summaryrefslogtreecommitdiff
path: root/libguile/chars.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-14Merge branch 'stable-2.0'Mark H Weaver1-4/+26
Conflicts: libguile/chars.c libguile/read.c test-suite/tests/reader.test
2014-01-14Recognize 'escape' character name, per R7RS.Mark H Weaver1-3/+25
* libguile/chars.c (scm_r7rs_charnames, scm_r7rs_charnums): New static constants. (SCM_N_R7RS_CHARNAMES): New macro. (scm_i_charname, scm_i_charname_to_char): Adapt to new R7RS char names. * doc/ref/api-data.texi (Characters): Document #\escape. * test-suite/tests/reader.test ("reading"): Add test.
2011-10-25most uses of scm_from_locale_symbol become scm_from_utf8_symbolAndy Wingo1-2/+2
* libguile/array-handle.c: * libguile/chars.c: * libguile/expand.c: * libguile/feature.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/instructions.c: * libguile/load.c: * libguile/macros.c: * libguile/memoize.c: * libguile/modules.c: * libguile/options.c: * libguile/print.c: * libguile/smob.c: * libguile/snarf.h: Change most uses of scm_from_locale_symbol to scm_from_utf8_symbol, as the symbols really are not locale-dependent.
2011-02-09fix typos in the manual bits generated from source comments.Ralf Wildenhues1-1/+1
* libguile/bitvectors.c, libguile/chars.c, libguile/deprecated.c, libguile/numbers.c, libguile/random.c, libguile/read.c, libguile/root.c, libguile/srfi-1.c, libguile/srfi-13.c, libguile/srfi-14.c, libguile/uniform.c: Fix typos, add missing newlines.
2010-01-10Add R6RS character namesMichael Gran1-6/+30
R6RS adds new names for some of the control characters. * libguile/chars.c (scm_r6rs_charnames, scm_r6rs_charnums) (SCM_N_R6RS_CHARNAMES): new character name constants (scm_alt_charnames, scm_alt_charnums): modified to remove duplicates (scm_i_charname, scm_i_charname_to_char): use new constants * test-suite/tests/chars.test (R5RS character names, R6RS character names): new tests * doc/ref/api-data.texi (Characters): updated
2010-01-07provide missing prototypesAndy Wingo1-1/+11
* libguile/array-map.c: * libguile/chars.c: * libguile/eq.c: * libguile/strorder.c: Provide declarations missing after the asubrs/rpsubrs -> gsubr conversion.
2009-12-27Incorrect indexing into character name listMichael Gran1-1/+3
When converting a character into a character name, an incorrect character name could theoretically have been returned. * libguile/chars.c (scm_i_charname): used wrong index into scm_alt_charnames
2009-12-24Support for Unicode general categoriesJulian Graham1-0/+20
* libguile/chars.c, libguile/chars.h (scm_char_general_category): New function. * test-suite/tests/chars.test: Unit tests for `char-general-category'. * doc/ref/api-data.texi (Characters): Documentation for `char-general-category'.
2009-12-22Improved support for Unicode title case in Guile's string and character APIs.Julian Graham1-1/+16
* doc/ref/api-data.texi (Characters): Documentation for `char-titlecase'. * doc/ref/api-i18n.texi (Character Case Mapping): Documentation for `char-locale-titlecase' and `string-locale-titlecase'. * libguile/chars.c, libguile/chars.h (scm_char_titlecase, scm_c_titlecase): New functions. * libguile/i18n.c, libguile/i18n.h (chr_to_case, scm_char_locale_titlecase, str_to_case, scm_string_locale_titlecase): New functions. * libguile/i18n.c (scm_char_locale_downcase, scm_char_locale_upcase, scm_string_locale_downcase, scm_string_locale_upcase): Refactor to share code via chr_to_case and str_to_case, as appropriate. * module/ice-9/i18n.scm (char-locale-title-case, string-locale-titlecase): New functions. * libguile/srfi-13.c (string_titlecase_x): Use uc_totitle instead of uc_toupper. * test-suite/tests/chars.test: Tests for `char-titlecase'. * test-suite/tests/i18n.test: Tests for `char-locale-titlecase' and `string-locale-titlecase'. * test-suite/tests/srfi-13.test: Tests for `string-titlecase'.
2009-12-04remove rpsubrsAndy Wingo1-52/+222
* 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-09-03Update docs and docstrings for Unicode charactersMichael Gran1-21/+23
* doc/ref/api-data.texi: more info about characters and codepoints * libguile/chars.c: replace 'code point' with 'Unicode code point' in docstrings
2009-08-30Update docs for Unicode charactersMichael Gran1-31/+33
* NEWS: add note about Unicode characters * doc/ref/api-data.texi: update Characters subsection * libguile/chars.c: update docstrings to match manual
2009-08-27Unicode-capable srfi-14 charsetsMichael Gran1-8/+2
* libguile/Makefile.am: distribute new files srfi-14.i.c and unidata_to_charset.pl * chars.c (scm_c_upcase, scm_c_downcase): use unicode-enable toupper and tolower * libguile/srfi-14.h (scm_t_char_range, scm_t_char_set): new structures to describe char-sets (scm_t_char_set_cursor): new structure to describe char-set-cursors (SCM_BITS_PER_LONG): removed (SCM_CHARSET_GET): calls function New declarations for scm_i_charset_get, scm_i_charset_set, scm_i_charset_unset, and scm_debug_char_set. * test-suite/tests/srfi-14.test: new tests * libguile/srfi-14.c (SCM_CHARSET_DATA): new macro (SCM_CHARSET_SET, SCM_CHARSET_UNSET): call function (BYTES_PER_CHARSET, LONGS_PER_CHARSET): removed (scm_i_charset_get, scm_i_charset_set, scm_i_charset_unset) (charsets_equal, charsets_leq, charsets_union) (charsets_intersection, charsets_complement, charsets_xor): new functions that are low-level charset operators (charset_print, charset_free): modified for new charset struct (charset_cursor_print, charset_cursor_free): new function (make_char_set, scm_char_set_p, scm_char_set_eq, scm_car_set_leq) (scm_char_set_hash, scm_char_set_cursor, scm_char_set_ref) (scm_char_set_cursor_next, scm_end_of_char_set_p, scm_char_set_fold) (scm_char_set_unfold, scm_char_set_unfold_x, scm_char_set_for_each) (scm_char_set_map, scm_char_set_copy, scm_char_set, scm_list_to_char_set) (scm_list_to_char_set_x, scm_string_to_char_set, scm_string_to_char_set_x) (scm_char_set_filter, scm_char_set_filter_x, scm_ucs_range_to_char_set) (scm_ucs_range_to_char_set_x, scm_to_char_set, scm_char_set_size) (scm_char_set_count, scm_char_set_to_list, scm_char_set_to_string) (scm_char_set_contains_p, scm_char_set_every, scm_char_set_any) (scm_char_set_adjoin, scm_char_set_delete, scm_char_set_adjoin_x) (scm_char_set_delete_x, scm_char_set_complement, scm_char_set_union) (scm_char_set_intersection, scm_char_set_difference, scm_char_set_xor) (scm_char_set_diff_plus_intersection, scm_char_set_complement_x) (scm_char_set_union_x, scm_char_set_intersection_x, scm_char_set_difference_x) (scm_char_set_xor_x, scm_char_set_diff_plus_intersection_x): modified to use new charset and charset-cursor data structures (CSET_BLANK_PRED, CSET_SYMBOL_PRED, CSET_PUNCT_PRED, CSET_LOWER_PRED) (CSET_UPPER_PRED, CSET_LETTER_PRED, CSET_DIGIT_PRED, CSET_WHITESPACE_PRED) (CSET_CONTROL_PRED, CSET_HEX_DIGIT_PRED, CSET_ASCII_PRED, CSET_LETTER_PRED) (CSET_LETTER_AND_DIGIT_PRED, CSET_PRINTING_PRED, CSET_TRUE_PRED) (CSET_FALSE_PRED): removed (scm_srfi_14_compute_char_sets): removed - too slow to iterate over all of unicode at startup (scm_debug_char_set) [SCM_CHARSET_DEBUG]: new function
2009-08-11Quiet signed/unsigned comparison warnings in chars.[ch]Michael Gran1-2/+2
* libguile/chars.h (SCM_MAKE_CHAR): quiet signed/unsigned comparison warnings * libguile/chars.c (scm_i_charname): (scm_i_charname_to_char): quiet signed/unsigned comparison warnings
2009-08-11Revert to locale-dependent toupper and tolowerMichael Gran1-2/+8
To avoid leaving Guile in a broken state, the conversion from locale-dependent case modification to Unicode case modification should be an atomic commit * libguile/chars.c (scm_c_upcase): revert to locale-dependent toupper and tolower
2009-08-01Make charname declarations module-level and GCSMichael Gran1-48/+42
Charname array declarations are corrected for style and are made module-level. Array list length variables are replaced with macros. * libguile/chars.c: variable declaration fixes
2009-07-29Add 32-bit charactersMichael Gran1-30/+38
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-27Replace global charnames variables with accessorsMichael Gran1-51/+98
The global variables scm_charnames and scm_charnums are replaced with the accessor functions scm_i_charname and scm_i_charname_to_num. Also, the incomplete and broken EBCDIC support is removed. * libguile/print.c (iprin1): use new func scm_i_charname * libguile/read.c (scm_read_character): use new func scm_i_charname_to_num * libguile/chars.c (scm_i_charname): new function (scm_i_charname_to_char): new function (scm_charnames, scm_charnums): removed * libguile/chars.h: new declarations
2009-06-17Change Guile license to LGPLv3+Neil Jerram1-6/+7
(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
2008-09-13Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès1-1/+4
2006-04-17merge from 1.8 branchKevin Ryde1-1/+1
2005-05-23The FSF has a new address.Marius Vollmer1-1/+1
2004-11-04(scm_charnames, scm_charnums): Added "sp" as an alias for "space".Marius Vollmer1-2/+2
Thanks to Bruce Korb!
2004-08-24(scm_char_alphabetic_p, scm_char_numeric_p, scm_char_whitespace_p,Marius Vollmer1-25/+16
scm_upper_case_p, scm_lower_case_p, scm_char_is_both_p): Use scm_char_set_contains_p with the proper charset instead of libc functions.
2004-08-02* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,Marius Vollmer1-1/+1
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.
2004-07-27* tags.h, deprecated.h (SCM_EQ_P): Deprecated by moving it intoMarius Vollmer1-1/+1
deprecated.h. Replaced all uses with scm_is_eq.
2004-07-10* validate.h, deprecated.h (SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY,Marius Vollmer1-2/+1
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN, SCM_VALIDATE_INUM_MIN_COPY, SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF, SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE, SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the fixnum/bignum distinction visible. Changed all uses to scm_to_size_t or similar.
2004-07-06* deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL,Marius Vollmer1-17/+17
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.
2004-04-24(scm_char_upcase, scm_char_downcase, scm_c_upcase,Kevin Ryde1-26/+8
scm_c_downcase): Use ctype.h toupper and tolower. This will be useful in 8-bit locales, and ensures consistency with char-upper-case? and char-lower-case? which already use ctype.h. (scm_c_upcase_table, scm_c_downcase_table, scm_lowers, scm_uppers): Remove. (scm_tables_prehistory): Remove.
2004-04-06* srfi-13.c (s_scm_string_map): convert character to unsigned charHan-Wen Nienhuys1-18/+22
before converting to unsigned int. This prevents hi-bit ascii as being converted large integers. (string_upcase_x): change caller for scm_{up,down}case to scm_c_{up,down}case * chars.h (scm_init_chars): change scm_{upcase,downcase} to scm_c_{up,down}case. (SCM_MAKE_CHAR): add (unsigned char) cast. This prevents havoc when hi-bit ASCII is subjected to SCM_MAKE_CHAR().
2003-04-05Changed license terms to the plain LGPL thru-out.Marius Vollmer1-36/+12
2002-07-202002-07-20 Han-Wen <hanwen@cs.uu.nl>Han-Wen Nienhuys1-35/+35
* *.c: add space after commas everywhere. * *.c: use SCM_VECTOR_SET everywhere, where a vector is written. Document cases where SCM_WRITABLE_VELTS() is used. * vectors.h (SCM_VELTS): prepare for write barrier, and let SCM_VELTS() return a const pointer (SCM_VECTOR_SET): add macro. * autogen.sh (mscripts): find and check version number of autoconf. Complain if 2.53 is not found.
2002-03-14Retire inclusion guard macro SCM_MAGIC_SNARFER.Thien-Thi Nguyen1-2/+0
2001-08-01(scm_char_alphabetic_p, scm_char_numeric_p, scm_char_whitespace_p,Marius Vollmer1-6/+6
scm_char_upper_case_p, scm_char_lower_case_p, scm_char_is_both_p): Do not require characters to fulfill isascii in addition to the primary predicate.
2001-07-19 * alist.c, arbiters.c, async.h, backtrace.h, boolean.c, chars.c,Martin Grabmüller1-1/+1
chars.h, continuations.h, debug-malloc.h, dynl.c, feature.c, feature.h, filesys.h, fluids.h, fports.h, gc_os_dep.c, gdb_interface.h, gh_eval.c, gh_funcs.c, gh_io.c, gh_list.c, gh_predicates.c, gsubr.c, gsubr.h, guardians.h, guile-func-name-check.in, guile-snarf-docs-texi.in, guile-snarf-docs.in, guile-snarf.awk.in, guile-snarf.in, hashtab.h, iselect.h, keywords.h, lang.c, list.h, load.h, objprop.c, objprop.h, options.c, options.h, random.h, regex-posix.h, root.c, root.h, script.c, snarf.h, stackchk.c, strerror.c, strop.h, strports.h, threads.h, values.c, values.h, version.c, version.h: Updated copyright notice.
2001-07-09Remove "face-lift" comment.Thien-Thi Nguyen1-2/+0
2001-03-09Remove #include <stdio.h>. Add #include <string.h>.Keisuke Nishida1-1/+0
2000-12-04* Minor cleanup/optimization for char=?.Dirk Herrmann1-3/+3
* Cleanup CCLO handling.
2000-11-17* alist.c, arbiters.c, async.c, backtrace.c, boolean.c, chars.c,Marius Vollmer1-0/+2
continuations.c, debug-malloc.c, debug.c, dynl.c, dynwind.c, environments.c, eq.c, error.c, eval.c, evalext.c, feature.c, filesys.c, fluids.c, fports.c, gc.c, goops.c, guardians.c, hash.c, hashtab.c, hooks.c, ioext.c, iselect.c, keywords.c, lang.c, list.c, load.c, macros.c, modules.c, net_db.c, numbers.c, objects.c, objprop.c, options.c, pairs.c, ports.c, posix.c, print.c, procprop.c, procs.c, properties.c, ramap.c, random.c, read.c, regex-posix.c, root.c, scmsigs.c, script.c, simpos.c, socket.c, sort.c, srcprop.c, stackchk.c, stacks.c, stime.c, strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c, tag.c, threads.c, throw.c, unif.c, variable.c, vectors.c, version.c, vports.c, weaks.c: Makes sure the snarfer output inclusion is disabled when the snarfer is run on the file. Thanks to Lars J. Aas! * Makefile.am: Install guile-procedures.txt in version-specific directory to enable multiple installed guile versions. Suggested by Karl M. Hegbloom <karlheg@debian.org, patch by Matthias Koeppe.
2000-08-18* Docstring fixes - adding texinfo markup and removing extraneous trailing ↵Neil Jerram1-21/+31
newlines.
2000-06-12Updated copyrightsMikael Djurfeldt1-1/+1
2000-04-21* Makefile.am (DEFS): Added. automake adds -I options to DEFS,Mikael Djurfeldt1-4/+4
and we don't want that. (INCLUDES): Removed all -I options except for the root source directory and the root build directory. * *.*: Change includes so that they always use the "prefixes" libguile/, qt/, guile-readline/, or libltdl/. (Thanks to Tim Mooney.)
2000-03-19 * *.[hc]: add Emacs magic at the end of file, to ensure GNUMichael Livshin1-0/+6
indentation style.
2000-03-03* error.h, error.c: Added `scm_wrong_type_arg_msg' to supportGreg J. Badros1-1/+1
displaying the expected type. Use SCM_LISTn in a couple places instead of scm_cons-ing by hand. * __scm.h: Added SCM_ASSERT_TYPE macro. * validate.h, scm_validate.h: Added the former, as a renamed version of the latter with SCM_ASSERT_TYPE used in SCM_MAKE_VALIDATE (instead of just SCM_ASSERT) * Makefile.am: Rename scm_validate.h to validate.h. * *.c, *.h: Include validate.h, not scm_validate.h (old name's prefix was superfluous).
2000-03-02* list.c: Moved append docs to append! Thanks Dirk Hermann. Also,Greg J. Badros1-50/+50
added append docs from R4RS. * strings.c: Docstring typo fix, + eliminate unneeded IMP tests. Thanks Dirk Hermann! * chars.h: Provide SCM_CHARP, SCM_CHAR, SCM_MAKE_CHAR and deprecate SCM_ICHRP, SCM_ICHR, SCM_MAKICHR. Thanks Dirk Hermann! * *.h, *.c: Use SCM_CHARP, SCM_CHAR, SCM_MAKE_CHAR throughout. Drop use of SCM_P for function prototypes... assume an ANSI C compiler. Thanks Dirk Hermann!
2000-01-18* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,Mikael Djurfeldt1-28/+28
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c, keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c, objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c, ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c, stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c, symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c, weaks.c: Converted docstrings to ANSI C format.
2000-01-11* scm_validate.h, chars.c, ports.c, print.c, read.c, strings.c,Greg J. Badros1-29/+29
strop.c: Use SCM_VALIDATE_ICHR, SCM_VALIDATE_ICHR_COPY instead of SCM_VALIDATE_CHAR, SCM_VALIDATE_CHAR_COPY. Change made for consistency with the other macros dealing with immediate characters. (Similar to INT -> INUM change a week or so ago).
2000-01-06* chars.c (scm_integer_to_char): Use Greg's niceMikael Djurfeldt1-2/+2
SCM_VALIDATE_INUM_RANGE macro for argument checking for closer adherence to R5RS.
2000-01-06* *.c, snarf.h: Replace GUILE_PROC1 with SCM_DEFINE1 throughout.Greg J. Badros1-10/+10
2000-01-05* *.[ch]: Whitespace changes -- added space after SCM_VALIDATE_*Greg J. Badros1-37/+37
macros and SCM_DEFINE macros to match GNU coding standards.