Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / man / mann / tcl_wordBreakAfter.n
CommitLineData
920dae64
AT
1'\"
2'\" Copyright (c) 1991-1993 The Regents of the University of California.
3'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4'\"
5'\" See the file "license.terms" for information on usage and redistribution
6'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7'\"
8'\" RCS: @(#) $Id: library.n,v 1.16 2001/08/24 06:03:15 dgp Exp $
9'\" The definitions below are for supplemental macros used in Tcl/Tk
10'\" manual entries.
11'\"
12'\" .AP type name in/out ?indent?
13'\" Start paragraph describing an argument to a library procedure.
14'\" type is type of argument (int, etc.), in/out is either "in", "out",
15'\" or "in/out" to describe whether procedure reads or modifies arg,
16'\" and indent is equivalent to second arg of .IP (shouldn't ever be
17'\" needed; use .AS below instead)
18'\"
19'\" .AS ?type? ?name?
20'\" Give maximum sizes of arguments for setting tab stops. Type and
21'\" name are examples of largest possible arguments that will be passed
22'\" to .AP later. If args are omitted, default tab stops are used.
23'\"
24'\" .BS
25'\" Start box enclosure. From here until next .BE, everything will be
26'\" enclosed in one large box.
27'\"
28'\" .BE
29'\" End of box enclosure.
30'\"
31'\" .CS
32'\" Begin code excerpt.
33'\"
34'\" .CE
35'\" End code excerpt.
36'\"
37'\" .VS ?version? ?br?
38'\" Begin vertical sidebar, for use in marking newly-changed parts
39'\" of man pages. The first argument is ignored and used for recording
40'\" the version when the .VS was added, so that the sidebars can be
41'\" found and removed when they reach a certain age. If another argument
42'\" is present, then a line break is forced before starting the sidebar.
43'\"
44'\" .VE
45'\" End of vertical sidebar.
46'\"
47'\" .DS
48'\" Begin an indented unfilled display.
49'\"
50'\" .DE
51'\" End of indented unfilled display.
52'\"
53'\" .SO
54'\" Start of list of standard options for a Tk widget. The
55'\" options follow on successive lines, in four columns separated
56'\" 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'\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $
71'\"
72'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
73.if t .wh -1.3i ^B
74.nr ^l \n(.l
75.ad b
76'\" # Start an argument description
77.de AP
78.ie !"\\$4"" .TP \\$4
79.el \{\
80. ie !"\\$2"" .TP \\n()Cu
81. el .TP 15
82.\}
83.ta \\n()Au \\n()Bu
84.ie !"\\$3"" \{\
85\&\\$1 \\fI\\$2\\fP (\\$3)
86.\".b
87.\}
88.el \{\
89.br
90.ie !"\\$2"" \{\
91\&\\$1 \\fI\\$2\\fP
92.\}
93.el \{\
94\&\\fI\\$1\\fP
95.\}
96.\}
97..
98'\" # define tabbing values for .AP
99.de AS
100.nr )A 10n
101.if !"\\$1"" .nr )A \\w'\\$1'u+3n
102.nr )B \\n()Au+15n
103.\"
104.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
105.nr )C \\n()Bu+\\w'(in/out)'u+2n
106..
107.AS Tcl_Interp Tcl_CreateInterp in/out
108'\" # BS - start boxed text
109'\" # ^y = starting y location
110'\" # ^b = 1
111.de BS
112.br
113.mk ^y
114.nr ^b 1u
115.if n .nf
116.if n .ti 0
117.if n \l'\\n(.lu\(ul'
118.if n .fi
119..
120'\" # BE - end boxed text (draw box now)
121.de BE
122.nf
123.ti 0
124.mk ^t
125.ie n \l'\\n(^lu\(ul'
126.el \{\
127.\" Draw four-sided box normally, but don't draw top of
128.\" box if the box started on an earlier page.
129.ie !\\n(^b-1 \{\
130\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
131.\}
132.el \}\
133\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
134.\}
135.\}
136.fi
137.br
138.nr ^b 0
139..
140'\" # VS - start vertical sidebar
141'\" # ^Y = starting y location
142'\" # ^v = 1 (for troff; for nroff this doesn't matter)
143.de VS
144.if !"\\$2"" .br
145.mk ^Y
146.ie n 'mc \s12\(br\s0
147.el .nr ^v 1u
148..
149'\" # VE - end of vertical sidebar
150.de VE
151.ie n 'mc
152.el \{\
153.ev 2
154.nf
155.ti 0
156.mk ^t
157\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
158.sp -1
159.fi
160.ev
161.\}
162.nr ^v 0
163..
164'\" # Special macro to handle page bottom: finish off current
165'\" # box/sidebar if in box/sidebar mode, then invoked standard
166'\" # page bottom macro.
167.de ^B
168.ev 2
169'ti 0
170'nf
171.mk ^t
172.if \\n(^b \{\
173.\" Draw three-sided box if this is the box's first page,
174.\" draw two sides but no top otherwise.
175.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
176.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
177.\}
178.if \\n(^v \{\
179.nr ^x \\n(^tu+1v-\\n(^Yu
180\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
181.\}
182.bp
183'fi
184.ev
185.if \\n(^b \{\
186.mk ^y
187.nr ^b 2
188.\}
189.if \\n(^v \{\
190.mk ^Y
191.\}
192..
193'\" # DS - begin display
194.de DS
195.RS
196.nf
197.sp
198..
199'\" # DE - end display
200.de DE
201.fi
202.RE
203.sp
204..
205'\" # SO - start of list of standard options
206.de SO
207.SH "STANDARD OPTIONS"
208.LP
209.nf
210.ta 5.5c 11c
211.ft B
212..
213'\" # SE - end of list of standard options
214.de SE
215.fi
216.ft R
217.LP
218See the \\fBoptions\\fR manual entry for details on the standard options.
219..
220'\" # OP - start of full description for a single option
221.de OP
222.LP
223.nf
224.ta 4c
225Command-Line Name: \\fB\\$1\\fR
226Database Name: \\fB\\$2\\fR
227Database Class: \\fB\\$3\\fR
228.fi
229.IP
230..
231'\" # CS - begin code excerpt
232.de CS
233.RS
234.nf
235.ta .25i .5i .75i 1i
236..
237'\" # CE - end code excerpt
238.de CE
239.fi
240.RE
241..
242.de UL
243\\$1\l'|0\(ul'\\$2
244..
245.TH library n "8.0" Tcl "Tcl Built-In Commands"
246.BS
247.SH NAME
248auto_execok, auto_import, auto_load, auto_mkindex, auto_mkindex_old, auto_qualify, auto_reset, tcl_findLibrary, parray, tcl_endOfWord, tcl_startOfNextWord, tcl_startOfPreviousWord, tcl_wordBreakAfter, tcl_wordBreakBefore \- standard library of Tcl procedures
249.SH SYNOPSIS
250.nf
251\fBauto_execok \fIcmd\fR
252\fBauto_import \fIpattern\fR
253\fBauto_load \fIcmd\fR
254\fBauto_mkindex \fIdir pattern pattern ...\fR
255\fBauto_mkindex_old \fIdir pattern pattern ...\fR
256\fBauto_qualify \fIcommand namespace\fR
257\fBauto_reset\fR
258\fBtcl_findLibrary \fIbasename version patch initScript enVarName varName\fR
259\fBparray \fIarrayName\fR
260.VS
261\fBtcl_endOfWord \fIstr start\fR
262\fBtcl_startOfNextWord \fIstr start\fR
263\fBtcl_startOfPreviousWord \fIstr start\fR
264\fBtcl_wordBreakAfter \fIstr start\fR
265\fBtcl_wordBreakBefore \fIstr start\fR
266.VE
267.BE
268
269.SH INTRODUCTION
270.PP
271Tcl includes a library of Tcl procedures for commonly-needed functions.
272The procedures defined in the Tcl library are generic ones suitable
273for use by many different applications.
274The location of the Tcl library is returned by the \fBinfo library\fR
275command.
276In addition to the Tcl library, each application will normally have
277its own library of support procedures as well; the location of this
278library is normally given by the value of the \fB$\fIapp\fB_library\fR
279global variable, where \fIapp\fR is the name of the application.
280For example, the location of the Tk library is kept in the variable
281\fB$tk_library\fR.
282.PP
283To access the procedures in the Tcl library, an application should
284source the file \fBinit.tcl\fR in the library, for example with
285the Tcl command
286.CS
287\fBsource [file join [info library] init.tcl]\fR
288.CE
289If the library procedure \fBTcl_Init\fR is invoked from an application's
290\fBTcl_AppInit\fR procedure, this happens automatically.
291The code in \fBinit.tcl\fR will define the \fBunknown\fR procedure
292and arrange for the other procedures to be loaded on-demand using
293the auto-load mechanism defined below.
294
295.SH "COMMAND PROCEDURES"
296.PP
297The following procedures are provided in the Tcl library:
298.TP
299\fBauto_execok \fIcmd\fR
300Determines whether there is an executable file or shell builtin
301by the name \fIcmd\fR. If so, it returns a list of arguments to be
302passed to \fBexec\fR to execute the executable file or shell builtin
303named by \fIcmd\fR. If not, it returns an empty string. This command
304examines the directories in the current search path (given by the PATH
305environment variable) in its search for an executable file named
306\fIcmd\fR. On Windows platforms, the search is expanded with the same
307directories and file extensions as used by \fBexec\fR. \fBAuto_exec\fR
308remembers information about previous searches in an array named
309\fBauto_execs\fR; this avoids the path search in future calls for the
310same \fIcmd\fR. The command \fBauto_reset\fR may be used to force
311\fBauto_execok\fR to forget its cached information.
312.TP
313\fBauto_import \fIpattern\fR
314\fBAuto_import\fR is invoked during \fBnamespace import\fR to see if
315the imported commands specified by \fIpattern\fR reside in an
316autoloaded library. If so, the commands are loaded so that they will
317be available to the interpreter for creating the import links. If the
318commands do not reside in an autoloaded library, \fBauto_import\fR
319does nothing. The pattern matching is performed according to the
320matching rules of \fBnamespace import\fR.
321.TP
322\fBauto_load \fIcmd\fR
323This command attempts to load the definition for a Tcl command named
324\fIcmd\fR. To do this, it searches an \fIauto-load path\fR, which is
325a list of one or more directories. The auto-load path is given by the
326global variable \fB$auto_path\fR if it exists. If there is no
327\fB$auto_path\fR variable, then the TCLLIBPATH environment variable is
328used, if it exists. Otherwise the auto-load path consists of just the
329Tcl library directory. Within each directory in the auto-load path
330there must be a file \fBtclIndex\fR that describes one or more
331commands defined in that directory and a script to evaluate to load
332each of the commands. The \fBtclIndex\fR file should be generated
333with the \fBauto_mkindex\fR command. If \fIcmd\fR is found in an
334index file, then the appropriate script is evaluated to create the
335command. The \fBauto_load\fR command returns 1 if \fIcmd\fR was
336successfully created. The command returns 0 if there was no index
337entry for \fIcmd\fR or if the script didn't actually define \fIcmd\fR
338(e.g. because index information is out of date). If an error occurs
339while processing the script, then that error is returned.
340\fBAuto_load\fR only reads the index information once and saves it in
341the array \fBauto_index\fR; future calls to \fBauto_load\fR check for
342\fIcmd\fR in the array rather than re-reading the index files. The
343cached index information may be deleted with the command
344\fBauto_reset\fR. This will force the next \fBauto_load\fR command to
345reload the index database from disk.
346.TP
347\fBauto_mkindex \fIdir pattern pattern ...\fR
348Generates an index suitable for use by \fBauto_load\fR. The command
349searches \fIdir\fR for all files whose names match any of the
350\fIpattern\fR arguments (matching is done with the \fBglob\fR
351command), generates an index of all the Tcl command procedures defined
352in all the matching files, and stores the index information in a file
353named \fBtclIndex\fR in \fIdir\fR. If no pattern is given a pattern of
354\fB*.tcl\fR will be assumed. For example, the command
355.RS
356.CS
357\fBauto_mkindex foo *.tcl\fR
358.CE
359.LP
360will read all the \fB.tcl\fR files in subdirectory \fBfoo\fR and
361generate a new index file \fBfoo/tclIndex\fR.
362.PP
363\fBAuto_mkindex\fR parses the Tcl scripts by sourcing them into a
364slave interpreter and monitoring the proc and namespace commands that
365are executed. Extensions can use the (undocumented)
366auto_mkindex_parser package to register other commands that can
367contribute to the auto_load index. You will have to read through
368auto.tcl to see how this works.
369.PP
370\fBAuto_mkindex_old\fR parses the Tcl scripts in a relatively
371unsophisticated way: if any line contains the word \fBproc\fR
372as its first characters then it is assumed to be a procedure
373definition and the next word of the line is taken as the
374procedure's name.
375Procedure definitions that don't appear in this way (e.g. they
376have spaces before the \fBproc\fR) will not be indexed. If your
377script contains "dangerous" code, such as global initialization
378code or procedure names with special characters like \fB$\fR,
379\fB*\fR, \fB[\fR or \fB]\fR, you are safer using auto_mkindex_old.
380.RE
381.TP
382\fBauto_reset\fR
383Destroys all the information cached by \fBauto_execok\fR and
384\fBauto_load\fR. This information will be re-read from disk the next
385time it is needed. \fBAuto_reset\fR also deletes any procedures
386listed in the auto-load index, so that fresh copies of them will be
387loaded the next time that they're used.
388.TP
389\fBauto_qualify \fIcommand namespace\fR
390Computes a list of fully qualified names for \fIcommand\fR. This list
391mirrors the path a standard Tcl interpreter follows for command
392lookups: first it looks for the command in the current namespace, and
393then in the global namespace. Accordingly, if \fIcommand\fR is
394relative and \fInamespace\fR is not \fB::\fR, the list returned has
395two elements: \fIcommand\fR scoped by \fInamespace\fR, as if it were
396a command in the \fInamespace\fR namespace; and \fIcommand\fR as if it
397were a command in the global namespace. Otherwise, if either
398\fIcommand\fR is absolute (it begins with \fB::\fR), or
399\fInamespace\fR is \fB::\fR, the list contains only \fIcommand\fR as
400if it were a command in the global namespace.
401.RS
402.PP
403\fBAuto_qualify\fR is used by the auto-loading facilities in Tcl, both
404for producing auto-loading indexes such as \fIpkgIndex.tcl\fR, and for
405performing the actual auto-loading of functions at runtime.
406.RE
407.TP
408\fBtcl_findLibrary \fIbasename version patch initScript enVarName varName\fR
409This is a standard search procedure for use by extensions during
410their initialization. They call this procedure to look for their
411script library in several standard directories.
412The last component of the name of the library directory is
413normally \fIbasenameversion\fP
414(e.g., tk8.0), but it might be "library" when in the build hierarchies.
415The \fIinitScript\fR file will be sourced into the interpreter
416once it is found. The directory in which this file is found is
417stored into the global variable \fIvarName\fP.
418If this variable is already defined (e.g., by C code during
419application initialization) then no searching is done.
420Otherwise the search looks in these directories:
421the directory named by the environment variable \fIenVarName\fP;
422relative to the Tcl library directory;
423relative to the executable file in the standard installation
424bin or bin/\fIarch\fP directory;
425relative to the executable file in the current build tree;
426relative to the executable file in a parallel build tree.
427.TP
428\fBparray \fIarrayName\fR
429Prints on standard output the names and values of all the elements
430in the array \fIarrayName\fR.
431\fBArrayName\fR must be an array accessible to the caller of \fBparray\fR.
432It may be either local or global.
433.TP
434\fBtcl_endOfWord \fIstr start\fR
435.VS
436Returns the index of the first end-of-word location that occurs after
437a starting index \fIstart\fR in the string \fIstr\fR. An end-of-word
438location is defined to be the first non-word character following the
439first word character after the starting point. Returns -1 if there
440are no more end-of-word locations after the starting point. See the
441description of \fBtcl_wordchars\fR and \fBtcl_nonwordchars\fR below
442for more details on how Tcl determines which characters are word
443characters.
444.TP
445\fBtcl_startOfNextWord \fIstr start\fR
446Returns the index of the first start-of-word location that occurs
447after a starting index \fIstart\fR in the string \fIstr\fR. A
448start-of-word location is defined to be the first word character
449following a non-word character. Returns \-1 if there are no more
450start-of-word locations after the starting point.
451.TP
452\fBtcl_startOfPreviousWord \fIstr start\fR
453Returns the index of the first start-of-word location that occurs
454before a starting index \fIstart\fR in the string \fIstr\fR. Returns
455\-1 if there are no more start-of-word locations before the starting
456point.
457.TP
458\fBtcl_wordBreakAfter \fIstr start\fR
459Returns the index of the first word boundary after the starting index
460\fIstart\fR in the string \fIstr\fR. Returns \-1 if there are no more
461boundaries after the starting point in the given string. The index
462returned refers to the second character of the pair that comprises a
463boundary.
464.TP
465\fBtcl_wordBreakBefore \fIstr start\fR
466Returns the index of the first word boundary before the starting index
467\fIstart\fR in the string \fIstr\fR. Returns \-1 if there are no more
468boundaries before the starting point in the given string. The index
469returned refers to the second character of the pair that comprises a
470boundary.
471.VE
472
473.SH "VARIABLES"
474.PP
475The following global variables are defined or used by the procedures in
476the Tcl library:
477.TP
478\fBauto_execs\fR
479Used by \fBauto_execok\fR to record information about whether
480particular commands exist as executable files.
481.TP
482\fBauto_index\fR
483Used by \fBauto_load\fR to save the index information read from
484disk.
485.TP
486\fBauto_noexec\fR
487If set to any value, then \fBunknown\fR will not attempt to auto-exec
488any commands.
489.TP
490\fBauto_noload\fR
491If set to any value, then \fBunknown\fR will not attempt to auto-load
492any commands.
493.TP
494\fBauto_path\fR
495If set, then it must contain a valid Tcl list giving directories to
496search during auto-load operations.
497This variable is initialized during startup to contain, in order:
498the directories listed in the TCLLIBPATH environment variable,
499the directory named by the $tcl_library variable,
500the parent directory of $tcl_library,
501the directories listed in the $tcl_pkgPath variable.
502.TP
503\fBenv(TCL_LIBRARY)\fR
504If set, then it specifies the location of the directory containing
505library scripts (the value of this variable will be
506assigned to the \fBtcl_library\fR variable and therefore returned by
507the command \fBinfo library\fR). If this variable isn't set then
508a default value is used.
509.TP
510\fBenv(TCLLIBPATH)\fR
511If set, then it must contain a valid Tcl list giving directories to
512search during auto-load operations. Directories must be specified in
513Tcl format, using "/" as the path separator, regardless of platform.
514This variable is only used when initializing the \fBauto_path\fR variable.
515.TP
516\fBtcl_nonwordchars\fR
517.VS
518This variable contains a regular expression that is used by routines
519like \fBtcl_endOfWord\fR to identify whether a character is part of a
520word or not. If the pattern matches a character, the character is
521considered to be a non-word character. On Windows platforms, spaces,
522tabs, and newlines are considered non-word characters. Under Unix,
523everything but numbers, letters and underscores are considered
524non-word characters.
525.TP
526\fBtcl_wordchars\fR
527This variable contains a regular expression that is used by routines
528like \fBtcl_endOfWord\fR to identify whether a character is part of a
529word or not. If the pattern matches a character, the character is
530considered to be a word character. On Windows platforms, words are
531comprised of any character that is not a space, tab, or newline. Under
532Unix, words are comprised of numbers, letters or underscores.
533.VE
534.TP
535\fBunknown_pending\fR
536Used by \fBunknown\fR to record the command(s) for which it is
537searching.
538It is used to detect errors where \fBunknown\fR recurses on itself
539infinitely.
540The variable is unset before \fBunknown\fR returns.
541
542.SH "SEE ALSO"
543info(n), re_syntax(n)
544
545.SH KEYWORDS
546auto-exec, auto-load, library, unknown, word, whitespace