- Timestamp:
- Aug 14, 2023, 9:28:00 PM (15 months ago)
- Branches:
- master
- Children:
- 6264087
- Parents:
- 7baff35
- git-author:
- Peter A. Buhr <pabuhr@…> (08/14/23 21:24:33)
- git-committer:
- Peter A. Buhr <pabuhr@…> (08/14/23 21:28:00)
- Location:
- libcfa/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/parseconfig.cfa
r7baff35 rb5e725a 16 16 #pragma GCC visibility push(default) 17 17 18 18 19 // *********************************** exceptions *********************************** 19 20 20 21 // TODO: Add names of missing config entries to exception (see further below)22 vtable(Missing_Config_Entries) Missing_Config_Entries_vt;23 21 24 22 [ void ] ?{}( & Missing_Config_Entries this, unsigned int num_missing ) { … … 33 31 34 32 35 vtable(Parse_Failure) Parse_Failure_vt;36 37 33 [ void ] ?{}( & Parse_Failure this, [] char failed_key, [] char failed_value ) { 38 34 this.virtual_table = &Parse_Failure_vt; … … 54 50 } 55 51 56 57 vtable(Validation_Failure) Validation_Failure_vt;58 52 59 53 [ void ] ?{}( & Validation_Failure this, [] char failed_key, [] char failed_value ) { -
libcfa/src/parseconfig.hfa
r7baff35 rb5e725a 2 2 3 3 #include <math.trait.hfa> 4 #include <Exception.hfa> 4 5 5 6 … … 62 63 63 64 64 exception Missing_Config_Entries { 65 ExceptionDecl( Missing_Config_Entries, 65 66 unsigned int num_missing; 66 };67 ); 67 68 68 69 [ void ] msg( * Missing_Config_Entries ex ); 69 70 70 exception Parse_Failure { 71 ExceptionDecl( Parse_Failure, 71 72 * char failed_key; 72 73 * char failed_value; 73 };74 ); 74 75 75 76 [ void ] msg( * Parse_Failure ex ); 76 77 77 exception Validation_Failure { 78 ExceptionDecl( Validation_Failure, 78 79 * char failed_key; 79 80 * char failed_value; 80 };81 ); 81 82 82 83 [ void ] msg( * Validation_Failure ex ); -
libcfa/src/stdlib.cfa
r7baff35 rb5e725a 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 5 11:53:43202313 // Update Count : 6 3712 // Last Modified On : Mon Aug 14 18:22:36 2023 13 // Update Count : 642 14 14 // 15 15 … … 65 65 //--------------------------------------- 66 66 67 static vtable(out_of_range) out_of_range_vt;68 static vtable(invalid_argument) invalid_argument_vt;69 70 67 forall( T | { T strto( const char sptr[], char * eptr[], int ); } ) 71 68 T convert( const char sptr[] ) { … … 73 70 errno = 0; // reset 74 71 T val = strto( sptr, &eptr, 10 ); // attempt conversion 75 if ( errno == ERANGE ) Throw( out_of_range );72 if ( errno == ERANGE ) throw ExceptionInst( out_of_range ); 76 73 if ( eptr == sptr || // conversion failed, no characters generated 77 *eptr != '\0' ) Throw( invalid_argument );// not at end of str ?74 *eptr != '\0' ) throw ExceptionInst( invalid_argument ); // not at end of str ? 78 75 return val; 79 76 } // convert -
libcfa/src/stdlib.hfa
r7baff35 rb5e725a 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 5 11:53:42 202313 // Update Count : 77 412 // Last Modified On : Mon Aug 14 18:19:12 2023 13 // Update Count : 777 14 14 // 15 15 … … 19 19 #include "bits/align.hfa" // libAlign 20 20 #include "bits/random.hfa" // prng 21 #include <Exception.hfa> 22 #include <heap.hfa> 21 23 22 24 #include <stdlib.h> // *alloc, strto*, ato* 23 #include <heap.hfa>24 25 #include <errno.h> 25 26 … … 310 311 long double _Complex strto( const char sptr[], char * eptr[] ); 311 312 312 exception out_of_range {};313 exception invalid_argument {};313 ExceptionDecl( out_of_range ); 314 ExceptionDecl( invalid_argument ); 314 315 315 316 forall( T | { T strto( const char sptr[], char * eptr[], int ); } ) … … 460 461 } // distribution 461 462 463 // Set default random-generator size. 464 #if defined( __x86_64__ ) || defined( __aarch64__ ) // 64-bit architecture 465 #define PRNG PRNG64 466 #else // 32-bit architecture 467 #define PRNG PRNG32 468 #endif // __x86_64__ 469 462 470 // Concurrent Pseudo Random-Number Generator : generate repeatable sequence of values that appear random. 463 471 //
Note: See TracChangeset
for help on using the changeset viewer.