summaryrefslogtreecommitdiff
path: root/libguile/arrays.h
AgeCommit message (Collapse)AuthorFilesLines
2016-07-11Clean up (array-for-each-cell)Daniel Llorens1-2/+0
* libguile/array-map.c (array-for-each-cell, array-for-each-cell-in-order): Moved from libguile/arrays.c. Fix argument names. Complete docstring. * libguile/array-map.h (array-for-each-cell, array-for-each-cell-in-order): Declarations moved from libguile/arrays.h. * test-suite/tests/array-map.test: Renamed from test-suite/tests/ramap.test, fix module name. Add tests for (array-for-each-cell). * test-suite/Makefile.am: Apply rename array-map.test -> ramap.test. * doc/ref/api-compound.texi: Minor documentation fixes.
2016-07-11New export (array-for-each-cell-in-order)Daniel Llorens1-0/+1
* libguile/arrays.h (array-for-each-cell-in-order): Declare. * libguile/arrays.c (array-for-each-cell-in-order): Define.
2016-07-11Draft of (array-for-each-cell)Daniel Llorens1-0/+2
* libguile/arrays.c (scm_i_array_rebase, scm_array_for_each_cell): new functions. Export scm_array_for_each_cell() as (array-for-each-cell). * libguile/arrays.h (scm_i_array_rebase, scm_array_for_each_cell): prototypes.
2016-07-11Don't use array handles in scm_c_array_rankDaniel Llorens1-0/+3
* libguile/arrays.c (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.
2016-07-11Rename array-set-from!, scm_array_set_from_x to array-amend!, scm_array_amend_xDaniel Llorens1-1/+1
2016-07-11New functions array-from, array-from*, array-set-from!Daniel Llorens1-0/+6
* libguile/arrays.h (scm_array_from, scm_array_from_s, scm_array_set_from_x): new declarations. * libguile/arrays.c (scm_array_from, scm_array_from_s, scm_array_set_from_x): new functions, export as array-from, array-from*, array-set-from!.
2016-07-11Unuse array 'contiguous' flagDaniel Llorens1-1/+1
SCM_I_ARRAY_FLAG_CONTIGUOUS (arrays.h) was set by all array-creating functions (make-typed-array, transpose-array, make-shared-array) but it was only used by array-contents, which needed to traverse the dimensions anyway. * libguile/arrays.c (scm_make_typed_array, scm_from_contiguous_typed_array): don't set the contiguous flag. (scm_transpose_array, scm_make_shared_array): don't call scm_i_ra_set_contp. (scm_array_contents): inline scm_i_ra_set_contp() here. Adopt uniform type check order. Remove redundant comments. (scm_i_ra_set_contp): remove. * libguile/arrays.h: note. * test-suite/tests/arrays.test: test array-contents with rank 0 array.
2016-07-11Remove scm_from_contiguous_arrayDaniel Llorens1-2/+0
This function is undocumented, unused within Guile, and can be trivially replaced by make-array + array-copy without requiring contiguity. * libguile/arrays.h (scm_from_contiguous_array): remove declaration. * libguile/arrays.c (scm_from_contiguous_array): remove.
2014-09-30Pack array dimensions in array objectDaniel Llorens1-11/+6
* 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.
2012-10-23Move array reader from arrays.c to read.cMark H Weaver1-2/+2
* 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'.
2012-01-09allocate a tc7 to arraysAndy Wingo1-6/+5
* 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.
2010-05-28Fix the visibility of a few of internal symbols.Ludovic Courtès1-1/+1
* 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.
2010-01-11allow compilation of #@2(1 2 3)Andy Wingo1-1/+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.
2010-01-07reimplement srfi-4 vectors on top of bytevectorsAndy Wingo1-6/+0
* 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.
2009-12-08fix erroneous SCM_CELL_* usage in arrays.[ch]Andy Wingo1-4/+4
* 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.
2009-07-19move generic array foo out to its own fileAndy Wingo1-20/+6
* 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.
2009-07-19remove enclosed arraysAndy Wingo1-6/+1
* 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.
2009-07-19rename unif.[ch] to arrays.[ch]Andy Wingo1-0/+110
* 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.