2 ent-gaussian.h -- Numeric types for SXEmacs
3 Copyright (C) 2005, 2006 Sebastian Freundt
5 Author: Sebastian Freundt
7 This file is part of SXEmacs
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.
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.
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/>. */
23 #ifndef INCLUDED_number_gaussian_h_
24 #define INCLUDED_number_gaussian_h_
27 /* Uno complains about several inline functions that include conditions with
28 assignments and side effects if we don't do this */
34 #elif defined HAVE_BSDMP
37 # error "Sod it! You can't get here without my permission!"
45 typedef struct bigg bigg[1];
47 extern bigg ent_scratch_bigg;
50 /******************************** Biggs ********************************/
53 struct lrecord_header lheader;
56 typedef struct Lisp_Bigg Lisp_Bigg;
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)
65 #define bigg_data(f) ((f)->data)
66 #define XBIGG_DATA(x) bigg_data(XBIGG(x))
68 #define XBIGG_RE(x) bigg_re(XBIGG_DATA(x))
69 #define XBIGG_IM(x) bigg_im(XBIGG_DATA(x))
71 #define BIGG_ARITH_RETURN(f,op) do \
73 Lisp_Object retval = make_bigg(0L, 0L); \
74 bigg_##op(XBIGG_DATA(retval), XBIGG_DATA(f)); \
78 #define BIGG_ARITH_RETURN1(f,op,arg) do \
80 Lisp_Object retval = make_bigg(0L, 0L); \
81 bigg_##op(XBIGG_DATA(retval), XBIGG_DATA(f), arg); \
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);
89 /***** Bigc: basic functions *****/
90 extern void bigg_init(bigg);
91 extern void bigg_fini(bigg);
92 extern unsigned long bigg_hashcode(bigg);
94 /***** Bigg: conversions *****/
95 extern Bufbyte *bigg_to_string(bigg, int);
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);
106 #define bigg_re(z) ((z)->intg)
107 #define bigg_im(z) ((z)->imag)
109 /***** Bigg: comparisons *****/
110 extern int bigg_eql(bigg, bigg);
111 #define bigg_cmp(f1,f2) (bigg_eql(f1,f2) ? 0 : 1)
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);
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);
127 extern Lisp_Object read_bigg_string(char *cp);
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);
134 #endif /* INCLUDED_number_gaussian_h_ */