Class: Fisk::Helpers::JITBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/fisk/helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(memory) ⇒ JITBuffer

Returns a new instance of JITBuffer.



54
55
56
57
# File 'lib/fisk/helpers.rb', line 54

def initialize memory
  @memory = memory
  @pos = 0
end

Instance Attribute Details

#memoryObject (readonly)

Returns the value of attribute memory.



52
53
54
# File 'lib/fisk/helpers.rb', line 52

def memory
  @memory
end

#posObject (readonly)

Returns the value of attribute pos.



52
53
54
# File 'lib/fisk/helpers.rb', line 52

def pos
  @pos
end

Instance Method Details

#putc(byte) ⇒ Object



59
60
61
62
# File 'lib/fisk/helpers.rb', line 59

def putc byte
  @memory[@pos] = byte
  @pos += 1
end

#to_function(params, ret) ⇒ Object



64
65
66
# File 'lib/fisk/helpers.rb', line 64

def to_function params, ret
  Fiddle::Function.new memory.to_i, params, ret
end