https://github.com/jrincayc/ucblogo-code
Revision e3a4d12a46d901da73743b105438891ed0f48504 authored by Joshua Cogliati on 26 October 2019, 02:34:26 UTC, committed by GitHub on 26 October 2019, 02:34:26 UTC
One is used to store pointers as well, so needs to be size of pointer.
2 parent s 160e994 + efcf4dd
Raw File
Tip revision: e3a4d12a46d901da73743b105438891ed0f48504 authored by Joshua Cogliati on 26 October 2019, 02:34:26 UTC
Merge pull request #3 from jrincayc/fix_segfault
Tip revision: e3a4d12
cond
;;; -*- logo -*-

.macro cond :cond.clauses
localmake "cond.result cond.helper :cond.clauses
if equalp first :cond.result "error [(throw "error last :cond.result)]
output last :cond.result
end

to cond.helper :cond.clauses
if emptyp :cond.clauses [output [[] []]]
if emptyp first :cond.clauses [output [error [Empty COND clause]]]
if equalp first first :cond.clauses "else ~
   [output list [] butfirst first :cond.clauses]
ignore error
catch "error [localmake "cond.result run first first :cond.clauses]
localmake "cond.error error
if not emptyp :cond.error [output list "error item 2 :cond.error]
if not memberp :cond.result [true false] ~
   [output list "error fput :cond.result [not TRUE or FALSE]]
if :cond.result [output list [] butfirst first :cond.clauses]
output cond.helper butfirst :cond.clauses
end

bury [cond cond.helper]
back to top