// // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // iostream.c -- // // Author : Richard C. Bilson // Created On : Wed May 27 17:56:53 2015 // Last Modified By : Peter A. Buhr // Last Modified On : Fri Nov 20 13:19:19 2015 // Update Count : 9 // #include "iostream.h" extern "C" { #include #include // strlen } forall( dtype ostype | ostream( ostype ) ) ostype * ?<>?( istype *is, char *cp ) { return read( is, cp, 1 ); } // ?>>? forall( dtype istype | istream( istype ) ) istype * ?>>?( istype *is, int *ip ) { char cur; // skip some whitespace do { is >> &cur; if ( fail( is ) || eof( is ) ) return is; } while ( !( cur >= '0' && cur <= '9' ) ); // accumulate digits *ip = 0; while ( cur >= '0' && cur <= '9' ) { *ip = *ip * 10 + ( cur - '0' ); is >> &cur; if ( fail( is ) || eof( is ) ) return is; } unread( is, cur ); return is; } // ?>>? // Local Variables: // // tab-width: 4 // // compile-command: "cfa iostream.c" // // End: //