| Commit message (Expand) | Author | Age | Files | Lines |
* | Reuse SCM_BYTEVECTOR_TYPED_LENGTH in scm_array_get_handle...* libguile/bytevectors.h (SCM_BYTEVECTOR_TYPE_SIZE,
SCM_BYTEVECTOR_TYPED_LENGTH): Moved from libguile/bytevectors.c.
* libguile/array-handle.c (scm_array_get_handle): Reuse
SCM_BYTEVECTOR_TYPED_LENGTH.
| Daniel Llorens | 2016-11-23 | 1 | -0/+5 |
* | refactor tc7 and tc16 checks...* libguile/tags.h (SCM_HAS_TYP7, SCM_HAS_TYP7S, SCM_HAS_TYP16): New
macros.
* libguile/bytevectors.h (SCM_BYTEVECTOR_P):
* libguile/control.h (SCM_PROMPT_P):
* libguile/filesys.h (SCM_DIRP):
* libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_FLUID_P)
(SCM_I_DYNAMIC_STATE_P):
* libguile/foreign.h (SCM_POINTER_P):
* libguile/fports.h (SCM_FPORTP):
* libguile/frames.h (SCM_VM_FRAME_P):
* libguile/hashtab.h (SCM_HASHTABLE_P):
* libguile/inline.h (scm_get_byte_or_eof):
* libguile/numbers.h (SCM_REALP, SCM_BIGP, SCM_COMPLEXP, SCM_FRACTIONP):
* libguile/objcodes.h (SCM_OBJCODE_P):
* libguile/ports.h (SCM_OUTPUT_PORT_P):
* libguile/programs.h (SCM_PROGRAM_P):
* libguile/smob.h (SCM_SMOB_PREDICATE):
* libguile/srfi-14.h (SCM_CHARSETP):
* libguile/strings.c (IS_STRING):
* libguile/strports.h (SCM_STRPORTP):
* libguile/symbols.h (scm_is_symbol):
* libguile/variable.h (SCM_VARIABLEP):
* libguile/vectors.h (SCM_I_IS_VECTOR, SCM_I_IS_NONWEAK_VECTOR):
* libguile/vm-i-system.c (call, tail-call, mv-call)
* libguile/vm.h (SCM_VM_P, SCM_VM_CONT_P):
* libguile/weak-set.c (SCM_WEAK_SET_P):
* libguile/weak-table.c (SCM_WEAK_TABLE_P):
* libguile/weak-vector.h (SCM_I_WVECTP): Use them.
| Andy Wingo | 2011-10-24 | 1 | -1/+1 |
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts:
libguile/bytevectors.c
libguile/bytevectors.h
libguile/objcodes.c
libguile/r6rs-ports.c
libguile/strings.c
libguile/vm.c
| Andy Wingo | 2011-08-31 | 1 | -1/+1 |
|\ |
|
| * | fix a couple of leaks...* libguile/bytevectors.h:
* libguile/bytevectors.c (scm_c_take_gc_bytevector): Rename this
internal function, from scm_c_take_bytevector. This indicates that
unlike the other scm_take_* functions, this one takes GC-managed
memory.
* libguile/objcodes.c (scm_objcode_to_bytecode):
* libguile/vm.c (really_make_boot_program): Use
scm_gc_malloc_pointerless, not scm_malloc. Thanks to Stefan
Israelsson Tampe!
* libguile/r6rs-ports.c:
* libguile/strings.c: Adapt to renames.
| Andy Wingo | 2011-08-18 | 1 | -2/+2 |
* | | bytevectors have internal parent field...* libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): Bump, giving
bytevectors another word: a parent pointer. Will allow for
sub-bytevectors and efficient mmap bindings.
* libguile/bytevectors.c (make_bytevector):
(make_bytevector_from_buffer): Init parent to #f.
(scm_c_take_bytevector, scm_c_take_typed_bytevector): Another
argument, the parent, which gets set in the bytevector.
* libguile/foreign.c (scm_pointer_to_bytevector): Use the parent field
instead of registering a weak reference from bytevector to foreign
pointer.
* libguile/objcodes.c (scm_objcode_to_bytecode): Use the parent field to
avoid copying the objcode.
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS):
* libguile/strings.c (scm_from_stringn):
* libguile/vm.c (really_make_boot_program):
* libguile/r6rs-ports.c (scm_get_bytevector_some)
(scm_get_bytevector_all, bytevector_output_port_procedure): Set the
parent to #f.
| Andy Wingo | 2011-05-07 | 1 | -4/+6 |
|/ |
|
* | Revert "Remove unused internal bytevector functions."...This reverts commit c4daa519107798d06ae96d2f69dc211fc57cc8a3.
| Andy Wingo | 2010-01-07 | 1 | -0/+4 |
* | Re-add an indirection in bytevectors....The intent is to allow for mmap(3) bindings and to actually reuse
user-provided buffers in `scm_c_take_bytevector ()'.
* libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): Increment.
(SCM_BYTEVECTOR_CONTENTS): Take the pointer from the second word.
(SCM_BYTEVECTOR_CONTIGUOUS_P): New macro.
(SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust to live alongside the CONTIGUOUS
flag.
* libguile/bytevectors.c (SCM_BYTEVECTOR_SET_CONTENTS,
SCM_BYTEVECTOR_SET_CONTIGUOUS_P): New macros.
(SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust.
(SCM_BYTEVECTOR_TYPED_LENGTH): Properly parenthesize.
(make_bytevector): Adjust to new bytevector header.
(make_bytevector_from_buffer): Reuse CONTENTS.
(scm_c_shrink_bytevector): Differentiate between contiguous and
non-contiguous bytevectors.
| Ludovic Courtès | 2009-11-16 | 1 | -7/+8 |
* | Remove unused internal bytevector functions....* libguile/bytevectors.c (scm_i_make_typed_bytevector,
scm_c_take_typed_bytevector): Remove.
* libguile/bytevectors.h: Adjust accordingly.
| Ludovic Courtès | 2009-11-16 | 1 | -4/+0 |
* | Remove the distinction between inline/outline storage for bytevectors....* libguile/bytevectors.c (SCM_BYTEVECTOR_INLINE_THRESHOLD,
SCM_BYTEVECTOR_INLINEABLE_SIZE_P, SCM_BYTEVECTOR_SET_CONTENTS,
SCM_BYTEVECTOR_SET_INLINE): Remove.
(SCM_BYTEVECTOR_HEADER_BYTES): New macro.
(SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust to new flag layout.
(make_bytevector): Remove content inlining machinery; use
`scm_gc_malloc_pointerless ()' in all cases; special-case zero-sized
vu8 buffers.
(make_bytevector_from_buffer): Simplified.
(scm_c_shrink_bytevector): New, formerly `scm_i_shrink_bytevector ()'.
Remove buffer inlining machinery.
(scm_bootstrap_bytevectors): Use `make_bytevector ()' for
SCM_NULL_BYTEVECTOR.
* libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): New macro.
(SCM_BYTEVECTOR_CONTENTS): Adjust to new layout.
(SCM_SET_BYTEVECTOR_FLAGS): Properly cast F.
(SCM_F_BYTEVECTOR_INLINE, SCM_BYTEVECTOR_INLINE_P): Remove.
(SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust.
(scm_c_shrink_bytevector): Remove macro, make a C function
declaration.
| Ludovic Courtès | 2009-08-31 | 1 | -17/+12 |
* | Use a TC7 tag instead of a SMOB for bytevectors....* libguile/bytevectors.c (scm_tc16_bytevector): Remove.
(SCM_BYTEVECTOR_SET_LENGTH, SCM_BYTEVECTOR_SET_CONTENTS,
SCM_BYTEVECTOR_SET_INLINE, SCM_BYTEVECTOR_SET_ELEMENT_TYPE,
make_bytevector_from_buffer, scm_is_bytevector,
scm_bootstrap_bytevectors): Adjust to the SMOB->tc7 change.
(scm_i_print_bytevector): New, formerly `print_bytevector ()'.
(bytevector_equal_p): Remove.
* libguile/bytevectors.h (SCM_BYTEVECTOR_LENGTH,
SCM_BYTEVECTOR_CONTENTS, SCM_BYTEVECTOR_P): Adjust to SMOB->tc7
change.
(SCM_BYTEVECTOR_FLAGS, SCM_SET_BYTEVECTOR_FLAGS): New macros.
(scm_tc16_bytevector): Remove declaration.
(scm_i_print_bytevector): New declaration.
* libguile/eq.c (scm_equal_p): Handle `scm_tc7_bytevector'.
* libguile/evalext.c (scm_self_evaluating_p): Likewise.
* libguile/print.c (iprin1): Likewise.
* libguile/tags.h (scm_tc7_bytevector): New.
(scm_tc7_unused_8): Remove.
* libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): Adjust.
* test-suite/tests/bytevectors.test ("Datum
Syntax")["self-evaluating?"]: New test.
| Ludovic Courtès | 2009-08-30 | 1 | -13/+16 |
* | bytevectors have "element type" field, e.g. for generalized-vector-ref...Bytevectors have a very close relationship to other forms of uniform
vectors. Often you want to view a u64vector as a series of bytes, for
writing over a socket; or to process an incoming stream using the
convenient and less error-prone s16vector-ref API rather than
bytevector-s16-native-ref.
The essential needs of the representation of a bytevector and an
s64vector are the same, so we take advantage of that and extend the
bytevector implementation to have a "native type" field, which defaults
to VU8.
This commit doesn't actually expose any user-noticeable changes,
however.
* libguile/bytevectors.h (SCM_BYTEVECTOR_ELEMENT_TYPE): New internal
defines.
(scm_i_make_typed_bytevector, scm_c_take_typed_bytevector): New
internal functions.
* libguile/bytevectors.c (SCM_BYTEVECTOR_SET_ELEMENT_TYPE):
(SCM_BYTEVECTOR_TYPE_SIZE):
(SCM_BYTEVECTOR_TYPED_LENGTH): New internal macros.
(make_bytevector, make_bytevector_from_buffer): Take an extra
argument, the element type. The length argument is interpreted as
being the number of elements, which corresponds to the number of bytes
in the default VU8 case. Doing it this way eliminates a class of bugs
-- e.g. a u32vector of length 3 bytes doesn't make sense. We do have
to check for another class of bugs: overflow. The length stored on the
bytevector itself is still the byte length, though.
(scm_i_make_typed_bytevector):
(scm_c_take_typed_bytevector): New internal functions.
(scm_i_shrink_bytevector): Make sure the new size is valid for the
bytevector's type.
(scm_i_bytevector_generalized_set_x): Remove this function, the
array-handle infrastructure takes care of this for us.
(print_bytevector): Print the bytevector according to its type.
(scm_make_bytevector, scm_bytevector_copy)
(scm_uniform_array_to_bytevector)
(scm_u8_list_to_bytevector, scm_bytevector_to_uint_list): Adapt to
make_bytevector extra arg.
(bv_handle_ref, bv_handle_set_x): Adapt to ref and set based on the
type of the bytevector, e.g. f64 or u8.
(bytevector_get_handle): Set the typed length of the vector, not the
byte length.
Conflicts:
libguile/bytevectors.c
| Andy Wingo | 2009-07-19 | 1 | -0/+6 |
* | bytevector inlinedness indicated by flag, not length...* libguile/bytevectors.h (SCM_BYTEVECTOR_INLINE_P): Change to check a
flag instead of checking the length of the bytevector.
* libguile/bytevectors.c (make_bytevector_from_buffer): Handle the len
<= inline threshold case as well. Set the inline flag as appropriate.
(make_bytevector): Updat the inline flag as appropriate.
(scm_c_take_bytevector): Just dispatch to make_bytevector_from_buffer.
(scm_i_shrink_bytevector): Update the inline flag as appropriate.
Update the length when shrinking an already-inlined vector.
(STRING_TO_UTF): Fix some indentation.
| Andy Wingo | 2009-07-19 | 1 | -6/+4 |
* | bytevectors provide scm_i_native_endianness to the vm...* libguile/bytevectors.h (scm_i_native_endianness): Allow the VM to use
scm_i_native_endianness, but still keep it marked as internal.
* libguile/bytevectors.c: Adjust to use scm_i_native_endianness instead
of native_endianness. Define it at bootstrap time.
| Andy Wingo | 2009-06-26 | 1 | -0/+3 |
* | Always create the bytevector SMOB type....* libguile/bytevectors.c (scm_tc16_bytevector, print_bytevector,
bytevector_equal_p, free_bytevector): Don't use the snarfing macros.
(scm_bootstrap_bytevectors): New.
(scm_init_bytevectors): No longer initialize SCM_NULL_BYTEVECTOR,
which is done by `scm_bootstrap_bytevectors ()'.
* libguile/bytevectors.h (scm_bootstrap_bytevectors): New declaration.
(scm_init_bytevectors): Made internal. This can be done because we
explicitly register it with `scm_c_register_extension ()' in
`scm_bootstrap_bytevectors ()'.
* libguile/init.c (scm_i_init_guile): Call `scm_bootstrap_bytevectors ()'.
This is so that expressions like "(generalized-vector-length #vu8())"
work even when `(rnrs bytevector)' hasn't been loaded.
| Ludovic Courtès | 2009-06-22 | 1 | -1/+2 |
* | 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.
| Ludovic Courtès | 2009-06-22 | 1 | -0/+1 |
* | bytevectors: Add a C-friendly API....* doc/ref/api-data.texi (Bytevector Manipulation): Add
`scm_is_bytevector ()', `scm_c_bytevector_length ()',
`scm_c_bytevector_length ()', and `scm_c_bytevector_set_x ()'.
* libguile/bytevectors.c (scm_is_bytevector, scm_c_bytevector_length,
scm_c_bytevector_ref, scm_c_bytevector_set_x): New functions.
(scm_bytevector_p): Use `scm_is_bytevector ()'.
(scm_bytevector_length): Use `scm_c_bytevector_length ()'.
* libguile/bytevectors.h (scm_is_bytevector, scm_c_bytevector_length,
scm_c_bytevector_ref, scm_c_bytevector_set_x): New declarations.
| Ludovic Courtès | 2009-06-22 | 1 | -1/+6 |
* | bytevectors: Use `size_t' rather than `unsigned' for sizes....* doc/ref/api-data.texi (Bytevector Manipulation): Update.
* libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE,
make_bytevector_from_buffer, scm_c_make_bytevector,
scm_c_take_bytevector, scm_i_shrink_bytevector): Use `size_t' for
bytevector lengths.
| Ludovic Courtès | 2009-06-22 | 1 | -4/+4 |
* | 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/*
)
| Neil Jerram | 2009-06-17 | 1 | -6/+7 |
* | add ability to compile uniform arrays...* module/rnrs/bytevector.scm (rnrs):
* libguile/bytevectors.h:
* libguile/bytevectors.c (scm_uniform_array_to_bytevector): New function.
* libguile/unif.h:
* libguile/unif.c (scm_from_contiguous_typed_array): New function.
* libguile/vm-i-loader.c (load-array): New instruction, for loading byte
data into uniform vectors. Currently it copies out the data, though in
the future we could avoid that.
* module/language/assembly.scm (align-code): New exported function,
aligns code on some boundary.
(align-program): Use align-code.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Support
the load-array instruction.
* module/language/glil/compile-assembly.scm (dump-object): Dump uniform
arrays. Neat :)
| Andy Wingo | 2009-06-05 | 1 | -0/+2 |
* | Import R6RS bytevectors and I/O ports from Guile-R6RS-Libs 0.2....* README: Document dependency on GNU libunistring.
* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
`benchmark/bytevectors.bm'.
* configure.in: Make sure we have libunistring; update $LIBS.
* libguile.h: Include "bytevectors.h" and "r6rs-ports.h".
* libguile/Makefile.am (libguile_la_SOURCES): Add `bytevectors.c' and
`r6rs-ports.c'
(DOT_X_FILES): Add `bytevectors.x' and `r6rs-ports.x'.
(DOT_DOC_FILES): Add `bytevectors.doc' and `r6rs-ports.doc'.
(noinst_HEADERS): Add `ieee-754.h'.
(modinclude_HEADERS): Add `bytevectors.h' and `r6rs-ports.h'
* libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): New macro.
* module/Makefile.am (SOURCES): Add $(RNRS_SOURCES).
(RNRS_SOURCES): New variable.
* test-suite/Makefile.am (SCM_TESTS): Add `bytevectors.test' and
`r6rs-ports.test'.
| Ludovic Courtès | 2009-05-28 | 1 | -0/+133 |