Ignore:
Timestamp:
Aug 31, 2021, 1:49:09 AM (3 years ago)
Author:
Jacob Prud'homme <jafprudhomme@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
Children:
5e0e488
Parents:
31337d8
git-author:
Jacob Prud'homme <jafprudhomme@…> (07/13/21 12:36:19)
git-committer:
Jacob Prud'homme <jafprudhomme@…> (08/31/21 01:49:09)
Message:

Restructured parseconfig to work like parseargs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/parseconfig.cfa

    r31337d8 r4df8fef5  
    1313
    1414// Process the configuration file to set the simulation parameters.
    15 void parseConfig( const char * configFile, ConfigParms & cparms ) {
    16                 ifstream in;
     15void parse_config( const char * config_file, config_entry entries[], size_t num_entries ) {
     16        ifstream in;
    1717        try {
    18                 open( in, configFile );                                                 // open the configuration file for input
     18                open( in, config_file );                                                        // open the configuration file for input
    1919
    2020                while () {
    21                   if ( comments( in, name ) ) break;                    // eof ?
     21                        char * key;
     22                        char * value;
     23                  if ( comments( in, key ) ) break;                     // eof ?
    2224                        // Should we just overwrite duplicate config entries? Having a hash map would make this much easier
    2325                        in | value;
     
    3133                } // for
    3234        } catch( Open_Failure * ex; ex->istream == &in ) {
    33                 exit | "Error: could not open input file \"" | configFile | "\"";
     35                exit | "Error: could not open input file \"" | config_file | "\"";
    3436        } // try
    3537        close( in );
Note: See TracChangeset for help on using the changeset viewer.