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

  1. Newsgroups: comp.sources.misc
  2. From: karl@sugar.neosoft.com (Karl Lehenbauer)
  3. Subject:  v25i075:  tcl - tool command language, version 6.1, Part07/33
  4. Message-ID: <1991Nov14.202800.23600@sparky.imd.sterling.com>
  5. X-Md4-Signature: fb132e699f2f3f100cb217690dc6be9a
  6. Date: Thu, 14 Nov 1991 20:28:00 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
  10. Posting-number: Volume 25, Issue 75
  11. Archive-name: tcl/part07
  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 7 (of 33)."
  21. # Contents:  tcl6.1/config tcl6.1/doc/Interp.man tcl6.1/tests/file.test
  22. #   tcl6.1/tests/proc.test tcl6.1/tests/regexp.test
  23. # Wrapped by karl@one on Tue Nov 12 19:44:16 1991
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'tcl6.1/config' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'tcl6.1/config'\"
  27. else
  28. echo shar: Extracting \"'tcl6.1/config'\" \(9141 characters\)
  29. sed "s/^X//" >'tcl6.1/config' <<'END_OF_FILE'
  30. X#!/bin/csh -f
  31. X#
  32. X# This script should be executed to configure the Tcl source directory
  33. X# for a particular system.  It probes the system for various header
  34. X# files and library object files.  Where things needed by Tcl are missing,
  35. X# substitute versions are included from the "compat" subdirectory.
  36. X#
  37. X# $Header: /user6/ouster/tcl/RCS/config,v 1.19 91/11/07 10:33:05 ouster Exp $ SPRITE (Berkeley)
  38. X#
  39. X# Copyright 1991 Regents of the University of California
  40. X# Permission to use, copy, modify, and distribute this
  41. X# software and its documentation for any purpose and without
  42. X# fee is hereby granted, provided that this copyright
  43. X# notice appears in all copies.  The University of California
  44. X# makes no representations about the suitability of this
  45. X# software for any purpose.  It is provided "as is" without
  46. X# express or implied warranty.
  47. X
  48. X#--------------------------------------------------------------
  49. X# The variable definitions below configure this script:  they
  50. X# tell where system-defined things are kept (so this program
  51. X# can tell whether the system contains certain features needed
  52. X# by Tcl), and they indicate which Tcl files to modify to
  53. X# reflect the configuration.
  54. X
  55. X# Directory containing system include files:
  56. X
  57. Xset includeDir="/usr/include"
  58. X
  59. X# Archive file containing object code for standard C library:
  60. X
  61. Xset libc="/lib/Llibc.a"
  62. X
  63. X# Makefile to modify:
  64. X
  65. Xset makefile="Makefile"
  66. X
  67. X# Header file to modify to hold #defines about system configuration:
  68. X
  69. Xset config="tclUnix.h"
  70. X#--------------------------------------------------------------
  71. X
  72. Xset changes=0
  73. Xunset time
  74. X
  75. X# First make sure that the configuration variables have been
  76. X# set in a reasonable fashion.
  77. X
  78. Xif ( ! -r $includeDir/stdio.h ) then
  79. X    echo "- ERROR\!\! $includeDir doesn't seem to contain standard system"
  80. X    echo "  include files.  Please edit config to set the includeDir"
  81. X    echo "  variable."
  82. X    exit(1)
  83. Xendif
  84. Xif ( ! -r $libc ) then
  85. X    echo "- ERROR\!\! C library $libc doesn\'t exist.  Please edit config"
  86. X    echo "  to set the libc variable."
  87. X    exit(1)
  88. Xendif
  89. Xnm -p $libc > tmp.libc
  90. Xif ( $status != 0 ) then
  91. X    echo "- ERROR\!\!  Nm failed to extract names of system-supplied library"
  92. X    echo "  procedures from $libc.  You'll have to modify config by hand to"
  93. X    echo "  fix the problem (whatever it is)."
  94. X    exit(1)
  95. Xendif
  96. X
  97. X# Since nm produces different output on different machines, the code
  98. X# below attempts to guess what pattern to grep for in the nm output.
  99. X
  100. Xset pattern="[ADIT]"
  101. Xset x=`grep printf tmp.libc | grep -c CODE`
  102. Xif ( $x ) then
  103. X    set pattern=CODE
  104. Xendif
  105. X
  106. X# Check in the C library for particular library procedures and
  107. X# variables needed by Tcl.
  108. X
  109. Xset gettod=`grep gettimeofday tmp.libc | grep -c "$pattern"`
  110. Xif ( $gettod > 1 ) set gettod=1
  111. Xset getwd=`grep getwd tmp.libc | grep -c "$pattern"`
  112. Xif ( $getwd > 1 ) set getwd=1
  113. Xset opendir=`grep opendir tmp.libc | grep -c "$pattern"`
  114. Xif ( $opendir > 1 ) set opendir=1
  115. Xset strerror=`grep strerror tmp.libc | grep -c "$pattern"`
  116. Xif ( $strerror > 1 ) set strerror=1
  117. Xset strstr=`grep strstr tmp.libc | grep -c "$pattern"`
  118. Xif ( $strstr > 1 ) set strstr=1
  119. Xset strtol=`grep strtol tmp.libc | grep -c "$pattern"`
  120. Xif ( $strtol > 1 ) set strtol=1
  121. Xset strtoul=`grep strtoul tmp.libc | grep -c "$pattern"`
  122. Xif ( $strtoul > 1 ) set strtoul=1
  123. Xset sys_errlist=`grep sys_errlist tmp.libc | grep -c "$pattern"`
  124. Xif ( $sys_errlist > 1 ) set sys_errlist=1
  125. X\rm tmp.libc
  126. X
  127. X# Check in <sys/types.h> for definitions for pid_t and uid_t,
  128. X# which are needed by Tcl.
  129. X
  130. Xset pid_t=0
  131. Xset chk1=`grep -c pid_t $includeDir/sys/types.h`
  132. Xset chk2=`grep -c uid_t $includeDir/sys/types.h`
  133. Xif ( ( $chk1 > 0 ) && ( $chk2 > 0 ) ) then
  134. X    set pid_t=1
  135. Xendif
  136. X
  137. X# Next, install header files that aren't present in /usr/include.
  138. X
  139. Xset extraHdrs=""
  140. Xforeach i (dirent.h limits.h)
  141. X    \rm -f $i
  142. X    if ( ! -r $includeDir/$i ) then
  143. X    cp compat/$i .
  144. X    set extraHdrs="$extraHdrs $i"
  145. X    endif
  146. Xend
  147. Xset stdlibOK=0
  148. X\rm -f stdlib.h
  149. Xif ( -r $includeDir/stdlib.h ) then
  150. X    # The check below is needed because SunOS has a stdlib that
  151. X    # doesn't declare strtod and other procedures, so we have to
  152. X    # use ours instead.
  153. X
  154. X    set chk1=`grep -c strtol $includeDir/stdlib.h`
  155. X    set chk2=`grep -c strtoul $includeDir/stdlib.h`
  156. X    set chk3=`grep -c strtod $includeDir/stdlib.h`
  157. X    if ( $chk1 > 0 && $chk2 > 0 && $chk3 > 0 ) then
  158. X    set stdlibOK=1
  159. X    endif
  160. Xendif
  161. Xif ( ! $stdlibOK ) then
  162. X    cp compat/stdlib.h .
  163. X    set extraHdrs="$extraHdrs stdlib.h"
  164. Xendif
  165. X
  166. X# Even if string.h exists it's not complete on all systems.  If
  167. X# some of the procedures we need are missing from the library, then
  168. X# also install a Tcl-specific string.h.
  169. X
  170. X\rm -f string.h
  171. Xif ( ! $strstr || ! $strtoul || ! -r $includeDir/string.h ) then
  172. X    cp compat/string.h .
  173. X    set extraHdrs="$extraHdrs string.h"
  174. Xendif
  175. Xif ( "$extraHdrs" != "" ) then
  176. X    echo "- Substitutes will be used for the following header files,"
  177. X    echo "  which aren't in ${includeDir} or aren't complete:"
  178. X    echo "     $extraHdrs"
  179. X    set changes=1
  180. Xendif
  181. X
  182. X# Next, install C procedures for missing library functions.
  183. X
  184. Xset extraLibs=""
  185. X\rm -f strerror.c
  186. Xif ( ! $strerror ) then
  187. X    set extraLibs="$extraLibs strerror"
  188. X    cp compat/strerror.c .
  189. Xendif
  190. X\rm -f opendir.c
  191. Xif ( ! $opendir ) then
  192. X    set extraLibs="$extraLibs opendir"
  193. X    cp compat/opendir.c .
  194. X    \rm -f dirent.h
  195. X    cp compat/dirent2.h dirent.h
  196. X    echo "- No opendir/readdir/closedir library exists in this system,"
  197. X    echo "  so substitutes will be provided.  This system better have"
  198. X    echo "  V7-style directories\!"
  199. Xendif
  200. X\rm -f strstr.c
  201. Xif ( ! $strstr ) then
  202. X    set extraLibs="$extraLibs strstr"
  203. X    cp compat/strstr.c .
  204. Xendif
  205. X\rm -f strtol.c
  206. Xif ( ! $strtol ) then
  207. X    set extraLibs="$extraLibs strtol"
  208. X    cp compat/strtol.c .
  209. Xendif
  210. X\rm -f strtoul.c
  211. Xif ( ! $strtoul ) then
  212. X    set extraLibs="$extraLibs strtoul"
  213. X    cp compat/strtoul.c .
  214. Xendif
  215. Xif ( "$extraLibs" != "" ) then
  216. X    echo "- Substitutes will be used for the following library procedures,"
  217. X    echo "  which aren't in ${libc}:"
  218. X    echo "     $extraLibs"
  219. X    set changes=1
  220. Xendif
  221. X
  222. X# The following statements determine whether ranlib should be used
  223. X# in the Makefile.  On System-V systems it shouldn't.  The only way
  224. X# to figure this out is to run ranlib and see if it complains (ranlib
  225. X# actually exists on some Sys-V systems, but it returns an error if
  226. X# you run it).
  227. X
  228. Xset ranlibOK=0
  229. Xcat > ranlibtest.c << EOF
  230. X#include <stdio.h>
  231. Xmain (argc, argv)
  232. X    int    argc;
  233. X    char **argv;
  234. X{
  235. X    printf ("Hello, world.\n");
  236. X}
  237. XEOF
  238. Xcc -c ranlibtest.c
  239. Xar cru ranlibtest.a ranlibtest.o
  240. Xranlib ranlibtest.a >& /dev/null
  241. Xif ( $status == 0 ) then
  242. X    set ranlibOK=1
  243. Xelse
  244. X    echo "- This system appears to be a System V one where ranlib isn't"
  245. X    echo "  used.  The ranlib commands will be removed from Makefile."
  246. X    set changes=1
  247. Xendif
  248. X\rm -f ranlibtest.*
  249. X
  250. X# Modify the Makefile to include supplemental library sources, if needed.
  251. X
  252. Xset compatObjs=""
  253. Xforeach i ($extraLibs)
  254. X    set compatObjs="$compatObjs $i.o"
  255. Xend
  256. Xif ( ! -e $makefile.bak ) mv $makefile $makefile.bak
  257. Xif ( $ranlibOK ) then
  258. X    sed -e "s/COMPAT_OBJS =/COMPAT_OBJS =$compatObjs/" $makefile.bak > $makefile
  259. Xelse
  260. X    sed -e "s/COMPAT_OBJS =/COMPAT_OBJS =$compatObjs/" \
  261. X    -e "/ranlib/d" $makefile.bak > $makefile
  262. Xendif
  263. X
  264. X# Set the #defines in tclConfig.h to provide various pieces of system
  265. X# configuration information at compile time (existence of header files,
  266. X# variables, type definitions, etc.)
  267. X
  268. Xif ( ! $gettod ) then
  269. X    echo "- There's no gettimeofday in ${libc} so Tcl will use"
  270. X    echo '  times for the "time" command.'
  271. X    set changes=1
  272. Xendif
  273. Xif ( ! $getwd ) then
  274. X    echo "- There's no getwd in ${libc} so Tcl will use"
  275. X    echo '  getcwd for the "pwd" command.'
  276. X    set changes=1
  277. Xendif
  278. Xset errlist=1
  279. Xif ( ! $sys_errlist && ! $strerror ) then
  280. X    echo "- Neither strerror nor sys_errlist is defined in ${libc} so"
  281. X    echo "  Tcl will make a guess about errno-related messages."
  282. X    set errlist=0
  283. X    set changes=1
  284. Xendif
  285. Xset sysTime=0
  286. Xif ( -r $includeDir/sys/time.h ) then
  287. X    set sysTime=1
  288. Xendif
  289. Xset sysWait=0
  290. Xset unionWait=0
  291. Xif ( -r $includeDir/sys/wait.h ) then
  292. X    set sysWait=1
  293. X    cp compat/testwait.c test.c
  294. X    make test >& /dev/null
  295. X    if ( $status == 0 ) then
  296. X    set unionWait=1
  297. X    endif
  298. X    \rm -f a.out test.c
  299. Xendif
  300. Xset pid_t=1
  301. Xcp compat/testpid.c test.c
  302. Xmake test >& /dev/null
  303. Xset chk1=$status
  304. Xif ( $chk1 != 0 ) then
  305. X    set pid_t=0
  306. X    echo "- The types pid_t and uid_t aren't defined in <sys/types.h>"
  307. X    echo '  so Tcl will use "int" instead.'
  308. Xendif
  309. X\rm -f a.out test.c
  310. Xif ( ! -e $config.bak ) mv $config $config.bak
  311. Xset x=\.\*\$
  312. Xsed -e "s/define TCL_GETTOD 1/define TCL_GETTOD $gettod/" \
  313. X    -e "s/define TCL_GETWD 1/define TCL_GETWD $getwd/" \
  314. X    -e "s/define TCL_SYS_ERRLIST 1/define TCL_SYS_ERRLIST $errlist/" \
  315. X    -e "s/define TCL_SYS_TIME_H 1/define TCL_SYS_TIME_H $sysTime/" \
  316. X    -e "s/define TCL_SYS_WAIT_H 1/define TCL_SYS_WAIT_H $sysWait/" \
  317. X    -e "s/define TCL_UNION_WAIT 1/define TCL_UNION_WAIT $unionWait/" \
  318. X    -e "s/define TCL_PID_T 1/define TCL_PID_T $pid_t/" \
  319. X$config.bak > $config
  320. X
  321. Xif ( ! $changes ) then
  322. X    echo "- No special modifications were needed for this system."
  323. Xendif
  324. END_OF_FILE
  325. if test 9141 -ne `wc -c <'tcl6.1/config'`; then
  326.     echo shar: \"'tcl6.1/config'\" unpacked with wrong size!
  327. fi
  328. chmod +x 'tcl6.1/config'
  329. # end of 'tcl6.1/config'
  330. fi
  331. if test -f 'tcl6.1/doc/Interp.man' -a "${1}" != "-c" ; then 
  332.   echo shar: Will not clobber existing file \"'tcl6.1/doc/Interp.man'\"
  333. else
  334. echo shar: Extracting \"'tcl6.1/doc/Interp.man'\" \(9204 characters\)
  335. sed "s/^X//" >'tcl6.1/doc/Interp.man' <<'END_OF_FILE'
  336. X'\" Copyright 1989 Regents of the University of California
  337. X'\" Permission to use, copy, modify, and distribute this
  338. X'\" documentation for any purpose and without fee is hereby
  339. X'\" granted, provided that this notice appears in all copies.
  340. X'\" The University of California makes no representations about
  341. X'\" the suitability of this material for any purpose.  It is
  342. X'\" provided "as is" without express or implied warranty.
  343. X'\" 
  344. X'\" $Header: /user6/ouster/tcl/doc/RCS/Interp.man,v 1.6 91/09/04 16:37:59 ouster Exp $ SPRITE (Berkeley)
  345. X'\" 
  346. X.\" The definitions below are for supplemental macros used in Sprite
  347. X.\" manual entries.
  348. X.\"
  349. X.\" .HS name section [date [version]]
  350. X.\"    Replacement for .TH in other man pages.  See below for valid
  351. X.\"    section names.
  352. X.\"
  353. X.\" .AP type name in/out [indent]
  354. X.\"    Start paragraph describing an argument to a library procedure.
  355. X.\"    type is type of argument (int, etc.), in/out is either "in", "out",
  356. X.\"    or "in/out" to describe whether procedure reads or modifies arg,
  357. X.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  358. X.\"    needed;  use .AS below instead)
  359. X.\"
  360. X.\" .AS [type [name]]
  361. X.\"    Give maximum sizes of arguments for setting tab stops.  Type and
  362. X.\"    name are examples of largest possible arguments that will be passed
  363. X.\"    to .AP later.  If args are omitted, default tab stops are used.
  364. X.\"
  365. X.\" .BS
  366. X.\"    Start box enclosure.  From here until next .BE, everything will be
  367. X.\"    enclosed in one large box.
  368. X.\"
  369. X.\" .BE
  370. X.\"    End of box enclosure.
  371. X.\"
  372. X.\" .VS
  373. X.\"    Begin vertical sidebar, for use in marking newly-changed parts
  374. X.\"    of man pages.
  375. X.\"
  376. X.\" .VE
  377. X.\"    End of vertical sidebar.
  378. X.\"
  379. X.\" .DS
  380. X.\"    Begin an indented unfilled display.
  381. X.\"
  382. X.\" .DE
  383. X.\"    End of indented unfilled display.
  384. X.\"
  385. X'    # Heading for Sprite man pages
  386. X.de HS
  387. X.if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  388. X.if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  389. X.if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  390. X.if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  391. X.if t .wh -1.3i ^B
  392. X.nr ^l \\n(.l
  393. X.ad b
  394. X..
  395. X'    # Start an argument description
  396. X.de AP
  397. X.ie !"\\$4"" .TP \\$4
  398. X.el \{\
  399. X.   ie !"\\$2"" .TP \\n()Cu
  400. X.   el          .TP 15
  401. X.\}
  402. X.ie !"\\$3"" \{\
  403. X.ta \\n()Au \\n()Bu
  404. X\&\\$1    \\fI\\$2\\fP    (\\$3)
  405. X.\".b
  406. X.\}
  407. X.el \{\
  408. X.br
  409. X.ie !"\\$2"" \{\
  410. X\&\\$1    \\fI\\$2\\fP
  411. X.\}
  412. X.el \{\
  413. X\&\\fI\\$1\\fP
  414. X.\}
  415. X.\}
  416. X..
  417. X'    # define tabbing values for .AP
  418. X.de AS
  419. X.nr )A 10n
  420. X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
  421. X.nr )B \\n()Au+15n
  422. X.\"
  423. X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  424. X.nr )C \\n()Bu+\\w'(in/out)'u+2n
  425. X..
  426. X'    # BS - start boxed text
  427. X'    # ^y = starting y location
  428. X'    # ^b = 1
  429. X.de BS
  430. X.br
  431. X.mk ^y
  432. X.nr ^b 1u
  433. X.if n .nf
  434. X.if n .ti 0
  435. X.if n \l'\\n(.lu\(ul'
  436. X.if n .fi
  437. X..
  438. X'    # BE - end boxed text (draw box now)
  439. X.de BE
  440. X.nf
  441. X.ti 0
  442. X.mk ^t
  443. X.ie n \l'\\n(^lu\(ul'
  444. X.el \{\
  445. X.\"    Draw four-sided box normally, but don't draw top of
  446. X.\"    box if the box started on an earlier page.
  447. X.ie !\\n(^b-1 \{\
  448. X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  449. X.\}
  450. X.el \}\
  451. X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  452. X.\}
  453. X.\}
  454. X.fi
  455. X.br
  456. X.nr ^b 0
  457. X..
  458. X'    # VS - start vertical sidebar
  459. X'    # ^Y = starting y location
  460. X'    # ^v = 1 (for troff;  for nroff this doesn't matter)
  461. X.de VS
  462. X.mk ^Y
  463. X.ie n 'mc \s12\(br\s0
  464. X.el .nr ^v 1u
  465. X..
  466. X'    # VE - end of vertical sidebar
  467. X.de VE
  468. X.ie n 'mc
  469. X.el \{\
  470. X.ev 2
  471. X.nf
  472. X.ti 0
  473. X.mk ^t
  474. X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  475. X.sp -1
  476. X.fi
  477. X.ev
  478. X.\}
  479. X.nr ^v 0
  480. X..
  481. X'    # Special macro to handle page bottom:  finish off current
  482. X'    # box/sidebar if in box/sidebar mode, then invoked standard
  483. X'    # page bottom macro.
  484. X.de ^B
  485. X.ev 2
  486. X'ti 0
  487. X'nf
  488. X.mk ^t
  489. X.if \\n(^b \{\
  490. X.\"    Draw three-sided box if this is the box's first page,
  491. X.\"    draw two sides but no top otherwise.
  492. 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
  493. X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  494. X.\}
  495. X.if \\n(^v \{\
  496. X.nr ^x \\n(^tu+1v-\\n(^Yu
  497. X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  498. X.\}
  499. X.bp
  500. X'fi
  501. X.ev
  502. X.if \\n(^b \{\
  503. X.mk ^y
  504. X.nr ^b 2
  505. X.\}
  506. X.if \\n(^v \{\
  507. X.mk ^Y
  508. X.\}
  509. X..
  510. X'    # DS - begin display
  511. X.de DS
  512. X.RS
  513. X.nf
  514. X.sp
  515. X..
  516. X'    # DE - end display
  517. X.de DE
  518. X.fi
  519. X.RE
  520. X.sp .5
  521. X..
  522. X.HS Tcl_Interp tcl
  523. X.BS
  524. X.SH NAME
  525. XTcl_Interp \- client-visible fields of interpreter structures
  526. X.SH SYNOPSIS
  527. X.nf
  528. X\fB#include <tcl.h>\fR
  529. X.sp
  530. Xtypedef struct {
  531. X    char *\fIresult\fR;
  532. X.VS
  533. X    Tcl_FreeProc *\fIfreeProc\fR;
  534. X.VE
  535. X    int \fIerrorLine\fR;
  536. X} Tcl_Interp;
  537. X
  538. X.VS
  539. Xtypedef void Tcl_FreeProc(char *\fIblockPtr\fR);
  540. X.VE
  541. X.BE
  542. X
  543. X.SH DESCRIPTION
  544. X.PP
  545. XThe \fBTcl_CreateInterp\fR procedure returns a pointer to a Tcl_Interp
  546. Xstructure.  This pointer is then passed into other Tcl procedures
  547. Xto process commands in the interpreter and perform other operations
  548. Xon the interpreter.  Interpreter structures contain many many fields
  549. Xthat are used by Tcl, but only three that may be accessed by
  550. X.VS
  551. Xclients:  \fIresult\fR, \fIfreeProc\fR, and \fIerrorLine\fR.
  552. X.PP
  553. XThe \fIresult\fR and \fIfreeProc\fR fields are used to return
  554. Xresults or error messages from commands.
  555. XThis information is returned by command procedures back to \fBTcl_Eval\fR,
  556. Xand by \fBTcl_Eval\fR back to its callers.
  557. XThe \fIresult\fR field points to the string that represents the
  558. Xresult or error message, and the \fIfreeProc\fR field tells how
  559. Xto dispose of the storage for the string when it isn't needed anymore.
  560. XThe easiest way for command procedures to manipulate these
  561. Xfields is to call procedures like \fBTcl_SetResult\fR
  562. Xor \fBTcl_AppendResult\fR;  they
  563. Xwill hide all the details of managing the fields.
  564. XThe description below is for those procedures that manipulate the
  565. Xfields directly.
  566. X.PP
  567. XWhenever a command procedure returns, it must ensure
  568. Xthat the \fIresult\fR field of its interpreter points to the string
  569. Xbeing returned by the command.
  570. XThe \fIresult\fR field must always point to a valid string.
  571. XIf a command wishes to return no result then \fIinterp->result\fR
  572. Xshould point to an empty string.
  573. XNormally, results are assumed to be statically allocated,
  574. Xwhich means that the contents will not change before the next time
  575. X\fBTcl_Eval\fR is called or some other command procedure is invoked.
  576. XIn this case, the \fIfreeProc\fR field must be zero.
  577. XAlternatively, a command procedure may dynamically
  578. Xallocate its return value (e.g. using \fBmalloc\fR)
  579. Xand store a pointer to it in \fIinterp->result\fR.
  580. XIn this case, the command procedure must also set \fIinterp->freeProc\fR
  581. Xto the address of a procedure that can free the value (usually \fBfree\fR).
  582. XIf \fIinterp->freeProc\fR is non-zero, then Tcl will call \fIfreeProc\fR
  583. Xto free the space pointed to by \fIinterp->result\fR before it
  584. Xinvokes the next command.
  585. XIf a client procedure overwrites \fIinterp->result\fR when
  586. X\fIinterp->freeProc\fR is non-zero, then it is responsible for calling
  587. X\fIfreeProc\fR to free the old \fIinterp->result\fR (the \fBTcl_FreeResult\fR
  588. Xmacro should be used for this purpose).
  589. X.PP
  590. X\fIFreeProc\fR should have arguments and result that match the
  591. X\fBTcl_FreeProc\fR declaration above:  it receives a single
  592. Xargument which is a pointer to the result value to free.
  593. XIn most applications \fBfree\fR is the only non-zero value ever
  594. Xused for \fIfreeProc\fR.
  595. XHowever, an application may store a different procedure address
  596. Xin \fIfreeProc\fR in order to use an alternate memory allocator
  597. Xor in order to do other cleanup when the result memory is freed.
  598. X.PP
  599. XAs part of processing each command, \fBTcl_Eval\fR initializes
  600. X\fIinterp->result\fR
  601. Xand \fIinterp->freeProc\fR just before calling the command procedure for
  602. Xthe command.  The \fIfreeProc\fR field will be initialized to zero,
  603. Xand \fIinterp->result\fR will point to an empty string.  Commands that
  604. Xdo not return any value can simply leave the fields alone.
  605. X.VE
  606. XFurthermore, the empty string pointed to by \fIresult\fR is actually
  607. Xpart of an array of \fBTCL_RESULT_SIZE\fR characters (approximately 200).
  608. XIf a command wishes to return a short string, it can simply copy
  609. Xit to the area pointed to by \fIinterp->result\fR.  Or, it can use
  610. Xthe sprintf procedure to generate a short result string at the location
  611. Xpointed to by \fIinterp->result\fR.
  612. X.PP
  613. XIt is a general convention in Tcl-based applications that the result
  614. Xof an interpreter is normally in the initialized state described
  615. Xin the previous paragraph.
  616. XProcedures that manipulate an interpreter's result (e.g. by
  617. Xreturning an error) will generally assume that the result
  618. Xhas been initialized when the procedure is called.
  619. XIf such a procedure is to be called after the result has been
  620. Xchanged, then \fBTcl_ResetResult\fR should be called first to
  621. Xreset the result to its initialized state.
  622. X.PP
  623. XThe \fIerrorLine\fR
  624. Xfield is valid only after \fBTcl_Eval\fR returns
  625. Xa \fBTCL_ERROR\fR return code.  In this situation the \fIerrorLine\fR
  626. Xfield identifies the line number of the command being executed when
  627. Xthe error occurred.  The line numbers are relative to the command
  628. Xbeing executed:  1 means the first line of the command passed to
  629. X\fBTcl_Eval\fR, 2 means the second line, and so on.
  630. XThe \fIerrorLine\fR field is typically used in conjunction with
  631. X\fBTcl_AddErrorInfo\fR to report information about where an error
  632. Xoccurred.
  633. X\fIErrorLine\fR should not normally be modified except by \fBTcl_Eval\fR.
  634. X
  635. X.SH KEYWORDS
  636. Xfree, initialized, interpreter, malloc, result
  637. END_OF_FILE
  638. if test 9204 -ne `wc -c <'tcl6.1/doc/Interp.man'`; then
  639.     echo shar: \"'tcl6.1/doc/Interp.man'\" unpacked with wrong size!
  640. fi
  641. # end of 'tcl6.1/doc/Interp.man'
  642. fi
  643. if test -f 'tcl6.1/tests/file.test' -a "${1}" != "-c" ; then 
  644.   echo shar: Will not clobber existing file \"'tcl6.1/tests/file.test'\"
  645. else
  646. echo shar: Extracting \"'tcl6.1/tests/file.test'\" \(9253 characters\)
  647. sed "s/^X//" >'tcl6.1/tests/file.test' <<'END_OF_FILE'
  648. X# Commands covered:  file
  649. X#
  650. X# This file contains a collection of tests for one or more of the Tcl
  651. X# built-in commands.  Sourcing this file into Tcl runs the tests and
  652. X# generates output for errors.  No output means no errors were found.
  653. X#
  654. X# Copyright 1991 Regents of the University of California
  655. X# Permission to use, copy, modify, and distribute this
  656. X# software and its documentation for any purpose and without
  657. X# fee is hereby granted, provided that this copyright notice
  658. X# appears in all copies.  The University of California makes no
  659. X# representations about the suitability of this software for any
  660. X# purpose.  It is provided "as is" without express or implied
  661. X# warranty.
  662. X#
  663. X# $Header: /user6/ouster/tcl/tests/RCS/file.test,v 1.13 91/10/17 16:22:34 ouster Exp $ (Berkeley)
  664. X
  665. Xif {[string compare test [info procs test]] == 1} then {source defs}
  666. X
  667. X# rootname and ext
  668. X
  669. Xtest file-1.1 {rootname and extension options} {file ext abc.def} .def
  670. Xtest file-1.2 {rootname and extension options} {file ro abc.def} abc
  671. Xtest file-1.3 {rootname and extension options} {file extension a/b/c.d} .d
  672. Xtest file-1.4 {rootname and extension options} {file rootname a/b/c.d} a/b/c
  673. Xtest file-1.5 {rootname and extension options} {file extension a/b.c/d} {}
  674. Xtest file-1.6 {rootname and extension options} {file rootname a/b.c/d} a/b.c/d
  675. Xset num 7
  676. Xforeach outer { {} a .a a. a.a } {
  677. X  foreach inner { {} a .a a. a.a } {
  678. X    set thing [format %s/%s $outer $inner]
  679. X    test file-1.$num {rootname and extension options} {
  680. X    format %s%s [file rootname $thing] [file ext $thing]
  681. X    } $thing
  682. X    set num [expr $num+1]
  683. X  }
  684. X}
  685. X
  686. X# dirname and tail
  687. X
  688. Xtest file-2.1 {dirname and tail options} {file dirname .def} .
  689. Xtest file-2.2 {dirname and tail options} {file tail abc.def} abc.def
  690. Xtest file-2.3 {dirname and tail options} {file d a/b/c.d} a/b
  691. Xtest file-2.4 {dirname and tail options} {file t a/b/c.d} c.d
  692. Xtest file-2.5 {dirname and tail options} {file dirname a/b.c/d} a/b.c
  693. Xtest file-2.6 {dirname and tail options} {file tail a/b.c/d} d
  694. Xset num 7
  695. Xforeach outer { a .a a. a.a } {
  696. X  foreach inner { {} a .a a. a.a } {
  697. X    set thing [format %s/%s $outer $inner]
  698. X    test file-2.$num {dirname and tail options} {
  699. X    format %s/%s [file dirname $thing] [file tail $thing]
  700. X    } $thing
  701. X    set num [expr $num+1]
  702. X  }
  703. X}
  704. X
  705. X# exists
  706. Xcatch {exec chmod 777 dir.file}
  707. Xcatch {exec rm -f dir.file/gorp.file}
  708. Xcatch {exec rm -f gorp.file}
  709. Xcatch {exec rmdir dir.file}
  710. Xtest file-3.1 {exists option} {file exists gorp.file} 0
  711. Xtest file-3.2 {exists option} {file exists dir.file/gorp.file} 0
  712. Xexec cat > gorp.file << abcde
  713. Xexec mkdir dir.file
  714. Xexec cat > dir.file/gorp.file << 12345
  715. Xtest file-3.3 {exists option} {file exists gorp.file} 1
  716. Xtest file-3.4 {exists option} {file exi dir.file/gorp.file} 1
  717. X
  718. X# The test below has to be done in /tmp rather than the current
  719. X# directory in order to guarantee (?) a local file system:  some
  720. X# NFS file systems won't do the stuff below correctly.
  721. X
  722. Xcatch {exec rm /tmp/tcl.foo.dir/file}
  723. Xcatch {exec rmdir /tmp/tcl.foo.dir}
  724. Xexec mkdir /tmp/tcl.foo.dir
  725. Xexec cat > /tmp/tcl.foo.dir/file << 12345
  726. Xexec chmod 000 /tmp/tcl.foo.dir
  727. Xif {$user != "root"} {
  728. X    test file-3.5 {exists option} {file exists /tmp/tcl.foo.dir/file} 0
  729. X}
  730. Xexec chmod 775 /tmp/tcl.foo.dir
  731. Xexec rm /tmp/tcl.foo.dir/file
  732. Xexec rmdir /tmp/tcl.foo.dir
  733. X
  734. X# executable
  735. X
  736. Xexec chmod 000 dir.file
  737. Xif {$user != "root"} {
  738. X    test file-4.1 {executable option} {file executable gorp.file} 0
  739. X}
  740. Xexec chmod 775 gorp.file
  741. Xtest file-4.2 {executable option} {file exe gorp.file} 1
  742. X
  743. X# isdirectory
  744. X
  745. Xtest file-5.1 {isdirectory option} {file isdirectory gorp.file} 0
  746. Xtest file-5.2 {isdirectory option} {file isd dir.file} 1
  747. X
  748. X# isfile
  749. X
  750. Xtest file-6.1 {isfile option} {file isfile gorp.file} 1
  751. Xtest file-6.2 {isfile option} {file isfile dir.file} 0
  752. X
  753. X# isowned
  754. X
  755. Xtest file-7.1 {owned option} {file owned gorp.file} 1
  756. Xif {$user != "root"} {
  757. X    test file-7.2 {owned option} {file owned /} 0
  758. X}
  759. X
  760. X# readable
  761. X
  762. Xexec chmod 444 gorp.file
  763. Xtest file-8.1 {readable option} {file readable gorp.file} 1
  764. Xexec chmod 333 gorp.file
  765. Xif {$user != "root"} {
  766. X    test file-8.2 {readable option} {file re gorp.file} 0
  767. X}
  768. X
  769. X# writable
  770. X
  771. Xexec chmod 555 gorp.file
  772. Xif {$user != "root"} {
  773. X    test file-9.1 {writable option} {file writable gorp.file} 0
  774. X}
  775. Xexec chmod 222 gorp.file
  776. Xtest file-9.2 {writable option} {file w gorp.file} 1
  777. X
  778. Xexec chmod 777 dir.file
  779. Xexec rm dir.file/gorp.file gorp.file
  780. Xexec rmdir dir.file
  781. X
  782. X# stat
  783. X
  784. Xexec cat > gorp.file << "Test string"
  785. Xexec chmod 765 gorp.file
  786. Xtest file-10.1 {stat option} {
  787. X    catch {unset stat}
  788. X    file stat gorp.file stat
  789. X    lsort [array names stat]
  790. X} {atime ctime dev gid ino mode mtime nlink size uid}
  791. Xtest file-10.2 {stat option} {
  792. X    catch {unset stat}
  793. X    file stat gorp.file stat
  794. X    list $stat(nlink) $stat(size) [expr $stat(mode)&0777]
  795. X} {1 11 501}
  796. Xtest file-10.3 {stat option} {
  797. X    string tolower [list [catch {file stat _non_existent_ stat} msg] \
  798. X        $msg $errorCode]
  799. X} {1 {couldn't stat "_non_existent_": no such file or directory} {unix enoent {no such file or directory}}}
  800. Xtest file-10.4 {stat option} {
  801. X    list [catch {file stat _non_existent_} msg] $msg $errorCode
  802. X} {1 {wrong # args: should be "file stat name varName"} NONE}
  803. Xtest file-10.5 {stat option} {
  804. X    list [catch {file stat _non_existent_ a b} msg] $msg $errorCode
  805. X} {1 {wrong # args: should be "file stat name varName"} NONE}
  806. Xtest file-10.6 {stat option} {
  807. X    catch {unset x}
  808. X    set x 44
  809. X    list [catch {file stat gorp.file x} msg] $msg $errorCode
  810. X} {1 {couldn't store stat information in variable "x"} NONE}
  811. Xcatch {unset stat}
  812. X
  813. X# mtime, and size (I've given up trying to find a test for "atime":  there
  814. X# seem to be too many quirks in the way file systems handle this to come
  815. X# up with a reproducible test.
  816. X
  817. Xtest file-11.1 {mtime and atime and size options} {
  818. X    catch {unset stat}
  819. X    file stat gorp.file stat
  820. X    list [expr {[file mtime gorp.file] == $stat(mtime)}] \
  821. X        [expr {[file atime gorp.file] == $stat(atime)}] \
  822. X        [file size gorp.file]
  823. X} {1 1 11}
  824. Xtest file-11.2 {mtime option} {
  825. X    set old [file mtime gorp.file]
  826. X    exec sleep 2
  827. X    set f [open gorp.file w]
  828. X    puts $f "More text"
  829. X    close $f
  830. X    set new [file mtime gorp.file]
  831. X    expr {($new > $old) && ($new <= ($old+5))}
  832. X} {1}
  833. Xtest file-11.3 {size option} {
  834. X    set oldsize [file size gorp.file]
  835. X    set f [open gorp.file a]
  836. X    puts $f "More text"
  837. X    close $f
  838. X    expr {[file size gorp.file] - $oldsize}
  839. X} {10}
  840. Xtest file-11.4 {errors in atime option} {
  841. X    list [catch {file atime _non_existent_ x} msg] $msg $errorCode
  842. X} {1 {wrong # args: should be "file atime name"} NONE}
  843. Xtest file-11.5 {errors in atime option} {
  844. X    string tolower [list [catch {file atime _non_existent_} msg] \
  845. X        $msg $errorCode]
  846. X} {1 {couldn't stat "_non_existent_": no such file or directory} {unix enoent {no such file or directory}}}
  847. Xtest file-11.6 {errors in mtime option} {
  848. X    list [catch {file mtime _non_existent_ x} msg] $msg $errorCode
  849. X} {1 {wrong # args: should be "file mtime name"} NONE}
  850. Xtest file-11.7 {errors in mtime option} {
  851. X    string tolower [list [catch {file mtime _non_existent_} msg] $msg \
  852. X        $errorCode]
  853. X} {1 {couldn't stat "_non_existent_": no such file or directory} {unix enoent {no such file or directory}}}
  854. Xtest file-11.8 {errors in size option} {
  855. X    list [catch {file size _non_existent_ x} msg] $msg $errorCode
  856. X} {1 {wrong # args: should be "file size name"} NONE}
  857. Xtest file-11.9 {errors in size option} {
  858. X    string tolower [list [catch {file size _non_existent_} msg] $msg \
  859. X        $errorCode]
  860. X} {1 {couldn't stat "_non_existent_": no such file or directory} {unix enoent {no such file or directory}}}
  861. X
  862. Xexec rm -f gorp.file
  863. X
  864. X# Error conditions
  865. X
  866. Xtest file-12.1 {error conditions} {
  867. X    list [catch file msg] $msg
  868. X} {1 {wrong # args: should be "file option name ?arg ...?"}}
  869. Xtest file-12.2 {error conditions} {
  870. X    list [catch {file x} msg] $msg
  871. X} {1 {wrong # args: should be "file option name ?arg ...?"}}
  872. Xtest file-12.3 {error conditions} {
  873. X    list [catch {file exists x too} msg] $msg
  874. X} {1 {wrong # args: should be "file exists name"}}
  875. Xtest file-12.4 {error conditions} {
  876. X    list [catch {file gorp x} msg] $msg
  877. X} {1 {bad option "gorp": should be atime, dirname, executable, exists, \
  878. Xextension, isdirectory, isfile, mtime, owned, readable, root, size, stat, \
  879. Xtail, or writable}}
  880. Xtest file-12.5 {error conditions} {
  881. X    list [catch {file ex x} msg] $msg
  882. X} {1 {bad option "ex": should be atime, dirname, executable, exists, \
  883. Xextension, isdirectory, isfile, mtime, owned, readable, root, size, stat, \
  884. Xtail, or writable}}
  885. Xtest file-12.6 {error conditions} {
  886. X    list [catch {file is x} msg] $msg
  887. X} {1 {bad option "is": should be atime, dirname, executable, exists, \
  888. Xextension, isdirectory, isfile, mtime, owned, readable, root, size, stat, \
  889. Xtail, or writable}}
  890. Xtest file-12.7 {error conditions} {
  891. X    list [catch {file r x} msg] $msg
  892. X} {1 {bad option "r": should be atime, dirname, executable, exists, \
  893. Xextension, isdirectory, isfile, mtime, owned, readable, root, size, stat, \
  894. Xtail, or writable}}
  895. Xtest file-12.8 {error conditions} {
  896. X    list [catch {file s x} msg] $msg
  897. X} {1 {bad option "s": should be atime, dirname, executable, exists, \
  898. Xextension, isdirectory, isfile, mtime, owned, readable, root, size, stat, \
  899. Xtail, or writable}}
  900. END_OF_FILE
  901. if test 9253 -ne `wc -c <'tcl6.1/tests/file.test'`; then
  902.     echo shar: \"'tcl6.1/tests/file.test'\" unpacked with wrong size!
  903. fi
  904. # end of 'tcl6.1/tests/file.test'
  905. fi
  906. if test -f 'tcl6.1/tests/proc.test' -a "${1}" != "-c" ; then 
  907.   echo shar: Will not clobber existing file \"'tcl6.1/tests/proc.test'\"
  908. else
  909. echo shar: Extracting \"'tcl6.1/tests/proc.test'\" \(9157 characters\)
  910. sed "s/^X//" >'tcl6.1/tests/proc.test' <<'END_OF_FILE'
  911. X# Commands covered:  proc, return, global
  912. X#
  913. X# This file contains a collection of tests for one or more of the Tcl
  914. X# built-in commands.  Sourcing this file into Tcl runs the tests and
  915. X# generates output for errors.  No output means no errors were found.
  916. X#
  917. X# Copyright 1991 Regents of the University of California
  918. X# Permission to use, copy, modify, and distribute this
  919. X# software and its documentation for any purpose and without
  920. X# fee is hereby granted, provided that this copyright notice
  921. X# appears in all copies.  The University of California makes no
  922. X# representations about the suitability of this software for any
  923. X# purpose.  It is provided "as is" without express or implied
  924. X# warranty.
  925. X#
  926. X# $Header: /user6/ouster/tcl/tests/RCS/proc.test,v 1.9 91/10/31 16:40:55 ouster Exp $ (Berkeley)
  927. X
  928. Xif {[string compare test [info procs test]] == 1} then {source defs}
  929. X
  930. Xproc tproc {} {return a; return b}
  931. Xtest proc-1.1 {simple procedure call and return} {tproc} a
  932. Xproc tproc x {
  933. X    set x [expr $x+1]
  934. X    return $x
  935. X}
  936. Xtest proc-1.2 {simple procedure call and return} {tproc 2} 3
  937. Xtest proc-1.3 {simple procedure call and return} {
  938. X    proc tproc {} {return foo}
  939. X} {}
  940. Xtest proc-1.4 {simple procedure call and return} {
  941. X    proc tproc {} {return}
  942. X    tproc
  943. X} {}
  944. X
  945. Xtest proc-2.1 {local and global variables} {
  946. X    proc tproc x {
  947. X    set x [expr $x+1]
  948. X    return $x
  949. X    }
  950. X    set x 42
  951. X    list [tproc 6] $x
  952. X} {7 42}
  953. Xtest proc-2.2 {local and global variables} {
  954. X    proc tproc x {
  955. X    set y [expr $x+1]
  956. X    return $y
  957. X    }
  958. X    set y 18
  959. X    list [tproc 6] $y
  960. X} {7 18}
  961. Xtest proc-2.3 {local and global variables} {
  962. X    proc tproc x {
  963. X    global y
  964. X    set y [expr $x+1]
  965. X    return $y
  966. X    }
  967. X    set y 189
  968. X    list [tproc 6] $y
  969. X} {7 7}
  970. Xtest proc-2.4 {local and global variables} {
  971. X    proc tproc x {
  972. X    global y
  973. X    return [expr $x+$y]
  974. X    }
  975. X    set y 189
  976. X    list [tproc 6] $y
  977. X} {195 189}
  978. Xcatch {unset _undefined_}
  979. Xtest proc-2.5 {local and global variables} {
  980. X    proc tproc x {
  981. X    global _undefined_
  982. X    return $_undefined_
  983. X    }
  984. X    list [catch {tproc xxx} msg] $msg
  985. X} {1 {can't read "_undefined_": no such variable}}
  986. Xtest proc-2.6 {local and global variables} {
  987. X    set a 114
  988. X    set b 115
  989. X    global a b
  990. X    list $a $b
  991. X} {114 115}
  992. X
  993. Xproc do {cmd} {eval $cmd}
  994. Xtest proc-3.1 {local and global arrays} {
  995. X    catch {unset a}
  996. X    set a(0) 22
  997. X    list [catch {do {global a; set a(0)}} msg] $msg
  998. X} {0 22}
  999. Xtest proc-3.2 {local and global arrays} {
  1000. X    catch {unset a}
  1001. X    set a(x) 22
  1002. X    list [catch {do {global a; set a(x) newValue}} msg] $msg $a(x)
  1003. X} {0 newValue newValue}
  1004. Xtest proc-3.3 {local and global arrays} {
  1005. X    catch {unset a}
  1006. X    set a(x) 22
  1007. X    set a(y) 33
  1008. X    list [catch {do {global a; unset a(y)}; array names a} msg] $msg
  1009. X} {0 x}
  1010. Xtest proc-3.4 {local and global arrays} {
  1011. X    catch {unset a}
  1012. X    set a(x) 22
  1013. X    set a(y) 33
  1014. X    list [catch {do {global a; unset a; info exists a}} msg] $msg \
  1015. X        [info exists a]
  1016. X} {0 0 0}
  1017. Xtest proc-3.5 {local and global arrays} {
  1018. X    catch {unset a}
  1019. X    set a(x) 22
  1020. X    set a(y) 33
  1021. X    list [catch {do {global a; unset a(y); array names a}} msg] $msg
  1022. X} {0 x}
  1023. Xcatch {unset a}
  1024. Xtest proc-3.6 {local and global arrays} {
  1025. X    catch {unset a}
  1026. X    set a(x) 22
  1027. X    set a(y) 33
  1028. X    do {global a; do {global a; unset a}; set a(z) 22}
  1029. X    list [catch {array names a} msg] $msg
  1030. X} {0 z}
  1031. Xtest proc-3.7 {local and global arrays} {
  1032. X    proc t1 {args} {global info; set info 1}
  1033. X    catch {unset a}
  1034. X    set info {}
  1035. X    do {global a; trace var a(1) w t1}
  1036. X    set a(1) 44
  1037. X    set info
  1038. X} 1
  1039. Xtest proc-3.8 {local and global arrays} {
  1040. X    proc t1 {args} {global info; set info 1}
  1041. X    catch {unset a}
  1042. X    trace var a(1) w t1
  1043. X    set info {}
  1044. X    do {global a; trace vdelete a(1) w t1}
  1045. X    set a(1) 44
  1046. X    set info
  1047. X} {}
  1048. Xtest proc-3.9 {local and global arrays} {
  1049. X    proc t1 {args} {global info; set info 1}
  1050. X    catch {unset a}
  1051. X    trace var a(1) w t1
  1052. X    do {global a; trace vinfo a(1)}
  1053. X} {{w t1}}
  1054. Xcatch {unset a}
  1055. X
  1056. Xtest proc-3.1 {arguments and defaults} {
  1057. X    proc tproc {x y z} {
  1058. X    return [list $x $y $z]
  1059. X    }
  1060. X    tproc 11 12 13
  1061. X} {11 12 13}
  1062. Xtest proc-3.2 {arguments and defaults} {
  1063. X    proc tproc {x y z} {
  1064. X    return [list $x $y $z]
  1065. X    }
  1066. X    list [catch {tproc 11 12} msg] $msg
  1067. X} {1 {no value given for parameter "z" to "tproc"}}
  1068. Xtest proc-3.3 {arguments and defaults} {
  1069. X    proc tproc {x y z} {
  1070. X    return [list $x $y $z]
  1071. X    }
  1072. X    list [catch {tproc 11 12 13 14} msg] $msg
  1073. X} {1 {called "tproc" with too many arguments}}
  1074. Xtest proc-3.4 {arguments and defaults} {
  1075. X    proc tproc {x {y y-default} {z z-default}} {
  1076. X    return [list $x $y $z]
  1077. X    }
  1078. X    tproc 11 12 13
  1079. X} {11 12 13}
  1080. Xtest proc-3.5 {arguments and defaults} {
  1081. X    proc tproc {x {y y-default} {z z-default}} {
  1082. X    return [list $x $y $z]
  1083. X    }
  1084. X    tproc 11 12
  1085. X} {11 12 z-default}
  1086. Xtest proc-3.6 {arguments and defaults} {
  1087. X    proc tproc {x {y y-default} {z z-default}} {
  1088. X    return [list $x $y $z]
  1089. X    }
  1090. X    tproc 11
  1091. X} {11 y-default z-default}
  1092. Xtest proc-3.7 {arguments and defaults} {
  1093. X    proc tproc {x {y y-default} {z z-default}} {
  1094. X    return [list $x $y $z]
  1095. X    }
  1096. X    list [catch {tproc} msg] $msg
  1097. X} {1 {no value given for parameter "x" to "tproc"}}
  1098. Xtest proc-3.8 {arguments and defaults} {
  1099. X    list [catch {
  1100. X    proc tproc {x {y y-default} z} {
  1101. X        return [list $x $y $z]
  1102. X    }
  1103. X    tproc 2 3
  1104. X    } msg] $msg
  1105. X} {1 {no value given for parameter "z" to "tproc"}}
  1106. Xtest proc-3.9 {arguments and defaults} {
  1107. X    proc tproc {x {y y-default} args} {
  1108. X    return [list $x $y $args]
  1109. X    }
  1110. X    tproc 2 3 4 5
  1111. X} {2 3 {4 5}}
  1112. Xtest proc-3.10 {arguments and defaults} {
  1113. X    proc tproc {x {y y-default} args} {
  1114. X    return [list $x $y $args]
  1115. X    }
  1116. X    tproc 2 3
  1117. X} {2 3 {}}
  1118. Xtest proc-3.11 {arguments and defaults} {
  1119. X    proc tproc {x {y y-default} args} {
  1120. X    return [list $x $y $args]
  1121. X    }
  1122. X    tproc 2
  1123. X} {2 y-default {}}
  1124. Xtest proc-3.12 {arguments and defaults} {
  1125. X    proc tproc {x {y y-default} args} {
  1126. X    return [list $x $y $args]
  1127. X    }
  1128. X    list [catch {tproc} msg] $msg
  1129. X} {1 {no value given for parameter "x" to "tproc"}}
  1130. X
  1131. Xtest proc-4.1 {variable numbers of arguments} {
  1132. X    proc tproc args {return $args}
  1133. X    tproc
  1134. X} {}
  1135. Xtest proc-4.2 {variable numbers of arguments} {
  1136. X    proc tproc args {return $args}
  1137. X    tproc 1 2 3 4 5 6 7 8
  1138. X} {1 2 3 4 5 6 7 8}
  1139. Xtest proc-4.3 {variable numbers of arguments} {
  1140. X    proc tproc args {return $args}
  1141. X    tproc 1 {2 3} {4 {5 6} {{{7}}}} 8
  1142. X} {1 {2 3} {4 {5 6} {{{7}}}} 8}
  1143. Xtest proc-4.4 {variable numbers of arguments} {
  1144. X    proc tproc {x y args} {return $args}
  1145. X    tproc 1 2 3 4 5 6 7
  1146. X} {3 4 5 6 7}
  1147. Xtest proc-4.5 {variable numbers of arguments} {
  1148. X    proc tproc {x y args} {return $args}
  1149. X    tproc 1 2
  1150. X} {}
  1151. Xtest proc-4.6 {variable numbers of arguments} {
  1152. X    proc tproc {x missing args} {return $args}
  1153. X    list [catch {tproc 1} msg] $msg
  1154. X} {1 {no value given for parameter "missing" to "tproc"}}
  1155. X
  1156. Xtest proc-5.1 {error conditions} {
  1157. X    list [catch {proc} msg] $msg
  1158. X} {1 {wrong # args: should be "proc name args body"}}
  1159. Xtest proc-5.2 {error conditions} {
  1160. X    list [catch {proc tproc b} msg] $msg
  1161. X} {1 {wrong # args: should be "proc name args body"}}
  1162. Xtest proc-5.3 {error conditions} {
  1163. X    list [catch {proc tproc b c d e} msg] $msg
  1164. X} {1 {wrong # args: should be "proc name args body"}}
  1165. Xtest proc-5.4 {error conditions} {
  1166. X    list [catch {proc tproc \{xyz {return foo}} msg] $msg
  1167. X} {1 {unmatched open brace in list}}
  1168. Xtest proc-5.5 {error conditions} {
  1169. X    list [catch {proc tproc {{} y} {return foo}} msg] $msg
  1170. X} {1 {procedure "tproc" has argument with no name}}
  1171. Xtest proc-5.6 {error conditions} {
  1172. X    list [catch {proc tproc {{} y} {return foo}} msg] $msg
  1173. X} {1 {procedure "tproc" has argument with no name}}
  1174. Xtest proc-5.7 {error conditions} {
  1175. X    list [catch {proc tproc {{x 1 2} y} {return foo}} msg] $msg
  1176. X} {1 {too many fields in argument specifier "x 1 2"}}
  1177. Xtest proc-5.8 {error conditions} {
  1178. X    catch {return}
  1179. X} 2
  1180. Xtest proc-5.9 {error conditions} {
  1181. X    list [catch {return 1 2} msg] $msg
  1182. X} {1 {wrong # args: should be "return ?value?"}}
  1183. Xtest proc-5.10 {error conditions} {
  1184. X    list [catch {global} msg] $msg
  1185. X} {1 {wrong # args: should be "global varName ?varName ...?"}}
  1186. Xproc tproc {} {
  1187. X    set a 22
  1188. X    global a
  1189. X}
  1190. Xtest proc-5.11 {error conditions} {
  1191. X    list [catch {tproc} msg] $msg
  1192. X} {1 {variable "a" already exists}}
  1193. Xtest proc-5.12 {error conditions} {
  1194. X    catch {rename tproc {}}
  1195. X    catch {
  1196. X    proc tproc {x {} z} {return foo}
  1197. X    }
  1198. X    list [catch {tproc 1} msg] $msg
  1199. X} {1 {invalid command name: "tproc"}}
  1200. Xtest proc-5.13 {error conditions} {
  1201. X    proc tproc {} {
  1202. X    set a 22
  1203. X    error "error in procedure"
  1204. X    return
  1205. X    }
  1206. X    list [catch tproc msg] $msg
  1207. X} {1 {error in procedure}}
  1208. Xtest proc-5.14 {error conditions} {
  1209. X    proc tproc {} {
  1210. X    set a 22
  1211. X    error "error in procedure"
  1212. X    return
  1213. X    }
  1214. X    catch tproc msg
  1215. X    set errorInfo
  1216. X} {error in procedure
  1217. X    while executing
  1218. X"error "error in procedure""
  1219. X    (procedure "tproc" line 3)
  1220. X    invoked from within
  1221. X"tproc"}
  1222. Xtest proc-5.15 {error conditions} {
  1223. X    proc tproc {} {
  1224. X    set a 22
  1225. X    break
  1226. X    return
  1227. X    }
  1228. X    catch tproc msg
  1229. X    set errorInfo
  1230. X} {invoked "break" outside of a loop
  1231. X    while executing
  1232. X"tproc"}
  1233. Xtest proc-5.16 {error conditions} {
  1234. X    proc tproc {} {
  1235. X    set a 22
  1236. X    continue
  1237. X    return
  1238. X    }
  1239. X    catch tproc msg
  1240. X    set errorInfo
  1241. X} {invoked "continue" outside of a loop
  1242. X    while executing
  1243. X"tproc"}
  1244. END_OF_FILE
  1245. if test 9157 -ne `wc -c <'tcl6.1/tests/proc.test'`; then
  1246.     echo shar: \"'tcl6.1/tests/proc.test'\" unpacked with wrong size!
  1247. fi
  1248. # end of 'tcl6.1/tests/proc.test'
  1249. fi
  1250. if test -f 'tcl6.1/tests/regexp.test' -a "${1}" != "-c" ; then 
  1251.   echo shar: Will not clobber existing file \"'tcl6.1/tests/regexp.test'\"
  1252. else
  1253. echo shar: Extracting \"'tcl6.1/tests/regexp.test'\" \(9482 characters\)
  1254. sed "s/^X//" >'tcl6.1/tests/regexp.test' <<'END_OF_FILE'
  1255. X# Commands covered:  regexp, regsub
  1256. X#
  1257. X# This file contains a collection of tests for one or more of the Tcl
  1258. X# built-in commands.  Sourcing this file into Tcl runs the tests and
  1259. X# generates output for errors.  No output means no errors were found.
  1260. X#
  1261. X# Copyright 1991 Regents of the University of California
  1262. X# Permission to use, copy, modify, and distribute this
  1263. X# software and its documentation for any purpose and without
  1264. X# fee is hereby granted, provided that this copyright notice
  1265. X# appears in all copies.  The University of California makes no
  1266. X# representations about the suitability of this software for any
  1267. X# purpose.  It is provided "as is" without express or implied
  1268. X# warranty.
  1269. X#
  1270. X# $Header: /user6/ouster/tcl/tests/RCS/regexp.test,v 1.5 91/10/27 15:20:14 ouster Exp $ (Berkeley)
  1271. X
  1272. Xif {[string compare test [info procs test]] == 1} then {source defs}
  1273. X
  1274. Xcatch {unset foo}
  1275. Xtest regexp-1.1 {basic regexp operation} {
  1276. X    regexp ab*c abbbc
  1277. X} 1
  1278. Xtest regexp-1.2 {basic regexp operation} {
  1279. X    regexp ab*c ac
  1280. X} 1
  1281. Xtest regexp-1.3 {basic regexp operation} {
  1282. X    regexp ab*c ab
  1283. X} 0
  1284. X
  1285. Xtest regexp-2.1 {getting substrings back from regexp} {
  1286. X    set foo {}
  1287. X    list [regexp ab*c abbbbc foo] $foo
  1288. X} {1 abbbbc}
  1289. Xtest regexp-2.2 {getting substrings back from regexp} {
  1290. X    set foo {}
  1291. X    set f2 {}
  1292. X    list [regexp a(b*)c abbbbc foo f2] $foo $f2
  1293. X} {1 abbbbc bbbb}
  1294. Xtest regexp-2.3 {getting substrings back from regexp} {
  1295. X    set foo {}
  1296. X    set f2 {}
  1297. X    list [regexp a(b*)(c) abbbbc foo f2] $foo $f2
  1298. X} {1 abbbbc bbbb}
  1299. Xtest regexp-2.4 {getting substrings back from regexp} {
  1300. X    set foo {}
  1301. X    set f2 {}
  1302. X    set f3 {}
  1303. X    list [regexp a(b*)(c) abbbbc foo f2 f3] $foo $f2 $f3
  1304. X} {1 abbbbc bbbb c}
  1305. Xtest regexp-2.5 {getting substrings back from regexp} {
  1306. X    set foo {}; set f1 {}; set f2 {}; set f3 {}; set f4 {}; set f5 {};
  1307. X    set f6 {}; set f7 {}; set f8 {}; set f9 {}
  1308. X    list [regexp (1*)(2*)(3*)(4*)(5*)(6*)(7*)(8*)(9*) 12223345556789999 \
  1309. X        foo f1 f2 f3 f4 f5 f6 f7 f8 f9] $foo $f1 $f2 $f3 $f4 $f5 \
  1310. X        $f6 $f7 $f8 $f9
  1311. X} {1 12223345556789999 1 222 33 4 555 6 7 8 9999}
  1312. Xtest regexp-2.6 {getting substrings back from regexp} {
  1313. X    set foo 2; set f2 2; set f3 2; set f4 2
  1314. X    list [regexp (a)(b)? xay foo f2 f3 f4] $foo $f2 $f3 $f4
  1315. X} {1 a a {} {}}
  1316. Xtest regexp-2.7 {getting substrings back from regexp} {
  1317. X    set foo 1; set f2 1; set f3 1; set f4 1
  1318. X    list [regexp (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4
  1319. X} {1 ac a {} c}
  1320. X
  1321. Xtest regexp-3.1 {-indices option to regexp} {
  1322. X    set foo {}
  1323. X    list [regexp -indices ab*c abbbbc foo] $foo
  1324. X} {1 {0 5}}
  1325. Xtest regexp-3.2 {-indices option to regexp} {
  1326. X    set foo {}
  1327. X    set f2 {}
  1328. X    list [regexp -indices a(b*)c abbbbc foo f2] $foo $f2
  1329. X} {1 {0 5} {1 4}}
  1330. Xtest regexp-3.3 {-indices option to regexp} {
  1331. X    set foo {}
  1332. X    set f2 {}
  1333. X    list [regexp -indices a(b*)(c) abbbbc foo f2] $foo $f2
  1334. X} {1 {0 5} {1 4}}
  1335. Xtest regexp-3.4 {-indices option to regexp} {
  1336. X    set foo {}
  1337. X    set f2 {}
  1338. X    set f3 {}
  1339. X    list [regexp -indices a(b*)(c) abbbbc foo f2 f3] $foo $f2 $f3
  1340. X} {1 {0 5} {1 4} {5 5}}
  1341. Xtest regexp-3.5 {-indices option to regexp} {
  1342. X    set foo {}; set f1 {}; set f2 {}; set f3 {}; set f4 {}; set f5 {};
  1343. X    set f6 {}; set f7 {}; set f8 {}; set f9 {}
  1344. X    list [regexp -indices (1*)(2*)(3*)(4*)(5*)(6*)(7*)(8*)(9*) \
  1345. X        12223345556789999 \
  1346. X        foo f1 f2 f3 f4 f5 f6 f7 f8 f9] $foo $f1 $f2 $f3 $f4 $f5 \
  1347. X        $f6 $f7 $f8 $f9
  1348. X} {1 {0 16} {0 0} {1 3} {4 5} {6 6} {7 9} {10 10} {11 11} {12 12} {13 16}}
  1349. Xtest regexp-3.6 {getting substrings back from regexp} {
  1350. X    set foo 2; set f2 2; set f3 2; set f4 2
  1351. X    list [regexp -indices (a)(b)? xay foo f2 f3 f4] $foo $f2 $f3 $f4
  1352. X} {1 {1 1} {1 1} {-1 -1} {-1 -1}}
  1353. Xtest regexp-3.7 {getting substrings back from regexp} {
  1354. X    set foo 1; set f2 1; set f3 1; set f4 1
  1355. X    list [regexp -indices (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4
  1356. X} {1 {1 2} {1 1} {-1 -1} {2 2}}
  1357. X
  1358. Xtest regexp-4.1 {-nocase option to regexp} {
  1359. X    regexp -nocase foo abcFOo
  1360. X} 1
  1361. Xtest regexp-4.2 {-nocase option to regexp} {
  1362. X    set f1 22
  1363. X    set f2 33
  1364. X    set f3 44
  1365. X    list [regexp -nocase {a(b*)([xy]*)z} aBbbxYXxxZ22 f1 f2 f3] $f1 $f2 $f3
  1366. X} {1 aBbbxYXxxZ Bbb xYXxx}
  1367. X
  1368. Xtest regexp-5.1 {exercise cache of compiled expressions} {
  1369. X    regexp .*a b
  1370. X    regexp .*b c
  1371. X    regexp .*c d
  1372. X    regexp .*d e
  1373. X    regexp .*e f
  1374. X    regexp .*a bbba
  1375. X} 1
  1376. Xtest regexp-5.2 {exercise cache of compiled expressions} {
  1377. X    regexp .*a b
  1378. X    regexp .*b c
  1379. X    regexp .*c d
  1380. X    regexp .*d e
  1381. X    regexp .*e f
  1382. X    regexp .*b xxxb
  1383. X} 1
  1384. Xtest regexp-5.3 {exercise cache of compiled expressions} {
  1385. X    regexp .*a b
  1386. X    regexp .*b c
  1387. X    regexp .*c d
  1388. X    regexp .*d e
  1389. X    regexp .*e f
  1390. X    regexp .*c yyyc
  1391. X} 1
  1392. Xtest regexp-5.4 {exercise cache of compiled expressions} {
  1393. X    regexp .*a b
  1394. X    regexp .*b c
  1395. X    regexp .*c d
  1396. X    regexp .*d e
  1397. X    regexp .*e f
  1398. X    regexp .*d 1d
  1399. X} 1
  1400. Xtest regexp-5.5 {exercise cache of compiled expressions} {
  1401. X    regexp .*a b
  1402. X    regexp .*b c
  1403. X    regexp .*c d
  1404. X    regexp .*d e
  1405. X    regexp .*e f
  1406. X    regexp .*e xe
  1407. X} 1
  1408. X
  1409. Xtest regexp-6.1 {regexp errors} {
  1410. X    list [catch {regexp a} msg] $msg
  1411. X} {1 {wrong # args: should be "regexp ?-nocase? exp string ?matchVar? ?subMatchVar subMatchVar ...?"}}
  1412. Xtest regexp-6.2 {regexp errors} {
  1413. X    list [catch {regexp -nocase a} msg] $msg
  1414. X} {1 {wrong # args: should be "regexp ?-nocase? exp string ?matchVar? ?subMatchVar subMatchVar ...?"}}
  1415. Xtest regexp-6.3 {regexp errors} {
  1416. X    list [catch {regexp -nocas a} msg] $msg
  1417. X} {0 0}
  1418. Xtest regexp-6.4 {regexp errors} {
  1419. X    list [catch {regexp a( b} msg] $msg
  1420. X} {1 {couldn't compile regular expression pattern: unmatched ()}}
  1421. Xtest regexp-6.5 {regexp errors} {
  1422. X    list [catch {regexp a( b} msg] $msg
  1423. X} {1 {couldn't compile regular expression pattern: unmatched ()}}
  1424. Xtest regexp-6.6 {regexp errors} {
  1425. X    list [catch {regexp a a f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1} msg] $msg
  1426. X} {1 {too many substring variables}}
  1427. Xtest regexp-6.7 {regexp errors} {
  1428. X    set f1 44
  1429. X    list [catch {regexp abc abc f1(f2)} msg] $msg
  1430. X} {1 {couldn't set variable "f1(f2)"}}
  1431. X
  1432. Xtest regexp-7.1 {basic regsub operation} {
  1433. X    list [regsub aa+ xaxaaaxaa 111&222 foo] $foo
  1434. X} {1 xax111aaa222xaa}
  1435. Xtest regexp-7.2 {basic regsub operation} {
  1436. X    list [regsub aa+ aaaxaa &111 foo] $foo
  1437. X} {1 aaa111xaa}
  1438. Xtest regexp-7.3 {basic regsub operation} {
  1439. X    list [regsub aa+ xaxaaa 111& foo] $foo
  1440. X} {1 xax111aaa}
  1441. Xtest regexp-7.4 {basic regsub operation} {
  1442. X    list [regsub aa+ aaa 11&2&333 foo] $foo
  1443. X} {1 11aaa2aaa333}
  1444. Xtest regexp-7.5 {basic regsub operation} {
  1445. X    list [regsub aa+ xaxaaaxaa &2&333 foo] $foo
  1446. X} {1 xaxaaa2aaa333xaa}
  1447. Xtest regexp-7.6 {basic regsub operation} {
  1448. X    list [regsub aa+ xaxaaaxaa 1&22& foo] $foo
  1449. X} {1 xax1aaa22aaaxaa}
  1450. Xtest regexp-7.7 {basic regsub operation} {
  1451. X    list [regsub a(a+) xaxaaaxaa {1\122\1} foo] $foo
  1452. X} {1 xax1aa22aaxaa}
  1453. Xtest regexp-7.8 {basic regsub operation} {
  1454. X    list [regsub a(a+) xaxaaaxaa {1\\\122\1} foo] $foo
  1455. X} "1 {xax1\\aa22aaxaa}"
  1456. Xtest regexp-7.9 {basic regsub operation} {
  1457. X    list [regsub a(a+) xaxaaaxaa {1\\122\1} foo] $foo
  1458. X} "1 {xax1\\122aaxaa}"
  1459. Xtest regexp-7.10 {basic regsub operation} {
  1460. X    list [regsub a(a+) xaxaaaxaa {1\\&\1} foo] $foo
  1461. X} "1 {xax1\\aaaaaxaa}"
  1462. Xtest regexp-7.11 {basic regsub operation} {
  1463. X    list [regsub a(a+) xaxaaaxaa {1\&\1} foo] $foo
  1464. X} {1 xax1&aaxaa}
  1465. Xtest regexp-7.12 {basic regsub operation} {
  1466. X    list [regsub a(a+) xaxaaaxaa {\1\1\1\1&&} foo] $foo
  1467. X} {1 xaxaaaaaaaaaaaaaaxaa}
  1468. Xtest regexp-7.13 {basic regsub operation} {
  1469. X    set foo xxx
  1470. X    list [regsub abc xyz 111 foo] $foo
  1471. X} {0 xxx}
  1472. X
  1473. Xtest regexp-8.1 {case conversion in regsub} {
  1474. X    list [regsub -nocase a(a+) xaAAaAAay & foo] $foo
  1475. X} {1 xaAAaAAay}
  1476. Xtest regexp-8.2 {case conversion in regsub} {
  1477. X    list [regsub -nocase a(a+) xaAAaAAay & foo] $foo
  1478. X} {1 xaAAaAAay}
  1479. Xtest regexp-8.3 {case conversion in regsub} {
  1480. X    set foo 123
  1481. X    list [regsub a(a+) xaAAaAAay & foo] $foo
  1482. X} {0 123}
  1483. X
  1484. Xtest regexp-9.1 {-all option to regsub} {
  1485. X    set foo 86
  1486. X    list [regsub -all x+ axxxbxxcxdx |&| foo] $foo
  1487. X} {1 a|xxx|b|xx|c|x|d|x|}
  1488. Xtest regexp-9.2 {-all option to regsub} {
  1489. X    set foo 86
  1490. X    list [regsub -nocase -all x+ aXxXbxxcXdx |&| foo] $foo
  1491. X} {1 a|XxX|b|xx|c|X|d|x|}
  1492. Xtest regexp-9.3 {-all option to regsub} {
  1493. X    set foo 86
  1494. X    list [regsub x+ axxxbxxcxdx |&| foo] $foo
  1495. X} {1 a|xxx|bxxcxdx}
  1496. Xtest regexp-9.4 {-all option to regsub} {
  1497. X    set foo 86
  1498. X    list [regsub -all bc axxxbxxcxdx |&| foo] $foo
  1499. X} {0 86}
  1500. Xtest regexp-9.5 {-all option to regsub} {
  1501. X    set foo xxx
  1502. X    list [regsub -all node "node node more" yy foo] $foo
  1503. X} {1 {yy yy more}}
  1504. X
  1505. Xtest regexp-10.1 {regsub errors} {
  1506. X    list [catch {regsub a b c} msg] $msg
  1507. X} {1 {wrong # args: should be "regsub ?-nocase? ?-all? exp string subSpec varName"}}
  1508. Xtest regexp-10.2 {regsub errors} {
  1509. X    list [catch {regsub -nocase a b c} msg] $msg
  1510. X} {1 {wrong # args: should be "regsub ?-nocase? ?-all? exp string subSpec varName"}}
  1511. Xtest regexp-10.3 {regsub errors} {
  1512. X    list [catch {regsub -nocase -all a b c} msg] $msg
  1513. X} {1 {wrong # args: should be "regsub ?-nocase? ?-all? exp string subSpec varName"}}
  1514. Xtest regexp-10.4 {regsub errors} {
  1515. X    list [catch {regsub a b c d e f} msg] $msg
  1516. X} {1 {wrong # args: should be "regsub ?-nocase? ?-all? exp string subSpec varName"}}
  1517. Xtest regexp-10.5 {regsub errors} {
  1518. X    list [catch {regsub -nocas a b c} msg] $msg
  1519. X} {0 0}
  1520. Xtest regexp-10.6 {regsub errors} {
  1521. X    list [catch {regsub -nocase a( b c d} msg] $msg
  1522. X} {1 {couldn't compile regular expression pattern: unmatched ()}}
  1523. Xtest regexp-10.7 {regsub errors} {
  1524. X    list [catch {regsub -nocase aaa aaa xxx f1(f2)} msg] $msg
  1525. X} {1 {couldn't set variable "f1(f2)"}}
  1526. END_OF_FILE
  1527. if test 9482 -ne `wc -c <'tcl6.1/tests/regexp.test'`; then
  1528.     echo shar: \"'tcl6.1/tests/regexp.test'\" unpacked with wrong size!
  1529. fi
  1530. # end of 'tcl6.1/tests/regexp.test'
  1531. fi
  1532. echo shar: End of archive 7 \(of 33\).
  1533. cp /dev/null ark7isdone
  1534. MISSING=""
  1535. 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
  1536.     if test ! -f ark${I}isdone ; then
  1537.     MISSING="${MISSING} ${I}"
  1538.     fi
  1539. done
  1540. if test "${MISSING}" = "" ; then
  1541.     echo You have unpacked all 33 archives.
  1542.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1543. else
  1544.     echo You still need to unpack the following archives:
  1545.     echo "        " ${MISSING}
  1546. fi
  1547. ##  End of shell archive.
  1548. exit 0
  1549.  
  1550. exit 0 # Just in case...
  1551. -- 
  1552. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1553. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1554. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1555. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1556.