Listing 3

piostruct.h

struct attrparms {      /* attribute parameter input to piogetvals() */
    char *name;             /* two-character attribute name (null terminated) */
    int  datatype;          /* date type of the attribute */
#define VAR_INT   1             /* variable integer */
#define VAR_STR   2             /* variable string */
    struct lktable *lktab;  /* pointer to lookup table (if NULL, use atoi()) */
    union dtypes            /* ptr to where piogetvals() is to store data ptr */
    {
        struct str_info *sinfo; /* pointer to pointer to str_info structure */
        int  *addr;             /* pointer to pointer to integer */
    } *types;
};

struct str_info {       /* string information */
    char *ptr;              /* pointer to string (string may contain nulls) */
    int  len;               /* current length of string */
};


struct lktable {        /* string-to-integer lookup table */
    char *str;              /* pointer to string value */
    int  value;             /* resulting integer value */
};
