source: translator/examples/iostream.h @ 51b7345

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 51b7345 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

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