#include "enum.hfa" #include "fstream.hfa" #pragma GCC visibility push(default) forall( istype & | istream( istype ), E, V | CfaEnum( E, V ) ) istype & ?|?( istype & is, E & e ) { if ( eof( is ) ) throwResume ExceptionInst( missing_data ); char val[256]; int args = fmt( is, "%255s", val ); if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); // for ( s; E ) { // if ( val == label( s ) ) { e = s; break; } // } else { // fprintf( stderr, "invalid enumeration constant\n" ); // abort(); // cannot use abort stream // } // for return is; } forall( ostype & | ostream( ostype ), E, V | CfaEnum( E, V ) ) { ostype & ?|?( ostype & os, E e ) { return os | label( e ); } OSTYPE_VOID_IMPL( E ) } forall( ostype & | ostream( ostype ), E | CfaEnum( E, quasi_void ) ) { ostype & ?|?( ostype & os, E e ) { return os | label( e ); } OSTYPE_VOID_IMPL( E ) }