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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc/] [execute/] [IMP.m] - Blame information for rev 378

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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