Ignore:
Timestamp:
Mar 3, 2016, 1:28:56 PM (10 years ago)
Author:
Aaron Moss <a3moss@…>
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:
3627356
Parents:
9d7b3ea (diff), 4040425 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/iostream

    r9d7b3ea r36ebd03  
    77// iostream --
    88//
    9 // Author           : Richard C. Bilson
     9// Author           : Peter A. Buhr
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 17 14:04:24 2016
    13 // Update Count     : 32
     12// Last Modified On : Wed Mar  2 18:05:27 2016
     13// Update Count     : 85
    1414//
    1515
    16 #ifndef IOSTREAM_H
    17 #define IOSTREAM_H
     16#ifndef __IOSTREAM_H__
     17#define __IOSTREAM_H__
    1818
    1919#include "iterator"
    2020
    21 typedef unsigned long streamsize_type;
    22 
    23 context ostream( dtype ostype ) {
     21trait ostream( dtype ostype ) {
     22        _Bool sepPrt( ostype * );
     23        void sepOn( ostype * );
     24        void sepOff( ostype * );
     25        void sepSet( ostype *, const char * );
     26        const char * sepGet( ostype * );
     27        void sepDisable( ostype * );
     28        void sepEnable( ostype * );
    2429        int fail( ostype * );
    2530        int flush( ostype * );
    26         ostype * write( ostype *, const char *, streamsize_type );
     31        void open( ostype * os, const char * name, const char * mode );
     32        void close( ostype * os );
     33        ostype * write( ostype *, const char *, unsigned long int );
     34        int prtfmt( ostype *, const char fmt[], ... );
    2735};
    28 context writeable( type T ) {
     36
     37trait writeable( otype T ) {
    2938        forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, T );
    3039};
     
    3342
    3443forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, char );
     44
     45forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, short int );
     46forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, unsigned short int );
    3547forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, int );
    3648forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, unsigned int );
     
    3951forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, unsigned long int );
    4052forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, unsigned long long int );
     53
    4154forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, float ); // FIX ME: should not be required
    4255forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, double );
    4356forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, long double );
     57
    4458forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, float _Complex );
    4559forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, double _Complex );
    4660forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, long double _Complex );
     61
    4762forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const char * );
    4863forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const void * );
    4964
    50 forall( dtype ostype, dtype retostype | ostream( ostype ) | ostream( retostype ) ) retostype * ?|?( ostype *os, retostype * (* manip)(ostype*) );
     65forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, ostype * (*)( ostype * ) );
    5166forall( dtype ostype | ostream( ostype ) ) ostype * endl( ostype * );
     67forall( dtype ostype | ostream( ostype ) ) ostype * sepOn( ostype * );
     68forall( dtype ostype | ostream( ostype ) ) ostype * sepOff( ostype * );
    5269
    5370// writes the range [begin, end) to the given stream
    54 forall( type elt_type | writeable( elt_type ), type iterator_type | iterator( iterator_type, elt_type ), dtype os_type | ostream( os_type ) )
     71forall( otype elt_type | writeable( elt_type ), otype iterator_type | iterator( iterator_type, elt_type ), dtype os_type | ostream( os_type ) )
    5572void write( iterator_type begin, iterator_type end, os_type *os );
    5673
    57 forall( type elt_type | writeable( elt_type ), type iterator_type | iterator( iterator_type, elt_type ), dtype os_type | ostream( os_type ) )
     74forall( otype elt_type | writeable( elt_type ), otype iterator_type | iterator( iterator_type, elt_type ), dtype os_type | ostream( os_type ) )
    5875void write_reverse( iterator_type begin, iterator_type end, os_type *os );
    5976
    6077//---------------------------------------
    6178
    62 context istream( dtype istype ) {
     79trait istream( dtype istype ) {
    6380        int fail( istype * );
    6481        int eof( istype * );
    65         istype * get( istype *, int * );
    66         istype * read( istype *, char *, streamsize_type );
     82        void open( istype * is, const char * name, const char * mode );
     83        void close( istype * is );
     84        istype * read( istype *, char *, unsigned long int );
    6785        istype * ungetc( istype *, char );
     86        int scanfmt( istype *, const char fmt[], ... );
    6887};
    6988
    70 context readable( type T ) {
     89trait readable( otype T ) {
    7190        forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, T );
    7291};
    7392
    74 forall( dtype istype | istream( istype ) )
    75 istype * ?|?( istype *, char * );
     93forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, char * );
    7694
    77 forall( dtype istype | istream( istype ) )
    78 istype * ?|?( istype *, int * );
     95forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, short int * );
     96forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, unsigned short int * );
     97forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, int * );
     98forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, unsigned int * );
     99forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, long int * );
     100forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, long long int * );
     101forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, unsigned long int * );
     102forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, unsigned long long int * );
    79103
    80 #endif // IOSTREAM_H
     104forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, float * );
     105forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, double * );
     106forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, long double * );
     107
     108forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, float _Complex * );
     109forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, double _Complex * );
     110forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, long double _Complex * );
     111
     112struct _Istream_str1 { char * s; };
     113_Istream_str1 str( char * );
     114forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_str1 );
     115
     116struct _Istream_str2 { char * s; int size; };
     117_Istream_str2 str( char *, int size );
     118forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_str2 );
     119
     120#endif // __IOSTREAM_H__
    81121
    82122// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.