summaryrefslogtreecommitdiff
path: root/src/character.h
Commit message (Collapse)AuthorAge
* Simplify str_to_multibyte and related codeMattias Engdegård2022-07-11
| | | | | | | | | | | * src/character.h (str_to_multibyte): * src/character.c (str_to_multibyte): Remove `nbytes` argument; return it instead. Copy forwards. * src/fns.c (concat_to_string, Fstring_make_multibyte): Use str_to_multibyte. (string_make_multibyte): Remove. (string_to_multibyte): * src/print.c (print_string): Adapt calls.
* Simplify and speed up string-to-multibyteMattias Engdegård2022-07-11
| | | | | | | | | | | | * src/character.h (str_to_multibyte): * src/character.c (str_to_multibyte): Change signature and simplify; the conversion is no longer done in-place. * src/fns.c (string_to_multibyte): Drop temporary buffer and memcpy; adapt to new str_to_multibyte signature. * src/print.c (print_string): Drop memcpy; adapt call to str_to_multibyte. * test/src/fns-tests.el (fns--string-to-unibyte): Rename to... (fns--string-to-unibyte-multibyte): ... this and strengthen, so that the test covers string-to-multibyte reasonably well.
* Speed up string-to-unibyteMattias Engdegård2022-07-10
| | | | | | | | * src/character.h (str_to_unibyte): * src/character.c (str_to_unibyte): Remove. * src/fns.c (Fstring_to_unibyte): Ditch the call to str_to_unibyte and the unnecessary heap allocation. Write new, faster code. * test/src/fns-tests.el (fns--string-to-unibyte): New test.
* Fix cursor motion around some Emoji sequencesEli Zaretskii2021-09-25
| | | | | | | | * src/character.h: Add TAG_SPACE and CANCEL_TAG to known Unicode characters values. * src/composite.c (char_composable_p): Recognize TAG characters relevant to Emoji as composable regardless of their General Category. (Bug#39799)
* Don't account for character compositions in 'format' and friendsEli Zaretskii2021-05-30
| | | | | | | | | | | | | | | | 'lisp_string_width' is called from 'format' and 'format-message', which can be called both very early into Emacs initialization and in other contexts where using the font backend is impossible or undesirable. So this commit changes 'lisp_string_width' to try accounting for automatic compositions only when explicitly requested, and only 'string-width' does that; 'format' and 'format-message' don't. * src/character.c (lisp_string_width): Accept an additional argument AUTO_COMP; attempt accounting for auto-compositions only if that argument is non-zero. (Bug#48732) * src/editfns.c (styled_format): * src/character.c (Fstring_width): Callers of 'lisp_string_width' adjusted.
* ; Fix some typos in doc strings and manualsŠtěpán Němec2021-04-24
|
* Add two optional arguments to 'string-width'Eli Zaretskii2021-04-14
| | | | | | | | | | | | | | | | | | | * src/character.c (Fstring_width, lisp_string_width): Accept two optional arguments FROM and TO, to indicate the substring to be considered. (Fstring_width): Add caveats in the doc string about display features ignored by the function. (Bug#47712) * src/character.h (lisp_string_width): Update prototype. * src/editfns.c (styled_format): Adjust call of lisp_string_width to its changed signature. * test/src/character-tests.el (character-test-string-width): New file with tests for 'string-width'. * doc/lispref/display.texi (Size of Displayed Text): Document caveats of using 'string-width'. * etc/NEWS: Announce the change.
* Reduce integer-output-format to print-integers-as-charactersMattias Engdegård2020-11-06
| | | | | | | | | | | | | | | | | The variable now only controls whether characters are printed, not the radix. Control chars are printed in human-readable syntax only when special escapes such as ?\n are available. Spaces, formatting and combining chars are excluded (bug#44155). Done in collaboration with Juri Linkov. * src/character.c (graphic_base_p): * src/print.c (named_escape): New functions. (print_object): Change semantics as described above. (syms_of_print): Rename integer-output-format. Update doc string. * doc/lispref/streams.texi (Output Variables): * etc/NEWS: * test/src/print-tests.el (print-integers-as-characters): Rename and update according to new semantics. The test now passes.
* Improve multibyte_length performancePaul Eggert2020-04-27
| | | | | | | * src/character.h (multibyte_length): Merge tests so that there are fewer conditional branches. This improved CPU speed of ‘make compile-always’ by about 1.5% on my platform.
* Improve string_char_and_length speedPaul Eggert2020-04-26
| | | | | | | | | This tweak improved the CPU time performance of ‘make compile-always’ by about 1.7% on my platform. * src/character.c (string_char): Remove; no longer used. * src/character.h (string_char_and_length): Redo so that it needn’t call string_char. This helps the caller, which can now become a leaf function.
* Fix string-to-multibyte overlong sequence bugPaul Eggert2020-04-20
| | | | | | | | | * src/character.h (MULTIBYTE_LENGTH, MULTIBYTE_LENGTH_NO_CHECK): Remove, replacing with ... (multibyte_length): ... this new function. All callers changed. The new function rejects overlong multibyte forms. * test/src/buffer-tests.el (buffer-multibyte-overlong-sequences): New test.
* Prefer more inline functions in character.hPaul Eggert2020-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h (fetch_char_advance, fetch_char_advance_no_check) (buf_next_char_len, next_char_len, buf_prev_char_len) (prev_char_len, inc_both, dec_both): New inline functions, replacing the old character.h macros FETCH_CHAR_ADVANCE, FETCH_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS, INC_POS, BUF_DEC_POS, DEC_POS, INC_BOTH, DEC_BOTH respectively. All callers changed. These new functions all assume buffer primitives and so need to be here rather than in character.h. * src/casefiddle.c (make_char_unibyte): New static function, replacing the old MAKE_CHAR_UNIBYTE macro. All callers changed. (do_casify_unibyte_string): Use SINGLE_BYTE_CHAR_P instead of open-coding it. * src/ccl.c (GET_TRANSLATION_TABLE): New static function, replacing the old macro of the same name. * src/character.c (string_char): Omit 2nd arg. 3rd arg can no longer be NULL. All callers changed. * src/character.h (SINGLE_BYTE_CHAR_P): Move up. (MAKE_CHAR_UNIBYTE, MAKE_CHAR_MULTIBYTE, PREV_CHAR_BOUNDARY) (STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE) (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE) (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH) (DEC_BOTH, BUF_INC_POS, BUF_DEC_POS): Remove. (make_char_multibyte): New static function, replacing the old macro MAKE_CHAR_MULTIBYTE. All callers changed. (CHAR_STRING_ADVANCE): Remove; all callers changed to use CHAR_STRING. (NEXT_CHAR_BOUNDARY): Remove; it was unused. (raw_prev_char_len): New inline function, replacing the old PREV_CHAR_BOUNDARY macro. All callers changed. (string_char_and_length): New inline function, replacing the old STRING_CHAR_AND_LENGTH macro. All callers changed. (STRING_CHAR): Rewrite in terms of string_char_and_length. (string_char_advance): New inline function, replacing the old STRING_CHAR_ADVANCE macro. All callers changed. (fetch_string_char_advance): New inline function, replacing the old FETCH_STRING_CHAR_ADVANCE macro. All callers changed. (fetch_string_char_as_multibyte_advance): New inline function, replacing the old FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE macro. All callers changed. (fetch_string_char_advance_no_check): New inline function, replacing the old FETCH_STRING_CHAR_ADVANCE_NO_CHECK macro. All callers changed. * src/regex-emacs.c (HEAD_ADDR_VSTRING): Remove; no longer used. * src/syntax.c (scan_lists): Use dec_bytepos instead of open-coding it. * src/xdisp.c (string_char_and_length): Rename from string_char_and_length to avoid name conflict with new function in character.h. All callers changed.
* Prefer inline functions in character.hPaul Eggert2020-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In character.h, replace macros with inline functions or enums when this is easy. This improves maintainability and on my platform (Fedora 31 x86-64, gcc -O2) improved CPU performance very slightly (0.3%) on ‘make compile-always’. * src/buffer.h (SANE_TAB_WIDTH, CHARACTER_WIDTH): Move here from character.h, and make them inline functions. Tune CHARACTER_WIDTH so that ASCII_CHAR_WIDTH is no longer needed. (sanitize_tab_width, sanitize_char_width): Move here from character.h. * src/character.h (MAX_CHAR, MAX_UNICODE_CHAR, MAX_1_BYTE_CHAR) (MAX_2_BYTE_CHAR, MAX_3_BYTE_CHAR, MAX_4_BYTE_CHAR) (MAX_5_BYTE_CHAR, MIN_MULTIBYTE_LEADING_CODE) (MAX_MULTIBYTE_LEADING_CODE, MAX_MULTIBYTE_LENGTH): Now enum constants instead of macros. * src/character.h (CHAR_BYTES): Redo to avoid conditional branches. (CHAR_BYTE8_P, BYTE8_TO_CHAR, UNIBYTE_TO_CHAR, CHAR_TO_BYTE8) (CHAR_TO_BYTE_SAFE, CHAR_BYTE8_HEAD_P, CHARACTERP) (CHECK_CHARACTER, CHECK_CHARACTER_CAR, CHECK_CHARACTER_CDR) (CHAR_PRINTABLE_P, CHAR_BYTES, CHAR_LEADING_CODE, BYTE8_STRING) (LEADING_CODE_P, TRAILING_CODE_P, CHAR_HEAD_P) (BYTES_BY_CHAR_HEAD): Now inline functions instead of macros. (ASCII_CHAR_WIDTH): Remove; no longer used. * src/conf_post.h (ATTRIBUTE_PURE): New macro. * src/lisp.h (char_table_ref): Use it, for better inlining. * src/fns.c (base64_decode_1): Add now-necessary casts.
* Remove UNSIGNED_CMPPaul Eggert2020-04-11
| | | | | | | | | | | | | | | | | | | | | | I added this macro in 2011 to fix some signedness comparison bugs. However, it’s a weird macro and the bugs can be fixed in a more-straightforward way. This helps performance slightly (0.5%) on my platform (Fedora 31 x86-64, GCC 9.3.1 with -O2). * src/casefiddle.c (do_casify_natnum): Use simple comparison instead of UNSIGNED_CMP. * src/character.h (CHAR_VALID_P, SINGLE_BYTE_CHAR_P, CHAR_STRING): * src/composite.h (COMPOSITION_ENCODE_RULE_VALID): * src/lisp.h (ASCII_CHAR_P): Now an inline function, and uses simple comparison instead of UNSIGNED_CMP. * src/dispextern.h (FACE_FROM_ID, FACE_FROM_ID_OR_NULL) (IMAGE_FROM_ID, IMAGE_OPT_FROM_ID): Move these to ... * src/frame.h (FACE_FROM_ID, FACE_FROM_ID_OR_NULL) (IMAGE_FROM_ID, IMAGE_OPT_FROM_ID): ... here, and make them inline functions that no longer use UNSIGNED_CMP. * src/keyboard.c (read_char): UNSIGNED_CMP is not needed here since XFIXNAT always returns a nonnegative value. * src/lisp.h (UNSIGNED_CMP): Remove; no longer used.
* Stop signaling an error when reading "smart quotes" in symbolsNoam Postavsky2019-11-28
| | | | | | | | | | | Revert commits from 2018-01-28 "Fix round tripping of read->print for symbols with strange quotes", and 2017-07-22 "Signal error for symbol names with strange quotes (Bug#2967)". * etc/NEWS: Remove corresponding entries. * src/character.c (confusable_symbol_character_p): * test/src/lread-tests.el (lread-tests--old-style-backquotes): Remove. * src/lread.c (read1): Don't signal error on confusable character. * src/print.c (print_object): Don't escape confusable characters.
* Port hexdigit init to non-GCC + pdumperPaul Eggert2019-11-15
| | | | | | | | | | | | | | The old code assumed that hexdigit initialization (needed by non-GCC) could be done in syms_of_character, but that is no longer true with pdumper. Instead, simplify hexdigit init so that it can be done statically on all C99 platforms. Problem discovered on Solaris 10 sparc + Oracle Solaris Studio 12.6. * src/character.c (hexdigit): Add 1 to every value; all uses changed. This simplifies the initialization so that it can be done statically on any C99 compiler. hexdigit is now always const. (syms_of_character): Omit no-longer-necessary initialization. * src/character.h (HEXDIGIT_CONST, HEXDIGIT_IS_CONST): Remove. All uses removed.
* Remove fixnum restriction on some display varsPaul Eggert2019-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a minor patch to remove some fixnum restrictions. Many more such patches are needed, but one thing at a time. * doc/emacs/custom.texi (Examining): Update fill-column example. * src/buffer.c (fill-column, left-margin, tab-width) (buffer-saved-size, left-margin-width, right-margin-width) (left-fringe-width, right-fringe-width, scroll-bar-width) (scroll-bar-height, buffer-display-count): Allow any integer; do not restrict to fixnums. * src/character.h (SANE_TAB_WIDTH): Do not assume tab_width is a nonnegative fixnum. (sanitize_tab_width): Take a Lisp_Object integer, not an EMACS_INT. Only use changed. * src/data.c (store_symval_forwarding): Remove unnecessary SYMBOLP since the predicate (e.g., Qintegerp) is always a symbol (leave the test in as an eassert). Avoid assignments inside if-conditions. * src/fileio.c (Fdo_auto_save): Do not assume buffer-saved-size is a fixnum. Avoid undefined behavior on EMACS_INT overflow by multiplying a fixnum by at most 4, not by at most 13. * src/window.c (set_window_buffer): When buffer-display-count is too large for a fixnum, make it a bignum. * src/xdisp.c (FILL_COLUMN_INDICATOR_NEEDED): Remove macro, ... (fill_column_indicator_column): ... replacing with this new function. All uses changed. The function is a bit pickier, to prevent problems with non-character fixnums and columns out of range for int, and to remove the assumption that integers are in fixnum range. (append_space_for_newline, extend_face_to_end_of_line): Avoid undefined behavior with signed integer overflow. Simplify.
* More macro renamings for bignumTom Tromey2018-08-07
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c, src/bidi.c, src/buffer.c, src/buffer.h, src/bytecode.c, src/callint.c, src/callproc.c, src/casefiddle.c, src/casetab.c, src/category.c, src/ccl.c, src/character.c, src/character.h, src/charset.c, src/charset.h, src/chartab.c, src/cmds.c, src/coding.c, src/composite.c, src/composite.h, src/data.c, src/dbusbind.c, src/decompress.c, src/dired.c, src/dispextern.h, src/dispnew.c, src/disptab.h, src/doc.c, src/dosfns.c, src/editfns.c, src/emacs-module.c, src/emacs.c, src/eval.c, src/fileio.c, src/floatfns.c, src/fns.c, src/font.c, src/font.h, src/fontset.c, src/frame.c, src/frame.h, src/fringe.c, src/ftcrfont.c, src/ftfont.c, src/gfilenotify.c, src/gnutls.c, src/gtkutil.c, src/image.c, src/indent.c, src/insdel.c, src/intervals.c, src/json.c, src/keyboard.c, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/syntax.h, src/sysdep.c, src/term.c, src/termhooks.h, src/textprop.c, src/undo.c, src/w32.c, src/w32console.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32term.h, src/w32uniscribe.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xml.c, src/xrdb.c, src/xselect.c, src/xsettings.c, src/xterm.c, src/xwidget.c Rename XINT->XFIXNUM, XFASTINT->XFIXNAT, XUINT->XUFIXNUM.
* Rename integerp->fixnum, etc, in preparation for bignumsTom Tromey2018-07-12
| | | | | | | | | | | | | | | | | * src/json.c, src/keyboard.c, src/keyboard.h, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/sysdep.c, src/term.c, src/terminal.c, src/textprop.c, src/undo.c, src/w16select.c, src/w32.c, src/w32console.c, src/w32cygwinx.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32uniscribe.c, src/widget.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xrdb.c, src/xselect.c, src/xterm.c, src/xwidget.c: Rename INTEGERP->FIXNUM, make_number->make_fixnum, CHECK_NUMBER->CHECK_FIXNUM, make_natnum->make_fixed_natum, NUMBERP->FIXED_OR_FLOATP, NATNUMP->FIXNATP, CHECK_NATNUM->CHECK_FIXNAT.
* Merge from origin/emacs-26Glenn Morris2018-06-18
|\ | | | | | | | | | | | | | | | | | | | | | | | | 63ba73a Fix documentation of ':propertize' in mode-line-format 22aa665 Reject invalid 5-byte sequences when detecting UTF-8 encoding 0d3c358 Fix 'replace-buffer-contents' in multibyte buffers c79a627 Update etc/NEWS for mail-source-movemail-program change 63f1dc4 Improve movemail default 0b1a2ae Delete description of deleted Customize functions fcd66d0 Keep vc-print-log from putting point at buffer end (Bug#31764) Conflicts: etc/NEWS
| * Reject invalid 5-byte sequences when detecting UTF-8 encodingEli Zaretskii2018-06-15
| | | | | | | | | | | | | | | | * src/coding.c (detect_coding_utf_8): Reject multibyte sequences whose leading byte is greater than MAX_MULTIBYTE_LEADING_CODE. (Bug#31829) * src/character.h (MAX_MULTIBYTE_LEADING_CODE): Add commentary about the connection between the value of this macro and MAX_CHAR.
* | Merge from origin/emacs-26Glenn Morris2018-02-17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e5a2933 (origin/emacs-26) lisp/vc/: documentation fixes f21f8e6 Document 'desktop-files-not-to-save' d8917eb Improve documentation of Profiling features b228839 Improve indexing of "performance" in ELisp manual ab67b3e Minor change in Emacs manual's VC chapter c352434 Avoid memory corruption with specpdl overflow + edebug (Bug#3... 593bbda Document comment-fill-column in the manual (Bug#11636) bd4cc8d * doc/emacs/dired.texi (Marks vs Flags): Copyedits. 69107f3 ; Fix doc typos related to indefinite articles aaad1e6 Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/emac... 5906418 More fixes for the Emacs manual 9ab3df1 ; Fix doc typos related to indefinite articles 66a4e65 ; Fix doc typos related to indefinite articles 35e5c57 ; Fix doc typos related to indefinite articles
| * ; Fix doc typos related to indefinite articlesGlenn Morris2018-02-16
| |
* | Fix round tripping of read->print for symbols with strange quotesNoam Postavsky2018-01-28
|/ | | | | | | | | | | | | | | | | Since 2017-07-22 "Signal error for symbol names with strange quotes (Bug#2967)", symbol names beginning with certain quote characters require an escaping backslash. However, the corresponding change for printing missed, so that (eq (read (prin1-to-string SYM)) SYM) does not give `t' for such symbols. * src/character.c (confusable_symbol_character_p): New function, extracted from test `read1'. * src/lread.c (read1): Use it. * src/print.c (print_object): Use it to print a backslash for symbols starting with characters that `read1' requires to be escaped. * test/src/print-tests.el (print-read-roundtrip): New test. * etc/NEWS.26: * etc/NEWS: Clarify the announcement for the earlier reader change (Bug#30217).
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-13
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Convert hex digits more systematicallyPaul Eggert2017-07-05
| | | | | | | | | | | | | | | | | This makes the code a bit smaller and presumably faster, as it substitutes a single lookup for conditional jumps. * src/character.c (hexdigit): New constant. (syms_of_character) [HEXDIGIT_IS_CONST]: Initialize it. * src/character.h (HEXDIGIT_CONST, HEXDIGIT_IS_CONST): New macros. (hexdigit): New decl. (char_hexdigit): New inline function. * src/charset.c: Do not include c-ctype.h. * src/charset.c (read_hex): * src/editfns.c (styled_format): * src/image.c (xbm_scan): * src/lread.c (read_escape): * src/regex.c (ISXDIGIT) [emacs]: Use char_hexdigit insted of doing it by hand.
* Add support for Unicode whitespace in [:blank:]Philipp Stephani2017-01-06
| | | | | | | | | | | | | | | | See Bug#25366. * src/character.c (blankp): New function for checking Unicode horizontal whitespace. * src/regex.c (ISBLANK): Use 'blankp' for non-ASCII horizontal whitespace. (BIT_BLANK): New bit for range table. (re_wctype_to_bit, execute_charset): Use it. * test/lisp/subr-tests.el (subr-tests--string-match-p--blank): Add unit test for [:blank:] character class. * test/src/regex-tests.el (test): Adapt unit test. * doc/lispref/searching.texi (Char Classes): Document new Unicode behavior for [:blank:].
* Merge from origin/emacs-25Paul Eggert2016-09-26
|\ | | | | | | | | | | | | | | | | | | | | | | 0ae9a81 Document 'timerp' 2c72c46 Improve documentation of overlay priorities f6fa160 Fix 'dired-compress-files' 2b8c5f0 Update commentary of STRING_CHAR and FETCH_MULTIBYTE_CHAR # Conflicts: # lisp/dired.el # src/buffer.h # src/character.h
| * Update commentary of STRING_CHAR and FETCH_MULTIBYTE_CHAREli Zaretskii2016-09-23
| | | | | | | | | | | | | | * src/character.h (STRING_CHAR): * src/buffer.h (FETCH_MULTIBYTE_CHAR): Update commentary: these two macros no longer do any character unification, so the caveats in those comments are no longer pertinent.
* | Port to ISO/IEC TS 18661-1:2014Paul Eggert2016-09-13
| | | | | | | | | | * src/character.h (CHARACTER_WIDTH): Rename from CHAR_WIDTH. All uses changed.
* | Replace decimalnump with alphanumericpMichal Nazarewicz2016-09-09
| | | | | | | | | | | | | | | | | | | | | | | | | | decimalnump was used in regex.c only in ISALNUM macro which ored it with alphabeticp. Because both of those functions require Unicode general category lookup, this resulted in unnecessary lookups (if alphabeticp return false decimalp had to perform another lookup). Drop decimalnump in favour of alphanumericp which combines decimelnump with alphabeticp. * src/character.c (decimalnump): Remove in favour of… (alphanumericp): …new function. * src/regex.c (ISALNUM): Use alphanumericp.
* | STRING_CHAR does not unify characters; update documentationMichal Nazarewicz2016-09-09
| | | | | | | | | | | | * src/character.h (STRING_CHAR): Update doc. * src/buffer.h (FETCH_MULTIBYTE_CHAR): Update doc. While at it, change the function to use BYTE_POS_ADDR instead of open-coding it.
* | Merge from origin/emacs-25Paul Eggert2016-08-22
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 927afa1 ; Update ChangeLog.2 and ldef-boot.el for Emacs 25.1 RC2 6bf83b5 * etc/AUTHORS: Update the AUTHORS file 73cbb81 ; ChangeLog spelling fixes 9b99772 Some assorted documentation clarifications 37d4723 Improve commentary in src/character.h 5ccd593 ; Fix typo in /etc/NEWS 96e3d16 * etc/NEWS: Mention the change in json-encode-string. 2e524034 ; * etc/NEWS: Mention incompatible change in url-http-create... 2e4e74e Merge branch 'emacs-25' of git.savannah.gnu.org:/srv/git/emac... 66dea65 ; * doc/lispref/windows.texi (Window Parameters): Grammar twe... # Conflicts: # ChangeLog.2 # lisp/ldefs-boot.el
| * Improve commentary in src/character.hEli Zaretskii2016-08-18
| | | | | | | | | | | | * src/character.h (BYTES_BY_CHAR_HEAD, MULTIBYTE_LENGTH) (MULTIBYTE_LENGTH_NO_CHECK, STRING_CHAR_AND_LENGTH): Remove stale info from commentary and improve it.
* | Improve character name escapesPaul Eggert2016-04-21
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/nonascii.texi (Character Properties): Avoid duplication of Unicode names. Reformat examples to fit in narrow pages. * doc/lispref/objects.texi (General Escape Syntax): Simplify and better-organize explanation of \N{...} escapes. * src/character.h (CHAR_SURROGATE_PAIR_P): Remove; unused. (char_surrogate_p): New inline function. * src/lread.c: Do not include string.h; no longer needed. (invalid_character_name, check_scalar_value): Remove; the ideas behind these functions are now bundled into character_name_to_code. (character_name_to_code): Remove undocumented support for "CJK IDEOGRAPH-XXXX" names, as "U+XXXX" suffices. Reject monstrosities like "\N{U+-0}" and null bytes in \N escapes. Reject floating point in \N escapes instead of returning garbage. Use AUTO_STRING_WITH_LEN to lessen pressure on the garbage collector. * test/src/lread-tests.el (lread-char-number, lread-char-name) (lread-string-char-number, lread-string-char-name): Test runtime behavior, not compile-time, as the test framework is not set up to test compile-time. (lread-char-surrogate-1, lread-char-surrogate-2) (lread-char-surrogate-3, lread-char-surrogate-4) (lread-string-char-number-2, lread-string-char-number-3): New tests. (lread-string-char-number-1): Rename from lread-string-char-number.
* Rework C source files to avoid ^(Paul Eggert2016-03-10
| | | | | | | | Work around Bug#22884 by rewording comments and strings to avoid ‘(’ at the start of a line unless it starts a function. This change is a short-term hack; in the longer run we plan to fix cc-mode’s performance for C files that have ‘(’ at the start of a line in a comment or string.
* Avoid writing to purespaceYAMAMOTO Mitsuharu2015-12-31
| | | | | | | | | * src/alloc.c (Fmake_string): Don't write to empty string contents. (allocate_vector): Don't write to empty vector size. * src/character.h (CHECK_CHARACTER_CAR, CHECK_CHARACTER_CDR): Don't call unnecessary XSETCAR or XSETCDR. * src/lisp.h (STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE): Don't write to empty string size_byte.
* Make src headers idempotent and standalonePaul Eggert2015-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Redo src/*.h so that each include file is idempotent (that is, can be included multiple times with the latter inclusions having no effect) and standalone (that is, can be included by itself, with no include file other than config.h needed as a prerequisite). This is standard practice in GNU programs nowadays. * lwlib/lwlib-widget.h, src/buffer.h, src/category.h, src/character.h: * src/charset.h, src/coding.h, src/commands.h, src/disptab.h: * src/fontset.h, src/gnutls.h, src/indent.h, src/keymap.h, src/macros.h: * src/regex.h [emacs]: * src/syntax.h, src/systty.h, src/termhooks.h: Include lisp.h, for Lisp_Object. * src/buffer.h, src/category.h, src/cm.h, src/commands.h, src/disptab.h: * src/indent.h, src/intervals.h, src/keyboard.h, src/macros.h: * src/process.h, src/puresize.h, src/region-cache.h, src/syntax.h: * src/syssignal.h, src/sysstdio.h, src/systty.h, src/termchar.h: * src/termopts.h, src/tparam.h, src/unexec.h: Protect against multiple inclusion. * src/buffer.h: Include character.h, for STRING_CHAR. * src/emacsgtkfixed.h (struct frame): * src/fontset.h (struct face): * src/region-cache.h (struct buffer): * src/termhooks.h (struct glyph): * src/xsettings.h (struct x_display_info): Add possibly-forward decl. * src/syntax.h: Include buffer.h, for BVAR. * src/sysselect.h: Include lisp.h, for eassume. * src/termchar.h: Include <stdio.h>, for FILE. * src/widget.h: Include <X11/IntrinsicP.h>, for Widget. * src/xsettings.h: Include <X11/Xlib.h>, for XEvent.
* Prefer ‘format’ to ‘substitute-command-keys’Paul Eggert2015-08-14
| | | | | | | | | | | | | | | | | | | | | | | | * src/character.h (uLSQM, uRSQM): Move here ... * src/doc.c (uLSQM, uRSQM): ... from here. * src/doc.c (Fsubstitute_command_keys): * src/syntax.c (Finternal_describe_syntax_value): * lisp/cedet/mode-local.el (mode-local-print-binding) (mode-local-describe-bindings-2): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-theme.el (describe-theme-1): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/emacs-lisp/cl-extra.el (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl--generic-describe): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/package.el (describe-package-1): * lisp/faces.el (describe-face): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode): Prefer ‘format’ to ‘substitute-command-keys’ when either will do to implement quoting style. This generally makes the code simpler.
* Give names to Unicode code points in C codePaul Eggert2015-08-11
| | | | | | | | | | | | | | | | | | * src/character.h (NO_BREAK_SPACE, SOFT_HYPHEN) (ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_JOINER, HYPHEN) (NON_BREAKING_HYPHEN, LEFT_SINGLE_QUOTATION_MARK) (RIGHT_SINGLE_QUOTATION_MARK, PARAGRAPH_SEPARATOR) (LEFT_POINTING_ANGLE_BRACKET, RIGHT_POINTING_ANGLE_BRACKET) (LEFT_ANGLE_BRACKET, RIGHT_ANGLE_BRACKET) (OBJECT_REPLACEMENT_CHARACTER): New named constants for Unicode code points. * src/bidi.c (bidi_fetch_char, CANONICAL_EQU): * src/composite.c (char_composable_p): * src/lread.c (readevalloop, read1): * src/xdisp.c (get_next_display_element): Use them. * src/doc.c (LEFT_SINGLE_QUOTATION_POINT): Remove; now in character.h.
* Make [:graph:] act like [:print:] sans spacePaul Eggert2015-04-15
| | | | | | | | | | | | | | | | | | In POSIX [[:print:]] is equivalent to [ [:graph:]], so change [:graph:] so that it matches everything that [:print:] does, except for space. * doc/lispref/searching.texi (Char Classes): * etc/NEWS: * lisp/emacs-lisp/rx.el (rx): Document [:graph:] to be [:print:] sans ' '. * src/character.c, src/character.h (graphicp): New function. * src/regex.c (ISGRAPH) [emacs]: Use it. (BIT_GRAPH): New macro. (BIT_PRINT): Increase to 0x200, to make room for BIT_GRAPH. (re_wctype_to_bit) [! WIDE_CHAR_SUPPORT]: Return BIT_GRAPH for RECC_GRAPH. (re_match_2_internal) [emacs]: Use ISGRAPH if BIT_GRAPH, and ISPRINT if BIT_PRINT.
* Make [:print:] support non-ASCII characters correctlyEli Zaretskii2015-04-14
| | | | | | | | | | | | | | | | * src/regex.c (ISPRINT): Call 'printablep' for multibyte characters. (BIT_PRINT): New bit mask. (re_wctype_to_bit): Return BIT_PRINT for RECC_PRINT. * src/character.c (printablep): New function. * src/character.h (printablep): Add prototype. * lisp/emacs-lisp/rx.el (rx): Doc fix: document the new behavior of 'print', 'alnum', and 'alphabetic'. * doc/lispref/searching.texi (Char Classes): Document the new behavior of [:print:]. * etc/NEWS: Mention the new behavior of [:print:].
* Improve [:alpha:] and [:alnum:] for multibyte characters (Bug#19878)Eli Zaretskii2015-02-28
| | | | | | | | | | | | | | | | src/character.c (alphabeticp, decimalnump): New functions. src/character.h (alphabeticp, decimalnump): Add prototypes. src/regex.c (ISALNUM, ISALPHA): Check Unicode character properties for multibyte characters by calling alphabeticp and decimalnump. (BIT_ALPHA, BIT_ALNUM): New bit masks. (re_wctype_to_bit): Return them when the class is RECC_ALPHA or RECC_ALNUM. (re_match_2_internal): Call ISALPHA and ISALNUM when appropriate. doc/lispref/searching.texi (Char Classes): Update the documentation of [:alpha:] and [:alnum:]. etc/NEWS: Mention the changes in [:alpha:] and [:alnum:].
* Compute C decls for DEFSYMs automaticallyPaul Eggert2015-01-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes Bug#15880. This patch also makes Q constants (e.g., Qnil) constant addresses from the C point of view. * make-docfile.c: Revamp to generate table of symbols, too. Include <stdbool.h>. (xstrdup): New function. (main): Don't process the same file twice. (SYMBOL): New constant in enum global_type. (struct symbol): Turn 'value' member into a union, either v.value for int or v.svalue for string. All uses changed. (add_global): New arg svalue, which overrides value, so that globals can have a string value. (close_emacs_global): New arg num_symbols; all uses changed. Output lispsym decl. (write_globals): Output symbol globals too. Output more ATTRIBUTE_CONST, now that Qnil etc. are C constants. Output defsym_name table. (scan_c_file): Move most of guts into ... (scan_c_stream): ... new function. Scan for DEFSYMs and record symbols found. Don't read past EOF if file doesn't end in newline. * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle: * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c: * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c: * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c: * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c: * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m: * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c: * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c: * xselect.c, xsettings.c, xterm.c: Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs). These names are now defined automatically by make-docfile. * alloc.c (init_symbol): New function. (Fmake_symbol): Use it. (c_symbol_p): New function. (valid_lisp_object_p, purecopy): Use it. * alloc.c (marked_pinned_symbols): Use make_lisp_symbol instead of make_lisp_ptr. (garbage_collect_1): Mark lispsym symbols. (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro. (mark_object): Use it. (sweep_symbols): Sweep lispsym symbols. (symbol_uses_obj): New function. (which_symbols): Use it. Work for lispsym symbols, too. (init_alloc_once): Initialize Vpurify_flag here; no need to wait, since Qt's address is already known now. (syms_of_alloc): Add lispsym count to symbols_consed. * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0), when testing whether storage is all bits zero. * dispextern (struct image_type): * font.c (font_property_table): * frame.c (struct frame_parm_table, frame_parms): * keyboard.c (scroll_bar_parts, struct event_head): * xdisp.c (struct props): Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and Lisp_Object *, since Qfoo is no longer an object whose address can be taken. All uses changed. * eval.c (run_hook): New function. Most uses of Frun_hooks changed to use it, so that they no longer need to take the address of a Lisp sym. (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable. * frame.c (syms_of_frame): Add defsyms for the frame_parms table. * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here. DEFSYM Qdeactivate_mark before the corresponding var. * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line instead of interning their symbols; this avoids duplicates. (LISP_INITIALLY, TAG_PTR) (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT): New macros. (LISP_INITIALLY_ZERO): Use it. (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol) (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*): Move decls up, to avoid forward uses. Include globals.h earlier, too. (make_lisp_symbol): New function. (XSETSYMBOL): Use it. (DEFSYM): Now just a placeholder for make-docfile. * lread.c (DEFINE_SYMBOLS): Define, for globals.h. (intern_sym): New function, with body taken from old intern_driver. (intern_driver): Use it. Last arg is now Lisp integer, not ptrdiff_t. All uses changed. (define_symbol): New function. (init_obarray): Define the C symbols taken from lispsym. Use plain DEFSYM for Qt and Qnil. * syntax.c (init_syntax_once): No need to worry about Qchar_table_extra_slots.
* Add macros to allocate temporary Lisp objects with alloca.Dmitry Antipov2014-09-09
| | | | | | | | | | | | | Respect MAX_ALLOCA and fall back to regular GC for large objects. * character.h (parse_str_as_multibyte): Move prototype to ... * lisp.h (parse_str_as_multibyte): ... here. (struct Lisp_Cons): Add GCALIGNED attribute if supported. (scoped_cons, scoped_list2, build_local_vector, build_local_string): New macros. (scoped_cons_init, pointer_valid_for_lisp_object, local_vector_init) (local_string_init): New functions. * alloc.c (verify_alloca) [ENABLE_CHECKING]: New function. (init_alloc_once): Call it.
* * chartab.c (char_table_translate): Move to...Dmitry Antipov2014-07-08
| | | | | | | * character.h (char_table_translate): ... inline function here. Avoid Faref and assume that args are always valid. This helps to speedup search, which is especially important for a huge buffers. * lisp.h (char_table_translate): Remove prototype.
* Simplify and cleanup character conversion stuff.Dmitry Antipov2014-06-23
| | | | | | | | | | | | | * lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe): Remove prototypes. * character.c (multibyte_char_to_unibyte) (multibyte_char_to_unibyte_safe): Remove; no longer used. * character.h (make_char): Remove; unused. (CHAR_TO_BYTE8, CHAR_TO_BYTE_SAFE): Simplify. (ASCII_BYTE_P): Remove; ASCII_CHAR_P does the same thing. * buffer.c, charset.c, charset.h, cmds.c, coding.c, editfns.c: * fileio.c, indent.c, insdel.c, keyboard.c, lread.c, print.c: * search.c, term.c, xdisp.c, xterm.c: Related users changed.
* * character.h: Fix misspelling of file name in comment.Paul Eggert2014-02-14
|
* Use bool for boolean, focusing on headers.Paul Eggert2013-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK): Use bool for boolean. * lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE): Remove. All uses replaced with uncapitalized version. * lib-src/emacsclient.c (message): * lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names): * lib-src/hexl.c (un_flag, iso_flag, endian): * lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next) (pop_trash): Use bool for boolean. * lib-src/etags.c (bool): Remove. * lib-src/etags.c (globals, members, declarations, no_line_directive) (no_duplicates): Use 'int' for boolean values that getopt requires to be 'int'. Formerly, these were 'bool' and 'bool' was 'int', but we can no longer rely on this implementation. * lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields. * lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields. * src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c: No need to include <stdbool.h>, since conf_post.h does it now. * src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION) (BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P) (SET_PER_BUFFER_VALUE_P): * src/ccl.c, src/ccl.h (setup_ccl_program): * src/ccl.h (CHECK_CCL_PROGRAM): * src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR) (CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY) (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE) (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE) (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH) (DEC_BOTH, BUF_INC_POS, BUF_DEC_POS): * src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID) (CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET) (CHARSET_FAST_MAP_SET): * src/coding.c (decode_coding_ccl, encode_coding_ccl): * src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC) (CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2) (JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE) (ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8) (decode_coding_c_string): * src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE): * src/conf_post.h (has_attribute): * src/dispextern.h (trace_redisplay_p): (INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE) (SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH) (SET_GLYPH_FROM_CHAR_GLYPH): (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P) (FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P) (PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p) (cursor_in_mouse_face_p): * src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows) (blank_row, prepare_desired_row) (build_frame_matrix_from_leaf_window, make_current) (mirror_make_current, mirrored_line_dance, mirror_line_dance) (update_window, scrolling_window, update_frame_line): * src/disptab.h (GLYPH_FOLLOW_ALIASES): * src/editfns.c (Fformat): * src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC) (FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE) (FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC) (FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC) (FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY) (CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG) (FONT_DEFERRED_LOG): * src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P): (FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME) (FRAME_MOUSE_UPDATE): * src/fringe.c (Fdefine_fringe_bitmap): * src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask) (x_create_bitmap_from_xpm_data, xpm_load_image): * src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT) (set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE) (MERGE_INTERVAL_CACHE): * src/keymap.h (KEYMAPP): * src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE) (STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP) (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER) (CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER) (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT) (DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT) (RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE) (SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp): * src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX) (UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD) (SETUP_BUFFER_SYNTAX_TABLE): * src/systime.h (timespec_valid_p): * src/term.c (save_and_enable_current_matrix): * src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P): * src/xdisp.c (in_display_vector_p, display_tool_bar_line) (redisplay_internal, try_window_reusing_current_matrix) (sync_frame_with_window_matrix_rows, try_window_id) (display_menu_bar, display_tty_menu_item, display_mode_line) (coords_in_mouse_face_p, cursor_in_mouse_face_p): * src/xmenu.c (xmenu_show): * src/xterm.c (use_xim, x_term_init): * src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET) (struct x_bitmap_record): Use bool for booleans. * src/ccl.c (struct buffer_text): * src/ccl.h (struct ccl_program): * src/charset.h (struct charset): * src/cm.h (struct cm): * src/coding.h (struct iso_2022_spec, struct coding_system): * src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row) (struct glyph_string, struct face, struct face_cache) (struct bidi_string_data, struct bidi_it) (struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo) (struct image): * src/editfns.c (Fformat): * src/frame.h (struct frame): * src/fringe.c (struct fringe_bitmap): * src/intervals.h (struct interval): * src/keyboard.h (struct kboard): * src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker) (struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free) (struct Lisp_Buffer_Local_Value, union specbinding): * src/macfont.m (struct macfont_info): * src/process.h (struct Lisp_Process): * src/termchar.h (struct tty_display_info): * src/window.h (struct window): * src/xterm.h (struct x_output): Use bool_bf for boolean bit-fields. * src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0. All callers changed. * src/ccl.h (struct ccl_program): Remove unused members private_state, src_multibyte, dst_multibyte, cr_consumed, suppress_error, eight_bit_control. (struct ccl_spec): Remove unused members cr_carryover, eight_bit_carryover. * src/conf_post.h: Include <stdbool.h>. (bool_bf): New type. * src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY): * src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE) Surround statement macro with proper 'do { ... } while (false)' brackets. (SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool. (PRODUCE_GLYPHS): Simplify use of boolean. * src/fileio.c (Fcopy_file): If I is an integer, prefer 'if (I != 0)' to 'if (I)'. * src/lisp.h (UNGCPRO): Return void, not int. (FOR_EACH_TAIL): Use void expression, not int expression. * src/region-cache.c: Reindent. * src/region-cache.h: Copy comments from region-cache.c, to fix incorrect remarks about booleans.
* Port to stricter C99 platforms.Paul Eggert2013-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Especially, C99 prohibits nesting a struct X inside struct Y if struct X has a flexible array member. Also, merge from gnulib, incorporating: 2013-11-03 intprops: port to Oracle Studio c99 * lib/intprops.h: Update from gnulib. * src/alloc.c (struct sdata): New type. (sdata): Implement in terms of struct sdata. Remove u member; all uses replaced by next_vector, set_next_vector. (SDATA_SELECTOR, SDATA_DATA, SDATA_DATA_OFFSET): Adjust to sdata change. (SDATA_DATA_OFFSET): Now a constant, not a macro. (struct sblock): Rename first_data member to data, which is now a flexible array member. All uses changed. (next_vector, set_next_vector, large_vector_vec): New functions. (vector_alignment): New constant. (roundup_size): Make it a multiple of ALIGNOF_STRUCT_LISP_VECTOR, too. (struct large-vector): Now merely a NEXT member, since the old approach ran afoul of stricter C99. All uses changed to use large_vector_vec or large_vector_offset. (large_vector_offset): New constant. * src/dispnew.c: Include tparam.h, for tgetent. Do not include term.h; no longer needed. * src/gnutls.c (Fgnutls_boot): Don't continue after calling a _Noreturn. * src/lisp.h (ENUM_BF) [__SUNPRO_C && __STDC__]: Use unsigned int. (struct Lisp_Vector): Use a flexible array member for contents, instead of a union with a member that is an array of size 1. All uses changed. (ALIGNOF_STRUCT_LISP_VECTOR): New constant, to make up for the fact that the struct no longer contains a union. (struct Lisp_Misc_Any, struct Lisp_Marker, struct Lisp_Overlay) (struct Lisp_Save_Value, struct Lisp_Free): Use unsigned, not int, for spacers, to avoid c99 warning. (union specbinding): Use unsigned, not bool, for bitfield, as bool is not portable to pre-C99 hosts.