Ejemplo n.º 1
0
/**
 * Cast the element to a function call.
 * 
 * @param element The element to attempt to cast.
 * @param success True if successful cast, false otherwise.
 * @return the function call casted if successful, empty call otherwise.
 */
Funcall CastToFuncall(Element const& element, bool& success)
{
    Element_* element_ = const_cast<Element_*>(element.ElementHandle());
    Funcall_* funcall = dynamic_cast<Funcall_*>(element_);
    success = (0 != funcall);
    return success ? Funcall(funcall, element.GetSourceLocation()) : Funcall();
}
Ejemplo n.º 2
0
/**
 * Cast the element to a function call.
 * 
 * @param element The element to attempt to cast.
 * @param success True if successful cast, false otherwise.
 * @return the function call casted if successful, empty call otherwise.
 */
Funcall CastToFuncall(Element const& element, bool& success)
{
    std::shared_ptr<Element_> element_ = element.ElementHandle();
    std::shared_ptr<Funcall_> funcall = std::dynamic_pointer_cast<Funcall_>(element_);
    success = (0 != funcall.get());
    return success ? Funcall(funcall, element.GetSourceLocation()) : Funcall();
}
Ejemplo n.º 3
0
void Action_Hook (Widget w, XtPointer client_data, char *name, XEvent *ep,
                  char **argv, int *argc) {
    ACTION *ap;
    Object args, params, tail;
    register int i;
    GC_Node3;

    for (ap = actions; ap; ap = ap->next) {
        if (strcmp (ap->name, name))
            continue;
        args = params = tail = Null;
        GC_Link3 (args, params, tail);
        params = P_Make_List (Make_Integer (*argc), Null);
        for (i = 0, tail = params; i < *argc; tail = Cdr (tail), i++) {
            Object tmp;

            tmp = Make_String (argv[i], strlen (argv[i]));
            Car (tail) = tmp;
        }
        args = Cons (params, Null);
        params = Get_Event_Args (ep);
        args = Cons (Copy_List (params), args);
        Destroy_Event_Args (params);
        args = Cons (Make_Widget_Foreign (w), args);
        (void)Funcall (Get_Function (ap->num), args, 0);
        GC_Unlink;
    }
}