-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
various documentation updates and small fixes
- Loading branch information
mtrute
committed
Oct 3, 2017
1 parent
50d2ae4
commit 08295c7
Showing
6 changed files
with
69 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
\ check for the 'c' syntax for single | ||
\ characters. | ||
: rec:char ( addr len -- n r:num | r:fail ) | ||
\ check for the 'c' syntax for single characters. | ||
: rec-char ( addr len -- n rectype-num | rectype-null ) | ||
3 = if \ a three character string | ||
dup c@ [char] ' = if \ starts with a ' | ||
dup 2 + c@ [char] ' = if \ and ends with a ' | ||
1+ c@ r:num exit | ||
1+ c@ rectype-num exit | ||
then | ||
then | ||
then | ||
drop r:fail | ||
drop rectype-null | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
s" tester.fs" INCLUDED | ||
s" Stack.4th" INCLUDED | ||
|
||
\ ------------- Test Cases ------------ | ||
|
||
4 STACK constant test | ||
|
||
: s1 1 0 ; \ 0 means continue with map-stack | ||
: s2 2 0 ; | ||
: s3 3 0 ; | ||
: s4 4 -1 ; \ -1 means premature exit from map-stack | ||
|
||
\ set and get methods | ||
T{ -1 test ' SET-STACK CATCH -> -1 test -4 }T | ||
T{ 0 test SET-STACK -> }T | ||
T{ test GET-STACK -> 0 }T | ||
|
||
T{ ' s1 1 test SET-STACK -> }T | ||
T{ test GET-STACK -> ' s1 1 }T | ||
|
||
T{ ' s2 ' s1 2 test SET-STACK -> }T | ||
T{ test GET-STACK -> ' s2 ' s1 2 }T | ||
|
||
T{ ' s1 ' s2 ' s3 3 test SET-STACK -> }T | ||
T{ test GET-STACK -> ' s1 ' s2 ' s3 3 }T | ||
|
||
\ testing map-stack | ||
\ the whole stack is used for execute | ||
T{ ' EXECUTE test MAP-STACK -> 3 2 1 0 }T | ||
|
||
T{ ' s1 ' s2 ' s4 3 test SET-STACK -> }T | ||
\ only the 1st element is executed | ||
T{ ' EXECUTE test MAP-STACK -> 4 -1 }T | ||
|
||
\ append and prepend methods | ||
T{ ' s1 1 test SET-STACK -> }T | ||
T{ ' s2 test >STACK -> }T | ||
T{ test GET-STACK -> ' s1 ' s2 2 }T | ||
T{ test STACK> -> ' s2 }T | ||
T{ test GET-STACK -> ' s1 1 }T | ||
|
||
T{ ' s1 1 test SET-STACK -> }T | ||
T{ ' s2 test >BACK -> }T | ||
T{ test GET-STACK -> ' s2 ' s1 2 }T | ||
T{ test BACK> -> ' s2 }T | ||
T{ test GET-STACK -> ' s1 1 }T | ||
|
||
\ depth | ||
T{ 2 1 0 3 test SET-STACK -> }T | ||
T{ test DEPTH-STACK -> 3 }T | ||
|
||
\ pick | ||
T{ 2 1 0 3 test SET-STACK -> }T | ||
T{ 0 test PICK-STACK -> 0 }T | ||
T{ 1 test PICK-STACK -> 1 }T | ||
|
||
T{ -1 test ' PICK-STACK CATCH -> -1 test -9 }T | ||
T{ 5 test ' PICK-STACK CATCH -> 5 test -9 }T |