* libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro.
(SCM_N_READ_OPTIONS): Increment.
* libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'.
(t_read_opts): Add field for 'r7rs_symbols_p'.
(scm_read_string_like_syntax): New function based on earlier
'scm_read_string' that handles either string literals or R7RS quoted
symbols (delimited by vertical bars), depending on the value of 'chr'.
(scm_read_string): Reimplement based on 'scm_read_string_like_syntax'.
(scm_read_r7rs_symbol): New static function.
* doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS
symbol syntax, mention the 'r7rs-symbols' read option, and give some
examples.
* doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols'
read option.
* test-suite/tests/reader.test ("reading"): Add test.
* doc/ref/api-data.texi (Conversion to/from C, Symbol Primitives,
Keyword Procedures): Fix the recommendations for conversion of C
string constants. The encoding of the source code is irrelevant in
modern compilers. What is relevant is the execution character set.
Both GCC and clang use UTF-8 by default, so recommend the
'scm_from_utf8_*' functions when the argument is a C string constant.
Also fix the broken texinfo markup for 'scm_from_*_symbol' that
prevented them from being listed in the index.
* libguile/keywords.c (scm_keyword_argument_error): New variable.
(scm_c_bind_keyword_arguments): New API function.
* libguile/keywords.h (enum scm_keyword_arguments_flags): New enum.
(scm_t_keyword_arguments_flags): New typedef.
(scm_c_bind_keyword_arguments): New prototype.
* doc/ref/api-data.texi (Coding With Keywords, Keyword Procedures): Add
documentation.
* test-suite/standalone/test-scm-c-bind-keyword-arguments.c: New file.
* test-suite/standalone/Makefile.am: Add
test-scm-c-bind-keyword-arguments test.
* 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'.
* libguile/random.c (random_state_of_last_resort): Simplify optional
inclusion of PID in the random state. Clarify in the comments that
the PID is only included where scm_getpid is present.
* doc/ref/api-data.texi (Random): Clarify that
'random-state-from-platform' includes the PID in the random state only
if scm_getpid is present.
* module/ice-9/iconv.scm (call-with-encoded-output-string):
(string->bytevector, bytevector->string): Take an optional instead of
a keyword argument.
* doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to
change, and fix a number of errors. Thanks to Ludovic Courtès for the
pointers.
* test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for
the 'substitute path.
* libguile/srfi-13.c (string-split): Add support for splitting on
character sets and predicates, like string-index and others.
* test-suite/tests/strings.test (string-split): Add tests covering
the new argument types.
* doc/ref/api-data.texi (string-split): Update.
Signed-off-by: Mark H Weaver <mhw@netris.org>
* doc/ref/api-data.texi (String Comparison): Remove documentation for
scm_i_string{,_ci}_{equal,less,leq,gr,geq}_p, which are not only
internal functions but static, and thus unusable by external code.
* doc/ref/api-compound.texi
* doc/ref/api-evaluation.texi
* doc/ref/api-foreign.texi
* doc/ref/api-io.texi
* doc/ref/posix.texi
* doc/ref/srfi-modules.texi: Add missing parentheses and commas to definitions
of C functions.
* doc/ref/api-data.texi: Change from @deffn to @deftypefn for C function
with arguments not of SCM type.
* doc/ref/api-data.texi (String Modification): Change
(define y "abcdefg") => (define y (string-copy "abcdefg"))
before mutating the string bound to y in the example code.
Reported by Dmitry Chestnykh <dmitry@codingrobots.com>.
Fixes <http://debbugs.gnu.org/10070>.
* libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not
`memcpy'.
* test-suite/tests/bytevectors.test ("2.2 General
Operations")["bytevector-copy! overlapping"]: New test.
* doc/ref/api-data.texi (Bytevector Manipulation): Mention possible
overlapping.
* 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
* doc/ref/api-data.texi (Conversion to/from C): In descriptions of
scm_to_stringn and scm_to_{latin1,utf8,utf32}, clarify that the
returned length is in units of bytes or code points, not characters.
Also change NULL to @code{NULL} in a few places.
* 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.
* doc/ref/api-data.texi (Arithmetic): `floor-remainder' is equivalent to
the R5RS `modulo' when the arguments are integers. Previously,
equivalence was claimed only for exact integers. Similarly for
`truncate-quotient' and `truncate-remainder' compared with the R5RS
`quotient' and `remainder'.
* libguile/strings.c (scm_to_locale_stringn, scm_from_locale_stringn):
Use the encoding of the current locale, not of the current i/o ports.
Also use the current conversion strategy.
* doc/ref/api-data.texi (Conversion to/from C): Update docs.
* libguile/keywords.c (scm_from_latin1_keyword, scm_from_utf8_keyword):
New functions appropriate for use when keyword name is a constant.
(scm_from_locale_keyword, scm_from_locale_keywordn): Change formal
parameter from `str' to `name'.
* libguile/keywords.h: Add prototypes for new functions. Change formal
parameter of scm_from_locale_keyword* from `str' to `name'.
* doc/ref/api-data.texi: Document new functions. Remind users that
scm_from_locale_keyword should not be used when the name is a C string
constant. Change formal parameter from `str' to `name'.
* doc/ref/api-data.texi (Conversion to/from C): Document
scm_from_latin1_string, scm_from_utf8_string, and
scm_from_utf32_string. Remind readers that these functions should be
used to convert C string constants, and that scm_from_locale_string is
_not_ appropriate for that purpose.
(Symbol Primitives): Document scm_from_latin1_symbol and
scm_from_utf8_symbol. Remind readers that these functions should be
used when the specified names are C string constants, and that
scm_from_locale_symbol is _not_ appropriate for that purpose.
* doc/ref/api-data.texi (Arithmetic): The R5RS `quotient', `remainder',
and `modulo' operators are exact-integer-only operators. `modulo' is
equivalent to `floor-remainder', not `floor-quotient'.
* 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.