Changeset 839ccbb for src/examples/iostream.c
- Timestamp:
- Nov 20, 2015, 4:19:13 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 5189888
- Parents:
- 05587c2 (diff), ed94eac (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Peter A. Buhr <pabuhr@…> (11/20/15 12:51:58)
- git-committer:
- Peter A. Buhr <pabuhr@…> (11/20/15 16:19:13)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/iostream.c
r05587c2 r839ccbb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 19 17:54:38201513 // Update Count : 412 // Last Modified On : Fri Nov 20 13:19:19 2015 13 // Update Count : 9 14 14 // 15 15 … … 17 17 extern "C" { 18 18 #include <stdio.h> 19 //#include <string.h> 20 //#include <ctype.h> 21 typedef long unsigned int size_t; 22 size_t strlen(const char *s); 19 #include <string.h> // strlen 23 20 } 24 21 … … 26 23 ostype * ?<<?( ostype *os, char c ) { 27 24 return write( os, &c, 1 ); 28 } 25 } // ?<<? 29 26 30 27 forall( dtype ostype | ostream( ostype ) ) … … 33 30 sprintf( buffer, "%d", i ); 34 31 return write( os, buffer, strlen( buffer ) ); 35 } 32 } // ?<<? 36 33 37 34 forall( dtype ostype | ostream( ostype ) ) … … 40 37 sprintf( buffer, "%g", d ); 41 38 return write( os, buffer, strlen( buffer ) ); 42 } 39 } // ?<<? 43 40 44 41 forall( dtype ostype | ostream( ostype ) ) 45 42 ostype * ?<<?( ostype *os, const char *cp ) { 46 43 return write( os, cp, strlen( cp ) ); 47 } 44 } // ?<<? 48 45 49 46 forall( dtype ostype | ostream( ostype ) ) … … 52 49 sprintf( buffer, "%p", p ); 53 50 return write( os, buffer, strlen( buffer ) ); 54 } 51 } // ?<<? 55 52 56 53 forall( type elt_type | writeable( elt_type ), … … 62 59 } 63 60 for_each( begin, end, print ); 64 } 61 } // ?<<? 65 62 66 63 forall( type elt_type | writeable( elt_type ), … … 72 69 } 73 70 for_each_reverse( begin, end, print ); 74 } 71 } // ?<<? 75 72 76 73 … … 78 75 istype * ?>>?( istype *is, char *cp ) { 79 76 return read( is, cp, 1 ); 80 } 77 } // ?>>? 81 78 82 79 forall( dtype istype | istream( istype ) ) … … 100 97 unread( is, cur ); 101 98 return is; 102 } 99 } // ?>>? 103 100 104 101 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.