source: src/examples/iostream.h @ 784deab

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 784deab was 784deab, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

fix recursive include bug in shadow includes, major clean of examples, add several long long routines to prelude

  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[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// iostream.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Wed May 27 17:56:53 2015
11// Last Modified By : Peter A. Buhr
[784deab]12// Last Modified On : Mon Jan  4 09:02:11 2016
13// Update Count     : 20
[86bd7c1f]14//
15
[51b7345]16#ifndef IOSTREAM_H
17#define IOSTREAM_H
18
[e56cfdb0]19#include "iterator.h"
20
[51b7345]21typedef unsigned long streamsize_type;
22
[134b86a]23context ostream( dtype ostype ) {
[86bd7c1f]24        ostype *write( ostype *, const char *, streamsize_type );
25        int fail( ostype * );
[51b7345]26};
27
[134b86a]28context writeable( type T ) {
[cf16f94]29        forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, T );
[51b7345]30};
31
32// implement writable for some intrinsic types
33
[cf16f94]34forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, char );
35forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, int );
[784deab]36forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, unsigned int );
37forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, long int );
38forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, long long int );
39forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, unsigned long int );
40forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, unsigned long long int );
[cf16f94]41forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, double );
[784deab]42forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, long double );
[cf16f94]43forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const char * );
44forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const void * );
45
46forall( dtype ostype, dtype retostype | ostream( ostype ) | ostream( retostype ) ) retostype * ?|?( ostype *os, retostype * (* manip)(ostype*) );
47forall( dtype ostype | ostream( ostype ) ) ostype * endl( ostype * );
[e56cfdb0]48
49// writes the range [begin, end) to the given stream
50forall( type elt_type | writeable( elt_type ),
51                type iterator_type | iterator( iterator_type, elt_type ),
52                dtype os_type | ostream( os_type ) )
53void write( iterator_type begin, iterator_type end, os_type *os );
54
55forall( type elt_type | writeable( elt_type ),
56                type iterator_type | iterator( iterator_type, elt_type ),
57                dtype os_type | ostream( os_type ) )
58void write_reverse( iterator_type begin, iterator_type end, os_type *os );
[51b7345]59
[cf16f94]60//******************************************************************************
[51b7345]61
[134b86a]62context istream( dtype istype ) {
[86bd7c1f]63        istype *read( istype *, char *, streamsize_type );
64        istype *unread( istype *, char );
65        int fail( istype * );
66        int eof( istype * );
[51b7345]67};
68
[134b86a]69context readable( type T ) {
[cf16f94]70        forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, T );
[51b7345]71};
72
73forall( dtype istype | istream( istype ) )
[cf16f94]74istype * ?|?( istype *, char * );
[51b7345]75
76forall( dtype istype | istream( istype ) )
[cf16f94]77istype * ?|?( istype *, int * );
[51b7345]78
[134b86a]79#endif // IOSTREAM_H
[86bd7c1f]80
81// Local Variables: //
82// tab-width: 4 //
83// compile-command: "cfa iostream.c" //
84// End: //
Note: See TracBrowser for help on using the repository browser.