Changeset acef4ad9


Ignore:
Timestamp:
Feb 26, 2013, 2:00:48 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
fbe04c6
Parents:
230e8ff
git-author:
David Benjamin <davidben@mit.edu> (02/25/13 17:19:40)
git-committer:
David Benjamin <davidben@mit.edu> (02/26/13 14:00:48)
Message:
Add BarnOwl::get_variable_info

Returns a dictionary about a given variable.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • perlglue.xs

    r3b9ca71 racef4ad9  
    359359                RETVAL
    360360
     361SV *
     362get_variable_info(name)
     363        const char *name;
     364        PREINIT:
     365                owl_variable *var;
     366                HV *h;
     367        CODE:
     368                var = owl_variable_get_var(owl_global_get_vardict(&g), name);
     369                if (var == NULL) {
     370                        croak("No such variable");
     371                }
     372                h = newHV();
     373                (void)hv_store(h, "name", strlen("name"),
     374                               owl_new_sv(owl_variable_get_name(var)), 0);
     375                (void)hv_store(h, "description", strlen("description"),
     376                               owl_new_sv(owl_variable_get_description(var)),
     377                               0);
     378                (void)hv_store(h, "summary", strlen("summary"),
     379                               owl_new_sv(owl_variable_get_summary(var)), 0);
     380                (void)hv_store(h, "validsettings", strlen("validsettings"),
     381                               owl_new_sv(owl_variable_get_validsettings(var)),
     382                               0);
     383                (void)hv_store(h, "takes_on_off", strlen("takes_on_off"),
     384                               newSViv(owl_variable_takes_on_off(var)), 0);
     385                RETVAL = newRV_noinc((SV*)h);
     386        OUTPUT:
     387                RETVAL
     388
    361389
    362390MODULE = BarnOwl                PACKAGE = BarnOwl::Zephyr
  • variable.c

    r230e8ff racef4ad9  
    802802}
    803803
     804bool owl_variable_takes_on_off(const owl_variable *v) {
     805  return v->takes_on_off;
     806}
     807
    804808int owl_variable_get_type(const owl_variable *v)
    805809{
Note: See TracChangeset for help on using the changeset viewer.