Ignore:
Timestamp:
Mar 2, 2016, 4:59:19 PM (10 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
bdad1679
Parents:
ac1ed49
Message:

compile CFA with C++11, further update refrat with lstlisting macros, support varags, enumeration initialization, add implicit separators to output streams, update example programs that print

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/iostream

    rac1ed49 r90c3b1c  
    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 16:44:32 2016
     13// Update Count     : 81
    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 
    2321context 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};
     36
    2837context writeable( type T ) {
    2938        forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, T );
     
    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
     
    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
     
    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.