summaryrefslogtreecommitdiff
path: root/libguile/bytevectors.c
AgeCommit message (Collapse)AuthorFilesLines
2016-07-11Reuse SCM_BYTEVECTOR_TYPED_LENGTH in scm_array_get_handleDaniel Llorens1-9/+4
* libguile/bytevectors.h (SCM_BYTEVECTOR_TYPE_SIZE, SCM_BYTEVECTOR_TYPED_LENGTH): moved from libguile/bytevectors.c. * libguile/array-handle.c (scm_array_get_handle): reuse SCM_BYTEVECTOR_TYPED_LENGTH.
2016-06-20Fix size measurement in bytevector_large_setAndy Wingo1-3/+4
* libguile/bytevectors.c (bytevector_large_set): Fix computation of value size in words. * test-suite/tests/bytevectors.test: Add test. Thanks to Ben Rocer <fleabyte@mail.com> for the bug report and fix.
2016-04-26Remove scm_putc_unlocked.Andy Wingo1-4/+4
* libguile/ports.h (scm_putc_unlocked): Remove. * libguile/ports.c (scm_putc): Replace implementation with scm_putc_unlocked's implementation. (scm_port_print): Use scm_putc. * libguile/arbiters.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/continuations.c: * libguile/dynl.c: * libguile/eval.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/hashtab.c: * libguile/hooks.c: * libguile/macros.c: * libguile/mallocs.c: * libguile/print.c: * libguile/programs.c: * libguile/promises.c: * libguile/r6rs-ports.c: * libguile/smob.c: * libguile/srcprop.c: * libguile/struct.c: * libguile/variable.c: * libguile/weak-set.c: * libguile/weak-table.c: Use scm_putc instead of scm_putc_unlocked.
2015-01-22Merge commit '8cf2a7ba7432d68b9a055d29f18117be70375af9'Andy Wingo1-1/+6
2015-01-22Merge commit '81d2c84674f03f9028f26474ab19d3d3f353881a'Andy Wingo1-39/+36
Some fixups in bytevectors.c.
2015-01-22Merge commit 'fdd319e9bd4121d844662d3d8ccc69b462b60840'Andy Wingo1-1/+1
2014-11-12Fix bytevector-fill! to accept fill arguments greater than 127.Mark H Weaver1-1/+6
Fixes <http://bugs.gnu.org/19027>. * libguile/bytevectors.c (scm_bytevector_fill_x): Accept fill arguments between -128 and 255. * test-suite/tests/bytevectors.test ("2.2 General Operations"): Add tests.
2014-11-12Avoid signed overflow and use size_t in bytevectors.c.Mark H Weaver1-38/+35
* libguile/bytevectors.c (ULONG_MAX): Remove (unportable) fallback definition. It is no longer used. (scm_make_bytevector): Use 'size_t' instead of 'unsigned' for indices. Use 'scm_t_uint8' instead of 'signed char' for elements and c_fill. Previously relied on GNU-C-specific behavior when casting integers in the range 128-255 to signed char. (GENERIC_INTEGER_ACCESSOR_PROLOGUE, INTEGER_LIST_TO_BYTEVECTOR) (scm_bytevector_eq_p, scm_bytevector_copy_x, scm_bytevector_copy) (scm_bytevector_to_u8_list, scm_u8_list_to_bytevector) (scm_bytevector_fill_x): Use 'size_t' instead of 'unsigned' for indices. Use 'scm_t_uint8' for elements.
2014-11-11Fix bytevector-copy when applied to SRFI-4 homogeneous numeric vectors.Mark H Weaver1-2/+2
Fixes <http://bugs.gnu.org/18866>. Reported by tantalum <sph@posteo.eu>. * libguile/bytevectors.c (scm_bytevector_copy): Always create a VU8 bytevector. * test-suite/tests/bytevectors.test: Add test.
2014-09-30Merge branch 'stable-2.0'Mark H Weaver1-5/+11
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-05-28Fix shrinking of contiguous bytevectors, as from 'get-bytevector-n'.Ludovic Courtès1-5/+11
Fixes <http://bugs.gnu.org/17466>. Reported by J Kalbhenn <jkal@posteo.eu>. * libguile/bytevectors.c (scm_c_shrink_bytevector): When BV is contiguous, add use of 'SCM_BYTEVECTOR_SET_CONTENTS'.
2014-02-09Remove array impl. registry; instead, hard-code array handle creationAndy Wingo1-175/+3
* libguile/array-handle.h (scm_t_vector_ref, scm_t_vector_set): Rename from scm_t_array_ref, scm_t_array_set. These were named scm_i_t_array_ref and scm_i_t_array_set in 1.8 and 2.0. Change to take the vector directly, instead of the array handle. In this way, generic array handles are layered on top of specific implementations of backing stores. Remove scm_t_array_implementation, introduced in 2.0 but never documented. It was a failed attempt to layer the array implementation that actually introduced too many layers, as it prevented the "vref" and "vset" members of scm_t_array_handle (called "ref" and "set" in 1.8, not present in 2.0) from specializing on array backing stores. (scm_i_register_array_implementation) (scm_i_array_implementation_for_obj): Remove these internal interfaces. (scm_t_array_handle): Adapt to scm_t_vector_ref / scm_t_vector_set change. (scm_array_handle_ref, scm_array_handle_set): Adapt to change in vref/vset prototype. * libguile/array-handle.c (scm_array_get_handle): Inline all the necessary initializations here for all specific array types. * libguile/array-map.c (rafill, racp, ramap, rafe, array_index_map_1): * libguile/arrays.c: Remove array implementation code. * libguile/bitvectors.h: * libguile/bitvectors.c: Remove array implementation code. (scm_i_bitvector_bits): New internal interface. * libguile/bytevectors.c: Remove array implementation code. * libguile/srfi-4.h: Remove declarations for internal procedures that don't exist (!). * libguile/strings.c: Remove array implementation code. * libguile/vectors.c: Remove array implementation code.
2013-11-03RTL compiler supports static bitvectorsAndy Wingo1-2/+3
* libguile/arrays.c (scm_from_contiguous_typed_array): * libguile/bytevectors.c (scm_uniform_array_to_bytevector): For bitvectors, round up the length to 32-bit units, as they are stored internally. Otherwise I think this probably does the wrong thing for the last word on big-endian systems. * libguile/bitvectors.c (BITVECTOR_LENGTH, BITVECTOR_BITS): (scm_c_make_bitvector): Reorder the length and pointer words to match the layout of bytevectors. * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/system/vm/assembler.scm (br-if-bitvector): * module/system/vm/disassembler.scm (code-annotation): Add bitvector test support. * module/system/vm/assembler.scm (<uniform-vector-backing-store>): Add an element-size field. (intern-constant): Adapt make-uniform-vector-backing-store call. Use uniform-array->bytevector, as the old compiler did. (link-data): Add bitvector cases.
2013-08-16In bytevector->uint-list et al, check that SIZE divides the bv length.Mark H Weaver1-1/+5
Fixes <http://bugs.gnu.org/15100>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/bytevectors.c (INTEGERS_TO_LIST): Enforce the R6RS requirement that SIZE divides the bytevector length. * test-suite/tests/bytevectors.test: Add test. Remove tests that assumes that this "divides" check is not enforced.
2013-08-16Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-5/+3
2013-08-16Improved error checking in bytevector->uint-list and bytevector->sint-list.Mark H Weaver1-5/+3
Partially fixes <http://bugs.gnu.org/15100>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/bytevectors.c (INTEGERS_TO_LIST): Make sure SIZE isn't 0. Allow SIZE to be greater than the bytevector length, for consistency with allowing extra bytes at the end when the bytevector length is non-zero. Use scm_from_size_t instead of scm_from_uint. * test-suite/tests/bytevectors.test: Add tests. Remove a test that checks for an exception when SIZE is greater than the bytevector length.
2013-01-15string->utf8 implementation uses scm_from_utf8_stringnAndy Wingo1-2/+1
* libguile/bytevectors.c (UTF_TO_STRING): Use scm_from_utf8_stringn.
2013-01-15fix bug where scm_from_utf8_stringn would not detect bad utf-8Andy Wingo1-3/+2
* libguile/strings.c (scm_from_utf8_stringn): * libguile/symbols.c (utf8_string_equals_wide_string): The "bad UTF8" return from u8_mbtouc is a 0xfffd character, not a negative byte length. Fixes a bug in which invalid UTF-8 would not be caught. * libguile/bytevectors.c (scm_utf8_to_string): Use scm_from_utf8_stringn directly. Just a little cleanup. * test-suite/tests/iconv.test ("narrow non-ascii string"): Add test for parsing bad utf-8 with substitution.
2012-04-26Merge commit 'd10f7b572c0ca1ccef87f9c46069daa30946e0cf'Andy Wingo1-51/+20
Conflicts: libguile/smob.c libguile/smob.h test-suite/tests/tree-il.test
2012-04-22bytevectors: Fix IEEE-754 endianness conversion.Ludovic Courtès1-51/+20
Fixes <http://bugs.gnu.org/11310>. Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>. * libguile/ieee-754.h: Remove. * libguile/Makefile.am (noinst_HEADERS): Remove `ieee-754.h'. * libguile/bytevectors.c (scm_ieee754_float, scm_ieee754_double): New unions. (float_to_foreign_endianness, float_from_foreign_endianness, double_to_foreign_endianness, double_from_foreign_endianness): Rewrite in terms of the new unions. * test-suite/tests/bytevectors.test ("2.8 Operations on IEEE-754 Representations")["single, little endian", "single, big endian", "double, little endian", "double, big endian"]: New tests.
2012-02-23Revert "wrap iconv_open / iconv_close with a lock to help in thread/fork issues"Andy Wingo1-6/+0
This reverts commit 8dfb7bbfd908ca883d0fdd0d868e13e6b20803ae.
2012-02-17wrap iconv_open / iconv_close with a lock to help in thread/fork issuesAndy Wingo1-0/+6
* libguile/bytevectors.c (STRING_TO_UTF, scm_string_to_utf8) (UTF_TO_STRING): * libguile/ports.c (open_iconv_descriptors, close_iconv_descriptors): * libguile/strings.c (scm_from_stringn, scm_to_stringn): Wrap operations that acquire and destroy iconv contexts with a mutex. While iconv is threadsafe, internally it uses a lock, and we need to make sure when we fork() that no one has that lock -- so we surround it with another one. Gross.
2012-02-11Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-26/+30
Conflicts: libguile/read.c test-suite/tests/tree-il.test
2012-02-10more efficient scm_string_to_utf8, scm_string_to_utf32Andy Wingo1-26/+30
* libguile/bytevectors.c (scm_string_to_utf8): More efficient implementation. (scm_string_to_utf32): Likewise.
2012-01-31Revert "add SCM_HEAP_OBJECT_BASE"Andy Wingo1-1/+1
This reverts commit 47ed8656db8800f3ad20a40eb2c4e9ef3dc891e3. Conflicts: libguile/foreign.c
2011-12-01Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-3/+3
Conflicts: configure.ac libguile/fluids.c libguile/gc.c libguile/gc.h libguile/objcodes.c libguile/procprop.c libguile/vm.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm
2011-11-20Allow overlapping regions to be passed to `bytevector-copy!'.Ludovic Courtès1-3/+3
Reported by Dmitry Chestnykh <dmitry@codingrobots.com>. Fixes <http://debbugs.gnu.org/10070>. * libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not `memcpy'. * test-suite/tests/bytevectors.test ("2.2 General Operations")["bytevector-copy! overlapping"]: New test. * doc/ref/api-data.texi (Bytevector Manipulation): Mention possible overlapping.
2011-11-08locking for putc, putsAndy Wingo1-4/+4
* libguile/ports.c (scm_putc, scm_puts): * libguile/ports.h (scm_putc_unlocked, scm_puts_unlocked): Separate into _unlocked and locked variants. Change all callers to use the _unlocked versions.
2011-10-24add SCM_HEAP_OBJECT_BASEAndy Wingo1-1/+1
* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro. Given a SCM, returns a pointer to the start of its memory area on the heap. * libguile/bytevectors.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/numbers.h: * libguile/ports.c: * libguile/smob.c: * libguile/struct.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Use it.
2011-10-24add SCM_{PACK,UNPACK}_POINTERAndy Wingo1-2/+2
* libguile/tags.h (SCM_UNPACK_POINTER, SCM_PACK_POINTER): New macros. The old SCM2PTR and PTR2SCM were defined in such a way that round-tripping through a pointer could lose precision, even in the case in which you weren't interested in actually dereferencing the pointer, it was simply that you needed to plumb a SCM through APIs that take pointers. These new macros are more like SCM_PACK and SCM_UNPACK, but for pointer types. The bit representation of the pointer should be the same as the scm_t_bits representation. * libguile/gc.h (PTR2SCM, SCM2PTR): Remove support for (old) UNICOS pointers. We are going to try tagging the SCM object itself in the future, and I don't think that keeping this support is worth its cost. It probably doesn't work anyway. * libguile/backtrace.c: * libguile/bytevectors.c: * libguile/continuations.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/hashtab.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/smob.c: * libguile/strings.c: * libguile/symbols.c: * libguile/vm.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Update many sites to use the new macros.
2011-08-31Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-2/+2
Conflicts: libguile/bytevectors.c libguile/bytevectors.h libguile/objcodes.c libguile/r6rs-ports.c libguile/strings.c libguile/vm.c
2011-08-18fix a couple of leaksAndy Wingo1-1/+1
* libguile/bytevectors.h: * libguile/bytevectors.c (scm_c_take_gc_bytevector): Rename this internal function, from scm_c_take_bytevector. This indicates that unlike the other scm_take_* functions, this one takes GC-managed memory. * libguile/objcodes.c (scm_objcode_to_bytecode): * libguile/vm.c (really_make_boot_program): Use scm_gc_malloc_pointerless, not scm_malloc. Thanks to Stefan Israelsson Tampe! * libguile/r6rs-ports.c: * libguile/strings.c: Adapt to renames.
2011-07-29minor style fix in bytevectors.cAndy Wingo1-1/+1
* libguile/bytevectors.c (SCM_BYTEVECTOR_HEADER_BYTES): Use sizeof scm_t_bits, not sizeof SCM. It's the same, but it seems like the right thing.
2011-07-25Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-24/+66
Conflicts: GUILE-VERSION test-suite/tests/srfi-4.test
2011-07-01Add type and range checks to the complex generalized vector accessors.Ludovic Courtès1-46/+64
* libguile/bytevectors.c (COMPLEX_ACCESSOR_PROLOGUE, COMPLEX_NATIVE_REF, COMPLEX_NATIVE_SET): New macros. (bytevector_ref_c32, bytevector_ref_c64): Defined in terms of `COMPLEX_NATIVE_REF'. (bytevector_set_c32, bytevector_set_c64): Defined in terms of `COMPLEX_NATIVE_SET'. (bytevector_ref_fns): Make `static'. * test-suite/tests/srfi-4.test ("c32 vectors")["generalized-vector-ref", "generalized-vector-set!", "generalized-vector-ref, out-of-range", "generalized-vector-set!, out-of-range"]: New tests. ("c64 vectors")["generalized-vector-ref", "generalized-vector-set!", "generalized-vector-ref, out-of-range", "generalized-vector-set!, out-of-range"]: New tests.
2011-07-01Fix unaligned accesses for bytevectors of complex numbers.Ludovic Courtès1-10/+34
* libguile/bytevectors.c (bytevector_ref_c32, bytevector_ref_c64, bytevector_set_c32, bytevector_set_c64): Use `memcpy' to avoid unaligned accesses. This fixes SIGBUS on SPARC and possibly other alignment-sensitive platforms.
2011-05-15remove SCM_I_SIZE limits definesAndy Wingo1-1/+1
* libguile/__scm.h: Remove defines for SCM_I_SIZE_MAX, SCM_I_SSIZE_MIN, and SCM_I_SSIZE_MAX, as there is no longer a scm_t_size / scm_size_t type. * libguile/bytevectors.c (make_bytevector): Replace a use of SCM_I_SIZE_MAX with ((size_t) -1).
2011-05-13merge strictness branch from 2.0Andy Wingo1-4/+4
2011-05-13scm_is_eq for SCM vals, not == or !=Andy Wingo1-4/+4
* libguile/bytevectors.c (scm_make_bytevector, STRING_TO_UTF) (UTF_TO_STRING): * libguile/continuations.c (scm_i_check_continuation): * libguile/expand.h (SCM_EXPANDED_P): * libguile/fluids.c (scm_i_make_with_fluids): * libguile/generalized-vectors.c (scm_make_generalized_vector): * libguile/goops.c (SCM_GOOPS_UNBOUNDP, slot_definition_using_name): (scm_c_extend_primitive_generic, more_specificp, scm_make) * libguile/i18n.c (SCM_VALIDATE_OPTIONAL_LOCALE_COPY): (scm_locale_string_to_integer) * libguile/modules.c (resolve_duplicate_binding): (scm_module_reverse_lookup) * libguile/posix.c (scm_to_resource): * libguile/r6rs-ports.c (scm_put_bytevector): * libguile/socket.c (scm_connect, scm_bind, scm_sendto * libguile/stacks.c (find_prompt): * libguile/variable.c (scm_variable_ref, scm_variable_bound_p): * libguile/vm-engine.h (ASSERT_BOUND_VARIABLE, ASSERT_BOUND) * libguile/vm-i-system.c (VARIABLE_BOUNDP, local_bound) (long_local_bound, fluid_ref): Use scm_is_eq to compare, not == / !=.
2011-05-07bytevectors have internal parent fieldAndy Wingo1-6/+23
* 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.
2011-03-08Fix bytevectors VALIDATE_REAL to test for reals, not rationalsMark H Weaver1-1/+1
Reported and fixed by Daniel Llorens <dll@bluewin.ch>. * libguile/bytevectors.c (VALIDATE_REAL): Test for reals, not rationals. * test-suite/tests/srfi-4.test (f32 vectors, f64 vectors): Add tests.
2011-03-08Fix bytevectors VALIDATE_REAL to test for reals, not rationalsMark H Weaver1-1/+1
Reported and fixed by Daniel Llorens <dll@bluewin.ch>. * libguile/bytevectors.c (VALIDATE_REAL): Test for reals, not rationals. * test-suite/tests/srfi-4.test (f32 vectors, f64 vectors): Add tests.
2011-01-07use scm_from_latin1_symboln for string literals and load-symbolAndy Wingo1-3/+3
* libguile/bytevectors.c: * libguile/eval.c: * libguile/goops.c: * libguile/i18n.c: * libguile/load.c: * libguile/memoize.c: * libguile/modules.c: * libguile/ports.c: * libguile/print.c: * libguile/procs.c: * libguile/programs.c: * libguile/read.c: * libguile/script.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/strings.c: * libguile/throw.c: * libguile/vm.c: Use scm_from_latin1_symboln to make symbols from string literals, because they aren't in the user's locale -- they are in ASCII, and we can optimize this case. * libguile/vm-i-loader.c: Also use scm_from_latin1_symboln when loading narrow symbols.
2010-12-04make-string et al nulls memory if not given an initializerAndy Wingo1-0/+2
* libguile/gc-malloc.c: Add a note that the gc-malloc does not clear the memory block, so users need to make sure it is initialized. * libguile/bitvectors.c (scm_c_make_bitvector): * libguile/bytevectors.c (scm_make_bytevector): * libguile/strings.c (scm_c_make_string): If no initializer is given, initialize the bytes to 0. Prevents information leakage if an app uses make-string et al without initializers. * libguile/foreign.c (make_cif): Initialize this too, to prevent leakage in the struct holes. Paranoia...
2010-11-19fix a number of assuptions that a long could hold an inumAndy Wingo1-4/+4
* libguile/bytevectors.c: * libguile/goops.c: * libguile/instructions.c: * libguile/numbers.c: * libguile/random.c: * libguile/read.c: * libguile/vm-i-scheme.c: Fix a number of assumptions that a long could hold an inum. This is not the case on platforms whose void* is larger than their long. * libguile/numbers.c (scm_i_inum2big): New helper, only implemented for sizeof(void*) == sizeof(long); produces a compile error on other platforms. Basically gmp doesn't have a nice interface for converting between mpz values and intmax_t.
2010-06-01rename (rnrs bytevector) to (rnrs bytevectors)Andy Wingo1-1/+1
* module/rnrs/bytevectors.scm: Rename to (rnrs bytevectors), from (rnrs bytevector), to match the name from the R6RS. * benchmark-suite/benchmarks/bytevectors.bm: * doc/ref/api-data.texi: * doc/ref/api-foreign.texi: * libguile/bytevectors.c: * module/6/rnrs.scm: * module/language/assembly.scm: * module/language/assembly/compile-bytecode.scm: * module/language/assembly/decompile-bytecode.scm: * module/language/glil/compile-assembly.scm: * module/language/tree-il/primitives.scm: * module/srfi/srfi-4.scm: * module/srfi/srfi-4/gnu.scm: * module/system/foreign.scm: * test-suite/standalone/test-ffi: * test-suite/tests/asm-to-bytecode.test: * test-suite/tests/bytevectors.test: * test-suite/tests/foreign.test: * test-suite/tests/r6rs-ports.test: Update all referrers.
2010-04-01more fixes to equal? for arraysAndy Wingo1-1/+2
* libguile/array-map.c (array_compare, scm_array_equal_p): Rewrite as something that operates on the generic array handle infrastructure. Based on array->list. (scm_i_array_equal_p): Change the docs, as array-equal? is now the same as equal?, except that it typechecks its args. * doc/ref/api-compound.texi (Array Procedures): Update array-equal? docs. * libguile/deprecated.h: * libguile/deprecated.c (scm_raequal): Deprecate. * libguile/bytevectors.c (scm_bytevector_eq_p): Bugfix: bytevectors are bytevector=? only if their element type is the same. * libguile/eq.c (scm_equal_p): Only dispatch to scm_array_equal_p if both args are arrays (generically). * test-suite/tests/arrays.test ("equal?"): Add some more tests.
2010-03-16rename libguile to libguile-@EFFECTIVE_VERSION@, currently libguile-2.0Andy Wingo1-1/+2
* libguile/Makefile.am (lib_LTLIBRARIES): Instead of just "libguile.la", make "libguile-@EFFECTIVE_VERSION@.la". This allows multiple versions of Guile to be installed at once. See http://www106.pair.com/rhp/parallel.html for a rationale. (libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS): (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES): (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD): (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Fixup automake vars to include the effective version. (guile_LDADD): Fix up the spelling of libguile. * libguile/bytevectors.c (scm_bootstrap_bytevectors): * libguile/foreign.c (scm_register_foreign): * libguile/i18n.c (scm_bootstrap_i18n): * libguile/instructions.c (scm_bootstrap_instructions): * libguile/objcodes.c (scm_bootstrap_objcodes): * libguile/programs.c (scm_bootstrap_programs): * libguile/vm.c (scm_bootstrap_vm): Register extensions using e.g. "libguile-2.0" as the libname -- i.e., including the effective version in the libname. * module/ice-9/i18n.scm: * module/rnrs/bytevector.scm: * module/rnrs/io/ports.scm: * module/system/foreign.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: When doing a load-extension for something in Guile, use the effective version also. * meta/guile-2.0-uninstalled.pc.in (Libs): * meta/guile-2.0.pc.in (Libs): Use -lguile-@EFFECTIVE_VERSION@. This change should mean that code built against Guile should not be affected by the libguile rename. * guile-readline/Makefile.am (libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD): * srfi/Makefile.am (libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_LIBADD): (libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_LIBADD): (libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_LIBADD): (libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_LIBADD): * test-suite/standalone/Makefile.am (test_num2integral_LDADD): (test_round_LDADD): (libtest_asmobs_la_LIBADD): (libtest_ffi_la_LIBADD): (test_list_LDADD): (test_unwind_LDADD): (test_conversion_LDADD): (test_loose_ends_LDADD): (test_scm_c_read_LDADD): (test_scm_take_locale_symbol_LDADD): (test_scm_take_u8vector_LDADD): (libtest_extensions_la_LIBADD): (test_with_guile_module_LDADD): (test_scm_with_guile_LDADD): Fix up the spelling of libguile.la.
2010-01-07reimplement srfi-4 vectors on top of bytevectorsAndy Wingo1-11/+10
* 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.
2010-01-07Revert "Remove unused internal bytevector functions."Andy Wingo1-0/+14
This reverts commit c4daa519107798d06ae96d2f69dc211fc57cc8a3.