import source from 1.3.40
[external/swig.git] / Examples / octave / enum / example.cxx
1 /* File : example.c */
2
3 #include "example.h"
4 #include <stdio.h>
5
6 void Foo::enum_test(speed s) {
7   if (s == IMPULSE) {
8     printf("IMPULSE speed\n");
9   } else if (s == WARP) {
10     printf("WARP speed\n");
11   } else if (s == LUDICROUS) {
12     printf("LUDICROUS speed\n");
13   } else {
14     printf("Unknown speed\n");
15   }
16 }
17
18 void enum_test(color c, Foo::speed s) {
19   if (c == RED) {
20     printf("color = RED, ");
21   } else if (c == BLUE) {
22     printf("color = BLUE, ");
23   } else if (c == GREEN) {
24     printf("color = GREEN, ");
25   } else {
26     printf("color = Unknown color!, ");
27   }
28   if (s == Foo::IMPULSE) {
29     printf("speed = IMPULSE speed\n");
30   } else if (s == Foo::WARP) {
31     printf("speed = WARP speed\n");
32   } else if (s == Foo::LUDICROUS) {
33     printf("speed = LUDICROUS speed\n");
34   } else {
35     printf("speed = Unknown speed!\n");
36   }
37 }