static void setFilters(unsigned int filterFlags){
	FLT_initializeDefaultOptions();
	
	if(filterFlags == FILTERS_DEFAULT){
		return;
	}
	if((filterFlags & FILTERS_REMOVE_CYCLES) == FILTERS_REMOVE_CYCLES){
		ATbool removeCycles = FLT_getRemoveCyclesFlag();
		FLT_setRemoveCyclesFlag((removeCycles == ATtrue) ? ATfalse : ATtrue);
	}
	if((filterFlags & FILTERS_DIRECT_PREFERENCE) == FILTERS_DIRECT_PREFERENCE){
		ATbool directPreference = FLT_getDirectPreferenceFlag();
		FLT_setDirectPreferenceFlag((directPreference == ATtrue) ? ATfalse : ATtrue);
	}
	if((filterFlags & FILTERS_INDIRECT_PREFERENCE) == FILTERS_INDIRECT_PREFERENCE){
		ATbool indirectPreference = FLT_getIndirectPreferenceFlag();
		FLT_setIndirectPreferenceFlag((indirectPreference == ATtrue) ? ATfalse : ATtrue);
	}
	if((filterFlags & FILTERS_PREFERENCE_COUNT) == FILTERS_PREFERENCE_COUNT){
		ATbool preferenceCount = FLT_getPreferenceCountFlag();
		FLT_setPreferenceCountFlag((preferenceCount == ATtrue) ? ATfalse : ATtrue);
	}
	if((filterFlags & FILTERS_INJECTION_COUNT) == FILTERS_INJECTION_COUNT){
		ATbool injectionCount = FLT_getInjectionCountFlag();
		FLT_setInjectionCountFlag((injectionCount == ATtrue) ? ATfalse : ATtrue);
	}
	if((filterFlags & FILTERS_PRIORITY) == FILTERS_PRIORITY){
		ATbool priority = FLT_getPriorityFlag();
		FLT_setPriorityFlag((priority == ATtrue) ? ATfalse : ATtrue);
	}
	if((filterFlags & FILTERS_REJECT) == FILTERS_REJECT){
		ATbool reject = FLT_getRejectFlag();
		FLT_setRejectFlag((reject == ATtrue) ? ATfalse : ATtrue);
	}
}
Example #2
0
static PT_ParseTree parsetreeFromTextFile(const char *filename) {
  PT_ParseTree parseResult = NULL;
  InputString inputString;
  
  FLT_setInjectionCountFlag(ATfalse);
  FLT_setPreferenceCountFlag(ATfalse);

  if (loadParseTable()) {
    inputString = IS_createInputStringFromFile(filename);
    parseResult = SGLR_parse(inputString, getParseTableID());
  }
  else {
    ATerror("asc-main: parse table not loaded.");
  }

  if (parseResult != NULL) {
    return parseResult;
  }
  else {
    ATerror("asc-main: unknown error while parsing %s\n", filename);
    exit(1);
  }
  
  return NULL;
}