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

497 commits

Author SHA1 Message Date
Mark H Weaver
41df63cf16 Optimize scm_exact_p by making use of SCM_INEXACTP
* libguile/numbers.c (scm_exact_p): Optimize by making use of the
  SCM_INEXACTP macro.
  (scm_inexact_p): Move it next to scm_exact_p, and add else's.

* test-suite/tests/numbers.test: Add test cases for `exact?'
  and `inexact?' applied to infinities and NaNs.
2011-01-28 12:24:24 +01:00
Mark H Weaver
7112615f73 Implement finite?' in core and fix R6RS finite?' and `infinite?'
* libguile/numbers.c (scm_finite_p): Add new predicate `finite?' from
  R6RS to guile core, which returns #t if and only if its argument is
  neither infinite nor a NaN.  Note that this is not the same as (not
  (inf? x)) or (not (infinite? x)), since NaNs are neither finite nor
  infinite.

* test-suite/tests/numbers.test: Add test cases for `finite?'.

* module/rnrs/base.scm: Import `inf?' as `infinite?' instead of
  reimplementing it.  Previously, the R6RS implementation of
  `infinite?' did not detect non-real complex infinities, nor did it
  throw exceptions for non-numbers.  (Note that NaNs _are_ considered
  numbers by scheme, despite their name).

  Import `finite?' instead of reimplementing it.  Previously, the R6RS
  implementation of `finite?' returned #t for both NaNs and non-real
  complex infinities, in violation of R6RS.

* NEWS: Add NEWS entries, and reorganize existing numerics-related
  entries together under one subheading.

* doc/ref/api-data.texi (Real and Rational Numbers): Add docs for
  `finite?' and scm_finite_p.
2011-01-28 12:21:14 +01:00
Mark H Weaver
cff5fa3384 Add SCM_INUM1 to numbers.h, and make use of it and SCM_INUM0 in numbers.c
* libguile/numbers.h: Add SCM_INUM1, a name for the fixnum 1.  This is
  analogous to SCM_INUM0, a name for 0, which already existed.

* libguile/numbers.c: Change occurrences of SCM_I_MAKINUM (0) and
  SCM_I_MAKINUM (1) to SCM_INUM0 and SCM_INUM1, respectively.
2011-01-28 12:18:12 +01:00
Ludovic Courtès
a917871527 Remove `scm_lfwrite_str'.
* libguile/ports.c (scm_lfwrite_str): Remove.

* libguile/ports.h (scm_lfwrite_str): Remove declaration.

* libguile/numbers.c (scm_i_print_fraction): Use `scm_display' instead
  of `scm_lfwrite_str'.
2011-01-23 01:14:51 +01:00
Andy Wingo
8e43ed5d0b infinities are no longer integers
* libguile/numbers.c (scm_is_integer): Infinities are not integers, per
  the R6RS.
  (scm_even_p, scm_odd_p): Passing an infinity to even? or odd? is an
  error.

* test-suite/tests/numbers.test ("integer?"): Adapt test.
  ("expt"): Add tests for +inf.0 and -inf.0 exponents.

* NEWS: Add NEWS entries.
2011-01-23 00:06:24 +01:00
Mark H Weaver
01c7284ae5 Fix bugs in expt and integer-expt
* libguile/numbers.c (scm_expt): Fix bug that caused expt to throw an
  exception whenever the base was exact and the exponent was an
  inexact integer, e.g. (expt 5 6.0).

  (scm_expt): Fix bug that caused expt to introduce spurious imaginary
  parts in the result when the base was an inexact negative real and
  the exponent was an integer, e.g. (expt -1.0 2)

  (scm_integer_expt, scm_expt): Change behavior of (integer-expt 0 -1),
  and therefore also (expt 0 -1), to return NaN, per R6RS (actually,
  R6RS says we should throw an exception or return an "unspecified
  number object", but for now we use NaN).  Formerly we returned 0, per
  R5RS. R5RS claims that 0^x=0 for all non-zero x, but that's
  mathematically incorrect, and probably an oversight.

  (scm_integer_expt): Consistently throw a wrong-argument-type exception
  when the exponent is inexact.  Formerly, it didn't always check this
  if the base was 0, 1, or -1.

* test-suite/tests/numbers.test ("integer-expt", "expt"): Add tests.
2011-01-20 23:28:37 +01:00
Andy Wingo
e25f37271a fix a number of assuptions that a long could hold an inum
* libguile/bytevectors.c:
* libguile/goops.c:
* libguile/instructions.c:
* libguile/numbers.c:
* libguile/random.c:
* libguile/read.c:
* libguile/vm-i-scheme.c: Fix a number of assumptions that a long could
  hold an inum. This is not the case on platforms whose void* is larger
  than their long.

* libguile/numbers.c (scm_i_inum2big): New helper, only implemented for
  sizeof(void*) == sizeof(long); produces a compile error on other
  platforms. Basically gmp doesn't have a nice interface for converting
  between mpz values and intmax_t.
2010-11-19 15:22:43 +01:00
Andy Wingo
9b5fcde6f9 lower-case hexadecimal digits again
* libguile/numbers.c: Default to lower-case hexadecimal digits again.
2010-11-18 13:10:45 +01:00
Andy Wingo
a6f3af1618 fix string->number for bases > 16
* libguile/numbers.c (scm_iuint2str): Add an assertion on the domain of
  the radix. Use the number_chars table to write the string, instead of
  doing strange math. Same effect, though.
  (mem2uinteger, char_decimal_value): Change logic to allow all ascii
  alphabetic chars as decimals, not just a-f. Thanks to Nils Gey for the
  report.

* test-suite/tests/numbers.test ("number->string"): Add some tests.
2010-11-15 23:43:30 +01:00
Ludovic Courtès
03604fcf50 Allocate complex numbers in contiguous pointer-less memory.
* libguile/numbers.h (SCM_COMPLEX_MEM): Remove.
  (SCM_COMPLEX_REAL): Change to just fetch the `real' field of the
  pointed-to `scm_t_complex'.
  (SCM_COMPLEX_IMAG): Likewise.
  (scm_t_complex)[type, pad]: New fields.

* libguile/numbers.c (scm_c_make_rectangular): Allocate the whole
  complex contiguously, with `scm_gc_malloc_pointerless'.
2010-10-13 00:06:30 +02:00
Ludovic Courtès
978c52d108 Allocate inexact numbers in pointer-less memory.
* libguile/numbers.c (scm_from_double): Use `scm_gc_malloc_pointerless'
  instead of `scm_double_cell'.
2010-10-13 00:06:29 +02:00
Ludovic Courtès
864e7d424e Fix bignum memory leak.
The `mpz_t' associated with a bignum would never be freed, so an
expression like `(while #t (expt 2 5000))' would quickly lead to memory
exhaustion.

* libguile/numbers.c (finalize_bignum): New function.
  (make_bignum): Register it as a finalizer for P.
2010-09-27 11:20:14 +02:00
Ludovic Courtès
d017fcdfcb Allocate bignums in pointer-less memory.
* libguile/numbers.c (make_bignum): New function.
  (scm_i_mkbig, scm_i_long2big, scm_i_ulong2big, scm_i_clonebig,
  scm_i_dbl2big, scm_i_mpz2num): Use it.
2010-09-27 11:10:01 +02:00
Michael Gran
23295dc35c Incorrect parsing of NaN complex numbers
* libguile/numbers.c (mem2complex): modified
* test-suite/tests/reader.test: new complex NaN reader test
2010-09-25 09:07:21 -07:00
Ludovic Courtès
f328f86230 Clarify feature macro conditionals.
* libguile/numbers.c (scm_log10): Check whether `HAVE_COMPLEX_DOUBLE'
  and `HAVE_CLOG10' are defined instead of checking whether they are
  non-zero.
  (scm_sqrt): Likewise for `HAVE_COMPLEX_DOUBLE' and
  `HAVE_USABLE_CSQRT'.
2010-09-08 00:38:49 +02:00
Ludovic Courtès
2e65b52f8a Use Gnulib's isnan' and isinf' modules.
This updates Gnulib to v0.0-4219-g84cdd8b.

* m4/gnulib-cache.m4: Add `isinf' and `isnan'.

* configure.ac: Remove checks for `floatingpoint.h', `ieeefp.h', and
  `nan.h'.

* libguile/gen-scmconfig.c (main): Remove definitions of
  `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', and
  `SCM_HAVE_NAN_H'.

* libguile/numbers.c (isnan)[SCO && !HAVE_ISNAN]: Remove.
  (isinf)[SCO && !HAVE_ISINF]: Remove.
  (xisinf, xisnan): Remove.  Change callers to use `isinf' and `isnan'.
  (guile_ieee_init): Remove the `defined HAVE_ISINF' and `define
  HAVE_ISNAN' conditions.

* libguile/numbers.h: Remove code conditional on
  `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', or `SCM_HAVE_NAN_H'.
2010-09-08 00:34:27 +02:00
Andy Wingo
8a4ed2dd34 remove "discouraged" infrastructure
* libguile/discouraged.h: Remove.

* libguile/deprecated.c (scm_internal_select, scm_thread_sleep)
  (scm_thread_usleep): Deprecate formerly discouraged names.

* libguile/eq.h (SCM_EQ_P):
* libguile/pairs.h (SCM_NULLP, SCM_NNULLP, SCM_CONSP, SCM_NCONSP):
* libguile/boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOLP, SCM_BOOL):
  (SCM_NEGATE_BOOL, SCM_BOOL_NOT): Undiscourage these names, because I'm
  not sure deprecating them will do any good.

* libguile.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/init.c:
* libguile/Makefile.am:
* configure.ac: Remove bits that referenced discouraged.h, and dealt
  with the "discouraging" system.
2010-08-08 14:15:47 +02:00
Andy Wingo
220058a835 deprecated all discouraged functions
* libguile/Makefile.am:
* libguile/discouraged.c: Remove discouraged.c.

* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/discouraged.h: All functions and declarations moved from
  discouraged.[ch] to deprecated.[ch], adding deprecation warnings.

* libguile/init.c: Remove discouraged init.

* libguile/numbers.c (scm_num2float, scm_num2double): Deprecate.

* test-suite/standalone/test-num2integral.c: Port to modern API.
2010-08-08 13:48:35 +02:00
Andy Wingo
4ca4826997 remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64
* 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.
2010-07-26 15:00:49 +02:00
Andy Wingo
5a8fc758b0 expt / integer-expt fixes
* libguile/numbers.c (scm_integer_expt): Validate the first arg as a
  number.
  (scm_expt): Delegate to scm_integer_expt iff x is exact. Fixes
  fractions.test, which I broke recently

* test-suite/tests/numbers.test ("integer-expt"): Add test for
  (integer-expt #t 0).
2010-06-10 18:14:02 +02:00
Andy Wingo
a4082ab57e fix (expt #t 0)
* libguile/numbers.c (scm_expt): Fix check regarding when to dispatch to
  integer-expt.

* test-suite/tests/numbers.test ("expt"): Add test.
2010-06-07 23:27:55 +02:00
Ludovic Courtès
8c93b597b3 Fix the visibility of a few of internal symbols.
* 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-05-28 17:02:13 +02: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
f39448c5a3 remove a bunch of needless scm_permanent_object calls
* libguile/array-handle.c:
* libguile/bytevectors.c:
* libguile/deprecated.c:
* libguile/eval.c:
* libguile/feature.c:
* libguile/filesys.c:
* libguile/gc.c:
* libguile/gdbint.c:
* libguile/goops.c:
* libguile/instructions.c:
* libguile/load.c:
* libguile/modules.c:
* libguile/numbers.c:
* libguile/options.c:
* libguile/ports.c:
* libguile/scmsigs.c:
* libguile/srcprop.c:
* libguile/srfi-4.c:
* libguile/stacks.c:
* libguile/threads.c:
* libguile/vm.c: Remove calls to scm_permanent_object, as they are no
  longer needed with the BDW GC.
2009-12-05 11:32:50 +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
78d3deb1d4 change asubrs to be gsubrs
* libguile/numbers.h:
* libguile/numbers.c (scm_i_gcd, scm_i_lcm, scm_i_logand, scm_i_logior)
  (scm_i_logxor, scm_i_min, scm_i_max, scm_i_sum, scm_i_difference)
  (scm_i_product, scm_i_divide): Change asubrs to be gsubrs.
2009-12-03 15:33:09 +01:00
Andy Wingo
8ccd24f7bb + is not an asubr
* libguile/numbers.h:
* libguile/numbers.c (scm_i_sum): Rework so that scm_sum is just a
  normal function. Its generic is actually provided by scm_i_sum, a
  gsubr with rest args. In that way, + is no longer an asubr.
2009-12-03 15:33:09 +01:00
Andy Wingo
ad79736c68 implement transcendental sin, cos etc in c; deprecate $sin, $cos, etc
* libguile/deprecated.h:
* libguile/deprecated.c (scm_asinh, scm_acosh, scm_atanh): Deprecate
  these stand-ins for the C99 asinh, acosh, and atanh functions. Guile
  is not gnulib.
  (scm_sys_atan2): Deprecate as well, in favor of scm_atan.

* libguile/numbers.h:
* libguile/numbers.c (scm_sin, scm_cos, scm_tan)
  (scm_sinh, scm_cosh, scm_tanh)
  (scm_asin, scm_acos, scm_atan)
  (scm_sys_asinh, scm_sys_acosh, scm_sys_atanh): New functions,
  replacing the combination of dsubrs and boot-9 wrappers with C subrs
  that handle complex values. The latter three have _sys_ in their names
  due to the name conflict with the deprecated scm_asinh et al.

  Remove the $abs, $sin etc "dsubrs".

* module/ice-9/boot-9.scm: Remove transcendental functions, as this all
  happens in C now.

* module/ice-9/deprecated.scm: Add aliases for $sin et al.

* test-suite/tests/ramap.test ("array-map!"): Adjust "dsubr" tests to
  use sqrt, not $sqrt. They don't actually test dsubrs now. In the
  two-source test, I'm pretty sure the dsubr array-map! should have been
  failing, as indeed it does now; I've changed the test case to expect
  the failure. I'd still like to know why it was succeeding before.
2009-12-03 15:27:35 +01:00
Andy Wingo
6fc4d0124d expt implemented in C, handles complex numbers
* libguile/numbers.h:
* libguile/numbers.c (scm_expt): Rename from scm_sys_expt, and handle
  the complex cases as well.

* libguile/deprecated.h:
* libguile/deprecated.c (scm_sys_expt): Add a deprecated shim.

* module/ice-9/boot-9.scm (expt): Remove definition, scm_expt does all
  we need.
2009-12-03 15:24:28 +01:00
Ludovic Courtès
56a3dcd431 Remove references to undefined macros.
The intent is to allow compilation with `-Wundef', which in turn should
make it easier to catch erroneous uses of nonexistent macros.

* libguile/__scm.h: Don't assume `BUILDING_LIBGUILE' is defined.

* libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): Remove unneeded CPP
  conditional on `TYPE_MIN == 0'.

* libguile/fports.c: Check for the definition of `HAVE_CHSIZE' and
  `HAVE_FTRUNCATE', not for their value.

* libguile/ports.c: Likewise.

* libguile/numbers.c (guile_ieee_init): Likewise with `HAVE_DINFINITY'
  and `HAVE_DQNAN'.

* test-suite/standalone/test-conversion.c (ieee_init): Likewise.

* libguile/strings.c: Likewise with `SCM_STRING_LENGTH_HISTOGRAM'.

* libguile/strings.h: Likewise.

* libguile/tags.h: Likewise with `HAVE_INTTYPES_H' and `HAVE_STDINT_H'.

* libguile/threads.c: Likewise with `HAVE_PTHREAD_GET_STACKADDR_NP'.

* libguile/vm-engine.c (VM_NAME): Likewise with `VM_CHECK_IP'.

* libguile/gen-scmconfig.c (main): Use "#ifdef HAVE_", not "#if HAVE_".

* libguile/socket.c (scm_setsockopt): Likewise.
2009-11-17 23:42:22 +01:00
Ludovic Courtès
7af531508c Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	libguile/Makefile.am
	libguile/bytevectors.c
	libguile/gc-card.c
	libguile/gc-mark.c
	libguile/programs.c
	libguile/srcprop.c
	libguile/srfi-14.c
	libguile/symbols.c
	libguile/threads.c
	libguile/unif.c
	libguile/vm.c
2009-08-28 19:16:46 +02:00
Michael Gran
cdf8f9e632 Use uc_tolower in number conversion
* libguile/numbers.c (XDIGIT2UINT): use uc_tolower
2009-08-21 09:30:53 -07:00
Michael Gran
3f47e52621 Use string accessors for string->number conversion
* libguile/numbers.c (scm_i_print_fraction): use string accessors
  (XDIGIT2UINT): use libunistring function
  (mem2uinteger, mem2integer, mem2decimal_from_point, mem2ureal)
  (mem2complex): take scheme string instead of c string; use accessors
  (scm_i_string_to_number): new function
  (scm_c_locale_string_to_number): use scm_i_string_to_number

* libguile/numbers.h: declaration for scm_i_string_to_number

* libguile/strings.c (scm_i_string_strcmp): new function

* libguile/strings.h: declaration for scm_i_string_strcmp
2009-08-21 09:18:30 -07:00
Ludovic Courtès
fbb857a472 Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	lib/Makefile.am
	libguile/Makefile.am
	libguile/frames.c
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc_os_dep.c
	libguile/load.c
	libguile/macros.c
	libguile/objcodes.c
	libguile/programs.c
	libguile/strings.c
	libguile/vm.c
	m4/gnulib-cache.m4
	m4/gnulib-comp.m4
	m4/inline.m4
2009-08-18 00:06:45 +02:00
Andy Wingo
ee0ddd2121 fix buffer overrun reading partial numbers: 1.0f, 1.0/, and 1.0+
* libguile/numbers.c (mem2decimal_from_point, mem2ureal, mem2complex):
  Fix a number of cases where, for invalid numbers, we could read past
  the end of the buffer. This happened in e.g. "1.0+", "1/" and "1.0f".
  But I couldn't figure out how to test for these, given that the
  behavior depended on the contents of uninitialized memory in the
  reader buffer. We'll just have to be happy with this.

Thanks to Kjetil S. Matheussen for the report.
2009-08-04 20:29:09 +02:00
Michael Gran
904a78f11d Add 32-bit characters
This adds the 32-bit standalone characters.  Strings are still
8-bit.  Characters larger than 8-bit can only be entered or
displayed in octal format at this point.  At this point, the
terminal's display encoding is expected to be Latin-1.

        * module/language/assembly/compile-bytecode.scm (write-bytecode):
        add 32-bit char

        * module/language/assembly.scm (object->assembly): add 32-bit char
        (assembly->object): add 32-bit char

        * libguile/vm-i-system.c (make-char32): new op

        * libguile/print.c (iprin1): print 32-bit char

        * libguile/numbers.h: add type scm_t_wchar

        * libguile/numbers.c: add type scm_t_wchar

        * libguile/chars.h: new type scm_t_wchar
        (SCM_CODEPOINT_MAX): new
        (SCM_IS_UNICODE_CHAR): new
        (SCM_MAKE_CHAR): operate on 32-bit char

        * libguile/chars.c: comparison operators now use Unicode
        codepoints
        (scm_c_upcase): now receives and returns scm_t_wchar
        (scm_c_downcase): now receives and returns scm_t_wchar
2009-07-29 06:38:32 -07:00
Neil Jerram
40f892156a Read complex numbers where both parts are inexact decimals
Thanks to Bill Schottstaedt for reporting this problem!

* libguile/numbers.c (mem2ureal): Don't be misled by *p_exactness
  being INEXACT on entry (as is possible when reading a complex
  number): use local exactness variable x which starts as EXACT.
  Call mem2decimal_from_point () with &x instead of p_exactness.

* test-suite/tests/numbers.test ("string->number"): Add complex number
  tests suggested by Bill.
2009-07-01 19:43:55 +01:00
Neil Jerram
53befeb700 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/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
5e647d08e9 Fix compilation of `numbers.c' on Tru64.
* libguile/numbers.c (scm_c_make_polar): Don't use sincos(3) on non-GNU
  platforms.  Reported by Didier Godefroy <ldg@ulysium.net>.
2009-05-20 23:53:09 +02:00
Ludovic Courtès
b66a552487 Merge branch 'master' into boehm-demers-weiser-gc 2008-09-23 19:01:01 +02:00
Neil Jerram
1dd797921c Fix for incorrect (gcd -2) => -2; should give 2.
(reported by Bill Schottstaedt)

* libguile/numbers.c (scm_gcd): When only one arg given, use scm_abs
  to ensure that result is non-negative.

* test-suite/tests/numbers.test ("gcd"): New test, (gcd -2).
2008-09-22 21:21:20 +01:00
Ludovic Courtès
44e268898b Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	lib/Makefile.am
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc.c
	libguile/gc.h
	libguile/gc_os_dep.c
	libguile/private-gc.h
	m4/.cvsignore
	m4/gnulib-cache.m4
	m4/gnulib-comp.m4
2008-09-13 22:51:27 +02:00
Ludovic Courtès
dbb605f575 Include <config.h> in all C files; use #ifdef HAVE_CONFIG_H' rather than #if'. 2008-09-13 15:35:27 +02:00
Ludovic Courtès
6f03035fe8 Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	libguile/Makefile.am
	libguile/coop-defs.h
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-malloc.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc.c
	libguile/gc.h
	libguile/gc_os_dep.c
	libguile/hashtab.c
	libguile/hashtab.h
	libguile/inline.h
	libguile/private-gc.h
	libguile/struct.c
	libguile/struct.h
	libguile/threads.c
	libguile/threads.h
	libguile/vectors.h
	libguile/weaks.h
	test-suite/tests/gc.test
2008-09-10 23:09:30 +02:00
Ludovic Courtès
6774820f1e Merge commit '29776e85da' into boehm-demers-weiser-gc
Conflicts:
	libguile/gc-card.c
	libguile/gc.c
	libguile/gc.h
	libguile/ports.c
2008-09-10 22:50:04 +02:00
Ludovic Courtès
e9b8556ec9 Merge commit '7337d56d57' into boehm-demers-weiser-gc
Conflicts:
	libguile/struct.c
2008-09-10 22:44:31 +02:00
Ludovic Courtès
4a4849dbe0 Merge commit '0329137392' into boehm-demers-weiser-gc
Conflicts:
	libguile/gc.c
	libguile/srcprop.c
	libguile/srcprop.h
2008-09-10 22:33:40 +02:00
Ludovic Courtès
35a9197ccc Merge commit 'f30e1bdf97' into boehm-demers-weiser-gc
Conflicts:
	libguile/Makefile.am
	libguile/coop-pthreads.c
	libguile/gc-freelist.c
	libguile/gc-segment.c
	libguile/gc.c
	libguile/private-gc.h
	test-suite/tests/environments.nottest
2008-09-10 22:27:30 +02:00
Ludovic Courtes
92d8fd328c Use `scm_gc_malloc_pointerless' in various places (improves performance).
* libguile/fports.c (scm_fport_buffer_add): Use
  `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when
  allocating room for the read/write buffers.

* libguile/numbers.c (scm_c_make_rectangular): Likewise.

* libguile/ports.c (scm_ungetc): Likewise.

* libguile/random.c (scm_i_copy_rstate): Likewise.
  (scm_c_make_rstate): Likewise.

* libguile/regex-posix.c (scm_make_regexp): Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-36
2008-09-10 20:27:00 +02:00
Ludovic Courtès
417566ebc9 Never define _GNU_SOURCE' explicitly since AC_USE_SYSTEM_EXTENSIONS'
takes care of it.

Conflicts:

	ChangeLog
	configure.in
	libguile/eval.c
	libguile/srfi-14.c
	libguile/threads.c
2008-08-20 19:31:46 +02:00