02-getstart.lpt 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. PSL Manual 7 February 1983 Getting Started
  2. section 2.0 page 2.1
  3. CHAPTER 2 CHAPTER 2 CHAPTER 2
  4. GETTING STARTED WITH PSL GETTING STARTED WITH PSL GETTING STARTED WITH PSL
  5. 2.1. Purpose of This Chapter. . . . . . . . . . . . 2.1
  6. 2.2. Defining Logical Device Names for PSL . . . . . . . 2.1
  7. 2.2.1. DEC-20 . . . . . . . . . . . . . . . 2.2
  8. 2.2.2. VAX . . . . . . . . . . . . . . . . 2.2
  9. 2.3. Starting PSL . . . . . . . . . . . . . . . 2.3
  10. 2.3.1. DEC-20 . . . . . . . . . . . . . . . 2.3
  11. 2.3.2. VAX . . . . . . . . . . . . . . . . 2.3
  12. 2.4. Running the PSL System . . . . . . . . . . . . 2.4
  13. 2.4.1. Loading Optional Modules . . . . . . . . . 2.4
  14. 2.4.2. Notes on Running PSL and RLISP . . . . . . . 2.4
  15. 2.4.3. Transcript of a Short Session with PSL . . . . 2.5
  16. 2.5. Error and Warning Messages. . . . . . . . . . . 2.8
  17. 2.6. Compilation Versus Interpretation . . . . . . . . 2.8
  18. 2.7. Function Types. . . . . . . . . . . . . . . 2.9
  19. 2.8. Switches and Globals. . . . . . . . . . . . . 2.10
  20. 2.9. Reporting Errors and Misfeatures. . . . . . . . . 2.10
  21. 2.1. Purpose of This Chapter 2.1. Purpose of This Chapter 2.1. Purpose of This Chapter
  22. This chapter is for beginning users of PSL on the DEC-20 and the VAX 750
  23. and 780 at Utah. It also is meant to be a guide to those familiar with
  24. LISP, and particularly STANDARD LISP, who would like to use PSL as they
  25. read the manual.
  26. It begins with descriptions of how to set up various logical device
  27. definitions required by PSL and how to run PSL. A number of miscellaneous
  28. hints and reminders are given in the remainder of the chapter.
  29. 2.2. Defining Logical Device Names for PSL 2.2. Defining Logical Device Names for PSL 2.2. Defining Logical Device Names for PSL
  30. When PSL is installed on your system, the person doing the installation
  31. has the option of using a number of different directory structures and
  32. names, depending on local conventions and available space. There are also
  33. options to select a small system (without all source-code online) or a full
  34. system. Also, as each release of PSL is prepared, we may find it
  35. convenient to change the names and number of sub-directories. In order to
  36. minimize the inconvenience, an attempt has been made to refer to such
  37. directories through some form of logical name ("logical device name" on
  38. DEC-20, shell-variable or link on VAX-UNIX, etc.). In some cases these can
  39. be used as if they were directory names (DEC-20), and in some cases not
  40. (VAX). These definitions are edited at installation time to reflect local Getting Started 7 February 1983 PSL Manual
  41. page 2.2 section 2.2
  42. usage, and stored in a file whose name is something like
  43. "logical-names.xxx". This file will be placed on an appropriate directory
  44. (often <PSL> on the DEC-20, ~psl on the VAX, etc.). A message should be
  45. sent out by your installer to indicate where the file is, and its name. It
  46. is suggested that a use of this file be placed in your LOGIN.CMD , .cshrc
  47. or equivalent file.
  48. 2.2.1. DEC-20 2.2.1. DEC-20 2.2.1. DEC-20
  49. It is absolutely essential that TAKE <PSL>LOGICAL-NAMES.CMD be inserted
  50. in your LOGIN.CMD file, or executed at EXEC level before using PSL. PSL is
  51. written to rely on these logical device definitions in place of
  52. "hard-coded" directory names. PSL also uses TOPS-20 search paths, so that
  53. for example, "PH:" is defined as the directory (or search list) on which
  54. PSL looks for help files, "PL:" is the directory (or search list) on which
  55. Lap Fasl Lap Fasl PSL looks for Lap and Fasl files of the form "xxxx.b", etc.
  56. The logical name "PSL:" is defined to be the directory on which the PSL
  57. executables reside. Thus "PSL:PSL.EXE" should start PSL executing.
  58. There should usually be a PSL:BARE-PSL.EXE, PSL:PSL.EXE and
  59. PSL:RLISP.EXE. BARE-PSL is the minimum system that is constructed during
  60. the PSL build sequence. PSL and RLISP usually contain additional modules
  61. selected by the installer, felt to be most commonly used by your community.
  62. 2.2.2. VAX 2.2.2. VAX 2.2.2. VAX
  63. In the current version of UNIX (4.1) there is no equivalent of logical
  64. device definitions that can be used to access files on other directories
  65. from within PSL or many UNIX utilities. We have defined a set of shell
  66. variables ($ variables) that may be used outside of an executing PSL to
  67. refer to the appropriate directories, and a series of PSL global variables
  68. for use inside PSL that contain the equivalent of search paths. In a
  69. future release of PSL for the VAX, we may be able to look up such shell or
  70. environment variables during the attempt to OPEN a file.
  71. These variables are defined in the file "psl-names", usually on the
  72. directory "~psl" (actually /u/local/psl at UTAH). Insert a "source
  73. ~psl/psl-names" or equivalent in your .cshrc file. Variables such as
  74. "$psl", "$pl", and "$pu" (on which many utility sources are stored) are
  75. defined.
  76. There should usually be a "$psl/bare-psl", "$psl/psl" and "$psl/rlisp".
  77. Bare-psl is the minimum system that is constructed during the PSL build
  78. sequence. PSL and RLISP usually contain additional modules selected by the
  79. installer, felt to be most commonly used by your community. PSL Manual 7 February 1983 Getting Started
  80. section 2.3 page 2.3
  81. 2.3. Starting PSL 2.3. Starting PSL 2.3. Starting PSL
  82. 2.3.1. DEC-20 2.3.1. DEC-20 2.3.1. DEC-20
  83. After defining the device names, type either PSL:RLISP or PSL:PSL to the
  84. at-sign prompt, @. A welcome message indicates the nature of the system
  85. running, usually with a date and version number. This information may be
  86. useful in describing problems. [Messages concerning bugs or misfeatures
  87. should be directed to PSL-BUGS@UTAH-20; see Section 2.9.]
  88. BARE-PSL.EXE is a "bare" PSL using LISP (i.e. parenthesis) syntax. This
  89. is a small core-image and is ideal for simple LISP execution. It also
  90. Fasl Fasl includes a resident Fasl, so additional modules can be loaded. In
  91. particular, the compiler is not normally part of PSL.EXE.
  92. RLISP.EXE is PSL with additional modules loaded, corresponding to the
  93. most common system run at Utah. It contains the compiler and an RLISP
  94. parser. For more information about RLISP see Chapter 3.
  95. It is assumed by PSL and RLISP that file names be of the form "*.sl" or
  96. Fasl Fasl "*.lsp" for LISP files, "*.red" for RLISP files, "*.b" for Fasl files, and
  97. Lap Lap "*.lap" for Lap files.
  98. 2.3.2. VAX 2.3.2. VAX 2.3.2. VAX
  99. The executable files are $psl/psl and $psl/rlisp. Loadable modules are
  100. on $pl/*.b or $pl/*.lap. Help files are on $ph/*.hlp.
  101. $psl/rlisp has the RLISP parser and compiler. Additional modules can be
  102. Load Error Load Error loaded from $pl using the Load function. <Ctrl-C> causes a call to Error,
  103. and may be used to stop a runaway computation. <Ctrl-Z> or the function
  104. Quit Quit Quit cause the process to be stopped, and control returned to the shell;
  105. the process may be continued. A sequence of <Ctrl-D>'s (EOF) causes the
  106. process to be terminated. This is to allow the use of I/O redirection from
  107. the shell.
  108. [??? Add Cntrl-B for BREAK loop call ???] [??? Add Cntrl-B for BREAK loop call ???] [??? Add Cntrl-B for BREAK loop call ???]
  109. Unix 4.1 and 4.1a allow only 14 characters for file names, and case is
  110. significant. The use of ".r" instead of ".red" is recommended as the
  111. extension for RLISP files to save on meaningful characters; other
  112. extensions are as on the DEC-20. Getting Started 7 February 1983 PSL Manual
  113. page 2.4 section 2.4
  114. 2.4. Running the PSL System 2.4. Running the PSL System 2.4. Running the PSL System
  115. The following sub-sections collect a few miscellaneous notes that are
  116. further expanded on elsewhere. They are provided here simply to get you
  117. started.
  118. 2.4.1. Loading Optional Modules 2.4.1. Loading Optional Modules 2.4.1. Loading Optional Modules
  119. Certain modules are not present in the "kernel" or "bare-psl" system, but
  120. can be loaded as options. Some of these optional modules will "auto-load"
  121. when first referenced; others may be explicitly loaded by the user, or
  122. included by the installer when building the "PSL" and "RLISP" core images.
  123. Optional modules can be loaded by executing
  124. LOAD modulename; % in RLISP syntax
  125. or
  126. (LOAD modulename) % in LISP syntax.
  127. The global variable OPTIONS!* contains a list of modules currently
  128. loaded; it does not mention those in the "bare-psl" kernel. Do not reset
  129. this variable; it is used by LOAD to avoid loading already present modules.
  130. RELOAD RELOAD [See RELOAD in Chapter 18].
  131. 2.4.2. Notes on Running PSL and RLISP 2.4.2. Notes on Running PSL and RLISP 2.4.2. Notes on Running PSL and RLISP
  132. Help Help Help Help a. Use Help(); [(Help) in LISP] for general help or an indication
  133. Help Help Help Help of what help is available; use Help (a, b, c); [(Help a b c) in
  134. LISP] for information on topics a, b, and c. This call prints
  135. Help Help files from the PH: (i.e. <PSL.HELP>) directory. Try Help x;
  136. Help Help [(Help x) in LISP] on:
  137. ? Exec Mini Step
  138. Br Find MiniEditor Strings
  139. Break Switches MiniTrace TopLoop
  140. Bug For Package Tr
  141. Debug Globals PRLISP Trace
  142. Defstruct GSort PSL UnBr
  143. Edit Help RCREF UnTr
  144. EditF JSYS RLISP Useful
  145. Editor Load ShowSwitches ZFiles
  146. Emode Manual Slate ZPEdit
  147. EWindow
  148. [??? Help() does not work in RLISP ???] [??? Help() does not work in RLISP ???] [??? Help() does not work in RLISP ???]
  149. b. File I/O needs string-quotes (") around file names. File names
  150. may use full TOPS-20 or UNIX conventions, including directories, PSL Manual 7 February 1983 Getting Started
  151. section 2.4 page 2.5
  152. sub-directories, etc.
  153. IN IN Input in RLISP mode is done using the 'IN "File-Name";' command.
  154. Dskin Dskin Use (Dskin "File-Name") for input from LISP mode.
  155. For information on similar I/O functions see Chapter 12.
  156. Quit Quit Quit Quit c. Use Quit; [(Quit) in LISP] or <Ctrl-C> on the DEC-20 (<Ctrl-Z>
  157. on the VAX) to exit. <Ctrl-C> (<Ctrl-Z> on the VAX) is useful
  158. for stopping run-away computations. On the DEC-20, typing START
  159. or CONTINUE to the @ prompt from the EXEC usually restarts in a
  160. reasonable way.
  161. 2.4.3. Transcript of a Short Session with PSL 2.4.3. Transcript of a Short Session with PSL 2.4.3. Transcript of a Short Session with PSL
  162. The following is a transcript of running PSL on the DEC-20. Getting Started 7 February 1983 PSL Manual
  163. page 2.6 section 2.4
  164. @psl:psl
  165. PSL 3.1, 11-Oct-82
  166. 1 Lisp> % Notice the numbered prompt.
  167. 1 Lisp> % Comments begin with "%" and do not change the prompt
  168. 1 Lisp> % number.
  169. 1 Lisp> (Setq Z '(1 2 3)) % Make an assignment for Z.
  170. (1 2 3)
  171. 2 Lisp> (Cdr Z) % Notice the change in prompt number.
  172. (2 3)
  173. 3 Lisp> (De Count (L) % Count counts the number or elements
  174. 3 Lisp> (Cond ((Null L) 0) % in a list L.
  175. 3 Lisp> (T (Add1 (Count (Cdr L))))))
  176. COUNT
  177. 4 Lisp> (Count Z) % Call Count on Z.
  178. 3
  179. 5 Lisp> (Tr Count) % Trace the recursive execution of "Count".
  180. (COUNT)
  181. 6 Lisp> % A call on "Count" now shows the value of
  182. 6 Lisp> % "Count" and of its arguments each time
  183. 6 Lisp> (Count Z) % it is called.
  184. COUNT being entered
  185. L: (1 2 3)
  186. COUNT (level 2) being entered
  187. L: (2 3)
  188. COUNT (level 3) being entered
  189. L: (3)
  190. COUNT (level 4) being entered
  191. L: NIL
  192. COUNT (level 4) = 0
  193. COUNT (level 3) = 1
  194. COUNT (level 2) = 2
  195. COUNT = 3
  196. 3
  197. 7 Lisp> (De Factorial (X)
  198. 7 Lisp> (Cond ((Eq 1)
  199. 7 Lisp> (T (Times X (Factorial (Sub1 X))))))
  200. FACTORIAL
  201. 8 Lisp> (Tr Factorial)
  202. (FACTORIAL)
  203. 9 Lisp> (Factorial 4) % Trace execution of "Factorial".
  204. FACTORIAL being entered
  205. X: 4
  206. FACTORIAL (level 2) being entered
  207. X: 3
  208. FACTORIAL (level 3) being entered
  209. X: 2 % Notice values being returned.
  210. FACTORIAL (level 4) being entered
  211. X: 1
  212. FACTORIAL (level 4) = 1
  213. FACTORIAL (level 3) = 2
  214. FACTORIAL (level 2) = 6 PSL Manual 7 February 1983 Getting Started
  215. section 2.4 page 2.7
  216. FACTORIAL = 24
  217. 24
  218. 10 Lisp> (Untr Count Factorial)
  219. NIL
  220. 11 Lisp> (Count 'A) % This generates an error causing the break
  221. % loop to be entered.
  222. ***** An attempt was made to do CDR on `A', which is not a pair
  223. Break loop
  224. 12 Lisp break>> ?
  225. BREAK():{Error,return-value}
  226. ----------------------------
  227. This is a Read-Eval-Print loop, similar to the top level loop,
  228. except that the following IDs at the top level cause functions to
  229. be called rather than being evaluated:
  230. ? Print this message, listing active Break IDs
  231. T Print stack backtrace
  232. Q Exit break loop back to ErrorSet
  233. A Abort to top level, i.e. restart PSL
  234. C Return last value to the ContinuableError call
  235. R Reevaluate ErrorForm!* and return
  236. M Display ErrorForm!* as the "message"
  237. E Invoke a simple structure editor on ErrorForm!*
  238. (For more information do Help Editor.)
  239. I Show a trace of any interpreted functions
  240. See the manual for details on the Backtrace, and how ErrorForm!* is
  241. set. The Break Loop attempts to use the same TopLoopRead!* etc, as
  242. the calling top loop, just expanding the PromptString!*.
  243. NIL
  244. 13 Lisp break>> % Get a Trace-Back of the
  245. 13 Lisp break>> I % interpreted functions.
  246. Backtrace, including interpreter functions, from top of stack:
  247. LIST2 CDR COUNT ADD1 COND COUNT LIST2
  248. NIL
  249. 14 Lisp break>> Q % To exit the Break Loop.
  250. 15 Lisp> % Load in a file, showing its execution.
  251. 15 Lisp> % The file contains the following:
  252. 15 Lisp> % (Setq X (Cons 'A (Cons 'B Nil)))
  253. 15 Lisp> % (Count X)
  254. 15 Lisp> % (Reverse X)
  255. 15 Lisp> (Dskin "small-file.sl")
  256. (A B)
  257. 2
  258. (B A)
  259. NIL
  260. 16 Lisp> (Quit)
  261. @continue
  262. "Continued"
  263. 17 Lisp> ^C
  264. @start
  265. 18 Lisp> (Quit) Getting Started 7 February 1983 PSL Manual
  266. page 2.8 section 2.5
  267. 2.5. Error and Warning Messages 2.5. Error and Warning Messages 2.5. Error and Warning Messages
  268. Many functions detect and signal appropriate errors (see Chapter 14 for
  269. details); in many cases, an error message is printed. The error conditions
  270. are given as part of a function's definition in the manual. An error
  271. message is preceded by five stars (*); a warning message is preceded by
  272. three. For example, most primitive functions check the type of their
  273. arguments and display an error message if an argument is incorrect. The
  274. type mismatch error mentions the function in which the error was detected,
  275. gives the expected type, and prints the actual value passed.
  276. Sometimes one sees a prompt of the form:
  277. Do you really want to redefine the system function `FOO'?
  278. This means you have tried to define a function with the same name as a
  279. function used by the PSL system. A Y, N, YES, NO, or B response is
  280. required. B starts a break loop. After quitting the break loop, answer Y,
  281. YesP YesP N, Yes, or No to the query. See the definition of YesP in Chapter 13. An
  282. affirmative response is extremely dangerous and should be given only if you
  283. are a system expert. Usually this means that your function must be given a
  284. different name.
  285. A common warning message is
  286. *** Function "FOO" has been redefined
  287. If this occurs without the query above, you are redefining your own
  288. function. This happens normally if you read a file, edit it, and read it
  289. in again.
  290. ________ The switch !*USERMODE controls whether redefinition of functions is
  291. "dangerous". When NIL, no query is generated. User functions entered when
  292. ________ !*USERMODE is on are flagged with the 'USER indicator, used by this
  293. ________ mechanism. The switch !*REDEFMSG, described in section 10.1.2, can be set
  294. to suppress these warning messages. There is also a property 'LOSE that
  295. will prevent redefinition; the new definition will be ignored, and a
  296. warning given.
  297. 2.6. Compilation Versus Interpretation 2.6. Compilation Versus Interpretation 2.6. Compilation Versus Interpretation
  298. PSL uses both compiled and interpreted code. If compiled, a function
  299. usually executes faster and is smaller. However, there are some semantic
  300. differences of which the user should be aware. For example, some recursive
  301. functions are made non-recursive, and certain functions are open-compiled.
  302. A call to an open-compiled function is replaced, on compilation, by a
  303. series of online instructions instead of just being a reference to another
  304. function. Functions compiled open may not do as much type checking. The
  305. user may have to supply some declarations to control this behavior. PSL Manual 7 February 1983 Getting Started
  306. section 2.6 page 2.9
  307. The exact semantic differences between compiled and interpreted functions
  308. are more fully discussed in Chapter 18 and in the Portable LISP Compiler
  309. paper [Griss 81].
  310. [??? We intend to consider the modification of the LISP semantics so as [??? We intend to consider the modification of the LISP semantics so as [??? We intend to consider the modification of the LISP semantics so as
  311. to ensure that these differences are minimized. If a conflict occurs, to ensure that these differences are minimized. If a conflict occurs, to ensure that these differences are minimized. If a conflict occurs,
  312. we will restrict the interpreter, rather than extending (and slowing we will restrict the interpreter, rather than extending (and slowing we will restrict the interpreter, rather than extending (and slowing
  313. down) the capabilities of the compiled code. ???] down) the capabilities of the compiled code. ???] down) the capabilities of the compiled code. ???]
  314. We indicate on the function definition line if it is typically compiled
  315. OPEN; this information helps in debugging code that uses these functions.
  316. These functions do not appear in backtraces and cannot be redefined, traced
  317. or broken in compiled code.
  318. [??? Should we make open-compiled functions totally un-redefinable [??? Should we make open-compiled functions totally un-redefinable [??? Should we make open-compiled functions totally un-redefinable
  319. without special action, even for interpreted code. Consistency! E.g. without special action, even for interpreted code. Consistency! E.g. without special action, even for interpreted code. Consistency! E.g.
  320. flag 'COND LOSE. ???] flag 'COND LOSE. ???] flag 'COND LOSE. ???]
  321. 2.7. Function Types 2.7. Function Types 2.7. Function Types
  322. Eval NoEval Eval NoEval Eval-type functions are those called with evaluated arguments. NoEval
  323. Spread Spread functions are called with unevaluated arguments. Spread-type functions
  324. have their arguments passed in a one-to-one correspondence with their
  325. NoSpread NoSpread formal parameters. NoSpread functions receive their arguments as a single
  326. ____ list.
  327. There are four function types implemented in PSL:
  328. ____ ____ ____ expr Eval Spread expr Eval Spread expr An Eval, Spread function, with a maximum of 15 arguments. In
  329. referring to the formal parameters we mean their values. Each
  330. function of this type should always be called with the expected
  331. number of parameters, as indicated in the function definition.
  332. Future versions of PSL will check this consistency.
  333. _____ _____ _____ fexpr NoEval NoSpread fexpr NoEval NoSpread fexpr A NoEval, NoSpread function. There is no limit on the number of
  334. arguments. In referring to the formal parameters we mean the
  335. unevaluated arguments, collected as a single List, and passed as
  336. a single formal parameter to the function body.
  337. _____ _____ _____ nexpr Eval NoSpread nexpr Eval NoSpread nexpr An Eval, NoSpread function. Each call on this kind of function
  338. may present a different number of arguments, which are evaluated,
  339. collected into a list, and passed in to the function body as a
  340. single formal parameter.
  341. _____ _____ _____ _____ _____ _____ macro macro macro macro macro The macro is a function which creates a new S-expression for
  342. subsequent evaluation or compilation. There is no limit to the
  343. _____ _____ _____ macro macro number of arguments a macro may have. The descriptions of the
  344. Eval Expand Eval Expand Eval and Expand functions in Chapter 11 provide precise details. Getting Started 7 February 1983 PSL Manual
  345. page 2.10 section 2.8
  346. 2.8. Switches and Globals 2.8. Switches and Globals 2.8. Switches and Globals
  347. Generally, switch names begin with !* and global names end with !*, where
  348. "!" is an escape character. One can set a switch !*xxx to T by using On
  349. xxx; in RLISP [(on xxx) in LISP]; one can set it to NIL by using Off xxx;
  350. in RLISP [(off xxx) in LISP]. For example) !*ECHO, !*PVAL and !*PECHO are
  351. switches that control Input Echo, Value Echo and Parse Echo. These
  352. switches are described more fully in Chapters 12 and 13.
  353. For more information, type "HELP SWITCHES;" or "HELP GLOBALS;", or see
  354. Section 6.7.
  355. 2.9. Reporting Errors and Misfeatures 2.9. Reporting Errors and Misfeatures 2.9. Reporting Errors and Misfeatures
  356. Send bug MAIL to PSL-BUGS@UTAH-20. The message will be distributed to a
  357. list of users concerned with bugs and maintenance, and a copy will be kept
  358. in <PSL>BUGS-MISSFEATURES.TXT at UTAH-20.
  359. Bug Bug _________ ___ __ ____ ____ (Bug ): undefined DEC-20 only, expr
  360. Bug Bug The function Bug(); can be called from within PSL:RLISP. This
  361. starts MAIL (actually MM) in a lower fork, with the To: line set
  362. up to Griss. Simply type the subject of the complaint, and then
  363. the message.
  364. After typing message about a bug or a misfeature end finally with
  365. a <Ctrl-Z>.
  366. <Ctrl-N> aborts the message.
  367. [??? needs switches ???] [??? needs switches ???] [??? needs switches ???]