OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc/] [execute/] [IMP.m] - Blame information for rev 702

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 702 jeremybenn
/* Contributed by Nicola Pero - Fri Mar  9 19:39:15 CET 2001 */
2
 
3
#include <stdlib.h>
4
#include "../../objc-obj-c++-shared/runtime.h"
5
 
6
/* Test getting and calling the IMP of a method */
7
 
8
@interface TestClass
9
{
10
  Class isa;
11
}
12
+ (int) next: (int)a;
13
@end
14
 
15
@implementation TestClass
16
+ (int) next: (int)a
17
{
18
  return a + 1;
19
}
20
@end
21
 
22
int main (void)
23
{
24
  Class class;
25
  SEL selector;
26
  int (* imp) (id, SEL, int);
27
 
28
  class = objc_getClass ("TestClass");
29
  selector = @selector (next:);
30
  imp = (int (*)(id, SEL, int))method_getImplementation
31
    (class_getClassMethod (class, selector));
32
 
33
  if (imp (class, selector, 5) != 6)
34
    {
35
      abort ();
36
    }
37
 
38
  return 0;
39
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.