ESO Recipe Execution Tool  3.13
Functions
EsoRex Parameter Utility Functions

Functions

void er_paramutils_tilde_convert (cpl_parameterlist *param_list)
 Replaces any tilde in parameters within a parameter list. More...
 
void er_paramutils_print_key_desc (const char *flag_prefix, const char *keyword, const char *description)
 Neatly print a parameter and its description. More...
 
int er_manage_sources (const int flag, const char *name, char **source)
 Manage buffer of sources of all used parameters (Esorex + recipes) More...
 
void er_paramutils_print_aux_info (const char *flag_prefix, const char *keyword, const char *description)
 Neatly print auxiliary information for a parameter. More...
 
int er_paramutils_print_list (cpl_parameterlist *param_list, const char *header)
 Pretty-print a parameter list with a given header text. More...
 
int paramutils_set_from_string (cpl_parameter *p, const char *value, const char *source)
 Set the value of a parameter from that of a given string. More...
 

Detailed Description

EsoRex Parameter Utility Functions

Function Documentation

int er_manage_sources ( const int  flag,
const char *  name,
char **  source 
)

Manage buffer of sources of all used parameters (Esorex + recipes)

Parameters
flagControl flag: = 1, for given param. save source in internal buffer = 2, for given param. pull out source from internal buffer = 3, free allocated memory
nameName of parameter
sourcedesription of source of a param. maybe "default", config-file name, "command line", etc

This function manages a buffer of sources of all used parameters in Esorex + all called recipes. Max MAX_SRC can be handled, i.e. for at most MAX_SRC different params. Esorex has already 25 parameters... Max length of parameter name is PAR_LEN chars.

void er_paramutils_print_aux_info ( const char *  flag_prefix,
const char *  keyword,
const char *  description 
)

Neatly print auxiliary information for a parameter.

Parameters
flag_prefixThis is the prefix used to flag certain types of switches/parameters. For example a double hypen "--" may be used before the long form of command line options. It is only used for spacing.
keywordThis is the keyword itself. It is only used for spacing.
descriptionThis is the descriptive text that is to be printed. It is aligned to a tab stop to ensure that the output is neat.

This function neatly prints an auxiliary line of information regarding a parameter. The infomation is printed to the normal output stream. The formatting is handled automatically to get neat alignment of the output.

void er_paramutils_print_key_desc ( const char *  flag_prefix,
const char *  keyword,
const char *  description 
)

Neatly print a parameter and its description.

Parameters
flag_prefixThis is the prefix used to flag certain types of switches/parameters. For example a double hypen "--" may be used before the long form of command line options.
keywordThis is the keyword itself. It is appended to the flag-prefix, if any.
descriptionThis is the descriptive text that follows the keyword. It is put at a tab-stop, so that all the descriptions are neatly aligned.

This function neatly prints a keyword and its associated description to the normal output channel. The formatting is handled automatically to get neat alignment of the output.

int er_paramutils_print_list ( cpl_parameterlist *  param_list,
const char *  header 
)

Pretty-print a parameter list with a given header text.

Parameters
param_listList of Parameters
headerHeader Text
Returns
Zero on sucess, or non-zero in the case of error.

This function takes a parameter list, and a title and prints them. The function makes use of the COMMENT_TAB_POSITION constant that is defined in er_macros.h .

void er_paramutils_tilde_convert ( cpl_parameterlist *  param_list)

Replaces any tilde in parameters within a parameter list.

Parameters
param_listList of Parameters
Returns
None

Function searches param_list for parameters whose values begin with a tilde (~) and if found, replace the tilde with the user's home directory (using the $HOME environment variable).

int paramutils_set_from_string ( cpl_parameter *  p,
const char *  value,
const char *  source 
)

Set the value of a parameter from that of a given string.

Parameters
pParameter that will have its value set.
valueA string containing the value to be assigned to the parameter.
sourceThe source of value
Returns
0 if successfull, !=0 otherwise

Function sets the current value of the given parameter. Converts the string value to the necessary type if needed.