--- trunk/src/io/Globals.cpp 2005/03/10 15:10:24 417 +++ trunk/src/io/Globals.cpp 2005/04/15 22:04:00 507 @@ -123,12 +123,6 @@ Globals::~Globals(){ Globals::~Globals(){ int i; - - for( i=0; imatch( lhs ); + + CommandMapType::iterator iter; + std::string keyword(lhs); + iter = command_table.find(keyword); + if (iter != command_table.end()) { + token = iter->second; + } if( token ){ @@ -1257,14 +1249,14 @@ int Globals::globalAssign( event* the_event ){ switch( the_type ){ case STRING: - strcpy(zconsForcePolicy, the_event->evt.asmt.rhs.sval); + strcpy(zconsForcePolicy, the_event->evt.asmt.rhs.sval); - for(int i = 0; zconsForcePolicy[i] != '\0'; i++) - { - zconsForcePolicy[i] = toupper(zconsForcePolicy[i]); - } + for(int i = 0; zconsForcePolicy[i] != '\0'; i++) + { + zconsForcePolicy[i] = toupper(zconsForcePolicy[i]); + } have_zcons_force_policy = 1; - return 1; + return 1; break; case DOUBLE: @@ -1615,21 +1607,21 @@ int Globals::globalAssign( event* the_event ){ switch( the_type ){ case STRING: - the_event->err_msg = + the_event->err_msg = strdup( "Error in parsing meta-data file!\n\tseed is not a string.\n" ); return 0; - return 0; + return 0; break; case DOUBLE: - have_seed = 1; - seed = (int)the_event->evt.asmt.rhs.dval; + have_seed = 1; + seed = (int)the_event->evt.asmt.rhs.dval; return 1; break; case INT: - have_seed = 1; - seed = the_event->evt.asmt.rhs.ival ; + have_seed = 1; + seed = the_event->evt.asmt.rhs.ival ; return 1; break; @@ -1818,7 +1810,7 @@ int Globals::globalAssign( event* the_event ){ } break; - case G_THERM_INT_OMEGA_SPRING: + case G_THERM_INT_OMEGA_SPRING: switch( the_type ){ case STRING: @@ -1936,47 +1928,4 @@ int Globals::globalEnd( event* the_event ){ return 1; } - -int Globals::hash( char* text ){ - - register unsigned short int i = 0; // loop counter - int key = 0; // the hash key - - while( text[i] != '\0' ){ - - key = ( ( key << hash_shift ) + text[i] ) % hash_size; - - i++; - } - - if( key < 0 ){ - // if the key is less than zero, we've had an overflow error - - sprintf( painCave.errMsg, - "There has been an overflow error in the Globals' hash key."); - painCave.isFatal = 1; - simError(); -#ifdef IS_MPI - if( painCave.isEventLoop ){ - if( worldRank == 0 ) mpiInterfaceExit(); - } -#endif //is_mpi - } - - return key; -} - -void Globals::addHash( char* text, int token ){ - - int key; - LinkedCommand* the_element; - - the_element = new LinkedCommand; - the_element->setValues( text, token ); - - key = hash( text ); - - the_element->setNext( command_table[key] ); - command_table[key] = the_element; -}