summaryrefslogtreecommitdiff
path: root/libguile/srfi-4.h
Commit message (Collapse)AuthorAgeFilesLines
* New function srfi-4-vector-type-size in (srfi srfi-4 gnu)Daniel Llorens2021-12-061-0/+2
| | | | | | | | | | | | | | This patch removes the undocumented function make-srfi-4-vector from (guile). That function is still exported from (srfi srfi-4 gnu). * libguile/srfi-4.h (scm_init_srfi_4): Split into scm_bootstrap_srfi_4() and scm_init_srfi_4(), after the pattern of scm_init_bytevectors() and scm_bootstrap_bytevectors(). * libguile/init.c: Replace scm_init_srfi_4() call by scm_bootstrap_srfi_4(). * module/srfi/srfi-4.scm: Load newly defined srfi-4 extension. This provides undocumented make-srfi-4-vector. * module/srfi/srfi-4/gnu.scm: Export srfi-4-vector-type-size. * doc/ref/srfi-modules.texi: Document srfi-4-vector-type-size.
* Refactor srfi-4 declarationsDaniel Llorens2021-08-171-246/+31
|
* Replace uses of scm_t_int8, scm_t_uintmax, etc with stdint typesAndy Wingo2018-06-211-40/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/bitvectors.c: * libguile/bitvectors.h: * libguile/bytevectors.c: * libguile/bytevectors.h: * libguile/chars.c: * libguile/continuations.c: * libguile/control.c: * libguile/conv-integer.i.c: * libguile/conv-uinteger.i.c: * libguile/dynstack.c: * libguile/dynstack.h: * libguile/foreign.c: * libguile/frames.c: * libguile/frames.h: * libguile/gc-inline.h: * libguile/gc.h: * libguile/gsubr.c: * libguile/gsubr.h: * libguile/hash.c: * libguile/i18n.c: * libguile/instructions.c: * libguile/intrinsics.c: * libguile/intrinsics.h: * libguile/loader.c: * libguile/loader.h: * libguile/numbers.c: * libguile/numbers.h: * libguile/pairs.c: * libguile/ports-internal.h: * libguile/ports.c: * libguile/ports.h: * libguile/posix.c: * libguile/print.c: * libguile/print.h: * libguile/programs.c: * libguile/programs.h: * libguile/r6rs-ports.c: * libguile/random.c: * libguile/random.h: * libguile/scm.h: * libguile/socket.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/struct.h: * libguile/symbols.c: * libguile/threads.c: * libguile/threads.h: * libguile/uniform.c: * libguile/vm-engine.c: * libguile/vm.c: * libguile/vm.h: * libguile/vports.c: * test-suite/standalone/test-conversion.c: * test-suite/standalone/test-ffi-lib.c: * test-suite/standalone/test-scm-take-u8vector.c: * test-suite/standalone/test-srfi-4.c: Replace e.g. scm_t_uint8 with uint8_t.
* Update license notices in all C filesAndy Wingo2018-06-201-19/+19
| | | | | Update to newest recommended license notices from the FSF. Everything stays LGPLv3+ except guile-readline which is GPLv3+.
* libguile header files have uniform format for copyright declarationsAndy Wingo2018-06-201-1/+2
|
* Remove (C) from copyright statementsAndy Wingo2018-06-201-1/+1
| | | | | | As the FSF advises, 'There is no legal significance to using the three-character sequence “(C)”, but it does no harm.' It does take up space though! For that reason, we remove it here from our C files.
* Rename __scm.h to scm.hAndy Wingo2018-06-201-1/+0
| | | | * libguile/scm.h: Rename. Update all includers.
* Move array-handle.h include out from inline.hAndy Wingo2018-06-191-1/+2
| | | | | | | * libguile/inline.h: Remove array-handle.h include. * libguile/srfi-4.h: * libguile/uniform.h: * libguile/vectors.h: Add array-handle.h includes.
* Remove array impl. registry; instead, hard-code array handle creationAndy Wingo2014-02-091-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* vref, vset members of scm_t_array_handleAndy Wingo2014-02-081-3/+3
| | | | | | | | | | * libguile/array-handle.h (scm_t_array_ref, scm_t_array_set): Rename from scm_i_t_array_ref, scm_i_t_array_set. (scm_t_array_handle): Copy vref and vset from impl to handle. (scm_array_handle_ref, scm_array_handle_set): * libguile/array-map.c (racp, ramap, rafe, rafill, array_index_map_1): * libguile/array-handle.c (scm_array_get_handle): Adapt.
* remove all deprecated codeAndy Wingo2011-05-121-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/async.c: * libguile/async.h: * libguile/debug.h: * libguile/deprecated.c: * libguile/deprecated.h: * libguile/evalext.h: * libguile/gc-malloc.c: * libguile/gc.h: * libguile/gen-scmconfig.c: * libguile/numbers.c: * libguile/ports.c: * libguile/ports.h: * libguile/procprop.c: * libguile/procprop.h: * libguile/read.c: * libguile/socket.c: * libguile/srfi-4.h: * libguile/strings.c: * libguile/strings.h: * libguile/tags.h: * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm: Remove all deprecated code. CPP defines that were not previously issuing warnings were changed so that their expansions would indicate the replacement forms to use, e.g. scm_sizet__GONE__REPLACE_WITH__size_t. The two exceptions were SCM_LISTN, which did not produce warnings before, and the string-filter argument order stuff. Drops the initial dirty memory usage of Guile down to 2.8 MB on my machine, from 4.4 MB.
* remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64Andy Wingo2010-07-261-5/+1
| | | | | | | | | | | | * 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.
* reimplement srfi-4 vectors on top of bytevectorsAndy Wingo2010-01-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Use `SCM_DEPRECATED' in declarations of deprecated functions/variables.Ludovic Courtès2009-10-021-1/+1
| | | | | | | | | | | | | | * libguile/deprecated.c (SCM_BUILDING_DEPRECATED_CODE): New macro. * libguile/async.c (SCM_BUILDING_DEPRECATED_CODE): Likewise. * libguile/macros.c (SCM_BUILDING_DEPRECATED_CODE): Likewise. * libguile/async.h, libguile/deprecated.h, libguile/eval.h, libguile/gc.h, libguile/gc.h, libguile/macros.h, libguile/ports.h, libguile/srfi-4.h, libguile/strings.h: Change declarations of deprecated functions and variables to use `SCM_DEPRECATED' instead of `SCM_API'.
* uniform vector functions to their own fileAndy Wingo2009-07-191-30/+1
| | | | | | | | | | | | | * 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.
* rename unif.[ch] to arrays.[ch]Andy Wingo2009-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Change Guile license to LGPLv3+Neil Jerram2009-06-171-6/+7
| | | | | | | | | | (Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
* Add `SCM_INTERNAL' macro, use it.Ludovic Courtès2008-05-311-6/+6
|
* merge from 1.8 branchKevin Ryde2006-04-171-1/+1
|
* (take_uvec): Make BASE pointer non-const.Marius Vollmer2005-12-061-12/+12
| | | | (scm_take_u8vector, etc): Likewise. Thanks to Ludovic Courtès!
* The FSF has a new address.Marius Vollmer2005-05-231-1/+1
|
* (scm_take_u64vector,Marius Vollmer2005-01-141-2/+8
| | | | | | | | | | | | | | | | | | | | | 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.
* * srfi-4.h, srfi-4.c, srfi-4.i.c (scm_i_uniform_vector_ref_proc,Marius Vollmer2005-01-091-0/+2
| | | | | | | | | 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.
* (scm_uniform_element_size): Deprecated for real.Marius Vollmer2005-01-071-1/+8
|
* (scm_c_uniform_vector_element_size,Marius Vollmer2005-01-061-2/+1
| | | | | scm_c_uniform_vector_size): Removed. (scm_array_handle_uniform_element_size): New.
* * weaks.c: Use new vector elements API or simple vectorMarius Vollmer2005-01-021-32/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * srfi-4.h (scm_i_proc_make_u8vector, scm_i_proc_make_s8vector,Marius Vollmer2004-12-291-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* (scm_uniform_vector_elements,Marius Vollmer2004-12-271-15/+30
| | | | | | | | | | | | | | | 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.
* Do not include <libguile.h>, include theMarius Vollmer2004-11-101-0/+4
| | | | | | needed files directly. Include config.h, <unistd.h> and <io.h> when available. (scm_uniform_vector_read_x, scm_uniform_vector_write): New.
* (scm_c_uniform_vector_ref, scm_c_uniform_vector_set_x): New.Marius Vollmer2004-11-091-1/+4
| | | | | | | | | | | (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.
* * srfi-4.h, srfi-4.c (scm_frame_uniform_vector_release): New.Marius Vollmer2004-11-021-0/+1
| | | | | * unif.c (scm_bit_set_star_x, scm_bit_count_star_x): Use it to get more efficient access to the u32vector.
* (coerce_to_uvec, scm_any_to_u8vector, etc): New.Marius Vollmer2004-11-021-0/+12
| | | | | (scm_uniform_element_size, scm_uniform_vector_length): Do no longer handle old-style uniform vectors.
* (scm_i_read_homogenous_vector,Marius Vollmer2004-10-291-2/+36
| | | | | | | | | | scm_i_uniform_vector_prototype): Removed. (scm_i_uniform_vector_creator): New. (SCM_UVEC_C32, scm_c32vector, scm_make_c32vector, etc, SCM_UVEC_C64, scm_c64vector, scm_make_c64vector, etc): New. Updated all tables and generic functions to support them. (scm_i_proc_make_u8vector, scm_i_proc_make_s8vector, etc): New. (scm_init_srfi_4): Initialize them.
* * srfi-4.c (take_uvec): New.Marius Vollmer2004-10-271-0/+10
| | | | | (alloc_uvec): Use it. * srfi-4.h, srfi-4.i.c (scm_take_u8vector, etc): New.
* * srfi-4.h, srfi-4.i.c (scm_u8vector_elements, etc): New.Marius Vollmer2004-10-271-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * srfi-4.h, srfi-4.c (scm_uniform_vector_p, scm_uniform_vector_ref, scm_uniform_vector_set_x, scm_uniform_vector_to_list, scm_is_uniform_vector, scm_c_uniform_vector_lengths, scm_c_uniform_vector_size, scm_uniform_vector_elements, scm_uniform_vector_element_size, scm_uniform_vector_release): New. (scm_i_uniform_vector_prototype, scm_i_uniform_vector_tag): New. (scm_uniform_element_size, scm_uniform_vector_length): Moved here from unif.h, unif.c and extended to handle both the old and new uniform vectors. * unif.h, unif.c (scm_uniform_vector_ref, scm_array_ref): Renamed the former to the latter. (scm_uniform_vector_length, scm_uniform_element_size): Moved to srfi-4.h, srfi-4.c. (scm_make_uve): Call scm_make_s8vector for #\nul prototype. (scm_array_p, scm_array_rank, scm_array_dimensions, scm_transpose_array, scm_enclose_array, scm_array_ref, scm_cvref, scm_array_set_x, scm_array_contents, scm_uniform_array_read_x, scm_array_to_list, scm_array_prototype): Handle srfi-4 uniform vectors. Removed code for scm_tc7_byvect. (scm_dimensions_to_uniform_array): Fill array with 0 when prototype is #\nul. (scm_i_print_array_dimension, scm_i_legacy_tag, scm_i_print_array): New. (scm_raprin1): Call scm_i_print_array for arrays. Removed code for scm_tc7_byvect.
* New files, initially from ../srfi/ but heavily modified.Marius Vollmer2004-10-261-0/+119