- Timestamp:
- Apr 27, 2016, 10:52:23 PM (9 years ago)
- 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, with_gc
- Children:
- 8bc4ef8
- Parents:
- dc5376a
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/io.c
rdc5376a rb72bad4f 11 11 // Created On : Wed Mar 2 16:56:02 2016 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Wed Apr 13 23:03:14201614 // Update Count : 2 213 // Last Modified On : Wed Apr 27 22:45:31 2016 14 // Update Count : 26 15 15 // 16 16 … … 52 52 | sepDisable | fc | dc | ldc | sepEnable | endl // complex without separator 53 53 | sepOn | s1 | sepOff | s2 | endl // local separator removal 54 | s1 | "" | s2 | endl; // C string withou separator54 | s1 | "" | s2 | endl; // C string without separator 55 55 sout | endl; 56 56 -
src/libcfa/fstream.c
rdc5376a rb72bad4f 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Apr 6 17:55:27201613 // Update Count : 1 7612 // Last Modified On : Wed Apr 27 18:20:30 2016 13 // Update Count : 187 14 14 // 15 15 … … 93 93 int prtfmt( ofstream * os, const char fmt[], ... ) { 94 94 va_list args; 95 96 95 va_start( args, fmt ); 97 96 int len = vfprintf( (FILE *)(os->file), fmt, args ); … … 103 102 } // if 104 103 va_end( args ); 104 105 sepReset( os ); // reset separator 105 106 return len; 106 107 } // prtfmt -
src/libcfa/iostream.c
rdc5376a rb72bad4f 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Apr 6 16:13:29201613 // Update Count : 2 7812 // Last Modified On : Wed Apr 27 20:35:13 2016 13 // Update Count : 294 14 14 // 15 15 … … 34 34 ostype * ?|?( ostype *os, short int si ) { 35 35 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 36 sepReset( os );37 36 prtfmt( os, "%hd", si ); 38 37 return os; … … 42 41 ostype * ?|?( ostype *os, unsigned short int usi ) { 43 42 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 44 sepReset( os );45 43 prtfmt( os, "%hu", usi ); 46 44 return os; … … 50 48 ostype * ?|?( ostype *os, int i ) { 51 49 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 52 sepReset( os );53 50 prtfmt( os, "%d", i ); 54 51 return os; … … 58 55 ostype * ?|?( ostype *os, unsigned int ui ) { 59 56 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 60 sepReset( os );61 57 prtfmt( os, "%u", ui ); 62 58 return os; … … 66 62 ostype * ?|?( ostype *os, long int li ) { 67 63 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 68 sepReset( os );69 64 prtfmt( os, "%ld", li ); 70 65 return os; … … 74 69 ostype * ?|?( ostype *os, unsigned long int uli ) { 75 70 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 76 sepReset( os );77 71 prtfmt( os, "%lu", uli ); 78 72 return os; … … 82 76 ostype * ?|?( ostype *os, long long int lli ) { 83 77 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 84 sepReset( os );85 78 prtfmt( os, "%lld", lli ); 86 79 return os; … … 90 83 ostype * ?|?( ostype *os, unsigned long long int ulli ) { 91 84 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 92 sepReset( os );93 85 prtfmt( os, "%llu", ulli ); 94 86 return os; … … 98 90 ostype * ?|?( ostype *os, float f ) { 99 91 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 100 sepReset( os );101 92 prtfmt( os, "%g", f ); 102 93 return os; … … 106 97 ostype * ?|?( ostype *os, double d ) { 107 98 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 108 sepReset( os );109 99 prtfmt( os, "%.*lg", DBL_DIG, d ); 110 100 return os; … … 114 104 ostype * ?|?( ostype *os, long double ld ) { 115 105 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 116 sepReset( os );117 106 prtfmt( os, "%.*Lg", LDBL_DIG, ld ); 118 107 return os; … … 161 150 ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close, 162 151 // opening-closing delimiters 163 [' \''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,152 [' '] : OpenClose, ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose, 164 153 ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace 165 154 }; // mask 166 155 167 int len = strlen( cp ); 168 // null string => no separator 169 if ( len == 0 ) { sepOff( os ); return os; } 156 if ( cp[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator 157 170 158 // first character IS NOT spacing or closing punctuation => add left separator 171 159 unsigned char ch = cp[0]; // must make unsigned … … 173 161 prtfmt( os, "%s", sepGet( os ) ); 174 162 } // if 163 164 // if string starts line, must reset to determine open state because separator is off 165 sepReset( os ); // reset separator 166 175 167 // last character IS spacing or opening punctuation => turn off separator for next item 176 unsigned int posn = len - 1;168 unsigned int len = strlen( cp ), posn = len - 1; 177 169 ch = cp[posn]; // must make unsigned 178 if ( mask[ ch ] == Open || mask[ ch ] == OpenClose ) { 170 if ( sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) { 171 sepOn( os ); 172 } else { 179 173 sepOff( os ); 180 } else {181 sepOn( os );182 174 } // if 183 175 return write( os, cp, len ); … … 187 179 ostype * ?|?( ostype *os, const void *p ) { 188 180 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 189 sepReset( os );190 181 prtfmt( os, "%p", p ); 191 182 return os; -
src/libcfa/stdlib
rdc5376a rb72bad4f 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Apr 21 07:55:21201613 // Update Count : 9 512 // Last Modified On : Wed Apr 27 22:03:29 2016 13 // Update Count : 96 14 14 // 15 15 … … 45 45 46 46 forall( otype T ) T * aligned_alloc( size_t alignment ); 47 forall( otype T ) T * memalign( size_t alignment ); 47 forall( otype T ) T * memalign( size_t alignment ); // deprecated 48 48 forall( otype T ) int posix_memalign( T ** ptr, size_t alignment ); 49 49
Note:
See TracChangeset
for help on using the changeset viewer.