add stack depth
This commit is contained in:
parent
af258b538a
commit
448b71dab1
@ -32,6 +32,9 @@ instructionExecFlush state = instructionFlush state exec
|
|||||||
instructionExecEq :: State -> State
|
instructionExecEq :: State -> State
|
||||||
instructionExecEq state = instructionEq state exec
|
instructionExecEq state = instructionEq state exec
|
||||||
|
|
||||||
|
instructionExecStackDepth :: State -> State
|
||||||
|
instructionExecStackDepth state = instructionStackDepth state exec
|
||||||
|
|
||||||
instructionExecDoRange :: State -> State
|
instructionExecDoRange :: State -> State
|
||||||
instructionExecDoRange state@(State {_exec = (e1 : es), _int = (i0 : i1 : is)}) =
|
instructionExecDoRange state@(State {_exec = (e1 : es), _int = (i0 : i1 : is)}) =
|
||||||
if increment i0 i1 /= 0
|
if increment i0 i1 /= 0
|
||||||
|
@ -71,3 +71,6 @@ instructionFloatFlush state = instructionFlush state float
|
|||||||
|
|
||||||
instructionFloatEq :: State -> State
|
instructionFloatEq :: State -> State
|
||||||
instructionFloatEq state = instructionEq state float
|
instructionFloatEq state = instructionEq state float
|
||||||
|
|
||||||
|
instructionFloatStackDepth :: State -> State
|
||||||
|
instructionFloatStackDepth state = instructionStackDepth state float
|
||||||
|
@ -63,3 +63,6 @@ instructionEq state accessor =
|
|||||||
where
|
where
|
||||||
stackTop :: [a]
|
stackTop :: [a]
|
||||||
stackTop = take 2 $ view accessor state
|
stackTop = take 2 $ view accessor state
|
||||||
|
|
||||||
|
instructionStackDepth :: State -> Lens' State [a] -> State
|
||||||
|
instructionStackDepth state accessor = state & int .~ (length (view accessor state) : view int state)
|
||||||
|
@ -76,3 +76,6 @@ instructionIntFlush state = instructionFlush state int
|
|||||||
|
|
||||||
instructionIntEq :: State -> State
|
instructionIntEq :: State -> State
|
||||||
instructionIntEq state = instructionEq state int
|
instructionIntEq state = instructionEq state int
|
||||||
|
|
||||||
|
instructionIntStackDepth :: State -> State
|
||||||
|
instructionIntStackDepth state = instructionStackDepth state int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user