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

58 commits

Author SHA1 Message Date
Andy Wingo
2be7131ee0 Fix breakage of SRFI-4 C accessors
* 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.
2014-03-19 22:41:19 +01:00
Andy Wingo
dc65b88d83 Simplify srfi-4 C implementation
* 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.
2014-02-08 14:28:07 +01:00
Andy Wingo
4ca4826997 remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64
* 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.
2010-07-26 15:00:49 +02:00
Ludovic Courtès
dc327575a8 Fix off-by-one error in the off-by-one fix of `make-srfi-4-vector'.
This is a followup to d900a8557d ("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.
2010-03-03 10:18:41 +01:00
Ludovic Courtès
d900a8557d Fix off-by-one error when initializing vectors in `make-srfi-4-vector'.
* 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.
2010-03-02 23:16:26 +01:00
Andy Wingo
0d782201bf hopefully fix shared c32 / c64 uniform arrays
* 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.
2010-01-12 20:14:06 +01:00
Andy Wingo
f3a1fc5a9e fix srfi-4 shared vector access from c
* 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.
2010-01-12 00:20:10 +01:00
Andy Wingo
a268973767 reimplement srfi-4 vectors on top of bytevectors
* 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-07 22:06:56 +01:00
Ludovic Courtès
f65e0168d5 Remove extraneous semicolon after `SCM_ARRAY_IMPLEMENTATION' & co.
* 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.
2009-12-15 01:01:17 +01:00
Andy Wingo
735bcfe579 add SCM_SMOB_TYPE_BITS and SCM_SMOB_TYPE_MASK
* libguile/smob.h (SCM_SMOB_TYPE_BITS, SCM_SMOB_TYPE_MASK): New macros,
  for when you want to identify a SMOB by type and mask.

* libguile/arrays.c:
* libguile/bitvectors.c:
* libguile/srfi-4.c: Use the new macros.
2009-12-08 23:13:21 +01:00
Andy Wingo
00f8b368ca SCM_CELL in srfi-4.c
* libguile/srfi-4.c (SCM_UVEC_TYPE, SCM_UVEC_LENGTH, SCM_UVEC_BASE): Fix
  SCM_CELL macro usage.
2009-12-08 23:13:20 +01:00
Andy Wingo
f39448c5a3 remove a bunch of needless scm_permanent_object calls
* 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.
2009-12-05 11:32:50 +01:00
Ludovic Courtès
1c44468d77 Rename "boehm-gc.h" to "bdw-gc.h"; add to the distribution.
* libguile/Makefile.am (modinclude_HEADERS): Add `bdw-gc.h'.

* libguile/bdw-gc.h: Rename from "boehm-gc.h"; users updated.  Update to
  LGPLv3+.
2009-09-14 00:42:25 +02:00
Ludovic Courtès
d7e7a02a62 Fix leaky behavior of `scm_take_TAGvector ()'.
* 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.
2009-09-01 23:53:58 +02:00
Ludovic Courtès
7af531508c Merge branch 'master' into boehm-demers-weiser-gc
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
2009-08-28 19:16:46 +02:00
Ludovic Courtès
fbb857a472 Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	lib/Makefile.am
	libguile/Makefile.am
	libguile/frames.c
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc_os_dep.c
	libguile/load.c
	libguile/macros.c
	libguile/objcodes.c
	libguile/programs.c
	libguile/strings.c
	libguile/vm.c
	m4/gnulib-cache.m4
	m4/gnulib-comp.m4
	m4/inline.m4
2009-08-18 00:06:45 +02:00
Andy Wingo
ac8ed3db31 any->u8vector and family now implemented in Scheme
* 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).
2009-07-19 15:15:44 +02:00
Andy Wingo
f45eccffa7 add registry of vector constructors, make-generalized-vector
* 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.
2009-07-19 15:15:44 +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
Andy Wingo
f332e95717 generic vector ops to own file
* 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.
2009-07-19 15:15:44 +02:00
Andy Wingo
2a610be594 add generic array implementation facility
* 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.
2009-07-19 15:15:40 +02:00
Andy Wingo
2fa901a51f rename unif.[ch] to arrays.[ch]
* 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.
2009-07-19 14:53:03 +02:00
Andy Wingo
cf39614240 bitvector exodus from unif.[ch]
* 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...
2009-07-19 14:53:03 +02:00
Ludovic Courtès
438974d08d Make bytevectors accessible using the generalized-vector API.
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.
2009-06-22 01:09:39 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
b66a552487 Merge branch 'master' into boehm-demers-weiser-gc 2008-09-23 19:01:01 +02:00
Neil Jerram
b5cb4464ca Make multi-byte reads on unbuffered ports more efficient.
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).
2008-09-15 18:52:51 +01:00
Ludovic Courtès
44e268898b Merge branch 'master' into boehm-demers-weiser-gc
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
2008-09-13 22:51:27 +02: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
Ludovic Courtes
a4a141f679 Removed a lot of now-useless SMOB mark/free functions.
* libguile/arbiters.c (scm_init_arbiters): Don't invoke `scm_set_smob_mark'.

* libguile/async.c (async_gc_mark): Removed.
  (scm_init_async): Don't invoke `scm_set_smob_mark'.

* libguile/coop-pthreads.c (thread_mark): Removed.
  (create_thread): Use `scm_gc_malloc' instead of `scm_malloc' when
  allocating `launch_data'.
  (mutex_mark): Removed.
  (scm_threads_init): Don't invoke `scm_set_smob_mark' and
  `scm_set_smob_free'.

* libguile/debug.c (scm_init_debug): Don't invoke `scm_set_smob_mark'.

* libguile/dynl.c (dynl_obj_mark): Removed.
  (scm_init_dynamic_linking): Don't invoke `scm_set_smob_mark'.

* libguile/dynwind.c (winder_mark): Removed.
  (scm_init_dynwind): Don't invoke `scm_set_smob_mark'.

* libguile/environments.c (environment_mark): Removed.
  (environment_free): Removed.
  (observer_mark): Removed.
  (core_environments_mark): Removed.
  (core_environments_finalize): Removed.
  (leaf_environment_mark): Removed.
  (leaf_environment_free): Removed.
  (leaf_environment_funcs): Don't refer to the above funcs.
  (eval_environment_mark): Removed.
  (eval_environment_free): Removed.
  (eval_environment_funcs): Don't refer to the above funcs.
  (import_environment_mark): Removed.
  (import_environment_free): Removed.
  (import_environment_funcs): Don't refer to the above funcs.
  (export_environment_mark): Removed.
  (export_environment_free): Removed.
  (export_environment_funcs): Don't refer to the above funcs.
  (scm_environments_prehistory): Don't invoke `scm_set_smob_mark' and
  `scm_set_smob_free'.

* libguile/environments.h (scm_environment_funcs)[mark]: Removed.
  [free]: Removed.

* libguile/eval.c (promise_mark): Removed.
  (promise_free): Removed.
  (scm_init_eval): Don't invoke `scm_set_smob_mark' and
  `scm_set_smob_free'.

* libguile/fluids.c (fluid_free): Removed.
  (scm_fluids_prehistory): Don't invoke `scm_set_smob_mark' and
  `scm_set_smob_free'.

* libguile/futures.c (future_mark): Removed.
  (scm_init_futures): Don't invoke `scm_set_smob_mark'.

* libguile/hashtab.c (hashtable_free): Removed.
  (scm_hashtab_prehistory): Don't invoke `scm_set_smob_mark' and
  `scm_set_smob_free'.

* libguile/hooks.c (scm_init_hooks): Don't invoke `scm_set_smob_mark'.

* libguile/keywords.c (scm_init_keywords): Don't invoke
  `scm_set_smob_mark'.

* libguile/macros.c (scm_init_macros): Don't invoke `scm_set_smob_mark'.

* libguile/modules.c (scm_init_modules): Don't invoke
  `scm_set_smob_mark'.

* libguile/print.c (scm_init_print): Don't invoke `scm_set_smob_mark'.

* libguile/random.c (scm_i_copy_rstate): Use `scm_gc_malloc' instead of
  `scm_malloc'.
  (scm_c_make_rstate): Likewise.
  (rstate_free): Removed.
  (scm_init_random): Don't invoke `scm_set_smob_free'.

* libguile/srcprop.c (srcprops_mark): Removed.
  (scm_init_srcprop): Don't invoke `srcprops_mark'.

* libguile/srfi-14.c (charset_free): Removed.
  (scm_init_srfi_14): Don't invoke `scm_set_smob_free'.

* libguile/srfi-4.c (uvec_mark): Removed.
  (uvec_free): Removed.
  (scm_init_srfi_4): Don't invoke `scm_set_smob_free' and
  `scm_set_smob_mark'.

* libguile/threads.c (thread_mark): Removed.
  (fat_mutex_mark): Removed.
  (fat_cond_mark): Removed.
  (scm_init_threads): Dont invoke `scm_set_smob_mark' and
  `scm_set_smob_free'.

* libguile/unif.c (bitvector_free): Removed.
  (array_mark): Removed.
  (array_free): Removed.
  (scm_init_unif): Don't invoke `scm_set_smob_free' and
  `scm_set_smob_mark'.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-28
2008-09-05 09:34:23 +02:00
Marius Vollmer
b0c0a310db Replace SCM_C_INLINE with SCM_C_INLINE_KEYWORD. Thanks to Mark Gran! 2006-05-27 21:32:22 +00:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
ab7acbb74e (take_uvec): Make BASE pointer non-const.
(scm_take_u8vector, etc): Likewise.  Thanks to Ludovic Courtès!
2005-12-06 21:42:19 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
69d2000d93 Docstring updates. 2005-03-04 17:55:49 +00:00
Marius Vollmer
9de87eea47 See ChangeLog from 2005-03-02. 2005-03-02 20:42:01 +00:00
Marius Vollmer
00c17d4526 (scm_take_u64vector,
scm_array_handle_u64_elements,
scm_array_handle_u64_writable_elements, scm_u64vector_elements,
scm_u64vector_writable_elements): Do not define when scm_t_uint64
is not available.
(scm_take_s64vector, scm_array_handle_s64_elements,
scm_array_handle_s64_writable_elements, scm_s64vector_elements,
scm_s64vector_writable_elements): Likewise for scm_t_int64.
(uvec_sizes, uvec_print, uvec_equalp): Use SCM bignums when
scm_t_int64/scm_t_uint64 are not available.
(uvec_mark): New, to mark the bignums.
(alloc_uvec): Initialize bignums.
(uvec_fast_ref): Return bignums directly.
(scm_uint64_min, scm_uint64_max, scm_int64_min, scm_int64_max,
assert_exact_integer): New.
(uvec_fast_set): Use them to validate the bignums.
(scm_init_srfi_4): Set mark function of smob when needed.
Initialize scm_uint64_min, scm_uint64_max, scm_int64_min,
scm_int64_max.
2005-01-14 18:19:13 +00:00
Marius Vollmer
04b87de561 (SCM_ARRAYP, SCM_I_ARRAYP): Renamed former to latter internal
version.  Changed all uses.
(scm_tc16_array, scm_i_tc16_array,
scm_tc16_enclosed_array, scm_i_tc16_enclosed_array,
SCM_ARRAY_FLAG_CONTIGUOUS, SCM_I_ARRAY_FLAG_CONTIGUOUS,
SCM_ENCLOSE_ARRAYP, SCM_I_ENCLOSE_ARRAYP,
SCM_ARRAY_NDIM, SCM_I_ARRAY_NDIM,
SCM_ARRAY_CONTP, SCM_I_ARRAY_CONTP,
SCM_ARRAY_MEM, SCM_I_ARRAY_MEM,
SCM_ARRAY_V, SCM_I_ARRAY_V,
SCM_ARRAY_BASE, SCM_I_ARRAY_BASE,
SCM_ARRAY_DIMS, SCM_I_ARRAY_DIMS,
scm_t_array, scm_i_t_array): Likewise.
(SCM_SET_ARRAY_CONTIGUOUS_FLAG, SCM_CLR_ARRAY_CONTIGUOUS_FLAG):
Moved from unif.h to unif.c.
(scm_c_array_rank): New.
(scm_array_rank): Reimplement using it.
2005-01-11 16:55:38 +00:00
Marius Vollmer
4e8ad32394 (coerce_to_uvec, scm_c_uniform_vector_ref,
scm_c_uniform_vector_set_x): Use generic scm_array_handle_ref/set
instead of uvec_fast_ref/set since scm_array_handle_ref should be
faster now.
2005-01-09 22:37:50 +00:00
Marius Vollmer
4ea4bc4c40 * srfi-4.h, srfi-4.c, srfi-4.i.c (scm_i_uniform_vector_ref_proc,
scm_i_uniform_vector_set_proc): New.
(u8ref, u8set, s8ref, s8set, etc): New.
(uvec_reffers, uvec_setters): New.
(uvec_to_list): Use generic scm_array_handle_ref instead of
uvec_fast_ref since scm_array_handle_ref should be faster now.
More changes like this are upcoming.
2005-01-09 22:06:56 +00:00
Marius Vollmer
7c2ef9a87b (scm_uniform_element_size): Deprecated implementation
as well.
2005-01-09 17:43:14 +00:00
Marius Vollmer
5e320e5926 (uvec_type): New.
(uvec_to_list, uvec_ref, uvec_set_x, scm_c_uniform_vector_ref,
scm_c_uniform_vector_x): Use it to get concrete type.
2005-01-09 15:45:21 +00:00
Marius Vollmer
6e433d8b8f Include deprecation.h. 2005-01-07 15:44:45 +00:00
Marius Vollmer
4330ee2502 (SCM_IS_UVEC): New, use it instead of
SCM_SMOB_PREDICATE in this file.
(is_uvec): Also recognize one-dimensional uniform numeric arrays
of the right type.
(scm_is_uniform_vector): Likewise.
(uvec_fast_ref): Made BASE param const.
(uvec_writable_elements, uvec_elements): New.
(uvec_to_list, uvec_ref, uvec_set_x, uvec_length,
scm_c_uniform_vector_length, scm_c_uniform_vector_ref,
scm_c_uniform_set_x): Use them to also deal with one-dimensional
arrays.
(scm_uniform_vector_ref, scm_uniform_vector_set_x): Deprecate old
argument convention.
(scm_uniform_vector_to_list): Let uvec_to_list do all the
checking.
(scm_uniform_vector_length): Use uvec_length.
2005-01-07 00:28:33 +00:00
Marius Vollmer
fea99690f2 (scm_c_uniform_vector_element_size,
scm_c_uniform_vector_size): Removed.
(scm_array_handle_uniform_element_size): New.
2005-01-06 18:44:08 +00:00
Marius Vollmer
6e708ef2b1 * weaks.c: Use new vector elements API or simple vector
API, as appropriate.

* srfi-4.h, srfi-4.c, srfi-4.i.c (scm_array_handle_uniform_elements,
scm_array_handle_uniform_writable_elements,
scm_uniform_vector_elements, scm_uniform_vector_writable_elements):
(scm_<foo>vector_elements, scm_<foo>vector_writable_elements): Use
scm_t_array_handle, deliver length and increment.
(scm_array_handle_<foo>_elements,
scm_array_handle_<foo>_writable_elements): New.

* unif.h, unif.c (scm_t_array_handle, scm_array_get_handle,
scm_array_handle_rank, scm_array_handle_dims, scm_array_handle_ref
scm_array_handle_set, scm_array_handle_elements
scm_array_handle_writable_elements, scm_vector_get_handle): New.
(scm_make_uve, scm_array_prototype, scm_list_to_uniform_array,
scm_dimensions_to_uniform_array): Deprecated for real.  (scm_array_p,
scm_i_array_p): Use latter for SCM_DEFINE since snarfing wont allow a
mismatch between C and Scheme arglists.  (scm_make_shared_array,
scm_enclose_array): Correctly use scm_c_generalized_vector_length
instead of scm_uniform_vector_length.

* weaks.h, weaks.c: Use new internal weak vector API from
vectors.h.

* Makefile.am (libguile_la_SOURCES, DOT_X_FILES, DOT_DOC_FILES,
EXTRA_libguile_la_SOURCES): Changed ramap.c and unif.c from being
'extra' to being regular sources.
(noinst_HEADERS): Added quicksort.i.c.
* quicksort.i.c: New file.

* vectors.h, vector.c (SCM_VECTORP, SCM_VECTOR_LENGTH, SCM_VELTS,
SCM_WRITABLE_VELTS, SCM_VECTOR_REF, SCM_VECTOR_SET): Deprecated and
reimplemented.  Replaced all uses with scm_vector_elements,
scm_vector_writable_elements, or SCM_SIMPLE_VECTOR_*, as appropriate.
(scm_is_simple_vector, SCM_SIMPLE_VECTOR_LENGTH,
SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET, SCM_SIMPLE_VECTOR_LOC):
New.  (SCM_VECTOR_BASE, SCM_SET_VECTOR_BASE, SCM_VECTOR_MAX_LENGTH,
SCM_MAKE_VECTOR_TAG, SCM_SET_VECTOR_LENGTH, SCM_VELTS_AS_STACKITEMS,
SCM_SETVELTS, SCM_GC_WRITABLE_VELTS): Removed.  (scm_vector_copy):
New.  (scm_vector_elements, scm_vector_writable_elements): Use
scm_t_array_handle, deliver length and increment.  Moved to
unif.h. Changed all uses.  (scm_vector_release_elements,
scm_vector_release_writable_elements,
(scm_frame_vector_release_elements,
scm_frame_vector_release_writable_elements): Removed.
(SCM_I_IS_VECTOR, SCM_I_VECTOR_ELTS, SCM_I_VECTOR_WELTS,
SCM_I_VECTOR_LENGTH, scm_i_vector_free): New internal API.
(SCM_I_WVECTP SCM_I_WVECT_LENGTH SCM_I_WVECT_VELTS
SCM_I_WVECT_GC_WVELTS SCM_I_WVECT_TYPE SCM_I_WVECT_GC_CHAIN
SCM_I_SET_WVECT_GC_CHAIN, scm_i_allocate_weak_vector): New, for weak
vectors.
2005-01-02 20:06:08 +00:00
Marius Vollmer
f301dbf34a * srfi-4.h (scm_i_proc_make_u8vector, scm_i_proc_make_s8vector,
scm_i_proc_make_u16vector, scm_i_proc_make_s16vector,
scm_i_proc_make_u32vector, scm_i_proc_make_s32vector,
scm_i_proc_make_u64vector, scm_i_proc_make_s64vector,
scm_i_proc_make_f32vector, scm_i_proc_make_f64vector,
scm_i_proc_make_c32vector, scm_i_proc_make_c64vector,
uvec_proc_vars): Removed.
(scm_i_generalized_vector_creator): Removed.
(scm_i_generalized_vector_type): New.

* unif.h, unif.c (scm_typed_array_p, scm_make_array,
scm_make_typed_array, scm_array_type, scm_list_to_array,
scm_list_to_typed_array, scm_is_array, scm_is_typed_array): New.
(scm_array_creator): Removed.
(scm_array_p): Deprecated second PROT argument.
(scm_dimensions_to_uniform_array, scm_list_to_uniform_array):
Deprecated, reimplemented in terms of scm_make_typed_array and
scm_list_to_typed_array.
(scm_i_proc_make_vector, scm_i_proc_make_string,
scm_i_proc_make_bitvector): Removed.
(type_creator_table, init_type_creator_table, type_to_creator,
make_typed_vector): New.
(scm_i_convert_old_prototype): Removed.
(prototype_to_type): New.
(scm_make_uve): Deprecated, reimplemented using make_typed_vector.
(scm_array_dimensions): Use scm_list_1 instead of scm_cons for
minor added clarity.
(scm_make_shared_array, scm_ra2contig): Use make_typed_vector
instead of scm_make_uve.
(tag_creator_table, scm_i_tag_to_creator): Removed.
(tag_to_type): New.
(scm_i_read_array): Use scm_list_to_typed_array instead of
scm_list_to_uniform_array.
2004-12-29 18:21:55 +00:00
Marius Vollmer
b590aceb96 (scm_uniform_vector_elements,
scm_u8vector_elements, etc): Made return value "const".
(scm_uniform_vector_writable_elements,
scm_u8vector_writable_elements, etc): New.
(scm_uniform_vector_release, scm_uniform_vector_release_elements):
Renamed former to latter.  Added explicit call to
scm_remember_upto_here_1.
(scm_frame_uniform_vector_release,
scm_frame_uniform_vector_release_elements): Renamed former to latter.
(scm_uniform_vector_release_writable_elements,
scm_frame_uniform_vector_release_writable_elements): New. Takes
crown of longest identifier yet.
Changed all uses as required by the changes above.
2004-12-27 02:10:14 +00:00
Marius Vollmer
69730f92ca Do not include <libguile.h>, include the
needed files directly.  Include config.h, <unistd.h> and <io.h>
when available.
(scm_uniform_vector_read_x, scm_uniform_vector_write): New.
2004-11-10 01:02:32 +00:00
Marius Vollmer
811eb6d0ee (scm_c_uniform_vector_ref, scm_c_uniform_vector_set_x): New.
(scm_i_uniform_vector_creator): Removed.
(scm_i_generalized_vector_creator): New.
(scm_uniform_vector_length, scm_uniform_element_size): Do not
handle generalized vectors, only uniform numeric vectors.
(alloc_uvec): Do length check here...
(make_uvec): ...but not here.
(coerce_to_uvec): Use new generalized vector functions to handle
all kinds of vectors in one go.
2004-11-09 16:13:58 +00:00