home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume25 / tcl / part10 < prev    next >
Encoding:
Text File  |  1991-11-14  |  50.6 KB  |  1,699 lines

  1. Newsgroups: comp.sources.misc
  2. From: karl@sugar.neosoft.com (Karl Lehenbauer)
  3. Subject:  v25i078:  tcl - tool command language, version 6.1, Part10/33
  4. Message-ID: <1991Nov14.202931.23807@sparky.imd.sterling.com>
  5. X-Md4-Signature: 0397d6eea7e54883fadb4e9d916b5f53
  6. Date: Thu, 14 Nov 1991 20:29:31 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
  10. Posting-number: Volume 25, Issue 78
  11. Archive-name: tcl/part10
  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 10 (of 33)."
  21. # Contents:  tcl6.1/compat/strerror.c tcl6.1/doc/Hash.man
  22. #   tcl6.1/tests/format.test tcl6.1/tests/parse.test
  23. # Wrapped by karl@one on Tue Nov 12 19:44:19 1991
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'tcl6.1/compat/strerror.c' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'tcl6.1/compat/strerror.c'\"
  27. else
  28. echo shar: Extracting \"'tcl6.1/compat/strerror.c'\" \(11480 characters\)
  29. sed "s/^X//" >'tcl6.1/compat/strerror.c' <<'END_OF_FILE'
  30. X/* 
  31. X * strerror.c --
  32. X *
  33. X *    Source code for the "strerror" library routine.
  34. X *
  35. X * Copyright 1988-1991 Regents of the University of California
  36. X * Permission to use, copy, modify, and distribute this
  37. X * software and its documentation for any purpose and without
  38. X * fee is hereby granted, provided that the above copyright
  39. X * notice appears in all copies.  The University of California
  40. X * makes no representations about the suitability of this
  41. X * software for any purpose.  It is provided "as is" without
  42. X * express or implied warranty.
  43. X */
  44. X
  45. X#ifndef lint
  46. Xstatic char rcsid[] = "$Header: /sprite/src/lib/tcl/compat/RCS/strerror.c,v 1.1 91/09/19 16:22:10 ouster Exp $ SPRITE (Berkeley)";
  47. X#endif /* not lint */
  48. X
  49. X#include <tclInt.h>
  50. X#include <tclUnix.h>
  51. X
  52. X/*
  53. X *----------------------------------------------------------------------
  54. X *
  55. X * strerror --
  56. X *
  57. X *    Map an integer error number into a printable string.
  58. X *
  59. X * Results:
  60. X *    The return value is a pointer to a string describing
  61. X *    error.  The first character of string isn't capitalized.
  62. X *
  63. X * Side effects:
  64. X *    Each call to this procedure may overwrite the value returned
  65. X *    by the previous call.
  66. X *
  67. X *----------------------------------------------------------------------
  68. X */
  69. X
  70. Xchar *
  71. Xstrerror(error)
  72. X    int error;            /* Integer identifying error (must be
  73. X                 * one of the officially-defined Sprite
  74. X                 * errors, as defined in errno.h). */
  75. X{
  76. X    static char msg[50];
  77. X
  78. X#if TCL_SYS_ERRLIST
  79. X    if ((error <= sys_nerr) && (error > 0)) {
  80. X    return sys_errlist[error];
  81. X    }
  82. X#else
  83. X    switch (error) {
  84. X#ifdef E2BIG
  85. X    case E2BIG: return "argument list too long";
  86. X#endif
  87. X#ifdef EACCES
  88. X    case EACCES: return "permission denied";
  89. X#endif
  90. X#ifdef EADDRINUSE
  91. X    case EADDRINUSE: return "address already in use";
  92. X#endif
  93. X#ifdef EADDRNOTAVAIL
  94. X    case EADDRNOTAVAIL: return "can't assign requested address";
  95. X#endif
  96. X#ifdef EADV
  97. X    case EADV: return "advertise error";
  98. X#endif
  99. X#ifdef EAFNOSUPPORT
  100. X    case EAFNOSUPPORT: return "address family not supported by protocol family";
  101. X#endif
  102. X#ifdef EAGAIN
  103. X    case EAGAIN: return "no more processes";
  104. X#endif
  105. X#ifdef EALIGN
  106. X    case EALIGN: return "EALIGN";
  107. X#endif
  108. X#ifdef EALREADY
  109. X    case EALREADY: return "operation already in progress";
  110. X#endif
  111. X#ifdef EBADE
  112. X    case EBADE: return "bad exchange descriptor";
  113. X#endif
  114. X#ifdef EBADF
  115. X    case EBADF: return "bad file number";
  116. X#endif
  117. X#ifdef EBADFD
  118. X    case EBADFD: return "file descriptor in bad state";
  119. X#endif
  120. X#ifdef EBADMSG
  121. X    case EBADMSG: return "not a data message";
  122. X#endif
  123. X#ifdef EBADR
  124. X    case EBADR: return "bad request descriptor";
  125. X#endif
  126. X#ifdef EBADRPC
  127. X    case EBADRPC: return "RPC structure is bad";
  128. X#endif
  129. X#ifdef EBADRQC
  130. X    case EBADRQC: return "bad request code";
  131. X#endif
  132. X#ifdef EBADSLT
  133. X    case EBADSLT: return "invalid slot";
  134. X#endif
  135. X#ifdef EBFONT
  136. X    case EBFONT: return "bad font file format";
  137. X#endif
  138. X#ifdef EBUSY
  139. X    case EBUSY: return "mount device busy";
  140. X#endif
  141. X#ifdef ECHILD
  142. X    case ECHILD: return "no children";
  143. X#endif
  144. X#ifdef ECHRNG
  145. X    case ECHRNG: return "channel number out of range";
  146. X#endif
  147. X#ifdef ECOMM
  148. X    case ECOMM: return "communication error on send";
  149. X#endif
  150. X#ifdef ECONNABORTED
  151. X    case ECONNABORTED: return "software caused connection abort";
  152. X#endif
  153. X#ifdef ECONNREFUSED
  154. X    case ECONNREFUSED: return "connection refused";
  155. X#endif
  156. X#ifdef ECONNRESET
  157. X    case ECONNRESET: return "connection reset by peer";
  158. X#endif
  159. X#ifdef EDEADLK
  160. X#ifndef EWOULDBLOCK
  161. X    case EDEADLK: return "resource deadlock avoided";
  162. X#else
  163. X#if EWOULDBLOCK != EDEADLK
  164. X    case EDEADLK: return "resource deadlock avoided";
  165. X#endif /* EWOULDBLOCK != EDEADLK */
  166. X#endif /* EWOULDBLOCK */
  167. X#endif /* EDEADLK */
  168. X#ifdef EDEADLOCK
  169. X    case EDEADLOCK: return "resource deadlock avoided";
  170. X#endif
  171. X#ifdef EDESTADDRREQ
  172. X    case EDESTADDRREQ: return "destination address required";
  173. X#endif
  174. X#ifdef EDIRTY
  175. X    case EDIRTY: return "mounting a dirty fs w/o force";
  176. X#endif
  177. X#ifdef EDOM
  178. X    case EDOM: return "math argument out of range";
  179. X#endif
  180. X#ifdef EDOTDOT
  181. X    case EDOTDOT: return "cross mount point";
  182. X#endif
  183. X#ifdef EDQUOT
  184. X    case EDQUOT: return "disk quota exceeded";
  185. X#endif
  186. X#ifdef EDUPPKG
  187. X    case EDUPPKG: return "duplicate package name";
  188. X#endif
  189. X#ifdef EEXIST
  190. X    case EEXIST: return "file already exists";
  191. X#endif
  192. X#ifdef EFAULT
  193. X    case EFAULT: return "bad address in system call argument";
  194. X#endif
  195. X#ifdef EFBIG
  196. X    case EFBIG: return "file too large";
  197. X#endif
  198. X#ifdef EHOSTDOWN
  199. X    case EHOSTDOWN: return "host is down";
  200. X#endif
  201. X#ifdef EHOSTUNREACH
  202. X    case EHOSTUNREACH: return "host is unreachable";
  203. X#endif
  204. X#ifdef EIDRM
  205. X    case EIDRM: return "identifier removed";
  206. X#endif
  207. X#ifdef EINIT
  208. X    case EINIT: return "initialization error";
  209. X#endif
  210. X#ifdef EINPROGRESS
  211. X    case EINPROGRESS: return "operation now in progress";
  212. X#endif
  213. X#ifdef EINTR
  214. X    case EINTR: return "interrupted system call";
  215. X#endif
  216. X#ifdef EINVAL
  217. X    case EINVAL: return "invalid argument";
  218. X#endif
  219. X#ifdef EIO
  220. X    case EIO: return "I/O error";
  221. X#endif
  222. X#ifdef EISCONN
  223. X    case EISCONN: return "socket is already connected";
  224. X#endif
  225. X#ifdef EISDIR
  226. X    case EISDIR: return "illegal operation on a directory";
  227. X#endif
  228. X#ifdef EISNAME
  229. X    case EISNAM: return "is a name file";
  230. X#endif
  231. X#ifdef ELBIN
  232. X    case ELBIN: return "ELBIN";
  233. X#endif
  234. X#ifdef EL2HLT
  235. X    case EL2HLT: return "level 2 halted";
  236. X#endif
  237. X#ifdef EL2NSYNC
  238. X    case EL2NSYNC: return "level 2 not synchronized";
  239. X#endif
  240. X#ifdef EL3HLT
  241. X    case EL3HLT: return "level 3 halted";
  242. X#endif
  243. X#ifdef EL3RST
  244. X    case EL3RST: return "level 3 reset";
  245. X#endif
  246. X#ifdef ELIBACC
  247. X    case ELIBACC: return "can not access a needed shared library";
  248. X#endif
  249. X#ifdef ELIBBAD
  250. X    case ELIBBAD: return "accessing a corrupted shared library";
  251. X#endif
  252. X#ifdef ELIBEXEC
  253. X    case ELIBEXEC: return "can not exec a shared library directly";
  254. X#endif
  255. X#ifdef ELIBMAX
  256. X    case ELIBMAX: return
  257. X        "attempting to link in more shared libraries than system limit";
  258. X#endif
  259. X#ifdef ELIBSCN
  260. X    case ELIBSCN: return ".lib section in a.out corrupted";
  261. X#endif
  262. X#ifdef ELNRNG
  263. X    case ELNRNG: return "link number out of range";
  264. X#endif
  265. X#ifdef ELOOP
  266. X    case ELOOP: return "too many levels of symbolic links";
  267. X#endif
  268. X#ifdef EMFILE
  269. X    case EMFILE: return "too many open files";
  270. X#endif
  271. X#ifdef EMLINK
  272. X    case EMLINK: return "too many links";
  273. X#endif
  274. X#ifdef EMSGSIZE
  275. X    case EMSGSIZE: return "message too long";
  276. X#endif
  277. X#ifdef EMULTIHOP
  278. X    case EMULTIHOP: return "multihop attempted";
  279. X#endif
  280. X#ifdef ENAMETOOLONG
  281. X    case ENAMETOOLONG: return "file name too long";
  282. X#endif
  283. X#ifdef ENAVAIL
  284. X    case ENAVAIL: return "not available";
  285. X#endif
  286. X#ifdef ENET
  287. X    case ENET: return "ENET";
  288. X#endif
  289. X#ifdef ENETDOWN
  290. X    case ENETDOWN: return "network is down";
  291. X#endif
  292. X#ifdef ENETRESET
  293. X    case ENETRESET: return "network dropped connection on reset";
  294. X#endif
  295. X#ifdef ENETUNREACH
  296. X    case ENETUNREACH: return "network is unreachable";
  297. X#endif
  298. X#ifdef ENFILE
  299. X    case ENFILE: return "file table overflow";
  300. X#endif
  301. X#ifdef ENOANO
  302. X    case ENOANO: return "anode table overflow";
  303. X#endif
  304. X#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
  305. X    case ENOBUFS: return "no buffer space available";
  306. X#endif
  307. X#ifdef ENOCSI
  308. X    case ENOCSI: return "no CSI structure available";
  309. X#endif
  310. X#ifdef ENODATA
  311. X    case ENODATA: return "no data available";
  312. X#endif
  313. X#ifdef ENODEV
  314. X    case ENODEV: return "no such device";
  315. X#endif
  316. X#ifdef ENOENT
  317. X    case ENOENT: return "no such file or directory";
  318. X#endif
  319. X#ifdef ENOEXEC
  320. X    case ENOEXEC: return "exec format error";
  321. X#endif
  322. X#ifdef ENOLCK
  323. X    case ENOLCK: return "no locks available";
  324. X#endif
  325. X#ifdef ENOLINK
  326. X    case ENOLINK: return "link has be severed";
  327. X#endif
  328. X#ifdef ENOMEM
  329. X    case ENOMEM: return "not enough memory";
  330. X#endif
  331. X#ifdef ENOMSG
  332. X    case ENOMSG: return "no message of desired type";
  333. X#endif
  334. X#ifdef ENONET
  335. X    case ENONET: return "machine is not on the network";
  336. X#endif
  337. X#ifdef ENOPKG
  338. X    case ENOPKG: return "package not installed";
  339. X#endif
  340. X#ifdef ENOPROTOOPT
  341. X    case ENOPROTOOPT: return "bad proocol option";
  342. X#endif
  343. X#ifdef ENOSPC
  344. X    case ENOSPC: return "no space left on device";
  345. X#endif
  346. X#ifdef ENOSR
  347. X    case ENOSR: return "out of stream resources";
  348. X#endif
  349. X#ifdef ENOSTR
  350. X    case ENOSTR: return "not a stream device";
  351. X#endif
  352. X#ifdef ENOSYM
  353. X    case ENOSYM: return "unresolved symbol name";
  354. X#endif
  355. X#ifdef ENOSYS
  356. X    case ENOSYS: return "function not implemented";
  357. X#endif
  358. X#ifdef ENOTBLK
  359. X    case ENOTBLK: return "block device required";
  360. X#endif
  361. X#ifdef ENOTCONN
  362. X    case ENOTCONN: return "socket is not connected";
  363. X#endif
  364. X#ifdef ENOTDIR
  365. X    case ENOTDIR: return "not a directory";
  366. X#endif
  367. X#ifdef ENOTEMPTY
  368. X    case ENOTEMPTY: return "directory not empty";
  369. X#endif
  370. X#ifdef ENOTNAM
  371. X    case ENOTNAM: return "not a name file";
  372. X#endif
  373. X#ifdef ENOTSOCK
  374. X    case ENOTSOCK: return "socket operation on non-socket";
  375. X#endif
  376. X#ifdef ENOTTY
  377. X    case ENOTTY: return "inappropriate device for ioctl";
  378. X#endif
  379. X#ifdef ENOTUNIQ
  380. X    case ENOTUNIQ: return "name not unique on network";
  381. X#endif
  382. X#ifdef ENXIO
  383. X    case ENXIO: return "no such device or address";
  384. X#endif
  385. X#ifdef EOPNOTSUPP
  386. X    case EOPNOTSUPP: return "operation not supported on socket";
  387. X#endif
  388. X#ifdef EPERM
  389. X    case EPERM: return "not owner";
  390. X#endif
  391. X#ifdef EPFNOSUPPORT
  392. X    case EPFNOSUPPORT: return "protocol family not supported";
  393. X#endif
  394. X#ifdef EPIPE
  395. X    case EPIPE: return "broken pipe";
  396. X#endif
  397. X#ifdef EPROCLIM
  398. X    case EPROCLIM: return "too many processes";
  399. X#endif
  400. X#ifdef EPROCUNAVAIL
  401. X    case EPROCUNAVAIL: return "bad procedure for program";
  402. X#endif
  403. X#ifdef EPROGMISMATCH
  404. X    case EPROGMISMATCH: return "program version wrong";
  405. X#endif
  406. X#ifdef EPROGUNAVAIL
  407. X    case EPROGUNAVAIL: return "RPC program not available";
  408. X#endif
  409. X#ifdef EPROTO
  410. X    case EPROTO: return "protocol error";
  411. X#endif
  412. X#ifdef EPROTONOSUPPORT
  413. X    case EPROTONOSUPPORT: return "protocol not suppored";
  414. X#endif
  415. X#ifdef EPROTOTYPE
  416. X    case EPROTOTYPE: return "protocol wrong type for socket";
  417. X#endif
  418. X#ifdef ERANGE
  419. X    case ERANGE: return "math result unrepresentable";
  420. X#endif
  421. X#ifdef EREFUSED
  422. X    case EREFUSED: return "EREFUSED";
  423. X#endif
  424. X#ifdef EREMCHG
  425. X    case EREMCHG: return "remote address changed";
  426. X#endif
  427. X#ifdef EREMDEV
  428. X    case EREMDEV: return "remote device";
  429. X#endif
  430. X#ifdef EREMOTE
  431. X    case EREMOTE: return "pathname hit remote file system";
  432. X#endif
  433. X#ifdef EREMOTEIO
  434. X    case EREMOTEIO: return "remote i/o error";
  435. X#endif
  436. X#ifdef EREMOTERELEASE
  437. X    case EREMOTERELEASE: return "EREMOTERELEASE";
  438. X#endif
  439. X#ifdef EROFS
  440. X    case EROFS: return "read-only file system";
  441. X#endif
  442. X#ifdef ERPCMISMATCH
  443. X    case ERPCMISMATCH: return "RPC version is wrong";
  444. X#endif
  445. X#ifdef ERREMOTE
  446. X    case ERREMOTE: return "object is remote";
  447. X#endif
  448. X#ifdef ESHUTDOWN
  449. X    case ESHUTDOWN: return "can't send afer socket shutdown";
  450. X#endif
  451. X#ifdef ESOCKTNOSUPPORT
  452. X    case ESOCKTNOSUPPORT: return "socket type not supported";
  453. X#endif
  454. X#ifdef ESPIPE
  455. X    case ESPIPE: return "invalid seek";
  456. X#endif
  457. X#ifdef ESRCH
  458. X    case ESRCH: return "no such process";
  459. X#endif
  460. X#ifdef ESRMNT
  461. X    case ESRMNT: return "srmount error";
  462. X#endif
  463. X#ifdef ESTALE
  464. X    case ESTALE: return "stale remote file handle";
  465. X#endif
  466. X#ifdef ESUCCESS
  467. X    case ESUCCESS: return "Error 0";
  468. X#endif
  469. X#ifdef ETIME
  470. X    case ETIME: return "timer expired";
  471. X#endif
  472. X#ifdef ETIMEDOUT
  473. X    case ETIMEDOUT: return "connection timed out";
  474. X#endif
  475. X#ifdef ETOOMANYREFS
  476. X    case ETOOMANYREFS: return "too many references: can't splice";
  477. X#endif
  478. X#ifdef ETXTBSY
  479. X    case ETXTBSY: return "text file or pseudo-device busy";
  480. X#endif
  481. X#ifdef EUCLEAN
  482. X    case EUCLEAN: return "structure needs cleaning";
  483. X#endif
  484. X#ifdef EUNATCH
  485. X    case EUNATCH: return "protocol driver not attached";
  486. X#endif
  487. X#ifdef EUSERS
  488. X    case EUSERS: return "too many users";
  489. X#endif
  490. X#ifdef EVERSION
  491. X    case EVERSION: return "version mismatch";
  492. X#endif
  493. X#ifdef EWOULDBLOCK
  494. X    case EWOULDBLOCK: return "operation would block";
  495. X#endif
  496. X#ifdef EXDEV
  497. X    case EXDEV: return "cross-domain link";
  498. X#endif
  499. X#ifdef EXFULL
  500. X    case EXFULL: return "message tables full";
  501. X#endif
  502. X    }
  503. X#endif /* ! TCL_SYS_ERRLIST */
  504. X    sprintf(msg, "unknown error (%d)", error);
  505. X    return msg;
  506. X}
  507. END_OF_FILE
  508. if test 11480 -ne `wc -c <'tcl6.1/compat/strerror.c'`; then
  509.     echo shar: \"'tcl6.1/compat/strerror.c'\" unpacked with wrong size!
  510. fi
  511. # end of 'tcl6.1/compat/strerror.c'
  512. fi
  513. if test -f 'tcl6.1/doc/Hash.man' -a "${1}" != "-c" ; then 
  514.   echo shar: Will not clobber existing file \"'tcl6.1/doc/Hash.man'\"
  515. else
  516. echo shar: Extracting \"'tcl6.1/doc/Hash.man'\" \(12084 characters\)
  517. sed "s/^X//" >'tcl6.1/doc/Hash.man' <<'END_OF_FILE'
  518. X'\" Copyright 1989 Regents of the University of California
  519. X'\" Permission to use, copy, modify, and distribute this
  520. X'\" documentation for any purpose and without fee is hereby
  521. X'\" granted, provided that this notice appears in all copies.
  522. X'\" The University of California makes no representations about
  523. X'\" the suitability of this material for any purpose.  It is
  524. X'\" provided "as is" without express or implied warranty.
  525. X'\" 
  526. X'\" $Header: /user6/ouster/tcl/doc/RCS/Hash.man,v 1.3 91/08/27 10:41:42 ouster Exp $ SPRITE (Berkeley)
  527. X'\" 
  528. X.\" The definitions below are for supplemental macros used in Sprite
  529. X.\" manual entries.
  530. X.\"
  531. X.\" .HS name section [date [version]]
  532. X.\"    Replacement for .TH in other man pages.  See below for valid
  533. X.\"    section names.
  534. X.\"
  535. X.\" .AP type name in/out [indent]
  536. X.\"    Start paragraph describing an argument to a library procedure.
  537. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  538. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  539. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  540. X.\"    needed;  use .AS below instead)
  541. X.\"
  542. X.\" .AS [type [name]]
  543. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  544. X.\"    name are examples of largest possible arguments that will be passed
  545. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  546. X.\"
  547. X.\" .BS
  548. X.\"    Start box enclosure.  From here until next .BE, everything will be
  549. X.\"    enclosed in one large box.
  550. X.\"
  551. X.\" .BE
  552. X.\"    End of box enclosure.
  553. X.\"
  554. X.\" .VS
  555. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  556. X.\"    of man pages.
  557. X.\"
  558. X.\" .VE
  559. X.\"    End of vertical sidebar.
  560. X.\"
  561. X.\" .DS
  562. X.\"    Begin an indented unfilled display.
  563. X.\"
  564. X.\" .DE
  565. X.\"    End of indented unfilled display.
  566. X.\"
  567. X'    # Heading for Sprite man pages
  568. X.de HS
  569. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  570. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  571. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  572. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  573. X.if t .wh -1.3i ^B
  574. X.nr ^l \\n(.l
  575. X.ad b
  576. X..
  577. X'    # Start an argument description
  578. X.de AP
  579. X.ie !"\\$4"" .TP \\$4
  580. X.el \{\
  581. X.   ie !"\\$2"" .TP \\n()Cu
  582. X.   el          .TP 15
  583. X.\}
  584. X.ie !"\\$3"" \{\
  585. X.ta \\n()Au \\n()Bu
  586. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  587. X.\".b
  588. X.\}
  589. X.el \{\
  590. X.br
  591. X.ie !"\\$2"" \{\
  592. X\&\\$1    \\fI\\$2\\fP
  593. X.\}
  594. X.el \{\
  595. X\&\\fI\\$1\\fP
  596. X.\}
  597. X.\}
  598. X..
  599. X'    # define tabbing values for .AP
  600. X.de AS
  601. X.nr )A 10n
  602. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  603. X.nr )B \\n()Au+15n
  604. X.\"
  605. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  606. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  607. X..
  608. X'    # BS - start boxed text
  609. X'    # ^y = starting y location
  610. X'    # ^b = 1
  611. X.de BS
  612. X.br
  613. X.mk ^y
  614. X.nr ^b 1u
  615. X.if n .nf
  616. X.if n .ti 0
  617. X.if n \l'\\n(.lu\(ul'
  618. X.if n .fi
  619. X..
  620. X'    # BE - end boxed text (draw box now)
  621. X.de BE
  622. X.nf
  623. X.ti 0
  624. X.mk ^t
  625. X.ie n \l'\\n(^lu\(ul'
  626. X.el \{\
  627. X.\"    Draw four-sided box normally, but don't draw top of
  628. X.\"    box if the box started on an earlier page.
  629. X.ie !\\n(^b-1 \{\
  630. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  631. X.\}
  632. X.el \}\
  633. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  634. X.\}
  635. X.\}
  636. X.fi
  637. X.br
  638. X.nr ^b 0
  639. X..
  640. X'    # VS - start vertical sidebar
  641. X'    # ^Y = starting y location
  642. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  643. X.de VS
  644. X.mk ^Y
  645. X.ie n 'mc \s12\(br\s0
  646. X.el .nr ^v 1u
  647. X..
  648. X'    # VE - end of vertical sidebar
  649. X.de VE
  650. X.ie n 'mc
  651. X.el \{\
  652. X.ev 2
  653. X.nf
  654. X.ti 0
  655. X.mk ^t
  656. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  657. X.sp -1
  658. X.fi
  659. X.ev
  660. X.\}
  661. X.nr ^v 0
  662. X..
  663. X'    # Special macro to handle page bottom:  finish off current
  664. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  665. X'    # page bottom macro.
  666. X.de ^B
  667. X.ev 2
  668. X'ti 0
  669. X'nf
  670. X.mk ^t
  671. X.if \\n(^b \{\
  672. X.\"    Draw three-sided box if this is the box's first page,
  673. X.\"    draw two sides but no top otherwise.
  674. 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
  675. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  676. X.\}
  677. X.if \\n(^v \{\
  678. X.nr ^x \\n(^tu+1v-\\n(^Yu
  679. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  680. X.\}
  681. X.bp
  682. X'fi
  683. X.ev
  684. X.if \\n(^b \{\
  685. X.mk ^y
  686. X.nr ^b 2
  687. X.\}
  688. X.if \\n(^v \{\
  689. X.mk ^Y
  690. X.\}
  691. X..
  692. X'    # DS - begin display
  693. X.de DS
  694. X.RS
  695. X.nf
  696. X.sp
  697. X..
  698. X'    # DE - end display
  699. X.de DE
  700. X.fi
  701. X.RE
  702. X.sp .5
  703. X..
  704. X.HS Tcl_Hash tcl
  705. X.BS
  706. X.SH NAME
  707. X.na
  708. XTcl_InitHashTable, Tcl_DeleteHashTable, Tcl_CreateHashEntry, \
  709. XTcl_DeleteHashEntry, Tcl_FindHashEntry, Tcl_GetHashValue, Tcl_SetHashValue, \
  710. XTcl_GetHashKey, Tcl_FirstHashEntry, Tcl_NextHashEntry, \
  711. XTcl_HashStats \- procedures to manage hash tables
  712. X.SH SYNOPSIS
  713. X.nf
  714. X\fB#include <tclHash.h>\fR
  715. X.sp
  716. X\fBTcl_InitHashTable\fR(\fItablePtr, keyType\fR)
  717. X.sp
  718. X\fBTcl_DeleteHashTable\fR(\fItablePtr\fR)
  719. X.sp
  720. XTcl_HashEntry *
  721. X\fBTcl_CreateHashEntry\fR(\fItablePtr, key, newPtr\fR)
  722. X.sp
  723. X\fBTcl_DeleteHashEntry\fR(\fIentryPtr\fR)
  724. X.sp
  725. XTcl_HashEntry *
  726. X\fBTcl_FindHashEntry\fR(\fItablePtr, key\fR)
  727. X.sp
  728. XClientData
  729. X\fBTcl_GetHashValue\fR(\fIentryPtr\fR)
  730. X.sp
  731. X\fBTcl_SetHashValue\fR(\fIentryPtr, value\fR)
  732. X.sp
  733. Xchar *
  734. X\fBTcl_GetHashKey\fR(\fItablePtr, entryPtr\fR)
  735. X.sp
  736. XTcl_HashEntry *
  737. X\fBTcl_FirstHashEntry\fR(\fItablePtr, searchPtr\fR)
  738. X.sp
  739. XTcl_HashEntry *
  740. X\fBTcl_NextHashEntry\fR(\fIsearchPtr\fR)
  741. X.sp
  742. Xchar *
  743. X\fBTcl_HashStats\fR(\fItablePtr\fR)
  744. X.SH ARGUMENTS
  745. X.AS Tcl_HashSearch *searchPtr
  746. X.AP Tcl_HashTable *tablePtr in
  747. XAddress of hash table structure (for all procedures but
  748. X\fBTcl_InitHashTable\fR, this must have been initialized by
  749. Xprevious call to \fBTcl_InitHashTable\fR).
  750. X.AP int keyType in
  751. XKind of keys to use for new hash table.  Must be either
  752. XTCL_STRING_KEYS, TCL_ONE_WORD_KEYS, or an integer value
  753. Xgreater than 1.
  754. X.AP char *key in
  755. XKey to use for probe into table.  Exact form depends on
  756. X\fIkeyType\fR used to create table.
  757. X.AP int *newPtr out
  758. XThe word at \fI*newPtr\fR is set to 1 if a new entry was created
  759. Xand 0 if there was already an entry for \fIkey\fR.
  760. X.AP Tcl_HashEntry *entryPtr in
  761. XPointer to hash table entry.
  762. X.AP ClientData value in
  763. XNew value to assign to hash table entry.  Need not have type
  764. XClientData, but must fit in same space as ClientData.
  765. X.AP Tcl_HashSearch *searchPtr in
  766. XPointer to record to use to keep track of progress in enumerating
  767. Xall the entries in a hash table.
  768. X.BE
  769. X
  770. X.SH DESCRIPTION
  771. X.PP
  772. XA hash table consists of zero or more entries, each consisting of
  773. Xa key and a value.
  774. XGiven the key for an entry, the hashing routines can very quickly
  775. Xlocate the entry, and hence its value.
  776. XThere may be at most one entry in a hash table with a
  777. Xparticular key, but many entries may have the same value.
  778. XKeys can take one of three forms:  strings,
  779. Xone-word values, or integer arrays.
  780. XAll of the keys in a given table have the same form, which is
  781. Xspecified when the table is initialized.
  782. X.PP
  783. XThe value of a hash table entry can be anything that fits in
  784. Xthe same space as a ``char *'' pointer.
  785. XValues for hash table entries are managed entirely by clients,
  786. Xnot by the hash module itself.
  787. XTypically each entry's value is a pointer to a data structure
  788. Xmanaged by client code.
  789. X.PP
  790. XHash tables grow gracefully as the number of entries increases,
  791. Xso that there are always less than three entries per hash bucket,
  792. Xon average.
  793. XThis allows for fast lookups regardless of the number of entries
  794. Xin a table.
  795. X.PP
  796. X\fBTcl_InitHashTable\fR initializes a structure that describes
  797. Xa new hash table.
  798. XThe space for the structure is provided by the caller, not by
  799. Xthe hash module.
  800. XThe value of \fIkeyType\fR indicates what kinds of keys will
  801. Xbe used for all entries in the table.  \fIKeyType\fR must have
  802. Xone of the following values:
  803. X.IP \fBTCL_STRING_KEYS\fR 25
  804. XKeys are null-terminated ASCII strings.
  805. XThey are passed to hashing routines using the address of the
  806. Xfirst character of the string.
  807. X.IP \fBTCL_ONE_WORD_KEYS\fR 25
  808. XKeys are single-word values;  they are passed to hashing routines
  809. Xand stored in hash table entries as ``char *'' values.
  810. XThe pointer value is the key;  it need not (and usually doesn't)
  811. Xactually point to a string.
  812. X.IP \fIother\fR 25
  813. XIf \fIkeyType\fR is not TCL_STRING_KEYS or TCL_ONE_WORD_KEYS,
  814. Xthen it must be an integer value greater than 1.
  815. XIn this case the keys will be arrays of ``int'' values, where
  816. X\fIkeyType\fR gives the number of ints in each key.
  817. XThis allows structures to be used as keys.
  818. XAll keys must have the same size.
  819. XArray keys are passed into hashing functions using the address
  820. Xof the first int in the array.
  821. X.PP
  822. X\fBTcl_DeleteHashTable\fR deletes all of the entries in a hash
  823. Xtable and frees up the memory associated with the table's
  824. Xbucket array and entries.
  825. XIt does not free the actual table structure (pointed to
  826. Xby \fItablePtr\fR), since that memory is assumed to be managed
  827. Xby the client.
  828. X\fBTcl_DeleteHashTable\fR also does not free or otherwise
  829. Xmanipulate the values of the hash table entries.
  830. XIf the entry values point to dynamically-allocated memory, then
  831. Xit is the client's responsibility to free these structures
  832. Xbefore deleting the table.
  833. X.PP
  834. X\fBTcl_CreateHashEntry\fR locates the entry corresponding to a
  835. Xparticular key, creating a new entry in the table if there
  836. Xwasn't already one with the given key.
  837. XIf an entry already existed with the given key then \fI*newPtr\fR
  838. Xis set to zero.
  839. XIf a new entry was created, then \fI*newPtr\fR is set to a non-zero
  840. Xvalue and the value of the new entry will be set to zero.
  841. XThe return value from \fBTcl_CreateHashEntry\fR is a pointer to
  842. Xthe entry, which may be used to retrieve and modify the entry's
  843. Xvalue or to delete the entry from the table.
  844. X.PP
  845. X\fBTcl_DeleteHashEntry\fR will remove an existing entry from a
  846. Xtable.
  847. XThe memory associated with the entry itself will be freed, but
  848. Xthe client is responsible for any cleanup associated with the
  849. Xentry's value, such as freeing a structure that it points to.
  850. X.PP
  851. X\fBTcl_FindHashEntry\fR is similar to \fBTcl_CreateHashEntry\fR
  852. Xexcept that it doesn't create a new entry if the key doesn't exist;
  853. Xinstead, it returns NULL as result.
  854. X.PP
  855. X\fBTcl_GetHashValue\fR and \fBTcl_SetHashValue\fR are used to
  856. Xread and write an entry's value, respectively.
  857. XValues are stored and retrieved as type ``ClientData'', which is
  858. Xlarge enough to hold a pointer value.  On almost all machines this is
  859. Xlarge enough to hold an integer value too.
  860. X.PP
  861. X\fBTcl_GetHashKey\fR returns the key for a given hash table entry,
  862. Xeither as a pointer to a string, a one-word (``char *'') key, or
  863. Xas a pointer to the first word of an array of integers, depending
  864. Xon the \fIkeyType\fR used to create a hash table.
  865. XIn all cases \fBTcl_GetHashKey\fR returns a result with type
  866. X``char *''.
  867. XWhen the key is a string or array, the result of \fBTcl_GetHashKey\fR
  868. Xpoints to information in the table entry;  this information will
  869. Xremain valid until the entry is deleted or its table is deleted.
  870. X.PP
  871. X\fBTcl_FirstHashEntry\fR and \fBTcl_NextHashEntry\fR may be used
  872. Xto scan all of the entries in a hash table.
  873. XA structure of type ``Tcl_HashSearch'', provided by the client,
  874. Xis used to keep track of progress through the table.
  875. X\fBTcl_FirstHashEntry\fR initializes the search record and
  876. Xreturns the first entry in the table (or NULL if the table is
  877. Xempty).
  878. XEach susequent call to \fBTcl_NextHashEntry\fR returns the
  879. Xnext entry in the table or
  880. XNULL if the end of the table has been reached.
  881. XA call to \fBTcl_FirstHashEntry\fR followed by calls to
  882. X\fBTcl_NextHashEntry\fR will return each of the entries in
  883. Xthe table exactly once, in an arbitrary order.
  884. XIt is unadvisable to modify the structure of the table, e.g.
  885. Xby creating or deleting entries, while the search is in
  886. Xprogress.
  887. X.PP
  888. X\fBTcl_HashStats\fR returns a dynamically-allocated string with
  889. Xoverall information about a hash table, such as the number of
  890. Xentries it contains, the number of buckets in its hash array,
  891. Xand the utilization of the buckets.
  892. XIt is the caller's responsibility to free the result string
  893. Xby passing it to \fBfree\fR.
  894. X.PP
  895. XThe header file \fBtclHash.h\fR defines the actual data structures
  896. Xused to implement hash tables.
  897. XThis is necessary so that clients can allocate Tcl_HashTable
  898. Xstructures and so that macros can be used to read and write
  899. Xthe values of entries.
  900. XHowever, users of the hashing routines should never refer directly
  901. Xto any of the fields of any of the hash-related data structures;
  902. Xuse the procedures and macros defined here.
  903. X
  904. X.SH KEYWORDS
  905. Xhash table, key, lookup, search, value
  906. END_OF_FILE
  907. if test 12084 -ne `wc -c <'tcl6.1/doc/Hash.man'`; then
  908.     echo shar: \"'tcl6.1/doc/Hash.man'\" unpacked with wrong size!
  909. fi
  910. # end of 'tcl6.1/doc/Hash.man'
  911. fi
  912. if test -f 'tcl6.1/tests/format.test' -a "${1}" != "-c" ; then 
  913.   echo shar: Will not clobber existing file \"'tcl6.1/tests/format.test'\"
  914. else
  915. echo shar: Extracting \"'tcl6.1/tests/format.test'\" \(11548 characters\)
  916. sed "s/^X//" >'tcl6.1/tests/format.test' <<'END_OF_FILE'
  917. X# Commands covered:  format
  918. X#
  919. X# This file contains a collection of tests for one or more of the Tcl
  920. X# built-in commands.  Sourcing this file into Tcl runs the tests and
  921. X# generates output for errors.  No output means no errors were found.
  922. X#
  923. X# Copyright 1991 Regents of the University of California
  924. X# Permission to use, copy, modify, and distribute this
  925. X# software and its documentation for any purpose and without
  926. X# fee is hereby granted, provided that this copyright notice
  927. X# appears in all copies.  The University of California makes no
  928. X# representations about the suitability of this software for any
  929. X# purpose.  It is provided "as is" without express or implied
  930. X# warranty.
  931. X#
  932. X# $Header: /sprite/src/lib/tcl/tests/RCS/format.test,v 1.6 91/09/17 11:32:01 ouster Exp $ (Berkeley)
  933. X
  934. Xif {[string compare test [info procs test]] == 1} then {source defs}
  935. X
  936. X# The following code is needed because some versions of SCO Unix have
  937. X# a round-off error in sprintf which would cause some of the tests to
  938. X# fail.  Someday I hope this code shouldn't be necessary (code added
  939. X# 9/9/91).
  940. X
  941. Xset roundOffBug 0
  942. Xif {"[format %7.1e  68.514]" == "6.8e+01"} {
  943. X    puts stdout "Note: this system has a sprintf round-off bug, some tests skipped\n"
  944. X    set roundOffBug 1
  945. X}
  946. X
  947. Xtest format-1.1 {integer formatting} {
  948. X    format "%*d %d %d %d" 6 34 16923 -12 -1
  949. X} {    34 16923 -12 -1}
  950. Xtest format-1.2 {integer formatting} {
  951. X    format "%4d %4d %4d %4d %d %#x %#X" 6 34 16923 -12 -1 0 0
  952. X} {   6   34 16923  -12 -1 0 0}
  953. Xtest format-1.3 {integer formatting} {
  954. X    format "%4u %4u %4u %4u %d %#o" 6 34 16923 -12 -1 0
  955. X} {   6   34 16923 4294967284 -1 0}
  956. Xtest format-1.4 {integer formatting} {
  957. X    format "%-4d %-4d %-4d %-4ld" 6 34 16923 -12 -1
  958. X} {6    34   16923 -12 }
  959. Xtest format-1.5 {integer formatting} {
  960. X    format "%04d %04d %04d %04d" 6 34 16923 -12 -1
  961. X} {0006 0034 16923 -012}
  962. Xtest format-1.6 {integer formatting} {
  963. X    format "%00*d" 6 34
  964. X} {000034}
  965. Xtest format-1.7 {integer formatting} {
  966. X    format "%4x %4x %4x %4x" 6 34 16923 -12 -1
  967. X} {   6   22 421b fffffff4}
  968. Xtest format-1.8 {integer formatting} {
  969. X    format "%#x %#X %#X %#x" 6 34 16923 -12 -1
  970. X} {0x6 0X22 0X421B 0xfffffff4}
  971. Xtest format-1.9 {integer formatting} {
  972. X    format "%#20x %#20x %#20x %#20x" 6 34 16923 -12 -1
  973. X} {                 0x6                 0x22               0x421b           0xfffffff4}
  974. Xtest format-1.10 {integer formatting} {
  975. X    format "%-#20x %-#20x %-#20x %-#20x" 6 34 16923 -12 -1
  976. X} {0x6                  0x22                 0x421b               0xfffffff4          }
  977. Xtest format-1.11 {integer formatting} {
  978. X    format "%-#20o %#-20o %#-20o %#-20o" 6 34 16923 -12 -1
  979. X} {06                   042                  041033               037777777764        }
  980. X
  981. Xtest format-2.1 {string formatting} {
  982. X    format "%s %s %c %s" abcd {This is a very long test string.} 120 x
  983. X} {abcd This is a very long test string. x x}
  984. Xtest format-2.2 {string formatting} {
  985. X    format "%20s %20s %20c %20s" abcd {This is a very long test string.} 120 x
  986. X} {                abcd This is a very long test string.                    x                    x}
  987. Xtest format-2.3 {string formatting} {
  988. X    format "%.10s %.10s %c %.10s" abcd {This is a very long test string.} 120 x
  989. X} {abcd This is a  x x}
  990. Xtest format-2.4 {string formatting} {
  991. X    format "%s %s %% %c %s" abcd {This is a very long test string.} 120 x
  992. X} {abcd This is a very long test string. % x x}
  993. X
  994. Xtest format-3.1 {e and f formats} {
  995. X    format "%e %e %e %e" 34.2e12 68.514 -.125 -16000. .000053
  996. X} {3.420000e+13 6.851400e+01 -1.250000e-01 -1.600000e+04}
  997. Xtest format-3.2 {e and f formats} {
  998. X    format "%20e %20e %20e %20e" 34.2e12 68.514 -.125 -16000. .000053
  999. X} {        3.420000e+13         6.851400e+01        -1.250000e-01        -1.600000e+04}
  1000. Xif {!$roundOffBug} {
  1001. X    test format-3.3 {e and f formats} {
  1002. X    format "%.1e %.1e %.1e %.1e" 34.2e12 68.514 -.126 -16000. .000053
  1003. X    } {3.4e+13 6.9e+01 -1.3e-01 -1.6e+04}
  1004. X    test format-3.4 {e and f formats} {
  1005. X    format "%020e %020e %020e %020e" 34.2e12 68.514 -.126 -16000. .000053
  1006. X    } {000000003.420000e+13 000000006.851400e+01 -00000001.260000e-01 -00000001.600000e+04}
  1007. X    test format-3.5 {e and f formats} {
  1008. X    format "%7.1e %7.1e %7.1e %7.1e" 34.2e12 68.514 -.126 -16000. .000053
  1009. X    } {3.4e+13 6.9e+01 -1.3e-01 -1.6e+04}
  1010. X    test format-3.6 {e and f formats} {
  1011. X    format "%f %f %f %f" 34.2e12 68.514 -.125 -16000. .000053
  1012. X    } {34200000000000.000000 68.514000 -0.125000 -16000.000000}
  1013. X}
  1014. Xtest format-3.7 {e and f formats} {
  1015. X    format "%.4f %.4f %.4f %.4f %.4f" 34.2e12 68.514 -.125 -16000. .000053
  1016. X} {34200000000000.0000 68.5140 -0.1250 -16000.0000 0.0001}
  1017. Xtest format-3.8 {e and f formats} {
  1018. X    format "%.4e %.5e %.6e" -9.99996 -9.99996 9.99996
  1019. X} {-1.0000e+01 -9.99996e+00 9.999960e+00}
  1020. Xtest format-3.9 {e and f formats} {
  1021. X    format "%.4f %.5f %.6f" -9.99996 -9.99996 9.99996
  1022. X} {-10.0000 -9.99996 9.999960}
  1023. Xtest format-3.10 {e and f formats} {
  1024. X    format "%20f %-20f %020f" -9.99996 -9.99996 9.99996
  1025. X} {           -9.999960 -9.999960            0000000000009.999960}
  1026. Xtest format-3.11 {e and f formats} {
  1027. X    format "%-020f %020f" -9.99996 -9.99996 9.99996
  1028. X} {-9.999960            -000000000009.999960}
  1029. Xtest format-3.12 {e and f formats} {
  1030. X    format "%.0e %#.0e" -9.99996 -9.99996 9.99996
  1031. X} {-1e+01 -1.e+01}
  1032. Xtest format-3.13 {e and f formats} {
  1033. X    format "%.0f %#.0f" -9.99996 -9.99996 9.99996
  1034. X} {-10 -10.}
  1035. Xtest format-3.14 {e and f formats} {
  1036. X    format "%.4f %.5f %.6f" -9.99996 -9.99996 9.99996
  1037. X} {-10.0000 -9.99996 9.999960}
  1038. Xtest format-3.15 {e and f formats} {
  1039. X    format "%3.0f %3.0f %3.0f %3.0f" 1.0 1.1 1.01 1.001
  1040. X} {  1   1   1   1}
  1041. Xtest format-3.16 {e and f formats} {
  1042. X    format "%3.1f %3.1f %3.1f %3.1f" 0.0 0.1 0.01 0.001
  1043. X} {0.0 0.1 0.0 0.0}
  1044. X
  1045. Xtest format-4.1 {g-format} {
  1046. X    format "%.3g" 12341.0
  1047. X} {1.23e+04}
  1048. Xtest format-4.2 {g-format} {
  1049. X    format "%.3G" 1234.12345
  1050. X} {1.23E+03}
  1051. Xtest format-4.3 {g-format} {
  1052. X    format "%.3g" 123.412345
  1053. X} {123}
  1054. Xtest format-4.4 {g-format} {
  1055. X    format "%.3g" 12.3412345
  1056. X} {12.3}
  1057. Xtest format-4.5 {g-format} {
  1058. X    format "%.3g" 1.23412345
  1059. X} {1.23}
  1060. Xtest format-4.6 {g-format} {
  1061. X    format "%.3g" 1.23412345
  1062. X} {1.23}
  1063. Xtest format-4.7 {g-format} {
  1064. X    format "%.3g" .123412345
  1065. X} {0.123}
  1066. Xtest format-4.8 {g-format} {
  1067. X    format "%.3g" .012341
  1068. X} {0.0123}
  1069. Xtest format-4.9 {g-format} {
  1070. X    format "%.3g" .0012341
  1071. X} {0.00123}
  1072. Xtest format-4.10 {g-format} {
  1073. X    format "%.3g" .00012341
  1074. X} {0.000123}
  1075. Xtest format-4.11 {g-format} {
  1076. X    format "%.3g" .00001234
  1077. X} {1.23e-05}
  1078. Xtest format-4.12 {g-format} {
  1079. X    format "%.4g" 9999.6
  1080. X} {1e+04}
  1081. Xtest format-4.13 {g-format} {
  1082. X    format "%.4g" 999.96
  1083. X} {1000}
  1084. Xtest format-4.14 {g-format} {
  1085. X    format "%.3g" 1.0
  1086. X} {1}
  1087. Xtest format-4.15 {g-format} {
  1088. X    format "%.3g" .1
  1089. X} {0.1}
  1090. Xtest format-4.16 {g-format} {
  1091. X    format "%.3g" .01
  1092. X} {0.01}
  1093. Xtest format-4.17 {g-format} {
  1094. X    format "%.3g" .001
  1095. X} {0.001}
  1096. Xtest format-4.19 {g-format} {
  1097. X    format "%.3g" .00001
  1098. X} {1e-05}
  1099. Xtest format-4.20 {g-format} {
  1100. X    format "%#.3g" 1234.0
  1101. X} {1.23e+03}
  1102. Xtest format-4.21 {g-format} {
  1103. X    format "%#.3G" 9999.5
  1104. X} {1.00E+04}
  1105. X
  1106. Xtest format-5.1 {floating-point zeroes} {
  1107. X    format "%e %f %g" 0.0 0.0 0.0 0.0
  1108. X} {0.000000e+00 0.000000 0}
  1109. Xtest format-5.2 {floating-point zeroes} {
  1110. X    format "%.4e %.4f %.4g" 0.0 0.0 0.0 0.0
  1111. X} {0.0000e+00 0.0000 0}
  1112. Xtest format-5.3 {floating-point zeroes} {
  1113. X    format "%#.4e %#.4f %#.4g" 0.0 0.0 0.0 0.0
  1114. X} {0.0000e+00 0.0000 0.000}
  1115. Xtest format-5.4 {floating-point zeroes} {
  1116. X    format "%.0e %.0f %.0g" 0.0 0.0 0.0 0.0
  1117. X} {0e+00 0 0}
  1118. Xtest format-5.5 {floating-point zeroes} {
  1119. X    format "%#.0e %#.0f %#.0g" 0.0 0.0 0.0 0.0
  1120. X} {0.e+00 0. 0.}
  1121. Xtest format-5.6 {floating-point zeroes} {
  1122. X    format "%3.0f %3.0f %3.0f %3.0f" 0.0 0.0 0.0 0.0
  1123. X} {  0   0   0   0}
  1124. Xtest format-5.7 {floating-point zeroes} {
  1125. X    format "%3.0f %3.0f %3.0f %3.0f" 1.0 1.1 1.01 1.001
  1126. X} {  1   1   1   1}
  1127. Xtest format-5.8 {floating-point zeroes} {
  1128. X    format "%3.1f %3.1f %3.1f %3.1f" 0.0 0.1 0.01 0.001
  1129. X} {0.0 0.1 0.0 0.0}
  1130. X
  1131. Xtest format-6.1 {various syntax features} {
  1132. X    format "%*.*f" 12 3 12.345678901
  1133. X} {      12.346}
  1134. Xtest format-6.2 {various syntax features} {
  1135. X    format "%0*.*f" 12 3 12.345678901
  1136. X} {00000012.346}
  1137. X
  1138. Xtest format-7.1 {error conditions} {
  1139. X    catch format
  1140. X} 1
  1141. Xtest format-7.2 {error conditions} {
  1142. X    catch format msg
  1143. X    set msg
  1144. X} {wrong # args: should be "format formatString ?arg arg ...?"}
  1145. Xtest format-7.3 {error conditions} {
  1146. X    catch {format %*d}
  1147. X} 1
  1148. Xtest format-7.4 {error conditions} {
  1149. X    catch {format %*d} msg
  1150. X    set msg
  1151. X} {not enough arguments for all format specifiers}
  1152. Xtest format-7.5 {error conditions} {
  1153. X    catch {format %*.*f 12}
  1154. X} 1
  1155. Xtest format-7.6 {error conditions} {
  1156. X    catch {format %*.*f 12} msg
  1157. X    set msg
  1158. X} {not enough arguments for all format specifiers}
  1159. Xtest format-7.7 {error conditions} {
  1160. X    catch {format %*.*f 12 3}
  1161. X} 1
  1162. Xtest format-7.8 {error conditions} {
  1163. X    catch {format %*.*f 12 3} msg
  1164. X    set msg
  1165. X} {not enough arguments for all format specifiers}
  1166. Xtest format-7.9 {error conditions} {
  1167. X    list [catch {format %*d x 3} msg] $msg
  1168. X} {1 {expected integer but got "x"}}
  1169. Xtest format-7.10 {error conditions} {
  1170. X    list [catch {format %*.*f 2 xyz 3} msg] $msg
  1171. X} {1 {expected integer but got "xyz"}}
  1172. Xtest format-7.11 {error conditions} {
  1173. X    catch {format %d 2a}
  1174. X} 1
  1175. Xtest format-7.12 {error conditions} {
  1176. X    catch {format %d 2a} msg
  1177. X    set msg
  1178. X} {expected integer but got "2a"}
  1179. Xtest format-7.13 {error conditions} {
  1180. X    catch {format %c 2x}
  1181. X} 1
  1182. Xtest format-7.14 {error conditions} {
  1183. X    catch {format %c 2x} msg
  1184. X    set msg
  1185. X} {expected integer but got "2x"}
  1186. Xtest format-7.15 {error conditions} {
  1187. X    catch {format %f 2.1z}
  1188. X} 1
  1189. Xtest format-7.16 {error conditions} {
  1190. X    catch {format %f 2.1z} msg
  1191. X    set msg
  1192. X} {expected floating-point number but got "2.1z"}
  1193. Xtest format-7.17 {error conditions} {
  1194. X    catch {format ab%}
  1195. X} 1
  1196. Xtest format-7.18 {error conditions} {
  1197. X    catch {format ab% 12} msg
  1198. X    set msg
  1199. X} {format string ended in middle of field specifier}
  1200. Xtest format-7.19 {error conditions} {
  1201. X    catch {format %q x}
  1202. X} 1
  1203. Xtest format-7.20 {error conditions} {
  1204. X    catch {format %q x} msg
  1205. X    set msg
  1206. X} {bad field specifier "q"}
  1207. Xtest format-7.21 {error conditions} {
  1208. X    catch {format %d}
  1209. X} 1
  1210. Xtest format-7.22 {error conditions} {
  1211. X    catch {format %d} msg
  1212. X    set msg
  1213. X} {not enough arguments for all format specifiers}
  1214. X
  1215. Xtest format-8.1 {long result} {
  1216. X    set a {1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 \
  1217. X3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E \
  1218. XF G H I J K L M N O P Q R S T U V W X Y Z}
  1219. X    format {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd \
  1220. Xeeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss \
  1221. Xtttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF \
  1222. XGGGG %s %s %s} $a $a $a
  1223. X} {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff \
  1224. Xgggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu \
  1225. Xvvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG \
  1226. X1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 \
  1227. X7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H \
  1228. XI J K L M N O P Q R S T U V W X Y Z \
  1229. X1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 \
  1230. X8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I \
  1231. XJ K L M N O P Q R S T U V W X Y Z \
  1232. X1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 \
  1233. X8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I \
  1234. XJ K L M N O P Q R S T U V W X Y Z}
  1235. END_OF_FILE
  1236. if test 11548 -ne `wc -c <'tcl6.1/tests/format.test'`; then
  1237.     echo shar: \"'tcl6.1/tests/format.test'\" unpacked with wrong size!
  1238. fi
  1239. # end of 'tcl6.1/tests/format.test'
  1240. fi
  1241. if test -f 'tcl6.1/tests/parse.test' -a "${1}" != "-c" ; then 
  1242.   echo shar: Will not clobber existing file \"'tcl6.1/tests/parse.test'\"
  1243. else
  1244. echo shar: Extracting \"'tcl6.1/tests/parse.test'\" \(11404 characters\)
  1245. sed "s/^X//" >'tcl6.1/tests/parse.test' <<'END_OF_FILE'
  1246. X# Commands covered:  set (plus basic command syntax)
  1247. X#
  1248. X# This file contains a collection of tests for one or more of the Tcl
  1249. X# built-in commands.  Sourcing this file into Tcl runs the tests and
  1250. X# generates output for errors.  No output means no errors were found.
  1251. X#
  1252. X# Copyright 1991 Regents of the University of California
  1253. X# Permission to use, copy, modify, and distribute this
  1254. X# software and its documentation for any purpose and without
  1255. X# fee is hereby granted, provided that this copyright notice
  1256. X# appears in all copies.  The University of California makes no
  1257. X# representations about the suitability of this software for any
  1258. X# purpose.  It is provided "as is" without express or implied
  1259. X# warranty.
  1260. X#
  1261. X# $Header: /user6/ouster/tcl/tests/RCS/parse.test,v 1.21 91/10/31 16:40:37 ouster Exp $ (Berkeley)
  1262. X
  1263. Xif {[string compare test [info procs test]] == 1} then {source defs}
  1264. X
  1265. Xproc fourArgs {a b c d} {
  1266. X    global arg1 arg2 arg3 arg4
  1267. X    set arg1 $a
  1268. X    set arg2 $b
  1269. X    set arg3 $c
  1270. X    set arg4 $d
  1271. X}
  1272. X
  1273. Xproc getArgs args {
  1274. X    global argv
  1275. X    set argv $args
  1276. X}
  1277. X
  1278. X# Basic argument parsing.
  1279. X
  1280. Xtest parse-1.1 {basic argument parsing} {
  1281. X    set arg1 {}
  1282. X    fourArgs a b    c          d
  1283. X    list $arg1 $arg2 $arg3 $arg4
  1284. X} {a b c d}
  1285. Xtest parse-1.2 {basic argument parsing} {
  1286. X    set arg1 {}
  1287. X    eval "fourArgs 123\v4\f56\r7890"
  1288. X    list $arg1 $arg2 $arg3 $arg4
  1289. X} {123 4 56 7890}
  1290. X
  1291. X# Quotes.
  1292. X
  1293. Xtest parse-2.1 {quotes and variable-substitution} {
  1294. X    getArgs "a b c" d
  1295. X    set argv
  1296. X} {{a b c} d}
  1297. Xtest parse-2.2 {quotes and variable-substitution} {
  1298. X    set a 101
  1299. X    getArgs "a$a b c"
  1300. X    set argv
  1301. X} {{a101 b c}}
  1302. Xtest parse-2.3 {quotes and variable-substitution} {
  1303. X    set argv "xy[format xabc]"
  1304. X    set argv
  1305. X} {xyxabc}
  1306. Xtest parse-2.4 {quotes and variable-substitution} {
  1307. X    set argv "xy\t"
  1308. X    set argv
  1309. X} xy\t
  1310. Xtest parse-2.5 {quotes and variable-substitution} {
  1311. X    set argv "a b    c
  1312. Xd e f"
  1313. X    set argv
  1314. X} a\ b\tc\nd\ e\ f
  1315. Xtest parse-2.6 {quotes and variable-substitution} {
  1316. X    set argv a"bcd"e
  1317. X    set argv
  1318. X} {a"bcd"e}
  1319. X
  1320. X# Braces.
  1321. X
  1322. Xtest parse-3.1 {braces} {
  1323. X    getArgs {a b c} d
  1324. X    set argv
  1325. X} "{a b c} d"
  1326. Xtest parse-3.2 {braces} {
  1327. X    set a 101
  1328. X    set argv {a$a b c}
  1329. X    set b [string index $argv 1]
  1330. X    set b
  1331. X} {$}
  1332. Xtest parse-3.3 {braces} {
  1333. X    set argv {a[format xyz] b}
  1334. X    string length $argv
  1335. X} 15
  1336. Xtest parse-3.4 {braces} {
  1337. X    set argv {a\nb\}}
  1338. X    string length $argv
  1339. X} 6
  1340. Xtest parse-3.5 {braces} {
  1341. X    set argv {{{{}}}}
  1342. X    set argv
  1343. X} "{{{}}}"
  1344. Xtest parse-3.6 {braces} {
  1345. X    set argv a{{}}b
  1346. X    set argv
  1347. X} "a{{}}b"
  1348. Xtest parse-3.7 {braces} {
  1349. X    set a [format "last]"]
  1350. X    set a
  1351. X} {last]}
  1352. X
  1353. X# Command substitution.
  1354. X
  1355. Xtest parse-4.1 {command substitution} {
  1356. X    set a [format xyz]
  1357. X    set a
  1358. X} xyz
  1359. Xtest parse-4.2 {command substitution} {
  1360. X    set a a[format xyz]b[format q]
  1361. X    set a
  1362. X} axyzbq
  1363. Xtest parse-4.3 {command substitution} {
  1364. X    set a a[
  1365. Xset b 22;
  1366. Xformat %s $b
  1367. X
  1368. X]b
  1369. X    set a
  1370. X} a22b
  1371. X
  1372. X# Variable substitution.
  1373. X
  1374. Xtest parse-5.1 {variable substitution} {
  1375. X    set a 123
  1376. X    set b $a
  1377. X    set b
  1378. X} 123
  1379. Xtest parse-5.2 {variable substitution} {
  1380. X    set a 345
  1381. X    set b x$a.b
  1382. X    set b
  1383. X} x345.b
  1384. Xtest parse-5.3 {variable substitution} {
  1385. X    set _123z xx
  1386. X    set b $_123z^
  1387. X    set b
  1388. X} xx^
  1389. Xtest parse-5.4 {variable substitution} {
  1390. X    set a 78
  1391. X    set b a${a}b
  1392. X    set b
  1393. X} a78b
  1394. Xtest parse-5.5 {variable substitution} {catch {$_non_existent_} msg} 1
  1395. Xtest parse-5.6 {variable substitution} {
  1396. X    catch {$_non_existent_} msg
  1397. X    set msg
  1398. X} {can't read "_non_existent_": no such variable}
  1399. Xtest parse-5.7 {array variable substitution} {
  1400. X    catch {unset a}
  1401. X    set a(xyz) 123
  1402. X    set b $a(xyz)foo
  1403. X    set b
  1404. X} 123foo
  1405. Xtest parse-5.8 {array variable substitution} {
  1406. X    catch {unset a}
  1407. X    set "a(x y z)" 123
  1408. X    set b $a(x y z)foo
  1409. X    set b
  1410. X} 123foo
  1411. Xtest parse-5.9 {array variable substitution} {
  1412. X    catch {unset a}; catch {unset qqq}
  1413. X    set "a(x y z)" qqq
  1414. X    set $a([format x]\ y [format z]) foo
  1415. X    set qqq
  1416. X} foo
  1417. Xtest parse-5.10 {array variable substitution} {
  1418. X    catch {unset a}
  1419. X    list [catch {set b $a(22)} msg] $msg
  1420. X} {1 {can't read "a(22)": no such variable}}
  1421. Xtest parse-5.11 {array variable substitution} {
  1422. X    set b a$!
  1423. X    set b
  1424. X} {a$!}
  1425. Xtest parse-5.12 {array variable substitution} {
  1426. X    set b a$()
  1427. X    set b
  1428. X} {a$()}
  1429. Xcatch {unset a}
  1430. Xtest parse-5.13 {array variable substitution} {
  1431. X    catch {unset a}
  1432. X    set long {This is a very long variable, long enough to cause storage \
  1433. X    allocation to occur in Tcl_ParseVar.  If that storage isn't getting \
  1434. X    freed up correctly, then a core leak will occur when this test is \
  1435. X    run.  This text is probably beginning to sound like drivel, but I've \
  1436. X    run out of things to say and I need more characters still.}
  1437. X    set a($long) 777
  1438. X    set b $a($long)
  1439. X    list $b [array names a]
  1440. X} {777 {{This is a very long variable, long enough to cause storage \
  1441. X    allocation to occur in Tcl_ParseVar.  If that storage isn't getting \
  1442. X    freed up correctly, then a core leak will occur when this test is \
  1443. X    run.  This text is probably beginning to sound like drivel, but I've \
  1444. X    run out of things to say and I need more characters still.}}}
  1445. Xtest parse-5.14 {array variable substitution} {
  1446. X    catch {unset a}; catch {unset b}; catch {unset a1}
  1447. X    set a1(22) foo
  1448. X    set a(foo) bar
  1449. X    set b $a($a1(22))
  1450. X    set b
  1451. X} bar
  1452. Xcatch {unset a}; catch {unset a1}
  1453. X
  1454. X# Backslash substitution.
  1455. X
  1456. Xset errNum 1
  1457. Xproc bsCheck {char num} {
  1458. X    global errNum
  1459. X    test parse-6.$errNum {backslash substitution} {
  1460. X    scan $char %c value
  1461. X    set value
  1462. X    } $num
  1463. X    set errNum [expr $errNum+1]
  1464. X}
  1465. X
  1466. XbsCheck \b    8
  1467. XbsCheck \e    27
  1468. XbsCheck \f    12
  1469. XbsCheck \n    10
  1470. XbsCheck \r    13
  1471. XbsCheck \t    9
  1472. XbsCheck \v    11
  1473. XbsCheck \{    123
  1474. XbsCheck \}    125
  1475. XbsCheck \[    91
  1476. XbsCheck \]    93
  1477. XbsCheck \$    36
  1478. XbsCheck \     32
  1479. XbsCheck \;    59
  1480. XbsCheck \\    92
  1481. XbsCheck \Ca    1
  1482. XbsCheck \Ma    225
  1483. XbsCheck \CMa    129
  1484. XbsCheck \14    12
  1485. XbsCheck \00a    97
  1486. XbsCheck b\0    98
  1487. XbsCheck \x    92
  1488. XbsCheck \
  1489. Xa        97
  1490. X
  1491. Xtest parse-7.1 {backslash substitution} {
  1492. X    set a "\a\c\n\]\}"
  1493. X    string length $a
  1494. X} 7
  1495. Xtest parse-7.2 {backslash substitution} {
  1496. X    set a {\a\c\n\]\}}
  1497. X    string length $a
  1498. X} 10
  1499. Xtest parse-7.3 {backslash substitution} {
  1500. X    set a "abc\
  1501. Xdef"
  1502. X    set a
  1503. X} abcdef
  1504. Xtest parse-7.4 {backslash substitution} {
  1505. X    set a {abc\
  1506. Xdef}
  1507. X    set a
  1508. X} "abcdef"
  1509. Xtest parse-7.5 {backslash substitution} {
  1510. X    set msg {}
  1511. X    set a xxx
  1512. X    set error [catch {if {24 < \
  1513. X    35} {set a 22} {set \
  1514. X        a 33}} msg]
  1515. X    list $error $msg $a
  1516. X} {0 22 22}
  1517. X
  1518. X# Semi-colon.
  1519. X
  1520. Xtest parse-8.1 {semi-colons} {
  1521. X    set b 0
  1522. X    getArgs a;set b 2
  1523. X    set argv
  1524. X} a
  1525. Xtest parse-8.2 {semi-colons} {
  1526. X    set b 0
  1527. X    getArgs a;set b 2
  1528. X    set b
  1529. X} 2
  1530. Xtest parse-8.3 {semi-colons} {
  1531. X    getArgs a b ; set b 1
  1532. X    set argv
  1533. X} {a b}
  1534. Xtest parse-8.4 {semi-colons} {
  1535. X    getArgs a b ; set b 1
  1536. X    set b
  1537. X} 1
  1538. X
  1539. X# The following checks are to ensure that the interpreter's result
  1540. X# gets re-initialized by Tcl_Eval in all the right places.
  1541. X
  1542. Xtest parse-9.1 {result initialization} {concat abc} abc
  1543. Xtest parse-9.2 {result initialization} {concat abc; proc foo {} {}} {}
  1544. Xtest parse-9.3 {result initialization} {concat abc; proc foo {} $a} {}
  1545. Xtest parse-9.4 {result initialization} {proc foo {} [concat abc]} {}
  1546. Xtest parse-9.5 {result initialization} {concat abc; } abc
  1547. Xtest parse-9.6 {result initialization} {
  1548. X    eval {
  1549. X    concat abc
  1550. X}} abc
  1551. Xtest parse-9.7 {result initialization} {} {}
  1552. Xtest parse-9.8 {result initialization} {concat abc; ; ;} abc
  1553. X
  1554. X# Syntax errors.
  1555. X
  1556. Xtest parse-10.1 {syntax errors} {catch "set a \{bcd" msg} 1
  1557. Xtest parse-10.2 {syntax errors} {
  1558. X    catch "set a \{bcd" msg
  1559. X    set msg
  1560. X} {missing close-brace}
  1561. Xtest parse-10.3 {syntax errors} {catch {set a "bcd} msg} 1
  1562. Xtest parse-10.4 {syntax errors} {
  1563. X    catch {set a "bcd} msg
  1564. X    set msg
  1565. X} {missing "}
  1566. Xtest parse-10.5 {syntax errors} {catch {set a "bcd"xy} msg} 1
  1567. Xtest parse-10.6 {syntax errors} {
  1568. X    catch {set a "bcd"xy} msg
  1569. X    set msg
  1570. X} {extra characters after close-quote}
  1571. Xtest parse-10.7 {syntax errors} {catch "set a {bcd}xy" msg} 1
  1572. Xtest parse-10.8 {syntax errors} {
  1573. X    catch "set a {bcd}xy" msg
  1574. X    set msg
  1575. X} {extra characters after close-brace}
  1576. Xtest parse-10.9 {syntax errors} {catch {set a [format abc} msg} 1
  1577. Xtest parse-10.10 {syntax errors} {
  1578. X    catch {set a [format abc} msg
  1579. X    set msg
  1580. X} {missing close-bracket}
  1581. Xtest parse-10.11 {syntax errors} {catch gorp-a-lot msg} 1
  1582. Xtest parse-10.12 {syntax errors} {
  1583. X    catch gorp-a-lot msg
  1584. X    set msg
  1585. X} {invalid command name: "gorp-a-lot"}
  1586. Xtest parse-10.13 {syntax errors} {
  1587. X    set a [concat {a}\
  1588. X {b}]
  1589. X    set a
  1590. X} {a b}
  1591. Xtest parse-10.14 {syntax errors} {catch "concat \{a\}\\\n{b}" msg} 1
  1592. Xtest parse-10.15 {syntax errors} {
  1593. X    catch "concat \{a\}\\\n{b}" msg
  1594. X    set msg
  1595. X} {extra characters after close-brace}
  1596. X
  1597. X# Long values (stressing storage management)
  1598. X
  1599. Xset a {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee \
  1600. Xffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt \
  1601. Xuuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH}
  1602. X
  1603. Xtest parse-11.1 {long values} {
  1604. X    string length $a
  1605. X} 214
  1606. Xtest parse-11.2 {long values} {
  1607. X    llength $a
  1608. X} 43
  1609. Xtest parse-1a1.3 {long values} {
  1610. X    set b "1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd \
  1611. Xeeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss \
  1612. Xtttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH"
  1613. X    set b
  1614. X} $a
  1615. Xtest parse-11.4 {long values} {
  1616. X    set b "$a"
  1617. X    set b
  1618. X} $a
  1619. Xtest parse-11.5 {long values} {
  1620. X    set b [set a]
  1621. X    set b
  1622. X} $a
  1623. Xtest parse-11.6 {long values} {
  1624. X    set b [concat 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb \
  1625. Xcccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq \
  1626. Xrrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF \
  1627. XGGGG HHHH]
  1628. X    string length $b
  1629. X} 214
  1630. Xtest parse-11.7 {long values} {
  1631. X    set b [concat 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb \
  1632. Xcccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq \
  1633. Xrrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF \
  1634. XGGGG HHHH]
  1635. X    llength $b
  1636. X} 43
  1637. Xtest parse-11.8 {long values} {
  1638. X    set b
  1639. X} $a
  1640. Xtest parse-11.9 {long values} {
  1641. X    set a [concat 0000 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa \
  1642. Xbbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp \
  1643. Xqqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE \
  1644. XFFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT \
  1645. XUUUU VVVV WWWW XXXX YYYY ZZZZ]
  1646. X    llength $a
  1647. X} 62
  1648. Xset i 0
  1649. Xforeach j [concat 0000 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa \
  1650. Xbbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp \
  1651. Xqqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE \
  1652. XFFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT \
  1653. XUUUU VVVV WWWW XXXX YYYY ZZZZ] {
  1654. X    set test [string index 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ $i]
  1655. X    set test $test$test$test$test
  1656. X    set i [expr $i+1]
  1657. X    test parse-11.10 {long values} {
  1658. X    set j
  1659. X    } $test
  1660. X}
  1661. Xtest parse-11.10 {test buffer overflow in backslashes in braces} {
  1662. X    expr {"a" == {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\
  1663. Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\
  1664. Xxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\
  1665. Xyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\
  1666. X\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\
  1667. X\101\101\101\101\101\101\101}}
  1668. X} 0
  1669. END_OF_FILE
  1670. if test 11404 -ne `wc -c <'tcl6.1/tests/parse.test'`; then
  1671.     echo shar: \"'tcl6.1/tests/parse.test'\" unpacked with wrong size!
  1672. fi
  1673. # end of 'tcl6.1/tests/parse.test'
  1674. fi
  1675. echo shar: End of archive 10 \(of 33\).
  1676. cp /dev/null ark10isdone
  1677. MISSING=""
  1678. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
  1679.     if test ! -f ark${I}isdone ; then
  1680.     MISSING="${MISSING} ${I}"
  1681.     fi
  1682. done
  1683. if test "${MISSING}" = "" ; then
  1684.     echo You have unpacked all 33 archives.
  1685.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1686. else
  1687.     echo You still need to unpack the following archives:
  1688.     echo "        " ${MISSING}
  1689. fi
  1690. ##  End of shell archive.
  1691. exit 0
  1692.  
  1693. exit 0 # Just in case...
  1694. -- 
  1695. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1696. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1697. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1698. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1699.