• Antelope Release 5.9 Mac OS X 10.13.2 2019-05-01

 

NAME

pf2struc - convert parameter file object into a C structure

SYNOPSIS

#include "brttutil.h"

int
pf2struc (Pf *pf, int ndefs, Pf2strucDefs *defs, void *struc)

DESCRIPTION

This is an interface to a parameter file object (see pf(3)) that will parse all or parts of a parameter file object into a C structure. It uses the parse_param(3) utility for parsing the individual elements of the parameter file object.

The parameter file object to be parsed is specified in pf. The C structure that will contain the results is referenced by struc. It is the responsibility of the user to allocate and initialize the C structure before calling this subroutine. The structure definition is specified through an array of ndefs PfstrucDefs structures oin a single linear array referenced by defs. The Pf2strucDefs structures are defined here:


typedef struct pf2struc_def_ {
       char *name;        /* pf name */
       int pftype;        /* pf type, same as parse_param(3) */
       int required;      /* if set, then this parameter is required */
       int struc_offset;  /* byte offset to the parameter in the C structure */
} Pf2strucDef;

RETURN VALUES

parse_param returns 0 if OK or -1 if there is an error. If there is an error, then messages are left on the error register.

LIBRARY

-lbrttutil

SEE ALSO

parse_param(3)

BUGS AND CAVEATS

Currently this utility can only handle scalar strings, ints and doubles.

AUTHOR

Danny Harvey
Printer icon