home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 230_01 / docs.bun < prev    next >
Text File  |  1987-05-27  |  118KB  |  3,730 lines

  1. : To unbundle, sh this file
  2. echo unbundling READ_ME 1>&2
  3. cat >READ_ME <<'End'
  4. Some of the material in this subdirectory is now out of date- having been
  5. superceded by the material in the book A Little Smalltalk, published by
  6. Addiso-Wesley.  So everybody run out and buy a copy of the book, ok?
  7.  
  8. End
  9. echo unbundling Makefile 1>&2
  10. cat >Makefile <<'End'
  11. TROFF = vtroff
  12. DITROFF = vtroff
  13. FILES = READ_ME Makefile macros books BUGS INDEX \
  14. install userman apndx1 st.1 syntax
  15.  
  16. INDEX: books
  17.     invert books
  18.  
  19. installguide:
  20.     $(TROFF) -ms install
  21.  
  22. manbody: INDEX
  23.     bib userman | tbl | $(TROFF) -ms
  24.  
  25. appendix1: apndx1 macros
  26.     tbl apndx1 | $(TROFF) -ms
  27.  
  28. appendix2:
  29.     $(TROFF) -man man
  30.  
  31. appendix3:
  32.     pic syntax | $(DITROFF) -ms
  33.  
  34. bundle: $(FILES)
  35.     bundle $(FILES) >../docs.bundle
  36.  
  37. End
  38. echo unbundling macros 1>&2
  39. cat >macros <<'End'
  40. .\" macros for producing descriptions of classes
  41. .ds CM
  42. .de Nm
  43. .ds LH
  44. .bp
  45. .Im 0 \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
  46. .ds LH class \\fB\\$\\n(.$\\fP (continued)
  47. .in 0
  48. ..
  49. .de Im
  50. .in \\$1
  51. .if 2=\\n(.$ .ft B
  52. \\$2
  53. .if 2<\\n(.$ .Im \\$1+2m \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  54. ..
  55. .de Rs  \" respondsTo:
  56. .ne 4v
  57. .IP \\fI\\$2\\fP\\h'2m-\\w'\\fI\\$2\\fI'u'\\$1 15m
  58. ..
  59. .de Ex   \" Examples
  60. .br
  61. .ne 10v
  62. .SH
  63. Examples
  64. .LP
  65. .if 0=\\n(.$ .ta 4i
  66. .el .ta \\$1
  67.      Printed result
  68. .sp
  69. .nf
  70. ..
  71. .de Sx
  72. .SH
  73. \\$1
  74. .IP
  75. ..
  76.  
  77. End
  78. echo unbundling books 1>&2
  79. cat >books <<'End'
  80. %T Smalltalk-80, The Language and It's Implementation
  81. %A Adele Goldberg
  82. %A David Robson
  83. %I Addison-Wesley
  84. %D 1983
  85. %K blue
  86.  
  87. %T Smalltalk-80 The Interactive Programming Environment
  88. %A Adele Goldberg
  89. %I Addison-Wesley
  90. %D 1984
  91. %K orange
  92.  
  93. %T Smalltalk-80 Bits of History, Words of Advice
  94. %A Glenn Krasner
  95. %I Addison-Wesley
  96. %D 1983
  97. %K green
  98. End
  99. echo unbundling BUGS 1>&2
  100. cat >BUGS <<'End'
  101. KNOWN BUGS
  102.  
  103. 1/1/85 assigning a block to a variable will usually cause memory reference
  104.     cycles, resulting in the number of increments and decrements not
  105.     being equal following execution.
  106.     (not really a bug, caused by the implementation - blocks need to
  107.     access the context, which includes the local variables, which
  108.     includes the block, which needs to access the context ... )
  109.  
  110. 1/1/85    The stack size allocated by the parser is fixed.  It should be
  111.     computed by the parser and varied for different methods.
  112.  
  113. 1/1/85  system should be modified to allow execution on system with no
  114.     ``system()'' system call (whew!).  This would involve using two
  115.     programs - a parser to take class descriptions and turn them into
  116.     internal form, and the smalltalk system.  Should be easy to do,
  117.     however.
  118.  
  119. 2/1/85    fast loading does not work on the HP9000
  120.  
  121. 4/1/85    if you modify the class Smalltalk (and thereby the pseudo variable
  122.     smalltalk) the pseudo variable does not get properly initialized.
  123.  
  124. 4/1/85    Because of bootstrapping peculiarities, a few classes (such as
  125.     Object or Symbol or String) do not respond to the message ``variables''
  126.     correctly.
  127. End
  128. echo unbundling INDEX 1>&2
  129. cat >INDEX <<'End'
  130. 1983 :books 0/122 234/101
  131. 1984 :books 123/110
  132. addiso :books 0/122 123/110 234/101
  133. adele :books 0/122 123/110
  134. advice :books 234/101
  135. bits :books 234/101
  136. blue :books 0/122
  137. david :books 0/122
  138. enviro :books 123/110
  139. glenn :books 234/101
  140. goldbe :books 0/122 123/110
  141. green :books 234/101
  142. histor :books 234/101
  143. implem :books 0/122
  144. intera :books 123/110
  145. its :books 0/122
  146. krasne :books 234/101
  147. langua :books 0/122
  148. orange :books 123/110
  149. progra :books 123/110
  150. robson :books 0/122
  151. smallt :books 0/122 123/110 234/101
  152. words :books 234/101
  153. End
  154. echo unbundling install 1>&2
  155. cat >install <<'End'
  156. .ce
  157. \fBLittle Smalltalk Installation Notes\fP
  158. .sp
  159. .NH
  160. Installation Notes
  161. .PP
  162. There are four basic steps involved in installing the Little Smalltalk
  163. system.  The four steps are; unbundling the sources, editing the sources to
  164. tailor them to the target installation, compiling the sources, and moving
  165. the final binary to the local executables directory.  Each of these four
  166. steps are described in following paragraphs and in succeeding sections.
  167. .ds RF \(DY
  168. .PP
  169. As distributed, the Little Smalltalk source consists of a small number of
  170. files in ``bundle'' format.  A shell script, \fBunbundle\fP, is provided
  171. that creates the various subdirectories used by the system and unbundles
  172. the distribution files into their component parts.  To execute this shell
  173. script, type, in a directory containing all the files in the distribution,
  174. the following command:
  175. .DS I
  176. sh unbundle
  177. .DE
  178. .LP
  179. A large amount of output should follow, indicating files have been
  180. unbundled into subdirectories /sources, /parser, /prelude, /tests, /docs
  181. and /bin.
  182. .PP
  183. There are a small number of editing changes required to tailor the system to
  184. various different environments.  Section 2 describes these changes in detail for
  185. various types of machines and operating systems.
  186. .PP
  187. Once the necessary tailoring has been performed, the system can then be
  188. compiled by typing the command:
  189. .DS I
  190. make install
  191. .DE
  192. .LP
  193. in the base directory (the original directory from which the source was
  194. unbundled).  This command will then invoke further make commands which
  195. produce the parser, the executable system, and the standard prelude.
  196. In addition various self checks for correctness are provided.  Should it be
  197. necessary, various subcomponents of the system can be individually produced
  198. by typing the ``make install'' commands in the appropriate subdirectory.
  199. These commands produce a considerable amount of output.
  200. .PP
  201. Once the system has been compiled and successfully passed all self tests,
  202. the executable file in /bin/st should be linked or moved to the appropriate
  203. location for local executables on the target system.
  204. Finally, the object files for all compilations can be removed by typing
  205. ``make clean''.
  206. .NH 1
  207. Specific Machine Installation Instructions
  208. .PP
  209. A single source form and command syntax cannot be used for all combinations of
  210. machine / operating systems, because of differences in library routine syntax
  211. or function availability.  An attempt has been made to surround the occurrences
  212. of such features with conditional compilation directives, so that by defining
  213. or not defining a symbol the correct result can be produced on different
  214. systems.  These commands have all been collected in the include file
  215. parser/env.h, so for the most part this should be the principle file needing
  216. to be edited.  In addition, ``meta-defines'' are provided for many systems to
  217. which the Little Smalltalk system has already been ported.  By defining one
  218. of these ``meta-defines'', correct values are given for the remainder of the
  219. symbols.
  220. .PP
  221. Similarly, the ``standard'' set of flags necessary to use the compiler and/or
  222. loader differ from system to system.  These are given by the two defined
  223. strings, CFLAGS and LFLAGS, in sources/Makefile and parser/Makefile.
  224. .PP
  225. As distributed, the Little Smalltalk system expects the various
  226. subdirectories to remain in the relationship in which they are unbundled.
  227. If desired, however, they can be moved (say to place the sources in one
  228. place, the libraries in another, and the binary in a third).  Each makefile
  229. may contain one of either the strings BINDIR or PARSEDIR at the beginning.
  230. If the binary or parser sources directory is moved, relative the the
  231. directory containing the makefile,
  232. these strings should be changed.  Otherwise, if the
  233. relative positions of the directories remain as they were unbundled, the
  234. default values for these strings can be used.
  235. .PP
  236. There are a few places where path specifications must be given in either
  237. the Makefiles or in C sources.  These are described in the following sections.
  238. .PP
  239. Finally, bytecodes are kept in the form of ``unsigned characters''; that is,
  240. characters containing numbers from 0-255.  These may or may not be
  241. supported on various machines.  The file parser/env.h contains a typedef
  242. for the type `uchar' and two macros for converting from unsigned characters
  243. to integers and back again.  These should be defined in such a manner that
  244. the appearance of unsigned characters is achieved, whether or not they are
  245. actually supported.  A simple test program, called uchar.c, is provided in
  246. /parser.  This program can be used to test the correctness of the macros
  247. defined in env.h.
  248. Generally, either the model of the VAX-780 or the PDP11/70 should be sufficient.
  249. .NH 2
  250. Bringing Little Smalltalk Up on a New System
  251. .PP
  252. If the system you are attempting to port to is not one of the systems described
  253. in the following sections, a certain amount of experimentation will probably be
  254. necessary to successfully install the system.  This section will describe some
  255. of the major changes required; what other changes may be necessary is
  256. generally unpredictable.
  257. .PP
  258. The strings CFLAGS and LFLAGS in sources/Makefile and parser/Makefile should
  259. be set to the appropriate values for ``normal'' compiles and loads of
  260. C programs.
  261. .PP
  262. The file prelude/Makefile contains a hard path in the string PREPATH.
  263. This should be set to the path to the prelude directory.
  264. .PP
  265. The file parser/env.h contains various hard paths, which are described in
  266. that file.  Also in that file, the following symbols should be defined or
  267. left undefined, depending upon the availability of various features.
  268. .IP CURSES 1i
  269. This symbol should be defined if it is desired to provide the simple ascii
  270. graphics given by the curses and termcap packages.  See section on
  271. graphics below.
  272. .IP ENVSAVE 1i
  273. This symbol should be defined if it is necessary to save the value of the
  274. global varible \fIenviron\fP during a fastload.
  275. This is necessary on the 11/70, IBM PC, possibly other machines.
  276. .IP FACTMAX 1i
  277. This symbol should be defined to be the largest integer for which the factorial
  278. can be computed by repeated multiplication without overflow.
  279. This value is generally 12 for 32 bit machines and 8 for 16 bit machines.
  280. .IP FASTDEFAULT 1i
  281. This symbol should be defined if the default behavior of the system should
  282. be to perform a fast load on the standard prelude (see section 3).
  283. .IP FLUSHREQ 1i
  284. If defined a fflush() is given after every call to printf.
  285. .IP GAMMA 1i
  286. This symbol should be defined if the gamma() function is part of the standard
  287. math library, left undefined otherwise.
  288. .IP INLINE 1i
  289. This symbol should be defined if in-line code is desired for object increments
  290. and decrements.  In line code is generally slightly faster, although the code
  291. size is slightly larger.  If this symbol is not defined subroutine calls
  292. will be generated for object increments and decrements.
  293. .IP NOSYSTEM 1i
  294. This symbol should be defined on non-unix systems for which the
  295. ``system()'' call is not supported.  As this seriously limits functionality
  296. (i.e. class descriptions cannot be modified during execution) is should not
  297. be used unless necessary.
  298. .IP OPEN3ARG 1i
  299. This symbol should be defined if Berkeley 4.2 style open
  300. statements (3 arguments)
  301. are used.  If the older, 2 argument, format is used this symbol should be left
  302. undefined.
  303. .IP PLOT3 1i
  304. This symbol should be defined if you have terminals for which the plot(3)
  305. routines can write directly to the screen, rather than requiring a
  306. postprocessing filter.  See section on graphics below.
  307. .IP SETJUMP 1i
  308. This symbol should be defined if the setjump/longjump facility is
  309. available.  This is used ONLY in the file sources/process.c to implement
  310. recovery when the user has typed an interrupt character.
  311. .IP SHORTDATA 1i
  312. If this symbol is defined various heuristics are used to reduce the data
  313. segment size, at the expense of functionality or execution speed.  Should
  314. only be defined if absolutely necessary.
  315. .IP SIGS
  316. This symbol should be defined if the signals facility is available.  This
  317. is used ONLY in the file sources/process.c to implement recovery when the
  318. user has typed an interrupt character.
  319. .PP
  320. Also in parser/env.h, defines are provided to implement the datatype
  321. ``unsigned character''.  These were described in the last section.  Generally,
  322. either following the model of the VAX-780 or the PDP11/70 should be sufficient
  323. for most machines.
  324. .NH 2
  325. Berkeley lookalikes
  326. .PP
  327. It has been reported that following the directions for Berkeley 4.2
  328. (below) is also sufficient for the following systems:
  329. .DS I
  330. Ahmdal / System V
  331. Pyramid 90x / System V
  332. Sequent Balance 8000
  333. .DE
  334. .NH 2
  335. Berkeley near-lookalikes
  336. .PP
  337. It has also been reported that following the directions for Berkeley 4.2 is
  338. sufficient for installation on the following systems, with the
  339. one change that the symbol ENVSAVE should be defined in parser/env.h.
  340. Note that on these systems, and other systems sharing the same
  341. characteristics, the only indication that ENVSAVE should be defined will be
  342. an obscure error message (usually ``-f: is not an identifier'') produced by the
  343. shell if an attempt is made to load a class description following a
  344. fast-load.
  345. .DS I
  346. Plexus P/35
  347. Tektronix 6130 (presumably other Tek 61xx and 62xx machines).
  348. .DE
  349. .NH 2
  350. AT&T 3B2, System V
  351. .PP
  352. The 3B2 does not have floating point hardware, and thus requires floating
  353. point simulation software being linked in.  This is accomplished by adding
  354. ``\-f'' to CFLAGS \fIand\fP LFALGS in the makefiles in /sources and
  355. /parser.  Other than for this change, the instructions for Berkeley 4.2 can
  356. be used for the installation.
  357. .NH 2
  358. Dec Professional 350
  359. .PP
  360. In parser/Makefile the strings CFLAGS and LFLAGS should be left blank.
  361. In sources/Makefile, however, the string CFLAGS should be defined to be ``\-m'',
  362. to indicate the use of the code-mapping feature.  The normal construction rule
  363. for the executable file st should be commented out, and the more complicated
  364. loader instruction inserted in its place.  The appropriate rule is given in
  365. a comment in the Makefile.
  366. .PP
  367. The string PREPATH in prelude/Makefile should be defined to be the path to
  368. the prelude directory (this can be discovered by typing ``pwd'' in the
  369. prelude directory).
  370. .PP
  371. In parser/env.h the ``meta-define'' DECPRO should be given, and any other
  372. meta-defines removed.
  373. Also in env.h the paths in the strings TEMPFILE, PARSER and PRELUDE should
  374. be defined.  Note that /usr/tmp is not standard on Venix systems, and /tmp
  375. should be used instead.
  376. .PP
  377. Because of the severe memory limitations on this machine, only Smalltalk
  378. programs that produce a relatively small number of objects can be executed.
  379. In fact, some of the later self tests fail with ``can't happen 1'' (out of
  380. memory space).
  381. Also, as more primitives are added to the system the size of primitive.o
  382. keeps creeping towards the magic 8K limit on object file sizes for the code
  383. mapping feature.  Eventually it may be necessary to split primitive.c into
  384. two files in order to avoid this problem.
  385. .NH 2
  386. HP 9000 / HP-UX
  387. .PP
  388. Follow the instructions for the VAX 780 / Berkeley 4.2 (below) with the
  389. exception that the meta-define should be given as HP9000 instead of BERK42.
  390. Note that in the filenames in env.h that /usr has been changed to /users,
  391. except for /usr/tmp, which hasn't (a foolish consistency is the hobgoblin
  392. of little minds).
  393. The fastsave routines have not been adapted to the HP extended memory
  394. system, and thus fastsave should not be used.
  395. .NH 2
  396. IBM PC-XT
  397. .PP
  398. It has been reported that the instructions given for the PDP 11/70 (below)
  399. are also sufficient for the IBM PC-XT running PC/IX.
  400. .NH 2
  401. PDP 11/70 (also 11/44)
  402. .PP
  403. In sources/Makefile and parser/Makefile the string CFLAGS should be left blank,
  404. however LFLAGS should be set to ``\-i'' to indicate the use of
  405. separate instruction and data spaces.
  406. .PP
  407. The string PREPATH in prelude/Makefile should be defined to be the path to
  408. the prelude directory (this can be discovered by typing ``pwd'' in the
  409. prelude directory).
  410. .PP
  411. In parser/env.h the ``meta-define'' PDP1170 should be given, and any other
  412. meta-defines removed.
  413. Also in env.h the paths in the strings TEMPFILE, PARSER and PRELUDE should
  414. be defined.
  415. .NH 2
  416. Perkin Elmer
  417. .PP
  418. The Perkin Elmer supports unsigned characters the same as the VAX, however
  419. it does not have the gamma function in the standard library.  Follow the
  420. instructions for the VAX/4.2, using the meta-define PERKELM.
  421. .NH 2
  422. RIDGE / ROS 3.0
  423. .PP
  424. Follow the instructions for the VAX 780 /Berkeley 4.2 (below),
  425. with the exception that the
  426. meta-define should be given as RIDGE instead of BERK42.
  427. The fast save feature does not work on the Ridge.
  428. .NH 2
  429. VAX 780 / Berkeley 4.2
  430. .PP
  431. In parser/Makefile and sources/Makefile the strings CFLAGS and LFLAGS should
  432. both be left blank.
  433. .PP
  434. The string PREPATH in prelude/Makefile should be defined to be the path to
  435. the prelude directory (this can be discovered by typing ``pwd'' in the
  436. prelude directory).
  437. .PP
  438. In parser/env.h the ``meta-define'' BERK42 should be given, and any other
  439. meta-defines removed.
  440. Also in env.h the paths in the strings TEMPFILE, PARSER and PRELUDE should
  441. be defined.
  442. .PP
  443. (VAX only) If the \-g flag is used the define FLUSHREQ need not be given
  444. (although it
  445. will work if it is present), otherwise FLUSHREQ should be defined in order
  446. for input and output to interleave correctly.
  447. .PP
  448. As distributed, the system does not perform a fastload (see next section)
  449. automatically.  If fastload works this can be made default by defining the
  450. symbol FASTDEFAULT.
  451. .PP
  452. These instructions appear to work also for the SUN workstation; of course,
  453. if you have a SUN workstation you can run the Xerox system.
  454. .NH
  455. Fast Loading
  456. .PP
  457. The Little Smalltalk system has the ability to save and restore a user
  458. environment by basically moving a copy of all of the users data space into
  459. a file.  Although this produces rather large files, the savings in time
  460. permitted by not having to recreate a specific environment can be
  461. substantial.  Because this is such an unusual thing to do, it is probably
  462. wise, if installing the system on a new machine/operating system, to first
  463. comment out the define for FASTDEFAULT in parser/env.h,
  464. which will install a system which will not default to doing a fast load.
  465. .PP
  466. Once such a system has been created and passed all self tests, you can
  467. experiment with fast loading by executing the st command with the argument
  468. \-f.  For test cases you can use the programs in /tests.  If it appears to
  469. be successful, then (by defining the variable FASTDEFAULT) you should
  470. regenerate the system so that the default behavior is to do a fast loading.
  471. (When regenerating the system, sources/main.c should be the only file
  472. needing to be recompiled).
  473. .PP
  474. Fastloading does not currently work on the HP-9000.
  475. It may not work on other machines as well.
  476. .NH
  477. Protections
  478. .PP
  479. The directories /sources and /parser need not be readable by casual users.
  480. The directory /prelude contains files, however, which must be loaded by
  481. the Little Smalltalk system prior to every execution.  The protection of this
  482. directory, and on the files in it, should therefore be such that all users
  483. have READ access.
  484. Although the /tests directory is only used during system installation,
  485. users may want to refer to it for examples of class descriptions and to see
  486. how various problems (8 queens, dinning philosophers) have been solved in
  487. Smalltalk.
  488. Allowing all users access to the /docs directory will permit a kind of
  489. on-line access, however users should not be allowed to modify any files in
  490. any directory.
  491. .NH
  492. Non-UNIX systems
  493. .PP
  494. Non-UNIX\s-2\u*\d\s+2
  495. .FS
  496. * UNIX is a trademark of AT&T Bell Laboratories.
  497. .FE
  498. systems which do not support multiple user processes, and thus the
  499. system() call, cannot at current run Little Smalltalk.  There are plans,
  500. however, to at some time in the future support such systems.  This section
  501. will describe, in broad terms, the changes required.  The detailed changed
  502. are, of course, at the moment not known.
  503. .PP
  504. First, the defined value NOSYSTEM must be given in parser/env.h.  This
  505. will cause all occurrences of the ``system()'' call to be commented out,
  506. and in most cases be replaced by error messages.
  507. .PP
  508. Next, the parser must be modified to place its output in a file (presumably
  509. the file given as argument with .st replaced by .p) instead of the standard
  510. output.  This is a trivial, although probably system specific, change.
  511. .PP
  512. In use, the user would then be required to ``compile'' all class
  513. descriptions by running the parser (which therefore would have to be user
  514. accessible program) before running the Little Smalltalk system.  Little
  515. Smalltalk could not be used to edit class descriptions on the fly \- the
  516. user would have to leave the system, perform the edit, and return to the
  517. system.  This would seriously limit functionality and utility, but that is
  518. cost of not running UNIX!
  519. .NH
  520. Graphics
  521. .PP
  522. The nice bit-mapped graphics display of the Smalltalk-80 system is,
  523. unfortunately, not very portable to conventional machines running
  524. conventional ascii terminals.
  525. Two mutually exclusive approaches have been furnished
  526. for providing \fBvery\fP rudimentary but
  527. nevertheless relatively device-independent graphics capabilities.
  528. .PP
  529. The first approach used the curses(3) and termlib(3) routines to provide
  530. simple ascii (character-level) graphics.
  531. To use these, define
  532. the symbol CURSES in parser/env.h, and modify the Makefile in /sourses
  533. adding the libraries -lcurses and -ltermlib (or termcap, whichever is
  534. appropriate) to the symbol LIB.
  535. .PP
  536. The functionality so provided can be described as follows:
  537. .IP clearScreen 1i
  538. This message is accepted by the pseudo-variable smalltalk and clears the
  539. screen.
  540. .IP printAt: 1i
  541. This message is accepted by instances of class String.  The argument must
  542. be a point, representing a line@column pair.  The string is printed at the
  543. point.
  544. .PP
  545. In addition, there is a class \fBForm\fP found in /prelude, which is an
  546. attempt at providing simple graphics forms.  Instances of \fBForm\fP also
  547. repond to printAt:.  A sample program plane.st can be found in /tests
  548. illustrating some of the features of forms.
  549. Refer to the Makesfiles in /prelude and /tests for more information.
  550. .PP
  551. The second approach uses the plot(3) routines.  On some terminals
  552. (the Tektronix 4014, for example) these routines can be set up to
  553. write directly to the terminal screen, rather than going through a
  554. postprocessing filter.  If such a device is available, the symbol PLOT3
  555. should be defined in parser/env.h, in addition appropriate loader commands
  556. (-l4014, for example) should be added to the symbol LIB in
  557. sources/Makefile.
  558. .PP
  559. The functionality so provided is the ability to produce lines, circles and
  560. arcs.  Various classes (Pen, PenSave and Form) for doing this are provided
  561. in the /prelude subdirectory, consult the Makefile for details.
  562. A test program (penshow) is provided in the /tests subdirectory.
  563. .NH
  564. Troubleshooting
  565. .PP
  566. Here are a few of the problems you might run into, and possible solutions:
  567. .PP
  568. The first thing to suspect if you observe strange behavior is the
  569. fastloading feature.  Try running the system with the \-m flag, which will
  570. turn off fastloading.  For example, on the 11/70 fastloading will inhibit
  571. the )i command from working correctly, but no error messages will be
  572. generated.  The appearance of a message such as ``\fIxxx\fP: is not
  573. an identifier'', or of can't happen message number 23
  574. is also a clue that fastloading does not work and should be disabled.
  575. Similarly, the appearance of the message ``no such context as:
  576. \fIxxx\fP/stdsave'' during startup is an indication that the file
  577. containing the saved binary form of the standard prelude either does not
  578. exist or is unreadable, or that the path given in parser/env.h is wrong.
  579. .PP
  580. The appearence of the message ``xxx: not an identifier'' following a fast
  581. load or a )l command may be a sign that the environment pointer is being
  582. trashed.   Try defining the symbol ENVSAVE and recreating the system.
  583. .PP
  584. Solutions to problems with fastloading are to try to
  585. to recreate the stdsave file in /prelude, or as a last resort to remove the
  586. definition for FASTDEFAULT from /parser/env.h, ``make clean''
  587. and recompile everything.
  588. This latter step will configure a system that will not attempt fastloading
  589. unless explicitly called for.
  590. .PP
  591. If the function _gamma is undefined following load for st.  Solution: remove
  592. the definition for the symbol GAMMA, ``make clean'' and recompile.
  593. .PP
  594. \&``Cant't happen number 1''.  If you are running on a machine with small
  595. memory, your program creates too many objects and runs out of memory.  If
  596. you are running on a vax or other large machine - your application is
  597. creating cycles or many many objects, probably a programming error.
  598. .PP
  599. No output appears when you start the program, and if you type control-D all
  600. the output appears.  Solution: define the symbol FLUSHREQ and recompile.
  601. .PP
  602. Can't happen number 22 - either TEMPFILE is unreadable, or
  603. /prelude/standard does not exist.
  604. .PP
  605. Systems that have trouble with long lines may have difficulty with the file
  606. syms.c in /sources (there is one line in that file over 300 characters long).
  607. If necessary, this file can (and will be) automatically reconstructed from
  608. other files in the directory.
  609. .PP
  610. Receiving error number 129 whenever any non-primitive class method is
  611. called may be a symptom of a clash of variable names.  On older systems the
  612. variables runningProcess and runningInterpreter would clash on systems that
  613. did not support long variable names.  The variable runningInterpreter (in
  614. process.c) has since been changed to presentInterpreter, so this problem
  615. should not occur in software taken from more recent distribution tapes.
  616. .PP
  617. 129 errors can also be caused by bad preludes.  Try removing all the .p
  618. files from /prelude and remaking standard.
  619. (Frequently, if you receive an error when first building the prelude, some
  620. of the .p files will be incorrect).
  621. .PP
  622. Note that /sources and /prelude have make instructions ``make clean'' which
  623. remove object files and are useful in insuring the files are in a clean
  624. state before starting a reconstruction of the system.
  625. .NH
  626. Further Distribution
  627. .PP
  628. The Little Smalltalk system is public domain, and may be distributed
  629. further as long as proper attribution is given in all published references.
  630. .PP
  631. In the interests of keeping the distribution up to date and as error free
  632. as possible, we wish to keep track of known sites using the
  633. system.  People interested in being placed on the mailing list for future
  634. bug announcements and new version announcements should contact Professor
  635. Budd, at the address listed below.  Changes, modifications, or improvements
  636. to the code or the standard library can be submitted also, and will be
  637. considered for inclusion in future distributions.
  638. .NH
  639. What to do with BUGS
  640. .PP
  641. Observed irregularities in Little Smalltalk behavior during execution
  642. (hereafter known as ``Bugs'') should be reported to:
  643. .DS I
  644. Professor Tim Budd
  645. Little Smalltalk Distribution
  646. Department of Computer Science
  647. Oregon State University
  648. Corvallis, Oregon 97331 USA
  649.  
  650. CSNET address:  budd@oregon-state.csnet
  651. UUCP  address:  budd@orstcs.uucp
  652. .DE
  653. .LP
  654. The report of the bug should indicate whether it is reproducible, and if so
  655. how it is manifested.  If it is available, a description of the fix for the
  656. bug should be given, and it will be incorporated into future distributions.
  657. Periodically, a listing of known bug fixes will be mailed to known sites.
  658. .PP
  659. The Little Smalltalk system is distributed without responsibility for the
  660. performance of the system and without any guarantee of maintenance.
  661. End
  662. echo unbundling userman 1>&2
  663. cat >userman <<'End'
  664. .ds CM
  665. .TL
  666. A Little Smalltalk
  667. User Manual
  668. .AU
  669. Timothy A. Budd
  670. .po +0.2i
  671. .nr PO +0.2i
  672. .NH 1
  673. Introduction
  674. .PP
  675. This manual is intended as an aid in using the Little Smalltalk system.
  676. It is not intended to be used as an introduction to the Smalltalk
  677. language.
  678. Little Smalltalk is largely (with exceptions listed in a later section)
  679. a subset of the Smalltalk-80\s-2\u*\d\s+2 language described
  680. .FS
  681. * Smalltalk-80 is a trademark of the Xerox Corporation.
  682. .FE
  683. in [.Smalltalk blue.].
  684. A complete description of the classes included in the Little Smalltalk system
  685. and the messages they accept is given in Appendix 1.
  686. .NH 1
  687. Running the system
  688. .PP
  689. The Little Smalltalk system is invoked by typing the command \fBst\fP.
  690. The system is interactive \- that is, the user types an expression at the
  691. keyboard and the system responds by evaluating the expression and typing
  692. the result.
  693. For example,
  694. typing the expression \fB3 + 4\fP results in the value \fB7\fP being
  695. displayed on
  696. the output.  Execution is terminated by typing control\-D.  A sample
  697. execution session is shown in Figure 1.
  698. .KF
  699. .sp
  700. .DS B
  701. % st
  702. Little Smalltalk
  703.     3 + 4
  704. 7
  705.     ^D
  706. %
  707. .DE
  708. .sp
  709. .ce
  710. \fBFigure 1:\fP A Sample Little Smalltalk Session
  711. .sp
  712. .KE
  713. .PP
  714. Instance variables for the command level can be created by
  715. assigning a value to a new variable name.  Thereafter that variable can
  716. be used at the command level, although it is not known within the scope
  717. of any method.  The variable ``last'' always contains the value
  718. returned by the last expression typed.
  719. Figure 2 shows the creation of a variable.
  720. Note that the assignment arrow is formed as a two character sequence.
  721. .KF
  722. .sp
  723. .DS B
  724. .ta 5m
  725.     newvar <\(mi 2 / 3
  726.     newvar
  727. 0.666667
  728.     2 raisedTo: newvar + (4 / 3)
  729. 4
  730.     last
  731. 4
  732. .DE
  733. .sp
  734. .ce
  735. \fBFigure 2:\fP Creating Variables
  736. .sp
  737. .KE
  738. .PP
  739. The default behavior is for the value of expressions,
  740. with the exception of assignments, to be typed
  741. automatically as they are evaluated.
  742. This behavior can be modified either by using the \-d flag
  743. (see Appendix 2), or by passing a message to the pseudo
  744. variable \fBsmalltalk\fP (see Appendix 1).
  745. .PP
  746. Class descriptions must be read in from files, they cannot be entered
  747. interactively.  Class descriptions are entered using a system directive.
  748. For example, to include a class description contained in a file named
  749. \fBnewclass.st\fP, the following system directive should be issued:
  750. .sp
  751. .ce
  752. )i newclass.st
  753. .sp
  754. A list of files containing class descriptions can also be given as
  755. arguments to the st command.  The command
  756. .DS B
  757. %st file\s-2\d1\u\s+2 ... file\s-2\dn\u\s+2
  758. .DE
  759. is equivalent to the sequence
  760. .DS B
  761. .ta 5m
  762. %st
  763. Little Smalltalk
  764.     )i file\s-2\d1\u\s+2
  765.     ...
  766.     )i file\s-2\dn\u\s+2
  767. .DE
  768. .PP
  769. A table of system directives is given in Figure 3.
  770. .KF
  771. .sp
  772. .TS
  773. center box;
  774. l lw(4.5i).
  775.  
  776. )e filename    T{
  777. Edit the named file.  The Little Smalltalk system will suspend, leaving
  778. the user in an editor for making changes to the named file.  Upon leaving
  779. the editor the named file will automatically be included, as if the )i
  780. directive had been typed.
  781. T}
  782.  
  783. )g filename    T{
  784. Search for an entry in the system library area matching the filename.
  785. If found, the class descriptions in the library entry are included.
  786. This command is useful for including commonly used classes that are not
  787. part of the standard prelude, such as classes for statistics applications
  788. or graphics.
  789. T}
  790.  
  791. )i filename    T{
  792. Include the named file.  The file must contain one or more class descriptions.
  793. The class descriptions are parsed, and if syntactically legal new
  794. instances of class \fBClass\fP are added to the Smalltalk system.
  795. T}
  796.  
  797. )l filename    T{
  798. Load a previously saved environment from the named file.
  799. The current values of all variables are overridden.
  800. The file must have been created using the )s directive (below).
  801. T}
  802.  
  803. )r filename    T{
  804. Read the named file.  The file must contain Smalltalk statements, as
  805. would be typed at the keyboard.  The effect is just as if the lines
  806. of the file had been typed at the keyboard.  The file cannot contain
  807. class descriptions.
  808. T}
  809.  
  810. )s filename    T{
  811. Save the current state in the named file.  The values of all variables
  812. are saved, and can later be reloaded using the )l directive (above).
  813. T}
  814.  
  815. )!string    T{
  816. Execute the remainder of the line following the exclamation point
  817. as a Unix\s-2\u*\d\s+2 command.  Nothing is done with the output of the command,
  818. nor is the returning status of the command recorded.
  819. T}
  820.  
  821. .TE
  822. .sp
  823. .ce
  824. \fBFigure 3:\fP System Directives
  825. .sp
  826. .KE
  827. .PP
  828. Note that the )e system directive invokes an editor on a file
  829. containing class descriptions, and then automatically includes the file
  830. when the editor is exited.
  831. Classes also respond to the message \fBedit\fP, which will have the same
  832. effect as the )e directive applied to the file containing the class
  833. description.
  834. Thus the typical debug/edit/debug cycle
  835. involves repeated uses of the )e directive or the \fBedit\fP message
  836. until a desired outcome is achieved.
  837. The editor invoked by the )e directive can be changed by setting
  838. the EDITOR variable in the users environment.
  839. .NH 1
  840. Differences between Little Smalltalk and the Smalltalk-80 system
  841. .PP
  842. This section describes the differences between the language accepted by
  843. the Little Smalltalk system and the language described in
  844. [.Smalltalk blue.].  The principal reasons for these changes are
  845. as follows:
  846. .IP size 6.5m
  847. Classes which are largely unnecessary, or which could be easily
  848. simulated by other classes (e.g. Association, SortedCollection) have
  849. been eliminated in the interest of keeping the size of the standard
  850. library as small as possible.  Similarly, indexed instance variables are
  851. not supported, since to do so would increase the size of every object in
  852. the system, and they can be easily simulated in those classes in which
  853. they are important (see below).
  854. .IP portability
  855. Classes which depend upon particular hardware (e.g. BitBlt) are not included
  856. as part of the Little Smalltalk system.  The basic system assumes nothing
  857. more than ascii terminals.
  858. .IP representation
  859. The need for a textual representation for class descriptions required some
  860. small additions to the syntax for class methods (see Appendix 3).
  861. Similarly, the fact that classes and subclasses can be separately parsed,
  862. in either order, forced some changes in the scoping rules for instance
  863. variables.
  864. .PP
  865. The following sections describe these changes in more detail.
  866. .NH 2
  867. No Browser
  868. .PP
  869. The Smalltalk-80 Programming Environment described in [.Smalltalk orange.]
  870. is not included as part of the Little Smalltalk system.  The Little
  871. Smalltalk system is designed to be little, easily portable, and to
  872. rely on nothing more than basic terminal capabilities.
  873. .NH 2
  874. Internal Representation Different
  875. .PP
  876. The internal representations of objects, including processes, interpreters,
  877. and bytecodes, is entirely different in the Little Smalltalk system from
  878. the Smalltalk-80 system described in [.Smalltalk blue.].
  879. .FS
  880. * Unix is a trademark of Bell Laboratories.
  881. .FE
  882. .NH 2
  883. Fewer Classes
  884. .PP
  885. Many of the classes described in [.Smalltalk blue.] are not included as
  886. part of the Little Smalltalk basic system.  Some of these are not
  887. necessary because of the decision not to include the editor, browser,
  888. and so on as part of the basic system.  Others are omitted in the interest
  889. of keeping the standard library of classes small.  A complete list
  890. of included classes for the Little Smalltalk system is given in Appendix 1.
  891. .NH 2
  892. No Class Protocol
  893. .PP
  894. Protocol for all classes is defined as part of class \fBClass\fP.
  895. It is not possible to redefine class protocol as part of a class description,
  896. only instance protocol.
  897. The notion of metaclasses is not supported.
  898. .NH 2
  899. Cascades Different
  900. .PP
  901. The semantics of cascades has been simplified and generalized.
  902. The result of a cascaded expression is always the result of the expression
  903. to the left of the first semicolon, which is also the receiver for each
  904. subsequent continuation.  Continuations can include multiple messages.
  905. A rather nonsensical, but illustrative, example is the following:
  906. .DS B
  907. 2 + 3 ; \(mi 7 + 3 ; * 4
  908. .DE
  909. .LP
  910. The result of this expression is 5 (the value yielded by 2 + 3).  5 is also
  911. the receiver for the message \(mi 7, and that result (\(mi2) is in turn the
  912. receiver for the message + 3.  This last result is thrown away.  5 is then
  913. again used as the receiver for the message * 4, the result of which is also
  914. thrown away.
  915. .NH 2
  916. Instance Variable Name Scope
  917. .PP
  918. In the language described in [.Smalltalk blue.], an instance variable is
  919. known not only to the class protocol in which it is declared, but is also
  920. valid in methods defined for any subclasses of that class.
  921. In the Little Smalltalk system an instance variable can be referenced only
  922. within the protocol for the class in which it is declared.
  923. .NH 2
  924. Indexed Instance Variables
  925. .PP
  926. Implicitly defined indexed instance variables are not supported.
  927. In any class for which these are desired they can be easily simulated by
  928. including an additional instance variable, containing an Array, and
  929. including the following methods:
  930. .DS B
  931. .ta 4m 8m
  932. Class Whatever
  933. | indexVars |
  934. [
  935.     new: size
  936.         indexVars <\(mi Array new: size
  937.  
  938. |    at: location
  939.         \(ua indexVars at: location
  940.  
  941. |    at: location put: value
  942.         indexVars at: location put: value
  943.  
  944.     ...
  945. .sp
  946. .DE
  947. .PP
  948. The message new: can be used with any class, with an effect similar to
  949. new.  That is, if a new instance of the class is created by sending the
  950. message new: to the class variable, the message is immediately passed
  951. on to the new instance, and the result returned is used as the result of
  952. the creation message.
  953. .NH 2
  954. No Pool Variables
  955. .PP
  956. The concepts of pool variables, global variables, or class variables are
  957. not supported.
  958. In their place there is a new pseudo-variable, \fBsmalltalk\fP, which
  959. responds to the messages \fBat:\fP and \fBat:put:\fP.
  960. The keys for this collection can be arbitrary.
  961. Although this facility is available, its use is often a sign of poor
  962. program design, and should be avoided.
  963. .NH 2
  964. No Associations
  965. .PP
  966. The class Dictionary stores keys and values separately, rather than
  967. as instances of Association.  The class Association, and all messages
  968. referring to Associations have been removed.
  969. .NH 2
  970. Generators in place of Streams
  971. .PP
  972. The notion of stream has been replaced by the slightly different notion of
  973. \fIgenerators\fP, in particular the use of the messages \fIfirst\fP
  974. and \fInext\fP in subclasses of \fBCollection\fP.
  975. External files are supported by an explicit class \fBFile\fP.
  976. .NH 2
  977. Primitives Different
  978. .PP
  979. Both the syntax and the use of primitives has been changed.
  980. Primitives provide an interface between the Smalltalk world and the
  981. underlying system, permitting the execution of operations that cannot be
  982. specified in Smalltalk.  In Little Smalltalk, primitives cannot fail and
  983. must return a value (although they may, in error situations, print an error
  984. message and return \fBnil\fP).
  985. The syntax for primitives has been altered to permit the specification of
  986. primitives with an arbitrary number of arguments.  The format for a
  987. primitive call is as follows:
  988. .DS B
  989. <primitive \fBnumber\fP \fIargumentlist\fP >
  990. .DE
  991. Where \fBnumber\fP is the number of the primitive to be executed
  992. (which must be a value between 1 and 255),
  993. and \fIargumentlist\fP is a list of Smalltalk primary expressions (see
  994. Appendix 2).  Appendix 4 lists the meanings of each of the currently
  995. recognized primitive numbers.
  996. .NH 2
  997. Byte Arrays
  998. .PP
  999. A new syntax has been created for defining an array composed entirely of
  1000. unsigned integers in the range 0-255.  These arrays are given a very
  1001. tight encoding.  The syntax is a pound sign, followed by a left square
  1002. brace, followed by a sequence of numbers in the range 0 to 255, followed by
  1003. a right square brace.
  1004. .DS B
  1005. #[ \fInumbers\fP ]
  1006. .DE
  1007. .LP
  1008. Byte Arrays are used extensively internally.
  1009. .NH 2
  1010. New Pseudo Variables
  1011. .PP
  1012. In addition to the pseudo variable \fBsmalltalk\fP already mentioned,
  1013. another pseudo variable, \fBselfProcess\fP, has beed added to the Little
  1014. Smalltalk system.  \fBselfProcess\fP returns the currently executing process,
  1015. which can then be passed as an argument to a semaphore, or
  1016. be used as a receiver for a message valid for class \fBProcess\fP.
  1017. Like \fBself\fP and \fBsuper\fP, \fBselfProcess\fP cannot be used at
  1018. the command level.
  1019. .NH 2
  1020. No Dependency
  1021. .PP
  1022. The notion of dependency, and automatic dependency updating, is not
  1023. included in Little Smalltalk.
  1024. .[]
  1025. .ds CH
  1026. .bp
  1027. .SH
  1028. .ce 2
  1029. Appendix 1
  1030. Class Descriptions
  1031. .PP
  1032. The messages accepted by the classes included in the Little Smalltalk
  1033. standard library are described in the following pages.
  1034. A list of the classes
  1035. defined, where indentation is used to imply subclassing, is given below:
  1036. .DS I
  1037. .ta 3m 6m 9m 12m 15m
  1038. Object
  1039.     UndefinedObject
  1040.     Symbol
  1041.     Boolean
  1042.         True
  1043.         False
  1044.     Magnitude    
  1045.         Char
  1046.         Number
  1047.             Integer
  1048.             Float
  1049.         Radian
  1050.         Point
  1051.     Random
  1052.     Collection
  1053.         Bag
  1054.         Set
  1055.         KeyedCollection
  1056.             Dictionary
  1057.                 Smalltalk
  1058.             File
  1059.             SequenceableCollection
  1060.                 Interval
  1061.                 LinkedList
  1062.                     Semaphore
  1063.                 File
  1064.                 ArrayedCollection
  1065.                     Array
  1066.                     ByteArray
  1067.                     String
  1068.     Block
  1069.     Class
  1070.     Process
  1071. .DE
  1072. .PP
  1073. In the descriptions of each message the following notes may occur:
  1074. .IP \fId\fP
  1075. Indicates the effect of the message differs slightly from that given
  1076. in [.Smalltalk blue.].
  1077. .IP \fIn\fP
  1078. Indicates the message is not included as part of the language defined
  1079. in [.Smalltalk blue.].
  1080. .IP \fIr\fP
  1081. Indicates the protocol for the message overrides a protocol given in
  1082. some superclass.  Only where the logical effect of this overriding is
  1083. important is the message given a second time; some messages, such as
  1084. copy, are overridden in many classes but are not described in the documentation
  1085. because the logical effect remains the same.
  1086. .bp
  1087. .SH
  1088. .ce 2
  1089. Appendix 2
  1090. Man Page
  1091. .PP
  1092. A Unix man page for the st command is given on the following page.
  1093. .bp
  1094. .SH
  1095. .ce 2
  1096. Appendix 3
  1097. Syntax Charts
  1098. .PP
  1099. Syntax charts for the language accepted by the Little Smalltalk system
  1100. are described on the following pages.
  1101. The following is an example class description:
  1102. .DS B
  1103. Class Set :Collection
  1104. | dict |
  1105. [
  1106.         new
  1107.                 dict <\(mi Dictionary new
  1108.  
  1109. |       add: newElement
  1110.                 dict at: newElement
  1111.                      ifAbsent: [dict at: newElement put: 1]
  1112.  
  1113. |       remove: oldElement ifAbsent: exceptionBlock
  1114.         dict removeKey: oldElement ifAbsent: exceptionBlock
  1115.  
  1116. |       size
  1117.                 \(ua dict size
  1118.  
  1119. |       occurrencesOf: anElement
  1120.                 \(ua dict at: anElement ifAbsent: [0]
  1121.  
  1122. |       first
  1123.                 dict first.
  1124.         \(ua dict currentKey
  1125.  
  1126. |       next
  1127.                 dict next.
  1128.         \(ua dict currentKey
  1129.  
  1130. ]
  1131. .DE
  1132. .bp
  1133. .SH
  1134. .ce 2
  1135. Appendix 4
  1136. Primitive Numbers
  1137. .PP
  1138. The following chart gives the function performed by each primitive in the
  1139. Little Smalltalk system.
  1140. .SH
  1141. Information about objects
  1142. .IP 0
  1143. (not used )
  1144. .IP 1
  1145. class of an object
  1146. .IP 2
  1147. superobject of an object
  1148. .IP 3
  1149. test if class responds to new
  1150. .IP 4
  1151. size of object
  1152. .IP 5
  1153. hash value
  1154. .IP 6
  1155. test if two built-in objects are of the same type
  1156. .IP 7
  1157. object equality testing ( == )
  1158. .IP 8
  1159. various switch toggles
  1160. .IP 9
  1161. numerical generality testing
  1162. .SH
  1163. Integer manipulation
  1164. .IP 10
  1165. integer addition (both args must be integer)
  1166. .IP 11
  1167. integer subtraction
  1168. .IP 12
  1169. integer < test
  1170. .IP 13
  1171. integer > test
  1172. .IP 14
  1173. integer \(<= test
  1174. .IP 15
  1175. integer \(>= test
  1176. .IP 16
  1177. integer = test
  1178. .IP 17
  1179. integer ~= test
  1180. .IP 18
  1181. integer multiplication
  1182. .IP 19
  1183. integer //
  1184. .SH
  1185. Bit manipulation and other integer valued functions
  1186. .IP 20
  1187. gcd:
  1188. .IP 21
  1189. bitAt:
  1190. .IP 22
  1191. bitOr:
  1192. .IP 23
  1193. bitAnd:
  1194. .IP 24
  1195. bitXor:
  1196. .IP 25
  1197. bitShift:
  1198. .IP 26
  1199. radix:
  1200. .IP 27
  1201. not used
  1202. .IP 28
  1203. integer quo:
  1204. .IP 29
  1205. integer rem:
  1206. .SH
  1207. Other integer functions
  1208. .IP 30
  1209. doPrimitive:withArguments:
  1210. .IP 31
  1211. not used
  1212. .IP 32
  1213. convert random integer to random float
  1214. .IP 33
  1215. bitInvert
  1216. .IP 34
  1217. highBit
  1218. .IP 35
  1219. randomNumber (argument is seed )
  1220. .IP 36
  1221. asCharacter
  1222. .IP 37
  1223. asString
  1224. .IP 38
  1225. factorial
  1226. .IP 39
  1227. asFloat
  1228. .SH
  1229. Character manipulation
  1230. .IP 40
  1231. not used
  1232. .IP 41.
  1233. not used
  1234. .IP 42
  1235. character < test
  1236. .IP 43
  1237. character > test
  1238. .IP 44
  1239. character \(<= test
  1240. .IP 45
  1241. character \(>= test
  1242. .IP 46
  1243. character = test
  1244. .IP 47
  1245. character ~= test
  1246. .IP 48
  1247. not used
  1248. .IP 49
  1249. not used
  1250. .SH
  1251. Character unary functions
  1252. .IP 50
  1253. digitValue
  1254. .IP 51
  1255. isVowel
  1256. .IP 52
  1257. isLetter
  1258. .IP 53
  1259. isLowerCase
  1260. .IP 54
  1261. isUpperCase
  1262. .IP 55
  1263. isSeparator
  1264. .IP 56
  1265. isAlphaNumeric
  1266. .IP 57
  1267. caseShift
  1268. .IP 58
  1269. asString
  1270. .IP 59
  1271. asciiValue
  1272. .SH
  1273. Floating point manipulation
  1274. .IP 60
  1275. floating point addition (both args must be float)
  1276. .IP 61
  1277. floating point subtraction
  1278. .IP 62
  1279. floating point < test
  1280. .IP 63
  1281. floating point > test
  1282. .IP 64
  1283. floating point \(<= test
  1284. .IP 65
  1285. floating point \(>= test
  1286. .IP 66
  1287. floating point = test
  1288. .IP 67
  1289. floating point ~= test
  1290. .IP 68
  1291. floating point multiplication
  1292. .IP 69
  1293. floating point division
  1294. .SH
  1295. Other floating point operations
  1296. .IP 70
  1297. ln
  1298. .IP 71
  1299. sqrt
  1300. .IP 72
  1301. floor
  1302. .IP 73
  1303. ceiling
  1304. .IP 74
  1305. not used
  1306. .IP 75
  1307. integerPart
  1308. .IP 76
  1309. fractionalPart
  1310. .IP 77
  1311. gamma
  1312. .IP 78
  1313. asString
  1314. .IP 79
  1315. exp
  1316. .SH
  1317. Other numerical functions
  1318. .IP 80
  1319. normalize number to be within 0 and 2\(*p.
  1320. .IP 81
  1321. sin
  1322. .IP 82
  1323. cos
  1324. .IP 83
  1325. not used
  1326. .IP 84
  1327. arcSin
  1328. .IP 85
  1329. arcCos
  1330. .IP 86
  1331. arcTan
  1332. .IP 87
  1333. not used
  1334. .IP 88
  1335. raisedTo:
  1336. .IP 89
  1337. radix:
  1338. .SH
  1339. Symbol Commands
  1340. .IP 90.
  1341. not used
  1342. .IP 91
  1343. symbol comparison, returns true or false.
  1344. .IP 92
  1345. printString
  1346. .IP 93
  1347. asString
  1348. .IP 94
  1349. print (used internally)
  1350. .IP 95
  1351. not used
  1352. .IP 96
  1353. not used
  1354. .IP 97
  1355. build a new class, arguments are class name, superclass name, instance
  1356. variables, messages, methods, context size.
  1357. .IP 98
  1358. insert an object into class dictionary, first argument is symbol,
  1359. second argument is class definition
  1360. .IP 99
  1361. find an object in class dictionary.  argument is symbol.
  1362. .SH
  1363. String operations
  1364. .IP 100
  1365. string length
  1366. .IP 101
  1367. string compare, case important \- return \(mi1, 0 or 1.
  1368. .IP 102
  1369. string compare, case not important
  1370. .IP 103
  1371. string catenation
  1372. .IP 104
  1373. string at:
  1374. .IP 105
  1375. string at:put:
  1376. .IP 106
  1377. copyFrom:length:
  1378. .IP 107
  1379. copy (new string with same chars)
  1380. .IP 108
  1381. asSymbol
  1382. .IP 109
  1383. string printString
  1384. .SH
  1385. Array manipulation
  1386. .IP 110
  1387. build an untyped object of given size, argument is integer size.
  1388. .IP 111
  1389. index variable get (first argument is object, second is index)
  1390. .IP 112
  1391. index variable put (first argument is object, second is index,
  1392. third argument is expression)
  1393. .IP 113
  1394. object grow (returns a new object with same instance variable values
  1395. as first argument, but with second argument tacked on end as new instance variable)
  1396. .IP 114
  1397. build an instance of \fBArray\fP of the given size.
  1398. .IP 115
  1399. new string of given size
  1400. .IP 116
  1401. ByteArray new:
  1402. .IP 117
  1403. ByteArray size
  1404. .IP 118
  1405. ByteArray at:
  1406. .IP 119
  1407. ByteArray at:put:
  1408. .SH
  1409. Output and error messages
  1410. .IP 120
  1411. print string with no return
  1412. .IP 121
  1413. print string with return
  1414. .IP 122
  1415. general error - first argument is receiver, second is error string
  1416. .IP 123
  1417. print string on error output (with return)
  1418. .IP 124
  1419. not used
  1420. .IP 125
  1421. unix system call
  1422. .IP 126
  1423. print a string at a specific point on the terminal
  1424. .IP 127
  1425. block return without surrounding context
  1426. .IP 128
  1427. reference count less than zero, first argument is guilty object
  1428. .IP 129
  1429. does not respond error, first argument is receiver, second is message.
  1430. .SH
  1431. File operations
  1432. .IP 130
  1433. file open, first argument is name, second argument is mode
  1434. .IP 131
  1435. file read
  1436. .IP 132
  1437. file write
  1438. .IP 133
  1439. set file mode, first argument is file, second is mode indicator (anInteger)
  1440. .IP 134
  1441. compute file size in bytes
  1442. .IP 135
  1443. file set location (at:) second argument is location (anInteger)
  1444. .IP 136
  1445. return current file offset in bytes
  1446. .IP 137
  1447. not used
  1448. .IP 138
  1449. not used
  1450. .IP 139
  1451. not used
  1452. .SH
  1453. Process management
  1454. .IP 140
  1455. block execute (trapped by interpreter)
  1456. .IP 141
  1457. new process (withArguments:)
  1458. .IP 142
  1459. terminate a process
  1460. .IP 143
  1461. perform:withArguments: (trapped by interpreter)
  1462. .IP 144.
  1463. not used
  1464. .IP 145
  1465. set state
  1466. .IP 146
  1467. return state
  1468. .IP 148
  1469. start atomic action
  1470. .IP 149
  1471. end atomic action
  1472. .SH
  1473. Operations on classes
  1474. .IP 150
  1475. class edit
  1476. .IP 151
  1477. superclass of a class
  1478. .IP 152
  1479. class name (a Symbol)
  1480. .IP 153
  1481. new instance of a class
  1482. .IP 154
  1483. list all commands class responds to
  1484. .IP 155
  1485. respondsTo: , second argument is a symbol
  1486. .IP 156
  1487. class view (drop into editor, but no include)
  1488. .IP 157
  1489. class list
  1490. .IP 158
  1491. variables (returns an array of symbols)
  1492. .IP 159
  1493. not used
  1494. .SH
  1495. Date and Time
  1496. .IP 160
  1497. current date and time as string
  1498. .IP 161
  1499. seconds time counter
  1500. .IP 162
  1501. clear the screen
  1502. .SH
  1503. Plot(3) interface
  1504. .IP 170
  1505. clear the screen
  1506. .IP 171
  1507. move the cursor (move(x,y))
  1508. .IP 172
  1509. draw a line (cont(x,y))
  1510. .IP 173
  1511. draw a point (point(x,y))
  1512. .IP 174
  1513. draw a circle (circle(x,y,r))
  1514. .IP 175
  1515. draw an arc (arc(x,y,x0,y0,x1,y1))
  1516. .IP 176
  1517. establish the coordinate space (space(a,b,c,d))
  1518. .IP 177
  1519. draw a line (line(a,b,c,d))
  1520. .IP 178
  1521. print a label (label(s))
  1522. .IP 179
  1523. establish a line type (linemod(s))
  1524. End
  1525. echo unbundling apndx1 1>&2
  1526. cat >apndx1 <<'End'
  1527. .so macros
  1528. .nh
  1529. .ds CF
  1530. .ds CH
  1531. .ps +0.2i
  1532. .nr PO +0.2i
  1533. .Nm Object
  1534. .PP
  1535. The class \fBObject\fP is a superclass of all classes in the system, and is
  1536. used to provide a consistent basic functionality and default behavior.
  1537. Many methods in class \fBObject\fP are overridden in subclasses.
  1538. .SH
  1539. Responds to
  1540. .Rs ==
  1541. Return true if receiver and argument are the
  1542. same object, false otherwise.
  1543. .Rs ~~
  1544. Inverse of ==.
  1545. .Rs asString
  1546. Return a string representation of the receiver,
  1547. by default this is the same as \fIprintString\fP, although one or the
  1548. other is redefined in many subclasses.
  1549. .Rs asSymbol
  1550. Return a symbol representing the receiver.
  1551. .Rs class
  1552. Return object representing the class of the receiver.
  1553. .Rs copy
  1554. Return shallowCopy of receiver.
  1555. Many subclasses redefine shallowCopy.
  1556. .Rs deepCopy
  1557. Return the receiver.  This method is redefined in many sub\%classes.
  1558. .Rs do: d
  1559. The argument must be a one argument block.
  1560. Execute the block on every element of the receiver collection.
  1561. Elements in the receiver collection are listed using \fIfirst\fP and \fInext\fP
  1562. (below), so the default behavior is merely to execute the block using the
  1563. receiver as argument.
  1564. .Rs error:
  1565. Argument must be a String.  Print argument string as error message.
  1566. Return \fBnil\fP.
  1567. .Rs first n
  1568. Return first item in sequence, which is by default simply the receiver.
  1569. See \fInext\fP, below.
  1570. .Rs isKindOf:
  1571. Argument must be a \fBClass\fP.  Return true if class of receiver, or any
  1572. superclass thereof, is the same as argument.
  1573. .Rs isMemberOf:
  1574. Argument must be a \fBClass\fP.  Return true if receiver is instance of
  1575. argument class.
  1576. .Rs isNil
  1577. Test whether receiver is object \fBnil\fP.
  1578. .Rs next n
  1579. Return next item in sequence, which is by default \fBnil\fP.  This message is
  1580. redefined in classes which represent sequences, such as \fBArray\fP
  1581. or \fBDictionary\fP.
  1582. .Rs notNil
  1583. Test if receiver is not object \fBnil\fP.
  1584. .Rs print
  1585. Display print image of receiver on the standard output.
  1586. .Rs printString
  1587. Return a string representation of receiver.
  1588. Objects which do not redefine printString, and which therefore do not have
  1589. a printable representation, return their class name as a string.
  1590. .Rs respondsTo:
  1591. Argument must be a symbol.  Return true if receiver will respond to
  1592. the indicated message.
  1593. .Rs shallowCopy
  1594. Return the receiver.  This method is redefined in many sub\%classes.
  1595. .Ex
  1596. 7 ~~ 7.0    True
  1597. 7 asSymbol    #7
  1598. 7 class    Integer
  1599. 7 copy    7
  1600. 7 isKindOf: Number    True
  1601. 7 isMemberOf: Number    False
  1602. 7 isNil    False
  1603. 7 respondsTo: #+    True
  1604. .Nm Object UndefinedObject
  1605. .PP
  1606. The pseudo variable \fBnil\fP is an instance (usually the only instance) of the
  1607. class \fBUndefinedObject\fP.  \fBnil\fP is used to represent undefined values,
  1608. and is
  1609. also typically returned in error situations.  \fBnil\fP is also used as a terminator
  1610. in sequences, as for example in response to the message \fInext\fP when there are
  1611. no further elements in a sequence.
  1612. .SH
  1613. Responds to
  1614. .Rs isNil r
  1615. Overrides method found in Object.  Return true.
  1616. .Rs notNil r
  1617. Overrides method found in Object.  Return false.
  1618. .Rs printString r
  1619. Return 'nil'.
  1620. .Ex
  1621. nil isNil    True
  1622. .Nm Object Symbol
  1623. .PP
  1624. Instances of the class \fBSymbol\fP are created either by their literal
  1625. representation, which is a pound sign followed by a string of nonspace
  1626. characters (for example #aSymbol ),
  1627. or by the message \fIasSymbol\fP being passed to an object.
  1628. Symbols cannot be created using \fInew\fP.  Symbols are guaranteed to have
  1629. unique representations; that is, two symbols representing the same
  1630. characters will always test equal to each other.  Inside of literal
  1631. arrays, the leading pound signs on symbols can be eliminated, for example:
  1632. #(these are symbols).
  1633. .SH
  1634. Responds to
  1635. .Rs == r
  1636. Return true if the two symbols represent the same characters,
  1637. false otherwise.
  1638. .Rs asString r
  1639. Return a String representation of the symbol without the leading pound
  1640. sign.
  1641. .Rs printString r
  1642. Return a String representation of the symbol, including the leading pound
  1643. sign.
  1644. .Ex
  1645. #abc == #abc    True
  1646. #abc == #ABC    False
  1647. #abc ~~ #ABC    True
  1648. #abc printString    #abc
  1649. \&'abc' asSymbol    #abc
  1650. .Nm Object Boolean
  1651. .PP
  1652. The class \fBBoolean\fP provides protocol for manipulating true and false values.
  1653. The pseudo variables \fBtrue\fP and \fBfalse\fP are instances of the subclasses of
  1654. \fBBoolean\fP; \fBTrue\fP and \fBFalse\fP, respectively.
  1655. The subclasses \fBTrue\fP and \fBFalse\fP, in combination with blocks, are used to
  1656. implement conditional control structures.  Note, however, that the
  1657. bytecodes may optimize conditional tests by generating
  1658. code in-line, rather than using message passing.
  1659. Note that bit-wise boolean operations are provided by class \fBInteger\fP.
  1660. .SH
  1661. Responds To
  1662. .Rs &
  1663. The argument must be a boolean.  Return the logical conjunction (and)
  1664. of the two values.
  1665. .Rs |
  1666. The argument must be a boolean.  Return the logical disjunction (or)
  1667. of the two values.
  1668. .Rs and:
  1669. The argument must be a block.  Return the logical conjunction (and)
  1670. of the two values.  If the receiver is false the second argument is not
  1671. used, otherwise the result is the value yielded in evaluating the argument
  1672. block.
  1673. .Rs or:
  1674. The argument must be a block.  Return the logical disjunction (or)
  1675. of the two values.  If the receiver is true the second argument is not
  1676. used, otherwise the result is the value yielded in evaluating the argument
  1677. block.
  1678. .Rs eqv:
  1679. The argument must be a boolean.  Return the logical equivalence (eqv)
  1680. of the two values.
  1681. .Rs xor:
  1682. The argument must be a boolean.  Return the logical exclusive or (xor)
  1683. of the two values.
  1684. .Ex
  1685. (1 > 3) & (2 < 4)    False
  1686. (1 > 3) | (2 < 4)    True
  1687. (1 > 3) and: [2 < 4]    False
  1688. .Nm Object Boolean True
  1689. .PP
  1690. The pseudo variable \fBtrue\fP is an instance (usually the only instance) of
  1691. the class \fBTrue\fP.
  1692. .SH
  1693. Responds To
  1694. .Rs ifTrue:
  1695. Return the result of evaluating the argument block.
  1696. .Rs ifFalse:
  1697. Return \fBnil\fP.
  1698. .Rs ifTrue:ifFalse:
  1699. Return the result of evaluating the first argument block.
  1700. .Rs ifFalse:ifTrue:
  1701. Return the result of evaluating the second argument block.
  1702. .Rs not
  1703. Return \fBfalse\fP.
  1704. .Ex
  1705. (3 < 5) not    False
  1706. (3 < 5) ifTrue: [17]    17
  1707. .Nm Object Boolean False
  1708. .PP
  1709. The pseudo variable \fBfalse\fP is an instance (usually the only instance) of
  1710. the class \fBFalse\fP.
  1711. .Rs ifTrue:
  1712. Return \fBnil\fP.
  1713. .Rs ifFalse:
  1714. Return the result of evaluating the argument block.
  1715. .Rs ifTrue:ifFalse:
  1716. Return the result of evaluating the second argument block.
  1717. .Rs ifFalse:ifTrue:
  1718. Return the result of evaluating the first argument block.
  1719. .Rs not
  1720. Return \fBtrue\fP.
  1721. .Ex
  1722. (1 < 3) ifTrue: [17]    17
  1723. (1 < 3) ifFalse: [17]    nil
  1724. .Nm Object Magnitude
  1725. .PP
  1726. The class \fBMagnitude\fP provides protocol for those subclasses possessing
  1727. a linear ordering.  For the sake of efficiency, most subclasses redefine
  1728. some or all of the relational messages.  All methods are defined in
  1729. terms of the basic messages <, = and >, which are in turn defined
  1730. circularly in terms of each other.  Thus each subclass of \fBMagnitude\fP
  1731. must redefine at least one of these messages.
  1732. .Rs <
  1733. Relational less than test.  Returns a boolean.
  1734. .Rs <=
  1735. Relational less than or equal test.
  1736. .Rs =
  1737. Relational equal test.  Note that this differs from ==, which is
  1738. an object equality test.
  1739. .Rs ~=
  1740. Relational not equal test, opposite of =.
  1741. .Rs >=
  1742. Relational greater than or equal test.
  1743. .Rs >
  1744. Relational greater than test.
  1745. .Rs between:and:
  1746. Relational test for inclusion.
  1747. .Rs max:
  1748. Return the maximum of the receiver and argument value.
  1749. .Rs min:
  1750. Return the minimum of the receiver and argument value.
  1751. .Ex
  1752. $A max: $a    $a
  1753. 4 between: 3.1 and: (17/3)    True
  1754. .Nm Object Magnitude Char
  1755. .PP
  1756. This class defines protocol for objects with character values.
  1757. Characters possess an ordering given by the underlying representation,
  1758. however arithmetic is not defined for character values.
  1759. Characters are written literally by preceding the character desired with
  1760. a dollar sign, for example: $a \0 $B \0 $$.
  1761. .SH
  1762. Responds to
  1763. .Rs == r
  1764. Object equality test.  Two instances of the same character always test equal.
  1765. .Rs asciiValue
  1766. Return an \fBInteger\fP representing the ascii value of the receiver.
  1767. .Rs asLowercase
  1768. If the receiver is an uppercase letter returns the same letter in lowercase,
  1769. otherwise returns the receiver.
  1770. .Rs asUppercase
  1771. If the receiver is a lowercase letter returns the same letter in uppercase,
  1772. otherwise returns the receiver.
  1773. .Rs asString r
  1774. Return a length one string containing the receiver.
  1775. Does not contain leading dollar sign, compare to \fIprintString\fP.
  1776. .Rs digitValue
  1777. If the receiver represents a number (for example $9) return the digit value
  1778. of the number.  If the receiver is an uppercase letter (for example $B) return
  1779. the position of the number in the uppercase letters + 10, ($B returns 11, for
  1780. example).  If the receiver is neither a digit nor an uppercase letter an
  1781. error is given and \fBnil\fP returned.
  1782. .Rs isAlphaNumeric
  1783. Respond true if receiver is either digit or letter, false otherwise.
  1784. .Rs isDigit
  1785. Respond true if receiver is a digit, false otherwise.
  1786. .Rs isLetter
  1787. Respond true if receiver is a letter, false otherwise.
  1788. .Rs isLowercase
  1789. Respond true if receiver is a lowercase letter, false otherwise.
  1790. .Rs isSeparator
  1791. Respond true if receiver is a space, tab or newline, false otherwise.
  1792. .Rs isUppercase
  1793. Respond true if receiver is an uppercase letter, false otherwise.
  1794. .Rs isVowel
  1795. Respond true if receiver is $a, $e, $i, $o or $u, in either
  1796. upper or lower case.
  1797. .Rs printString r    
  1798. Respond with a string representation of the character value.
  1799. Includes leading dollar sign, compare to \fIasString\fP, which does not include $.
  1800. .Ex
  1801. $A < $0    False
  1802. $A asciiValue    65
  1803. $A asString    A
  1804. $A printString    $A
  1805. $A isVowel    True
  1806. $A digitValue    10
  1807. .Nm Object Magnitude Number
  1808. .PP
  1809. The class \fBNumber\fP is an abstract superclass for \fBInteger\fP and \fBFloat\fP.
  1810. Instances of \fBNumber\fP cannot be created directly.
  1811. Relational messages and many arithmetic messages are redefined in each
  1812. subclass for arguments of the appropriate type.  In general, an error message
  1813. is given and \fBnil\fP returned for illegal arguments.
  1814. .SH
  1815. Responds To
  1816. .Rs +
  1817. Mixed type addition.
  1818. .Rs \(mi
  1819. Mixed type subtraction.
  1820. .Rs *
  1821. Mixed type multiplication
  1822. .Rs /
  1823. Mixed type division.
  1824. .Rs \(ua n
  1825. Exponentiation, same as raisedTo: .
  1826. .Rs @
  1827. Construct a point with coordinates being the receiver and the argument.
  1828. .Rs abs
  1829. Absolute value of the receiver.
  1830. .Rs exp
  1831. e raised to the power.
  1832. .Rs gamma n
  1833. Return the gamma function (generalized factorial) evaluated at the
  1834. receiver.
  1835. .Rs ln
  1836. Natural logarithm of the receiver.
  1837. .Rs log:
  1838. Logarithm in the given base.
  1839. .Rs negated
  1840. The arithmetic inverse of the receiver.
  1841. .Rs negative
  1842. True if the receiver is negative.
  1843. .Rs pi n
  1844. Return the approximate value of the receiver multiplied by \*(p (3.1415926...).
  1845. .Rs positive
  1846. True if the receiver is positive.
  1847. .Rs radians n
  1848. Argument converted into radians.
  1849. .Rs raisedTo:
  1850. The receiver raised to the argument value.
  1851. .Rs reciprocal
  1852. The arithmetic reciprocal of the receiver.
  1853. .Rs roundTo:
  1854. The receiver rounded to units of the argument.
  1855. .Rs sign
  1856. Return \(mi1, 0 or 1 depending upon whether the receiver is negative, zero or
  1857. positive.
  1858. .Rs sqrt
  1859. Square root.  nil if receiver is less than zero.
  1860. .Rs squared
  1861. Return the receiver multiplied by itself.
  1862. .Rs strictlyPositive
  1863. True if the receiver is greater than zero.
  1864. .Rs to:
  1865. Interval from receiver to argument value with step of 1.
  1866. .Rs to:by:
  1867. Interval from receiver to argument in given steps.
  1868. .Rs truncatedTo:
  1869. The receiver truncated to units of the argument.
  1870. .Ex
  1871. 3 < 4.1    True
  1872. 3 + 4.1    7.1
  1873. 3.14159 exp    23.1406
  1874. 9 gamma    40320
  1875. 5 reciprocal    0.2
  1876. 0.5 radians    0.5 radians
  1877. 13 roundTo: 5    15
  1878. 13 truncateTo: 5    10
  1879. .Nm Object Magnitude Number Integer
  1880. .PP
  1881. The class \fBInteger\fP provides protocol for objects with integer values.
  1882. .SH
  1883. Responds To
  1884. .Rs == r
  1885. Object equality test.  Two integers representing the same value are
  1886. considered to be the same object.
  1887. .Rs //
  1888. Integer quotient, truncated towards negative infinity (compare to \fIquo:\fP).
  1889. .Rs \e\e
  1890. Integer remainder, truncated towards negative infinity (compare to \fIrem:\fP).
  1891. .Rs allMask:
  1892. Argument must be \fBInteger\fP.  Treating receiver and argument as bit strings,
  1893. return \fBtrue\fP if all bits with 1 value in argument correspond to bits with 1
  1894. values in the receiver.
  1895. .Rs anyMask:
  1896. Argument must be \fBInteger\fP.  Treating receiver and argument as bit strings,
  1897. return true if any bit with 1 value in argument corresponds to a bit with
  1898. 1 value in the receiver.
  1899. .Rs asCharacter
  1900. Return the Char with the same underlying ascii representation as the low
  1901. order eight bits of the receiver.
  1902. .Rs asFloat
  1903. Floating point value with same magnitude as receiver.
  1904. .Rs bitAnd:
  1905. Argument must be \fBInteger\fP.  Treating the receiver and argument as bit strings,
  1906. return logical \fBand\fP of values.
  1907. .Rs bitAt:
  1908. Argument must be \fBInteger\fP greater than 0 and less than underlying word size.
  1909. Treating receiver as a bit string, return the bit value at the given position,
  1910. numbering from low order (or rightmost) position.
  1911. .Rs bitInvert
  1912. Return the receiver with all bit positions inverted.
  1913. .Rs bitOr:
  1914. Return logical \fBor\fP of values.
  1915. .Rs bitShift:
  1916. Treating the receiver as a bit string, shift bit values by amount indicated
  1917. in argument.  Negative values shift right, positive left.
  1918. .Rs bitXor:
  1919. Return logical \fBexclusive-or\fP of values.
  1920. .Rs even
  1921. Return true if receiver is even, false otherwise.
  1922. .Rs factorial
  1923. Return the factorial of the receiver.  Return as Float for large numbers.
  1924. .Rs gcd:
  1925. Argument must be \fBInteger\fP.  Return the greatest common divisor of the
  1926. receiver and argument.
  1927. .Rs highBit
  1928. Return the location of the highest 1 bit in the receiver.
  1929. Return \fBnil\fP for receiver zero.
  1930. .Rs lcm:
  1931. Argument must be \fBInteger\fP.  Return least common multiple of receiver and
  1932. argument.
  1933. .Rs noMask:
  1934. Argument must be \fBInteger\fP.  Treating receiver and argument as bit strings,
  1935. return true if no 1 bit in the argument corresponds to a 1 bit in the receiver.
  1936. .Rs odd
  1937. Return true if receiver is odd, false otherwise.
  1938. .Rs quo:
  1939. Return quotient of receiver divided by argument.
  1940. .Rs radix:
  1941. Return a string representation of the receiver value, printed in the base
  1942. represented by the argument.  Argument value must be less than 36.
  1943. .Rs rem:
  1944. Remainder after receiver is divided by argument value.
  1945. .Rs timesRepeat:
  1946. Repeat argument block the number of times given by the receiver.
  1947. .Ex
  1948. 5 + 4    7
  1949. 5 allMask: 4    True
  1950. 4 allMask: 5    False
  1951. 5 anyMask: 4    True
  1952. 5 bitAnd: 3    1
  1953. 5 bitOr: 3    7
  1954. 5 bitInvert    \(mi6
  1955. 254 radix: 16    16rFE
  1956. \(mi5 // 4    \(mi2
  1957. \(mi5 quo: 4    \(mi1
  1958. \(mi5 \e\e 4    1
  1959. \(mi5 rem: 4    \(mi1
  1960. 8 factorial    40320
  1961. .Nm Object Magnitude Number Float
  1962. .PP
  1963. The class \fBFloat\fP provides protocol for objects with floating point values.
  1964. .SH
  1965. Responds To
  1966. .Rs == r
  1967. Object equality test.  Return true if the receiver and argument
  1968. represent the same floating point value.
  1969. .Rs \(ua n
  1970. Floating exponentiation.
  1971. .Rs arcCos
  1972. Return a \fBRadian\fP representing the arcCos of the receiver.
  1973. .Rs arcSin
  1974. Return a \fBRadian\fP representing the arcSin of the receiver.
  1975. .Rs arcTan
  1976. Return a \fBRadian\fP representing the arcTan of the receiver.
  1977. .Rs  asFloat
  1978. Return the receiver.
  1979. .Rs ceiling
  1980. Return the Integer ceiling of the receiver.
  1981. .Rs coerce:
  1982. Coerce the argument into being type Float.
  1983. .Rs exp
  1984. Return e raised to the receiver value.
  1985. .Rs floor
  1986. Return the Integer floor of the receiver.
  1987. .Rs fractionPart
  1988. Return the fractional part of the receiver.
  1989. .Rs gamma n
  1990. Return the value of the gamma function applied to the receiver value.
  1991. .Rs integerPart
  1992. Return the integer part of the receiver.
  1993. .Rs ln
  1994. Return the natural log of the receiver.
  1995. .Rs radix:
  1996. Return a string containing the printable representation of the receiver
  1997. in the given radix.  Argument must be an Integer less than 36.
  1998. .Rs rounded
  1999. Return the receiver rounded to the nearest integer.
  2000. .Rs sqrt
  2001. Return the square root of the receiver.
  2002. .Rs truncated
  2003. Return the receiver truncated to the nearest integer.
  2004. .Ex
  2005. 4.2 * 3    12.6
  2006. 2.1 \(ua 4    19.4481
  2007. 2.1 raisedTo: 4    19.4481
  2008. 0.5 arcSin    0.523599 radians
  2009. 2.1 reciprocal    0.47619
  2010. 4.3 sqrt    2.07364
  2011. .Nm Object Magnitude Radian
  2012. .PP
  2013. The class \fBRadian\fP is used to represent radians.  Radians are a unit of
  2014. measurement, independent of other numbers.
  2015. Only radians will responds to the trigonometric functions
  2016. such as \fIsin\fP and \fIcos\fP.
  2017. Numbers can be converted into
  2018. radians by passing them the message \fIradians\fP.  Similarly, radians
  2019. can be converted into numbers by sending them the message \fIasFloat\fP.
  2020. Notice that only a limited range of arithmetic operations are permitted on
  2021. Radians.
  2022. Radians are normalized to be between 0 and 2\(*p.
  2023. .SH
  2024. Responds to
  2025. .Rs +
  2026. Argument must be a Radian.  Add the two radians together and return the
  2027. normalized result.
  2028. .Rs \(mi
  2029. Argument must be a Radian.  Subtract the argument from the receiver and
  2030. return the normalized result.
  2031. .Rs *
  2032. Argument must be a Number.  Multiply the receiver by the argument amount
  2033. and return the normalized result.
  2034. .Rs /
  2035. Argument must be a Number.  Divide the receiver by the argument amount
  2036. and return the normalized result.
  2037. .Rs asFloat
  2038. Return the receiver as a floating point number.
  2039. .Rs cos
  2040. Return a floating point number representing the cosine of the
  2041. receiver.
  2042. .Rs sin
  2043. Return a floating point number representing the sine of the receiver.
  2044. .Rs tan
  2045. Return a floating point number representing the tangent of the receiver.
  2046. .Ex
  2047. 0.5236 radians sin    0.5
  2048. 0.5236 radians cos    0.866025
  2049. 0.5236 radians tan    0.577352
  2050. 0.5 arcSin asFloat    0.523599
  2051. .Nm Object Magnitude Point
  2052. .PP
  2053. \fBPoint\fPs are used to represent pairs of quantities, such as coordinate
  2054. pairs.
  2055. .SH
  2056. Responds To
  2057. .Rs <
  2058. True if both values of the receiver are less than the corresponding values
  2059. in the argument.
  2060. .Rs <=
  2061. True if the first value is less than or equal to the corresponding value in
  2062. the argument, and the second value is less than the corresponding value in
  2063. the argument.
  2064. .Rs >=
  2065. True if both values of the receiver are greater than or equal to the
  2066. corresponding values in the argument.
  2067. .Rs *
  2068. Return a new point with coordinates multiplied by the argument value.
  2069. .Rs /
  2070. Return a new point with coordinates divided by the argument value.
  2071. .Rs //
  2072. Return a new point with coordinates divided by the argument value.
  2073. .Rs +
  2074. Return a new point with coordinates offset by the corresponding values in
  2075. the argument.
  2076. .Rs abs
  2077. Return a new point with coordinates having the absolute value of the
  2078. receiver.
  2079. .Rs dist:
  2080. Return the Euclidean distance between the receiver and the argument
  2081. point.
  2082. .Rs max:
  2083. The argument must be a \fBPoint\fP.
  2084. Return the lower right corner of the rectangle defined by the receiver and
  2085. the argument.
  2086. .Rs min:
  2087. The argument must be a \fBPoint\fP.
  2088. Return the upper left corner of the rectangle defined by the receiver and
  2089. the argument.
  2090. .Rs transpose
  2091. Return a new point with coordinates being the transpose of the receiver.
  2092. .Rs x
  2093. Return the first coordinate of the receiver.
  2094. .Rs x:
  2095. Set the first coordinate of the receiver.
  2096. .Rs x:y:
  2097. Sets both coordinates of the receiver.
  2098. .Rs y
  2099. Return the second coordinate of the receiver.
  2100. .Rs y:
  2101. Set the second coordinate of the receiver.
  2102. .Ex
  2103. (10@12) < (11@14)    True
  2104. (10@12) < (11@11)    False
  2105. (10@12) max: (11@11)    11@12
  2106. (10@12) min: (11@11)    10@11
  2107. (10@12) dist: (11@14)    2.23607
  2108. (10@12) transpose    12@10
  2109. .Nm Object Random
  2110. .PP
  2111. The class \fBRandom\fP provides protocol for random number generation.  Sending
  2112. the message \fInext\fP to an instance of \fBRandom\fP results in a \fBFloat\fP
  2113. between 0.0 and 1.0, randomly distributed.
  2114. By default, the pseudo random sequence is the same for each object in class
  2115. \fBRandom\fP.  This can be altered using the message \fIrandomize\fP.
  2116. .SH
  2117. Responds To
  2118. .Rs between:and: n
  2119. Return a random number uniformly distributed between the two arguments.
  2120. .Rs first n
  2121. Return a random number between 0.0 and 1.0.
  2122. This message merely provides consistency with protocol for other sequences,
  2123. such as Arrays or Intervals.
  2124. .Rs next
  2125. Return a random number between 0.0 and 1.0.
  2126. .Rs next: d
  2127. Return an \fBArray\fP containing the next n random numbers, where n
  2128. is the argument value.
  2129. .Rs randInteger: n
  2130. The argument must be an integer.  Return a random integer between 1 and the
  2131. value given.
  2132. .Rs randomize n
  2133. Change the pseudo-random number generator seed by a time dependent value.
  2134. .Ex
  2135. i \(<- Random new
  2136. i next    0.759
  2137. i next    0.157
  2138. i next: 3    #( 0.408 0.278 0.547 )
  2139. i randInteger: 12    5
  2140. i between: 4 and: 17.5    10.0
  2141. .Nm Object Collection
  2142. .PP
  2143. The class \fBCollection\fP provides protocol for groups of objects, such as
  2144. \fBArray\fPs or \fBSet\fPs.
  2145. The different forms of collections are distinguished by several
  2146. characteristics, among them whether the size of the collection is fixed
  2147. or unbounded, the presence or absence of an ordering, and their insertion
  2148. or access method.  For example, an \fBArray\fP is a collection with a
  2149. fixed size and ordering, indexed by integer keys.  A \fBDictionary\fP, on the
  2150. other hand, has no fixed size or ordering, and can be indexed by
  2151. arbitrary elements.  Nevertheless, \fBArrays\fP and \fBDictionarys\fP share many
  2152. features in common, such as their access method (\fIat:\fP and \fPat:put:\fP),
  2153. and the ability to respond to \fIcollect:\fP, \fIselect:\fP, and many other
  2154. messages.
  2155. .PP
  2156. The table below lists some of the characteristics of several forms of
  2157. collections:
  2158. .TS
  2159. center box;
  2160. l c c c c c.
  2161.  
  2162. Name    Creation    Size    Ordered?    Insertion    Access
  2163.     Method    fixed?        method    method
  2164.  
  2165. _
  2166.  
  2167. Bag/Set    new    no    no    add:    includes:
  2168.  
  2169. Dictionary    new    no    no    at:put:    at:
  2170.  
  2171. Interval    n to: m    yes    yes    none    at:
  2172.  
  2173. List    new    no    yes    addFirst:    first
  2174.                 addLast:    last
  2175.  
  2176. Array    new:    yes    yes    at:put:    at:
  2177.  
  2178. String    new:    yes    yes    at:put:    at:
  2179.  
  2180. .TE
  2181. .PP
  2182. The list below shows messages that are shared in common by all collections.
  2183. .SH
  2184. Responds to
  2185. .Rs addAll:
  2186. The argument must be a \fBCollection\fP.
  2187. Add all the elements of the argument collection to the receiver collection.
  2188. .Rs asArray
  2189. Return a new collection of type \fBArray\fP containing the elements from
  2190. the receiver collection.  If the receiver was ordered, the elements will
  2191. be in the same order in the new collection, otherwise the elements will
  2192. be in an arbitrary order.
  2193. .Rs asBag
  2194. Return a new collection of type \fBBag\fP containing the elements from
  2195. the receiver collection.
  2196. .Rs asList n
  2197. Return a new collection of type \fBList\fP containing the elements from
  2198. the receiver collection.  If the receiver was ordered, the elements will
  2199. be in the same order in the new collection, otherwise the elements will
  2200. be in an arbitrary order.
  2201. .Rs asSet
  2202. Return a new collection of type \fBSet\fP containing the elements from
  2203. the receiver collection.
  2204. .Rs asString
  2205. Return a new collection of type \fBString\fP containing the elements from the
  2206. receiver collection.  The elements to be included must all be of type
  2207. \fBCharacter\fP.  If the receiver was ordered, the elements will be in the same
  2208. order in the new collection, otherwise the elements will be listed in an
  2209. arbitrary order.
  2210. .Rs coerce:
  2211. The argument must be a collection.
  2212. Return a collection, of the same type as the receiver, containing elements
  2213. from the argument collection.  This message is redefined in most subclasses
  2214. of collection.
  2215. .Rs collect:
  2216. The argument must be a one argument block.
  2217. Return a new collection, like the receiver, containing the result of
  2218. evaluating the argument block on each element of the receiver collection.
  2219. .Rs detect:
  2220. The argument must be a one argument block.
  2221. Return the first element in the receiver collection for which the
  2222. argument block evaluates true.  Report an error and return \fBnil\fP if
  2223. no such element exists.
  2224. Note that in unordered collections (such as \fBBags\fP or \fBDictionarys\fP) the first
  2225. element to be encountered that will satisfy the condition may not be
  2226. easily predictable.
  2227. .Rs detect:ifAbsent:
  2228. Return the first element in the receiver collection for which the
  2229. first argument block evaluates true.  Return the result of evaluating
  2230. the second argument if no such element exists.
  2231. .Rs do:
  2232. The argument must be a one argument block.
  2233. Evaluate the argument block on each element in the receiver collection.
  2234. .Rs includes:
  2235. Return true if the receiver collection contains the argument.
  2236. .Rs inject:into:
  2237. The first argument must be a value, the second a two argument block.
  2238. The second argument is evaluated once for each element in the receiver
  2239. collection, passing as arguments the result of the previous evaluation
  2240. (starting with the first argument) and the element.
  2241. The value returned is the final value generated.
  2242. .Rs isEmpty
  2243. Return true if the receiver collection contains no elements.
  2244. .Rs occurrencesOf:
  2245. Return the number of times the argument occurs in the receiver collection.
  2246. .Rs remove:
  2247. Remove the argument from the receiver collection.  Report an error
  2248. if the element is not contained in the receiver collection.
  2249. .Rs remove:ifAbsent:
  2250. Remove the first argument from the receiver collection.  Evaluate the second
  2251. argument if not present.
  2252. .Rs reject:
  2253. The argument must be a one argument block.
  2254. Return a new collection like the receiver containing all elements for
  2255. which the argument block returns false.
  2256. .Rs select:
  2257. The argument must be a one argument block.
  2258. Return a new collection like the receiver containing all elements for
  2259. which the argument block returns true.
  2260. .Rs size
  2261. Return the number of elements in the receiver collection.
  2262. .Ex
  2263. i \(<- 'abacadabra'
  2264. i size    10
  2265. i asArray    #( $a $b $a $c $a $d $a $b $r $a )
  2266. i asBag    Bag ( $a $a $a $a $a $r $b $b $c $d)
  2267. i asSet    Set ( $a $r $b $c $d )
  2268. i occurrencesOf: $a    5
  2269. i reject: [:x | x isVowel]    bcdbr
  2270. .Nm Object Collection Bag/Set
  2271. .PP
  2272. \fBBags\fP and \fBSets\fP are each
  2273. unordered collections of elements.
  2274. Elements in the collections do not have keys, but are added and removed
  2275. directly.
  2276. The difference between a \fBBag\fP and a \fBSet\fP is that each element can occur
  2277. any number of times in a \fBBag\fP, whereas only one copy is inserted into
  2278. a \fBSet\fP.
  2279. .SH
  2280. Responds to
  2281. .Rs add:
  2282. Add the indicated element to the receiver collection.
  2283. .Rs add:withOccurences:
  2284. (\fBBag\fP only) Add the indicated element to the receiver \fBBag\fP the given number
  2285. of times.
  2286. .Rs first n
  2287. Return the first element from the receiver collection.
  2288. As the collection is unordered, the first element
  2289. depends upon certain values in the internal representation, and is
  2290. not guaranteed to be any specific element in the collection.
  2291. .Rs next n
  2292. Return the next element in the collection.
  2293. In conjunction with \fIfirst\fP, this can be used to access each
  2294. element of the collection in turn.
  2295. .Ex
  2296. i \(<- (1 to: 6) asBag    Bag ( 1 2 3 4 5 6 )
  2297. i size    6
  2298. i select: [:x | (x \e\e 2) strictlyPositive]    Bag ( 1 3 5 )
  2299. i collect: [:x | x \e\e 3]    Bag ( 0 0 1 1 2 2 )
  2300. j \(<- ( i collect: [:x | x \e\e 3] ) asSet    Set ( 0 1 2 )
  2301. j size    3
  2302. .LP
  2303. \fBNote:\fP Since \fBBags\fP and \fBSets\fP are unordered, there is no way to
  2304. establish a mapping between the elements of the Bag i in the example above
  2305. and the corresponding elements in the collection that resulted from the
  2306. message collect: [:x | x \e\e 3].
  2307. .Nm Object Collection KeyedCollection
  2308. .PP
  2309. The class \fBKeyedCollection\fP provides protocol for collections with keys,
  2310. such as \fBDictionarys\fP and \fBArrays\fP.
  2311. Since each entry in the collection has both a key and value, the
  2312. method \fIadd:\fP is no longer appropriate.  Instead, the method
  2313. \fIat:put:\fP, which provides both a key and a value, must be used.
  2314. .SH
  2315. Responds to
  2316. .Rs asDictionary
  2317. Return a new collection of type \fBDictionary\fP containing the elements
  2318. from the receiver collection.
  2319. .Rs at:
  2320. Return the item in the receiver collection whose key matches the argument.
  2321. Produces and error message, and returns nil, if no item is currently in
  2322. the receiver collection under the given key.
  2323. .Rs at:ifAbsent:
  2324. Return the element stored in the dictionary under the key given by the
  2325. first argument.  Return the result of evaluating the second argument if
  2326. no such element exists.
  2327. .Rs atAll:put:
  2328. The first argument must be a collection containing keys valid for the
  2329. receiver.  At each location given by a key in the first argument place
  2330. the second argument.
  2331. .Rs binaryDo:
  2332. The argument must be a two argument block.  This message is similar to \fIdo:\fP,
  2333. however both the key and the element value are passed as argument to the
  2334. block.
  2335. .Rs includesKey:
  2336. Return true if the indicated key is valid for the receiver collection.
  2337. .Rs indexOf:
  2338. Return the key value of the first element in the receiver collection matching
  2339. the argument.
  2340. Produces an error message if no such element exists.
  2341. Note that, as with the message \fIdetect:\fP, in unordered collections the
  2342. first element may not be related in any way to the order in which elements
  2343. were placed into the collection, but is rather implementation dependent.
  2344. .Rs indexOf:ifAbsent:
  2345. Return the key value of the first element in the receiver collection matching
  2346. the argument.
  2347. Return the result of evaluating the second argument if no such element
  2348. exists.
  2349. .Rs keys
  2350. Return a Set containing the keys for the receiver collection.
  2351. .Rs keysDo:
  2352. The argument must be a one argument block.
  2353. Similar to \fIdo:\fP, except that the values passed to the block are the keys
  2354. of the receiver collection.
  2355. .Rs keysSelect:
  2356. Similar to \fIselect\fP, except that the selection is made on the basis of keys
  2357. instead of values.
  2358. .Rs removeKey:
  2359. Remove the object with the given key from the receiver collection.
  2360. Print an error message, and return \fBnil\fP, if no such object exists.
  2361. Return the value of the deleted item.
  2362. .Rs removeKey:ifAbsent:
  2363. Remove the object with the given key from the receiver collection.
  2364. Return the result of evaluating the second argument if no such object
  2365. exists.
  2366. .Rs values
  2367. Return a Bag containing the values from the receiver collection.
  2368. .Ex
  2369. i \(<- 'abacadabra'
  2370. i atAll: (1 to: 7 by: 2) put: $e    ebecedebra
  2371. i indexOf: $r    9
  2372. i atAll: i keys put: $z    zzzzzzzzzz
  2373. i keys    Set ( 1 2 3 4 5 6 7 8 9 10 )
  2374. i values    Bag ( $z $z $z $z $z $z $z $z $z $z )
  2375. #(how odd) asDictionary    Dictionary ( 1 @ #how 2 @ odd )
  2376. .Nm Object Collection KeyedCollection Dictionary
  2377. .PP
  2378. A \fBDictionary\fP is an unordered collection of elements, as are \fBBags\fP
  2379. and \fBSets\fP.
  2380. However, unlike these collections, elements inserted and removed from
  2381. a \fBDictionary\fP must reference an explicit key.  Both the key and value
  2382. portions of an element can be any object, although commonly the keys are
  2383. instances of \fBSymbol\fP or \fBNumber\fP.
  2384. .SH
  2385. Responds to
  2386. .Rs at:put:
  2387. Place the second argument into the receiver collection under the key given
  2388. by the first argument.
  2389. .Rs currentKey
  2390. Return the key of the last element yielded in response to a \fIfirst\fP or
  2391. \fInext\fP request.
  2392. .Rs first n
  2393. Return the first element of the receiver collection.
  2394. Return nil if the receiver collection is empty.
  2395. .Rs next n
  2396. Return the next element of the receiver collection, or nil if no such element
  2397. exists.
  2398. .Ex
  2399. .ta 3i
  2400. i \(<- Dictionary new
  2401. i at: #abc put: #def
  2402. i at: #pqr put: #tus
  2403. i at: #xyz put: #wrt
  2404. i print    Dictionary ( #abc @ #def #pqr @ #tus #xyz @ #wrt )
  2405. i size    3
  2406. i at: #pqr    #tus
  2407. i indexOf: #tus    #pqr
  2408. i keys    Set ( #abc #pqr #xyz )
  2409. i values    Bag ( #wrt #def # tus )
  2410. i collect: [:x | x asString at: 2]    Dictionary ( #abc @ $e #pqr @ $u #xyz @ $r)
  2411. .Nm Object Collection KeyedCollection Dictionary Smalltalk
  2412. .PP
  2413. The class \fBSmalltalk\fP provides protocol for the pseudo variable
  2414. \fBsmalltalk\fP.
  2415. Since it is a subclass of Dictionary, this variable can be used to store
  2416. information, and thus provide a means of communication between objects.
  2417. Other messages modify various parameters used by the Little Smalltalk system.
  2418. .SH
  2419. Responds To
  2420. .Rs date n
  2421. Return the current date and time as a string.
  2422. .Rs display n
  2423. Set execution display to display the result of every expression typed, but
  2424. not for assignments.
  2425. Note that the display behavior can also be modified using the \-d argument
  2426. on the command line.
  2427. .Rs displayAssign n
  2428. Set execution display to display the result of every expression typed,
  2429. including assignment statements.
  2430. .Rs doPrimitive:withArguments: n
  2431. Execute the indicated primitive with arguments given by the second array.
  2432. A few primitives (such as those dealing with process management) cannot be
  2433. executed in this manner.
  2434. .Rs noDisplay n
  2435. Turn off execution display - no results will be displayed unless explicitly
  2436. requested by the user.
  2437. .Rs perform:withArguments: d
  2438. Send indicated message to the receiver, using the arguments given.
  2439. The first value in the argument array is taken to be the receiver of
  2440. the message.
  2441. Unpredictable results if the number of arguments is not appropriate for
  2442. the given message.
  2443. .Rs sh: n
  2444. The argument, which must be a string, is executed as a Unix command by the
  2445. shell.  The value returned is the termination status of the shell.
  2446. .Rs time: n
  2447. The argument must be a block.  The block is executed, and the number of
  2448. seconds elapsed during execution returned.  Time is only accurate to within
  2449. about one second.
  2450. .Ex
  2451. smalltalk date    Fri Apr 12 16:15:42 1985
  2452. smalltalk perform: #+ withArguments: #(2 5)    7
  2453. smalltalk doPrimitive: 10 withArguments: #(2 5)    7
  2454. .Nm Object Collection KeyedCollection SequenceableCollection
  2455. .PP
  2456. The class \fBSequenceableCollection\fP contains protocol for collections that have
  2457. a definite sequential ordering and are indexed by integer keys.
  2458. Since there is a fixed order for elements, it is possible to refer to the
  2459. last element in a \fBSequenceableCollection\fP.
  2460. .SH
  2461. Responds to
  2462. .Rs ,
  2463. Appends the argument collection to the receiver collection, returning a new
  2464. collection of the same type as the receiver.
  2465. .Rs copyFrom:to:
  2466. Return a new collection, like the receiver, containing the designated
  2467. subportion of the receiver collection.
  2468. .Rs copyWith:
  2469. Return a new collection, like the receiver, with the argument added to
  2470. the end.
  2471. .Rs copyWithout:
  2472. Return a new collection, like the receiver, with all occurrences of
  2473. the argument removed.
  2474. .Rs equals:startingAt:
  2475. The first argument must be a \fBSequenceableCollection\fP.
  2476. Return true if each element of the receiver collection is equal to the
  2477. corresponding element in the argument offset by the amount given in
  2478. the second argument.
  2479. .Rs findFirst:
  2480. Find the key for the first element whose value satisfies the
  2481. argument block.
  2482. Produce an error message if no such element exists.
  2483. .Rs findFirst:ifAbsent:
  2484. Both arguments must be blocks.
  2485. Find the key for the first element whose value satisfies the first argument block.
  2486. If no such element exists return the value of the
  2487. second argument.
  2488. .Rs findLast:
  2489. Find the key for the last element whose value satisfies the argument block.
  2490. Produce an error message if no such element exists.
  2491. .Rs findLast:ifAbsent:
  2492. Both arguments must be blocks.
  2493. Find the key for the last element whose value satisfies the first argument block.
  2494. If no such element exists return the value of the second argument block.
  2495. .Rs firstKey
  2496. Return the first key valid for the receiver collection.
  2497. .Rs indexOfSubCollection:startingAt:
  2498. .br
  2499. Starting at the position given by the second argument, find the next
  2500. block of elements in the receiver collection which match the collection
  2501. given by the first argument, and return the index for the start of that block.
  2502. Produce an error message if no such position
  2503. exists.
  2504. .Rs indexOfSubCollection:startingAt:ifAbsent:
  2505. .br
  2506. Similar to \fIindexOfSubCollection:startingAt:\fP, except that the result of the
  2507. exception block is produced if no position exists matching the pattern.
  2508. .Rs last
  2509. Return the last element in the receiver collection.
  2510. .Rs lastKey
  2511. Return the last key valid for the receiver collection.
  2512. .Rs replaceFrom:to:with:
  2513. Replace the elements in the receiver collection in the positions indicated
  2514. by the first two arguments with values taken from the collection given
  2515. by the third argument.
  2516. .Rs replaceFrom:to:with:startingAt:
  2517. .br
  2518. Replace the elements in the receiver collection in the positions indicated
  2519. by the first two arguments with values taken from the collection given
  2520. in the third argument, starting at the position given by the fourth
  2521. argument.
  2522. .Rs reversed n
  2523. Return a collection, like the receiver, with elements reversed.
  2524. .Rs reverseDo:
  2525. Similar to \fIdo\fP:, except that the items are presented in reverse order.
  2526. .Rs sort n
  2527. Return a collection, like the receiver, with the elements sorted
  2528. using the comparison <=.  Elements must be able to respond to the binary
  2529. message <=.
  2530. .Rs sort: n
  2531. The argument must be a two argument block which yields a boolean.
  2532. Return a collection, like the receiver, sorted using the argument
  2533. to compare elements for the purpose of ordering.
  2534. .Rs with:do:
  2535. The second argument must be a two argument block.
  2536. Present one element from the receiver collection and from the collection
  2537. given by the first argument in turn to the second argument block.
  2538. An error message is given if the collections do not have the same number of
  2539. elements.
  2540. .Ex
  2541. i \(<- 'abacadabra'
  2542. i copyFrom: 4 to: 8    cadab
  2543. i copyWith: $z    abacadabraz
  2544. i copyWithout: $a    bcdbr
  2545. i findFirst: [:x | x > $m]    9
  2546. i indexOfSubCollection: 'dab' startingAt: 1    6
  2547. i reversed    arbadacaba
  2548. i , i reversed    abacadabraarbadacaba
  2549. i sort: [:x :y | x >= y]    rdcbbaaaaa    
  2550. .Nm Object Collection KeyedCollection SequenceableCollection Interval
  2551. .PP
  2552. The class \fBInterval\fP represents a sequence of numbers in an arithmetic
  2553. sequence, either ascending or descending.  Instances of \fBInterval\fP are
  2554. created by numbers in response to the message \fIto:\fP or \fIto:by:\fP.
  2555. In conjunction with the message \fIdo:\fP, \fBIntervals\fP create a control
  2556. structure similar to do or for loops in Algol like languages.  For example:
  2557. .DS B
  2558. .sp
  2559. (1 to: 10) do: [:x | x print]
  2560. .sp
  2561. .DE
  2562. will print the numbers 1 through 10.
  2563. Although they are a collection, \fBIntervals\fP cannot be added to.
  2564. They can, however, be accessed randomly using the message \fIat\fP:.
  2565. .SH
  2566. Responds to
  2567. .Rs first
  2568. Produce the first element from the interval.  In conjunction with
  2569. \fIlast\fP, this message may be used to produce each element from the
  2570. interval in turn.  Note that \fBIntervals\fP also respond to the message
  2571. \fIat:\fP, which can be used to produce elements in an arbitrary order.
  2572. .Rs from:to:by:
  2573. Initialize the upper and lower bounds and the step size for the receiver.
  2574. (This is used principally internally by the method for number to create new
  2575. Intervals).
  2576. .Rs next
  2577. Produce the next element from the interval.
  2578. .Rs size
  2579. Return the number of elements that will be generated in producing the
  2580. interval.
  2581. .Ex
  2582. (7 to: 13 by: 3) asArray    #( 7 10 13 )
  2583. (7 to: 13 by: 3) at: 2    10
  2584. (1 to: 10) inject: 0 into: [:x :y | x + y]    55
  2585. (7 to: 13) copyFrom: 2 to: 5    #( 8 9 10 11 )
  2586. (3 to: 5) copyWith: 13    #( 3 4 5 13 )
  2587. (3 to: 5) copyWithout: 4    #( 3 5 )
  2588. (2 to: 4) equals: (1 to: 4) startingAt: 2    True
  2589. .Nm Object Collection KeyedCollection SequenceableCollection List
  2590. .PP
  2591. Lists represent collections with a fixed order, but indefinite
  2592. size.  No keys are used, and elements are added or removed from one end of
  2593. the other.
  2594. Used in this way, Lists
  2595. can perform as \fIstacks\fP or as \fIqueues\fP.  The table below
  2596. illustrates how stack and queue operations can be implemented in terms
  2597. of messages to instances of List.
  2598. .TS
  2599. center;
  2600. l s | l s
  2601. l l | l l.
  2602. \fIstack operations\fP    \fIqueue operations\fP
  2603.  
  2604. _
  2605. push    addLast:    add    addLast:    
  2606. pop    removeLast    first in queue    first    
  2607. top    last    remove first in queue    removeFirst
  2608. test empty    isEmpty    test empty    isEmpty
  2609. .TE
  2610. .SH
  2611. Responds to
  2612. .Rs add:
  2613. Add the element to the beginning of the receiver collection.  This is the same
  2614. as \fIaddFirst:\fP.
  2615. .Rs addAllFirst:
  2616. The argument must be a SequenceableCollection.  The elements of the argument
  2617. are added, in order, to the front of the receiver collection.
  2618. .Rs addAllLast:
  2619. The argument must be a SequenceableCollection.  The elements of the argument
  2620. are added, in order, to the end of the receiver collection.
  2621. .Rs addFirst:
  2622. The argument is added to the front of the receiver collection.
  2623. .Rs addLast:
  2624. The argument is added to the back of the receiver collection.
  2625. .Rs removeFirst
  2626. Remove the first element from the receiver collection, returning the
  2627. removed value.
  2628. .Rs removeLast
  2629. Remove the last element from the receiver collection, returning the
  2630. removed value.
  2631. .Ex
  2632. i \(<- List new
  2633. i addFirst: 2 / 3    List ( 0.6666 )
  2634. i add: $A    
  2635. i addAllLast: (12 to: 14 by: 2)
  2636. i print    List ( 0.6666 $A 12 14 )
  2637. i first    0.6666
  2638. i removeLast    14
  2639. i print    List ( 0.6666 $A 12 )
  2640. .Nm Object Collection KeyedCollection SequenceableCollection List Semaphore
  2641. .PP
  2642. Semaphores are used to synchronize concurrently running \fBProcesses\fP.
  2643. .SH
  2644. Responds To
  2645. .Rs new:
  2646. If created using \fInew\fP, a \fBSemaphore\fP starts out with zero excess
  2647. signals.  Alternatively, a \fBSemaphore\fP can be created with an arbitrary
  2648. number of excess signals by giving it an argument to \fInew\fP:.
  2649. .Rs signal
  2650. If there is a process blocked on the semaphore is it scheduled for
  2651. execution, otherwise
  2652. the number of excess signals is incremented by one.
  2653. .Rs wait
  2654. If there are excess signals associated with the semaphore the number of
  2655. signals is decremented by one, otherwise
  2656. the current process is placed on the semaphore queue.
  2657. .Nm Object Collection KeyedCollection SequenceableCollection File
  2658. .PP
  2659. A \fBFile\fP is a type of collection where the elements of the collection are
  2660. stored on an external medium, typically a disk.
  2661. For this reason, although most operations on collections are defined for
  2662. files, many can be quite slow in execution.
  2663. A file can be opened on one of three \fImodes\fP:
  2664. In \fIcharacter\fP mode every read returns a single character from the
  2665. file.
  2666. In \fIinteger\fP mode every read returns a single word, as an integer value.
  2667. In \fIstring\fP mode every read returns a single line, as a \fBString\fP.
  2668. For writing, character and string modes will write the string representation
  2669. of the argument, while integer mode must write only a single integer.
  2670. .SH
  2671. Responds To
  2672. .Rs at:
  2673. Return the object stored at the indicated position.  Position is given as a
  2674. character count from the start of the file.
  2675. .Rs at:put:
  2676. Place the object at the indicated position in the file.  Position is given
  2677. as a character count from the start of the file.
  2678. .Rs characterMode
  2679. Set the mode of the receiver file to \fIcharacter\fP.
  2680. .Rs currentKey
  2681. Return the current position in the file, as a character count from the
  2682. start of the file.
  2683. .Rs integerMode
  2684. Set the mode of the receiver file to \fIinteger\fP.
  2685. .Rs open:
  2686. Open the indicated file for reading.
  2687. The argument must be a \fBString\fP.
  2688. .Rs open:for:
  2689. The \fIfor:\fP argument must be one of 'r', 'w' or 'r+'
  2690. (see fopen(3) in the Unix programmers
  2691. manual).  Open the file in the indicated mode.
  2692. .Rs read
  2693. Return the next object from the file.
  2694. .Rs size
  2695. Return the size of the file, in character counts.
  2696. .Rs stringMode
  2697. Set the mode of the receiver file to \fIstring\fP.
  2698. .Rs write:
  2699. Write the argument into the file.
  2700. .Nm Object Collection KeyedCollection SequenceableCollection ArrayedCollection
  2701. .PP
  2702. The class \fBArrayedCollection\fP provides protocol for collections with a
  2703. Fixed size and integer keys.
  2704. Unlike other collections, which are created using the message \fInew\fP,
  2705. instances of \fBArrayedCollection\fP must be created using the one argument
  2706. message \fInew:\fP.  The argument given with this message must be a positive
  2707. integer, representing the size of the collection to be created.
  2708. In addition to the protocol shown, many of the methods inherited
  2709. from superclasses are redefined in this class.
  2710. .SH
  2711. Responds to
  2712. .Rs =
  2713. The argument must also be an \fBArray\fP.  Test whether the receiver and the
  2714. argument have equal elements listed in the same order.
  2715. .Rs at:ifAbsent:
  2716. Return the element stored with the given key.  Return the result
  2717. of evaluating the second argument if the key is not valid for the
  2718. receiver collection.
  2719. .Rs padTo: n
  2720. Return an array like the received that is at least as long as the argument
  2721. value.  Returns the receiver if it is already longer than the argument.
  2722. .Ex
  2723. \&'small' = 'small'    True
  2724. \&'small' = 'SMALL'    False
  2725. \&'small' asArray    #( $s $m $a $l $l)
  2726. \&'small' asArray = 'small'    True
  2727. #(1 2 3) padTo: 5    #(1 2 3 nil nil)
  2728. #(1 2 3) padTo: 2    #(1 2 3)
  2729. .Nm Object Collection KeyedCollection SequenceableCollection ArrayedCollection Array
  2730. .PP
  2731. Instances of the class \fBArray\fP are perhaps the most commonly used
  2732. data structure in Smalltalk programs.
  2733. \fBArrays\fP are represented textually by a pound sign preceding the list of
  2734. array elements.
  2735. .SH
  2736. Responds to
  2737. .Rs at:
  2738. Return the item stored in the position given by the argument.
  2739. An error message is produced, and \fBnil\fP returned, if the argument is not
  2740. a valid key.
  2741. .Rs at:put:
  2742. Store the second argument in the position given by the first argument.
  2743. An error message is produced, and \fBnil\fP returned, if the argument is not
  2744. a valid key.
  2745. .Rs grow:
  2746. Return a new array one element larger than the receiver, with the argument
  2747. value attached to the end.  This is a slightly more efficient command than
  2748. \fIcopyWith:\fP, although the effect is the same.
  2749. .Ex
  2750. i \(<- #(110 101 97)
  2751. i size    3
  2752. i \(<- i grow: 116    #( 110 101 97 116)
  2753. i \(<- i collect: [:x | x asCharacter]    #( #n #e #a #t )
  2754. i asString    neat
  2755. .Nm Object Collection KeyedCollection SequenceableCollection ArrayedCollection ByteArray
  2756. .PP
  2757. A \fBByteArray\fP is a special form of array in which the elements must be
  2758. numbers in the range 0-255.  Instances of \fBByteArray\fP are given a very
  2759. compact encoding, and are used extensively internally in the Little
  2760. Smalltalk system.
  2761. A \fBByteArray\fP can be represented textually by a pound sign preceding
  2762. the list of array elements surrounded by a pair of square braces.
  2763. .SH
  2764. Responds to
  2765. .Rs at:
  2766. Return the item stored in the position given by the argument.
  2767. An error message is produced, and \fBnil\fP returned, if the argument is not
  2768. a valid key.
  2769. .Rs at:put:
  2770. Store the second argument in the position given by the first argument.
  2771. An error message is produced, and \fBnil\fP returned, if the argument is not
  2772. a valid key.
  2773. .Ex
  2774. i \(<- #[110 101 97]
  2775. i size    3
  2776. i \(<- i copyWith: 116    #[ 110 101 97 116 ]
  2777. i \(<- i asArray collect: [:x | x asCharacter]    #( #n #e #a #t )
  2778. i asString    neat
  2779. .Nm Object Collection KeyedCollection SequenceableCollection ArrayedCollection String
  2780. .PP
  2781. Instances of the class \fBString\fP are similar to \fBArrays\fP, except
  2782. that the individual elements
  2783. must be \fBCharacter\fP.  \fBStrings\fP are represented literally by placing single
  2784. quote marks around the characters making up the string.
  2785. \fBStrings\fP also differ from \fBArrays\fP in that
  2786. Strings possess an ordering, given by the underlying ascii sequence.
  2787. .SH
  2788. Responds to
  2789. .Rs ,
  2790. Concatenates the argument to the
  2791. receiver string, producing a new string.
  2792. If the argument is not a \fBString\fP it is first converted
  2793. using \fIprintString\fP.
  2794. .Rs <
  2795. The argument must be a \fBString\fP.  Test if the receiver is lexically
  2796. less than the argument.  For the purposes of comparison case differences
  2797. are ignored.
  2798. .Rs <=
  2799. Test if the receiver is lexically less than or equal to the
  2800. argument.
  2801. .Rs >=
  2802. Test if the receiver is lexically greater than or equal to the argument.
  2803. .Rs >
  2804. Test if the receiver is lexically greater than the argument.
  2805. .Rs asSymbol r
  2806. Return a \fBSymbol\fP with characters given by the receiver string.
  2807. .Rs at:
  2808. Return the character stored at the position given by the argument.
  2809. Produce and error message, and return \fBnil\fP, if the argument does not represent
  2810. a valid key.
  2811. .Rs at:put:
  2812. Store the character given by second argument at the location given by
  2813. the first argument.  Produce an error message, and return \fBnil\fP, if either
  2814. argument is invalid.
  2815. .Rs copyFrom:length: n
  2816. Return a substring of the receiver.  The substring is taken from the
  2817. indicated starting position in the receiver and extends for the given length.
  2818. Produce an error message, and return \fBnil\fP, if the given positions are
  2819. not legal.
  2820. .Rs copyFrom:to: r
  2821. Return a substring of the receiver.  The substring is taken from the
  2822. indicated positions.
  2823. Produce an error message, and return \fBnil\fP, if the given positions are
  2824. not legal.
  2825. .Rs printAt: n
  2826. The argument must be a \fBPoint\fP which describes a location on the
  2827. terminal screen.  The string is printed at the specified location.
  2828. .Rs size
  2829. Return the number of characters stored in the string.
  2830. .Rs sameAs:
  2831. Return true if the receiver and argument string match with the exception of
  2832. case differences.  Note that the boolean message = , inherited from
  2833. ArrayedCollection, can be used to see if two strings are the same including
  2834. case differences.
  2835. .Ex
  2836. \&'example' at: 2    $x
  2837. \&'bead' at: 1 put: $r    read
  2838. \&'small' > 'BIG'    True
  2839. \&'small' sameAs: 'SMALL'    True
  2840. \&'tary' sort    arty
  2841. \&'Rats live on no evil Star' reversed    ratS live on no evil staR
  2842. .Nm Object Block
  2843. .PP
  2844. Although it is easy for the programmer to think of blocks as a syntactic
  2845. construct, or a control structure, they are actually objects, and share
  2846. attributes of all other objects in the Smalltalk system, such as the
  2847. ability to respond to messages.
  2848. .SH
  2849. Responds to
  2850. .Rs fork
  2851. Start the block executing as a \fBProcess\fP.
  2852. The value \fBnil\fP is immediately returned,
  2853. and the \fBProcess\fP created from the block
  2854. is scheduled to run in parallel with the current process.
  2855. .Rs forkWith:
  2856. Similar to \fIfork\fP, except that the array is passed as arguments to the
  2857. receiver block prior to scheduling for execution.
  2858. .Rs newProcess
  2859. A new \fBProcess\fP is created for the block, but is not
  2860. scheduled for execution.
  2861. .Rs newProcessWith: n
  2862. Similar to \fInewProcess\fP, except that the array is passed as arguments to the
  2863. receiver block prior to it being made into a process.
  2864. .Rs value
  2865. Evaluates the receiver block.  Produces an error message, and returns nil,
  2866. if the receiver block required arguments.  Return the value yielded by
  2867. the block.
  2868. .Rs value:
  2869. Evaluates the receiver block.  Produces an error message, and returns nil,
  2870. if the receiver block did not require a single argument.  Return the
  2871. value yielded by the block.
  2872. .Rs value:value:
  2873. Two argument block evaluation.
  2874. .Rs value:value:value:
  2875. Three argument block evaluation.
  2876. .Rs value:value:value:value:
  2877. Four argument block evaluation.
  2878. .Rs value:value:value:value:value:
  2879. .br
  2880. Five argument block evaluation.
  2881. .Rs whileTrue:
  2882. The receiver block is repeatedly evaluated.  While it evaluates to true,
  2883. the argument block is also evaluated.  Return nil when the receiver block
  2884. no longer evaluates to true.
  2885. .Rs whileTrue
  2886. The receiver block is repeatedly evaluated until it returns a value that is
  2887. not true.
  2888. .Rs whileFalse:
  2889. The receiver block is repeatedly evaluated.  While it evaluates to false,
  2890. the argument block is also evaluated.  Return nil when the receiver block
  2891. no longer evaluates to false.
  2892. .Rs whileFalse
  2893. The receiver block is repeatedly evaluated until it returns a value that is
  2894. not false.
  2895. .Ex
  2896. ['block indeed'] value    block indeed
  2897. [:x :y | x + y + 3] value: 5 value: 7    15
  2898. .Nm Object Class
  2899. .PP
  2900. The class \fBClass\fP provides protocol for manipulating class instances.
  2901. An instance of class \fBClass\fP is generated for each class in the Smalltalk
  2902. system.  New instances of this class are then formed by sending messages
  2903. to the class instance.
  2904. .SH
  2905. Responds to
  2906. .Rs deepCopy: n
  2907. The argument must be an instance of the receiver class.  A deepCopy
  2908. of the argument is returned.
  2909. .Rs edit n
  2910. The user is placed into a editor editing the file from which the class
  2911. description was originally obtained.  When the editor terminates, the class
  2912. description will be reparsed and will override the previous description.
  2913. See also \fIview\fP (below).
  2914. .Rs list n
  2915. Lists all subclasses of the given class recursively.
  2916. In particular, \fBObject\fP \fIlist\fP will list the names of all the
  2917. classes in the system.
  2918. .Rs new
  2919. A new instance of the receiver class is returned.  If the methods for
  2920. the receiver contain protocol for \fInew\fP, the new instance will
  2921. first be passed this message.
  2922. .Rs new:
  2923. A new instance of the receiver class is returned.  If the methods for
  2924. the receiver contain protocol for \fInew:\fP, the new instance will
  2925. first be passed this message.
  2926. .Rs respondsTo n
  2927. List all the messages that the current class will respond to.
  2928. .Rs respondsTo: d
  2929. The argument must be a Symbol.  Return true if the receiver class,
  2930. or any of its superclasses, contains a method
  2931. for the indicated message. Return false otherwise.
  2932. .Rs shallowCopy: n
  2933. The argument must be an instance of the receiver class.  A shallowCopy
  2934. of the argument is returned.
  2935. .Rs superClass n
  2936. Return the superclass of the receiver class.
  2937. .Rs variables n
  2938. Return an array containing the names of the instance variables used in
  2939. the receiver class.
  2940. .Rs view n
  2941. Place the user into an editor viewing the class description from which the
  2942. class was created.  Changes made to the file will not, however, affect the
  2943. current class representation.
  2944. .Ex
  2945. Array new: 3    #( nil nil nil )
  2946. Bag respondsTo: #add:    True
  2947. SequenceableCollection superClass    KeyedCollection
  2948. .Nm Object Process
  2949. .PP
  2950. Processes are created by the system, or by passing the message \fInewProcess\fP
  2951. or \fIfork\fP to a block; they cannot be created directly by the user.
  2952. .SH
  2953. Responds To
  2954. .Rs block
  2955. The receiver process is marked as being blocked.  This is usually
  2956. the result of a semaphore wait.
  2957. Blocked processes are not executed.
  2958. .Rs resume
  2959. If the receiver process has been \fIsuspend\fPed, it is rescheduled for
  2960. execution.
  2961. .Rs suspend
  2962. If the receiver process is scheduled for execution, it is marked as
  2963. suspended.  Suspended processes are not executed.
  2964. .Rs state
  2965. The current state of the receiver process is returned as a Symbol.
  2966. .Rs terminate
  2967. The receiver process is terminated.  Unlike a blocked or suspended process,
  2968. a terminated process cannot be restarted.
  2969. .Rs unblock
  2970. If the receiver process is currently blocked, it is scheduled for
  2971. execution.
  2972. .Rs yield
  2973. Returns \fBnil\fP.  As a side effect, however,
  2974. if there are pending processes the current process is
  2975. placed back on the process queue and another process started.
  2976. End
  2977. echo unbundling st.1 1>&2
  2978. cat >st.1 <<'End'
  2979. .TH st 1 "local"
  2980. .SH NAME
  2981. st \- a Little Smalltalk
  2982. .SH SYNOPSIS
  2983. st [options] [files]
  2984. .SH DESCRIPTION
  2985. .PP
  2986. \fBst\fP is an interpreter for a Smalltalk-like language.  For a complete
  2987. description of the language accepted by the interpreter see the user manual.
  2988. Options accepted by the command are as follows:
  2989. .IP \-a
  2990. If the \-a option is given statistics on the number of memory allocations
  2991. will be displayed following execution.
  2992. .IP \-d\fIdigit\fP
  2993. If the \fIdigit\fP is zero only those results explicitly requested by the
  2994. user will be printed.  If 1, the values of expressions typed at the
  2995. keyboard will be displayed (this is the default).
  2996. If 2, the values of expressions and the values
  2997. assigned in assignment statements will be displayed.
  2998. .IP \-f
  2999. The \-f option indicates fast loading should be used, which loads a binary
  3000. save image (see ``)s'' below) for the standard library.
  3001. .IP \-g
  3002. The next argument is taken to be the name of an additional library stored
  3003. in the system library area.  The library is loaded following the standard
  3004. prelude, just as if a ``)g'' directive were given at the beginning of
  3005. execution (see below).
  3006. .IP \-l
  3007. The next argument is taken to be the name of a file containing a binary
  3008. image saved using the )s directive (see below).  This binary image is
  3009. loaded prior to execution.
  3010. .IP \-m
  3011. Do not perform fast loading.  (Used when fastloading is the default).
  3012. .IP \-n
  3013. The \-n option, if given, suppresses the loading
  3014. of the standard library.
  3015. As this gives you a system with almost no functionality, it is seldom
  3016. useful except during debugging.
  3017. .IP \-r
  3018. The next argument is taken to be the name of a file of
  3019. Smalltalk commands.  The file is included prior to execution, just
  3020. as if a ``)r'' directive were given at the beginning of execution (see below).
  3021. .IP \-s
  3022. In normal operation, at the end of execution the number of reference
  3023. count increments and decrements is printed just prior to exit.
  3024. In the absence of cycles these two
  3025. figures should be equal.  Since cycles can cause large chunks of memory to
  3026. become unreachable, and seriously degrade performance, this information is
  3027. often useful in debugging.
  3028. The \-s option, if given, suppresses the printing of this information.
  3029. .PP
  3030. The files, if given, must contain class descriptions.  Consult the
  3031. reference manual for the syntax for class descriptions.  The classes
  3032. defined are included along with the standard library of classes before
  3033. execution begins.
  3034. .PP
  3035. Once execution begins, the cursor will tab over 8 spaces to indicate that
  3036. a command can be entered.
  3037. A command consists of a valid Smalltalk expression, without a terminating
  3038. period.
  3039. As each expression is entered it is executed by the Little Smalltalk
  3040. interpreter, and the results displayed.
  3041. .PP
  3042. The following system directives can be entered in place of commands:
  3043. .IP ")e filename"
  3044. Edit the named file, which must contain only class descriptions.
  3045. The Little Smalltalk system will suspend, leaving the user in an editor
  3046. for making changes to the named file.  Upon exiting the editor, the named
  3047. file will automatically be included, as with the )i directive (below).
  3048. The editor chosen by this command is taken from the variable EDITOR in the
  3049. user's environment.
  3050. .IP ")g filename"
  3051. Search for a file with the given name in the system library area.
  3052. If found, load the library in with the users classes.  This is useful for
  3053. creating libraries of commonly used classes which are not part of the
  3054. standard prelude, such as classes for statistics applications or for
  3055. graphics.
  3056. .IP ")i filename"
  3057. Include the named file.  The File must contain one or more class
  3058. descriptions.  The class descriptions are parsed, and if syntactically
  3059. legal new instances of class \fBClass\fP are added to the Smalltalk system.
  3060. .IP ")l filename"
  3061. Load a saved binary environment.  The file must have been previously
  3062. created using the )s directive (below).  The values of all variables are
  3063. overridden.
  3064. .IP ")r filename"
  3065. Read the named file.  The effect is just as if the lines in the file
  3066. had been typed at the keyboard.  The file cannot contain class
  3067. descriptions.
  3068. .IP ")s filename"
  3069. Save the current environment in the named file.  The values of all
  3070. variables will be saved, and can later be restored using the )l directive
  3071. (above).
  3072. .IP ")!string"
  3073. .br
  3074. Execute the string following the exclamation point as
  3075. a Unix command.
  3076. .SH "Author"
  3077. Tim Budd, Department of Computer Science, Oregon State University
  3078. .SH "See Also"
  3079. Timothy A. Budd,
  3080. \fIA Little Smalltalk\fP, published by Addison Wesley.
  3081. .SH Bugs
  3082. Not all the Smalltalk-80 Language described in the Blue Book is supported;
  3083. see the user manual for details.
  3084. (Smalltalk-80 is a trademark of Xerox Corporation).
  3085. End
  3086. echo unbundling syntax 1>&2
  3087. cat >syntax <<'End'
  3088. .so macros
  3089. .ds CH
  3090. .Sx "Class Description"
  3091. .PS
  3092. ellipsewid = 1.3i
  3093. arrow
  3094. A: ellipse "class heading"
  3095. arc -> cw
  3096. arc
  3097. ellipse "instance variables"
  3098. arc ->
  3099. arc cw
  3100. B: ellipse "protocol"
  3101. arrow
  3102. arrow from A.e to B.w
  3103. .PE
  3104. .Sx "Class Heading"
  3105. .PS
  3106. arrow
  3107. circle "\fBClass\fP"
  3108. arrow
  3109. ellipse "variable"
  3110. arrow right 3i
  3111. move left 3i
  3112. move right 0.1i
  3113. arc -> cw
  3114. arc
  3115. ellipse "colon variable"
  3116. arc ->
  3117. arc cw
  3118. .PE
  3119. .IP
  3120. \fBvariable\fP defines the class name, must begin with an upper case letter.
  3121. .br
  3122. \fBcolon variable\fP defines the superclass name, superclass is \fBObject\fP
  3123. if not given.
  3124. .Sx "Instance Variables"
  3125. .PS
  3126. arrow
  3127. circle "|"
  3128. arrow
  3129. A: ellipse "variable"
  3130. arc -> cw
  3131. arc cw
  3132. arrow left 1.3i
  3133. arc cw
  3134. arc cw
  3135. move to A.e
  3136. arrow
  3137. circle "|"
  3138. arrow
  3139. .PE
  3140. .IP
  3141. Instance variables must begin with a lower case letter.
  3142. .Sx "Protocol"
  3143. .PS
  3144. arrow
  3145. circle "["
  3146. arrow
  3147. A: ellipse "method"
  3148. arc -> cw
  3149. line down 0.2i
  3150. arc cw
  3151. arrow left 0.4i
  3152. circle "|"
  3153. arrow left 0.4i
  3154. arc cw
  3155. line up 0.2i
  3156. arc cw
  3157. move to A.e
  3158. arrow
  3159. circle "]"
  3160. arrow
  3161. .PE
  3162. .IP
  3163. Vertical bar separating methods \fBmust\fP be placed in column 1.
  3164. .Sx "Method"
  3165. .PS
  3166. arrow
  3167. A: ellipse "method pattern"
  3168. arc -> cw
  3169. arc
  3170. ellipse "temporary variables"
  3171. arc ->
  3172. arc cw
  3173. C: ellipse "statements"
  3174. arrow
  3175. arrow from A.e to C.w
  3176. .PE
  3177. .bp
  3178. .Sx "Method Pattern"
  3179. .PS
  3180. A: arrow
  3181. ellipse "unary selector"
  3182. arrow right 3i
  3183. move to A
  3184. arc -> cw
  3185. line down 0.1i
  3186. B: arc
  3187. ellipse "binary selector"
  3188. arrow
  3189. ellipse "argument variable"
  3190. arc ->
  3191. line up 0.1i
  3192. arc -> cw
  3193. move to start of B
  3194. line down 0.6i
  3195. arc
  3196. ellipse "keyword selector"
  3197. arrow
  3198. C: ellipse "argument variable"
  3199. arc
  3200. line up 0.6i
  3201. move to C.e
  3202. right
  3203. arc -> cw
  3204. arc cw
  3205. arrow left 3.1i
  3206. arc -> cw
  3207. arc cw
  3208. .PE
  3209. .IP
  3210. Argument variables must begin with a lower case letter,
  3211. and must be distinct from instance variables.
  3212. .Sx "Temporary Variables"
  3213. .PS
  3214. arrow
  3215. circle "|"
  3216. arrow
  3217. A: ellipse "variable"
  3218. arc -> cw
  3219. arc cw
  3220. arrow left 1.3i
  3221. arc cw
  3222. arc cw
  3223. move to A.e
  3224. arrow
  3225. circle "|"
  3226. arrow
  3227. .PE
  3228. .IP
  3229. temporary variables must begin with lower case letters,
  3230. and must be distinct from both instance and argument variables.
  3231. .Sx "Statements"
  3232. .PS
  3233. arrow
  3234. A: line right 1.5i
  3235. move to start of A
  3236. arc -> cw
  3237. arc
  3238. circle "\s+6\(ua\s-6"
  3239. arc ->
  3240. arc cw
  3241. B: ellipse "expression"
  3242. arrow right 2.5i
  3243. move to B.e
  3244. move right 0.5i
  3245. arc -> cw
  3246. arc
  3247. circle "."
  3248. arc ->
  3249. arc cw
  3250. move to B.e
  3251. arc -> cw
  3252. line down 0.4i
  3253. arc -> cw
  3254. circle "."
  3255. arrow left 2.5i
  3256. arc cw
  3257. arrow up 0.4i
  3258. arc cw
  3259. .PE
  3260. .Sx "Expression"
  3261. .PS
  3262. A: arrow right 3.3i
  3263. move to start of A
  3264. arc -> cw
  3265. arc
  3266. ellipse "variable"
  3267. arrow
  3268. B: circle "<\(mi"
  3269. arc ->
  3270. arc cw
  3271. C: ellipse "cascaded expression"
  3272. arrow
  3273. move to B.e
  3274. arc -> cw
  3275. arc cw
  3276. arrow left 2.3i
  3277. arc -> cw
  3278. arc cw
  3279. .PE
  3280. .bp
  3281. .Sx "Cascaded Expression"
  3282. .PS
  3283. arrow
  3284. ellipse "simple expression"
  3285. arrow right 3.5i
  3286. move left 0.5i
  3287. right
  3288. arc -> cw
  3289. arc cw
  3290. circle ";"
  3291. arrow
  3292. ellipse "continuation"
  3293. arc -> cw
  3294. arc cw
  3295. .PE
  3296. .Sx "Simple Expression"
  3297. .PS
  3298. arrow
  3299. A: ellipse "binary"
  3300. arrow
  3301. move to A.e
  3302. arc -> cw
  3303. line down 0.2i
  3304. arc cw
  3305. ellipse "keyword"
  3306. arc -> cw
  3307. line up 0.2i
  3308. arc cw
  3309. .PE
  3310. .Sx "Binary"
  3311. .PS
  3312. arrow
  3313. A: ellipse "unary"
  3314. arrow
  3315. move to A.e
  3316. arc -> cw
  3317. B: line down 0.2i
  3318. arc cw
  3319. ellipse "binary selector"
  3320. arc -> cw
  3321. line up 0.2i
  3322. arc cw
  3323. .PE
  3324. .Sx "Unary"
  3325. .PS
  3326. arrow
  3327. A: ellipse "primary"
  3328. B: line right 2i
  3329. arc -> cw
  3330. arc cw
  3331. ellipse "unary selector"
  3332. arc -> cw
  3333. arc cw
  3334. move to B.e
  3335. arrow right
  3336. .PE
  3337. .Sx "Primitive"
  3338. .PS
  3339. arrow right 0.2i
  3340. circle "<primitive" wid 0.7i
  3341. arrow right 0.2i
  3342. ellipse "unsigned integer"
  3343. A: line right 1.7i
  3344. arc -> cw
  3345. arc cw
  3346. ellipse "primary"
  3347. arc -> cw
  3348. arc cw
  3349. move to A.e
  3350. arrow right
  3351. circle ">"
  3352. arrow right
  3353. .PE
  3354. .IP
  3355. Unsigned integer must be a number in the range 0-255.
  3356. .bp
  3357. .Sx "Primary"
  3358. .PS
  3359. A: arrow right 2i
  3360. ellipse "variable"
  3361. arrow right 2i
  3362. move to start of A
  3363. move right 0.5i
  3364. arc -> cw
  3365. B: line down 0.1i
  3366. arc
  3367. arrow right 1i
  3368. ellipse "literal"
  3369. arrow right 1i
  3370. arc ->
  3371. line up 0.1i
  3372. arc cw
  3373. move to end of B
  3374. C: arrow down 0.6i
  3375. arc
  3376. arrow right 1i
  3377. ellipse "block"
  3378. arrow right 1i
  3379. arc ->
  3380. line up 0.6i
  3381. move to end of C
  3382. Z: arrow down 0.6i
  3383. arc
  3384. arrow right 1i
  3385. ellipse "primitive"
  3386. arrow right 1i
  3387. arc ->
  3388. line up 0.6i
  3389. move to end of Z
  3390. arrow down 0.6i
  3391. arc
  3392. circle "("
  3393. arrow
  3394. ellipse "cascaded expression"
  3395. arrow
  3396. circle ")"
  3397. arc ->
  3398. line up 0.6i
  3399. .PE
  3400. .IP
  3401. If variable begins with an upper case letter it is a class name, otherwise
  3402. variable must be instance, argument or temporary variable or pseudo variable
  3403. name.
  3404. .Sx "Continuation"
  3405. .PS
  3406. A: arrow
  3407. arrow right 1.5i
  3408. ellipse "unary selector"
  3409. Z: line right 1.5i
  3410. arrow right 0.5i
  3411. move to end of Z
  3412. arc -> cw
  3413. arrow down 2i
  3414. arc -> cw
  3415. arrow left 4.5i
  3416. arc -> cw
  3417. arrow up 2i
  3418. arc -> cw
  3419. move to end of A
  3420. arc -> cw
  3421. C: arrow down 0.4i
  3422. arc
  3423. ellipse "binary selector"
  3424. arrow
  3425. ellipse "unary"
  3426. arc ->
  3427. line up 0.4i
  3428. arc cw
  3429. move to end of C
  3430. arrow down 0.6i
  3431. arc
  3432. ellipse "keyword"
  3433. arrow
  3434. D: ellipse "binary"
  3435. arc ->
  3436. line up 0.6i
  3437. move to D.e
  3438. right
  3439. arc -> cw
  3440. arc cw
  3441. arrow left 3.1i
  3442. arc cw
  3443. arc -> cw
  3444. .PE
  3445. .bp
  3446. .Sx "Block"
  3447. .PS
  3448. arrow
  3449. A: circle "["
  3450. arrow right 2.2i
  3451. ellipse "statements"
  3452. arrow
  3453. circle "]"
  3454. arrow
  3455. move to A.e
  3456. arc -> cw
  3457. arc
  3458. ellipse "block arguments" width 1.2i
  3459. arc ->
  3460. arc cw
  3461. .PE
  3462. .IP
  3463. The last statement cannot be followed by a period.
  3464. .Sx "Block Arguments"
  3465. .PS
  3466. arrow
  3467. A: ellipse "colon variable"
  3468. arrow
  3469. circle "|"
  3470. arrow
  3471. move to A.e
  3472. arc -> cw
  3473. arc cw
  3474. arrow left 1.3i
  3475. arc cw
  3476. arc cw
  3477. .PE
  3478. .Sx "Literal"
  3479. .PS
  3480. arrow right 1i
  3481. A: arrow
  3482. ellipse "number"
  3483. arrow right 1.5i
  3484. move to start of A
  3485. arc -> cw
  3486. B: line down 0.1i
  3487. arc
  3488. ellipse "symbol"
  3489. arc ->
  3490. line up 0.1i
  3491. arc cw
  3492. move to end of B
  3493. C: arrow down 0.6i
  3494. arc
  3495. ellipse "string"
  3496. arc ->
  3497. line up 0.6i
  3498. move to end of C
  3499. D: arrow down 0.6i
  3500. arc
  3501. ellipse "character constant"
  3502. arc ->
  3503. line up 0.6i
  3504. move to end of D
  3505. H: arrow down 0.6i
  3506. arc
  3507. ellipse "bytearray"
  3508. arc ->
  3509. line up 0.6i
  3510. move to end of H
  3511. E: arrow down 0.6i
  3512. arc
  3513. ellipse "array constant"
  3514. arc ->
  3515. line up 0.6i
  3516. .PE
  3517. .bp
  3518. .Sx "Number"
  3519. .PS
  3520. A: arrow right 3.6i
  3521. move to start of A
  3522. arc -> cw
  3523. arc
  3524. ellipse "base" width 0.8i
  3525. arc ->
  3526. arc cw
  3527. arc -> cw
  3528. arc
  3529. ellipse "sign" width 0.8i
  3530. arc ->
  3531. arc cw
  3532. ellipse "unsigned number"
  3533. arrow
  3534. .PE
  3535. .Sx "Base"
  3536. .PS
  3537. arrow
  3538. ellipse "unsigned integer"
  3539. arrow
  3540. circle "r"
  3541. arrow
  3542. .PE
  3543. .Sx "Sign"
  3544. .PS
  3545. A: arrow
  3546. arrow right 3i
  3547. move to end of A
  3548. B: arc cw
  3549. arc
  3550. circle "+"
  3551. arc
  3552. arc cw
  3553. move to end of B
  3554. arrow down 0.6i
  3555. arc
  3556. circle "\(mi"
  3557. arc
  3558. arrow up 0.6i
  3559. .PE
  3560. .Sx "Unsigned Number"
  3561. .PS
  3562. arrow
  3563. A: ellipse "unsigned fraction"
  3564. arc -> cw
  3565. arc
  3566. circle "e"
  3567. arrow right 0.25i
  3568. ellipse "sign" width 0.8i
  3569. arrow right 0.25i
  3570. ellipse "unsigned integer"
  3571. arc ->
  3572. arc cw
  3573. move to A.e
  3574. arrow right 4.2i
  3575. .PE
  3576. .Sx "Unsigned Fraction"
  3577. .PS
  3578. arrow
  3579. A: ellipse "unsigned integer"
  3580. arc -> cw
  3581. arc
  3582. circle "."
  3583. arrow
  3584. ellipse "unsigned integer"
  3585. arc ->
  3586. arc cw
  3587. move to A.e
  3588. arrow right 4i
  3589. .PE
  3590. .Sx "Unsigned Integer"
  3591. .PS
  3592. arrow
  3593. A: circle "digit"
  3594. arrow
  3595. move to A.e
  3596. arc -> cw
  3597. arc cw
  3598. arrow left 0.5i
  3599. arc -> cw
  3600. arc cw
  3601. .PE
  3602. .bp
  3603. .Sx "Symbol"
  3604. .PS
  3605. arrow
  3606. circle "#"
  3607. arrow
  3608. A: circle "char"
  3609. arrow
  3610. move to A.e
  3611. arc cw
  3612. arc cw
  3613. arrow left 0.5i
  3614. arc cw
  3615. arc cw
  3616. .PE
  3617. .IP
  3618. char is any non-space character that is not one of period, parenthesis
  3619. or square braces.
  3620. .Sx "String"
  3621. .PS
  3622. arrow
  3623. circle "'"
  3624. arrow
  3625. A: circle "char"
  3626. arrow
  3627. circle "'"
  3628. arrow
  3629. move to A.e
  3630. arc cw
  3631. arc cw
  3632. arrow left 0.5i
  3633. arc cw
  3634. arc cw
  3635. .PE
  3636. .IP
  3637. To include a quote mark in a string, use two adjacent quote marks.
  3638. .Sx "Character Constant"
  3639. .PS
  3640. arrow
  3641. circle "$"
  3642. arrow
  3643. circle "char"
  3644. arrow
  3645. .PE
  3646. .Sx "Bytearray"
  3647. .PS
  3648. arrow
  3649. circle "#"
  3650. arrow
  3651. circle "["
  3652. arrow
  3653. A: ellipse "unsigned integer"
  3654. arrow
  3655. circle "]"
  3656. arrow
  3657. move to A.e
  3658. arc -> cw
  3659. arc cw
  3660. line left 1.3i
  3661. arc -> cw
  3662. arc cw
  3663. .PE
  3664. .IP
  3665. Integer must be in the range 0 through 255.
  3666. .Sx "Array Constant"
  3667. .PS
  3668. arrow
  3669. circle "#"
  3670. arrow
  3671. ellipse "array"
  3672. arrow
  3673. .PE
  3674. .bp
  3675. .Sx "Array"
  3676. .PS
  3677. arrow
  3678. circle "("
  3679. arrow
  3680. A: arc -> cw
  3681. arc
  3682. ellipse "number"
  3683. arc ->
  3684. arc cw
  3685. B: arrow
  3686. circle ")"
  3687. arrow
  3688. move to start of A
  3689. arrow right 2.5i
  3690. move to end of A
  3691. C: arrow down 0.6i
  3692. arc
  3693. ellipse "symbol"
  3694. arc ->
  3695. arrow up 0.6i
  3696. move to end of C
  3697. D: arrow down 0.6i
  3698. arc
  3699. ellipse "string"
  3700. arc ->
  3701. arrow up 0.6i
  3702. move to end of D
  3703. E: arrow down 0.6i
  3704. arc
  3705. ellipse "character constant"
  3706. arc ->
  3707. arrow up 0.6i
  3708. move to end of E
  3709. arrow down 0.6i
  3710. arc
  3711. ellipse "array"
  3712. arc ->
  3713. arrow up 0.6i
  3714. move to start of B
  3715. right
  3716. arc -> cw
  3717. arrow down 3i
  3718. arc -> cw
  3719. arrow left 2.4i
  3720. arc -> cw
  3721. arrow up 3i
  3722. arc -> cw
  3723. .PE
  3724. .IP
  3725. The leading sharp sign can be omitted in symbols and arrays inside of
  3726. an array list.
  3727. Binary selectors, keywords, and other strings are treated as Symbols inside
  3728. of arrays.
  3729. End
  3730.