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

  1. Newsgroups: comp.sources.misc
  2. From: karl@sugar.neosoft.com (Karl Lehenbauer)
  3. Subject:  v26i009:  tclx - extensions and on-line help for tcl 6.1, Part09/23
  4. Message-ID: <1991Nov19.005525.8857@sparky.imd.sterling.com>
  5. X-Md4-Signature: c36cded47e52233811d835850fd87680
  6. Date: Tue, 19 Nov 1991 00:55:25 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
  10. Posting-number: Volume 26, Issue 9
  11. Archive-name: tclx/part09
  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 9 (of 23)."
  21. # Contents:  extended/man/Keylist.man extended/man/MathErr.man
  22. #   extended/man/tcl.tlib.man extended/tcllib/help/commands/string
  23. #   extended/tests/filescan.test extended/tests/fmath.test
  24. #   extended/tests/help.test extended/tests/keylist.test
  25. # Wrapped by karl@one on Wed Nov 13 21:50:21 1991
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'extended/man/Keylist.man' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'extended/man/Keylist.man'\"
  29. else
  30. echo shar: Extracting \"'extended/man/Keylist.man'\" \(5511 characters\)
  31. sed "s/^X//" >'extended/man/Keylist.man' <<'END_OF_FILE'
  32. X.\"----------------------------------------------------------------------------
  33. X.\" The definitions below are for supplemental macros used in Sprite
  34. X.\" manual entries.
  35. X.\"
  36. X.\" .HS name section [date [version]]
  37. X.\"    Replacement for .TH in other man pages.  See below for valid
  38. X.\"    section names.
  39. X.\"
  40. X.\" .AP type name in/out [indent]
  41. X.\"    Start paragraph describing an argument to a library procedure.
  42. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  43. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  44. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  45. X.\"    needed;  use .AS below instead)
  46. X.\"
  47. X.\" .AS [type [name]]
  48. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  49. X.\"    name are examples of largest possible arguments that will be passed
  50. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  51. X.\"
  52. X.\" .BS
  53. X.\"    Start box enclosure.  From here until next .BE, everything will be
  54. X.\"    enclosed in one large box.
  55. X.\"
  56. X.\" .BE
  57. X.\"    End of box enclosure.
  58. X.\"
  59. X.\" .VS
  60. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  61. X.\"    of man pages.
  62. X.\"
  63. X.\" .VE
  64. X.\"    End of vertical sidebar.
  65. X.\"
  66. X.\" .DS
  67. X.\"    Begin an indented unfilled display.
  68. X.\"
  69. X.\" .DE
  70. X.\"    End of indented unfilled display.
  71. X.\"
  72. X'    # Heading for Sprite man pages
  73. X.de HS
  74. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  75. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  76. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  77. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  78. X.if t .wh -1.3i ^B
  79. X.nr ^l \\n(.l
  80. X.ad b
  81. X..
  82. X'    # Start an argument description
  83. X.de AP
  84. X.ie !"\\$4"" .TP \\$4
  85. X.el \{\
  86. X.   ie !"\\$2"" .TP \\n()Cu
  87. X.   el          .TP 15
  88. X.\}
  89. X.ie !"\\$3"" \{\
  90. X.ta \\n()Au \\n()Bu
  91. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  92. X.\".b
  93. X.\}
  94. X.el \{\
  95. X.br
  96. X.ie !"\\$2"" \{\
  97. X\&\\$1    \\fI\\$2\\fP
  98. X.\}
  99. X.el \{\
  100. X\&\\fI\\$1\\fP
  101. X.\}
  102. X.\}
  103. X..
  104. X'    # define tabbing values for .AP
  105. X.de AS
  106. X.nr )A 10n
  107. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  108. X.nr )B \\n()Au+15n
  109. X.\"
  110. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  111. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  112. X..
  113. X'    # BS - start boxed text
  114. X'    # ^y = starting y location
  115. X'    # ^b = 1
  116. X.de BS
  117. X.br
  118. X.mk ^y
  119. X.nr ^b 1u
  120. X.if n .nf
  121. X.if n .ti 0
  122. X.if n \l'\\n(.lu\(ul'
  123. X.if n .fi
  124. X..
  125. X'    # BE - end boxed text (draw box now)
  126. X.de BE
  127. X.nf
  128. X.ti 0
  129. X.mk ^t
  130. X.ie n \l'\\n(^lu\(ul'
  131. X.el \{\
  132. X.\"    Draw four-sided box normally, but don't draw top of
  133. X.\"    box if the box started on an earlier page.
  134. X.ie !\\n(^b-1 \{\
  135. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  136. X.\}
  137. X.el \}\
  138. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  139. X.\}
  140. X.\}
  141. X.fi
  142. X.br
  143. X.nr ^b 0
  144. X..
  145. X'    # VS - start vertical sidebar
  146. X'    # ^Y = starting y location
  147. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  148. X.de VS
  149. X.mk ^Y
  150. X.ie n 'mc \s12\(br\s0
  151. X.el .nr ^v 1u
  152. X..
  153. X'    # VE - end of vertical sidebar
  154. X.de VE
  155. X.ie n 'mc
  156. X.el \{\
  157. X.ev 2
  158. X.nf
  159. X.ti 0
  160. X.mk ^t
  161. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  162. X.sp -1
  163. X.fi
  164. X.ev
  165. X.\}
  166. X.nr ^v 0
  167. X..
  168. X'    # Special macro to handle page bottom:  finish off current
  169. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  170. X'    # page bottom macro.
  171. X.de ^B
  172. X.ev 2
  173. X'ti 0
  174. X'nf
  175. X.mk ^t
  176. X.if \\n(^b \{\
  177. X.\"    Draw three-sided box if this is the box's first page,
  178. X.\"    draw two sides but no top otherwise.
  179. 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
  180. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  181. X.\}
  182. X.if \\n(^v \{\
  183. X.nr ^x \\n(^tu+1v-\\n(^Yu
  184. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  185. X.\}
  186. X.bp
  187. X'fi
  188. X.ev
  189. X.if \\n(^b \{\
  190. X.mk ^y
  191. X.nr ^b 2
  192. X.\}
  193. X.if \\n(^v \{\
  194. X.mk ^Y
  195. X.\}
  196. X..
  197. X'    # DS - begin display
  198. X.de DS
  199. X.RS
  200. X.nf
  201. X.sp
  202. X..
  203. X'    # DE - end display
  204. X.de DE
  205. X.fi
  206. X.RE
  207. X.sp .5
  208. X..
  209. X.\"----------------------------------------------------------------------------
  210. X.HS "Keyed Lists" tcl
  211. X.BS
  212. X'@index: Tcl_GetKeyedListField Tcl_SetKeyedListField Tcl_DeleteKeyedListField
  213. X.SH NAME
  214. XTcl_GetKeyedListField, Tcl_SetKeyedListField, Tcl_DeleteKeyedListField -
  215. XKeyed list management routines.
  216. X.SH SYNOPSIS
  217. X.nf
  218. X\fB#include <tclExtend.h>\fR
  219. X.sp
  220. Xint
  221. X\fBTcl_GetKeyedListField\fR (\fIinterp, fieldName, keyedList, fieldValuePtr\fR);
  222. X.sp
  223. Xchar *
  224. X\fBTcl_SetKeyedListField\fR (\fIinterp, fieldName, fieldvalue, keyedList\fR);
  225. X.sp
  226. Xchar *
  227. X\fBTcl_DeleteKeyedListField\fR (\fIinterp, fieldName, keyedList\fR);
  228. X'
  229. X.SH ARGUMENTS
  230. X.AS Tcl_Interp **fieldValuePtr
  231. X.AP Tcl_Interp *interp in
  232. XInterpreter to use for error reporting.
  233. X.AP "const char" *fieldName in
  234. XThe name of the field (the key) to perform the operation on.
  235. X.AP "const char" *keyedList in
  236. XThe keyed list to perform the operation on.
  237. X.AP char **fieldValuePtr out
  238. XA pointer to a dynamicly allocated string containing the field value is
  239. Xreturned here.
  240. X.BE
  241. X
  242. X.SH DESCRIPTION
  243. X.PP
  244. XThese routines perform operations on keyed lists.  See the \fIExtended Tcl\fR 
  245. Xman page for a description of keyed lists.
  246. X.PP
  247. X\fBTcl_GetKeyedListField\fR retrieves a field value from a keyed list. It
  248. Xreturns \fBTCL_OK\fR if the field was found, \fBTCL_BREAK\fR if the field was
  249. Xnot found and \fBTCL_ERROR\fR if an error occured.  NULL maybe specifled for
  250. X\fIfieldValuePtr\fR to check for the presences of a field without actually 
  251. Xextracting the value.
  252. X.PP
  253. X\fBTcl_SetKeyedListField\fR sets a field value in keyed list. It returns a
  254. Xpointer to a dynamically allocated string containing the new list, or NULL if
  255. Xan error occured.
  256. X.PP
  257. X\fBTcl_DeleteKeyedListField\fR deletes a field from keyed list. It returns a
  258. Xpointer to a dynamically allocated string containing the new list, or NULL if
  259. Xan error occured.
  260. X'
  261. X.SH KEYWORDS
  262. Xlists, keyed
  263. X
  264. END_OF_FILE
  265. if test 5511 -ne `wc -c <'extended/man/Keylist.man'`; then
  266.     echo shar: \"'extended/man/Keylist.man'\" unpacked with wrong size!
  267. fi
  268. # end of 'extended/man/Keylist.man'
  269. fi
  270. if test -f 'extended/man/MathErr.man' -a "${1}" != "-c" ; then 
  271.   echo shar: Will not clobber existing file \"'extended/man/MathErr.man'\"
  272. else
  273. echo shar: Extracting \"'extended/man/MathErr.man'\" \(5171 characters\)
  274. sed "s/^X//" >'extended/man/MathErr.man' <<'END_OF_FILE'
  275. X.\"----------------------------------------------------------------------------
  276. X.\" The definitions below are for supplemental macros used in Sprite
  277. X.\" manual entries.
  278. X.\"
  279. X.\" .HS name section [date [version]]
  280. X.\"    Replacement for .TH in other man pages.  See below for valid
  281. X.\"    section names.
  282. X.\"
  283. X.\" .AP type name in/out [indent]
  284. X.\"    Start paragraph describing an argument to a library procedure.
  285. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  286. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  287. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  288. X.\"    needed;  use .AS below instead)
  289. X.\"
  290. X.\" .AS [type [name]]
  291. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  292. X.\"    name are examples of largest possible arguments that will be passed
  293. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  294. X.\"
  295. X.\" .BS
  296. X.\"    Start box enclosure.  From here until next .BE, everything will be
  297. X.\"    enclosed in one large box.
  298. X.\"
  299. X.\" .BE
  300. X.\"    End of box enclosure.
  301. X.\"
  302. X.\" .VS
  303. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  304. X.\"    of man pages.
  305. X.\"
  306. X.\" .VE
  307. X.\"    End of vertical sidebar.
  308. X.\"
  309. X.\" .DS
  310. X.\"    Begin an indented unfilled display.
  311. X.\"
  312. X.\" .DE
  313. X.\"    End of indented unfilled display.
  314. X.\"
  315. X'    # Heading for Sprite man pages
  316. X.de HS
  317. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  318. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  319. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  320. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  321. X.if t .wh -1.3i ^B
  322. X.nr ^l \\n(.l
  323. X.ad b
  324. X..
  325. X'    # Start an argument description
  326. X.de AP
  327. X.ie !"\\$4"" .TP \\$4
  328. X.el \{\
  329. X.   ie !"\\$2"" .TP \\n()Cu
  330. X.   el          .TP 15
  331. X.\}
  332. X.ie !"\\$3"" \{\
  333. X.ta \\n()Au \\n()Bu
  334. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  335. X.\".b
  336. X.\}
  337. X.el \{\
  338. X.br
  339. X.ie !"\\$2"" \{\
  340. X\&\\$1    \\fI\\$2\\fP
  341. X.\}
  342. X.el \{\
  343. X\&\\fI\\$1\\fP
  344. X.\}
  345. X.\}
  346. X..
  347. X'    # define tabbing values for .AP
  348. X.de AS
  349. X.nr )A 10n
  350. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  351. X.nr )B \\n()Au+15n
  352. X.\"
  353. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  354. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  355. X..
  356. X'    # BS - start boxed text
  357. X'    # ^y = starting y location
  358. X'    # ^b = 1
  359. X.de BS
  360. X.br
  361. X.mk ^y
  362. X.nr ^b 1u
  363. X.if n .nf
  364. X.if n .ti 0
  365. X.if n \l'\\n(.lu\(ul'
  366. X.if n .fi
  367. X..
  368. X'    # BE - end boxed text (draw box now)
  369. X.de BE
  370. X.nf
  371. X.ti 0
  372. X.mk ^t
  373. X.ie n \l'\\n(^lu\(ul'
  374. X.el \{\
  375. X.\"    Draw four-sided box normally, but don't draw top of
  376. X.\"    box if the box started on an earlier page.
  377. X.ie !\\n(^b-1 \{\
  378. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  379. X.\}
  380. X.el \}\
  381. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  382. X.\}
  383. X.\}
  384. X.fi
  385. X.br
  386. X.nr ^b 0
  387. X..
  388. X'    # VS - start vertical sidebar
  389. X'    # ^Y = starting y location
  390. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  391. X.de VS
  392. X.mk ^Y
  393. X.ie n 'mc \s12\(br\s0
  394. X.el .nr ^v 1u
  395. X..
  396. X'    # VE - end of vertical sidebar
  397. X.de VE
  398. X.ie n 'mc
  399. X.el \{\
  400. X.ev 2
  401. X.nf
  402. X.ti 0
  403. X.mk ^t
  404. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  405. X.sp -1
  406. X.fi
  407. X.ev
  408. X.\}
  409. X.nr ^v 0
  410. X..
  411. X'    # Special macro to handle page bottom:  finish off current
  412. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  413. X'    # page bottom macro.
  414. X.de ^B
  415. X.ev 2
  416. X'ti 0
  417. X'nf
  418. X.mk ^t
  419. X.if \\n(^b \{\
  420. X.\"    Draw three-sided box if this is the box's first page,
  421. X.\"    draw two sides but no top otherwise.
  422. 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
  423. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  424. X.\}
  425. X.if \\n(^v \{\
  426. X.nr ^x \\n(^tu+1v-\\n(^Yu
  427. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  428. X.\}
  429. X.bp
  430. X'fi
  431. X.ev
  432. X.if \\n(^b \{\
  433. X.mk ^y
  434. X.nr ^b 2
  435. X.\}
  436. X.if \\n(^v \{\
  437. X.mk ^Y
  438. X.\}
  439. X..
  440. X'    # DS - begin display
  441. X.de DS
  442. X.RS
  443. X.nf
  444. X.sp
  445. X..
  446. X'    # DE - end display
  447. X.de DE
  448. X.fi
  449. X.RE
  450. X.sp .5
  451. X..
  452. X.\"----------------------------------------------------------------------------
  453. X.HS Tcl_MathError tcl
  454. X.BS
  455. X'@index: Tcl_MathError
  456. X.SH NAME
  457. XTcl_MathError - Floating point math error trap handler for Tcl.
  458. X.SH SYNOPSIS
  459. X.nf
  460. X\fB#include <tclExtend.h>\fR
  461. X.sp
  462. X\fBTcl_MathError\fR (\fIfunctionName, errorType\fR)
  463. X'
  464. X.SH ARGUMENTS
  465. X.AS char *functionName
  466. X.AP char *functionName in
  467. XThe name of the function that got the error. From the exception structure
  468. Xsupplied to matherr.
  469. X.AP int errorType in
  470. XThe type of error that occured. From the exception structure supplied to
  471. Xmatherr.
  472. X.BE
  473. X
  474. X.SH DESCRIPTION
  475. X.PP
  476. XTcl math error handler, should be called by an application `matherr' routine
  477. Xto determine if an error was caused by Tcl code or by other code in the
  478. Xapplication.  If the error occured in Tcl code, flags will be set so that a
  479. Xstandard Tcl interpreter error can be returned.
  480. X.PP
  481. XReturns TRUE if the error was in Tcl code, in which case the matherr routine
  482. Xcalling this function should return non-zero so no error message will be
  483. Xgenerated.  FALSE if the error was not in Tcl code, in which case the matherr
  484. Xroutine can handle the error in any manner it choses.
  485. X.PP
  486. XThe Extended Tcl library comes with a \fBmatherr\fR routine that calls
  487. X\fBTcl_MathError\fR.  If the error does not belong to Tcl, standard math error
  488. Xprocessing is done.  An application may replace this \fRmatherr\fR with their
  489. Xown version however, it must call \fBTcl_MathError\fR to check if the error
  490. Xbelongs to tcl.
  491. X
  492. X.SH KEYWORDS
  493. Xfloating point, math, error
  494. END_OF_FILE
  495. if test 5171 -ne `wc -c <'extended/man/MathErr.man'`; then
  496.     echo shar: \"'extended/man/MathErr.man'\" unpacked with wrong size!
  497. fi
  498. # end of 'extended/man/MathErr.man'
  499. fi
  500. if test -f 'extended/man/tcl.tlib.man' -a "${1}" != "-c" ; then 
  501.   echo shar: Will not clobber existing file \"'extended/man/tcl.tlib.man'\"
  502. else
  503. echo shar: Extracting \"'extended/man/tcl.tlib.man'\" \(5845 characters\)
  504. sed "s/^X//" >'extended/man/tcl.tlib.man' <<'END_OF_FILE'
  505. X.TH "tcl.tlib" TCL "" "Tcl"
  506. X.ad b
  507. X.SH NAME
  508. XExtended Tcl - Tcl procedure library
  509. X'
  510. X.SH "INTRODUCTION"
  511. X.PP
  512. XThis manual page contains documentation for all of the procedures in
  513. Xthe standard Tcl source library, \fItcl.tlib\fR.  Commands from the library,
  514. Xand any Tcl source library along your Tcl search path, \fRTCLPATH\fR,
  515. Xthat contain properly formatted \fI#@package\fR definition
  516. Xcomments, are automatically loaded the first time they are executed.  See 
  517. Xthe \fITcl Shell\fR documentation for more details.
  518. X'
  519. X'@help: tcl.tlib/assign_fields
  520. X'@brief: Assign successive elements in a list to specified variables.
  521. X.TP
  522. X.B assign_fields \fIlist var\fR [\fIvar\fR...]
  523. X.br
  524. XAssign successive elements in a list to specified variables.
  525. XAny leftover fields are discarded.  When there are more variable
  526. Xnames than fields, the remaining variables are set to the
  527. Xempty string.
  528. X.sp
  529. XFor example,
  530. X.sp
  531. X.nf
  532. X   assign_fields {dave 100 200 "Dave Foo"} name uid gid longName
  533. X.fi
  534. X.sp
  535. XAssigns \fIname\fR to ``dave'', \fIuid\fR to ``100'', \fIgid\fR to ``200'',
  536. Xand \fIlongName\fR to ``Dave Foo''.
  537. X'@endhelp
  538. X'
  539. X'@help: tcl.tlib/dirs
  540. X'@brief: List the directories in the directory stack.
  541. X.TP
  542. X.B dirs
  543. XList the directories in the directory stack.
  544. X'@endhelp
  545. X'
  546. X'@help: tcl.tlib/edprocs
  547. X'@brief: Edit named procs, or all procs.
  548. X.TP
  549. X.B edprocs [\fIproc\fR...]
  550. X.br
  551. XWrites the named procedures, or all currently defined procedures, to
  552. Xa temporary file, then calls an editor on it (as specified by the
  553. X\fBEDITOR\fR environment variable, or \fBvi\fR
  554. Xif none is specified), then sources the file back in if it was changed.
  555. X'@endhelp
  556. X'
  557. X'@help: tcl.tlib/for_array_keys
  558. X'@brief: Do a foreach-style loop on each key in an array.
  559. X.TP
  560. X.B for_array_keys \fIvar array_name code\fR
  561. X.br
  562. XPerform a foreach-style loop for each key in the named array.  The \fBbreak\fR
  563. Xand \fBcontinue\fR statements work as with \fBforeach\fR.
  564. X'@endhelp
  565. X'@help: tcl.tlib/for_file
  566. X'@brief: Do a foreach-style loop on each line in a file.
  567. X.TP
  568. X.B for_file \fIvar filename { code }\fR
  569. X.br
  570. XFor each line in \fIfilename\fR, sets
  571. X\fIvar\fR to the line and executes \fIcode\fR.
  572. X.sp
  573. XThe \fBbreak\fR and \fBcontinue\fR commands work as with foreach.
  574. X.sp
  575. XFor example, the command
  576. X.sp
  577. X.nf
  578. X    \fBfor_file line /etc/passwd {echo $line}\fR
  579. X.fi
  580. X.sp
  581. Xwould echo all the lines in the password file.
  582. X'@endhelp
  583. X'@help: tcl.tlib/for_recursive_glob
  584. X'@brief: Perform a foreach-style loop for all globbed files and directories.
  585. X.TP
  586. X.B for_recursive_glob \fIvar globlist code\fR
  587. X.br
  588. XPerforms a foreach-style loop for each file and directory that recursively
  589. Xmatched one or more patterns specified in the call to
  590. X\fBfor_recursive_glob\fR, setting \fIvar\fR to the matching file or directory,
  591. Xand calling \fIcode\fR.  The \fBbreak\fR and \fBcontinue\fR statements work as
  592. Xexpected.
  593. X'@endhelp
  594. X'@help: tcl.tlib/intersect
  595. X'@brief: Return a list containing every element present in both lists.
  596. X.TP
  597. X.B intersect \fIlista listb\fR
  598. X.br
  599. XReturn the logical intersection of two lists.
  600. X'@endhelp
  601. X'@help: tcl.tlib/intersect3
  602. X'@brief: Return three lists from an intersection of two lists.
  603. X.TP
  604. X.B intersect3 \fIlista listb\fR
  605. X.br
  606. XPerforms the intersecting of the two lists, returning a list containing
  607. Xthree lists.  The first list returned is everything in the first list
  608. Xthat wasn't in the second.  The second list contains the intersection
  609. Xof the two lists, and the third list contains all the elements that
  610. Xwere in the second list but weren't in the first.
  611. X'@endhelp
  612. X'@help: tcl.tlib/lrmdups
  613. X'@brief: Given a list, remove all of the duplicated elements.
  614. X.TP
  615. X.B lrmdups \fIlist\fR
  616. X.br
  617. XRemove duplicate elements from a list.
  618. XSorts the specified list, removes any duplicate elements, and returns
  619. Xthe result.
  620. X'@endhelp
  621. X'@help: tcl.tlib/popd
  622. X'@brief: Pop a directory from a stack of directories and cd to it.
  623. X.TP
  624. X.B popd
  625. X.br
  626. XPop the top directory entry from the directory stack and make it the current
  627. Xdirectory.
  628. X'@endhelp
  629. X'@help: tcl.tlib/pushd
  630. X'@brief: Push a directory to a stack of directories.
  631. X.TP
  632. X.B pushd [\fIdir\fR]
  633. X.br
  634. XPush the current directory onto the directory stack and \fBcd\fR to the specified
  635. Xdirectory.  If the directory is not specified, then the current directory is
  636. Xpushed, but remains unchanged.
  637. X'@endhelp
  638. X'@help: tcl.tlib/read_file
  639. X'@brief: Read in a file to a string (less overhead than "exec cat").
  640. X.TP
  641. X.B read_file \fIfileName\fR
  642. X.br
  643. XRead the named file and returns the contents as a string.
  644. X'@endhelp
  645. X'@help: tcl.tlib/recursive_glob
  646. X'@brief: Do filename globbing, recursively descending all matched directories.
  647. X.TP
  648. X.B recursive_glob \fIgloblist\fR
  649. X.br
  650. XDoes the same thing as glob, except that it recursively descends all the
  651. Xmatched subdirectories, returning a list of all the files that matched all
  652. Xpattern in the list \fIgloblist\fR.
  653. X'@endhelp
  654. X'@help: tcl.tlib/saveprocs
  655. X'@brief: Save named procs to a file, or all procs.
  656. X.TP
  657. X.B saveprocs \fIfileName\fR [\fIproc\fR...]
  658. X.br
  659. XSave the definition of the named procedure, or all currently
  660. Xdefined procedures if none is specified, to the named file.
  661. X'@endhelp
  662. X'@help: tcl.tlib/showproc
  663. X'@brief: List the definition of the named procedure.
  664. X.TP
  665. X.B showproc \fIprocname\fR
  666. X.br
  667. XList the definition of the named procedure, loading it if it is not already
  668. Xloaded.
  669. X'@endhelp
  670. X'@help: tcl.tlib/showprocs
  671. X'@brief: List the definition of the named, or all, procedures.
  672. X.TP
  673. X.B showprocs [\fIprocname\fR...]
  674. X.br
  675. XList the definition of all of the named procedures, or 
  676. Xall defined procedures if none are specified.
  677. X'@endhelp
  678. X'@help: tcl.tlib/union
  679. X'@brief: Return the logical union of two lists.
  680. X.TP
  681. X.B union \fIlista listb\fR
  682. XReturn the logical union of the two specified lists.  Any duplicate elements
  683. Xare removed.
  684. X'@endhelp
  685. X'@help: tcl.tlib/write_file
  686. X'@brief: Write a string out as a file.
  687. X.TP
  688. X.B write_file \fIfileName stringVar\fR
  689. X.br
  690. XWrites the specified string to the named file.
  691. X'@endhelp
  692. END_OF_FILE
  693. if test 5845 -ne `wc -c <'extended/man/tcl.tlib.man'`; then
  694.     echo shar: \"'extended/man/tcl.tlib.man'\" unpacked with wrong size!
  695. fi
  696. # end of 'extended/man/tcl.tlib.man'
  697. fi
  698. if test -f 'extended/tcllib/help/commands/string' -a "${1}" != "-c" ; then 
  699.   echo shar: Will not clobber existing file \"'extended/tcllib/help/commands/string'\"
  700. else
  701. echo shar: Extracting \"'extended/tcllib/help/commands/string'\" \(5464 characters\)
  702. sed "s/^X//" >'extended/tcllib/help/commands/string' <<'END_OF_FILE'
  703. X          string option arg ?arg ...?
  704. X               Perform one of several string operations, depending  on
  705. X               option.   The  legal options (which may be abbreviated)
  706. X               are:
  707. X
  708. X               string compare string1 string2
  709. X                    Perform  a  character-by-character  comparison  of
  710. X                    strings string1 and string2 in the same way as the
  711. X                    C strcmp procedure.  Return -1, 0, or 1, depending
  712. X                    on whether string1 is lexicographically less than,
  713. X                    equal to, or greater than string2.
  714. X
  715. X               string first string1 string2
  716. X                    Search string2 for a sequence of  characters  that
  717. X                    exactly  match  the  characters  in  string1.   If
  718. X                    found, return the index of the first character  in
  719. X                    the  first  such  match  within  string2.   If not
  720. X                    found, return -1.
  721. X
  722. X               string index string charIndex
  723. X                    Returns  the  charIndex'th character of the string
  724. X                    argument.  A charIndex of  0  corresponds  to  the
  725. X                    first  character  of  the string.  If charIndex is
  726. X                    less than 0 or greater than or equal to the length
  727. X                    of the string then an empty string is returned.
  728. X
  729. X               string last string1 string2
  730. X                    Search string2 for a sequence of  characters  that
  731. X                    exactly  match  the  characters  in  string1.   If
  732. X                    found, return the index of the first character  in
  733. X                    the  last  such match within string2.  If there is
  734. X                    no match, then return -1.
  735. X
  736. X               string length string
  737. X                    Returns  a  decimal  string  giving  the number of
  738. X                    characters in string.
  739. X
  740. X               string match pattern string
  741. X                    See if pattern matches  string;  return  1  if  it
  742. X                    does,  0  if  it  doesn't.   Matching is done in a
  743. X                    fashion similar to that used by the C-shell.   For
  744. X                    the  two  strings to match, their contents must be
  745. X                    identical  except  that  the   following   special
  746. X                    sequences may appear in pattern:
  747. X
  748. X                    *         Matches any sequence  of  characters  in
  749. X                              string, including a null string.
  750. X
  751. X                    ?         Matches any single character in string.
  752. X
  753. X                    [chars]   Matches any character in the  set  given
  754. X                              by chars.  If a sequence of the form x-y
  755. X                              appears in  chars,  then  any  character
  756. X                              between x and y, inclusive, will match.
  757. X
  758. X                    \x        Matches the single  character  x.   This
  759. X                              provides  a  way of avoiding the special
  760. X                              interpretation of the  characters  *?[]\
  761. X                              in pattern.
  762. X
  763. X               string range string first last
  764. X                    Returns  a  range  of  consecutive characters from
  765. X                    string, starting with the character whose index is
  766. X                    first and ending with the character whose index is
  767. X                    last.  An index of 0 refers to the first character
  768. X                    of   the   string.    Last  may  be  end  (or  any
  769. X                    abbreviation of it) to refer to the last character
  770. X                    of the string.  If first is less than zero then it
  771. X                    is treated as if it were  zero,  and  if  last  is
  772. X                    greater  than or equal to the length of the string
  773. X                    then it is treated as if it were end.  If first is
  774. X                    greater   than   last  then  an  empty  string  is
  775. X                    returned.
  776. X
  777. X               string tolower string
  778. X                    Returns  a  value  equal to string except that all
  779. X                    upper case letters have been  converted  to  lower
  780. X                    case.
  781. X
  782. X               string toupper string
  783. X                    Returns  a  value  equal to string except that all
  784. X                    lower case letters have been  converted  to  upper
  785. X                    case.
  786. X
  787. X               string trim string ?chars?
  788. X                    Returns  a  value  equal to string except that any
  789. X                    leading or trailing characters from the set  given
  790. X                    by  chars  are removed.  If chars is not specified
  791. X                    then  white  space  is  removed   (spaces,   tabs,
  792. X                    newlines, and carriage returns).
  793. X
  794. X               string trimleft string ?chars?
  795. X                    Returns  a  value  equal to string except that any
  796. X                    leading characters from the set given by chars are
  797. X                    removed.   If  chars  is  not specified then white
  798. X                    space is  removed  (spaces,  tabs,  newlines,  and
  799. X                    carriage returns).
  800. X
  801. X               string trimright string ?chars?
  802. X                    Returns  a  value  equal to string except that any
  803. X                    trailing characters from the set  given  by  chars
  804. X                    are removed.  If chars is not specified then white
  805. X                    space is  removed  (spaces,  tabs,  newlines,  and
  806. X                    carriage returns).
  807. END_OF_FILE
  808. if test 5464 -ne `wc -c <'extended/tcllib/help/commands/string'`; then
  809.     echo shar: \"'extended/tcllib/help/commands/string'\" unpacked with wrong size!
  810. fi
  811. # end of 'extended/tcllib/help/commands/string'
  812. fi
  813. if test -f 'extended/tests/filescan.test' -a "${1}" != "-c" ; then 
  814.   echo shar: Will not clobber existing file \"'extended/tests/filescan.test'\"
  815. else
  816. echo shar: Extracting \"'extended/tests/filescan.test'\" \(5376 characters\)
  817. sed "s/^X//" >'extended/tests/filescan.test' <<'END_OF_FILE'
  818. X#
  819. X# filescan.test
  820. X#
  821. X# Tests for the scancontext and scanfile commands.
  822. X#---------------------------------------------------------------------------
  823. X# Copyright 1991 Karl Lehenbauer and Mark Diekhans.
  824. X#
  825. X# Permission to use, copy, modify, and distribute this software and its
  826. X# documentation for any purpose and without fee is hereby granted, provided
  827. X# that the above copyright notice appear in all copies.  Karl Lehenbauer and
  828. X# Mark Diekhans make no representations about the suitability of this
  829. X# software for any purpose.  It is provided "as is" without express or
  830. X# implied warranty.
  831. X#
  832. X
  833. Xglobal ModuleName
  834. Xset ModuleName "File scan"
  835. Xsource testutil.tcl
  836. X
  837. X# Proc to generate record that can be validated.  The record has 
  838. X# grows quite large to test the dynamic buffering in the file I/O.
  839. X
  840. Xproc GenRec {Key LineNum} {
  841. X  set extra [replicate :@@@@@@@@: $LineNum]
  842. X  return  "$Key This is a test record ($extra) index is $Key"
  843. X}
  844. X
  845. X# Build a test file and a list of records to scan for.  Each element in the 
  846. X# list will have the following info:
  847. X#   {Key FileOffset FileLineNumber MatchType}
  848. X
  849. X# Proc to validate a matched record.
  850. X
  851. Xproc ValMatch {ScanInfo ErrId} {
  852. X    global TestFH matchInfo
  853. X    set chkRec [GenRec [lindex $ScanInfo 0] [lindex $ScanInfo 2]]
  854. X    check $matchInfo(line) $chkRec                         $ErrId.1
  855. X    check $matchInfo(offset) [lindex $ScanInfo 1]           $ErrId.2
  856. X    check $matchInfo(linenum) [lindex $ScanInfo 2]          $ErrId.3
  857. X    check $matchInfo(handle) $TestFH                       $ErrId.4
  858. X    set MatchType [lindex $ScanInfo 3] 
  859. X    global MatchCnt.$MatchType
  860. X    incr MatchCnt.$MatchType
  861. X}
  862. X
  863. Xglobal matchInfo
  864. Xglobal MatchCnt.0    MatchCnt.1    MatchCnt.2    MatchCnt.3    DefaultCnt 
  865. Xglobal ChkMatchCnt.0 ChkMatchCnt.1 ChkMatchCnt.2 ChkMatchCnt.3 ChkDefaultCnt
  866. Xglobal TestFH
  867. X
  868. Xset MatchCnt.0      0
  869. Xset MatchCnt.1      0
  870. Xset MatchCnt.2      0
  871. Xset MatchCnt.3      0
  872. Xset DefaultCnt      0
  873. Xset ChkMatchCnt.0   0
  874. Xset ChkMatchCnt.1   0
  875. Xset ChkMatchCnt.2   0
  876. Xset ChkMatchCnt.3   0
  877. Xset ChkDefaultCnt   0
  878. Xset ScanList       {}
  879. Xset MaxRec        200
  880. X
  881. Xcatch {unlink TEST.TMP}
  882. Xset TestFH [open TEST.TMP w]
  883. X
  884. Xset Key FatHeadAAAA
  885. Xfor {set cnt 0} {$cnt < $MaxRec} {incr cnt} {
  886. X    if {($cnt % 10) == 0} {
  887. X        set MatchType [random 4]
  888. X        incr ChkMatchCnt.$MatchType
  889. X        set ScanInfo [list "$Key [tell $TestFH] [expr $cnt+1] $MatchType"]
  890. X        if {[random 2]} {
  891. X            set ScanList [concat $ScanList $ScanInfo]
  892. X        } else {
  893. X            set ScanList [concat $ScanInfo $ScanList]}
  894. X    } else {
  895. X        incr ChkDefaultCnt}
  896. X    if {$cnt == [expr $MaxRec/2]} {
  897. X        set MidKey $Key
  898. X        }
  899. X    puts $TestFH [GenRec $Key [expr $cnt+1]]
  900. X    set Key [IncrName $Key 1]  ;# Upper case only
  901. X}
  902. X
  903. Xclose $TestFH
  904. X
  905. X# Build up the scan context.
  906. X
  907. Xset TestCH [scancontext create]
  908. X
  909. Xforeach ScanInfo $ScanList {
  910. X    set Key [lindex $ScanInfo 0]
  911. X    set matchType [lindex $ScanInfo 3]
  912. X    set Cmd "global matchInfo; ValMatch \{$ScanInfo\} 1.0" 
  913. X    case $matchType in {
  914. X      {0} {scanmatch -nocase $TestCH [string toupper $Key] $Cmd}
  915. X      {1} {scanmatch $TestCH ^$Key  $Cmd}
  916. X      {2} {scanmatch $TestCH $Key\$ $Cmd}
  917. X      {3} {scanmatch $TestCH $Key   $Cmd}
  918. X    }
  919. X}
  920. X
  921. Xscanmatch $TestCH {
  922. X    global DefaultCnt TestFH matchInfo
  923. X
  924. X    incr DefaultCnt
  925. X    check $matchInfo(handle) $TestFH          1.1
  926. X    }
  927. X
  928. Xset TestFH [open TEST.TMP r]
  929. Xscanfile $TestCH $TestFH
  930. X
  931. Xcheck ${MatchCnt.0} ${ChkMatchCnt.0}              1.2
  932. Xcheck ${MatchCnt.1} ${ChkMatchCnt.1}              1.3
  933. Xcheck ${MatchCnt.2} ${ChkMatchCnt.2}              1.4
  934. Xcheck ${MatchCnt.3} ${ChkMatchCnt.3}              1.5
  935. Xcheck $DefaultCnt $ChkDefaultCnt                  1.6
  936. X
  937. Xscancontext delete $TestCH
  938. X
  939. X# Test return and continue from within match commands
  940. X
  941. Xset TestCH [scancontext create]
  942. Xseek $TestFH 0
  943. Xglobal MatchCnt
  944. Xset MatchCnt 0
  945. X
  946. Xscanmatch $TestCH $MidKey {
  947. X    global MatchCnt
  948. X    incr MatchCnt
  949. X    continue;
  950. X}
  951. X
  952. Xscanmatch $TestCH ^$MidKey {
  953. X    error "$ModuleName error: This should not ever get executed  2.0"
  954. X}
  955. X
  956. Xscanmatch $TestCH [IncrName $MidKey] {
  957. X    return FudPucker
  958. X}
  959. X
  960. Xset ScanRet [scanfile $TestCH $TestFH]
  961. Xcheck $ScanRet FudPucker                           2.1
  962. Xscancontext delete $TestCH
  963. X
  964. X
  965. X# Test argument checking and error handling.
  966. X
  967. Xdo1cmd {scancontext foomuch} msg                                3.1
  968. Xset expect {invalid argument, expected one of: create or delete}
  969. Xcheck $msg $expect                                             3.2
  970. Xdo1cmd {scanmatch $TestCH} msg                                 3.4
  971. Xset expect {wrong # args: scanmatch [-nocase] contexthandle [regexp] command}
  972. Xcheck $msg $expect                                             3.5
  973. Xdo1cmd {scanmatch} msg                                         3.6
  974. Xcheck $msg $expect                                             3.7
  975. Xdo1cmd {scanfile} msg                                          3.8
  976. Xcheck $msg \
  977. X    {wrong # args: scanfile contexthandle filehandle}  3.9
  978. Xset TestCH [scancontext create]
  979. Xdo1cmd {scanfile $TestCH $TestFH} msg                          3.10
  980. Xcheck $msg {no patterns in current scan context}               3.11
  981. Xscancontext delete $TestCH
  982. X
  983. Xclose $TestFH
  984. Xunlink TEST.TMP
  985. X
  986. Xrename GenRec {}
  987. Xrename ValMatch {}
  988. X
  989. Xunset MatchCnt matchInfo
  990. Xunset MatchCnt.0    MatchCnt.1    MatchCnt.2    MatchCnt.3    DefaultCnt 
  991. Xunset ChkMatchCnt.0 ChkMatchCnt.1 ChkMatchCnt.2 ChkMatchCnt.3 ChkDefaultCnt
  992. Xunset TestFH
  993. END_OF_FILE
  994. if test 5376 -ne `wc -c <'extended/tests/filescan.test'`; then
  995.     echo shar: \"'extended/tests/filescan.test'\" unpacked with wrong size!
  996. fi
  997. # end of 'extended/tests/filescan.test'
  998. fi
  999. if test -f 'extended/tests/fmath.test' -a "${1}" != "-c" ; then 
  1000.   echo shar: Will not clobber existing file \"'extended/tests/fmath.test'\"
  1001. else
  1002. echo shar: Extracting \"'extended/tests/fmath.test'\" \(5838 characters\)
  1003. sed "s/^X//" >'extended/tests/fmath.test' <<'END_OF_FILE'
  1004. X#
  1005. X# fmath.test
  1006. X#
  1007. X# Tests for the following floating point math commands:
  1008. X#   acos, asin, atan,  cos,  sin,  tan,   cosh, sinh, tanh, 
  1009. X#   exp,  log,  log10, sqrt, fabs, floor, ceil, fmod, pow.
  1010. X#---------------------------------------------------------------------------
  1011. X# Copyright 1991 Karl Lehenbauer and Mark Diekhans.
  1012. X#
  1013. X# Permission to use, copy, modify, and distribute this software and its
  1014. X# documentation for any purpose and without fee is hereby granted, provided
  1015. X# that the above copyright notice appear in all copies.  Karl Lehenbauer and
  1016. X# Mark Diekhans make no representations about the suitability of this
  1017. X# software for any purpose.  It is provided "as is" without express or
  1018. X# implied warranty.
  1019. X#
  1020. X
  1021. Xglobal ModuleName
  1022. Xset ModuleName FMath
  1023. X
  1024. Xset F_E            2.71828
  1025. Xset F_LN10    2.30258
  1026. Xset F_PI    3.14159265358979
  1027. Xset F_PI_180    0.0174533
  1028. Xset F_PI_4      0.785398
  1029. Xset F_PI_2      1.5708
  1030. Xset F_SQRT2    1.41421
  1031. X
  1032. X
  1033. Xsource testutil.tcl
  1034. X
  1035. X
  1036. X# Check that a floating point value is reasonably within range.  If not,
  1037. X# generate an error
  1038. X
  1039. Xproc fchecknum {got expect idnum} {
  1040. X  global ModuleName
  1041. X
  1042. X  set lowExpect [expr {$expect * 0.9999}]
  1043. X  set hiExpect  [expr {$expect * 1.0001}]
  1044. X
  1045. X  if {($got < $lowExpect) || ($got > $hiExpect)} {
  1046. X    error [format {%s test error %s: wanted something close to %s, got %s} \
  1047. X               $ModuleName $idnum $expect $got]}
  1048. X}
  1049. X
  1050. Xdo1cmd {acos} msg                                     1.1
  1051. Xcheck $msg {wrong # args: acos val}                   1.2
  1052. Xdo1cmd {acos 1 1} msg                                 1.3
  1053. Xcheck $msg {wrong # args: acos val}                   1.4
  1054. Xfchecknum [acos 0] 1.5708                             1.5
  1055. Xfchecknum [acos $F_PI_180] 1.55334                    1.6
  1056. Xfchecknum [acos $F_PI_4] 0.667457                     1.7
  1057. X
  1058. Xdo1cmd {asin} msg                                     2.1
  1059. Xcheck $msg {wrong # args: asin val}                   2.2
  1060. Xdo1cmd {asin 1 1} msg                                 2.3
  1061. Xcheck $msg {wrong # args: asin val}                   2.4
  1062. X
  1063. Xdo1cmd {atan} msg                                     3.1
  1064. Xcheck $msg {wrong # args: atan val}                   3.2
  1065. Xdo1cmd {atan 1 1} msg                                 3.3
  1066. Xcheck $msg {wrong # args: atan val}                   3.4
  1067. X
  1068. Xdo1cmd {cos} msg                                      4.1
  1069. Xcheck $msg {wrong # args: cos val}                    4.2
  1070. Xdo1cmd {cos 1 1} msg                                  4.3
  1071. Xcheck $msg {wrong # args: cos val}                    4.4
  1072. X
  1073. Xdo1cmd {sin} msg                                      5.1
  1074. Xcheck $msg {wrong # args: sin val}                    5.2
  1075. Xdo1cmd {sin 1 1} msg                                  5.3
  1076. Xcheck $msg {wrong # args: sin val}                    5.4
  1077. X
  1078. Xdo1cmd {tan} msg                                      6.1
  1079. Xcheck $msg {wrong # args: tan val}                    6.2
  1080. Xdo1cmd {tan 1 1} msg                                  6.3
  1081. Xcheck $msg {wrong # args: tan val}                    6.4
  1082. X
  1083. Xdo1cmd {cosh} msg                                     7.1
  1084. Xcheck $msg {wrong # args: cosh val}                   7.2
  1085. Xdo1cmd {cosh 1 1} msg                                 7.3
  1086. Xcheck $msg {wrong # args: cosh val}                   7.4
  1087. X
  1088. Xdo1cmd {sinh} msg                                     8.1
  1089. Xcheck $msg {wrong # args: sinh val}                   8.2
  1090. Xdo1cmd {sinh 1 1} msg                                 8.3
  1091. Xcheck $msg {wrong # args: sinh val}                   8.4
  1092. X
  1093. Xdo1cmd {tanh} msg                                     9.1
  1094. Xcheck $msg {wrong # args: tanh val}                   9.2
  1095. Xdo1cmd {tanh 1 1} msg                                 9.3
  1096. Xcheck $msg {wrong # args: tanh val}                   9.4
  1097. X
  1098. Xdo1cmd {exp} msg                                     10.1
  1099. Xcheck $msg {wrong # args: exp val}                   10.2
  1100. Xdo1cmd {exp 1 1} msg                                 10.3
  1101. Xcheck $msg {wrong # args: exp val}                   10.4
  1102. X
  1103. Xdo1cmd {log} msg                                     11.1
  1104. Xcheck $msg {wrong # args: log val}                   11.2
  1105. Xdo1cmd {log 1 1} msg                                 11.3
  1106. Xcheck $msg {wrong # args: log val}                   11.4
  1107. X
  1108. Xdo1cmd {log10} msg                                   12.1
  1109. Xcheck $msg {wrong # args: log10 val}                 12.2
  1110. Xdo1cmd {log10 1 1} msg                               12.3
  1111. Xcheck $msg {wrong # args: log10 val}                 12.4
  1112. X
  1113. Xdo1cmd {sqrt} msg                                    13.1
  1114. Xcheck $msg {wrong # args: sqrt val}                  13.2
  1115. Xdo1cmd {sqrt 1 1} msg                                13.3
  1116. Xcheck $msg {wrong # args: sqrt val}                  13.4
  1117. X
  1118. Xdo1cmd {fabs} msg                                    14.1
  1119. Xcheck $msg {wrong # args: fabs val}                  14.2
  1120. Xdo1cmd {fabs 1 1} msg                                14.3
  1121. Xcheck $msg {wrong # args: fabs val}                  14.4
  1122. X
  1123. Xdo1cmd {floor} msg                                   15.1
  1124. Xcheck $msg {wrong # args: floor val}                 15.2
  1125. Xdo1cmd {floor 1 1} msg                               15.3
  1126. Xcheck $msg {wrong # args: floor val}                 15.4
  1127. X
  1128. Xdo1cmd {ceil} msg                                    16.1
  1129. Xcheck $msg {wrong # args: ceil val}                  16.2
  1130. Xdo1cmd {ceil 1 1} msg                                16.3
  1131. Xcheck $msg {wrong # args: ceil val}                  16.4
  1132. X
  1133. Xdo1cmd {fmod} msg                                    17.1
  1134. Xcheck $msg {wrong # args: fmod val divisor}          17.2
  1135. Xdo1cmd {fmod 1 1 1} msg                              17.3
  1136. Xcheck $msg {wrong # args: fmod val divisor}          17.4
  1137. X
  1138. Xdo1cmd {pow} msg                                     18.1
  1139. Xcheck $msg {wrong # args: pow val exp}               18.2
  1140. Xdo1cmd {pow 1 1 1} msg                               18.3
  1141. Xcheck $msg {wrong # args: pow val exp}               18.4
  1142. X
  1143. Xdo1cmd {pow 0 0} msg                                 18.5
  1144. Xcheck $msg {pow: floating point domain error}        18.6
  1145. X
  1146. END_OF_FILE
  1147. if test 5838 -ne `wc -c <'extended/tests/fmath.test'`; then
  1148.     echo shar: \"'extended/tests/fmath.test'\" unpacked with wrong size!
  1149. fi
  1150. # end of 'extended/tests/fmath.test'
  1151. fi
  1152. if test -f 'extended/tests/help.test' -a "${1}" != "-c" ; then 
  1153.   echo shar: Will not clobber existing file \"'extended/tests/help.test'\"
  1154. else
  1155. echo shar: Extracting \"'extended/tests/help.test'\" \(6040 characters\)
  1156. sed "s/^X//" >'extended/tests/help.test' <<'END_OF_FILE'
  1157. X#
  1158. X# help.test
  1159. X#
  1160. X# Tests for the help subsystem.  Help must be build first.  If help files
  1161. X# change, thest tests may have to be changed.
  1162. X#---------------------------------------------------------------------------
  1163. X# Copyright 1991 Karl Lehenbauer and Mark Diekhans.
  1164. X#
  1165. X# Permission to use, copy, modify, and distribute this software and its
  1166. X# documentation for any purpose and without fee is hereby granted, provided
  1167. X# that the above copyright notice appear in all copies.  Karl Lehenbauer and
  1168. X# Mark Diekhans make no representations about the suitability of this
  1169. X# software for any purpose.  It is provided "as is" without express or
  1170. X# implied warranty.
  1171. X#
  1172. Xif {[info procs test] != "test"} then {source defs}
  1173. X
  1174. X#
  1175. X# Only run help test if help has been installed.
  1176. X#
  1177. Xif {"[glob -nocomplain ../tcllib/help/*]" == ""} {
  1178. X    echo "****"
  1179. X    echo "**** No help files in tcllib/help - help not available test not run"
  1180. X    echo "****"
  1181. X    return
  1182. X}
  1183. X
  1184. X#------------------------------------------------------------------------------
  1185. X# Read a line from the server, set an alarm to make sure it doesn't hang.
  1186. Xproc ReadServer {} {
  1187. X    global G_helpOutPipeFH
  1188. X
  1189. X    alarm 45
  1190. X    if {[gets $G_helpOutPipeFH line] < 0} {
  1191. X        alarm 0
  1192. X        error "EOF from help server"}
  1193. X    alarm 0
  1194. X    return $line
  1195. X}
  1196. X
  1197. X#------------------------------------------------------------------------------
  1198. X# Eat a prompt line from the help server.
  1199. X
  1200. Xproc EatServerPrompt {} {
  1201. X    set line [ReadServer]
  1202. X    if {"$line" != "===HELPSERVER==="} {
  1203. X        error "unexpected output from help server: `$line'"}
  1204. X}
  1205. X
  1206. X#------------------------------------------------------------------------------
  1207. X# Send a command to the help server and return the output.  The help server
  1208. X# output will be bracketed with commands to mark the beginning and ending.
  1209. X# An extra newline is always queued to continue the help pager.  The prompt of
  1210. X# the pager will be removed from the output.  This assumes that the output has
  1211. X# no lines starting with `:'.
  1212. X#
  1213. Xproc HelpSend {cmd pagerCntVar} {
  1214. X    global G_helpInPipeFH G_helpOutPipeFH
  1215. X    upvar $pagerCntVar pagerCnt
  1216. X
  1217. X    puts $G_helpInPipeFH $cmd
  1218. X    puts $G_helpInPipeFH ""  ;# Just a new line..
  1219. X    flush $G_helpInPipeFH
  1220. X
  1221. X    set pagerCnt 0
  1222. X    set results {}
  1223. X
  1224. X    # Read lines of the output.
  1225. X    while 1 {
  1226. X        set line [ReadServer]
  1227. X        if {"[cindex $line 0]" == ":"} {
  1228. X            set line [crange $line 1 end]
  1229. X            incr pagerCnt
  1230. X            puts $G_helpInPipeFH ""  ;# Just a new line
  1231. X        }
  1232. X        if {"$line" == "===HELPSERVER==="} {
  1233. X            break}
  1234. X        append results $line "\n"
  1235. X    }
  1236. X    # Eat the extra prompt caused by the typed-ahead newline
  1237. X    EatServerPrompt
  1238. X
  1239. X    return $results
  1240. X}
  1241. X#
  1242. X# Create the help server process, which will execute the commands, 
  1243. X# with stdin and stdout redirected to pipes.
  1244. X#
  1245. X
  1246. Xglobal G_helpInPipeFH G_helpOutPipeFH G_helpPid
  1247. X
  1248. Xpipe fromClientPipeFH G_helpInPipeFH
  1249. Xpipe G_helpOutPipeFH  toClientPipeFH
  1250. X
  1251. Xfcntl $G_helpInPipeFH  NOBUF 1
  1252. Xfcntl $G_helpOutPipeFH NOBUF 1
  1253. X
  1254. Xflush stdout  ;# Not going to exec, must clean up the buffers.
  1255. Xflush stderr
  1256. Xset G_helpPid [fork]
  1257. X
  1258. Xif {$G_helpPid == 0} {
  1259. X    # Set up stdin/stdout.  Cann't use them nobuf, since we havn't execvp-ed.
  1260. X    close stdin
  1261. X    dup $fromClientPipeFH stdin
  1262. X    close stdout
  1263. X    dup $toClientPipeFH stdout
  1264. X    close $G_helpInPipeFH
  1265. X    close $G_helpOutPipeFH
  1266. X
  1267. X    rename SAVED_UNKNOWN unknown
  1268. X
  1269. X    commandloop {puts stdout "===HELPSERVER==="; flush stdout} \
  1270. X                {error "Help server incomplete cmd"}
  1271. X    error "Help server got eof"
  1272. X}
  1273. X
  1274. Xclose $fromClientPipeFH
  1275. Xclose $toClientPipeFH
  1276. X
  1277. X#
  1278. X# An alarm will be set when talking to the server uncase it doesn't talk back
  1279. X#
  1280. Xsignal error SIGALRM
  1281. X
  1282. X# Nuke the first prompt
  1283. XEatServerPrompt
  1284. X
  1285. X# Now run the tests.
  1286. X
  1287. X
  1288. Xtest help-1.1 {help tests} {
  1289. X    HelpSend "help" promptCnt
  1290. X} {
  1291. XSubjects available in /:
  1292. X   commands/        extended/        intro/           misc/
  1293. X   tcl.tlib/        tclshell/        
  1294. X
  1295. XHelp files available in /:
  1296. X   brief            help             
  1297. X}
  1298. X
  1299. Xtest help-1.2 {help tests} {
  1300. X    HelpSend "helppwd" promptCnt
  1301. X} {Current help subject directory: /
  1302. X}
  1303. X
  1304. Xtest help-1.3 {help tests} {
  1305. X    HelpSend "helpcd intro" promptCnt
  1306. X} {}
  1307. X
  1308. Xtest help-1.4 {help tests} {
  1309. X    HelpSend "helppwd" promptCnt
  1310. X} {Current help subject directory: /intro
  1311. X}
  1312. X
  1313. Xtest help-1.5 {help tests} {
  1314. X    set result [HelpSend "help comments" promptCnt]
  1315. X    set fh [open "../tcllib/help/intro/comments"]
  1316. X    set expect [read $fh]
  1317. X    close $fh
  1318. X    set summary {}
  1319. X    if {"$expect" == "$result"} {
  1320. X        append summary "CORRECT"
  1321. X    } else {
  1322. X        append summary "DATA DOES NOT MATCH"
  1323. X    }
  1324. X    if {$promptCnt == 0} {
  1325. X       append summary " : PROMPT OK"
  1326. X    } else {
  1327. X       append summary " : TOO MANY PROMPTS"
  1328. X    }
  1329. X    set summary
  1330. X} {CORRECT : PROMPT OK}
  1331. X
  1332. Xtest help-1.6 {help tests} {
  1333. X    set result [HelpSend "help expressions" promptCnt]
  1334. X    set fh [open "../tcllib/help/intro/expressions"]
  1335. X    set expect [read $fh]
  1336. X    close $fh
  1337. X    set summary {}
  1338. X    if {"$expect" == "$result"} {
  1339. X        append summary "CORRECT"
  1340. X    } else {
  1341. X        append summary "DATA DOES NOT MATCH"
  1342. X    }
  1343. X    if {$promptCnt >= 2} {
  1344. X       append summary " : PROMPT OK"
  1345. X    } else {
  1346. X       append summary " : NOT ENOUGH PROMPTS"
  1347. X    }
  1348. X    set summary
  1349. X} {CORRECT : PROMPT OK}
  1350. X
  1351. Xtest help-1.7 {help tests} {
  1352. X    HelpSend "apropos upvar" promptCnt
  1353. X} {commands/upvar - Bind a variable to another variable up the procedure call stack.
  1354. X}
  1355. X
  1356. Xtest help-1.8 {help tests} {
  1357. X    HelpSend "apropos clock" promptCnt
  1358. X} {extended/alarm - Set a process alarm clock.
  1359. Xextended/fmtclock - Convert integer time to human-readable format.
  1360. Xextended/getclock - Return current date and time as an integer value.
  1361. X}
  1362. X
  1363. Xtest help-1.9 {help tests} {
  1364. X    HelpSend "helpcd" promptCnt
  1365. X} {}
  1366. X
  1367. Xtest help-1.10 {help tests} {
  1368. X    HelpSend "helppwd" promptCnt
  1369. X} {Current help subject directory: /
  1370. X}
  1371. X
  1372. X
  1373. X# Terminate the help server.
  1374. X
  1375. Xputs $G_helpInPipeFH "exit 0"
  1376. Xset status [wait $G_helpPid]
  1377. Xif {"$status" != "$G_helpPid EXIT 0"} {
  1378. X    error "Bad status returned: `$status'"}
  1379. X
  1380. Xreturn
  1381. END_OF_FILE
  1382. if test 6040 -ne `wc -c <'extended/tests/help.test'`; then
  1383.     echo shar: \"'extended/tests/help.test'\" unpacked with wrong size!
  1384. fi
  1385. # end of 'extended/tests/help.test'
  1386. fi
  1387. if test -f 'extended/tests/keylist.test' -a "${1}" != "-c" ; then 
  1388.   echo shar: Will not clobber existing file \"'extended/tests/keylist.test'\"
  1389. else
  1390. echo shar: Extracting \"'extended/tests/keylist.test'\" \(5066 characters\)
  1391. sed "s/^X//" >'extended/tests/keylist.test' <<'END_OF_FILE'
  1392. X#
  1393. X# keylist.test
  1394. X#
  1395. X# Tests for the keylget, keylset, and keyldel commands.
  1396. X#---------------------------------------------------------------------------
  1397. X# Copyright 1991 Karl Lehenbauer and Mark Diekhans.
  1398. X#
  1399. X# Permission to use, copy, modify, and distribute this software and its
  1400. X# documentation for any purpose and without fee is hereby granted, provided
  1401. X# that the above copyright notice appear in all copies.  Karl Lehenbauer and
  1402. X# Mark Diekhans make no representations about the suitability of this
  1403. X# software for any purpose.  It is provided "as is" without express or
  1404. X# implied warranty.
  1405. X#
  1406. Xif {[info procs test] != "test"} then {source defs}
  1407. X
  1408. Xtest keylist-1.1 {keylget tests} {
  1409. X    set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
  1410. X    keylget keyedlist keyA
  1411. X} {valueA}
  1412. X
  1413. Xtest keylist-1.2 {keylget tests} {
  1414. X    set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
  1415. X    list [keylget keyedlist keyA value] $value
  1416. X} {1 valueA}
  1417. X
  1418. Xtest keylist-1.3 {keylget tests} {
  1419. X    set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
  1420. X                   {keyD valueD}}
  1421. X    keylget keyedlist keyD
  1422. X} {valueD}
  1423. X
  1424. Xtest keylist-1.4 {keylget tests} {
  1425. X    set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
  1426. X                   {keyD valueD}}
  1427. X    list [keylget keyedlist keyD value] $value
  1428. X} {1 valueD}
  1429. X
  1430. Xtest keylist-1.5 {keylget tests} {
  1431. X    set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
  1432. X                   {keyD valueD}}
  1433. X    list [catch {keylget keyedlist keyC} msg] $msg
  1434. X} {1 {key "keyC" not found in keyed list}}
  1435. X
  1436. Xtest keylist-1.6 {keylget tests} {
  1437. X    set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
  1438. X                   {keyD valueD}}
  1439. X    keylget keyedlist keyC value
  1440. X} {0}
  1441. X
  1442. Xtest keylist-1.61 {keylget tests} {
  1443. X    set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
  1444. X                   {keyD valueD}}
  1445. X    keylget keyedlist keyB
  1446. X} {{keyB1 valueB1} {keyB2 valueB2}}
  1447. X
  1448. Xtest keylist-1.7 {keylget tests} {
  1449. X    set keyedlist {{} {keyB valueB} {keyD valueD}}
  1450. X    list [catch {keylget keyedlist keyB} msg] $msg
  1451. X} {1 {invalid keyed list format: list contains an empty field entry}}
  1452. X
  1453. Xtest keylist-1.8 {keylget tests} {
  1454. X    set keyedlist {keyA {keyB valueB} {keyD valueD}}
  1455. X    list [catch {keylget keyedlist keyB} msg] $msg
  1456. X} {1 {invalid keyed list format: no value associated with field "keyA"}}
  1457. X
  1458. Xtest keylist-1.9 {keylget tests} {
  1459. X    set keyedlist {{{} valueA} {keyB valueB} {keyD valueD}}
  1460. X    list [catch {keylget keyedlist keyB} msg] $msg
  1461. X} {1 {invalid keyed list format: list contains an empty field name}}
  1462. X
  1463. Xtest keylist-1.10 {keylget tests} {
  1464. X    list [catch {keylget} msg] $msg
  1465. X} {1 {wrong # args: keylget listvar key [retvar | {}]}}
  1466. X
  1467. X
  1468. X
  1469. Xtest keylist-2.1 {keylset tests} {
  1470. X    catch {unset keyedlist}
  1471. X    keylset keyedlist keyA valueA
  1472. X    set keyedlist
  1473. X} {{keyA valueA}}
  1474. X
  1475. Xtest keylist-2.2 {keylset tests} {
  1476. X    catch {unset keyedlist}
  1477. X    keylset keyedlist keyA valueA
  1478. X    keylset keyedlist keyB valueB
  1479. X    set keyedlist
  1480. X} {{keyA valueA} {keyB valueB}}
  1481. X
  1482. Xtest keylist-2.3 {keylset tests} {
  1483. X    catch {unset keyedlist}
  1484. X    keylset keyedlist keyA valueA
  1485. X    keylset keyedlist keyB valueB
  1486. X    keylset keyedlist keyB valueB2
  1487. X    set keyedlist
  1488. X} {{keyA valueA} {keyB valueB2}}
  1489. X
  1490. Xtest keylist-2.4 {keylset tests} {
  1491. X    catch {unset keyedlist}
  1492. X    keylset keyedlist keyA valueA
  1493. X    keylset keyedlist keyB valueB
  1494. X    keylset keyedlist keyA valueA2
  1495. X    keylset keyedlist keyB valueB2
  1496. X    keylset keyedlist keyC valueC
  1497. X    set keyedlist
  1498. X} {{keyA valueA2} {keyB valueB2} {keyC valueC}}
  1499. X
  1500. Xtest keylist-2.5 {keylset tests} {
  1501. X    catch {unset keyedlist}
  1502. X    list [catch {keylset keyedlist keyA} msg] $msg
  1503. X} {1 {wrong # args: keylset listvar key value}}
  1504. X
  1505. Xtest keylist-2.6 {keylset tests} {
  1506. X    catch {unset keyedlist}
  1507. X    set keyedlist(foo) 1
  1508. X    list [catch {keylset keyedlist keyA valueA} msg] $msg
  1509. X} {1 {can't set "keyedlist": variable is array}}
  1510. X
  1511. Xtest keylist-2.7 {keylset tests} {
  1512. X    catch {unset keyedlist}
  1513. X    set keyedlist {{keyA valueA valueBad} {keyB valueB}}
  1514. X    list [catch {keylset keyedlist keyA valueA} msg] $msg
  1515. X} {1 {invalid keyed list format: trailing data following value in field: "valueA valueBad"}}
  1516. X
  1517. Xtest keylist-3.1 {keyldel tests} {
  1518. X    set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
  1519. X    keyldel keyedlist keyB
  1520. X    set keyedlist
  1521. X} {{keyA valueA} {keyD valueD}}
  1522. X
  1523. Xtest keylist-3.2 {keyldel tests} {
  1524. X    set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
  1525. X    keyldel keyedlist keyB
  1526. X    keyldel keyedlist keyA
  1527. X    set keyedlist
  1528. X} {{keyD valueD}}
  1529. X
  1530. Xtest keylist-3.3 {keyldel tests} {
  1531. X    set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
  1532. X    keyldel keyedlist keyD
  1533. X    keyldel keyedlist keyB
  1534. X    keyldel keyedlist keyA
  1535. X    set keyedlist
  1536. X} {}
  1537. X
  1538. Xtest keylist-3.4 {keyldel tests} {
  1539. X    set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
  1540. X    list [catch {keyldel keyedlist keyC} msg] $msg
  1541. X} {1 {field name not found: "keyC"}}
  1542. X
  1543. Xtest keylist-3.5 {keyldel tests} {
  1544. X    list [catch {keyldel keyedlist} msg] $msg
  1545. X} {1 {wrong # args: keyldel listvar key}}
  1546. X
  1547. END_OF_FILE
  1548. if test 5066 -ne `wc -c <'extended/tests/keylist.test'`; then
  1549.     echo shar: \"'extended/tests/keylist.test'\" unpacked with wrong size!
  1550. fi
  1551. # end of 'extended/tests/keylist.test'
  1552. fi
  1553. echo shar: End of archive 9 \(of 23\).
  1554. cp /dev/null ark9isdone
  1555. MISSING=""
  1556. 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
  1557.     if test ! -f ark${I}isdone ; then
  1558.     MISSING="${MISSING} ${I}"
  1559.     fi
  1560. done
  1561. if test "${MISSING}" = "" ; then
  1562.     echo You have unpacked all 23 archives.
  1563.     echo "Now cd to "extended", edit the makefile, then do a "make""
  1564.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1565. else
  1566.     echo You still need to unpack the following archives:
  1567.     echo "        " ${MISSING}
  1568. fi
  1569. ##  End of shell archive.
  1570. exit 0
  1571.  
  1572. exit 0 # Just in case...
  1573. -- 
  1574. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1575. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1576. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1577. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1578.