en:pfw:library
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:pfw:library [2025-03-20 17:02] – [noForth t extending the library] willem | en:pfw:library [2025-04-01 15:56] (current) – [noForth t library use] willem | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== A library for Forth ====== | + | ====== A library for (no)Forth ====== |
- | *W.O.* | + | *W.O. 2025* |
Line 14: | Line 14: | ||
An optional word as suggested by Ulrich Hoffmann | An optional word as suggested by Ulrich Hoffmann | ||
- | * '' | + | * '' |
Optional words as suggested by Willem Ouwerkerk | Optional words as suggested by Willem Ouwerkerk | ||
* '' | * '' | ||
* '' | * '' | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
===== Pseudo code ===== | ===== Pseudo code ===== | ||
Line 164: | Line 164: | ||
LIB value LIBHERE | LIB value LIBHERE | ||
- | : LIB-FIND | + | : FIND-CHAPTER |
- | keyword place \ Save keyword | + | |
- | | + | libhere lib |
- | libhere | + | |
- | begin | + | |
- | | + | 2dup < throw |
- | 0D scan nip over 1+ \ Get line with keywords, skip \ | + | dup c@ r@ c@ = until |
- | | + | dup 2r@ over s<> 0= until \ Name ok? |
- | 2dup > while | + | |
- | bl skip dup >r \ Skip leading spaces | + | |
- | bl scan \ After keyword | + | |
- | r@ over r> - \ Keyword length | + | |
- | keyword count s<> 0= \ Keyword found, leave source address | + | |
- | if 2drop nip exit | + | |
- | then | + | |
- | | + | |
- | 2drop 09 scan 1+ \ Find library section, skip 09 | + | |
- | | + | |
: LIB-REFILL | : LIB-REFILL | ||
Line 200: | Line 192: | ||
: NEEDED | : NEEDED | ||
['] lib-refill | ['] lib-refill | ||
- | | + | |
and lib-load ; | and lib-load ; | ||
Line 303: | Line 295: | ||
repeat | repeat | ||
- | : LOOK-AT | + | : LOOK-AT |
</ | </ | ||
Line 452: | Line 444: | ||
</ | </ | ||
- | Viewing code chapter from any library. It needs the name as string parameter.\\ | + | Viewing code chapter from any library. It needs the library |
<code forth> | <code forth> | ||
- | : CHAPTERS-FROM ( " | + | : CHAPTERS-FROM ( " |
lib libhere 2> | lib libhere 2> | ||
chapters | chapters |
en/pfw/library.1742486557.txt.gz · Last modified: 2025-03-20 17:02 by willem