Class: CShadow::LongAttribute

Inherits:
CNativeAttribute show all
Defined in:
lib/cgen/attribute.rb

Instance Attribute Summary

Attributes inherited from CNativeAttribute

#ctype

Attributes inherited from Attribute

#cdecl, #check, #cvar, #dump, #free, #init, #load, #mark, #owner_class, #persists, #reader, #var, #writer

Instance Method Summary collapse

Methods inherited from CNativeAttribute

match

Methods inherited from Attribute

inherited, #inspect, match

Constructor Details

#initialize(*args) ⇒ LongAttribute

Returns a new instance of LongAttribute.



336
337
338
339
340
341
342
# File 'lib/cgen/attribute.rb', line 336

def initialize(*args)
  super
  @reader = "result = INT2NUM(shadow->#{@cvar})"
  @writer = "shadow->#{@cvar} = NUM2LONG(arg)"   # type check and conversion
  @dump = "rb_ary_push(result, INT2NUM(shadow->#{@cvar}))"
  @load = "tmp = rb_ary_shift(from_array); shadow->#{@cvar} = NUM2LONG(tmp)"
end