- Timestamp:
- Aug 31, 2021, 1:49:09 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
- Children:
- 716e4e6
- Parents:
- 6604ea1
- git-author:
- Jacob Prud'homme <jafprudhomme@…> (07/16/21 15:36:51)
- git-committer:
- Jacob Prud'homme <jafprudhomme@…> (08/31/21 01:49:09)
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/parseconfig.cfa
r6604ea1 r930609e2 115 115 116 116 117 // *********************************** validation *********************************** 118 119 120 forall(T | arithmetic( T )) 121 bool is_nonnegative( T & value ) { 122 T zero_val = 0; 123 return value >= zero_val; 124 } 125 126 forall(T | arithmetic( T )) 127 bool is_positive( T & value ) { 128 T zero_val = 0; 129 return value > zero_val; 130 } 131 132 forall(T | arithmetic( T )) 133 bool is_nonpositive( T & value ) { 134 T zero_val = 0; 135 return value <= zero_val; 136 } 137 138 forall(T | arithmetic( T )) 139 bool is_negative( T & value ) { 140 T zero_val = 0; 141 return value < zero_val; 142 } 143 144 117 145 // Local Variables: // 118 146 // tab-width: 4 // -
libcfa/src/parseconfig.hfa
r6604ea1 r930609e2 1 1 #pragma once 2 2 3 4 // *********************************** exceptions *********************************** 3 #include <rational.hfa> 5 4 6 5 7 EHM_EXCEPTION(Validation_Failure)( 8 const char * key; 9 void * variable; 10 ); 11 12 void ?{}( Validation_Failure & this, config_entry & entry ); 13 14 15 // *********************************** main code *********************************** 6 // *********************************** initial declarations *********************************** 16 7 17 8 … … 57 48 } 58 49 50 51 // *********************************** exceptions *********************************** 52 53 54 EHM_EXCEPTION(Validation_Failure)( 55 const char * key; 56 void * variable; 57 ); 58 59 void ?{}( Validation_Failure & this, config_entry & entry ); 60 61 62 // *********************************** main code *********************************** 63 64 59 65 void parse_config( const char * config_file, config_entry entries[], size_t num_entries ); 60 66 … … 67 73 bool parse( const char *, double & ); 68 74 75 76 // *********************************** validation *********************************** 77 78 79 forall(T | arithmetic( T )) 80 bool is_nonnegative( T & ); 81 82 forall(T | arithmetic( T )) 83 bool is_positive( T & ); 84 85 forall(T | arithmetic( T )) 86 bool is_nonpositive( T & ); 87 88 forall(T | arithmetic( T )) 89 bool is_negative( T & ); 90 91 69 92 // Local Variables: // 70 93 // mode: c //
Note: See TracChangeset
for help on using the changeset viewer.