OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc/] [execute/] [enumeration-1.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 -  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
/* Test using a bitfield enumeration ivar.  */
7
 
8
typedef enum
9
{
10
  black,
11
  white
12
} color;
13
 
14
@interface TestClass: Object
15
{
16
  color c:2;
17
}
18
- (color)color;
19
- (void)setColor: (color)a;
20
@end
21
 
22
@implementation TestClass
23
- (color)color
24
{
25
  return c;
26
}
27
- (void)setColor: (color)a
28
{
29
  c = a;
30
}
31
@end
32
 
33
 
34
int main (void)
35
{
36
  TestClass *c;
37
 
38
  c = [TestClass new];
39
 
40
  [c setColor: black];
41
  [c setColor: white];
42
  [c setColor: black];
43
  if ([c color] != black)
44
    {
45
      abort ();
46
    }
47
 
48
 
49
  return 0;
50
}

powered by: WebSVN 2.1.0

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