mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Don't expose mini-gmp to users
* libguile.h: Don't import anything GMP-related. * libguile/numbers.h: Import GMP here instead. If we are using mini-GMP, only import it when building Guile. (scm_to_mpz, scm_from_mpz): Don't define when mini-gmp is enabled.
This commit is contained in:
parent
91547abf54
commit
f46477f6f5
2 changed files with 26 additions and 14 deletions
15
libguile.h
15
libguile.h
|
@ -1,7 +1,7 @@
|
|||
#ifndef SCM_LIBGUILE_H
|
||||
#define SCM_LIBGUILE_H
|
||||
|
||||
/* Copyright 1995-1998,2000-2004,2006,2008-2014,2018,2020
|
||||
/* Copyright 1995-1998,2000-2004,2006,2008-2014,2018,2020-2021
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -25,18 +25,9 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "libguile/scm.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#if SCM_ENABLE_MINI_GMP
|
||||
#include "libguile/mini-gmp.h"
|
||||
#else
|
||||
#include <gmp.h>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "libguile/alist.h"
|
||||
#include "libguile/array-handle.h"
|
||||
#include "libguile/array-map.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SCM_NUMBERS_H
|
||||
#define SCM_NUMBERS_H
|
||||
|
||||
/* Copyright 1995-1996,1998,2000-2006,2008-2011,2013-2014,2016-2018
|
||||
/* Copyright 1995-1996,1998,2000-2006,2008-2011,2013-2014,2016-2018,2021
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -22,13 +22,26 @@
|
|||
|
||||
|
||||
|
||||
#include "libguile/scm.h"
|
||||
#include "libguile/scmconfig.h"
|
||||
|
||||
/* gmp.h needs to be included with C++ linkage, if including Guile
|
||||
headers from a C++ compiler. */
|
||||
#ifdef __cplusplus
|
||||
extern "C++" {
|
||||
#endif
|
||||
|
||||
#if SCM_ENABLE_MINI_GMP
|
||||
#ifdef BUILDING_LIBGUILE
|
||||
#include "libguile/mini-gmp.h"
|
||||
#endif
|
||||
#else
|
||||
#include <gmp.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "libguile/error.h"
|
||||
#include "libguile/gc.h"
|
||||
#include "libguile/print.h"
|
||||
|
@ -156,7 +169,10 @@ typedef long scm_t_inum;
|
|||
#define SCM_COMPLEX_IMAG(x) (((scm_t_complex *) SCM2PTR (x))->imag)
|
||||
|
||||
/* Each bignum is just an mpz_t stored in a double cell starting at word 1. */
|
||||
#if defined BUILDING_LIBGUILE || SCM_ENABLE_MINI_GMP == 0
|
||||
#define SCM_I_BIG_MPZ(x) (*((mpz_t *) (SCM_CELL_OBJECT_LOC((x),1))))
|
||||
#endif
|
||||
|
||||
#define SCM_BIGP(x) (SCM_HAS_TYP16 (x, scm_tc16_big))
|
||||
|
||||
#define SCM_NUMBERP(x) (SCM_I_INUMP(x) || SCM_NUMP(x))
|
||||
|
@ -401,8 +417,13 @@ SCM_API SCM scm_from_int64 (int64_t x);
|
|||
SCM_API uint64_t scm_to_uint64 (SCM x);
|
||||
SCM_API SCM scm_from_uint64 (uint64_t x);
|
||||
|
||||
#if defined BUILDING_LIBGUILE && SCM_ENABLE_MINI_GMP
|
||||
SCM_INTERNAL void scm_to_mpz (SCM x, mpz_t rop);
|
||||
SCM_INTERNAL SCM scm_from_mpz (mpz_t rop);
|
||||
#elif !SCM_ENABLE_MINI_GMP
|
||||
SCM_API void scm_to_mpz (SCM x, mpz_t rop);
|
||||
SCM_API SCM scm_from_mpz (mpz_t rop);
|
||||
#endif
|
||||
|
||||
|
||||
/* The conversion functions for other types are aliased to the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue