OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / man / mann / tm.n
1 '\"
2 '\" Copyright (c) 2004-2010 Andreas Kupries <andreas_kupries@users.sourceforge.net>
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\" 
7 .TH tm n 8.5 Tcl "Tcl Built-In Commands"
8 .\" The -*- nroff -*- definitions below are for supplemental macros used
9 .\" in Tcl/Tk manual entries.
10 .\"
11 .\" .AP type name in/out ?indent?
12 .\"     Start paragraph describing an argument to a library procedure.
13 .\"     type is type of argument (int, etc.), in/out is either "in", "out",
14 .\"     or "in/out" to describe whether procedure reads or modifies arg,
15 .\"     and indent is equivalent to second arg of .IP (shouldn't ever be
16 .\"     needed;  use .AS below instead)
17 .\"
18 .\" .AS ?type? ?name?
19 .\"     Give maximum sizes of arguments for setting tab stops.  Type and
20 .\"     name are examples of largest possible arguments that will be passed
21 .\"     to .AP later.  If args are omitted, default tab stops are used.
22 .\"
23 .\" .BS
24 .\"     Start box enclosure.  From here until next .BE, everything will be
25 .\"     enclosed in one large box.
26 .\"
27 .\" .BE
28 .\"     End of box enclosure.
29 .\"
30 .\" .CS
31 .\"     Begin code excerpt.
32 .\"
33 .\" .CE
34 .\"     End code excerpt.
35 .\"
36 .\" .VS ?version? ?br?
37 .\"     Begin vertical sidebar, for use in marking newly-changed parts
38 .\"     of man pages.  The first argument is ignored and used for recording
39 .\"     the version when the .VS was added, so that the sidebars can be
40 .\"     found and removed when they reach a certain age.  If another argument
41 .\"     is present, then a line break is forced before starting the sidebar.
42 .\"
43 .\" .VE
44 .\"     End of vertical sidebar.
45 .\"
46 .\" .DS
47 .\"     Begin an indented unfilled display.
48 .\"
49 .\" .DE
50 .\"     End of indented unfilled display.
51 .\"
52 .\" .SO ?manpage?
53 .\"     Start of list of standard options for a Tk widget. The manpage
54 .\"     argument defines where to look up the standard options; if
55 .\"     omitted, defaults to "options". The options follow on successive
56 .\"     lines, in three columns separated by tabs.
57 .\"
58 .\" .SE
59 .\"     End of list of standard options for a Tk widget.
60 .\"
61 .\" .OP cmdName dbName dbClass
62 .\"     Start of description of a specific option.  cmdName gives the
63 .\"     option's name as specified in the class command, dbName gives
64 .\"     the option's name in the option database, and dbClass gives
65 .\"     the option's class in the option database.
66 .\"
67 .\" .UL arg1 arg2
68 .\"     Print arg1 underlined, then print arg2 normally.
69 .\"
70 .\" .QW arg1 ?arg2?
71 .\"     Print arg1 in quotes, then arg2 normally (for trailing punctuation).
72 .\"
73 .\" .PQ arg1 ?arg2?
74 .\"     Print an open parenthesis, arg1 in quotes, then arg2 normally
75 .\"     (for trailing punctuation) and then a closing parenthesis.
76 .\"
77 .\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
78 .if t .wh -1.3i ^B
79 .nr ^l \n(.l
80 .ad b
81 .\"     # Start an argument description
82 .de AP
83 .ie !"\\$4"" .TP \\$4
84 .el \{\
85 .   ie !"\\$2"" .TP \\n()Cu
86 .   el          .TP 15
87 .\}
88 .ta \\n()Au \\n()Bu
89 .ie !"\\$3"" \{\
90 \&\\$1 \\fI\\$2\\fP (\\$3)
91 .\".b
92 .\}
93 .el \{\
94 .br
95 .ie !"\\$2"" \{\
96 \&\\$1  \\fI\\$2\\fP
97 .\}
98 .el \{\
99 \&\\fI\\$1\\fP
100 .\}
101 .\}
102 ..
103 .\"     # define tabbing values for .AP
104 .de AS
105 .nr )A 10n
106 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
107 .nr )B \\n()Au+15n
108 .\"
109 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
110 .nr )C \\n()Bu+\\w'(in/out)'u+2n
111 ..
112 .AS Tcl_Interp Tcl_CreateInterp in/out
113 .\"     # BS - start boxed text
114 .\"     # ^y = starting y location
115 .\"     # ^b = 1
116 .de BS
117 .br
118 .mk ^y
119 .nr ^b 1u
120 .if n .nf
121 .if n .ti 0
122 .if n \l'\\n(.lu\(ul'
123 .if n .fi
124 ..
125 .\"     # BE - end boxed text (draw box now)
126 .de BE
127 .nf
128 .ti 0
129 .mk ^t
130 .ie n \l'\\n(^lu\(ul'
131 .el \{\
132 .\"     Draw four-sided box normally, but don't draw top of
133 .\"     box if the box started on an earlier page.
134 .ie !\\n(^b-1 \{\
135 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
136 .\}
137 .el \}\
138 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
139 .\}
140 .\}
141 .fi
142 .br
143 .nr ^b 0
144 ..
145 .\"     # VS - start vertical sidebar
146 .\"     # ^Y = starting y location
147 .\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
148 .de VS
149 .if !"\\$2"" .br
150 .mk ^Y
151 .ie n 'mc \s12\(br\s0
152 .el .nr ^v 1u
153 ..
154 .\"     # VE - end of vertical sidebar
155 .de VE
156 .ie n 'mc
157 .el \{\
158 .ev 2
159 .nf
160 .ti 0
161 .mk ^t
162 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
163 .sp -1
164 .fi
165 .ev
166 .\}
167 .nr ^v 0
168 ..
169 .\"     # Special macro to handle page bottom:  finish off current
170 .\"     # box/sidebar if in box/sidebar mode, then invoked standard
171 .\"     # page bottom macro.
172 .de ^B
173 .ev 2
174 'ti 0
175 'nf
176 .mk ^t
177 .if \\n(^b \{\
178 .\"     Draw three-sided box if this is the box's first page,
179 .\"     draw two sides but no top otherwise.
180 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
181 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
182 .\}
183 .if \\n(^v \{\
184 .nr ^x \\n(^tu+1v-\\n(^Yu
185 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
186 .\}
187 .bp
188 'fi
189 .ev
190 .if \\n(^b \{\
191 .mk ^y
192 .nr ^b 2
193 .\}
194 .if \\n(^v \{\
195 .mk ^Y
196 .\}
197 ..
198 .\"     # DS - begin display
199 .de DS
200 .RS
201 .nf
202 .sp
203 ..
204 .\"     # DE - end display
205 .de DE
206 .fi
207 .RE
208 .sp
209 ..
210 .\"     # SO - start of list of standard options
211 .de SO
212 'ie '\\$1'' .ds So \\fBoptions\\fR
213 'el .ds So \\fB\\$1\\fR
214 .SH "STANDARD OPTIONS"
215 .LP
216 .nf
217 .ta 5.5c 11c
218 .ft B
219 ..
220 .\"     # SE - end of list of standard options
221 .de SE
222 .fi
223 .ft R
224 .LP
225 See the \\*(So manual entry for details on the standard options.
226 ..
227 .\"     # OP - start of full description for a single option
228 .de OP
229 .LP
230 .nf
231 .ta 4c
232 Command-Line Name:      \\fB\\$1\\fR
233 Database Name:  \\fB\\$2\\fR
234 Database Class: \\fB\\$3\\fR
235 .fi
236 .IP
237 ..
238 .\"     # CS - begin code excerpt
239 .de CS
240 .RS
241 .nf
242 .ta .25i .5i .75i 1i
243 ..
244 .\"     # CE - end code excerpt
245 .de CE
246 .fi
247 .RE
248 ..
249 .\"     # UL - underline word
250 .de UL
251 \\$1\l'|0\(ul'\\$2
252 ..
253 .\"     # QW - apply quotation marks to word
254 .de QW
255 .ie '\\*(lq'"' ``\\$1''\\$2
256 .\"" fix emacs highlighting
257 .el \\*(lq\\$1\\*(rq\\$2
258 ..
259 .\"     # PQ - apply parens and quotation marks to word
260 .de PQ
261 .ie '\\*(lq'"' (``\\$1''\\$2)\\$3
262 .\"" fix emacs highlighting
263 .el (\\*(lq\\$1\\*(rq\\$2)\\$3
264 ..
265 .\"     # QR - quoted range
266 .de QR
267 .ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3
268 .\"" fix emacs highlighting
269 .el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3
270 ..
271 .\"     # MT - "empty" string
272 .de MT
273 .QW ""
274 ..
275 .BS
276 '\" Note:  do not modify the .SH NAME line immediately below!
277 .SH NAME
278 tm \- Facilities for locating and loading of Tcl Modules
279 .SH SYNOPSIS
280 .nf
281 \fB::tcl::tm::path add \fR?\fIpath\fR...?
282 \fB::tcl::tm::path remove \fR?\fIpath\fR...?
283 \fB::tcl::tm::path list\fR
284 \fB::tcl::tm::roots \fR?\fIpath\fR...?
285 .fi
286 .BE
287 .SH DESCRIPTION
288 .PP
289 This document describes the facilities for locating and loading Tcl
290 Modules (see \fBMODULE DEFINITION\fR for the definition of a Tcl Module).
291 The following commands are supported:
292 .TP
293 \fB::tcl::tm::path add \fR?\fIpath\fR...?
294 .
295 The paths are added at the head to the list of module paths, in order
296 of appearance. This means that the last argument ends up as the new
297 head of the list.
298 .RS
299 .PP
300 The command enforces the restriction that no path may be an ancestor
301 directory of any other path on the list. If any of the new paths
302 violates this restriction an error will be raised, before any of the
303 paths have been added. In other words, if only one path argument
304 violates the restriction then none will be added.
305 .PP
306 If a path is already present as is, no error will be raised and no
307 action will be taken.
308 .PP
309 Paths are searched later in the order of their appearance in the
310 list. As they are added to the front of the list they are searched in
311 reverse order of addition. In other words, the paths added last are
312 looked at first.
313 .RE
314 .TP
315 \fB::tcl::tm::path remove \fR?\fIpath\fR...?
316 .
317 Removes the paths from the list of module paths. The command silently
318 ignores all paths which are not on the list.
319 .TP
320 \fB::tcl::tm::path list\fR
321 .
322 Returns a list containing all registered module paths, in the order
323 that they are searched for modules.
324 .TP
325 \fB::tcl::tm::roots \fR?\fIpath\fR...?
326 .
327 Similar to \fBpath add\fR, and layered on top of it. This command
328 takes a list of paths, extends each with
329 .QW "\fBtcl\fIX\fB/site-tcl\fR" ,
330 and
331 .QW "\fBtcl\fIX\fB/\fIX\fB.\fIy\fR" ,
332 for major version \fIX\fR of the
333 Tcl interpreter and minor version \fIy\fR less than or equal to the
334 minor version of the interpreter, and adds the resulting set of paths
335 to the list of paths to search.
336 .RS
337 .PP
338 This command is used internally by the system to set up the
339 system-specific default paths.
340 .PP
341 The command has been exposed to allow a build system to define
342 additional root paths beyond those described by this document.
343 .RE
344 .SH "MODULE DEFINITION"
345 .PP
346 A Tcl Module is a Tcl Package contained in a single file, and no other
347 files required by it. This file has to be \fBsource\fRable. In other
348 words, a Tcl Module is always imported via:
349 .PP
350 .CS
351 source module_file
352 .CE
353 .PP
354 The \fBload\fR command is not directly used. This restriction is not
355 an actual limitation, as some may believe.
356 Ever since 8.4 the Tcl \fBsource\fR command reads only until the first
357 ^Z character. This allows us to combine an arbitrary Tcl script with
358 arbitrary binary data into one file, where the script processes the
359 attached data in any it chooses to fully import and activate the
360 package.
361 .PP
362 The name of a module file has to match the regular expression:
363 .PP
364 .CS
365 ([_[:alpha:]][:_[:alnum:]]*)-([[:digit:]].*)\e.tm
366 .CE
367 .PP
368 The first capturing parentheses provides the name of the package, the
369 second clause its version. In addition to matching the pattern, the
370 extracted version number must not raise an error when used in the
371 command:
372 .PP
373 .CS
374 package vcompare $version 0
375 .CE
376 .SH "FINDING MODULES"
377 .PP
378 The directory tree for storing Tcl modules is separate from other
379 parts of the filesystem and independent of \fBauto_path\fR.
380 .PP
381 Tcl Modules are searched for in all directories listed in the result
382 of the command \fB::tcl::tm::path list\fR.
383 This is called the \fIModule path\fR. Neither the \fBauto_path\fR nor
384 the \fBtcl_pkgPath\fR variables are used.
385 All directories on the module path have to obey one restriction:
386 .RS
387 .PP
388 For any two directories, neither is an ancestor directory of the
389 other.
390 .RE
391 .PP
392 This is required to avoid ambiguities in package naming. If for
393 example the two directories
394 .QW "\fIfoo/\fR"
395 and
396 .QW "\fIfoo/cool\fR"
397 were on
398 the path a package named \fBcool::ice\fR could be found via the
399 names \fBcool::ice\fR or \fBice\fR, the latter potentially
400 obscuring a package named \fBice\fR, unqualified.
401 .PP
402 Before the search is started, the name of the requested package is
403 translated into a partial path, using the following algorithm:
404 .RS
405 .PP
406 All occurrences of
407 .QW "\fB::\fR"
408 in the package name are replaced by
409 the appropriate directory separator character for the platform we are
410 on. On Unix, for example, this is
411 .QW "\fB/\fR" .
412 .RE
413 .PP
414 Example:
415 .RS
416 .PP
417 The requested package is \fBencoding::base64\fR. The generated
418 partial path is
419 .QW "\fIencoding/base64\fR" .
420 .RE
421 .PP
422 After this translation the package is looked for in all module paths,
423 by combining them one-by-one, first to last with the partial path to
424 form a complete search pattern. Note that the search algorithm rejects
425 all files where the filename does not match the regular expression
426 given in the section \fBMODULE DEFINITION\fR. For the remaining
427 files \fIprovide scripts\fR are generated and added to the package
428 ifneeded database.
429 .PP
430 The algorithm falls back to the previous unknown handler when none of
431 the found module files satisfy the request. If the request was
432 satisfied the fall-back is ignored.
433 .PP
434 Note that packages in module form have \fIno\fR control over the
435 \fIindex\fR and \fIprovide script\fRs entered into the package
436 database for them.
437 For a module file \fBMF\fR the \fIindex script\fR is always:
438 .PP
439 .CS
440 package ifneeded \fBPNAME PVERSION\fR [list source \fBMF\fR]
441 .CE
442 .PP
443 and the \fIprovide script\fR embedded in the above is:
444 .PP
445 .CS
446 source \fBMF\fR
447 .CE
448 .PP
449 Both package name \fBPNAME\fR and package version \fBPVERSION\fR are
450 extracted from the filename \fBMF\fR according to the definition
451 below:
452 .PP
453 .CS
454 \fBMF\fR = /module_path/\fBPNAME\(fm\fR-\fBPVERSION\fR.tm
455 .CE
456 .PP
457 Where \fBPNAME\(fm\fR is the partial path of the module as defined in
458 section \fBFINDING MODULES\fR, and translated into \fBPNAME\fR by
459 changing all directory separators to
460 .QW "\fB::\fR" ,
461 and \fBmodule_path\fR is the path (from the list of paths to search)
462 that we found the module file under.
463 .PP
464 Note also that we are here creating a connection between package names
465 and paths. Tcl is case-sensitive when it comes to comparing package
466 names, but there are filesystems which are not, like NTFS. Luckily
467 these filesystems do store the case of the name, despite not using the
468 information when comparing.
469 .PP
470 Given the above we allow the names for packages in Tcl modules to have
471 mixed-case, but also require that there are no collisions when
472 comparing names in a case-insensitive manner. In other words, if a
473 package \fBFoo\fR is deployed in the form of a Tcl Module,
474 packages like \fBfoo\fR, \fBfOo\fR, etc. are not allowed
475 anymore.
476 .SH "DEFAULT PATHS"
477 .PP
478 The default list of paths on the module path is computed by a
479 \fBtclsh\fR as follows, where \fIX\fR is the major version of the Tcl
480 interpreter and \fIy\fR is less than or equal to the minor version of
481 the Tcl interpreter.
482 .PP
483 All the default paths are added to the module path, even those paths
484 which do not exist. Non-existent paths are filtered out during actual
485 searches. This enables a user to create one of the paths searched when
486 needed and all running applications will automatically pick up any
487 modules placed in them.
488 .PP
489 The paths are added in the order as they are listed below, and for
490 lists of paths defined by an environment variable in the order they
491 are found in the variable.
492 .SS "SYSTEM SPECIFIC PATHS"
493 .TP
494 \fBfile normalize [info library]/../tcl\fIX\fB/\fIX\fB.\fIy\fR
495 .
496 In other words, the interpreter will look into a directory specified
497 by its major version and whose minor versions are less than or equal
498 to the minor version of the interpreter.
499 .RS
500 .PP
501 For example for Tcl 8.4 the paths searched are:
502 .PP
503 .CS
504 \fB[info library]/../tcl8/8.4\fR
505 \fB[info library]/../tcl8/8.3\fR
506 \fB[info library]/../tcl8/8.2\fR
507 \fB[info library]/../tcl8/8.1\fR
508 \fB[info library]/../tcl8/8.0\fR
509 .CE
510 .PP
511 This definition assumes that a package defined for Tcl \fIX\fB.\fIy\fR
512 can also be used by all interpreters which have the same major number
513 \fIX\fR and a minor number greater than \fIy\fR.
514 .RE
515 .TP
516 \fBfile normalize EXEC/tcl\fIX\fB/\fIX\fB.\fIy\fR
517 .
518 Where \fBEXEC\fR is \fBfile normalize [info nameofexecutable]/../lib\fR
519 or \fBfile normalize [::tcl::pkgconfig get libdir,runtime]\fR
520 .RS
521 .PP
522 This sets of paths is handled equivalently to the set coming before,
523 except that it is anchored in \fBEXEC_PREFIX\fR.
524 For a build with \fBPREFIX\fR = \fBEXEC_PREFIX\fR the two sets are
525 identical.
526 .RE
527 .SS "SITE SPECIFIC PATHS"
528 .TP
529 \fBfile normalize [info library]/../tcl\fIX\fB/site-tcl\fR
530 .
531 Note that this is always a single entry because \fIX\fR is always a
532 specific value (the current major version of Tcl).
533 .SS "USER SPECIFIC PATHS"
534 .TP
535 \fB$::env(TCL\fIX\fB_\fIy\fB_TM_PATH)\fR
536 .
537 A list of paths, separated by either \fB:\fR (Unix) or \fB;\fR
538 (Windows). This is user and site specific as this environment variable
539 can be set not only by the user's profile, but by system configuration
540 scripts as well.
541 .TP
542 \fB$::env(TCL\fIX\fB.\fIy\fB_TM_PATH)\fR
543 .
544 Same meaning and content as the previous variable. However the use of
545 dot '.' to separate major and minor version number makes this name
546 less to non-portable and its use is discouraged. Support of this
547 variable has been kept only for backward compatibility with the
548 original specification, i.e. TIP 189.
549 .PP
550 These paths are seen and therefore shared by all Tcl shells in the
551 \fB$::env(PATH)\fR of the user.
552 .PP
553 Note that \fIX\fR and \fIy\fR follow the general rules set out
554 above. In other words, Tcl 8.4, for example, will look at these 10
555 environment variables:
556 .PP
557 .CS
558 \fB$::env(TCL8.4_TM_PATH)\fR  \fB$::env(TCL8_4_TM_PATH)\fR
559 \fB$::env(TCL8.3_TM_PATH)\fR  \fB$::env(TCL8_3_TM_PATH)\fR
560 \fB$::env(TCL8.2_TM_PATH)\fR  \fB$::env(TCL8_2_TM_PATH)\fR
561 \fB$::env(TCL8.1_TM_PATH)\fR  \fB$::env(TCL8_1_TM_PATH)\fR
562 \fB$::env(TCL8.0_TM_PATH)\fR  \fB$::env(TCL8_0_TM_PATH)\fR
563 .CE
564 .SH "SEE ALSO"
565 package(n), Tcl Improvement Proposal #189
566 .QW "\fITcl Modules\fR"
567 (online at http://tip.tcl.tk/189.html), Tcl Improvement Proposal #190
568 .QW "\fIImplementation Choices for Tcl Modules\fR"
569 (online at http://tip.tcl.tk/190.html)
570 .SH "KEYWORDS"
571 modules, package
572 .\" Local Variables:
573 .\" mode: nroff
574 .\" End: