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

78 commits

Author SHA1 Message Date
Daniel Llorens
d09b201d59 Deprecate scm_array_fill_int()
* libguile/array-map.h, libgule/array-map.c: move scm_array_fill_int
  to the deprecated section.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2013-04-05 22:54:14 +02:00
Daniel Llorens
ab1ca17986 Remove double indirection in array-fill!
* libguile/array-map.c: new function rafill, like scm_array_fill_int,
  but factors GVSET out of the loop. Use it in scm_array_fill_x instead of
  scm_array_fill_int.
* test-suite/tests/arrays.test: add test for array-fill! with stride != 1.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2013-04-05 22:54:14 +02:00
Daniel Llorens
c3e3ef6eb6 Remove double indirection for 1st arg of array-for-each
* libguile/array-map.c: (rafe): factor GVREF out of rank-1 loop for ra0.
2013-04-03 21:46:27 +02:00
Daniel Llorens
51a1763f65 Remove double indirection in array-map! with <2 args
* libguile/array-map.c: (ramap): factor GVSET/GVREF out of rank-1 loop
  for ra0 and the first element of ras.
2013-04-03 21:46:27 +02:00
Daniel Llorens
9a68d7b388 Avoid per-element cons for 1-arg case of array-map!
* libguile/array-map.c: (ramap): special case when ras is a 1-element list.
2013-04-03 21:46:27 +02:00
Daniel Llorens
75a1b26c5d Deprecate dead code in array-map.c
* libguile/array-map.c, libguile/array-map.h: deprecate scm_ra_eqp,
  scm_ra_lessp, scm_ra_leqp, scm_ra_grp, scm_ra_greqp, scm_ra_sum,
  scm_ra_product, scm_ra_difference, scm_ra_divide, scm_array_identity.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2013-04-03 21:46:27 +02:00
Daniel Llorens
72e2b5923a Remove double indirection in element access in array-copy!
* libguile/array-map.c: (racp): factor scm_generalized_vector_ref,
  scm_generalized_vector_set_x out of the rank-1 loop.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2013-04-03 14:21:49 +02:00
Andy Wingo
0858753e82 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	libguile/gc-malloc.c
	libguile/ports.c
2012-02-08 11:48:08 +01:00
Bake Timmons
b7e64f8b26 Improve the usage of variable names in C docstrings.
* libguile/alist.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/bitvectors.c:
* libguile/filesys.c:
* libguile/foreign.c:
* libguile/generalized-arrays.c:
* libguile/hashtab.c:
* libguile/ioext.c:
* libguile/load.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/procprop.c:
* libguile/promises.c:
* libguile/simpos.c:
* libguile/socket.c:
* libguile/srfi-1.c:
* libguile/srfi-13.c:
* libguile/srfi-14.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Make the variable names in the C docstrings more
  consistent.  Replace a few instances of @var with @code when appropriate.
2012-02-02 12:22:10 +01:00
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
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
62fdadb0a5 check for pairs with scm_is_pair, not scm_nimp
* libguile/array-map.c (scm_ra_matchp, scm_ramapc):
* libguile/dynwind.c (scm_swap_bindings):
* libguile/hooks.c (hook_print, scm_c_run_hook, scm_c_run_hookn):
* libguile/objprop.c (scm_object_property, scm_set_object_property_x):
  Use !scm_is_pair as the termination condition, not scm_imp.
2011-10-24 17:22:47 +02:00
Ludovic Courtès
10b9343f04 Change `scm_ramapc' prototype to avoid empty declarators (bug #23681).
* libguile/array-map.h (scm_ramapc): Change `cproc' to `void *' instead
  of using empty declarators.

* libguile/array-map.c (scm_ramapc): Adjust accordingly.
2011-02-13 14:47:33 +01:00
Andy Wingo
a587d6a973 more fixes to equal? for arrays
* libguile/array-map.c (array_compare, scm_array_equal_p): Rewrite as
  something that operates on the generic array handle infrastructure.
  Based on array->list.
  (scm_i_array_equal_p): Change the docs, as array-equal? is now the same
  as equal?, except that it typechecks its args.

* doc/ref/api-compound.texi (Array Procedures): Update array-equal?
  docs.

* libguile/deprecated.h:
* libguile/deprecated.c (scm_raequal): Deprecate.

* libguile/bytevectors.c (scm_bytevector_eq_p): Bugfix: bytevectors are
  bytevector=? only if their element type is the same.

* libguile/eq.c (scm_equal_p): Only dispatch to scm_array_equal_p if
  both args are arrays (generically).

* test-suite/tests/arrays.test ("equal?"): Add some more tests.
2010-04-01 00:25:06 +02:00
Andy Wingo
3ffd1ba96e fix equal? between an array and a non-array
OK let's try again. While the thanks go to Daniel Llorens del Río for
the tip, the blame continues going to me :)

* test-suite/Makefile.am:
* test-suite/tests/arrays.test: Add a test.

* libguile/array-map.c (raeql): Handle a few 0-dimensional cases. If the
  shapes of the arrays don't match, just return #f instead of raising
  an error.
2010-03-31 00:05:01 +02:00
Andy Wingo
f1d19308ad provide missing prototypes
* libguile/array-map.c:
* libguile/chars.c:
* libguile/eq.c:
* libguile/strorder.c: Provide declarations missing after the asubrs/rpsubrs ->
  gsubr conversion.
2010-01-07 23:49:15 +01:00
Andy Wingo
e7efe8e793 decruftify scm_sys_protects
* libguile/root.h
* libguile/root.c (scm_sys_protects): It used to be that for some reason
  we'd define a special array of "protected" values. This was a little
  silly, always, but with the BDW GC it's completely unnecessary. Also
  many of these variables were unused, and none of them were good API.
  So remove this array, and either eliminate, make static, or make
  internal the various values.

* libguile/snarf.h: No need to generate calls to scm_permanent_object.

* guile-readline/readline.c (scm_init_readline): No need to call
  scm_permanent_object.

* libguile/array-map.c (ramap, rafe): Remove the dubious nullvect
  optimizations.

* libguile/async.c (scm_init_async): No need to init scm_asyncs, it is
  no more.

* libguile/eval.c (scm_init_eval): No need to init scm_listofnull, it is
  no more.

* libguile/gc.c: Make scm_protects a static var.
  (scm_storage_prehistory): Change the sanity check to use the address
  of protects.
  (scm_init_gc_protect_object): No need to clear the scm_sys_protects,
  as it is no more.

* libguile/keywords.c: Make the keyword obarray a static var.
* libguile/numbers.c: Make flo0 a static var.
* libguile/objprop.c: Make object_whash a static var.
* libguile/properties.c: Make properties_whash a static var.

* libguile/srcprop.h:
* libguile/srcprop.c: Make scm_source_whash a global with internal
  linkage.

* libguile/strings.h:
* libguile/strings.c: Make scm_nullstr a global with internal linkage.

* libguile/vectors.c (scm_init_vectors): No need to init scm_nullvect,
  it's unused.
2009-12-05 12:38:43 +01:00
Andy Wingo
8a1f4f98e1 remove rpsubrs
* libguile/tags.h: Remove rpsubrs (I chose to interpret the terse name
  as "recursive predicate subrs"). Just use gsubrs with rest arguments,
  or do a fold yourself.

* libguile/array-map.c (scm_i_array_equal_p): Do the comparison in
  order, why not.

* libguile/chars.c:
* libguile/eq.c:
* libguile/numbers.c:
* libguile/strorder.c: Add 0,2,1 gsubr wrappers for rpsubrs like eq?, <,
  etc.

* libguile/goops.c (scm_class_of)
* libguile/procprop.c (scm_i_procedure_arity)
* libguile/procs.c (scm_thunk_p)
* libguile/vm.c (apply_foreign): Remove rpsubr cases.

* test-suite/tests/numbers.test ("=", "<"): Turn a couple xfails into
  passes.
2009-12-04 13:05:00 +01:00
Andy Wingo
31d845b4bc remove asubrs
* libguile/tags.h (scm_tcs_subrs, scm_tc7_asubr): Remove definitions.

* libguile/goops.c (scm_class_of)
* libguile/procprop.c (scm_i_procedure_arity)
* libguile/procs.c (scm_thunk_p)
* libguile/vm.c (apply_foreign): Remove cases for asubrs.

* libguile/array-map.c: Gut all of the optimizations, because there are
  no more asubrs, soon won't be rpsubrs, and all of this should happen
  on the Scheme level, ideally.
2009-12-03 17:05:14 +01:00
Andy Wingo
b04ab0c624 remove scm_tc7_dsubr
* libguile/tags.h: Remove scm_tc7_dsubr. There are no more users of
  this.

* libguile/array-map.c:
* libguile/eval.c:
* libguile/eval.i.c:
* libguile/goops.c:
* libguile/procprop.c:
* libguile/procs.h: Remove all dsubr cases.
2009-12-03 15:33:09 +01:00
Andy Wingo
df338a2264 remove tc7_subr_* and tc7_lsubr_*
* libguile/tags.h: Remove tc7 #defines for subrs, replacing them with
  placeholders. These were public, but hopfully unused. I don't see how
  to usefully deprecate them.

* libguile/array-map.c (scm_array_map_x): Remove special cases for
  certain subr types. This might make things slower for the moment,
  otoh, native compilation should moot that question.

* libguile/eval.i.c:
* libguile/eval.c: Remove subr-handling cases. To regain this speed and
  more won't have to wait for native compilation, though -- this change
  smooths the way for subr dispatch in the VM.

* libguile/gsubr.c (scm_i_gsubr_apply): Fix a bug in which we didn't
  detect too-many-arguments. This would only show up when using ceval,
  as only ceval called this function.

* test-suite/tests/ramap.test ("array-map!"): Change the expected
  exception if passed a procedure of the wrong arity. It now gives
  wrong-num-args.
  more won't have to wait for native compilation, though -- this change
  smooths the way for subr dispatch in the VM.

* libguile/goops.c (scm_class_of): Remove subr cases. No speed
  implication.

* libguile/objects.c (scm_valid_object_procedure_p): Remove this public
  but undocumented, and useless, function. I do not think this will
  affect anyone at all.
  (scm_set_object_procedure_x): Replace a call to
  scm_valid_object_procedure_p with scm_procedure_p, and actually wrap
  with a scm_is_true.

* module/oop/goops.scm (initialize-object-procedure): Don't call
  valid-object-procedure?.
2009-12-03 15:22:07 +01:00
Ludovic Courtès
d66b74dce7 Avoid unneeded `scm_dynwind_free ()'.
* libguile/array-map.c (indices_gc_hint): New variable.
  (scm_ramapc, scm_array_index_map_x): Avoid `scm_dynwind_free ()' using
  `scm_gc_malloc_pointerless ()'.
2009-09-09 19:27:42 +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
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
Andy Wingo
cf39614240 bitvector exodus from unif.[ch]
* libguile/Makefile.am:
* libguile/unif.c:
* libguile/unif.h:
* libguile/bitvectors.c:
* libguile/bitvectors.h: Move bitvector functionality out of unif.[ch].

* libguile/array-handle.c:
* libguile/array-map.c:
* libguile/init.c:
* libguile/read.c:
* libguile/srfi-4.c:
* libguile/vectors.c: Oh, what a tangled web we weave...
2009-07-19 14:53:03 +02:00
Andy Wingo
5d1b3b2db9 rename ramap.[ch] to array-map.[ch]
* libguile/array-map.c:
* libguile/array-map.h: Rename from ramap.c and ramap.h.

* libguile.h:
* libguile/Makefile.am:
* libguile/eq.c:
* libguile/init.c:
* libguile/sort.c:
* libguile/unif.c:
* libguile/vectors.c: All referrers changed.
2009-07-19 14:53:03 +02:00
Renamed from libguile/ramap.c (Browse further)