| Commit message (Expand) | Author | Age | Files | Lines |
* | Do not assume that sizeof (long) == sizeof (void *) == sizeof (SCM)....This assumption does not hold on systems that use the LLP64 data model.
Partially fixes <https://debbugs.gnu.org/22406>.
Reported by Peter TB Brett <peter@peter-b.co.uk>.
* libguile/numbers.h (scm_t_inum): Move here from numbers.c, and change
to be equivalent to 'long' (formerly 'scm_t_signed_bits').
(SCM_MOST_POSITIVE_FIXNUM, SCM_MOST_NEGATIVE_FIXNUM): Define based on
SCM_I_FIXNUM_BIT instead of SCM_T_SIGNED_BITS_MAX.
(SCM_I_INUM): Adjust definitions to return a 'scm_t_inum', and avoiding
the assumption that SCM_UNPACK returns a 'long'.
* libguile/numbers.c (scm_t_inum): Move definition to numbers.h.
Verify that 'scm_t_inum' fits within a SCM value.
(scm_i_inum2big): Remove preprocessor code that forced a compile error
unless sizeof (long) == sizeof (void *).
| Mark H Weaver | 2017-03-01 | 1 | -16/+15 |
* | Merge branch 'stable-2.0'...Conflicts:
GUILE-VERSION
NEWS
guile-readline/ice-9/readline.scm
libguile/async.c
libguile/backtrace.c
libguile/deprecated.h
libguile/gc-malloc.c
libguile/gdbint.c
libguile/init.c
libguile/ioext.c
libguile/mallocs.c
libguile/print.c
libguile/rw.c
libguile/scmsigs.c
libguile/script.c
libguile/simpos.c
libguile/snarf.h
libguile/strports.c
libguile/threads.c
libguile/vm-i-scheme.c
libguile/vm-i-system.c
module/srfi/srfi-18.scm
test-suite/Makefile.am
test-suite/standalone/test-num2integral.c
| Mark H Weaver | 2014-04-25 | 1 | -8/+32 |
|\ |
|
| * | SCM_I_INUM: Rewrite to avoid unspecified behavior when not using GNU C....* libguile/numbers.h (SCM_I_INUM): Unless using GNU C, use a portable
implementation that avoids unspecified behavior.
| Mark H Weaver | 2014-03-11 | 1 | -1/+16 |
| * | SCM_SRS: Improve fallback implemention to avoid unspecified behavior....* libguile/numbers.h (SCM_SRS): Rewrite preprocessor test to avoid
left-shifting negative integers, and to test more comprehensively for
the behavior we need. Rewrite fallback implementation to avoid
unspecified behavior.
| Mark H Weaver | 2014-03-11 | 1 | -5/+14 |
| * | Improve compliance with C standards regarding signed integer shifts....* configure.ac: Add -fwrapv when using GCC (or compatible), if
supported.
* libguile/numbers.h (SCM_I_MAKINUM): Cast to scm_t_bits (unsigned)
before shifting, to avoid undefined behavior.
| Mark H Weaver | 2014-03-07 | 1 | -2/+2 |
* | | Merge branch 'stable-2.0'...Conflicts:
module/system/vm/traps.scm
test-suite/tests/peval.test
| Mark H Weaver | 2014-01-09 | 1 | -0/+2 |
|\| |
|
| * | Implement 'exact-integer?' and 'scm_is_exact_integer'....* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer):
New procedures.
(scm_integer_p): Improve docstring.
* libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer):
New prototypes.
* doc/ref/api-data.texi (Integers): Add docs.
* test-suite/tests/numbers.test ("exact-integer?"): Add tests.
| Mark H Weaver | 2014-01-08 | 1 | -0/+2 |
* | | add scm_{to,from}_{u,}intptr_t...* libguile/numbers.h (scm_to_intptr_t, scm_from_intptr_t)
(scm_to_uintptr_t, scm_from_uintptr_t): New defines.
* libguile/foreign.c: Remove definitions here; adapt callers to use new
names with _t suffixes.
| Andy Wingo | 2013-05-23 | 1 | -0/+28 |
* | | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts:
configure.ac
libguile/deprecated.c
libguile/deprecated.h
libguile/filesys.h
libguile/fluids.c
libguile/fports.c
libguile/gc.c
libguile/guile.c
libguile/numbers.c
libguile/objcodes.c
libguile/r6rs-ports.c
libguile/smob.c
libguile/socket.c
libguile/threads.h
module/language/scheme/decompile-tree-il.scm
module/language/tree-il/peval.scm
test-suite/tests/syncase.test
| Mark H Weaver | 2013-03-28 | 1 | -1/+2 |
|\| |
|
| * | Add 'round-ash', a rounding arithmetic shift operator...* libguile/numbers.c (left_shift_exact_integer,
floor_right_shift_exact_integer, round_right_shift_exact_integer): New
static functions.
(scm_round_ash): New procedure.
(scm_ash): Reimplement in terms of 'left_shift_exact_integer' and
'floor_right_shift_exact_integer'.
* libguile/numbers.h: Add prototype for scm_round_ash. Rename the
second argument of 'scm_ash' from 'cnt' to 'count'.
* test-suite/tests/numbers.test (round-ash, ash): Add new unified
testing framework for 'ash' and 'round-ash'. Previously, the tests
for 'ash' were not very comprehensive; for example, they did not
include a single test where the number to be shifted was a bignum.
* doc/ref/api-data.texi (Bitwise Operations): Add documentation for
'round-ash'. Improve documentation for `ash'.
| Mark H Weaver | 2013-03-12 | 1 | -1/+2 |
* | | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts:
libguile/array-handle.c
libguile/deprecated.h
libguile/inline.c
libguile/inline.h
module/ice-9/deprecated.scm
module/language/tree-il/peval.scm
| Andy Wingo | 2013-02-18 | 1 | -1/+14 |
|\| |
|
| * | Add scm_from_ptrdiff_t and scm_to_ptrdiff_t....* libguile/numbers.h (scm_from_ptrdiff_t, scm_to_ptrdiff_t):
New macros (function aliases).
* doc/ref/api-data.texi: Add docs.
| Mark H Weaver | 2013-02-02 | 1 | -1/+14 |
* | | Revert "add SCM_HEAP_OBJECT_BASE"...This reverts commit 47ed8656db8800f3ad20a40eb2c4e9ef3dc891e3.
Conflicts:
libguile/foreign.c
| Andy Wingo | 2012-01-31 | 1 | -3/+3 |
* | | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts:
libguile/guile.c
libguile/numbers.c
| Andy Wingo | 2011-12-02 | 1 | -0/+3 |
|\| |
|
| * | install gmp memory functions that let libgc know about allocations...* libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc,
custom_gmp_free): New static functions used by GMP for allocation.
These are just wrappers for scm_malloc, scm_realloc, and free.
(scm_init_numbers): If scm_install_gmp_memory_functions is nonzero,
use mp_set_memory_functions to configure GMP to use
custom_gmp_{malloc,realloc,free} for memory allocation.
(scm_bigprint): Ask gmp for the function used to deallocate the string
returned by mpz_get_str.
* libguile/numbers.h: Declare scm_install_gmp_memory_functions.
* libguile/guile.c: When running the Guile binary, install the
gmp_memory_functions.
Based on a patch by Mark H Weaver <mhw@netris.org>.
| Andy Wingo | 2011-12-02 | 1 | -0/+3 |
* | | add SCM_HEAP_OBJECT_BASE...* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro. Given a SCM,
returns a pointer to the start of its memory area on the heap.
* libguile/bytevectors.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/numbers.h:
* libguile/ports.c:
* libguile/smob.c:
* libguile/struct.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Use it.
| Andy Wingo | 2011-10-24 | 1 | -3/+3 |
* | | 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 | -6/+5 |
|/ |
|
* | New functions scm_is_exact and scm_is_inexact...* doc/ref/api-data.texi (Exact and Inexact Numbers): doc for scm_is_exact
and scm_is_inexact
* libguile/numbers.c (scm_is_exact, scm_is_inexact): new functions
* libguile/numbers.h: declarations for scm_is_exact and scm_is_inexact
* test/suite/standalone/test-conversion.c (test_is_exact, test_is_inexact):
new tests
| Mike Gran | 2011-10-09 | 1 | -0/+2 |
* | Fix the R6RS exact-integer-sqrt and import into core guile...* libguile/numbers.c (scm_exact_integer_sqrt): New C procedure to
compute exact integer square root and remainder.
(scm_i_exact_integer_sqrt): New Scheme procedure `exact-integer-sqrt'
from the R6RS, imported into core guile.
* libguile/numbers.h: Add prototypes.
* module/rnrs/base.scm: Remove broken stub implementation, which would
fail badly when applied to large integers.
* doc/ref/api-data.texi: Add documentation.
* doc/ref/r6rs.texi: Change documentation for `exact-integer-sqrt' to a
stub that xrefs the core docs, as is done for other operations
available in core.
* test-suite/tests/numbers.test: Add tests.
* NEWS: Add news entries.
| Mark H Weaver | 2011-04-09 | 1 | -0/+2 |
* | Make SCM_NUMP and SCM_NUMBERP more extensible...* libguile/numbers.h (SCM_NUMP, SCM_NUMBERP): Mask out more bits in the
cell type field when doing the comparison, in order to accept future
numeric types that have not yet been implemented. This should allow
us to add more core numeric types without breaking ABI compatibility.
As a bonus, these macros are now more efficient.
| Mark H Weaver | 2011-02-14 | 1 | -3/+1 |
* | Add four new sets of fast quotient and remainder operators...* libguile/numbers.c (scm_floor_divide, scm_floor_quotient,
scm_floor_remainder, scm_ceiling_divide, scm_ceiling_quotient,
scm_ceiling_remainder, scm_truncate_divide, scm_truncate_quotient,
scm_truncate_remainder, scm_round_divide, scm_round_quotient,
scm_round_remainder): New extensible procedures `floor/',
`floor-quotient', `floor-remainder', `ceiling/', `ceiling-quotient',
`ceiling-remainder', `truncate/', `truncate-quotient',
`truncate-remainder', `round/', `round-quotient', and
`round-remainder'.
* libguile/numbers.h: Add function prototypes.
* test-suite/tests/numbers.test: Add tests.
* doc/ref/api-data.texi (Arithmetic): Add documentation.
* NEWS: Add NEWS entry.
| Mark H Weaver | 2011-02-14 | 1 | -0/+16 |
* | Make divide functions return values via (SCM *) output arguments...* libguile/numbers.c (scm_euclidean_divide, scm_centered_divide): Change
API to return two values via output arguments of type (SCM *), instead
of packing into a values object.
(scm_i_euclidean_divide, scm_i_centered_divide): New internal wrappers
that call the above functions and pack the result into a values
object.
* libguile/numbers.h: Change prototypes to reflect new API.
* doc/ref/api-data.h (Arithmetic): Update manual.
| Mark H Weaver | 2011-02-14 | 1 | -2/+5 |
* | Rename {euclidean,centered}_quo_rem to {euclidean,centered}_divide...* libguile/numbers.c (euclidean_quo_rem): Rename to euclidean_divide.
(centered_quo_rem): Rename to {euclidean,centered}_divide.
* libguile/numbers.h: Rename euclidean_quo_rem to euclidean_divide and
centered_quo_rem to centered_divide.
* doc/ref/api-data.texi: Rename euclidean_quo_rem to euclidean_divide and
centered_quo_rem to centered_divide.
| Mark H Weaver | 2011-01-31 | 1 | -2/+2 |
* | Improve extensibility of core numeric procedures...* libguile/numbers.c (scm_quotient, scm_remainder, scm_modulo,
scm_zero_p, scm_positive_p, scm_negative_p, scm_real_part,
scm_imag_part, scm_numerator, scm_denominator, scm_magnitude,
scm_angle, scm_exact_to_inexact): Change from SCM_GPROC to
SCM_PRIMITIVE_GENERIC. As a side effect, all of these procedures now
have documentation strings.
(scm_exact_p, scm_inexact_p, scm_odd_p, scm_even_p, scm_finite_p,
scm_inf_p, scm_nan_p, scm_expt, scm_inexact_to_exact, scm_log,
scm_log10, scm_exp, scm_sqrt): Change from SCM_DEFINE to
SCM_PRIMITIVE_GENERIC, and make sure the code allows these functions
to be extended in practice.
(scm_real_part, scm_imag_part, scm_numerator, scm_denominator,
scm_inexact_to_exact): Simplify type dispatch code.
(scm_sqrt): Rename formal argument from x to z, since complex numbers
are supported.
(scm_abs): Fix empty FUNC_NAME.
* libguile/numbers.h (scm_finite_p): Add missing prototype.
(scm_inf_p, scm_nan_p): Rename formal parameter from n to x, since
the domain is the real numbers.
* test-suite/tests/numbers.test: Test for documentation strings. Change
from `expect-fail' to `pass-if' for several of these, and add tests
for others. Also add other tests for `real-part' and `imag-part',
which previously had none.
| Mark H Weaver | 2011-01-30 | 1 | -2/+3 |
* | Add two new sets of fast quotient and remainder operators...* libguile/numbers.c (scm_euclidean_quo_and_rem, scm_euclidean_quotient,
scm_euclidean_remainder, scm_centered_quo_and_rem,
scm_centered_quotient, scm_centered_remainder): New extensible
procedures `euclidean/', `euclidean-quotient', `euclidean-remainder',
`centered/', `centered-quotient', `centered-remainder'.
* libguile/numbers.h: Add function prototypes.
* module/rnrs/base.scm: Remove incorrect stub implementations of `div',
`mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Instead do
renaming imports of `euclidean-quotient', `euclidean-remainder',
`euclidean/', `centered-quotient', `centered-remainder', and
`centered/', which are equivalent to the R6RS operators.
* module/rnrs/arithmetic/fixnums.scm (fxdiv, fxmod, fxdiv-and-mod,
fxdiv0, fxmod0, fxdiv0-and-mod0): Remove redundant checks for division
by zero and unnecessary complexity.
(fx+/carry): Remove unneeded calls to `inexact->exact'.
* module/rnrs/arithmetic/flonums.scm (fldiv, flmod, fldiv-and-mod,
fldiv0, flmod0, fldiv0-and-mod0): Remove redundant checks for division
by zero and unnecessary complexity. Remove unneeded calls to
`inexact->exact' and `exact->inexact'
* test-suite/tests/numbers.test: (test-eqv?): New internal predicate for
comparing numerical outputs with expected values.
Add extensive test code for `euclidean/', `euclidean-quotient',
`euclidean-remainder', `centered/', `centered-quotient',
`centered-remainder'.
* test-suite/tests/r6rs-arithmetic-fixnums.test: Fix some broken test
cases, and remove `unresolved' test markers for `fxdiv', `fxmod',
`fxdiv-and-mod', `fxdiv0', `fxmod0', and `fxdiv0-and-mod0'.
* test-suite/tests/r6rs-arithmetic-flonums.test: Remove `unresolved'
test markers for `fldiv', `flmod', `fldiv-and-mod', `fldiv0',
`flmod0', and `fldiv0-and-mod0'.
* doc/ref/api-data.texi (Arithmetic): Document `euclidean/',
`euclidean-quotient', `euclidean-remainder', `centered/',
`centered-quotient', and `centered-remainder'.
(Operations on Integer Values): Add cross-references to `euclidean/'
et al, from `quotient', `remainder', and `modulo'.
* doc/ref/r6rs.texi (rnrs base): Improve documentation for `div', `mod',
`div-and-mod', `div0', `mod0', and `div0-and-mod0'. Add
cross-references to `euclidean/' et al.
* NEWS: Add NEWS entry.
| Mark H Weaver | 2011-01-30 | 1 | -0/+6 |
* | 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.
| Mark H Weaver | 2011-01-28 | 1 | -3/+4 |
* | 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'.
| Ludovic Courtès | 2010-10-13 | 1 | -3/+4 |
* | 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'.
| Ludovic Courtès | 2010-09-08 | 1 | -18/+0 |
* | 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.
| Andy Wingo | 2010-07-26 | 1 | -5/+1 |
* | 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.
| Andy Wingo | 2009-12-03 | 1 | -1/+13 |
* | + 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.
| Andy Wingo | 2009-12-03 | 1 | -0/+1 |
* | 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.
| Andy Wingo | 2009-12-03 | 1 | -4/+12 |
* | 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.
| Andy Wingo | 2009-12-03 | 1 | -1/+1 |
* | Add full Unicode capability to ports and the default reader...Ports are given two additional properties: a character encoding and
a conversion failure strategy. These properties have getters and setters.
The new properties are used to convert any locale text to/from the
internal representation of strings.
If unspecified, ports use a default value. The default value of these
properties is held in a fluid. The default character encoding can be
modified by calling setlocale.
ISO-8859-1 is treated specially. Since it is a native encoding of
strings, it can be processed more quickly. Source code is assumed to be
ISO-8859-1 unless otherwise specified. The encoding of a source code
file can be given as 'coding: XXXXX' in a magic comment at the top of a
file.
The C functions that deal with encoding often use a null pointer
as shorthand for the native Latin-1 encoding, for efficiency's sake.
* test-suite/tests/encoding-iso88591.test: new tests
* test-suite/tests/encoding-iso88597.test: new tests
* test-suite/tests/encoding-utf8.test: new tests
* test-suite/tests/encoding-escapes.test: new tests
* test-suite/tests/numbers.test: declare 'binary' encoding
* test-suite/tests/ports.test: declare 'binary' encoding
* test-suite/tests/r6rs-ports.test: declare 'binary' encoding
* module/system/base/compile.scm (compile-file): use source-code
file's self-declared encoding when compiling files
* libguile/strports.c: store string ports in locale encoding
(scm_strport_to_locale_u8vector, scm_call_with_output_locale_u8vector)
(scm_open_input_locale_u8vector, scm_get_output_locale_u8vector):
new functions
* libguile/strings.h: new declaration for scm_i_string_contains_char
* libguile/strings.c (scm_i_string_contains_char): new function
(scm_from_stringn, scm_to_stringn): use NULL for Latin-1
(scm_from_locale_stringn, scm_to_locale_stringn): respect character
encoding of input and output ports
* libguile/read.h: declaration for scm_scan_for_encoding
* libguile/read.c:
(read_token): now takes scheme string instead of C string/length
(read_complete_token): new function
(scm_read_sexp, scm_read_number, scm_read_mixed_case_symbol)
(scm_read_number_and_radix, scm_read_quote, scm_read_semicolon_comment)
(scm_read_srfi4_vector, scm_read_bytevector, scm_read_guile_bit_vector)
(scm_read_scsh_block_comment, scm_read_commented_expression)
(scm_read_extended_symbol, scm_read_sharp_extension, scm_read_shart)
(scm_read_expression): use scm_t_wchar for char type, use read_complete_token
(scm_scan_for_encoding): new function to find a file's character encoding
(scm_file_encoding): new function to find a port's character encoding
* libguile/rdelim.c: don't unpack strings
* libguile/print.h: declaration for modified function
scm_i_charprint
* libguile/print.c: use locale when printing characters and
strings
(scm_i_charprint): input parameter is now scm_t_wchar
(scm_simple_format): don't unpack strings
* libguile/posix.h: new declaration for scm_setbinary.
* libguile/posix.c (scm_setlocale): set default and stdio port
encodings based on the locale's character encoding
(scm_setbinary): new function
* libguile/ports.h (scm_t_port): add encoding and failed
conversion handler to port type. Declarations for new or modified
functions scm_getc, scm_unget_byte, scm_ungetc,
scm_i_get_port_encoding, scm_i_set_port_encoding_x,
scm_port_encoding, scm_set_port_encoding_x,
scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x,
scm_port_conversion_strategy, scm_set_port_conversion_strategy_x.
* libguile/ports.c: assign the current ports to zero on startup so
we can see if they've been set.
(scm_current_input_port, scm_current_output_port,
scm_current_error_port): return #f if the port is not yet
initialized
(scm_new_port_table_entry): set up a new port's encoding and
illegal sequence handler based on the thread's current defaults
(scm_i_remove_port): free port encoding name when port is removed
(scm_i_mode_bits_n): now takes a scheme string instead of a c
string and length. All callers changed.
(SCM_MBCHAR_BUF_SIZE): new const
(scm_getc): new function, since the scm_getc in inline.h is now
scm_get_byte_or_eof. This pulls one codepoint from a port.
(scm_lfwrite_substr, scm_lfwrite_str): now uses port's encoding
(scm_unget_byte): new function, incorportaing the low-level functionality
of scm_ungetc
(scm_ungetc): uses scm_unget_byte
* libguile/numbers.h (scm_t_wchar): compilation order problem with
scm_t_wchar being use in functions in multiple headers. Forward
declare scm_t_wchar.
* libguile/load.c (scm_primitive_load): scan for file encoding at
top of file and use it to set the load port's encoding
* libguile/inline.h (scm_get_byte_or_eof): new function
incorporating most of the functionality of scm_getc.
* libguile/fports.c (fport_fill_input): now returns scm_t_wchar
* libguile/chars.h (scm_t_wchar): avoid compilation order problem
with declaration of scm_t_wchar
| Michael Gran | 2009-08-25 | 1 | -1/+5 |
* | 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
| Michael Gran | 2009-08-21 | 1 | -0/+1 |
* | Don't doubly define scm_t_wchar... * libguile/chars.h: don't define scm_t_wchar
* libguile/numbers.h: define scm_t_wchar here
| Michael Gran | 2009-08-01 | 1 | -3/+0 |
* | 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
| Michael Gran | 2009-07-29 | 1 | -1/+9 |
* | 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 `SCM_INTERNAL' macro, use it. | Ludovic Courtès | 2008-05-31 | 1 | -16/+16 |
* | * numbers.c (scm_i_fraction_reduce): move logic into...scm_i_make_ratio(), so fractions are only read.
scm_i_fraction_reduce() modifies a fraction when reading it. A
race condition might lead to fractions being corrupted by reading
them concurrently.
* numbers.h: remove SCM_FRACTION_SET_NUMERATOR,
SCM_FRACTION_SET_DENOMINATOR, SCM_FRACTION_REDUCED_BIT,
SCM_FRACTION_REDUCED_SET, SCM_FRACTION_REDUCED_CLEAR,
SCM_FRACTION_REDUCED.
| Han-Wen Nienhuys | 2006-12-23 | 1 | -8/+0 |
* | merge from 1.8 branch | Kevin Ryde | 2006-10-09 | 1 | -0/+4 |
* | merge from 1.8 branch | Kevin Ryde | 2006-04-17 | 1 | -2/+3 |
* | * hashtab.h: Bugfix: use SCM_API (WAS: extern)....* socket.c: Remove obsolete comment about socklen_t.
(s_scm_setsockopt)[!HAVE_IP_MREQ]: Do not use ip_mreq code.
* numbers.h (isnan)[__MINGW32__]: Remove.
* Makefile.am (gen_scmconfig_SOURCES): Bugfix: Add
DEFAULT_INCLUDES when cross compiling.
* threads.c (ETIMEDOUT, pipe)[__MINGW32__]: Add defines.
* stime.c (s_scm_strftime)[!HAVE_TM_ZONE]: Use
SCM_SIMPLE_VECTOR_REF instead of SCM_VELTS. (Changed slightly
from Jan's patch.)
| Marius Vollmer | 2005-06-05 | 1 | -1/+0 |
* | The FSF has a new address. | Marius Vollmer | 2005-05-23 | 1 | -1/+1 |
* | (scm_oneplus, scm_oneminus): New functions, converted from...scheme code in boot-9.scm.
| Kevin Ryde | 2005-04-14 | 1 | -0/+2 |
* | (scm_i_clonebig): Remove static, so can use in srfi-60. | Kevin Ryde | 2005-03-13 | 1 | -1/+2 |
* | (scm_i_print_complex, icmplx2str): New....(iflo2str): Use icmplx2str for complex numbers.
| Marius Vollmer | 2004-10-29 | 1 | -0/+1 |
* | (scm_i_print_double): New. | Marius Vollmer | 2004-10-26 | 1 | -0/+3 |
* | (SCM_T_INTBUFLEN): Increased to cover...scm_t_intmax values.
(scm_uint2str): New, for scm_t_uintmax.
(scm_iint2str): Argument type changed to scm_t_intmax,
reimplemented in terms of scm_uint2str.
| Marius Vollmer | 2004-10-22 | 1 | -4/+7 |
* | Include <gmp.h> in numbers.h, not in...numbers.c.
(scm_to_mpz, scm_from_mpz): New.
Thanks to Andreas Vögele!
| Marius Vollmer | 2004-09-21 | 1 | -0/+6 |