[comp.sys.handhelds] HP48SX PROGRAM: TCAT

dhe@engr.uark.edu (David Ewing) (04/09/91)

HP48sx Program : TCAT
---------------------------------------------------------------------

TCAT: A String Catalog designed to work with TEXTVIEW.

   This is the String Catalog Program mentioned in the previous post.
It has been modeled somewhat from the Equation Card Catalog program.

   To install this, follow the directions below.  Once TCAT has been 
installed and started, it searches for the variable TCATPATH which 
should contain the directory path where you want TCAT to start
in.  If TCAT is unable to locate TCATPATH, then it will start in
the current directory.  After this point it searches all variables
types in the directory for string variables and directory variable, 
and will display the results:  The first line will be the parent 
directory (or a null path if the current directory is HOME), then 
all directories are listed, and finally all string variables.   The 
directories are indicated by a folder icon in front of the name, 
and when one is selected, the current directory is changed and 
the catalog is updated for the new directory.  If the total number of 
directories and string variables exceed the number of lines that 
can be displayed at once, an arrow will appear on the lower-right side 
indicating that more items exist.   Finally a menu item will appear 
above the 'F' key for exiting TCAT, and the following keys will 
become active:
  
 Arrow up             :  Up one line   (if not at the top)
 Arrow down           :  Down one line (if not at the bottom)
 Blue/Right-Shift up  :  Top of string list
 Blue/Right-Shift down:  Bottom of string list
 Enter                :  Select String to view or directory to enter
 Blue/Right-Shift On  :  Turns off Calculator -Pressing ON resumes.
 F (or Exit)          :  Exit TCAT

             (Pressing any other key is mostly pointless)

During the program, the up/down arrows will indicate whether
there are items above or below the page displayed on the screen.  The
inverted line is, of course, the item that will be selected if ENTER is
pressed.  To exit at any point, press the F key, and HP will return
to the directory and status it was before TCAT was started.   

 As always in RPL programs, ON is active - but not really recommended as 
an exit since it will leave one or two objects of its own on the stack.
TEXTVIEW will also not erase anything that was previously on the stack
besides the object that you wished to view.


     VERY QUICK OPERATION SUMMARY:
--------------------------------------
Nothing required on the stack
Press the TCAT menu key
Arrow keys acts as page up and down, ENTER selects item, and F exits.


     TO INSTALL:
---------------------
   Simply strip off all this documentation until only the program
remains, then set the HP48 for a ASC transfer with translate code
3, and finally send it to the calculator.   I recommend putting 
TCAT in the HOME directory along with the TEXTVIEW program so 
that it is available anywhere in the directory structure.  Matter of
fact, TCAT REQUIRES that TEXTVIEW be in the HOME directory to work
fully - otherwise TCAT will probably die when a string is selected.   
The optional variable 'TCATPATH' should also be put in the HOME 
directory where TCAT can find it - TCATPATH is provided only
as a convenience and is not required for the program to run properly.
( if you do use TCATPATH, here's an example PATH stored in 
 TCATPATH: {HOME TXT} )

#include <disclaimer.h>
  "...this program shouldn't in anyway damage data, and if it does
   I can't be held responsible - blame some other program...."  :-)

        -David

==============================================================================
 dhe@engr.uark.edu                        David Ewing, University of Arkansas
 dewing@uafhp.uark.edu                        Computer Science Engineering

Data, I would like to have been consulted.
I have not observed anyone else on board consulting you about their
  procreation, Captain.
    -- Picard and Data, "The Offspring", stardate 43657.0
==============================================================================

--------------------->Cut Here and Download to HP<-------------------

%%HP: T(3)A(D)F(.);
\<< 0 1 0 0 1 { } { }
{ } # 117d # 8d
BLANK NEG
GROB 8 6 6090171818FF
0 \-> a b o n p l d g
s f z
  \<< PATH 'TCATPATH'
VTYPE
    IF 5 ==
    THEN TCATPATH
EVAL
    END
    DO VARS OBJ\->
DUP
      IF 0 >
      THEN 1 SWAP
        START DUP
VTYPE
          IF 2 ==
          THEN DUP
l SWAP + 'l' STO
'a' INCR DROP \->STR
DUP SIZE 2 SWAP 1 -
SUB 2 \->GROB g SWAP
+ 'g' STO
          ELSE DUP
VTYPE
            IF 15
==
            THEN
DUP d + 'd' STO 'b'
INCR DROP \->STR DUP
SIZE 2 SWAP 1 - SUB
2 \->GROB g + 'g' STO
            ELSE
DROP
            END
          END
        NEXT
      END PATH OBJ\->
1 - SWAP DROP \->LIST
\->STR 2 \->GROB g +
'g' STO
      DO # 131d
# 64d BLANK PICT
STO n 1 + a b + n 8
+ MIN
        FOR o PICT
# 8d o n 1 + - 8 *
R\->B 2 \->LIST g o GET
GOR
          IF o b \<=
          THEN PICT
# 0d o n 1 + - 8 *
R\->B 2 \->LIST f GOR
          END
          IF p n +
o ==
          THEN PICT
# 0d o n 1 + - 8 *
R\->B 2 \->LIST s GXOR
          END
        NEXT PICT {
# 123d # 45d }
        IF a b + n
- 6 >
        THEN
GROB 7 10 C141414141773663C180
        ELSE # 7d
# 10d BLANK
        END REPL
PICT { # 117d # 57d
}
GROB 14 7 FFF39A22DA639D63DA639A63FFF3
REPL PICT { # 123d
# 0d }
        IF n 0 >
        THEN
GROB 7 10 80C163367741414141C1
        ELSE # 7d
# 10d BLANK
        END REPL 0
'z' STO
        DO { # 0d
# 0d } PVIEW 7
FREEZE 0 WAIT DUP {
16.1 35.1 25.1 25.3
35.3 91.3 } SWAP
POS DUP PICT # 0d p
1 - 8 * R\->B 2 \->LIST
s GXOR
          IF 0 \=/
          THEN {
            \<< 2 'z'
STO
            \>>
            \<<
              IF n
a b + < p 8 == AND
              THEN
'n' 8 STO+ 1 'p'
STO 1 'z' STO
              ELSE
IF p n + a b + n 8
+ MIN <
THEN 'p' INCR DROP
END
              END
            \>>
            \<<
              IF n
0 > p 1 == AND
              THEN
'n' 8 STO- 8 'p'
STO 1 'z' STO
              ELSE
IF p 1 >
THEN 'p' DECR DROP
END
              END
            \>>
            \<<
              IF n
0 >
              THEN
'n' 8 STO- 1 'z'
STO
              END 1
'p' STO
            \>>
            \<< a b +
'p' STO
              WHILE
p 8 >
              REPEAT
'n' 8 STO+ 'p' 8
STO- 1 'z' STO
              END
            \>>
            \<< OFF
            \>> }
SWAP GET EVAL
          ELSE DROP
          END PICT
# 0d p 1 - 8 * R\->B
2 \->LIST s GXOR
        UNTIL 51.1
== z 0 \=/ OR
        END TEXT
CLLCD
        IF z 0 ==
        THEN
          IF p n +
b >
          THEN l p
b - n + GET RCL
TEXT TEXTVIEW ERASE
          ELSE
            IF p n
+ 1 >
            THEN d
p n + 1 - GET EVAL
            ELSE
UPDIR
            END
          END
        END
      UNTIL p n + b
\<= z 2 == OR
      END 1 'b' STO
0 'a' STO { } 'd'
STO { } 'l' STO { }
'g' STO 1 0 'n' STO
'p' STO
    UNTIL z 2 ==
    END EVAL
  \>>
\>>