Top Level Namespace

Defined Under Namespace

Modules: Foolio

Instance Method Summary collapse

Instance Method Details

#for_arg(args) ⇒ Object

! /opt/local/bin/ruby -w -*- mode:ruby; coding:utf-8 -*-



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'ext/foolio/gen.rb', line 4

def for_arg(args)
  type,name = args
  case type
  when /uv_.*_t/
    "#{type} #{name}_;
  Data_Get_Struct(#{name}, #{type.gsub(/\*$/,"")}, #{name}_)"
  when /uv_.*_cb/
    "handle_->data = (void*)callback(#{name})"
  when "int"
    "int #{name}_ = NUM2INT(#{name})"
  when "unsigned int"
    "#{type} #{name}_ = NUM2UINT(#{name})"
  when "const char*"
    "#{type} #{name}_ = StringValueCStr(#{name})"
  else
    "// #{type} #{name}"
  end
end

#wrap(type) ⇒ Object



23
24
25
26
27
28
# File 'ext/foolio/gen.rb', line 23

def wrap(type)
  case type
  when "int"
    "INT2NUM"
  end
end