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

25 commits

Author SHA1 Message Date
Andy Wingo
91ee7515da Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/__scm.h
	libguile/array-map.c
	libguile/procprop.c
	libguile/tags.h
	module/ice-9/deprecated.scm
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	test-suite/standalone/test-num2integral.c
	test-suite/tests/regexp.test
2012-01-10 00:41:42 +01:00
Ludovic Courtès
67543d0761 Fix incorrect use of `SCM_UNPACK'.
* libguile/arrays.c (scm_i_make_array): Cast the result of
  `scm_gc_malloc' directly to `scm_t_bits'.
2012-01-09 22:16:49 +01:00
Andy Wingo
b2637c985c 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.
2012-01-09 17:50:56 +01:00
Andy Wingo
0607ebbfcf locking for putc, puts
* libguile/ports.c (scm_putc, scm_puts):
* libguile/ports.h (scm_putc_unlocked, scm_puts_unlocked): Separate into
  _unlocked and locked variants.  Change all callers to use the
  _unlocked versions.
2011-11-08 00:55:05 +01:00
Andy Wingo
c932ce0b55 locking on unget_byte, ungetc, ungets
* libguile/ports.h:
* libguile/ports.c (scm_unget_byte_unlocked, scm_unget_byte)
  (scm_ungetc_unlocked, scm_ungetc, scm_ungets_unlocked, scm_ungets):
  Add locking and _unlocked variants.

* libguile/arrays.c:
* libguile/rdelim.c:
* libguile/read.c:
* libguile/vports.c: Adapt callers to use the _unlocked variants.
2011-11-08 00:54:58 +01:00
Andy Wingo
be632904ca locking on scm_c_read, scm_getc
* libguile/ports.c (scm_c_read_unlocked, scm_c_read, scm_getc_unlocked)
  (scm_getc): Split getc and read operations into locked and unlocked
  variants.  Change most uses to use the _unlocked version.
2011-11-08 00:54:58 +01:00
Andy Wingo
8c5bb72920 add SCM_HEAP_OBJECT_P
* libguile/tags.h (SCM_HEAP_OBJECT_P): New macro, an alias for
  SCM_NIMP.

* libguile/arrays.c:
* libguile/debug.c:
* libguile/foreign.c:
* libguile/gdbint.c:
* libguile/guardians.c:
* libguile/list.c:
* libguile/modules.c:
* libguile/options.c:
* libguile/smob.c:
* libguile/validate.h:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Use it instead of SCM_NIMP or !SCM_IMP.
2011-10-24 18:55:43 +02:00
Andy Wingo
eff3dd99f7 fix write beyond array end in arrays.c
* libguile/arrays.c (scm_i_read_array): Fix write past end of array
  while reading array type tag.  Fix non-ascii type tag elements.
  Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685.
2011-07-28 19:04:38 +02:00
Andy Wingo
03976fee3b fix code that causes warnings on gcc 4.6
* libguile/arrays.c (scm_i_read_array):
* libguile/backtrace.c (display_backtrace_body):
* libguile/filesys.c (scm_readdir)
* libguile/i18n.c (chr_to_case):
* libguile/ports.c (register_finalizer_for_port):
* libguile/posix.c (scm_nice):
* libguile/stacks.c (scm_make_stack): Clean up a number of
  set-but-unused vars.  Thanks to Douglas Mencken for the report.

* libguile/numbers.c (scm_log, scm_exp): Fix a few #if cases that should
  be #ifdef.
2011-03-17 12:39:53 +01:00
Andy Wingo
73788ca8be 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.
2010-01-11 21:47: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
c395cb7813 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.
2009-12-08 23:13:07 +01:00
Andy Wingo
b0fae4ecaa bitvector tweaks
* libguile/arrays.c (scm_from_contiguous_typed_array):
* libguile/bytevectors.c (scm_uniform_array_to_bytevector): Error if the
  uniform element size is more than 8 bits, but not divisible by 8 --
  because our math could overflow in that case.

* module/ice-9/deprecated.scm (#\y): Indeed, #* is the valid bitvector
  syntax :)
2009-10-16 11:59:30 +02:00
Ludovic Courtès
cd48c32cf4 Fix compilation of literal bitvectors.
* libguile/arrays.c (scm_from_contiguous_typed_array): Fix BYTE_LEN
  sanity check for bitvectors.

* test-suite/tests/unif.test ("syntax")["bitvector is self-evaluating"]:
  New test.

* module/ice-9/deprecated.scm (#\y): Fix deprecation comment: `#*' is
  not a read syntax.
2009-10-15 23:29:50 +02:00
Ludovic Courtès
8cf0dd6104 Remove unneeded SMOB/port mark/free procedures.
* libguile/arrays.c (array_mark, array_free): Remove.
  (scm_init_arrays): Adjust accordingly.

* libguile/bitvectors.c (bitvector_free): Remove.
  (scm_c_make_bitvector): Use `scm_gc_malloc_pointerless ()'.
  (scm_init_bitvectors): Adjust accordingly.

* libguile/strports.c (scm_make_stptob): Remove `scm_set_port_mark ()'
  call.

* libguile/vports.c (scm_make_sfptob): Likewise.
2009-09-28 23:32:34 +02:00
Andy Wingo
f5a51caec1 fix bitvectors after the array handle refactoring
* libguile/uniform.h (scm_array_handle_uniform_element_bit_size): New
  public accessor.

* libguile/uniform.c (scm_array_handle_uniform_element_size): Better
  errors in non-byte-aligned arrays.
  (scm_uniform_vector_element_type, scm_uniform_vector_element_size)
  (scm_c_uniform_vector_ref, scm_c_uniform_vector_set_x):
  (scm_uniform_vector_to_list): Don't require byte-aligned access.

* libguile/bytevectors.c (scm_uniform_array_to_bytevector):
* libguile/arrays.c (scm_from_contiguous_typed_array):  Fix for
  uniform arrays whose element size is not a multiple of the byte size.
2009-09-18 16:27:32 +02:00
Andy Wingo
943a0a8759 make-typed-array builds backing vector via make-generalized-vector
* libguile/arrays.c: Rework to use scm_make_generalized_vector instead
  of our own type table.

* libguile/bitvectors.c: Fix some includes.
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
1030b45049 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.
2009-07-19 15:15:44 +02:00
Andy Wingo
66b9d7d304 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.
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
Renamed from libguile/unif.c (Browse further)