mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
Move number validators to numbers.h.
* libguile/validate.h: * libguile/numbers.h (SCM_NUM2SIZE, SCM_NUM2SIZE_DEF, SCM_NUM2PTRDIFF) SCM_NUM2PTRDIFF_DEF, SCM_NUM2SHORT, SCM_NUM2SHORT_DEF, SCM_NUM2USHORT) SCM_NUM2USHORT_DEF, SCM_NUM2INT, SCM_NUM2INT_DEF, SCM_NUM2UINT) SCM_NUM2UINT_DEF, SCM_NUM2ULONG, SCM_NUM2ULONG_DEF, SCM_NUM2LONG) SCM_NUM2LONG_DEF, SCM_NUM2LONG_LONG, SCM_NUM2LONG_LONG_DEF) SCM_NUM2ULONG_LONG, SCM_NUM2ULONG_LONG_DEF, SCM_NUM2FLOAT) SCM_NUM2DOUBLE): Move these here, from validate.h.
This commit is contained in:
parent
87896eb3e6
commit
d10c3aa3cd
2 changed files with 62 additions and 56 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <gmp.h>
|
||||
|
||||
#include "libguile/__scm.h"
|
||||
#include "libguile/error.h"
|
||||
#include "libguile/print.h"
|
||||
|
||||
#ifndef SCM_T_WCHAR_DEFINED
|
||||
|
@ -596,6 +597,67 @@ SCM_API int scm_install_gmp_memory_functions;
|
|||
|
||||
SCM_INTERNAL void scm_init_numbers (void);
|
||||
|
||||
|
||||
|
||||
#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
|
||||
|
||||
#define SCM_NUM2SIZE_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_size_t (arg))
|
||||
|
||||
#define SCM_NUM2PTRDIFF(pos, arg) (scm_to_ssize_t (arg))
|
||||
|
||||
#define SCM_NUM2PTRDIFF_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ssize_t (arg))
|
||||
|
||||
#define SCM_NUM2SHORT(pos, arg) (scm_to_short (arg))
|
||||
|
||||
#define SCM_NUM2SHORT_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_short (arg))
|
||||
|
||||
#define SCM_NUM2USHORT(pos, arg) (scm_to_ushort (arg))
|
||||
|
||||
#define SCM_NUM2USHORT_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ushort (arg))
|
||||
|
||||
#define SCM_NUM2INT(pos, arg) (scm_to_int (arg))
|
||||
|
||||
#define SCM_NUM2INT_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_int (arg))
|
||||
|
||||
#define SCM_NUM2UINT(pos, arg) (scm_to_uint (arg))
|
||||
|
||||
#define SCM_NUM2UINT_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_uint (arg))
|
||||
|
||||
#define SCM_NUM2ULONG(pos, arg) (scm_to_ulong (arg))
|
||||
|
||||
#define SCM_NUM2ULONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ulong (arg))
|
||||
|
||||
#define SCM_NUM2LONG(pos, arg) (scm_to_long (arg))
|
||||
|
||||
#define SCM_NUM2LONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_long (arg))
|
||||
|
||||
#define SCM_NUM2LONG_LONG(pos, arg) (scm_to_long_long (arg))
|
||||
|
||||
#define SCM_NUM2LONG_LONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_long_long (arg))
|
||||
|
||||
#define SCM_NUM2ULONG_LONG(pos, arg) (scm_to_ulong_long (arg))
|
||||
|
||||
#define SCM_NUM2ULONG_LONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ulong_long (arg))
|
||||
|
||||
#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
|
||||
|
||||
#define SCM_NUM2FLOAT(pos, arg) ((float) scm_to_double (arg))
|
||||
|
||||
#define SCM_NUM2DOUBLE(pos, arg) (scm_to_double (arg))
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* SCM_NUMBERS_H */
|
||||
|
||||
/*
|
||||
|
|
|
@ -31,62 +31,6 @@
|
|||
|
||||
|
||||
|
||||
#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
|
||||
|
||||
#define SCM_NUM2SIZE_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_size_t (arg))
|
||||
|
||||
#define SCM_NUM2PTRDIFF(pos, arg) (scm_to_ssize_t (arg))
|
||||
|
||||
#define SCM_NUM2PTRDIFF_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ssize_t (arg))
|
||||
|
||||
#define SCM_NUM2SHORT(pos, arg) (scm_to_short (arg))
|
||||
|
||||
#define SCM_NUM2SHORT_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_short (arg))
|
||||
|
||||
#define SCM_NUM2USHORT(pos, arg) (scm_to_ushort (arg))
|
||||
|
||||
#define SCM_NUM2USHORT_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ushort (arg))
|
||||
|
||||
#define SCM_NUM2INT(pos, arg) (scm_to_int (arg))
|
||||
|
||||
#define SCM_NUM2INT_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_int (arg))
|
||||
|
||||
#define SCM_NUM2UINT(pos, arg) (scm_to_uint (arg))
|
||||
|
||||
#define SCM_NUM2UINT_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_uint (arg))
|
||||
|
||||
#define SCM_NUM2ULONG(pos, arg) (scm_to_ulong (arg))
|
||||
|
||||
#define SCM_NUM2ULONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ulong (arg))
|
||||
|
||||
#define SCM_NUM2LONG(pos, arg) (scm_to_long (arg))
|
||||
|
||||
#define SCM_NUM2LONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_long (arg))
|
||||
|
||||
#define SCM_NUM2LONG_LONG(pos, arg) (scm_to_long_long (arg))
|
||||
|
||||
#define SCM_NUM2LONG_LONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_long_long (arg))
|
||||
|
||||
#define SCM_NUM2ULONG_LONG(pos, arg) (scm_to_ulong_long (arg))
|
||||
|
||||
#define SCM_NUM2ULONG_LONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ulong_long (arg))
|
||||
|
||||
#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
|
||||
|
||||
#define SCM_NUM2FLOAT(pos, arg) ((float) scm_to_double (arg))
|
||||
|
||||
#define SCM_NUM2DOUBLE(pos, arg) (scm_to_double (arg))
|
||||
|
||||
#define SCM_OUT_OF_RANGE(pos, arg) \
|
||||
do { scm_out_of_range_pos (FUNC_NAME, arg, scm_from_int (pos)); } while (0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue