summaryrefslogtreecommitdiff
path: root/libguile/symbols.c
Commit message (Expand)AuthorAgeFilesLines
* Allow decoding of UTF-8 containing U+FFFD, the replacement character....* libguile/strings.c (scm_from_utf8_stringn): Use 'u8_mbtoucr' and check for a decoding error by its 'nbytes' return value. Previously we used 'u8_mbtouc' and improperly assumed that a U+FFFD character indicated a decoding error. * libguile/symbols.c (utf8_string_equals_wide_string): Likewise. * test-suite/tests/bytevectors.test (exception:decoding-error): New variable. ("2.9 Operations on Strings"): Add tests. Mark H Weaver2015-08-131-4/+4
* fix bug where scm_from_utf8_stringn would not detect bad utf-8...* libguile/strings.c (scm_from_utf8_stringn): * libguile/symbols.c (utf8_string_equals_wide_string): The "bad UTF8" return from u8_mbtouc is a 0xfffd character, not a negative byte length. Fixes a bug in which invalid UTF-8 would not be caught. * libguile/bytevectors.c (scm_utf8_to_string): Use scm_from_utf8_stringn directly. Just a little cleanup. * test-suite/tests/iconv.test ("narrow non-ascii string"): Add test for parsing bad utf-8 with substitution. Andy Wingo2013-01-151-2/+2
* Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c Andy Wingo2012-02-081-4/+5
|\
| * Improve the usage of variable names in C docstrings....* libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/generalized-arrays.c: * libguile/hashtab.c: * libguile/ioext.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/procprop.c: * libguile/promises.c: * libguile/simpos.c: * libguile/socket.c: * libguile/srfi-1.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/symbols.c: * libguile/threads.c: * libguile/weak-table.c: * libguile/weak-vector.c: Make the variable names in the C docstrings more consistent. Replace a few instances of @var with @code when appropriate. Bake Timmons2012-02-021-4/+5
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: libguile/debug.h module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm module/language/tree-il/peval.scm module/language/tree-il/primitives.scm Andy Wingo2012-01-301-39/+11
|\|
| * Revert "Universally-unique gensyms"...This reverts commit ad432bc8317c33899efc29854550b67f3d7babf7. Not all gensyms need to be universally-unique: most of them just need to be unique within some portion of a Guile session. We'll take a different tack on this problem in the next commit. Andy Wingo2012-01-261-39/+11
* | Merge commit '3d51e57cfb0404db568a6adfde2a346d3fd9907e'...Conflicts: libguile/foreign.c libguile/hashtab.c module/ice-9/psyntax-pp.scm module/language/tree-il/compile-glil.scm Andy Wingo2012-01-301-11/+39
|\|
| * Universally-unique gensyms...* libguile/symbols.c (scm_gensym): Make the gensym counter a 128-bit thread-local, initialized to a random number upon the first call to `gensym' within a given thread. This counter is rendered as a 22 byte suffix of mostly base64 digits. * libguile/threads.h (scm_i_thread): Add a thread-local gensym_counter. * libguile/threads.c (guilify_self_1): Initialize gensym_counter to NULL. Mark H Weaver2012-01-211-11/+39
* | optimize utf8 symbol lookup...* libguile/symbols.c (utf8_string_equals_wide_string) (utf8_lookup_predicate_fn, lookup_interned_utf8_symbol): Optimize utf8 symbol lookup. Andy Wingo2011-10-251-2/+84
* | add SCM_{PACK,UNPACK}_POINTER...* libguile/tags.h (SCM_UNPACK_POINTER, SCM_PACK_POINTER): New macros. The old SCM2PTR and PTR2SCM were defined in such a way that round-tripping through a pointer could lose precision, even in the case in which you weren't interested in actually dereferencing the pointer, it was simply that you needed to plumb a SCM through APIs that take pointers. These new macros are more like SCM_PACK and SCM_UNPACK, but for pointer types. The bit representation of the pointer should be the same as the scm_t_bits representation. * libguile/gc.h (PTR2SCM, SCM2PTR): Remove support for (old) UNICOS pointers. We are going to try tagging the SCM object itself in the future, and I don't think that keeping this support is worth its cost. It probably doesn't work anyway. * libguile/backtrace.c: * libguile/bytevectors.c: * libguile/continuations.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/hashtab.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/smob.c: * libguile/strings.c: * libguile/symbols.c: * libguile/vm.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Update many sites to use the new macros. Andy Wingo2011-10-241-2/+2
* | symbols.c uses weak sets...* libguile/symbols.c (lookup_interned_symbol) (lookup_interned_latin1_symbol, intern_symbol): Adapt to use weak sets instead of weak-key hash tables. Andy Wingo2011-10-231-61/+30
|/
* really threadsafe access to symbol table...* libguile/symbols.c (symbols_lock): Rename from intern_lock. (lookup_interned_symbol, lookup_interned_latin1_symbol): Instead of faith-based programming, just use the mutex. Though I haven't seen this break, Ken is right! Andy Wingo2011-05-231-12/+7
* Slightly optimize `gensym'....* libguile/symbols.c (default_gensym_prefix): New variable. (scm_gensym): Use it. Use `scm_from_latin1_stringn' instead of `scm_from_locale_stringn'. (scm_init_symbols): Initialize DEFAULT_GENSYM_PREFIX. Ludovic Courtès2011-03-061-5/+11
* optimize scm_from_latin1_symboln...* libguile/symbols.c (lookup_interned_latin1_symbol): New helper. (scm_from_latin1_symboln): Use lookup_interned_latin1_symbol, so we avoid allocating a string in that case. Andy Wingo2011-01-071-2/+58
* lookup_interned_symbol uses get_handle_by_hash...* libguile/symbols.c (lookup_interned_symbol): Change to use scm_hash_fn_get_handle_by_hash. Andy Wingo2011-01-071-28/+18
* fix symbol garbage collection...* libguile/symbols.c (lookup_interned_symbol, intern_symbol): Refactor to use hashtab.[ch] interfaces. Andy Wingo2011-01-071-106/+86
* add scm_from_{latin1,utf8}_symbol{n,}...* libguile/symbols.c (scm_from_latin1_symbol, scm_from_latin1_symboln) (scm_from_utf8_symbol, scm_from_utf8_symboln): New functions. Andy Wingo2011-01-071-0/+26
* 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ès2009-08-281-67/+43
|\
| * Add initial support for wide symbols...* libguile/hash.c (scm_i_string_hash): new function (scm_hasher): don't unpack string: use scm_i_string_hash * libguile/hash.h: new declaration for scm_i_string_hash * libguile/print.c (quote_keywordish_symbol): use symbol accessors (scm_i_print_symbol_name): new function (scm_print_symbol_name): call scm_i_print_symbol_name (iprin1): use scm_i_print_symbol_name to print symbols * libguile/print.h: new declaration for scm_i_print_symbol_name * libguile/symbols.c (lookup_interned_symbol): now takes scheme string instead of c string; callers changed (lookup_interned_symbol): add wide symbol support (scm_i_c_mem2symbol): removed (scm_i_mem2symbol): removed and replaced with scm_i_str2symbol (scm_i_str2symbol): new function (scm_i_mem2uninterned_symbol): removed and replaced with scm_i_str2uninterned_symbol (scm_i_str2uninterned_symbol): new function (scm_make_symbol, scm_string_to_symbol, scm_from_locale_symbol) (scm_from_locale_symboln): use scm_i_str2symbol * test-suite/tests/symbols.test: new tests Michael Gran2009-08-211-67/+41
* | 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ès2009-08-181-6/+7
|\|
| * 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 Jerram2009-06-171-6/+7
* | Merge branch 'master' into boehm-demers-weiser-gc...Conflicts: libguile/continuations.c libguile/gc-freelist.c libguile/gc-mark.c libguile/symbols.c libguile/threads.c module/ice-9/boot-9.scm Ludovic Courtès2009-03-221-42/+42
|\|
| * Have `scm_take_locale_symbol ()' return an interned symbol (fixes bug #25865)....* libguile/symbols.c (intern_symbol): New function, with code formerly duplicated in `scm_i_c_mem2symbol ()' and `scm_i_mem2symbol ()'. (scm_i_c_mem2symbol, scm_i_mem2symbol): Use it. (scm_take_locale_symboln): Use `intern_symbol ()'. This fixes bug #25865. * test-suite/standalone/Makefile.am (test_scm_take_locale_symbol_SOURCES, test_scm_take_locale_symbol_CFLAGS, test_scm_take_locale_symbol_LDADD): New variables. (check_PROGRAMS, TESTS): Add `test-scm-take-locale-symbol'. Ludovic Courtès2009-03-191-42/+42
* | 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 Ludovic Courtès2008-09-131-1/+1
|\|
| * Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès2008-09-131-1/+1
* | Merge commit '032913739218c756f673bfb9c8f66ef9f8f02330' into boehm-demers-wei......Conflicts: libguile/gc.c libguile/srcprop.c libguile/srcprop.h Ludovic Courtès2008-09-101-0/+3
|\|
| * * backtrace.c, debug.c, debug.h, deprecation.c, eq.c, eval.c...eval.h, gsubr.c, init.c, macros.c, print.c, print.h, read.c, read.h, stacks.c, symbols.c, throw.c: use private-options.h * private-options.h: new file: contain hardcoded option definitions. Han-Wen Nienhuys2007-01-221-0/+3
* | Fixed symbols so that interned symbols are only weakly referenced....* libguile/symbols.c (lookup_interned_symbol): When a deleted weak pair is encountered, remove it and update the hashtable's item count. Also, check the hash table threshold and trigger a rehashing if needed. (scm_i_c_mem2symbol): Allocate CELL using `scm_weak_car_pair ()' rather than `scm_cons ()'. (scm_i_mem2symbol): Likewise. (scm_symbols_prehistory): Don't invoke `scm_permanent_object ()' for SYMBOLS. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-44 Ludovic Courtes2008-09-101-14/+34
* | Fixed a warning in `symbols.c'....* libguile/symbols.c (lookup_interned_symbol): When checking for `NULL', use `SCM2PTR' rather than `SCM_UNPACK' (this fixes a warning). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-31 Ludovic Courtes2008-09-051-1/+1
* | First stab at implementing weak hash tables and vectors. Unable to run the R......* libguile/hashtab.c (scm_weak_car_cell): New. (scm_weak_cdr_cell): New. (scm_doubly_weak_cell): New. (SCM_WEAK_CELL_WORD_DELETED_P): New. (SCM_WEAK_CELL_WORD): New. (scm_fixup_weak_alist): New. (make_hash_table): Always use non-weak vectors. Allocate `scm_t_hashtable' objects as pointerless. (scm_i_rehash): Always make NEW_BUCKETS a non-weak vector. (scm_hash_fn_get_handle): Call `scm_fixup_weak_alist ()' on weak buckets before calling ASSOC_FN. (scm_hash_fn_remove_x): Likewise. (scm_hash_fn_create_handle_x): Likewise. Also, use `scm_.*weak.*cell ()' for HANDLE when needed. * libguile/symbols.c (lookup_interned_symbol): Check for nullified pairs. * libguile/vectors.c (scm_vector_elements): Abort on weak vectors. (scm_vector_writable_elements): Likewise. (scm_c_vector_ref): Check whether the referenced element has been nullified. (scm_c_vector_set_x): Use `GC_GENERAL_REGISTER_DISAPPEARING_LINK ()'. (scm_i_allocate_weak_vector): Use `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when allocating room for the vector itself. * libguile/weaks.c (scm_make_weak_key_alist_vector): Use `scm_make_vector ()' instead of `scm_i_allocate_weak_vector ()'. (scm_make_weak_value_alist_vector): Likewise. (scm_make_doubly_weak_alist_vector): Likewise. (weak_vectors): Removed. (scm_i_init_weak_vectors_for_gc): Removed. (scm_i_mark_weak_vector): Removed. (scm_i_mark_weak_vector_non_weaks): Removed. (scm_i_mark_weak_vectors_non_weaks): Removed. (scm_i_remove_weaks_from_weak_vectors): Commented out. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-7 Ludovic Courtes2008-09-051-1/+12
|/
* merge from 1.8 branchKevin Ryde2006-04-171-1/+1
* patches by Ludovic Courtès for symbol generation.Han-Wen Nienhuys2006-01-241-32/+106
* The FSF has a new address.Marius Vollmer2005-05-231-1/+1
* See ChangeLog from 2005-03-02.Marius Vollmer2005-03-021-2/+2
* Reverted changed from 2005/01/24 19:14:54, which was a commit to the...wrong branch. Sorry. Marius Vollmer2005-01-241-2/+2
* Threading changes.Marius Vollmer2005-01-241-2/+2
* Use new vector elements API or simple vector API, as appropriate....Removed SCM_HAVE_ARRAYS ifdefery. Replaced all uses of SCM_HASHTABLE_BUCKETS with SCM_HASHTABLE_BUCKET. Marius Vollmer2005-01-021-2/+2
* *** empty log message ***Marius Vollmer2004-09-221-1/+1
* * strings.h, strings.c (scm_i_make_symbol): Added FLAGS parameter....* symbols.h, symbols.c (SCM_I_F_SYMBOL_UNINTERNED, scm_i_symbol_is_interned, scm_i_mem2symbol, scm_i_mem2uninternedsymbol): Use it to store uninternedness flag. Marius Vollmer2004-08-261-7/+5
* * symbols.h, symbols.c (scm_string_ci_to_symbol): Moved here, next...to scm_string_to_symbol. * deprecated.c, load.c, posix.c, unif.c, symbols.c: Include "srfi-13.h" instead of "strop.h". Marius Vollmer2004-08-241-0/+15
* * strings.h, strings.c: (scm_i_string_chars, scm_i_string_length,...scm_i_string_writable_chars, scm_i_string_stop_writing): New, to replace SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH. Updated all uses. (scm_i_make_string, scm_c_make_string): New, to replace scm_allocate_string. Updated all uses. (SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_UCHARS, SCM_STRING_LENGTH): Deprecated. (scm_allocate_string, scm_take_str, scm_take0str, scm_mem2string, scm_str2string, scm_makfrom0str, scm_makfrom0str_opt): Discouraged. Replaced all uses with scm_from_locale_string or similar, as appropriate. (scm_c_string_length, scm_c_string_ref, scm_c_string_set_x, scm_c_substring, scm_c_substring_shared, scm_c_substring_copy, scm_substring_shared, scm_substring_copy): New. * symbols.c, symbols.h (SCM_SYMBOLP, SCM_SYMBOL_FUNC, SCM_SET_SYMBOL_FUNC, SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS, SCM_SYMBOL_HASH, SCM_SYMBOL_INTERNED_P, scm_mem2symbol, scm_str2symbol, scm_mem2uninterned_symbol): Discouraged. (SCM_SYMBOL_LENGTH, SCM_SYMBOL_CHARS, scm_c_symbol2str): Deprecated. (SCM_MAKE_SYMBOL_TAG, SCM_SET_SYMBOL_LENGTH, SCM_SET_SYMBOL_CHARS, SCM_PROP_SLOTS, SCM_SET_PROP_SLOTS): Removed. (scm_is_symbol, scm_from_locale_symbol, scm_from_locale_symboln): New, to replace scm_str2symbol and scm_mem2symbol, respectively. Updated all uses. (scm_gensym): Generate only the number suffix in the buffer, just string-append the prefix. Marius Vollmer2004-08-191-119/+52
* * socket.c, rw.c, deprecated.h, validate.h...(SCM_VALIDATE_STRING_COPY): Deprecated. Replaced all uses with SCM_VALIDATE_STRING plus SCM_I_STRING_CHARS or scm_to_locale_string, etc. (SCM_VALIDATE_SUBSTRING_SPEC_COPY): Deprecated. Replaced as above, plus scm_i_get_substring_spec. * regex-posix.c, read.c, random.c, ramap.c, print.c, numbers.c, hash.c, gc.c, gc-card.c, convert.i.c, backtrace.c, strop.c, strorder.c, strports.c, struct.c, symbols.c, unif.c, ports.c: Use SCM_I_STRING_CHARS, SCM_I_STRING_UCHARS, and SCM_I_STRING_LENGTH instead of SCM_STRING_CHARS, SCM_STRING_UCHARS, and SCM_STRING_LENGTH, respectively. Also, replaced scm_return_first with more explicit scm_remember_upto_here_1, etc, or introduced them in the first place. Marius Vollmer2004-08-121-6/+7
* * numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,...scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num, scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long, scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num, scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long): Discouraged by moving to discouraged.h and discouraged.c and reimplementing in terms of scm_from_* and scm_to_*. Changed all uses to the new scm_from_* and scm_to_* functions. Marius Vollmer2004-08-021-1/+1
* (scm_gensym): Use scm_i_misc_mutex around gensym_counter...update, for thread safety. (gensym_counter): Move into scm_gensym which is its only user. (scm_init_symbols): No need to explicitly initialize gensym_counter. Kevin Ryde2004-07-311-5/+11
* * deprecated.h, deprecated.c, numbers.h (SCM_INUMP, SCM_NINUMP,...SCM_INUM): Deprecated by reenaming them to SCM_I_INUMP, SCM_I_NINUMP and SCM_I_INUM, respectively and adding deprecated versions to deprecated.h and deprecated.c. Changed all uses to either use the SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate. Marius Vollmer2004-07-231-1/+1
* * numbers.h (SCM_MAKINUM, SCM_I_MAKINUM): Renamed SCM_MAKINUM to...SCM_I_MAKINUM and changed all uses. Marius Vollmer2004-07-081-1/+1
* * deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL,...SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into "deprecated.h". Replaced all uses with scm_is_false, scm_is_true, scm_from_bool, and scm_is_bool, respectively. Marius Vollmer2004-07-061-2/+2
* Changed license terms to the plain LGPL thru-out.Marius Vollmer2003-04-051-36/+12
* * symbols.c: #include <config.h> if HAVE_CONFIG_H.Rob Browning2003-03-261-0/+3
* * environments.c (DEFAULT_OBARRAY_SIZE): Changed from 137 to 31...(since hash tables now adapt their size). * modules.c (scm_modules_prehistory): Changed from 2001 to 1533 (current number of prehistory bindings; hashtable code will select a prime which is greater than this value). * symbols.c (scm_symbols_prehistory): Changed from 1009 to 2139 (current number of initial symbols). * properties.c (scm_init_properties): Don't specify size of scm_properties_whash. * objprop.c (scm_init_objprop): Don't specify size of scm_object_whash. * keywords.c (scm_init_keywords): Don't specify a hash table size. Mikael Djurfeldt2003-02-191-1/+1