1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-09 16:25:01 +00:00

Clean up source

This commit is contained in:
David Schmenk
2024-07-08 20:55:55 -07:00
parent ab2239753c
commit 6a67577a9b

View File

@@ -134,10 +134,8 @@ export def new_cons#1
if cons_free if cons_free
consptr = cons_free consptr = cons_free
cons_free = cons_free=>link cons_free = cons_free=>link
//puts("Recycle cons\n")
else else
consptr = heapalloc(t_cons) consptr = heapalloc(t_cons)
//puts("Alloc cons\n")
fin fin
consptr=>link = cons_list consptr=>link = cons_list
cons_list = consptr cons_list = consptr
@@ -153,8 +151,6 @@ def match_int(intlo, inthi)
intptr = int_list intptr = int_list
while intptr while intptr
if intptr=>intval[0] == intlo and intptr=>intval[1] == inthi if intptr=>intval[0] == intlo and intptr=>intval[1] == inthi
//puts("Match int: ")
//puti(int); putln
return intptr return intptr
fin fin
intptr = intptr=>link intptr = intptr=>link
@@ -170,17 +166,14 @@ export def new_int(intlo, inthi)#1
if int_free if int_free
intptr = int_free intptr = int_free
int_free = int_free=>link int_free = int_free=>link
//puts("Recycle int\n")
else else
intptr = heapalloc(t_numint) intptr = heapalloc(t_numint)
//puts("Alloc int\n")
fin fin
intptr=>link = int_list intptr=>link = int_list
int_list = intptr int_list = intptr
intptr->type = NUM_INT intptr->type = NUM_INT
intptr=>intval[0] = intlo intptr=>intval[0] = intlo
intptr=>intval[1] = inthi intptr=>intval[1] = inthi
//puts("New int: "); puti(int); putln
return intptr return intptr
end end
@@ -198,8 +191,6 @@ def match_sym(symstr)
if symptr->name[i] <> symstr->[i]; break; fin if symptr->name[i] <> symstr->[i]; break; fin
next next
if i > len if i > len
//puts("Match symbol: ")
//puts(symstr - 1); putln
return symptr return symptr
fin fin
fin fin
@@ -220,7 +211,6 @@ export def new_sym(symstr)#1
symptr=>natv = NULL symptr=>natv = NULL
symptr=>lambda = NULL symptr=>lambda = NULL
memcpy(symptr + name, symstr + 1, ^symstr) memcpy(symptr + name, symstr + 1, ^symstr)
//puts("New symbol: "); puts(symstr); putln
return symptr return symptr
end end
@@ -389,8 +379,7 @@ export def parse_expr(evalptr, level, refill)#2 // return evalptr, exprptr
when ^evalptr when ^evalptr
is 0 is 0
if level if level
// Refill input buffer evalptr = refill() // Refill input buffer
evalptr = refill()
else else
return evalptr, exprptr return evalptr, exprptr
fin fin
@@ -767,9 +756,10 @@ def natv_lt(expr)
end end
def natv_print(expr) def natv_print(expr)
print_expr(eval_expr(expr=>car)) expr = eval_expr(expr=>car)
print_expr(expr)
putln putln
return NULL return expr
end end
// //