Chandra

 view release on metacpan or  search on metacpan

include/chandra/chandra.h  view on Meta::CPAN


                    /* Call the handler */
                    {
                        dSP;
                        int count;
                        ENTER; SAVETMPS;
                        PUSHMARK(SP);
                        XPUSHs(sv_2mortal(event));
                        PUTBACK;
                        count = call_sv(*handler_svp, G_SCALAR);
                        SPAGAIN;
                        if (count > 0) {
                            result = newSVsv(POPs);
                        }
                        PUTBACK;
                        FREETMPS; LEAVE;
                    }
                }
            }
        }
    }

    if (result == &PL_sv_undef) {
        ST(0) = &PL_sv_undef;
    } else {
        ST(0) = sv_2mortal(result);
    }
    XSRETURN(1);
}

/* ---- DragDrop static XS callback ---- */

static XS(XS_Chandra__DragDrop__dispatch_trampoline)
{
    dXSARGS;
    SV *dd_self = (SV *)CvXSUBANY(cv).any_ptr;
    SV *json_sv = (items > 0) ? ST(0) : &PL_sv_undef;

    if (!dd_self || !SvOK(dd_self) || !SvROK(dd_self)) {
        ST(0) = &PL_sv_undef;
        XSRETURN(1);
    }

    {
        dSP;
        ENTER; SAVETMPS;
        PUSHMARK(SP);
        XPUSHs(dd_self);
        XPUSHs(json_sv);
        PUTBACK;
        call_method("_dispatch", G_DISCARD | G_EVAL);
        if (SvTRUE(ERRSV))
            warn("DragDrop dispatch error: %s", SvPV_nolen(ERRSV));
        FREETMPS; LEAVE;
    }

    ST(0) = &PL_sv_undef;
    XSRETURN(1);
}

/* ---- ContextMenu static XS callback ---- */

static XS(XS_Chandra__ContextMenu__dispatch_trampoline)
{
    dXSARGS;
    SV *cm_self = (SV *)CvXSUBANY(cv).any_ptr;
    SV *json_sv = (items > 0) ? ST(0) : &PL_sv_undef;

    if (!cm_self || !SvOK(cm_self) || !SvROK(cm_self)) {
        ST(0) = &PL_sv_undef;
        XSRETURN(1);
    }

    {
        dSP;
        ENTER; SAVETMPS;
        PUSHMARK(SP);
        XPUSHs(cm_self);
        XPUSHs(json_sv);
        PUTBACK;
        call_method("_dispatch", G_DISCARD | G_EVAL);
        if (SvTRUE(ERRSV))
            warn("ContextMenu dispatch error: %s", SvPV_nolen(ERRSV));
        FREETMPS; LEAVE;
    }

    ST(0) = &PL_sv_undef;
    XSRETURN(1);
}

#endif /* CHANDRA_XS_IMPLEMENTATION */

#endif /* CHANDRA_H */



( run in 0.931 second using v1.01-cache-2.11-cpan-39bf76dae61 )