Chandra
view release on metacpan or search on metacpan
xs/shortcut.xs view on Meta::CPAN
(void)hv_stores(hv, "_dispatch_bound", newSViv(1));
}
}
}
SvREFCNT_dec(norm_combo);
RETVAL = SvREFCNT_inc(self);
}
OUTPUT:
RETVAL
# ---- unbind($combo) ----
SV *
unbind(self, combo_sv)
SV *self
SV *combo_sv
CODE:
{
HV *hv = (HV *)SvRV(self);
SV **bindings_svp;
SV *norm_combo;
const char *norm_str;
STRLEN norm_len;
/* Normalize combo */
{
dSP;
int count;
ENTER; SAVETMPS;
PUSHMARK(SP);
XPUSHs(self);
XPUSHs(combo_sv);
PUTBACK;
count = call_method("_normalize_combo", G_SCALAR);
SPAGAIN;
norm_combo = (count > 0) ? newSVsv(POPs) : newSVsv(combo_sv);
PUTBACK;
FREETMPS; LEAVE;
}
norm_str = SvPV(norm_combo, norm_len);
bindings_svp = hv_fetchs(hv, "bindings", 0);
if (bindings_svp && SvROK(*bindings_svp)) {
HV *bindings_hv = (HV *)SvRV(*bindings_svp);
(void)hv_delete(bindings_hv, norm_str, norm_len, G_DISCARD);
}
SvREFCNT_dec(norm_combo);
RETVAL = SvREFCNT_inc(self);
}
OUTPUT:
RETVAL
# ---- list() - return array of hashrefs ----
void
list(self)
SV *self
PPCODE:
{
HV *hv = (HV *)SvRV(self);
SV **bindings_svp;
bindings_svp = hv_fetchs(hv, "bindings", 0);
if (bindings_svp && SvROK(*bindings_svp)) {
HV *bindings_hv = (HV *)SvRV(*bindings_svp);
HE *entry;
hv_iterinit(bindings_hv);
while ((entry = hv_iternext(bindings_hv)) != NULL) {
SV *val = HeVAL(entry);
if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) {
HV *ehv = (HV *)SvRV(val);
HV *result = newHV();
SV **tmp;
(void)hv_stores(result, "combo",
newSVhek(HeKEY_hek(entry)));
tmp = hv_fetchs(ehv, "handler", 0);
if (tmp) (void)hv_stores(result, "handler", newSVsv(*tmp));
tmp = hv_fetchs(ehv, "enabled", 0);
(void)hv_stores(result, "enabled",
newSViv(tmp ? SvIV(*tmp) : 1));
tmp = hv_fetchs(ehv, "prevent_default", 0);
(void)hv_stores(result, "prevent_default",
newSViv(tmp ? SvIV(*tmp) : 0));
XPUSHs(sv_2mortal(newRV_noinc((SV *)result)));
}
}
}
}
# ---- is_bound($combo) ----
SV *
is_bound(self, combo_sv)
SV *self
SV *combo_sv
CODE:
{
HV *hv = (HV *)SvRV(self);
SV **bindings_svp;
SV *norm_combo;
const char *norm_str;
STRLEN norm_len;
/* Normalize combo */
{
dSP;
int count;
ENTER; SAVETMPS;
PUSHMARK(SP);
XPUSHs(self);
XPUSHs(combo_sv);
PUTBACK;
( run in 0.621 second using v1.01-cache-2.11-cpan-71847e10f99 )