[86bd7c1f] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
| 7 | // it_out.c --
|
---|
| 8 | //
|
---|
| 9 | // Author : Richard C. Bilson
|
---|
| 10 | // Created On : Wed May 27 17:56:53 2015
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
[b63e376] | 12 | // Last Modified On : Tue Mar 8 22:14:39 2016
|
---|
| 13 | // Update Count : 8
|
---|
[86bd7c1f] | 14 | //
|
---|
[a0d9f94] | 15 |
|
---|
| 16 | typedef unsigned long streamsize_type;
|
---|
| 17 |
|
---|
[fd54fef] | 18 | trait ostream( os_type & ) {
|
---|
[86bd7c1f] | 19 | os_type *write( os_type *, const char *, streamsize_type );
|
---|
| 20 | int fail( os_type * );
|
---|
[a0d9f94] | 21 | };
|
---|
| 22 |
|
---|
[fd54fef] | 23 | trait writeable( T ) {
|
---|
| 24 | forall( os_type & | ostream( os_type ) ) os_type * ?<<?( os_type *, T );
|
---|
[a0d9f94] | 25 | };
|
---|
| 26 |
|
---|
[fd54fef] | 27 | forall( os_type & | ostream( os_type ) ) os_type * ?<<?( os_type *, char );
|
---|
| 28 | forall( os_type & | ostream( os_type ) ) os_type * ?<<?( os_type *, int );
|
---|
| 29 | forall( os_type & | ostream( os_type ) ) os_type * ?<<?( os_type *, const char * );
|
---|
[a0d9f94] | 30 |
|
---|
[fd54fef] | 31 | trait istream( is_type & ) {
|
---|
[86bd7c1f] | 32 | is_type *read( is_type *, char *, streamsize_type );
|
---|
| 33 | is_type *unread( is_type *, char );
|
---|
| 34 | int fail( is_type * );
|
---|
| 35 | int eof( is_type * );
|
---|
[a0d9f94] | 36 | };
|
---|
| 37 |
|
---|
[fd54fef] | 38 | trait readable( T ) {
|
---|
| 39 | forall( is_type & | istream( is_type ) ) is_type * ?<<?( is_type *, T );
|
---|
[a0d9f94] | 40 | };
|
---|
| 41 |
|
---|
[fd54fef] | 42 | forall( is_type & | istream( is_type ) ) is_type * ?>>?( is_type *, char* );
|
---|
| 43 | forall( is_type & | istream( is_type ) ) is_type * ?>>?( is_type *, int* );
|
---|
[a0d9f94] | 44 |
|
---|
[fd54fef] | 45 | trait iterator( iterator_type, elt_type ) {
|
---|
[86bd7c1f] | 46 | iterator_type ?++( iterator_type* );
|
---|
| 47 | iterator_type ++?( iterator_type* );
|
---|
| 48 | int ?==?( iterator_type, iterator_type );
|
---|
| 49 | int ?!=?( iterator_type, iterator_type );
|
---|
[a0d9f94] | 50 |
|
---|
[86bd7c1f] | 51 | lvalue elt_type *?( iterator_type );
|
---|
[a0d9f94] | 52 | };
|
---|
| 53 |
|
---|
[fd54fef] | 54 | forall( elt_type | writeable( elt_type ),
|
---|
| 55 | iterator_type | iterator( iterator_type, elt_type ),
|
---|
| 56 | os_type & | ostream( os_type ) )
|
---|
[a0d9f94] | 57 | void write_all( iterator_type begin, iterator_type end, os_type *os );
|
---|
| 58 |
|
---|
[fd54fef] | 59 | forall( elt_type | writeable( elt_type ),
|
---|
| 60 | iterator_type | iterator( iterator_type, elt_type ),
|
---|
| 61 | os_type & | ostream( os_type ) )
|
---|
[86bd7c1f] | 62 | void write_all( elt_type begin, iterator_type end, os_type *os ) {
|
---|
| 63 | os << begin;
|
---|
[a0d9f94] | 64 | }
|
---|
[86bd7c1f] | 65 |
|
---|
| 66 | // Local Variables: //
|
---|
| 67 | // tab-width: 4 //
|
---|
| 68 | // compile-command: "cfa it_out.c" //
|
---|
| 69 | // End: //
|
---|