source: src/examples/iostream.h@ 2bae7307

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string with_gc
Last change on this file since 2bae7307 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#ifndef IOSTREAM_H
2#define IOSTREAM_H
3
4typedef unsigned long streamsize_type;
5
6context ostream( dtype ostype ) {
7 ostype *write( ostype *, const char *, streamsize_type );
8 int fail( ostype * );
9};
10
11context writeable( type T ) {
12 forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, T );
13};
14
15// implement writable for some intrinsic types
16
17forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, char );
18forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, int );
19forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, double );
20forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, const char * );
21
22
23context istream( dtype istype ) {
24 istype *read( istype *, char *, streamsize_type );
25 istype *unread( istype *, char );
26 int fail( istype * );
27 int eof( istype * );
28};
29
30context readable( type T ) {
31 forall( dtype istype | istream( istype ) ) istype * ?<<?( istype *, T );
32};
33
34forall( dtype istype | istream( istype ) )
35istype * ?>>?( istype *, char * );
36
37forall( dtype istype | istream( istype ) )
38istype * ?>>?( istype *, int * );
39
40#endif // IOSTREAM_H
Note: See TracBrowser for help on using the repository browser.