node/lib/metasm/metasm/compile_c.rb
# fills @state.offset (empty hash)
# automatic variable => stack offset, (recursive)
# offset is an ::Integer or a CExpression (dynamic array)
# assumes offset 0 is a ptr-size-aligned address
# TODO registerize automatic variables
fills @state.offset (empty hash)
automatic variable => stack offset, (recursive)
offset is an ::Integer or a CExpression (dynamic array)
assumes offset 0 is a ptr-size-aligned address
TODO registerize automatic variables
fills @state . offset ( empty hash ) automatic variable = > stack offset ( recursive ) offset is an :: Integer or a CExpression ( dynamic array ) assumes offset 0 is a ptr - size - aligned address TODO registerize automatic variables
def c_reserve_stack(block, off = 0)
			block.statements.each { |stmt|
				case stmt
				when Declaration
					next if stmt.var.type.kind_of? Function
					off = c_reserve_stack_var(stmt.var, off)
					@state.offset[stmt.var] = off
				when Block
					c_reserve_stack(stmt, off)
				end
			}
		end
def c_reserve_stack ( block , off = 0 ) block . statements . each { | stmt | case stmt when Declaration next if stmt . var . type . kind_of? Function off = c_reserve_stack_var ( stmt . var , off ) @state . offset [ stmt . var ] = off when Block c_reserve_stack ( stmt , off ) end } end
fills @state.offset (empty hash)
automatic variable => stack offset, (recursive)
offset is an ::Integer or a CExpression (dynamic array)
assumes offset 0 is a ptr-size-aligned address
TODO registerize automatic variables
fills @state . offset ( empty hash ) automatic variable = > stack offset ( recursive ) offset is an :: Integer or a CExpression ( dynamic array ) assumes offset 0 is a ptr - size - aligned address TODO registerize automatic variables
# do not update off, not nested subblocks can overlap
block
off