Ticket #14333: trac_14333-singular_function_interface.patch

File trac_14333-singular_function_interface.patch, 2.1 KB (added by Burcin Erocal, 9 years ago)
  • sage/libs/singular/function.pyx

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1380388844 -7200
    # Node ID feeab65b6de69376946cbe8b2da306c33a4f84ae
    # Parent  1d109fb5d9acac28e5d72ea0db338c63add533ec
    Update Singular function interface to API changes in Singular 3.1.6.
    
    iiMake_proc function in libsingular no longer returns an sleftv. Instead, the
    return value is a boolean error condition and the return value is stored in a
    global variable iiRETURNEXPR.
    
    diff --git a/sage/libs/singular/function.pyx b/sage/libs/singular/function.pyx
    a b  
    10351035
    10361036    cdef leftv* handle_call(self, Converter argument_list, ring *_ring=NULL):
    10371037        if _ring != currRing: rChangeCurrRing(_ring)
    1038         return iiMake_proc(self.proc_idhdl, NULL, argument_list.args)
     1038        cdef bint error = iiMake_proc(self.proc_idhdl, NULL, argument_list.args)
     1039        cdef leftv * res
     1040        if not error:
     1041            res = <leftv*> omAllocBin(sleftv_bin)
     1042            res.Init()
     1043            res.Copy(&iiRETURNEXPR)
     1044            iiRETURNEXPR.Init();
     1045            return res
     1046        raise RuntimeError("Error raised calling singular function")
    10391047       
    10401048    cdef bint free_res(self):
    10411049        """
  • sage/libs/singular/singular-cdefs.pxi

    diff --git a/sage/libs/singular/singular-cdefs.pxi b/sage/libs/singular/singular-cdefs.pxi
    a b  
    338338        void* data
    339339        #data is some union, so this might be very dangerous, but I am lazy now
    340340        attr *attribute
     341        void (* Copy)(leftv*)
    341342        void (* Init)()
    342343        void (* CleanUp)(ring *r)
    343344        int  rtyp
     
    953954    #
    954955    # INTERPRETER
    955956    #
     957    leftv iiRETURNEXPR
    956958
    957959    cdef omBin* sleftv_bin
    958960
     
    960962
    961963    idhdl* ggetid(char *n)
    962964
    963     leftv * iiMake_proc(idhdl *pn, package *pack, leftv *sl)
     965    bint iiMake_proc(idhdl *pn, package *pack, leftv *sl)
    964966   
    965967    bint iiExprArith1(leftv *res, leftv* a, int op)
    966968    bint iiExprArith2(leftv *res, leftv* a, int op, leftv *b, bint proc_call)