Build Fix -- compatibility issue with newer autoconf
[sxemacs] / src / ent / ent-gaussian.h
1 /*
2   ent-gaussian.h -- Numeric types for SXEmacs
3   Copyright (C) 2005, 2006 Sebastian Freundt
4
5   Author:  Sebastian Freundt
6
7 This file is part of SXEmacs
8
9 SXEmacs is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 SXEmacs is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
21
22
23 #ifndef INCLUDED_number_gaussian_h_
24 #define INCLUDED_number_gaussian_h_
25
26 #ifdef UNO
27 /* Uno complains about several inline functions that include conditions with
28    assignments and side effects if we don't do this */
29 #undef __GNUC__
30 #endif
31
32 #if defined HAVE_GMP
33 # include "ent-gmp.h"
34 #elif defined HAVE_BSDMP
35 # include "ent-mp.h"
36 #else
37 # error "Sod it! You can't get here without my permission!"
38 #endif
39
40 struct bigg
41 {
42         bigz intg;
43         bigz imag;
44 };
45 typedef struct bigg bigg[1];
46
47 extern bigg ent_scratch_bigg;
48
49 \f
50 /******************************** Biggs ********************************/
51 struct Lisp_Bigg
52 {
53         struct lrecord_header lheader;
54         bigg data;
55 };
56 typedef struct Lisp_Bigg Lisp_Bigg;
57
58 DECLARE_LRECORD(bigg, Lisp_Bigg);
59 #define XBIGG(x) XRECORD(x, bigg, Lisp_Bigg)
60 #define wrap_bigg(p) wrap_object(p)
61 #define BIGGP(x) RECORDP(x, bigg)
62 #define CHECK_BIGG(x) CHECK_RECORD(x, bigg)
63 #define CONCHECK_BIGG(x) CONCHECK_RECORD(x, bigg)
64
65 #define bigg_data(f) ((f)->data)
66 #define XBIGG_DATA(x) bigg_data(XBIGG(x))
67
68 #define XBIGG_RE(x) bigg_re(XBIGG_DATA(x))
69 #define XBIGG_IM(x) bigg_im(XBIGG_DATA(x))
70
71 #define BIGG_ARITH_RETURN(f,op) do                                      \
72 {                                                                       \
73         Lisp_Object retval = make_bigg(0L, 0L);                         \
74         bigg_##op(XBIGG_DATA(retval), XBIGG_DATA(f));                   \
75         return retval;                                                  \
76 } while (0)
77
78 #define BIGG_ARITH_RETURN1(f,op,arg) do                                 \
79 {                                                                       \
80         Lisp_Object retval = make_bigg(0L, 0L);                         \
81         bigg_##op(XBIGG_DATA(retval), XBIGG_DATA(f), arg);              \
82         return retval;                                                  \
83 } while (0)
84
85 extern Lisp_Object make_bigg(long, long);
86 extern Lisp_Object make_bigg_bz(bigz, bigz);
87 extern Lisp_Object make_bigg_bg(bigg);
88
89 /***** Bigc: basic functions *****/
90 extern void bigg_init(bigg);
91 extern void bigg_fini(bigg);
92 extern unsigned long bigg_hashcode(bigg);
93
94 /***** Bigg: conversions *****/
95 extern Bufbyte *bigg_to_string(bigg, int);
96
97 /***** Bigg: converting assignments *****/
98 extern void bigg_set(bigg, bigg);
99 extern void bigg_set_long(bigg, long);
100 extern void bigg_set_ulong(bigg, unsigned long);
101 extern void bigg_set_bigz(bigg, bigz);
102 extern void bigg_set_long_long(bigg, long, long);
103 extern void bigg_set_ulong_ulong(bigg, unsigned long, unsigned long);
104 extern void bigg_set_bigz_bigz(bigg, bigz, bigz);
105
106 #define bigg_re(z)                  ((z)->intg)
107 #define bigg_im(z)                  ((z)->imag)
108
109 /***** Bigg: comparisons *****/
110 extern int bigg_eql(bigg, bigg);
111 #define bigg_cmp(f1,f2)             (bigg_eql(f1,f2) ? 0 : 1)
112
113 /***** Bigg: arithmetic *****/
114 extern void bigg_neg(bigg, bigg);
115 #if defined HAVE_MPFR && defined WITH_MPFR
116 extern void bigg_abs(bigfr, bigg);
117 #endif
118 extern void bigg_norm(bigz, bigg);
119 extern void bigg_conj(bigg, bigg);
120 extern void bigg_add(bigg, bigg, bigg);
121 extern void bigg_sub(bigg, bigg, bigg);
122 extern void bigg_mul(bigg, bigg, bigg);
123 extern void bigg_div(bigg, bigg, bigg);
124 extern void bigg_mod(bigg, bigg, bigg);
125 extern void bigg_pow(bigg, bigg, unsigned long);
126
127 extern Lisp_Object read_bigg_string(char *cp);
128
129 extern void init_optables_BIGG_T(void);
130 extern void init_ent_gaussian(void);
131 extern void syms_of_ent_gaussian(void);
132 extern void vars_of_ent_gaussian(void);
133
134 #endif /* INCLUDED_number_gaussian_h_ */