diff --git a/deps/src/singular.cpp b/deps/src/singular.cpp index bb1e10c8e..d063b81ed 100644 --- a/deps/src/singular.cpp +++ b/deps/src/singular.cpp @@ -206,6 +206,72 @@ JLCXX_MODULE define_julia_module(jlcxx::Module & Singular) } return old_value; }); + // all of the global setters return the previous value + Singular.method("set_option", [](std::string opt, bool value, ring r) { + bool old_value = false; + ring oldring=currRing; + if (r!=NULL) rChangeCurrRing(r); + if (false) + ; + SETTER(si_opt_2, V_QUIET) + SETTER(si_opt_2, V_QRING) + SETTER(si_opt_2, V_SHOW_MEM) + SETTER(si_opt_2, V_YACC) + SETTER(si_opt_2, V_REDEFINE) + SETTER(si_opt_2, V_LOAD_LIB) + SETTER(si_opt_2, V_DEBUG_LIB) + SETTER(si_opt_2, V_LOAD_PROC) + SETTER(si_opt_2, V_DEF_RES) + SETTER(si_opt_2, V_SHOW_USE) + SETTER(si_opt_2, V_IMAP) + SETTER(si_opt_2, V_PROMPT) + SETTER(si_opt_2, V_NSB) + SETTER(si_opt_2, V_CONTENTSB) + SETTER(si_opt_2, V_CANCELUNIT) + SETTER(si_opt_2, V_MODPSOLVSB) + SETTER(si_opt_2, V_UPTORADICAL) + SETTER(si_opt_2, V_FINDMONOM) + SETTER(si_opt_2, V_COEFSTRAT) + SETTER(si_opt_2, V_IDLIFT) + SETTER(si_opt_2, V_LENGTH) + SETTER(si_opt_2, V_ALLWARN) + SETTER(si_opt_2, V_INTERSECT_ELIM) + SETTER(si_opt_2, V_INTERSECT_SYZ) + SETTER(si_opt_2, V_DEG_STOP) + + SETTER(si_opt_1, OPT_PROT) + SETTER(si_opt_1, OPT_REDSB) + SETTER(si_opt_1, OPT_NOT_BUCKETS) + SETTER(si_opt_1, OPT_NOT_SUGAR) + SETTER(si_opt_1, OPT_INTERRUPT) + SETTER(si_opt_1, OPT_SUGARCRIT) + SETTER(si_opt_1, OPT_DEBUG) + SETTER(si_opt_1, OPT_REDTHROUGH) + SETTER(si_opt_1, OPT_NO_SYZ_MINIM) + SETTER(si_opt_1, OPT_RETURN_SB) + SETTER(si_opt_1, OPT_FASTHC) + SETTER(si_opt_1, OPT_OLDSTD) + SETTER(si_opt_1, OPT_STAIRCASEBOUND) + SETTER(si_opt_1, OPT_MULTBOUND) + SETTER(si_opt_1, OPT_DEGBOUND) + SETTER(si_opt_1, OPT_REDTAIL) + SETTER(si_opt_1, OPT_INTSTRATEGY) + SETTER(si_opt_1, OPT_FINDET) + SETTER(si_opt_1, OPT_INFREDTAIL) + SETTER(si_opt_1, OPT_SB_1) + SETTER(si_opt_1, OPT_NOTREGULARITY) + SETTER(si_opt_1, OPT_WEIGHTM) + else + { + std::cerr << "unknown option " << opt << std::endl; + } + if (r!=NULL) + { + r->options=si_opt_1; + rChangeCurrRing(oldring); + } + return old_value; + }); #undef SETTER diff --git a/src/ideal/ideal.jl b/src/ideal/ideal.jl index c5189b985..e2e8e15b0 100644 --- a/src/ideal/ideal.jl +++ b/src/ideal/ideal.jl @@ -847,12 +847,12 @@ from the identity matrix only for local ring orderings. function divrem(I::sideal{S}, G::sideal{S}; complete_reduction::Bool = false) where S <: SPolyUnion check_parent(I, G) R = base_ring(I) - old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction) - old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction) + old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction,R.ptr) + old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction,R.ptr) ptr_T,ptr_Rest,ptr_U = GC.@preserve I G R libSingular.id_Lift(G.ptr, I.ptr, true, false, true, R.ptr) - libSingular.set_option("OPT_REDSB",old_redsb) - libSingular.set_option("OPT_REDTAIL",old_redtail) + libSingular.set_option("OPT_REDSB",old_redsb,R.ptr) + libSingular.set_option("OPT_REDTAIL",old_redtail,R.ptr) return (smodule{S}(R,ptr_T), sideal{S}(R,ptr_Rest), smodule{S}(R,ptr_U)) end diff --git a/src/module/module.jl b/src/module/module.jl index a2de68882..fd7c9c3b4 100644 --- a/src/module/module.jl +++ b/src/module/module.jl @@ -274,12 +274,12 @@ from the identity matrix only for local ring orderings. function divrem(I::smodule{S}, G::smodule{S}; complete_reduction::Bool = false) where S <: SPolyUnion check_parent(I, G) R = base_ring(I) - old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction) - old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction) + old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction,R.ptr) + old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction,R.ptr) ptr_T,ptr_Rest,ptr_U = GC.@preserve I G R libSingular.id_Lift(G.ptr, I.ptr, true, false, true, R.ptr) - libSingular.set_option("OPT_REDSB",old_redsb) - libSingular.set_option("OPT_REDTAIL",old_redtail) + libSingular.set_option("OPT_REDSB",old_redsb,R.ptr) + libSingular.set_option("OPT_REDTAIL",old_redtail,R.ptr) return (smodule{S}(R,ptr_T), smodule{S}(R,ptr_Rest), smodule{S}(R,ptr_U)) end