Sujet : Re: Why dial-a-standard is not a thing in Forth
De : dxforth (at) *nospam* gmail.com (dxf)
Groupes : comp.lang.forthDate : 01. May 2025, 02:42:24
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <f037c203efea3a55354777696bcd3cbc262925b4@i2pn2.org>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
On 1/05/2025 1:51 am, sjack wrote:
dxf <dxforth@gmail.com> 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 ;