mirror of
https://github.com/nineties/planckforth
synced 2024-12-26 21:58:42 +01:00
23 lines
476 B
Forth
23 lines
476 B
Forth
\ planckforth -
|
|
\ Copyright (C) 2021 nineties
|
|
|
|
( === String === )
|
|
|
|
private{
|
|
|
|
\ Heap-allocated string object
|
|
\ p: null terminated string
|
|
: make-string ( p -- str )
|
|
dup strlen 1 + allocate throw tuck strcpy
|
|
; export
|
|
|
|
: release-string ( str -- ) free ; export
|
|
|
|
}private
|
|
|
|
T{ s" AAAAA" make-string constant A -> }T
|
|
T{ s" BBBBBBB" make-string constant B -> }T
|
|
T{ A s" AAAAA" streq -> true }T
|
|
T{ B s" BBBBBBB" streq -> true }T
|
|
T{ A release-string -> }T
|
|
T{ B release-string -> }T
|