Changeset b431515 for libcfa/src


Ignore:
Timestamp:
Apr 24, 2021, 11:29:51 AM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
fec63b2
Parents:
85d8153
Message:

formatting, rename public enum sepSize to ofstream_sepSize, change return type to bool for function fail

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.cfa

    r85d8153 rb431515  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 20 19:04:46 2021
    13 // Update Count     : 425
     12// Last Modified On : Sat Apr 24 09:05:16 2021
     13// Update Count     : 426
    1414//
    1515
     
    1919#include <stdlib.h>                                                                             // exit
    2020#include <stdarg.h>                                                                             // varargs
    21 #include <string.h>                                                                             // strlen
    22 #include <float.h>                                                                              // DBL_DIG, LDBL_DIG
    23 #include <complex.h>                                                                    // creal, cimag
     21#include <string.h>                                                                             // strncpy, strerror
    2422#include <assert.h>
    2523#include <errno.h>                                                                              // errno
     
    9391void sepSet( ofstream & os, const char s[] ) {
    9492        assert( s );
    95         strncpy( os.separator$, s, sepSize - 1 );
    96         os.separator$[sepSize - 1] = '\0';
     93        strncpy( os.separator$, s, ofstream_sepSize - 1 );
     94        os.separator$[ofstream_sepSize - 1] = '\0';
    9795} // sepSet
    9896
     
    10098void sepSetTuple( ofstream & os, const char s[] ) {
    10199        assert( s );
    102         strncpy( os.tupleSeparator$, s, sepSize - 1 );
    103         os.tupleSeparator$[sepSize - 1] = '\0';
     100        strncpy( os.tupleSeparator$, s, ofstream_sepSize - 1 );
     101        os.tupleSeparator$[ofstream_sepSize - 1] = '\0';
    104102} // sepSet
    105103
     
    112110} // ends
    113111
    114 int fail( ofstream & os ) {
     112bool fail( ofstream & os ) {
    115113        return os.file$ == 0 || ferror( (FILE *)(os.file$) );
    116114} // fail
     
    228226bool getANL( ifstream & os ) { return os.nlOnOff$; }
    229227
    230 int fail( ifstream & is ) {
     228bool fail( ifstream & is ) {
    231229        return is.file$ == 0p || ferror( (FILE *)(is.file$) );
    232230} // fail
  • libcfa/src/fstream.hfa

    r85d8153 rb431515  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 20 19:04:12 2021
    13 // Update Count     : 218
     12// Last Modified On : Sat Apr 24 09:04:03 2021
     13// Update Count     : 219
    1414//
    1515
     
    2424
    2525
    26 enum { sepSize = 16 };
     26enum { ofstream_sepSize = 16 };
    2727struct ofstream {
    2828        void * file$;
     
    3333        bool sawNL$;
    3434        const char * sepCur$;
    35         char separator$[sepSize];
    36         char tupleSeparator$[sepSize];
     35        char separator$[ofstream_sepSize];
     36        char tupleSeparator$[ofstream_sepSize];
    3737        multiple_acquisition_lock lock$;
    3838        bool acquired$;
    3939}; // ofstream
     40
     41// Satisfies ostream
    4042
    4143// private
     
    6466void sepSetTuple( ofstream &, const char [] );
    6567
    66 void ends( ofstream & os );
    67 int fail( ofstream & );
     68void ends( ofstream & );
     69int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
     70
     71bool fail( ofstream & );
    6872int flush( ofstream & );
    6973void open( ofstream &, const char name[], const char mode[] );
     
    7175void close( ofstream & );
    7276ofstream & write( ofstream &, const char data[], size_t size );
    73 int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
    74 void acquire( ofstream & os );
    75 void release( ofstream & os );
     77
     78void acquire( ofstream & );
     79void release( ofstream & );
    7680
    7781struct osacquire {
    7882        ofstream & os;
    7983};
    80 void ?{}( osacquire & acq, ofstream & os );
     84void ?{}( osacquire & acq, ofstream & );
    8185void ^?{}( osacquire & acq );
    8286
    83 void ?{}( ofstream & os );
    84 void ?{}( ofstream & os, const char name[], const char mode[] );
    85 void ?{}( ofstream & os, const char name[] );
    86 void ^?{}( ofstream & os );
     87void ?{}( ofstream & );
     88void ?{}( ofstream &, const char name[], const char mode[] );
     89void ?{}( ofstream &, const char name[] );
     90void ^?{}( ofstream & );
    8791
    8892extern ofstream & sout, & stdout, & serr, & stderr;             // aliases
     
    100104}; // ifstream
    101105
     106// Satisfies istream
     107
    102108// public
    103109void nlOn( ifstream & );
     
    105111bool getANL( ifstream & );
    106112void ends( ifstream & );
    107 int fail( ifstream & is );
     113bool fail( ifstream & is );
    108114int eof( ifstream & is );
    109115void open( ifstream & is, const char name[], const char mode[] );
     
    142148);
    143149
    144 void ?{}( Open_Failure & this, ofstream & ostream );
    145 void ?{}( Open_Failure & this, ifstream & istream );
     150void ?{}( Open_Failure & this, ofstream & );
     151void ?{}( Open_Failure & this, ifstream & );
    146152
    147153// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.