Changes in / [a53e10a:87d13cd]


Ignore:
Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/fstream

    ra53e10a r87d13cd  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 14:48:08 2017
    13 // Update Count     : 91
     12// Last Modified On : Tue Mar 21 15:57:24 2017
     13// Update Count     : 102
    1414//
    1515
     
    2121enum { separateSize = 16 };
    2222struct ofstream {
    23         void *file;
     23        void * file;
    2424        _Bool sepDefault;
    2525        _Bool sepOnOff;
     26        const char * sepCur;
    2627        char separator[separateSize];
     28        char tupleSeparator[separateSize];
    2729}; // ofstream
    2830
     
    3234void sepReset( ofstream * );
    3335void sepReset( ofstream *, _Bool );
     36const char * sepGetCur( ofstream * );
     37void sepSetCur( ofstream *, const char * );
    3438const char * sepGet( ofstream * );
    3539void sepSet( ofstream *, const char * );
     40const char * sepGetTuple( ofstream * );
     41void sepSetTuple( ofstream *, const char * );
    3642_Bool sepDisable( ofstream * );
    3743_Bool sepEnable( ofstream * );
     
    4248void close( ofstream * );
    4349ofstream * write( ofstream *, const char * data, unsigned long int size );
    44 int prtfmt( ofstream *, const char fmt[], ... );
     50int fmt( ofstream *, const char fmt[], ... );
     51
     52void ?{}( ofstream * );
    4553
    4654extern ofstream * sout, * serr;
     
    4856// implement context istream
    4957struct ifstream {
    50         void *file;
     58        void * file;
    5159}; // ifstream
    5260
     
    5765ifstream * read( ifstream * is, char * data, unsigned long int size );
    5866ifstream * ungetc( ifstream * is, char c );
    59 int scanfmt( ifstream *, const char fmt[], ... );
     67int fmt( ifstream *, const char fmt[], ... );
    6068
    61 extern ifstream *sin;
     69extern ifstream * sin;
    6270
    6371#endif // __FSTREAM_H__
  • src/libcfa/fstream.c

    ra53e10a r87d13cd  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 14:48:09 2017
    13 // Update Count     : 192
     12// Last Modified On : Tue Mar 21 20:56:10 2017
     13// Update Count     : 215
    1414//
    1515
     
    3333void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; }
    3434void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; }
     35
     36const char * sepGetCur( ofstream * os ) { return os->sepCur; }
     37void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; }
     38
    3539const char * sepGet( ofstream * os ) { return &(os->separator[0]); }
    3640
     
    3842        strncpy( &(os->separator[0]), s, separateSize - 1 );
    3943        os->separator[separateSize - 1] = '\0';
     44} // sepSet
     45
     46const char * sepGetTuple( ofstream * os ) { return &(os->tupleSeparator[0]); }
     47
     48void sepSetTuple( ofstream * os, const char * s ) {
     49        strncpy( &(os->tupleSeparator[0]), s, separateSize - 1 );
     50        os->tupleSeparator[separateSize - 1] = '\0';
    4051} // sepSet
    4152
     
    95106} // write
    96107
    97 int prtfmt( ofstream * os, const char fmt[], ... ) {
     108int fmt( ofstream * os, const char format[], ... ) {
    98109        va_list args;
    99         va_start( args, fmt );
    100         int len = vfprintf( (FILE *)(os->file), fmt, args );
     110        va_start( args, format );
     111        int len = vfprintf( (FILE *)(os->file), format, args );
    101112        if ( len == EOF ) {
    102113                if ( ferror( (FILE *)(os->file) ) ) {
     
    109120        sepReset( os );                                                                         // reset separator
    110121        return len;
    111 } // prtfmt
    112 
    113 
    114 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, { ' ', '\0' } };
     122} // fmt
     123
     124void ?{}( ofstream * this, void * file, _Bool sepDefault, _Bool sepOnOff, const char * separator, const char * tupleSeparator ) {
     125        this->file = file;
     126        this->sepDefault = sepDefault;
     127        this->sepOnOff = sepOnOff;
     128        sepSet( this, separator );
     129        sepSetCur( this, sepGet( this ) );
     130        sepSetTuple( this, tupleSeparator );
     131}
     132
     133static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " };
    115134ofstream *sout = &soutFile;
    116 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, { ' ', '\0' } };
     135static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, " ", ", " };
    117136ofstream *serr = &serrFile;
    118137
     
    173192} // ungetc
    174193
    175 int scanfmt( ifstream * is, const char fmt[], ... ) {
     194int fmt( ifstream * is, const char format[], ... ) {
    176195        va_list args;
    177196
    178         va_start( args, fmt );
    179         int len = vfscanf( (FILE *)(is->file), fmt, args );
     197        va_start( args, format );
     198        int len = vfscanf( (FILE *)(is->file), format, args );
    180199        if ( len == EOF ) {
    181200                if ( ferror( (FILE *)(is->file) ) ) {
     
    186205        va_end( args );
    187206        return len;
    188 } // prtfmt
     207} // fmt
    189208
    190209
  • src/libcfa/iostream

    ra53e10a r87d13cd  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 20:51:35 2017
    13 // Update Count     : 98
     12// Last Modified On : Tue Mar 21 15:57:29 2017
     13// Update Count     : 104
    1414//
    1515
     
    2525        void sepReset( ostype * );                                                      // set separator state to default state
    2626        void sepReset( ostype *, _Bool );                                       // set separator and default state
     27        const char * sepGetCur( ostype * );                                     // get current separator string
     28        void sepSetCur( ostype *, const char * );                       // set current separator string
     29        const char * sepGet( ostype * );                                        // get separator string
    2730        void sepSet( ostype *, const char * );                          // set separator to string (15 character maximum)
    28         const char * sepGet( ostype * );                                        // get separator string
     31        const char * sepGetTuple( ostype * );                           // get tuple separator string
     32        void sepSetTuple( ostype *, const char * );                     // set tuple separator to string (15 character maximum)
    2933        _Bool sepDisable( ostype * );                                           // set default state to off, and return previous state
    3034        _Bool sepEnable( ostype * );                                            // set default state to on, and return previous state
     
    3539        void close( ostype * os );
    3640        ostype * write( ostype *, const char *, unsigned long int );
    37         int prtfmt( ostype *, const char fmt[], ... );
     41        int fmt( ostype *, const char fmt[], ... );
    3842};
    3943
     
    9599        istype * read( istype *, char *, unsigned long int );
    96100        istype * ungetc( istype *, char );
    97         int scanfmt( istype *, const char fmt[], ... );
     101        int fmt( istype *, const char fmt[], ... );
    98102};
    99103
  • src/libcfa/iostream.c

    ra53e10a r87d13cd  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 20:52:02 2017
    13 // Update Count     : 313
     12// Last Modified On : Tue Mar 21 22:05:57 2017
     13// Update Count     : 348
    1414//
    1515
     
    2424
    2525forall( dtype ostype | ostream( ostype ) )
    26 ostype * ?|?( ostype *os, char c ) {
    27         prtfmt( os, "%c", c );
    28         sepOff( os );
    29         return os;
    30 } // ?|?
    31 
    32 forall( dtype ostype | ostream( ostype ) )
    33 ostype * ?|?( ostype *os, signed char c ) {
    34         prtfmt( os, "%hhd", c );
    35         sepOff( os );
    36         return os;
    37 } // ?|?
    38 
    39 forall( dtype ostype | ostream( ostype ) )
    40 ostype * ?|?( ostype *os, unsigned char c ) {
    41         prtfmt( os, "%hhu", c );
    42         sepOff( os );
    43         return os;
    44 } // ?|?
    45 
    46 forall( dtype ostype | ostream( ostype ) )
    47 ostype * ?|?( ostype *os, short int si ) {
    48         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    49         prtfmt( os, "%hd", si );
    50         return os;
    51 } // ?|?
    52 
    53 forall( dtype ostype | ostream( ostype ) )
    54 ostype * ?|?( ostype *os, unsigned short int usi ) {
    55         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    56         prtfmt( os, "%hu", usi );
    57         return os;
    58 } // ?|?
    59 
    60 forall( dtype ostype | ostream( ostype ) )
    61 ostype * ?|?( ostype *os, int i ) {
    62         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    63         prtfmt( os, "%d", i );
    64         return os;
    65 } // ?|?
    66 
    67 forall( dtype ostype | ostream( ostype ) )
    68 ostype * ?|?( ostype *os, unsigned int ui ) {
    69         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    70         prtfmt( os, "%u", ui );
    71         return os;
    72 } // ?|?
    73 
    74 forall( dtype ostype | ostream( ostype ) )
    75 ostype * ?|?( ostype *os, long int li ) {
    76         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    77         prtfmt( os, "%ld", li );
    78         return os;
    79 } // ?|?
    80 
    81 forall( dtype ostype | ostream( ostype ) )
    82 ostype * ?|?( ostype *os, unsigned long int uli ) {
    83         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    84         prtfmt( os, "%lu", uli );
    85         return os;
    86 } // ?|?
    87 
    88 forall( dtype ostype | ostream( ostype ) )
    89 ostype * ?|?( ostype *os, long long int lli ) {
    90         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    91         prtfmt( os, "%lld", lli );
    92         return os;
    93 } // ?|?
    94 
    95 forall( dtype ostype | ostream( ostype ) )
    96 ostype * ?|?( ostype *os, unsigned long long int ulli ) {
    97         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    98         prtfmt( os, "%llu", ulli );
    99         return os;
    100 } // ?|?
    101 
    102 forall( dtype ostype | ostream( ostype ) )
    103 ostype * ?|?( ostype *os, float f ) {
    104         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    105         prtfmt( os, "%g", f );
    106         return os;
    107 } // ?|?
    108 
    109 forall( dtype ostype | ostream( ostype ) )
    110 ostype * ?|?( ostype *os, double d ) {
    111         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    112         prtfmt( os, "%.*lg", DBL_DIG, d );
    113         return os;
    114 } // ?|?
    115 
    116 forall( dtype ostype | ostream( ostype ) )
    117 ostype * ?|?( ostype *os, long double ld ) {
    118         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    119         prtfmt( os, "%.*Lg", LDBL_DIG, ld );
    120         return os;
    121 } // ?|?
    122 
    123 forall( dtype ostype | ostream( ostype ) )
    124 ostype * ?|?( ostype *os, float _Complex fc ) {
     26ostype * ?|?( ostype * os, char c ) {
     27        fmt( os, "%c", c );
     28        sepOff( os );
     29        return os;
     30} // ?|?
     31
     32forall( dtype ostype | ostream( ostype ) )
     33ostype * ?|?( ostype * os, signed char c ) {
     34        fmt( os, "%hhd", c );
     35        sepOff( os );
     36        return os;
     37} // ?|?
     38
     39forall( dtype ostype | ostream( ostype ) )
     40ostype * ?|?( ostype * os, unsigned char c ) {
     41        fmt( os, "%hhu", c );
     42        sepOff( os );
     43        return os;
     44} // ?|?
     45
     46forall( dtype ostype | ostream( ostype ) )
     47ostype * ?|?( ostype * os, short int si ) {
     48        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     49        fmt( os, "%hd", si );
     50        return os;
     51} // ?|?
     52
     53forall( dtype ostype | ostream( ostype ) )
     54ostype * ?|?( ostype * os, unsigned short int usi ) {
     55        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     56        fmt( os, "%hu", usi );
     57        return os;
     58} // ?|?
     59
     60forall( dtype ostype | ostream( ostype ) )
     61ostype * ?|?( ostype * os, int i ) {
     62        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     63        fmt( os, "%d", i );
     64        return os;
     65} // ?|?
     66
     67forall( dtype ostype | ostream( ostype ) )
     68ostype * ?|?( ostype * os, unsigned int ui ) {
     69        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     70        fmt( os, "%u", ui );
     71        return os;
     72} // ?|?
     73
     74forall( dtype ostype | ostream( ostype ) )
     75ostype * ?|?( ostype * os, long int li ) {
     76        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     77        fmt( os, "%ld", li );
     78        return os;
     79} // ?|?
     80
     81forall( dtype ostype | ostream( ostype ) )
     82ostype * ?|?( ostype * os, unsigned long int uli ) {
     83        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     84        fmt( os, "%lu", uli );
     85        return os;
     86} // ?|?
     87
     88forall( dtype ostype | ostream( ostype ) )
     89ostype * ?|?( ostype * os, long long int lli ) {
     90        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     91        fmt( os, "%lld", lli );
     92        return os;
     93} // ?|?
     94
     95forall( dtype ostype | ostream( ostype ) )
     96ostype * ?|?( ostype * os, unsigned long long int ulli ) {
     97        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     98        fmt( os, "%llu", ulli );
     99        return os;
     100} // ?|?
     101
     102forall( dtype ostype | ostream( ostype ) )
     103ostype * ?|?( ostype * os, float f ) {
     104        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     105        fmt( os, "%g", f );
     106        return os;
     107} // ?|?
     108
     109forall( dtype ostype | ostream( ostype ) )
     110ostype * ?|?( ostype * os, double d ) {
     111        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     112        fmt( os, "%.*lg", DBL_DIG, d );
     113        return os;
     114} // ?|?
     115
     116forall( dtype ostype | ostream( ostype ) )
     117ostype * ?|?( ostype * os, long double ld ) {
     118        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     119        fmt( os, "%.*Lg", LDBL_DIG, ld );
     120        return os;
     121} // ?|?
     122
     123forall( dtype ostype | ostream( ostype ) )
     124ostype * ?|?( ostype * os, float _Complex fc ) {
    125125        os | crealf( fc );
    126126        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     
    132132
    133133forall( dtype ostype | ostream( ostype ) )
    134 ostype * ?|?( ostype *os, double _Complex dc ) {
     134ostype * ?|?( ostype * os, double _Complex dc ) {
    135135        os | creal( dc );
    136136        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     
    142142
    143143forall( dtype ostype | ostream( ostype ) )
    144 ostype * ?|?( ostype *os, long double _Complex ldc ) {
     144ostype * ?|?( ostype * os, long double _Complex ldc ) {
    145145        os | creall( ldc );
    146146        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     
    152152
    153153forall( dtype ostype | ostream( ostype ) )
    154 ostype * ?|?( ostype *os, const char *cp ) {
     154ostype * ?|?( ostype * os, const char * cp ) {
    155155        enum { Open = 1, Close, OpenClose };
    156156        static const unsigned char mask[256] = {
     
    161161                // closing delimiters, no space before
    162162                [','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
     163                ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
    163164                [')'] : Close, [']'] : Close, ['}'] : Close,
    164                 ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
    165165                // opening-closing delimiters, no space before or after
    166166                ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,
     
    173173        unsigned char ch = cp[0];                                                       // must make unsigned
    174174        if ( sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
    175                 prtfmt( os, "%s", sepGet( os ) );
     175                fmt( os, "%s", sepGetCur( os ) );
    176176        } // if
    177177
     
    191191
    192192forall( dtype ostype | ostream( ostype ) )
    193 ostype * ?|?( ostype *os, const void *p ) {
    194         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    195         prtfmt( os, "%p", p );
     193ostype * ?|?( ostype * os, const void * p ) {
     194        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     195        fmt( os, "%p", p );
    196196        return os;
    197197} // ?|?
     
    201201forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } )
    202202ostype * ?|?( ostype * os, T arg, Params rest ) {
    203         os | arg | ", ";
    204         os | rest;
    205         return os;
     203        sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
     204        os | arg;                                                                                       // print first argument
     205        os | rest;                                                                                      // print remaining arguments
     206        sepSetCur( os, sepGet( os ) );                                          // switch to regular separator
    206207} // ?|?
    207208
     
    248249
    249250forall( otype elttype | writeable( elttype ), otype iteratortype | iterator( iteratortype, elttype ), dtype ostype | ostream( ostype ) )
    250 void write( iteratortype begin, iteratortype end, ostype *os ) {
     251void write( iteratortype begin, iteratortype end, ostype * os ) {
    251252        void print( elttype i ) { os | i; }
    252253        for_each( begin, end, print );
     
    254255
    255256forall( otype elttype | writeable( elttype ), otype iteratortype | iterator( iteratortype, elttype ), dtype ostype | ostream( ostype ) )
    256 void write_reverse( iteratortype begin, iteratortype end, ostype *os ) {
     257void write_reverse( iteratortype begin, iteratortype end, ostype * os ) {
    257258        void print( elttype i ) { os | i; }
    258259        for_each_reverse( begin, end, print );
     
    263264forall( dtype istype | istream( istype ) )
    264265istype * ?|?( istype * is, char * c ) {
    265         scanfmt( is, "%c", c );
     266        fmt( is, "%c", c );
    266267        return is;
    267268} // ?|?
     
    269270forall( dtype istype | istream( istype ) )
    270271istype * ?|?( istype * is, short int * si ) {
    271         scanfmt( is, "%hd", si );
     272        fmt( is, "%hd", si );
    272273        return is;
    273274} // ?|?
     
    275276forall( dtype istype | istream( istype ) )
    276277istype * ?|?( istype * is, unsigned short int * usi ) {
    277         scanfmt( is, "%hu", usi );
     278        fmt( is, "%hu", usi );
    278279        return is;
    279280} // ?|?
     
    281282forall( dtype istype | istream( istype ) )
    282283istype * ?|?( istype * is, int * i ) {
    283         scanfmt( is, "%d", i );
     284        fmt( is, "%d", i );
    284285        return is;
    285286} // ?|?
     
    287288forall( dtype istype | istream( istype ) )
    288289istype * ?|?( istype * is, unsigned int * ui ) {
    289         scanfmt( is, "%u", ui );
     290        fmt( is, "%u", ui );
    290291        return is;
    291292} // ?|?
     
    293294forall( dtype istype | istream( istype ) )
    294295istype * ?|?( istype * is, long int * li ) {
    295         scanfmt( is, "%ld", li );
     296        fmt( is, "%ld", li );
    296297        return is;
    297298} // ?|?
     
    299300forall( dtype istype | istream( istype ) )
    300301istype * ?|?( istype * is, unsigned long int * ulli ) {
    301         scanfmt( is, "%lu", ulli );
     302        fmt( is, "%lu", ulli );
    302303        return is;
    303304} // ?|?
     
    305306forall( dtype istype | istream( istype ) )
    306307istype * ?|?( istype * is, long long int * lli ) {
    307         scanfmt( is, "%lld", lli );
     308        fmt( is, "%lld", lli );
    308309        return is;
    309310} // ?|?
     
    311312forall( dtype istype | istream( istype ) )
    312313istype * ?|?( istype * is, unsigned long long int * ulli ) {
    313         scanfmt( is, "%llu", ulli );
     314        fmt( is, "%llu", ulli );
    314315        return is;
    315316} // ?|?
     
    318319forall( dtype istype | istream( istype ) )
    319320istype * ?|?( istype * is, float * f ) {
    320         scanfmt( is, "%f", f );
     321        fmt( is, "%f", f );
    321322        return is;
    322323} // ?|?
     
    324325forall( dtype istype | istream( istype ) )
    325326istype * ?|?( istype * is, double * d ) {
    326         scanfmt( is, "%lf", d );
     327        fmt( is, "%lf", d );
    327328        return is;
    328329} // ?|?
     
    330331forall( dtype istype | istream( istype ) )
    331332istype * ?|?( istype * is, long double * ld ) {
    332         scanfmt( is, "%Lf", ld );
     333        fmt( is, "%Lf", ld );
    333334        return is;
    334335} // ?|?
     
    338339istype * ?|?( istype * is, float _Complex * fc ) {
    339340        float re, im;
    340         scanfmt( is, "%g%gi", &re, &im );
     341        fmt( is, "%g%gi", &re, &im );
    341342        *fc = re + im * _Complex_I;
    342343        return is;
     
    346347istype * ?|?( istype * is, double _Complex * dc ) {
    347348        double re, im;
    348         scanfmt( is, "%lf%lfi", &re, &im );
     349        fmt( is, "%lf%lfi", &re, &im );
    349350        *dc = re + im * _Complex_I;
    350351        return is;
     
    354355istype * ?|?( istype * is, long double _Complex * ldc ) {
    355356        long double re, im;
    356         scanfmt( is, "%Lf%Lfi", &re, &im );
     357        fmt( is, "%Lf%Lfi", &re, &im );
    357358        *ldc = re + im * _Complex_I;
    358359        return is;
     
    362363forall( dtype istype | istream( istype ) )
    363364istype * ?|?( istype * is, _Istream_cstrUC cstr ) {
    364         scanfmt( is, "%s", cstr.s );
     365        fmt( is, "%s", cstr.s );
    365366        return is;
    366367} // cstr
     
    371372        char buf[16];
    372373        sprintf( buf, "%%%ds", cstr.size );
    373         scanfmt( is, buf, cstr.s );
     374        fmt( is, buf, cstr.s );
    374375        return is;
    375376} // cstr
  • src/tests/.expect/io.txt

    ra53e10a r87d13cd  
    1818abc, $xyz
    1919
    20 v(27 v[27 v{27 $27 £27 ¥27 ¡27 ¿27 «27
    21 25, 25. 25: 25; 25! 25? 25) 25] 25} 25% 25¢ 25»
     20v(27 v[27 v{27 $27 =27 £27 ¥27 ¡27 ¿27 «27
     2125, 25. 25: 25; 25! 25? 25% 25¢ 25» 25) 25] 25}
    222225'27 25`27 25"27 25 27 25
    232327 25
     
    252527 25   27 25
    262627
     27Segmentation fault (core dumped)
  • src/tests/io.c

    ra53e10a r87d13cd  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul  5 18:29:23 2016
    13 // Update Count     : 31
     12// Last Modified On : Tue Mar 21 21:24:50 2017
     13// Update Count     : 47
    1414//
    1515
     
    6262
    6363        sepSet( sout, ", $" );                                                                          // change separator, maximum of 15 characters
    64         sout | f | d | ld | endl                                                                        // floating point without separator
    65                  | fc | dc | ldc | endl                                                                 // complex without separator
     64        sout | f | d | ld | endl
     65                 | fc | dc | ldc | endl
    6666                 | s1 | s2 | endl;
    6767        sout | endl;
     
    7474                | "v{" | 27
    7575                | "$" | 27
     76                | "=" | 27
    7677                | "£" | 27
    7778                | "¥" | 27
     
    8788                | 25 | "!"
    8889                | 25 | "?"
     90                | 25 | "%"
     91                | 25 | "¢"
     92                | 25 | "»"
    8993                | 25 | ")"
    9094                | 25 | "]"
    9195                | 25 | "}"
    92                 | 25 | "%"
    93                 | 25 | "¢"
    94                 | 25 | "»"
    9596                | endl
    9697                // opening-closing delimiters
     
    105106                | 25 | "\v" | 27
    106107                | endl;
     108
     109        [int, int, const char *, double] t = { 3, 4, "a", 7.2 };
     110        sout | [ 3, 4, 'a', 7.2 ] | endl;
     111        sout | t | endl;
     112        sepSetTuple( sout, " " );
     113        sout | t | endl;
     114        sout | sepOn | t | sepDisable | t | sepEnable | t | endl;
     115        sepSet( sout, "^" );
     116        sepSetTuple( sout, "-" );
     117        sout | t | 3 | 4 | t | endl;
    107118}
    108119
Note: See TracChangeset for help on using the changeset viewer.