- Timestamp:
- Feb 19, 2013, 8:28:55 PM (12 years ago)
- Branches:
- master, release-1.10
- Children:
- 353719a
- Parents:
- 6a20996
- git-author:
- Adam Glasgall <adam@crossproduct.net> (07/20/11 00:04:42)
- git-committer:
- David Benjamin <davidben@mit.edu> (02/19/13 20:28:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
owl.h
rc42a8d1 r06e04a9 235 235 char *name; 236 236 int type; /* OWL_VARIABLE_* */ 237 GValue gval_default; 238 const char *validsettings; /* documentation of valid settings */ 239 char *summary; /* summary of usage */ 240 char *description; /* detailed description */ 241 GValue val; /* current value */ 242 GClosure *validate_fn; 243 /* returns 1 if newval is valid */ 244 GClosure *set_fn; 245 /* sets the variable to a value 246 * of the appropriate type. 247 * unless documented, this 248 * should make a copy. 249 * returns 0 on success. */ 250 GClosure *set_fromstring_fn; 251 /* sets the variable to a value 252 * of the appropriate type. 253 * unless documented, this 254 * should make a copy. 255 * returns 0 on success. */ 256 GClosure *get_fn; 257 /* returns a reference to the current value. 258 * WARNING: this approach is hard to make 259 * thread-safe... */ 260 GClosure *get_tostring_fn; 261 /* converts val to a string; 262 * caller must free the result */ 263 GClosure *delete_fn; 264 /* frees val as needed */ 265 GClosure *get_default_fn; 266 /* return the default value, as set at creation time */ 267 268 } owl_variable; 269 270 typedef struct _owl_variable_init_params { 271 char *name; 272 int type; /* OWL_VARIABLE_* */ 237 273 void *pval_default; /* for types other and string */ 238 274 int ival_default; /* for types int and bool */ … … 241 277 char *description; /* detailed description */ 242 278 void *val; /* current value */ 243 int (*validate_fn)(const struct _owl_variable *v, const void *newval);279 GCallback validate_fn; 244 280 /* returns 1 if newval is valid */ 245 int (*set_fn)(struct _owl_variable *v, const void *newval);281 GCallback set_fn; 246 282 /* sets the variable to a value 247 283 * of the appropriate type. … … 249 285 * should make a copy. 250 286 * returns 0 on success. */ 251 int (*set_fromstring_fn)(struct _owl_variable *v, const char *newval);287 GCallback set_fromstring_fn; 252 288 /* sets the variable to a value 253 289 * of the appropriate type. … … 255 291 * should make a copy. 256 292 * returns 0 on success. */ 257 const void *(*get_fn)(const struct _owl_variable *v);293 GCallback get_fn; 258 294 /* returns a reference to the current value. 259 295 * WARNING: this approach is hard to make 260 296 * thread-safe... */ 261 CALLER_OWN char *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);297 GCallback get_tostring_fn; 262 298 /* converts val to a string; 263 299 * caller must free the result */ 264 void (*delete_fn)(struct _owl_variable *v);300 GCallback delete_fn; 265 301 /* frees val as needed */ 266 } owl_variable; 302 GCallback get_default_fn; 303 /* return the default value as set at creation time */ 304 } owl_variable_init_params; 305 267 306 268 307 typedef struct _owl_input { … … 614 653 #endif 615 654 655 /* We have to dynamically bind these ourselves */ 656 extern gboolean (*gvalue_from_sv) (GValue * value, SV * sv); 657 extern SV * (*sv_from_gvalue) (const GValue * value); 658 extern GClosure * (*perl_closure_new) (SV * callback, SV * data, gboolean swap); 659 660 616 661 #endif /* INC_BARNOWL_OWL_H */
Note: See TracChangeset
for help on using the changeset viewer.