(Comp.sys.handhelds) Item: 3694 by Simone.Rapisarda at wolf.sublink.org Author: [Simone Rapisarda] Subj: Re: CUT Program [see CUT on this disk. -jkh] Date: Tue Jul 16 1991 Some time ago I wrote a similar program, I called it STRIP. I never posted it because I thought it was not so useful (and I didn't like it very much) but maybe I was wrong so here it is. I'm posting it because I think that it's more complete then CUT, it cuts off more things, it works also on lists and doesn't need the HACKIT library. All the operations are stack based so I think it's also faster. You can also run STRIP on programs containing 'Externals' without any problem. In fact before exploding a program it checks if it's a 'real' program or just an internal routine. I suggest you to use STRIP after PACK. [PACK is on Goodies Disk #2. -jkh-] STRIP is a recursive program so don't change its name. It removes from PROGRAMS and LISTS the following things: - The instructions IF and UNTIL - The user program delimiters ( \<< and \>> ) and if the program contains only one object it cuts off all program delimiters. - All the \>> (the two types) and the END (the ones of the IF THEN [ ELSE ] END construct) that are at the end of the programs. I have tried STRIP with a lot of programs and everything worked fine but I guarantee nothing so always backup your program before using STRIP and test the STRIPped version before normal use. Simple Example: before after 15 \<< 14 { \<< DUP \>> } 13 (2349C: XLIB 1792 15) 12 \<< SWAP \>> 11 \-> 10 'a' 10 { DUP } ("47A2078BF1B2130") 9 \<< 9 (2349C: XLIB 1792 15) 8 IF 8 SWAP (type 19) 7 THEN 7 \-> 6 (null program) 6 'a' 5 ELSE 5 \<< 4 (null program) 4 THEN 3 END 3 (null program) 2 \>> 2 ELSE 1 \>> 1 (null program) I hope everything is clear. RAP ---------- Resp: 1 of 1 by bson at rice-chex.ai.mit.edu Author: [Jan Brittenson] Date: Tue Jul 16 1991 In a posting of [14 Jul 91 01:59:48 GMT] Simone.Rapisarda@wolf.sublink.org (Simone Rapisarda) writes: > STRIP is a recursive program so don't change its name. > [Removes:] > > - The user program delimiters ( \<< and \>> ) and if the program contains > only one object it cuts off all program delimiters. This is potentially dangerous. The sequence: << X >> 'Y' STO Is quite different from the sequence: X 'Y' STO -- Jan Brittenson bson@ai.mit.edu