Skip to content

Commit 35078d5

Browse files
committed
Add M+ and SPACES words.
Reorganize test suite alphabetically, add several missing tests. Execute one line of input at a time.
1 parent 919cd35 commit 35078d5

File tree

5 files changed

+1216
-1014
lines changed

5 files changed

+1216
-1014
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ error if it cannot be cannot be cross compiled.
745745
* `S"`
746746
* `S>D`
747747
* `SPACE`
748+
* `SPACES`
748749
* `STATE`
749750
* `SWAP`
750751
* `THEN`
@@ -809,15 +810,20 @@ all can be in the future.
809810
* `2CONSTANT`
810811
* `2LITERAL`
811812
* `2VARIABLE`
812-
* `D-`
813813
* `D+`
814+
* `D-`
814815
* `D0<`
816+
* `D<`
815817
* `D0=`
816818
* `D>S`
817819
* `DABS`
818820
* `DMAX`
819821
* `DMIN`
820822
* `DNEGATE`
823+
* `M+`
824+
825+
# Standard Double extension words
826+
821827
* `DU<`
822828

823829
# Optimizations

pkg/forth/builtin/03_double.f

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
: DNEGATE 0. 2SWAP D- ;
77
: DABS DUP 0< IF DNEGATE THEN ;
8+
: M+ S>D D+ ;
89

910
: D= ( x1 x2 y1 y2 -- bool )
1011
ROT ( x1 y1 y2 x2 )

pkg/forth/builtin/10_print.f

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@
2525

2626
DEFER EMIT \ let us change EMIT
2727
: SPACE BL EMIT ;
28+
: SPACES ( n -- )
29+
DUP 0> IF
30+
0 DO
31+
SPACE
32+
LOOP
33+
ELSE
34+
DROP
35+
THEN
36+
;
2837
: CR 10 13 EMIT EMIT ;
2938

3039
: U.NOSPACE ( u -- )

0 commit comments

Comments
 (0)