Exemplo n.º 1
0
void flag_FPrint(FILE* File, FLAGSTORE Store)
/**************************************************************
  INPUT:   A File to print to, and a FlagStore.
  RETURNS: Nothing.
  EFFECT:  Prints the values of all flags to File.
***************************************************************/
{
  FLAG_ID  i;
  char name[30];
  
  fputs("list_of_settings(SPASS).{*", File);

  for (i = (FLAG_ID) 0; i < flag_MAXFLAG; i+= (FLAG_ID) 3) {
    sprintf(name,"set_flag(%s,%d).", flag_Name(i), flag_GetFlagValue(Store, i));
    fprintf(File,"\n %-30s",name);
    if (i+1 < flag_MAXFLAG) {
      sprintf(name,"set_flag(%s,%d).", flag_Name(i+ (FLAG_ID) 1), flag_GetFlagValue(Store, i+ (FLAG_ID) 1));
      fprintf(File," %-30s",name);
      if (i+2 < flag_MAXFLAG) {
	sprintf(name," set_flag(%s,%d).", flag_Name(i+ (FLAG_ID) 2), flag_GetFlagValue(Store, i+ (FLAG_ID) 2));
	fprintf(File," %-30s",name);
      }
    }
  }
  fputs("*}\nend_of_list.\n", File);
}
Exemplo n.º 2
0
BOOL cmdlne_SetFlags(FLAGSTORE flagstore)
/****************************************************************
  INPUT:   a FLAGSTORE
  RETURNS: TRUE if all arguments of <cmdlne_ArgumentsList> are 
           valid arguments and the respective flags of <flagstore>
	   could be set and FALSE otherwise.
  EFFECT:  Set flags of <flagstore> according to arguments stored in
  	   <cmdlne_ArgumentsList>
*****************************************************************/
{
	int id, tk;
	LIST Scan;	
	BOOL found;


	for(Scan=cmdlne_ArgumentsList; !list_Empty(Scan); Scan = list_Cdr(Scan)) 
	{
		found = FALSE;
		
		for (id=0; id < flag_GetMaxFlag() && !found; id++)
		{
		  if (!flag_IsUndefined(id) && string_Equal(flag_Name(id), 
					       (char*) list_PairFirst(list_Car(Scan))) )
	   		{
			  if (flag_IsOfValueType(id, flag_INTEGER)) {
			    if(!string_StringIsInteger(list_PairSecond(list_Car(Scan)))){
			        misc_StartUserErrorReport();
			        misc_UserErrorReport("\nError: Argument of option %s must be an integer.\n\n", flag_Name(id));
				misc_FinishUserErrorReport();
				return FALSE;
			    }
				tk = atoi((char*) list_PairSecond(list_Car(Scan)));
				flag_SetFlagIntValue(flagstore, id, tk);
			  }
			  else {
			    flag_SetFlagStringValue(flagstore, id, string_StringCopy((char*)list_PairSecond(list_Car(Scan))));
			  }
			  found = TRUE;
           		}
	   
		}
		
		if(!found) {
		  misc_StartUserErrorReport();
		  misc_UserErrorReport("\n Unrecognized option %s\n\n", (char*) list_PairFirst(list_Car(Scan)));
		  misc_FinishUserErrorReport();
		  return FALSE;
		}
		
	}
	return TRUE;
}
Exemplo n.º 3
0
FLAG_ID flag_Id(const char* String)
/**************************************************************
  INPUT:   A string <String>.
  RETURNS: The identification of the flag <String> if it exists
           -1 otherwise.
***************************************************************/
{
  FLAG_ID i;

  for (i = (FLAG_ID) 0; i < flag_MAXFLAG; i++)
    if (string_Equal(flag_Name(i), String))
      return i;

  return (FLAG_ID) -1;
}
Exemplo n.º 4
0
void cmdlne_PrintSPASSNames()
/**************************************************************
  INPUT:   None 
  RETURNS: Nothing
  EFFECT:  Prints all options in three rows
***************************************************************/
{
  int i,j;
  
  for (i=0; i < flag_GetMaxFlag(); i=i+4) { 
    for (j =0; j <=3; j++) 
      if (i+j < flag_GetMaxFlag() && !flag_IsUndefined(i+j)) {
	printf("%-18s ", flag_Name(i+j)); 
      } 
    putchar('\n');
  }
}