2001-03-06 01:22:37 +00:00
|
|
|
|
/* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc.
|
1996-07-25 22:56:11 +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.
|
|
|
|
|
|
*
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this software; see the file COPYING. If not, write to
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
|
|
|
* Boston, MA 02111-1307 USA
|
1996-07-25 22:56:11 +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.
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* If you do not wish that, delete this exception notice. */
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
* _scm.h: Removed #include <errno.h>.
* error.c, net_db.c, putenv.c, stime.c: Removed declaration of
errno variable (can be a macro on some systems, for example when
using linux libc with threads).
* error.c, filesys.c, gc.c, ioext.c, iselect.c, net_db.c, ports.c,
posix.c, print.c, putenv.c, scmsigs.c, script.c, simpos.c, smob.c,
socket.c, srcprop.c, stime.c, strop.c, unif.c, vports.c: Added
#include <errno.h> in these 20 out of 100 files.
2001-03-10 16:56:09 +00:00
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/_scm.h"
|
C files should #include only the header files they need, not
libguile.h (which #includes all the header files); the pointless
recompilation was wasting my time.
* Makefile.in (all .o dependency lists): Regenerated.
* libguile.h: Don't try to get a definition for size_t here...
* __scm.h: Do it here.
* _scm.h: Since this is the internal libguile header, put things
here that all (or a majority) of the libguile files will want.
Don't #include <libguile.h> here; that generates dependencies on
way too much. Instead, get "__scm.h", "error.h", "pairs.h",
"list.h", "gc.h", "gsubr.h", "procs.h", "numbers.h", "symbols.h",
"boolean.h", "strings.h", "vectors.h", "root.h", "ports.h", and
"async.h".
* alist.c: Get "eq.h", "list.h", "alist.h".
* append.c: Get "append.h", "list.h".
* arbiters.c: Get "arbiters.h", "smob.h".
* async.c: Get "async.h", "smob.h", "throw.h", "eval.h".
* boolean.c: Get "boolean.h".
* chars.c: Get "chars.h".
* continuations.c: Get "continuations.h", "dynwind.h", "debug.h",
"stackchk.h".
* debug.c: Get "debug.h", "feature.h", "read.h", "strports.h",
"continuations.h", "alist.h", "srcprop.h", "procprop.h", "smob.h",
"genio.h", "throw.h", "eval.h".
* dynwind.c: Get "dynwind.h", "alist.h", "eval.h".
* eq.c: Get "eq.h", "unif.h", "smob.h", "strorder.h",
"stackchk.h".
* error.c: Get "error.h", "throw.h", "genio.h", "pairs.h".
* eval.c: Get "eval.h", "stackchk.h", "srcprop.h", "debug.h",
"hashtab.h", "procprop.h", "markers.h", "smob.h", "throw.h",
"continuations.h", "eq.h", "sequences.h", "alist.h", "append.h",
"debug.h".
* fdsocket.c: Get "fdsocket.h", "unif.h", "filesys.h".
* feature.c: Get "feature.h".
* files.c: Get "files.h".
* filesys.c: Get "filesys.h", "smob.h", "genio.h".
* fports.c: Get "fports.h", "markers.h".
* gc.c: Get "async.h", "unif.h", "smob.h", "weaks.h",
"genio.h", "struct.h", "stackchk.h", "stime.h".
* gdbint.c: Get "gdbint.h", "chars.h", "eval.h", "print.h",
"read.h", "strports.h", "tag.h".
* genio.c: Get "genio.h", "chars.h".
* gsubr.c: Get "gsubr.h", "genio.h".
* hash.c: Get "hash.h", "chars.h".
* hashtab.c: Get "hashtab.h", "eval.h", "hash.h", "alist.h".
* init.c: Get everyone who has an scm_init_mumble function:
"weaks.h", "vports.h", "version.h", "vectors.h", "variable.h",
"unif.h", "throw.h", "tag.h", "symbols.h", "struct.h",
"strports.h", "strorder.h", "strop.h", "strings.h", "stime.h",
"stackchk.h", "srcprop.h", "socket.h", "simpos.h", "sequences.h",
"scmsigs.h", "read.h", "ramap.h", "procs.h", "procprop.h",
"print.h", "posix.h", "ports.h", "pairs.h", "options.h",
"objprop.h", "numbers.h", "mbstrings.h", "mallocs.h", "load.h",
"list.h", "kw.h", "ioext.h", "hashtab.h", "hash.h", "gsubr.h",
"gdbint.h", "gc.h", "fports.h", "filesys.h", "files.h",
"feature.h", "fdsocket.h", "eval.h", "error.h", "eq.h",
"dynwind.h", "debug.h", "continuations.h", "chars.h", "boolean.h",
"async.h", "arbiters.h", "append.h", "alist.h".
* ioext.c: Get "ioext.h", "fports.h".
* kw.c: Get "kw.h", "smob.h", "mbstrings.h", "genio.h".
* list.c: Get "list.h", "eq.h".
* load.c: Get "load.h", "eval.h", "read.h", "fports.h".
* mallocs.c: Get "smob.h", "genio.h".
* markers.c: Get "markers.h".
* mbstrings.c: Get "mbstrings.h", "read.h", "genio.h", "unif.h",
"chars.h".
* numbers.c: Get "unif.h", "genio.h".
* objprop.c: Get "objprop.h", "weaks.h", "alist.h", "hashtab.h".
* options.c: Get "options.h".
* ports.c: Get "ports.h", "vports.h", "strports.h", "fports.h",
"markers.h", "chars.h", "genio.h".
* posix.c: Get "posix.h", "sequences.h", "feature.h", "unif.h",
"read.h", "scmsigs.h", "genio.h", "fports.h".
* print.c: Get "print.h", "unif.h", "weaks.h", "read.h",
"procprop.h", "eval.h", "smob.h", "mbstrings.h", "genio.h",
"chars.h".
* procprop.c: Get "procprop.h", "eval.h", "alist.h".
* procs.c: Get "procs.h".
* ramap.c: Get "ramap.h", "feature.h", "eval.h", "eq.h",
"chars.h", "smob.h", "unif.h".
* read.c: Get "alist.h", "kw.h", "mbstrings.h", "unif.h",
"eval.h", "genio.h", "chars.h".
* root.c: Get "root.h", "stackchk.h".
* scmsigs.c: Get "scmsigs.h".
* sequences.c: Get "sequences.h".
* simpos.c: Get "simpos.h", "scmsigs.h".
* smob.c: Get "smob.h".
* socket.c: Get "socket.h", "feature.h".
* srcprop.c: Get "srcprop.h", "weaks.h", "hashtab.h", "debug.h",
"alist.h", "smob.h".
* stackchk.c: Get "stackchk.h", "genio.h".
* stime.c: Get "stime.h"."libguile/continuations.h".
* strings.c: Get "strings.h", "chars.h".
* strop.c: Get "strop.h", "chars.h".
* strorder.c: Get "strorder.h", "chars.h".
* strports.c: Get "strports.h", "print.h", "eval.h", "unif.h".
* struct.c: Get "struct.h", "chars.h".
* symbols.c: Get "symbols.h", "mbstrings.h", "alist.h",
"variable.h", "eval.h", "chars.h".
* tag.c: Get "tag.h", "struct.h", "chars.h".
* throw.c: Get "throw.h", "continuations.h", "debug.h",
"dynwind.h", "eval.h", "alist.h", "smob.h", "genio.h".
* unif.c: Get "unif.h", "feature.h", "strop.h", "sequences.h",
"smob.h", "genio.h", "eval.h", "chars.h".
* variable.c: Get "variable.h", "smob.h", "genio.h".
* vectors.c: Get "vectors.h", "eq.h".
* version.c: Get "version.h".
* vports.c: Get "vports.h", "fports.h", "chars.h", "eval.h".
* weaks.c: Get "weaks.h".
1996-09-10 02:26:07 +00:00
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/objects.h"
|
|
|
|
|
|
#include "libguile/ports.h"
|
1999-03-14 16:51:55 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#ifdef HAVE_MALLOC_H
|
|
|
|
|
|
#include <malloc.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/smob.h"
|
1999-05-23 09:57:31 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* scm_smobs scm_numsmob
|
2001-04-21 21:50:08 +00:00
|
|
|
|
* implement a fixed sized array of smob records.
|
1996-07-25 22:56:11 +00:00
|
|
|
|
* Indexes into this table are used when generating type
|
|
|
|
|
|
* tags for smobjects (if you know a tag you can get an index and conversely).
|
|
|
|
|
|
*/
|
2001-04-21 21:50:08 +00:00
|
|
|
|
|
|
|
|
|
|
#define MAX_SMOB_COUNT 256
|
2001-05-26 20:51:22 +00:00
|
|
|
|
long scm_numsmob;
|
2001-04-21 21:50:08 +00:00
|
|
|
|
scm_smob_descriptor scm_smobs[MAX_SMOB_COUNT];
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
1999-05-23 09:57:31 +00:00
|
|
|
|
/* {Mark}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* This function is vestigial. It used to be the mark function's
|
|
|
|
|
|
responsibility to set the mark bit on the smob or port, but now the
|
|
|
|
|
|
generic marking routine in gc.c takes care of that, and a zero
|
|
|
|
|
|
pointer for a mark function means "don't bother". So you never
|
|
|
|
|
|
need scm_mark0.
|
|
|
|
|
|
|
|
|
|
|
|
However, we leave it here because it's harmless to call it, and
|
|
|
|
|
|
people out there have smob code that uses it, and there's no reason
|
|
|
|
|
|
to make their links fail. */
|
|
|
|
|
|
|
|
|
|
|
|
SCM
|
2001-06-07 21:12:19 +00:00
|
|
|
|
scm_mark0 (SCM ptr SCM_UNUSED)
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCM
|
2001-03-30 15:03:23 +00:00
|
|
|
|
/* Dirk::FIXME: The name markcdr is misleading, since the term cdr should only
|
|
|
|
|
|
be used for real pairs. */
|
1999-12-12 20:35:02 +00:00
|
|
|
|
scm_markcdr (SCM ptr)
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
2001-03-30 15:03:23 +00:00
|
|
|
|
return SCM_CELL_OBJECT_1 (ptr);
|
1999-05-23 09:57:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* {Free}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
* 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
|
|
|
|
size_t
|
2001-06-07 21:12:19 +00:00
|
|
|
|
scm_free0 (SCM ptr SCM_UNUSED)
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* 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
|
|
|
|
size_t
|
1999-05-23 09:57:31 +00:00
|
|
|
|
scm_smob_free (SCM obj)
|
|
|
|
|
|
{
|
* gc.h, gc.c (scm_gc_sweep): Issue deprecation warning when
non-zero is returned from a port or smob free function.
(scm_malloc, scm_realloc, scm_strndup, scm_strdup,
scm_gc_register_collectable_memory,
scm_gc_unregister_collectable_memory, scm_gc_malloc,
scm_gc_realloc, scm_gc_free, scm_gc_strndup, scm_gc_strdup): New.
* backtrace.c, continuations.c, convert.i.c, coop-threads.c,
debug-malloc.c, dynl.c, environments.c, environments.h,
extensions.c, filesys.c, fports.c, gc.c, gc.h, gh_data.c, goops.c,
guardians.c, hooks.c, init.c, keywords.c, load.c, numbers.c,
ports.c, posix.c, procs.c, rdelim.c, regex-posix.c, root.c,
smob.c, stime.c, strings.c, struct.c, struct.h, symbols.c, unif.c,
vectors.c, weaks.c: Use scm_gc_malloc/scm_malloc and
scm_gc_free/free instead of scm_must_malloc and scm_must_free, as
appropriate. Return zero from smob and port free functions.
* debug-malloc.c (scm_malloc_reregister): Handle "old == NULL".
* fports.c (scm_setvbuf): Reset read buffer to saved values when
it is pointing to the putback buffer.
2002-02-11 18:06:50 +00:00
|
|
|
|
long n = SCM_SMOBNUM (obj);
|
|
|
|
|
|
if (scm_smobs[n].size > 0)
|
|
|
|
|
|
scm_gc_free ((void *) SCM_CELL_WORD_1 (obj),
|
|
|
|
|
|
scm_smobs[n].size, SCM_SMOBNAME (n));
|
|
|
|
|
|
return 0;
|
1999-05-23 09:57:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* {Print}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2001-06-07 21:12:19 +00:00
|
|
|
|
scm_smob_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED)
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
2001-05-26 20:51:22 +00:00
|
|
|
|
long n = SCM_SMOBNUM (exp);
|
1999-05-23 09:57:31 +00:00
|
|
|
|
scm_puts ("#<", port);
|
1999-07-24 23:10:27 +00:00
|
|
|
|
scm_puts (SCM_SMOBNAME (n) ? SCM_SMOBNAME (n) : "smob", port);
|
1999-05-23 09:57:31 +00:00
|
|
|
|
scm_putc (' ', port);
|
2001-04-21 21:50:08 +00:00
|
|
|
|
if (scm_smobs[n].size)
|
|
|
|
|
|
scm_intprint (SCM_CELL_WORD_1 (exp), 16, port);
|
|
|
|
|
|
else
|
|
|
|
|
|
scm_intprint (SCM_UNPACK (exp), 16, port);
|
1999-05-23 09:57:31 +00:00
|
|
|
|
scm_putc ('>', port);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
2000-08-25 02:26:22 +00:00
|
|
|
|
/* {Apply}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2000-12-07 00:55:12 +00:00
|
|
|
|
#define SCM_SMOB_APPLY0(SMOB) \
|
|
|
|
|
|
SCM_SMOB_DESCRIPTOR (SMOB).apply (SMOB)
|
2002-07-20 14:08:34 +00:00
|
|
|
|
#define SCM_SMOB_APPLY1(SMOB, A1) \
|
2000-12-07 00:55:12 +00:00
|
|
|
|
SCM_SMOB_DESCRIPTOR (SMOB).apply (SMOB, A1)
|
2002-07-20 14:08:34 +00:00
|
|
|
|
#define SCM_SMOB_APPLY2(SMOB, A1, A2) \
|
2000-12-07 00:55:12 +00:00
|
|
|
|
SCM_SMOB_DESCRIPTOR (SMOB).apply (SMOB, A1, A2)
|
2002-07-20 14:08:34 +00:00
|
|
|
|
#define SCM_SMOB_APPLY3(SMOB, A1, A2, A3) \
|
2000-12-07 00:55:12 +00:00
|
|
|
|
SCM_SMOB_DESCRIPTOR (SMOB).apply (SMOB, A1, A2, A3)
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_0_010 (SCM smob)
|
2000-08-25 02:26:22 +00:00
|
|
|
|
{
|
2000-12-07 00:55:12 +00:00
|
|
|
|
return SCM_SMOB_APPLY1 (smob, SCM_UNDEFINED);
|
2000-08-25 02:26:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2000-12-07 00:55:12 +00:00
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_0_020 (SCM smob)
|
2000-08-25 02:26:22 +00:00
|
|
|
|
{
|
2000-12-07 00:55:12 +00:00
|
|
|
|
return SCM_SMOB_APPLY2 (smob, SCM_UNDEFINED, SCM_UNDEFINED);
|
2000-08-25 02:26:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2000-12-07 00:55:12 +00:00
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_0_030 (SCM smob)
|
2000-08-25 02:26:22 +00:00
|
|
|
|
{
|
2000-12-07 00:55:12 +00:00
|
|
|
|
return SCM_SMOB_APPLY3 (smob, SCM_UNDEFINED, SCM_UNDEFINED, SCM_UNDEFINED);
|
2000-08-25 02:26:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2000-12-07 00:55:12 +00:00
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_0_001 (SCM smob)
|
2000-08-25 02:26:22 +00:00
|
|
|
|
{
|
2000-12-07 00:55:12 +00:00
|
|
|
|
return SCM_SMOB_APPLY1 (smob, SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_0_011 (SCM smob)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY2 (smob, SCM_UNDEFINED, SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_0_021 (SCM smob)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY3 (smob, SCM_UNDEFINED, SCM_UNDEFINED, SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_0_error (SCM smob)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_wrong_num_args (smob);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_1_020 (SCM smob, SCM a1)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY2 (smob, a1, SCM_UNDEFINED);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_1_030 (SCM smob, SCM a1)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY3 (smob, a1, SCM_UNDEFINED, SCM_UNDEFINED);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_1_001 (SCM smob, SCM a1)
|
|
|
|
|
|
{
|
* list.h (scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5,
scm_list_n): New functions.
(SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, SCM_LIST5,
SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9, scm_listify): Deprecated.
(lots of files): Use the new functions.
* goops.c (CALL_GF1, CALL_GF2, CALL_GF3, CALL_GF4): Use scm_call_N.
* strings.c: #include "libguile/deprecation.h".
2001-06-28 01:11:59 +00:00
|
|
|
|
return SCM_SMOB_APPLY1 (smob, scm_list_1 (a1));
|
2000-12-07 00:55:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_1_011 (SCM smob, SCM a1)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY2 (smob, a1, SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_1_021 (SCM smob, SCM a1)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY3 (smob, a1, SCM_UNDEFINED, SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
2001-06-07 21:12:19 +00:00
|
|
|
|
scm_smob_apply_1_error (SCM smob, SCM a1 SCM_UNUSED)
|
2000-12-07 00:55:12 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_wrong_num_args (smob);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_2_030 (SCM smob, SCM a1, SCM a2)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY3 (smob, a1, a2, SCM_UNDEFINED);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_2_001 (SCM smob, SCM a1, SCM a2)
|
|
|
|
|
|
{
|
* list.h (scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5,
scm_list_n): New functions.
(SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, SCM_LIST5,
SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9, scm_listify): Deprecated.
(lots of files): Use the new functions.
* goops.c (CALL_GF1, CALL_GF2, CALL_GF3, CALL_GF4): Use scm_call_N.
* strings.c: #include "libguile/deprecation.h".
2001-06-28 01:11:59 +00:00
|
|
|
|
return SCM_SMOB_APPLY1 (smob, scm_list_2 (a1, a2));
|
2000-12-07 12:04:48 +00:00
|
|
|
|
}
|
2000-12-07 00:55:12 +00:00
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_2_011 (SCM smob, SCM a1, SCM a2)
|
|
|
|
|
|
{
|
* list.h (scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5,
scm_list_n): New functions.
(SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, SCM_LIST5,
SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9, scm_listify): Deprecated.
(lots of files): Use the new functions.
* goops.c (CALL_GF1, CALL_GF2, CALL_GF3, CALL_GF4): Use scm_call_N.
* strings.c: #include "libguile/deprecation.h".
2001-06-28 01:11:59 +00:00
|
|
|
|
return SCM_SMOB_APPLY2 (smob, a1, scm_list_1 (a2));
|
2000-12-07 00:55:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_2_021 (SCM smob, SCM a1, SCM a2)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY3 (smob, a1, a2, SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
2001-06-07 21:12:19 +00:00
|
|
|
|
scm_smob_apply_2_error (SCM smob, SCM a1 SCM_UNUSED, SCM a2 SCM_UNUSED)
|
2000-12-07 00:55:12 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_wrong_num_args (smob);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_3_030 (SCM smob, SCM a1, SCM a2, SCM rst)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!SCM_NULLP (SCM_CDR (rst)))
|
|
|
|
|
|
scm_wrong_num_args (smob);
|
|
|
|
|
|
return SCM_SMOB_APPLY3 (smob, a1, a2, SCM_CAR (rst));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_3_001 (SCM smob, SCM a1, SCM a2, SCM rst)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY1 (smob, scm_cons2 (a1, a2, rst));
|
2000-08-25 02:26:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2000-12-07 00:55:12 +00:00
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_3_011 (SCM smob, SCM a1, SCM a2, SCM rst)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY2 (smob, a1, scm_cons (a2, rst));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
scm_smob_apply_3_021 (SCM smob, SCM a1, SCM a2, SCM rst)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SCM_SMOB_APPLY3 (smob, a1, a2, rst);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
2001-06-07 21:12:19 +00:00
|
|
|
|
scm_smob_apply_3_error (SCM smob,
|
|
|
|
|
|
SCM a1 SCM_UNUSED,
|
|
|
|
|
|
SCM a2 SCM_UNUSED,
|
|
|
|
|
|
SCM rst SCM_UNUSED)
|
2000-12-07 00:55:12 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_wrong_num_args (smob);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-04-21 21:50:08 +00:00
|
|
|
|
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_bits
|
* 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
|
|
|
|
scm_make_smob_type (char *name, size_t size)
|
2001-04-21 21:50:08 +00:00
|
|
|
|
#define FUNC_NAME "scm_make_smob_type"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2001-05-26 20:51:22 +00:00
|
|
|
|
long new_smob;
|
2001-04-21 21:50:08 +00:00
|
|
|
|
|
|
|
|
|
|
SCM_ENTER_A_SECTION; /* scm_numsmob */
|
|
|
|
|
|
new_smob = scm_numsmob;
|
|
|
|
|
|
if (scm_numsmob != MAX_SMOB_COUNT)
|
|
|
|
|
|
++scm_numsmob;
|
|
|
|
|
|
SCM_EXIT_A_SECTION;
|
|
|
|
|
|
|
|
|
|
|
|
if (new_smob == MAX_SMOB_COUNT)
|
|
|
|
|
|
scm_misc_error (FUNC_NAME, "maximum number of smobs exceeded", SCM_EOL);
|
|
|
|
|
|
|
|
|
|
|
|
scm_smobs[new_smob].name = name;
|
|
|
|
|
|
if (size != 0)
|
2000-06-29 15:54:58 +00:00
|
|
|
|
{
|
2001-04-21 21:50:08 +00:00
|
|
|
|
scm_smobs[new_smob].size = size;
|
|
|
|
|
|
scm_smobs[new_smob].free = scm_smob_free;
|
2000-06-29 15:54:58 +00:00
|
|
|
|
}
|
2001-04-21 21:50:08 +00:00
|
|
|
|
|
1999-03-14 16:51:55 +00:00
|
|
|
|
/* Make a class object if Goops is present. */
|
|
|
|
|
|
if (scm_smob_class)
|
2001-04-21 21:50:08 +00:00
|
|
|
|
scm_smob_class[new_smob] = scm_make_extended_class (name);
|
|
|
|
|
|
|
|
|
|
|
|
return scm_tc7_smob + new_smob * 256;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2001-04-21 21:50:08 +00:00
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
1999-05-23 09:57:31 +00:00
|
|
|
|
void
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_set_smob_mark (scm_t_bits tc, SCM (*mark) (SCM))
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].mark = mark;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_set_smob_free (scm_t_bits tc, size_t (*free) (SCM))
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].free = free;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_set_smob_print (scm_t_bits tc, int (*print) (SCM, SCM, scm_print_state*))
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].print = print;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_set_smob_equalp (scm_t_bits tc, SCM (*equalp) (SCM, SCM))
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].equalp = equalp;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-08-25 02:26:22 +00:00
|
|
|
|
void
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_set_smob_apply (scm_t_bits tc, SCM (*apply) (),
|
2000-12-07 12:04:48 +00:00
|
|
|
|
unsigned int req, unsigned int opt, unsigned int rst)
|
2000-08-25 02:26:22 +00:00
|
|
|
|
{
|
2000-12-07 00:55:12 +00:00
|
|
|
|
SCM (*apply_0) (SCM);
|
|
|
|
|
|
SCM (*apply_1) (SCM, SCM);
|
|
|
|
|
|
SCM (*apply_2) (SCM, SCM, SCM);
|
|
|
|
|
|
SCM (*apply_3) (SCM, SCM, SCM, SCM);
|
|
|
|
|
|
int type = SCM_GSUBR_MAKTYPE (req, opt, rst);
|
|
|
|
|
|
|
2000-12-07 12:04:48 +00:00
|
|
|
|
if (rst > 1 || req + opt + rst > 3)
|
2000-12-07 00:55:12 +00:00
|
|
|
|
{
|
|
|
|
|
|
puts ("Unsupported smob application type");
|
|
|
|
|
|
abort ();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 0, 0):
|
2000-12-07 12:04:48 +00:00
|
|
|
|
apply_0 = apply; break;
|
2000-12-07 00:55:12 +00:00
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 1, 0):
|
|
|
|
|
|
apply_0 = scm_smob_apply_0_010; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 2, 0):
|
|
|
|
|
|
apply_0 = scm_smob_apply_0_020; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 3, 0):
|
|
|
|
|
|
apply_0 = scm_smob_apply_0_030; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 0, 1):
|
|
|
|
|
|
apply_0 = scm_smob_apply_0_001; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 1, 1):
|
|
|
|
|
|
apply_0 = scm_smob_apply_0_011; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 2, 1):
|
|
|
|
|
|
apply_0 = scm_smob_apply_0_021; break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
apply_0 = scm_smob_apply_0_error; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 0, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 1, 0):
|
2000-12-07 12:04:48 +00:00
|
|
|
|
apply_1 = apply; break;
|
2000-12-07 00:55:12 +00:00
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 1, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 2, 0):
|
|
|
|
|
|
apply_1 = scm_smob_apply_1_020; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 2, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 3, 0):
|
|
|
|
|
|
apply_1 = scm_smob_apply_1_030; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 0, 1):
|
|
|
|
|
|
apply_1 = scm_smob_apply_1_001; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 0, 1):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 1, 1):
|
|
|
|
|
|
apply_1 = scm_smob_apply_1_011; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 1, 1):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 2, 1):
|
|
|
|
|
|
apply_1 = scm_smob_apply_1_021; break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
apply_1 = scm_smob_apply_1_error; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (2, 0, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 1, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 2, 0):
|
2000-12-07 12:04:48 +00:00
|
|
|
|
apply_2 = apply; break;
|
2000-12-07 00:55:12 +00:00
|
|
|
|
case SCM_GSUBR_MAKTYPE (2, 1, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 2, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 3, 0):
|
|
|
|
|
|
apply_2 = scm_smob_apply_2_030; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 0, 1):
|
|
|
|
|
|
apply_2 = scm_smob_apply_2_001; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 0, 1):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 1, 1):
|
|
|
|
|
|
apply_2 = scm_smob_apply_2_011; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (2, 0, 1):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 1, 1):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 2, 1):
|
|
|
|
|
|
apply_2 = scm_smob_apply_2_021; break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
apply_2 = scm_smob_apply_2_error; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (3, 0, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (2, 1, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 2, 0):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 3, 0):
|
|
|
|
|
|
apply_3 = scm_smob_apply_3_030; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 0, 1):
|
|
|
|
|
|
apply_3 = scm_smob_apply_3_001; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 0, 1):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 1, 1):
|
|
|
|
|
|
apply_3 = scm_smob_apply_3_011; break;
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (2, 0, 1):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (1, 1, 1):
|
|
|
|
|
|
case SCM_GSUBR_MAKTYPE (0, 2, 1):
|
|
|
|
|
|
apply_3 = scm_smob_apply_3_021; break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
apply_3 = scm_smob_apply_3_error; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2001-02-03 04:59:16 +00:00
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].apply = apply;
|
2000-12-07 00:55:12 +00:00
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].apply_0 = apply_0;
|
|
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].apply_1 = apply_1;
|
|
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].apply_2 = apply_2;
|
|
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].apply_3 = apply_3;
|
2000-12-07 07:10:26 +00:00
|
|
|
|
scm_smobs[SCM_TC2SMOBNUM (tc)].gsubr_type = type;
|
2000-08-25 02:26:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
1999-05-23 09:57:31 +00:00
|
|
|
|
SCM
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_make_smob (scm_t_bits tc)
|
1999-05-23 09:57:31 +00:00
|
|
|
|
{
|
2001-05-26 20:51:22 +00:00
|
|
|
|
long n = SCM_TC2SMOBNUM (tc);
|
* 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
|
|
|
|
size_t size = scm_smobs[n].size;
|
2001-11-25 15:21:07 +00:00
|
|
|
|
scm_t_bits data = (size > 0
|
* gc.h, gc.c (scm_gc_sweep): Issue deprecation warning when
non-zero is returned from a port or smob free function.
(scm_malloc, scm_realloc, scm_strndup, scm_strdup,
scm_gc_register_collectable_memory,
scm_gc_unregister_collectable_memory, scm_gc_malloc,
scm_gc_realloc, scm_gc_free, scm_gc_strndup, scm_gc_strdup): New.
* backtrace.c, continuations.c, convert.i.c, coop-threads.c,
debug-malloc.c, dynl.c, environments.c, environments.h,
extensions.c, filesys.c, fports.c, gc.c, gc.h, gh_data.c, goops.c,
guardians.c, hooks.c, init.c, keywords.c, load.c, numbers.c,
ports.c, posix.c, procs.c, rdelim.c, regex-posix.c, root.c,
smob.c, stime.c, strings.c, struct.c, struct.h, symbols.c, unif.c,
vectors.c, weaks.c: Use scm_gc_malloc/scm_malloc and
scm_gc_free/free instead of scm_must_malloc and scm_must_free, as
appropriate. Return zero from smob and port free functions.
* debug-malloc.c (scm_malloc_reregister): Handle "old == NULL".
* fports.c (scm_setvbuf): Reset read buffer to saved values when
it is pointing to the putback buffer.
2002-02-11 18:06:50 +00:00
|
|
|
|
? (scm_t_bits) scm_gc_malloc (size, SCM_SMOBNAME (n))
|
2001-11-25 15:21:07 +00:00
|
|
|
|
: 0);
|
Changes in doc/ref:
* api.txt, data-rep.texi: Renamed the struct scm_cell to
scm_t_cell.
* data-rep.texi: Renamed scm_alloc_cell to scm_cell and
scm_alloc_double_cell to scm_double_cell.
Changes in libguile:
* gc.c (SCM_HEAP_SEG_SIZE, CELL_UP, CELL_DN, NEXT_DATA_CELL,
init_heap_seg, alloc_some_heap), gc.h (struct scm_cell, struct
scm_t_cell, SCM_CELLPTR, SCM_GC_CARD_SIZE,
SCM_GC_IN_CARD_HEADERP), tags.h (SCM_CELLP): Renamed the struct
scm_cell and all its uses to scm_t_cell in accordance to Guile's
naming scheme for types.
* alist.c (scm_acons), convert.i.c (CTYPES2UVECT,
CTYPES2UVECT_OPTIONAL), coop-threads.c (scm_call_with_new_thread,
scm_spawn_thread), debug.c (scm_make_debugobj), environments.c
(scm_make_environment), eval.c (scm_closure), fports.c
(scm_fdes_to_port), gc.c (scm_deprecated_newcell,
scm_deprecated_newcell2), inline.h (scm_alloc_cell, scm_cell),
list.c (SCM_I_CONS), numbers.c (scm_i_mkbig), pairs.c (scm_cons),
ports.c (scm_void_port), procs.c (scm_c_make_subr, scm_makcclo),
smob.c (scm_make_smob), smob.h (SCM_NEWSMOB), strings.c
(scm_take_str, scm_allocate_string), strports.c (scm_mkstrport),
unif.c (scm_make_uve), variable.c (make_variable), vectors.c
(scm_c_make_vector), vports.c (scm_make_soft_port): Renamed
scm_alloc_cell to scm_cell.
* environments.c (core_environments_observe), gc.c
(scm_deprecated_newcell2), goops.c (wrap_init, scm_wrap_object),
inline.h (scm_alloc_double_cell, scm_double_cell), num2float.i.c
(FLOAT2NUM), numbers.c (scm_make_real), procs.c
(scm_make_procedure_with_setter), smob.h (SCM_NEWSMOB2,
SCM_NEWSMOB3), struct.c (scm_make_struct, scm_make_vtable_vtable),
symbols.c (scm_mem2symbol, scm_mem2uninterned_symbol), weaks.c
(allocate_weak_vector): Renamed scm_alloc_double_cell to
scm_double_cell.
2002-03-01 00:19:20 +00:00
|
|
|
|
return scm_cell (tc, data);
|
1999-05-23 09:57:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
1998-12-05 16:52:34 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
/* {Initialization for i/o types, float, bignum, the type of free cells}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
1998-12-05 16:52:34 +00:00
|
|
|
|
static int
|
2001-06-07 21:12:19 +00:00
|
|
|
|
free_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED)
|
1998-12-05 16:52:34 +00:00
|
|
|
|
{
|
|
|
|
|
|
char buf[100];
|
2000-12-08 17:32:56 +00:00
|
|
|
|
sprintf (buf, "#<freed cell %p; GC missed a reference>",
|
|
|
|
|
|
(void *) SCM_UNPACK (exp));
|
1998-12-05 16:52:34 +00:00
|
|
|
|
scm_puts (buf, port);
|
2002-09-08 11:31:32 +00:00
|
|
|
|
|
|
|
|
|
|
#if (SCM_DEBUG_CELL_ACCESSES == 1)
|
|
|
|
|
|
if (scm_debug_cell_accesses_p)
|
|
|
|
|
|
abort();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
1998-12-05 16:52:34 +00:00
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_smob_prehistory ()
|
|
|
|
|
|
{
|
2001-05-26 20:51:22 +00:00
|
|
|
|
long i;
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_bits tc;
|
2000-12-08 17:32:56 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_numsmob = 0;
|
2001-04-21 21:50:08 +00:00
|
|
|
|
for (i = 0; i < MAX_SMOB_COUNT; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_smobs[i].name = 0;
|
|
|
|
|
|
scm_smobs[i].size = 0;
|
|
|
|
|
|
scm_smobs[i].mark = 0;
|
|
|
|
|
|
scm_smobs[i].free = 0;
|
|
|
|
|
|
scm_smobs[i].print = scm_smob_print;
|
|
|
|
|
|
scm_smobs[i].equalp = 0;
|
|
|
|
|
|
scm_smobs[i].apply = 0;
|
|
|
|
|
|
scm_smobs[i].apply_0 = 0;
|
|
|
|
|
|
scm_smobs[i].apply_1 = 0;
|
|
|
|
|
|
scm_smobs[i].apply_2 = 0;
|
|
|
|
|
|
scm_smobs[i].apply_3 = 0;
|
|
|
|
|
|
scm_smobs[i].gsubr_type = 0;
|
|
|
|
|
|
}
|
1999-05-23 09:57:31 +00:00
|
|
|
|
|
|
|
|
|
|
/* WARNING: These scm_make_smob_type calls must be done in this order */
|
2000-12-08 17:32:56 +00:00
|
|
|
|
tc = scm_make_smob_type ("free", 0);
|
|
|
|
|
|
scm_set_smob_print (tc, free_print);
|
1999-07-07 09:44:01 +00:00
|
|
|
|
|
2001-04-21 21:50:08 +00:00
|
|
|
|
tc = scm_make_smob_type ("big", 0); /* freed in gc */
|
2000-12-08 17:32:56 +00:00
|
|
|
|
scm_set_smob_print (tc, scm_bigprint);
|
|
|
|
|
|
scm_set_smob_equalp (tc, scm_bigequal);
|
1999-07-07 09:44:01 +00:00
|
|
|
|
|
2000-12-08 17:32:56 +00:00
|
|
|
|
tc = scm_make_smob_type ("real", 0); /* freed in gc */
|
|
|
|
|
|
scm_set_smob_print (tc, scm_print_real);
|
|
|
|
|
|
scm_set_smob_equalp (tc, scm_real_equalp);
|
2000-03-14 06:43:57 +00:00
|
|
|
|
|
2001-04-21 21:50:08 +00:00
|
|
|
|
tc = scm_make_smob_type ("complex", 0); /* freed in gc */
|
2000-12-08 17:32:56 +00:00
|
|
|
|
scm_set_smob_print (tc, scm_print_complex);
|
|
|
|
|
|
scm_set_smob_equalp (tc, scm_complex_equalp);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|