// Only Limited features are supported currently enum Days; enum Days { Mon, Tues, Wed, Num }; // int type, integral type => auto number Days x0; enum Days x1; enum( char ) { A = 'A', B, C, D }; // char type, integral type => auto number enum( double ) { F = 3.5, G = 7.7 }; // double type, non-integral type => programmer must assign ALL enums enum( double ) X { R = 3.5, QQ = 7.7 }; // double type, non-integral type => programmer must assign ALL enums enum( char * ) names { X = "X", Y = "Y" }; // char * type, non-integral type => programmer must assign ALL enums enum( int ) { Q, W, E }; // int type, integral type => auto number int w; enum( int * ) addr { W = &w }; // int * type, non-integral type => programmer must assign ALL enums enum( * int ) addr2 { WW = &w }; // int * type, non-integral type => programmer must assign ALL enums /* void f() {} void g() {} enum( void (*)() ) { FF = f, FG = g }; // void (*)() type, non-integral type => programmer must assign ALL enums enum( void (*)() ) funs { FF = f, FG = g }; // void (*)() type, non-integral type => programmer must assign ALL enums enum( * [void] () ) { FF1 = f, FG1 = g }; // void (*)() type, non-integral type => programmer must assign ALL enums enum( * [void] () ) funs1 { FF1 = f, FG1 = g }; // void (*)() type, non-integral type => programmer must assign ALL enums enum( [int, int] ) { XXX = [1,2] }; enum( [int, int] ) na { XXX = [1,2] }; enum fred; struct S {}; enum S { UX = { { 3 }, 4 }, UY = { { 7 }, 8 } }; enum( struct S ) mary { MX }; enum mary { MX }; enum( struct S * ) mary { MX = { { 3 }, 4 }, MY = { { 7 }, 8 } }; enum( S * ) mary { MX = { { 3 }, 4 }, MY = { { 7 }, 8 } }; enum( * S ) mary { MX = { { 3 }, 4 }, MY = { { 7 }, 8 } }; enum( enum fred ) mary { C }; struct HH { enum hh { h }; }; //enum HH.hh h; // Fred is a subset of char * enum( char * ) Fred { A = "A", B = "B", C = "C" }; // Jack is a subset of Fred // these are same enum( enum Fred ) Jack { W = A, Y = C}; enum( enum Fred ) Jack { W, Y = C}; enum( Fred ) Jack { W, Y = C}; // desirable, but hard to parse // Mack is a subset of char * // these are same enum( char * ) Mack { W1 = A, Y1 = "whee" }; // Mary is a SUPERSET of Fred // these are same enum Mary { inline Fred, D = "hello" }; enum( char * ) Mary { inline Fred, D = "hello" }; enum( char * ) Charlie { G = "G", H = "H" }; enum Jane { inline Fred, inline Charlie, K = "K" }; enum( char * ) Jane { inline Fred, inline Charlie, K = "K" }; typedef long int size_t; enum( size_t ) Lisa { L1, L2, L3}; // bad: Fred is char*; Lisa is size_t enum Jane { inline Fred, inline Lisa, M = "M" }; enum( char * ) Jane { inline Fred, inline Lisa, M = "M" }; enum( char ) Steve { steveA = 'A' }; enum Don1 { inline Steve, daveB = (char) 2 }; // ok enum Don2 { inline Steve, daveB = 2 }; // typeof( readLine() ? steveA : 2 ) // desirable, may cause constexpr problems enum( struct vec3f ) Axis { Up @= {1,0,0}, Left @= {0,1,1}, Front @= {0,1,0} }; */ // enum struct S.T jane { JX = { 3 } }; // enum S.T jane2 { JX = { 3 } }; // enum Fred { A, B, C }; // enum enum Fred Mary { D, E, F }; // enumeration inheritance, auto number starting at C + 1 // enum enum Fred Mary { D, E, F }; // enumeration inheritance, auto number starting at C + 1 // Fred f = A; // //Mary m1 = A, m2 = D; // #if 0 // #endif // 0 // enum Fred Jane { D = C, E = B, F = A } // alternate reverse names // Jane j1 = A, J2 = F; // both value 0 // struct Color { // C++ scoped enumerations // enum { red, green = 20, blue }; // }; // //Color color = Color.red; // Local Variables: // // tab-width: 4 // // compile-command: "~/software/mary/cfa-cc/driver/cfa -XCFA -P -XCFA parse -XCFA -n test_enum.cfa" // // End: //