home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / hp48 / 4296 < prev    next >
Encoding:
Text File  |  1992-08-18  |  7.9 KB  |  203 lines

  1. Newsgroups: comp.sys.hp48
  2. Path: sparky!uunet!mcsun!news.funet.fi!funic!nntp.hut.fi!nntp.hut.fi!mheiskan
  3. From: mheiskan@hut.fi (Mika Heiskanen)
  4. Subject: Re: ParOuterLoop'news
  5. In-Reply-To: cohen@cmu.unige.ch's message of 17 Aug 92 11:30:27 +0200
  6. Message-ID: <MHEISKAN.92Aug18170928@vipunen.hut.fi>
  7. Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
  8. Nntp-Posting-Host: vipunen.hut.fi
  9. Reply-To: mheiskan@.vipunen.hut.fi
  10. Organization: Helsinki University of Technology - Finland
  11. References: <1992Aug17.113027.201@cmu.unige.ch>
  12. Date: 18 Aug 92 17:09:28
  13. Lines: 188
  14.  
  15. In article <1992Aug17.113027.201@cmu.unige.ch> cohen@cmu.unige.ch writes:
  16.  
  17. >   First of all, the ParOuterLoop modifies the temporary environment
  18. >   as the following example shows:
  19. >
  20. >   BEGIN_RPL example.s
  21. >   INCLUDE KEYDEFS.H
  22. >   ASSEMBLE
  23. >       NIBASC   /HPHP48-E/
  24. >   RPL
  25. >   :: CK0
  26. >       THREE TWO ONE 
  27. >       { NULLLAM NULLLAM NULLLAM } BIND   ( { 1 2 3 })
  28. >     FALSE    
  29. >     { LAM Exit } BIND  ( *Bind POL exit flag* )
  30.       ~~~~~~~~~~~~~~~~~~
  31. (deleted)
  32. >     ParOuterLoop    ( *Run the ParOuterLoop* )
  33. >
  34. >     1GETLAM 2GETLAM 3GETLAM 4GETLAM 5GETLAM
  35. >     ABND
  36. >   ;
  37. >
  38. >   The resulting stack is :
  39. >   :5: External     Stand for
  40. >   :4: External     the last flags.
  41. >   :3: <3d>
  42. >   :2: <2d>
  43. >   :1: <1d>
  44.  
  45. Seems to me that stk5 has the Exit flag and stk4 the link field for the
  46. next temporary environment.
  47.  
  48. >   So, if you still want to use your temp. variables after 
  49. >   the ParOuterLoop, you'll have to write N+2GETLAM instead of NGETLAM
  50. >   unless you use named temporary variable like { LAM name }.(This tip
  51. >   comes from a recent mail from Mika Heiskanen). Secondly, you can't
  52. >   use 3GETLAM to get ONE inside the loop (try it in the the example above).
  53. >   That must be why it is mentioned in RPLMAN to use named temp. var. inside
  54. >   the ParOuterLoop.
  55.  
  56. Yes, you must use 5GETLAM to get the ONE, because you made another
  57. temporary environment between the first BIND and ParOuterLoop
  58.  
  59. >   But what is strange is that the ParOuterLoop should restore the old
  60. >   temp. env. because of the POLRestoreUI at the end as it is 
  61. >   described in RPLMAN.DOC:
  62.  
  63. And it does.
  64.  
  65. >   So, the question is how the POLRestoreUI command works ?
  66. >   If anyone has an explanation, please post it...
  67.  
  68. The previous environment was collected to a list and then bound to
  69. 'SavedUI. If there was already a application running (AppMode?), the list
  70. will have 11 elements, else just 4 ( last menu, last menu row, current
  71. menu, current menu row).
  72. So look at these listings (Names from entries3 file!):
  73. (Some stuff deleted, but still a long disassembly. Sorry.)
  74.  
  75. ------------------------------------------------------------------------------
  76. 38985 :: HP:ParOuterLoop
  77.  
  78. 38985: 2D9D PROGRAM        |  <<
  79. 3898A:389BC romobj         |    :: HP:POLSaveUI
  80. 3898F: 4E5E romobj         |    P  HP:ERRSET
  81. 38994: 2D9D PROGRAM        |    <<
  82. 38999:38A64 romobj         |      :: HP:POLSetUI
  83. 3899E:38AEB romobj         |      :: HP:POLKeyUI
  84. 389A3: 312B endprog        |    >>
  85. 389A8: 4EB8 romobj         |    P  HP:ERRTRAP
  86. 389AD:38B77 romobj         |    :: HP:POLResUI&Err
  87. 389B2:38B90 romobj         |    :: HP:POLRestoreUI
  88. 389B7: 312B endprog        |  >>
  89. ------------------------------------------------------------------------------
  90. 389BC :: HP:POLSaveUI
  91. 389BC @  Save current user interface in a temporary environment (no args)
  92.  
  93. 389BC: 2D9D PROGRAM        |  <<
  94. 389C1:38CFB romobj         |    P  AppMode?
  95. 389C6:61AD8 romobj         |    P  HP:ITE
  96. ------------------------------------------------------------------------------
  97. 389CB :: RclUI
  98. 389CB @  Recall current user interface
  99.  
  100. 389CB: 2D9D PROGRAM        |    <<
  101. 389D0:419F4 romobj         |      P  GETLASTMENU
  102. 389D5:41881 romobj         |      P  LastMenuRow@
  103. 389DA:38C18 romobj         |      P  RclAppDisplay
  104. 389DF:38C48 romobj         |      P  RclAppKeys
  105. 389E4:38D25 romobj         |      P  NAppKeyOK?
  106. 389E9:38D4F romobj         |      P  DoStdKeys?
  107. 389EE:418A4 romobj         |      P  CurMenu@
  108. 389F3:4185B romobj         |      P  HP:MenuRow@
  109. 389F8:38D79 romobj         |      P  AppSuspOK?
  110. 389FD:38C78 romobj         |      P  RclAppExitCond
  111. 38A02:38CAB romobj         |      P  RclAppError
  112. 38A07: 405D romobj         |      #  HP:ELEVEN | hxs | <Bh>
  113. 38A0C: 312B endprog        |    >>
  114. ------------------------------------------------------------------------------
  115. 38A11 :: RecallHPUI
  116. 38A11 @  Recall system interface (-> 5:LASTMENU 4:# 3:prg 2:MenuRow@ 1:<4h>)
  117.  
  118. 38A11: 2D9D PROGRAM        |    <<
  119. 38A16:419F4 romobj         |      P  GETLASTMENU
  120. 38A1B:41881 romobj         |      P  LastMenuRow@
  121. 38A20:418A4 romobj         |      P  CurMenu@
  122. 38A25:4185B romobj         |      P  HP:MenuRow@
  123. 38A2A: 4017 romobj         |      #  HP:FOUR | arry | <4h>
  124. 38A2F: 312B endprog        |    >>
  125. 38A34: 5459 romobj         |    :: HP:{}N
  126. ------------------------------------------------------------------------------
  127. 38A39 {} LAM{'SavedUI}
  128.  
  129. 38A39: 2A74 LIST           |    {
  130. ------------------------------------------------------------------------------
  131. 38A3E l' LAM_'SavedUI
  132. 38A3E @  Temporary storage for user interface (parametrized outer loop)
  133.  
  134. 38A3E: 2E6D LOCAL_NAME     |      ''SavedUI'
  135. 38A55: 312B endlist        |    }
  136. 38A5A: 74D0 romobj         |    :: HP:BIND
  137. 38A5F: 312B endprog        |  >>
  138. -------------------------------------------------------------------------------
  139. (deleted)
  140. ------------------------------------------------------------------------------
  141. 38ACD :: UserRestoreUI
  142.  
  143. 38ACD: 2D9D PROGRAM        |  <<
  144. 38AD2:38A64 romobj         |    :: HP:POLSetUI
  145. 38AD7:4186E romobj         |    P  STOLastMenuRow
  146. 38ADC:419E4 romobj         |    P  SAVELASTMENU
  147. 38AE1:38CED romobj         |    P  Clr_4_70688
  148. 38AE6: 312B endprog        |  >>
  149. ------------------------------------------------------------------------------
  150. (deleted)
  151. ------------------------------------------------------------------------------
  152. 38B90 :: HP:POLRestoreUI
  153. 38B90 @  Restore saved UI (POLSaveUI) and ABND (no args)
  154.  
  155. 38B90: 2D9D PROGRAM        |  <<
  156. 38B95:38CDF romobj         |    P  Set_4_70688
  157. 38B9A:38A3E romobj         |    l' LAM_'SavedUI
  158. 38B9F: 7497 romobj         |    P  HP:ABND
  159. 38BA4: 54AF romobj         |    P  HP:INNERCOMP
  160. 38BA9: 405D romobj         |    #  HP:ELEVEN | hxs | <Bh>
  161. 38BAE:6186C romobj         |    P  HP:#=case
  162. 38BB3:38ACD romobj         |    :: UserRestoreUI
  163. 38BB8:41008 romobj         |    :: HP:StartMenu
  164. 38BBD:4186E romobj         |    P  STOLastMenuRow
  165. 38BC2:419E4 romobj         |    P  SAVELASTMENU
  166. 38BC7:38BD6 romobj         |    :: ClrAppFlags&SetSuspOk
  167. 38BCC:38CED romobj         |    P  Clr_4_70688
  168. 38BD1: 312B endprog        |  >>
  169. ------------------------------------------------------------------------------
  170. 38BD6 :: ClrAppFlags&SetSuspOk
  171.  
  172. 38BD6: 2D9D PROGRAM        |  <<
  173. 38BDB:38D17 romobj         |    P  ClrAppMode
  174. 38BE0:38C28 romobj         |    P  ClrAppDisplay
  175. 38BE5:38C58 romobj         |    P  ClrAppKeys
  176. 38BEA:38D41 romobj         |    P  ClrNAppKeyOK
  177. 38BEF:38D6B romobj         |    P  ClrDoStdKeys
  178. 38BF4:38D8A romobj         |    P  SetAppSuspOK
  179. 38BF9:38C88 romobj         |    P  ClrAppExitCond
  180. 38BFE:38CBE romobj         |    P  ClrAppError
  181. 38C03: 312B endprog        |  >>
  182. ------------------------------------------------------------------------------
  183.  
  184. I think the listing explains it all much more accuretely than I ever could.
  185.  
  186. And now to another subject:
  187.  
  188. >   So, the moral is if you can't do a LASTSTACK after the program has run
  189. >   (the calc is stuck), you probably put bad arguments in the stack.
  190.  
  191. Ah, but you CAN use the supported SAVESTACK command, which collects the
  192. stack (duplicated) to a list and BINDs it to SAVELAM (supported).
  193. Then use undo (supported) to get the list exploded. NOTE: undo doesn't ABND
  194. since there can be new temporary environments created after SAVESTACK.
  195.  
  196. If I recall right, I couldn't find any references in memory to SAVESTACK
  197. command, but unfortunately I don't have my calc with me now. I'll do a seek
  198. command this evening and make a followup about it. Why? To see if SAVESTACK
  199. is used/not used internally and thus not safe/safe to use.
  200.  
  201. --
  202. --> mheiskan@vipunen.hut.fi
  203.