ANEW --Words-Reworked-- \ Wil Baden 2002-03-17 \ ********************************************************************* \ * * \ * Wil Baden 2003-01-24 * \ * * \ * WORDS Reworked * \ * * \ * These definitions depend on Power MacForth internals only. * \ * * \ ********************************************************************* \ * * \ * [WORDS ... WORDS] * \ * [WORDS ... WORDS] is macro-pair to scan the dictionary. * \ * Usage: [WORDS ( str len) ... ( ) WORDS] * \ * * \ * Thus for the classic MacForth WORDS - * \ * * \ * : WORDS ( -- ) * \ * [WORDS ( str len) \ For each word. * \ * 16 >COL dup 1+ ?CR TYPE SPACE ( ) * \ * WORDS] ; * \ * * \ * WORDS] has test to pause on keyboard-space or quit on other * \ * key stroke. * \ * * \ * [WORDS ... ?WORDS] * \ * [WORDS ... ?WORDS] lets you supply test for termination. * \ * Usage: [WORDS ( str len) ... test ( flag) ?WORDS] DROP * \ * * \ ********************************************************************* \ * * \ * WORDS ( -- ) * \ * My preference for format -- three spaces between words, * \ * blank line before and after words beginning with "--" (which * \ * is used with ANEW words). This groups related words. * \ * If found, --FILEPATHS-- will terminate display. * \ * * \ * MINE ( -- ) * \ * Show all new words in the kernel. My convention is to use * \ * --LATE-ADDITIONS-- for the beginning of user words added * \ * to the kernel. You choose. * \ * * \ * ADDS ( -- ) * \ * Show the words after the kernel. My convention is to use * \ * --EMPTY-- for the beginning of words after the kernel. * \ * * \ * DEFS ( -- ) * \ * Show all words in the last module, i.e. since last word * \ * beginning `--`. * \ * * \ ********************************************************************* \ ******************** [WORDS ?WORDS] WORDS] ********************** : [WORDS S" :| >>GetName$ " EVALUATE ; IMMEDIATE : ?WORDS] S" |; Get-First-Wordlist >>Apply " EVALUATE ; IMMEDIATE : WORDS] S" KEYSTOP? ?Words] DROP " EVALUATE ; IMMEDIATE \ ***************** [Save-Cursor] [Restore-Cursor] ***************** : [Save-Cursor] \ Optional s" [ ALSO EDITOR ] selstart @ >R [ PREVIOUS ] " EVALUATE ; IMMEDIATE : [Restore-Cursor] \ Optional s" [ ALSO EDITOR ] R> dup selstart ! selend ! [ PREVIOUS ] " EVALUATE ; IMMEDIATE \ ************************ .Vocabulary-Word ************************* : .Vocabulary-Word ( str len -- ) 2dup 2 MIN S" --" COMPARE 0= COL @ AND IF CR THEN dup 3 + ?CR 2dup TYPE 3 SPACES 2 MIN S" --" COMPARE 0= IF CR CR THEN ; \ ********************* WORDS MINE ADDS DEFS ********************* : Old-Words WORDS ; \ : WORDS ( -- ) \ [Save-Cursor] \ Optional \ CR [WORDS ( str len) \ .Vocabulary-Word \ WORDS] CR \ [Restore-Cursor] \ Optional \ ; : WORDS ( -- ) [Save-Cursor] \ Optional CR [WORDS ( str len) 2dup .Vocabulary-Word S" --FILEPATHS--" COMPARE 0= Keystop? OR ?WORDS] DROP CR [Restore-Cursor] \ Optional ; : MINE ( -- ) [Save-Cursor] \ Optional CR [WORDS ( str len) 2dup .Vocabulary-Word S" --LATE-ADDITIONS--" COMPARE 0= Keystop? OR ?WORDS] DROP CR [Restore-Cursor] \ Optional ; : ADDS ( -- ) CR [WORDS ( str len) 2dup .Vocabulary-Word S" --EMPTY--" COMPARE 0= Keystop? OR ?WORDS] DROP CR ; : DEFS ( -- ) CR [WORDS ( str len) 2dup .Vocabulary-Word 2 MIN S" --" COMPARE 0= ?WORDS] DROP CR ; Prior.Stream