ROLDX - Rolodex program v2.0 From: Jim Weisbin <73457.3462@CompuServe.COM> Newsgroups: comp.sources.hp48 Date: Sun, 27 Oct 1991 23:34:05 GMT Yet another rolodex program for the HP48. After sampling the various rolodex-type programs out there, I decided I needed to write my own. This one is written entirely in user code, so it can be easily modified. It is not as fast as some of the PDL and ML versions, but it mostly does what I expect from a rolodex program where some of the others fall short. PICT is not used, which greatly simplified the programming effort. The database form is "free form" in the sense that you can store anything you like on any line as long as you have at least seven items in each list (only 7 will be displayed). The 48 can display 7 lines of text quickly with a minimum of fuss and I find this to be adequate room to store name, address, phone, fax, and email data. The program is distributed as a directory. Press ROLDX to start. Depending on the value of flag 34 (see below), you will either see a screen with all 7 lines of the current item, or a screen containing 7 items, each being one line from each of 7 items starting from the current. You will be presented with a menu as follows: FIND FIND text prompted for. If one character only, only the 1st character of 1st or 2nd word (see flag 32 below) is checked for a match. If more than one character, a match is sought in any position. Only the line number set by the var rdLINE is searched. EDIT the usual - all 7 lines must be edited, RETURN leaves each unchanged. An empty string is ok. ADD add an item _after_ the current item. DEL delete the current item (you can't delete 1 of 1 though). ->STK put the current item on the stack. STK-> insert an item from the stack. (Must be a list with at least 7 items). In addition to the menu keys above, the following key- presses are supported: right-arrow, down-arrow, NEXT increment pointer up-arrow, left arrow, PREV decrement pointer left-shift right-arrow & down-arrow incr pointer by 7 left-shift left-arrow & up-arrow decr pointer by 7 right-shift right-arrow & down-arrow go to last right-shift left-arrow & up-arrow go to first (top) ENTER enter STATUS mode (change settings) right-shift OFF OFF (pause program) shift-PRINT print current item There is no sorting provided, but you can use .->STK, STK->, and DEL to move things around. (If you have Donnelly's Toolkit library, you can use LSORT - see below). The data format makes it fairly easy to transfer data to a PC and edit it there. The following global variables must be present in the current directory, and are provided with the listing: rdNAME a global containing another global which points to the roldx data list. For example, if the name of your data list is LIST1, then 'rdNAME' should contain the global 'LIST1', *not* the list itself! The format of the data list is a list of lists, each inner list containing at least 7 items, which can be empty strings, but must be present. The data format is the same as the iNB "Notebook" program which was posted to the net sometime ago (my complements to Poul-Henning Kamp). The program will not create a new list if one is not present, so you should modify the one I have provided, called LIST1. The data list must be in the Roldx directory!!! rdSIZ the number of entries (lists) in the data list. rdPOS number of the current item to display. rdLINE number of the line to search on, and the number of the line which gets displayed when displaying only the headings (flag 34 set). rdTXT the last text sought by the FIND command (can be a null string). The settings of user flags 32-35 are as follows (use the ENTER key to enter status mode and change the settings): Flag 32 if clear, and rdTEXT is only one character, (as set by the FIND command), the program will attempt to match the first character of the 1st word of the line to search on (rdLINE). In other words, clear flag 32 if you put surnames first. If you put surnames last, then set flag 32, and the program will attempt to match the 1st character of the 2nd word of the line to search. The words are assumed to be separated by a space. If no spaces are present, then the action is the same as if flag 32 is clear. Note that, if flag 32 is set, and there is either a trailing space or more than one space after the first word (and no other words), the program will attempt to match a space. In other words, avoid trailing spaces!!! Flag 33 if clear, the FIND command searches from the current position in the list, if set, it searches from the beginning, which can be very slow for large databases. Note that only the line number in rdLINE is searched (searching all lines would be too slow - perhaps a future PDL version will overcome this). Flag 34 if clear, display all 7 lines of each item, if set, display only one line of each item, for a total of seven items on each screen. With flag 34 set, the line diplayed for each item is the value of rdLINE. When flag 34 is set, using left-shift-arrows will scroll ahead or back by exactly 7 items (one full screen holds 7 lines). Flag 35 a temporary flag used by FIND to signal a match. In STATUS mode, there is a HELP key. The program HELP will also work when outside of the ROLDX program. Miscellaneous notes: Some of the routines are appropriate for general use. These are as follows: bell an error bell - edit to anything you want, as long as it can be evaluated. Ltrim trim leading spaces from a string. Similar to Donnelly's LTRIM, but doesn't remove tabs. Can be replaced by Donnelly's LTRIM for more speed. split split the at the item . Equivalent to Donnely's SPLIT SWAP. LDEL delete the item from the resulting in a new list minus that item. UPcase change case of characters between "a" and "z" to uppercase. Replacing this with Donnelly's UCASE will speed up FIND by at least 20%. Or, use the following ML routine, which was posted to the net (my apologies to the author, whose name I've lost): %%HP: T(3)A(D)F(.); "D9D20ECE81D0040D9D2075660CCD20380008FB9760147134164146819F2CECE8AAE4D71643106AE514A9EC0331B79EAD131FD9EAE1317F9625131FF962C0310EA6A148161CF8AF2C8F2D760142164808CB2130B2130BDE1" (run the above through ASC->). As noted above, if you want to sort the data list, you can use Donnelly's LSORT. Put the list on the stack and press OBJ->, then enter the number of the line you want to sort on (usually will be 1), then press LSORT from the TLLIB menu. Note that this will sort on the first letter(s) of each line so it is not really appropriate if you put surnames last (in other words, if you put surnames last, you will be sorting on first names). Some may ask why I put the program's dynamic parameters (like rdPOS, for example) in separate global variables, rather than in a parameter list. The answer is SPEED! The 48 can evaluate a global variable at least twice as fast as GETting a list item, and this can make a big difference to a program written in RPL. A future version of this program might be written in PDL, but who knows? I personally don't see the usefulness of compiling this into a library, but it should be do-able, providing the variables rdXXX mentioned above are in the $VAR list used by USRLIB. The program is free and distributed as-is: use at your own risk. There are NO sysevals or ML's to blow up your machine, but I make no guarantees of any kind. As distributed, the directory takes 4924.5 bytes (chksum #9582h). James Weisbin 73457.3462@compuserve.com