Exemple #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
chfPluginArgDef sloppyOpts[] = {
Exemple #2
0
typedef struct myStruct {
    int    mode;
    double cval;
    double hyst;
    double last;
} myStruct;

static void *myStructFreeList;

static const
chfPluginEnumType modeEnum[] = { {"abs", 0}, {"rel", 1}, {NULL,0} };

static const
chfPluginArgDef opts[] = {
    chfDouble    (myStruct, cval, "d", 0, 1),
    chfEnum      (myStruct, mode, "m", 0, 1, modeEnum),
    chfTagDouble (myStruct, cval, "abs", mode, 0, 0, 1),
    chfTagDouble (myStruct, cval, "rel", mode, 1, 0, 1),
    chfPluginArgEnd
};

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

static void freePvt(void *pvt)
{
    freeListFree(myStructFreeList, pvt);
}