URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
/* Contributed by Nicola Pero - Fri Mar 9 19:39:15 CET 2001 */
|
/* Contributed by Nicola Pero - Fri Mar 9 19:39:15 CET 2001 */
|
#include <objc/objc.h>
|
#include <objc/objc.h>
|
#include <objc/objc-api.h>
|
#include <objc/objc-api.h>
|
|
|
#include "next_mapping.h"
|
#include "next_mapping.h"
|
|
|
/* Test getting and calling the IMP of a method */
|
/* Test getting and calling the IMP of a method */
|
|
|
@interface TestClass
|
@interface TestClass
|
{
|
{
|
Class isa;
|
Class isa;
|
}
|
}
|
- (int) next: (int)a;
|
- (int) next: (int)a;
|
@end
|
@end
|
|
|
@implementation TestClass
|
@implementation TestClass
|
- (int) next: (int)a
|
- (int) next: (int)a
|
{
|
{
|
return a + 1;
|
return a + 1;
|
}
|
}
|
@end
|
@end
|
|
|
|
|
int main (void)
|
int main (void)
|
{
|
{
|
Class class;
|
Class class;
|
SEL selector;
|
SEL selector;
|
int (* imp) (id, SEL, int);
|
int (* imp) (id, SEL, int);
|
|
|
class = objc_get_class ("TestClass");
|
class = objc_get_class ("TestClass");
|
selector = @selector (next:);
|
selector = @selector (next:);
|
imp = (int (*)(id, SEL, int))method_get_imp
|
imp = (int (*)(id, SEL, int))method_get_imp
|
(class_get_class_method (class, selector));
|
(class_get_class_method (class, selector));
|
|
|
if (imp (class, selector, 5) != 6)
|
if (imp (class, selector, 5) != 6)
|
{
|
{
|
abort ();
|
abort ();
|
}
|
}
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.