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

65 commits

Author SHA1 Message Date
Mark H Weaver
3ae69f3063 Use 'scm_from_utf8_{string,symbol,keyword}' for C string literals.
Partial fix for <https://bugs.gnu.org/33044>.
Reported by Tom de Vries <tdevries@suse.de>.

Fix several instances of the mistake of using 'scm_from_locale_*' for C
strings that originally came from a C string literal.  Change several
uses of 'scm_from_latin1_*' as well, to promote the practice of writing
code that works for arbitrary C string literals.

Also add missing years to the copyright notices of changed files, based
on the git history.

* libguile/debug-malloc.c, libguile/deprecation.c, libguile/error.c,
libguile/eval.c, libguile/expand.c, libguile/extensions.c,
libguile/filesys.c, libguile/init.c, libguile/load.c,
libguile/modules.c, libguile/pairs.c, libguile/posix.c,
libguile/print.c, libguile/random.c, libguile/read.c,
libguile/regex-posix.c, libguile/snarf.h, libguile/srfi-13.c,
libguile/stacks.c, libguile/stime.c, libguile/strports.c,
libguile/values.c: Use 'scm_from_utf8_*' where appropriate.
2019-05-23 16:41:53 +02:00
Andy Wingo
16879cabed Replace uses of scm_t_int8, scm_t_uintmax, etc with stdint types
* libguile/bitvectors.c:
* libguile/bitvectors.h:
* libguile/bytevectors.c:
* libguile/bytevectors.h:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/conv-integer.i.c:
* libguile/conv-uinteger.i.c:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/foreign.c:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gc-inline.h:
* libguile/gc.h:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/hash.c:
* libguile/i18n.c:
* libguile/instructions.c:
* libguile/intrinsics.c:
* libguile/intrinsics.h:
* libguile/loader.c:
* libguile/loader.h:
* libguile/numbers.c:
* libguile/numbers.h:
* libguile/pairs.c:
* libguile/ports-internal.h:
* libguile/ports.c:
* libguile/ports.h:
* libguile/posix.c:
* libguile/print.c:
* libguile/print.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/random.h:
* libguile/scm.h:
* libguile/socket.c:
* libguile/srfi-4.c:
* libguile/srfi-4.h:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/threads.h:
* libguile/uniform.c:
* libguile/vm-engine.c:
* libguile/vm.c:
* libguile/vm.h:
* libguile/vports.c:
* test-suite/standalone/test-conversion.c:
* test-suite/standalone/test-ffi-lib.c:
* test-suite/standalone/test-scm-take-u8vector.c:
* test-suite/standalone/test-srfi-4.c: Replace e.g. scm_t_uint8 with
  uint8_t.
2018-06-21 20:18:54 +02:00
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
b8d757732f Rationalize include order in C files
Include config.h first, then system includes, then libguile includes, in
alphabetical order, then the include for the file in question.
2018-06-20 18:31:24 +02:00
Andy Wingo
3068bc7384 Make libguile header inclusion consistent within libguile c files
Change from '#include "libguile/foo.h"' and '#include <libguile/foo.h>'
to '#include "foo.h"'.
2018-06-20 17:19:31 +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
d9eafa374c Inline tags.h into __scm.h
* libguile/__scm.h: Inline tags.h, and reformat comments.  Before, these
  files used to include each other!
* libguile.h:
* libguile/atomic.h:
* libguile/boolean.c:
* libguile/eq.h:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/pairs.c:
* libguile/pairs.h:
* libguile/ports.h:
* libguile/print.c:
* libguile/snarf.h:
* libguile/tags.h: Remove tags.h includes.
2018-06-20 16:10:54 +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
40ade0886e Remove _scm.h
* libguile/_scm.h: Remove.  An internal header, never installed.
* libguile/__scm.h: Remove horrible documentation.
* libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  Remove _scm.h.
* libguile/alist.c:
* libguile/array-handle.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/async.c:
* libguile/atomic.c:
* libguile/backtrace.c:
* libguile/bitvectors.c:
* libguile/boolean.c:
* libguile/bytevectors.c:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/debug-malloc.c:
* libguile/debug.c:
* libguile/deprecated.c:
* libguile/deprecation.c:
* libguile/dynl.c:
* libguile/dynstack.c:
* libguile/dynwind.c:
* libguile/eq.c:
* libguile/error.c:
* libguile/eval.c:
* libguile/evalext.c:
* libguile/expand.c:
* libguile/extensions.c:
* libguile/fdes-finalizers.c:
* libguile/feature.c:
* libguile/filesys.c:
* libguile/finalizers.c:
* libguile/fluids.c:
* libguile/foreign-object.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/frames.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/gen-scmconfig.c:
* libguile/generalized-arrays.c:
* libguile/generalized-vectors.c:
* libguile/gettext.c:
* libguile/goops.c:
* libguile/gsubr.c:
* libguile/guardians.c:
* libguile/hash.c:
* libguile/hashtab.c:
* libguile/hooks.c:
* libguile/i18n.c:
* libguile/init.c:
* libguile/instructions.c:
* libguile/intrinsics.c:
* libguile/ioext.c:
* libguile/keywords.c:
* libguile/list.c:
* libguile/load.c:
* libguile/loader.c:
* libguile/macros.c:
* libguile/mallocs.c:
* libguile/memoize.c:
* libguile/modules.c:
* libguile/net_db.c:
* libguile/null-threads.c:
* libguile/numbers.c:
* libguile/objprop.c:
* libguile/options.c:
* libguile/pairs.c:
* libguile/poll.c:
* libguile/ports-internal.h:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/procprop.c:
* libguile/procs.c:
* libguile/programs.c:
* libguile/promises.c:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/rdelim.c:
* libguile/read.c:
* libguile/regex-posix.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/script.c:
* libguile/simpos.c:
* libguile/smob.c:
* libguile/socket.c:
* libguile/sort.c:
* libguile/srcprop.c:
* libguile/srfi-1.c:
* libguile/srfi-13.c:
* libguile/srfi-14.c:
* libguile/srfi-4.c:
* libguile/srfi-60.c:
* libguile/stackchk.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/strorder.c:
* libguile/strports.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/syntax.c:
* libguile/threads.c:
* libguile/throw.c:
* libguile/trees.c:
* libguile/unicode.c:
* libguile/uniform.c:
* libguile/values.c:
* libguile/variable.c:
* libguile/vectors.c:
* libguile/version.c:
* libguile/vm.c:
* libguile/vports.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Remove _scm.h includes.
2018-06-20 14:26:01 +02:00
Andy Wingo
1ddf42dae0 Devolve threads.h from _scm.h.
* libguile/__scm.h (scm_print_state, scm_t_dynstack): Add forward
  declarations.
* libguile/_scm.h: Remove threads.h.
* libguile/atomic.c:
* libguile/bitvectors.h:
* libguile/bytevectors.c:
* libguile/continuations.h:
* libguile/control.c:
* libguile/deprecation.c:
* libguile/dynl.c:
* libguile/dynstack.h:
* libguile/dynwind.c:
* libguile/extensions.c:
* libguile/fdes-finalizers.c:
* libguile/foreign-object.c:
* libguile/frames.c:
* libguile/guardians.c:
* libguile/hashtab.c:
* libguile/list.c:
* libguile/loader.c:
* libguile/macros.c:
* libguile/memoize.c:
* libguile/net_db.c:
* libguile/pairs.c:
* libguile/procprop.c:
* libguile/rdelim.c:
* libguile/simpos.c:
* libguile/srfi-14.c:
* libguile/srfi-60.c:
* libguile/strings.c:
* libguile/strports.c:
* libguile/syntax.c:
* libguile/syntax.h:
* libguile/unicode.c:
* libguile/variable.c:
* libguile/vectors.c:
* libguile/weak-set.c:
* libguile/weak-set.h:
* libguile/weak-table.c:
* libguile/weak-table.h:
* libguile/weak-vector.c: Add threads.h as appropriate, or possible
  other headers that threads.h pulled in.
2018-06-20 11:52:29 +02:00
Andy Wingo
bf15afa6bf Move subr snarfing macros to gsubr.h.
* libguile/snarf.h: Remove gsubr include and subr snarfers.
* libguile/gsubr.h (SCM_DEFINE_GSUBR, SCM_DEFINE, SCM_PRIMITIVE_GENERIC):
  (SCM_DEFINE_PUBLIC, SCM_PROC, SCM_REGISTER_PROC, SCM_GPROC): Move
  here.
* libguile/alist.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/async.c:
* libguile/atomic.c:
* libguile/backtrace.c:
* libguile/bitvectors.c:
* libguile/boolean.c:
* libguile/bytevectors.c:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/debug-malloc.c:
* libguile/debug.c:
* libguile/deprecation.c:
* libguile/dynl.c:
* libguile/eq.c:
* libguile/error.c:
* libguile/error.h:
* libguile/eval.c:
* libguile/evalext.c:
* libguile/expand.c:
* libguile/extensions.c:
* libguile/fdes-finalizers.c:
* libguile/feature.c:
* libguile/filesys.c:
* libguile/finalizers.c:
* libguile/fluids.c:
* libguile/foreign-object.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/frames.c:
* libguile/gc.c:
* libguile/generalized-arrays.c:
* libguile/generalized-vectors.c:
* libguile/gettext.c:
* libguile/guardians.c:
* libguile/hash.c:
* libguile/hashtab.c:
* libguile/hooks.c:
* libguile/i18n.c:
* libguile/instructions.c:
* libguile/intrinsics.c:
* libguile/ioext.c:
* libguile/keywords.c:
* libguile/list.c:
* libguile/load.c:
* libguile/loader.c:
* libguile/macros.c:
* libguile/memoize.c:
* libguile/modules.c:
* libguile/net_db.c:
* libguile/numbers.c:
* libguile/objprop.c:
* libguile/pairs.c:
* libguile/poll.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/procs.c:
* libguile/programs.c:
* libguile/promises.c:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/rdelim.c:
* libguile/read.c:
* libguile/regex-posix.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/simpos.c:
* libguile/smob.c:
* libguile/socket.c:
* libguile/sort.c:
* libguile/srcprop.c:
* libguile/srfi-1.c:
* libguile/srfi-13.c:
* libguile/srfi-14.c:
* libguile/srfi-4.c:
* libguile/srfi-60.c:
* libguile/stackchk.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/strorder.c:
* libguile/strports.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/syntax.c:
* libguile/threads.c:
* libguile/throw.c:
* libguile/trees.c:
* libguile/unicode.c:
* libguile/values.c:
* libguile/variable.c:
* libguile/vectors.c:
* libguile/version.c:
* libguile/vm.c:
* libguile/vports.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Add gsubr includes.
2018-06-20 09:04:55 +02:00
Andy Wingo
5f50309448 Remove includes of validate.h.
* guile-readline/readline.c:
* libguile/alist.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/async.c:
* libguile/atomic.c:
* libguile/backtrace.c:
* libguile/boolean.c:
* libguile/bytevectors.c:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/debug.c:
* libguile/dynl.c:
* libguile/eq.c:
* libguile/error.c:
* libguile/eval.c:
* libguile/evalext.c:
* libguile/expand.c:
* libguile/feature.c:
* libguile/filesys.c:
* libguile/fluids.c:
* libguile/fports.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/goops.c:
* libguile/goops.h:
* libguile/guardians.c:
* libguile/hash.c:
* libguile/hashtab.c:
* libguile/hashtab.h:
* libguile/hooks.c:
* libguile/i18n.c:
* libguile/ioext.c:
* libguile/keywords.c:
* libguile/list.c:
* libguile/load.c:
* libguile/macros.c:
* libguile/memoize.c:
* libguile/modules.h:
* libguile/net_db.c:
* libguile/numbers.c:
* libguile/pairs.c:
* libguile/poll.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/procprop.c:
* libguile/procs.c:
* libguile/promises.c:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/rdelim.c:
* libguile/read.c:
* libguile/regex-posix.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/script.c:
* libguile/simpos.c:
* libguile/socket.c:
* libguile/sort.c:
* libguile/srcprop.c:
* libguile/srfi-1.c:
* libguile/srfi-4.c:
* libguile/srfi-60.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/strorder.c:
* libguile/strports.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/syntax.c:
* libguile/threads.c:
* libguile/throw.c:
* libguile/trees.c:
* libguile/unicode.c:
* libguile/values.c:
* libguile/variable.c:
* libguile/vectors.c:
* libguile/vports.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c:
* libguile.h: Remove validate.h include.
2018-06-18 10:50:23 +02:00
Andy Wingo
6e573a0885 Attempt to mutate residualized literal pair throws exception
* libguile/validate.h (SCM_VALIDATE_MUTABLE_PAIR):
* libguile/pairs.h (scm_is_mutable_pair): New internal definitions.
* libguile/pairs.c (scm_set_car_x, scm_set_cdr_x): Validate mutable
  pairs.
* libguile/alist.c (scm_assq_set_x, scm_assv_set_x, scm_assoc_set_x):
* libguile/list.c (scm_reverse_x, scm_list_set_x, scm_list_cdr_set_x):
* libguile/srcprop.c (scm_make_srcprops):
* libguile/srfi-1.c (scm_srfi1_append_reverse_x)
  (scm_srfi1_delete_duplicates_x):
* libguile/symbols.c (scm_symbol_fset_x, scm_symbol_pset_x):
* libguile/sort.c (scm_merge_list_x): Use scm_set_car_x / scm_set_cdr_x
  instead of the macros, so as to check for mutable pairs.
  (SCM_VALIDATE_MUTABLE_LIST): New internal helper macro.
  (scm_sort_x, scm_stable_sort_x, scm_sort_list_x): Use
  SCM_VALIDATE_MUTABLE_LIST.
* libguile/vm-engine.c (VM_VALIDATE_MUTABLE_PAIR): New definition.
  (set-car!, set-cdr!): Use VM_VALIDATE_MUTABLE_PAIR.  Fix error message
  for set-cdr!.
2017-04-18 21:27:45 +02:00
Mark H Weaver
61989c7053 Merge branch 'stable-2.0'
Conflicts:
	libguile/pairs.c
	libguile/vm.c
	test-suite/tests/control.test
2013-12-12 23:44:46 -05:00
Tom Tromey
97dd74c00e Add missing FUNC_NAME defines for pair accessors.
* libguile/pairs.c (scm_car, scm_cdr, scm_caar, scm_cadr, scm_cdar,
  scm_cddr, scm_caaar, scm_caadr, scm_cadar, scm_caddr, scm_cdaar,
  scm_cdadr, scm_cddar, scm_cdddr, scm_caaaar, scm_caaadr, scm_caadar,
  scm_caaddr, scm_cadaar, scm_cadadr, scm_caddar, scm_cadddr,
  scm_cdaaar, scm_cdaadr, scm_cdadar, scm_cdaddr, scm_cddaar,
  scm_cddadr, scm_cdddar, scm_cddddr): Add missing FUNC_NAME defines.
2013-12-12 21:53:01 -05:00
Andy Wingo
730af462c3 inline scm_cons, scm_car, scm_cdr
* libguile/pairs.h (scm_cons, scm_car, scm_cdr): Define these as inline
  functions.
  (scm_is_pair): Move here from inline.h.
* libguile/pairs.c: Remove definitions here, and define gsubrs.

* libguile/inline.h: Remove scm_is_pair implementation.
* libguile/inline.c: Include pairs.h to residualize inlines from
  pairs.h.
2012-05-17 11:25:58 +02:00
Andy Wingo
210c0325d3 allow iflags to be constant expressions with typing-strictness==2
* libguile/tags.h (SCM_MAKE_ITAG8_BITS): New helper, produces a
  scm_t_bits instead of a SCM, because SCM_UNPACK is not a constant
  expression with SCM_DEBUG_TYPING_STRICTNESS==2.
  (SCM_MAKIFLAG_BITS): Remove SCM_MAKIFLAG, and replace with this, which
  returns bits.
  (SCM_BOOL_F_BITS, SCM_ELISP_NIL_BITS, SCM_EOL_BITS, SCM_BOOL_T_BITS):
  (SCM_UNSPECIFIED_BITS, SCM_UNDEFINED_BITS, SCM_EOF_VAL_BITS):
  (SCM_UNBOUND_BITS): New definitions.  Defined SCM_BOOL_F, etc in terms
  of them.
  (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0):
  (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_1):
  (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_2):
  (SCM_XXX_ANOTHER_LISP_FALSE_DONT_USE): Be bits instead of SCM values.
  (SCM_BITS_DIFFER_IN_EXACTLY_ONE_BIT_POSITION):
  (SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS): Rename from
  SCM_VALUES_DIFFER_..., and take unpacked bits as the args.

* libguile/boolean.c: Update verify block to use
  SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS et al.

* libguile/debug.c (scm_debug_opts):
* libguile/print.c (scm_print_opts):
* libguile/read.c (scm_read_opts): Use iflags bits for initializers.

* libguile/hash.c (scm_hasher): Use _BITS for iflags as case labels.

* libguile/pairs.c: Nil/null compile-time check uses
  SCM_ELISP_NIL_BITS.
2011-05-13 13:48:07 +02:00
Andy Wingo
34cbb05331 Revert "[build] Rewrite guile-func-name-check in Scheme, adding features."
This reverts commit 6832604efa. Not only
does this fail on a fresh build due to a lack of "guile", but even if it
did have its Makefile fixed, it would take too long to run, because the
rest of Guile isn't compiled.

The right thing is to avoid invoking Guile until after at least psyntax
and boot-9 have been compiled.

This commit can be reinstated if we move doc snarfing to a phase that
happens after module/ is compiled.
2010-08-27 13:05:23 -07:00
Thien-Thi Nguyen
6832604efa [build] Rewrite guile-func-name-check in Scheme, adding features.
* libguile/guile-func-name-check: Rewrite in Scheme; add inhibition
  directives, string-literal handling, failureful exit on error.
* libguile/guile-snarf-docs.in: Use ‘@top_builddir@/meta/guile’.
* libguile/pairs.c: Add guile-func-name-check inhibition directive.
2010-08-26 23:34:49 +02:00
Andy Wingo
f36878ba2d remove cxrs
* libguile/pairs.h:
* libguile/pairs.c: Previously scm_cdadr et al were implemented as
  #defines that called scm_i_chase_pairs, and the Scheme-exposed
  functions themselves were cxr subrs, which got special help in the
  interpreter. Since now the special help is unnecessary (because the
  compiler inlines and expands calls to car, cdadr, etc), the complexity
  is a loss. So just implement cdadr etc using normal functions. There's
  an advantage too, in that the compiler can unroll the cxring, reducing
  branches.

* libguile/tags.h (scm_tc7_cxr): Remove this tag.
  (scm_tcs_subrs): Now there's only one kind of subr, yay!

* libguile/debug.c (scm_procedure_name)
* libguile/evalext.c (scm_self_evaluating_p)
* libguile/gc.c (scm_i_tag_name)
* libguile/goops.c (scm_class_of)
* libguile/hash.c (scm_hasher)
* libguile/print.c (iprin1)
* libguile/procprop.c (scm_i_procedure_arity)
* libguile/procs.c (scm_procedure_p, scm_subr_p)
  (scm_make_procedure_with_setter)
* libguile/vm.c (apply_foreign): Remove cxr cases. Replace uses of
  scm_tcs_subrs with scm_tc7_gsubr.
2009-12-04 16:39:34 +01:00
Mark H Weaver
45f4cbdf12 the cube of lisp booleans (#f nil () #t)
* Renumbers the IFLAG constants.

 * Adds several macros related to boolean type tests, null tests, and
   boolean-truth testing (including lisp-style boolean-truth tests).

 * Adds compile-time checks to verify the necessary IFLAG numbering
   properties needed for the checks to work properly.

 * Changes some existing code to use the new optimized macros, without
   changing the semantics of the code at all (except that scm_is_bool
   is changed from a function to a macro).

I added the following macros, whose names explicitly state how %nil
should be handled.  See the comments in the patch for more information
about these.

  scm_is_false_assume_not_lisp_nil  scm_is_true_assume_not_lisp_nil
  scm_is_false_and_not_lisp_nil     scm_is_true_or_lisp_nil
  scm_is_false_or_lisp_nil          scm_is_true_and_not_lisp_nil

  scm_is_lisp_false                 scm_is_lisp_true

  scm_is_null_assume_not_lisp_nil
  scm_is_null_and_not_lisp_nil
  scm_is_null_or_lisp_nil

  scm_is_bool_and_not_lisp_nil
  scm_is_bool_or_lisp_nil

The following already-existing macros are defined as aliases, such
that their semantics is unchanged (although scm_is_bool used to be a
function and is now a macro).

  scm_is_null   -->  scm_is_null_and_not_lisp_nil
  scm_is_false  -->  scm_is_false_and_not_lisp_nil
  scm_is_true   -->  scm_is_true_or_lisp_nil
  scm_is_bool   -->  scm_is_bool_and_not_lisp_nil

(I still believe that these should be changed to versions that handle
 %nil properly, but await approval on that point, so these patches do
 not make those changes)

Also, if the preprocessor macro SCM_ENABLE_ELISP is not true (this
macro already existed and was used in lang.h), all overheads
associated with %nil handling are eliminated from the above macros.

* libguile/tags.h (SCM_BOOL_F, SCM_BOOL_T, SCM_UNSPECIFIED)
  (SCM_UNDEFINED, SCM_UNBOUND, SCM_ELISP_NIL): Renumber, so that a
  number of important distinctions (false versus true, end-of-list, etc)
  can be made by masking a single bit. Also define a number of
  build-time tests to assert that this condition holds.

* libguile/boolean.h (scm_is_false_and_not_nil, scm_is_true_or_nil)
  (scm_is_false_assume_not_nil, scm_is_true_assume_not_nil):
  (scm_is_false_or_nil, scm_is_true_and_not_nil)
  (scm_is_bool_or_nil, scm_is_bool_and_not_nil): New exciting macros to
  test certain boolean/end-of-list properties.
  (scm_is_false, scm_is_true): Use a restrictive definition, where only
  SCM_BOOL_F is false. Should probably change in the future.
  (scm_is_bool): Incompatible change: changed to be a macro. Was a
  function before. Probably should allow nil as a boolean, but that will
  be for a later patch.
  (scm_is_lisp_false, scm_is_lisp_true): New macros, implementing the
  standard Lisp boolean predicates, where '() is actually false.

* libguile/eval.i.c (CEVAL): Fix a number of false-or-nil and similar
  tests to use the new macros.

* libguile/lang.h (SCM_NULL_OR_NIL_P): Use scm_is_null_or_nil.

* libguile/pairs.c: Add a compile-time check that null and nil differ by
  only one bit.

* libguile/pairs.h (scm_is_null_and_not_nil, scm_is_null_assume_not_nil)
  (scm_is_null_or_nil): New exciting macros!
  (scm_is_null): Just be scm_is_null_and_not_nil, for now.

* libguile/print.c: Adapt to the reordering, and print suitably nasty
  things for the not-to-be-used values.
2009-10-27 23:25:02 +01: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
dbb605f575 Include <config.h> in all C files; use #ifdef HAVE_CONFIG_H' rather than #if'. 2008-09-13 15:35:27 +02:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
d5ad4aa6fa * inline.h, pairs.c (scm_is_pair): Moved scm_is_pair from pairs.c
to inline.h to make it inline.
2006-01-28 22:01:35 +00:00
Kevin Ryde
f32632e6cd (scm_error_pair_access): Plain ascii ' in error message
rather than latin-1 acute accent, the latter may not print on all
terminals.
2005-07-11 23:55:17 +00:00
Kevin Ryde
9d5dc023b4 (scm_error_pair_access): Use scm_from_locale_string rather
than scm_makfrom0str.
Reported by Ken Raeburn.
2005-07-11 23:50:45 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
7dab4b370c (scm_i_chase_pairs): Replace scm_t_bits with scm_t_uint32 to fix the
mismatch between the function declaration and definition.
2004-11-02 22:47:14 +00:00
Marius Vollmer
6fcc7d48e4 * discouraged.h, tags.h (SCM_CONSP, SCM_NCONSP): Moved to
discouraged.h.  Replaced all uses with scm_is_pair.
(SCM_I_CONSP): New name for SCM_CONSP.

* pairs.h, pairs.c (scm_is_pair, scm_is_null, scm_car, scm_cdr,
scm_i_chase_pairs, SCM_I_A_PAT, SCM_I_D_PAT, etc, scm_caar,
scm_cadr, etc): New.
(SCM_NULLP, SCM_NNULLP): Moved to discouraged.h.  Replaced all
uses with scm_is_null.
2004-09-22 17:37:01 +00:00
Marius Vollmer
7888309be8 * deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL,
SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into "deprecated.h".
Replaced all uses with scm_is_false, scm_is_true, scm_from_bool, and
scm_is_bool, respectively.
2004-07-06 10:59:25 +00:00
Dirk Herrmann
14b18ed6f5 This set of patches separates the representation of the cxr family
of functions (car, cdr etc.) from the dsubr family of functions
	(i. e. functions that take a double precision floating point
	argument).  Further, the algorithm for handling the cxr function
	is improved.

	* eval.c (SCM_CEVAL, SCM_APPLY, scm_trampoline_1), numbers.c
	(scm_asinh, scm_acosh, scm_atanh, scm_truncate, scm_round, floor,
	ceil, sqrt, fabs, exp, log, sin, cos, tan, asin, acos, atan, sinh,
	cosh, tanh), objects.c (scm_class_of), procprop.c
	(scm_i_procedure_arity), ramap.c (scm_array_map_x), tags.h
	(scm_tc7_dsubr, scm_tcs_subrs): Introduce scm_tc7_dsubr as new
	typecode for the dsubr family of functions.

	* ramap.c (ramap_cxr, ramap_dsubr): Renamed ramap_cxr to
	ramap_dsubr.

	* eval.c (SCM_CEVAL, SCM_APPLY, call_cxr_1), pairs.c
	(scm_init_pairs): Make use of the (now usable) second cell element
	of a scm_tc7_cxr function to implement the cxr family of functions
	more efficiently.
2003-06-01 13:58:42 +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
ba1b222692 * tests/reader.test: change misc-error in read-error.
* read.c (scm_input_error): new function: give meaningful error
messages, and throw read-error

* gc-malloc.c (scm_calloc): add scm_calloc.

* scheme-memory.texi (Memory Blocks): add scm_calloc, scm_gc_calloc.
correct typos.
2002-08-05 23:04:44 +00:00
Han-Wen Nienhuys
c8a1bdc460 new gc 2002-08-04 00:17:18 +00:00
Thien-Thi Nguyen
a6b844c224 Retire inclusion guard macro SCM_MAGIC_SNARFER. 2002-03-14 03:47:43 +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
Thien-Thi Nguyen
a06e3a75b2 Remove "face-lift" comment. 2001-07-09 07:36:48 +00:00
Keisuke Nishida
1afff62054 * 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
Dirk Herrmann
bab246f334 * Fixed some bugs, some reported by Matthias Koeppe. 2001-06-08 10:02:33 +00:00
Dirk Herrmann
e81d98ec2d * Introduce SCM_UNUSED and mark unused function parameters.
* Introduce SCM_DEBUG_PAIR_ACCESSES.
* Extend the possibilities of SCM_DEBUG_CELL_ACCESSES.
2001-06-07 21:12:19 +00:00
Marius Vollmer
9a441ddb34 (scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions.  They replace
scm_make_gsubr and scm_make_gsubr_with_generic.  The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module.  Changed all callers.  (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.

(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions.  They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic.  The
`make' variants only create the subr object, while the `define'
variants also put it into the current module.  Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
Martin Grabmüller
1e6808ea20 Correct, update, improve and clean up a lot of docstrings in order to make
the documentation much more consistent.
2001-04-03 13:19:05 +00:00
Keisuke Nishida
783e777478 Remove #include <stdio.h>. Add #include <string.h>. 2001-03-09 23:33:41 +00:00
Marius Vollmer
8dc9439fc6 * alist.c, arbiters.c, async.c, backtrace.c, boolean.c, chars.c,
continuations.c, debug-malloc.c, debug.c, dynl.c, dynwind.c,
environments.c, eq.c, error.c, eval.c, evalext.c, feature.c,
filesys.c, fluids.c, fports.c, gc.c, goops.c, guardians.c, hash.c,
hashtab.c, hooks.c, ioext.c, iselect.c, keywords.c, lang.c,
list.c, load.c, macros.c, modules.c, net_db.c, numbers.c,
objects.c, objprop.c, options.c, pairs.c, ports.c, posix.c,
print.c, procprop.c, procs.c, properties.c, ramap.c, random.c,
read.c, regex-posix.c, root.c, scmsigs.c, script.c, simpos.c,
socket.c, sort.c, srcprop.c, stackchk.c, stacks.c, stime.c,
strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c,
tag.c, threads.c, throw.c, unif.c, variable.c, vectors.c,
version.c, vports.c, weaks.c: Makes sure the snarfer output
inclusion is disabled when the snarfer is run on the file.  Thanks
to Lars J. Aas!

* Makefile.am: Install guile-procedures.txt in version-specific
directory to enable multiple installed guile versions.  Suggested
by Karl M. Hegbloom <karlheg@debian.org, patch by Matthias Koeppe.
2000-11-17 16:25:05 +00:00
Mikael Djurfeldt
f2c9fcb07e Updated copyrights 2000-06-12 12:28:24 +00:00
Dirk Herrmann
4983cbe405 * Use SCM{_SET}?_CELL_OBJECT to access cells that are no valid pairs yet.
* Eliminated redundant SCM_IMP test.
2000-05-05 16:19:30 +00:00
Dirk Herrmann
e59bb51662 * Remove function scm_init_iprocs, remove struct scm_iproc and simplify
initialization of c[ad]+r functions.
* Remove structs scm_subr and scm_dsubr and access the function cell words
  directly instead of casting a cell to a C struct.
2000-04-25 09:45:16 +00:00