Path: funic!fuug!mcsun!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!rutgers!modus!otello!gear!wolf!Simone.Rapisarda
From: Simone.Rapisarda@wolf.sublink.org (Simone Rapisarda)
Newsgroups: comp.sys.handhelds
Subject: Re: CUT program
Message-ID: <16785.2880DF82@wolf.sublink.org>
Date: 14 Jul 91 01:59:48 GMT
Organization: Rekursive Labs sdf - Pisa, Italy
Lines: 87

Some time ago I wrote a similar program, I called it STRIP.
I never post 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 cut off more things, it works also on lists and don'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 containings 'External' without any 
problem. Infact 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.

STRIP is a recursive program so don't change is name.

It removes from PROGRAMS and LISTS the following things:

- The instructions IF and UNTIL

- The user programs delimiters ( \<< and \>> ) and if the program contain
  only one object it cut off all his 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.

The program follow in ASC format so use ASC\-> or ASCI\-> to decode it.

Bye

                                              RAP

----------------------- ASC ------------------------------------
%%HP:;
"D9D2078BF168BC178BF1C53A2279E1DBBF1D13A2279E1908E192CF19D1A1DBBF 
18DBF1339200000000000000520D9AE1387E192CF1C9432D9D20B2130D9AE138 
7E1AFE22D9D20916C1DBBF19C2A292CF168BC1C53A2279E1C94325D2C1C94324 
72C1EF3A1379C19C2A276BA178BF1A9CF178BF168BC1803A2A9CF178BF168BC1 
B0BC176BA176BA176BA1C2A2011000BA1393BB1393279E1AFE22D9D2078BF15B 
CF18DBF1DBBF18DBF1ED2A290DA1B21305DF2278BF19C2A2D9AE1AFE22D9D203 
303292CF1C943293632279E13F2A2A9CF1C9432EF532279E1908E1D5032D9D20 
DBBF18DBF19C2A290DA1B213049632ED2A292CF13013278BF15BCF178BF168BC 
178BF1339201000000000000910279E1AFE22D9D208DBF1C2A2031000946455E 
44594C492CF1B0BC14BAC1AFE22D9D208DBF19C2A290DA1B21305BF22DBBF1B2 
1305BF22D9D2078BF1C53A2279E1DBBF1D13A2279E1908E1AFE2284E20503545 
2594055DF22DBBF1B21305DF22C4232B21305DF229C2A290DA19C2A2313C1AFE 
22387C15BF22D9D2078BF19C2A2D9AE1AFE22D9D20AEC8154450B21305BF228D 
BF15DF22B21305DF22DBBF1F76C1B2130B21307F41"
------------------------- ASC-----------------------------------







--  
 WolfNet BBS Pisa (Italy) Tel. +39-50-589050 300-14.4K Baud Matrix 2:332/602.0
 Simone Rapisarda - via FidoNet node 2:33/800
 UUCP: ...!gear!wolf!Simone.Rapisarda
 ARPA: Simone.Rapisarda@wolf.sublink.org
