next up previous contents
Next: Sample Use from cscf Up: The Input Parser Previous: Source Files   Contents

Syntax

ip_cwk.cc

void ip_cwk_clear();
Clears current working keyword. Used when initializing input or switching from one section to another (:DEFAULT and :CSCF to :INTCO, for instance).

void ip_cwk_add(char *kwd);
Adds kwd to the list of current working keywords. Allows parsing of variables under that keyword out of the input file (files) which has (have) been read or will be read in the future using ip_append. The keyword kwd can only be removed from the list of current working keywords by purging the entire list using ip_cwk_clear. You must ensure that they keyword strings begin with a colon.

ip_data.cc

int ip_count(char *kwd, int *count, int n);
Counts the elements in the n'th element of the array kwd.

int ip_boolean(char *kwd, int *bool, int n);
Parses n'th element of kwd as boolean (true, 1, yes; false, 0, no) into 1 or 0 returned in bool.

int ip_exist(char *kwd, int n);
Returns 1 if n'th element of kwd exists. Unfortunately, n must be 0.

int ip_data(char *kwd, char *conv, void *value, int n [, int o1, ..., int on]);
Looks for keyword kwd, finds the value associated with it, converts it according to the format specification given in conv, and stores the result in value. Note that value is a void * so this routine can handle any data type, but it is the programmer's responsibility to ensure that the pointer passed to this routine is of the appropriate pointer type for the data. The value found by the input parser depends on the value of n and any optional additional arguments. n is the number of additional arguments. If n is 0, then there are no additional arguments, and the keyword has only one value associated with it. If the keyword has an array associated with it, then n is 1 and the one additional argument is which element of the array to pick. If kwd specifies an array of arrays, then n is 2, the first additional argument is the number of the first array, and the second argument is the number of the element within that array, etc. Deep in here, the code calls a sscanf(read, conv, value);, so that's the real meaning of variables.

int ip_string(char *kwd, char **value, int n, [int o1, ..., int on]);
Parses the string associated with kwd stores it in value. The role of n and optional arguments is the same as that described above for ip_data().

int ip_value(char *kwd, ip_value_t **ip_val, int n);
Grabs the section of keyword tree at kwd and stores it in ip_val for the programmer's use - this is usually not used, since you need to understand the structure of ip_value_t.

int ip_int_array(char *kwd, int *arr, int n);
Reads n integers into array arr.

ip_read.cc

void ip_set_uppercase(int uc);
Sets parsing to case sensitive if uc==0, I think.

void ip_initialize(FILE *in, FILE *out);
Calls yyparse(); followed by ip_cwk_clear(); followed by ip_internal_values();. This routine reads the entire input deck and stores it into the keyword tree for access later.

void ip_append(FILE *in, FILE *out);
Same thing as ip_initialize();, except this doesn't clear the cwk first. Used for parsing another input file, such as intco.dat.

void ip_done();
Frees up the keyword tree.

ip_read.cc

void ip_print_tree(FILE *out, ip_keyword_tree_t *tree);
Prints out tree to out. If tree is set to NULL, then the current working keyword tree will be printed out. This function is useful for debugging problems with parsing.


next up previous contents
Next: Sample Use from cscf Up: The Input Parser Previous: Source Files   Contents
sherrill 2008-02-13