From: dxforth@gmail.com   
      
   On 1/05/2025 1:51 am, sjack wrote:   
   > dxf wrote:   
   >>   
   >> What happens in the case of CATCH - what's left on the stack?   
   >>   
   >   
   > Nowadays I don't use catch/throw, not that I have anything against it;   
   > I'm just being retro. But from past experience, if I recall right, the   
   > data stack may have been reset to its former position at the time of   
   > catch but the data on the stack could be dirty. Any on-error action,   
   > e.g. i/o cleanup, prior to abort would be prudent in avoiding the   
   > use of data left on the data stack (if catch hadn't restored it from   
   > a clone copy).   
      
   I've found this sort of thing very useful. Sometimes ABORT" isn't good   
   enough.   
      
   \ Convert wave file to program   
   : DECODE ( -- )   
    skipheader   
    begin   
    ['] findpreamble 1 ?catch 0=   
    while ( program found )   
    0. decodecount 2!   
    ['] getid 1 ?catch if s" ID" missing then   
    0 checksum !   
    ['] getaddress 1 ?catch if s" address" missing then   
    ['] getdata 1 ?catch if s" data" missing then   
    ['] getchecksum 1 ?catch if s" checksum" missing then   
    getend .decoded   
    repeat ;   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|