From 11da511c784eca003deb90c23570f0873954e0de Mon Sep 17 00:00:00 2001 From: Duncan Wilkie Date: Sat, 18 Nov 2023 06:11:09 -0600 Subject: Initial commit. --- ic-reals-6.3/math-lib/init.c | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 ic-reals-6.3/math-lib/init.c (limited to 'ic-reals-6.3/math-lib/init.c') diff --git a/ic-reals-6.3/math-lib/init.c b/ic-reals-6.3/math-lib/init.c new file mode 100644 index 0000000..be3e6ec --- /dev/null +++ b/ic-reals-6.3/math-lib/init.c @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2000, Imperial College + * + * This file is part of the Imperial College Exact Real Arithmetic Library. + * See the copyright notice included in the distribution for conditions + * of use. + */ + +#include +#include "real.h" +#include "real-impl.h" +#include "math-lib.h" + +/* + * Temporary storage for use in the math library + */ +mpz_t tmpw_z, tmpx_z, tmpy_z, tmpz_z; + +Real E; + +void +initReals() +{ + void initRealBase(); + void stdTensorCont(); + void failCls(); + + initRealBase(); + + mpz_init(tmpw_z); + mpz_init(tmpx_z); + mpz_init(tmpy_z); + mpz_init(tmpz_z); + + registerForceFunc(stdTensorCont, "stdTensorCont", 2); + registerForceFunc(failCls, "failCls", 2); + + initPi(); + E = exp_QInt(1, 1); /* there is better way but this will come later */ +} + +Real +realError(char *p) +{ + void failCls(); + Cls *cls; + + cls = allocCls(failCls, (void *) p); + cls->tag.isSigned = FALSE; + + return (Real) cls; +} + +void +failCls() +{ + Cls *cls; + char *p; + + cls = (Cls *) POP; + p = (char *) cls->userData; + + if (p != NULL) + Error(FATAL, E_INT, "failCls", p); + else + Error(FATAL, E_INT, "failCls", "failure closure activated"); +} -- cgit v1.2.3