Symbol parse_symbol(char *token, Package pkg) { char *pkg_name, *sym_name; token = toupper_string(token); if (is_keyword_token(token)) return gen_keyword(token + 1); if (is_qualified(token, &pkg_name, &sym_name)) { Package pkg; pkg = find_package(pkg_name); return gen_symbol(sym_name, pkg); } else return gen_symbol(token, pkg); }
/* +----------------------------------------------------------------------+ | Name: mod_check_report_reduction() | | Description: Checks the database sys param's for report reduction. | | Input: connection - dataserver communication channel | module_name - current process name (e.g., CAP) | reduction_start - integer | reduction_min - integer | Output: none | Returns: TRUE/FALSE ----------------------------------------------------------------------+ */ boolean mod_check_report_reduction(Arb_connection *connection, const char *module_name, int reduction_start, int reduction_min) { /* local constants */ #define MAX_LEVELS 2 #define MAX_LEVEL_LEN 33 #define MAX_RED_EMITS 4 #define LEVEL_UNSET -1 #define PROC_LEVEL 1 #define MODL_LEVEL 0 /* Gobal variables */ #ifndef WIN32 extern boolean gbReduceOutput; /* message.c (libarbor_err.a) */ #endif #ifdef WIN32 boolean gbReduceOutput = FALSE; #endif /* Local variables */ long reductionCount = 0; long reductionTol = 0; boolean bPlaceHolder, bProcLevel, bModlLevel; char upper_process_nm[33]; char upper_process_id[33]; int value [ MAX_LEVELS ]; int iLevel, iPrint; static boolean firstReduction = TRUE; static boolean reduce_reporting = FALSE; static boolean sbPrintedMsg = FALSE; static boolean sbFirstPass = TRUE; static boolean sbReduction = FALSE; /* element 1 = module_level reduction...*/ /* element 2 = process_level reduction...*/ static char reduce_output_id[ MAX_LEVELS ][ MAX_LEVEL_LEN ]; static int emit_msgs[ MAX_RED_EMITS ] = { MODL_REDUCTION, PROC_REDUCTION, BAD_MODL_REDUCT, BAD_PROC_REDUCT }; static int sbSetZero = FALSE; /* check for connection being present for sys param access... */ if( connection ) { /* Set report reduction parameters here */ bPlaceHolder = gbReduceOutput; bProcLevel=bModlLevel=gbReduceOutput = FALSE; iPrint = LEVEL_UNSET; /* get the process_name to be set for report reduction... * first pass only. */ if( sbFirstPass ) { strcpy(upper_process_nm, module_name); strcpy(upper_process_id, arb_get_process_id()); toupper_string(upper_process_nm); toupper_string(upper_process_id); /* set parameter names to look for...for report reduction... */ sprintf( reduce_output_id[0],"%s_REDUCE_OUTPUT", upper_process_nm ); sprintf( reduce_output_id[1],"%s_REDUCE_OUTPUT", upper_process_id ); } /* check for module and process level parameters... */ for ( iLevel=0; iLevel < MAX_LEVELS; iLevel++ ) { /* check for a defined system parameter... */ if( get_system_parameter_int(connection, upper_process_nm, reduce_output_id[ iLevel ], &value[ iLevel ] ) != FAILURE) { if( iLevel == PROC_LEVEL ) bProcLevel = TRUE; else bModlLevel = TRUE; } else { value[ iLevel ] = LEVEL_UNSET; } } /* if at some level a sys param's defined, then... */ if( bProcLevel ) { iLevel = PROC_LEVEL; } else if ( bModlLevel ) { iLevel = MODL_LEVEL; } else { reduce_reporting = FALSE; reductionCount = 0; reductionTol = 0; iLevel = LEVEL_UNSET; } /* if the value is different than before; or if state changed then... */ if( (iLevel != LEVEL_UNSET) && (value[ iLevel ] != reductionTol) ) { /* reset counter && reset 1st reduction var... */ firstReduction = TRUE; reductionCount = reduction_start; /* setup to print the appropriate msg here... */ sbPrintedMsg = FALSE; sbSetZero = FALSE; /* allow defined values as low as makes sense... * any lower use default */ if( value[ iLevel ] > reduction_min ) { reduce_reporting = TRUE; reductionTol = value[ iLevel ]; iPrint = iLevel; /* if the value doesn't make sense, * turn off reduction, print msg... */ } else { reduce_reporting = FALSE; reductionCount = 0; reductionTol = value[ iLevel ]; /* make the appropriate msg change...emit error msg's */ iPrint = iLevel + 2; /* if the value is zero the message will already print */ if( value[ iLevel ] == 0 ) sbSetZero = TRUE; } /* check to see if the values are the same and not set yet... */ } else if((iLevel != LEVEL_UNSET)&&(value[iLevel] == reductionTol)) { if( value[iLevel] == 0 ) { reduce_reporting = FALSE; if( !sbSetZero ) { /* setup to print the appropriate msg here... */ sbPrintedMsg = FALSE; /* make the appropriate msg change...emit error msg's */ iPrint = iLevel + 2; sbSetZero = TRUE; } } } /* check to see if prev state = current state... */ /* * if( (sbReduction != reduce_reporting) || sbFirstPass ) * { * sbReduction = reduce_reporting; * if( (iLevel != LEVEL_UNSET) && (iPrint == LEVEL_UNSET )) * iPrint = iLevel; * sbPrintedMsg = FALSE; * * } */ /* check for msg to log, and log...*/ if( iPrint != LEVEL_UNSET && !sbPrintedMsg ) { emit((char *)module_name, __FILE__, __LINE__, emit_msgs[iPrint], value[iLevel]); sbPrintedMsg = TRUE; } /* if reducing reporting, we care to keep the last state...*/ if( reduce_reporting ) { gbReduceOutput = bPlaceHolder; /* Check to see if it's the 1st pass of the new reduction, * if so, set global flag to allow printing the 1st cycle... */ if( firstReduction ) gbReduceOutput = FALSE; } else /* otherwise, we want no report reduction... */ if( gbReduceOutput ) gbReduceOutput = FALSE; } else { /************************************************/ /* all this stuff for reducing report output... */ /************************************************/ if( reduce_reporting ) { if( reductionCount > reductionTol ) { gbReduceOutput = TRUE; /* true causes no more printing * of the emit inform msgs */ reductionCount = reduction_start+1; } else if( reductionCount == reductionTol) { gbReduceOutput = FALSE; /* false causes printing * of all emit inform msgs */ reductionCount++; } else if( reductionCount < reductionTol) { reductionCount++; if( firstReduction ) { gbReduceOutput = TRUE; /* true causes no more printing * of emit inform msgs */ firstReduction = FALSE; } } } else { /* ... set the global in emit to emit all messages... */ if( gbReduceOutput ) gbReduceOutput = FALSE; } } return reduce_reporting; } /* mod_check_report_reduction() */