mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-09-07 12:54:31 +00:00
Back to directly manipulating FOR index value
This commit is contained in:
parent
f9b7c51b3d
commit
4c4ec7c985
@ -1242,21 +1242,18 @@ end
|
||||
|
||||
def natv_for(symptr, expr)
|
||||
var index, ufunc, dlist
|
||||
var[2] indexval, incval, stepval
|
||||
var[2] incval, stepval
|
||||
|
||||
index = expr=>car
|
||||
expr = expr=>cdr
|
||||
if index->type & TYPE_MASK <> SYM_TYPE
|
||||
if expr=>car->type & TYPE_MASK <> SYM_TYPE
|
||||
puts("For index not symbol\n")
|
||||
return NULL
|
||||
fin
|
||||
symptr = eval_expr(index)
|
||||
if symptr->type <> NUM_INT
|
||||
index = eval_expr(expr=>car)
|
||||
expr = expr=>cdr
|
||||
if index->type <> NUM_INT
|
||||
puts("FOR index not integer\n")
|
||||
return NULL
|
||||
fin
|
||||
indexval[0] = symptr=>intval[0]
|
||||
indexval[1] = symptr=>intval[1]
|
||||
symptr = eval_expr(expr=>car)
|
||||
expr = expr=>cdr
|
||||
if symptr->type <> NUM_INT
|
||||
@ -1288,10 +1285,9 @@ def natv_for(symptr, expr)
|
||||
sweep_stack[sweep_stack_top - 1] = eval_expr(expr=>car)
|
||||
expr = expr=>cdr
|
||||
loop
|
||||
load32(@indexval)
|
||||
load32(index + intval) // Manipulate integer value directly!
|
||||
add32(@stepval)
|
||||
store32(@indexval)
|
||||
set_assoc(index, new_int(indexval[0], indexval[1]))
|
||||
store32(index + intval)
|
||||
loop
|
||||
return pop_sweep_stack
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user