home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.hp48
- Path: sparky!uunet!mcsun!news.funet.fi!funic!nntp.hut.fi!nntp.hut.fi!mheiskan
- From: mheiskan@hut.fi (Mika Heiskanen)
- Subject: Re: ParOuterLoop'news
- In-Reply-To: cohen@cmu.unige.ch's message of 17 Aug 92 11:30:27 +0200
- Message-ID: <MHEISKAN.92Aug18170928@vipunen.hut.fi>
- Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
- Nntp-Posting-Host: vipunen.hut.fi
- Reply-To: mheiskan@.vipunen.hut.fi
- Organization: Helsinki University of Technology - Finland
- References: <1992Aug17.113027.201@cmu.unige.ch>
- Date: 18 Aug 92 17:09:28
- Lines: 188
-
- In article <1992Aug17.113027.201@cmu.unige.ch> cohen@cmu.unige.ch writes:
-
- > First of all, the ParOuterLoop modifies the temporary environment
- > as the following example shows:
- >
- > BEGIN_RPL example.s
- > INCLUDE KEYDEFS.H
- > ASSEMBLE
- > NIBASC /HPHP48-E/
- > RPL
- > :: CK0
- > THREE TWO ONE
- > { NULLLAM NULLLAM NULLLAM } BIND ( { 1 2 3 })
- > FALSE
- > { LAM Exit } BIND ( *Bind POL exit flag* )
- ~~~~~~~~~~~~~~~~~~
- (deleted)
- > ParOuterLoop ( *Run the ParOuterLoop* )
- >
- > 1GETLAM 2GETLAM 3GETLAM 4GETLAM 5GETLAM
- > ABND
- > ;
- >
- > The resulting stack is :
- > :5: External Stand for
- > :4: External the last flags.
- > :3: <3d>
- > :2: <2d>
- > :1: <1d>
-
- Seems to me that stk5 has the Exit flag and stk4 the link field for the
- next temporary environment.
-
- > So, if you still want to use your temp. variables after
- > the ParOuterLoop, you'll have to write N+2GETLAM instead of NGETLAM
- > unless you use named temporary variable like { LAM name }.(This tip
- > comes from a recent mail from Mika Heiskanen). Secondly, you can't
- > use 3GETLAM to get ONE inside the loop (try it in the the example above).
- > That must be why it is mentioned in RPLMAN to use named temp. var. inside
- > the ParOuterLoop.
-
- Yes, you must use 5GETLAM to get the ONE, because you made another
- temporary environment between the first BIND and ParOuterLoop
-
- > But what is strange is that the ParOuterLoop should restore the old
- > temp. env. because of the POLRestoreUI at the end as it is
- > described in RPLMAN.DOC:
-
- And it does.
-
- > So, the question is how the POLRestoreUI command works ?
- > If anyone has an explanation, please post it...
-
- The previous environment was collected to a list and then bound to
- 'SavedUI. If there was already a application running (AppMode?), the list
- will have 11 elements, else just 4 ( last menu, last menu row, current
- menu, current menu row).
- So look at these listings (Names from entries3 file!):
- (Some stuff deleted, but still a long disassembly. Sorry.)
-
- ------------------------------------------------------------------------------
- 38985 :: HP:ParOuterLoop
-
- 38985: 2D9D PROGRAM | <<
- 3898A:389BC romobj | :: HP:POLSaveUI
- 3898F: 4E5E romobj | P HP:ERRSET
- 38994: 2D9D PROGRAM | <<
- 38999:38A64 romobj | :: HP:POLSetUI
- 3899E:38AEB romobj | :: HP:POLKeyUI
- 389A3: 312B endprog | >>
- 389A8: 4EB8 romobj | P HP:ERRTRAP
- 389AD:38B77 romobj | :: HP:POLResUI&Err
- 389B2:38B90 romobj | :: HP:POLRestoreUI
- 389B7: 312B endprog | >>
- ------------------------------------------------------------------------------
- 389BC :: HP:POLSaveUI
- 389BC @ Save current user interface in a temporary environment (no args)
-
- 389BC: 2D9D PROGRAM | <<
- 389C1:38CFB romobj | P AppMode?
- 389C6:61AD8 romobj | P HP:ITE
- ------------------------------------------------------------------------------
- 389CB :: RclUI
- 389CB @ Recall current user interface
-
- 389CB: 2D9D PROGRAM | <<
- 389D0:419F4 romobj | P GETLASTMENU
- 389D5:41881 romobj | P LastMenuRow@
- 389DA:38C18 romobj | P RclAppDisplay
- 389DF:38C48 romobj | P RclAppKeys
- 389E4:38D25 romobj | P NAppKeyOK?
- 389E9:38D4F romobj | P DoStdKeys?
- 389EE:418A4 romobj | P CurMenu@
- 389F3:4185B romobj | P HP:MenuRow@
- 389F8:38D79 romobj | P AppSuspOK?
- 389FD:38C78 romobj | P RclAppExitCond
- 38A02:38CAB romobj | P RclAppError
- 38A07: 405D romobj | # HP:ELEVEN | hxs | <Bh>
- 38A0C: 312B endprog | >>
- ------------------------------------------------------------------------------
- 38A11 :: RecallHPUI
- 38A11 @ Recall system interface (-> 5:LASTMENU 4:# 3:prg 2:MenuRow@ 1:<4h>)
-
- 38A11: 2D9D PROGRAM | <<
- 38A16:419F4 romobj | P GETLASTMENU
- 38A1B:41881 romobj | P LastMenuRow@
- 38A20:418A4 romobj | P CurMenu@
- 38A25:4185B romobj | P HP:MenuRow@
- 38A2A: 4017 romobj | # HP:FOUR | arry | <4h>
- 38A2F: 312B endprog | >>
- 38A34: 5459 romobj | :: HP:{}N
- ------------------------------------------------------------------------------
- 38A39 {} LAM{'SavedUI}
-
- 38A39: 2A74 LIST | {
- ------------------------------------------------------------------------------
- 38A3E l' LAM_'SavedUI
- 38A3E @ Temporary storage for user interface (parametrized outer loop)
-
- 38A3E: 2E6D LOCAL_NAME | ''SavedUI'
- 38A55: 312B endlist | }
- 38A5A: 74D0 romobj | :: HP:BIND
- 38A5F: 312B endprog | >>
- -------------------------------------------------------------------------------
- (deleted)
- ------------------------------------------------------------------------------
- 38ACD :: UserRestoreUI
-
- 38ACD: 2D9D PROGRAM | <<
- 38AD2:38A64 romobj | :: HP:POLSetUI
- 38AD7:4186E romobj | P STOLastMenuRow
- 38ADC:419E4 romobj | P SAVELASTMENU
- 38AE1:38CED romobj | P Clr_4_70688
- 38AE6: 312B endprog | >>
- ------------------------------------------------------------------------------
- (deleted)
- ------------------------------------------------------------------------------
- 38B90 :: HP:POLRestoreUI
- 38B90 @ Restore saved UI (POLSaveUI) and ABND (no args)
-
- 38B90: 2D9D PROGRAM | <<
- 38B95:38CDF romobj | P Set_4_70688
- 38B9A:38A3E romobj | l' LAM_'SavedUI
- 38B9F: 7497 romobj | P HP:ABND
- 38BA4: 54AF romobj | P HP:INNERCOMP
- 38BA9: 405D romobj | # HP:ELEVEN | hxs | <Bh>
- 38BAE:6186C romobj | P HP:#=case
- 38BB3:38ACD romobj | :: UserRestoreUI
- 38BB8:41008 romobj | :: HP:StartMenu
- 38BBD:4186E romobj | P STOLastMenuRow
- 38BC2:419E4 romobj | P SAVELASTMENU
- 38BC7:38BD6 romobj | :: ClrAppFlags&SetSuspOk
- 38BCC:38CED romobj | P Clr_4_70688
- 38BD1: 312B endprog | >>
- ------------------------------------------------------------------------------
- 38BD6 :: ClrAppFlags&SetSuspOk
-
- 38BD6: 2D9D PROGRAM | <<
- 38BDB:38D17 romobj | P ClrAppMode
- 38BE0:38C28 romobj | P ClrAppDisplay
- 38BE5:38C58 romobj | P ClrAppKeys
- 38BEA:38D41 romobj | P ClrNAppKeyOK
- 38BEF:38D6B romobj | P ClrDoStdKeys
- 38BF4:38D8A romobj | P SetAppSuspOK
- 38BF9:38C88 romobj | P ClrAppExitCond
- 38BFE:38CBE romobj | P ClrAppError
- 38C03: 312B endprog | >>
- ------------------------------------------------------------------------------
-
- I think the listing explains it all much more accuretely than I ever could.
-
- And now to another subject:
-
- > So, the moral is if you can't do a LASTSTACK after the program has run
- > (the calc is stuck), you probably put bad arguments in the stack.
-
- Ah, but you CAN use the supported SAVESTACK command, which collects the
- stack (duplicated) to a list and BINDs it to SAVELAM (supported).
- Then use undo (supported) to get the list exploded. NOTE: undo doesn't ABND
- since there can be new temporary environments created after SAVESTACK.
-
- If I recall right, I couldn't find any references in memory to SAVESTACK
- command, but unfortunately I don't have my calc with me now. I'll do a seek
- command this evening and make a followup about it. Why? To see if SAVESTACK
- is used/not used internally and thus not safe/safe to use.
-
- --
- --> mheiskan@vipunen.hut.fi
-