summaryrefslogtreecommitdiff
path: root/src/coding.h
Commit message (Collapse)AuthorAge
* Be more systematic about parens in C source codePaul Eggert2024-01-20
| | | | | | | | | Be more systematic about putting space before paren in calls, and in avoiding unnecessary parentheses in macros. This was partly inspired by my wading through gcc -E output while debugging something else, and seeing too many parens. This patch does not change the generated .o files on my platform.
* Inlined and specialised hash table look-upMattias Engdegård2024-01-13
| | | | | | | | | | | This improves performance in several ways. Separate functions are used depending on whether the caller has a hash value computed or not. * src/fns.c (hash_lookup_with_hash, hash_lookup_get_hash): New. (hash_lookup): Remove hash return argument. All callers adapted. hash_lookup_with_hash hash_hash_t arg
* Merge from savannah/emacs-29Po Lu2024-01-02
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-02
| |
* | Update Android portPo Lu2023-02-12
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/emacs/android.texi (Android Environment): Document notifications permission. * java/org/gnu/emacs/EmacsEditable.java (EmacsEditable): * java/org/gnu/emacs/EmacsInputConnection.java (EmacsInputConnection): New files. * java/org/gnu/emacs/EmacsNative.java (EmacsNative): Load library dependencies in a less verbose fashion. * java/org/gnu/emacs/EmacsView.java (EmacsView): Make imManager public. (onCreateInputConnection): Set InputType to TYPE_NULL for now. * java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, onKeyDown) (onKeyUp, getEventUnicodeChar): Correctly handle key events with strings. * lisp/term/android-win.el (android-clear-preedit-text) (android-preedit-text): New special event handlers. * src/android.c (struct android_emacs_window): Add function lookup_string. (android_init_emacs_window): Adjust accordingly. (android_wc_lookup_string): New function. * src/androidgui.h (struct android_key_event): Improve commentary. (enum android_lookup_status): New enum. * src/androidterm.c (handle_one_android_event): Synchronize IM lookup code with X. * src/coding.c (from_unicode_buffer): Implement on Android. * src/coding.h: * src/sfnt.c: Fix commentary.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-01
|
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-01
|
* Update copyright year to 2021Paul Eggert2021-01-01
| | | | Run "TZ=UTC0 admin/update-copyright".
* Inhibit buffer hooks in temporary buffersBasil L. Contovounesios2020-12-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Give get-buffer-create an optional argument to inhibit buffer hooks in internal or temporary buffers for efficiency (bug#34765). * etc/NEWS: Announce new parameter of get-buffer-create and generate-new-buffer, and that with-temp-buffer and with-temp-file now inhibit buffer hooks. * doc/lispref/buffers.texi (Buffer Names): Fix typo. (Creating Buffers): Document new parameter of get-buffer-create and generate-new-buffer. (Buffer List, Killing Buffers): Document when buffer hooks are inhibited. (Current Buffer): * doc/lispref/files.texi (Writing to Files): Document that with-temp-buffer and with-temp-file inhibit buffer hooks. * doc/lispref/internals.texi (Buffer Internals): Document inhibit_buffer_hooks flag. Remove stale comment. * doc/misc/gnus-faq.texi (FAQ 5-8): * lisp/simple.el (shell-command-on-region): Fix indentation. * lisp/files.el (kill-buffer-hook): Document when hook is inhibited. (create-file-buffer): * lisp/gnus/gnus-uu.el (gnus-uu-unshar-article): * lisp/international/mule.el (load-with-code-conversion): * lisp/mh-e/mh-xface.el (mh-x-image-url-fetch-image): * lisp/net/imap.el (imap-open): * lisp/net/mailcap.el (mailcap-maybe-eval): * lisp/progmodes/flymake-proc.el (flymake-proc--read-file-to-temp-buffer) (flymake-proc--copy-buffer-to-temp-buffer): Simplify. * lisp/subr.el (generate-new-buffer): Forward new optional argument to inhibit buffer hooks to get-buffer-create. (with-temp-file, with-temp-buffer, with-output-to-string): * lisp/json.el (json-encode-string): Inhibit buffer hooks in buffer used. * src/buffer.c (run_buffer_list_update_hook): New helper function. (Fget_buffer_create): Use it. Add optional argument to set inhibit_buffer_hooks flag instead of comparing the buffer name to Vcode_conversion_workbuf_name. All callers changed. (Fmake_indirect_buffer, Frename_buffer, Fbury_buffer_internal) (record_buffer): Use run_buffer_list_update_hook. (Fkill_buffer): Document when buffer hooks are inhibited. Use run_buffer_list_update_hook. (init_buffer_once): Inhibit buffer hooks in Vprin1_to_string_buffer. (Vkill_buffer_query_functions, Vbuffer_list_update_hook): Document when hooks are inhibited. * src/buffer.h (struct buffer): Update inhibit_buffer_hooks commentary. * src/coding.h (Vcode_conversion_workbuf_name): * src/coding.c (Vcode_conversion_workbuf_name): Make static again since it is no longer needed in src/buffer.c. (code_conversion_restore, code_conversion_save, syms_of_coding): Prefer boolean over integer constants. * src/fileio.c (Finsert_file_contents): Inhibit buffer hooks in " *code-converting-work*" buffer. * src/window.c (Fselect_window): Fix grammar. Mention window-selection-change-functions alongside buffer-list-update-hook. * test/src/buffer-tests.el: Fix requires. (buffer-tests-inhibit-buffer-hooks): New test.
* Use the full name of the null byte/character, not its abbreviationAndreas Schwab2020-10-05
| | | | | | | | | | | | | | | | | | | | | * lisp/subr.el (inhibit-nul-byte-detection): Make it an obsolete alias. * src/coding.c (setup_coding_system): Use original name. (detect_coding): Rename nul_byte_found => null_byte_found. (detect_coding_system): Use original name. Rename nul_byte_found => null_byte_found. (Fdefine_coding_system_internal): Use original name. (syms_of_coding): Rename inhibit-nul-byte-detection to inhibit-null-byte-detection. * src/w16select.c (get_clipboard_data): Rename nul_char to null_char. * src/json.c (check_string_without_embedded_nulls): Rename from check_string_without_embedded_nuls. (Fjson_parse_string): Adjust accordingly. * src/coding.h (enum define_coding_undecided_arg_index) (enum coding_attr_index): Rename ...nul_byte... to ...null_byte.... * lisp/info.el (info-insert-file-contents, Info-insert-dir): * lisp/international/mule.el (define-coding-system): * lisp/vc/vc-git.el (vc-git--call): * doc/lispref/nonascii.texi (Lisp and Coding Systems): Use original name.
* Allow ENCODE_FILE and DECODE_FILE to use no-copy conversionMattias Engdegård2020-04-11
| | | | | | | | | | They already did return their argument under some circumstances; this change broadens it to further reduce allocation in common cases (bug#40407). * src/coding.c (convert_string_nocopy): New function. (decode_file_name, encode_file_name): Use convert_string_nocopy. * src/coding.h (ENCODE_FILE, DECODE_FILE): Note the nocopy semantics.
* Update copyright year to 2020Paul Eggert2020-01-01
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Fix and speed up en/decoding of UTF-8 stringsEli Zaretskii2019-11-23
| | | | | | | | | | | | * src/coding.c (get_char_bytes, encode_string_utf_8) (decode_string_utf_8): Fix commentary. (encode_string_utf_8): Return the original ASCII string only if NOCOPY is non-zero. (decode_string_utf_8): Accept 2 additional arguments STR and STR_LEN, which allow to pass the input text as a C string. (make_string_from_utf8): Delegate the job to decode_string_utf_8. * src/coding.h: Update the prototype of decode_string_utf_8. * src/json.c (json_encode): Call encode_string_utf_8.
* Add Unicode-safe UTF-8 converterK. Handa2019-08-04
| | | | | * src/coding.c (encode_string_utf_8, decode_string_utf_8): New functions. * src/coding.h (encode_string_utf_8, decode_string_utf_8): Extern them.
* * src/coding.c (decode_coding_gap): Remove `chars` argument.Stefan Monnier2019-07-02
| | | | | | * src/json.c (Fjson_insert): * src/fileio.c (Finsert_file_contents): * src/coding.h (decode_coding_gap): Adjust accordingly.
* Fix names of functions in last commitEli Zaretskii2019-04-28
| | | | | | | * src/coding.h (build_string_from_utf8): Rename from build_utf8_string. All callers changed. * src/coding.c (make_string_from_utf8): Rename from make_utf8_string. All callers changed.
* Refactoring: move UTF-8 decoding functions into coding.h.Philipp Stephani2019-04-28
| | | | | | | | | | | | | | | | | json_make_string and json_build_string are generally useful and not JSON-specific. Move them to coding.[ch]. * src/coding.h (build_utf8_string): Move from json.c. * src/coding.c (make_utf8_string): Move from json.c. * src/json.c (json_make_string, json_build_string): Move to coding.[ch]. Split out JSON-specific comment. (json_parse_error, Fjson_serialize, json_to_lisp): Fix callers. * src/emacs-module.c (module_make_function, module_make_string): Use new functions. (module_decode, module_decode_copy): Remove.
* Don't run buffer-related hooks in " *code conversion work*" buffersEli Zaretskii2019-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | Note: portions of this change were mistakenly pushed as part of an unrelated commit a35a1f6a9. * src/buffer.c (Fget_buffer_create): Set inhibit_buffer_hooks non-zero for temporary buffers created by coding.c. Don't run buffer-list-update-hook for such buffers. (Frename_buffer, Fkill_buffer, record_buffer) (Fbury_buffer_internal): Don't run hooks for buffers whose inhibit_buffer_hooks flag is set. * src/buffer.h (struct buffer): New member inhibit_buffer_hooks. * src/pdumper.c (dump_buffer): Dump the new field. Update the hash value in HASH_buffer_XXX. * src/coding.c (make_conversion_work_buffer): Function deleted; code moved to code_conversion_save. (code_conversion_save): Insert code from make_conversion_work_buffer, but arrange for unwind-protecting the current buffer before switching to the work buffer. This avoids leaving reused_workbuf_in_use set if user presses C-g during encoding/decoding. (Vcode_conversion_workbuf_name): Now external variable. * src/coding.h (Vcode_conversion_reused_workbuf): Declare.
* Fix misuses of NULL when talking about the NUL characterStefan Monnier2019-03-21
| | | | | | | | | | | | | | | | | | | | | | * lisp/subr.el (inhibit-null-byte-detection): Make it an obsolete alias. * src/coding.c (setup_coding_system): Use new name. (detect_coding): Rename null_byte_found => nul_byte_found. (detect_coding_system): Use new name. Rename null_byte_found => nul_byte_found. (Fdefine_coding_system_internal): Use new name. (syms_of_coding): Rename inhibit-null-byte-detection to inhibit-nul-byte-detection. * src/w16select.c (get_clipboard_data): null_char => nul_char. * src/json.c (check_string_without_embedded_nuls): Rename from check_string_without_embedded_nulls. (Fjson_parse_string): Adjust accordingly. * src/coding.h (enum define_coding_undecided_arg_index) (enum coding_attr_index): ...null_byte... => ...nul_byte.... * lisp/info.el (info-insert-file-contents, Info-insert-dir): * lisp/international/mule.el (define-coding-system): * lisp/vc/vc-git.el (vc-git--call): * doc/lispref/nonascii.texi (Lisp and Coding Systems): Use the new name.
* Merge from origin/emacs-26Glenn Morris2019-02-08
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0cd7b52 (origin/emacs-26) Minor improvements to do strings in callproc.c b8c7017 Improve documentation of 'date-to-time' and 'parse-time-string' 46095a7 Fix downloading of URLs that end in a slash 3b60a0a * doc/misc/eww.texi (Basics): Fix eww keybindings. (Bug#34291) 8e22025 Fix process-thread docstring 459b669 Fix failures of vc-find-revision with non-ASCII file names e9ff190 * doc/lispref/tips.texi (Documentation Tips): Fix quotes. (B... 3e49a08 ; * src/coding.h (struct coding_system): Fix a typo in a comm... b657286 Add documentation for tabulated-list functions in the elisp m... 6e0f67b Fix URL in ucs-normalize.el ce3ae1f * etc/PROBLEMS: Amend entry for profiler bug #34235 to mentio... # Conflicts: # doc/lispref/os.texi
| * ; * src/coding.h (struct coding_system): Fix a typo in a comment.Eli Zaretskii2019-02-06
| |
* | Merge from origin/emacs-26Paul Eggert2018-12-31
|\| | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-01
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Assume ‘emacs’ is defined in Emacs-only codePaul Eggert2018-12-17
| | | | | | | | | | | | | | * src/charset.c, src/coding.c, src/coding.h, src/gmalloc.c: * src/ralloc.c, src/regex-emacs.c: Simplify slightly by assuming that ‘emacs’ is defined. These modules have long been specific to Emacs, and are not used elsewhere.
* | Merge from origin/emacs-26Glenn Morris2018-07-02
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fc5cae7 ; Fix ChangeLog typo. e17a5e5 ; make change-history-commit f205928 * etc/HISTORY: Cite Brinkoff on early history. 4e58ca8 Document internal use of 'above-suspended' z-group frame para... 4bd43b0 Increase max-lisp-eval-depth adjustment while in debugger (bu... ab98352 Improve on last change in replace-buffer-contents 2f149c0 Fix a factual error in Introduction to Emacs Lisp 8ad50a3 ; * lisp/files.el (buffer-offer-save): Doc fix. (Bug#32000) c80f31f Minor improvements in documentation of imenu.el 8ebb683 Avoid errors with recentering in 'skeleton-insert' e980a3c * src/lisp.h: Omit obsolete comment re bytecode stack. eec71eb Speed up replace-buffer-contents 93c41ce Remove extra process call from vc-git-find-file-hook 7ea0873 ; Update some commentary 4a7f423 Speed up vc-git-dir-status-files 9134c84 Avoid compiler warning using coding.h Conflicts: src/editfns.c
| * Avoid compiler warning using coding.hEli Zaretskii2018-06-27
| | | | | | | | | | * src/coding.h: Add INLINE_HEADER_BEGIN..INLINE_HEADER_END, since this header now has an extern INLINE function.
| * Allow inserting non-BMP charactersPhilipp Stephani2018-06-17
| | | | | | | | | | | | | | | | | | | | * src/coding.h (UTF_16_HIGH_SURROGATE_P, UTF_16_LOW_SURROGATE_P): Move from coding.c and document. (surrogates_to_codepoint): New function. * src/nsterm.m (insertText:): Properly handle surrogate pairs. (cherry picked from commit 703ac3ea1c1ce381f385469a0e88bc29d3fe83c2)
* | ; * src/coding.h (surrogates_to_codepoint): Add prototype.Eli Zaretskii2018-01-15
| |
* | Allow inserting non-BMP charactersPhilipp Stephani2018-01-07
| | | | | | | | | | | | | | | | * src/coding.h (UTF_16_HIGH_SURROGATE_P, UTF_16_LOW_SURROGATE_P): Move from coding.c and document. (surrogates_to_codepoint): New function. * src/nsterm.m (insertText:): Properly handle surrogate pairs.
* | Merge from origin/emacs-26Paul Eggert2018-01-01
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 63b04c11d5 Fix copyright years by hand 5c7dd8a783 Update copyright year to 2018 220a9ecba1 Merge from Gnulib 312c565566 Don't add empty keyboard macro to macro ring (Bug#24992) 39ca289a7a Allow customization of decoding of "man" command f8240815ea * etc/NEWS: Add security consideration note on passphrase ... 0c78822c70 Fix subtle problem with scroll-down when scroll-margin is ... acd289c5a4 Fix problems with indexing in User manual b240c7846b * lisp/help.el (describe-key): Only (copy-sequence elt) wh... e879a5444a * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846 81b1028b63 Improve documentation of 'inhibit-modification-hooks' and ... 7175496d7a Fix doc string of 'enable-recursive-minibuffers' 5b38406491 Fix documentation of delsel and of killing text # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex
| * Update copyright year to 2018Paul Eggert2018-01-01
| | | | | | | | Run admin/update-copyright.
* | Improve error reporting when serializing non-Unicode strings to JSONPhilipp Stephani2017-12-30
|/ | | | | | | | | | | | | * src/coding.c (utf8_string_p): New helper function. (syms_of_coding) <utf-8-unix>: Move from json.c. * src/json.c (json_check_utf8): New helper function. (lisp_to_json_toplevel_1, lisp_to_json): Use it. To save a bit of time, check for invalid UTF-8 strings only after encountering an error, since Jansson already rejects them. * test/src/json-tests.el (json-serialize/invalid-unicode): Adapt expected error symbol.
* 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.
* Tighten recently-added UTF-8 checkPaul Eggert2017-04-17
| | | | | | * src/coding.c (encode_coding_utf_8): Now extern. * src/terminal.c (terminal_glyph_code) [HAVE_STRUCT_UNIPAIR_UNICODE]: Check for UTF-8, not just for multibyte.
* Remove unused coding enumsPaul Eggert2017-04-16
| | | | | * src/coding.h (enum coding_system_type, enum end_of_line_type): Remove; unused.
* Merge from origin/emacs-25Paul Eggert2017-01-01
|\ | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-31
| | | | | | | | Run admin/update-copyright.
* | emacs_strerror cleanupsPaul Eggert2016-06-11
|/ | | | | | | | | | | | | | | | | | | | * src/buffer.c, src/emacs.c, src/lread.c: Don’t include coding.h; no longer needed, now that emacs_strerror is declared by lisp.h. * src/coding.c (emacs_strerror): Remove; moved to emacs.c. * src/coding.h (emacs_strerror) [emacs]: Remove decl; moved to lisp.h. * src/emacs.c (emacs_strerror): Move here from coding.c. Do not convert result string; this is now the caller’s responsibility, as some need conversion and others don’t. * src/fileio.c (report_file_errno, report_file_notify_error): Use emacs_strerror rather than rolling it ourselves. * src/lisp.h (emacs_strerror): Move decl here from coding.h. * src/lread.c (dir_warning): Just call emacs_strerror rather than both strerror and emacs_strerror. Convert its result from locale-coding-system, since it no longer does that conversion. * src/sound.c (sound_perror): * src/sysdep.c (emacs_perror, str_collate): Use emacs_strerror, not strerror.
* 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.
* Update copyright year to 2016Paul Eggert2016-01-01
| | | | Run admin/update-copyright.
* 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.
* Avoid aborts when keyboard-coding-system is raw-text (Bug#19532)Eli Zaretskii2015-01-31
| | | | | | | src/coding.c (raw_text_coding_system_p): New function. src/keyboard.c (read_decoded_event_from_main_queue): Use it when the keyboard coding-system is 'raw-text'. src/coding.h (raw_text_coding_system_p): Add prototype.
* 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.
* Update copyright year to 2015Paul Eggert2015-01-01
| | | | Run admin/update-copyright.
* * coding.h (struct coding_system): Remove 'error_positions' (unused)Dmitry Antipov2014-07-10
| | | | | | | | | | and 'errors' (set but unused) fields. Use bitfields for 'eol_seen', 'mode', 'common_flags' and 'result' fields, adjust layout to avoid extra padding and shrink struct coding_system by 56 bytes (x86_64). * coding.c (decode_coding_utf_8, decode_coding_utf_16) (decode_coding_emacs_mule, decode_coding_iso_2022, decode_coding_sjis) (decode_coding_big5, decode_coding_charset, decode_coding) (encode_coding): Adjust users.
* Prefer 'ARRAYELTS (x)' to 'sizeof x / sizeof *x'.Paul Eggert2014-04-05
| | | | | | | | | | | | | | | | * alloc.c (memory_full): * charset.c (syms_of_charset): * doc.c (Fsnarf_documentation): * emacs.c (main): * font.c (BUILD_STYLE_TABLE): * keyboard.c (make_lispy_event): * profiler.c (setup_cpu_timer): * xgselect.c (xg_select): * xterm.c (record_event, STORE_KEYSYM_FOR_DEBUG): Use ARRAYELTS. * font.c (FONT_PROPERTY_TABLE_SIZE): Remove. Replace the only use with ARRAYELTS (font_property_table). * xfaces.c (DIM): Remove. All uses replaced by ARRAYELTS.
* Fix bug#16286 by the different way than ↵Kenichi Handa2014-01-29
| | | | 2014-01-26T00:32:30Z!eggert@cs.ucla.edu to preserve the code detection behavior of 24.3.
* When decoding, prefer ptrdiff_t to int for buffer positions etc.Paul Eggert2014-01-25
| | | | | | | | | * coding.c (detect_coding_utf_8, emacs_mule_char) (detect_coding_iso_2022, encode_coding_iso_2022, check_ascii) (check_utf_8, decode_coding): * coding.h (struct coding_system.errors): Use ptrdiff_t, not int, for integer values derived from buffer and string positions.
* Update copyright year to 2014 by running admin/update-copyright.Paul Eggert2014-01-01
|
* 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.