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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc/] [execute/] [enumeration-1.m] - Blame information for rev 823

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

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

powered by: WebSVN 2.1.0

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