Last change
on this file since 793eb2f was 062467b, checked in by Peter A. Buhr <pabuhr@…>, 15 months ago |
inline enum relational and increment operators, comment out loop causing compiler segment fault
|
-
Property mode
set to
100644
|
File size:
904 bytes
|
Rev | Line | |
---|
[c333ed2] | 1 | #include "enum.hfa"
|
---|
[85855b0] | 2 | #include "fstream.hfa"
|
---|
[c333ed2] | 3 |
|
---|
[03ac869] | 4 | #pragma GCC visibility push(default)
|
---|
| 5 |
|
---|
[64eeb06] | 6 | forall( istype & | istream( istype ), E, V | CfaEnum( E, V ) )
|
---|
| 7 | istype & ?|?( istype & is, E & e ) {
|
---|
| 8 | if ( eof( is ) ) throwResume ExceptionInst( missing_data );
|
---|
| 9 | char val[256];
|
---|
| 10 | int args = fmt( is, "%255s", val );
|
---|
| 11 | if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
|
---|
[062467b] | 12 | // for ( s; E ) {
|
---|
| 13 | // if ( val == label( s ) ) { e = s; break; }
|
---|
| 14 | // } else {
|
---|
| 15 | // fprintf( stderr, "invalid enumeration constant\n" );
|
---|
| 16 | // abort(); // cannot use abort stream
|
---|
| 17 | // } // for
|
---|
[64eeb06] | 18 | return is;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | forall( ostype & | ostream( ostype ), E, V | CfaEnum( E, V ) ) {
|
---|
| 22 | ostype & ?|?( ostype & os, E e ) {
|
---|
[d5efcb7] | 23 | return os | label( e );
|
---|
| 24 | }
|
---|
| 25 | OSTYPE_VOID_IMPL( E )
|
---|
[85855b0] | 26 | }
|
---|
[c333ed2] | 27 |
|
---|
[64eeb06] | 28 | forall( ostype & | ostream( ostype ), E | CfaEnum( E, quasi_void ) ) {
|
---|
| 29 | ostype & ?|?( ostype & os, E e ) {
|
---|
| 30 | return os | label( e );
|
---|
| 31 | }
|
---|
| 32 | OSTYPE_VOID_IMPL( E )
|
---|
[259012e] | 33 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.