Changeset fbfde843 for src/libcfa
- Timestamp:
- May 2, 2016, 3:15:07 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:
- d7903b1
- Parents:
- 540de412 (diff), e945826 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/libcfa
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/fstream
r540de412 rfbfde843 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Apr 19 20:44:10201613 // Update Count : 8 412 // Last Modified On : Thu Apr 28 08:08:04 2016 13 // Update Count : 88 14 14 // 15 15 … … 22 22 struct ofstream { 23 23 void *file; 24 intsepDefault;25 int sepOnOff; 24 _Bool sepDefault; 25 int sepOnOff; // FIX ME: type should be _Bool 26 26 char separator[separateSize]; 27 27 }; // ofstream -
src/libcfa/fstream.c
r540de412 rfbfde843 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Apr 14 17:04:24201613 // Update Count : 1 7612 // Last Modified On : Mon May 02 15:14:52 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
r540de412 rfbfde843 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Apr 14 16:02:09201613 // Update Count : 27812 // Last Modified On : Mon May 02 15:13:55 2016 13 // Update Count : 302 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; … … 155 144 // opening delimiters 156 145 ['('] : Open, ['['] : Open, ['{'] : Open, 157 ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open, 146 ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open, 147 [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open, 158 148 // closing delimiters 159 149 [','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close, … … 162 152 // opening-closing delimiters 163 153 ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose, 164 [' \f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace154 [' '] : OpenClose, ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace 165 155 }; // mask 166 156 167 int len = strlen( cp ); 168 // null string => no separator 169 if ( len == 0 ) { sepOff( os ); return os; } 157 if ( cp[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator 158 170 159 // first character IS NOT spacing or closing punctuation => add left separator 171 160 unsigned char ch = cp[0]; // must make unsigned … … 173 162 prtfmt( os, "%s", sepGet( os ) ); 174 163 } // if 164 165 // if string starts line, must reset to determine open state because separator is off 166 sepReset( os ); // reset separator 167 175 168 // last character IS spacing or opening punctuation => turn off separator for next item 176 unsigned int posn = len - 1;169 unsigned int len = strlen( cp ), posn = len - 1; 177 170 ch = cp[posn]; // must make unsigned 178 if ( mask[ ch ] == Open || mask[ ch ] == OpenClose ) { 171 if ( sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) { 172 sepOn( os ); 173 } else { 179 174 sepOff( os ); 180 } else {181 sepOn( os );182 175 } // if 183 176 return write( os, cp, len ); … … 187 180 ostype * ?|?( ostype *os, const void *p ) { 188 181 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); 189 sepReset( os );190 182 prtfmt( os, "%p", p ); 191 183 return os; -
src/libcfa/stdlib
r540de412 rfbfde843 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 -
src/libcfa/stdlib.c
r540de412 rfbfde843 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Apr 2 1 07:58:29201613 // Update Count : 16 512 // Last Modified On : Thu Apr 28 07:54:21 2016 13 // Update Count : 166 14 14 // 15 15 … … 213 213 //--------------------------------------- 214 214 215 forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )216 [ T, T ] div( T t1, T t2 ) { /* return [ t1 / t2, t1 % t2 ]; */}215 // forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } ) 216 // [ T, T ] div( T t1, T t2 ) { return [ t1 / t2, t1 % t2 ]; } 217 217 218 218 //---------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.