Changeset ff2a33e
- Timestamp:
- Jul 14, 2019, 11:43:21 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- ec72861
- Parents:
- 1201d54
- Location:
- libcfa/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.cfa
r1201d54 rff2a33e 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:03:53201913 // Update Count : 34 412 // Last Modified On : Sun Jul 14 11:51:10 2019 13 // Update Count : 347 14 14 // 15 15 … … 119 119 #ifdef __CFA_DEBUG__ 120 120 if ( file == 0 ) { 121 abort ( IO_MSG "open output file \"%s\", %s", name, strerror( errno ));121 abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno ); 122 122 } // if 123 123 #endif // __CFA_DEBUG__ … … 133 133 134 134 if ( fclose( (FILE *)(os.file) ) == EOF ) { 135 abort ( IO_MSG "close output %s", strerror( errno ));135 abort | IO_MSG "close output" | nl | strerror( errno ); 136 136 } // if 137 137 } // close … … 139 139 ofstream & write( ofstream & os, const char * data, size_t size ) { 140 140 if ( fail( os ) ) { 141 abort ( "attempt write I/O on failed stream\n" );141 abort | IO_MSG "attempt write I/O on failed stream"; 142 142 } // if 143 143 144 144 if ( fwrite( data, 1, size, (FILE *)(os.file) ) != size ) { 145 abort ( IO_MSG "write %s", strerror( errno ));145 abort | IO_MSG "write" | nl | strerror( errno ); 146 146 } // if 147 147 return os; … … 154 154 if ( len == EOF ) { 155 155 if ( ferror( (FILE *)(os.file) ) ) { 156 abort ( "invalid write\n" );156 abort | IO_MSG "invalid write"; 157 157 } // if 158 158 } // if … … 211 211 #ifdef __CFA_DEBUG__ 212 212 if ( file == 0 ) { 213 abort ( IO_MSG "open input file \"%s\", %s\n", name, strerror( errno ));213 abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno ); 214 214 } // if 215 215 #endif // __CFA_DEBUG__ … … 225 225 226 226 if ( fclose( (FILE *)(is.file) ) == EOF ) { 227 abort ( IO_MSG "close input %s", strerror( errno ));227 abort | IO_MSG "close input" | nl | strerror( errno ); 228 228 } // if 229 229 } // close … … 231 231 ifstream & read( ifstream & is, char * data, size_t size ) { 232 232 if ( fail( is ) ) { 233 abort ( "attempt read I/O on failed stream\n" );233 abort | IO_MSG "attempt read I/O on failed stream"; 234 234 } // if 235 235 236 236 if ( fread( data, size, 1, (FILE *)(is.file) ) == 0 ) { 237 abort ( IO_MSG "read %s", strerror( errno ));237 abort | IO_MSG "read" | nl | strerror( errno ); 238 238 } // if 239 239 return is; … … 242 242 ifstream &ungetc( ifstream & is, char c ) { 243 243 if ( fail( is ) ) { 244 abort ( "attempt ungetc I/O on failed stream\n" );244 abort | IO_MSG "attempt ungetc I/O on failed stream"; 245 245 } // if 246 246 247 247 if ( ungetc( c, (FILE *)(is.file) ) == EOF ) { 248 abort ( IO_MSG "ungetc %s", strerror( errno ));248 abort | IO_MSG "ungetc" | nl | strerror( errno ); 249 249 } // if 250 250 return is; … … 258 258 if ( len == EOF ) { 259 259 if ( ferror( (FILE *)(is.file) ) ) { 260 abort ( "invalid read\n" );260 abort | IO_MSG "invalid read"; 261 261 } // if 262 262 } // if -
libcfa/src/gmp.hfa
r1201d54 rff2a33e 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:02:55 201913 // Update Count : 2 612 // Last Modified On : Sat Jul 13 15:25:05 2019 13 // Update Count : 27 14 14 // 15 15 … … 43 43 Int ?=?( Int & lhs, long int rhs ) { mpz_set_si( lhs.mpz, rhs ); return lhs; } 44 44 Int ?=?( Int & lhs, unsigned long int rhs ) { mpz_set_ui( lhs.mpz, rhs ); return lhs; } 45 Int ?=?( Int & lhs, const char * rhs ) { if ( mpz_set_str( lhs.mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return lhs; }45 Int ?=?( Int & lhs, const char * rhs ) { if ( mpz_set_str( lhs.mpz, rhs, 0 ) ) { abort | "invalid string conversion"; } return lhs; } 46 46 47 47 char ?=?( char & lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; } -
libcfa/src/rational.cfa
r1201d54 rff2a33e 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 1 2:02:36201913 // Update Count : 18 312 // Last Modified On : Fri Jul 12 18:12:08 2019 13 // Update Count : 184 14 14 // 15 15 … … 35 35 static RationalImpl simplify( RationalImpl & n, RationalImpl & d ) { 36 36 if ( d == (RationalImpl){0} ) { 37 abort ( "Invalid rational number construction: denominator cannot be equal to 0.\n" );37 abort | "Invalid rational number construction: denominator cannot be equal to 0."; 38 38 } // exit 39 39 if ( d < (RationalImpl){0} ) { d = -d; n = -n; } // move sign to numerator -
libcfa/src/time.cfa
r1201d54 rff2a33e 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:03:19201913 // Update Count : 5912 // Last Modified On : Sat Jul 13 08:41:55 2019 13 // Update Count : 65 14 14 // 15 15 16 16 #include "time.hfa" 17 #include " iostream.hfa"17 #include "fstream.hfa" 18 18 #include <stdio.h> // snprintf 19 19 #include <assert.h> … … 52 52 53 53 #ifdef __CFA_DEBUG__ 54 #define CreateFmt "Attempt to create Time( year=%d (>=1970), month=%d (1-12), day=%d (1-31), hour=%d (0-23), min=%d (0-59), sec=%d (0-60), nsec=%d (0-999_999_999), " \ 55 "which exceeds range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038." 54 static void tabort( int year, int month, int day, int hour, int min, int sec, int nsec ) { 55 abort | "Attempt to create Time( year=" | year | "(>=1970), month=" | month | "(1-12), day=" | day | "(1-31), hour=" | hour | "(0-23), min=" | min | "(0-59), sec=" | sec 56 | "(0-60), nsec=" | nsec | "(0-999_999_999), which exceeds range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038."; 57 } // tabort 56 58 #endif // __CFA_DEBUG__ 57 59 … … 63 65 #ifdef __CFA_DEBUG__ 64 66 if ( month < 1 || 12 < month ) { 65 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );67 tabort( year, month, day, hour, min, sec, nsec ); 66 68 } // if 67 69 #endif // __CFA_DEBUG__ … … 69 71 #ifdef __CFA_DEBUG__ 70 72 if ( day < 1 || 31 < day ) { 71 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );73 tabort( year, month, day, hour, min, sec, nsec ); 72 74 } // if 73 75 #endif // __CFA_DEBUG__ … … 79 81 #ifdef __CFA_DEBUG__ 80 82 if ( epochsec == (time_t)-1 ) { 81 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );83 tabort( year, month, day, hour, min, sec, nsec ); 82 84 } // if 83 85 #endif // __CFA_DEBUG__ … … 85 87 #ifdef __CFA_DEBUG__ 86 88 if ( tv > 2147483647LL * TIMEGRAN ) { // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038. 87 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );89 tabort( year, month, day, hour, min, sec, nsec ); 88 90 } // if 89 91 #endif // __CFA_DEBUG__
Note: See TracChangeset
for help on using the changeset viewer.