13-toploop.lpt 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. PSL Manual 7 February 1983 User Interface
  2. section 13.0 page 13.1
  3. CHAPTER 13 CHAPTER 13 CHAPTER 13
  4. USER INTERFACE USER INTERFACE USER INTERFACE
  5. 13.1. Introduction . . . . . . . . . . . . . . . 13.1
  6. 13.2. Stopping PSL and Saving a New Executable Core Image . . 13.1
  7. 13.3. Init Files. . . . . . . . . . . . . . . . 13.3
  8. 13.4. Changing the Default Top Level Function . . . . . . 13.3
  9. 13.5. The General Purpose Top Loop Function. . . . . . . 13.4
  10. 13.6. The HELP Mechanism . . . . . . . . . . . . . 13.7
  11. 13.7. The Break Loop . . . . . . . . . . . . . . 13.8
  12. 13.8. Terminal Interaction Commands in RLISP . . . . . . 13.8
  13. 13.1. Introduction 13.1. Introduction 13.1. Introduction
  14. In this chapter those functions are presented relating directly to the
  15. user interface; for example, the general purpose Top Loop function, the
  16. History mechanism, and changing the default Top Level function.
  17. 13.2. Stopping PSL and Saving a New Executable Core Image 13.2. Stopping PSL and Saving a New Executable Core Image 13.2. Stopping PSL and Saving a New Executable Core Image
  18. Quit Quit The normal way to stop PSL execution is to call the Quit function or to
  19. strike <Ctrl-C> on the DEC-20 or <Ctrl-Z> on the VAX.
  20. Quit Quit _________ ____ (Quit ): Undefined expr
  21. Return from LISP to superior process.
  22. After either of these actions, PSL may be re-entered by typing START or
  23. CONTINUE to the EXEC on the DEC-20. After exiting, the core image may also
  24. be saved using the Tops-20 monitor command "SAVE filename". On the VAX,
  25. Quit Quit Quit causes a stop signal to be sent, so that PSL may be continued from the
  26. shell. If you desire that the process be killed, use the function
  27. ExitLisp ExitLisp ExitLisp.
  28. ExitLisp ExitLisp _________ ____ (ExitLisp ): Undefined expr
  29. Quit Quit To be used on the VAX. Like Quit except that the process is
  30. ExitLisp ExitLisp killed. ExitLisp calls the Unix library routine exit().
  31. A better way to exit and save the core image is to call the function
  32. SaveSystem SaveSystem SaveSystem. User Interface 7 February 1983 PSL Manual
  33. page 13.2 section 13.2
  34. SaveSystem SaveSystem ___ ______ ____ ______ _____ ____ ____ _________ ____ (SaveSystem MSG:string FILE:string FORMS:form-list): Undefined expr
  35. This records the welcome message (after attaching a date) in the
  36. StandardLisp StandardLisp global variable LISPBANNER!* used by StandardLisp's call on
  37. TopLoop DumpLisp TopLoop DumpLisp TopLoop, and then calls DumpLisp to compact the core image and
  38. write it out as a machine dependent executable file with the name
  39. ____ ____ FILE. FILE should have the appropriate extension for an
  40. SaveSystem SaveSystem executable file. SaveSystem also sets USERMODE!* to T.
  41. _____ The forms in the list FORMS will be evaluated when the new core
  42. image is started. For example
  43. (SaveSystem "PSL 3.1" "PSL.EXE" '((Read-Init-File "PSL")
  44. (InitializeInterrupts)))
  45. SaveSystem SaveSystem If RLISP has been loaded, SaveSystem will have been redefined to
  46. Main Main save the message in the global variable DATE!*, and redefine Main
  47. RlispMain Begin1 RlispMain Begin1 to call RlispMain, which uses DATE!* in Begin1. The older
  48. SaveSystem LispSaveSystem SaveSystem LispSaveSystem SaveSystem will be saved as the function LispSaveSystem.
  49. DumpLisp DumpLisp ____ ______ _________ ____ (DumpLisp FILE:string): Undefined expr
  50. Reclaim Reclaim This calls Reclaim to compact the heap, and unmaps the unused
  51. pages (DEC-20) or moves various segment pointers (VAX) to
  52. decrease the core image. The core image is then written as an
  53. ____ executable file, with the name FILE.
  54. Reset Reset _________ ____ (Reset ): Undefined expr
  55. Return to top level of LISP. Equivalent to <Ctrl-C> and Start on
  56. DEC-20.
  57. Time Time _______ ____ (Time ): integer expr
  58. CPU time in milliseconds since login time.
  59. Date Date ______ ____ (Date ): string expr
  60. The date in the form 16-Dec-82.
  61. __________ ______ LISPBANNER!* [Initially: ] global
  62. SaveSystem SaveSystem Records the welcome message given by a call to SaveSystem from
  63. Date Date PSL. Also contains the date, given by the function Date. PSL Manual 7 February 1983 User Interface
  64. section 13.2 page 13.3
  65. __________ ______ DATE!* [Initially: Nil] global
  66. SaveSystem SaveSystem Records the welcome message given by a call to SaveSystem from
  67. RLISP.
  68. 13.3. Init Files 13.3. Init Files 13.3. Init Files
  69. Init files are available to make it easier for the user to customize PSL
  70. to his/her own needs. When PSL, RLISP, or PSLCOMP is executed, if a file
  71. PSL.INIT, RLISP.INIT, or PSLCOMP.INIT (.pslrc, rlisprc, or .pslcomprc on
  72. the VAX) is on the home directory, it will be read and evaluated.
  73. Currently all init files must be written in LISP syntax. They may use
  74. FASLIN LOAD FASLIN LOAD FASLIN or LOAD as needed.
  75. The following functions are used to implement init files, and can be
  76. accessed by LOADing the INIT-FILE module.
  77. User-HomeDir-String User-HomeDir-String ______ ____ (User-HomeDir-String ): string expr
  78. Returns a full pathname for the user's home directory.
  79. Init-File-String Init-File-String ___________ ______ ______ ____ (Init-File-String PROGRAMNAME:string): string expr
  80. Returns the full pathname of the user's init file for the program
  81. ___________ PROGRAMNAME.
  82. (Init-File-String "PSL")
  83. Read-Init-File Read-Init-File ___________ ______ ___ ____ (Read-Init-File PROGRAMNAME:string): Nil expr
  84. ___________ Reads and evaluates the init file with name PROGRAMNAME.
  85. Read-Init-File Init-File-String Read-Init-File Init-File-String ___________ Read-Init-File calls Init-File-String with argument PROGRAMNAME.
  86. (Read-Init-File "PSL")
  87. 13.4. Changing the Default Top Level Function 13.4. Changing the Default Top Level Function 13.4. Changing the Default Top Level Function
  88. As PSL starts up, it first sets the stack pointer and various other
  89. Main While Main While variables, and then calls the function Main inside a While loop, protected
  90. Catch Main StandardLisp Catch Main StandardLisp by a Catch. By default, Main calls a StandardLisp top loop, defined using
  91. TopLoop TopLoop the general TopLoop function, described in the next Section. In order to
  92. Main Main have a saved PSL come up in a different top loop, the function Main should
  93. be appropriately redefined by the user (e.g. as is done to create RLISP). User Interface 7 February 1983 PSL Manual
  94. page 13.4 section 13.4
  95. Main Main _________ ____ (Main ): Undefined expr
  96. Initialization function, called after setting the stack. Should
  97. TopLoop TopLoop be redefined by the user to change the default TopLoop.
  98. 13.5. The General Purpose Top Loop Function 13.5. The General Purpose Top Loop Function 13.5. The General Purpose Top Loop Function
  99. PSL provides a general purpose Top Loop that allows the user to specify
  100. Read Eval Print Read Eval Print his own Read, Eval and Print functions and otherwise obtain a standard set
  101. of services, such as Timing, History, Break Loop interface, and Interface
  102. to Help system.
  103. __________ ______ TOPLOOPEVAL!* [Initially: NIL] global
  104. Eval Eval The Eval used in the current Top Loop.
  105. __________ ______ TOPLOOPPRINT!* [Initially: NIL] global
  106. Print Print The Print used in the current Top Loop.
  107. __________ ______ TOPLOOPREAD!* [Initially: NIL] global
  108. Read Read The Read used in the current Top Loop.
  109. TopLoop TopLoop ___________ ________ ____________ ________ (TopLoop TOPLOOPREAD!*:function TOPLOOPPRINT!*:function
  110. ___________ ________ ___________ __ _____________ ______ ___ ____ TOPLOOPEVAL!*:function TOPLOOPNAME!*:id WELCOMEBANNER:string): NIL expr
  111. This function is called to establish a new Top Loop (currently
  112. Standard LISP Break Standard LISP Break used for Standard LISP, RLISP, and Break). It prints the
  113. Read-Eval-Print _____________ Read-Eval-Print WELCOMEBANNER and then invokes a "Read-Eval-Print" loop, using
  114. ___________ the given functions. Note that TOPLOOPREAD!*, etc. are FLUID
  115. variables, and so may be examined (and changed) within the
  116. TopLoop TopLoop executing Top Loop. TopLoop provides a standard History and
  117. ____ ___________ timing mechanism, retaining on a list (HISTORYLIST!*) the input
  118. ____ ____ and output as a list of pairs. A prompt is constructed from
  119. ___________ TOPLOOPNAME!* and is printed out, prefixed by the History count.
  120. As a convention, the name is followed by a number of ">"'s,
  121. indicating the loop depth.
  122. __________ ______ TOPLOOPNAME!* [Initially: ] global
  123. Short name to put in prompt. PSL Manual 7 February 1983 User Interface
  124. section 13.5 page 13.5
  125. __________ ______ TOPLOOPLEVEL!* [Initially: ] global
  126. Depth of top loop invocations.
  127. __________ ______ !*EMSGP [Initially: ] switch
  128. Whether to print error messages.
  129. __________ ______ GCTIME!* [Initially: ] global
  130. Time spent in garbage collection.
  131. __________ ______ INITFORMS!* [Initially: ] global
  132. Forms to be evaluated at startup.
  133. __________ ______ !*PECHO [Initially: NIL] switch
  134. StandardLisp StandardLisp Causes parsed form read in top-loop StandardLisp to be printed,
  135. if T.
  136. __________ ______ !*PVAL [Initially: T] switch
  137. StandardLisp StandardLisp Causes values computed in top-loop StandardLisp to be printed, if
  138. T.
  139. __________ ______ !*TIME [Initially: NIL] switch
  140. If on, causes a step evaluation time to be printed after each
  141. command.
  142. Hist Hist _ _______ ___ _____ (Hist [N:integer]): NIL nexpr
  143. This function does not work with the Top Loop used by PSL:RLISP
  144. or by (beginrlisp); it does work with LISP and with RLISP if it
  145. Hist Hist is started from LISP using the RLISP function. Hist is called
  146. with 0, 1 or 2 integers, which control how much history is to be
  147. printed out:
  148. (HIST) Display full history.
  149. (HIST n m)
  150. Display history from n to m.
  151. (HIST n) Display history from n to present.
  152. (HIST -n) Display last n entries. User Interface 7 February 1983 PSL Manual
  153. page 13.6 section 13.5
  154. [??? Add more info about what a history is. ???] [??? Add more info about what a history is. ???] [??? Add more info about what a history is. ???]
  155. The following functions permit the user to access and resubmit previous
  156. expressions, and to re-examine previous results.
  157. Inp Inp _ _______ ___ ____ (Inp N:integer): any expr
  158. Return N'th input at this level.
  159. ReDo ReDo _ _______ ___ ____ (ReDo N:integer): any expr
  160. Reevaluate N'th input.
  161. Ans Ans _ _______ ___ ____ (Ans N:integer): any expr
  162. Return N'th result.
  163. __________ ______ HISTORYCOUNT!* [Initially: 0] global
  164. Number of entries read so far.
  165. __________ ______ HISTORYLIST!* [Initially: Nil] global
  166. List of entries read and evaluated.
  167. TopLoop StandardLisp TopLoop StandardLisp TopLoop has been used to define the following StandardLisp and RLISP top
  168. loops.
  169. StandardLisp StandardLisp ___ ____ (StandardLisp ): NIL expr
  170. Interpreter LISP syntax top loop, defined as:
  171. (De StandardLisp Nil
  172. (Prog (CurrentReadMacroIndicator!* CurrentScanTable!*)
  173. (Setq CurrentReadMacroIndicator!* 'LispReadMacro)
  174. (Setq CurrentScanTable!* LispScanTable!*)
  175. (Toploop 'Read 'Print 'Eval "LISP"
  176. "PORTABLE STANDARD LISP")))
  177. Note that the scan tables are modified.
  178. RLisp RLisp ___ ____ (RLisp ): NIL expr
  179. Alternative interpreter RLISP syntax top loop, defined as: PSL Manual 7 February 1983 User Interface
  180. section 13.5 page 13.7
  181. [??? xread described in RLISP Section ???] [??? xread described in RLISP Section ???] [??? xread described in RLISP Section ???]
  182. (De RLisp Nil
  183. (Toploop 'XRead 'Print 'Eval "RLISP" "PSL RLISP"))
  184. Note that for the moment, the default RLISP loop is not this
  185. (though this may be used experimentally); instead a similar
  186. BeginRlisp BeginRlisp (special purpose hand coded) function, BeginRlisp, based on the
  187. Begin1 Begin1 older Begin1 is used. It is hoped to change the RLISP top-level
  188. to use the general purpose capability.
  189. BeginRLisp BeginRLisp ____ ________ ____ (BeginRLisp ): None Returned expr
  190. Starts RLISP from PSL:PSL only if RLISP is loaded. The module
  191. RLISP is present if you started in RLISP and then entered PSL.
  192. 13.6. The HELP Mechanism 13.6. The HELP Mechanism 13.6. The HELP Mechanism
  193. PSL provides a general purpose Help mechanism, that is called in the
  194. TopLoop Help TopLoop Help TopLoop by invoking Help sometimes a ? may be used, as for example in the
  195. break loop.
  196. Help Help ______ __ ___ _____ (Help [TOPICS:id]): NIL fexpr
  197. If no arguments are given, a message describing Help itself and
  198. __ known topics is printed. Otherwise, each of the id arguments is
  199. checked to see if any help information is available. If it has a
  200. value under the property list indicator HelpFunction, that
  201. function is called. If it has a value under the indicator
  202. HelpString, the value is printed. If it has a value under the
  203. indicator HelpFile, the file is displayed on the terminal. By
  204. default, a file called "topic.HLP" on the Logical device, "PH:"
  205. is looked for, and printed if found.
  206. Help Help Help also prints out the values of the TopLoop fluids, and
  207. finally searches the current Id-Hash-Table for loaded modules.
  208. __________ ______ HELPIN!* [Initially: NIL] global
  209. Help Help The channel used for input by the Help mechanism.
  210. __________ ______ HELPOUT!* [Initially: NIL] global
  211. Help Help The channel used for output by the Help mechanism. User Interface 7 February 1983 PSL Manual
  212. page 13.8 section 13.7
  213. 13.7. The Break Loop 13.7. The Break Loop 13.7. The Break Loop
  214. The Break Loop is described in detail in Chapter 14. For information,
  215. look there.
  216. 13.8. Terminal Interaction Commands in RLISP 13.8. Terminal Interaction Commands in RLISP 13.8. Terminal Interaction Commands in RLISP
  217. Two commands are available in RLISP for use in interactive computing.
  218. Pause Pause ___ ____ (Pause ): Nil expr
  219. The command PAUSE; may be inserted at any point in an input file.
  220. If this command is encountered on input, the system prints the
  221. YesP YesP message CONT? on the user's terminal and halts by calling YesP.
  222. YesP YesP _______ ______ _______ ____ (YesP MESSAGE:string): boolean expr
  223. YesP YesP If the user responds Y or Yes, YesP returns T and the calculation
  224. continues from that point in the file. If the user responds N or
  225. YesP YesP No, YesP returns NIL and control is returned to the terminal, and
  226. the user can type in further commands. However, later on he can
  227. use the command CONT; and control is then transferred back to the
  228. point in the file after the last PAUSE was encountered. If the
  229. user responds B, one enters a break loop. After quitting the
  230. break loop, one still must respond Y, N, Yes, or No.