Toad User abort with cut: ... -cut

Liste des GroupesRevenir à cl forth 
Sujet : Toad User abort with cut: ... -cut
De : sjack (at) *nospam* dontemail.me (sjack)
Groupes : comp.lang.forth
Date : 17. Oct 2024, 16:55:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <verc15$2qfgr$1@dont-email.me>
User-Agent : tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-45-generic (x86_64))
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

Date Sujet#  Auteur
17 Oct 24 * Toad User abort with cut: ... -cut2sjack
17 Oct 24 `- Re: Toad User abort with cut: ... -cut1sjack

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal