Changeset cb91437


Ignore:
Timestamp:
Mar 22, 2017, 5:39:46 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
22854f8, 37f9860
Parents:
87d13cd
Message:

additions to tuple separator for sout

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/fstream.c

    r87d13cd rcb91437  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 21 20:56:10 2017
    13 // Update Count     : 215
     12// Last Modified On : Wed Mar 22 16:17:21 2017
     13// Update Count     : 221
    1414//
    1515
     
    2525#include <complex.h>                                                                    // creal, cimag
    2626}
     27#include "assert"
    2728
    2829#define IO_MSG "I/O error: "
     
    3738void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; }
    3839
    39 const char * sepGet( ofstream * os ) { return &(os->separator[0]); }
     40const char * sepGet( ofstream * os ) { return os->separator; }
    4041
    4142void sepSet( ofstream * os, const char * s ) {
    42         strncpy( &(os->separator[0]), s, separateSize - 1 );
     43        assert( s );
     44        strncpy( os->separator, s, separateSize - 1 );
    4345        os->separator[separateSize - 1] = '\0';
    4446} // sepSet
    4547
    46 const char * sepGetTuple( ofstream * os ) { return &(os->tupleSeparator[0]); }
     48const char * sepGetTuple( ofstream * os ) { return os->tupleSeparator; }
    4749
    4850void sepSetTuple( ofstream * os, const char * s ) {
    49         strncpy( &(os->tupleSeparator[0]), s, separateSize - 1 );
     51        assert( s );
     52        strncpy( os->tupleSeparator, s, separateSize - 1 );
    5053        os->tupleSeparator[separateSize - 1] = '\0';
    5154} // sepSet
  • src/libcfa/iostream.c

    r87d13cd rcb91437  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 21 22:05:57 2017
    13 // Update Count     : 348
     12// Last Modified On : Wed Mar 22 17:21:23 2017
     13// Update Count     : 358
    1414//
    1515
     
    157157                // opening delimiters, no space after
    158158                ['('] : Open, ['['] : Open, ['{'] : Open,
    159                 ['$'] : Open, ['='] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open,
     159                ['='] : Open, ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open,
    160160                [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
    161161                // closing delimiters, no space before
     
    201201forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } )
    202202ostype * ?|?( ostype * os, T arg, Params rest ) {
     203        forall( ttype Params ) ostype * prtTuple( ostype * os, T arg, Params rest ) {
     204                os | arg;                                                                               // print first argument
     205                os | rest;                                                                              // print remaining arguments
     206                return os;
     207        } // prtTuple
    203208        sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
    204         os | arg;                                                                                       // print first argument
    205         os | rest;                                                                                      // print remaining arguments
     209        prtTuple( os, arg, rest );                                                      // recursively print tuple
    206210        sepSetCur( os, sepGet( os ) );                                          // switch to regular separator
     211        return os;
    207212} // ?|?
    208213
  • src/tests/.expect/io.txt

    r87d13cd rcb91437  
    252527 25   27 25
    262627
    27 Segmentation fault (core dumped)
     273, 4, a, 7.2
     283, 4, a, 7.2
     293 4 a 7.2
     30 3 4 a 7.234a7.2 3 4 a 7.2
     313-4-a-7.2^3^4-3-4-a-7.2
  • src/tests/io.c

    r87d13cd rcb91437  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 21 21:24:50 2017
    13 // Update Count     : 47
     12// Last Modified On : Tue Mar 21 22:36:06 2017
     13// Update Count     : 48
    1414//
    1515
     
    108108
    109109        [int, int, const char *, double] t = { 3, 4, "a", 7.2 };
    110         sout | [ 3, 4, 'a', 7.2 ] | endl;
     110        sout | [ 3, 4, "a", 7.2 ] | endl;
    111111        sout | t | endl;
    112112        sepSetTuple( sout, " " );
Note: See TracChangeset for help on using the changeset viewer.