2001-08-31 11:17:06 +00:00
|
|
|
|
/* classes: h_files */
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SCM_VALIDATE_H
|
|
|
|
|
|
#define SCM_VALIDATE_H
|
|
|
|
|
|
|
2001-04-10 07:57:05 +00:00
|
|
|
|
/* Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
|
2000-04-05 15:28:28 +00:00
|
|
|
|
*
|
1999-12-12 18:08:24 +00:00
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
|
* any later version.
|
2000-04-05 15:28:28 +00:00
|
|
|
|
*
|
1999-12-12 18:08:24 +00:00
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
2000-04-05 15:28:28 +00:00
|
|
|
|
*
|
1999-12-12 18:08:24 +00:00
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this software; see the file COPYING. If not, write to
|
|
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
|
|
|
* Boston, MA 02111-1307 USA
|
1999-12-12 02:36:16 +00:00
|
|
|
|
*
|
1999-12-12 18:08:24 +00:00
|
|
|
|
* As a special exception, the Free Software Foundation gives permission
|
|
|
|
|
|
* for additional uses of the text contained in its release of GUILE.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The exception is that, if you link the GUILE library with other files
|
|
|
|
|
|
* to produce an executable, this does not by itself cause the
|
|
|
|
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
|
|
|
|
* Your use of that executable is in no way restricted on account of
|
|
|
|
|
|
* linking the GUILE library code into it.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception does not however invalidate any other reasons why
|
|
|
|
|
|
* the executable file might be covered by the GNU General Public License.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception applies only to the code released by the
|
|
|
|
|
|
* Free Software Foundation under the name GUILE. If you copy
|
|
|
|
|
|
* code from other Free Software Foundation releases into a copy of
|
|
|
|
|
|
* GUILE, as the General Public License permits, the exception does
|
|
|
|
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
|
|
|
|
* anyone as to the status of such modified files, you must delete
|
|
|
|
|
|
* this exception notice from them.
|
|
|
|
|
|
*
|
|
|
|
|
|
* If you write modifications of your own for GUILE, it is your choice
|
|
|
|
|
|
* whether to permit this exception to apply to your modifications.
|
|
|
|
|
|
* If you do not wish that, delete this exception notice. */
|
|
|
|
|
|
|
|
|
|
|
|
/* Written by Greg J. Badros <gjb@cs.washington.edu>, Dec-1999 */
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2001-08-31 11:17:06 +00:00
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_SYSERROR do { scm_syserror (FUNC_NAME); } while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_MEMORY_ERROR do { scm_memory_error (FUNC_NAME); } while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_SYSERROR_MSG(str, args, val) \
|
|
|
|
|
|
do { scm_syserror_msg (FUNC_NAME, (str), (args), (val)); } while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_MISC_ERROR(str, args) \
|
|
|
|
|
|
do { scm_misc_error (FUNC_NAME, str, args); } while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-12-16 20:25:08 +00:00
|
|
|
|
#define SCM_WRONG_NUM_ARGS() \
|
2001-03-17 12:20:36 +00:00
|
|
|
|
do { scm_error_num_args_subr (FUNC_NAME); } while (0)
|
2000-12-16 20:25:08 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_WRONG_TYPE_ARG(pos, obj) \
|
|
|
|
|
|
do { scm_wrong_type_arg (FUNC_NAME, pos, obj); } while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
* validate.h
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]):
new macros.
* unif.h: type renaming:
scm_array -> scm_array_t
scm_array_dim -> scm_array_dim_t
the old names are deprecated, all in-Guile uses changed.
* tags.h (scm_ubits_t): new typedef, representing unsigned
scm_bits_t.
* stacks.h: type renaming:
scm_info_frame -> scm_info_frame_t
scm_stack -> scm_stack_t
the old names are deprecated, all in-Guile uses changed.
* srcprop.h: type renaming:
scm_srcprops -> scm_srcprops_t
scm_srcprops_chunk -> scm_srcprops_chunk_t
the old names are deprecated, all in-Guile uses changed.
* gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c,
rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c,
vectors.c, vports.c, weaks.c:
various int/size_t -> size_t/scm_bits_t changes.
* random.h: type renaming:
scm_rstate -> scm_rstate_t
scm_rng -> scm_rng_t
scm_i_rstate -> scm_i_rstate_t
the old names are deprecated, all in-Guile uses changed.
* procs.h: type renaming:
scm_subr_entry -> scm_subr_entry_t
the old name is deprecated, all in-Guile uses changed.
* options.h (scm_option_t.val): unsigned long -> scm_bits_t.
type renaming:
scm_option -> scm_option_t
the old name is deprecated, all in-Guile uses changed.
* objects.c: various long -> scm_bits_t changes.
(scm_i_make_class_object): flags: unsigned long -> scm_ubits_t
* numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to
SCM_I_FIXNUM_BIT.
* num2integral.i.c: new file, multiply included by numbers.c, used
to "templatize" the various integral <-> num conversion routines.
* numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig,
scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl):
deprecated.
(scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig,
scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big,
scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big,
scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big,
scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big,
scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num,
scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num,
scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int,
scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff,
scm_num2size): new functions.
* modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x
* load.c: change int -> size_t in various places (where the
variable is used to store a string length).
(search-path): call scm_done_free, not scm_done_malloc.
* list.c (scm_ilength): return a scm_bits_t, not long.
some other {int,long} -> scm_bits_t changes.
* hashtab.c: various [u]int -> scm_bits_t changes.
scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef).
(scm_ihashx): n: uint -> scm_bits_t
use scm_bits2num instead of scm_ulong2num.
* gsubr.c: various int -> scm_bits_t changes.
* gh_data.c (gh_scm2double): no loss of precision any more.
* gh.h (gh_str2scm): len: int -> size_t
(gh_{get,set}_substr): start: int -> scm_bits_t,
len: int -> size_t
(gh_<num>2scm): n: int -> scm_bits_t
(gh_*vector_length): return scm_[u]size_t, not unsigned long.
(gh_length): return scm_bits_t, not unsigned long.
* fports.h: type renaming:
scm_fport -> scm_fport_t
the old name is deprecated, all in-Guile uses changed.
* fports.c (fport_fill_input): count: int -> scm_bits_t
(fport_flush): init_size, remaining, count: int -> scm_bits_t
* debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed
those prototypes, as the functions they prototype don't exist.
* fports.c (default_buffer_size): int -> size_t
(scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t
default_size: int -> size_t
(scm_setvbuf): csize: int -> scm_bits_t
* fluids.c (n_fluids): int -> scm_bits_t
(grow_fluids): old_length, i: int -> scm_bits_t
(next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int ->
scm_bits_t
(scm_c_with_fluids): flen, vlen: int -> scm_bits_t
* filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to
the new and shiny SCM_NUM2INT.
* extensions.c: extension -> extension_t (and made a typedef).
* eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so
there are no nasty surprises if/when the various deeply magic tag
bits move somewhere else.
* eval.c: changed the locals used to store results of SCM_IFRAME,
scm_ilength and such to be of type scm_bits_t (and not int/long).
(iqq): depth, edepth: int -> scm_bits_t
(scm_eval_stack): int -> scm_bits_t
(SCM_CEVAL): various vars are not scm_bits_t instead of int.
(check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t
i: int -> scm_bits_t
* environments.c: changed the many calls to scm_ulong2num to
scm_ubits2num.
(import_environment_fold): proc_as_ul: ulong -> scm_ubits_t
* dynwind.c (scm_dowinds): delta: long -> scm_bits_t
* debug.h: type renaming:
scm_debug_info -> scm_debug_info_t
scm_debug_frame -> scm_debug_frame_t
the old names are deprecated, all in-Guile uses changed.
(scm_debug_eframe_size): int -> scm_bits_t
* debug.c (scm_init_debug): use scm_c_define instead of the
deprecated scm_define.
* continuations.h: type renaming:
scm_contregs -> scm_contregs_t
the old name is deprecated, all in-Guile uses changed.
(scm_contregs_t.num_stack_items): size_t -> scm_bits_t
(scm_contregs_t.num_stack_items): ulong -> scm_ubits_t
* continuations.c (scm_make_continuation): change the type of
stack_size form long to scm_bits_t.
* ports.h: type renaming:
scm_port_rw_active -> scm_port_rw_active_t (and made a typedef)
scm_port -> scm_port_t
scm_ptob_descriptor -> scm_ptob_descriptor_t
the old names are deprecated, all in-Guile uses changed.
(scm_port_t.entry): int -> scm_bits_t.
(scm_port_t.line_number): int -> long.
(scm_port_t.putback_buf_size): int -> size_t.
* __scm.h (long_long, ulong_long): deprecated (they pollute the
global namespace and have little value besides that).
(SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an
SCM handle).
(ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they
exist (for size_t & ptrdiff_t)
(scm_sizet): deprecated.
* Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-05-24 00:50:51 +00:00
|
|
|
|
#define SCM_NUM2SIZE(pos, arg) (scm_num2size (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2SIZE_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2size (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2PTRDIFF(pos, arg) (scm_num2ptrdiff (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2PTRDIFF_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2ptrdiff (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2SHORT(pos, arg) (scm_num2short (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2SHORT_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2short (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2USHORT(pos, arg) (scm_num2ushort (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2USHORT_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2ushort (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2INT(pos, arg) (scm_num2int (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2INT_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2int (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2UINT(pos, arg) (scm_num2uint (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2UINT_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2uint (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
2001-04-10 07:57:05 +00:00
|
|
|
|
#define SCM_NUM2ULONG(pos, arg) (scm_num2ulong (arg, pos, FUNC_NAME))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
* validate.h
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]):
new macros.
* unif.h: type renaming:
scm_array -> scm_array_t
scm_array_dim -> scm_array_dim_t
the old names are deprecated, all in-Guile uses changed.
* tags.h (scm_ubits_t): new typedef, representing unsigned
scm_bits_t.
* stacks.h: type renaming:
scm_info_frame -> scm_info_frame_t
scm_stack -> scm_stack_t
the old names are deprecated, all in-Guile uses changed.
* srcprop.h: type renaming:
scm_srcprops -> scm_srcprops_t
scm_srcprops_chunk -> scm_srcprops_chunk_t
the old names are deprecated, all in-Guile uses changed.
* gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c,
rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c,
vectors.c, vports.c, weaks.c:
various int/size_t -> size_t/scm_bits_t changes.
* random.h: type renaming:
scm_rstate -> scm_rstate_t
scm_rng -> scm_rng_t
scm_i_rstate -> scm_i_rstate_t
the old names are deprecated, all in-Guile uses changed.
* procs.h: type renaming:
scm_subr_entry -> scm_subr_entry_t
the old name is deprecated, all in-Guile uses changed.
* options.h (scm_option_t.val): unsigned long -> scm_bits_t.
type renaming:
scm_option -> scm_option_t
the old name is deprecated, all in-Guile uses changed.
* objects.c: various long -> scm_bits_t changes.
(scm_i_make_class_object): flags: unsigned long -> scm_ubits_t
* numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to
SCM_I_FIXNUM_BIT.
* num2integral.i.c: new file, multiply included by numbers.c, used
to "templatize" the various integral <-> num conversion routines.
* numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig,
scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl):
deprecated.
(scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig,
scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big,
scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big,
scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big,
scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big,
scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num,
scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num,
scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int,
scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff,
scm_num2size): new functions.
* modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x
* load.c: change int -> size_t in various places (where the
variable is used to store a string length).
(search-path): call scm_done_free, not scm_done_malloc.
* list.c (scm_ilength): return a scm_bits_t, not long.
some other {int,long} -> scm_bits_t changes.
* hashtab.c: various [u]int -> scm_bits_t changes.
scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef).
(scm_ihashx): n: uint -> scm_bits_t
use scm_bits2num instead of scm_ulong2num.
* gsubr.c: various int -> scm_bits_t changes.
* gh_data.c (gh_scm2double): no loss of precision any more.
* gh.h (gh_str2scm): len: int -> size_t
(gh_{get,set}_substr): start: int -> scm_bits_t,
len: int -> size_t
(gh_<num>2scm): n: int -> scm_bits_t
(gh_*vector_length): return scm_[u]size_t, not unsigned long.
(gh_length): return scm_bits_t, not unsigned long.
* fports.h: type renaming:
scm_fport -> scm_fport_t
the old name is deprecated, all in-Guile uses changed.
* fports.c (fport_fill_input): count: int -> scm_bits_t
(fport_flush): init_size, remaining, count: int -> scm_bits_t
* debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed
those prototypes, as the functions they prototype don't exist.
* fports.c (default_buffer_size): int -> size_t
(scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t
default_size: int -> size_t
(scm_setvbuf): csize: int -> scm_bits_t
* fluids.c (n_fluids): int -> scm_bits_t
(grow_fluids): old_length, i: int -> scm_bits_t
(next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int ->
scm_bits_t
(scm_c_with_fluids): flen, vlen: int -> scm_bits_t
* filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to
the new and shiny SCM_NUM2INT.
* extensions.c: extension -> extension_t (and made a typedef).
* eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so
there are no nasty surprises if/when the various deeply magic tag
bits move somewhere else.
* eval.c: changed the locals used to store results of SCM_IFRAME,
scm_ilength and such to be of type scm_bits_t (and not int/long).
(iqq): depth, edepth: int -> scm_bits_t
(scm_eval_stack): int -> scm_bits_t
(SCM_CEVAL): various vars are not scm_bits_t instead of int.
(check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t
i: int -> scm_bits_t
* environments.c: changed the many calls to scm_ulong2num to
scm_ubits2num.
(import_environment_fold): proc_as_ul: ulong -> scm_ubits_t
* dynwind.c (scm_dowinds): delta: long -> scm_bits_t
* debug.h: type renaming:
scm_debug_info -> scm_debug_info_t
scm_debug_frame -> scm_debug_frame_t
the old names are deprecated, all in-Guile uses changed.
(scm_debug_eframe_size): int -> scm_bits_t
* debug.c (scm_init_debug): use scm_c_define instead of the
deprecated scm_define.
* continuations.h: type renaming:
scm_contregs -> scm_contregs_t
the old name is deprecated, all in-Guile uses changed.
(scm_contregs_t.num_stack_items): size_t -> scm_bits_t
(scm_contregs_t.num_stack_items): ulong -> scm_ubits_t
* continuations.c (scm_make_continuation): change the type of
stack_size form long to scm_bits_t.
* ports.h: type renaming:
scm_port_rw_active -> scm_port_rw_active_t (and made a typedef)
scm_port -> scm_port_t
scm_ptob_descriptor -> scm_ptob_descriptor_t
the old names are deprecated, all in-Guile uses changed.
(scm_port_t.entry): int -> scm_bits_t.
(scm_port_t.line_number): int -> long.
(scm_port_t.putback_buf_size): int -> size_t.
* __scm.h (long_long, ulong_long): deprecated (they pollute the
global namespace and have little value besides that).
(SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an
SCM handle).
(ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they
exist (for size_t & ptrdiff_t)
(scm_sizet): deprecated.
* Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-05-24 00:50:51 +00:00
|
|
|
|
#define SCM_NUM2ULONG_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2ulong (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
2001-04-10 07:57:05 +00:00
|
|
|
|
#define SCM_NUM2LONG(pos, arg) (scm_num2long (arg, pos, FUNC_NAME))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_NUM2LONG_DEF(pos, arg, def) \
|
2001-04-10 07:57:05 +00:00
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2long (arg, pos, FUNC_NAME))
|
2000-01-12 01:51:18 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_NUM2LONG_LONG(pos, arg) \
|
2001-04-10 07:57:05 +00:00
|
|
|
|
(scm_num2long_long (arg, pos, FUNC_NAME))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
* validate.h
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]):
new macros.
* unif.h: type renaming:
scm_array -> scm_array_t
scm_array_dim -> scm_array_dim_t
the old names are deprecated, all in-Guile uses changed.
* tags.h (scm_ubits_t): new typedef, representing unsigned
scm_bits_t.
* stacks.h: type renaming:
scm_info_frame -> scm_info_frame_t
scm_stack -> scm_stack_t
the old names are deprecated, all in-Guile uses changed.
* srcprop.h: type renaming:
scm_srcprops -> scm_srcprops_t
scm_srcprops_chunk -> scm_srcprops_chunk_t
the old names are deprecated, all in-Guile uses changed.
* gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c,
rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c,
vectors.c, vports.c, weaks.c:
various int/size_t -> size_t/scm_bits_t changes.
* random.h: type renaming:
scm_rstate -> scm_rstate_t
scm_rng -> scm_rng_t
scm_i_rstate -> scm_i_rstate_t
the old names are deprecated, all in-Guile uses changed.
* procs.h: type renaming:
scm_subr_entry -> scm_subr_entry_t
the old name is deprecated, all in-Guile uses changed.
* options.h (scm_option_t.val): unsigned long -> scm_bits_t.
type renaming:
scm_option -> scm_option_t
the old name is deprecated, all in-Guile uses changed.
* objects.c: various long -> scm_bits_t changes.
(scm_i_make_class_object): flags: unsigned long -> scm_ubits_t
* numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to
SCM_I_FIXNUM_BIT.
* num2integral.i.c: new file, multiply included by numbers.c, used
to "templatize" the various integral <-> num conversion routines.
* numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig,
scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl):
deprecated.
(scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig,
scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big,
scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big,
scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big,
scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big,
scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num,
scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num,
scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int,
scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff,
scm_num2size): new functions.
* modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x
* load.c: change int -> size_t in various places (where the
variable is used to store a string length).
(search-path): call scm_done_free, not scm_done_malloc.
* list.c (scm_ilength): return a scm_bits_t, not long.
some other {int,long} -> scm_bits_t changes.
* hashtab.c: various [u]int -> scm_bits_t changes.
scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef).
(scm_ihashx): n: uint -> scm_bits_t
use scm_bits2num instead of scm_ulong2num.
* gsubr.c: various int -> scm_bits_t changes.
* gh_data.c (gh_scm2double): no loss of precision any more.
* gh.h (gh_str2scm): len: int -> size_t
(gh_{get,set}_substr): start: int -> scm_bits_t,
len: int -> size_t
(gh_<num>2scm): n: int -> scm_bits_t
(gh_*vector_length): return scm_[u]size_t, not unsigned long.
(gh_length): return scm_bits_t, not unsigned long.
* fports.h: type renaming:
scm_fport -> scm_fport_t
the old name is deprecated, all in-Guile uses changed.
* fports.c (fport_fill_input): count: int -> scm_bits_t
(fport_flush): init_size, remaining, count: int -> scm_bits_t
* debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed
those prototypes, as the functions they prototype don't exist.
* fports.c (default_buffer_size): int -> size_t
(scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t
default_size: int -> size_t
(scm_setvbuf): csize: int -> scm_bits_t
* fluids.c (n_fluids): int -> scm_bits_t
(grow_fluids): old_length, i: int -> scm_bits_t
(next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int ->
scm_bits_t
(scm_c_with_fluids): flen, vlen: int -> scm_bits_t
* filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to
the new and shiny SCM_NUM2INT.
* extensions.c: extension -> extension_t (and made a typedef).
* eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so
there are no nasty surprises if/when the various deeply magic tag
bits move somewhere else.
* eval.c: changed the locals used to store results of SCM_IFRAME,
scm_ilength and such to be of type scm_bits_t (and not int/long).
(iqq): depth, edepth: int -> scm_bits_t
(scm_eval_stack): int -> scm_bits_t
(SCM_CEVAL): various vars are not scm_bits_t instead of int.
(check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t
i: int -> scm_bits_t
* environments.c: changed the many calls to scm_ulong2num to
scm_ubits2num.
(import_environment_fold): proc_as_ul: ulong -> scm_ubits_t
* dynwind.c (scm_dowinds): delta: long -> scm_bits_t
* debug.h: type renaming:
scm_debug_info -> scm_debug_info_t
scm_debug_frame -> scm_debug_frame_t
the old names are deprecated, all in-Guile uses changed.
(scm_debug_eframe_size): int -> scm_bits_t
* debug.c (scm_init_debug): use scm_c_define instead of the
deprecated scm_define.
* continuations.h: type renaming:
scm_contregs -> scm_contregs_t
the old name is deprecated, all in-Guile uses changed.
(scm_contregs_t.num_stack_items): size_t -> scm_bits_t
(scm_contregs_t.num_stack_items): ulong -> scm_ubits_t
* continuations.c (scm_make_continuation): change the type of
stack_size form long to scm_bits_t.
* ports.h: type renaming:
scm_port_rw_active -> scm_port_rw_active_t (and made a typedef)
scm_port -> scm_port_t
scm_ptob_descriptor -> scm_ptob_descriptor_t
the old names are deprecated, all in-Guile uses changed.
(scm_port_t.entry): int -> scm_bits_t.
(scm_port_t.line_number): int -> long.
(scm_port_t.putback_buf_size): int -> size_t.
* __scm.h (long_long, ulong_long): deprecated (they pollute the
global namespace and have little value besides that).
(SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an
SCM handle).
(ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they
exist (for size_t & ptrdiff_t)
(scm_sizet): deprecated.
* Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-05-24 00:50:51 +00:00
|
|
|
|
#define SCM_NUM2LONG_LONG_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2long_long (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2ULONG_LONG(pos, arg) \
|
|
|
|
|
|
(scm_num2ulong_long (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2ULONG_LONG_DEF(pos, arg, def) \
|
|
|
|
|
|
(SCM_UNBNDP (arg) ? def : scm_num2ulong_long (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
2001-09-23 21:25:26 +00:00
|
|
|
|
#define SCM_NUM2FLOAT(pos, arg) \
|
|
|
|
|
|
(scm_num2float (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_NUM2DOUBLE(pos, arg) \
|
|
|
|
|
|
(scm_num2double (arg, pos, FUNC_NAME))
|
|
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_OUT_OF_RANGE(pos, arg) \
|
|
|
|
|
|
do { scm_out_of_range_pos (FUNC_NAME, arg, SCM_MAKINUM (pos)); } while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_ASSERT_RANGE(pos, arg, f) \
|
2001-02-28 16:58:12 +00:00
|
|
|
|
do { if (!(f)) scm_out_of_range_pos (FUNC_NAME, arg, SCM_MAKINUM (pos)); } while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_MUST_MALLOC_TYPE(type) \
|
|
|
|
|
|
((type *) scm_must_malloc (sizeof (type), FUNC_NAME))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_MUST_MALLOC_TYPE_NUM(type, num) \
|
|
|
|
|
|
((type *) scm_must_malloc (sizeof (type) * (num), FUNC_NAME))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_MUST_MALLOC(size) (scm_must_malloc ((size), FUNC_NAME))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_MAKE_VALIDATE(pos, var, pred) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT_TYPE (SCM_ ## pred (var), var, pos, FUNC_NAME, #pred); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 18:30:09 +00:00
|
|
|
|
|
1999-12-12 20:35:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-05-18 08:47:52 +00:00
|
|
|
|
#define SCM_VALIDATE_REST_ARGUMENT(x) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
if (SCM_DEBUG_REST_ARGUMENT) { \
|
|
|
|
|
|
if (scm_ilength (x) < 0) { \
|
|
|
|
|
|
SCM_MISC_ERROR ("Rest arguments do not form a proper list.", SCM_EOL); \
|
|
|
|
|
|
} \
|
|
|
|
|
|
} \
|
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_NIM(pos, scm) SCM_MAKE_VALIDATE (pos, scm, NIMP)
|
1999-12-12 20:35:02 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_BOOL(pos, flag) SCM_MAKE_VALIDATE(pos, flag, BOOLP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_BOOL_COPY(pos, flag, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_BOOLP (flag), flag, pos, FUNC_NAME); \
|
2000-06-05 11:39:46 +00:00
|
|
|
|
cvar = SCM_EQ_P (flag, SCM_BOOL_T) ? 1 : 0; \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-05-15 11:47:48 +00:00
|
|
|
|
#define SCM_VALIDATE_CHAR(pos, scm) SCM_MAKE_VALIDATE (pos, scm, CHARP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_CHAR_COPY(pos, scm, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_CHARP (scm), scm, pos, FUNC_NAME); \
|
|
|
|
|
|
cvar = SCM_CHAR (scm); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_STRING(pos, str) SCM_MAKE_VALIDATE (pos, str, STRINGP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \
|
2000-09-22 17:17:55 +00:00
|
|
|
|
cvar = SCM_STRING_CHARS(str); \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2001-01-08 23:10:06 +00:00
|
|
|
|
/* validate a string and optional start/end arguments which default to
|
|
|
|
|
|
0/string-len. this is unrelated to the old shared substring
|
|
|
|
|
|
support, so please do not deprecate it :) */
|
|
|
|
|
|
#define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \
|
|
|
|
|
|
pos_start, start, c_start,\
|
|
|
|
|
|
pos_end, end, c_end) \
|
|
|
|
|
|
do {\
|
|
|
|
|
|
SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\
|
|
|
|
|
|
SCM_VALIDATE_INUM_DEF_COPY (pos_start, start, 0, c_start);\
|
|
|
|
|
|
SCM_VALIDATE_INUM_DEF_COPY (pos_end, end, SCM_STRING_LENGTH (str), c_end);\
|
|
|
|
|
|
SCM_ASSERT_RANGE (pos_start, start,\
|
2001-06-26 10:59:34 +00:00
|
|
|
|
0 <= c_start \
|
|
|
|
|
|
&& (size_t) c_start <= SCM_STRING_LENGTH (str));\
|
2001-01-08 23:10:06 +00:00
|
|
|
|
SCM_ASSERT_RANGE (pos_end, end,\
|
2001-06-26 10:59:34 +00:00
|
|
|
|
c_start <= c_end \
|
|
|
|
|
|
&& (size_t) c_end <= SCM_STRING_LENGTH (str));\
|
2001-01-08 23:10:06 +00:00
|
|
|
|
} while (0)
|
|
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_REAL(pos, z) SCM_MAKE_VALIDATE (pos, z, REALP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2001-01-06 18:46:48 +00:00
|
|
|
|
#define SCM_VALIDATE_NUMBER(pos, z) SCM_MAKE_VALIDATE (pos, z, NUMBERP)
|
|
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM(pos, k) SCM_MAKE_VALIDATE (pos, k, INUMP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM_COPY(pos, k, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
|
|
|
|
|
|
cvar = SCM_INUM (k); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2001-08-25 18:22:50 +00:00
|
|
|
|
#define SCM_VALIDATE_USHORT_COPY(pos, k, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
cvar = SCM_NUM2USHORT (pos, k); \
|
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_VALIDATE_SHORT_COPY(pos, k, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
cvar = SCM_NUM2SHORT (pos, k); \
|
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_VALIDATE_UINT_COPY(pos, k, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
cvar = SCM_NUM2UINT (pos, k); \
|
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_VALIDATE_INT_COPY(pos, k, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
cvar = SCM_NUM2INT (pos, k); \
|
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_ULONG_COPY(pos, k, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
cvar = SCM_NUM2ULONG (pos, k); \
|
|
|
|
|
|
} while (0)
|
2000-01-17 19:44:01 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_LONG_COPY(pos, k, cvar) \
|
|
|
|
|
|
do { \
|
2001-04-10 07:57:05 +00:00
|
|
|
|
cvar = SCM_NUM2LONG (pos, k); \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
} while (0)
|
2000-01-17 19:44:01 +00:00
|
|
|
|
|
2001-09-23 21:25:26 +00:00
|
|
|
|
#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)
|
|
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_BIGINT(pos, k) SCM_MAKE_VALIDATE (pos, k, BIGP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM_MIN(pos, k, min) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP(k), k, pos, FUNC_NAME); \
|
|
|
|
|
|
SCM_ASSERT_RANGE (pos, k, (SCM_INUM (k) >= min)); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM_MIN_COPY(pos, k, min, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
|
2000-06-30 09:48:25 +00:00
|
|
|
|
SCM_ASSERT_RANGE (pos, k, (SCM_INUM (k) >= min)); \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
cvar = SCM_INUM (k); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM_MIN_DEF_COPY(pos, k, min, default, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
if (SCM_UNBNDP (k)) \
|
|
|
|
|
|
k = SCM_MAKINUM (default); \
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
|
2000-06-30 09:48:25 +00:00
|
|
|
|
SCM_ASSERT_RANGE (pos, k, (SCM_INUM (k) >= min)); \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
cvar = SCM_INUM (k); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM_DEF(pos, k, default) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
if (SCM_UNBNDP (k)) \
|
|
|
|
|
|
k = SCM_MAKINUM (default); \
|
|
|
|
|
|
else SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM_DEF_COPY(pos, k, default, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
if (SCM_UNBNDP (k)) \
|
|
|
|
|
|
{ \
|
|
|
|
|
|
k = SCM_MAKINUM (default); \
|
|
|
|
|
|
cvar = default; \
|
|
|
|
|
|
} \
|
|
|
|
|
|
else \
|
|
|
|
|
|
{ \
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
|
|
|
|
|
|
cvar = SCM_INUM (k); \
|
|
|
|
|
|
} \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2001-10-12 08:55:05 +00:00
|
|
|
|
#define SCM_VALIDATE_DOUBLE_DEF_COPY(pos, k, default, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
if (SCM_UNBNDP (k)) \
|
|
|
|
|
|
{ \
|
|
|
|
|
|
k = scm_make_real (default); \
|
|
|
|
|
|
cvar = default; \
|
|
|
|
|
|
} \
|
|
|
|
|
|
else \
|
|
|
|
|
|
{ \
|
|
|
|
|
|
cvar = SCM_NUM2DOUBLE (pos, k); \
|
|
|
|
|
|
} \
|
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
/* [low,high) */
|
2000-04-18 15:23:11 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM_RANGE(pos,k,low,high) \
|
|
|
|
|
|
do { SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); \
|
|
|
|
|
|
SCM_ASSERT_RANGE(pos,k, \
|
|
|
|
|
|
(SCM_INUM (k) >= low && \
|
|
|
|
|
|
SCM_INUM (k) < high)); \
|
|
|
|
|
|
} while (0)
|
2000-04-15 19:30:16 +00:00
|
|
|
|
|
2000-04-16 23:01:51 +00:00
|
|
|
|
#define SCM_VALIDATE_INUM_RANGE_COPY(pos, k, low, high, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
|
2000-06-30 09:48:25 +00:00
|
|
|
|
SCM_ASSERT_RANGE (pos, k, low <= SCM_INUM (k) && SCM_INUM (k) < high); \
|
2000-04-16 23:01:51 +00:00
|
|
|
|
cvar = SCM_INUM (k); \
|
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_NULL(pos, scm) SCM_MAKE_VALIDATE (pos, scm, NULLP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_CONS(pos, scm) SCM_MAKE_VALIDATE (pos, scm, CONSP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_LIST(pos, lst) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (scm_ilength (lst) >= 0, lst, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_NONEMPTYLIST(pos, lst) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (scm_ilength (lst) > 0, lst, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_LIST_COPYLEN(pos, lst, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
cvar = scm_ilength (lst); \
|
|
|
|
|
|
SCM_ASSERT (cvar >= 0, lst, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
2000-01-12 01:51:18 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_NONEMPTYLIST_COPYLEN(pos, lst, cvar) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
cvar = scm_ilength (lst); \
|
|
|
|
|
|
SCM_ASSERT (cvar >= 1, lst, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_ALISTCELL(pos, alist) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_CONSP (alist) && SCM_CONSP (SCM_CAR (alist)), \
|
|
|
|
|
|
alist, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_ALISTCELL_COPYSCM(pos, alist, cvar) \
|
1999-12-12 02:36:16 +00:00
|
|
|
|
do { \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
SCM_ASSERT (SCM_CONSP (alist), alist, pos, FUNC_NAME); \
|
|
|
|
|
|
cvar = SCM_CAR (alist); \
|
|
|
|
|
|
SCM_ASSERT (SCM_CONSP (cvar), alist, pos, FUNC_NAME); \
|
* tags.h (SCM_CONSP, SCM_NCONSP): Define these in terms of
SCM_SLOPPY_CONSP and SCM_SLOPPY_NCONSP. (SCM_CONSP) Define this
in terms of SCM_SLOPPY_NCONSP instead of repeating the
expression.
* symbols.h (SCM_SLOPPY_SUBSTRP, SCM_SUBSTRP): Added former, and
define latter in terms of sloppy variant.
* strings.h (SCM_SLOPPY_STRINGP, SCM_STRINGP): Added former, and
define latter in terms of sloppy variant.
* scm_validate.h (SCM_MAKE_VALIDATE): Added this macro to factor
out the commonality of the various basic SCM_VALIDATE_foop
macros. Use SCM_MAKE_VALIDATE macro where possible. Fix
SCM_VALIDATE_INT_COPY to not use scm_num2ulong -- that does
coercion to an integer which is more advanced than desired and
SCM_NUM2ULONG provides that functionality. Use SCM_ASSERT_RANGE
appropriately for the various _MIN, _MAX, _RANGE macros. Drop
some superfluous "SCM_NIMP &&" where possible. Eliminate obsoleted
SCM_VALIDATE_NIMCONS (SCM_VALIDATE_CONS now does the NIMP test as
part of its SCM_CONSP test).
* socket.c, ports.c, pairs.c, list.c, lang.c, async.c: Use
SCM_VALIDATE_CONS, not obsoleted SCM_VALIDATE_NIMCONS.
1999-12-19 01:04:37 +00:00
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_OPORT_VALUE(pos, port) \
|
1999-12-12 02:36:16 +00:00
|
|
|
|
do { \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
SCM_ASSERT (scm_valid_oport_value_p (port), port, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_VALIDATE_PRINTSTATE(pos, a) SCM_MAKE_VALIDATE(pos,a,PRINT_STATE_P)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_SMOB(pos, obj, type) \
|
|
|
|
|
|
do { \
|
2000-12-08 17:32:56 +00:00
|
|
|
|
SCM_ASSERT (SCM_TYP16_PREDICATE (scm_tc16_ ## type, obj), \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
obj, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_THREAD(pos, a) SCM_MAKE_VALIDATE (pos, a, THREADP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_THUNK(pos, thunk) \
|
|
|
|
|
|
do { \
|
2001-08-31 11:17:06 +00:00
|
|
|
|
SCM_ASSERT (!SCM_FALSEP (scm_thunk_p (thunk)), thunk, pos, FUNC_NAME); \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_SYMBOL(pos, sym) SCM_MAKE_VALIDATE (pos, sym, SYMBOLP)
|
1999-12-16 20:48:05 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_VARIABLE(pos, var) SCM_MAKE_VALIDATE (pos, var, VARIABLEP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_MEMOIZED(pos, obj) SCM_MAKE_VALIDATE (pos, obj, MEMOIZEDP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_CLOSURE(pos, obj) SCM_MAKE_VALIDATE (pos, obj, CLOSUREP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_PROC(pos, proc) \
|
|
|
|
|
|
do { \
|
2000-06-05 11:39:46 +00:00
|
|
|
|
SCM_ASSERT (SCM_EQ_P (scm_procedure_p (proc), SCM_BOOL_T), proc, pos, FUNC_NAME); \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_NULLORCONS(pos, env) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_NULLP (env) || SCM_CONSP (env), env, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_HOOK(pos, a) SCM_MAKE_VALIDATE (pos, a, HOOKP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_RGXP(pos, a) SCM_MAKE_VALIDATE (pos, a, RGXP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_DIR(pos, port) SCM_MAKE_VALIDATE (pos, port, DIRP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_PORT(pos, port) SCM_MAKE_VALIDATE (pos, port, PORTP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_INPUT_PORT(pos, port) \
|
|
|
|
|
|
SCM_MAKE_VALIDATE (pos, port, INPUT_PORT_P)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_OUTPUT_PORT(pos, port) \
|
|
|
|
|
|
SCM_MAKE_VALIDATE (pos, port, OUTPUT_PORT_P)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_FPORT(pos, port) SCM_MAKE_VALIDATE (pos, port, FPORTP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_OPFPORT(pos, port) SCM_MAKE_VALIDATE (pos, port, OPFPORTP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_OPINPORT(pos, port) \
|
|
|
|
|
|
SCM_MAKE_VALIDATE (pos, port, OPINPORTP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
#define SCM_VALIDATE_OPENPORT(pos,port) \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT (SCM_PORTP (port) && SCM_OPENP (port), \
|
|
|
|
|
|
port, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_OPPORT(pos, port) SCM_MAKE_VALIDATE (pos, port, OPPORTP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_OPOUTPORT(pos, port) \
|
|
|
|
|
|
SCM_MAKE_VALIDATE (pos, port, OPOUTPORTP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2001-03-15 11:24:45 +00:00
|
|
|
|
#define SCM_VALIDATE_OPOUTSTRPORT(pos, port) \
|
|
|
|
|
|
SCM_MAKE_VALIDATE (pos, port, OPOUTSTRPORTP)
|
|
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_FLUID(pos, fluid) SCM_MAKE_VALIDATE (pos, fluid, FLUIDP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_KEYWORD(pos, v) SCM_MAKE_VALIDATE (pos, v, KEYWORDP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_STACK(pos, v) SCM_MAKE_VALIDATE (pos, v, STACKP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_FRAME(pos, v) SCM_MAKE_VALIDATE (pos, v, FRAMEP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_RSTATE(pos, v) SCM_MAKE_VALIDATE (pos, v, RSTATEP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
#define SCM_VALIDATE_ARRAY(pos,v) \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
do { \
|
2001-08-31 11:17:06 +00:00
|
|
|
|
SCM_ASSERT (!SCM_IMP (v) \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
&& !SCM_FALSEP (scm_array_p (v, SCM_UNDEFINED)), \
|
|
|
|
|
|
v, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_VECTOR(pos, v) SCM_MAKE_VALIDATE (pos, v, VECTORP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_VECTOR_OR_DVECTOR(pos, v) \
|
|
|
|
|
|
do { \
|
|
|
|
|
|
SCM_ASSERT ((SCM_VECTORP (v) \
|
2001-08-31 11:17:06 +00:00
|
|
|
|
|| (!SCM_IMP (v) && SCM_TYP7 (v) == scm_tc7_dvect)), \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
v, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
2000-01-05 16:16:57 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_STRUCT(pos, v) SCM_MAKE_VALIDATE (pos, v, STRUCTP)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_VTABLE(pos, v) \
|
|
|
|
|
|
do { \
|
2001-08-31 11:17:06 +00:00
|
|
|
|
SCM_ASSERT (!SCM_IMP (v) && !SCM_FALSEP (scm_struct_vtable_p (v)), \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
v, pos, FUNC_NAME); \
|
|
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-15 19:30:16 +00:00
|
|
|
|
#define SCM_VALIDATE_VECTOR_LEN(pos, v, len) \
|
|
|
|
|
|
do { \
|
2000-10-09 16:27:24 +00:00
|
|
|
|
SCM_ASSERT (SCM_VECTORP (v) && len == SCM_VECTOR_LENGTH (v), v, pos, FUNC_NAME); \
|
2000-04-15 19:30:16 +00:00
|
|
|
|
} while (0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2001-08-31 11:17:06 +00:00
|
|
|
|
#endif /* SCM_VALIDATE_H */
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|