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/] [enumeration-2.m] - Blame information for rev 307

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 307 jeremybenn
/* Contributed by Nicola Pero -  Wed Dec  5 17:12:40 GMT 2001 */
2
#include <stdlib.h>
3
#import "../../objc-obj-c++-shared/Object1.h"
4
#include <objc/objc.h>
5
 
6
typedef enum { black, white } color;
7
 
8
typedef struct
9
{
10
  color a:2;
11
  color b:2;
12
} color_couple;
13
 
14
@interface TestClass: Object
15
{
16
  color_couple *c;
17
}
18
- (color_couple *)colorCouple;
19
- (void)setColorCouple: (color_couple *)a;
20
@end
21
 
22
@implementation TestClass
23
- (color_couple *)colorCouple
24
{
25
  return c;
26
}
27
- (void)setColorCouple: (color_couple *)a
28
{
29
  c = a;
30
}
31
@end
32
 
33
 
34
int main (void)
35
{
36
  color_couple cc;
37
  TestClass *c;
38
 
39
  c = [TestClass new];
40
 
41
  cc.a = black;
42
  cc.b = white;
43
 
44
  [c setColorCouple: &cc];
45
  if ([c colorCouple] != &cc)
46
    {
47
      abort ();
48
    }
49
 
50
 
51
  return 0;
52
}

powered by: WebSVN 2.1.0

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