Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!microsoft!alonzo From: alonzo@microsoft.UUCP (Alonzo GARIEPY) Newsgroups: comp.sys.handhelds Subject: Re: Want HP-28S fuel gauge, program name query Message-ID: <10095@microsoft.UUCP> Date: 29 Dec 89 18:18:18 GMT References: <4374@rtech.rtech.com> Reply-To: alonzo@microsoft.UUCP (Alonzo GARIEPY) Organization: Microsoft Corp., Redmond WA Lines: 22 In article <4374@rtech.rtech.com> glenk@llama.UUCP (Glen Kilpatrick) writes: > * I keep a "catalog" of ~150 objects of the form << param1 param2 > pgm >> 'name1' STO. I'd like pgm to report "Output for name1" when > it executes, but cannot afford the MEM to encode name1 INSIDE name1. There is a way to do this, but it seems like a lot of unnecessary work. You can write a machine code object that will determine what variable it is stored in and put the name on the stack. This will use up more memory in your program than the name itself. Alternatively, you can write a machine code subroutine (in another variable) that figures out where it was called from and determines the name of the calling program. Both of these approaches are extremely risky, which you did not want. The best way is to avoid this complexity and simply call your program from another program that prints the name for you. The basic idea is: INVOKE << DUP ->STR "Output for " SWAP + 1 DISP EVAL >> 'pgmname' INVOKE Alonzo Gariepy alonzo@microsoft