home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume25 / tcl / part06 < prev    next >
Encoding:
Text File  |  1991-11-14  |  48.8 KB  |  1,641 lines

  1. Newsgroups: comp.sources.misc
  2. From: karl@sugar.neosoft.com (Karl Lehenbauer)
  3. Subject:  v25i074:  tcl - tool command language, version 6.1, Part06/33
  4. Message-ID: <1991Nov14.202736.23527@sparky.imd.sterling.com>
  5. X-Md4-Signature: f8f861ad2561cc4aa548718f616aed14
  6. Date: Thu, 14 Nov 1991 20:27:36 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
  10. Posting-number: Volume 25, Issue 74
  11. Archive-name: tcl/part06
  12. Environment: UNIX
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then unpack
  16. # it by saving it into a file and typing "sh file".  To overwrite existing
  17. # files, type "sh file -c".  You can also feed this as standard input via
  18. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  19. # will see the following message at the end:
  20. #        "End of archive 6 (of 33)."
  21. # Contents:  tcl6.1/doc/AddErrInfo.man tcl6.1/doc/CrtCommand.man
  22. #   tcl6.1/doc/CrtTrace.man tcl6.1/doc/Fork.man
  23. #   tcl6.1/doc/SplitList.man
  24. # Wrapped by karl@one on Tue Nov 12 19:44:15 1991
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'tcl6.1/doc/AddErrInfo.man' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'tcl6.1/doc/AddErrInfo.man'\"
  28. else
  29. echo shar: Extracting \"'tcl6.1/doc/AddErrInfo.man'\" \(8975 characters\)
  30. sed "s/^X//" >'tcl6.1/doc/AddErrInfo.man' <<'END_OF_FILE'
  31. X'\" Copyright 1989 Regents of the University of California
  32. X'\" Permission to use, copy, modify, and distribute this
  33. X'\" documentation for any purpose and without fee is hereby
  34. X'\" granted, provided that this notice appears in all copies.
  35. X'\" The University of California makes no representations about
  36. X'\" the suitability of this material for any purpose.  It is
  37. X'\" provided "as is" without express or implied warranty.
  38. X'\" 
  39. X'\" $Header: /user6/ouster/tcl/doc/RCS/AddErrInfo.man,v 1.6 91/08/20 09:47:45 ouster Exp $ SPRITE (Berkeley)
  40. X'\" 
  41. X.\" The definitions below are for supplemental macros used in Sprite
  42. X.\" manual entries.
  43. X.\"
  44. X.\" .HS name section [date [version]]
  45. X.\"    Replacement for .TH in other man pages.  See below for valid
  46. X.\"    section names.
  47. X.\"
  48. X.\" .AP type name in/out [indent]
  49. X.\"    Start paragraph describing an argument to a library procedure.
  50. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  51. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  52. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  53. X.\"    needed;  use .AS below instead)
  54. X.\"
  55. X.\" .AS [type [name]]
  56. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  57. X.\"    name are examples of largest possible arguments that will be passed
  58. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  59. X.\"
  60. X.\" .BS
  61. X.\"    Start box enclosure.  From here until next .BE, everything will be
  62. X.\"    enclosed in one large box.
  63. X.\"
  64. X.\" .BE
  65. X.\"    End of box enclosure.
  66. X.\"
  67. X.\" .VS
  68. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  69. X.\"    of man pages.
  70. X.\"
  71. X.\" .VE
  72. X.\"    End of vertical sidebar.
  73. X.\"
  74. X.\" .DS
  75. X.\"    Begin an indented unfilled display.
  76. X.\"
  77. X.\" .DE
  78. X.\"    End of indented unfilled display.
  79. X.\"
  80. X'    # Heading for Sprite man pages
  81. X.de HS
  82. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  83. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  84. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  85. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  86. X.if t .wh -1.3i ^B
  87. X.nr ^l \\n(.l
  88. X.ad b
  89. X..
  90. X'    # Start an argument description
  91. X.de AP
  92. X.ie !"\\$4"" .TP \\$4
  93. X.el \{\
  94. X.   ie !"\\$2"" .TP \\n()Cu
  95. X.   el          .TP 15
  96. X.\}
  97. X.ie !"\\$3"" \{\
  98. X.ta \\n()Au \\n()Bu
  99. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  100. X.\".b
  101. X.\}
  102. X.el \{\
  103. X.br
  104. X.ie !"\\$2"" \{\
  105. X\&\\$1    \\fI\\$2\\fP
  106. X.\}
  107. X.el \{\
  108. X\&\\fI\\$1\\fP
  109. X.\}
  110. X.\}
  111. X..
  112. X'    # define tabbing values for .AP
  113. X.de AS
  114. X.nr )A 10n
  115. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  116. X.nr )B \\n()Au+15n
  117. X.\"
  118. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  119. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  120. X..
  121. X'    # BS - start boxed text
  122. X'    # ^y = starting y location
  123. X'    # ^b = 1
  124. X.de BS
  125. X.br
  126. X.mk ^y
  127. X.nr ^b 1u
  128. X.if n .nf
  129. X.if n .ti 0
  130. X.if n \l'\\n(.lu\(ul'
  131. X.if n .fi
  132. X..
  133. X'    # BE - end boxed text (draw box now)
  134. X.de BE
  135. X.nf
  136. X.ti 0
  137. X.mk ^t
  138. X.ie n \l'\\n(^lu\(ul'
  139. X.el \{\
  140. X.\"    Draw four-sided box normally, but don't draw top of
  141. X.\"    box if the box started on an earlier page.
  142. X.ie !\\n(^b-1 \{\
  143. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  144. X.\}
  145. X.el \}\
  146. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  147. X.\}
  148. X.\}
  149. X.fi
  150. X.br
  151. X.nr ^b 0
  152. X..
  153. X'    # VS - start vertical sidebar
  154. X'    # ^Y = starting y location
  155. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  156. X.de VS
  157. X.mk ^Y
  158. X.ie n 'mc \s12\(br\s0
  159. X.el .nr ^v 1u
  160. X..
  161. X'    # VE - end of vertical sidebar
  162. X.de VE
  163. X.ie n 'mc
  164. X.el \{\
  165. X.ev 2
  166. X.nf
  167. X.ti 0
  168. X.mk ^t
  169. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  170. X.sp -1
  171. X.fi
  172. X.ev
  173. X.\}
  174. X.nr ^v 0
  175. X..
  176. X'    # Special macro to handle page bottom:  finish off current
  177. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  178. X'    # page bottom macro.
  179. X.de ^B
  180. X.ev 2
  181. X'ti 0
  182. X'nf
  183. X.mk ^t
  184. X.if \\n(^b \{\
  185. X.\"    Draw three-sided box if this is the box's first page,
  186. X.\"    draw two sides but no top otherwise.
  187. X.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  188. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  189. X.\}
  190. X.if \\n(^v \{\
  191. X.nr ^x \\n(^tu+1v-\\n(^Yu
  192. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  193. X.\}
  194. X.bp
  195. X'fi
  196. X.ev
  197. X.if \\n(^b \{\
  198. X.mk ^y
  199. X.nr ^b 2
  200. X.\}
  201. X.if \\n(^v \{\
  202. X.mk ^Y
  203. X.\}
  204. X..
  205. X'    # DS - begin display
  206. X.de DS
  207. X.RS
  208. X.nf
  209. X.sp
  210. X..
  211. X'    # DE - end display
  212. X.de DE
  213. X.fi
  214. X.RE
  215. X.sp .5
  216. X..
  217. X.HS Tcl_AddErrorInfo tcl
  218. X.BS
  219. X.SH NAME
  220. XTcl_AddErrorInfo, Tcl_SetErrorCode, Tcl_UnixError, Tcl_CheckStatus \- record information about errors
  221. X.SH SYNOPSIS
  222. X.nf
  223. X\fB#include <tcl.h>\fR
  224. X.sp
  225. Xchar *
  226. X\fBTcl_AddErrorInfo\fR(\fIinterp, message\fR)
  227. X.sp
  228. X.VS
  229. Xvoid
  230. X\fBTcl_SetErrorCode\fR(\fIinterp, element, element, ...\fR)
  231. X.sp
  232. Xchar
  233. X\fBTcl_UnixError\fR(\fIinterp\fR)
  234. X.VE
  235. X.SH ARGUMENTS
  236. X.AS Tcl_Interp *interp
  237. X.AP Tcl_Interp *interp in
  238. XInterpreter in which to record information.
  239. X.AP char *message in
  240. XIdentifying string to record in \fBerrorInfo\fR variable.
  241. X.AP char *element in
  242. X.VS
  243. XString to record as one element of \fBerrorCode\fR variable.
  244. XLast \fIelement\fR argument must be NULL.
  245. X.VE
  246. X.BE
  247. X
  248. X.SH DESCRIPTION
  249. X.PP
  250. X.VS
  251. XThese procedures are used to manipulate two global variables
  252. Xthat hold information about errors.
  253. XThe variable \fBerrorInfo\fR holds a stack trace of the
  254. Xoperations that were in progress when an error occurred, and
  255. Xis intended to be human-readable.
  256. XThe variable \fBerrorCode\fR holds a list of items that
  257. Xare intended to be machine-readable.
  258. XThe first item in \fBerrorCode\fR identifies the class of
  259. Xerror that occurred (e.g. UNIX means an error occurred in
  260. Xa Unix system call) and additional elements in \fBerrorCode\fR
  261. Xhold additional pieces of information that depend on the class.
  262. XSee the Tcl overview manual entry for details on the various
  263. Xformats for \fBerrorCode\fR.
  264. X.PP
  265. XThe \fBerrorInfo\fR variable is gradually built up as an
  266. Xerror unwinds through the nested operations.
  267. XEach time an error code is returned to \fBTcl_Eval\fR
  268. Xit calls the procedure \fBTcl_AddErrorInfo\fR to add
  269. Xadditional text to \fBerrorInfo\fR describing the
  270. Xcommand that was being executed when the error occurred.
  271. XBy the time the error has been passed all the way back
  272. Xto the application, it will contain a complete trace
  273. Xof the activity in progress when the error occurred.
  274. X.PP
  275. XIt is sometimes useful to add additional information to
  276. X\fBerrorInfo\fR beyond what can be supplied automatically
  277. Xby \fBTcl_Eval\fR.
  278. X\fBTcl_AddErrorInfo\fR may be used for this purpose:
  279. Xits \fImessage\fR argument contains an additional
  280. Xstring to be appended to \fBerrorInfo\fR.
  281. XFor example, the \fBsource\fR command calls \fBTcl_AddErrorInfo\fR
  282. Xto record the name of the file being processed and the
  283. Xline number on which the error occurred;  for Tcl procedures, the
  284. Xprocedure name and line number within the procedure are recorded,
  285. Xand so on.
  286. XThe best time to call \fBTcl_AddErrorInfo\fR is just after
  287. X\fBTcl_Eval\fR has returned \fBTCL_ERROR\fR.
  288. XIn calling \fBTcl_AddErrorInfo\fR, you may find it useful to
  289. Xuse the \fBerrorLine\fR field of the interpreter (see the
  290. X\fBTcl_Interp\fR manual entry for details).
  291. X.PP
  292. XThe procedure \fBTcl_SetErrorCode\fR is used to set the
  293. X\fBerrorCode\fR variable.
  294. XIts \fIelement\fR arguments give one or more strings to record
  295. Xin \fBerrorCode\fR:  each \fIelement\fR will become one item
  296. Xof a properly-formed Tcl list stored in \fBerrorCode\fR.
  297. X\fBTcl_SetErrorCode\fR is typically invoked just before returning
  298. Xan error.
  299. XIf an error is returned without calling \fBTcl_SetErrorCode\fR
  300. Xthen the Tcl interpreter automatically sets \fBerrorCode\fR
  301. Xto \fBNONE\fR.
  302. X.PP
  303. X\fBTcl_UnixError\fR sets the \fBerrorCode\fR variable after an error
  304. Xin a UNIX kernel call.
  305. XIt reads the value of the \fBerrno\fR C variable and calls
  306. X\fBTcl_SetErrorCode\fR to set \fBerrorCode\fR in the
  307. X\fBUNIX\fR format.
  308. XIn addition, \fBTcl_UnixError\fR returns a human-readable
  309. Xdiagnostic message for the error (this is the same value that
  310. Xwill appear as the third element in \fBerrorCode\fR).
  311. XIt may be convenient to include this string as part of the
  312. Xerror message returned to the application in \fIinterp->result\fR.
  313. X.PP
  314. XIt is important to call the procedures described here rather than
  315. Xsetting \fBerrorInfo\fR or \fBerrorCode\fR directly with
  316. X\fBTcl_SetVar\fR.
  317. XThe reason for this is that the Tcl interpreter keeps information
  318. Xabout whether these procedures have been called.
  319. XFor example, the first time \fBTcl_AppendResult\fR is called
  320. Xfor an error, it clears the existing value of \fBerrorInfo\fR
  321. Xand adds the error message in \fIinterp->result\fR to the variable
  322. Xbefore appending \fImessage\fR;  in subsequent calls, it just
  323. Xappends the new \fImessage\fR.
  324. XWhen \fBTcl_SetErrorCode\fR is called, it sets a flag indicating
  325. Xthat \fBerrorCode\fR has been set;  this allows the Tcl interpreter
  326. Xto set \fBerrorCode\fR to \fBNONE\fB if it receives an error return
  327. Xwhen \fBTcl_SetErrorCode\fR hasn't been called.
  328. X.PP
  329. XIf the procedure \fBTcl_ResetResult\fR is called, it clears all
  330. Xof the state associated with \fBerrorInfo\fR and \fBerrorCode\fR
  331. X(but it doesn't actually modify the variables).
  332. XIf an error had occurred, this will clear the error state to
  333. Xmake it appear as if no error had occurred after all.
  334. X.VE
  335. X
  336. X.SH "SEE ALSO"
  337. XTcl_ResetResult, Tcl_Interp
  338. X
  339. X.SH KEYWORDS
  340. Xerror, stack, trace, variable
  341. END_OF_FILE
  342. if test 8975 -ne `wc -c <'tcl6.1/doc/AddErrInfo.man'`; then
  343.     echo shar: \"'tcl6.1/doc/AddErrInfo.man'\" unpacked with wrong size!
  344. fi
  345. # end of 'tcl6.1/doc/AddErrInfo.man'
  346. fi
  347. if test -f 'tcl6.1/doc/CrtCommand.man' -a "${1}" != "-c" ; then 
  348.   echo shar: Will not clobber existing file \"'tcl6.1/doc/CrtCommand.man'\"
  349. else
  350. echo shar: Extracting \"'tcl6.1/doc/CrtCommand.man'\" \(8815 characters\)
  351. sed "s/^X//" >'tcl6.1/doc/CrtCommand.man' <<'END_OF_FILE'
  352. X'\" Copyright 1989 Regents of the University of California
  353. X'\" Permission to use, copy, modify, and distribute this
  354. X'\" documentation for any purpose and without fee is hereby
  355. X'\" granted, provided that this notice appears in all copies.
  356. X'\" The University of California makes no representations about
  357. X'\" the suitability of this material for any purpose.  It is
  358. X'\" provided "as is" without express or implied warranty.
  359. X'\" 
  360. X'\" $Header: /user6/ouster/tcl/man/RCS/CrtCommand.man,v 1.5 91/11/01 14:41:04 ouster Exp $ SPRITE (Berkeley)
  361. X'\" 
  362. X.\" The definitions below are for supplemental macros used in Sprite
  363. X.\" manual entries.
  364. X.\"
  365. X.\" .HS name section [date [version]]
  366. X.\"    Replacement for .TH in other man pages.  See below for valid
  367. X.\"    section names.
  368. X.\"
  369. X.\" .AP type name in/out [indent]
  370. X.\"    Start paragraph describing an argument to a library procedure.
  371. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  372. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  373. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  374. X.\"    needed;  use .AS below instead)
  375. X.\"
  376. X.\" .AS [type [name]]
  377. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  378. X.\"    name are examples of largest possible arguments that will be passed
  379. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  380. X.\"
  381. X.\" .BS
  382. X.\"    Start box enclosure.  From here until next .BE, everything will be
  383. X.\"    enclosed in one large box.
  384. X.\"
  385. X.\" .BE
  386. X.\"    End of box enclosure.
  387. X.\"
  388. X.\" .VS
  389. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  390. X.\"    of man pages.
  391. X.\"
  392. X.\" .VE
  393. X.\"    End of vertical sidebar.
  394. X.\"
  395. X.\" .DS
  396. X.\"    Begin an indented unfilled display.
  397. X.\"
  398. X.\" .DE
  399. X.\"    End of indented unfilled display.
  400. X.\"
  401. X'    # Heading for Sprite man pages
  402. X.de HS
  403. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  404. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  405. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  406. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  407. X.if t .wh -1.3i ^B
  408. X.nr ^l \\n(.l
  409. X.ad b
  410. X..
  411. X'    # Start an argument description
  412. X.de AP
  413. X.ie !"\\$4"" .TP \\$4
  414. X.el \{\
  415. X.   ie !"\\$2"" .TP \\n()Cu
  416. X.   el          .TP 15
  417. X.\}
  418. X.ie !"\\$3"" \{\
  419. X.ta \\n()Au \\n()Bu
  420. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  421. X.\".b
  422. X.\}
  423. X.el \{\
  424. X.br
  425. X.ie !"\\$2"" \{\
  426. X\&\\$1    \\fI\\$2\\fP
  427. X.\}
  428. X.el \{\
  429. X\&\\fI\\$1\\fP
  430. X.\}
  431. X.\}
  432. X..
  433. X'    # define tabbing values for .AP
  434. X.de AS
  435. X.nr )A 10n
  436. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  437. X.nr )B \\n()Au+15n
  438. X.\"
  439. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  440. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  441. X..
  442. X'    # BS - start boxed text
  443. X'    # ^y = starting y location
  444. X'    # ^b = 1
  445. X.de BS
  446. X.br
  447. X.mk ^y
  448. X.nr ^b 1u
  449. X.if n .nf
  450. X.if n .ti 0
  451. X.if n \l'\\n(.lu\(ul'
  452. X.if n .fi
  453. X..
  454. X'    # BE - end boxed text (draw box now)
  455. X.de BE
  456. X.nf
  457. X.ti 0
  458. X.mk ^t
  459. X.ie n \l'\\n(^lu\(ul'
  460. X.el \{\
  461. X.\"    Draw four-sided box normally, but don't draw top of
  462. X.\"    box if the box started on an earlier page.
  463. X.ie !\\n(^b-1 \{\
  464. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  465. X.\}
  466. X.el \}\
  467. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  468. X.\}
  469. X.\}
  470. X.fi
  471. X.br
  472. X.nr ^b 0
  473. X..
  474. X'    # VS - start vertical sidebar
  475. X'    # ^Y = starting y location
  476. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  477. X.de VS
  478. X.mk ^Y
  479. X.ie n 'mc \s12\(br\s0
  480. X.el .nr ^v 1u
  481. X..
  482. X'    # VE - end of vertical sidebar
  483. X.de VE
  484. X.ie n 'mc
  485. X.el \{\
  486. X.ev 2
  487. X.nf
  488. X.ti 0
  489. X.mk ^t
  490. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  491. X.sp -1
  492. X.fi
  493. X.ev
  494. X.\}
  495. X.nr ^v 0
  496. X..
  497. X'    # Special macro to handle page bottom:  finish off current
  498. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  499. X'    # page bottom macro.
  500. X.de ^B
  501. X.ev 2
  502. X'ti 0
  503. X'nf
  504. X.mk ^t
  505. X.if \\n(^b \{\
  506. X.\"    Draw three-sided box if this is the box's first page,
  507. X.\"    draw two sides but no top otherwise.
  508. X.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  509. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  510. X.\}
  511. X.if \\n(^v \{\
  512. X.nr ^x \\n(^tu+1v-\\n(^Yu
  513. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  514. X.\}
  515. X.bp
  516. X'fi
  517. X.ev
  518. X.if \\n(^b \{\
  519. X.mk ^y
  520. X.nr ^b 2
  521. X.\}
  522. X.if \\n(^v \{\
  523. X.mk ^Y
  524. X.\}
  525. X..
  526. X'    # DS - begin display
  527. X.de DS
  528. X.RS
  529. X.nf
  530. X.sp
  531. X..
  532. X'    # DE - end display
  533. X.de DE
  534. X.fi
  535. X.RE
  536. X.sp .5
  537. X..
  538. X.HS Tcl_CreateCommand tcl
  539. X.BS
  540. X.SH NAME
  541. XTcl_CreateCommand, Tcl_DeleteCommand \- define application-specific command bindings
  542. X.SH SYNOPSIS
  543. X.nf
  544. X\fB#include <tcl.h>\fR
  545. X.sp
  546. X\fBTcl_CreateCommand\fR(\fIinterp, cmdName, proc, clientData, deleteProc\fR)
  547. X.sp
  548. Xint
  549. X\fBTcl_DeleteCommand\fR(\fIinterp, cmdName\fR)
  550. X.SH ARGUMENTS
  551. X.AS Tcl_CmdDeleteProc (*deleteProc)()
  552. X.AP Tcl_Interp *interp in
  553. XInterpreter in which to create new command.
  554. X.AP char *cmdName in
  555. XName of command to create or delete.
  556. X.AP Tcl_CmdProc *proc in
  557. XImplementation of new command:  \fIproc\fR will be called whenever
  558. X\fIcmdName\fR is invoked as a command.
  559. X.AP ClientData clientData in
  560. XArbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR.
  561. X.AP Tcl_CmdDeleteProc *deleteProc in
  562. XProcedure to call before \fIcmdName\fR is deleted from the interpreter;
  563. Xallows for command-specific cleanup.  If NULL, then no procedure is
  564. Xcalled before the command is deleted.
  565. X.BE
  566. X
  567. X.SH DESCRIPTION
  568. X.PP
  569. X\fBTcl_CreateCommand\fR defines a new command in \fIinterp\fR and associates
  570. Xit with procedure \fIproc\fR such that whenever \fIcmdName\fR is
  571. Xinvoked as a Tcl command (via a call to \fBTcl_Eval\fR) the Tcl interpreter
  572. Xwill call \fIproc\fR
  573. Xto process the command.  If there is already a command \fIcmdName\fR
  574. Xassociated with the interpreter, it is deleted.  \fIProc\fP should
  575. Xhave arguments and result that match the type \fBTcl_CmdProc\fR:
  576. X.nf
  577. X.RS
  578. Xtypedef int Tcl_CmdProc(
  579. X.RS
  580. XClientData \fIclientData\fR,
  581. XTcl_Interp *\fIinterp\fR,
  582. Xint \fIargc\fR,
  583. Xchar *\fIargv\fR[]);
  584. X.RE
  585. X.RE
  586. X.fi
  587. XWhen \fIproc\fR is invoked the \fIclientData\fP and \fIinterp\fR
  588. Xparameters will be copies of the \fIclientData\fP and \fIinterp\fR
  589. Xarguments given to \fBTcl_CreateCommand\fR.
  590. XTypically, \fIclientData\fR points to an application-specific
  591. Xdata structure that describes what to do when the command procedure
  592. Xis invoked.  \fIArgc\fR and \fIargv\fR describe the arguments to
  593. Xthe command, \fIargc\fR giving the number of arguments (including
  594. Xthe command name) and \fIargv\fR giving the values of the arguments
  595. Xas strings.  The \fIargv\fR array will contain \fIargc\fR+1 values;
  596. Xthe first \fIargc\fR values point to the argument strings, and the
  597. Xlast value is NULL.
  598. X.PP
  599. X\fIProc\fR must return an integer code that is either \fBTCL_OK\fR, \fBTCL_ERROR\fR,
  600. X\fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR.  See the Tcl overview man page
  601. Xfor details on what these codes mean.  Most normal commands will only
  602. Xreturn \fBTCL_OK\fR or \fBTCL_ERROR\fR.  In addition, \fIproc\fR must set
  603. X\fIinterp->result\fR to point to a string value;
  604. Xin the case of a \fBTCL_OK\fR return code this gives the result
  605. Xof the command, and in the case of \fBTCL_ERROR\fR it gives an error message.
  606. XThe \fBTcl_SetResult\fR procedure provides an easy interface for setting
  607. Xthe return value;  for complete details on how the \fIinterp->result\fR
  608. Xfield is managed, see the \fBTcl_Interp\fR man page.
  609. XBefore invoking a command procedure,
  610. X\fBTcl_Eval\fR sets \fIinterp->result\fR to point to an empty string, so simple
  611. Xcommands can return an empty result by doing nothing at all.
  612. X.PP
  613. XThe contents of the \fIargv\fR array are copies made by the Tcl interpreter
  614. Xfor the use of \fIproc\fR.  \fIProc\fR may alter any of the strings
  615. Xin \fIargv\fR.  However, the \fIargv\fR array
  616. Xis recycled as soon as \fIproc\fR returns, so \fIproc\fR must not set
  617. X\fIinterp->result\fR to point anywhere within the \fIargv\fR values
  618. X(call Tcl_SetResult
  619. Xwith status \fBTCL_VOLATILE\fR if you want to return something from the
  620. X\fIargv\fR array).
  621. X.PP
  622. X\fIDeleteProc\fR will be invoked when (if) \fIcmdName\fR is deleted.
  623. XThis can occur through a call to \fBTcl_DeleteCommand\fR or \fBTcl_DeleteInterp\fR,
  624. Xor by replacing \fIcmdName\fR in another call to Tcl_CreateCommand.
  625. X\fIDeleteProc\fR is invoked before the command is deleted, and gives the
  626. Xapplication an opportunity to release any structures associated
  627. Xwith the command.  \fIDeleteProc\fR should have arguments and
  628. Xresult that match the type \fBTcl_CmdDeleteProc\fR:
  629. X.nf
  630. X.RS
  631. X.sp
  632. Xtypedef void Tcl_CmdDeleteProc(ClientData \fIclientData\fR);
  633. X.sp
  634. X.RE
  635. X.fi
  636. XThe \fIclientData\fR argument will be the same as the \fIclientData\fR
  637. Xargument passed to \fBTcl_CreateCommand\fR.
  638. X.PP
  639. X\fBTcl_DeleteCommand\fR deletes a command from a command interpreter.
  640. XOnce the call completes, attempts to invoke \fIcmdName\fR in
  641. X\fIinterp\fR will result in errors.
  642. XIf \fIcmdName\fR isn't bound as a command in \fIinterp\fR then
  643. X\fBTcl_DeleteCommand\fR does nothing and returns -1;  otherwise
  644. Xit returns 0.
  645. XThere are no restrictions on \fIcmdName\fR:  it may refer to
  646. Xa built-in command, an application-specific command, or a Tcl procedure.
  647. X
  648. X.SH KEYWORDS
  649. Xbind, command, create, delete, interpreter
  650. END_OF_FILE
  651. if test 8815 -ne `wc -c <'tcl6.1/doc/CrtCommand.man'`; then
  652.     echo shar: \"'tcl6.1/doc/CrtCommand.man'\" unpacked with wrong size!
  653. fi
  654. # end of 'tcl6.1/doc/CrtCommand.man'
  655. fi
  656. if test -f 'tcl6.1/doc/CrtTrace.man' -a "${1}" != "-c" ; then 
  657.   echo shar: Will not clobber existing file \"'tcl6.1/doc/CrtTrace.man'\"
  658. else
  659. echo shar: Extracting \"'tcl6.1/doc/CrtTrace.man'\" \(8294 characters\)
  660. sed "s/^X//" >'tcl6.1/doc/CrtTrace.man' <<'END_OF_FILE'
  661. X'\" Copyright 1989 Regents of the University of California
  662. X'\" Permission to use, copy, modify, and distribute this
  663. X'\" documentation for any purpose and without fee is hereby
  664. X'\" granted, provided that this notice appears in all copies.
  665. X'\" The University of California makes no representations about
  666. X'\" the suitability of this material for any purpose.  It is
  667. X'\" provided "as is" without express or implied warranty.
  668. X'\" 
  669. X'\" $Header: /user6/ouster/tcl/man/RCS/CrtTrace.man,v 1.4 91/11/01 14:41:15 ouster Exp $ SPRITE (Berkeley)
  670. X'\" 
  671. X.\" The definitions below are for supplemental macros used in Sprite
  672. X.\" manual entries.
  673. X.\"
  674. X.\" .HS name section [date [version]]
  675. X.\"    Replacement for .TH in other man pages.  See below for valid
  676. X.\"    section names.
  677. X.\"
  678. X.\" .AP type name in/out [indent]
  679. X.\"    Start paragraph describing an argument to a library procedure.
  680. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  681. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  682. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  683. X.\"    needed;  use .AS below instead)
  684. X.\"
  685. X.\" .AS [type [name]]
  686. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  687. X.\"    name are examples of largest possible arguments that will be passed
  688. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  689. X.\"
  690. X.\" .BS
  691. X.\"    Start box enclosure.  From here until next .BE, everything will be
  692. X.\"    enclosed in one large box.
  693. X.\"
  694. X.\" .BE
  695. X.\"    End of box enclosure.
  696. X.\"
  697. X.\" .VS
  698. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  699. X.\"    of man pages.
  700. X.\"
  701. X.\" .VE
  702. X.\"    End of vertical sidebar.
  703. X.\"
  704. X.\" .DS
  705. X.\"    Begin an indented unfilled display.
  706. X.\"
  707. X.\" .DE
  708. X.\"    End of indented unfilled display.
  709. X.\"
  710. X'    # Heading for Sprite man pages
  711. X.de HS
  712. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  713. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  714. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  715. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  716. X.if t .wh -1.3i ^B
  717. X.nr ^l \\n(.l
  718. X.ad b
  719. X..
  720. X'    # Start an argument description
  721. X.de AP
  722. X.ie !"\\$4"" .TP \\$4
  723. X.el \{\
  724. X.   ie !"\\$2"" .TP \\n()Cu
  725. X.   el          .TP 15
  726. X.\}
  727. X.ie !"\\$3"" \{\
  728. X.ta \\n()Au \\n()Bu
  729. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  730. X.\".b
  731. X.\}
  732. X.el \{\
  733. X.br
  734. X.ie !"\\$2"" \{\
  735. X\&\\$1    \\fI\\$2\\fP
  736. X.\}
  737. X.el \{\
  738. X\&\\fI\\$1\\fP
  739. X.\}
  740. X.\}
  741. X..
  742. X'    # define tabbing values for .AP
  743. X.de AS
  744. X.nr )A 10n
  745. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  746. X.nr )B \\n()Au+15n
  747. X.\"
  748. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  749. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  750. X..
  751. X'    # BS - start boxed text
  752. X'    # ^y = starting y location
  753. X'    # ^b = 1
  754. X.de BS
  755. X.br
  756. X.mk ^y
  757. X.nr ^b 1u
  758. X.if n .nf
  759. X.if n .ti 0
  760. X.if n \l'\\n(.lu\(ul'
  761. X.if n .fi
  762. X..
  763. X'    # BE - end boxed text (draw box now)
  764. X.de BE
  765. X.nf
  766. X.ti 0
  767. X.mk ^t
  768. X.ie n \l'\\n(^lu\(ul'
  769. X.el \{\
  770. X.\"    Draw four-sided box normally, but don't draw top of
  771. X.\"    box if the box started on an earlier page.
  772. X.ie !\\n(^b-1 \{\
  773. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  774. X.\}
  775. X.el \}\
  776. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  777. X.\}
  778. X.\}
  779. X.fi
  780. X.br
  781. X.nr ^b 0
  782. X..
  783. X'    # VS - start vertical sidebar
  784. X'    # ^Y = starting y location
  785. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  786. X.de VS
  787. X.mk ^Y
  788. X.ie n 'mc \s12\(br\s0
  789. X.el .nr ^v 1u
  790. X..
  791. X'    # VE - end of vertical sidebar
  792. X.de VE
  793. X.ie n 'mc
  794. X.el \{\
  795. X.ev 2
  796. X.nf
  797. X.ti 0
  798. X.mk ^t
  799. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  800. X.sp -1
  801. X.fi
  802. X.ev
  803. X.\}
  804. X.nr ^v 0
  805. X..
  806. X'    # Special macro to handle page bottom:  finish off current
  807. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  808. X'    # page bottom macro.
  809. X.de ^B
  810. X.ev 2
  811. X'ti 0
  812. X'nf
  813. X.mk ^t
  814. X.if \\n(^b \{\
  815. X.\"    Draw three-sided box if this is the box's first page,
  816. X.\"    draw two sides but no top otherwise.
  817. X.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  818. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  819. X.\}
  820. X.if \\n(^v \{\
  821. X.nr ^x \\n(^tu+1v-\\n(^Yu
  822. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  823. X.\}
  824. X.bp
  825. X'fi
  826. X.ev
  827. X.if \\n(^b \{\
  828. X.mk ^y
  829. X.nr ^b 2
  830. X.\}
  831. X.if \\n(^v \{\
  832. X.mk ^Y
  833. X.\}
  834. X..
  835. X'    # DS - begin display
  836. X.de DS
  837. X.RS
  838. X.nf
  839. X.sp
  840. X..
  841. X'    # DE - end display
  842. X.de DE
  843. X.fi
  844. X.RE
  845. X.sp .5
  846. X..
  847. X.HS Tcl_CreateTrace tcl
  848. X.BS
  849. X.SH NAME
  850. XTcl_CreateTrace, Tcl_DeleteTrace \- arrange for command execution to be traced
  851. X.SH SYNOPSIS
  852. X.nf
  853. X\fB#include <tcl.h>\fR
  854. X.sp
  855. XTcl_Trace
  856. X\fBTcl_CreateTrace\fR(\fIinterp, level, proc, clientData\fR)
  857. X.sp
  858. X\fBTcl_DeleteTrace\fR(\fIinterp, trace\fR)
  859. X.SH ARGUMENTS
  860. X.AS Tcl_CmdTraceProc (clientData)()
  861. X.AP Tcl_Interp *interp in
  862. XInterpreter containing command to be traced or untraced.
  863. X.AP int level in
  864. XOnly commands at or below this nesting level will be traced.  1 means
  865. Xtop-level commands only, 2 means top-level commands or those that are
  866. Xinvoked as immediate consequences of executing top-level commands
  867. X(procedure bodies, bracketed commands, etc.) and so on.
  868. X.AP Tcl_CmdTraceProc *proc in
  869. XProcedure to call for each command that's executed.  See below for
  870. Xdetails on the calling sequence.
  871. X.AP ClientData clientData in
  872. XArbitrary one-word value to pass to \fIproc\fR.
  873. X.AP Tcl_Trace trace in
  874. XToken for trace to be removed (return value from previous call
  875. Xto \fBTcl_CreateTrace\fR).
  876. X.BE
  877. X
  878. X.SH DESCRIPTION
  879. X.PP
  880. X\fBTcl_CreateTrace\fR arranges for command tracing.  From now on, \fIproc\fR
  881. Xwill be invoked before Tcl calls command procedures to process
  882. Xcommands in \fIinterp\fR.  The return value from
  883. X\fBTcl_CreateTrace\fR is a token for the trace,
  884. Xwhich may be passed to \fBTcl_DeleteTrace\fR to remove the trace.  There may
  885. Xbe many traces in effect simultaneously for the same command interpreter.
  886. X.PP
  887. X\fIProc\fR should have arguments and result that match the
  888. Xtype \fBTcl_CmdTraceProc\fR:
  889. X.nf
  890. X.sp
  891. X.RS
  892. Xtypedef void Tcl_CmdTraceProc(
  893. X.RS
  894. XClientData \fIclientData\fR,
  895. XTcl_Interp *\fIinterp\fR,
  896. Xint \fIlevel\fR,
  897. Xchar *\fIcommand\fR,
  898. XTcl_CmdProc *\fIcmdProc\fR,
  899. XClientData \fIcmdClientData\fR,
  900. Xint \fIargc\fR,
  901. Xchar *\fIargv\fR[]));
  902. X.sp
  903. X.RE
  904. X.RE
  905. X.fi
  906. XThe \fIclientData\fP and \fIinterp\fP parameters are
  907. Xcopies of the corresponding arguments given to \fBTcl_CreateTrace\fR.
  908. X\fIClientData\fR typically points to an application-specific
  909. Xdata structure that describes what to do when \fIproc\fR
  910. Xis invoked.  \fILevel\fR gives the nesting level of the command
  911. X(1 for top-level commands passed to \fBTcl_Eval\fR by the application,
  912. X2 for the next-level commands passed to \fBTcl_Eval\fR as part of parsing
  913. Xor interpreting level-1 commands, and so on).  \fICommand\fR
  914. Xpoints to a string containing the text of the
  915. Xcommand, before any argument substitution.
  916. X\fICmdProc\fR contains the address of the command procedure that
  917. Xwill be called to process the command (i.e. the \fIproc\fR argument
  918. Xof some previous call to \fBTcl_CreateCommand\fR) and \fIcmdClientData\fR
  919. Xcontains the associated client data for \fIcmdProc\fR (the \fIclientData\fR
  920. Xvalue passed to \fBTcl_CreateCommand\fR).  \fIArgc\fR and \fIargv\fR give
  921. Xthe final argument information that will be passed to \fIcmdProc\fR, after
  922. Xcommand, variable, and backslash substitution.
  923. X\fIProc\fR must not modify the \fIcommand\fR or \fIargv\fR strings.
  924. X.PP
  925. XTracing will only occur for commands at nesting level less than
  926. Xor equal to the \fIlevel\fR parameter (i.e. the \fIlevel\fR
  927. Xparameter to \fIproc\fR will always be less than or equal to the
  928. X\fIlevel\fR parameter to \fBTcl_CreateTrace\fR).
  929. X.PP
  930. XCalls to \fIproc\fR will be made by the Tcl parser immediately before
  931. Xit calls the command procedure for the command (\fIcmdProc\fR).  This
  932. Xoccurs after argument parsing and substitution, so tracing for
  933. Xsubstituted commands occurs before tracing of the commands
  934. Xcontaining the substitutions.  If there is a syntax error in a
  935. Xcommand, or if there is no command procedure associated with a
  936. Xcommand name, then no tracing will occur for that command.  If a
  937. Xstring passed to Tcl_Eval contains multiple commands (bracketed, or
  938. Xon different lines) then multiple calls to \fIproc\fR will occur,
  939. Xone for each command.  The \fIcommand\fR string for each of these
  940. Xtrace calls will reflect only a single command, not the entire string
  941. Xpassed to Tcl_Eval.
  942. X.PP
  943. X\fBTcl_DeleteTrace\fR removes a trace, so that no future calls will be
  944. Xmade to the procedure associated with the trace.  After \fBTcl_DeleteTrace\fR
  945. Xreturns, the caller should never again use the \fItrace\fR token.
  946. X
  947. X.SH KEYWORDS
  948. Xcommand, create, delete, interpreter, trace
  949. END_OF_FILE
  950. if test 8294 -ne `wc -c <'tcl6.1/doc/CrtTrace.man'`; then
  951.     echo shar: \"'tcl6.1/doc/CrtTrace.man'\" unpacked with wrong size!
  952. fi
  953. # end of 'tcl6.1/doc/CrtTrace.man'
  954. fi
  955. if test -f 'tcl6.1/doc/Fork.man' -a "${1}" != "-c" ; then 
  956.   echo shar: Will not clobber existing file \"'tcl6.1/doc/Fork.man'\"
  957. else
  958. echo shar: Extracting \"'tcl6.1/doc/Fork.man'\" \(9119 characters\)
  959. sed "s/^X//" >'tcl6.1/doc/Fork.man' <<'END_OF_FILE'
  960. X'\" Copyright 1989 Regents of the University of California
  961. X'\" Permission to use, copy, modify, and distribute this
  962. X'\" documentation for any purpose and without fee is hereby
  963. X'\" granted, provided that this notice appears in all copies.
  964. X'\" The University of California makes no representations about
  965. X'\" the suitability of this material for any purpose.  It is
  966. X'\" provided "as is" without express or implied warranty.
  967. X'\" 
  968. X'\" $Header: /user6/ouster/tcl/doc/RCS/Fork.man,v 1.2 91/10/09 11:58:25 ouster Exp $ SPRITE (Berkeley)
  969. X'\" 
  970. X.\" The definitions below are for supplemental macros used in Sprite
  971. X.\" manual entries.
  972. X.\"
  973. X.\" .HS name section [date [version]]
  974. X.\"    Replacement for .TH in other man pages.  See below for valid
  975. X.\"    section names.
  976. X.\"
  977. X.\" .AP type name in/out [indent]
  978. X.\"    Start paragraph describing an argument to a library procedure.
  979. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  980. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  981. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  982. X.\"    needed;  use .AS below instead)
  983. X.\"
  984. X.\" .AS [type [name]]
  985. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  986. X.\"    name are examples of largest possible arguments that will be passed
  987. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  988. X.\"
  989. X.\" .BS
  990. X.\"    Start box enclosure.  From here until next .BE, everything will be
  991. X.\"    enclosed in one large box.
  992. X.\"
  993. X.\" .BE
  994. X.\"    End of box enclosure.
  995. X.\"
  996. X.\" .VS
  997. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  998. X.\"    of man pages.
  999. X.\"
  1000. X.\" .VE
  1001. X.\"    End of vertical sidebar.
  1002. X.\"
  1003. X.\" .DS
  1004. X.\"    Begin an indented unfilled display.
  1005. X.\"
  1006. X.\" .DE
  1007. X.\"    End of indented unfilled display.
  1008. X.\"
  1009. X'    # Heading for Sprite man pages
  1010. X.de HS
  1011. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  1012. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  1013. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  1014. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  1015. X.if t .wh -1.3i ^B
  1016. X.nr ^l \\n(.l
  1017. X.ad b
  1018. X..
  1019. X'    # Start an argument description
  1020. X.de AP
  1021. X.ie !"\\$4"" .TP \\$4
  1022. X.el \{\
  1023. X.   ie !"\\$2"" .TP \\n()Cu
  1024. X.   el          .TP 15
  1025. X.\}
  1026. X.ie !"\\$3"" \{\
  1027. X.ta \\n()Au \\n()Bu
  1028. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  1029. X.\".b
  1030. X.\}
  1031. X.el \{\
  1032. X.br
  1033. X.ie !"\\$2"" \{\
  1034. X\&\\$1    \\fI\\$2\\fP
  1035. X.\}
  1036. X.el \{\
  1037. X\&\\fI\\$1\\fP
  1038. X.\}
  1039. X.\}
  1040. X..
  1041. X'    # define tabbing values for .AP
  1042. X.de AS
  1043. X.nr )A 10n
  1044. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  1045. X.nr )B \\n()Au+15n
  1046. X.\"
  1047. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  1048. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  1049. X..
  1050. X'    # BS - start boxed text
  1051. X'    # ^y = starting y location
  1052. X'    # ^b = 1
  1053. X.de BS
  1054. X.br
  1055. X.mk ^y
  1056. X.nr ^b 1u
  1057. X.if n .nf
  1058. X.if n .ti 0
  1059. X.if n \l'\\n(.lu\(ul'
  1060. X.if n .fi
  1061. X..
  1062. X'    # BE - end boxed text (draw box now)
  1063. X.de BE
  1064. X.nf
  1065. X.ti 0
  1066. X.mk ^t
  1067. X.ie n \l'\\n(^lu\(ul'
  1068. X.el \{\
  1069. X.\"    Draw four-sided box normally, but don't draw top of
  1070. X.\"    box if the box started on an earlier page.
  1071. X.ie !\\n(^b-1 \{\
  1072. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  1073. X.\}
  1074. X.el \}\
  1075. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  1076. X.\}
  1077. X.\}
  1078. X.fi
  1079. X.br
  1080. X.nr ^b 0
  1081. X..
  1082. X'    # VS - start vertical sidebar
  1083. X'    # ^Y = starting y location
  1084. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  1085. X.de VS
  1086. X.mk ^Y
  1087. X.ie n 'mc \s12\(br\s0
  1088. X.el .nr ^v 1u
  1089. X..
  1090. X'    # VE - end of vertical sidebar
  1091. X.de VE
  1092. X.ie n 'mc
  1093. X.el \{\
  1094. X.ev 2
  1095. X.nf
  1096. X.ti 0
  1097. X.mk ^t
  1098. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  1099. X.sp -1
  1100. X.fi
  1101. X.ev
  1102. X.\}
  1103. X.nr ^v 0
  1104. X..
  1105. X'    # Special macro to handle page bottom:  finish off current
  1106. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  1107. X'    # page bottom macro.
  1108. X.de ^B
  1109. X.ev 2
  1110. X'ti 0
  1111. X'nf
  1112. X.mk ^t
  1113. X.if \\n(^b \{\
  1114. X.\"    Draw three-sided box if this is the box's first page,
  1115. X.\"    draw two sides but no top otherwise.
  1116. X.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  1117. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  1118. X.\}
  1119. X.if \\n(^v \{\
  1120. X.nr ^x \\n(^tu+1v-\\n(^Yu
  1121. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  1122. X.\}
  1123. X.bp
  1124. X'fi
  1125. X.ev
  1126. X.if \\n(^b \{\
  1127. X.mk ^y
  1128. X.nr ^b 2
  1129. X.\}
  1130. X.if \\n(^v \{\
  1131. X.mk ^Y
  1132. X.\}
  1133. X..
  1134. X'    # DS - begin display
  1135. X.de DS
  1136. X.RS
  1137. X.nf
  1138. X.sp
  1139. X..
  1140. X'    # DE - end display
  1141. X.de DE
  1142. X.fi
  1143. X.RE
  1144. X.sp .5
  1145. X..
  1146. X.HS Tcl_Fork tcl
  1147. X.BS
  1148. X.VS
  1149. X.SH NAME
  1150. XTcl_Fork, Tcl_WaitPids, Tcl_DetachPids \- manage child processes
  1151. X.SH SYNOPSIS
  1152. X.nf
  1153. X\fB#include <tcl.h>\fR
  1154. X.sp
  1155. Xint
  1156. X\fBTcl_Fork\fR( )
  1157. X.sp
  1158. Xint
  1159. X\fBTcl_WaitPids\fR(\fInumPids, pidPtr, statusPtr\fR)
  1160. X.sp
  1161. Xint
  1162. X\fBTcl_DetachPids\fR(\fInumPids, pidPtr\fR)
  1163. X.SH ARGUMENTS
  1164. X.AS Tcl_Interp *statusPtr
  1165. X.AP int numPids in
  1166. XNumber of process ids contained in the array pointed to by \fIpidPtr\fR.
  1167. X.AP int *pidPtr in
  1168. XAddress of array containing \fInumPids\fR process ids.
  1169. X.AP int *statusPtr out
  1170. XAddress of place to store status returned by exited/suspended process.
  1171. X.BE
  1172. X
  1173. X.SH DESCRIPTION
  1174. X.PP
  1175. XThese procedures keep track of child processes in order to make it
  1176. Xeasier for one application to manage several children.
  1177. XIf an application uses
  1178. Xthe UNIX \fIfork\fR and \fIwait\fR kernel calls directly,
  1179. Xproblems occur in situations like the following:
  1180. X.IP [1]
  1181. XOne part of an application creates child C1.  It plans to
  1182. Xlet the child run in background, then later wait for it to
  1183. Xcomplete.
  1184. X.IP [2]
  1185. XSome other part of the application creates another child C2,
  1186. Xnot knowing anything about C1.
  1187. X.IP [3]
  1188. XThe second part of the application uses \fIwait\fR to wait for C2
  1189. Xto complete.
  1190. X.IP [4]
  1191. XC1 completes before C2, so C1 is returned by the
  1192. X\fIwait\fR kernel call.
  1193. X.IP [5]
  1194. XThe second part of the application doesn't recognize C1, so it
  1195. Xignores it and calls \fIwait\fR again.  This time C2
  1196. Xcompletes.
  1197. X.IP [6]
  1198. XThe first part of the application eventually decides to wait
  1199. Xfor its child to complete.  When it calls \fIwait\fR there are
  1200. Xno children left, so \fIwait\fR returns an error and the
  1201. Xapplication never gets to examine the exit status for C1.
  1202. X.PP
  1203. XThe procedures \fBTcl_Fork\fR, \fBTcl_WaitPids\fR, and \fBTcl_DetachPids\fR
  1204. Xget around this problem by keeping a table of child processes and
  1205. Xtheir exit statuses.
  1206. XThey also provide a more flexible waiting
  1207. Xmechanism than the \fIwait\fR kernel call.
  1208. XTcl-based applications should never call \fIfork\fR and
  1209. X\fIwait\fR directly;  they should use \fBTcl_Fork\fR,
  1210. X\fBTcl_WaitPids\fR, and \fBTcl_DetachPids\fR.
  1211. X.PP
  1212. X\fBTcl_Fork\fR calls \fIfork\fR and returns the result of
  1213. Xthe \fIfork\fR kernel call.
  1214. XIf the \fIfork\fR call was successful then \fBTcl_Fork\fR also
  1215. Xenters the new process into its internal table of child
  1216. Xproceses.
  1217. XIf \fIfork\fR returns an error then \fBTcl_Fork\fR returns that
  1218. Xsame error.
  1219. X.PP
  1220. X\fBTcl_WaitPids\fR calls \fIwait\fR repeatedly until one of the processes
  1221. Xin the \fIpidPtr\fR array has exited or been killed or suspended by a
  1222. Xsignal.
  1223. XWhen this occurs, \fBTcl_WaitPids\fR returns the process
  1224. Xidentifier for the process and stores its wait status at
  1225. X\fI*statusPtr\fR.
  1226. XIf the process no longer exists (it exited or was killed by a signal),
  1227. Xthen \fBTcl_WaitPids\fR removes its entry from the internal
  1228. Xprocess table.
  1229. XIf \fIwait\fR returns a process that isn't
  1230. Xin the \fIpidPtr\fR array, \fBTcl_WaitPids\fR saves its wait
  1231. Xstatus in the internal process table and calls \fIwait\fR again.
  1232. XIf one of the processes in the \fIpidPtr\fR array has already
  1233. Xexited (or suspended or been killed) when \fBTcl_WaitPids\fR
  1234. Xis called, that process and its wait status are returned
  1235. Ximmediately without calling \fIwait\fR.
  1236. X.PP
  1237. X\fBTcl_WaitPids\fR provides two advantages.  First, it allows
  1238. Xprocesses to exit in any order, and saves their wait statuses.
  1239. XSecond, it allows waiting on a number of processes simultaneously,
  1240. Xreturning when any of the processes is returned by \fIwait\fR.
  1241. X.PP
  1242. X\fBTcl_DetachPids\fR is used to indicate that the application
  1243. Xno longer cares about the processes given by the \fIpidPtr\fR
  1244. Xarray and will never use \fBTcl_WaitPids\fR to wait for them.
  1245. XThis occurs, for example, if one or more children are to be
  1246. Xexecuted in background and the parent doesn't care whether
  1247. Xthey complete successfully.
  1248. XWhen \fBTcl_DetachPids\fR is called, the internal process
  1249. Xtable entries for the processes are marked so that the
  1250. Xentries will be removed as soon as the processes exit or
  1251. Xare killed.
  1252. X.PP
  1253. XIf none of the pids passed to \fBTcl_WaitPids\fR exists in
  1254. Xthe internal process table, then -1 is returned and \fIerrno\fR
  1255. Xis set to ECHILD.
  1256. XIf a \fIwait\fR kernel call returns an error,
  1257. Xthen \fBTcl_WaitPids\fR returns that same error.
  1258. XIf a \fIwait\fR kernel call returns a process that isn't in
  1259. Xthe internal process table,  \fBTcl_WaitPids\fR panics and
  1260. Xaborts the application.
  1261. XIf this situation occurs, it means that a process has been
  1262. Xcreated without calling \fBTcl_Fork\fR and that its exit
  1263. Xstatus is about to be lost.
  1264. X.PP
  1265. X\fBTcl_WaitPids\fR defines wait statuses to have type \fIint\fR,
  1266. Xwhich is correct for POSIX and many variants of UNIX. 
  1267. XSome BSD-based UNIX systems still use type \fIunion wait\fR for
  1268. Xwait statuses;  it should be safe to cast a pointer to a
  1269. X\fIunion wait\fR structure to \fI(int *)\fR before passing
  1270. Xit to \fBTcl_WaitPids\fR as in the following code:
  1271. X.nf
  1272. X.RS
  1273. X
  1274. X\fBunion wait status;
  1275. Xint pid1, pid2;
  1276. X\&...
  1277. Xpid2 = Tcl_WaitPids(1, &pid1, (int *) &status);\fR
  1278. X.RE
  1279. X.fi
  1280. X
  1281. X.SH KEYWORDS
  1282. Xbackground, child, detach, fork, process, status, wait
  1283. X.VE
  1284. END_OF_FILE
  1285. if test 9119 -ne `wc -c <'tcl6.1/doc/Fork.man'`; then
  1286.     echo shar: \"'tcl6.1/doc/Fork.man'\" unpacked with wrong size!
  1287. fi
  1288. # end of 'tcl6.1/doc/Fork.man'
  1289. fi
  1290. if test -f 'tcl6.1/doc/SplitList.man' -a "${1}" != "-c" ; then 
  1291.   echo shar: Will not clobber existing file \"'tcl6.1/doc/SplitList.man'\"
  1292. else
  1293. echo shar: Extracting \"'tcl6.1/doc/SplitList.man'\" \(9107 characters\)
  1294. sed "s/^X//" >'tcl6.1/doc/SplitList.man' <<'END_OF_FILE'
  1295. X'\" Copyright 1989-1991 Regents of the University of California
  1296. X'\" Permission to use, copy, modify, and distribute this
  1297. X'\" documentation for any purpose and without fee is hereby
  1298. X'\" granted, provided that this notice appears in all copies.
  1299. X'\" The University of California makes no representations about
  1300. X'\" the suitability of this material for any purpose.  It is
  1301. X'\" provided "as is" without express or implied warranty.
  1302. X'\" 
  1303. X'\" $Header: /user6/ouster/tcl/doc/RCS/SplitList.man,v 1.5 91/07/10 11:08:18 ouster Exp $ SPRITE (Berkeley)
  1304. X'\" 
  1305. X.\" The definitions below are for supplemental macros used in Sprite
  1306. X.\" manual entries.
  1307. X.\"
  1308. X.\" .HS name section [date [version]]
  1309. X.\"    Replacement for .TH in other man pages.  See below for valid
  1310. X.\"    section names.
  1311. X.\"
  1312. X.\" .AP type name in/out [indent]
  1313. X.\"    Start paragraph describing an argument to a library procedure.
  1314. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  1315. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  1316. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  1317. X.\"    needed;  use .AS below instead)
  1318. X.\"
  1319. X.\" .AS [type [name]]
  1320. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  1321. X.\"    name are examples of largest possible arguments that will be passed
  1322. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  1323. X.\"
  1324. X.\" .BS
  1325. X.\"    Start box enclosure.  From here until next .BE, everything will be
  1326. X.\"    enclosed in one large box.
  1327. X.\"
  1328. X.\" .BE
  1329. X.\"    End of box enclosure.
  1330. X.\"
  1331. X.\" .VS
  1332. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  1333. X.\"    of man pages.
  1334. X.\"
  1335. X.\" .VE
  1336. X.\"    End of vertical sidebar.
  1337. X.\"
  1338. X.\" .DS
  1339. X.\"    Begin an indented unfilled display.
  1340. X.\"
  1341. X.\" .DE
  1342. X.\"    End of indented unfilled display.
  1343. X.\"
  1344. X'    # Heading for Sprite man pages
  1345. X.de HS
  1346. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  1347. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  1348. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  1349. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  1350. X.if t .wh -1.3i ^B
  1351. X.nr ^l \\n(.l
  1352. X.ad b
  1353. X..
  1354. X'    # Start an argument description
  1355. X.de AP
  1356. X.ie !"\\$4"" .TP \\$4
  1357. X.el \{\
  1358. X.   ie !"\\$2"" .TP \\n()Cu
  1359. X.   el          .TP 15
  1360. X.\}
  1361. X.ie !"\\$3"" \{\
  1362. X.ta \\n()Au \\n()Bu
  1363. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  1364. X.\".b
  1365. X.\}
  1366. X.el \{\
  1367. X.br
  1368. X.ie !"\\$2"" \{\
  1369. X\&\\$1    \\fI\\$2\\fP
  1370. X.\}
  1371. X.el \{\
  1372. X\&\\fI\\$1\\fP
  1373. X.\}
  1374. X.\}
  1375. X..
  1376. X'    # define tabbing values for .AP
  1377. X.de AS
  1378. X.nr )A 10n
  1379. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  1380. X.nr )B \\n()Au+15n
  1381. X.\"
  1382. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  1383. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  1384. X..
  1385. X'    # BS - start boxed text
  1386. X'    # ^y = starting y location
  1387. X'    # ^b = 1
  1388. X.de BS
  1389. X.br
  1390. X.mk ^y
  1391. X.nr ^b 1u
  1392. X.if n .nf
  1393. X.if n .ti 0
  1394. X.if n \l'\\n(.lu\(ul'
  1395. X.if n .fi
  1396. X..
  1397. X'    # BE - end boxed text (draw box now)
  1398. X.de BE
  1399. X.nf
  1400. X.ti 0
  1401. X.mk ^t
  1402. X.ie n \l'\\n(^lu\(ul'
  1403. X.el \{\
  1404. X.\"    Draw four-sided box normally, but don't draw top of
  1405. X.\"    box if the box started on an earlier page.
  1406. X.ie !\\n(^b-1 \{\
  1407. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  1408. X.\}
  1409. X.el \}\
  1410. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  1411. X.\}
  1412. X.\}
  1413. X.fi
  1414. X.br
  1415. X.nr ^b 0
  1416. X..
  1417. X'    # VS - start vertical sidebar
  1418. X'    # ^Y = starting y location
  1419. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  1420. X.de VS
  1421. X.mk ^Y
  1422. X.ie n 'mc \s12\(br\s0
  1423. X.el .nr ^v 1u
  1424. X..
  1425. X'    # VE - end of vertical sidebar
  1426. X.de VE
  1427. X.ie n 'mc
  1428. X.el \{\
  1429. X.ev 2
  1430. X.nf
  1431. X.ti 0
  1432. X.mk ^t
  1433. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  1434. X.sp -1
  1435. X.fi
  1436. X.ev
  1437. X.\}
  1438. X.nr ^v 0
  1439. X..
  1440. X'    # Special macro to handle page bottom:  finish off current
  1441. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  1442. X'    # page bottom macro.
  1443. X.de ^B
  1444. X.ev 2
  1445. X'ti 0
  1446. X'nf
  1447. X.mk ^t
  1448. X.if \\n(^b \{\
  1449. X.\"    Draw three-sided box if this is the box's first page,
  1450. X.\"    draw two sides but no top otherwise.
  1451. X.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  1452. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  1453. X.\}
  1454. X.if \\n(^v \{\
  1455. X.nr ^x \\n(^tu+1v-\\n(^Yu
  1456. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  1457. X.\}
  1458. X.bp
  1459. X'fi
  1460. X.ev
  1461. X.if \\n(^b \{\
  1462. X.mk ^y
  1463. X.nr ^b 2
  1464. X.\}
  1465. X.if \\n(^v \{\
  1466. X.mk ^Y
  1467. X.\}
  1468. X..
  1469. X'    # DS - begin display
  1470. X.de DS
  1471. X.RS
  1472. X.nf
  1473. X.sp
  1474. X..
  1475. X'    # DE - end display
  1476. X.de DE
  1477. X.fi
  1478. X.RE
  1479. X.sp .5
  1480. X..
  1481. X.HS Tcl_SplitList tcl
  1482. X.BS
  1483. X.SH NAME
  1484. XTcl_SplitList, Tcl_Merge, Tcl_ScanElement, Tcl_ConvertElement \- manipulate Tcl lists
  1485. X.SH SYNOPSIS
  1486. X.nf
  1487. X\fB#include <tcl.h>\fR
  1488. X.sp
  1489. Xint
  1490. X\fBTcl_SplitList\fR(\fIinterp, list, argcPtr, argvPtr\fR)
  1491. X.sp
  1492. Xchar *
  1493. X\fBTcl_Merge\fR(\fIargc, argv\fR)
  1494. X.sp
  1495. X.VS
  1496. Xint
  1497. X\fBTcl_ScanElement\fR(\fIsrc, flagsPtr\fR)
  1498. X.sp
  1499. Xint
  1500. X\fBTcl_ConvertElement\fR(\fIsrc, dst, flags\fR)
  1501. X.VE
  1502. X.AS Tcl_Interp *argvPtr
  1503. X.SH ARGUMENTS
  1504. X.AP Tcl_Interp *interp out
  1505. XInterpreter to use for error reporting.
  1506. X.AP char *list in
  1507. XPointer to a string with proper list structure.
  1508. X.AP int *argcPtr out
  1509. XFilled in with number of elements in \fIlist\fR.
  1510. X.AP char ***argvPtr out
  1511. X\fI*argvPtr\fR will be filled in with the address of an array of
  1512. Xpointers to the strings that are the extracted elements of \fIlist\fR.
  1513. XThere will be \fI*argcPtr\fR valid entries in the array, followed by
  1514. Xa NULL entry.
  1515. X.AP int argc in
  1516. XNumber of elements in \fIargv\fR.
  1517. X.AP char **argv in
  1518. XArray of strings to merge together into a single list.
  1519. XEach string will become a separate element of the list.
  1520. X.AP char *src in
  1521. X.VS
  1522. XString that is to become an element of a list.
  1523. X.AP int *flagsPtr in
  1524. XPointer to word to fill in with information about \fIsrc\fR.
  1525. XThe value of *\fIflagsPtr\fR must be passed to \fBTcl_ConvertElement\fR.
  1526. X.AP char *dst in
  1527. XPlace to copy converted list element.  Must contain enough characters
  1528. Xto hold converted string.
  1529. X.AP int flags in
  1530. XInformation about \fIsrc\fR, which must have been returned by previous
  1531. Xcall to \fBTcl_ScanElement\fR.
  1532. X.VE
  1533. X.BE
  1534. X
  1535. X.SH DESCRIPTION
  1536. X.PP
  1537. XThese procedures may be used to disassemble and reassemble Tcl lists.
  1538. X\fBTcl_SplitList\fR breaks a list up into its constituent elements,
  1539. Xreturning an array of pointers to the elements using
  1540. X\fIargcPtr\fR and \fIargvPtr\fR.
  1541. XWhile extracting the arguments, \fBTcl_SplitList\fR obeys the usual
  1542. Xrules for backslash substitutions and braces.  The area of
  1543. Xmemory pointed to by \fI*argvPtr\fR is dynamically allocated;  in
  1544. Xaddition to the array of pointers, it
  1545. Xalso holds copies of all the list elements.  It is the caller's
  1546. Xresponsibility to free up all of this storage by calling
  1547. X.DS
  1548. X\fBfree\fR((char *) \fI*argvPtr\fR)
  1549. X.DE
  1550. Xwhen the list elements are no longer needed.
  1551. X.PP
  1552. X\fBTcl_SplitList\fR normally returns \fBTCL_OK\fR, which means the list was
  1553. Xsuccessfully parsed.
  1554. XIf there was a syntax error in \fIlist\fR, then \fBTCL_ERROR\fR is returned
  1555. Xand \fIinterp->result\fR will point to an error message describing the
  1556. Xproblem.
  1557. XIf \fBTCL_ERROR\fR is returned then no memory is allocated and \fI*argvPtr\fR
  1558. Xis not modified.
  1559. X.PP
  1560. X\fBTcl_Merge\fR is the inverse of \fBTcl_SplitList\fR:  it
  1561. Xtakes a collection of strings given by \fIargc\fR
  1562. Xand \fIargv\fR and generates a result string
  1563. Xthat has proper list structure.
  1564. XThis means that commands like \fBindex\fR may be used to
  1565. Xextract the original elements again.
  1566. XIn addition, if the result of \fBTcl_Merge\fR is passed to \fBTcl_Eval\fR,
  1567. Xit will be parsed into \fIargc\fR words whose values will
  1568. Xbe the same as the \fIargv\fR strings passed to \fBTcl_Merge\fR.
  1569. X\fBTcl_Merge\fR will modify the list elements with braces and/or
  1570. Xbackslashes in order to produce proper Tcl list structure.
  1571. XThe result string is dynamically allocated
  1572. Xusing \fBmalloc()\fR;  the caller must eventually release the space
  1573. Xusing \fBfree()\fR.
  1574. X.PP
  1575. XIf the result of \fBTcl_Merge\fR is passed to \fBTcl_SplitList\fR,
  1576. Xthe elements returned by \fBTcl_SplitList\fR will be identical to
  1577. Xthose passed into \fBTcl_Merge\fR.
  1578. XHowever, the converse is not true:  if \fBTcl_SplitList\fR
  1579. Xis passed a given string, and the resulting \fIargc\fR and
  1580. X\fIargv\fR are passed to \fBTcl_Merge\fR, the resulting string
  1581. Xmay not be the same as the original string passed to \fBTcl_SplitList\fR.
  1582. XThis is because \fBTcl_Merge\fR may use backslashes and braces
  1583. Xdifferently than the original string.
  1584. X.PP
  1585. X.VS
  1586. X\fBTcl_ScanElement\fR and \fBTcl_ConvertElement\fR are the
  1587. Xprocedures that do all of the real work of \fBTcl_Merge\fR.
  1588. X\fBTcl_ScanElement\fR scans its \fIsrc\fR argument
  1589. Xand determines how to use backslashes and braces
  1590. Xwhen converting it to a list element.
  1591. XIt returns an overestimate of the number of characters
  1592. Xrequired to represent \fIsrc\fR as a list element, and
  1593. Xit stores information in \fI*flagsPtr\fR that is needed
  1594. Xby \fBTcl_ConvertElement\fR.
  1595. X.PP
  1596. X\fBTcl_ConvertElement\fR is a companion procedure to \fBTcl_ScanElement\fR.
  1597. XIt does the actual work of converting a string to a list element.
  1598. XIts \fIflags\fR argument must be the same as the value returned
  1599. Xby \fBTcl_ScanElement\fR.
  1600. X\fBTcl_ConvertElement\fR writes a proper list element to memory
  1601. Xstarting at *\fIdst\fR and returns a count of the total number
  1602. Xof characters written, which will be no more than the result
  1603. Xreturned by \fBTcl_ScanElement\fR.
  1604. X\fBTcl_ConvertElement\fR writes out only the actual list element
  1605. Xwithout any leading or trailing spaces: it is up to the caller to
  1606. Xinclude spaces between adjacent list elements.
  1607. X.VE
  1608. X
  1609. X.SH KEYWORDS
  1610. Xbackslash, convert, element, list, merge, split, strings
  1611. END_OF_FILE
  1612. if test 9107 -ne `wc -c <'tcl6.1/doc/SplitList.man'`; then
  1613.     echo shar: \"'tcl6.1/doc/SplitList.man'\" unpacked with wrong size!
  1614. fi
  1615. # end of 'tcl6.1/doc/SplitList.man'
  1616. fi
  1617. echo shar: End of archive 6 \(of 33\).
  1618. cp /dev/null ark6isdone
  1619. MISSING=""
  1620. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
  1621.     if test ! -f ark${I}isdone ; then
  1622.     MISSING="${MISSING} ${I}"
  1623.     fi
  1624. done
  1625. if test "${MISSING}" = "" ; then
  1626.     echo You have unpacked all 33 archives.
  1627.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1628. else
  1629.     echo You still need to unpack the following archives:
  1630.     echo "        " ${MISSING}
  1631. fi
  1632. ##  End of shell archive.
  1633. exit 0
  1634.  
  1635. exit 0 # Just in case...
  1636. -- 
  1637. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1638. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1639. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1640. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1641.