home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume26 / tclx / part23 < prev    next >
Encoding:
Text File  |  1991-11-19  |  45.3 KB  |  1,247 lines

  1. Newsgroups: comp.sources.misc
  2. From: karl@sugar.neosoft.com (Karl Lehenbauer)
  3. Subject:  v26i023:  tclx - extensions and on-line help for tcl 6.1, Part23/23
  4. Message-ID: <1991Nov19.135902.1758@sparky.imd.sterling.com>
  5. X-Md4-Signature: 6cd0ad6dc5dc7c33ca265032d75c97e3
  6. Date: Tue, 19 Nov 1991 13:59:02 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
  10. Posting-number: Volume 26, Issue 23
  11. Archive-name: tclx/part23
  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 23 (of 23)."
  21. # Contents:  extended/man/TclX.man
  22. # Wrapped by karl@one on Wed Nov 13 21:50:34 1991
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. if test -f 'extended/man/TclX.man' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'extended/man/TclX.man'\"
  26. else
  27. echo shar: Extracting \"'extended/man/TclX.man'\" \(42986 characters\)
  28. sed "s/^X//" >'extended/man/TclX.man' <<'END_OF_FILE'
  29. X.TH "TclX" TCL "" "Tcl"
  30. X.ad b
  31. X'@index: tclx ExtendedTcl
  32. X.SH NAME
  33. XTclX - Extended Tcl - Extended command set for Tcl 6.1.
  34. X'
  35. X.SH "INTRODUCTION"
  36. X.PP
  37. XThis man page contains the documentation for all of the extensions that are
  38. Xadded to Tcl 6.1 by Extended Tcl.  These extensions provide their
  39. Xcapabilities by adding new commands to Tcl whitout changing the syntax of
  40. Xstandard Tcl.  Extended Tcl is a superset of standard Tcl and is built with
  41. Xthe standard Tcl sources.
  42. X.TP
  43. XThe command descriptions are separated into several sections:
  44. X.TP
  45. Xo General Commands
  46. X.TP
  47. Xo Unix Access Commands
  48. X.TP
  49. Xo File I/O Commands
  50. X.TP
  51. Xo File Scanning Commands
  52. X.TP
  53. Xo Math Commands
  54. X.TP
  55. Xo List Manipulation Commands
  56. X.TP
  57. Xo Keyed Lists
  58. X.TP
  59. Xo String and Character Manipulation Commands
  60. X'
  61. X.SH "GENERAL COMMANDS"
  62. X.PP
  63. XA set of general useful Tcl commands.  Includes interactive inputting of
  64. Xcommands, a facility for tracing execution and a looping command.
  65. X'
  66. X'@help: extended/commandloop
  67. X'@brief: Create an interactive command loop.
  68. X.TP
  69. X.B commandloop [\fIprompt\fR] [\fIprompt2\fR]
  70. X.br
  71. XCreate an interactive command loop for the current TCL interpreter.  This
  72. Xcommand receives commands from stdin and executes them.  This command is
  73. Xuseful for non-interactive TCL scripts that want to enter an interactive mode.
  74. X\fIPrompt\fR is a command string to set the top level prompt hook to
  75. X to, the contents of which is executed to generate the main prompt.
  76. X\fIPrompt2\fR is a command string to set the down level prompt to, which is
  77. Xgenerates the prompt command for continuation input.  When the command
  78. Xterminates, the variables for the prompt hooks will be set to their old value.
  79. XIf these arguments are not specified, the prompt hooks use their current
  80. Xvalue.  Prompt hooks are TCL code that return as their result the prompt to
  81. Xoutput.  The result of the last command executed in the command string (which
  82. Xmay be a \fBreturn\fR) will be outputted as the prompt.
  83. X'@endhelp
  84. X'@help: extended/cmdtrace
  85. X'@brief: Trace Tcl execution.
  86. X.TP
  87. X.B cmdtrace \fIlevel\fR|\fBon\fR [\fBnoeval\fR] [\fBnotruncate\fR] [\fBflush\fR] [\fIfilehandle\fR]
  88. X.br
  89. XPrint a trace statement for all commands executed at depth of \fIlevel\fR or
  90. Xbelow (1 is the top level).  If \fBon\fR is specified, all commands at any
  91. Xlevel are traced.
  92. XIf \fBnoeval\fR is specified, arguments are
  93. Xprinted unevaluated -- if it is not specified, the arguments are printed after
  94. Xevaluation. If the command line is longer than 60 characters, it is truncated
  95. Xto 60 and a "..." is postpended to indicate that there was more.  If
  96. X\fBnoeval\fR wasn't specified, the arguments are printed after evaluation.  In
  97. Xthis case, each argument is truncated to 40 characters (with "..." postpended 
  98. Xif the argument was longer than 40 characters) and printed. If an evaluated 
  99. Xargument contains a space, the entire argument will be enclosed inside of
  100. Xbraces (`{}') to allow the reader to visually separate the arguments from
  101. Xeach other. If \fBnotruncate\fR is specified, then the truncation of commands
  102. Xand evaluated arguments will be disabled. If \fBflush\fR is specified, then
  103. Xthe output buffer will be flushed after each line is printed.  This is useful
  104. Xwhen tracing code that cause an application to abort, making it easy to narrow
  105. Xthe problem down to the command that caused the abort. If \fIfilehandle\fR is
  106. Xspecified, then the trace output will be written to the file.
  107. X.TP
  108. X.B cmdtrace off
  109. XTurn off all tracing.
  110. X.TP
  111. X.B cmdtrace depth
  112. X.br
  113. XReturns the current maximum trace level, or zero if trace is disabled.
  114. X'@endhelp
  115. X'@help: extended/echo
  116. X'@brief: Echo one or more strings to stdout, followed by a newline.
  117. X.TP
  118. X.B echo \fIstr1\fR [\fIstr2..\fR]
  119. X.br
  120. XPrint the strings to stdout followed by a newline.
  121. X'@endhelp
  122. X'@help: extended/infox
  123. X'@brief: Return information about extended Tcl or the current application.
  124. X.TP
  125. X.B infox \fIoption\fR
  126. X.br
  127. XReturn information about extended Tcl or the current application.  
  128. XThe following \fBinfox\fR command options are available.
  129. X.RS 5
  130. X.TP
  131. X.B version
  132. XReturn the version number of Extended Tcl.  The version number for
  133. Xextended Tcl is generated by combining the base version of the standard Tcl
  134. Xcode with a letter indicating the version of Extended Tcl being used.  This is
  135. Xthe documentation for version \fBtcl6.1a\fR.
  136. X.TP
  137. X.B patchlevel
  138. XReturn the patchlevel for Extended Tcl.
  139. X.TP
  140. X.B appname
  141. XReturn the symbolic application name of the current application linked with
  142. Xthe Extended Tcl library.  The C variable \fBtclAppName\fR must be set by the
  143. Xapplication to return an application specific value for this variable.
  144. X.TP
  145. X.B applongname
  146. XReturn a natural language name for the current application. The C variable
  147. X\fBtclLongAppName\fR must be set by the application to return an application
  148. Xspecific value for this variable.
  149. X.TP
  150. X.B appversion
  151. XReturn the version number for the current application.  The C variable
  152. X\fBtclAppVersion\fR must be set by the application to return an application
  153. Xspecific value for this variable.
  154. X.RE
  155. X'@endhelp
  156. X'@help: extended/loop
  157. X'@brief: Higher-performance for-style loop.
  158. X.TP
  159. X.B loop \fIvar first last [increment] body\fR
  160. X.br
  161. X\fBLoop\fR is a looping command, similar in behavior to the Tcl \fBfor\fR
  162. Xstatement, except that the \fBloop\fR statement achieves substantially higher
  163. Xperformance and is easier to code when the beginning and ending values of a
  164. Xloop are known and the loop variable is to be incremented by a known, fixed
  165. Xamount every time through.
  166. X.sp
  167. X The \fIvar\fR argument is the name of a Tcl variable that will contain the
  168. Xloop index.  The loop index is first set to the value specified by
  169. X\fIfirst\fR.  The Tcl interpreter is invoked upon \fIbody\fR zero or more
  170. Xtimes, where \fIvar\fR is incremented by \fIincrement\fR every time through
  171. Xthe loop, or by one if \fIincrement\fR is not specified.  \fIIncrement\fR can
  172. Xbe negative in which case the loop will count downwards.
  173. X.sp
  174. XWhen \fIvar\fR reaches \fIlast\fR, the loop terminates without a subsequent
  175. Xexecution of \fIbody\fR.  For instance, if the original \fBloop\fR parameters
  176. Xwould cause \fBloop\fR to terminate, say \fIfirst\fR was one, \fIlast\fR was
  177. Xzero and \fIincrement\fR was not specified or was non-negative, \fIbody\fR is
  178. Xnot executed at all and \fBloop\fR returns.
  179. X.sp
  180. XIf a \fBcontinue\fR command is invoked within \fIbody\fR then
  181. Xany remaining commands in the current execution of \fIbody\fR are skipped,
  182. Xas in the \fBfor\fR command.
  183. XIf a \fBbreak\fR command is invoked
  184. Xwithin \fIbody\fR
  185. Xthen the \fBloop\fR command will
  186. Xreturn immediately.
  187. X\fBLoop\fR returns an empty string.
  188. X'@endhelp
  189. X'
  190. X.SH "UNIX ACCESS COMMANDS
  191. X.PP
  192. XThese commands provide access to many basic Unix facilities, including process
  193. Xhandling, data and time, signal handling, linking and unlinking files,
  194. Xchanging file attributes, process and user attributes and the executing
  195. Xcommands via the shell.
  196. X'
  197. X'@help: extended/alarm
  198. X'@brief: Set a process alarm clock.
  199. X.TP
  200. X.B alarm \fIseconds\fR
  201. X.br
  202. XInstructs the system to send a SIGALRM signal in the specified number of
  203. Xseconds.  If \fIseconds\fR is 0, any previous alarm request is canceled.
  204. XOnly one alarm at a time may be active, the command returns the number of
  205. Xseconds left in the previous alarm.
  206. X'@endhelp
  207. X'
  208. X'@help: extended/chgrp
  209. X'@brief: Change file group.
  210. X.TP
  211. X.B chgrp \fIgroup\fR \fIfilelist\fR
  212. X.br
  213. XSet group of each file in the list \fIfilelist\fR to \fIgroup\fR, which is a
  214. Xgroup name or numeric group id.
  215. X'@endhelp
  216. X'@help: extended/chmod
  217. X'@brief: Set file permissions.
  218. X.TP
  219. X.B chmod [\fB-i\fR] \fImode\fR \fIfilelist\fR
  220. X.br
  221. XSet permissions of each of the files in the list \fIfilelist\fR to \fImode\fR,
  222. Xwhich is an absolute numeric mode or symbolic permissions as in the
  223. X\fBchmod(C)\fR UNIX command.  Normally absolute modes are assumed to be
  224. Xspecified in octal.  However Tcl stores numbers internally as integers.  The
  225. X\fB-i\fR option causes an absolute mode to be treated as a standard Tcl
  226. Xinteger (decimal unless prefixed by "0" of "0x").
  227. X'@endhelp
  228. X'@help: extended/chown
  229. X'@brief: Change file owner and/or group.
  230. X.TP
  231. X.B chown \fIowner\fR|{\fIowner group\fR} \fIfilelist\fR
  232. X.br
  233. XSet owner of each file in the list \fIfilelist\fR to \fIowner\fR, which is a
  234. Xowner name or numeric owner id.  If the first parameter is a list, then the
  235. Xowner is set to the first element of the list and the group is set to the
  236. Xsecond element of the list. \fIGroup\fR is a group name or numeric group id.
  237. XIf \fIgroup\fR is {}, then the file group will be set to the group for the
  238. Xassociated the specified user.
  239. X'@endhelp
  240. X'@help: extended/execvp
  241. X'@brief: Perform a process exec, executing a file.
  242. X.TP
  243. X.B execvp \fIprog\fR [\fIarg1...argN\fR]
  244. X.br
  245. XDo an execvp, replacing the current program with \fIprog\fR and passing the
  246. Xarguments \fIarg1...argN\fR. 
  247. X'@endhelp
  248. X'@help: extended/fmtclock
  249. X'@brief: Convert integer time to human-readable format.
  250. X.TP
  251. X.B fmtclock \fIclockval\fR [\fIformat\fR] [\fBGMT|{}\fR]
  252. X.br
  253. XConvert a value returned by \fBgetclock\fR or \fBfile\fR to human readable
  254. Xform.  The \fIformat\fR argument is a string that describes how to format the
  255. Xdate and time.  Field descriptors consist of a ``%'' followed by a field
  256. Xdescriptor. All other characters are copied into the result.  The available
  257. Xfield descriptors are:
  258. X.sp
  259. X.nf
  260. X.ft CW
  261. X    %% - Insert a %.
  262. X    %a - Abbreviated weekday name.
  263. X    %A - Full weekday name
  264. X    %b - Abbreviated month name.
  265. X    %B - Full month name.
  266. X    %d - Day of month (01 - 31).
  267. X    %D - Date as %m/%d/%y.
  268. X    %e - Day of month (1-31), no leading zeros.
  269. X    %h - Abbreviated month name.
  270. X    %H - Hour (00 - 23).
  271. X    %I - Hour (00 - 12).
  272. X    %j - Day number of year (001 - 366).
  273. X    %m - Month number (01 - 12).
  274. X    %M - Minute (00 - 59).
  275. X    %n - Insert a new line.
  276. X    %p - AM or PM.
  277. X    %r - Time as %I:%M:%S %p.
  278. X    %R - Time as %H:%M.
  279. X    %S - Seconds (00 - 59).
  280. X    %t - Insert a tab.
  281. X    %T - Time as %H:%M:%S.
  282. X    %U - Week number of year (01 - 52), Sunday is the first 
  283. X         day of the week.
  284. X    %w - Weekday number (Sunday = 0).
  285. X    %W - Week number of year (01 - 52), Monday is the first 
  286. X         day of the week.
  287. X    %x - Local specific date format.
  288. X    %X - Local specific time format.
  289. X    %y - Year within century (00 - 99).
  290. X    %Y - Year as ccyy (e.g. 1990)
  291. X    %Z - Time zone name.
  292. X.fi
  293. X.ft R
  294. X.sp
  295. XIf format is not specified, "%a %b %d %H:%M:%S %Z %Y" is used.  If \fBGMT\fR
  296. Xis specified, the time will be formated as Greenwich Mean Time. If the
  297. Xargument is not specified or is empty, then the local timezone will be used as
  298. Xdefined by the timezone environment variable.
  299. X'@endhelp
  300. X'@help: extended/fork
  301. X'@brief: Fork the current Tcl process.
  302. X.TP
  303. X.B fork
  304. X.br
  305. XFork the current TCL process.  Fork returns zero to the child process and the
  306. Xprocess number of the child to the parent process.  If an \fBexecvp\fR is not
  307. Xgoing to be performed before the forked process does output, then a
  308. X\fBflush\fR should be issued against \fBstdout\fR, \fBstderr\fR and any other
  309. Xopen output file before doing the \fBfork\fR.  Otherwise, output from the
  310. Xparent process pending in the buffers will also be outputted by the child
  311. Xprocess.
  312. X'@endhelp
  313. X'@help: extended/getclock
  314. X'@brief: Return current date and time as an integer value.
  315. X.TP
  316. X.B getclock
  317. X.br
  318. XReturn the current date and time as a system dependent integer value.  The
  319. Xunit of the value is seconds, allowing it to be used for relative time
  320. Xcalculations and so forth.
  321. X'@endhelp
  322. X'@help: extended/id
  323. X'@brief: Access, set or convert process, user and group information.
  324. X.TP
  325. X.B id options
  326. X.br
  327. XThis command provides a means of getting, setting and converting user, group
  328. Xand process ids.  The following versions of the \fBid\fR command are available:
  329. X'
  330. X.RS 5
  331. X.TP
  332. X.B id user \fR[\fIname\fR]
  333. X.TP
  334. X.B id userid \fR[\fIuid\fR]
  335. XSet the real and effective user ID to \fIname\fR or \fIuid\fR, if the
  336. Xname (or uid) is valid and permissions allow it.  If the name (or uid)
  337. Xis not specified, the current name (or uid) is returned.
  338. X.TP
  339. X.B id convert userid \fIuid\fR
  340. X.TP
  341. X.B id convert user \fIname\fR
  342. XConvert a user ID number to a user name, or vice versa.
  343. X.TP
  344. X.B id group \fR[\fIname\fR]
  345. X.TP
  346. X.B id groupid \fR[\fIgid\fR]
  347. XSet the real and effective group ID to \fIname\fR or \fIgid\fR, if the
  348. Xname (or gid) is valid and permissions allow it.  If the group name
  349. X(or gid) is not specified, the current group name (or gid) is returned.
  350. X.TP
  351. X.B id convert groupid \fIgid\fR
  352. X.TP
  353. X.B id convert group \fIname\fR
  354. XConvert a group ID number to a group name, or vice versa.
  355. X.TP
  356. X.B id effective user
  357. X.TP
  358. X.B id effective userid
  359. XReturn the effective user name, or effective user ID number, respectively.
  360. X.TP
  361. X.B id effective group
  362. X.TP
  363. X.B id effective groupid
  364. XReturn the effective group name, or effective group ID number, respectively.
  365. X.TP
  366. X.B id process
  367. X.br
  368. XReturn the process ID of the current process.
  369. X.TP
  370. X.B id process parent
  371. X.br
  372. XReturn the process ID of the parent of the current process.
  373. X.TP
  374. X.B id process group
  375. X.br
  376. XReturn the process group ID of the current process.
  377. X.TP
  378. X.B id process group set
  379. X.br
  380. XSet the process group ID of the current process to its process ID.
  381. X.RE
  382. X'@endhelp
  383. X'
  384. X'@help: extended/kill
  385. X'@brief: Send a signal to the specified process.
  386. X.TP
  387. X.B kill [\fIsignal\fR] \fIprocesslist\fR
  388. X.br
  389. XSend a signal to the each process in the list \fIprocesslist\fR, if permitted.
  390. X\fISignal\fR, if present, is the signal number or the symbolic name of the
  391. Xsignal, see the signal system call manual page.  The leading "SIG" is optional
  392. Xwhen the signal is specified by its symbolic name.
  393. X.PP
  394. XThe default for \fIsigno\fR is 15, SIGTERM.
  395. X'@endhelp
  396. X'@help: extended/link
  397. X'@brief: Make a link to a file.
  398. X.TP
  399. X.B link \fIsrcpath destpath\fR
  400. X.br
  401. XCreate a directory entry, \fIdestpath\fR, linking it to the existing file,
  402. X\fIsrcpath\fR.
  403. X'@endhelp
  404. X'@help: extended/mkdir
  405. X'@brief: Create a new directory
  406. X.TP
  407. X.B mkdir [-path] \fIdirList\fR
  408. X.br
  409. XCreate each of the directories in the list \fIdirList\fR.  The mode on the
  410. Xnew directories is 777, modified by the umask.  If \fB-path\fR is specified,
  411. Xthen any non-existent parent directories in the specified path are also
  412. Xcreated.
  413. X'@endhelp
  414. X'@help: extended/rmdir
  415. X'@brief: Remove directories
  416. X.TP
  417. X.B rmdir \fIdirList\fR
  418. X.br
  419. XRemove each of the directories in the list \fIdirList\fR.
  420. X'@endhelp
  421. X'@help: extended/signal
  422. X'@brief: Specify action to take when a signal is received.
  423. X.TP
  424. X.B signal \fIaction\fR \fIsiglist\fR [\fIcommand\fR]
  425. X.br
  426. XSpecify the action to take when a Unix signal occurs. \fISiglist\fR is a list
  427. Xof either the symbolic or numeric Unix signal (the SIG prefix is optional).
  428. X\fIAction\fR is one of the following actions to be performed on receipt of the
  429. Xsignal.
  430. X.IP
  431. X\fBdefault\fR - Terminate the process
  432. X.IP
  433. X\fBignore\fR - Ignore the signal.
  434. X.IP
  435. X\fBerror\fR - Generate a catchable Tcl error.  It will be as if the command
  436. Xthat was running returned an error.  The error code will be in the form:
  437. X.br
  438. X    {\fBUNIX SIG\fR \fIsigname\fR}
  439. X.br
  440. XFor the death of child signal, \fIsigname\fR will always be SIGCHLD, rather
  441. Xthan SIGCLD, to allow writting protable code.
  442. X.IP
  443. X\fBtrap\fR - When the signal occures, execute \fIcommand\fR and continue
  444. Xexecution if an error is not returned by \fIcommand\fR.  If will be executed
  445. Xin the global context and the symbolic signal name (e.g. SIGINT) will be
  446. Xsupplied in a global variable \fBsignalRecieved\fR.  If an error is returned,
  447. Xthen follow the standard Tcl error mechanism.  Often \fIcommand\fR will just
  448. Xdo an \fBexit\fR.
  449. X.IP
  450. X\fBget\fR - Retrieve the current settings of the specified signals.  A list
  451. Xwill be returned with each element containing one of `\fBdefault\fR',
  452. X`\fBignore\fR', `\fBerror\fR' or `\fBtrap\fR' corresponding to each signal in
  453. X\fIsiglist\fR.
  454. X.sp
  455. XFor all signals except \fBSIGCLD\fR, the signal action will remain enabled
  456. Xafter the specified signal has occured.  For \fBSIGCLD\fR (also known as
  457. X\fBSIGCHLD\fR), the signal will not be automatically reenable. A wait must be
  458. Xperformed before issuing another \fBsignal\fR command.  Signals are not
  459. Xprocessed until after the completion of the Tcl command that is executing when
  460. Xthe signal is recieved.
  461. X'@endhelp
  462. X'@help: extended/sleep
  463. X'@brief: Sleep Tcl for the specified number of seconds.
  464. X.TP
  465. X.B sleep \fIseconds\fR
  466. X.br
  467. XSleep the TCL process for \fIseconds\fR.
  468. X'@endhelp
  469. X'@help: extended/system
  470. X'@brief: Execute command via `system' call.
  471. X.TP
  472. X.B system \fIcommand\fR
  473. X.br
  474. XExecutes \fIcommand\fR via the system(3) call.  Differs from \fBexec\fR
  475. Xbecause \fBsystem\fR doesn't return stdout as the result or the command and
  476. X\fBsystem\fR goes through the shell to provide wildcard
  477. Xexpansion, redirection, etc,
  478. Xas is normal from a \fBsh\fR command line.  Returns the exit code of
  479. Xthe command.
  480. X'@endhelp
  481. X'@help: extended/times
  482. X'@brief: Get process and child execution times.
  483. X.TP
  484. X.B times
  485. XReturn a list containing the process and child execution times in the form:
  486. X.br
  487. X    \fIutime stime cutime cstime\fR
  488. X.br
  489. XSee times system call manual page.  The values are in milliseconds.
  490. X'@endhelp
  491. X'@help: extended/umask
  492. X'@brief: Get or set the file-creation mode mask.
  493. X.TP
  494. X.B umask [\fIoctalmask\fR]
  495. X.br
  496. XSets file-creation mode mask to the octal value of \fIoctalmask\fR.
  497. XIf \fIoctalmask\fR is omitted, the current mask is returned.
  498. X'@endhelp
  499. X'@help: extended/unlink
  500. X'@brief: Delete (unlink) files.
  501. X.TP
  502. X.B unlink \fIfilelist\fR
  503. X.br
  504. XDelete (unlink) the files whose names are in the list \fIfilelist\fR.
  505. X'@endhelp
  506. X'@help: extended/wait
  507. X'@brief: Wait for a child process to terminate.
  508. X.TP
  509. X.B wait \fIproclist\fR
  510. X.br
  511. XWaits for an any of the immediate child processes specified in the list
  512. X\fIproclist\fR to terminate or a signal to be received.  \fBWait\fR returns a
  513. Xlist of three elements: The first element is process id of the terminating
  514. Xprocess. If the process exited normally, the second element is `EXIT',
  515. Xfollowed by the error code.  If the process terminated because of a signal,
  516. Xthe second element is `SIG', followed by the signal name.  If the process is
  517. Xcurrently stopped, the second element is `STOP', followed by the signal name.
  518. X'@endhelp
  519. X'
  520. X.SH "FILE I/O COMMANDS"
  521. X.PP      
  522. XThe commands extend the stdio-style file I/O capabilities present in Tcl 6.1.
  523. XThese extensions include searching ASCII-sorted data files, copying files,
  524. Xduplicating file descriptors, control of file access options, retrieving open
  525. Xfile status, and creating pipes with the \fBpipe\fR system call. A interface
  526. Xto the \fBselect\fR system call is also available on Unix systems that support
  527. Xit.
  528. X.PP
  529. XIt should be noted that Tcl file I/O is implemented on top of the stdio 
  530. Xlibrary.  By default, the file is buffered, when communicating to a process
  531. Xthrough a pipe, a \fBflush\fR command should be issued to force the data
  532. Xout.  Alternatively, the \fBfcntl\fR command may be used to set the buffering
  533. Xmode to line buffered or unbuffered.
  534. X'@help: extended/bsearch
  535. X.TP
  536. X.B bsearch \fIfilehandle key\fR [\fIretvar\fR] [\fIcompare_proc\fR]
  537. X.br
  538. XSearch an opened sorted data file, \fIfilehandle\fR, for a line
  539. Xmatching \fIkey\fR. If \fIretvar\fR is specified, then the line from the
  540. Xfile is returned in \fIretvar\fR and the command returns \fB1\fR if \fIkey\fR
  541. Xwas found, and \fB0\fR if it was not found.  If \fIretvar\fR is not specified
  542. Xor is a null name, then the command returns the line that was found, or an
  543. Xempty string if \fIkey\fR is not found.
  544. X.sp
  545. XBy default, the key is matched against the first white-space seperated field
  546. Xin each line.  The field is treated as an ASCII string.  If \fIcompare_proc\fR
  547. Xis specified, then it is the name of a Tcl procedure to evaluate against each
  548. Xline read from the file.  This \fIcompare_proc\fR takes two arguments, the key
  549. Xand a line extracted from the file.  The compare routine should return a
  550. Xnumber less than zero if the key is less than the line, zero if the key
  551. Xmatches the line or greater than zero if the key is greater than the line.
  552. XThe file must be sorted in assending order by whatever criteria
  553. X\fIcompare_proc\fR uses to compare the key with the line.
  554. X'@endhelp
  555. X'@help: extended/copyfile
  556. X'@brief: Copy remainder of one open file into another.
  557. X.TP
  558. X.B copyfile \fIhandle1 handle2\fR
  559. X.br
  560. XCopies the rest of file specified by \fIhandle1\fR from its current position
  561. Xto the file specified by \fIhandle2\fR.
  562. X'@endhelp
  563. X'@help: extended/dup
  564. X'@brief: Duplicate an open filehandle.
  565. X.TP
  566. X.B dup \fIfilehandle\fR [\fIstdhandle\fR]
  567. X.br
  568. XDuplicate an open file.  A file handle is created that addresses the
  569. Xsame file as \fIfilehandle\fR.
  570. X.sp
  571. XA special case is allowed for dup-ing files to stdin, stdout or stderr.
  572. XIf \fIstdhandle\fR is specified, then it must be one of the
  573. Xstandard handles to dup \fIfilehandle\fR to.  
  574. X.sp
  575. X.nf
  576. X.ftCW
  577. X    proc ChildProcess {cmd inPipe outPipe} {
  578. X        if {[set childPid [fork]] == 0} {
  579. X            close stdin
  580. X            dup $inPipe stdin
  581. X            close $inPipe
  582. X
  583. X            close stdout
  584. X            dup $outPipe stdout
  585. X            close $outPipe
  586. X
  587. X            execvp $cmd
  588. X            # will never make it here...
  589. X        }
  590. X        return $childPid
  591. X    }
  592. X.ftR
  593. X.fi
  594. X'@endhelp
  595. X'@help: extended/fcntl
  596. X'@brief: Get or set open file access options.
  597. X.TP
  598. X.B fcntl \fIhandle\fR [\fIattribute value\fR] 
  599. X.br
  600. XThis command either returns a list of various boolean attributes controlling
  601. Xaccess to a file or set or clears one of the boolean attributes.  If
  602. X\fIattribute\fR and \fIvalue\fR are not specified, then the list of the 
  603. Xattributes that are set are return. If an attribute is not set, then it will
  604. Xnot be included in the list.  The following attributes maybe returned:
  605. X.IP
  606. X\fBRDONLY\fR - The file is opened for reading only.
  607. X.sp
  608. X\fBWRONLY\fR - The file is opened for writing only.
  609. X.sp
  610. X\fBRDWR\fR - The file is opened for reading and writing.
  611. X.sp
  612. X\fBAPPEND\fR - The file is opened for append only writes.  All writes will
  613. Xbe forced to the end of the file.
  614. X.sp
  615. X\fBNDELAY\fR - The file is to be accessed with non-blocking I/O.  See the
  616. X\fBread\fR system call for a description of how it affects the behaviour of
  617. Xfile reads
  618. X.sp
  619. X\fBCLEXEC\fR - Close the file on an process exec.  If the \fBexecvp\fR
  620. Xcommand or some other mechanism causes the process to exec, the file will
  621. Xbe closed.
  622. X.sp
  623. X\fBNOBUF\fR - The file is not buffered. If set, then there no stdio buffering
  624. Xfor the file.
  625. X.sp
  626. X\fBLINEBUF\fR - Output the file will be line buffered. The buffer will
  627. Xbe flushed when a newline is written, when the buffer is full,
  628. Xor when input is requested.
  629. X.sp
  630. XThe \fBAPPEND\fR, \fBNDELAY\fR, and \fBCLEXEC\fR attributes may be set or
  631. Xcleared by specifying the attribute name and a value \fB1\fR to set the
  632. Xattribute and \fB0\fR to clear it.
  633. X.sp
  634. XThe \fBNOBUF\fR and \fBLINEBUF\fR attributes may only be set (a value of
  635. X\fB1\fR) and only one of the options may be set.  Once set, they may not be
  636. Xcleared. Thees option should be set before any I/O operations have been done
  637. Xon the file.
  638. X'@endhelp
  639. X'
  640. X'@help: extended/fstat
  641. X'@brief: Obtain status information about a open file.
  642. X.TP
  643. X.B fstat \fIhandle\fR [\fIarrayvar\fR]
  644. X.br
  645. XObtain the status of an open file.  This differs from the \fBfile stat\fR
  646. Xcommand in that it takes a file handle rather than a file name.
  647. XIf \fIarrayvar\fR is
  648. Xspecified, the status information is returned in the following elements of
  649. Xthis array variable: \fBatime\fR, \fBctime\fR, \fBdev\fR, \fBgid\fR, 
  650. X\fBino\fR, \fBmode\fR, \fBmtime\fR, \fBnlink\fR, \fBsize\fR, \fBuid\fR.
  651. XEach element is a decimal string with the value of the corresponding
  652. Xfield from the \fBstat\fR return structure; see the manual entry
  653. Xfor \fBstat\fR for details on the meanings of the values.  If \fIarrayvar\fR
  654. Xis not specified, then the information is returned as a keyed list.  Each
  655. Xelement of the list is itself a list with the status value name paired with its
  656. Xvalue, in alphabetical order.  For example:
  657. X.sp 1
  658. X.IP
  659. X{atime\ 683617279} {ctime\ 683617310} {dev\ 298} {gid\ 50} {ino\ 6317}
  660. X{mode\ 33152} {mtime\ 683617310} {nlink\ 1} {size\ 924} {uid\ 200}
  661. X'@endhelp
  662. X'
  663. X'@help: extended/pipe
  664. X'@brief: Create a pipe.
  665. X.TP
  666. X.B pipe [\fIhandle_var_r handle_var_w\fR]
  667. X.br
  668. XCreate a pipe (see the pipe system call manual page).  If \fIhandle_var_r\fR
  669. Xand \fIhandle_var_r\fR are specified, then variable \fIhandle_var_r\fR will
  670. Xcontain the handle opened for reading and \fIhandle_var_w\fR will contain the
  671. Xhandle opened for writing.  If the handle variables are not specified, then a
  672. Xlist containing the read followed by the write handle is returned as the
  673. Xresult of the command.
  674. X'@endhelp
  675. X'@help: extended/select
  676. X'@brief: Synchronous I/O multiplexing.
  677. X.TP
  678. X.B select \fIreadhandles\fR [\fIwritehandles\fR] [\fIexcepthandles\fR] [\fItimeout\fR]
  679. X.br
  680. XThis command allows polling or blocking on multiple files being ready for
  681. Xfor reading, are ready for writing, or have an exceptional condition pending.
  682. X\fIreadhandles\fR, \fIwritehandles\fR, \fIexcepthandles\fR are each lists
  683. Xof file handles (as returned from \fBopen\fR) to query.  An empty list ({}) may
  684. Xbe specified if a category is not used. 
  685. X.sp
  686. XThe \fIreadhandles\fR files are checked to set if data is available for
  687. Xreading. The \fIwritehandles\fR are checked if they are clear for writing The
  688. X\fIexcepthandles\fR are checked to see if an exceptional condition has
  689. Xoccured.  The write and exception checking is most useful on devices, however,
  690. Xthe read checking is also very valuable when communicating with multiple
  691. Xprocesses through pipes.
  692. X.sp
  693. X\fITimeout\fR is a floating point timeout number of seconds.  If an empty
  694. Xlist is supplied (or the parameter is omitted), then no timeout is set.  If
  695. Xthe value is zero, then the \fBselect\fR command functions as a poll of the
  696. Xfiles.
  697. X.sp
  698. XIf the \fItimeout\fR period expires with none of the files becomming ready,
  699. Xthen the command returns an empty list.  Otherwise the command returns a 
  700. Xlist of three elements, each of those elements is a list of the file handles
  701. Xthat are ready in the read, write and exception classes.  If none are ready in
  702. Xa class, then that element will be the null list.  For example:
  703. X.nf
  704. X    select {file3 file4 file5} {file6 file7} {} 10.5
  705. X
  706. Xcould return
  707. X   {file3 file4} {file6} {}
  708. Xor perhaps
  709. X   file3 {} {}
  710. X.fi
  711. X.sp
  712. X'@endhelp
  713. X'
  714. X.SH "FILE SCANNING COMMANDS"
  715. X.PP
  716. XThese commands provide a facility to scan files, matching lines of the file
  717. Xagainst regular expressions and executing Tcl code on a match.  With this
  718. Xfacility you can use Tcl to do the sort of file processing
  719. Xthat are traditionally done with \fBawk\fR.  And since Tcl's approach is more
  720. Xdeclarative, some of the scripts that are really hard to write in awk are a
  721. Xsnap in Tcl.
  722. X.PP
  723. XFile scanning in Tcl centers around the concept of a \fIscan context\fR.
  724. XA scan context contains one or more match statements, which associate
  725. Xregular expressions to scan for with Tcl code to be executed when the
  726. Xexpressions are matched.
  727. X'
  728. X'@help: extended/scancontext
  729. X'@brief: Manage file scan contexts.
  730. X.TP
  731. X.B scancontext [\fIoption\fR]
  732. X.br
  733. XThis command manages file scan contexts.  A scan context is a collection of
  734. Xregular expressions and commands to execute when that regular expression
  735. Xmatches a line of the file.  A context may also have a single default match,
  736. Xto be applied against lines that do not match any of the regular expressions.
  737. XMultiple scan contexts may be defined and the may be reused on multiple files.
  738. XA scan context is identified by a context handle.  The \fBscancontext\fR
  739. Xcommand takes
  740. Xthe following forms:
  741. X.TP
  742. X.B scancontext create
  743. XCreate a new scan context.  The \fBscanmatch\fR command is used to define
  744. Xpatterns in the context.
  745. X'
  746. X.TP
  747. X.B scancontext delete \fIcontexthandle\fR
  748. X.br
  749. XDelete the scan context identified by \fIcontexthandle\fR and free all the
  750. Xmatch statements and compiled regular expressions associated with the
  751. Xspecified context.
  752. X'@endhelp
  753. X'@help: extended/scanfile
  754. X'@brief: Scan a file, executing match code when their patterns are matched.
  755. X.TP
  756. X.B scanfile \fIcontexthandle\fR \fIfilehandle\fR
  757. X.br
  758. XScan the file specified by \fIfilehandle\fR, starting at the
  759. Xcurrent file position.  Check all patterns in the scan context specified by
  760. X\fIcontexthandle\fR against
  761. Xit, executing the match commands corresponding to patterns matched.
  762. X'@endhelp
  763. X'@help: extended/scanmatch
  764. X'@brief: Specify tcl code to execute when scanfile pattern is matched.
  765. X.TP
  766. X.B scanmatch [\fB-nocase\fR] \fIcontexthandle\fR [\fIregexp\fR] \fIcommands\fR
  767. X.br
  768. XSpecify Tcl \fIcommands\fR, to be evaluated when \fIregexp\fR is matched by a
  769. X\fBscanfile\fR command.  The match is added to the scan context specified by
  770. X\fIcontexthandle\fR.  Several match statements may be
  771. Xspecified for a give context.  \fIRegexp\fR is a regular expression (see the
  772. X\fBregexp\fR command).  If \fB-nocase\fR is specified as the first argument,
  773. Xthe pattern is matched regardless of
  774. Xalphabetic case.
  775. X.sp
  776. XIf \fIregexp\fR is not specified, then a default match is
  777. Xspecified for the scan context.  The default match will be executed when a
  778. Xline of the file does not match any of the specified regular expressions.
  779. X.sp
  780. XThe array, \fBmatchInfo\fR, is available when the Tcl code is executed and
  781. Xcontains information about the file being scanned.  It is local to the top
  782. Xlevel of the match command unless declared global at that level.  If it is to
  783. Xbe used as a global it \fImust\fR be declared global before \fBscanfile\fR is
  784. Xcalled (since \fBscanfile\fR sets the \fBmatchInfo\fR before the match code is
  785. Xexecuted, a subsequent \fBglobal\fR will override the local variable).  The
  786. Xtext of the file line that was matched is in \fBmatchInfo(line)\fR.  The byte
  787. Xoffset into the file of the line that was matched is in
  788. X\fBmatchInfo(offset)\fR.  The line number of the line that was matched is in
  789. X\fBmatchInfo(linenum)\fR. This is relative to the first line scanned, not the
  790. Xfirst line of the file.  The first line is line number one.  The file handle
  791. Xof the file being scanned is in \fBmatchInfo(handle)\fR.
  792. X.PP
  793. XAll \fBscanmatch\fR patterns that match a line will be processed in the order
  794. Xthat the specifications were added to the scan context.  The remainder of the
  795. X\fBscanmatch\fR pattern-command pairs may be skipped for a file line if a
  796. X\fBcontinue\fR is executed in the match command.  If a \fBreturn\fR is
  797. Xexecuted in the body of the match command, the \fBscanfile\fR command in
  798. Xprogress returns with the value passed to \fBreturn\fR as it's value.
  799. X'@endhelp
  800. X'
  801. X.SH "MATH COMMANDS"
  802. X.PP
  803. XThese commands make many additonal math functions available in Tcl, including
  804. Xmin, max, trig functions, exponent, logarithm, square root, and more.  An
  805. Xinteger random number generator is provided as well.
  806. X'@help: extended/acos
  807. X'@brief: Return the arccosine of a number.
  808. X.TP
  809. X.B acos \fInum\fR
  810. X.br
  811. XReturns the arccosine of \fInum\fR.  \fInum\fR is in radians.
  812. X'@endhelp
  813. X'@help: extended/asin
  814. X'@brief: Return the arcsin of a number.
  815. X.TP
  816. X.B asin \fInum\fR
  817. X.br
  818. XReturns the arcsin of \fInum\fR.  \fInum\fR is in radians.
  819. X'@endhelp
  820. X'@help: extended/atan
  821. X'@brief: Return the arctangent of a number..
  822. X.TP
  823. X.B atan \fInum\fR
  824. X.br
  825. XReturns the arctangent of \fInum\fR.  \fInum\fR is in radians.
  826. X'@endhelp
  827. X'@help: extended/ceil
  828. X'@brief: Return the smallest integer not less than a floating point number.
  829. X.TP
  830. X.B ceil \fInum\fR
  831. X.br
  832. XReturns the smallest integer not less than \fInum\fR (floating point).
  833. X'@endhelp
  834. X'@help: extended/cos
  835. X'@brief: Return the cosine of a number.
  836. X.TP
  837. X.B cos \fInum\fR
  838. X.br
  839. XReturns the cosine of \fInum\fR.  \fInum\fR is in radians.
  840. X'@endhelp
  841. X'@help: extended/cosh
  842. X'@brief: Return the hyperbolic cosine of a number.
  843. X.TP
  844. X.B cosh \fInum\fR
  845. X.br
  846. XReturns the hyperbolic cosine of \fInum\fR.
  847. X'@endhelp
  848. X'@help: extended/exp
  849. X'@brief: Return e to the power of a number.
  850. X.TP
  851. X.B exp \fInum\fR
  852. X.br
  853. XReturns \fIe\fR to the power of \fInum\fR.
  854. X'@endhelp
  855. X'@help: extended/fabs
  856. X'@brief: Return the absolute value of the floating point number.
  857. X.TP
  858. X.B fabs \fInum\fR
  859. X.br
  860. XReturns the absolute value of \fInum\fR (floating point).
  861. X'@endhelp
  862. X'@help: extended/floor
  863. X'@brief: Return the largest integer not greater than a floating point number.
  864. X.TP
  865. X.B floor \fInum\fR
  866. X.br
  867. XReturns the largest integer not greater than \fInum\fR (floating point).
  868. X'@endhelp
  869. X'@help: extended/fmod
  870. X'@brief: Perform a floating point modulus operation.
  871. X.TP
  872. X.B fmod \fInum1\fR \fInum2\fR
  873. X.br
  874. XReturns \fInum1\fR modulo \fInum2\fR.
  875. X'@endhelp
  876. X'@help: extended/max
  877. X'@brief: Return the argument that has the highest numeric value.
  878. X.TP
  879. X.B max \fInum1 num2\fR [..\fInumN\fR]
  880. X.br
  881. XReturns the argument that has the highest numeric value. The arguments,
  882. X\fInumN\fR may be any interger or floating point values.
  883. X'@endhelp
  884. X'@help: extended/min
  885. X'@brief: Return the argument that has the lowest numeric value.
  886. X.TP
  887. X.B min \fInum1 num2\fR [..\fInumN\fR]
  888. X.br
  889. XReturns the argument that has the lowest numeric value. The arguments,
  890. X\fInumN\fR may be any interger or floating point values.
  891. X'@endhelp
  892. X'@help: extended/log
  893. X'@brief: Return the natural logarithm of a number.
  894. X.TP
  895. X.B log \fInum\fR
  896. X.br
  897. XReturns the natural logarithm of \fInum\fR.
  898. X'@endhelp
  899. X'@help: extended/log10
  900. X'@brief: Return the logarithm base 10 of a number.
  901. X.TP
  902. X.B log10 \fInum\fR
  903. X.br
  904. XReturns the logarithm base 10 of \fInum\fR.
  905. X'@endhelp
  906. X'@help: extended/pow
  907. X'@brief: Return a number to the power of another number.
  908. X.TP
  909. X.B pow \fInum1\fR \fInum2\fR
  910. X.br
  911. XReturns \fInum1\fR to the power of \fInum2\fR.
  912. X'@endhelp
  913. X'@help: extended/random
  914. X'@brief: Return a pseudorandom integer or set the seed.
  915. X.TP
  916. X.B random \fBlimit\fR | \fBseed\fR [\fIseedval\fR]
  917. X.br
  918. XGenerate a pseudorandom integer number greater than or equal to zero and
  919. Xless than \fIlimit\fR.  If \fBseed\fR is specified, then the command
  920. Xresets the random number generator to a starting point derived from 
  921. Xthe \fBseedval\fR. This allows one to reproduce a random number sequence
  922. Xfor testing purposes.
  923. XIf \fIseedval\fR is omitted, then the seed is set to a value based on current
  924. Xsystem state and the current time, providing a reasonably interesting and
  925. Xever-changing seed.
  926. X'@endhelp
  927. X'@help: extended/sin
  928. X'@brief: Return the sin of a number.
  929. X.TP
  930. X.B sin \fInum\fR
  931. X.br
  932. XReturns the sin of \fInum\fR.  \fInum\fR is in radians.
  933. X'@endhelp
  934. X'@help: extended/tan
  935. X'@brief: Return the tangent of a number.
  936. X.TP
  937. X.B tan \fInum\fR
  938. X.br
  939. XReturns the tangent of \fInum\fR.  \fInum\fR is in radians.
  940. X'@endhelp
  941. X'@help: extended/sinh
  942. X'@brief: Return the hyperbolic sin of a number.
  943. X.TP
  944. X.B sinh \fInum\fR
  945. X.br
  946. XReturns the hyperbolic sin of \fInum\fR.
  947. X'@endhelp
  948. X'@help: extended/sqrt
  949. X'@brief: Return the square root of a number.
  950. X.TP
  951. X.B sqrt \fInum\fR
  952. X.br
  953. XReturns the square root of \fInum\fR.
  954. X'@endhelp
  955. X'@help: extended/tanh
  956. X'@brief: Return the hyperbolic tangent of a number.
  957. X.TP
  958. X.B tanh \fInum\fR
  959. X.br
  960. XReturns the hyperbolic tangent of \fInum\fR.
  961. X'@endhelp
  962. X'
  963. X.SH "LIST MANINIPULATION COMMANDS"
  964. X.PP
  965. XExtended Tcl provides two additional list manipulation commands.
  966. X'@help: extended/lempty
  967. X'@brief: Determine if a list is empty. 
  968. X.TP
  969. X.B lempty \fIlist\fR
  970. X.br
  971. XDetermine if the specified list is empty.
  972. XIf empty, 1 is returned, otherwise, 0 is returned.  This command is an
  973. Xalternative to comparing a list to an empty string.
  974. X'@endhelp
  975. X'
  976. X'@help: extended/lvarpop
  977. X'@brief: Pop or replace the specified element from a list.
  978. X.TP
  979. X.B lvarpop \fIvar\fR [\fIindex\fR \fR[\fIstring\fR]]
  980. X.br
  981. XThe \fBlvarpop\fR command pops (deletes) the element indexed by
  982. X\fIindex\fR from the list in the variable \fIvar\fR.
  983. XIf \fIindex\fR is omitted, then 0 is assumed.
  984. XIf \fIstring\fR, is specified, then the deleted element is replaced by 
  985. X\fIstring\fR. The replaced or deleted element is returned.
  986. XThus ``lvarpop argv 0'' returns the first element and sets argv to contain the
  987. Xremainder of the string.
  988. X'@endhelp
  989. X'
  990. X'@help: extended/keyedlists
  991. X'@brief: Introduction to keyed lists
  992. X.SH "KEYED LISTS"
  993. X.PP
  994. XExtended Tcl defines a special type of list referred to as \fIkeyed lists\fR.
  995. XThese lists provided a structured data type built upon standard Tcl lists.
  996. XThis provides a functionality similar to \fBstruct\fRs in the C 
  997. Xprogramming language.
  998. XA keyed list is a list in which each element is a key and value pair field.
  999. XThese elements are actually lists themselves, were the key is the first
  1000. Xelement of the list, and the value is the second.  The key-value pairs are
  1001. Xrefered to as \fIfields\fR.
  1002. XThis is an example of a keyed list:
  1003. X.IP
  1004. X    {{NAME {Frank Zappa}} {JOB {musician and composer}}
  1005. X'
  1006. X.PP
  1007. XBy convention, `.' is a field name separator, allowing nesting of fields,
  1008. Xeven though keyed list are only one level deep.  Currently none of the commands
  1009. Xexplictly function on nested field names, but they may in a future release,
  1010. Xso `.' should not be used for other than a field separator in a name.  For
  1011. Xexample:
  1012. X.IP
  1013. X    {{ID 106} {NAME.FIRST Frank} {NAME.LAST Zappa}}
  1014. X.PP
  1015. XAll key list functions take the name of the variable containing the keyed list
  1016. Xas an argument (i.e. passed by reference) rather than the value.
  1017. X'@endhelp
  1018. X'@help: extended/keyldel
  1019. X'@brief: Delete a field of a keyed list.
  1020. X.TP
  1021. X.B keyldel \fIlistvar\fR \fIkey\fR
  1022. X.br
  1023. XDelete the field specified by \fIkey\fR from the keyed list in the
  1024. Xvariable \fIlistvar\fR.  This removes both the key and the value from
  1025. Xthe keyed list.
  1026. X'@endhelp
  1027. X'@help: extended/keylget
  1028. X'@brief: Get the value of a field of a keyed list.
  1029. X.TP
  1030. X.B keylget \fIlistvar\fR \fIkey\fR [\fIretvar\fR | {}]
  1031. X.br
  1032. XReturn the value associated with the \fIkey\fR out of keyed list in the
  1033. Xvariable \fIlistvar\fR.  If \fIretvar\fR is not specified, then the value will
  1034. Xbe returned as the result of the command.  If \fIkey\fR is not found in the
  1035. Xlist, an error will result.  If \fIretvar\fR is specified and \fIkey\fR is in
  1036. Xthe list, then the value is returned in the variable \fIretvar\fR and the
  1037. Xcommand returns one. 
  1038. XIf \fIkey\fR is not in the list, the command will return \fB0\fR
  1039. Xand \fIretvar\fR will be unchanged.  If \fB{}\fR is specified for
  1040. X\fIretvar\fR, the value is not returned, only the presence of the key is
  1041. Xdetermined.
  1042. X'@endhelp
  1043. X'
  1044. X'@help: extended/keylset
  1045. X'@brief: Set the value of a field of a keyed list.
  1046. X.TP
  1047. X.B keylset \fIlistvar\fR \fIkey\fR \fIvalue\fR
  1048. X.br
  1049. XSet the value associated with the \fIkey\fR in the keyed list in the
  1050. Xvariable \fIlistvar\fR  to \fIvalue\fR.
  1051. XIf \fRlistvar\fR does not exists, it is created.  If \fIkey\fR
  1052. Xis not currently in the list, it will be added.  If it already exists, 
  1053. X\fIvalue\fR overrides the existing value.
  1054. X'@endhelp
  1055. X'
  1056. X.SH "STRING AND CHARACTER MANIPULATION COMMANDS"
  1057. X.PP
  1058. XThe commands provide additional functionality to classify characters, convert
  1059. Xcharacters between character and numeric values, and index into a string,
  1060. Xdetermine the length of a string, extract a range of character from a string,
  1061. Xreplicate a string a number of times, and transliterate a string (similar to
  1062. Xthe \fItr\fR command).
  1063. X'
  1064. X'@help: extended/cindex
  1065. X'@brief: Return indexed character from string.
  1066. X.TP
  1067. X.B cindex \fIstring index\fR
  1068. X.br
  1069. XReturns the character indexed by \fIindex\fR (zero based) from \fIstring\fR.
  1070. XThis command is a shortcut for:
  1071. X.nf
  1072. X.ft CW
  1073. X    \fBstring index\fR \fIstring index\fR
  1074. X.ft R
  1075. X.fi
  1076. X'@endhelp
  1077. X'@help: extended/clength
  1078. X'@brief: Return length of specified string.
  1079. X.TP
  1080. X.B clength \fIstring\fR
  1081. X.br
  1082. XReturns the length of \fIstring\fR in characters.  
  1083. XThis command is a shortcut for:
  1084. X.nf
  1085. X.ft CW
  1086. X    \fBstring length\fR \fIstring\fR
  1087. X.ft R
  1088. X.fi
  1089. X'@endhelp
  1090. X'@help: extended/crange
  1091. X'@brief: Return range of characters from string.
  1092. X.TP
  1093. X.B crange \fIstring first last\fR
  1094. X.br
  1095. XReturns a range of characters from \fIstring\fR starting at \fIfirst\fR
  1096. X(zero-based) until \fIlast\fR.  The special keyword \fBend\fR may be specified
  1097. Xfor \fIlast\fR to indicate that the remainder of the string is to be 
  1098. Xextracted.  This command is a short cut for:
  1099. X.nf
  1100. X.ft CW
  1101. X    \fBstring range\fR \fIstring first last\fR
  1102. X.ft R
  1103. X.fi
  1104. X'@endhelp
  1105. X'@help: extended/csubstr
  1106. X'@brief: Return a substring from within a string.
  1107. X.TP
  1108. X.B csubstr \fIstring first length\fR
  1109. X.br
  1110. XReturns a range of characters from \fIstring\fR starting at \fIfirst\fR 
  1111. X(zero-based) for \fIlength\fR characters.
  1112. XThe special keyword \fBend\fR may be specified
  1113. Xfor \fIlength\fR to indicate that the remainder of the string is to be 
  1114. Xextracted.  This command is a short cut for:
  1115. X.nf
  1116. X.ft CW
  1117. X    \fBstring range\fR \fIstring first\fR [\fBexpr\fR \fIlength\fB-1\fR]
  1118. X.ft R
  1119. X.fi
  1120. X'@endhelp
  1121. X'@help: extended/ctype
  1122. X'@brief: Determine if string has various characteristics.
  1123. X.TP
  1124. X.B ctype \fIclass string\fR 
  1125. X.br
  1126. XDetermine if all characters in \fIstring\fR are in of the specified
  1127. X\fIclass\fR.  Returns \fB1\fR if they are all of \fIclass\fR and \fB0\fR if
  1128. Xthey are not or if the string is null. This command also provides another
  1129. Xmethod (besides \fBformat\fR and \fBscan\fR) of converting between an ASCII
  1130. Xcharacter and its numeric value.  The following \fBctype\fR commands are
  1131. Xavailable.
  1132. X.RS 5
  1133. X.TP
  1134. X.B ctype alnum \fIstring\fR
  1135. XTests that all characters are alphabetic or numeric characters as defined by
  1136. Xthe character set.
  1137. X.TP
  1138. X.B ctype alpha \fIstring\fR
  1139. XTests that all characters are alphabetic characters as defined by the
  1140. Xcharacter set.
  1141. X.TP
  1142. X.B ctype ascii \fIstring\fR
  1143. XTests that all characters are an ASCII character (a non-negative number less
  1144. Xthan 0200).
  1145. X.TP
  1146. X.B ctype char \fInumber\fR
  1147. XConverts the numeric value, \fIstring\fR, to an ASCII character.  Number must
  1148. Xbe in the range 0 through 255.
  1149. X.TP
  1150. X.B ctype cntrl \fIstring\fR
  1151. XTests that all characters are ``control characters'' as defined by the
  1152. Xcharacter set.
  1153. X.TP
  1154. X.B ctype digit \fIstring\fR
  1155. XTests that all characters are valid decimal digits, i.e. 0 through 9.
  1156. X.TP
  1157. X.B ctype graph \fIstring\fR
  1158. XTests that all characters within are any character for which \fIctype print\fR
  1159. Xis true, except for space characters.
  1160. X.TP
  1161. X.B ctype lower \fIstring\fR
  1162. XTests that all characters are lowercase letters as defined by the character
  1163. Xset.
  1164. X.TP
  1165. X.B ctype ord \fIcharacter\fR
  1166. XConvert a character into its decimal numeric value.  The string must be one
  1167. Xcharacter long.
  1168. X.TP
  1169. X.B ctype space \fIstring\fR
  1170. XTests that all characters are either a space, horizontal-tab, carriage
  1171. Xreturn, newline, vertical-tab, or form-feed.
  1172. X.TP
  1173. X.B ctype print \fIstring\fR
  1174. XTests that all characters are a space or any character for which \fIctype
  1175. Xalnum\fR or \fIctype punct\fR is true or other ``printing character'' as
  1176. Xdefined by the character set.
  1177. X.TP
  1178. X.B ctype punct \fIstring\fR
  1179. XTests that all characters are made up of any of the characters
  1180. Xother than the ones for which
  1181. X\fBalnum\fR, \fBcntrl\fR, or \fBspace\fR is true.
  1182. X.TP
  1183. X.B ctype upper \fIstring\fR
  1184. XTests that all characters are uppercase letters as defined by the character
  1185. Xset.
  1186. X.TP
  1187. X.B ctype xdigit \fIstring\fR
  1188. XTests that all characters are valid hexadecimal digits, that is \fI0\fR
  1189. Xthrough \fI9\fR, a through \fIf\fR or \fIA\fR through \fIF\fR.
  1190. X.RE
  1191. X'@endhelp
  1192. X'@help: extended/replicate
  1193. X'@brief: Replicate string a number of times.
  1194. X.TP
  1195. X.B replicate \fIstring count\fR
  1196. X.br
  1197. XReturns \fIstring\fR replicated \fIcount\fR times.
  1198. X'@endhelp
  1199. X'@help: extended/translit
  1200. X'@brief: Translate characters in string according to patterns.
  1201. X.TP
  1202. X.B \fBtranslit \fIinrange outrange string\fR
  1203. X.br
  1204. XTranslate characters in \fIstring\fR matching characters in \fIinrange\fR
  1205. Xto the corresponding character in \fIoutrange\fR. \fIInrange\fR and 
  1206. X\fIoutrange\fR may be list of characters or a range in the form `A-M'.
  1207. X.nf
  1208. X.ft CW
  1209. X    Example:
  1210. X        translit a-z A-Z foobar
  1211. X    returns 
  1212. X        FOOBAR
  1213. X.ft R
  1214. X.if
  1215. X'@endhelp
  1216. END_OF_FILE
  1217. if test 42986 -ne `wc -c <'extended/man/TclX.man'`; then
  1218.     echo shar: \"'extended/man/TclX.man'\" unpacked with wrong size!
  1219. fi
  1220. # end of 'extended/man/TclX.man'
  1221. fi
  1222. echo shar: End of archive 23 \(of 23\).
  1223. cp /dev/null ark23isdone
  1224. MISSING=""
  1225. 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 ; do
  1226.     if test ! -f ark${I}isdone ; then
  1227.     MISSING="${MISSING} ${I}"
  1228.     fi
  1229. done
  1230. if test "${MISSING}" = "" ; then
  1231.     echo You have unpacked all 23 archives.
  1232.     echo "Now cd to "extended", edit the makefile, then do a "make""
  1233.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1234. else
  1235.     echo You still need to unpack the following archives:
  1236.     echo "        " ${MISSING}
  1237. fi
  1238. ##  End of shell archive.
  1239. exit 0
  1240.  
  1241. exit 0 # Just in case...
  1242. -- 
  1243. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1244. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1245. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1246. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1247.