Changeset 4584d1f for owl.h


Ignore:
Timestamp:
Feb 21, 2013, 4:42:20 PM (8 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master
Children:
1a4508b
Parents:
3b9ca71
git-author:
David Benjamin <davidben@mit.edu> (06/10/12 15:04:10)
git-committer:
David Benjamin <davidben@mit.edu> (02/21/13 16:42:20)
Message:
Pipe all C-created variables through function calls

Gets us some long-overdue type checking in the various type-specific
callbacks.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.h

    r3b9ca71 r4584d1f  
    266266                                 * returns 0 on success. */
    267267} owl_variable;
    268 
    269 typedef struct _owl_variable_init_params {
    270   const char *name;
    271   int   type;  /* OWL_VARIABLE_* */
    272   const char *pval_default;     /* for string */
    273   int   ival_default;           /* for types int and bool     */
    274   const char *validsettings;    /* documentation of valid settings */
    275   const char *summary;          /* summary of usage */
    276   const char *description;      /* detailed description */
    277   void *val;                    /* current value */
    278   GCallback validate_fn;
    279                                 /* returns 1 if newval is valid */
    280   GCallback set_fn;
    281                                 /* sets the variable to a value
    282                                  * of the appropriate type.
    283                                  * unless documented, this
    284                                  * should make a copy.
    285                                  * returns 0 on success. */
    286   GCallback set_fromstring_fn;
    287                                 /* sets the variable to a value
    288                                  * of the appropriate type.
    289                                  * unless documented, this
    290                                  * should make a copy.
    291                                  * returns 0 on success. */
    292   GCallback get_fn;
    293                                 /* returns a reference to the current value.
    294                                  * WARNING:  this approach is hard to make
    295                                  * thread-safe... */
    296   GCallback get_tostring_fn;
    297                                 /* converts val to a string;
    298                                  * caller must free the result */
    299 } owl_variable_init_params;
    300268
    301269
Note: See TracChangeset for help on using the changeset viewer.