summaryrefslogtreecommitdiff
path: root/libguile/arrays.h
Commit message (Expand)AuthorAgeFilesLines
* Final names for new array functions...Globally rename (array-from* -> array-slice), (array-from -> array-cell-ref), (array-amend! -> array-cell-set!), (array-for-each-cell -> array-slice-for-each). Daniel Llorens2017-01-091-3/+3
* Deprecate scm_from_contiguous_array...scm_from_contiguous_array() was undocumented, unused within Guile, and can be replaced by make-array + array-copy! without requiring contiguity and without loss of performance. * libguile/arrays.c (scm_array_contents): Do not rely on SCM_I_ARRAY_CONTP. * test-suite/tests/arrays.test: Test array-contents with 0-rank array. * libguile/arrays.h: Declare scm_i_shap2ra(), SCM_SET_ARRAY_CONTIGUOUS_FLAG, SCM_CLR_ARRAY_CONTIGUOUS_FLAG so that scm_from_contiguous_array() can keep using them. * libguile/deprecated.c (scm_from_contiguous_array): Move here from arrays.c. * libguile/deprecated.h (scm_from_contiguous_array): Deprecate. * NEWS: Add deprecation notice. Daniel Llorens2016-11-231-3/+7
* New functions array-from, array-from*, array-amend!...* libguile/arrays.h (scm_array_from, scm_array_from_s, scm_array_amend_x): New declarations. * libguile/arrays.c (scm_array_from, scm_array_from_s, scm_array_amend_x): New functions, export as array-from, array-from*, array-amend!. * test-suite/tests/arrays.test: Tests for array-from, array-from*, array-amend!. Replace with-test-prefix/c&e with with-test-prefix where the array read syntax isn't used. Daniel Llorens2016-11-231-0/+6
* Avoid unneeded internal use of array handles...* libguile/arrays.c (scm_shared_array_root): Adopt uniform check order. (scm_shared_array_offset, scm_shared_array_increments): Use the array fields directly just as scm_shared_array_root does. (scm_c_array_rank): Moved from libguile/generalized-arrays.c. Don't use array handles, but follow the same type check sequence as the other array functions (shared-array-root, etc). (scm_array_rank): Moved from libguile/generalized-arrays.h. * libguile/arrays.h: Move prototypes here. * test-suite/tests/arrays.test: Tests for shared-array-offset, shared-array-increments. Daniel Llorens2016-11-231-0/+3
* Pack array dimensions in array object...* libguile/arrays.c (scm_i_make_array): redo object layout. * libguile/arrays.h (SCM_I_ARRAY_V, SCM_ARRAY_BASE, SCM_I_ARRAY_DIMS): to match new layout. (SCM_I_ARRAY_SET_V, SCM_ARRAY_SET_BASE): new setters. (SCM_I_ARRAY_MEM, scm_i_t_array): unused, remove. (scm_i_shap2ra, scm_make_typed_array, scm_from_contiguous_typed_array, scm_from_contiguous_array, scm_make_shared_array, scm_transpose_array, scm_array_contents): fix uses of SCM_I_ARRAY_V, SCM_ARRAY_BASE as lvalues. * libguile/array-map.c (make1array, scm_ramapc): fix uses of SCM_I_ARRAY_V, SCM_ARRAY_BASE as lvalues. Daniel Llorens2014-09-301-11/+6
* Move array reader from arrays.c to read.c...* libguile/arrays.c (read_decimal_integer): Move to read.c. (scm_i_read_array): Remove. Incorporate the code into the 'scm_read_array' static function in read.c. * libguile/arrays.h (scm_i_read_array): Remove prototype. * libguile/read.c (read_decimal_integer): Move here from read.c. (scm_read_array): Incorporate the code from 'scm_i_read_array'. Call 'scm_read_vector' and 'scm_read_sexp' instead of 'scm_read'. Mark H Weaver2012-10-231-2/+2
* allocate a tc7 to arrays...* libguile/tags.h (scm_tc7_array): Allocate a tag for arrays. * libguile/arrays.h (SCM_I_ARRAYP): Change to use scm_tc7_array. The previous definition was not externally usable because scm_i_tc16_array was internal. (scm_i_print_array): Declare, though internally. * libguile/arrays.c (scm_i_make_array): Use scm_cell with the tc7 instead of NEWSMOB. (scm_i_print_array): Make not static. (SCM_ARRAY_IMPLEMENTATION): Adapt. (scm_init_arrays): Remove array smob declaration. * libguile/eq.c (scm_equal_p): Refactor to put the string, pointer, and bytevector cases in the switch. Add a case for arrays. * libguile/goops.c: Add <array> declarations. * libguile/print.c (iprin1): Call scm_i_print_array as needed. * libguile/evalext.c (scm_self_evaluating_p): Add a case for arrays. Andy Wingo2012-01-091-6/+5
* Fix the visibility of a few of internal symbols....* libguile/gc.h (scm_i_gc): Make internal. * libguile/posix.h (scm_i_locale_mutex): Likewise. * libguile/arrays.h (scm_i_tc16_array): Likewise. * libguile/numbers.c (scm_i_num_less_p): Likewise. * libguile/discouraged.h (scm_i_init_discouraged): Likewise. * libguile/continuations.c (scm_i_dummy): Made static. * libguile/gc.c (scm_i_cell_validation_already_running): Likewise. * libguile/discouraged.h (scm_i_init_discouraged): Likewise. Ludovic Courtès2010-05-281-1/+1
* allow compilation of #@2(1 2 3)...* libguile/arrays.h: * libguile/arrays.c (scm_from_contiguous_array): New public function, like scm_from_contiguous_typed_array but for arrays of generic Scheme values. * libguile/vm-i-scheme.c (make-struct): Sync regs before making the struct, so if we get a GC the regs are on the heap. (make-array): New instruction, makes an generic (untyped) Scheme array. * module/language/glil/compile-assembly.scm (dump-object): Correctly compile arrays. Andy Wingo2010-01-111-1/+3
* 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. Andy Wingo2010-01-071-6/+0
* fix erroneous SCM_CELL_* usage in arrays.[ch]...* libguile/arrays.h (SCM_I_ARRAY_FLAG_CONTIGUOUS, SCM_I_ARRAY_NDIM): (SCM_I_ARRAY_CONTP, SCM_I_ARRAY_MEM): * libguile/arrays.c (SCM_SET_ARRAY_CONTIGUOUS_FLAG): (SCM_CLR_ARRAY_CONTIGUOUS_FLAG): Fix macros to use SCM_SMOB macros instead of SCM_CELL macros. Andy Wingo2009-12-081-4/+4
* move generic array foo out to its own file...* libguile/arrays.h: * libguile/arrays.c: * libguile/generalized-arrays.h: * libguile/generalized-arrays.c: Move some generic functionality out of arrays.c to a new file. * libguile/array-map.c: * libguile/deprecated.c: * libguile/init.c: Update includers. Andy Wingo2009-07-191-20/+6
* remove enclosed arrays...* libguile/arrays.h: * libguile/array-map.c: * libguile/arrays.c: * libguile/deprecated.c: Remove "enclosed arrays". The only user-facing procedures that this affects are scm_enclose_array / enclose-array. If enclosed arrays are added back, it should be through the generic array interface; but really, it sounds like something that would be better implemented in Scheme. Andy Wingo2009-07-191-6/+1
* 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. Andy Wingo2009-07-191-0/+110