| Commit message (Expand) | Author | Age | Files | Lines |
* | Stringbufs immutable by default...* libguile/snarf.h (SCM_IMMUTABLE_STRINGBUF): Remove shared flag.
Stringbufs are immutable by default.
* libguile/strings.c: Rewrite blurb. Change to have stringbufs be
immutable by default and mutable only when marked as such. Going
mutable means making a private copy.
(STRINGBUF_MUTABLE, STRINGBUF_F_MUTABLE): New definitions.
(SET_STRINGBUF_SHARED): Remove.
(scm_i_print_stringbuf): Simplify to just alias the stringbuf as-is.
(substring_with_immutable_stringbuf): New helper.
(scm_i_substring, scm_i_substring_read_only, scm_i_substring_copy):
use new helper.
(scm_i_string_ensure_mutable_x): New helper.
(scm_i_substring_shared): Use scm_i_string_ensure_mutable_x.
(stringbuf_write_mutex): Remove; yaaaaaaaay.
(scm_i_string_start_writing): Use scm_i_string_ensure_mutable_x. No
more mutex.
(scm_i_string_stop_writing): Now a no-op.
(scm_i_make_symbol): Use substring/copy.
(scm_sys_string_dump, scm_sys_symbol_dump): Update.
* libguile/strings.h (SCM_I_STRINGBUF_F_SHARED): Remove.
(SCM_I_STRINGBUF_F_MUTABLE): Add.
* module/system/vm/assembler.scm (link-data): Don't add shared flag any
more. Existing compiled flags are harmless tho.
* test-suite/tests/strings.test ("string internals"): Update.
| Andy Wingo | 2017-02-16 | 1 | -1/+1 |
* | Implement 'string-utf8-length' and 'scm_c_string_utf8_length'....* libguile/strings.c (utf8_length, scm_c_string_utf8_length)
(scm_string_utf8_length): New functions.
* libguile/strings.h (scm_c_string_utf8_length, scm_string_utf8_length):
New prototypes.
* doc/ref/api-data.texi (Bytevectors as Strings): Add docs.
* doc/ref/guile.texi: Update manual copyright date to 2015.
* test-suite/tests/strings.test (string-utf8-length): Add tests.
| Mark H Weaver | 2016-05-22 | 1 | -1/+4 |
* | Port conversion strategies internally are symbols...* libguile/ports.h (scm_t_port): Represent the conversion strategy as a
symbol, to make things easier for Scheme. Rename to
"conversion_strategy".
(scm_c_make_port_with_encoding): Change to take encoding and
conversion_strategy arguments as symbols.
(scm_i_string_failed_conversion_handler): New internal helper, to turn
a symbol to a scm_t_string_failed_conversion_handler.
(scm_i_default_port_encoding): Return the default port encoding as a
symbol.
(scm_i_default_port_conversion_strategy)
(scm_i_set_default_port_conversion_strategy): Rename from
scm_i_default_port_conversion_handler et al. Take and return Scheme
symbols.
* libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Use
scm_i_default_string_failed_conversion_handler instead of
scm_i_default_port_conversion_handler.
* libguile/print.c (PORT_CONVERSION_HANDLER): Update definition.
(print_normal_symbol): Use PORT_CONVERSION_HANDLER.
* libguile/r6rs-ports.c (make_bytevector_input_port):
(make_custom_binary_input_port, make_bytevector_output_port): Adapt to
changes in scm_c_make_port_with_encoding.
* libguile/strings.h:
* libguile/strings.c (scm_i_default_string_failed_conversion_handler):
New helper.
(scm_from_locale_stringn, scm_from_port_stringn):
(scm_to_locale_stringn, scm_to_port_stringn): Adapt to interface
changes.
* libguile/strports.c (scm_mkstrport): Adapt to
scm_c_make_port_with_encoding change.
* libguile/ports.c (scm_c_make_port): Adapt to
scm_c_make_port_with_encoding change.
(ascii_toupper, encoding_matches, canonicalize_encoding): Move down in
the file.
(peek_codepoint, get_codepoint, scm_ungetc): Adapt to port conversion
strategy change. Remove duplicate case in get_codepoint.
(scm_init_ports): Move symbol initializations to the same place.
| Andy Wingo | 2016-05-04 | 1 | -0/+3 |
* | Add stringbuf printer...* libguile/strings.h:
* libguile/strings.c (scm_i_print_stringbuf):
* libguile/print.c (iprin1): Add a printer for stringbufs. The
disassembler can print a stringbuf.
| Andy Wingo | 2013-10-26 | 1 | -0/+2 |
* | add scm_from_port_string and friends...* doc/ref/api-data.texi (Conversion to/from C):
* libguile/strings.h:
* libguile/strings.c (scm_from_port_string, scm_from_port_stringn):
(scm_to_port_string, scm_to_port_stringn): New functions.
* guile-readline/readline.c (internal_readline):
* libguile/strports.c (scm_strport_to_string):
* libguile/read.c (scm_read_number, scm_read_mixed_case_symbol):
(scm_read_number_and_radix, scm_read_character): Use the new
functions.
| Andy Wingo | 2013-01-15 | 1 | -1/+6 |
* | Revert "wrap iconv_open / iconv_close with a lock to help in thread/fork issues"...This reverts commit 8dfb7bbfd908ca883d0fdd0d868e13e6b20803ae.
| Andy Wingo | 2012-02-23 | 1 | -4/+1 |
* | wrap iconv_open / iconv_close with a lock to help in thread/fork issues...* libguile/bytevectors.c (STRING_TO_UTF, scm_string_to_utf8)
(UTF_TO_STRING):
* libguile/ports.c (open_iconv_descriptors, close_iconv_descriptors):
* libguile/strings.c (scm_from_stringn, scm_to_stringn): Wrap operations
that acquire and destroy iconv contexts with a mutex. While iconv is
threadsafe, internally it uses a lock, and we need to make sure when
we fork() that no one has that lock -- so we surround it with another
one. Gross.
| Andy Wingo | 2012-02-17 | 1 | -1/+4 |
* | 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
| Andy Wingo | 2012-01-10 | 1 | -1/+1 |
|\ |
|
| * | Placate a number of `syntax-check' verifications.... - "filesystem" -> "file system"
- remove doubled words
- use EXIT_* macros instead of literal numbers
- update `syntax-check' exclusion files
| Ludovic Courtès | 2012-01-05 | 1 | -1/+1 |
* | | remove all deprecated code...* libguile/async.c:
* libguile/async.h:
* libguile/debug.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/evalext.h:
* libguile/gc-malloc.c:
* libguile/gc.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/ports.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/read.c:
* libguile/socket.c:
* libguile/srfi-4.h:
* libguile/strings.c:
* libguile/strings.h:
* libguile/tags.h:
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm: Remove all deprecated code. CPP defines
that were not previously issuing warnings were changed so that their
expansions would indicate the replacement forms to use,
e.g. scm_sizet__GONE__REPLACE_WITH__size_t.
The two exceptions were SCM_LISTN, which did not produce warnings
before, and the string-filter argument order stuff.
Drops the initial dirty memory usage of Guile down to 2.8 MB on my
machine, from 4.4 MB.
| Andy Wingo | 2011-05-12 | 1 | -15/+0 |
|/ |
|
* | Make VM string literals immutable....* libguile/strings.c (scm_i_make_string, scm_i_make_wide_string): Add
`read_only_p' parameter. All callers updated.
* libguile/vm-i-loader.c (load_string, load_wide_string): Push read-only
strings.
* test-suite/tests/strings.test ("literals"): New test prefix.
| Ludovic Courtès | 2011-03-20 | 1 | -2/+5 |
* | Change `scm_encoding_error' to pass the port and faulty character....* libguile/strings.c (scm_encoding_error): Remove the `from', `to', and
`string_or_bv' parameters; add `port' and `chr'.
(scm_to_stringn): Update accordingly.
* libguile/strings.h (scm_encoding_error): Update accordingly.
* libguile/ports.c (scm_ungetc): Update accordingly.
* libguile/print.c (iprin1, scm_write_char): Update accordingly.
* test-suite/tests/encoding-escapes.test ("display output
errors")["ultima", "Rashomon"]: Check the arguments of
`encoding-error'.
["tekniko"]: New test.
* test-suite/tests/ports.test ("string ports")["wrong encoding"]: Adjust
to new `encoding-error' arguments.
| Ludovic Courtès | 2011-02-02 | 1 | -3/+1 |
* | Have `read-char' & co. throw to `decoding-error'....* libguile/ports.c (scm_read_char): Mention `decoding-error' in the
docstring.
(get_codepoint): Change to return an error code; add `codepoint'
output parameter. Don't raise an error from here.
(scm_getc): Raise an error with `scm_decoding_error' if
`get_codepoint' returns an error.
(scm_peek_char): Likewise. Update docstring.
* libguile/strings.c (scm_decoding_error_key): New variable.
(scm_decoding_error): New function.
(scm_from_stringn): Use `scm_decoding_error' instead of
`scm_encoding_error'.
* libguile/strings.h (scm_decoding_error): New declaration.
* test-suite/tests/ports.test ("string ports")["read-char, wrong
encoding, error"]: Change to expect `decoding-error'. Make sure PORT
points past the error.
["read-char, wrong encoding, escape"]: Likewise.
["peek-char, wrong encoding, error"]: New test.
* test-suite/tests/r6rs-ports.test ("7.2.11 Binary
Output")["put-bytevector with wrong-encoding string port"]: Change to
expect `decoding-error'.
("8.2.6 Input and output ports")["transcoded-port [error handling
mode = raise]"]: Likewise.
* test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding
error, substitute"]: New tests.
* doc/ref/api-io.texi (Reading): Update documentation of `read-char' and
`peek-char'.
(Line/Delimited): Update documentation of `read-line'.
| Ludovic Courtès | 2011-02-02 | 1 | -0/+2 |
* | Add `scm_{to,from}_utf32_string'....* libguile/strings.c (scm_from_utf32_string, scm_from_utf32_stringn,
scm_to_utf32_string, scm_to_utf32_stringn): New functions.
* libguile/strings.h (scm_from_utf32_string, scm_from_utf32_stringn,
scm_to_utf32_string, scm_to_utf32_stringn): New declarations.
* doc/ref/api-data.texi (Conversion to/from C): Document
`scm_{to,from}_{utf8,utf32}_stringn'.
| Ludovic Courtès | 2011-01-26 | 1 | -0/+5 |
* | Hide the string escaping hacks....* libguile/strings.c (scm_i_unistring_escapes_to_guile_escapes): Rename
to...
(unistring_escapes_to_guile_escapes): ... this. Make `static'.
(scm_i_unistring_escapes_to_r6rs_escapes): Rename to...
(unistring_escapes_to_r6rs_escapes): ... this. Make `static'.
* libguile/strings.h (scm_i_unistring_escapes_to_guile_escapes,
scm_i_unistring_escapes_to_r6rs_escapes): Remove declarations.
| Ludovic Courtès | 2011-01-23 | 1 | -4/+0 |
* | add scm_{to,from}_{utf8,latin1}_string{n,}...* libguile/strings.h:
* libguile/strings.c (scm_from_latin1_string, scm_to_latin1_string): New
functions, in terms of the latin1_stringn variants.
(scm_from_utf8_string, scm_from_utf8_stringn)
(scm_to_utf8_string, scm_to_utf8_stringn): New functions.
(scm_i_from_utf8_string, scm_i_to_utf8_string): Removed these internal
functions.
(scm_from_stringn): Handle -1 as a length. Unlike the previous
behavior of scm_from_locale_string (NULL), which returned the empty
string, we now raise an error. The null pointer is not the same as
the empty string.
* libguile/stime.c (scm_strftime, scm_strptime): Adapt to publishing of
utf8 functions.
| Andy Wingo | 2011-01-07 | 1 | -5/+18 |
* | Remove conflicting `scm_is_string' declaration....* libguile/strings.h: Move `scm_is_string' declaration...
* libguile/inline.h: ... here.
Reported by Noah Lavine <noah.b.lavine@gmail.com>.
| Ludovic Courtès | 2010-12-17 | 1 | -1/+0 |
* | Internally expose `scm_i_unistring_escapes_to_{guile,r6rs}_escapes'....* libguile/strings.c (unistring_escapes_to_guile_escapes): Rename to...
(scm_i_unistring_escapes_to_guile_escapes): ... this. Change `char **bufp'
to `char *buf'; leave realloc responsibility to the caller. Update caller.
(unistring_escapes_to_r6rs_escapes): Rename to...
(scm_i_unistring_escapes_to_r6rs_escapes): ... this. Likewise.
| Ludovic Courtès | 2010-09-14 | 1 | -0/+4 |
* | Provide non-locale C/Scheme string conversion functions...* doc/ref/api-data.texi: document scm_to_stringn, scm_from_stringn,
scm_to_latin1_stringn, and scm_from_latin1_stringn
* libguile/strings.h (scm_to_stringn): make public
(scm_to_latin1_stringn): new declaration
(scm_from_latin1_stringn): new declaration
* libguile/strings.c (scm_to_latin1_stringn): new function
(scm_from_latin1_stringn): new function
| Michael Gran | 2010-09-12 | 1 | -8/+8 |
* | Expose `scm_encoding_error'....* libguile/strings.c (scm_encoding_error): Make public.
* libguile/strings.h (scm_encoding_error): New internal declaration.
| Ludovic Courtès | 2010-07-15 | 1 | -0/+4 |
* | Add `scm_i_string_data'....* libguile/strings.c (STRINGBUF_CONTENTS): New macro.
(STRINGBUF_CHARS, STRINGBUF_WIDE_CHARS): Use it.
(scm_i_string_data): New function.
* libguile/strings.h (scm_i_string_data): New declaration.
| Ludovic Courtès | 2010-07-04 | 1 | -1/+3 |
* | Support for Unicode string normalization functions...* libguile/strings.c, libguile/strings.h (normalize_str,
scm_string_normalize_nfc, scm_string_normalize_nfd, scm_normalize_nfkc,
scm_string_normalize_nfkd): New functions.
* test-suite/tests/strings.test: Unit tests for `string-normalize-nfc',
`string-normalize-nfd', `string-normalize-nfkc', and
`string-normalize-nfkd'.
* doc/ref/api-data.texi (String Comparison): Documentation for normalization
functions.
| Julian Graham | 2010-01-03 | 1 | -0/+5 |
* | 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.
| Andy Wingo | 2009-12-05 | 1 | -0/+2 |
* | 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.
| Ludovic Courtès | 2009-11-17 | 1 | -1/+1 |
* | Merge branch 'bdw-gc-static-alloc'...Conflicts:
acinclude.m4
libguile/__scm.h
libguile/bdw-gc.h
libguile/eval.c
| Ludovic Courtès | 2009-11-01 | 1 | -0/+11 |
|\ |
|
| * | Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc...Conflicts:
acinclude.m4
libguile/strings.c
| Ludovic Courtès | 2009-09-02 | 1 | -29/+73 |
| |\ |
|
| * \ | Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc | Ludovic Courtès | 2009-01-19 | 1 | -1/+0 |
| |\ \ |
|
| * | | | Expose some of the string/stringbuf internal flags and tags....* libguile/strings.h (scm_tc7_ro_string, SCM_I_STRINGBUF_F_SHARED,
SCM_I_STRINGBUF_F_INLINE): New macros.
* libguile/strings.c (STRINGBUF_F_SHARED): Alias for
`SCM_I_STRINGBUF_F_SHARED'.
(STRINGBUF_F_INLINE): Alias for `SCM_I_STRINGBUF_F_INLINE'.
(RO_STRING_TAG): Alias for `scm_tc7_ro_string'.
| Ludovic Courtès | 2009-01-13 | 1 | -1/+12 |
* | | | | Use `SCM_DEPRECATED' in declarations of deprecated functions/variables....* libguile/deprecated.c (SCM_BUILDING_DEPRECATED_CODE): New macro.
* libguile/async.c (SCM_BUILDING_DEPRECATED_CODE): Likewise.
* libguile/macros.c (SCM_BUILDING_DEPRECATED_CODE): Likewise.
* libguile/async.h, libguile/deprecated.h, libguile/eval.h,
libguile/gc.h, libguile/gc.h, libguile/macros.h, libguile/ports.h,
libguile/srfi-4.h, libguile/strings.h: Change declarations of
deprecated functions and variables to use `SCM_DEPRECATED' instead of
`SCM_API'.
| Ludovic Courtès | 2009-10-02 | 1 | -3/+3 |
* | | | | Merge branch 'master' into boehm-demers-weiser-gc...Conflicts:
libguile/gc_os_dep.c
| Ludovic Courtès | 2009-09-09 | 1 | -0/+4 |
|\ \ \ \
| |_|_|/
|/| | | |
|
| * | | | Make scm_i_from_stringn into API for use with libguilereadline...* libguile/strings.c (scm_i_from_stringn): renamed to scm_from_stringn.
All callers changed.
* libguile/strings.h: change declaration of scm_i_from_stringn to
scm_from_stringn
* libguile/strports.c (scm_strport_to_string): scm_i_from_stringn ->
scm_from_stringn
* guile-readline/readline.c (internal_readline): scm_i_from_stringn ->
scm_from_stringn
| Michael Gran | 2009-09-09 | 1 | -2/+2 |
| * | | | Fix broken interaction between readline and Unicode...This requires separate small fixes.
Readline has internal logic to deal with multi-byte characters, so
it wants bytes, not characters.
scm_c_read gets called by the vm when readline is activated, and it was
truncating multi-byte characters because soft ports didn't have the
UCS-4 capability.
Soft ports need the capability to read UCS-4 characters. Since soft ports
may have a single byte buffer, full characters need to be stored into the
pushback buffer.
This broke the optimizations in scm_c_read for using an alternate buffer
for single-byte-buffered ports, because the opimization wasn't expecting
anything in the pushback buffer.
* libguile/vports.c (sf_fill_input): store complete chars, not single bytes
* libguile/ports.c (scm_c_read): don't use optimized path for non Latin-1.
Add debug prints.
* libguile/string.h: make scm_i_from_stringn and scm_i_string_ref public
so that readline can use them
* guile-readline/readline.c: read bytes, not complete chars, from the
input port. Convert output to the output port's locale
| Michael Gran | 2009-09-07 | 1 | -2/+2 |
| * | | | Fix encoding errors with strings returned by string ports...String ports, being 8-bit, store strings using the character encoding
of the port. This fixes a bug where the default character encoding, and
not the port's encoding, was being used to convert the string port data
back to a string.
* libguile/strports.c: extra comments
(scm_strport_to_string): use port's encoding when converting port data
to a string
* libguile/strings.c (scm_i_from_stringn): renamed from scm_from_stringn
and made internal. All callers changed.
(scm_from_stringn): renamed to scm_i_from_stringn.
* libguile/strings.h: declaration for scm_i_from_stringn
| Michael Gran | 2009-08-30 | 1 | -0/+4 |
* | | | | Fix leaky handling of `scm_take_locale_{symbol,string} ()'....* libguile/strings.c (scm_i_take_stringbufn, scm_i_c_take_symbol):
Remove.
(scm_take_locale_stringn): Rewrite in terms of `scm_from_locale_stringn ()'.
* libguile/strings.h (scm_i_c_take_symbol, scm_i_take_stringbufn):
Remove declarations.
| Ludovic Courtès | 2009-09-01 | 1 | -4/+0 |
* | | | | 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
| Ludovic Courtès | 2009-08-28 | 1 | -1/+6 |
|\| | | |
|
| * | | | 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 | -0/+1 |
| * | | | Modify socket and time functions for wide strings...* libguile/socket.c (scm_recv): receive the message without holding the
stringbuf writing lock
(scm_send): try to narrow a string before using it
* libguile/stime.c (strftime): convert string to UTF-8 so that it can
be safely passed to strftime
(strptime): convert input string to UTF-8 so that it can be safely
passed through strptime
* libguile/strings.c (narrow_stringbuf): new function
(scm_i_try_narrow_string): new function
* libguile/strings.h: new declaration for scm_i_try_narrow_string
| Michael Gran | 2009-08-23 | 1 | -0/+3 |
| * | | | 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 |
| * | | | Rename string-width to string-bytes-per-char...* libguile/strings.h: rename scm_string_width to scm_string_bytes_per_char
* libguile/strings.c (scm_string_width): renamed to scm_string_bytes_per_char
(scm_string_bytes_per_char): renamed from scm_string_width
* module/language/assembly/compile-bytecode.scm (write-bytecode): string-width
-> string-bytes-per-char
* module/language/glil/compile-assembly.scm (dump-object): string-width
-> string-bytes-per-char
| Michael Gran | 2009-08-19 | 1 | -1/+1 |
* | | | | 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
| Ludovic Courtès | 2009-08-18 | 1 | -24/+67 |
|\| | |
| |_|/
|/| | |
|
| * | | Don't include libunistring headers in Guile public headers...This requres the creation of a new type
scm_t_string_failed_conversion_handler to replace libunistring's
enum iconveh_ilseq_handler.
* libguile/strings.h: don't include <uniconv.h>
(scm_t_string_failed_conversion_handler): new enum type
(SCM_FAILED_CONVERSION_ERROR, SCM_FAILED_CONVERSION_QUESTION_MARK):
(SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE): new enum type values
* libguile/strings.c (scm_to_stringn): now takes type
scm_t_string_failed_conversion_handler. All callers changed.
* libguile/print.c: include <uniconv.h>
* libguile/ports.c (scm_lfwrite_substr): use
scm_t_string_conversion_handler's constants
* libguile/gen-scmconfig.c (SCM_ICONVEH_ERROR):
(SCM_ICONVEH_QUESTION_MARK, SCM_ICONVEH_ESCAPE_SEQUENCE): store
iconveh_ilseq_hander constants as #define's
| Michael Gran | 2009-08-12 | 1 | -3/+12 |
| * | | Make scm_charprint and scm_i_string_wide_chars SCM_INTERNAL....Also, scm_charprint is renamed to scm_i_charprint.
* libguile/strings.h: make scm_i_string_wide_chars internal.
* libguile/print.h: rename scm_charprint to scm_i_charprint. Make
internal.
* libguile/print.c (scm_i_charprint): renamed from scm_charprint
(scm_charprint): renamed to scm_i_charprint. All callers changed.
| Michael Gran | 2009-08-10 | 1 | -1/+1 |
| * | | Improve %string-dump and %symbol-dump...%string-dump and %symbol-dump are modified to return assocation lists
of string and symbol attributes instead of printing to stderr. They
are no longer conditional on SCM_DEBUG.
* libguile/strings.c (scm_sys_string_dump)
(scm_sys_symbol_dump): now returns alist of properties. No longer
require that SCM_DEBUG be defined.
(scm_sys_stringbuf_hist): now conditional on
SCM_STRING_LENGTH_HISTOGRAM
* libguile/strings.h: scm_sys_string_dump and scm_sys_symbol dump
are now declared as API
| Michael Gran | 2009-08-10 | 1 | -0/+8 |
| * | | Add Unicode strings and symbols...This adds full Unicode strings as a datatype, and it adds some
minimal functionality. The terminal and port encoding is assumed
to be ISO-8859-1. Non-ISO-8859-1 characters are written or
input as string character escapes.
The string character escapes now have 3 forms: \xXX \uXXXX and
\UXXXXXX, for unprintable characters that have 2, 4 or 6 hex digits.
The process for writing to strings has been modified. There is now a
function scm_i_string_start_writing that does the copy-on-write
conversion if necessary.
To compile strings that may be wide, the VM storage of strings and
string-likes has changed.
Most string-using functions have not yet been updated and may break
when used with wide strings.
* module/language/assembly/compile-bytecode.scm (write-bytecode):
use variable width string bytecode format
* module/language/assembly.scm (byte-length): use variable width
bytecode format
* libguile/vm-i-loader.c (load-string, load-symbol):
(load-keyword, define): use variable-width bytecode format
* libguile/vm-engine.h (FETCH_WIDTH): new macro
* libguile/strings.h: new declarations
* libguile/strings.c (make_wide_stringbuf): new function
(widen_stringbuf): new function
(scm_i_make_wide_string): new function
(scm_i_is_narrow_string): new function
(scm_i_string_wide_chars): new function
(scm_i_string_start_writing): new function
(scm_i_string_ref): new function
(scm_i_string_set_x): new function
(scm_i_is_narrow_symbol): new function
(scm_i_symbol_wide_chars, scm_i_symbol_ref): new function
(scm_string_width): new function
(unistring_escapes_to_guile_escapes): new function
(scm_to_stringn): new function
(scm_i_stringbuf_free): modify for wide strings
(scm_i_substring_copy): modify for wide strings
(scm_i_string_chars, scm_string_append): modify for wide strings
(scm_i_make_symbol, scm_to_locale_stringn): modify for wide strings
(scm_string_dump, scm_symbol_dump, scm_to_locale_stringbuf):
(scm_string, scm_i_deprecated_string_chars): modify for wide strings
(scm_from_locale_string, scm_from_locale_stringn): add null test
* libguile/srfi-13.c: add calls for scm_i_string_start_writing for
each call of scm_i_string_stop_writing
(scm_string_for_each): modify for wide strings
* libguile/socket.c: add calls for scm_i_string_start_writing for each
call of scm_i_string_stop_writing
* libguile/rw.c: add calls for scm_i_string_start_writing for each
call of scm_i_string_stop_writing
* libguile/read.c (scm_read_string): allow reading of wide strings
* libguile/print.h: add declaration for scm_charprint
* libguile/print.c (iprin1): print wide strings and add new string
escapes
(scm_charprint): new function
* libguile/ports.h: new declarations for scm_lfwrite_substr and
scm_lfwrite_str
* libguile/ports.c (update_port_lf): new function
(scm_lfwrite): use update_port_lf
(scm_lfwrite_substr): new function
(scm_lfwrite_str): new function
* test-suite/tests/asm-to-bytecode.test ("compiler"): add string
width byte to sting-like asm tests
| Michael Gran | 2009-08-08 | 1 | -17/+42 |
| * | | 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 |
* | | | Use `scm_gc malloc_pointerless ()' in `scm_i allocate_string_pointers ()'....* libguile/dynl.c (free_string_pointers): Remove.
(scm_dynamic_args_call): Remove reference to `free_string_pointers ()'
and remove dynwind.
* libguile/posix.c (free_string_pointers): Remove.
(scm_execl, scm_execlp, scm_execle, scm_environ): Remove references
to `free_string_pointers ()'.
* libguile/simpos.c (free_string_pointers): Remove.
(scm_system_star): Remove reference to `free_string_pointers ()',
remove enclosing dynwind.
* libguile/strings.c (scm_i_allocate_string_pointers): Use
`scm_gc_malloc_pointerless ()' and `scm_gc_malloc ()'
instead of `scm_malloc ()' and `scm_to_locale_string ()',
so that the result is automatically GC'd when no longer
referenced. Remove unneeded dynwind.
(scm_i_free_string_pointers): Remove.
* libguile/strings.h (scm_i_free_string_pointers): Remove declaration.
| Ludovic Courtès | 2009-01-18 | 1 | -1/+0 |
| |/
|/| |
|
* | | Merge branch 'master' into boehm-demers-weiser-gc...Conflicts:
libguile/Makefile.am
libguile/threads.c
| Ludovic Courtès | 2008-10-11 | 1 | -1/+0 |
|\| |
|
| * | Revert "Make literal strings (i.e., returned by `read') read-only."...This reverts commit fb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4.
The rationale is that `read' must return mutable strings, as reported
by szgyg <szgyg@ludens.elte.hu>.
| Ludovic Courtès | 2008-10-09 | 1 | -1/+0 |
* | | Merge branch 'master' into boehm-demers-weiser-gc | Ludovic Courtès | 2008-09-23 | 1 | -0/+1 |
|\| |
|
| * | Make literal strings (i.e., returned by `read') read-only....* libguile/read.c (scm_read_string): Use `scm_i_make_read_only_string ()' to
return a read-only string, as mandated by R5RS. Reported by Bill
Schottstaedt <bil@ccrma.Stanford.EDU>.
* libguile/strings.c (scm_i_make_read_only_string): New function.
(scm_i_shared_substring_read_only): Special-case the empty string
so that the read-only and read-write empty strings are `eq?'. This
optimization is relied on by the `substring/shared' `empty string'
test case in `srfi-13.test'.
* libguile/strings.h (scm_i_make_read_only_string): New declaration.
* test-suite/tests/strings.test ("string-set!")["literal string"]: New test.
* NEWS: Update.
| Ludovic Courtès | 2008-09-23 | 1 | -0/+1 |