EXEC by John M O'Donnell (ODONNELL@LAMPF.LANL.GOV) 2-Oct-1994 [Note: EXEC is a command in the SYSUTILS library, also on this disk. If you use SYSUTILS, don't use this; you already have EXEC. -jkh-] --> S/SX/G/GX EXEC adds path like functionality to the HP48. This routine is similar to ones written by Scott Burke and Darryl Okahata. EXEC searches a list of directories (given in the variables 'TRAIL' and 'TRAIL.SYS') for the first occurrence of an object named in stack level 1. At the end of the search, the object is evaluated in the initial directory. Stack arguments: levels, N+1,...,2 - arguments required to evaluate requested object. level 1 - object to be found in another directory and then evaluated. Other arguments: TRAIL.SYS - an ordered list of directories to search for the object named in level 2. TRAIL.SYS is in HOME. TRAIL - an ordered list of directories to search for the object named in level 1. This list is prepended to TRAIL.SYS. It is used to make modifications to TRAIL.SYS local to a given directory tree. A default TRAIL with no paths should be included in HOME. In the interest of size and speed, little checking is done - make sure TRAIL refers only to existing directories. Return Stack: levels M,...,1 - results of evaluating the object. Error Messages: Bad Control Variable - TRAIL, or TRAIL.SYS is not a list. Other messages are described in the HP48 manual. Discussion: When searching a directory for the requested object, only the specified directories (and not their parents) are searched. Thus, using the directory tree from Scott Burke's example: HOME /\ WORK PLAY / / \ \ W1 W2 W3 GAMES and with TRAIL.SYS set to { { W2 } { WORK } }, the HOME directory would not be searched, and WORK would be searched only once. This version evaluates the requested object in the current directory, not the directory in which the object came from. (This can be easily changed.) I have considered points raised by the previous authors: (1) I do not require TRAIL or TRAIL.SYS to be in the HOME directory. It comes from the HP48 PATH, and a local copy is then maintained in the program. This allows software packages to have their own path. (2) the name is short. (3) Using SYSRPL considerably speeded up the code. Other speed improvements include searching only the requested directories (not their parents as well) and terminating the search loop as soon as the first occurrence of the requested object is found. (4) Searching the current directory can easily be achieved by including {} in TRAIL.SYS. (5) No extra code is required to handle {} occurring in TRAIL.SYS. (6) HOME is only searched if included in TRAIL.SYS (either as HOME or as { HOME }. (7) The code is independent of flag -55 (LAST ARGS). (8) The requested object is evaluated in the original directory, not the directory in which the requested object came from. This is a personal preference. I can provide a version which evaluates the object in it's own directory. Which option is preferred? Should it be selectable via a flag? Installation ============ Install EXEC in the HOME directory, make a list of directories to be searched by EXEC and store in TRAIL in the HOME directory.