[comp.sys.handhelds] HP48-PhoneBook

TAINT020@ysub.ysu.edu (Robert Noe) (02/16/91)

After downloading and using the Phone book program (by somebody whose name
escapes me right now) I found that it was very usefull and handy.  However
I did find that it was quite large (me only having a 32k card) and the
program just cried out for DataBrowser (one of James Donnelly's tools in
the Programmer's ToolKit).  Well Im almost done rewriting a phonebook
system using tools from the Toolkit and I was planning on posting it (the
phonebook not the ToolKit) to the net soon but I have one question.  How
should I upload it so that people with the ToolKit should use it.  Ive heard
references to problems with unresolved xlib calls and such and Im not sure
I understand everything fully so any hints would be helpfull!  Hopefully
Ill be done this weekend (I just have to write a delete entry routine) and
everyone with the toolkit can be using it soon.

      Thanks for any Help!
---
            Bob Noe
               TAINT020@YSUB.YSU.EDU
"All the brightest boys, to play with the biggest toys,
 More than they bargined for" -- Rush

TAINT020@ysub.ysu.edu (Robert Noe) (02/19/91)

Here is my phone book management program.  Remember that it uses two of
James Donnelly's libraries from the Programmers Toolkit.  Below you will
find my attempt at documentation and following that the directory itself.
Hopefully nobody will have any problems with this but if you do Ill be
happy to answer any questions.  I would also like to here any comments and
suggestions.
        Thanks....
---
            Bob Noe
               TAINT020@YSUB.YSU.EDU
"All the brightest boys, to play with the biggest toys,
 More than they bargined for" -- Rush

---
Installing

   Load the PBK directory using TEXT with translation code 3.
   PBK needs both DBLIB and TLLIB (James Donnelly's libraries)
   to be installed to work.  It is easiest to have these installed
   during the transfer process although it can be made to work by
   installing the libraries afterwards and then visiting the programs.

To run just hit the softkey labled PHNE.
   Since you have a blank PHDAT (which follows the format for the other
   phone program) you will be dropped directly into the input routine.
   Just follow the prompts.  One thing to note: the search routine is
   case sensitive so I enter in all my text in upper case.  This really
   isn't a large problem since most of the screens use the small font
   in which everything is upper case.

   Once you have provided one entry you will be presented with the NAMES
   list.  (In this case it will contain only one name).  This interface
   is provided by the DBLIB and is quite nice.  I'll quickly go thru some
   of its functions as they relate to my program.

UP & DOWN arrows
   The up and down arrows scroll you up and down through the list.
   LEFT SHIFT UP and DOWN are page up and page down.
   RIGHT SHIFT UP and DOWN move you to the ends of the list.
VISIT
   For entries that are longer than the display VISIT will display the
   entire entry (as well as expanding newline characters).
EDIT
   Allows you to EDIT an entry.
ALPHA
   The ALPHA key places you in search mode.  This mode allows you to
   search for an entry containing the string you specify.
ON
   ON will exit the program.
OFF
   OFF will shut the calculator off without leaving the DataBrowser.

The menu keys....

SORT
   SORT sorts the list based upon what item is being examined.
   example....
       If you are looking at a list of NAMES and hit sort everything
       gets sorted based on the name field.

The next two keys change depending on what list is being viewed.  They
serve to switch between lists of NAMEs, ADDResses, and PHoNE numbers.

ADD
   ADD allows you to input a new entry.
DEL
   DEL deletes the current entry.
QUIT
   QUIT quits PBK.  (leaving the stack unchanged) (I hope  :) :) )

The ENTER key switches to a DETAIL MODE.  (for lack of a better name.)

In DETAIL MODE you are presented with one record at a time.  The
databrowser keys work as described as above.

LIST
   LIST returns you to the main list (NAME,ADDR,PHNE) depending where the
   DataBrowser pointer is.
NEXT and PREV
   NEXT and PREV scroll through the records one at a time.
ADD, DEL, and QUIT function as described as above.
The ENTER key functions just like the LIST option in the MENU.

And finally here is the listing.....
Size: 2071.5
Chck: # 4F83h
---
%%HP: T(3)A(D)F(.);
DIR
  phne
    \<<
      IF PHDAT 1
GET SIZE NOT
      THEN inp DROP
      END 3 1 view
    \>>
  view
    \<< \-> n p
      \<< { } 'PHDAT'
n GET { "SORT" } {
"ADDR" "PHNE"
"NAME" "ADD" "DEL"
"QUIT" } DUP n GET
1 \->LIST SDIFF + { 1
} p + p + 1 + {
"Addresses"
"Numbers" "Names" }
n GET + DBR 4 ROLL
PHDAT SWAP n SWAP
PUT 'PHDAT' STO 3
ROLL DROP
        CASE DUP 1
==
          THEN DROP
{ 2 3 1 } n GET
aview
          END DUP 1
NEG ==
          THEN DROP
'p' STO n sort n p
view
          END DUP 2
NEG ==
          THEN DROP
{ 2 1 1 } n GET
SWAP view
          END DUP 3
NEG ==
          THEN DROP
{ 3 3 2 } n GET
SWAP view
          END DUP 4
NEG ==
          THEN DROP
DROP inp n SWAP
view
          END DUP 5
NEG ==
          THEN DROP
del n 1 view
          END DUP 0
== SWAP 6 NEG == OR
          THEN DROP
          END
        END
      \>>
    \>>
  aview
    \<< \-> n p
      \<< { "Name: "
"Addr: " "  Ph: " }
PHDAT OBJ\-> n
EXTRACT ROLLD 3
\->LIST { "LIST"
"NEXT" "PREV" "ADD"
"DEL" "QUIT" } { 1
1 } p + { 1
"Detail" } + DBR 3
ROLL DROP 3 ROLL n
recsto
        CASE DUP
ABS 1 ==
          THEN DROP
{ 3 1 2 } SWAP GET
n view
          END DUP 2
NEG ==
          THEN DROP
n 1 +
            IF DUP
PHDAT 1 GET SIZE >
            THEN
DROP 1
            END
SWAP aview
          END DUP 3
NEG ==
          THEN DROP
n 1 -
            IF DUP
0 ==
            THEN
DROP PHDAT 1 GET
SIZE
            END
SWAP aview
          END DUP 4
NEG ==
          THEN DROP
DROP inp 1 aview
          END DUP 5
NEG ==
          THEN DROP
DROP n del 1 1
aview
          END DUP 6
NEG == 2 PICK 0 ==
OR
          THEN DROP
DROP
          END
        END
      \>>
    \>>
  sort
    \<< PHDAT 1 GET
SIZE \-> p n
      \<< 1 n
        FOR l PHDAT
OBJ\-> l EXTRACT
\->LIST
        NEXT n p
LSORT DUP 1 + DUPN
1 EXTRACT \->LIST 1
MSWAP DUP 1 + DUPN
2 EXTRACT \->LIST 1
MSWAP 3 EXTRACT
\->LIST 1 MM\->L + SWAP
DROP SWAP 1 \->LIST
SWAP + 'PHDAT' STO
      \>>
    \>>
  del
    \<< \-> n
      \<< 1 3
        FOR l PHDAT
l GET DUP 1 n 1 -
SUB SWAP DUP SIZE n
1 + SWAP SUB +
        NEXT 3
\->LIST 'PHDAT' STO
      \>>
    \>>
  recsto
    \<< \-> rec n
      \<< PHDAT 1 GET
n rec 2 GET PUT
PHDAT 2 GET n rec 3
GET PUT PHDAT 3 GET
n rec 1 GET PUT 3
\->LIST 'PHDAT' STO
      \>>
    \>>
  inp
    \<< "Enter name:"
{ "" 1 \Ga } INPUT
PHDAT 3 GET SWAP +
"Enter address:" {
"" 1 \Ga } INPUT
PHDAT 1 GET SWAP +
"Enter phone numb:"
{ "" 1 \Ga } INPUT
PHDAT 2 GET SWAP +
3 ROLL 3 \->LIST
'PHDAT' STO PHDAT 1
GET SIZE
    \>>
  CST { phne }
  PHDAT { { } { } {
} }
END