108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/tecsgen/plugin/lib/MrubyBridgeSignaturePluginModule.rb', line 108
def gen_ep_func_body_ptr( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
t = @@ptr_list[ct_name]
type = t[1]
file.print <<EOT
struct RClass *a; /* MBP710 */
a = mrb_define_class_under(mrb, TECS, "#{type}Pointer", mrb->object_class);
MRB_SET_INSTANCE_TT(a, MRB_TT_DATA);
mrb_define_method(mrb, a, "initialize", #{type}Pointer_initialize, MRB_ARGS_REQ(1));
mrb_define_method(mrb, a, "[]", #{type}Pointer_aget, MRB_ARGS_REQ(1));
mrb_define_method(mrb, a, "value", #{type}Pointer_get_val, MRB_ARGS_NONE());
mrb_define_method(mrb, a, "[]=", #{type}Pointer_aset, MRB_ARGS_REQ(2));
mrb_define_method(mrb, a, "value=", #{type}Pointer_set_val, MRB_ARGS_REQ(1));
mrb_define_method(mrb, a, "size", #{type}Pointer_size, MRB_ARGS_NONE());
mrb_define_method(mrb, a, "length", #{type}Pointer_size, MRB_ARGS_NONE());
EOT
if t[2] == :Char then
file.print <<EOT
mrb_define_method(mrb, a, "to_s", CharPointer_to_s, MRB_ARGS_NONE());
mrb_define_method(mrb, a, "from_s", CharPointer_from_s, MRB_ARGS_REQ(1));
EOT
end
end
|