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

12 commits

Author SHA1 Message Date
Daniel Llorens
d0b47b4946 Rename scm_t_array_handle.array to .root
Globally rename this field (after shared-array-root), since it's not an array.
2014-01-27 21:48:44 +01:00
Daniel Llorens
8190effae2 Have array impl->vref, vset take SCM, not handles
* libguile/array-handle.h
  - scm_i_t_array_ref, scm_i_t_array_set take SCM.
  - scm_array_handle_ref, scm_array_handle_set: pass h->array.
* libguile/array-map.c
  - AREF, ASET, rafill, racp, ramap, rafe: pass storage vector SCM
    instead of handle.
* libguile/bitvector.c
  - bitvector_handle_ref, bitvector_handle_set_x: take bitvector arg.
* libguile/bytevectors.c
  - bv_handle_ref, bv_handle_set_x: take bytevector arg.
  - scm_i_print_bytevectors: don't use array handles.
* libguile/deprecated.c
  - scm_generalized_vector_to_list: pass h.array.
* libguile/strings.c
  - string_handle_ref, string_handle_set: take string arg.
* libguile/uniform.c
  - scm_c_uniform_vector_ref, scm_c_uniform_vector_set_x: pass h.array.
* libguile/vectors.c
  - vector_handle_ref, vector_handle_set: take vector arg.
2014-01-27 21:45:54 +01:00
Daniel Llorens
ba7e018b61 Match uniform_vector_elements with vector_elements
* libguile/vectors.c
  - (scm_vector_writable_elements): allow any non-uniform rank 1 array,
    after the doc. Match the implementation with scm_uniform_vector_elements.
  - (scm_vector_elements): after the above.
* libguile/uniform.c
  - (scm_uniform_vector_writable_elements): ditto for uniform rank 1 arrays.
* libguile/sort.c
  - revert the changes in 7a6fd9, except for the argument type test; allow
    what scm_vector_(writable_)elements allows.
2014-01-27 21:45:18 +01:00
Daniel Llorens
413c715679 For uniform vectors SCM_I_ARRAYP can't be true
This fixes an inconsistency where uniform-vector? of a shared array could
be true but -ref operations failed to account correctly for lbnd.

* libguile/uniform.c
  - scm_is_uniform_vector: SCM_I_ARRAYP disqualifies obj as uniform vector.
  - scm_c_uniform_vector_length: lbnd is known 0, so don't use it.
  - scm_c_uniform_vector_ref: lbnd/base/inc are known to be 0/0/1.
  - scm_c_uniform_vector_set_x!: idem.
  - scm_uniform_vector_writable_elements: check uvec's type.
* test-suite/tests/arrays.test
  - group the exception types at the top.
  - check that uniform-vector functions do not accept general arrays.
2014-01-27 21:45:17 +01:00
Daniel Llorens
4569bbf7f6 Don't use generalized-vector functions in uniform.c
* libguile/uniform.c
  - (scm_is_uniform_vector): replace scm_is_generalized_vector and
    scm_generalized_vector_get_handle by scm_is_array and manual rank check.
  - (scm_c_uniform_vector_length): inline length computation. This
    removes a redundant rank check.
  - (scm_c_uniform_vector_ref): inline impl->vref use. This removes
    a redundant rank check.
  - (scm_c_uniform_vector_set): inline impl->vset use. This removes
    a redundant rank check.
  - (scm_uniform_vector_writable_elements): replace
    scm_generalized_vector_get_handle by scm_array_get_handle.

* test-suite/test/arrays.test
  - rename uniform-vector-ref block to uniform-vector.
  - exercise uniform-vector-length and shared arrays remaining uniform.
2014-01-27 21:45:17 +01:00
Andy Wingo
7bfbc7b1c5 Support serialization of uniform vector literals
* libguile/uniform.h:
* libguile/uniform.c (scm_uniform_vector_element_type_code): New
  interface, returns a type code as an integer.

* module/system/vm/assembler.scm (<uniform-vector-backing-store>)
  (simple-vector?, uniform-array?, statically-allocatable?)
  (intern-constant, link-data, link-constants): Support uniform arrays,
  and punt on vectors aren't contiguous from 0.  Support for general
  arrays will come later.

* test-suite/tests/rtl.test ("load-constant"): Add tests.
2013-10-31 12:55:23 +01:00
Andy Wingo
118ff892be deprecate generalized vectors in favor of arrays
* libguile/generalized-arrays.h:
* libguile/generalized-arrays.c (scm_c_array_length):
  (scm_array_length): New functions.

* module/ice-9/deprecated.scm:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_generalized_vector_p)
  (scm_generalized_vector_length, scm_generalized_vector_ref)
  (scm_generalized_vector_set_x, scm_generalized_vector_to_list):
  Deprecate.

* libguile/uniform.c (scm_uniform_vector_to_list): Use
  scm_array_to_list.

* module/ice-9/boot-9.scm (case): Arrays are generalized vectors.

* module/srfi/srfi-4/gnu.scm (define-any->vector): Use the array
  functions instead of the generalized-vector functions.

* test-suite/tests/arrays.test: Remove generalized-vector->list test;
  covered by array->list test.

* test-suite/tests/bitvectors.test:
* test-suite/tests/bytevectors.test:
* test-suite/tests/srfi-4.test: Adapt to test using array interfaces
  instead of generalized-vector interfaces.

* doc/ref/api-compound.texi: Remove generalized vector docs.
* doc/ref/api-data.texi:
* doc/ref/srfi-modules.texi: Adapt.
2013-02-18 16:57:15 +01:00
Ralf Wildenhues
ffb62a43dc fix typos in the manual bits generated from source comments.
* libguile/bitvectors.c, libguile/chars.c,
libguile/deprecated.c, libguile/numbers.c, libguile/random.c,
libguile/read.c, libguile/root.c, libguile/srfi-1.c,
libguile/srfi-13.c, libguile/srfi-14.c, libguile/uniform.c:
Fix typos, add missing newlines.
2011-02-09 22:28:49 +00:00
Andy Wingo
0142d376b8 bitvector work
* test-suite/Makefile.am:
* test-suite/tests/bitvectors.test: Add a new file to test bitvectors.

* libguile/uniform.c (scm_c_uniform_vector_length): Don't call
  scm_uniform_vector_elements, as we don't need to be able to access the
  elements with pointers to bytes. Fixes uniform-vector-length on
  bitvectors.
2010-08-29 20:48:32 -07:00
Ludovic Courtès
bc4adf1739 Remove unneeded #include <assert.h>.
* libguile/backtrace.c, libguile/eval.c, libguile/gc.c,
  libguile/goops.c, libguile/memoize.c, libguile/threads.c,
  libguile/uniform.c, libguile/vm.c,
  test-suite/standalone/test-conversion.c,
  test-suite/standalone/test-list.c: Don't include <assert.h>.
2009-12-15 20:20:38 +01:00
Andy Wingo
f5a51caec1 fix bitvectors after the array handle refactoring
* libguile/uniform.h (scm_array_handle_uniform_element_bit_size): New
  public accessor.

* libguile/uniform.c (scm_array_handle_uniform_element_size): Better
  errors in non-byte-aligned arrays.
  (scm_uniform_vector_element_type, scm_uniform_vector_element_size)
  (scm_c_uniform_vector_ref, scm_c_uniform_vector_set_x):
  (scm_uniform_vector_to_list): Don't require byte-aligned access.

* libguile/bytevectors.c (scm_uniform_array_to_bytevector):
* libguile/arrays.c (scm_from_contiguous_typed_array):  Fix for
  uniform arrays whose element size is not a multiple of the byte size.
2009-09-18 16:27:32 +02:00
Andy Wingo
476b894c71 uniform vector functions to their own file
* 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.
2009-07-19 15:15:44 +02:00