home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / hp48 / 4289 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  3.2 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!chx400!ugun2b!ugcmu!cohen
  2. Newsgroups: comp.sys.hp48
  3. Subject: ParOuterLoop'news
  4. Message-ID: <1992Aug17.113027.201@cmu.unige.ch>
  5. From: cohen@cmu.unige.ch
  6. Date: 17 Aug 92 11:30:27 +0200
  7. Organization: University of Geneva, Switzerland
  8. Lines: 105
  9.  
  10. Concerning the ParOuterLoop which seems to give some difficulties....
  11.  
  12. With the help of William j. Levenson and Mika Heiskanen (I thank them
  13. very much for their precious remarks), I post some interesting
  14. discovers (Sorry if they are already found out!)
  15.  
  16. First of all, the ParOuterLoop modifies the temporary environment
  17. as the following example shows:
  18.  
  19. BEGIN_RPL example.s
  20. INCLUDE KEYDEFS.H
  21. ASSEMBLE
  22.     NIBASC   /HPHP48-E/
  23. RPL
  24. :: CK0
  25.     THREE TWO ONE 
  26.     { NULLLAM NULLLAM NULLLAM } BIND   ( { 1 2 3 })
  27.   FALSE    
  28.   { LAM Exit } BIND  ( *Bind POL exit flag* )
  29.   ' NOP        ( *No display action*  )
  30.   ' ::         ( *Hard key handler*   )
  31.      kpNoShift #=casedrop
  32.         ::
  33.             kcOn        ?CaseKeyDef
  34.               :: TakeOver
  35.                   TRUE ' LAM Exit STO ;
  36.         ;
  37.      2DROP 'DoBadKeyT
  38.   ;
  39.   TrueTrue     ( *Key control flags* )
  40.   NULL{}    ( *No softkeys here*  )
  41.   ONEFALSE     ( *1st row, no suspend* )
  42.   ' LAM Exit      ( *App exit condition* )
  43.   ' ERRJMP     ( *Error handler* )
  44.   ParOuterLoop    ( *Run the ParOuterLoop* )
  45.  
  46.   1GETLAM 2GETLAM 3GETLAM 4GETLAM 5GETLAM
  47.   ABND
  48. ;
  49. END_RPL
  50.  
  51. The resulting stack is :
  52. :5: External     Stand for
  53. :4: External     the last flags.
  54. :3: <3d>
  55. :2: <2d>
  56. :1: <1d>
  57.  
  58. So, if you still want to use your temp. variables after 
  59. the ParOuterLoop, you'll have to write N+2GETLAM instead of NGETLAM
  60. unless you use named temporary variable like { LAM name }.(This tip
  61. comes from a recent mail from Mika Heiskanen). Secondly, you can't
  62. use 3GETLAM to get ONE inside the loop (try it in the the example above).
  63. That must be why it is mentioned in RPLMAN to use named temp. var. inside
  64. the ParOuterLoop.
  65.  
  66. But what is strange is that the ParOuterLoop should restore the old
  67. temp. env. because of the POLRestoreUI at the end as it is 
  68. described in RPLMAN.DOC:
  69.                 ------------------------
  70.                 ("POLSaveUI")
  71.                 Save the system or current application's
  72.                 user interface
  73.  
  74.                 If error in
  75.  
  76.                   ("POLSetUI")
  77.                   Set the new application's user interface
  78.  
  79.                   ("POLKeyUI")
  80.                   While "ExitCond" evaluates to FALSE {
  81.                      Evaluate "AppDisplay"
  82.                      If error in
  83.                         Read and evaluate a key
  84.                      Then
  85.                         Evaluate "AppError"
  86.                      }
  87.  
  88.                 Then
  89.  
  90.                   Restore the saved user interface and
  91.                   ERRJMP
  92.  
  93.                 ("POLRestoreUI")
  94.                 Restore the saved user interface
  95.           ------------------------------
  96. So, the question is how the POLRestoreUI command works ?
  97. If anyone has an explanation, please post it...
  98.  
  99. One more thing, I found the bug in my rpl program called 'Scrn'
  100. posted a few days ago : in fact, it was just the sub$ command
  101. which was applied to an object that wasn't necessary a string!
  102. So, the moral is if you can't do a LASTSTACK after the program has run
  103. (the calc is stuck), you probably put bad arguments in the stack.
  104. A retenir!!!
  105. ( I 'll post a new version of Scrn with some improvements in the
  106. next days.)
  107.  
  108. For any commments or remarks, please mail to:
  109.  
  110. cohen@cmu.unige.ch
  111. Daniel COHEN-LAROQUE
  112.  
  113.  
  114.  
  115.