summaryrefslogtreecommitdiff
path: root/libguile/srfi-4.c
Commit message (Collapse)AuthorAgeFilesLines
* New function srfi-4-vector-type-size in (srfi srfi-4 gnu)Daniel Llorens2021-12-061-1/+24
| | | | | | | | | | | | | | This patch removes the undocumented function make-srfi-4-vector from (guile). That function is still exported from (srfi srfi-4 gnu). * libguile/srfi-4.h (scm_init_srfi_4): Split into scm_bootstrap_srfi_4() and scm_init_srfi_4(), after the pattern of scm_init_bytevectors() and scm_bootstrap_bytevectors(). * libguile/init.c: Replace scm_init_srfi_4() call by scm_bootstrap_srfi_4(). * module/srfi/srfi-4.scm: Load newly defined srfi-4 extension. This provides undocumented make-srfi-4-vector. * module/srfi/srfi-4/gnu.scm: Export srfi-4-vector-type-size. * doc/ref/srfi-modules.texi: Document srfi-4-vector-type-size.
* Replace uses of scm_t_int8, scm_t_uintmax, etc with stdint typesAndy Wingo2018-06-211-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Update license notices in all C filesAndy Wingo2018-06-201-18/+19
| | | | | Update to newest recommended license notices from the FSF. Everything stays LGPLv3+ except guile-readline which is GPLv3+.
* Remove (C) from copyright statementsAndy Wingo2018-06-201-1/+1
| | | | | | 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.
* Rationalize include order in C filesAndy Wingo2018-06-201-5/+6
| | | | | Include config.h first, then system includes, then libguile includes, in alphabetical order, then the include for the file in question.
* Make libguile header inclusion consistent within libguile c filesAndy Wingo2018-06-201-14/+14
| | | | | Change from '#include "libguile/foo.h"' and '#include <libguile/foo.h>' to '#include "foo.h"'.
* Rename __scm.h to scm.hAndy Wingo2018-06-201-1/+0
| | | | * libguile/scm.h: Rename. Update all includers.
* Remove _scm.hAndy Wingo2018-06-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Remove modules.h from _scm.h.Andy Wingo2018-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/_scm.h: Remove modules.h. * libguile/arrays.c: * libguile/backtrace.c: * libguile/feature.c: * libguile/filesys.c: * libguile/foreign-object.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/gc.c: * libguile/gsubr.c: * libguile/i18n.c: * libguile/intrinsics.c: * libguile/macros.c: * libguile/numbers.c: * libguile/poll.c: * libguile/ports.c: * libguile/posix.c: * libguile/random.c: * libguile/read.c: * libguile/regex-posix.c: * libguile/scmsigs.c: * libguile/script.c: * libguile/socket.c: * libguile/srcprop.c: * libguile/srfi-14.c: * libguile/srfi-4.c: * libguile/stime.c: * libguile/struct.c: * libguile/syntax.c: * libguile/threads.c: * libguile/throw.c: Add modules.h.
* Devolve variable.h from _scm.h.Andy Wingo2018-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/_scm.h: Remove variable.h. * libguile/backtrace.c: * libguile/debug.c: * libguile/dynstack.c: * libguile/dynwind.c: * libguile/eval.c: * libguile/evalext.c: * libguile/expand.c: * libguile/feature.c: * libguile/fluids.c: * libguile/foreign-object.c: * libguile/fports.c: * libguile/frames.c: * libguile/goops.c: * libguile/i18n.c: * libguile/load.c: * libguile/macros.c: * libguile/memoize.c: * libguile/ports.c: * libguile/print.c: * libguile/programs.c: * libguile/random.c: * libguile/read.c: * libguile/scmsigs.c: * libguile/srfi-4.c: * libguile/strports.c: * libguile/syntax.c: * libguile/threads.c: * libguile/throw.c: Add variable.h.
* Move subr snarfing macros to gsubr.h.Andy Wingo2018-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Devolve numbers.h from _scm.h.Andy Wingo2018-06-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/_scm.h: Remove numbers.h. * libguile/array-handle.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/backtrace.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/chars.c: * libguile/continuations.c: * libguile/debug-malloc.c: * libguile/error.c: * libguile/eval.c: * libguile/filesys.c: * libguile/foreign-object.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/gc.c: * libguile/generalized-arrays.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/instructions.c: * libguile/intrinsics.c: * libguile/ioext.c: * libguile/list.c: * libguile/memoize.c: * libguile/net_db.c: * libguile/options.c: * libguile/ports.c: * libguile/posix-w32.c: * libguile/posix.c: * libguile/procprop.c: * libguile/programs.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/srcprop.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/srfi-4.c: * libguile/stackchk.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/symbols.c: * libguile/threads.c: * libguile/throw.c: * libguile/vectors.c: * libguile/version.c: * libguile/vm.c: * libguile/vports.c: * libguile/weak-table.c: Add numbers.h.
* Remove <string.h> include from ports.h.Andy Wingo2018-06-191-0/+2
| | | | | | | | | | | | | | | * libguile/ports.h: Remove <string.h>. * libguile/array-handle.c: * libguile/array-map.c: * libguile/chars.c: * libguile/hash.c: * libguile/memoize.c: * libguile/ports-internal.h: * libguile/regex-posix.c: * libguile/srfi-4.c: * libguile/unicode.c: * libguile/weak-set.c: * libguile/weak-vector.c: Add string.h.
* Devolve boolean.h include.Andy Wingo2018-06-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/_scm.h: Remove boolean.h include. * libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/backtrace.c: * libguile/bitvectors.c: * libguile/chars.c: * libguile/continuations.c: * libguile/dynwind.c: * libguile/eq.c: * libguile/eval.c: * libguile/expand.c: * libguile/fdes-finalizers.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/generalized-arrays.h: * libguile/goops.c: * libguile/goops.h: * libguile/guardians.c: * libguile/hooks.c: * libguile/i18n.c: * libguile/intrinsics.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/options.c: * libguile/ports.c: * libguile/print.c: * libguile/procprop.c: * libguile/procs.h: * libguile/programs.c: * libguile/r6rs-ports.c: * libguile/read.c: * libguile/scmsigs.c: * libguile/sort.c: * libguile/srcprop.h: * libguile/srfi-1.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/srfi-14.h: * libguile/srfi-4.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strorder.c: * libguile/struct.c: * libguile/struct.h: * libguile/symbols.c: * libguile/threads.c: * libguile/throw.c: * libguile/vports.c: Add boolean.h includes.
* Remove includes of validate.h.Andy Wingo2018-06-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Fix libguile subcomponent headers not to include <libguile.h>Andy Wingo2018-06-141-1/+2
| | | | | | | | | | | | | | | | | | | * libguile/bytevectors.h: Include uniform.h, for use in the macros. * libguile/extensions.h: Include libpath.h, for the SCM_EFFECTIVE_VERSION, which is almost always used with these routines. * libguile/frames.h: * libguile/instructions.h: * libguile/intrinsics.h: * libguile/loader.h: * libguile/programs.h: * libguile/vm.h: Include <libguile/__scm.h> instead of <libguile.h>. Cuts a circular include, but also precipitates a lot of maintenance in the .c files. * libguile/*.c: Update C files to add needed all needed includes that before were getting automatically pulled in by the indirect inclusion of libguile.h.
* All literal constants are read-onlyAndy Wingo2017-04-181-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/array-handle.c (initialize_vector_handle): Add mutable_p argument. Unless the vector handle is mutable, null out its writable_elements member. (scm_array_get_handle): Adapt to determine mutability of the various arrays. (scm_array_handle_elements, scm_array_handle_writable_elements): Reverse the sense: instead of implementing read-only in terms of read-write, go the other way around, adding an assertion in the read-write case that the array handle is mutable. * libguile/array-map.c (racp): Assert that the destination is mutable. * libguile/bitvectors.c (SCM_F_BITVECTOR_IMMUTABLE, IS_BITVECTOR): (IS_MUTABLE_BITVECTOR): Add a flag to indicate immutability. (scm_i_bitvector_bits): Fix indentation. (scm_i_is_mutable_bitvector): New helper. (scm_array_handle_bit_elements) ((scm_array_handle_bit_writable_elements): Build writable_elements in terms of elements. (scm_bitvector_elements, scm_bitvector_writable_elements): Likewise. (scm_c_bitvector_set_x): Require a mutable bitvector for the fast-path. (scm_bitvector_to_list, scm_bit_count): Use read-only elements() function. * libguile/bitvectors.h (scm_i_is_mutable_bitvector): New decl. * libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE): (INTEGER_GETTER_PROLOGUE, INTEGER_SETTER_PROLOGUE): (INTEGER_REF, INTEGER_NATIVE_REF, INTEGER_SET, INTEGER_NATIVE_SET): (GENERIC_INTEGER_ACCESSOR_PROLOGUE): (GENERIC_INTEGER_GETTER_PROLOGUE, GENERIC_INTEGER_SETTER_PROLOGUE): (LARGE_INTEGER_NATIVE_REF, LARGE_INTEGER_NATIVE_SET): (IEEE754_GETTER_PROLOGUE, IEEE754_SETTER_PROLOGUE): (IEEE754_REF, IEEE754_NATIVE_REF, IEEE754_SET, IEEE754_NATIVE_SET): Setters require a mutable bytevector. (SCM_BYTEVECTOR_SET_FLAG): New helper. (SCM_BYTEVECTOR_SET_CONTIGUOUS_P, SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Remove helpers. (SCM_VALIDATE_MUTABLE_BYTEVECTOR): New helper. (make_bytevector, make_bytevector_from_buffer): Use SCM_SET_BYTEVECTOR_FLAGS. (scm_c_bytevector_set_x, scm_bytevector_fill_x) (scm_bytevector_copy_x): Require a mutable bytevector. * libguile/bytevectors.h (SCM_F_BYTEVECTOR_CONTIGUOUS) (SCM_F_BYTEVECTOR_IMMUTABLE, SCM_MUTABLE_BYTEVECTOR_P): New definitions. * libguile/bytevectors.h (SCM_BYTEVECTOR_CONTIGUOUS_P): Just access one bit. * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Implement writable_elements() in terms of elements(). * libguile/strings.c (scm_i_string_is_mutable): New helper. * libguile/uniform.c (scm_array_handle_uniform_elements): (scm_array_handle_uniform_writable_elements): Implement writable_elements in terms of elements. * libguile/vectors.c (SCM_VALIDATE_MUTABLE_VECTOR): New helper. (scm_vector_elements, scm_vector_writable_elements): Implement writable_elements in terms of elements. (scm_c_vector_set_x): Require a mutable vector. * libguile/vectors.h (SCM_F_VECTOR_IMMUTABLE, SCM_I_IS_MUTABLE_VECTOR): New definitions. * libguile/vm-engine.c (VM_VALIDATE_MUTABLE_BYTEVECTOR): (VM_VALIDATE_MUTABLE_VECTOR, vector-set!, vector-set!/immediate) (BV_BOUNDED_SET, BV_SET): Require mutable bytevector/vector. * libguile/vm.c (vm_error_not_a_mutable_bytevector): (vm_error_not_a_mutable_vector): New definitions. * module/system/vm/assembler.scm (link-data): Mark residualized vectors, bytevectors, and bitvectors as being read-only.
* Merge branch 'stable-2.0'v2.1.0Mark H Weaver2014-04-251-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c
| * Fix breakage of SRFI-4 C accessorsAndy Wingo2014-03-191-2/+3
| | | | | | | | | | | | | | | | | | * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix bad assumption that width was a byte width. Thanks very much to Barry Fishman for the report, and to Daniel Llorens for tracking it down. * test-suite/standalone/Makefile.am (test_srfi_4_CFLAGS): * test-suite/standalone/test-srfi-4.c: Add test.
* | Merge commit 'dc65b88d839c326889618112c4870ad3a64e9446'Andy Wingo2014-02-081-43/+25
|\ \ | |/ | | | | | | Conflicts: libguile/srfi-4.c
| * Simplify srfi-4 C implementationAndy Wingo2014-02-081-43/+25
| | | | | | | | | | | | | | | | | | | | * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): In the raw element accessors (e.g scm_u32vector_writable_elements), only permit bytevectors, as the constructors will only make bytevectors. This harmonizes with the Scheme interfaces as well, which expect packed bytevectors. (scm_make_srfi_4_vector): Knowing that the new value is a bytevector with base 0 and inc 1, simplify initialization.
* | Remove generalized-vectors.h includesDaniel Llorens2014-02-061-1/+0
| | | | | | | | * libguile/srfi-4.c, libguile/uniform.h: ditto.
* | bytevectors have internal parent fieldAndy Wingo2011-05-071-2/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | * libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): Bump, giving bytevectors another word: a parent pointer. Will allow for sub-bytevectors and efficient mmap bindings. * libguile/bytevectors.c (make_bytevector): (make_bytevector_from_buffer): Init parent to #f. (scm_c_take_bytevector, scm_c_take_typed_bytevector): Another argument, the parent, which gets set in the bytevector. * libguile/foreign.c (scm_pointer_to_bytevector): Use the parent field instead of registering a weak reference from bytevector to foreign pointer. * libguile/objcodes.c (scm_objcode_to_bytecode): Use the parent field to avoid copying the objcode. * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): * libguile/strings.c (scm_from_stringn): * libguile/vm.c (really_make_boot_program): * libguile/r6rs-ports.c (scm_get_bytevector_some) (scm_get_bytevector_all, bytevector_output_port_procedure): Set the parent to #f.
* remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64Andy Wingo2010-07-261-4/+0
| | | | | | | | | | | | * libguile/__scm.h: * libguile/numbers.h: * libguile/random.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/numbers.c: * test-suite/standalone/test-conversion.c: * libguile/gen-scmconfig.c: As we require 64-bit integers in configure.ac, remove conditional definition of 64-bit types.
* Fix off-by-one error in the off-by-one fix of `make-srfi-4-vector'.Ludovic Courtès2010-03-031-1/+2
| | | | | | | | This is a followup to d900a8557db21641413db8995a7cdc1453adbe1f ("Fix off-by-one error when initializing vectors in `make-srfi-4-vector'."). * libguile/srfi-4.c (scm_make_srfi_4_vector): Don't initialize RET when LEN is zero.
* Fix off-by-one error when initializing vectors in `make-srfi-4-vector'.Ludovic Courtès2010-03-021-0/+6
| | | | | | | | * libguile/srfi-4.c (scm_make_srfi_4_vector): When FILL is bound and non-zero, initialize the last element. * test-suite/tests/srfi-4.test ("TAG vectors")["make-TAGvector"]: New tests.
* hopefully fix shared c32 / c64 uniform arraysAndy Wingo2010-01-121-17/+17
| | | | | | * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Add a width parameter, indicating the number of sizeof(ctype) entries comprised by one element of the uniform; normally 1, but 2 for c32 and c64.
* fix srfi-4 shared vector access from cAndy Wingo2010-01-121-2/+2
| | | | | | * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix elements/writable_elements for shared vectors. Thanks to Daniel Llorens del Río for the info.
* reimplement srfi-4 vectors on top of bytevectorsAndy Wingo2010-01-071-822/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/srfi-4.h: * libguile/srfi-4.c (scm_make_srfi_4_vector): New function, exported by (srfi srfi-4 gnu). * libguile/srfi-4.i.c: Removed. * module/srfi/srfi-4.scm: * module/srfi/srfi-4/gnu.scm: Reimplement srfi-4 vectors on top of bytevectors. The implementation is mostly in Scheme now. * test-suite/tests/unif.test: Update to use (srfi srfi-4 gnu). * libguile/bytevectors.c (bytevector_ref_c32, bytevector_ref_c64) (bytevector_set_c32, bytevector_set_c64): Fix some embarrassing bugs. Still need to do an upper bounds check. * libguile/deprecated.h: Remove deprecated array functions: scm_i_arrayp, scm_i_array_ndim, scm_i_array_mem, scm_i_array_v, scm_i_array_base, scm_i_array_dims, and the deprecated macros: SCM_ARRAYP, SCM_ARRAY_NDIM, SCM_ARRAY_CONTP, SCM_ARRAY_MEM, SCM_ARRAY_V, SCM_ARRAY_BASE, SCM_ARRAY_DIMS. * libguile/deprecated.c (scm_uniform_vector_read_x) (scm_uniform_vector_write, scm_uniform_array_read_x) (scm_uniform_array_write): Newly deprecated functions. * libguile/generalized-arrays.c (scm_array_type): Remove the bytevector hack. * libguile/objcodes.c (scm_bytecode_to_objcode, scm_objcode_to_bytecode): Rework to operate on bytevectors, as scm_make_u8vector now causes a module lookup, which can't be done e.g. when loading the VM boot program for psyntax-pp.go on a fresh bootstrap. * libguile/objcodes.h (SCM_F_OBJCODE_IS_BYTEVECTOR): (SCM_OBJCODE_IS_BYTEVECTOR): s/U8VECTOR/BYTEVECTOR/. * module/ice-9/boot-9.scm (the-scm-module): A terrible hack to pull in (srfi srfi-4), as the bindings are primarily there now. We'll worry about this later.
* Remove extraneous semicolon after `SCM_ARRAY_IMPLEMENTATION' & co.Ludovic Courtès2009-12-151-1/+1
| | | | | | | * libguile/bitvectors.c, libguile/srfi-4.c, libguile/strings.c, libguile/vectors.c: Remove extraneous semicolon after `SCM_ARRAY_IMPLEMENTATION' and `SCM_VECTOR_IMPLEMENTATION' invocations.
* add SCM_SMOB_TYPE_BITS and SCM_SMOB_TYPE_MASKAndy Wingo2009-12-081-1/+2
| | | | | | | | | * 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.
* SCM_CELL in srfi-4.cAndy Wingo2009-12-081-3/+3
| | | | | * libguile/srfi-4.c (SCM_UVEC_TYPE, SCM_UVEC_LENGTH, SCM_UVEC_BASE): Fix SCM_CELL macro usage.
* remove a bunch of needless scm_permanent_object callsAndy Wingo2009-12-051-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * libguile/array-handle.c: * libguile/bytevectors.c: * libguile/deprecated.c: * libguile/eval.c: * libguile/feature.c: * libguile/filesys.c: * libguile/gc.c: * libguile/gdbint.c: * libguile/goops.c: * libguile/instructions.c: * libguile/load.c: * libguile/modules.c: * libguile/numbers.c: * libguile/options.c: * libguile/ports.c: * libguile/scmsigs.c: * libguile/srcprop.c: * libguile/srfi-4.c: * libguile/stacks.c: * libguile/threads.c: * libguile/vm.c: Remove calls to scm_permanent_object, as they are no longer needed with the BDW GC.
* Rename "boehm-gc.h" to "bdw-gc.h"; add to the distribution.Ludovic Courtès2009-09-141-1/+1
| | | | | | | * libguile/Makefile.am (modinclude_HEADERS): Add `bdw-gc.h'. * libguile/bdw-gc.h: Rename from "boehm-gc.h"; users updated. Update to LGPLv3+.
* Fix leaky behavior of `scm_take_TAGvector ()'.Ludovic Courtès2009-09-011-0/+9
| | | | | | | | | | | | | * libguile/srfi-4.c (free_user_data): New function. * libguile/srfi-4.i.c (scm_take_TAGvector): Register `free_user_data ()' as a finalizer for DATA. * libguile/objcodes.c (scm_objcode_to_bytecode): Allocate with `scm_malloc ()' since the memory taken by `scm_take_u8vector ()' will eventually be free(3)d. * libguile/vm.c (really_make_boot_program): Likewise.
* Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès2009-08-281-251/+78
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: libguile/Makefile.am libguile/bytevectors.c libguile/gc-card.c libguile/gc-mark.c libguile/programs.c libguile/srcprop.c libguile/srfi-14.c libguile/symbols.c libguile/threads.c libguile/unif.c libguile/vm.c
| * any->u8vector and family now implemented in SchemeAndy Wingo2009-07-191-23/+31
| | | | | | | | | | | | | | | | | | | | * module/Makefile.am: * module/srfi/srfi-4/gnu.scm: New module, for extensions to srfi-4. Currently defines the any->FOOvector family. * libguile/srfi-4.c: * libguile/srfi-4.i.c: Dispatch scm_any_to_FOOvector calls to the scheme-implemented functions in (srfi srfi-4 gnu).
| * add registry of vector constructors, make-generalized-vectorAndy Wingo2009-07-191-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/generalized-vectors.h: * libguile/generalized-vectors.c: Add a registry of vector constructors. (scm_make_generalized_vector): New public function, constructs a vector of a given type. * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/srfi-4.c: * libguile/strings.c: * libguile/vectors.c: Register vector constructors. * libguile/extensions.c (scm_init_extensions): No need to NULL the list of registered extensions here, the static init does it for us. Allows scm_c_register_extension to be called before scm_init_extensions. * libguile/init.c (scm_i_init_guile): Move array initialization earlier, so e.g. scm_init_strings has access to a valid list of array element types when registering its vector constructor.
| * uniform vector functions to their own fileAndy Wingo2009-07-191-216/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/uniform.c: * libguile/uniform.h: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/Makefile.am: Move uniform vector funcs out of srfi-4 to their own file. * libguile.h: * libguile/arrays.c: * libguile/bytevectors.c: Update includers.
| * generic vector ops to own fileAndy Wingo2009-07-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/Makefile.am: * libguile/vectors.c: * libguile/vectors.h: * libguile/generalized-vectors.c: * libguile/generalized-vectors.h: Move generic vector ops off into their own file too. The implementation is now based on the generic array-handle infrastructure. * libguile.h: * libguile/array-map.c: * libguile/bitvectors.c: * libguile/random.c: * libguile/srfi-4.c: Update includers.
| * add generic array implementation facilityAndy Wingo2009-07-191-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/array-handle.c (scm_i_register_array_implementation): (scm_i_array_implementation_for_obj): Add generic array facility, which will (in a few commits) detangle the array code. (scm_array_get_handle): Use the generic array facility. Note that scm_t_array_handle no longer has ref and set function pointers; instead it has a pointer to the array implementation. It is unlikely that code out there used these functions, however, as the supported way was through scm_array_handle_ref/set_x. (scm_array_handle_pos): Move this function here from arrays.c. (scm_array_handle_element_type): New function, returns a Scheme value representing the type of element stored in this array. * libguile/array-handle.h (scm_t_array_element_type): New enum, for generically determining the type of an array. (scm_array_handle_rank): (scm_array_handle_dims): These are now just #defines. * libguile/arrays.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/srfi-4.c: * libguile/strings.c: * libguile/vectors.c: Register array implementations for all of these. * libguile/inline.h: Update for array_handle_ref/set change. * libguile/deprecated.h: Need to include arrays.h now.
| * rename unif.[ch] to arrays.[ch]Andy Wingo2009-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/Makefile.am: * libguile/unif.c: * libguile/unif.h: * libguile/arrays.c: * libguile/arrays.h: Rename unif.[ch] to arrays.[ch]. * libguile.h: * libguile/array-handle.c: * libguile/array-map.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/eq.c: * libguile/gc-card.c: * libguile/gc-malloc.c: * libguile/gc-mark.c: * libguile/gc.c: * libguile/init.c: * libguile/inline.h: * libguile/print.c: * libguile/random.c: * libguile/read.c: * libguile/socket.c: * libguile/sort.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/strports.c: * libguile/vectors.c: * libguile/vectors.h: Update includers.
| * bitvector exodus from unif.[ch]Andy Wingo2009-07-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/Makefile.am: * libguile/unif.c: * libguile/unif.h: * libguile/bitvectors.c: * libguile/bitvectors.h: Move bitvector functionality out of unif.[ch]. * libguile/array-handle.c: * libguile/array-map.c: * libguile/init.c: * libguile/read.c: * libguile/srfi-4.c: * libguile/vectors.c: Oh, what a tangled web we weave...
* | Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès2009-08-181-7/+15
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Make bytevectors accessible using the generalized-vector API.Ludovic Courtès2009-06-221-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a side effect, this allows compilation of literal bytevectors ("#vu8(...)"), which gets done by the generic array handling of the GLIL->assembly compiler. * doc/ref/api-compound.texi (Generalized Vectors): Mention bytevectors. (Arrays, Array Syntax): Likewise. * doc/ref/api-data.texi (Bytevectors as Generalized Vectors): New node. * libguile/bytevectors.c (scm_i_bytevector_generalized_set_x): New. * libguile/bytevectors.h (scm_i_bytevector_generalized_set_x): New declaration. * libguile/srfi-4.c (scm_i_generalized_vector_type, scm_array_handle_uniform_element_size, scm_array_handle_uniform_writable_elements): Add support for bytevectors. * libguile/unif.c (type_creator_table): Add `vu8'. (bytevector_ref, bytevector_set): New functions. (memoize_ref, memoize_set): Add support for bytevectors. * libguile/vectors.c (scm_is_generalized_vector, scm_c_generalized_vector_length, scm_c_generalized_vector_ref, scm_c_generalized_vector_set_x): Add support for bytevectors. * test-suite/tests/bytevectors.test ("Generalized Vectors"): New test set.
| * Change Guile license to LGPLv3+Neil Jerram2009-06-171-6/+7
| | | | | | | | | | | | | | | | | | | | (Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
* | Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès2008-09-231-31/+4
|\ \ | |/
| * Make multi-byte reads on unbuffered ports more efficient.Neil Jerram2008-09-151-31/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Idea and original patch were by Ludovic Courts, this is Neil Jerram's reworking of it. * libguile/srfi-4.c (scm_uniform_vector_read_x): Use scm_c_read, instead of equivalent code here. * libguile/ports.c (scm_fill_input): Add assertion that read buffer is empty when called. (port_and_swap_buffer, swap_buffer): New, for... (scm_c_read): Use caller's buffer for reading, to avoid making N 1-byte low-level read calls, in the case where the port is unbuffered (or has a very small buffer).
* | Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès2008-09-131-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/Makefile.am libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/private-gc.h m4/.cvsignore m4/gnulib-cache.m4 m4/gnulib-comp.m4
| * Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès2008-09-131-1/+1
| |