[PATCH 12/20] Convert the mpq subdirectory to __GMP_*_DEFINE and include changes
Richard Henderson
rth at twiddle.net
Mon Mar 4 19:41:42 CET 2013
---
mpq/abs.c | 3 +--
mpq/aors.c | 3 ++-
mpq/canonicalize.c | 2 +-
mpq/clear.c | 2 +-
mpq/clears.c | 11 +----------
mpq/cmp.c | 3 +--
mpq/cmp_si.c | 2 +-
mpq/cmp_ui.c | 2 +-
mpq/div.c | 2 +-
mpq/equal.c | 2 +-
mpq/get_d.c | 4 +---
mpq/get_den.c | 2 +-
mpq/get_num.c | 2 +-
mpq/get_str.c | 5 +----
mpq/init.c | 2 +-
mpq/inits.c | 11 +----------
mpq/inp_str.c | 4 +---
mpq/inv.c | 2 +-
mpq/md_2exp.c | 4 ++--
mpq/mul.c | 2 +-
mpq/neg.c | 3 +--
mpq/out_str.c | 3 +--
mpq/set.c | 2 +-
mpq/set_d.c | 9 +--------
mpq/set_den.c | 2 +-
mpq/set_f.c | 3 +--
mpq/set_num.c | 2 +-
mpq/set_si.c | 2 +-
mpq/set_str.c | 4 +---
mpq/set_ui.c | 2 +-
mpq/set_z.c | 2 +-
mpq/swap.c | 2 +-
32 files changed, 34 insertions(+), 72 deletions(-)
diff --git a/mpq/abs.c b/mpq/abs.c
index 3f0caeb..7dec9ee 100644
--- a/mpq/abs.c
+++ b/mpq/abs.c
@@ -18,8 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpq_abs 1
-
-#include "gmp.h"
#include "gmp-impl.h"
@@ -43,3 +41,4 @@ mpq_abs (mpq_ptr dst, mpq_srcptr src)
SIZ(NUM(dst)) = num_abs_size;
}
+__GMP_PUBLIC_DEFINE (mpq_abs)
diff --git a/mpq/aors.c b/mpq/aors.c
index 6a8c049..c8513fc 100644
--- a/mpq/aors.c
+++ b/mpq/aors.c
@@ -18,7 +18,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -94,9 +93,11 @@ mpq_add (mpq_ptr rop, mpq_srcptr op1, mpq_srcptr op2)
{
mpq_aors (rop, op1, op2, mpz_add);
}
+__GMP_PUBLIC_DEFINE (mpq_add)
void
mpq_sub (mpq_ptr rop, mpq_srcptr op1, mpq_srcptr op2)
{
mpq_aors (rop, op1, op2, mpz_sub);
}
+__GMP_PUBLIC_DEFINE (mpq_sub)
diff --git a/mpq/canonicalize.c b/mpq/canonicalize.c
index ab7925b..c646ae8 100644
--- a/mpq/canonicalize.c
+++ b/mpq/canonicalize.c
@@ -19,7 +19,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -51,3 +50,4 @@ mpq_canonicalize (MP_RAT *op)
}
TMP_FREE;
}
+__GMP_PUBLIC_DEFINE (mpq_canonicalize)
diff --git a/mpq/clear.c b/mpq/clear.c
index 787dae1..2ce01ea 100644
--- a/mpq/clear.c
+++ b/mpq/clear.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -28,3 +27,4 @@ mpq_clear (MP_RAT *m)
(*__gmp_free_func) (PTR(DEN(m)),
ALLOC(DEN(m)) * BYTES_PER_MP_LIMB);
}
+__GMP_PUBLIC_DEFINE (mpq_clear)
diff --git a/mpq/clears.c b/mpq/clears.c
index 0aa8b57..f4eee46 100644
--- a/mpq/clears.c
+++ b/mpq/clears.c
@@ -17,16 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -54,3 +44,4 @@ mpq_clears (va_alist)
}
va_end (ap);
}
+__GMP_PUBLIC_DEFINE (mpq_clears)
diff --git a/mpq/cmp.c b/mpq/cmp.c
index c4bb5e0..934be87 100644
--- a/mpq/cmp.c
+++ b/mpq/cmp.c
@@ -18,9 +18,7 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
int
mpq_cmp (const MP_RAT *op1, const MP_RAT *op2)
@@ -113,3 +111,4 @@ mpq_cmp (const MP_RAT *op1, const MP_RAT *op2)
TMP_FREE;
return num1_sign < 0 ? -cc : cc;
}
+__GMP_PUBLIC_DEFINE (mpq_cmp)
diff --git a/mpq/cmp_si.c b/mpq/cmp_si.c
index a465b11..28e0db9 100644
--- a/mpq/cmp_si.c
+++ b/mpq/cmp_si.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -54,3 +53,4 @@ _mpq_cmp_si (mpq_srcptr q, long n, unsigned long d)
}
}
}
+__GMP_PUBLIC_DEFINE (_mpq_cmp_si)
diff --git a/mpq/cmp_ui.c b/mpq/cmp_ui.c
index a52c2e8..749d659 100644
--- a/mpq/cmp_ui.c
+++ b/mpq/cmp_ui.c
@@ -20,7 +20,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
int
@@ -88,3 +87,4 @@ _mpq_cmp_ui (const MP_RAT *op1, unsigned long int num2, unsigned long int den2)
TMP_FREE;
return cc;
}
+__GMP_PUBLIC_DEFINE (_mpq_cmp_ui)
diff --git a/mpq/div.c b/mpq/div.c
index 1f64f6d..7f835ba 100644
--- a/mpq/div.c
+++ b/mpq/div.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -102,3 +101,4 @@ mpq_div (mpq_ptr quot, mpq_srcptr op1, mpq_srcptr op2)
TMP_FREE;
}
+__GMP_PUBLIC_DEFINE (mpq_div)
diff --git a/mpq/equal.c b/mpq/equal.c
index e55180a..d30a0c8 100644
--- a/mpq/equal.c
+++ b/mpq/equal.c
@@ -18,7 +18,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
int
@@ -56,3 +55,4 @@ mpq_equal (mpq_srcptr op1, mpq_srcptr op2) __GMP_NOTHROW
return 1;
}
+__GMP_PUBLIC_DEFINE (mpq_equal)
diff --git a/mpq/get_d.c b/mpq/get_d.c
index 3db8226..c3821e9 100644
--- a/mpq/get_d.c
+++ b/mpq/get_d.c
@@ -18,10 +18,7 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
/* All that's needed is to get the high 53 bits of the quotient num/den,
@@ -163,3 +160,4 @@ mpq_get_d (const MP_RAT *src)
TMP_FREE;
return res;
}
+__GMP_PUBLIC_DEFINE (mpq_get_d)
diff --git a/mpq/get_den.c b/mpq/get_den.c
index 6a969df..d6ebfe8 100644
--- a/mpq/get_den.c
+++ b/mpq/get_den.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -30,3 +29,4 @@ mpq_get_den (mpz_ptr den, mpq_srcptr src)
SIZ(den) = size;
MPN_COPY (dp, PTR(DEN(src)), size);
}
+__GMP_PUBLIC_DEFINE (mpq_get_den)
diff --git a/mpq/get_num.c b/mpq/get_num.c
index bbc6448..09aa9a5 100644
--- a/mpq/get_num.c
+++ b/mpq/get_num.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -32,3 +31,4 @@ mpq_get_num (mpz_ptr num, mpq_srcptr src)
MPN_COPY (dp, PTR(NUM(src)), abs_size);
}
+__GMP_PUBLIC_DEFINE (mpq_get_num)
diff --git a/mpq/get_str.c b/mpq/get_str.c
index 74398a5..1bfa9f5 100644
--- a/mpq/get_str.c
+++ b/mpq/get_str.c
@@ -17,11 +17,7 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include <stdio.h>
-#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
char *
mpq_get_str (char *str, int base, mpq_srcptr q)
@@ -63,3 +59,4 @@ mpq_get_str (char *str, int base, mpq_srcptr q)
return str;
}
+__GMP_PUBLIC_DEFINE (mpq_get_str)
diff --git a/mpq/init.c b/mpq/init.c
index f075477..e6cb366 100644
--- a/mpq/init.c
+++ b/mpq/init.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -36,3 +35,4 @@ mpq_init (MP_RAT *x)
PTR(NUM(x))[0] = 0;
#endif
}
+__GMP_PUBLIC_DEFINE (mpq_init)
diff --git a/mpq/inits.c b/mpq/inits.c
index 851daaa..a9bf0f4 100644
--- a/mpq/inits.c
+++ b/mpq/inits.c
@@ -17,16 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -54,3 +44,4 @@ mpq_inits (va_alist)
}
va_end (ap);
}
+__GMP_PUBLIC_DEFINE (mpq_inits)
diff --git a/mpq/inp_str.c b/mpq/inp_str.c
index fef2f98..a5e110b 100644
--- a/mpq/inp_str.c
+++ b/mpq/inp_str.c
@@ -17,9 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include <stdio.h>
-#include <ctype.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -63,3 +60,4 @@ mpq_inp_str (mpq_ptr q, FILE *fp, int base)
return nread;
}
+__GMP_PUBLIC_DEFINE (mpq_inp_str)
diff --git a/mpq/inv.c b/mpq/inv.c
index 48f0ae7..9066821 100644
--- a/mpq/inv.c
+++ b/mpq/inv.c
@@ -18,7 +18,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -58,3 +57,4 @@ mpq_inv (mpq_ptr dest, mpq_srcptr src)
MPN_COPY (dp, PTR(NUM(src)), num_size);
}
}
+__GMP_PUBLIC_DEFINE (mpq_inv)
diff --git a/mpq/md_2exp.c b/mpq/md_2exp.c
index 7b85793..14a4344 100644
--- a/mpq/md_2exp.c
+++ b/mpq/md_2exp.c
@@ -18,9 +18,7 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
/* The multiplier/divisor "n", representing 2^n, is applied by right shifting
@@ -84,6 +82,7 @@ mpq_mul_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n)
{
mord_2exp (NUM(dst), DEN(dst), NUM(src), DEN(src), n);
}
+__GMP_PUBLIC_DEFINE (mpq_mul_2exp)
void
mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n)
@@ -98,3 +97,4 @@ mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n)
mord_2exp (DEN(dst), NUM(dst), DEN(src), NUM(src), n);
}
+__GMP_PUBLIC_DEFINE (mpq_div_2exp)
diff --git a/mpq/mul.c b/mpq/mul.c
index 839308b..9eb8645 100644
--- a/mpq/mul.c
+++ b/mpq/mul.c
@@ -18,7 +18,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -91,3 +90,4 @@ mpq_mul (mpq_ptr prod, mpq_srcptr op1, mpq_srcptr op2)
TMP_FREE;
}
+__GMP_PUBLIC_DEFINE (mpq_mul)
diff --git a/mpq/neg.c b/mpq/neg.c
index 32115c2..312ec76 100644
--- a/mpq/neg.c
+++ b/mpq/neg.c
@@ -18,8 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpq_neg 1
-
-#include "gmp.h"
#include "gmp-impl.h"
@@ -45,3 +43,4 @@ mpq_neg (mpq_ptr dst, mpq_srcptr src)
SIZ(NUM(dst)) = -num_size;
}
+__GMP_PUBLIC_DEFINE (mpq_neg)
diff --git a/mpq/out_str.c b/mpq/out_str.c
index ade8e2b..fc42209 100644
--- a/mpq/out_str.c
+++ b/mpq/out_str.c
@@ -18,8 +18,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -41,3 +39,4 @@ mpq_out_str (FILE *stream, int base, mpq_srcptr q)
return ferror (stream) ? 0 : written;
}
+__GMP_PUBLIC_DEFINE (mpq_out_str)
diff --git a/mpq/set.c b/mpq/set.c
index b2dad7e..2774da1 100644
--- a/mpq/set.c
+++ b/mpq/set.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -38,3 +37,4 @@ mpq_set (mpq_ptr dest, mpq_srcptr src)
SIZ(DEN(dest)) = den_size;
MPN_COPY (dp, PTR(DEN(src)), den_size);
}
+__GMP_PUBLIC_DEFINE (mpq_set)
diff --git a/mpq/set_d.c b/mpq/set_d.c
index c56ef5d..623f651 100644
--- a/mpq/set_d.c
+++ b/mpq/set_d.c
@@ -17,15 +17,7 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "config.h"
-
-#if HAVE_FLOAT_H
-#include <float.h> /* for DBL_MAX */
-#endif
-
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
#if LIMBS_PER_DOUBLE > 4
choke me
@@ -153,3 +145,4 @@ mpq_set_d (mpq_ptr dest, double d)
SIZ(NUM(dest)) = negative ? -nn : nn;
}
}
+__GMP_PUBLIC_DEFINE (mpq_set_d)
diff --git a/mpq/set_den.c b/mpq/set_den.c
index e9ee17b..6512d0e 100644
--- a/mpq/set_den.c
+++ b/mpq/set_den.c
@@ -18,7 +18,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -33,3 +32,4 @@ mpq_set_den (mpq_ptr dest, mpz_srcptr den)
SIZ(DEN(dest)) = size;
MPN_COPY (dp, PTR(den), abs_size);
}
+__GMP_PUBLIC_DEFINE (mpq_set_den)
diff --git a/mpq/set_f.c b/mpq/set_f.c
index d1e1486..415da22 100644
--- a/mpq/set_f.c
+++ b/mpq/set_f.c
@@ -17,9 +17,7 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
void
@@ -94,3 +92,4 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f)
SIZ(DEN(q)) = den_size + 1;
}
}
+__GMP_PUBLIC_DEFINE (mpq_set_f)
diff --git a/mpq/set_num.c b/mpq/set_num.c
index 5b018c8..b7bb149 100644
--- a/mpq/set_num.c
+++ b/mpq/set_num.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -32,3 +31,4 @@ mpq_set_num (mpq_ptr dest, mpz_srcptr num)
SIZ(NUM(dest)) = size;
MPN_COPY (dp, PTR(num), abs_size);
}
+__GMP_PUBLIC_DEFINE (mpq_set_num)
diff --git a/mpq/set_si.c b/mpq/set_si.c
index f7499aa..49fbbd1 100644
--- a/mpq/set_si.c
+++ b/mpq/set_si.c
@@ -18,7 +18,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -52,3 +51,4 @@ mpq_set_si (MP_RAT *dest, signed long int num, unsigned long int den)
PTR(DEN(dest))[0] = den;
SIZ(DEN(dest)) = (den != 0);
}
+__GMP_PUBLIC_DEFINE (mpq_set_si)
diff --git a/mpq/set_str.c b/mpq/set_str.c
index 07a18bb..2b649c6 100644
--- a/mpq/set_str.c
+++ b/mpq/set_str.c
@@ -17,9 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include <stdio.h>
-#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -56,3 +53,4 @@ mpq_set_str (mpq_ptr q, const char *str, int base)
return mpz_set_str (mpq_denref(q), slash+1, base);
}
+__GMP_PUBLIC_DEFINE (mpq_set_str)
diff --git a/mpq/set_ui.c b/mpq/set_ui.c
index 231e07d..fdc0c79 100644
--- a/mpq/set_ui.c
+++ b/mpq/set_ui.c
@@ -18,7 +18,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -48,3 +47,4 @@ mpq_set_ui (MP_RAT *dest, unsigned long int num, unsigned long int den)
PTR(DEN(dest))[0] = den;
SIZ(DEN(dest)) = (den != 0);
}
+__GMP_PUBLIC_DEFINE (mpq_set_ui)
diff --git a/mpq/set_z.c b/mpq/set_z.c
index e6f3ff0..996ed1e 100644
--- a/mpq/set_z.c
+++ b/mpq/set_z.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -36,3 +35,4 @@ mpq_set_z (mpq_ptr dest, mpz_srcptr src)
PTR(DEN(dest))[0] = 1;
SIZ(DEN(dest)) = 1;
}
+__GMP_PUBLIC_DEFINE (mpq_set_z)
diff --git a/mpq/swap.c b/mpq/swap.c
index 0736c87..1bb2871 100644
--- a/mpq/swap.c
+++ b/mpq/swap.c
@@ -17,7 +17,6 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -58,3 +57,4 @@ mpq_swap (mpq_ptr u, mpq_ptr v) __GMP_NOTHROW
PTR(DEN(v)) = up;
PTR(DEN(u)) = vp;
}
+__GMP_PUBLIC_DEFINE (mpq_swap)
--
1.8.1.2
More information about the gmp-devel
mailing list