|
Last change
on this file since 062467b was 062467b, checked in by Peter A. Buhr <pabuhr@…>, 16 months ago |
|
inline enum relational and increment operators, comment out loop causing compiler segment fault
|
-
Property mode
set to
100644
|
|
File size:
904 bytes
|
| Line | |
|---|
| 1 | #include "enum.hfa"
|
|---|
| 2 | #include "fstream.hfa"
|
|---|
| 3 |
|
|---|
| 4 | #pragma GCC visibility push(default)
|
|---|
| 5 |
|
|---|
| 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 );
|
|---|
| 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
|
|---|
| 18 | return is;
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | forall( ostype & | ostream( ostype ), E, V | CfaEnum( E, V ) ) {
|
|---|
| 22 | ostype & ?|?( ostype & os, E e ) {
|
|---|
| 23 | return os | label( e );
|
|---|
| 24 | }
|
|---|
| 25 | OSTYPE_VOID_IMPL( E )
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 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 )
|
|---|
| 33 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.