diff --git a/libguile/ChangeLog b/libguile/ChangeLog index a7530216b..e17b83cf8 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,11 @@ +2001-09-23 Mikael Djurfeldt + + * validate.h (SCM_NUM2FLOAT, SCM_NUM2DOUBLE, + SCM_VALIDATE_FLOAT_COPY, SCM_VALIDATE_DOUBLE_COPY): New + macros. (The NUM names might soon change.) + + * numbers.h: Added missing declarations. + 2001-09-22 Mikael Djurfeldt * Makefile.am: Distribute num2float.i.c. diff --git a/libguile/numbers.h b/libguile/numbers.h index 4c3023ecd..350f43f3d 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -325,9 +325,16 @@ extern SCM scm_ulong_long2num (unsigned long long sl); extern long long scm_num2long_long (SCM num, unsigned long int pos, const char *s_caller); extern unsigned long long scm_num2ulong_long (SCM num, unsigned long int pos, - const char *s_caller); + const char *s_caller); #endif +extern SCM scm_float2num (float n); +extern SCM scm_double2num (double n); +extern float scm_num2float (SCM num, unsigned long int pos, + const char *s_caller); +extern double scm_num2double (SCM num, unsigned long int pos, + const char *s_caller); + extern void scm_init_numbers (void); #endif /* SCM_NUMBERS_H */ diff --git a/libguile/validate.h b/libguile/validate.h index ddbf98a48..f7b7aec53 100644 --- a/libguile/validate.h +++ b/libguile/validate.h @@ -116,6 +116,12 @@ #define SCM_NUM2ULONG_LONG_DEF(pos, arg, def) \ (SCM_UNBNDP (arg) ? def : scm_num2ulong_long (arg, pos, FUNC_NAME)) +#define SCM_NUM2FLOAT(pos, arg) \ + (scm_num2float (arg, pos, FUNC_NAME)) + +#define SCM_NUM2DOUBLE(pos, arg) \ + (scm_num2double (arg, pos, FUNC_NAME)) + #define SCM_OUT_OF_RANGE(pos, arg) \ do { scm_out_of_range_pos (FUNC_NAME, arg, SCM_MAKINUM (pos)); } while (0) @@ -232,6 +238,16 @@ cvar = SCM_NUM2LONG (pos, k); \ } while (0) +#define SCM_VALIDATE_FLOAT_COPY(pos, k, cvar) \ + do { \ + cvar = SCM_NUM2FLOAT (pos, k); \ + } while (0) + +#define SCM_VALIDATE_DOUBLE_COPY(pos, k, cvar) \ + do { \ + cvar = SCM_NUM2DOUBLE (pos, k); \ + } while (0) + #define SCM_VALIDATE_BIGINT(pos, k) SCM_MAKE_VALIDATE (pos, k, BIGP) #define SCM_VALIDATE_INUM_MIN(pos, k, min) \