Changeset 6d8e1ab
- Timestamp:
- Aug 31, 2021, 1:49:10 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
- Children:
- a0d6987
- Parents:
- cac1d52
- git-author:
- Jacob Prud'homme <jafprudhomme@…> (08/06/21 22:05:11)
- git-committer:
- Jacob Prud'homme <jafprudhomme@…> (08/31/21 01:49:10)
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/parseconfig.cfa
rcac1d52 r6d8e1ab 9 9 10 10 11 static vtable(Parse_Failure) Parse_Failure_vt; 12 13 void ?{}( Parse_Failure & this ) with ( this ) { 14 virtual_table = &Parse_Failure_vt; 15 } 16 17 static vtable(Unknown_Config_Format) Unknown_Config_Format_vt; 18 19 void ?{}( Unknown_Config_Format & this ) with ( this ) { 20 virtual_table = &Unknown_Config_Format_vt; 21 } 22 11 23 static vtable(Validation_Failure) Validation_Failure_vt; 12 24 13 void ?{}( Validation_Failure & this, config_entry & entry ) with ( entry ) { 14 this.virtual_table = &Validation_Failure_vt; 15 this.key = key; 16 this.variable = variable; 25 void ?{}( Validation_Failure & this ) with ( this ) { 26 virtual_table = &Validation_Failure_vt; 17 27 } 18 28 … … 91 101 } catch( Open_Failure * ex; ex->istream == &in ) { 92 102 delete( kv_pairs ); 93 exit | "Error: could not open input file '" | config_file | "'"; 103 serr | "Error: could not open input file '" | config_file | "'"; 104 throw *ex; 94 105 // HERE (unfreed storage) 95 106 } // try … … 106 117 kv_pairs = parse_tabular_config_format( config_file, num_entries ); 107 118 default: 108 exit | "Error: config file format " | format | " is not supported"; 119 serr | "Error: config file format " | format | " is not supported"; 120 throw (Unknown_Config_Format){}; 109 121 } 110 122 … … 125 137 if ( !entries[j].validate( entries[j].variable ) ) { 126 138 delete( kv_pairs ); 127 throw (Validation_Failure){ entries[j] }; 139 serr | "Error: config value at key '" | entries[j].key | "' did not pass validation"; 140 throw (Validation_Failure){}; 128 141 } 129 142 } … … 132 145 } 133 146 134 serr | "Value '" | src_value | "' for key '" | src_key | "' could not be parsed"; 147 delete( kv_pairs ); 148 serr | "Error: value '" | src_value | "' for key '" | src_key | "' could not be parsed"; 149 throw (Parse_Failure){}; 135 150 } 136 151 } -
libcfa/src/parseconfig.hfa
rcac1d52 r6d8e1ab 56 56 57 57 58 exception Validation_Failure { 59 const char * key; 60 void * variable; 61 }; 58 exception Parse_Failure {}; 62 59 63 void ?{}( Validation_Failure & this, config_entry & entry ); 60 void ?{}( Parse_Failure & this ); 61 62 exception Unknown_Config_Format {}; 63 64 void ?{}( Unknown_Config_Format & this ); 65 66 exception Validation_Failure {}; 67 68 void ?{}( Validation_Failure & this ); 64 69 65 70
Note: See TracChangeset
for help on using the changeset viewer.