quakeforge/tools/qfcc/test/sendv.r
Bill Currie a95f679283 Add a test for compiling calls to obj_msg_sendv.
It seems dag_set_live_vars still served a purpose after all, but I don't
feel like bringing it as I'd rather implement its param handing in
dagnode_set_edges. I've now got a test case for it, though the test
currently causes the VM to segfault (even with pr_boundscheck 2!).
2012-12-22 14:05:12 +09:00

57 lines
927 B
R

string got;
SEL (string name) sel_get_uid = #0;
@param (id receiver, SEL op, @va_list args) obj_msg_sendv = #0;
id (Class class) class_create_instance = #0;
int obj_increment_retaincount (id object) = #0;
void
send (id obj, string cmd, string str)
{
@static @param params[1];
@va_list va_list = {1, params};
SEL sel;
params[0].string_val = str;
sel = sel_get_uid (cmd);
obj_msg_sendv (obj, sel, va_list);
}
@interface Object //just so the runtime doesn't complain
{
Class isa;
}
+alloc;
-init;
-catch:(string) it;
@end
int
main ()
{
id obj = [[Object alloc] init];
send (obj, "catch:", "it");
return !(got == "it");
}
@implementation Object
+alloc
{
return class_create_instance (self);
}
-init
{
obj_increment_retaincount (self);
return self;
}
-catch:(string) it
{
got = it;
return self;
}
@end
id (id receiver, SEL op, ...) obj_msgSend = #0;
void __obj_exec_class (struct obj_module *msg) = #0;