1 \ http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Tutorial.html
2 \ all `ass*' words are `( -- )' if not stated otherwise.
4 : rr ( -- ) s" 2hw.fs" included ;
8 \ ============================== 3.24 ========================================
9 \ Assignment: Emit ( c -- ) types c as character (not a number). Implement
17 \ ============================== 3.27 ========================================
18 \ Assignment: How could you modify copy-file so that it copies until a second
19 \ line is matched? Can you write a program that extracts a section of a text
20 \ file, given the line that starts and the line that terminates that section?
22 s" 1hw.fs" r/o open-file throw Value fd-in
23 s" lol.out" w/o create-file throw Value fd-out
25 Create line-buffer max-line 2 + allot
30 line-buffer max-line fd-in read-line throw
32 line-buffer swap fd-out write-line throw
35 \ ============================== 3.29 ========================================
36 : map-array ( ... addr u xt -- ... )
37 \ executes xt ( ... x -- ... ) for every element of the array starting
38 \ at addr and containing u elements
44 \ ============================== 3.31 ========================================
54 \ > s" lulz" find-name 48 dump ( mitschrift, leet hax )
57 \ > s" lulz" find-name 48 dump ( mitschrift, leet hax )
59 \ ============================== 3.33 ========================================
61 postpone over postpone over ; immediate
62 : foodup my-2dup ; \ see foodup
64 \ ============================== 3.34 ========================================
65 : ]L ] postpone literal ;
67 \ ============================== 3.37 ========================================
69 get-order wid swap 1+ set-order ;
72 \ > forth-wordlist >order
73 \ > order \ "ich schieb nochmal `Forth' rauf"
77 \ \ wie mach ich eine "gegenseitige" rekursion?
84 \ > begin x if y then x until ; \ das `then' macht backpatching !
85 \ > see foo \ ist falsch, weil buggy `see' :/
91 \ > [ .s ] \ jetzt wird zeug am stack vom compilezeit stuff angezeigt, w00t
98 \ \ `?branch' bedingter sprung, `branch' unbedingter sprung
100 \ btw, `cs-roll' manipuliert den stack zur compilezeit... (?)