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

  1. Newsgroups: comp.sources.misc
  2. From: karl@sugar.neosoft.com (Karl Lehenbauer)
  3. Subject:  v26i020:  tclx - extensions and on-line help for tcl 6.1, Part20/23
  4. Message-ID: <1991Nov19.135733.1540@sparky.imd.sterling.com>
  5. X-Md4-Signature: 050056e14f4a568272054b0962de5ab0
  6. Date: Tue, 19 Nov 1991 13:57:33 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
  10. Posting-number: Volume 26, Issue 20
  11. Archive-name: tclx/part20
  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 20 (of 23)."
  21. # Contents:  extended/README.EXTD extended/man/TclShell.man
  22. # Wrapped by karl@one on Wed Nov 13 21:50:32 1991
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. if test -f 'extended/README.EXTD' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'extended/README.EXTD'\"
  26. else
  27. echo shar: Extracting \"'extended/README.EXTD'\" \(24101 characters\)
  28. sed "s/^X//" >'extended/README.EXTD' <<'END_OF_FILE'
  29. X
  30. X
  31. X              *** README.EXTD - README file for Extended Tcl ***
  32. X
  33. X
  34. XEXTENDED TCL
  35. X============
  36. X
  37. XExtended Tcl, also known as NeoSoft Tcl, defines a set of extensions
  38. Xto Tcl 6.1, the Tool Command Language invented by Dr. John Ousterhout
  39. Xof the University of California at Berkeley.  Extended Tcl is upwardly
  40. Xcompatible from Tcl 6.1.  You take the Extended Tcl package, add it to 
  41. XTcl 6.1, and from that you get Extended Tcl.  Extended Tcl was designed 
  42. Xand implemented by Karl Lehenbauer (karl@NeoSoft.com) and Mark Diekhans
  43. X(markd@Grizzly.com), with help in the early stages from Peter da Silva
  44. X(peter@NeoSoft.com).
  45. X
  46. XExtended Tcl (TclX for short) was first publicly released as version
  47. X4.0, to the Usenet alt.sources newsgroup in December of 1990.  The
  48. Xextensions built upon the embeddable Tcl interpreter to create a
  49. Xpowerful string and file processing language for Unix, adding support
  50. Xfor extended string and list operations, stdio-style I/O to files and
  51. Xpipelines, scanning files for lines matching regular expressions,
  52. Xsorting, sorted file searching, arrays, Unix multitasking operations
  53. X(fork, wait, kill, exec, etc), extensions for interactive use as a
  54. Xshell and awk-like command-line operation.  It also included
  55. Xdemand-loading of procedures from files and Tcl source libraries, a
  56. Xcommand trace capability, on-line help, and more.  We also supported
  57. XExtended Tcl on a number of versions of Unix, most significantly
  58. Xadding support for Unix System V, unlike the original Tcl, which was
  59. XBerkeley BSD-only.
  60. X
  61. XAt that time, Extended Tcl introduced some incompatibilities with
  62. XOusterhout's Tcl 3.3, upon which it was based.  We made Extended Tcl
  63. Xincompatible, with regrets, based on our experience using the
  64. Xlanguage.  Adding arrays, for example, introduced an incompatibility,
  65. Xas did changes we made in the way the exec command worked, among a few
  66. Xother small differences.
  67. X
  68. XHappily, John Ousterhout worked closely with Mark and Karl over the
  69. Xlast few months, and with his release of Tcl 6.1, most of the
  70. Xcapabilities of Extended Tcl 4.0 have been included in his Tcl 6.1
  71. Xbaseline.  Also, we've ironed out the incompatibilities so that
  72. XExtended Tcl 6.1a adds new capabilities to Tcl 6.1 without introducing
  73. Xany backward incompatibilities.  Finally, John's Tcl 6.1 now supports
  74. Xthe most popular Unix variants.
  75. X
  76. XAs with the original Tcl, all of Extended Tcl is freely
  77. Xredistributable, including commercial use and resale.
  78. X
  79. X
  80. XFEATURES ADDED BY EXTENDED TCL
  81. X==============================
  82. X
  83. X    o A shell, which provides an environment for developmenting and executing
  84. X      Tcl programs.  A Tcl code library facility is provided.
  85. X
  86. X    o General Commands
  87. X
  88. X        commandloop - create and enter an interactive command environment
  89. X
  90. X        cmdtrace - debugging tool for tracing Tcl command execution
  91. X
  92. X
  93. X        infox - find out additional information about extended Tcl,
  94. X                such as the version, patchlevel, name, version and
  95. X                long name of any embedded application.
  96. X
  97. X        loop -  a higher-performance for-style loop
  98. X
  99. X    o Unix Access Commands
  100. X
  101. X        chgrp, chmod, chown, execvp, fork, kill, sleep, system, umask,
  102. X        unlink, wait
  103. X
  104. X        fmtclock - format a long integer time value into human-readable form
  105. X
  106. X        getclock - return current date and time as a long integer
  107. X
  108. X        id - get and set user, group, process and process group id's
  109. X
  110. X        signal - specify action to be taken when a signal occurs
  111. X
  112. X        times - get process and child execution times
  113. X
  114. X
  115. X    o File I/O Commands
  116. X
  117. X        bsearch - binary search a sorted file
  118. X
  119. X        copyfile - copy remainder of one open file into another
  120. X
  121. X        dup - duplicate an open filehandle
  122. X
  123. X        fcntl - get or set open file access options
  124. X
  125. X        fstat - obtain status information about an open file
  126. X
  127. X        pipe - create a pipe
  128. X
  129. X        select - synchronous I/O multiplexing (on systems that support it)
  130. X
  131. X    o File Scanning Commands
  132. X
  133. X        scancontext - manage file scan contexts
  134. X
  135. X        scanfile - scan specified file against selected scan context
  136. X
  137. X        scanmatch - specify Tcl code to execute when scan pattern matches
  138. X
  139. X    o Math Commands
  140. X
  141. X        acos, asin, atan, ceil, cos, cosh, exp, fabs, floor, mod, max,
  142. X        min, log, log10, pow, sin, sinh, sqrt, tan, tah
  143. X
  144. X        random - return a pseudorandom integer or seed the random number
  145. X            generator
  146. X
  147. X
  148. X    o List Manipulation Commands
  149. X
  150. X        lempty - determine if a list is empty
  151. X
  152. X        lvarpop - pop or replace the specified element from a list
  153. X
  154. X    o Keyed Lists - support for struct-like lists
  155. X
  156. X        keyldel - delete a field of a keyed list
  157. X
  158. X        keylget - get the value of a field in a keyed list
  159. X
  160. X        keylset - set the value of a field of a keyed list
  161. X
  162. X    o String and Character Manipulation Commands
  163. X
  164. X        cindex - return the indexed character from the specified string
  165. X
  166. X        clength - return the length of the specified string
  167. X
  168. X        crange - return a range of characters from the specified string
  169. X
  170. X        csubstr - return a range of character from a string a different way
  171. X
  172. X        ctype - determine if string has various characteristics
  173. X
  174. X        replicate - replicate string a number of times
  175. X
  176. X        translit - translate characters in a string like the "tr" command
  177. X
  178. X    o Procedures in the Tcl Library
  179. X
  180. X        assign_fields - assign successive elements in lists to variables
  181. X
  182. X        edprocs - call editor on named, or all, procedures
  183. X
  184. X        for_array_keys - do a foreach-style loop on each key in an array
  185. X
  186. X        for_file - do a foreach-style loop on each line in a file
  187. X
  188. X        for_recursive_glob - perform a foreach-style loop on each file
  189. X                and directory that matches one or more patterns
  190. X
  191. X        intersect - return the logical intersection of two lists
  192. X
  193. X        intersect3 - return the intersection of two lists, with remainders
  194. X
  195. X        pushd/popd/dirs - Cshell-style directory stack routines
  196. X
  197. X        read_file - read in a file to a string
  198. X
  199. X        recursive_glob - do filename globbing, recursively descending
  200. X                all matched directories
  201. X
  202. X        lrmdups - sort a list and remove duplicate elements
  203. X
  204. X        saveprocs - save the definitions of named, or all, procedures
  205. X
  206. X        showproc - lists the definition of the named procedure
  207. X
  208. X        showprocs - list the definition of the named procedures, or all
  209. X
  210. X        union - return the logical union of two lists
  211. X
  212. X        write_file - write the specified string to the specified file
  213. X
  214. X
  215. XON-LINE HELP
  216. X============
  217. X
  218. XThere is a help system included with Extended Tcl.  It contains some
  219. Xdocumentation on every command in Berkeley Tcl, and Extended Tcl.  You
  220. Xcan invoke it interactively from within Extended Tcl by typing "help".
  221. X
  222. XOnce you bring Tcl up and have gotten it to pass all the tests, try
  223. Xtyping "help help" to learn how to use help.
  224. X
  225. X
  226. XMANUAL PAGES
  227. X============
  228. X
  229. XMan pages in nroff/troff format are provided for all of Tcl and the
  230. Xextensions.  These are in the "tcl6.1/doc" and "extended/man"
  231. Xdirectories.  Of greatest importance are Berkeley Tcl's
  232. Xtcl6.1/doc/Tcl.man, and Extended Tcl's TclX.man and TclShell.man,
  233. Xlocated in the extended/man directory.
  234. X
  235. XAn ASCII version of a paper that John Ousterhout presented at the
  236. XWinter '90 Usenix conference is also included.  It contains an
  237. Xoverview of Tcl, the rationale for creating a new embeddable
  238. Xprogramming language rather than using an existing one, speculations
  239. Xon future uses and so forth.  This file is usenix.text in the
  240. Xtcl6.1/doc directory.
  241. X
  242. X
  243. XEXTENDED TCL VERSION NAMING
  244. X===========================
  245. X
  246. XExtended Tcl takes its version number from the corresponding version
  247. Xof Berkeley (Ousterhout) Tcl upon which it is based, with the addition
  248. Xof a trailing letter in case there are multiple releases of Extended
  249. XTcl within a single release of baseline Tcl.
  250. X
  251. XFor example, the first release of Extended Tcl for Tcl 6.1 is called
  252. XExtended Tcl 6.1a.
  253. X
  254. X
  255. XC PROGRAMMERS CAN USE THIS PACKAGE TO BUILD TCL INTO THEIR APPLICATIONS, TOO
  256. X============================================================================
  257. X
  258. XAs an embeddable interpreter, Tcl offers a powerful, plug-in-and-go
  259. Xprogramming language that saves the programmer who needs to provide
  260. Xprogrammability in an application from having to design and implement
  261. Xhis or her own.  Tcl provides a better and more complete language than
  262. Xmost programmers have the time or inclination to write, and could
  263. Xreduce the all-too-common proliferation of similar-but-incompatible
  264. Xembedded programming languages.
  265. X
  266. XIn addition to the Tcl programming environment for Unix, this release
  267. Xalso provides C and C++ programmers with everything they need to embed
  268. Xthe Tcl programming language into an existing application or to build
  269. Xa new application and include Tcl within it.  C and C++ programmers
  270. X(and people programming in languages from which they can make
  271. XC-compatible calls for that matter) can link against the tcl.a
  272. Xlibrary, which this package should produce when you get it built
  273. Xsuccessfully, to include all of the baseline capabilities, plus any of
  274. Xour extensions that they like, plus any application-specific
  275. Xextensions they add themselves to produce a package with a significant
  276. Xruntime programmability.
  277. X
  278. XWe have found that including Tcl into large programs provides a good
  279. Xway to decouple the bulk of the application from the user interface, 
  280. Xallows sophisticated users to write programs to control the application,
  281. Xshortens turnaround time during development, makes many debugging tasks
  282. Xeasier, and allows you to code tricky data processing tasks in just a
  283. Xfew lines of Tcl.
  284. X
  285. X
  286. XINTERFACING TCL AND C++
  287. X=======================
  288. X
  289. XC++ programmers can include the file "tcl++.h" to define C++ classes
  290. Xthat can be used to access a Tcl interpreter.  This is based on Tcl
  291. XC++ classes originally developed by Parag Patel.
  292. X
  293. X
  294. XTCL DIRECTORY HIERARCHY
  295. X=======================
  296. X
  297. XHere is an overview of the directory hierarchy:
  298. X
  299. X                              top_level_directory
  300. X
  301. X             tcl6.1                                 extended
  302. X
  303. X    compat doc library test       man ossupport src tcllib tclsrc tests ucbsrc
  304. X
  305. X                                                     help
  306. X
  307. XThe subdirectories of the tcl6.1 directory contain Berkeley Tcl,
  308. Xunmodified.  Note that tcl6.1 is just a suggested name; you can
  309. Xcall the directory anything you want, by changing one line in
  310. Xextended/Makefile, as long as the directory is parallel to the
  311. X"extended" directory.
  312. X
  313. XWithin the tcl6.1 directory is the README file, the config program,
  314. Xmakefile and all of the C source files and include files.  The
  315. X"compat" directory contains implementations for routines that may
  316. Xnot be present on all unix systems.
  317. X
  318. XThe "doc" directory contains all of the manual pages for baseline Tcl
  319. Xin nroff/troff format, plus the text of the Usenix paper.
  320. X
  321. X"library" includes various Tcl procedures defined in baseline Tcl.
  322. X
  323. XFinally, "test" contains all of the tests for baseline Tcl.
  324. X
  325. XWithin the "extended" directory, the "man" directory contains all of
  326. Xthe manpages for Extended Tcl, "ossupport" contains routines that
  327. XExtended Tcl needs that may not be present on all systems, and "src"
  328. Xcontains all of the C source and include files comprising the
  329. XTcl extensions.
  330. X
  331. XThe "tcllib" directory contains several demo programs for Extended
  332. XTcl, and the Tcl procedure library and index are built here.  Also
  333. Xthe "help" subdirectory contains all of the help files.
  334. X
  335. XThe "tclsrc" directory contains the Tcl source files that are
  336. Xconcatenated to create the Tcl procedure library, and the "tests"
  337. Xdirectory contains the tests for Extended Tcl.
  338. X
  339. XFinally, the "ucbsrc" directory contains a replacement for the
  340. Xbaseline version of tclBasic.c.  This was necessary because a
  341. Xcouple of small changes needed to be made to tclBasic.c to support
  342. Xthe signal processing of Extended Tcl.
  343. X
  344. X
  345. XHOW TO BUILD IT
  346. X===============
  347. X
  348. XPlease read TclX.man and TclShell.man in the extended/man directory
  349. Xbefore starting the engine or working under the hood.
  350. X
  351. XCreate a directory that you want to create Tcl and Extended Tcl in,
  352. Xcd to that directory and unpack tcl6.1.tar.Z by doing a 
  353. X"compress -dc tcl6.1.tar.Z | tar xvf -" or equivalent.
  354. X
  355. XIf you got tcl6.1 from the comp.sources.misc newsgroup, create the
  356. Xbuild directory and unshar all of the parts of Tcl 6.1 there.
  357. X
  358. XTo configure Tcl 6.1 for your machine, do a "csh config" to run the
  359. Xconfigure script.  This script determines things about the version
  360. Xof Unix you're using, looks for routines that aren't present in all
  361. Xversions, and configures the Makefile to use public domain equivalents
  362. Xthat are included with the release.  (Eventually we would like to
  363. Xreplace this with a configure script generated by Larry Wall's
  364. X"metaconfig" program.  Anyone, please feel free to help out on this.)
  365. X
  366. XNext do a "make".  If all goes well, this will create a library,
  367. Xtcl.a, which contains the core functions of the Tcl 6.1 interpreter.
  368. X
  369. XIn the next step, we will  build and install Extended Tcl.
  370. X
  371. XFirst, "cd" back to the top-level directory you've created to build
  372. XTcl and Extended Tcl in, and unpack tclX6.1.tar.Z by doing a
  373. X"compress -dc tclx6.1.tar.Z | tar xvf -" or equivalent.
  374. X
  375. XAgain, if you got Extended Tcl from the comp.sources.misc newsgroup,
  376. Xunshar all of the parts of Tcl 6.1 while your current directory is
  377. Xset to the build directory you created earlier.
  378. X
  379. XNext, "cd" to the "extended" directory which was created by untaring
  380. Xor unsharing extended Tcl, and edit the Makefile, commenting in
  381. Xthe configuration lines for your version of Unix, be it System V/3.2.0,
  382. XSystem V/3.2.2 or SCO Unix, Berkeley BSD, Sun OS, Xenix, or HPUX.
  383. X
  384. XThen do a "make".  If all goes well, this will augment the tcl.a
  385. Xlibrary will all of the functions defined by Extended Tcl, and
  386. Xcreate an executable version of tcl in the "extended" directory called,
  387. Xsimply enough, "tcl".
  388. X
  389. XNext fire up "tcl" and, if everything worked, you should be greated
  390. Xby a tcl prompt:
  391. X
  392. Xtcl>
  393. X
  394. XCongratulations, you have successfully built Tcl.
  395. X
  396. X
  397. XRUN TESTS TO INSURE THAT TCL IS WORKING PROPERLY
  398. X================================================
  399. X
  400. XTcl comes with over 1400 tests that you can run to insure that it
  401. Xis working properly.  These tests have greatly helped us while
  402. Xworking on Tcl by detecting bugs that get introduced accidentally
  403. Xas side-effects of changes.  Consequently, we have found Tcl
  404. Xto be very reliable, and have had very few cases where a new
  405. Xrelease has regressed by introducing new bugs in old functions,
  406. Xor reintroducing old bugs in old fucntions.
  407. X
  408. XThere are two sets of tests:  tests for the Tcl baseline,
  409. Xand tests for extended Tcl, which test both the new commands
  410. Xadded by Extended Tcl and the procedures defined in the Tcl
  411. Xprocedure library.
  412. X
  413. XFirst, run the tests for baseline Tcl.  After firing up Tcl,
  414. Xcd to the baseline tests directory, "cd ../tcl6.1/tests" and
  415. Xdo a "source all".  Tcl will print the names of the test
  416. Xfiles as it executes them, and it will report the test number
  417. Xof any test that fails, along with what the test expected and
  418. Xwhat it actually got.
  419. X
  420. XIf a test fails, please dig into the test and the C source for
  421. Xthe function being tested, fix the bug and mail us the change.
  422. XIf you're not inclined to do this, please report the problem,
  423. Xincluding the output of the test, to tcl-project@neosoft.com
  424. Xor ouster@sprite.berkeley.edu.
  425. X
  426. XAfter your build of Tcl has successfully passed the baseline
  427. Xtests, you are ready to run the tests of the functions in
  428. XExtended Tcl.  Exit tcl by entering a control-D at the command
  429. Xprompt, or issue the "exit" command.  Then restart Tcl and cd
  430. Xto the "tests" directory (extended/tests).  Now do another
  431. X"source all" command.
  432. X
  433. XOnce all of the tests have been passed, your build of Tcl has
  434. Xbeen validated as much as possible, and you are ready to beging
  435. Xwriting and using Tcl programs.
  436. X
  437. XIf you're having trouble with the baseline tests, and you suspect
  438. Xthat the extensions might be involved, you can build a special
  439. Xminimal version of baseline Tcl by cd'ing to the tcl6.1
  440. Xdirectory and doing a "make tclTest".  You can then invoke
  441. X"tclTest", where you should be greeted by a "%" prompt.  Next,
  442. Xcd to the tests directory and do a "source all".
  443. X
  444. XNote that the baseline tests turn off tcl's ability to autoload
  445. Xprocedures from the Tcl source library, so after running the
  446. Xtests, you should usually exit Tcl and restart it.
  447. X
  448. X
  449. XINSTALLING EXTENDED TCL
  450. X=======================
  451. X
  452. XTo install Extended Tcl, edit the extended/Makefile installation configuration
  453. Xsection to match your preferences. Read the information in the Makefile 
  454. Xcarefully before configuring it. Cd to the extended directory and do a
  455. X"make install".  
  456. X
  457. X
  458. XMAKING EXECUTABLE TCL SCRIPTS
  459. X=============================
  460. X
  461. XIt is common to want to write Tcl scripts, put them in a directory
  462. Xalong your search path, and execute them just like you do with
  463. Xshell scripts.
  464. X
  465. XOn systems that support the "#!" convention, you can put a
  466. X
  467. X#!/usr/local/bin/tcl
  468. X
  469. Xas the first line of your script, and executing the script will
  470. Xautomatically invoke tcl to process it.  Of course if you install
  471. XTcl somewhere else, you'll use a different path.
  472. X
  473. XFor systems that don't support this convention (most System V
  474. Xsystems, for example), it is probably best to create a shell
  475. Xscript that does something like:
  476. X
  477. Xexec tcl commandfile.tcl
  478. X
  479. X
  480. XPACKAGE LIBRARIES
  481. X=================
  482. X
  483. XPackage Libraries are a Tcl source code management tool included in
  484. Xthis release.  Package libraries allow you to group Tcl procedures
  485. Xinto logical bundles and create single files, libraries, that contain
  486. Xmultiple packages.  The package code provides a low-overhead means of
  487. Xautomatically demand-loading a package on the first attempt to execute
  488. Xone of the procedures defined within it.  As such, package libraries
  489. Xprovide a mechanism to accomodate the creation of Tcl applications and
  490. Xlibraries of a substantial size.
  491. X
  492. XPackage iibraries are documented in detail in extended/man/TclShell.man.
  493. X
  494. X
  495. XSUPPORT FOR EXTENDED TCL
  496. X========================
  497. X
  498. XWe are committed to providing continuing support for Extended Tcl.
  499. XPlease send questions, bug reports, and bug fixes to
  500. Xtcl-project@NeoSoft.com (uupsi!sugar!tcl-project).
  501. X
  502. XIf you are unable to send electronic mail, please send surface
  503. Xmail to:
  504. X
  505. X        NeoSoft
  506. X        Attention: TCL Project
  507. X        3918 Panorama
  508. X        Missouri City, TX  77459
  509. X        USA
  510. X
  511. XOr leave a note on our BBS at (713) 684-5900
  512. X
  513. X
  514. XSEND US YOUR LIBRARY ROUTINES
  515. X=============================
  516. X
  517. XIf you write a useful Tcl procedure and would like to share it with
  518. Xeveryone, send us a copy and we'll include it in the Tcl library!
  519. X
  520. X
  521. XCAVEATS
  522. X=======
  523. X
  524. XAlthough Tcl compiles and executes the tests properly on Intel/Bell
  525. XTech System V/3.2.0, SCO Unix System V/3.2.2, Xenix System V/386
  526. Xand SunOS, it has not had much use under Xenix System V/386 or SunOS.
  527. X
  528. XPrevious versions of Extended Tcl have also run under Berkeley BSD,
  529. XHP-UX and Xenix/286.  This release, however, has not been tested
  530. Xon these machines, although there is configuration information in
  531. Xthe makefile for BSD and HP-UX, and Extended Tcl should come up
  532. Xfairly easily on these machines.
  533. X
  534. XInstallation, performed by doing a "make install" in the "extended"
  535. Xdirectory, has not be heavily tested, either.
  536. X
  537. XDo not create any set-user-id versions of Tcl yet.  There are holes in
  538. Xthe startup sequence involving shell variables and default files that need
  539. Xto be plugged first.
  540. X
  541. X
  542. XMAILING LISTS AND NEWSGROUPS FOR TCL
  543. X====================================
  544. X
  545. XThere are two mailing lists dedicated to Tcl.  To subscribe to a
  546. Xmailing list about Tcl and the Tk toolkit, send mail to
  547. Xtcl-request@sprite.berkeley.edu.  To subscribe to a mailing list about
  548. XExtended Tcl, send mail to tcl-users-request@NeoSoft.com.
  549. X
  550. XAs of the time of this writing (Nov 8th, '91), the discussion period
  551. Xhas nearly completed and a call for votes is about to be issued for a
  552. Xnew Usenet newsgroup, comp.lang.tcl.  Unless serious opposition occurs
  553. X(and this isn't anticipated), the newsgroup should be created around
  554. Xthe middle of December.  It is expected that, should the newsgroup be
  555. Xcreated, discussion will shift from the mailing lists to the
  556. Xnewsgroup.  The newsgroup will be gatewayed to a mailing list for
  557. Xthose unable to receive the newsgroup.
  558. X
  559. X
  560. XACKNOWLEDGEMENTS
  561. X================
  562. X
  563. XWe'd like to thank John Ousterhout for challenging and thrilling us
  564. Xwith the creation and release of Tcl, and his close support and
  565. Xinteraction the last seven months as we all worked toward this major
  566. Xnew release.
  567. X
  568. XThanks also to everyone who acquired Tcl and Extended Tcl from the net
  569. Xand gave us feedback in terms of bug fixes, suggested enhancements and
  570. Xaccolades.  It's very energizing to know that something you've worked
  571. Xon is being used.
  572. X
  573. XMark and Karl would like to thank all their friends for being their
  574. Xfriends.  The check is in the mail.
  575. X
  576. X
  577. XWHERE TO GET IT
  578. X===============
  579. X
  580. XTcl 6.1 and Extended Tcl 6.1a were posted to the comp.sources.misc
  581. Xnewsgroup.  Any site that archives comp.sources.misc should have it.
  582. X
  583. XTcl 6.1 and Extended Tcl 6.1a can be downloaded by anonymous UUCP
  584. Xfrom Sugar Land Unix and Grizzly's Osprey.  Add one of these lines
  585. Xto your Systems file:
  586. X
  587. X    sugar Any ACU 2400 1-713-684-5900 in:--in: nuucp word: ""
  588. X    sugar Any ACU 19200 1-713-684-5928 in:--in: nuucp word: ""
  589. X
  590. X    osprey Any ACU 2400 1-408-427-1398 in:--in: nuucp word: ""
  591. X    osprey Any ACU 19200 1-408-427-1398 in:--in: nuucp word: ""
  592. X
  593. X(The second lines are for people with V.32/V.42bis or Telebit PEP-capable
  594. X modems)
  595. X
  596. XYou may also have to add one of the following lines to your Permissions
  597. Xfile:
  598. X
  599. X    LOGNAME=sugar MACHINE=osprey REQUEST=yes
  600. X    LOGNAME=osprey MACHINE=osprey REQUEST=yes
  601. X
  602. XThen enter a uucp command:
  603. X
  604. X    uucp sugar!/usr/spool/anon-uucp/tcl6.1.tar.Z your_machine!~
  605. X
  606. X...to download Tcl 6.1, and...
  607. X
  608. X    uucp sugar!/usr/spool/anon-uucp/tcl6.1Xa.tar.Z your_machine!~
  609. X
  610. X...to download Extended Tcl 6.1a.
  611. X
  612. XFor downloading from osprey:
  613. X    uucp osprey!/usr/spool/anon-uucp/tcl6.1.tar.Z your_machine!~
  614. X    uucp osprey!/usr/spool/anon-uucp/tcl6.1Xa.tar.Z your_machine!~
  615. X
  616. X
  617. XCONVERTING FROM EXTENDED TCL 4.0 TO EXTENDED TCL 6.1a
  618. X=====================================================
  619. X
  620. XHere are the things to look out for, and change:
  621. X
  622. XMost list-oriented commands now begin with "l".  Consequently, "index"
  623. Xbecomes "lindex", "range" becomes "lrange", "empty" becomes "lempty",
  624. X"length" becomes "llength", and "sortlist" becomes "lsort".
  625. X
  626. XThe "replace" command is now "lvarpop"; a new command, "lreplace" has
  627. Xmuch of the functionality of "replace", but works on the contents of a
  628. Xlist, returning a new list, rather than working on a variable name
  629. Xcontaining a list, as lvarpop now does.
  630. X
  631. XCommand parameter ordering has been changed for "file", "split", and
  632. X"join".
  633. X
  634. XThe "chars" options to "index", "range", and so forth, have been
  635. Xremoved.  The "string" command has several new suboptions, "index",
  636. X"length" and "range" to name a few.
  637. X
  638. XThe "uppercase" and "lowercase" commands have been replaced by "string
  639. Xtoupper" and "string tolower".
  640. X
  641. XThe "trim_string", "trim_left" and "trim_right" commands have been
  642. Xreplaced by "string trim", "string trimleft" and "string trimright".
  643. X
  644. XIn Extended Tcl 4.0 the "gets" command returned "1" if the read
  645. Xsucceeded, and "0" on end of file.  Dr. Ousterhout decided, in his
  646. Ximplementation, to have "gets" return the number of bytes read, or
  647. X"-1" on end of file.  This can lead to subtle bugs in porting 
  648. XExtended Tcl 4.0 programs to 6.1a, causing while...gets loops
  649. Xto return early or to not return at all.  The change requires that 
  650. Xstatements along the line of "while {[gets $fp line]} {..."  be 
  651. Xmodified to read "while {[gets $fp line] >= 0} {...".
  652. X
  653. XFor developers of Tcl extensions in C, the routines "Tcl_RetError" and
  654. X"Tcl_RetUnixError" have been removed.  They were unsafe, anyway,
  655. Xbecause they rendered into a static buffer, which could result in
  656. Xoverflows which, although usually detected in software, could
  657. Xnonetheless crash Tcl in unanticipated ways.  Developers should now 
  658. Xuse the "Tcl_AppendResult" call, and return TCL_ERROR explicitly.
  659. X
  660. XFor more details on changes in Tcl 6.1, examine the file "changes" in
  661. Xthe tcl6.1 subdirectory.
  662. X
  663. X
  664. END_OF_FILE
  665. if test 24101 -ne `wc -c <'extended/README.EXTD'`; then
  666.     echo shar: \"'extended/README.EXTD'\" unpacked with wrong size!
  667. fi
  668. # end of 'extended/README.EXTD'
  669. fi
  670. if test -f 'extended/man/TclShell.man' -a "${1}" != "-c" ; then 
  671.   echo shar: Will not clobber existing file \"'extended/man/TclShell.man'\"
  672. else
  673. echo shar: Extracting \"'extended/man/TclShell.man'\" \(20766 characters\)
  674. sed "s/^X//" >'extended/man/TclShell.man' <<'END_OF_FILE'
  675. X.TH TCLSHELL TCL "" "Tcl"
  676. X.ad b
  677. X'@index: tclshell
  678. X.SH NAME
  679. XTcl - Tcl interactive shell.
  680. X.SH SYNOPSIS
  681. X.br
  682. X.B tcl [-q] [[-f] \fIscript\fB]|[-c \fIcommand\fB] [\fIargs\fR]
  683. X
  684. X.SH DESCRIPTION
  685. X.PP
  686. X'@help: tclshell/intro
  687. X'@brief: Introduction to the tcl shell.
  688. X.B tcl [-q] [[-f] \fIscript\fB]|[-c \fIcommand\fB] [\fIargs\fR]
  689. X.PP
  690. X\fBTcl\fR starts the interactive Tcl command interpreter.  The Tcl shell
  691. Xprovides an environment for writing, debugging and executing Tcl scripts.  The
  692. Xfunctionality of the Tcl shell can also be obtained in any Tcl-based
  693. Xapplication.
  694. X.PP
  695. XThe \fBtcl\fR command, issued without any arguments,
  696. Xinvokes an interactive Tcl shell.
  697. XIf \fIscript\fR is specified, then the script is executed noninteractively
  698. Xwith \fIargs\fR being supplied in the Tcl variable `\fBargv\fR'.  If 
  699. X\fIcommand\fR is supplied, then this command (or series of commands, 
  700. Xseparated by `;') is executed, with `\fBargv\fR' containing \fIargs\fR.
  701. X.P
  702. XThe Tcl shell is intended as an environment for Tcl program development and
  703. Xexecution.  While it is not a full-featured interactive shell, it provides a
  704. Xcomfortable environment for the interactive development of Tcl code.  Note
  705. Xthat the package library code described here overrides the \fBunknown\fR
  706. Xcommand provided as part of the standard Berkeley Tcl library facility,
  707. Xalthough Tcl source libraries coded to that standard can be loaded and used by
  708. XExtended Tcl.
  709. X'@endhelp
  710. X'
  711. X.SH "INITIALIZATION SEQUENCE"
  712. X'@help: tclshell/initialize
  713. X'@brief: Tcl shell initialization sequence.
  714. X.PP
  715. XThe standard Tcl shell initialization consists of the following steps:
  716. X.IP
  717. XSearch for a default file.  The default file is a Tcl script that is executed
  718. Xto set important Tcl variables that govern startup, such as \fBTCLPATH\fR.
  719. XThe Tcl default file is searched for using the following
  720. Xalgorithm:  The current Extended Tcl version, represented by $ver, is included
  721. Xin the default file naming to allow multiple Tcl versions to exists on a
  722. Xsystem.  Note that the Extended Tcl version is the standard Tcl version number
  723. Xwith an alphabetic character added to indicated the version of Extended Tcl.
  724. XThe \fBinfox version\fR command will return this version number.
  725. X.sp
  726. X.RS 10
  727. X- An environment variable, \fBTCLDEFAULT\fR, is checked for.  If present,
  728. Xit is used as the name of the
  729. Xdefault file.
  730. X.sp
  731. X- A file, \fBTCLDEFAULT\fR, is looked for in the current directory.
  732. X.sp
  733. X- A global default file with is usually either \fB/etc/default/tcl$ver\fR or
  734. X\fB/usr/local/lib/tcldefault$ver\fR.  (Tcl may be compiled to use a different
  735. Xdirectory on some systems).
  736. X.RE
  737. X.IP
  738. XFirst, \fBTcl\fR executes the default file.  This file normally sets at 
  739. Xleast two Tcl variables:
  740. X\fBTCLPATH\fR, which contains a list of directories that contain tcl source
  741. Xfiles, and \fBTCLINIT\fR, the
  742. Xfull pathname of the Tcl source file that performs Tcl initialization.
  743. XOther site-specific variables may also be set in
  744. Xthis file.
  745. X.IP
  746. XNext, \fBtcl\fR executes the initialization file specified by the Tcl 
  747. Xvariable \fBTCLINIT\fR.
  748. XThis is normally the \fBTclInit.Tcl\fR file distributed with Tcl.  This
  749. Xfile defines the Tcl environment, including standard Tcl procs and variables.
  750. X'@endhelp
  751. X'
  752. X.SH FLAGS
  753. X'@help: tclshell/flags
  754. X'@brief: Tcl shell command line flags.
  755. X.TP
  756. X.B \-q
  757. XQuick initialization flag.  If this flag is set the only initialization step
  758. Xperformed is to locate the Tcl default file and save its name in the Tcl
  759. Xvariable TCLDEFAULT.  The file is not evaluated nor is the TclInit.tcl file.
  760. XThis provides for a faster start up, but does not make any of the standard
  761. XTcl procedures and facilities available.
  762. X.TP
  763. X.B \-f
  764. XTake the next argument as a Tcl script to source rather than enter interactive
  765. Xmode.  The \fB-f\fR flag is optional.  Normally the first argument that does
  766. Xnot start with a `-' is taken as the script to execute unless the `-c' option
  767. Xis specified.  All following arguments are passed to the script in \fBargv\fR,
  768. Xthus any other Tcl shell flags must precede this option.
  769. X.TP
  770. X.B \-c
  771. XTake the next argument as a Tcl command to execute.  It may be series of 
  772. Xcommands to execute, separated by `;'.  All following arguments are passed in
  773. X\fBargv\fR, thus any other Tcl shell flags must precede this option.
  774. X.TP
  775. X.B \-\-
  776. XMark the end of the arguments to the Tcl shell. All arguments following this
  777. Xare passed in the Tcl variable \fBargv\fR.  This is useful to pass arguments
  778. Xwithout attempting to execute a Tcl script.
  779. X'@endhelp
  780. X'
  781. X.SH "TCLINIT FILE"
  782. X'@help: tclshell/tclinit
  783. X'@brief: Tcl shell initialization file.
  784. X.PP
  785. XThe Tcl initialization file, normally \fITclInit.tcl\fR in the main Tcl script
  786. Xdirectory, initializes the Tcl shell.  It defines various Tcl procedures
  787. Xthat are required to implement loading of Tcl source from libraries via the
  788. Xpackage libraries and autoload facilities.  
  789. X.PP
  790. XIf the Tcl is invoked interactively, it will source a \fI.tclrc\fR in the
  791. Xuser's home directory, if it exists.  Tcl is viewed primarly as a programming
  792. Xlanguage, not an interactive shell, so the \fI.tclrc\fR is intended for use for
  793. Xloading development utilities, not to support programs, which should not rely
  794. Xon the user's environment.
  795. X'
  796. X'@endhelp
  797. X'
  798. X.SH VARIABLES
  799. X'@help: tclshell/variables
  800. X'@brief: Tcl shell variables.
  801. X.PP
  802. XThe following variables are set and/or used by the Tcl shell.
  803. X.TP
  804. X.B argv
  805. XA list containing the arguments passed in from the command line, excluding
  806. Xarguments used by the Tcl shell.  The first element is the first passed
  807. Xargument, not the program name.
  808. X.TP
  809. X.B interactiveSession
  810. XSet to \fB1\fR if Tcl shell is invoked interactively, or \fB0\fR if the
  811. XTcl shell is directly
  812. Xexecuting a script.
  813. X.TP
  814. X.B noAutoExec
  815. XIf this variable exists and has a value of \fB1\fR, then the Tcl shell will not
  816. Xattempt to exec an non-existent command as a shell command.
  817. X.TP
  818. X.B programName
  819. XThe name that the Tcl shell is executing as.  All directory
  820. Xcomponents are removed from the program name.
  821. X.TP
  822. X.B scriptName
  823. XThe name of the script that the Tcl shell is executing if the script was
  824. Xinvoked on the command line.
  825. X.TP
  826. X.B TCLDEFAULT
  827. XName of the default file that was used to locate all other files used by the
  828. XTcl shell.
  829. X.TP
  830. X.B TCLENV
  831. XArray that contains information used internally by various Tcl procedures that
  832. Xare part of the Tcl shell.
  833. X.TP
  834. X.B TCLENV(topLevelPromptHook)
  835. XContains code to run to generate the prompt used when interactively prompting
  836. Xfor commands.  The code in this hook will be evaluated and the result will be
  837. Xused for the prompt.
  838. X.TP
  839. X.B TCLENV(downLevelPromptHook)
  840. XContains code to run to generate the prompt used when interactively prompting
  841. Xfor continuation of an incomplete command.  The code in this hook
  842. Xwill be evaluated and the result will be used for the prompt
  843. X.TP
  844. X.B TCLINIT
  845. XThe name of the file that initializes, and does startup processing of,
  846. XTcl.
  847. X.TP
  848. X.B TCLPATH
  849. XPath to search to locate Tcl scripts.  Used by the \fBload\fR and 
  850. X\fBdemand_load\fR procedures.
  851. X'@endhelp
  852. X'
  853. X.SH "HELP FACILITY"
  854. X'@help: help
  855. X'@brief: Tcl shell help facility.
  856. X.PP
  857. XThe help facility allows for display of help files extracted from
  858. Xthe standard Tcl manual pages and Tcl scripts.  Help files are structured in a
  859. Xmultilevel directory tree of subjects and help files.  The
  860. Xfollowing commands and options are provided with the help package:
  861. X.TP
  862. X.B help
  863. X.br
  864. XHelp, without arguments, lists of all the top-level help subject
  865. Xdirectories and files.
  866. X.TP
  867. X.B help \fIsubjectdir\fR
  868. XDisplays all of help files and lower level subject files (if any exist) under
  869. Xthe directory \fIsubjectdir\fR.
  870. X.TP
  871. X.B help \fIsubjectdir/helpfile\fR
  872. XDisplay the specified help file.  The help output is passed through a simple
  873. Xpager if output exceeds 23 lines, pausing waiting for a return to be entered.
  874. XIf any other character is entered, the output is terminated.
  875. X.TP
  876. X.B helpcd [\fIsubjectdir\fR]
  877. XChange the current subject directory, which is much like the Unix current
  878. Xdirectory.  This directory can be changed with the \fBhelpcd\fR command.  If
  879. X\fIsubjectdir\fR is not specified, return to the top-level of the help tree.
  880. XHelp path names may also include ``..'' elements.
  881. X.TP
  882. X.B helppwd
  883. XDisplays the current help subject directory.
  884. X.TP
  885. X.B help help | ?
  886. XDisplays help on the help facility at any directory level.
  887. X.TP
  888. X.B apropos \fIpattern\fR
  889. XThis command locates subjects by searching their one-line descriptions for a
  890. Xpattern.  \fRApropos\fR is useful when you can remember part of the name or
  891. Xdescription of a command, and want to search through the one-line summaries
  892. Xfor matching lines.  Full regular expressions may be specified (see 
  893. Xthe \fBregexp\fR command).
  894. X'@endhelp
  895. X'
  896. X.SH "COMMAND RESULTS"
  897. X'@help: tclshell/results
  898. X'@brief: Tcl shell command result processsing.
  899. X.PP
  900. XThe string result of a command typed at the Tcl shell command prompt is
  901. Xnormally echoed back to the user.  If an error occurs, then the string result
  902. Xis displayed, along with the error message.  The error message will be
  903. Xpreceded by the string ``Error:''.
  904. X.PP
  905. XThe \fBset\fR command is a special case.  If the command is called to set
  906. Xa variable (i.e. with two arguments), then the result will not be echoed.
  907. XIf only one argument, the name of a variable, is supplied to \fBset\fR, then
  908. Xthe result will be echoed.
  909. X'@endhelp
  910. X'
  911. X.SH "EXECUTION OF UNIX COMMANDS"
  912. X'@help: tclshell/unixcommands
  913. X'@brief: Tcl shell Unix command execution.
  914. X.PP
  915. XIf an unknown Tcl command is entered from the command line, then the Unix
  916. Xcommand path, specified in the environment variable \fBPATH\fR,
  917. Xwill be searched for a command of the same name.
  918. XIf found, the command will be executed.
  919. XThis feature is provided to enhance the interactive environment for developing
  920. XTcl scripts. This is only supported from the command line, not in script files
  921. Xor in procedures, to eliminate confusion.  The \fBexec\fR or \fBsystem\fR 
  922. Xcommand should be used to run Unix commands inside scripts.
  923. X'@endhelp
  924. X'
  925. X.SH "TCL SHELL PROCEDURES"
  926. X.PP
  927. XThe follow additional procedures are defined by the Tcl shell and may be 
  928. Xgenerally useful:
  929. X.TP
  930. X'@help: tclshell/load
  931. X'@brief: Search the TCLPATH for a file to source.
  932. X.B load \fIfile\fR
  933. XSource a file, as with the source command, except search the TCLPATH for
  934. Xthe file.
  935. X'@endhelp
  936. X.TP
  937. X'@help: tclshell/utilprocs
  938. X'@brief: Search a path list for a file.
  939. X.B searchpath \fIpath file\fR
  940. XSearch all directories in the specified path, which is a Tcl list, for the
  941. Xspecified file.  Returns the full path name of the file, or an empty string
  942. Xif the file is not found.
  943. X'@endhelp
  944. X'
  945. X.SH AUTOLOAD
  946. X'@help: tclshell/autoload
  947. X'@brief: Autoloading of commands.
  948. X.PP
  949. X.B autoload \fIfile proc1\fR [..\fIprocN\fR]
  950. X.sp
  951. XThe \fIautoload\fR procedure, defined in \fBTclInit.tcl\fR, allows the Tcl
  952. Xprogrammer to name one or more procedures and the file they are defined in.
  953. XAfter \fIautoload\fR has been executed to inform Tcl of the presence of them,
  954. Xa subsequent attempt to execute one of the procedures will cause the
  955. Xcorresponding file to be loaded transparently prior to executing the function.
  956. XFor example, executing:
  957. X.IP
  958. Xautoload showproc.tcl showproc showprocs
  959. X.PP
  960. Xtells Tcl to automatically load the file \fBshowproc.tcl\fR the first time
  961. Xin the current session that either \fIshowproc\fR or \fIshowprocs\fR is
  962. Xexecuted.
  963. X'@endhelp
  964. X'
  965. X'@help: tclshell/packagelib
  966. X'@brief: Tcl shell package libraries.
  967. X.SH "PACKAGE LIBRARIES
  968. X.PP
  969. XPackage libraries work like \fIautoload\fR, except that a package library file
  970. Xcan contain multiple independent Tcl packages.  A package is a collection
  971. Xof related Tcl procedures.
  972. X.PP
  973. XThe package library file is just a regular Unix text file, editable with your
  974. Xfavorite text editor, containing packages of Tcl source code. The package
  975. Xlibrary must end in \fB.tlib\fR, an index file with the suffix \fB.tndx\fR
  976. Xwill be built corresponding to the package library.  The start of a package
  977. Xis delimited by:
  978. X.IP
  979. X.B #@package: \fIpackage_name proc1\fR [\fI..procN\fR]
  980. X.PP
  981. XThese lines must start in column one.
  982. XEverything between the \fBpackage\fR keyword and
  983. Xthe next \fBpackage\fR keyword, or the end of the file,
  984. Xbecomes part of the named
  985. Xpackage. The specified procedures, \fIproc1..procN\fR, are the entry points
  986. Xof the package.  When a command named in a package command is executed and 
  987. Xdetected as an unknown command, all code in the specified package will be 
  988. Xsourced.  This
  989. Xpackage should define all of the procedures named on the package line, define 
  990. Xany support procedures required by the package and do any package-specific 
  991. Xinitialization.
  992. X.PP
  993. XFor example, in a package source file, the presence of the following line:
  994. X.IP
  995. X\fB#@package: directory_stack pushd popd dirs\fR
  996. X.PP
  997. Xsays that the text lines following that line in the package file up
  998. Xto the next \fIpackage\fR line or the end of the file is a package named
  999. X\fBdirectory_stack\fR and that an attempt to execute either \fIpushd\fR,
  1000. X\fIpopd\fR or \fIdirs\fR when the routine is not already defined will cause 
  1001. Xthe \fBdirectory_stack\fR portion of the package file to be loaded.
  1002. X'
  1003. X.SH PACKAGE INDEX FILES
  1004. X.PP
  1005. XA package library file has associated with it an index file 
  1006. Xcalled a \fB.tndx\fR file.  The \fB.tndx\fR file contains the names
  1007. Xof the packages in the \fB.tlib\fR file, their addresses and lengths
  1008. Xwithin the \fB.tlib\fR file and the functions that are to cause the
  1009. Xdifferent packages to be autoloaded when an attempt is made to execute
  1010. Xthem.
  1011. X.PP
  1012. XThe first time Tcl tries to execute a procedure where the procedure doesn't
  1013. Xexist and isn't an autoload, Tcl will search along \fBTCLPATH\fR looking
  1014. Xfor any files ending in \fB.tlib\fR.  For each one it finds, it checks
  1015. Xto see if there is a corresponding file in the same directory ending
  1016. Xin \fB.tndx\fR.  If the \fB.tndx\fR file doesn't exist, or if its date
  1017. Xof last modification is older than that of the \fB.tlib\fR file,
  1018. Xthe \fB.tndx\fR is automatically (re)generated if possible.  If Tcl can't
  1019. Xregenerate the file (most likely due to file or directory permission
  1020. Xproblems), an error occurs.
  1021. X.PP
  1022. XDemand loading is also supported from indexes build by the \fBmkindex.tcl\fR
  1023. Xprogram, supplied with standard Tcl.  However, \fBinit.tcl\fR
  1024. Xis not loaded.  Note that the \fBinfo library\fR command is not used to locate
  1025. Xlibraries by this shell; the \fBTCLPATH\fR variable is set by the default file
  1026. Xand is used to locate the libraries.
  1027. X'@endhelp
  1028. X'
  1029. X.SH "PACKAGE MANAGEMENT COMMANDS"
  1030. X.PP
  1031. XSeveral commands are available for building and managing package libraries.
  1032. XIf you are not building package libraries and are using the standard Tcl
  1033. Xinitialization file, they are all transparent.  These commands are either
  1034. Xdefined or autoloaded by \fBTclInit.tcl\fR.
  1035. X.TP
  1036. X'@help: tclshell/autoprocs
  1037. X'@brief: List names of autload and package library procs.
  1038. X.B autoprocs
  1039. XLists the names of all known autoload and package library procedures.
  1040. X'@endhelp
  1041. X.TP
  1042. X'@help: tclshell/buildpackageindex
  1043. X'@brief: Build an index to a package library.
  1044. X.B buildpackageindex \fIlibfile\fR
  1045. XBuild an index for a package library.  The the \fIlibfile\fR name must end with
  1046. Xthe suffix \fB.tlib\fR.
  1047. X'@endhelp
  1048. X.TP
  1049. X'@help: tclshell/demand_load
  1050. X'@brief: Force an autoload proc or a package to be loaded.
  1051. X.B demand_load \fIprocname\fR
  1052. XAttempt to load the specified procedure, either as an autoload function or by
  1053. Xloading the package containing the procedure.  If the package indexes have not
  1054. Xbeen loaded for all package libraries in \fBTCLPATH\fR, they will be loaded.
  1055. XOut-of-date library indexes will be rebuilt if they are writable.  The
  1056. Xprocedure returns \fB1\fR if the procedure was sucessfully
  1057. Xloaded, or \fB0\fR if it was
  1058. Xnot.
  1059. X'@endhelp
  1060. X.TP
  1061. X'@help: tclshell/loadlibindex
  1062. X'@brief: Load the index of a package library
  1063. X.B loadlibindex \fIlibfile\fR
  1064. XLoad the package library index of the library file \fBlibfile\fR (which must
  1065. Xhave the suffix \fI.tlib\fR).  Package library indexes along the \fBTCLPATH\fR
  1066. Xare loaded automatically on the first demand_load; this command is provided to
  1067. Xexplicitly load libraries that are not in the path.  If the index file (with
  1068. Xa \fI.tndx\fR suffix)
  1069. Xdoes not exists or is out of date, it will be rebuilt if the user has
  1070. Xdirectory permissions to create it.
  1071. X'@endhelp
  1072. X.TP
  1073. X'@help: tclshell/packages
  1074. X'@brief: List all known packages.
  1075. X.B packages
  1076. XReturns a list of the names of all known packages.
  1077. X'@endhelp
  1078. X.TP
  1079. X'
  1080. X.SH "TCL SHELL INTERNAL STRUCTURE"
  1081. X.PP
  1082. XThis section discusses the internal structure of the standard Tcl
  1083. Xinitialization file and the facilities it implements.  This is intended
  1084. Xprimarily for developers who want to customize these facilities for their
  1085. Xapplications.
  1086. X'
  1087. X.SS "Autoload and Package Library Structures"
  1088. X.PP
  1089. XThe package library index consists of an entry for each package in the library,
  1090. Xwhere each entry
  1091. Xis a call to the \fBTCLSH:defpkg\fR procedure.  Loading of the package
  1092. Xindex is done with the \fBsource\fR command.
  1093. XThe \fIdefpackage\fR routine initializes elements of
  1094. Xthe \fBTCLENV\fR array which are used by \fBdemand_load\fR to locate and load
  1095. Xa package.  The \fBbuildpackageindex\fR procedure is contained in
  1096. X\fBpackages.tcl\fR.
  1097. X'
  1098. X.PP
  1099. XThe following elements of the \fBTCLENV\fR are used to implement the autoload
  1100. Xand package library facility.
  1101. X.TP
  1102. X\fBTCLENV(PROC:\fIprocName\fB)\fR
  1103. XEach procedure that is to be loaded by the \fBdemand_load\fR command has an
  1104. Xentry in this
  1105. Xarray, indexed by the concatenation of `PROC:' with the procedure name.
  1106. XIf the entry is for a package, it is a list consisting `P' followed by the
  1107. Xname of the package.  The package name must be looked up in the TCLENV array
  1108. Xto find the actual library file.  If the entry is for an autoload procedure,
  1109. Xit is a list consisting of 'F' followed by the name of the file to load.
  1110. X.TP
  1111. X\fBTCLENV(PKG:\fIpackageName\fB)\fR
  1112. XEach package has an entry in the array indexed by the concatenation of
  1113. X`PKG:' and the name of the package.  The entry is a list containing the
  1114. Xfull path to the library file, the byte offset in the file of the start of the
  1115. Xpackage, and the length of the package.
  1116. X.TP
  1117. X\fBTCLENV(packageIndexesLoaded)\fR
  1118. XA boolean that indicates if the package indexes have been loaded.  They will
  1119. Xnot be loaded until the first call to \fBdemand_load\fR.
  1120. X.TP
  1121. X\fBTCLENV(inUnknown)\fR
  1122. XIndicates if the \fBunknown\fR command is currently being executed.
  1123. XIt is used
  1124. Xto detect recursion in situations where an unknown command is found
  1125. Xduring unknown command processing.
  1126. X'
  1127. X.PP
  1128. XThe following procedures are used to implement the internals of the autoload
  1129. Xand package library facility, and are defined by \fBTclInit.tcl\fR:
  1130. X.TP
  1131. X\fBTCLSH:defpkg\fR \fIpkgname libfile offset len proc1\fR [..\fIprocN\fR]
  1132. XDefine a package for the current interpreter.  \fIPkgname\fR is the name
  1133. Xof the package to define, \fIlibfile\fR is the full path to the library file.
  1134. X\fIoffset\fR is the byte offset into the of the start of the package code;
  1135. X\fIlen\fR is the length of the package code, in bytes, and
  1136. X\fIproc1..procN\fR are the entry point procedures defined by the package.
  1137. XThis procedure is normally not called directly by the user or the
  1138. Xuser's script.  The library index files
  1139. Xconsists of calls to this procedure to define every package in a library.
  1140. X.TP
  1141. X\fBTCLSH:LoadOusterIndex dir\fR
  1142. XLoad an index file, \fIdir\fR/\fBtclIndex\fR, of the type built by John
  1143. XOusterhout's \fBmkindex.tcl\fR program (included with the standard Tcl
  1144. Xdistribution).  This style of index defines procedure names and the files that
  1145. Xcontain them.  It is a one-index-to-many-source-files structure. All of the
  1146. Xfiles pointed to by this must reside in \fIdir\fR.  The procedures in these
  1147. Xlibraries will be defined as if the autoload command had been used.
  1148. X.TP
  1149. X\fBTCLSH:LoadPackageIndexes\fR
  1150. XThis procedure searches the path defined by Tcl variable \fBTCLPATH\fR and
  1151. Xloads all of the indexes for all of the \fI.tlib\fR package libraries in the
  1152. Xpath.  If any of the indexes are older that their corresponding library file
  1153. Xor do not exist, then they will be rebuilt if the user has write access to the
  1154. Xdirectory.  Also all Ousterhout-style indexes found along the path will be
  1155. Xloaded.
  1156. X.TP
  1157. X\fBunknown\fR
  1158. XThis is the actual unknown command trap handler.  It will first do a
  1159. X\fBdemand_load\fR, loading the \fBunknown\fR command if it has been defined by
  1160. X\fBautoload\fR, or by a package library index.  The library indexes will be be
  1161. Xloaded if this is the first call to \fBunknown\fR.  If the command is not
  1162. Xfound by \fBdemand_load\fR, the Unix path (in the environment
  1163. Xvariable \fBPATH\fR,
  1164. Xwill be searched for the command.  If it is found, it will be executed via the
  1165. X\fBsystem\fR command, providing full shell (\fBsh\fR) command line expansion,
  1166. Xwith output going to standard out rather than being returned as the result of
  1167. Xthe command.  This binary path search will only occur if this is an
  1168. Xinteractive session running at the top level (i.e., not in a procedure or a
  1169. Xscript). This behavior can be disabled with the \fBnoAutoExec\fR variable.
  1170. X
  1171. END_OF_FILE
  1172. if test 20766 -ne `wc -c <'extended/man/TclShell.man'`; then
  1173.     echo shar: \"'extended/man/TclShell.man'\" unpacked with wrong size!
  1174. fi
  1175. # end of 'extended/man/TclShell.man'
  1176. fi
  1177. echo shar: End of archive 20 \(of 23\).
  1178. cp /dev/null ark20isdone
  1179. MISSING=""
  1180. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ; do
  1181.     if test ! -f ark${I}isdone ; then
  1182.     MISSING="${MISSING} ${I}"
  1183.     fi
  1184. done
  1185. if test "${MISSING}" = "" ; then
  1186.     echo You have unpacked all 23 archives.
  1187.     echo "Now cd to "extended", edit the makefile, then do a "make""
  1188.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1189. else
  1190.     echo You still need to unpack the following archives:
  1191.     echo "        " ${MISSING}
  1192. fi
  1193. ##  End of shell archive.
  1194. exit 0
  1195.  
  1196. exit 0 # Just in case...
  1197. -- 
  1198. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1199. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1200. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1201. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1202.