mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-12-02 09:02:32 +00:00
58 lines
927 B
R
58 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;
|