Add release-array

This commit is contained in:
Koichi Nakamura 2021-12-03 21:28:41 +09:00
parent 71bb8bcaae
commit 4bb6829378

View file

@ -39,6 +39,11 @@ s" Index out of range" exception constant OUT-OF-RANGE export
allocate-array allocate-array
; export ; export
: release-array ( arr -- )
dup array>buf @ free
free
; export
: array-size ( arr -- n ) array>size @ ; export : array-size ( arr -- n ) array>size @ ; export
: check-index ( i arr -- ) : check-index ( i arr -- )
@ -135,3 +140,4 @@ T{ 1 0 A array! -> }T
T{ 0 A array@ -> 1 }T T{ 0 A array@ -> 1 }T
T{ 2 99 A array! -> }T T{ 2 99 A array! -> }T
T{ 99 A array@ -> 2 }T T{ 99 A array@ -> 2 }T
T{ A release-array -> }T