Example #1
0
    chfInt32     (myStruct, tval,    "t" , 1, 0),
    chfBoolean   (myStruct, flag,    "f" , 1, 0),
    chfTagInt32  (myStruct, ival,    "I" , tval, 1, 0, 0),
    chfTagBoolean(myStruct, flag,    "F" , tval, 2, 0, 0),
    chfTagDouble (myStruct, dval,    "D" , tval, 3, 1, 0),
    chfTagDouble (myStruct, dval,    "D2", tval, 4, 1, 0),
    chfTagEnum   (myStruct, enumval, "C" , tval, 5, 0, 0, colorEnum),
    chfPluginArgEnd
};

static const
chfPluginArgDef strictOpts[] = {
    chfInt32  (myStruct, ival,    "i" , 1, 0),
    chfBoolean(myStruct, flag,    "f" , 1, 0),
    chfDouble (myStruct, dval,    "d" , 1, 0),
    chfString (myStruct, str,     "s" , 1, 0),
    chfEnum   (myStruct, enumval, "c" , 1, 0, colorEnum),
    chfPluginArgEnd
};

static const
chfPluginArgDef noconvOpts[] = {
    chfInt32  (myStruct, ival,    "i" , 0, 0),
    chfBoolean(myStruct, flag,    "f" , 0, 0),
    chfDouble (myStruct, dval,    "d" , 0, 0),
    chfString (myStruct, str,     "s" , 0, 0),
    chfEnum   (myStruct, enumval, "c" , 0, 0, colorEnum),
    chfPluginArgEnd
};

static const
Example #2
0
};

typedef struct myStruct {
    syncMode mode;
    char state[STATE_NAME_LENGTH];
    dbStateId id;
    db_field_log *lastfl;
    int laststate:1;
} myStruct;

static void *myStructFreeList;

static const
chfPluginArgDef opts[] = {
    chfEnum      (myStruct, mode,  "m", 1, 1, modeEnum),
    chfString    (myStruct, state, "s", 1, 0),
    chfTagString (myStruct, state, "before", mode, 0, 1, 0),
    chfTagString (myStruct, state, "first",  mode, 1, 1, 0),
    chfTagString (myStruct, state, "last",   mode, 2, 1, 0),
    chfTagString (myStruct, state, "after",  mode, 3, 1, 0),
    chfTagString (myStruct, state, "while",  mode, 4, 1, 0),
    chfTagString (myStruct, state, "unless", mode, 5, 1, 0),
    chfPluginArgEnd
};

static void * allocPvt(void)
{
    myStruct *my = (myStruct*) freeListCalloc(myStructFreeList);
    return (void *) my;
}