1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

87 commits

Author SHA1 Message Date
Andy Wingo
1234bb1850 Update license notices in all C files
Update to newest recommended license notices from the FSF.  Everything
stays LGPLv3+ except guile-readline which is GPLv3+.
2018-06-20 20:07:34 +02:00
Andy Wingo
791eb0c01a Remove (C) from copyright statements
As the FSF advises, 'There is no legal significance to using the
three-character sequence “(C)”, but it does no harm.'  It does take up
space though!  For that reason, we remove it here from our C files.
2018-06-20 19:17:06 +02:00
Andy Wingo
97cc65fee4 Rename __scm.h to scm.h
* libguile/scm.h: Rename.  Update all includers.
2018-06-20 16:33:33 +02:00
Andy Wingo
c495b44714 Remove Emacs local variables comments in Guile source
The .dir-locals.el file in the repository is sufficient for Emacs
users.

* libguile/__scm.h:
* libguile/alist.c:
* libguile/alist.h:
* libguile/array-handle.c:
* libguile/array-handle.h:
* libguile/array-map.c:
* libguile/array-map.h:
* libguile/arrays.c:
* libguile/arrays.h:
* libguile/async.c:
* libguile/async.h:
* libguile/backtrace.c:
* libguile/backtrace.h:
* libguile/bitvectors.c:
* libguile/bitvectors.h:
* libguile/boolean.c:
* libguile/boolean.h:
* libguile/chars.c:
* libguile/chars.h:
* libguile/chooks.c:
* libguile/chooks.h:
* libguile/continuations.c:
* libguile/continuations.h:
* libguile/control.c:
* libguile/conv-integer.i.c:
* libguile/debug-malloc.h:
* libguile/debug.c:
* libguile/debug.h:
* libguile/deprecation.c:
* libguile/deprecation.h:
* libguile/dynl.c:
* libguile/dynl.h:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/dynwind.c:
* libguile/dynwind.h:
* libguile/eq.c:
* libguile/eq.h:
* libguile/error.c:
* libguile/error.h:
* libguile/eval.c:
* libguile/eval.h:
* libguile/evalext.c:
* libguile/evalext.h:
* libguile/expand.c:
* libguile/expand.h:
* libguile/extensions.c:
* libguile/extensions.h:
* libguile/feature.c:
* libguile/feature.h:
* libguile/filesys.c:
* libguile/filesys.h:
* libguile/fluids.c:
* libguile/fluids.h:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/fports.h:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gc-inline.h:
* libguile/gc.c:
* libguile/gc.h:
* libguile/generalized-arrays.c:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h:
* libguile/gettext.c:
* libguile/gettext.h:
* libguile/goops.c:
* libguile/goops.h:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/guardians.c:
* libguile/guardians.h:
* libguile/guile.c:
* libguile/hash.c:
* libguile/hash.h:
* libguile/hashtab.c:
* libguile/hashtab.h:
* libguile/hooks.c:
* libguile/hooks.h:
* libguile/i18n.c:
* libguile/i18n.h:
* libguile/init.c:
* libguile/init.h:
* libguile/instructions.c:
* libguile/instructions.h:
* libguile/intrinsics.c:
* libguile/intrinsics.h:
* libguile/ioext.c:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.c:
* libguile/keywords.h:
* libguile/list.c:
* libguile/list.h:
* libguile/load.c:
* libguile/load.h:
* libguile/loader.c:
* libguile/loader.h:
* libguile/macros.c:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memmove.c:
* libguile/memoize.c:
* libguile/memoize.h:
* libguile/modules.c:
* libguile/modules.h:
* libguile/net_db.c:
* libguile/net_db.h:
* libguile/null-threads.c:
* libguile/null-threads.h:
* libguile/numbers.c:
* libguile/numbers.h:
* libguile/objprop.c:
* libguile/objprop.h:
* libguile/options.c:
* libguile/options.h:
* libguile/pairs.c:
* libguile/pairs.h:
* libguile/poll.c:
* libguile/poll.h:
* libguile/ports.c:
* libguile/ports.h:
* libguile/posix.c:
* libguile/posix.h:
* libguile/print.c:
* libguile/print.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/procs.c:
* libguile/procs.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/promises.c:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.c:
* libguile/random.h:
* libguile/rdelim.c:
* libguile/rdelim.h:
* libguile/read.c:
* libguile/read.h:
* libguile/regex-posix.c:
* libguile/regex-posix.h:
* libguile/rw.c:
* libguile/rw.h:
* libguile/scmsigs.c:
* libguile/scmsigs.h:
* libguile/script.c:
* libguile/script.h:
* libguile/simpos.c:
* libguile/simpos.h:
* libguile/smob.c:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.c:
* libguile/socket.h:
* libguile/sort.c:
* libguile/sort.h:
* libguile/srcprop.c:
* libguile/srcprop.h:
* libguile/stackchk.c:
* libguile/stackchk.h:
* libguile/stacks.c:
* libguile/stacks.h:
* libguile/stime.c:
* libguile/stime.h:
* libguile/strerror.c:
* libguile/strings.c:
* libguile/strings.h:
* libguile/strorder.c:
* libguile/strorder.h:
* libguile/strports.c:
* libguile/strports.h:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/symbols.h:
* libguile/syntax.c:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.c:
* libguile/threads.h:
* libguile/throw.c:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.c:
* libguile/unicode.h:
* libguile/uniform.c:
* libguile/uniform.h:
* libguile/values.c:
* libguile/values.h:
* libguile/variable.c:
* libguile/variable.h:
* libguile/vectors.c:
* libguile/vectors.h:
* libguile/version.c:
* libguile/vm-engine.c:
* libguile/vm-expand.h:
* libguile/vm.c:
* libguile/vm.h:
* libguile/vports.c:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.c:
* libguile/weak-set.h:
* libguile/weak-table.c:
* libguile/weak-table.h:
* libguile/weak-vector.c:
* libguile/weak-vector.h: Remove needless trailing comments.
2018-06-20 14:32:28 +02:00
Andy Wingo
5534c2817e Remove useless "classes: h_files" from Guile headers.
* libguile/__scm.h:
* libguile/alist.h:
* libguile/array-handle.h:
* libguile/array-map.h:
* libguile/arrays.h:
* libguile/async.h:
* libguile/backtrace.h:
* libguile/bitvectors.h:
* libguile/boolean.h:
* libguile/chars.h:
* libguile/chooks.h:
* libguile/continuations.h:
* libguile/debug-malloc.h:
* libguile/debug.h:
* libguile/deprecation.h:
* libguile/dynl.h:
* libguile/dynstack.h:
* libguile/dynwind.h:
* libguile/eq.h:
* libguile/error.h:
* libguile/eval.h:
* libguile/evalext.h:
* libguile/expand.h:
* libguile/extensions.h:
* libguile/feature.h:
* libguile/filesys.h:
* libguile/fluids.h:
* libguile/fports.h:
* libguile/gc-inline.h:
* libguile/gc.h:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.h:
* libguile/gettext.h:
* libguile/goops.h:
* libguile/gsubr.h:
* libguile/guardians.h:
* libguile/hash.h:
* libguile/hashtab.h:
* libguile/hooks.h:
* libguile/i18n.h:
* libguile/init.h:
* libguile/inline.h:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.h:
* libguile/list.h:
* libguile/load.h:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memoize.h:
* libguile/modules.h:
* libguile/net_db.h:
* libguile/null-threads.h:
* libguile/numbers.h:
* libguile/objprop.h:
* libguile/options.h:
* libguile/pairs.h:
* libguile/poll.h:
* libguile/ports.h:
* libguile/posix-w32.h:
* libguile/posix.h:
* libguile/print.h:
* libguile/procprop.h:
* libguile/procs.h:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.h:
* libguile/rdelim.h:
* libguile/read.h:
* libguile/regex-posix.h:
* libguile/rw.h:
* libguile/scmsigs.h:
* libguile/script.h:
* libguile/simpos.h:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.h:
* libguile/sort.h:
* libguile/srcprop.h:
* libguile/stackchk.h:
* libguile/stacks.h:
* libguile/stime.h:
* libguile/strings.h:
* libguile/strorder.h:
* libguile/strports.h:
* libguile/struct.h:
* libguile/symbols.h:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.h:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.h:
* libguile/uniform.h:
* libguile/values.h:
* libguile/variable.h:
* libguile/vectors.h:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.h:
* libguile/weak-table.h:
* libguile/weak-vector.h: Remove "classes: h_files".  Reformat
  copyrights if needed.
2018-06-20 14:26:16 +02:00
Andy Wingo
d340a9709c Shuffle around inline C function implementation
* libguile/__scm.h:
* libguile/inline.h (SCM_C_EXTERN_INLINE, SCM_CAN_INLINE, SCM_INLINE)
  (SCM_INLINE_IMPLEMENTATION): Move definitions here, from __scm.h.
* libguile/strings.h (scm_is_string): Move implementation here, from
  inline.h.
* libguile/inline.c: Add strings.h include.
* libguile/_scm.h: Remove inline.h include.
* libguile/array-handle.h:
* libguile/gc.h:
* libguile/pairs.h:
* libguile/smob.h: Add inline.h includes.
2018-06-20 11:17:13 +02:00
Andy Wingo
ad4fbebe85 Devolve smob snarfers
* libguile/snarf.h:
* libguile/smob.h (SCM_SMOB, SCM_GLOBAL_SMOB)
  (SCM_SMOB_MARK, SCM_GLOBAL_SMOB_MARK)
  (SCM_SMOB_FREE, SCM_GLOBAL_SMOB_FREE)
  (SCM_SMOB_PRINT, SCM_GLOBAL_SMOB_PRINT)
  (SCM_SMOB_EQUALP, SCM_GLOBAL_SMOB_EQUALP)
  (SCM_SMOB_APPLY, SCM_GLOBAL_SMOB_APPLY): Move these definitions here.
2018-06-20 09:37:50 +02:00
Andy Wingo
2b95d6faa4 Devolve gc.h
* libguile/_scm.h: Remove gc.h.
* libguile/arrays.h:
* libguile/bytevectors.h:
* libguile/foreign.h:
* libguile/fports.h:
* libguile/frames.h:
* libguile/hashtab.h:
* libguile/modules.h:
* libguile/numbers.h:
* libguile/print.h:
* libguile/programs.h:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/strports.h:
* libguile/struct.h:
* libguile/symbols.h:
* libguile/variable.h:
* libguile/vectors.h:
* libguile/vm.h: Add gc.h to users of scm_cell_* interfaces.  Not really
  visible right now given that e.g. numbers.h is already included in
  _scm.h.
2018-06-18 22:27:29 +02:00
Andy Wingo
8a6f46ee96 More validate.h devolution
* libguile/validate.h:
* libguile/alist.h (SCM_VALIDATE_ALISTCELL, SCM_VALIDATE_ALISTCELL_COPYSCM)
* libguile/bytevectors.h (SCM_VALIDATE_BYTEVECTOR)
* libguile/chars.h (SCM_VALIDATE_CHAR, SCM_VALIDATE_CHAR_COPY):
* libguile/print.h (SCM_VALIDATE_OPORT_VALUE, SCM_VALIDATE_PRINTSTATE):
* libguile/procs.h (SCM_VALIDATE_THUNK)
* libguile/smob.h (SCM_VALIDATE_SMOB)
* libguile/strings.h (SCM_VALIDATE_STRING): Devolve these macros from
  validate.h.
2018-06-18 09:44:35 +02:00
Andy Wingo
1bbf7f7580 Add `scm_smob_type_class()'.
* libguile/smob.h:
* libguile/smob.c (scm_smob_type_class): New function, to access the
  GOOPS class for a SMOB type.
2015-02-10 14:35:35 +01:00
Mark H Weaver
856d318a9f Merge branch 'stable-2.0'
Conflicts:
	benchmark-suite/benchmarks/ports.bm
	libguile/async.h
	libguile/bytevectors.c
	libguile/foreign.c
	libguile/gsubr.c
	libguile/srfi-1.c
	libguile/vm-engine.h
	libguile/vm-i-scheme.c
	module/Makefile.am
	module/language/tree-il/analyze.scm
	module/language/tree-il/peval.scm
	module/scripts/compile.scm
	module/scripts/disassemble.scm
	test-suite/tests/asm-to-bytecode.test
	test-suite/tests/peval.test
	test-suite/tests/rdelim.test
2014-09-30 03:50:47 -04:00
David Kastrup
8442211ef0 Fix SCM_SMOB_OBJECT{_,_0_,_1_,_2_,_3_}LOC.
Fixes <http://bugs.gnu.org/18495>.

* libguile/smob.h (SCM_SMOB_OBJECT_LOC, SCM_SMOB_OBJECT_0_LOC)
  (SCM_SMOB_OBJECT_1_LOC, SCM_SMOB_OBJECT_2_LOC)
  (SCM_SMOB_OBJECT_3_LOC): These elementary API macros have been broken
  by commit 56164dc47f in 2009.

Signed-off-by: David Kastrup <dak@gnu.org>
2014-09-20 06:36:42 -04:00
Ludovic Courtès
0f6dd25023 Avoid use of `GC_PTR' in "smob.h".
Commit c46fee438c removed the "bdw-gc.h"
include from "smob.h", so better avoid `GC_PTR'.

* libguile/smob.c (scm_i_finalize_smob): Use `void *' instead of `GC_PTR'.
* libguile/smob.h (scm_i_finalize_smob): Update declaration accordingly.
2012-04-12 23:16:48 +02:00
Andy Wingo
c05805a4ea make applicable smob calls cheaper, and fix a memory leak
* libguile/vm.c (prepare_smob_call): New helper.  Now, instead of making
  a per-smob trampoline, we will shuffle the smob into the args and use
  a gsubr.  This prevents a memory leak in which the trampolines, which
  were values in a weak-key table, were preventing the smobs from being
  collected.

* libguile/vm-i-system.c (call, tail-call, mv-call): Adapt to new smob
  application mechanism.
  (smob-call): Remove this instruction.

* libguile/smob.h (scm_smob_descriptor): Rename apply_trampoline_objcode
  to apply_trampoline.

* libguile/smob.c: Remove our own objcode trampolines in favor of using
  scm_c_make_gsubr.
  (scm_smob_prehistory): No more trampoline weak map.

* libguile/procprop.c (scm_i_procedure_arity): Adapt to applicable smob
  representation change.
2012-03-18 20:21:49 +01:00
Andy Wingo
80be163f81 make applicable smob calls cheaper, and fix a memory leak
* libguile/vm.c (prepare_smob_call): New helper.  Now, instead of making
  a per-smob trampoline, we will shuffle the smob into the args and use
  a gsubr.  This prevents a memory leak in which the trampolines, which
  were values in a weak-key table, were preventing the smobs from being
  collected.

* libguile/vm-i-system.c (call, tail-call, mv-call): Adapt to new smob
  application mechanism.
  (smob-call): Remove this instruction.

* libguile/smob.h (scm_smob_descriptor): Rename apply_trampoline_objcode
  to apply_trampoline.

* libguile/smob.c: Remove our own objcode trampolines in favor of using
  scm_c_make_gsubr.
  (scm_smob_prehistory): No more trampoline weak map.

* libguile/procprop.c (scm_i_procedure_arity): Adapt to applicable smob
  representation change.
2012-03-18 20:06:06 +01:00
Andy Wingo
c46fee438c scm_new_smob, scm_new_double_smob inline functions
* libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors,
  which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline
  functions instead of macros.  They also bail to scm_i_new_smob /
  scm_i_new_double_smob in either the mark or the free case, so that the
  inline definition doesn't reference other internal details like libgc
  stuff.
  (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see
  them as already being declared.
  (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2):
  (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new
  inline functions.

  Remove now-unneeded bdw-gc include.

* libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and
  make static.
  (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators.
  (scm_i_finalize_smob, scm_i_new_smob_with_mark_proc): Add
  back-compatibility shims to preserve ABI.

* libguile/inline.c: Include smob.h, so as to reify scm_new_smob and
  scm_new_double_smob.
2012-03-08 12:40:27 +01:00
Andy Wingo
dc7da0be90 refactor tc7 and tc16 checks
* libguile/tags.h (SCM_HAS_TYP7, SCM_HAS_TYP7S, SCM_HAS_TYP16): New
  macros.

* libguile/bytevectors.h (SCM_BYTEVECTOR_P):
* libguile/control.h (SCM_PROMPT_P):
* libguile/filesys.h (SCM_DIRP):
* libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_FLUID_P)
  (SCM_I_DYNAMIC_STATE_P):
* libguile/foreign.h (SCM_POINTER_P):
* libguile/fports.h (SCM_FPORTP):
* libguile/frames.h (SCM_VM_FRAME_P):
* libguile/hashtab.h (SCM_HASHTABLE_P):
* libguile/inline.h (scm_get_byte_or_eof):
* libguile/numbers.h (SCM_REALP, SCM_BIGP, SCM_COMPLEXP, SCM_FRACTIONP):
* libguile/objcodes.h (SCM_OBJCODE_P):
* libguile/ports.h (SCM_OUTPUT_PORT_P):
* libguile/programs.h (SCM_PROGRAM_P):
* libguile/smob.h (SCM_SMOB_PREDICATE):
* libguile/srfi-14.h (SCM_CHARSETP):
* libguile/strings.c (IS_STRING):
* libguile/strports.h (SCM_STRPORTP):
* libguile/symbols.h (scm_is_symbol):
* libguile/variable.h (SCM_VARIABLEP):
* libguile/vectors.h (SCM_I_IS_VECTOR, SCM_I_IS_NONWEAK_VECTOR):
* libguile/vm-i-system.c (call, tail-call, mv-call)
* libguile/vm.h (SCM_VM_P, SCM_VM_CONT_P):
* libguile/weak-set.c (SCM_WEAK_SET_P):
* libguile/weak-table.c (SCM_WEAK_TABLE_P):
* libguile/weak-vector.h (SCM_I_WVECTP): Use them.
2011-10-24 18:54:01 +02:00
Andy Wingo
27583e7466 scm_new_smob, scm_new_double_smob inline functions
* libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors,
  which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline
  functions instead of macros.  They also bail to scm_i_new_smob /
  scm_i_new_double_smob in either the mark or the free case, so that the
  inline definition doesn't reference other internal details like libgc
  stuff.
  (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see
  them as already being declared.
  (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2):
  (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new
  inline functions.
  (scm_i_finalize_smob): Remove declaration, as it's no longer needed or
  used.
  Remove now-unneeded bdw-gc include.

* libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and
  make static.
  (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators.

* libguile/inline.c: Include smob.h, so as to reify scm_new_smob and
  scm_new_double_smob.
2011-05-26 17:17:53 +02:00
Ludovic Courtès
be90d0b6f9 Add `scm_t_subr' typedef (fix bug #23681).
* libguile/__scm.h (scm_t_subr): New typedef.

* libguile/deprecated.h (scm_make_gsubr, scm_make_gsubr_with_generic,
  scm_call_catching_errors): Use it.

* libguile/gsubr.h (scm_c_make_gsubr, scm_c_define_gsubr,
  scm_c_define_gsubr_with_generic): Likewise.

* libguile/smob.h (scm_smob_descriptor)[apply]: Likewise.
  (scm_set_smob_apply): Likewise.

* libguile/snarf.h (SCM_FUNC_CAST_ARBITRARY_ARGS): Likewise.
2011-02-13 14:50:05 +01:00
Andy Wingo
75c3ed2820 smobs are applied with vm trampoline procedures
* libguile/smob.c: Instead of having special evaluator support for
  applying smobs, we use the same strategy that gsubr uses, that smob
  application should happen via a trampoline VM procedure, which uses a
  special opcode (smob-apply). So statically allocate all of the desired
  trampoline procedures here.
  (scm_i_smob_apply_trampoline): Unfortunately there's no real place to
  put the trampoline, so instead use a weak-key hash. It's nasty, but I
  think the benefits of speeding up procedure calls in the general case
  are worth it.

* libguile/smob.h (scm_smob_descriptor): Remove fields apply_0, apply_1,
  apply_2, and apply_3; these were never public. Also remove the
  gsubr_type field. Instead cache the trampoline objcode here.
  (SCM_SMOB_APPLY_0, SCM_SMOB_APPLY_1, SCM_SMOB_APPLY_2,
  SCM_SMOB_APPLY_3): Just go through scm_call_0, etc here.

* libguile/vm-i-system.c (call, tail-call, mv-call): Simplify. All
  procedure calls are VM calls now.
  (smob-call): New instruction, used in smob trampoline procedures.

* libguile/vm.c (apply_foreign): Remove. Yay!

* libguile/procprop.c (scm_i_procedure_arity): Refactor a bit for the
  smob changes.
2010-01-09 14:21:03 +01:00
Andy Wingo
cc7005bc37 remove scm_tc7_gsubr
* libguile/tags.h (scm_tc7_gsubr): Return to the pool of unused tc7s, as
  there are no more gsubrs. Yay :)

* libguile/programs.h (SCM_F_PROGRAM_IS_PRIMITIVE):
  (SCM_PROGRAM_IS_PRIMITIVE): New flag and accessor.

* libguile/gsubr.c (create_gsubr):
* libguile/snarf.h (SCM_STATIC_PROGRAM): Give subrs a PRIMITIVE flag.

* libguile/smob.h:
* libguile/smob.c (scm_i_smob_arity): New internal procedure. Uses the
  old GSUBR type macros, local to the file.

* libguile/procprop.c (scm_i_procedure_arity): Call out to
  scm_i_smob_arity, and remove a gsubr case.

* libguile/gc.c (scm_i_tag_name):
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (scm_class_of):
* libguile/vm.c (apply_foreign):
* libguile/hash.c (scm_hasher):
* libguile/debug.c (scm_procedure_name):
* libguile/print.c (iprin1): Remove gsubr cases.

* libguile/gsubr.h (SCM_PRIMITIVE_P): Fix to work with the new VM
  program regimen.
  (SCM_GSUBR_TYPE, SCM_GSUBR_MAKTYPE, SCM_GSUBR_MAX, SCM_GSUBR_REQ)
  (SCM_GSUBR_OPT, SCM_GSUBR_REST): Remove these macros, that are no
  longer useful.
* libguile/gsubr.c (scm_i_gsubr_apply, scm_i_gsubr_apply_list)
  (scm_i_gsubr_apply_array): Remove internal gsubr application
  functions.
2010-01-07 23:49:39 +01:00
Andy Wingo
735bcfe579 add SCM_SMOB_TYPE_BITS and SCM_SMOB_TYPE_MASK
* libguile/smob.h (SCM_SMOB_TYPE_BITS, SCM_SMOB_TYPE_MASK): New macros,
  for when you want to identify a SMOB by type and mask.

* libguile/arrays.c:
* libguile/bitvectors.c:
* libguile/srfi-4.c: Use the new macros.
2009-12-08 23:13:21 +01:00
Andy Wingo
56164dc47f clean up smob macro implementation
* libguile/smob.h: Regularize the SCM_SMOB macros, and make them all go
  through some generic SMOB accessor macros.

* libguile/smob.c (scm_i_set_smob_flags): Remove, as it is unused.
2009-12-08 23:13:07 +01:00
Ludovic Courtès
3051344be5 Remove default port/SMOB finalizers.
* libguile/ports.c (scm_port_free0): Remove.
  (scm_make_port_type): Set `free' to NULL.

* libguile/smob.c (scm_make_smob_type): Leave `free' to NULL.
  (scm_smob_free): Remove.

* libguile/smob.h (scm_smob_free): Remove.

* libguile/deprecated.c (scm_smob_free): New.

* libguile/deprecated.h (scm_smob_free): New declaration.
2009-09-28 23:32:33 +02:00
Ludovic Courtès
1c44468d77 Rename "boehm-gc.h" to "bdw-gc.h"; add to the distribution.
* libguile/Makefile.am (modinclude_HEADERS): Add `bdw-gc.h'.

* libguile/bdw-gc.h: Rename from "boehm-gc.h"; users updated.  Update to
  LGPLv3+.
2009-09-14 00:42:25 +02:00
Ludovic Courtès
fbb857a472 Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	lib/Makefile.am
	libguile/Makefile.am
	libguile/frames.c
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc_os_dep.c
	libguile/load.c
	libguile/macros.c
	libguile/objcodes.c
	libguile/programs.c
	libguile/strings.c
	libguile/vm.c
	m4/gnulib-cache.m4
	m4/gnulib-comp.m4
	m4/inline.m4
2009-08-18 00:06:45 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
202271f291 Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'.
* libguile/goops.c (create_smob_classes): Refer to
  `SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256.

* libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'.

* libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro.
2009-02-03 00:02:36 +01:00
Ludovic Courtès
c891a40e9f Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'.
* libguile/goops.c (create_smob_classes): Refer to
  `SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256.

* libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'.

* libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro.
2009-01-18 16:42:17 +01:00
Ludovic Courtes
e7bca22779 Use thread-local allocation (significant perf. improvement!); added the `boehm-gc.h' header.
* libguile/Makefile.am (modinclude_HEADERS): Added `boehm-gc.h'.

* libguile/coop-defs.h: Use "libguile/boehm-gc.h" instead of <gc/gc.h>.

* libguile/coop-threads.h: Likewise.

* libguile/coop.c: Likewise.

* libguile/gc.c: Likewise.
  (scm_storage_prehistory): Invoke `GC_init ()'.

* libguile/guardians.c: Use "libguile/boehm-gc.h" instead of <gc/gc.h>.

* libguile/inline.h: Likewise.
  (scm_double_cell): Use `GC_MALLOC' instead of `GC_malloc'.

* libguile/pthread-threads.h: Use "libguile/boehm-gc.h" instead of
  <gc/gc.h>.

* libguile/smob.c: Likewise.

* libguile/smob.h: Likewise.

* libguile/struct.c: Likewise.

* libguile/threads.c: Likewise.

* libguile/weaks.c: Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-51
2008-09-10 22:19:49 +02:00
Ludovic Courtes
10fb3386dd Fixed use of finalizers for guardians and SMOBs (undoes patches 23-24).
* libguile/gc.c (finalizer_trampoline): Removed.
  (scm_gc_register_finalizer): Removed (undoes patches 23 and 24).

* libguile/gc.h (scm_gc_register_finalizer): Removed.

* libguile/guardians.c (finalize_guarded): Undid patch 23.  Added support
  for "proxied finalizers".
  (scm_i_guard): Likewise.

* libguile/smob.c (scm_i_finalize_smob): Adapted to
  `GC_finalization_proc'.

* libguile/smob.h: Include <gc/gc.h>.
  (SCM_NEWSMOB): Use `GC_REGISTER_FINALIZER_NO_ORDER' instead of
  `scm_gc_register_finalizer ()'.
  (SCM_NEWSMOB3): Likewise.
  (scm_i_finalize_smob): Updated.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-29
2008-09-05 09:34:35 +02:00
Ludovic Courtes
e9d635e5d8 Added support for SMOBs free function (via finalizers).
* libguile/smob.c (scm_i_finalize_smob): New.

* libguile/smob.h (SCM_NEWSMOB): Register `scm_i_finalize_smob ()' as a
  finalizer for Z if its SMOB type has a free function.
  (SCM_NEWSMOB3): Likewise.
  (scm_i_finalize_smob): New declaration.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-26
2008-09-05 09:34:10 +02:00
Ludovic Courtes
378f262561 Added support for SMOB custom mark procedures.
* libguile/gc.c (scm_gc_mark): Removed.
  (scm_gc_mark_dependencies): Removed.
  (scm_mark_locations): Removed.

* libguile/gc.h (scm_gc_mark_dependencies): Removed.
  (scm_mark_locations): Removed.

* libguile/inline.h (scm_cell): Use `GC_MALLOC ()' instead of `GC_malloc ()'.

* libguile/smob.c (smob_freelist): New.
  (smob_gc_kind): New.
  (smob_mark): New.
  (scm_gc_mark): New.
  (scm_i_new_smob_with_mark_proc): New.
  (scm_smob_prehistory): Initialize `smob_freelist' and `smob_gc_kind'.

* libguile/smob.h (scm_i_new_smob_with_mark_proc): New declaration.
  (SCM_NEWSMOB): Use it if a mark procedure is available.
  (SCM_NEWSMOB2): Likewise.
  (SCM_NEWSMOB3): Likewise.

* libguile/threads.c (guilify_self_1): Initialize the
  `current_mark_stack_*' fields.

* libguile/threads.h (scm_i_thread)[current_mark_stack_ptr]: New field.
  [current_mark_stack_limit]: New field.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-22
2008-09-05 09:33:20 +02:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
197b057336 (scm_assert_smob_type): New. 2004-09-24 01:46:09 +00:00
Marius Vollmer
37fc18ae73 * smob.h (SCM_SMOB_DATA_2, SCM_SMOB_DATA_3, SCM_SMOB_FLAGS,
SCM_SET_SMOB_DATA_2, SCM_SET_SMOB_DATA_3, SCM_SET_SMOB_FLAGS,
SCM_SMOB_OBJECT, SCM_SMOB_OBJECT_2, SCM_SMOB_OBJECT_3,
SCM_SET_SMOB_OBJECT, SCM_SET_SMOB_OBJECT_2, SCM_SET_SMOB_OBJECT_3,
SCM_SMOB_OBJECT_LOC, SCM_SMOB_OBJECT_2_LOC,
SCM_SMOB_OBJECT_3_LOC): New.
* smob.c (scm_i_set_smob_flags): New function.
2004-05-06 16:41:27 +00:00
Dirk Herrmann
df5af69a91 * smob.h (scm_make_smob_type): Made the declaration match the
definition.
2003-10-07 22:03:26 +00:00
Marius Vollmer
da0e6c2baf Make type names char const * instead of char *. Thanks to Paul Jarc! 2003-10-07 15:58:19 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Han-Wen Nienhuys
34d19ef643 2002-07-20 Han-Wen <hanwen@cs.uu.nl>
* *.c: add space after commas everywhere.

* *.c: use SCM_VECTOR_SET everywhere, where a vector is written.
Document cases where SCM_WRITABLE_VELTS() is used.

* vectors.h (SCM_VELTS): prepare for write barrier, and let
SCM_VELTS() return a const pointer
(SCM_VECTOR_SET): add macro.

* autogen.sh (mscripts): find and check version number of
autoconf. Complain if 2.53 is not found.
2002-07-20 14:08:34 +00:00
Dirk Herrmann
228a24ef30 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
Marius Vollmer
16d4699b6b Replaced SCM_NEWCELL and SCM_NEWCELL2 with scm_alloc_cell and
scm_alloc_double_cell, respectively.
2001-11-25 15:21:07 +00:00
Marius Vollmer
33b001fd89 Prefixed each each exported symbol with SCM_API. 2001-11-02 00:19:12 +00:00
Dirk Herrmann
dee01b012c * Removed deprecated stuff.
* Some more renamings to SCM_<filename>_H.
2001-08-31 12:13:50 +00:00
Marius Vollmer
92c2555f69 replace "scm_*_t" with "scm_t_*". 2001-06-14 19:50:43 +00:00
Michael Livshin
c014a02eec revert the ill-considered part of the 2001-05-24 changes 2001-05-26 20:51:22 +00:00
Michael Livshin
1be6b49ccb * 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
Dirk Herrmann
7a7f7c5314 * Made creation of new smob types thread safe.
* Minor cleanups to smob usage.
2001-04-21 21:50:08 +00:00
Keisuke Nishida
9e6fc585b2 Remove dump facilities. 2001-03-02 23:41:18 +00:00