Path: republic.btigate.com!news-xfer.netaxs.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!nyd.news.ans.net!newsfeeds.ans.net!newsxfer.itd.umich.edu!newsrelay.iastate.edu!news.iastate.edu!vax1.miu.edu!JHMEYERS
From: jhmeyers@miu.edu (John H Meyers)
Newsgroups: comp.sys.hp48
Subject: Re: Save unlimited "Last Commands"
Date: 30 Jul 1998 06:28:00 GMT
Organization: MIU Computer Services,  Fairfield, IA 52557.  Not Approved.
Lines: 99
Message-ID: <6pp3pg$eel$2@news.iastate.edu>
References: <6pdt47$ig9$1@news.iastate.edu>
Reply-To: jhmeyers@miu.edu
NNTP-Posting-Host: vax1.mum.edu
Xref: republic.btigate.com comp.sys.hp48:13917

This is an update to programs offering the ability to
save more than four "Last Command" lines (which you can
retrieve for later re-entry or modification,
using the CMD keyboard function).

When you use the "Vectored/Custom Enter" feature in the HP48
(which turns all typed input over to you to deal with as you wish,
instead of automatically parsing and executing it), the syntax of
what you type is not checked; therefore I have added the customary
syntax checking to the program below.

The "Custom Enter" option also only captures "new" typed input;
it does not intercept the contents of the command line when you
edit existing objects, as does the built-in "Last Commands" function.

In case there is some reason you might also want to save the command
lines when you edit existing objects, another program has been included;
however, the built-in Last Commands feature also keeps saving all
entries for you anyway, although still limited to the last four entries.

Only SX/GX "supported" system entry points are used, but a "choose"
function (G/GX command) is necessary for "Last Command" selection.

-----------------------------------------------------------
With best wishes from:   John H Meyers   <jhmeyers@mum.edu>
-----------------------------------------------------------

%%HP: T(3)F(.); @ Include this line when using Kermit

@ This set of variables implements a "Last Commands" function,
@ exactly like the built-in function; however, the built-in
@ function saves only the most recent four buffers
@ you have entered, while this function can be set
@ to keep any maximum number of buffers you wish.

@ The G/GX user CHOOSE command is used in these programs;
@ any identical replacement for CHOOSE will work as well.

@ Move these variables into HOME once installed.

@ Press CMDS to activate the function for the first time
@ (ignore any "No Saved Commands" message at this time);
@ after you have edited one or more command lines,
@ press CMDS to select from any previous command lines.
@ To abort editing, you may need to press CANCEL twice.

@ The 'SetLC' program may optionally be used to
@ assign the right-shift CMD key to the CMDS program,
@ replacing the built-in function.

@ 'PgLC' may optionally be used to purge all saved buffers.
@ Warmstarts purge HP48 built-in buffers, but *not* our buffers.

@ Do *not* press the key for the 'AlphaENTER' variable;
@ the HP48 automatically calls this name itself each
@ time you complete a new entry in the Command Line.

@ Turning off USER mode (left-shift USER) inactivates
@ command saving; saving resumes when user mode is resumed.
@ Any user key assignment for the CMD key also adjusts itself
@ off or on at the same time, reverting to the built-in function.
@ Pressing CMDS always turns USER mode back on.

DIR @ Directory:  name1 object1  name2 object2  ...

@ Note the HEX addresses for SYSEVAL, and make sure they're right!
@ (a memory backup is prudent before running new programs)

@ #64037h SYSEVAL is 'WithHidden', which executes the next
@ *following* object (command) in the "hidden" directory,
@ which is where the list of saved editing buffers is kept.

CMDS @ Name this variable as you wish
\<< -55 CF -62 SF -63 SF "" 'LastCmds' IFERR #64037h SYSEVAL
  RCL THEN DROP2 "No Saved Commands" DOERR ELSE 1 CHOOSE
  { "" SWAP IFERR INPUT THEN DROP2 ELSE \GaENTER END } IFT END \>>
@ The Greek alpha character may be typed as alpha right-shift A

SetLC @ Assign CMD key [GX]
\<< \<< CMDS \>> 52.3 ASN \>>

PgLC @ Purge all saved commands
\<< 'LastCmds' #6408Ch SYSEVAL \>> @ PuHiddenVar

\GaENTER @ AlphaENTER - this name must not be changed
\<< \->STR DUP #238A4h SYSEVAL { #5380Eh SYSEVAL } EVAL @ palparse
  \<< 'LastCmds' { ROT OVER VTYPE 0 < { { } } { OVER RCL } IFTE
          + 1 OVER SIZE 30 MIN SUB @ <== Adjust here
        SWAP STO } #64037h SYSEVAL EVAL #6F8Eh SYSEVAL @ internal eval
  \>> { #40B2Eh SYSEVAL } IFTE @ ParseFail
\>> @ Adjust constant "30" for maximum number of commands to save.

EO @ EDIT replacement, to save edited string in 'LastCmds' also
@ 'name' edits variable contents; original object -> Last Args
\<< -55 CF DUP DUP TYPE 6 == { RCL } IFT \-> ~n ~o
  \<< "" ~o #15A0Eh SYSEVAL { V } + IFERR INPUT THEN DROP2 ~n
  ELSE \GaENTER ~n TYPE 6 == { ~n STO } IFT END ~o DROP \>> \>>

END @ Directory ends