Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: sjack@dontemail.me (sjack) Newsgroups: comp.lang.forth Subject: Toad User abort with cut: ... -cut Date: Thu, 17 Oct 2024 15:55:17 -0000 (UTC) Organization: A noiseless patient Spider Lines: 127 Message-ID: Injection-Date: Thu, 17 Oct 2024 17:55:17 +0200 (CEST) Injection-Info: dont-email.me; posting-host="5119eb69bad735d99744a2df73b89dbc"; logging-data="2965019"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193uozK4VWETUpz5bWVQLWk" User-Agent: tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-45-generic (x86_64)) Cancel-Lock: sha1:Cebl83nu3qYNbl6YkAtkx6B3yyo= Bytes: 3865 Toad doesn't have CATCH/THROW but FigForth provides user abort (ABORT) . Have BacForth type words in RTC vocabulary. Using BACK...TREK and CUT: ... -CUT made SNAPSHOT error handler to show stacks and return to cleanup code marked by CUT: . Not nearly as capable and slick as CATCH/THROW but adequate for my light-weight applications. Have CATCH/THROW in Frog but Toad is all about making full use of FigForth facilities (use of abundant vocabularies has been very entertaining, ain't KISS.) User abort with cut: ... -cut Some code -- SNAPSHOT -- User abort action -- dump data stack and top of return stack -- (return stack top holds the address of the word where the -- fault was detected. ) -- Process each cut: cleanup location : SNAPSHOT RTC BEGIN -CUT cr ." --- (!) User abort: " cr ." Data stack: " s? xx cr ." Return : " r . cr ." --." cr LDEPTH 0= UNTIL cr ; -- YO -- Display some items of interest : YO rtc cr ." L-stack depth: " ldepth . cr ." LP : " lp@ . tab lp@ @ . +voc cr ." (ABORT) : " ' (ABORT) @ CELL+ NFA ID. cr ." UABORT : " dfa' uabort @ CELL+ NFA ID. cr ." FDIID : " fdiid . \ file id, zero after cleanup cr ; Success example "pad/txt" svdir sv! \ assign input path prefix ' snapshot is uabort \ assign user abort -uabort \ enable user abort -pause \ allow pausing fviews -p rubyatXLIX rubyatLI; \ view two files with pause option pad/txt/rubyatLI: LI. The Moving Finger writes; and, having writ, Moves on: nor all thy Piety nor Wit Shall lure it back to cancel half a Line, Nor all thy Tears wash out a Word of it. -more- pad/txt/rubyatXLIX: XLIX. Tis all a Chequer-board of Nights and Days, Where Destiny with Men for Pieces plays: Hither and thither moves, and mates, and slays, And one by one back in the Closet lays. +uabort \ disable user abort yo \ look at items of interest L-stack depth: 0 LP : 134566380 -1 (ABORT) : ABORT UABORT : SNAPSHOT FDIID : 0 ...CURRENT and CONTEXT are WRK BASE: 10 Latest: YO Fail example -uabort fviews rubyatXLIX foo rubyatLI; \ foo doesn't exit, should fail pad/txt/rubyatLI: LI. The Moving Finger writes; and, having writ, Moves on: nor all thy Piety nor Wit Shall lure it back to cancel half a Line, Nor all thy Tears wash out a Word of it. pad/txt/foo: --- (!) User abort: Data stack: 134583709 10 134582004 -2 666 Return : 134581372 --. --- (!) User abort: Data stack: empty Return : 134582140 --. --- (!) FVIEWS abandon +uabort yo L-stack depth: 0 LP : 134566380 -1 (ABORT) : ABORT UABORT : SNAPSHOT FDIID : 0 ...CURRENT and CONTEXT are WRK BASE: 10 Latest: YO -fin- OK -- me