// Lookup or create a univariate polynomial ring with a named variable over r.
extern const cl_univpoly_ring find_univpoly_ring (const cl_ring& r, const cl_symbol& varname);
-CL_REQUIRE(cl_UP)
+class cl_UP_init_helper
+{
+ static int count;
+public:
+ cl_UP_init_helper();
+ ~cl_UP_init_helper();
+};
+static cl_UP_init_helper cl_UP_init_helper_instance;
// Operations on polynomials.
// General includes.
#include "cl_sysdep.h"
-CL_PROVIDE(cl_UP)
-
// Specification.
#define CL_GV_NO_RANGECHECKS
#define CL_SV_NO_RANGECHECKS
(*(cl_heap_univpoly_ring*)pointer).~cl_heap_univpoly_ring();
}
-cl_class cl_class_univpoly_ring = {
- cl_univpoly_ring_destructor,
- cl_class_flags_univpoly_ring
-};
+cl_class cl_class_univpoly_ring;
+
+int cl_UP_init_helper::count = 0;
+
+cl_UP_init_helper::cl_UP_init_helper()
+{
+ if (count++ == 0) {
+ cl_class_univpoly_ring.destruct = cl_univpoly_ring_destructor;
+ cl_class_univpoly_ring.flags = cl_class_flags_univpoly_ring;
+ }
+}
+
+cl_UP_init_helper::~cl_UP_init_helper()
+{
+ if (--count == 0) {
+ // nothing to clean up
+ }
+}
cl_heap_univpoly_ring::cl_heap_univpoly_ring (const cl_ring& r, cl_univpoly_setops* setopv, cl_univpoly_addops* addopv, cl_univpoly_mulops* mulopv, cl_univpoly_modulops* modulopv, cl_univpoly_polyops* polyopv)
: setops (setopv), addops (addopv), mulops (mulopv), modulops (modulopv), polyops (polyopv),
} // namespace cln
-CL_PROVIDE_END(cl_UP)