#include "options.h"

This page has information from files options.h and options.c.

Contents


Public Routines in File options.c

Index

assign_parmfprint_optionsnext_available_flag_idparm_id_to_str
clear_flaginit_flagnext_available_parm_idset_flag
flaginit_optionsp_optionsstr_to_flag_id
flag_id_to_strinit_parmparmstr_to_parm_id

Details


void assign_parm(int id, int val);
This routine assigns a value to a parm. The parm is identified by its integer ID (which is available from str_to_parm_id()). If the ID is not valid, or if the value is out of range, a fatal error occurs.
void clear_flag(int id);
This routine clears a flag. The flag is identified by its integer ID (which is available from str_to_flag_id()). If the ID is not valid, a fatal error occurs.
int flag(int flag_id);
This Boolean routine returns the value of a flag. If the Flag index is out of range, bad things can happen.
char *flag_id_to_str(int id);
Given a flag ID, return the corresponding name of the flag.
void fprint_options(FILE *fp);
This routine prints (to FILE *fp) the current values of all of the the flags and parameters.
void init_flag(int flag_id,
	       char *flag_name,
	       BOOL default_value);

void init_options(void);
This routine initializes all of the flags and parameters. It should be called once at the beginning of the process, before doing any options operations.
void init_parm(int parm_id,
	       char *parm_name,
	       int default_value,
	       int min_value,
	       int max_value);

int next_available_flag_id(void);
If you're not sure what flag IDs have already been claimed, for example if you're adding options to an existing program, you can use this function to find an available one. Return -1 if none is available.
int next_available_parm_id(void);
If you're not sure what parm IDs have already been claimed, for example if you're adding options to an existing program, you can use this function to find an available one. Return -1 if none is available.
void p_options(void);
This routine prints (to stdout) the current values of the the flags and parameters.
int parm(int parm_id);
This integer routine returns the value of a parameter. If the parm index is out of range, bad things can happen.
char *parm_id_to_str(int id);
Given a parm ID, return the corresponding name of the parm.
void set_flag(int id);
This routine sets a flag. The flag is identified by its integer ID (which is available from str_to_flag_id()). If the ID is not valid, a fatal error occurs.
int str_to_flag_id(char *flag_name);
This routine converts the string name of a flag to its integer ID. If the string name is not valid, -1 is returned.
int str_to_parm_id(char *parm_name);
This routine converts the string name of a parm to its integer ID. If the string name is not valid, -1 is returned.

Public Definitions in File options.h

#define MAX_FLAGS                100
#define MAX_PARMS                100


Introduction

There are two kinds of options: Flags and Parms. Flags are Boolean valued, and Parms are integer valued.

To introduce a new flag or parm,


These activities are projects of the Mathematics and Computer Science Division of Argonne National Laboratory.