Ignore:
Timestamp:
Jun 1, 2015, 12:55:33 PM (10 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
6db50d5
Parents:
46cbfe1 (diff), db82596 (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.
Message:

Merge branch 'master' into labels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/it_out.c

    r46cbfe1 r76934fb  
    1 # 1 "iterator.c"
    2 # 1 "<built-in>"
    3 # 1 "<command line>"
    4 # 1 "iterator.c"
    5 # 1 "iterator.h" 1
    6 
    7 
    8 
    9 # 1 "iostream.h" 1
    10 
    11 
     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
     12// Last Modified On : Wed May 27 18:41:23 2015
     13// Update Count     : 4
     14//
    1215
    1316typedef unsigned long streamsize_type;
    1417
    15 
    16 
    17 context ostream( dtype os_type )
    18 {
    19 
    20     os_type *write( os_type *, const char *, streamsize_type );
    21 
    22 
    23     int fail( os_type * );
     18context ostream( dtype os_type ) {
     19        os_type *write( os_type *, const char *, streamsize_type );
     20        int fail( os_type * );
    2421};
    2522
    26 
    27 
    28 
    29 context writeable( type T )
    30 {
    31     forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, T );
     23context writeable( type T ) {
     24        forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, T );
    3225};
    33 
    34 
    3526
    3627forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, char );
     
    3829forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, const char * );
    3930
    40 
    41 
    42 
    43 context istream( dtype is_type )
    44 {
    45 
    46     is_type *read( is_type *, char *, streamsize_type );
    47 
    48 
    49     is_type *unread( is_type *, char );
    50 
    51 
    52     int fail( is_type * );
    53 
    54 
    55     int eof( is_type * );
     31context istream( dtype is_type ) {
     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 * );
    5636};
    5737
    58 
    59 
    60 
    61 context readable( type T )
    62 {
    63     forall( dtype is_type | istream( is_type ) ) is_type * ?<<?( is_type *, T );
     38context readable( type T ) {
     39        forall( dtype is_type | istream( is_type ) ) is_type * ?<<?( is_type *, T );
    6440};
    65 
    66 
    6741
    6842forall( dtype is_type | istream( is_type ) ) is_type * ?>>?( is_type *, char* );
    6943forall( dtype is_type | istream( is_type ) ) is_type * ?>>?( is_type *, int* );
    70 # 5 "iterator.h" 2
    7144
     45context iterator( type iterator_type, type elt_type ) {
     46        iterator_type ?++( iterator_type* );
     47        iterator_type ++?( iterator_type* );
     48        int ?==?( iterator_type, iterator_type );
     49        int ?!=?( iterator_type, iterator_type );
    7250
    73 context iterator( type iterator_type, type elt_type )
    74 {
    75 
    76     iterator_type ?++( iterator_type* );
    77     iterator_type ++?( iterator_type* );
    78 
    79 
    80     int ?==?( iterator_type, iterator_type );
    81     int ?!=?( iterator_type, iterator_type );
    82 
    83 
    84     lvalue elt_type *?( iterator_type );
     51        lvalue elt_type *?( iterator_type );
    8552};
    8653
    87 
     54forall( type elt_type | writeable( elt_type ),
     55                type iterator_type | iterator( iterator_type, elt_type ),
     56                dtype os_type | ostream( os_type ) )
     57void write_all( iterator_type begin, iterator_type end, os_type *os );
    8858
    8959forall( type elt_type | writeable( elt_type ),
    90         type iterator_type | iterator( iterator_type, elt_type ),
    91         dtype os_type | ostream( os_type ) )
    92 void write_all( iterator_type begin, iterator_type end, os_type *os );
    93 # 2 "iterator.c" 2
     60                type iterator_type | iterator( iterator_type, elt_type ),
     61                dtype os_type | ostream( os_type ) )
     62void write_all( elt_type begin, iterator_type end, os_type *os ) {
     63        os << begin;
     64}
    9465
    95 forall( type elt_type | writeable( elt_type ),
    96         type iterator_type | iterator( iterator_type, elt_type ),
    97         dtype os_type | ostream( os_type ) )
    98 void
    99 write_all( elt_type begin, iterator_type end, os_type *os )
    100 {
    101     os << begin;
    102 }
     66// Local Variables: //
     67// tab-width: 4 //
     68// compile-command: "cfa it_out.c" //
     69// End: //
Note: See TracChangeset for help on using the changeset viewer.