Changeset c80ac84
- 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:
- a0e142f
- Parents:
- 45729a8
- git-author:
- Jacob Prud'homme <jafprudhomme@…> (07/27/21 12:44:04)
- git-committer:
- Jacob Prud'homme <jafprudhomme@…> (08/31/21 01:49:10)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/parseconfig.cfa
r45729a8 rc80ac84 120 120 121 121 while () { 122 char * key = 0p; 123 char * value = 0p; 124 if ( comments( in, key ) ) break; // eof ? 125 // Should we just overwrite duplicate config entries? Having a hash map would make this much easier 126 in | value; 122 // * char key; 123 // * char value; 124 // if ( comments( in, key ) ) break; // eof ? 125 126 // THE CODE BELOW IS TEMPORARY, TO TRY AND GET SOMETHING WORKING 127 128 // Right now doesn't handle duplicate keys. Should use hashmap for that 129 char c; 130 StringBuilder key_sb; 131 StringBuilder value_sb; 132 133 // Doesn't handle comments 134 while () { 135 in | c; 136 if ( c == ' ' ) { 137 while ( c == ' ' ) in | c; 138 } else { 139 add_char( key_sb, c ); 140 } 141 } 142 143 * char key = alloc( key_sb.size ); 144 strcpy( key, key_sb.string ); 145 146 // Doesn't handle comments 147 while () { 148 in | c; 149 if ( c == ' ' || c == '\n' ) break; 150 add_char( value_sb, c ); 151 } 152 153 * char value = alloc( value_sb.size ); 154 strcpy( value, value_sb.string ); 127 155 128 156 add_kv_pair( kv_pairs, key, value );
Note: See TracChangeset
for help on using the changeset viewer.