diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-03-21 12:42:16 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-03-21 12:42:16 -0400 |
commit | cafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch) | |
tree | 7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /src | |
parent | a08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff) | |
parent | 4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff) | |
download | emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.bz2 emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip |
Merge from trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/.gdbinit | 4 | ||||
-rw-r--r-- | src/ChangeLog.trunk | 797 | ||||
-rw-r--r-- | src/alloc.c | 90 | ||||
-rw-r--r-- | src/bidi.c | 3 | ||||
-rw-r--r-- | src/buffer.c | 283 | ||||
-rw-r--r-- | src/buffer.h | 72 | ||||
-rw-r--r-- | src/bytecode.c | 16 | ||||
-rw-r--r-- | src/callint.c | 28 | ||||
-rw-r--r-- | src/casefiddle.c | 31 | ||||
-rw-r--r-- | src/casetab.c | 6 | ||||
-rw-r--r-- | src/category.c | 4 | ||||
-rw-r--r-- | src/ccl.c | 57 | ||||
-rw-r--r-- | src/character.c | 2 | ||||
-rw-r--r-- | src/character.h | 57 | ||||
-rw-r--r-- | src/charset.c | 29 | ||||
-rw-r--r-- | src/charset.h | 7 | ||||
-rw-r--r-- | src/chartab.c | 45 | ||||
-rw-r--r-- | src/cm.c | 9 | ||||
-rw-r--r-- | src/cm.h | 33 | ||||
-rw-r--r-- | src/cmds.c | 6 | ||||
-rw-r--r-- | src/coding.c | 348 | ||||
-rw-r--r-- | src/config.in | 1388 | ||||
-rw-r--r-- | src/data.c | 40 | ||||
-rw-r--r-- | src/dbusbind.c | 49 | ||||
-rw-r--r-- | src/deps.mk | 28 | ||||
-rw-r--r-- | src/dired.c | 52 | ||||
-rw-r--r-- | src/dispextern.h | 8 | ||||
-rw-r--r-- | src/doc.c | 36 | ||||
-rw-r--r-- | src/editfns.c | 209 | ||||
-rw-r--r-- | src/emacs.c | 51 | ||||
-rw-r--r-- | src/eval.c | 63 | ||||
-rw-r--r-- | src/fileio.c | 109 | ||||
-rw-r--r-- | src/filelock.c | 10 | ||||
-rw-r--r-- | src/floatfns.c | 17 | ||||
-rw-r--r-- | src/fns.c | 25 | ||||
-rw-r--r-- | src/font.c | 84 | ||||
-rw-r--r-- | src/fontset.c | 17 | ||||
-rw-r--r-- | src/fringe.c | 20 | ||||
-rw-r--r-- | src/gtkutil.c | 338 | ||||
-rw-r--r-- | src/image.c | 64 | ||||
-rw-r--r-- | src/indent.c | 34 | ||||
-rw-r--r-- | src/insdel.c | 24 | ||||
-rw-r--r-- | src/intervals.c | 16 | ||||
-rw-r--r-- | src/keyboard.c | 244 | ||||
-rw-r--r-- | src/keyboard.h | 11 | ||||
-rw-r--r-- | src/keymap.c | 76 | ||||
-rw-r--r-- | src/lisp.h | 309 | ||||
-rw-r--r-- | src/lread.c | 67 | ||||
-rw-r--r-- | src/makefile.w32-in | 44 | ||||
-rw-r--r-- | src/marker.c | 12 | ||||
-rw-r--r-- | src/minibuf.c | 77 | ||||
-rw-r--r-- | src/msdos.c | 7 | ||||
-rw-r--r-- | src/msdos.h | 2 | ||||
-rw-r--r-- | src/nsterm.m | 18 | ||||
-rw-r--r-- | src/print.c | 26 | ||||
-rw-r--r-- | src/process.c | 19 | ||||
-rw-r--r-- | src/regex.c | 255 | ||||
-rw-r--r-- | src/s/aix4-2.h | 2 | ||||
-rw-r--r-- | src/s/cygwin.h | 3 | ||||
-rw-r--r-- | src/s/darwin.h | 3 | ||||
-rw-r--r-- | src/s/gnu-linux.h | 2 | ||||
-rw-r--r-- | src/s/irix6-5.h | 3 | ||||
-rw-r--r-- | src/scroll.c | 13 | ||||
-rw-r--r-- | src/search.c | 29 | ||||
-rw-r--r-- | src/syntax.c | 19 | ||||
-rw-r--r-- | src/sysdep.c | 37 | ||||
-rw-r--r-- | src/systime.h | 5 | ||||
-rw-r--r-- | src/systty.h | 3 | ||||
-rw-r--r-- | src/term.c | 78 | ||||
-rw-r--r-- | src/termcap.c | 18 | ||||
-rw-r--r-- | src/termchar.h | 93 | ||||
-rw-r--r-- | src/termhooks.h | 3 | ||||
-rw-r--r-- | src/terminal.c | 5 | ||||
-rw-r--r-- | src/tparam.c | 16 | ||||
-rw-r--r-- | src/tparam.h | 31 | ||||
-rw-r--r-- | src/unexaix.c | 9 | ||||
-rw-r--r-- | src/unexcoff.c | 8 | ||||
-rw-r--r-- | src/unexcw.c | 9 | ||||
-rw-r--r-- | src/unexec.h | 1 | ||||
-rw-r--r-- | src/unexelf.c | 28 | ||||
-rw-r--r-- | src/unexhp9k800.c | 6 | ||||
-rw-r--r-- | src/unexmacosx.c | 8 | ||||
-rw-r--r-- | src/unexsol.c | 7 | ||||
-rw-r--r-- | src/unexw32.c | 6 | ||||
-rw-r--r-- | src/w32.c | 5 | ||||
-rw-r--r-- | src/w32console.c | 9 | ||||
-rw-r--r-- | src/w32fns.c | 48 | ||||
-rw-r--r-- | src/w32font.c | 3 | ||||
-rw-r--r-- | src/w32inevt.c | 9 | ||||
-rw-r--r-- | src/w32menu.c | 8 | ||||
-rw-r--r-- | src/w32proc.c | 8 | ||||
-rw-r--r-- | src/w32select.c | 2 | ||||
-rw-r--r-- | src/w32term.c | 14 | ||||
-rw-r--r-- | src/w32term.h | 6 | ||||
-rw-r--r-- | src/w32uniscribe.c | 4 | ||||
-rw-r--r-- | src/w32xfns.c | 2 | ||||
-rw-r--r-- | src/window.c | 53 | ||||
-rw-r--r-- | src/window.h | 1 | ||||
-rw-r--r-- | src/xdisp.c | 65 | ||||
-rw-r--r-- | src/xfaces.c | 90 | ||||
-rw-r--r-- | src/xfns.c | 52 | ||||
-rw-r--r-- | src/xgselect.c | 17 | ||||
-rw-r--r-- | src/xmenu.c | 24 | ||||
-rw-r--r-- | src/xrdb.c | 10 | ||||
-rw-r--r-- | src/xselect.c | 34 | ||||
-rw-r--r-- | src/xsmfns.c | 6 | ||||
-rw-r--r-- | src/xterm.c | 222 | ||||
-rw-r--r-- | src/xterm.h | 14 |
108 files changed, 3187 insertions, 3740 deletions
diff --git a/src/.gdbinit b/src/.gdbinit index 3072dc956b9..2cf5663df91 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -392,7 +392,7 @@ define pwinx printf "Window %d ", $int xgetptr $w->buffer set $tem = (struct buffer *) $ptr - xgetptr $tem->name + xgetptr $tem->name_ printf "%s", ((struct Lisp_String *) $ptr)->data printf "\n" xgetptr $w->start @@ -938,7 +938,7 @@ end define xbuffer xgetptr $ print (struct buffer *) $ptr - xgetptr $->name + xgetptr $->name_ output ((struct Lisp_String *) $ptr)->data echo \n end diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk index a96edcdfdca..6fa2d821565 100644 --- a/src/ChangeLog.trunk +++ b/src/ChangeLog.trunk @@ -1,3 +1,796 @@ +2011-03-20 Glenn Morris <rgm@gnu.org> + + * config.in: Remove file. + +2011-03-20 Juanma Barranquero <lekktu@gmail.com> + + * minibuf.c (Vcompleting_read_function): Don't declare, global variables + are now in src/globals.h. + (syms_of_minibuf): Remove spurious & from previous change. + +2011-03-20 Leo <sdl.web@gmail.com> + + * minibuf.c (completing-read-function): New variable. + (completing-read-default): Rename from completing-read. + (completing-read): Call completing-read-function. + +2011-03-19 Juanma Barranquero <lekktu@gmail.com> + + * xfaces.c (Fx_load_color_file): + Read color file from absolute filename (bug#8250). + +2011-03-19 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in: Update dependencies. + +2011-03-17 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h. + +2011-03-17 Paul Eggert <eggert@cs.ucla.edu> + + Fix more problems found by GCC 4.5.2's static checks. + + * process.c (make_serial_process_unwind, send_process_trap): + (sigchld_handler): Now static. + + * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars. + That way, the code declares only the vars that it needs. + * s/aix4-2.h (PTY_ITERATION): Declare iteration vars. + * s/cygwin.h (PTY_ITERATION): Likewise. + * s/darwin.h (PTY_ITERATION): Likewise. + * s/gnu-linux.h (PTY_ITERATION): Likewise. + + * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling. + * process.c (allocate_pty): Don't declare stb unless it's needed. + + * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else". + (CONSTANTLIM): Remove; unused. + (METER_CODE, Bscan_buffer, Bread_char, Bset_mark): + Define only if needed. + + * unexelf.c (unexec): Name an expression, + to avoid gcc -Wbad-function-cast warning. + Use a different way to cause a compilation error if anyone uses + n rather than nn, a way that does not involve shadowing. + (ELF_BSS_SECTION_NAME, OLD_PROGRAM_H): Remove; unused. + + * deps.mk (unexalpha.o): Remove; unused. + + New file unexec.h, the (simple) interface for unexec (Bug#8267). + * unexec.h: New file. + * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o): + (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o): + Depend on unexec.h. + * emacs.c [!defined CANNOT_DUMP]: Include unexec.h. + * unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c: + * unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h. + Change as necessary to match prototype in unexec.h. + + * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid + shadowing. + (back_comment, skip_chars): Mark vars as initialized. + + * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS): + Rename locals to avoid shadowing. + + * lread.c (read1): Rewrite so as not to use empty "else". + (Fload, readevalloop, read1): Rename locals to avoid shadowing. + + * print.c (Fredirect_debugging_output): Fix pointer signedess. + + * lisp.h (debug_output_compilation_hack): Add decl here, to avoid + warning when compiling print.c. + + * font.c (font_unparse_fcname): Abort in an "impossible" situation + instead of using an uninitialized var. + (font_sort_entities): Mark var as initialized. + + * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing. + + * font.c (font_unparse_xlfd): Don't mix pointers to variables with + pointers to constants. + (font_parse_fcname): Remove unused vars. + (font_delete_unmatched): Now static. + (font_get_spec): Remove; unused. + (font_style_to_value, font_prop_validate_style, font_unparse_fcname): + (font_update_drivers, Ffont_get_glyphs, font_add_log): + Rename or move locals to avoid shadowing. + + * fns.c (require_nesting_list, require_unwind): Now static. + (Ffillarray): Rename locals to avoid shadowing. + + * floatfns.c (domain_error2): Define only if needed. + (Ffrexp, Fldexp): Rename locals to avoid shadowing. + + * alloc.c (mark_backtrace): Move decl from here ... + * lisp.h: ... to here, so that it can be checked. + + * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static. + (Fdefvar): Rewrite so as not to use empty "else". + (lisp_indirect_variable): Name an expression, + to avoid gcc -Wbad-function-cast warning. + (Fdefvar): Rename locals to avoid shadowing. + + * callint.c (quotify_arg, quotify_args): Now static. + (Fcall_interactively): Rename locals to avoid shadowing. + Use const pointer when appropriate. + + * lisp.h (get_system_name, get_operating_system_release): + Move decls here, to check interfaces. + * process.c (get_operating_system_release): Move decl to lisp.h. + * xrdb.c (get_system_name): Likewise. + * editfns.c (init_editfns, Fuser_login_name, Fuser_uid): + (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts, + some of which prompt warnings from gcc -Wbad-function-cast. + (Fformat_time_string, Fencode_time, Finsert_char): + (Ftranslate_region_internal, Fformat): + Rename or remove local vars to avoid shadowing. + (Ftranslate_region_internal): Mark var as initialized. + + * doc.c (Fdocumentation, Fsnarf_documentation): Move locals to + avoid shadowing. + + * lisp.h (eassert): Check that the argument compiles, even if + ENABLE_CHECKING is not defined. + + * data.c (Findirect_variable): Name an expression, to avoid + gcc -Wbad-function-cast warning. + (default_value, arithcompare, arith_driver, arith_error): Now static. + (store_symval_forwarding): Rename local to avoid shadowing. + (Fmake_variable_buffer_local, Fmake_local_variable): Mark + variables as initialized. + (do_blv_forwarding, do_symval_forwarding): Remove; unused. + + * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. + (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): + Rename locals to avoid shadowing. + (mark_stack): Move local variables into the #ifdef region where + they're used. + (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Define only if + ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT, as they are not + needed otherwise. + (CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS. + (GC_STRING_CHARS): Remove; not used. + (Fmemory_limit): Cast sbrk's returned value to char *. + + * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this + avoids undefined behavior in theory. + + * regex.c (IF_LINT): Add defn, for benefit of ../lib-src. + + Use functions, not macros, for up- and down-casing (Bug#8254). + * buffer.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP): + (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Remove. All callers changed + to use the following functions instead of these macros. + (downcase): Adjust to lack of DOWNCASE_TABLE. Return int, not + EMACS_INT, since callers assume the returned value fits in int. + (upcase1): Likewise, for UPCASE_TABLE. + (uppercasep, lowercasep, upcase): New static inline functions. + * editfns.c (Fchar_equal): Remove no-longer-needed workaround for + the race-condition problem in the old DOWNCASE. + + * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT): + Rename locals to avoid shadowing. + (regex_compile, re_match_2_internal): Move locals to avoid shadowing. + (regex_compile, re_search_2, re_match_2_internal): + Remove unused local vars. + (FREE_VAR): Rewrite so as not to use empty "else", + which gcc can warn about. + (regex_compile, re_match_2_internal): Mark locals as initialized. + (RETALLOC_IF): Define only if needed. + (WORDCHAR_P): Likewise. This one is never needed, but is used + only in a comment talking about a compiler bug, so put inside + the #if 0 of that comment. + (CHARSET_LOOKUP_BITMAP, FAIL_STACK_FULL, RESET_FAIL_STACK): + (PUSH_FAILURE_ELT, BUF_PUSH_3, STOP_ADDR_VSTRING): + Remove; unused. + + * search.c (boyer_moore): Rename locals to avoid shadowing. + * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): + (PREV_CHAR_BOUNDARY): Likewise. + + * search.c (simple_search): Remove unused var. + + * dired.c (compile_pattern): Move decl from here ... + * lisp.h: ... to here, so that it can be checked. + (struct re_registers): New forward decl. + + * character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing. + + * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width. + All uses changed. + (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion): + Rename locals to avoid shadowing. + (Fvertical_motion): Mark locals as initialized. + + * casefiddle.c (casify_object, casify_region): Now static. + (casify_region): Mark local as initialized. + + * cmds.c (internal_self_insert): Rename local to avoid shadowing. + + * lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR): + New macros, so that the caller can use some names other than + gcpro1, gcpro2, etc. + (GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6): Reimplement in terms + of the new macros. + (GCPRO1_VAR, UNGCPRO_VAR): Change the meaning of the second + argument, for consistency with GCPRO2_VAR, etc: it is now the + prefix of the variable, not the variable itself. All uses + changed. + * dired.c (directory_files_internal, file_name_completion): + Rename locals to avoid shadowing. + + Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254). + An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in + dired.c's scmp function, had undefined behavior. + * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP): + (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ... + * buffer.h: ... to here, because these macros use current_buffer, + and the new implementation with inline functions needs to have + current_buffer in scope now, rather than later when the macros + are used. + (downcase, upcase1): New static inline functions. + (DOWNCASE, UPCASE1): Reimplement using these functions. + This avoids undefined behavior in expressions like + DOWNCASE (x) == DOWNCASE (y), which previously suffered + from race conditions in accessing the global variables + case_temp1 and case_temp2. + * casetab.c (case_temp1, case_temp2): Remove; no longer needed. + * lisp.h (case_temp1, case_temp2): Remove their decls. + * character.h (ASCII_CHAR_P): Move from here ... + * lisp.h: ... to here, so that the inline functions mentioned + above can use them. + + * dired.c (directory_files_internal_unwind): Now static. + + * fileio.c (file_name_as_directory, directory_file_name): + (barf_or_query_if_file_exists, auto_save_error, auto_save_1): + Now static. + (file_name_as_directory): Use const pointers when appropriate. + (Fexpand_file_name): Likewise. In particular, newdir might + point at constant storage, so make it a const pointer. + (Fmake_directory_internal, Fread_file_name): Remove unused vars. + (Ffile_selinux_context, Fset_file_selinux_context): Fix pointer + signedness issues. + (Fset_file_times, Finsert_file_contents, auto_save_error): + Rename locals to avoid shadowing. + + * minibuf.c (choose_minibuf_frame_1): Now static. + (Ftry_completion, Fall_completions): Rename or remove locals + to avoid shadowing. + + * marker.c (bytepos_to_charpos): Remove; unused. + + * lisp.h (verify_bytepos, count_markers): New decls, + so that gcc does not warn that these functions aren't declared. + + * insdel.c (check_markers, make_gap_larger, make_gap_smaller): + (reset_var_on_error, Fcombine_after_change_execute_1): Now static. + (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic. + (copy_text): Remove unused local var. + + * filelock.c (within_one_second): Now static. + (lock_file_1): Rename local to avoid shadowing. + + * buffer.c (fix_overlays_before): Mark locals as initialized. + (fix_start_end_in_overlays): Likewise. This function should be + simplified by using pointers-to-pointers, but that's a different + matter. + (switch_to_buffer_1): Now static. + (Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte): + (report_overlay_modification): Rename locals to avoid shadowing. + + * sysdep.c (system_process_attributes): Rename vars to avoid shadowing. + Fix pointer signedness issue. + (sys_subshell): Mark local as volatile if checking for lint, + to suppress a gcc -Wclobbered warning that does not seem to be right. + (MAXPATHLEN): Define only if needed. + + * process.c (serial_open, serial_configure): Move decls from here ... + * systty.h: ... to here, so that they can be checked. + + * fns.c (get_random, seed_random): Move extern decls from here ... + * lisp.h: ... to here, so that they can be checked. + + * sysdep.c (reset_io): Now static. + (wait_for_termination_signal): Remove; unused. + + * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal): + (copy_keymap_item, append_key, push_text_char_description): + Now static. + (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily. + (DENSE_TABLE_SIZE): Remove; unused. + (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal): + (describe_map_tree): + Rename locals to avoid shadowing. + + * keyboard.c: Declare functions static if they are not used elsewhere. + (echo_char, echo_dash, cmd_error, top_level_2): + (poll_for_input, handle_async_input): Now static. + (read_char, kbd_buffer_get_event, make_lispy_position): + (make_lispy_event, make_lispy_movement, apply_modifiers): + (decode_keyboard_code, tty_read_avail_input, menu_bar_items): + (parse_tool_bar_item, read_key_sequence, Fread_key_sequence): + (Fread_key_sequence_vector): Rename locals to avoid shadowing. + (read_key_sequence, read_char): Mark locals as initialized. + (Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN. + + * keyboard.h (make_ctrl_char): New decl. + (mark_kboards): Move decl here ... + * alloc.c (mark_kboards): ... from here. + + * lisp.h (force_auto_save_soon): New decl. + + * emacs.c (init_cmdargs): Rename local to avoid shadowing. + (DEFINE_DUMMY_FUNCTION): New macro. + (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main): + Use it. + (main): Add casts to avoid warnings + if GCC considers string literals to be constants. + + * lisp.h (fatal_error_signal): Add decl, since it's exported. + + * dbusbind.c: Pointer signedness fixes. + (xd_signature, xd_append_arg, xd_initialize): + (Fdbus_call_method, Fdbus_call_method_asynchronously): + (Fdbus_method_return_internal, Fdbus_method_error_internal): + (Fdbus_send_signal, xd_read_message_1, Fdbus_register_service): + (Fdbus_register_signal): Use SSDATA when the context wants char *. + + * dbusbind.c (Fdbus_init_bus): Add cast to avoid warning + if GCC considers string literals to be constants. + (Fdbus_register_service, Fdbus_register_method): Remove unused vars. + +2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca> + + * print.c (PRINT_CIRCLE_CANDIDATE_P): New macro. + (print_preprocess, print_object): New macro to fix last change. + + * print.c (print_preprocess): Don't forget font objects. + +2011-03-16 Juanma Barranquero <lekktu@gmail.com> + + * emacs.c (USAGE3): Doc fixes. + +2011-03-15 Andreas Schwab <schwab@linux-m68k.org> + + * coding.c (detect_coding_iso_2022): Reorganize code to clarify + structure. + +2011-03-14 Juanma Barranquero <lekktu@gmail.com> + + * lisp.h (VWindow_system, Qfile_name_history): + * keyboard.h (lispy_function_keys) [WINDOWSNT]: + * w32term.h (w32_system_caret_hwnd, w32_system_caret_height) + (w32_system_caret_x, w32_system_caret_y): Declare extern. + + * w32select.c: Don't #include "keyboard.h". + (run_protected): Add extern declaration for waiting_for_input. + + * w32.c (Qlocal, noninteractive1, inhibit_window_system): + * w32console.c (detect_input_pending, read_input_pending) + (encode_terminal_code): + * w32fns.c (quit_char, lispy_function_keys, Qtooltip) + (w32_system_caret_hwnd, w32_system_caret_height, w32_system_caret_x) + (w32_system_caret_y, Qfile_name_history): + * w32font.c (w32font_driver, QCantialias, QCotf, QClang): + * w32inevt.c (reinvoke_input_signal, lispy_function_keys): + * w32menu.c (Qmenu_bar, QCtoggle, QCradio, Qoverriding_local_map) + (Qoverriding_terminal_local_map, Qmenu_bar_update_hook): + * w32proc.c (Qlocal, report_file_error): + * w32term.c (Vwindow_system, updating_frame): + * w32uniscribe.c (initialized, uniscribe_font_driver): + Remove unneeded extern declarations. + +2011-03-14 Chong Yidong <cyd@stupidchicken.com> + + * buffer.c (Fmake_indirect_buffer): Fix incorrect assertions. + +2011-03-13 Chong Yidong <cyd@stupidchicken.com> + + * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) + (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). + These macros can no longer be used for assignment. + + * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign + struct members directly, instead of using BUF_BEGV etc. + (record_buffer_markers, fetch_buffer_markers): New functions for + recording and fetching special buffer markers. + (set_buffer_internal_1, set_buffer_temp): Use them. + + * lread.c (unreadchar): Use SET_BUF_PT_BOTH. + + * insdel.c (adjust_point): Use SET_BUF_PT_BOTH. + + * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH. + (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH. + + * xdisp.c (hscroll_window_tree): + (reconsider_clip_changes): Use PT instead of BUF_PT. + +2011-03-13 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in ($(BLD)/editfns.$(O)): Depend on + $(EMACS_ROOT)/lib/intprops.h. + +2011-03-13 Paul Eggert <eggert@cs.ucla.edu> + + Fix more problems found by GCC 4.5.2's static checks. + + * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char * + to unsigned char * to avoid compiler diagnostic. + (xg_free_frame_widgets): Make it clear that a local variable is + needed only if USE_GTK_TOOLTIP. + (gdk_window_get_screen): Make it clear that this macro is needed + only if USE_GTK_TOOLTIP. + (int_gtk_range_get_value): New function, which avoids a diagnostic + from gcc -Wbad-function-cast. + (xg_set_toolkit_scroll_bar_thumb): Use it. + (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid + diagnostic from gcc -Wbad-function-cast. + (get_utf8_string, xg_get_file_with_chooser): + Rename locals to avoid shadowing. + (create_dialog): Move locals to avoid shadowing. + + * xgselect.c (xg_select): Remove unused var. + + * image.c (four_corners_best): Mark locals as initialized. + (gif_load): Initialize transparent_p to zero (Bug#8238). + Mark another local as initialized. + (my_png_error, my_error_exit): Mark with NO_RETURN. + + * image.c (clear_image_cache): Now static. + (DIM, HAVE_STDLIB_H_1): Remove unused macros. + (xpm_load): Redo to avoid "discards qualifiers" gcc warning. + (x_edge_detection): Remove unnecessary cast that + gcc -Wbad-function-cast diagnoses. + (gif_load): Fix pointer signedness. + (clear_image_cache, xbm_read_bitmap_data, x_detect_edges): + (jpeg_load, gif_load): Rename locals to avoid shadowing. + +2011-03-11 Paul Eggert <eggert@cs.ucla.edu> + + Improve quality of tests for time stamp overflow. + For example, without this patch (encode-time 0 0 0 1 1 + 1152921504606846976) returns the obviously-bogus value (-948597 + 62170) on my RHEL 5.5 x86-64 host. With the patch, it correctly + reports time overflow. See + <http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00470.html>. + * deps.mk (editfns.o): Depend on ../lib/intprops.h. + * editfns.c: Include limits.h and intprops.h. + (TIME_T_MIN, TIME_T_MAX): New macros. + (time_overflow): Move earlier, to before first use. + (hi_time, lo_time): New functions, for an accurate test for + out-of-range times. + (Fcurrent_time, Fget_internal_run_time, make_time): Use them. + (Fget_internal_run_time): Don't assume time_t fits in int. + (make_time): Use list2 instead of Fcons twice. + (Fdecode_time): More accurate test for out-of-range times. + (check_tm_member): New function. + (Fencode_time): Use it, to test for out-of-range times. + (lisp_time_argument): Don't rely on undefined left-shift and + right-shift behavior when checking for time stamp overflow. + + * editfns.c (time_overflow): New function, refactoring common code. + (Fformat_time_string, Fdecode_time, Fencode_time): + (Fcurrent_time_string): Use it. + + Move 'make_time' to be next to its inverse 'lisp_time_argument'. + * dired.c (make_time): Move to ... + * editfns.c (make_time): ... here. + * systime.h: Note the move. + +2011-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * fringe.c (update_window_fringes): Remove unused variables. + + * unexmacosx.c (copy_data_segment): Also copy __got section. + (Bug#8223) + +2011-03-12 Eli Zaretskii <eliz@gnu.org> + + * termcap.c [MSDOS]: Include "msdos.h". + (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent): + Constify `char *' arguments and their references according to + prototypes in tparam.h. + + * deps.mk (termcap.o): Depend on tparam.h and msdos.h. + + * msdos.c (XMenuAddPane): 3rd argument is `const char *' now. + Adapt all references accordingly. + + * msdos.h (XMenuAddPane): 3rd argument is `const char *' now. + +2011-03-11 Tom Tromey <tromey@redhat.com> + + * buffer.c (syms_of_buffer): Remove obsolete comment. + +2011-03-11 Eli Zaretskii <eliz@gnu.org> + + * termhooks.h (encode_terminal_code): Declare prototype. + + * msdos.c (encode_terminal_code): Don't declare prototype. + + * term.c (encode_terminal_code): Now external again, used by + w32console.c and msdos.c. + + * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): Depend + on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu. + +2011-03-11 Paul Eggert <eggert@cs.ucla.edu> + + Fix some minor problems found by GCC 4.5.2's static checks. + + * fringe.c (update_window_fringes): Mark locals as initialized + (Bug#8227). + (destroy_fringe_bitmap, init_fringe_bitmap): Now static. + + * alloc.c (mark_fringe_data): Move decl from here ... + * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here, + to check its interface. + (init_fringe_once): Do not declare unless HAVE_WINDOW_SYSTEM. + + * fontset.c (free_realized_fontset): Now static. + (Fset_fontset_font): Rename local to avoid shadowing. + (fontset_font): Mark local as initialized. + (FONTSET_SPEC, FONTSET_REPERTORY, RFONT_DEF_REPERTORY): Remove; unused. + + * xrdb.c: Include "xterm.h", to check x_load_resources's interface. + + * xselect.c (x_disown_buffer_selections): Remove; not used. + (TRACE3) [!defined TRACE_SELECTION]: Remove; not used. + (x_own_selection, Fx_disown_selection_internal): Rename locals + to avoid shadowing. + (x_handle_dnd_message): Remove local to avoid shadowing. + + * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros, + so that the caller can use some name other than gcpro1. + (GCPRO1, UNGCPRO): Reimplement in terms of the new macros. + * xfns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip): + (Fx_backspace_delete_keys_p): + Use them to avoid shadowing, and rename vars to avoid shadowing. + (x_decode_color, x_set_name, x_window): Now static. + (Fx_create_frame): Add braces to silence GCC warning. + (Fx_file_dialog, Fx_select_font): Fix pointer signedness. + (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame): + Remove unused locals. + (Fx_create_frame, x_create_tip_frame, Fx_show_tip): + (Fx_backspace_delete_keys_p): Rename locals to avoid shadowing. + Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR + macros. + + * xterm.h (x_mouse_leave): New decl. + + * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame): + Remove unused functions. + (x_shift_glyphs_for_insert, XTflash, XTring_bell): + (x_calc_absolute_position): Now static. + (XTread_socket): Don't define label "out" unless it's used. + Don't declare local "event" unless it's used. + (x_iconify_frame, x_free_frame_resources): Don't declare locals + unless they are used. + (XEMBED_VERSION, xembed_set_info): Don't define unless needed. + (x_fatal_error_signal): Remove; not used. + (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position): + (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor): + (x_error_catcher, x_connection_closed, x_error_handler): + (x_error_quitter, xembed_send_message, x_iconify_frame): + (my_log_handler): Rename locals to avoid shadowing. + (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN. + (x_connection_closed): Tell GCC not to suggest NO_RETURN. + + * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename + or move locals to avoid shadowing. + (tty_defined_color, merge_face_heights): Now static. + (free_realized_faces_for_fontset): Remove; not used. + (Fx_list_fonts): Mark variable that gcc -Wuninitialized + does not deduce is never used uninitialized. + (STRDUPA, LSTRDUPA, FONT_POINT_SIZE_QUANTUM): Remove; not used. + (LFACEP): Define only if XASSERTS, as it's not needed otherwise. + + * terminal.c (store_terminal_param): Now static. + + * xmenu.c (menu_highlight_callback): Now static. + (set_frame_menubar): Remove unused local. + (xmenu_show): Rename parameter to avoid shadowing. + (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const" + since they might point to immutable storage. + (next_menubar_widget_id): Declare only if USE_X_TOOLKIT, + since it's unused otherwise. + + * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. + Add a FIXME, since the code still doesn't look right. (Bug#8215) + (Fcurrent_bidi_paragraph_direction): Simplify slightly; this + avoids a gcc -Wuninitialized diagnostic. + (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs): + (note_mouse_highlight): Mark variables that gcc -Wuninitialized + does not deduce are never used uninitialized. + + * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c. + + * xdisp.c (redisplay_window): Rename local to avoid shadowing. + * window.c (window_loop, size_window): + (run_window_configuration_change_hook, enlarge_window): Likewise. + + * window.c (display_buffer): Now static. + (size_window): Mark variables that gcc -Wuninitialized + does not deduce are never used uninitialized. + * window.h (check_all_windows): New decl, to forestall + gcc -Wmissing-prototypes diagnostic. + * dispextern.h (bidi_dump_cached_states): Likewise. + + * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid + shadowing. + * charset.c (map_charset_for_dump, Fchar_charset): Likewise. + Include <limits.h>. + (Fsort_charsets): Redo min/max calculation to shorten the code a bit + and to avoid gcc -Wuninitialized warning. + (load_charset_map): Mark variables that gcc -Wuninitialized + does not deduce are never used uninitialized. + (load_charset): Abort instead of using uninitialized var (Bug#8229). + + * coding.c (coding_set_source, coding_set_destination): + Use "else { /* comment */ }" rather than "else /* comment */;" + for clarity, and to avoid gcc -Wempty-body warning. + (Fdefine_coding_system_internal): Don't redeclare 'i' inside + a block, when the outer 'i' will do. + (decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule): + (emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022): + (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5): + (decode_coding_raw_text, decode_coding_charset, get_translation_table): + (Fdecode_sjis_char, Fdefine_coding_system_internal): + Rename locals to avoid shadowing. + * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise. + * coding.c (emacs_mule_char, encode_invocation_designation): + Now static, since they're not used elsewhere. + (decode_coding_iso_2022): Add "default: abort ();" as a safety check. + (decode_coding_object, encode_coding_object, detect_coding_system): + (decode_coding_emacs_mule): Mark variables that gcc + -Wuninitialized does not deduce are never used uninitialized. + (detect_coding_iso_2022): Initialize a local variable that might + be used uninitialized. Leave a FIXME because it's not clear that + this initialization is needed. (Bug#8211) + (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT): + (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P): + (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER): + (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R): + Remove unused macros. + + * category.c (hash_get_category_set): Remove unused local var. + (copy_category_table): Now static, since it's not used elsewhere. + * character.c (string_count_byte8): Likewise. + + * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string): + (Fregister_code_conversion_map): Rename locals to avoid shadowing. + + * chartab.c (copy_sub_char_table): Now static, since it's not used + elsewhere. + (sub_char_table_ref_and_range, char_table_ref_and_range): + Rename locals to avoid shadowing. + (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros. + + * bidi.c (bidi_check_type): Now static, since it's not used elsewhere. + (BIDI_BOB): Remove unused macro. + + * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not + deduce are never used uninitialized. + * term.c (encode_terminal_code): Likewise. + + * term.c (encode_terminal_code): Now static. Remove unused local. + + * tparam.h: New file. + * term.c, tparam.h: Include it. + * deps.mk (term.o, tparam.o): Depend on tparam.h. + * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr): + Move these decls to tparam.h, and make them agree with what + is actually in tparam.c. The previous trick of using incompatible + decls in different modules does not conform to the C standard. + All callers of tparam changed to use tparam's actual API. + * tparam.c (tparam1, tparam, tgoto): + Use const pointers where appropriate. + + * cm.c (calccost, cmgoto): Use const pointers where appropriate. + * cm.h (struct cm): Likewise. + * dispextern.h (do_line_insertion_deletion_costs): Likewise. + * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise. + * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table): + (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph): + (turn_on_face, init_tty): Likewise. + * termchar.h (struct tty_display_info): Likewise. + + * term.c (term_mouse_position): Rename local to avoid shadowing. + + * alloc.c (mark_ttys): Move decl from here ... + * lisp.h (mark_ttys): ... to here, so that it's checked against defn. + +2011-03-11 Andreas Schwab <schwab@linux-m68k.org> + + * .gdbinit (pwinx, xbuffer): Fix access to buffer name. + +2011-03-09 Juanma Barranquero <lekktu@gmail.com> + + * search.c (compile_pattern_1): Remove argument regp, unused since + revid:rms@gnu.org-19941211082627-3x1g1wyqkjmwloig. + (compile_pattern): Don't pass it. + +2011-03-08 Jan Djärv <jan.h.d@swipnet.se> + + * xterm.h (DEFAULT_GDK_DISPLAY): New define. + (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines + for ! HAVE_GTK3. + (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID. + + * xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size. + + * gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define + gdk_window_get_screen, gdk_window_get_geometry, + gdk_x11_window_lookup_for_display and GDK_KEY_g. + (xg_set_screen): Use DEFAULT_GDK_DISPLAY. + (xg_get_pixbuf_from_pixmap): New function. + (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap + to Pixmap, take frame as parameter, remove GdkColormap parameter. + Call xg_get_pixbuf_from_pixmap instead of + gdk_pixbuf_get_from_drawable. + (xg_get_image_for_pixmap): Do not make GdkPixmaps, call + xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead. + (xg_check_special_colors): Use GtkStyleContext and its functions + for HAVE_GTK3. + (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen. + (xg_prepare_tooltip, create_dialog, menubar_map_cb) + (xg_update_frame_menubar, xg_tool_bar_detach_callback) + (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call + gtk_widget_get_preferred_size. + (xg_frame_resized): gdk_window_get_geometry only takes 5 + parameters. + (xg_win_to_widget, xg_event_is_for_menubar): Call + gdk_x11_window_lookup_for_display. + (xg_set_widget_bg): New function. + (delete_cb): New function. + (xg_create_frame_widgets): connect delete-event to delete_cb. + Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3 + (xg_set_background_color): Call xg_set_widget_bg. + (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask. + (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3. + Only call gtk_range_set_update_policy if ! HAVE_GTK3. + (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback + if ! HAVE_GTK3. + (update_frame_tool_bar): Call gtk_widget_hide. + (xg_initialize): Use GDK_KEY_g. + + * xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id + if ! HAVE_GTK3 + (x_session_initialize): Call gdk_x11_set_sm_client_id. + + * xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3. + (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS. + Load ~/emacs.d/gtkrc only for ! HAVE_GTK3. + +2011-03-08 Juanma Barranquero <lekktu@gmail.com> + + * w32xfns.c (select_palette): Check success of RealizePalette against + GDI_ERROR, not zero. + +2011-03-07 Ben Key <bkey76@gmail.com> + + * w32fns.c (FILE_NAME_COMBO_BOX, FILE_NAME_LIST): Define. + (file_dialog_callback): Fix locating the window handle of the File Name + text field. After disabling it, set focus on the list control. + (Fx_file_dialog): If only_dir_p is non-nil, set the text of the File + Name text field to "Current Directory" if it does not already have + another value. (Bug#8181) + +2011-03-07 Adrian Robert <Adrian.B.Robert@gmail.com> + + * nsterm.m (ns_draw_window_cursor): Fix handling of "cursor_width" + parameter for hbar cursors. Based on a patch by Ben Key + <bkey76@gmail.com>. + +2011-03-06 Chong Yidong <cyd@stupidchicken.com> + + * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 + change. + 2011-03-06 Paul Eggert <eggert@cs.ucla.edu> current_column: Now returns EMACS_INT, fixing some iftc @@ -46,7 +839,7 @@ * xdisp.c (BUILD_GLYPHLESS_GLYPH_STRING): Omit unused local var. (produce_glyphless_glyph): Make a pointer "const" since it might point to immutable storage. - (update_window_cursor): Now static, since it's not used elsewhere. + (update_window_cursor): Now static, since it's not used elsewhere. (SKIP_GLYPHS): Removed unused macro. 2011-03-06 Michael Shields <shields@msrl.com> (tiny change) @@ -132,7 +925,7 @@ as per recent filemodestring API change. Reported by Jonas Öster in <http://lists.gnu.org/archive/html/emacs-devel/2011-02/msg01069.html>. -2011-02-23 Ben Key <bkey76@gmail.com> (tiny change) +2011-02-23 Ben Key <bkey76@gmail.com> * nsterm.m (ns_draw_window_cursor): Obey the cursor_width argument directly, for bar cursors. diff --git a/src/alloc.c b/src/alloc.c index c7fd8747f74..0ca702fe0cd 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -92,7 +92,8 @@ extern __malloc_size_t __malloc_extra_blocks; #endif /* not DOUG_LEA_MALLOC */ -#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) +#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT +#ifdef HAVE_GTK_AND_PTHREAD /* When GTK uses the file chooser dialog, different backends can be loaded dynamically. One such a backend is the Gnome VFS backend that gets loaded @@ -130,12 +131,13 @@ static pthread_mutex_t alloc_mutex; } \ while (0) -#else /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */ +#else /* ! defined HAVE_GTK_AND_PTHREAD */ #define BLOCK_INPUT_ALLOC BLOCK_INPUT #define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT -#endif /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */ +#endif /* ! defined HAVE_GTK_AND_PTHREAD */ +#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */ /* Value of _bytes_used, when spare_memory was freed. */ @@ -152,13 +154,11 @@ static __malloc_size_t bytes_used_when_full; #define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG) #define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0) -/* Value is the number of bytes/chars of S, a pointer to a struct - Lisp_String. This must be used instead of STRING_BYTES (S) or - S->size during GC, because S->size contains the mark bit for +/* Value is the number of bytes of S, a pointer to a struct Lisp_String. + Be careful during GC, because S->size contains the mark bit for strings. */ #define GC_STRING_BYTES(S) (STRING_BYTES (S)) -#define GC_STRING_CHARS(S) ((S)->size & ~ARRAY_MARK_FLAG) /* Global variables. */ struct emacs_globals globals; @@ -270,17 +270,10 @@ Lisp_Object Qpost_gc_hook; static void mark_buffer (Lisp_Object); static void mark_terminals (void); -extern void mark_kboards (void); -extern void mark_ttys (void); -extern void mark_backtrace (void); static void gc_sweep (void); static void mark_glyph_matrix (struct glyph_matrix *); static void mark_face_cache (struct face_cache *); -#ifdef HAVE_WINDOW_SYSTEM -extern void mark_fringe_data (void); -#endif /* HAVE_WINDOW_SYSTEM */ - static struct Lisp_String *allocate_string (void); static void compact_small_strings (void); static void free_large_strings (void); @@ -2659,17 +2652,17 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, return val; } +#ifdef GC_CHECK_CONS_LIST /* Get an error now if there's any junk in the cons free list. */ void check_cons_list (void) { -#ifdef GC_CHECK_CONS_LIST struct Lisp_Cons *tail = cons_free_list; while (tail) tail = tail->u.chain; -#endif } +#endif /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ @@ -2909,15 +2902,15 @@ See also the function `vector'. */) { Lisp_Object vector; register EMACS_INT sizei; - register EMACS_INT index; + register EMACS_INT i; register struct Lisp_Vector *p; CHECK_NATNUM (length); sizei = XFASTINT (length); p = allocate_vector (sizei); - for (index = 0; index < sizei; index++) - p->contents[index] = init; + for (i = 0; i < sizei; i++) + p->contents[i] = init; XSETVECTOR (vector, p); return vector; @@ -2931,14 +2924,14 @@ usage: (vector &rest OBJECTS) */) (register int nargs, Lisp_Object *args) { register Lisp_Object len, val; - register int index; + register int i; register struct Lisp_Vector *p; XSETFASTINT (len, nargs); val = Fmake_vector (len, Qnil); p = XVECTOR (val); - for (index = 0; index < nargs; index++) - p->contents[index] = args[index]; + for (i = 0; i < nargs; i++) + p->contents[i] = args[i]; return val; } @@ -2962,7 +2955,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT (register int nargs, Lisp_Object *args) { register Lisp_Object len, val; - register int index; + register int i; register struct Lisp_Vector *p; XSETFASTINT (len, nargs); @@ -2980,11 +2973,11 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT args[1] = Fstring_as_unibyte (args[1]); p = XVECTOR (val); - for (index = 0; index < nargs; index++) + for (i = 0; i < nargs; i++) { if (!NILP (Vpurify_flag)) - args[index] = Fpurecopy (args[index]); - p->contents[index] = args[index]; + args[i] = Fpurecopy (args[i]); + p->contents[i] = args[i]; } XSETPVECTYPE (p, PVEC_COMPILED); XSETCOMPILED (val, p); @@ -4328,12 +4321,6 @@ static void mark_stack (void) { int i; - /* jmp_buf may not be aligned enough on darwin-ppc64 */ - union aligned_jmpbuf { - Lisp_Object o; - jmp_buf j; - } j; - volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; void *end; #ifdef HAVE___BUILTIN_UNWIND_INIT @@ -4343,6 +4330,14 @@ mark_stack (void) __builtin_unwind_init (); end = &end; #else /* not HAVE___BUILTIN_UNWIND_INIT */ +#ifndef GC_SAVE_REGISTERS_ON_STACK + /* jmp_buf may not be aligned enough on darwin-ppc64 */ + union aligned_jmpbuf { + Lisp_Object o; + jmp_buf j; + } j; + volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; +#endif /* This trick flushes the register windows so that all the state of the process is contained in the stack. */ /* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is @@ -5079,18 +5074,18 @@ returns nil, because real GC can't be done. */) if (FLOATP (Vgc_cons_percentage)) { /* Set gc_cons_combined_threshold. */ - EMACS_INT total = 0; - - total += total_conses * sizeof (struct Lisp_Cons); - total += total_symbols * sizeof (struct Lisp_Symbol); - total += total_markers * sizeof (union Lisp_Misc); - total += total_string_size; - total += total_vector_size * sizeof (Lisp_Object); - total += total_floats * sizeof (struct Lisp_Float); - total += total_intervals * sizeof (struct interval); - total += total_strings * sizeof (struct Lisp_String); - - gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage); + EMACS_INT tot = 0; + + tot += total_conses * sizeof (struct Lisp_Cons); + tot += total_symbols * sizeof (struct Lisp_Symbol); + tot += total_markers * sizeof (union Lisp_Misc); + tot += total_string_size; + tot += total_vector_size * sizeof (Lisp_Object); + tot += total_floats * sizeof (struct Lisp_Float); + tot += total_intervals * sizeof (struct interval); + tot += total_strings * sizeof (struct Lisp_String); + + gc_relative_threshold = tot * XFLOAT_DATA (Vgc_cons_percentage); } else gc_relative_threshold = 0; @@ -5139,9 +5134,9 @@ returns nil, because real GC can't be done. */) if (!NILP (Vpost_gc_hook)) { - int count = inhibit_garbage_collection (); + int gc_count = inhibit_garbage_collection (); safe_run_hooks (Qpost_gc_hook); - unbind_to (count, Qnil); + unbind_to (gc_count, Qnil); } /* Accumulate statistics. */ @@ -5320,7 +5315,6 @@ mark_object (Lisp_Object arg) #else /* not GC_CHECK_MARKED_OBJECTS */ -#define CHECK_ALLOCATED() (void) 0 #define CHECK_LIVE(LIVEP) (void) 0 #define CHECK_ALLOCATED_AND_LIVE(LIVEP) (void) 0 @@ -6072,7 +6066,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer. */) { Lisp_Object end; - XSETINT (end, (EMACS_INT) sbrk (0) / 1024); + XSETINT (end, (EMACS_INT) (char *) sbrk (0) / 1024); return end; } diff --git a/src/bidi.c b/src/bidi.c index eeacf65bd5c..3457e177436 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -72,7 +72,6 @@ static Lisp_Object bidi_type_table, bidi_mirror_table; #define RLO_CHAR 0x202E #define BIDI_EOB -1 -#define BIDI_BOB -2 /* FIXME: Is this needed? */ /* Local data structures. (Look in dispextern.h for the rest.) */ @@ -180,7 +179,7 @@ bidi_get_type (int ch, bidi_dir_t override) } } -void +static void bidi_check_type (bidi_type_t type) { if (type < UNKNOWN_BT || type > NEUTRAL_ON) diff --git a/src/buffer.c b/src/buffer.c index 1b413ccb8b0..d301e7f14f9 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -330,15 +330,17 @@ even if it is dead. The return value is never nil. */) if (! BUF_BEG_ADDR (b)) buffer_memory_full (); - BUF_PT (b) = BEG; + b->pt = BEG; + b->begv = BEG; + b->zv = BEG; + b->pt_byte = BEG_BYTE; + b->begv_byte = BEG_BYTE; + b->zv_byte = BEG_BYTE; + BUF_GPT (b) = BEG; - BUF_BEGV (b) = BEG; - BUF_ZV (b) = BEG; - BUF_Z (b) = BEG; - BUF_PT_BYTE (b) = BEG_BYTE; BUF_GPT_BYTE (b) = BEG_BYTE; - BUF_BEGV_BYTE (b) = BEG_BYTE; - BUF_ZV_BYTE (b) = BEG_BYTE; + + BUF_Z (b) = BEG; BUF_Z_BYTE (b) = BEG_BYTE; BUF_MODIFF (b) = 1; BUF_CHARS_MODIFF (b) = 1; @@ -489,6 +491,53 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) BVAR (to, local_var_alist) = buffer_lisp_local_variables (from); } + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, update these markers. */ + +static void +record_buffer_markers (struct buffer *b) +{ + if (! NILP (BVAR (b, pt_marker))) + { + Lisp_Object buffer; + + eassert (!NILP (BVAR (b, begv_marker))); + eassert (!NILP (BVAR (b, zv_marker))); + + XSETBUFFER (buffer, b); + set_marker_both (BVAR (b, pt_marker), buffer, b->pt, b->pt_byte); + set_marker_both (BVAR (b, begv_marker), buffer, b->begv, b->begv_byte); + set_marker_both (BVAR (b, zv_marker), buffer, b->zv, b->zv_byte); + } +} + + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, fetch these values into B->begv etc. */ + +static void +fetch_buffer_markers (struct buffer *b) +{ + if (! NILP (BVAR (b, pt_marker))) + { + Lisp_Object m; + + eassert (!NILP (BVAR (b, begv_marker))); + eassert (!NILP (BVAR (b, zv_marker))); + + m = BVAR (b, pt_marker); + SET_BUF_PT_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = BVAR (b, begv_marker); + SET_BUF_BEGV_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = BVAR (b, zv_marker); + SET_BUF_ZV_BOTH (b, marker_position (m), marker_byte_position (m)); + } +} + + DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 2, 3, "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", @@ -527,12 +576,12 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Use the base buffer's text object. */ b->text = b->base_buffer->text; - BUF_BEGV (b) = BUF_BEGV (b->base_buffer); - BUF_ZV (b) = BUF_ZV (b->base_buffer); - BUF_PT (b) = BUF_PT (b->base_buffer); - BUF_BEGV_BYTE (b) = BUF_BEGV_BYTE (b->base_buffer); - BUF_ZV_BYTE (b) = BUF_ZV_BYTE (b->base_buffer); - BUF_PT_BYTE (b) = BUF_PT_BYTE (b->base_buffer); + b->pt = b->base_buffer->pt; + b->begv = b->base_buffer->begv; + b->zv = b->base_buffer->zv; + b->pt_byte = b->base_buffer->pt_byte; + b->begv_byte = b->base_buffer->begv_byte; + b->zv_byte = b->base_buffer->zv_byte; b->newline_cache = 0; b->width_run_cache = 0; @@ -562,24 +611,23 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Make sure the base buffer has markers for its narrowing. */ if (NILP (BVAR (b->base_buffer, pt_marker))) { + eassert (NILP (BVAR (b->base_buffer, begv_marker))); + eassert (NILP (BVAR (b->base_buffer, zv_marker))); + BVAR (b->base_buffer, pt_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, - BUF_PT (b->base_buffer), - BUF_PT_BYTE (b->base_buffer)); - } - if (NILP (BVAR (b->base_buffer, begv_marker))) - { + b->base_buffer->pt, + b->base_buffer->pt_byte); + BVAR (b->base_buffer, begv_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer, - BUF_BEGV (b->base_buffer), - BUF_BEGV_BYTE (b->base_buffer)); - } - if (NILP (BVAR (b->base_buffer, zv_marker))) - { + b->base_buffer->begv, + b->base_buffer->begv_byte); + BVAR (b->base_buffer, zv_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer, - BUF_ZV (b->base_buffer), - BUF_ZV_BYTE (b->base_buffer)); + b->base_buffer->zv, + b->base_buffer->zv_byte); XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; } @@ -587,11 +635,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */) { /* Give the indirect buffer markers for its narrowing. */ BVAR (b, pt_marker) = Fmake_marker (); - set_marker_both (BVAR (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); + set_marker_both (BVAR (b, pt_marker), buf, b->pt, b->pt_byte); BVAR (b, begv_marker) = Fmake_marker (); - set_marker_both (BVAR (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + set_marker_both (BVAR (b, begv_marker), buf, b->begv, b->begv_byte); BVAR (b, zv_marker) = Fmake_marker (); - set_marker_both (BVAR (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + set_marker_both (BVAR (b, zv_marker), buf, b->zv, b->zv_byte); XMARKER (BVAR (b, zv_marker))->insertion_type = 1; } else @@ -1416,9 +1464,9 @@ with SIGHUP. */) don't re-kill them. */ if (other->base_buffer == b && !NILP (BVAR (other, name))) { - Lisp_Object buffer; - XSETBUFFER (buffer, other); - Fkill_buffer (buffer); + Lisp_Object buf; + XSETBUFFER (buf, other); + Fkill_buffer (buf); } UNGCPRO; @@ -1479,9 +1527,9 @@ with SIGHUP. */) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) { - Lisp_Object tem; - tem = Fsymbol_value (intern ("delete-auto-save-files")); - if (! NILP (tem)) + Lisp_Object delete; + delete = Fsymbol_value (intern ("delete-auto-save-files")); + if (! NILP (delete)) internal_delete_file (BVAR (b, auto_save_file_name)); } @@ -1553,19 +1601,19 @@ with SIGHUP. */) void record_buffer (Lisp_Object buf) { - register Lisp_Object link, prev; + register Lisp_Object list, prev; Lisp_Object frame; frame = selected_frame; prev = Qnil; - for (link = Vbuffer_alist; CONSP (link); link = XCDR (link)) + for (list = Vbuffer_alist; CONSP (list); list = XCDR (list)) { - if (EQ (XCDR (XCAR (link)), buf)) + if (EQ (XCDR (XCAR (list)), buf)) break; - prev = link; + prev = list; } - /* Effectively do Vbuffer_alist = Fdelq (link, Vbuffer_alist); + /* Effectively do Vbuffer_alist = Fdelq (list, Vbuffer_alist); we cannot use Fdelq itself here because it allows quitting. */ if (NILP (prev)) @@ -1573,40 +1621,40 @@ record_buffer (Lisp_Object buf) else XSETCDR (prev, XCDR (XCDR (prev))); - XSETCDR (link, Vbuffer_alist); - Vbuffer_alist = link; + XSETCDR (list, Vbuffer_alist); + Vbuffer_alist = list; /* Effectively do a delq on buried_buffer_list. */ prev = Qnil; - for (link = XFRAME (frame)->buried_buffer_list; CONSP (link); - link = XCDR (link)) + for (list = XFRAME (frame)->buried_buffer_list; CONSP (list); + list = XCDR (list)) { - if (EQ (XCAR (link), buf)) + if (EQ (XCAR (list), buf)) { if (NILP (prev)) - XFRAME (frame)->buried_buffer_list = XCDR (link); + XFRAME (frame)->buried_buffer_list = XCDR (list); else XSETCDR (prev, XCDR (XCDR (prev))); break; } - prev = link; + prev = list; } /* Now move this buffer to the front of frame_buffer_list also. */ prev = Qnil; - for (link = frame_buffer_list (frame); CONSP (link); - link = XCDR (link)) + for (list = frame_buffer_list (frame); CONSP (list); + list = XCDR (list)) { - if (EQ (XCAR (link), buf)) + if (EQ (XCAR (list), buf)) break; - prev = link; + prev = list; } /* Effectively do delq. */ - if (CONSP (link)) + if (CONSP (list)) { if (NILP (prev)) set_frame_buffer_list (frame, @@ -1614,8 +1662,8 @@ record_buffer (Lisp_Object buf) else XSETCDR (prev, XCDR (XCDR (prev))); - XSETCDR (link, frame_buffer_list (frame)); - set_frame_buffer_list (frame, link); + XSETCDR (list, frame_buffer_list (frame)); + set_frame_buffer_list (frame, list); } else set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame))); @@ -1664,7 +1712,7 @@ the current buffer's major mode. */) /* Switch to buffer BUFFER in the selected window. If NORECORD is non-nil, don't call record_buffer. */ -Lisp_Object +static Lisp_Object switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord) { register Lisp_Object buffer; @@ -1796,27 +1844,7 @@ set_buffer_internal_1 (register struct buffer *b) /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (BVAR (old_buf, pt_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, pt_marker), obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, begv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, begv_marker), obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, zv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, zv_marker), obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } + record_buffer_markers (old_buf); } /* Get the undo list from the base buffer, so that it appears @@ -1826,21 +1854,7 @@ set_buffer_internal_1 (register struct buffer *b) /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (BVAR (b, pt_marker))) - { - BUF_PT (b) = marker_position (BVAR (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); - } - if (! NILP (BVAR (b, begv_marker))) - { - BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); - } - if (! NILP (BVAR (b, zv_marker))) - { - BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); - } + fetch_buffer_markers (b); /* Look down buffer's list of local Lisp variables to find and update any that forward into C variables. */ @@ -1876,50 +1890,13 @@ set_buffer_temp (struct buffer *b) old_buf = current_buffer; current_buffer = b; - if (old_buf) - { - /* If the old current buffer has markers to record PT, BEGV and ZV - when it is not current, update them now. */ - if (! NILP (BVAR (old_buf, pt_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, pt_marker), obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, begv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, begv_marker), obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, zv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, zv_marker), obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } - } + /* If the old current buffer has markers to record PT, BEGV and ZV + when it is not current, update them now. */ + record_buffer_markers (old_buf); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (BVAR (b, pt_marker))) - { - BUF_PT (b) = marker_position (BVAR (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); - } - if (! NILP (BVAR (b, begv_marker))) - { - BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); - } - if (! NILP (BVAR (b, zv_marker))) - { - BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); - } + fetch_buffer_markers (b); } DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, @@ -2007,13 +1984,13 @@ its frame, iconify that frame. */) buffer is killed. */ if (!NILP (BVAR (XBUFFER (buffer), name))) { - Lisp_Object aelt, link; + Lisp_Object aelt, list; aelt = Frassq (buffer, Vbuffer_alist); - link = Fmemq (aelt, Vbuffer_alist); + list = Fmemq (aelt, Vbuffer_alist); Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); - XSETCDR (link, Qnil); - Vbuffer_alist = nconc2 (Vbuffer_alist, link); + XSETCDR (list, Qnil); + Vbuffer_alist = nconc2 (Vbuffer_alist, list); XFRAME (selected_frame)->buffer_list = Fdelq (buffer, XFRAME (selected_frame)->buffer_list); @@ -2358,12 +2335,12 @@ current buffer is cleared. */) && GPT_BYTE > 1 && GPT_BYTE < Z_BYTE && ! CHAR_HEAD_P (*(GAP_END_ADDR))) { - unsigned char *p = GPT_ADDR - 1; + unsigned char *q = GPT_ADDR - 1; - while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--; - if (LEADING_CODE_P (*p)) + while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--; + if (LEADING_CODE_P (*q)) { - EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - p); + EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - q); move_gap_both (new_gpt, new_gpt); } @@ -2447,14 +2424,14 @@ current buffer is cleared. */) ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; { - EMACS_INT pt_byte = advance_to_char_boundary (PT_BYTE); - EMACS_INT pt; + EMACS_INT byte = advance_to_char_boundary (PT_BYTE); + EMACS_INT position; - if (pt_byte > GPT_BYTE) - pt = chars_in_text (GAP_END_ADDR, pt_byte - GPT_BYTE) + GPT; + if (byte > GPT_BYTE) + position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT; else - pt = chars_in_text (BEG_ADDR, pt_byte - BEG_BYTE) + BEG; - TEMP_SET_PT_BOTH (pt, pt_byte); + position = chars_in_text (BEG_ADDR, byte - BEG_BYTE) + BEG; + TEMP_SET_PT_BOTH (position, byte); } tail = markers = BUF_MARKERS (current_buffer); @@ -3421,7 +3398,8 @@ void fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) { Lisp_Object overlay; - struct Lisp_Overlay *before_list, *after_list; + struct Lisp_Overlay *before_list IF_LINT (= NULL); + struct Lisp_Overlay *after_list IF_LINT (= NULL); /* These are either nil, indicating that before_list or after_list should be assigned, or the cons cell the cdr of which should be assigned. */ @@ -3569,7 +3547,7 @@ fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos) /* If parent is nil, replace overlays_before; otherwise, parent->next. */ struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; Lisp_Object tem; - EMACS_INT end; + EMACS_INT end IF_LINT (= 0); /* After the insertion, the several overlays may be in incorrect order. The possibility is that, in the list `overlays_before', @@ -4345,10 +4323,10 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, for (i = 0; i < size;) { - Lisp_Object prop, overlay; - prop = copy[i++]; - overlay = copy[i++]; - call_overlay_mod_hooks (prop, overlay, after, arg1, arg2, arg3); + Lisp_Object prop_i, overlay_i; + prop_i = copy[i++]; + overlay_i = copy[i++]; + call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); } } UNGCPRO; @@ -5333,9 +5311,6 @@ syms_of_buffer (void) Fput (Qprotected_field, Qerror_message, make_pure_c_string ("Attempt to modify a protected field")); - /* All these use DEFVAR_LISP_NOPRO because the slots in - buffer_defaults will all be marked via Vbuffer_defaults. */ - DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", mode_line_format, doc: /* Default value of `mode-line-format' for buffers that don't override it. diff --git a/src/buffer.h b/src/buffer.h index 65c7168d60a..d80875a0811 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -107,27 +107,46 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define BUF_BEG(buf) (BEG) #define BUF_BEG_BYTE(buf) (BEG_BYTE) -/* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed: - on indirect (or base) buffers, that value is only correct if that buffer - is the current_buffer, or if the buffer's text hasn't been modified (via - an indirect buffer) since it was last current. */ +/* The BUF_BEGV[_BYTE], BUF_ZV[_BYTE], and BUF_PT[_BYTE] macros cannot + be used for assignment; use SET_BUF_* macros below for that. */ /* Position of beginning of accessible range of buffer. */ -#define BUF_BEGV(buf) ((buf)->begv) -#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) +#define BUF_BEGV(buf) \ + (buf == current_buffer ? BEGV \ + : NILP (BVAR (buf, begv_marker)) ? buf->begv \ + : marker_position (BVAR (buf, begv_marker))) + +#define BUF_BEGV_BYTE(buf) \ + (buf == current_buffer ? BEGV_BYTE \ + : NILP (BVAR (buf, begv_marker)) ? buf->begv_byte \ + : marker_byte_position (BVAR (buf, begv_marker))) /* Position of point in buffer. */ -#define BUF_PT(buf) ((buf)->pt) -#define BUF_PT_BYTE(buf) ((buf)->pt_byte) +#define BUF_PT(buf) \ + (buf == current_buffer ? PT \ + : NILP (BVAR (buf, pt_marker)) ? buf->pt \ + : marker_position (BVAR (buf, pt_marker))) + +#define BUF_PT_BYTE(buf) \ + (buf == current_buffer ? PT_BYTE \ + : NILP (BVAR (buf, pt_marker)) ? buf->pt_byte \ + : marker_byte_position (BVAR (buf, pt_marker))) + +/* Position of end of accessible range of buffer. */ +#define BUF_ZV(buf) \ + (buf == current_buffer ? ZV \ + : NILP (BVAR (buf, zv_marker)) ? buf->zv \ + : marker_position (BVAR (buf, zv_marker))) + +#define BUF_ZV_BYTE(buf) \ + (buf == current_buffer ? ZV_BYTE \ + : NILP (BVAR (buf, zv_marker)) ? buf->zv_byte \ + : marker_byte_position (BVAR (buf, zv_marker))) /* Position of gap in buffer. */ #define BUF_GPT(buf) ((buf)->text->gpt) #define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) -/* Position of end of accessible range of buffer. */ -#define BUF_ZV(buf) ((buf)->zv) -#define BUF_ZV_BYTE(buf) ((buf)->zv_byte) - /* Position of end of buffer. */ #define BUF_Z(buf) ((buf)->text->z) #define BUF_Z_BYTE(buf) ((buf)->text->z_byte) @@ -235,8 +254,6 @@ extern void enlarge_buffer_text (struct buffer *, EMACS_INT); /* Macros for setting the BEGV, ZV or PT of a given buffer. - SET_BUF_PT* seet to be redundant. Get rid of them? - The ..._BOTH macros take both a charpos and a bytepos, which must correspond to each other. @@ -1009,4 +1026,31 @@ extern int last_per_buffer_idx; #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) + +/* Downcase a character C, or make no change if that cannot be done. */ +static inline int +downcase (int c) +{ + Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); + Lisp_Object down = CHAR_TABLE_REF (downcase_table, c); + return NATNUMP (down) ? XFASTINT (down) : c; +} + +/* 1 if C is upper case. */ +static inline int uppercasep (int c) { return downcase (c) != c; } + +/* Upcase a character C known to be not upper case. */ +static inline int +upcase1 (int c) +{ + Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); + Lisp_Object up = CHAR_TABLE_REF (upcase_table, c); + return NATNUMP (up) ? XFASTINT (up) : c; +} + +/* 1 if C is lower case. */ +static inline int lowercasep (int c) +{ return !uppercasep (c) && upcase1 (c) != c; } +/* Upcase a character C, or make no change if that cannot be done. */ +static inline int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } diff --git a/src/bytecode.c b/src/bytecode.c index ba3c012bd1a..d887668dd39 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -76,11 +76,7 @@ Lisp_Object Qbyte_code_meter; } \ } -#else /* no BYTE_CODE_METER */ - -#define METER_CODE(last_code, this_code) - -#endif /* no BYTE_CODE_METER */ +#endif /* BYTE_CODE_METER */ Lisp_Object Qbytecode; @@ -148,7 +144,9 @@ extern Lisp_Object Qand_optional, Qand_rest; #define Bpreceding_char 0150 #define Bcurrent_column 0151 #define Bindent_to 0152 +#ifdef BYTE_CODE_SAFE #define Bscan_buffer 0153 /* No longer generated as of v18 */ +#endif #define Beolp 0154 #define Beobp 0155 #define Bbolp 0156 @@ -156,8 +154,12 @@ extern Lisp_Object Qand_optional, Qand_rest; #define Bcurrent_buffer 0160 #define Bset_buffer 0161 #define Bsave_current_buffer_1 0162 /* Replacing Bsave_current_buffer. */ +#if 0 #define Bread_char 0162 /* No longer generated as of v19 */ +#endif +#ifdef BYTE_CODE_SAFE #define Bset_mark 0163 /* this loser is no longer generated as of v18 */ +#endif #define Binteractive_p 0164 /* Obsolete. */ #define Bforward_char 0165 @@ -234,7 +236,6 @@ extern Lisp_Object Qand_optional, Qand_rest; #define BdiscardN 0266 #define Bconstant 0300 -#define CONSTANTLIM 0100 /* Whether to maintain a `top' and `bottom' field in the stack frame. */ #define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK) @@ -370,6 +371,7 @@ unmark_byte_stack (void) We do this at every branch, to avoid loops that never GC. */ #define MAYBE_GC() \ + do { \ if (consing_since_gc > gc_cons_threshold \ && consing_since_gc > gc_relative_threshold) \ { \ @@ -377,7 +379,7 @@ unmark_byte_stack (void) Fgarbage_collect (); \ AFTER_POTENTIAL_GC (); \ } \ - else + } while (0) /* Check for jumping out of range. */ diff --git a/src/callint.c b/src/callint.c index a0efc4bbfe4..3c520742e27 100644 --- a/src/callint.c +++ b/src/callint.c @@ -118,7 +118,7 @@ usage: (interactive &optional ARGS) */) /* Quotify EXP: if EXP is constant, return it. If EXP is not constant, return (quote EXP). */ -Lisp_Object +static Lisp_Object quotify_arg (register Lisp_Object exp) { if (CONSP (exp) @@ -130,7 +130,7 @@ quotify_arg (register Lisp_Object exp) } /* Modify EXP by quotifying each element (except the first). */ -Lisp_Object +static Lisp_Object quotify_args (Lisp_Object exp) { register Lisp_Object tail; @@ -262,7 +262,7 @@ invoke it. If KEYS is omitted or nil, the return value of Lisp_Object prefix_arg; char *string; - char *tem; + const char *tem; /* If varies[i] > 0, the i'th argument shouldn't just have its value in this call quoted in the command history. It should be @@ -415,25 +415,25 @@ invoke it. If KEYS is omitted or nil, the return value of string++; else if (*string == '@') { - Lisp_Object event, tem; + Lisp_Object event, w; event = (next_event < key_count ? AREF (keys, next_event) : Qnil); if (EVENT_HAS_PARAMETERS (event) - && (tem = XCDR (event), CONSP (tem)) - && (tem = XCAR (tem), CONSP (tem)) - && (tem = XCAR (tem), WINDOWP (tem))) + && (w = XCDR (event), CONSP (w)) + && (w = XCAR (w), CONSP (w)) + && (w = XCAR (w), WINDOWP (w))) { - if (MINI_WINDOW_P (XWINDOW (tem)) - && ! (minibuf_level > 0 && EQ (tem, minibuf_window))) + if (MINI_WINDOW_P (XWINDOW (w)) + && ! (minibuf_level > 0 && EQ (w, minibuf_window))) error ("Attempt to select inactive minibuffer window"); /* If the current buffer wants to clean up, let it. */ if (!NILP (Vmouse_leave_buffer_hook)) call1 (Vrun_hooks, Qmouse_leave_buffer_hook); - Fselect_window (tem, Qnil); + Fselect_window (w, Qnil); } string++; } @@ -686,7 +686,7 @@ invoke it. If KEYS is omitted or nil, the return value of int first = 1; do { - Lisp_Object tem; + Lisp_Object str; if (! first) { message ("Please enter a number."); @@ -694,13 +694,13 @@ invoke it. If KEYS is omitted or nil, the return value of } first = 0; - tem = Fread_from_minibuffer (callint_message, + str = Fread_from_minibuffer (callint_message, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil); - if (! STRINGP (tem) || SCHARS (tem) == 0) + if (! STRINGP (str) || SCHARS (str) == 0) args[i] = Qnil; else - args[i] = Fread (tem); + args[i] = Fread (str); } while (! NUMBERP (args[i])); } diff --git a/src/casefiddle.c b/src/casefiddle.c index 26fa0db2d77..43ecd38dc7d 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -32,7 +32,7 @@ enum case_action {CASE_UP, CASE_DOWN, CASE_CAPITALIZE, CASE_CAPITALIZE_UP}; Lisp_Object Qidentity; -Lisp_Object +static Lisp_Object casify_object (enum case_action flag, Lisp_Object obj) { register int c, c1; @@ -64,13 +64,13 @@ casify_object (enum case_action flag, Lisp_Object obj) multibyte = 1; if (! multibyte) MAKE_CHAR_MULTIBYTE (c1); - c = DOWNCASE (c1); + c = downcase (c1); if (inword) XSETFASTINT (obj, c | flags); else if (c == (XFASTINT (obj) & ~flagbits)) { if (! inword) - c = UPCASE1 (c1); + c = upcase1 (c1); if (! multibyte) MAKE_CHAR_UNIBYTE (c); XSETFASTINT (obj, c | flags); @@ -92,10 +92,10 @@ casify_object (enum case_action flag, Lisp_Object obj) MAKE_CHAR_MULTIBYTE (c); c1 = c; if (inword && flag != CASE_CAPITALIZE_UP) - c = DOWNCASE (c); - else if (!UPPERCASEP (c) + c = downcase (c); + else if (!uppercasep (c) && (!inword || flag != CASE_CAPITALIZE_UP)) - c = UPCASE1 (c1); + c = upcase1 (c1); if ((int) flag >= (int) CASE_CAPITALIZE) inword = (SYNTAX (c) == Sword); if (c != c1) @@ -133,10 +133,10 @@ casify_object (enum case_action flag, Lisp_Object obj) } c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len); if (inword && flag != CASE_CAPITALIZE_UP) - c = DOWNCASE (c); - else if (!UPPERCASEP (c) + c = downcase (c); + else if (!uppercasep (c) && (!inword || flag != CASE_CAPITALIZE_UP)) - c = UPCASE1 (c); + c = upcase1 (c); if ((int) flag >= (int) CASE_CAPITALIZE) inword = (SYNTAX (c) == Sword); o += CHAR_STRING (c, o); @@ -193,7 +193,7 @@ The argument object is not altered--the value is a copy. */) /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. b and e specify range of buffer to operate on. */ -void +static void casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) { register int c; @@ -201,7 +201,10 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); EMACS_INT start, end; EMACS_INT start_byte, end_byte; - EMACS_INT first = -1, last; /* Position of first and last changes. */ + + /* Position of first and last changes. */ + EMACS_INT first = -1, last IF_LINT (= 0); + EMACS_INT opoint = PT; EMACS_INT opoint_byte = PT_BYTE; @@ -240,10 +243,10 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) } c2 = c; if (inword && flag != CASE_CAPITALIZE_UP) - c = DOWNCASE (c); - else if (!UPPERCASEP (c) + c = downcase (c); + else if (!uppercasep (c) && (!inword || flag != CASE_CAPITALIZE_UP)) - c = UPCASE1 (c); + c = upcase1 (c); if ((int) flag >= (int) CASE_CAPITALIZE) inword = ((SYNTAX (c) == Sword) && (inword || !syntax_prefix_flag_p (c))); diff --git a/src/casetab.c b/src/casetab.c index 5207e5315ae..56f6b065358 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -28,11 +28,6 @@ Lisp_Object Qcase_table_p, Qcase_table; Lisp_Object Vascii_downcase_table, Vascii_upcase_table; Lisp_Object Vascii_canon_table, Vascii_eqv_table; -/* Used as a temporary in DOWNCASE and other macros in lisp.h. No - need to mark it, since it is used only very temporarily. */ -int case_temp1; -Lisp_Object case_temp2; - static void set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt); static void set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt); static void shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt); @@ -302,4 +297,3 @@ syms_of_casetab (void) defsubr (&Sset_case_table); defsubr (&Sset_standard_case_table); } - diff --git a/src/category.c b/src/category.c index bcd73d3a487..cc7ff88474f 100644 --- a/src/category.c +++ b/src/category.c @@ -61,7 +61,6 @@ static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object); static Lisp_Object hash_get_category_set (Lisp_Object table, Lisp_Object category_set) { - Lisp_Object val; struct Lisp_Hash_Table *h; int i; unsigned hash; @@ -228,7 +227,7 @@ copy_category_entry (Lisp_Object table, Lisp_Object c, Lisp_Object val) the original and the copy. This function is called recursively by binding TABLE to a sub char table. */ -Lisp_Object +static Lisp_Object copy_category_table (Lisp_Object table) { table = copy_char_table (table); @@ -538,4 +537,3 @@ See the documentation of the variable `word-combining-categories'. */); category_table_version = 0; } - diff --git a/src/ccl.c b/src/ccl.c index 411c041b22a..5428e94c69a 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -758,18 +758,18 @@ while(0) buffer. */ #define CCL_WRITE_STRING(len) \ do { \ - int i; \ + int ccli; \ if (!dst) \ CCL_INVALID_CMD; \ else if (dst + len <= dst_end) \ { \ if (XFASTINT (ccl_prog[ic]) & 0x1000000) \ - for (i = 0; i < len; i++) \ - *dst++ = XFASTINT (ccl_prog[ic + i]) & 0xFFFFFF; \ + for (ccli = 0; ccli < len; ccli++) \ + *dst++ = XFASTINT (ccl_prog[ic + ccli]) & 0xFFFFFF; \ else \ - for (i = 0; i < len; i++) \ - *dst++ = ((XFASTINT (ccl_prog[ic + (i / 3)])) \ - >> ((2 - (i % 3)) * 8)) & 0xFF; \ + for (ccli = 0; ccli < len; ccli++) \ + *dst++ = ((XFASTINT (ccl_prog[ic + (ccli / 3)])) \ + >> ((2 - (ccli % 3)) * 8)) & 0xFF; \ } \ else \ CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ @@ -806,15 +806,15 @@ while(0) #define CCL_ENCODE_CHAR(c, charset_list, id, encoded) \ do { \ - unsigned code; \ + unsigned ncode; \ \ - charset = char_charset ((c), (charset_list), &code); \ + charset = char_charset ((c), (charset_list), &ncode); \ if (! charset && ! NILP (charset_list)) \ - charset = char_charset ((c), Qnil, &code); \ + charset = char_charset ((c), Qnil, &ncode); \ if (charset) \ { \ (id) = CHARSET_ID (charset); \ - (encoded) = code; \ + (encoded) = ncode; \ } \ } while (0) @@ -2092,22 +2092,22 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY { const unsigned char *p = SDATA (str) + consumed_bytes; const unsigned char *endp = SDATA (str) + str_bytes; - int i = 0; + int j = 0; int *src, src_size; if (endp - p == str_chars - consumed_chars) - while (i < CCL_EXECUTE_BUF_SIZE && p < endp) - source[i++] = *p++; + while (j < CCL_EXECUTE_BUF_SIZE && p < endp) + source[j++] = *p++; else - while (i < CCL_EXECUTE_BUF_SIZE && p < endp) - source[i++] = STRING_CHAR_ADVANCE (p); - consumed_chars += i; + while (j < CCL_EXECUTE_BUF_SIZE && p < endp) + source[j++] = STRING_CHAR_ADVANCE (p); + consumed_chars += j; consumed_bytes = p - SDATA (str); if (consumed_bytes == str_bytes) ccl.last_block = NILP (contin); src = source; - src_size = i; + src_size = j; while (1) { ccl_driver (&ccl, src, destination, src_size, CCL_EXECUTE_BUF_SIZE, @@ -2123,8 +2123,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); outp = outbuf + offset; } - for (i = 0; i < ccl.produced; i++) - CHAR_STRING_ADVANCE (destination[i], outp); + for (j = 0; j < ccl.produced; j++) + CHAR_STRING_ADVANCE (destination[j], outp); } else { @@ -2135,8 +2135,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); outp = outbuf + offset; } - for (i = 0; i < ccl.produced; i++) - *outp++ = destination[i]; + for (j = 0; j < ccl.produced; j++) + *outp++ = destination[j]; } src += ccl.consumed; src_size -= ccl.consumed; @@ -2253,7 +2253,7 @@ Return index number of the registered map. */) { int len = ASIZE (Vcode_conversion_map_vector); int i; - Lisp_Object index; + Lisp_Object idx; CHECK_SYMBOL (symbol); CHECK_VECTOR (map); @@ -2267,11 +2267,11 @@ Return index number of the registered map. */) if (EQ (symbol, XCAR (slot))) { - index = make_number (i); + idx = make_number (i); XSETCDR (slot, map); Fput (symbol, Qcode_conversion_map, map); - Fput (symbol, Qcode_conversion_map_id, index); - return index; + Fput (symbol, Qcode_conversion_map_id, idx); + return idx; } } @@ -2279,11 +2279,11 @@ Return index number of the registered map. */) Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector, len * 2, Qnil); - index = make_number (i); + idx = make_number (i); Fput (symbol, Qcode_conversion_map, map); - Fput (symbol, Qcode_conversion_map_id, index); + Fput (symbol, Qcode_conversion_map_id, idx); ASET (Vcode_conversion_map_vector, i, Fcons (symbol, map)); - return index; + return idx; } @@ -2341,4 +2341,3 @@ used by CCL. */); defsubr (&Sregister_ccl_program); defsubr (&Sregister_code_conversion_map); } - diff --git a/src/character.c b/src/character.c index 6f3312fec29..fdaf22f04f8 100644 --- a/src/character.c +++ b/src/character.c @@ -786,7 +786,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, i } -EMACS_INT +static EMACS_INT string_count_byte8 (Lisp_Object string) { int multibyte = STRING_MULTIBYTE (string); diff --git a/src/character.h b/src/character.h index fb29ced66b7..4c468e14d2c 100644 --- a/src/character.h +++ b/src/character.h @@ -128,9 +128,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ XSETCDR ((x), tmp); \ } while (0) -/* Nonzero iff C is an ASCII character. */ -#define ASCII_CHAR_P(c) ((unsigned) (c) < 0x80) - /* Nonzero iff C is a character of code less than 0x100. */ #define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100) @@ -281,11 +278,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ do { \ if ((p) > (limit)) \ { \ - const unsigned char *p0 = (p); \ + const unsigned char *pcb = (p); \ do { \ - p0--; \ - } while (p0 >= limit && ! CHAR_HEAD_P (*p0)); \ - (p) = (BYTES_BY_CHAR_HEAD (*p0) == (p) - p0) ? p0 : (p) - 1; \ + pcb--; \ + } while (pcb >= limit && ! CHAR_HEAD_P (*pcb)); \ + (p) = (BYTES_BY_CHAR_HEAD (*pcb) == (p) - pcb) ? pcb : (p) - 1; \ } \ } while (0) @@ -356,11 +353,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ CHARIDX++; \ if (STRING_MULTIBYTE (STRING)) \ { \ - unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ - int len; \ + unsigned char *string_ptr = &SDATA (STRING)[BYTEIDX]; \ + int string_len; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT = STRING_CHAR_AND_LENGTH (string_ptr, string_len); \ + BYTEIDX += string_len; \ } \ else \ { \ @@ -380,10 +377,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ if (STRING_MULTIBYTE (STRING)) \ { \ unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ - int len; \ + int ptrlen; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT = STRING_CHAR_AND_LENGTH (ptr, ptrlen); \ + BYTEIDX += ptrlen; \ } \ else \ { \ @@ -400,11 +397,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \ do \ { \ - unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ - int len; \ + unsigned char *fetch_ptr = &SDATA (STRING)[BYTEIDX]; \ + int fetch_len; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT = STRING_CHAR_AND_LENGTH (fetch_ptr, fetch_len); \ + BYTEIDX += fetch_len; \ CHARIDX++; \ } \ while (0) @@ -420,10 +417,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ { \ unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ - int len; \ + int string_len; \ \ - OUTPUT= STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT= STRING_CHAR_AND_LENGTH (ptr, string_len); \ + BYTEIDX += string_len; \ } \ else \ { \ @@ -454,8 +451,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define INC_POS(pos_byte) \ do { \ - unsigned char *p = BYTE_POS_ADDR (pos_byte); \ - pos_byte += BYTES_BY_CHAR_HEAD (*p); \ + unsigned char *ptr = BYTE_POS_ADDR (pos_byte); \ + pos_byte += BYTES_BY_CHAR_HEAD (*ptr); \ } while (0) @@ -464,16 +461,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define DEC_POS(pos_byte) \ do { \ - unsigned char *p; \ + unsigned char *ptr; \ \ pos_byte--; \ if (pos_byte < GPT_BYTE) \ - p = BEG_ADDR + pos_byte - BEG_BYTE; \ + ptr = BEG_ADDR + pos_byte - BEG_BYTE; \ else \ - p = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE;\ - while (!CHAR_HEAD_P (*p)) \ + ptr = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ + while (!CHAR_HEAD_P (*ptr)) \ { \ - p--; \ + ptr--; \ pos_byte--; \ } \ } while (0) @@ -513,8 +510,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define BUF_INC_POS(buf, pos_byte) \ do { \ - unsigned char *p = BUF_BYTE_ADDRESS (buf, pos_byte); \ - pos_byte += BYTES_BY_CHAR_HEAD (*p); \ + unsigned char *bbp = BUF_BYTE_ADDRESS (buf, pos_byte); \ + pos_byte += BYTES_BY_CHAR_HEAD (*bbp); \ } while (0) diff --git a/src/charset.c b/src/charset.c index 3624e740acb..d82b29ae44b 100644 --- a/src/charset.c +++ b/src/charset.c @@ -29,6 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <unistd.h> #include <ctype.h> +#include <limits.h> #include <sys/types.h> #include <setjmp.h> #include "lisp.h" @@ -250,7 +251,7 @@ struct charset_map_entries static void load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag) { - Lisp_Object vec, table; + Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil); unsigned max_code = CHARSET_MAX_CODE (charset); int ascii_compatible_p = charset->ascii_compatible_p; int min_char, max_char, nonascii_min_char; @@ -629,8 +630,12 @@ load_charset (struct charset *charset, int control_flag) if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP) map = CHARSET_MAP (charset); - else if (CHARSET_UNIFIED_P (charset)) - map = CHARSET_UNIFY_MAP (charset); + else + { + if (! CHARSET_UNIFIED_P (charset)) + abort (); + map = CHARSET_UNIFY_MAP (charset); + } if (STRINGP (map)) load_charset_map_from_file (charset, map, control_flag); else @@ -668,9 +673,9 @@ map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object while (1) { - int index = GET_TEMP_CHARSET_WORK_ENCODER (c); + int idx = GET_TEMP_CHARSET_WORK_ENCODER (c); - if (index >= from_idx && index <= to_idx) + if (idx >= from_idx && idx <= to_idx) { if (NILP (XCAR (range))) XSETCAR (range, make_number (c)); @@ -2066,10 +2071,10 @@ that case, find the charset from what supported by that coding system. */) for (; CONSP (restriction); restriction = XCDR (restriction)) { - struct charset *charset; + struct charset *rcharset; - CHECK_CHARSET_GET_CHARSET (XCAR (restriction), charset); - if (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset)) + CHECK_CHARSET_GET_CHARSET (XCAR (restriction), rcharset); + if (ENCODE_CHAR (rcharset, c) != CHARSET_INVALID_CODE (rcharset)) return XCAR (restriction); } return Qnil; @@ -2250,7 +2255,7 @@ See also `charset-priority-list' and `set-charset-priority'. */) int n = XFASTINT (len), i, j, done; Lisp_Object tail, elt, attrs; struct charset_sort_data *sort_data; - int id, min_id, max_id; + int id, min_id = INT_MAX, max_id = INT_MIN; USE_SAFE_ALLOCA; if (n == 0) @@ -2262,11 +2267,9 @@ See also `charset-priority-list' and `set-charset-priority'. */) CHECK_CHARSET_GET_ATTR (elt, attrs); sort_data[i].charset = elt; sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs)); - if (i == 0) - min_id = max_id = id; - else if (id < min_id) + if (id < min_id) min_id = id; - else if (id > max_id) + if (id > max_id) max_id = id; } for (done = 0, tail = Vcharset_ordered_list, i = 0; diff --git a/src/charset.h b/src/charset.h index 1fc552a5bd3..8c87ffe6c3d 100644 --- a/src/charset.h +++ b/src/charset.h @@ -358,9 +358,9 @@ extern int emacs_mule_charset[256]; #define CHECK_CHARSET_GET_CHARSET(x, charset) \ do { \ - int id; \ - CHECK_CHARSET_GET_ID (x, id); \ - charset = CHARSET_FROM_ID (id); \ + int csid; \ + CHECK_CHARSET_GET_ID (x, csid); \ + charset = CHARSET_FROM_ID (csid); \ } while (0) @@ -541,4 +541,3 @@ extern void map_charset_chars (void (*) (Lisp_Object, Lisp_Object), struct charset *, unsigned, unsigned); #endif /* EMACS_CHARSET_H */ - diff --git a/src/chartab.c b/src/chartab.c index cd8aa784eb4..85aa5932ac3 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -118,7 +118,7 @@ char_table_ascii (Lisp_Object table) return XSUB_CHAR_TABLE (sub)->contents[0]; } -Lisp_Object +static Lisp_Object copy_sub_char_table (Lisp_Object table) { Lisp_Object copy; @@ -216,16 +216,16 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp int depth = XINT (tbl->depth); int min_char = XINT (tbl->min_char); int max_char = min_char + chartab_chars[depth - 1] - 1; - int index = CHARTAB_IDX (c, depth, min_char), idx; + int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; Lisp_Object val; - val = tbl->contents[index]; + val = tbl->contents[chartab_idx]; if (SUB_CHAR_TABLE_P (val)) val = sub_char_table_ref_and_range (val, c, from, to, defalt); else if (NILP (val)) val = defalt; - idx = index; + idx = chartab_idx; while (idx > 0 && *from < min_char + idx * chartab_chars[depth]) { Lisp_Object this_val; @@ -244,13 +244,13 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp break; } } - while ((c = min_char + (index + 1) * chartab_chars[depth]) <= max_char + while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char && *to >= c) { Lisp_Object this_val; - index++; - this_val = tbl->contents[index]; + chartab_idx++; + this_val = tbl->contents[chartab_idx]; if (SUB_CHAR_TABLE_P (this_val)) this_val = sub_char_table_ref_and_range (this_val, c, from, to, defalt); else if (NILP (this_val)) @@ -275,10 +275,10 @@ Lisp_Object char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); - int index = CHARTAB_IDX (c, 0, 0), idx; + int chartab_idx = CHARTAB_IDX (c, 0, 0), idx; Lisp_Object val; - val = tbl->contents[index]; + val = tbl->contents[chartab_idx]; if (*from < 0) *from = 0; if (*to < 0) @@ -288,7 +288,7 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) else if (NILP (val)) val = tbl->defalt; - idx = index; + idx = chartab_idx; while (*from < idx * chartab_chars[0]) { Lisp_Object this_val; @@ -308,13 +308,13 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) break; } } - while (*to >= (index + 1) * chartab_chars[0]) + while (*to >= (chartab_idx + 1) * chartab_chars[0]) { Lisp_Object this_val; - index++; - c = index * chartab_chars[0]; - this_val = tbl->contents[index]; + chartab_idx++; + c = chartab_idx * chartab_chars[0]; + this_val = tbl->contents[chartab_idx]; if (SUB_CHAR_TABLE_P (this_val)) this_val = sub_char_table_ref_and_range (this_val, c, from, to, tbl->defalt); @@ -331,20 +331,6 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) } -#define ASET_RANGE(ARRAY, FROM, TO, LIMIT, VAL) \ - do { \ - int limit = (TO) < (LIMIT) ? (TO) : (LIMIT); \ - for (; (FROM) < limit; (FROM)++) (ARRAY)->contents[(FROM)] = (VAL); \ - } while (0) - -#define GET_SUB_CHAR_TABLE(TABLE, SUBTABLE, IDX, DEPTH, MIN_CHAR) \ - do { \ - (SUBTABLE) = (TABLE)->contents[(IDX)]; \ - if (!SUB_CHAR_TABLE_P (SUBTABLE)) \ - (SUBTABLE) = make_sub_char_table ((DEPTH), (MIN_CHAR), (SUBTABLE)); \ - } while (0) - - static void sub_char_table_set (Lisp_Object table, int c, Lisp_Object val) { @@ -951,7 +937,7 @@ map_sub_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), map_charset_chars. */ void -map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), +map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object function, Lisp_Object table, Lisp_Object arg, struct charset *charset, unsigned from, unsigned to) @@ -1012,4 +998,3 @@ syms_of_chartab (void) defsubr (&Soptimize_char_table); defsubr (&Smap_char_table); } - @@ -199,7 +199,7 @@ calccost (struct tty_display_info *tty, tabx, tab2x, tabcost; - register char *p; + register const char *p; /* If have just wrapped on a terminal with xn, don't believe the cursor position: give up here @@ -330,9 +330,9 @@ cmgoto (struct tty_display_info *tty, int row, int col) llcost, relcost, directcost; - int use; - char *p, - *dcm; + int use IF_LINT (= 0); + char *p; + const char *dcm; /* First the degenerate case */ if (row == curY (tty) && col == curX (tty)) /* already there */ @@ -460,4 +460,3 @@ Wcm_init (struct tty_display_info *tty) return - 2; return 0; } - @@ -35,25 +35,25 @@ struct cm int cm_curX; /* Current column */ /* Capabilities from termcap */ - char *cm_up; /* up (up) */ - char *cm_down; /* down (do) */ - char *cm_left; /* left (le) */ - char *cm_right; /* right (nd) */ - char *cm_home; /* home (ho) */ - char *cm_cr; /* carriage return (cr) */ - char *cm_ll; /* last line (ll) */ - char *cm_tab; /* tab (ta) */ - char *cm_backtab; /* backtab (bt) */ + const char *cm_up; /* up (up) */ + const char *cm_down; /* down (do) */ + const char *cm_left; /* left (le) */ + const char *cm_right; /* right (nd) */ + const char *cm_home; /* home (ho) */ + const char *cm_cr; /* carriage return (cr) */ + const char *cm_ll; /* last line (ll) */ + const char *cm_tab; /* tab (ta) */ + const char *cm_backtab; /* backtab (bt) */ char *cm_abs; /* absolute (cm) */ - char *cm_habs; /* horizontal absolute (ch) */ - char *cm_vabs; /* vertical absolute (cv) */ + const char *cm_habs; /* horizontal absolute (ch) */ + const char *cm_vabs; /* vertical absolute (cv) */ #if 0 - char *cm_ds; /* "don't send" string (ds) */ + const char *cm_ds; /* "don't send" string (ds) */ #endif - char *cm_multiup; /* multiple up (UP) */ - char *cm_multidown; /* multiple down (DO) */ - char *cm_multileft; /* multiple left (LE) */ - char *cm_multiright; /* multiple right (RI) */ + const char *cm_multiup; /* multiple up (UP) */ + const char *cm_multidown; /* multiple down (DO) */ + const char *cm_multileft; /* multiple left (LE) */ + const char *cm_multiright; /* multiple right (RI) */ int cm_cols; /* number of cols on screen (co) */ int cm_rows; /* number of rows on screen (li) */ int cm_tabwidth; /* tab width (it) */ @@ -168,4 +168,3 @@ extern void cmcostinit (struct tty_display_info *); extern void cmgoto (struct tty_display_info *, int, int); extern void Wcm_clear (struct tty_display_info *); extern int Wcm_init (struct tty_display_info *); - diff --git a/src/cmds.c b/src/cmds.c index 5e6884c0807..fa1ac5028ae 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -485,18 +485,18 @@ internal_self_insert (int c, EMACS_INT n) : (c == ' ' || c == '\n')) && !NILP (BVAR (current_buffer, auto_fill_function))) { - Lisp_Object tem; + Lisp_Object auto_fill_result; if (c == '\n') /* After inserting a newline, move to previous line and fill that. Must have the newline in place already so filling and justification, if any, know where the end is going to be. */ SET_PT_BOTH (PT - 1, PT_BYTE - 1); - tem = call0 (BVAR (current_buffer, auto_fill_function)); + auto_fill_result = call0 (BVAR (current_buffer, auto_fill_function)); /* Test PT < ZV in case the auto-fill-function is strange. */ if (c == '\n' && PT < ZV) SET_PT_BOTH (PT + 1, PT_BYTE + 1); - if (!NILP (tem)) + if (!NILP (auto_fill_result)) hairy = 2; } diff --git a/src/coding.c b/src/coding.c index f6310369ad3..0c2836c19f6 100644 --- a/src/coding.c +++ b/src/coding.c @@ -395,8 +395,6 @@ Lisp_Object Vbig5_coding_system; /* Control characters of ISO2022. */ /* code */ /* function */ -#define ISO_CODE_LF 0x0A /* line-feed */ -#define ISO_CODE_CR 0x0D /* carriage-return */ #define ISO_CODE_SO 0x0E /* shift-out */ #define ISO_CODE_SI 0x0F /* shift-in */ #define ISO_CODE_SS2_7 0x19 /* single-shift-2 for 7-bit code */ @@ -479,7 +477,7 @@ enum iso_code_class_type #define CODING_ISO_FLAG_COMPOSITION 0x2000 -#define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 +/* #define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 */ #define CODING_ISO_FLAG_USE_ROMAN 0x8000 @@ -721,25 +719,6 @@ static struct coding_system coding_categories[coding_category_max]; } while (0) -#define ONE_MORE_BYTE_NO_CHECK(c) \ - do { \ - c = *src++; \ - if (multibytep && (c & 0x80)) \ - { \ - if ((c & 0xFE) == 0xC0) \ - c = ((c & 1) << 6) | *src++; \ - else \ - { \ - src--; \ - c = - string_char (src, &src, NULL); \ - record_conversion_result \ - (coding, CODING_RESULT_INVALID_SRC); \ - } \ - } \ - consumed_chars++; \ - } while (0) - - /* Store a byte C in the place pointed by DST and increment DST to the next free point, and increment PRODUCED_CHARS. The caller should assure that C is 0..127, and declare and set the variable `dst' @@ -1051,9 +1030,10 @@ coding_set_source (struct coding_system *coding) coding->source = SDATA (coding->src_object) + coding->src_pos_byte; } else - /* Otherwise, the source is C string and is never relocated - automatically. Thus we don't have to update anything. */ - ; + { + /* Otherwise, the source is C string and is never relocated + automatically. Thus we don't have to update anything. */ + } } static void @@ -1079,9 +1059,10 @@ coding_set_destination (struct coding_system *coding) } } else - /* Otherwise, the destination is C string and is never relocated - automatically. Thus we don't have to update anything. */ - ; + { + /* Otherwise, the destination is C string and is never relocated + automatically. Thus we don't have to update anything. */ + } } @@ -1217,7 +1198,6 @@ alloc_destination (struct coding_system *coding, EMACS_INT nbytes, #define UTF_8_4_OCTET_LEADING_P(c) (((c) & 0xF8) == 0xF0) #define UTF_8_5_OCTET_LEADING_P(c) (((c) & 0xFC) == 0xF8) -#define UTF_BOM 0xFEFF #define UTF_8_BOM_1 0xEF #define UTF_8_BOM_2 0xBB #define UTF_8_BOM_3 0xBF @@ -1318,7 +1298,7 @@ decode_coding_utf_8 (struct coding_system *coding) int multibytep = coding->src_multibyte; enum utf_bom_type bom = CODING_UTF_8_BOM (coding); Lisp_Object attr, charset_list; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; @@ -1379,7 +1359,7 @@ decode_coding_utf_8 (struct coding_system *coding) } else if (UTF_8_1_OCTET_P (c1)) { - if (eol_crlf && c1 == '\r') + if (eol_dos && c1 == '\r') ONE_MORE_BYTE (byte_after_cr); c = c1; } @@ -1533,11 +1513,6 @@ encode_coding_utf_8 (struct coding_system *coding) #define UTF_16_LOW_SURROGATE_P(val) \ (((val) & 0xFC00) == 0xDC00) -#define UTF_16_INVALID_P(val) \ - (((val) == 0xFFFE) \ - || ((val) == 0xFFFF) \ - || UTF_16_LOW_SURROGATE_P (val)) - static int detect_coding_utf_16 (struct coding_system *coding, @@ -1637,7 +1612,7 @@ decode_coding_utf_16 (struct coding_system *coding) enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); int surrogate = CODING_UTF_16_SURROGATE (coding); Lisp_Object attr, charset_list; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr1 = -1, byte_after_cr2 = -1; @@ -1734,7 +1709,7 @@ decode_coding_utf_16 (struct coding_system *coding) CODING_UTF_16_SURROGATE (coding) = surrogate = c; else { - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') { ONE_MORE_BYTE (byte_after_cr1); ONE_MORE_BYTE (byte_after_cr2); @@ -1918,17 +1893,17 @@ detect_coding_emacs_mule (struct coding_system *coding, it because analyzing it is too heavy for detecting. But, at least, we check that the composite character constitutes of more than 4 bytes. */ - const unsigned char *src_base; + const unsigned char *src_start; repeat: - src_base = src; + src_start = src; do { ONE_MORE_BYTE (c); } while (c >= 0xA0); - if (src - src_base <= 4) + if (src - src_start <= 4) break; found = CATEGORY_MASK_EMACS_MULE; if (c == 0x80) @@ -1980,7 +1955,7 @@ detect_coding_emacs_mule (struct coding_system *coding, the decoded character or rule. If an invalid byte is found, return -1. If SRC is too short, return -2. */ -int +static int emacs_mule_char (struct coding_system *coding, const unsigned char *src, int *nbytes, int *nchars, int *id, struct composition_status *cmp_status) @@ -1988,7 +1963,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base = src; int multibytep = coding->src_multibyte; - int charset_id; + int charset_ID; unsigned code; int c; int consumed_chars = 0; @@ -1998,7 +1973,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, if (c < 0) { c = -c; - charset_id = emacs_mule_charset[0]; + charset_ID = emacs_mule_charset[0]; } else { @@ -2034,7 +2009,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, switch (emacs_mule_bytes[c]) { case 2: - if ((charset_id = emacs_mule_charset[c]) < 0) + if ((charset_ID = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2047,7 +2022,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) { ONE_MORE_BYTE (c); - if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) + if (c < 0xA0 || (charset_ID = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2056,7 +2031,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, } else { - if ((charset_id = emacs_mule_charset[c]) < 0) + if ((charset_ID = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2071,7 +2046,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, case 4: ONE_MORE_BYTE (c); - if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) + if (c < 0 || (charset_ID = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2085,21 +2060,21 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, case 1: code = c; - charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; + charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; break; default: abort (); } CODING_DECODE_CHAR (coding, src, src_base, src_end, - CHARSET_FROM_ID (charset_id), code, c); + CHARSET_FROM_ID (charset_ID), code, c); if (c < 0) goto invalid_code; } *nbytes = src - src_base; *nchars = consumed_chars; if (id) - *id = charset_id; + *id = charset_ID; return (mseq_found ? -c : c); no_more_source: @@ -2372,7 +2347,7 @@ decode_coding_emacs_mule (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status; @@ -2390,7 +2365,7 @@ decode_coding_emacs_mule (struct coding_system *coding) while (1) { - int c, id; + int c, id IF_LINT (= 0); src_base = src; consumed_chars_base = consumed_chars; @@ -2422,7 +2397,7 @@ decode_coding_emacs_mule (struct coding_system *coding) if (c < 0x80) { - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') ONE_MORE_BYTE (byte_after_cr); id = charset_ascii; if (cmp_status->state != COMPOSING_NO) @@ -2435,7 +2410,7 @@ decode_coding_emacs_mule (struct coding_system *coding) } else { - int nchars, nbytes; + int nchars IF_LINT (= 0), nbytes IF_LINT (= 0); /* emacs_mule_char can load a charset map from a file, which allocates a large structure and might cause buffer text to be relocated as result. Thus, we need to remember the @@ -2903,10 +2878,6 @@ enum iso_code_class_type iso_code_class[256]; ((id) <= (coding)->max_charset_id \ && (coding)->safe_charsets[id] != 255) - -#define SHIFT_OUT_OK(category) \ - (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0) - static void setup_iso_safe_charsets (Lisp_Object attrs) { @@ -3023,40 +2994,11 @@ detect_coding_iso_2022 (struct coding_system *coding, break; single_shifting = 0; ONE_MORE_BYTE (c); - if (c >= '(' && c <= '/') - { - /* Designation sequence for a charset of dimension 1. */ - ONE_MORE_BYTE (c1); - if (c1 < ' ' || c1 >= 0x80 - || (id = iso_charset_table[0][c >= ','][c1]) < 0) - /* Invalid designation sequence. Just ignore. */ - break; - } - else if (c == '$') - { - /* Designation sequence for a charset of dimension 2. */ - ONE_MORE_BYTE (c); - if (c >= '@' && c <= 'B') - /* Designation for JISX0208.1978, GB2312, or JISX0208. */ - id = iso_charset_table[1][0][c]; - else if (c >= '(' && c <= '/') - { - ONE_MORE_BYTE (c1); - if (c1 < ' ' || c1 >= 0x80 - || (id = iso_charset_table[1][c >= ','][c1]) < 0) - /* Invalid designation sequence. Just ignore. */ - break; - } - else - /* Invalid designation sequence. Just ignore it. */ - break; - } - else if (c == 'N' || c == 'O') + if (c == 'N' || c == 'O') { /* ESC <Fe> for SS2 or SS3. */ single_shifting = 1; rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_8BIT; - break; } else if (c == '1') { @@ -3072,36 +3014,66 @@ detect_coding_iso_2022 (struct coding_system *coding, { /* ESC <Fp> for start/end composition. */ composition_count = 0; - break; } else { - /* Invalid escape sequence. Just ignore it. */ - break; - } + if (c >= '(' && c <= '/') + { + /* Designation sequence for a charset of dimension 1. */ + ONE_MORE_BYTE (c1); + if (c1 < ' ' || c1 >= 0x80 + || (id = iso_charset_table[0][c >= ','][c1]) < 0) + /* Invalid designation sequence. Just ignore. */ + break; + } + else if (c == '$') + { + /* Designation sequence for a charset of dimension 2. */ + ONE_MORE_BYTE (c); + if (c >= '@' && c <= 'B') + /* Designation for JISX0208.1978, GB2312, or JISX0208. */ + id = iso_charset_table[1][0][c]; + else if (c >= '(' && c <= '/') + { + ONE_MORE_BYTE (c1); + if (c1 < ' ' || c1 >= 0x80 + || (id = iso_charset_table[1][c >= ','][c1]) < 0) + /* Invalid designation sequence. Just ignore. */ + break; + } + else + /* Invalid designation sequence. Just ignore it. */ + break; + } + else + { + /* Invalid escape sequence. Just ignore it. */ + break; + } - /* We found a valid designation sequence for CHARSET. */ - rejected |= CATEGORY_MASK_ISO_8BIT; - if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7], - id)) - found |= CATEGORY_MASK_ISO_7; - else - rejected |= CATEGORY_MASK_ISO_7; - if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_tight], - id)) - found |= CATEGORY_MASK_ISO_7_TIGHT; - else - rejected |= CATEGORY_MASK_ISO_7_TIGHT; - if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_else], - id)) - found |= CATEGORY_MASK_ISO_7_ELSE; - else - rejected |= CATEGORY_MASK_ISO_7_ELSE; - if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_8_else], - id)) - found |= CATEGORY_MASK_ISO_8_ELSE; - else - rejected |= CATEGORY_MASK_ISO_8_ELSE; + /* We found a valid designation sequence for CHARSET. */ + rejected |= CATEGORY_MASK_ISO_8BIT; + if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7], + id)) + found |= CATEGORY_MASK_ISO_7; + else + rejected |= CATEGORY_MASK_ISO_7; + if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_tight], + id)) + found |= CATEGORY_MASK_ISO_7_TIGHT; + else + rejected |= CATEGORY_MASK_ISO_7_TIGHT; + if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_else], + id)) + found |= CATEGORY_MASK_ISO_7_ELSE; + else + rejected |= CATEGORY_MASK_ISO_7_ELSE; + if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_8_else], + id)) + found |= CATEGORY_MASK_ISO_8_ELSE; + else + rejected |= CATEGORY_MASK_ISO_8_ELSE; + } break; case ISO_CODE_SO: @@ -3129,13 +3101,32 @@ detect_coding_iso_2022 (struct coding_system *coding, rejected |= CATEGORY_MASK_ISO_7BIT; if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) & CODING_ISO_FLAG_SINGLE_SHIFT) - found |= CATEGORY_MASK_ISO_8_1, single_shifting = 1; + { + found |= CATEGORY_MASK_ISO_8_1; + single_shifting = 1; + } if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2]) & CODING_ISO_FLAG_SINGLE_SHIFT) - found |= CATEGORY_MASK_ISO_8_2, single_shifting = 1; + { + found |= CATEGORY_MASK_ISO_8_2; + single_shifting = 1; + } if (single_shifting) break; - goto check_extra_latin; + check_extra_latin: + if (! VECTORP (Vlatin_extra_code_table) + || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) + { + rejected = CATEGORY_MASK_ISO; + break; + } + if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) + & CODING_ISO_FLAG_LATIN_EXTRA) + found |= CATEGORY_MASK_ISO_8_1; + else + rejected |= CATEGORY_MASK_ISO_8_1; + rejected |= CATEGORY_MASK_ISO_8_2; + break; default: if (c < 0) @@ -3158,7 +3149,7 @@ detect_coding_iso_2022 (struct coding_system *coding, if (! single_shifting && ! (rejected & CATEGORY_MASK_ISO_8_2)) { - int i = 1; + int len = 1; while (src < src_end) { src_base = src; @@ -3168,38 +3159,24 @@ detect_coding_iso_2022 (struct coding_system *coding, src = src_base; break; } - i++; + len++; } - if (i & 1 && src < src_end) + if (len & 1 && src < src_end) { rejected |= CATEGORY_MASK_ISO_8_2; if (composition_count >= 0) - composition_count += i; + composition_count += len; } else { found |= CATEGORY_MASK_ISO_8_2; if (composition_count >= 0) - composition_count += i / 2; + composition_count += len / 2; } } break; } - check_extra_latin: - single_shifting = 0; - if (! VECTORP (Vlatin_extra_code_table) - || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) - { - rejected = CATEGORY_MASK_ISO; - break; - } - if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) - & CODING_ISO_FLAG_LATIN_EXTRA) - found |= CATEGORY_MASK_ISO_8_1; - else - rejected |= CATEGORY_MASK_ISO_8_1; - rejected |= CATEGORY_MASK_ISO_8_2; } } detect_info->rejected |= CATEGORY_MASK_ISO; @@ -3309,10 +3286,10 @@ detect_coding_iso_2022 (struct coding_system *coding, } \ else /* new format (after ver.21) */ \ { \ - int c; \ + int b; \ \ - ONE_MORE_BYTE (c); \ - rule = COMPOSITION_ENCODE_RULE (rule - 81, c - 32); \ + ONE_MORE_BYTE (b); \ + rule = COMPOSITION_ENCODE_RULE (rule - 81, b - 32); \ if (rule >= 0) \ rule += 0x100; /* to destinguish it from the old format */ \ nbytes = 2; \ @@ -3504,7 +3481,7 @@ decode_coding_iso_2022 (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; int i; @@ -3624,7 +3601,7 @@ decode_coding_iso_2022 (struct coding_system *coding) break; case ISO_control_0: - if (eol_crlf && c1 == '\r') + if (eol_dos && c1 == '\r') ONE_MORE_BYTE (byte_after_cr); MAYBE_FINISH_COMPOSITION (); charset = CHARSET_FROM_ID (charset_ascii); @@ -3897,6 +3874,10 @@ decode_coding_iso_2022 (struct coding_system *coding) } continue; } + break; + + default: + abort (); } if (cmp_status->state == COMPOSING_NO @@ -4029,7 +4010,6 @@ decode_coding_iso_2022 (struct coding_system *coding) const char *intermediate_char_94 = "()*+"; \ const char *intermediate_char_96 = ",-./"; \ int revision = -1; \ - int c; \ \ if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_REVISION) \ revision = CHARSET_ISO_REVISION (charset); \ @@ -4042,11 +4022,12 @@ decode_coding_iso_2022 (struct coding_system *coding) EMIT_ONE_ASCII_BYTE (ISO_CODE_ESC); \ if (CHARSET_DIMENSION (charset) == 1) \ { \ + int b; \ if (! CHARSET_ISO_CHARS_96 (charset)) \ - c = intermediate_char_94[reg]; \ + b = intermediate_char_94[reg]; \ else \ - c = intermediate_char_96[reg]; \ - EMIT_ONE_ASCII_BYTE (c); \ + b = intermediate_char_96[reg]; \ + EMIT_ONE_ASCII_BYTE (b); \ } \ else \ { \ @@ -4226,7 +4207,7 @@ decode_coding_iso_2022 (struct coding_system *coding) to use CHARSET. The element `spec.iso_2022' of *CODING is updated. Return new DST. */ -unsigned char * +static unsigned char * encode_invocation_designation (struct charset *charset, struct coding_system *coding, unsigned char *dst, int *p_nchars) @@ -4289,30 +4270,6 @@ encode_invocation_designation (struct charset *charset, return dst; } -/* The following three macros produce codes for indicating direction - of text. */ -#define ENCODE_CONTROL_SEQUENCE_INTRODUCER \ - do { \ - if (CODING_ISO_FLAGS (coding) == CODING_ISO_FLAG_SEVEN_BITS) \ - EMIT_TWO_ASCII_BYTES (ISO_CODE_ESC, '['); \ - else \ - EMIT_ONE_BYTE (ISO_CODE_CSI); \ - } while (0) - - -#define ENCODE_DIRECTION_R2L() \ - do { \ - ENCODE_CONTROL_SEQUENCE_INTRODUCER (dst); \ - EMIT_TWO_ASCII_BYTES ('2', ']'); \ - } while (0) - - -#define ENCODE_DIRECTION_L2R() \ - do { \ - ENCODE_CONTROL_SEQUENCE_INTRODUCER (dst); \ - EMIT_TWO_ASCII_BYTES ('0', ']'); \ - } while (0) - /* Produce codes for designation and invocation to reset the graphic planes and registers to initial state. */ @@ -4707,7 +4664,7 @@ decode_coding_sjis (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; @@ -4742,7 +4699,7 @@ decode_coding_sjis (struct coding_system *coding) goto invalid_code; if (c < 0x80) { - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') ONE_MORE_BYTE (byte_after_cr); charset = charset_roman; } @@ -4824,7 +4781,7 @@ decode_coding_big5 (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; @@ -4857,7 +4814,7 @@ decode_coding_big5 (struct coding_system *coding) goto invalid_code; if (c < 0x80) { - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') ONE_MORE_BYTE (byte_after_cr); charset = charset_roman; } @@ -5261,13 +5218,13 @@ encode_coding_ccl (struct coding_system *coding) static void decode_coding_raw_text (struct coding_system *coding) { - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); coding->chars_at_source = 1; coding->consumed_char = coding->src_chars; coding->consumed = coding->src_bytes; - if (eol_crlf && coding->source[coding->src_bytes - 1] == '\r') + if (eol_dos && coding->source[coding->src_bytes - 1] == '\r') { coding->consumed_char--; coding->consumed--; @@ -5480,7 +5437,7 @@ decode_coding_charset (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; @@ -5514,7 +5471,7 @@ decode_coding_charset (struct coding_system *coding) else { ONE_MORE_BYTE (c); - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') ONE_MORE_BYTE (byte_after_cr); } if (c < 0) @@ -6607,15 +6564,15 @@ get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup) } else if (CONSP (translation_table)) { - Lisp_Object tail, val; + Lisp_Object tail; for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) if (CHAR_TABLE_P (XCAR (tail)) && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) { - val = XCHAR_TABLE (XCAR (tail))->extras[1]; - if (NATNUMP (val) && *max_lookup < XFASTINT (val)) - *max_lookup = XFASTINT (val); + Lisp_Object tailval = XCHAR_TABLE (XCAR (tail))->extras[1]; + if (NATNUMP (tailval) && *max_lookup < XFASTINT (tailval)) + *max_lookup = XFASTINT (tailval); } } } @@ -7652,12 +7609,12 @@ decode_coding_object (struct coding_system *coding, Lisp_Object dst_object) { int count = SPECPDL_INDEX (); - unsigned char *destination; - EMACS_INT dst_bytes; + unsigned char *destination IF_LINT (= NULL); + EMACS_INT dst_bytes IF_LINT (= 0); EMACS_INT chars = to - from; EMACS_INT bytes = to_byte - from_byte; Lisp_Object attrs; - int saved_pt = -1, saved_pt_byte; + int saved_pt = -1, saved_pt_byte IF_LINT (= 0); int need_marker_adjustment = 0; Lisp_Object old_deactivate_mark; @@ -7845,7 +7802,7 @@ encode_coding_object (struct coding_system *coding, EMACS_INT chars = to - from; EMACS_INT bytes = to_byte - from_byte; Lisp_Object attrs; - int saved_pt = -1, saved_pt_byte; + int saved_pt = -1, saved_pt_byte IF_LINT (= 0); int need_marker_adjustment = 0; int kill_src_buffer = 0; Lisp_Object old_deactivate_mark; @@ -8178,8 +8135,8 @@ detect_coding_system (const unsigned char *src, base_category = XINT (CODING_ATTR_CATEGORY (attrs)); if (base_category == coding_category_undecided) { - enum coding_category category; - struct coding_system *this; + enum coding_category category IF_LINT (= 0); + struct coding_system *this IF_LINT (= NULL); int c, i; /* Skip all ASCII bytes except for a few ISO2022 controls. */ @@ -9112,10 +9069,10 @@ Return the corresponding character. */) } else { - int s1 = c >> 8, s2 = c & 0xFF; + int c1 = c >> 8, c2 = c & 0xFF; - if (s1 < 0x81 || (s1 > 0x9F && s1 < 0xE0) || s1 > 0xEF - || s2 < 0x40 || s2 == 0x7F || s2 > 0xFC) + if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF + || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC) error ("Invalid code: %d", code); SJIS_TO_JIS (c); charset = charset_kanji; @@ -9798,7 +9755,6 @@ usage: (define-coding-system-internal ...) */) else if (EQ (coding_type, Qiso_2022)) { Lisp_Object initial, reg_usage, request, flags; - int i; if (nargs < coding_arg_iso2022_max) goto short_args; @@ -9830,12 +9786,12 @@ usage: (define-coding-system-internal ...) */) for (tail = request; ! NILP (tail); tail = Fcdr (tail)) { int id; - Lisp_Object tmp; + Lisp_Object tmp1; val = Fcar (tail); CHECK_CONS (val); - tmp = XCAR (val); - CHECK_CHARSET_GET_ID (tmp, id); + tmp1 = XCAR (val); + CHECK_CHARSET_GET_ID (tmp1, id); CHECK_NATNUM_CDR (val); if (XINT (XCDR (val)) >= 4) error ("Invalid graphic register number: %d", XINT (XCDR (val))); diff --git a/src/config.in b/src/config.in deleted file mode 100644 index 7f33727c0b1..00000000000 --- a/src/config.in +++ /dev/null @@ -1,1388 +0,0 @@ -/* src/config.in. Generated from configure.in by autoheader. */ - -/* GNU Emacs site configuration template file. - -Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2011 - Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ - - -/* No code in Emacs #includes config.h twice, but some bits of code - intended to work with other packages as well (like gmalloc.c) - think they can include it as many times as they like. */ -#ifndef EMACS_CONFIG_H -#define EMACS_CONFIG_H - - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to the number of bits in type 'ptrdiff_t'. */ -#undef BITSIZEOF_PTRDIFF_T - -/* Define to the number of bits in type 'sig_atomic_t'. */ -#undef BITSIZEOF_SIG_ATOMIC_T - -/* Define to the number of bits in type 'size_t'. */ -#undef BITSIZEOF_SIZE_T - -/* Define to the number of bits in type 'wchar_t'. */ -#undef BITSIZEOF_WCHAR_T - -/* Define to the number of bits in type 'wint_t'. */ -#undef BITSIZEOF_WINT_T - -/* Define if Emacs cannot be dumped on your system. */ -#undef CANNOT_DUMP - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */ -#undef DGUX - -/* Define to 1 if you are using the GNU C Library. */ -#undef DOUG_LEA_MALLOC - -/* Define to the canonical Emacs configuration name. */ -#undef EMACS_CONFIGURATION - -/* Define to the options passed to configure. */ -#undef EMACS_CONFIG_OPTIONS - -/* Enable expensive run-time checking of data types? */ -#undef ENABLE_CHECKING - -/* Define this to check for errors in cons list. */ -#undef GC_CHECK_CONS_LIST - -/* Define this temporarily to hunt a bug. If defined, the size of strings is - redundantly recorded in sdata structures so that it can be compared to the - sizes recorded in Lisp strings. */ -#undef GC_CHECK_STRING_BYTES - -/* Define this to check the string free list. */ -#undef GC_CHECK_STRING_FREE_LIST - -/* Define this to check for short string overrun. */ -#undef GC_CHECK_STRING_OVERRUN - -/* Define to 1 if the `getpgrp' function requires zero arguments. */ -#undef GETPGRP_VOID - -/* Define to 1 if gettimeofday accepts only one argument. */ -#undef GETTIMEOFDAY_ONE_ARGUMENT - -/* Define to 1 if you want to use the GNU memory allocator. */ -#undef GNU_MALLOC - -/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */ -#undef HAVE_AIX_SMT_EXP - -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if ALSA is available. */ -#undef HAVE_ALSA - -/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */ -#undef HAVE_ATTRIBUTE_ALIGNED - -/* Define to 1 if strtold conforms to C99. */ -#undef HAVE_C99_STRTOLD - -/* Define to 1 if you have the `cbrt' function. */ -#undef HAVE_CBRT - -/* Define to 1 if you have the `cfmakeraw' function. */ -#undef HAVE_CFMAKERAW - -/* Define to 1 if you have the `cfsetspeed' function. */ -#undef HAVE_CFSETSPEED - -/* Define to 1 if you have the `closedir' function. */ -#undef HAVE_CLOSEDIR - -/* Define to 1 if you have the <coff.h> header file. */ -#undef HAVE_COFF_H - -/* Define to 1 if you have the <com_err.h> header file. */ -#undef HAVE_COM_ERR_H - -/* Define to 1 if you have the `copysign' function. */ -#undef HAVE_COPYSIGN - -/* Define to 1 if using D-Bus. */ -#undef HAVE_DBUS - -/* Define to 1 if you have the `dbus_watch_get_unix_fd' function. */ -#undef HAVE_DBUS_WATCH_GET_UNIX_FD - -/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. - */ -#undef HAVE_DECL_GETENV - -/* Define to 1 if you have the declaration of `localtime_r', and to 0 if you - don't. */ -#undef HAVE_DECL_LOCALTIME_R - -/* Define to 1 if you have the declaration of `strmode', and to 0 if you - don't. */ -#undef HAVE_DECL_STRMODE - -/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you - don't. */ -#undef HAVE_DECL_SYS_SIGLIST - -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -#undef HAVE_DECL_TZNAME - -/* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you - don't. */ -#undef HAVE_DECL___SYS_SIGLIST - -/* Define to 1 if you have the <des.h> header file. */ -#undef HAVE_DES_H - -/* Define to 1 if dynamic ptys are supported. */ -#undef HAVE_DEV_PTMX - -/* Define to 1 if you have the `difftime' function. */ -#undef HAVE_DIFFTIME - -/* Define to 1 if you have the <dirent.h> header file. */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the `dup2' function. */ -#undef HAVE_DUP2 - -/* Define to 1 if you have the `euidaccess' function. */ -#undef HAVE_EUIDACCESS - -/* Define to 1 if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fmod' function. */ -#undef HAVE_FMOD - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `fpathconf' function. */ -#undef HAVE_FPATHCONF - -/* Define to 1 if using the freetype and fontconfig libraries. */ -#undef HAVE_FREETYPE - -/* Define to 1 if you have the `frexp' function. */ -#undef HAVE_FREXP - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -#undef HAVE_FSEEKO - -/* Define to 1 if you have the `fsync' function. */ -#undef HAVE_FSYNC - -/* Define to 1 if you have the `ftime' function. */ -#undef HAVE_FTIME - -/* Define to 1 if you have the `gai_strerror' function. */ -#undef HAVE_GAI_STRERROR - -/* Define to 1 if using GConf. */ -#undef HAVE_GCONF - -/* Define to 1 if you have the `getaddrinfo' function. */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the `getcwd' function. */ -#undef HAVE_GETCWD - -/* Define to 1 if you have the `getdelim' function. */ -#undef HAVE_GETDELIM - -/* Define to 1 if you have the `getdomainname' function. */ -#undef HAVE_GETDOMAINNAME - -/* Define to 1 if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME - -/* Define to 1 if you have the `getline' function. */ -#undef HAVE_GETLINE - -/* Define to 1 if you have the <getopt.h> header file. */ -#undef HAVE_GETOPT_H - -/* Define to 1 if you have the `getopt_long_only' function. */ -#undef HAVE_GETOPT_LONG_ONLY - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the `getpeername' function. */ -#undef HAVE_GETPEERNAME - -/* Define to 1 if you have the `getpt' function. */ -#undef HAVE_GETPT - -/* Define to 1 if you have the `getrlimit' function. */ -#undef HAVE_GETRLIMIT - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `getsockname' function. */ -#undef HAVE_GETSOCKNAME - -/* Define to 1 if you have the `getsockopt' function. */ -#undef HAVE_GETSOCKOPT - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the `getwd' function. */ -#undef HAVE_GETWD - -/* Define to 1 if you have the `get_current_dir_name' function. */ -#undef HAVE_GET_CURRENT_DIR_NAME - -/* Define to 1 if you have a gif (or ungif) library. */ -#undef HAVE_GIF - -/* Define if using GnuTLS. */ -#undef HAVE_GNUTLS - -/* Define to 1 if you have the gpm library (-lgpm). */ -#undef HAVE_GPM - -/* Define to 1 if you have the `grantpt' function. */ -#undef HAVE_GRANTPT - -/* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */ -#undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE - -/* Define to 1 if you have GTK and pthread (-lpthread). */ -#undef HAVE_GTK_AND_PTHREAD - -/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */ -#undef HAVE_GTK_DIALOG_GET_ACTION_AREA - -/* Define to 1 if you have the `gtk_file_selection_new' function. */ -#undef HAVE_GTK_FILE_SELECTION_NEW - -/* Define to 1 if you have the `gtk_main' function. */ -#undef HAVE_GTK_MAIN - -/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */ -#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION - -/* Define to 1 if you have the `gtk_widget_get_mapped' function. */ -#undef HAVE_GTK_WIDGET_GET_MAPPED - -/* Define to 1 if you have the `gtk_widget_get_sensitive' function. */ -#undef HAVE_GTK_WIDGET_GET_SENSITIVE - -/* Define to 1 if you have the `gtk_widget_get_window' function. */ -#undef HAVE_GTK_WIDGET_GET_WINDOW - -/* Define to 1 if you have the `gtk_widget_set_has_window' function. */ -#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW - -/* Define to 1 if you have the `g_type_init' function. */ -#undef HAVE_G_TYPE_INIT - -/* Define to 1 if netdb.h declares h_errno. */ -#undef HAVE_H_ERRNO - -/* Define to 1 if using imagemagick. */ -#undef HAVE_IMAGEMAGICK - -/* Define to 1 if you have inet sockets. */ -#undef HAVE_INET_SOCKETS - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `isnan' function. */ -#undef HAVE_ISNAN - -/* Define to 1 if you have the jpeg library (-ljpeg). */ -#undef HAVE_JPEG - -/* Define to 1 if you have the <kerberosIV/des.h> header file. */ -#undef HAVE_KERBEROSIV_DES_H - -/* Define to 1 if you have the <kerberosIV/krb.h> header file. */ -#undef HAVE_KERBEROSIV_KRB_H - -/* Define to 1 if you have the <kerberos/des.h> header file. */ -#undef HAVE_KERBEROS_DES_H - -/* Define to 1 if you have the <kerberos/krb.h> header file. */ -#undef HAVE_KERBEROS_KRB_H - -/* Define to 1 if `e_text' is a member of `krb5_error'. */ -#undef HAVE_KRB5_ERROR_E_TEXT - -/* Define to 1 if `text' is a member of `krb5_error'. */ -#undef HAVE_KRB5_ERROR_TEXT - -/* Define to 1 if you have the <krb5.h> header file. */ -#undef HAVE_KRB5_H - -/* Define to 1 if you have the <krb.h> header file. */ -#undef HAVE_KRB_H - -/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ -#undef HAVE_LANGINFO_CODESET - -/* Define to 1 if you have the `com_err' library (-lcom_err). */ -#undef HAVE_LIBCOM_ERR - -/* Define to 1 if you have the `crypto' library (-lcrypto). */ -#undef HAVE_LIBCRYPTO - -/* Define to 1 if you have the `des' library (-ldes). */ -#undef HAVE_LIBDES - -/* Define to 1 if you have the `des425' library (-ldes425). */ -#undef HAVE_LIBDES425 - -/* Define to 1 if you have the `dgc' library (-ldgc). */ -#undef HAVE_LIBDGC - -/* Define to 1 if you have the `dnet' library (-ldnet). */ -#undef HAVE_LIBDNET - -/* Define to 1 if you have the hesiod library (-lhesiod). */ -#undef HAVE_LIBHESIOD - -/* Define to 1 if you have the `intl' library (-lintl). */ -#undef HAVE_LIBINTL - -/* Define to 1 if you have the `k5crypto' library (-lk5crypto). */ -#undef HAVE_LIBK5CRYPTO - -/* Define to 1 if you have the `krb' library (-lkrb). */ -#undef HAVE_LIBKRB - -/* Define to 1 if you have the `krb4' library (-lkrb4). */ -#undef HAVE_LIBKRB4 - -/* Define to 1 if you have the `krb5' library (-lkrb5). */ -#undef HAVE_LIBKRB5 - -/* Define to 1 if you have the `kstat' library (-lkstat). */ -#undef HAVE_LIBKSTAT - -/* Define to 1 if you have the `lockfile' library (-llockfile). */ -#undef HAVE_LIBLOCKFILE - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `mail' library (-lmail). */ -#undef HAVE_LIBMAIL - -/* Define to 1 if you have the `ncurses' library (-lncurses). */ -#undef HAVE_LIBNCURSES - -/* Define to 1 if using libotf. */ -#undef HAVE_LIBOTF - -/* Define to 1 if you have the `perfstat' library (-lperfstat). */ -#undef HAVE_LIBPERFSTAT - -/* Define to 1 if you have the <libpng/png.h> header file. */ -#undef HAVE_LIBPNG_PNG_H - -/* Define to 1 if you have the `pthreads' library (-lpthreads). */ -#undef HAVE_LIBPTHREADS - -/* Define to 1 if you have the resolv library (-lresolv). */ -#undef HAVE_LIBRESOLV - -/* Define to 1 if using SELinux. */ -#undef HAVE_LIBSELINUX - -/* Define to 1 if you have the `Xext' library (-lXext). */ -#undef HAVE_LIBXEXT - -/* Define to 1 if you have the libxml library (-lxml2). */ -#undef HAVE_LIBXML2 - -/* Define to 1 if you have the `Xmu' library (-lXmu). */ -#undef HAVE_LIBXMU - -/* Define to 1 if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the <linux/version.h> header file. */ -#undef HAVE_LINUX_VERSION_H - -/* Define to 1 if you have the <locale.h> header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the `localtime_r' function. */ -#undef HAVE_LOCALTIME_R - -/* Define to 1 if you have the `logb' function. */ -#undef HAVE_LOGB - -/* Define to 1 if you support file names longer than 14 characters. */ -#undef HAVE_LONG_FILE_NAMES - -/* Define to 1 if the system has the type `long long int'. */ -#undef HAVE_LONG_LONG_INT - -/* Define to 1 if you have the `lrand48' function. */ -#undef HAVE_LRAND48 - -/* Define to 1 if you have the `lstat' function. */ -#undef HAVE_LSTAT - -/* Define to 1 if using libm17n-flt. */ -#undef HAVE_M17N_FLT - -/* Define to 1 if you have the <machine/soundcard.h> header file. */ -#undef HAVE_MACHINE_SOUNDCARD_H - -/* Define to 1 if you have the <mach/mach.h> header file. */ -#undef HAVE_MACH_MACH_H - -/* Define to 1 if you have the `MagickExportImagePixels' function. */ -#undef HAVE_MAGICKEXPORTIMAGEPIXELS - -/* Define to 1 if you have the <maillock.h> header file. */ -#undef HAVE_MAILLOCK_H - -/* Define to 1 if you have the <malloc/malloc.h> header file. */ -#undef HAVE_MALLOC_MALLOC_H - -/* Define to 1 if you have the `mblen' function. */ -#undef HAVE_MBLEN - -/* Define to 1 if you have the `mbrlen' function. */ -#undef HAVE_MBRLEN - -/* Define to 1 if you have the `mbsinit' function. */ -#undef HAVE_MBSINIT - -/* Define to 1 if <wchar.h> declares mbstate_t. */ -#undef HAVE_MBSTATE_T - -/* Define to 1 if you have the `memcmp' function. */ -#undef HAVE_MEMCMP - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mempcpy' function. */ -#undef HAVE_MEMPCPY - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have mouse menus. (This is automatic if you use X, but - the option to specify it remains.) It is also defined with other window - systems that support xmenu.c. */ -#undef HAVE_MENUS - -/* Define to 1 if you have the `mkdir' function. */ -#undef HAVE_MKDIR - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if you have mouse support. */ -#undef HAVE_MOUSE - -/* Define to 1 if you have the `mremap' function. */ -#undef HAVE_MREMAP - -/* Define to 1 if you have the <net/if.h> header file. */ -#undef HAVE_NET_IF_H - -/* Define to 1 if you have the <nlist.h> header file. */ -#undef HAVE_NLIST_H - -/* Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on - Mac OS X. */ -#undef HAVE_NS - -/* Define to 1 if libotf has OTF_get_variation_glyphs. */ -#undef HAVE_OTF_GET_VARIATION_GLYPHS - -/* Define to 1 if personality LINUX32 can be set. */ -#undef HAVE_PERSONALITY_LINUX32 - -/* Define to 1 if you have the png library (-lpng). */ -#undef HAVE_PNG - -/* Define to 1 if you have the <png.h> header file. */ -#undef HAVE_PNG_H - -/* Define to 1 if you have the `posix_memalign' function. */ -#undef HAVE_POSIX_MEMALIGN - -/* Define to 1 if you have the `pstat_getdynamic' function. */ -#undef HAVE_PSTAT_GETDYNAMIC - -/* Define to 1 if you have the <pthread.h> header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the <pty.h> header file. */ -#undef HAVE_PTY_H - -/* Define to 1 if you have the <pwd.h> header file. */ -#undef HAVE_PWD_H - -/* Define to 1 if you have the `random' function. */ -#undef HAVE_RANDOM - -/* Define to 1 if you have the `readlink' function. */ -#undef HAVE_READLINK - -/* Define to 1 if you have the `recvfrom' function. */ -#undef HAVE_RECVFROM - -/* Define to 1 if you have the `rename' function. */ -#undef HAVE_RENAME - -/* Define to 1 if res_init is available. */ -#undef HAVE_RES_INIT - -/* Define to 1 if you have the `rint' function. */ -#undef HAVE_RINT - -/* Define to 1 if you have the `rmdir' function. */ -#undef HAVE_RMDIR - -/* Define to 1 if using librsvg. */ -#undef HAVE_RSVG - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define to 1 if you have the `sendto' function. */ -#undef HAVE_SENDTO - -/* Define to 1 if you have the `setitimer' function. */ -#undef HAVE_SETITIMER - -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the `setpgid' function. */ -#undef HAVE_SETPGID - -/* Define to 1 if you have the `setrlimit' function. */ -#undef HAVE_SETRLIMIT - -/* Define to 1 if you have the `setsid' function. */ -#undef HAVE_SETSID - -/* Define to 1 if you have the `setsockopt' function. */ -#undef HAVE_SETSOCKOPT - -/* Define to 1 if you have the `shutdown' function. */ -#undef HAVE_SHUTDOWN - -/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ -#undef HAVE_SIGNED_SIG_ATOMIC_T - -/* Define to 1 if 'wchar_t' is a signed integer type. */ -#undef HAVE_SIGNED_WCHAR_T - -/* Define to 1 if 'wint_t' is a signed integer type. */ -#undef HAVE_SIGNED_WINT_T - -/* Define to 1 if the system has the type `size_t'. */ -#undef HAVE_SIZE_T - -/* Define to 1 if you have sound support. */ -#undef HAVE_SOUND - -/* Define to 1 if you have the <soundcard.h> header file. */ -#undef HAVE_SOUNDCARD_H - -/* Define to 1 if `speed_t' is declared by <termios.h>. */ -#undef HAVE_SPEED_T - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdio_ext.h> header file. */ -#undef HAVE_STDIO_EXT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strrchr' function. */ -#undef HAVE_STRRCHR - -/* Define to 1 if you have the `strsignal' function. */ -#undef HAVE_STRSIGNAL - -/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_ADDR - -/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR - -/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_FLAGS - -/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_HWADDR - -/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_NETMASK - -/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ -#undef HAVE_STRUCT_NLIST_N_UN_N_NAME - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - -/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */ -#undef HAVE_STRUCT_UTIMBUF - -/* Define if struct stat has an st_dm_mode member. */ -#undef HAVE_ST_DM_MODE - -/* Define to 1 if you have the `symlink' function. */ -#undef HAVE_SYMLINK - -/* Define to 1 if you have the `sync' function. */ -#undef HAVE_SYNC - -/* Define to 1 if you have the `sysinfo' function. */ -#undef HAVE_SYSINFO - -/* Define to 1 if you have the <sys/bitypes.h> header file. */ -#undef HAVE_SYS_BITYPES_H - -/* Define to 1 if you have the <sys/inttypes.h> header file. */ -#undef HAVE_SYS_INTTYPES_H - -/* Define to 1 if you have the <sys/loadavg.h> header file. */ -#undef HAVE_SYS_LOADAVG_H - -/* Define to 1 if you have the <sys/mman.h> header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the <sys/resource.h> header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the <sys/select.h> header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the <sys/socket.h> header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the <sys/soundcard.h> header file. */ -#undef HAVE_SYS_SOUNDCARD_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/systeminfo.h> header file. */ -#undef HAVE_SYS_SYSTEMINFO_H - -/* Define to 1 if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <sys/un.h> header file. */ -#undef HAVE_SYS_UN_H - -/* Define to 1 if you have the <sys/utsname.h> header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the <sys/vlimit.h> header file. */ -#undef HAVE_SYS_VLIMIT_H - -/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the <sys/_mbstate_t.h> header file. */ -#undef HAVE_SYS__MBSTATE_T_H - -/* Define to 1 if you have the <term.h> header file. */ -#undef HAVE_TERM_H - -/* Define to 1 if you have the tiff library (-ltiff). */ -#undef HAVE_TIFF - -/* Define to 1 if `struct timeval' is declared by <sys/time.h>. */ -#undef HAVE_TIMEVAL - -/* Define if struct tm has the tm_gmtoff member. */ -#undef HAVE_TM_GMTOFF - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you have the `touchlock' function. */ -#undef HAVE_TOUCHLOCK - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -#undef HAVE_TZNAME - -/* Define to 1 if you have the `tzset' function. */ -#undef HAVE_TZSET - -/* Define to 1 if you have the `ualarm' function. */ -#undef HAVE_UALARM - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#undef HAVE_UNSIGNED_LONG_LONG_INT - -/* Define to 1 if you have the <util.h> header file. */ -#undef HAVE_UTIL_H - -/* Define to 1 if you have the `utimes' function. */ -#undef HAVE_UTIMES - -/* Define to 1 if you have the <utime.h> header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if you have the <utmp.h> header file. */ -#undef HAVE_UTMP_H - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the <vfork.h> header file. */ -#undef HAVE_VFORK_H - -/* Define to 1 if you have the <wchar.h> header file. */ -#undef HAVE_WCHAR_H - -/* Define if you have the 'wchar_t' type. */ -#undef HAVE_WCHAR_T - -/* Define if you have a window system. */ -#undef HAVE_WINDOW_SYSTEM - -/* Define to 1 if `fork' works. */ -#undef HAVE_WORKING_FORK - -/* Define to 1 if `vfork' works. */ -#undef HAVE_WORKING_VFORK - -/* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs - expects to use version 10. */ -#undef HAVE_X11 - -/* Define to 1 if you have the X11R6 or newer version of Xlib. */ -#undef HAVE_X11R6 - -/* Define if you have usable X11R6-style XIM support. */ -#undef HAVE_X11R6_XIM - -/* Define to 1 if you have the X11R6 or newer version of Xt. */ -#undef HAVE_X11XTR6 - -/* Define to 1 if you have the Xaw3d library (-lXaw3d). */ -#undef HAVE_XAW3D - -/* Define to 1 if you have the Xft library. */ -#undef HAVE_XFT - -/* Define to 1 if XIM is available */ -#undef HAVE_XIM - -/* Define to 1 if you have the XkbGetKeyboard function. */ -#undef HAVE_XKBGETKEYBOARD - -/* Define to 1 if you have the Xpm libary (-lXpm). */ -#undef HAVE_XPM - -/* Define to 1 if you have the `XrmSetDatabase' function. */ -#undef HAVE_XRMSETDATABASE - -/* Define to 1 if you have the `XScreenNumberOfScreen' function. */ -#undef HAVE_XSCREENNUMBEROFSCREEN - -/* Define to 1 if you have the `XScreenResourceString' function. */ -#undef HAVE_XSCREENRESOURCESTRING - -/* Define to 1 if you have the `XSetWMProtocols' function. */ -#undef HAVE_XSETWMPROTOCOLS - -/* Define if you have usable i18n support. */ -#undef HAVE_X_I18N - -/* Define to 1 if you have the SM library (-lSM). */ -#undef HAVE_X_SM - -/* Define to 1 if you want to use the X window system. */ -#undef HAVE_X_WINDOWS - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Define to 1 if you have the `__builtin_unwind_init' function. */ -#undef HAVE___BUILTIN_UNWIND_INIT - -/* Define to 1 if you have the `__executable_start' function. */ -#undef HAVE___EXECUTABLE_START - -/* Define to 1 if you have the `__fpending' function. */ -#undef HAVE___FPENDING - -/* Define to support using a Hesiod database to find the POP server. */ -#undef HESIOD - -/* Define to support Kerberos-authenticated POP mail retrieval. */ -#undef KERBEROS - -/* Define to use Kerberos 5 instead of Kerberos 4. */ -#undef KERBEROS5 - -/* Define to 1 if localtime caches TZ. */ -#undef LOCALTIME_CACHE - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* String giving fallback POP mail host. */ -#undef MAILHOST - -/* Define to unlink, rather than empty, mail spool after reading. */ -#undef MAIL_UNLINK_SPOOL - -/* Define if the mailer uses flock to interlock the mail spool. */ -#undef MAIL_USE_FLOCK - -/* Define if the mailer uses lockf to interlock the mail spool. */ -#undef MAIL_USE_LOCKF - -/* Define to support MMDF mailboxes in movemail. */ -#undef MAIL_USE_MMDF - -/* Define to support POP mail retrieval. */ -#undef MAIL_USE_POP - -/* Define to 1 if you don't have struct exception in math.h. */ -#undef NO_MATHERR - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Define to 1 if `NSInteger' is defined. */ -#undef NS_HAVE_NSINTEGER - -/* Define to 1 if you are using NS windowing under MacOS X. */ -#undef NS_IMPL_COCOA - -/* Define to 1 if you are using NS windowing under GNUstep. */ -#undef NS_IMPL_GNUSTEP - -/* Define to 1 if the nlist n_name member is a pointer */ -#undef N_NAME_POINTER - -/* Define if the C compiler is the linker. */ -#undef ORDINARY_LINK - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define as `void' if your compiler accepts `void *'; otherwise define as - `char'. */ -#undef POINTER_TYPE - -/* Define to 1 if the C compiler supports function prototypes. */ -#undef PROTOTYPES - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'ptrdiff_t'. */ -#undef PTRDIFF_T_SUFFIX - -/* Define to 1 if readlink fails to recognize a trailing slash. */ -#undef READLINK_TRAILING_SLASH_BUG - -/* Define REL_ALLOC if you want to use the relocating allocator for buffer - space. */ -#undef REL_ALLOC - -/* Define to 1 if stat needs help when passed a directory name with a trailing - slash */ -#undef REPLACE_FUNC_STAT_DIR - -/* Define to 1 if stat needs help when passed a file name with a trailing - slash */ -#undef REPLACE_FUNC_STAT_FILE - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'sig_atomic_t'. */ -#undef SIG_ATOMIC_T_SUFFIX - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'size_t'. */ -#undef SIZE_T_SUFFIX - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ -#undef STAT_MACROS_BROKEN - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 on System V Release 4. */ -#undef SVR4 - -/* Process async input synchronously. */ -#undef SYNC_INPUT - -/* Define to use system malloc. */ -#undef SYSTEM_MALLOC - -/* Define to 1 if you use terminfo instead of termcap. */ -#undef TERMINFO - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your <sys/time.h> declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Define to 1 for Encore UMAX. */ -#undef UMAX - -/* Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of - <sys/cpustats.h>. */ -#undef UMAX4_3 - -/* Define to 1 if using GTK. */ -#undef USE_GTK - -/* Define this to use a lisp union for the Lisp_Object data type. */ -#undef USE_LISP_UNION_TYPE - -/* Define to 1 if using the Lucid X toolkit. */ -#undef USE_LUCID - -/* Define to use mmap to allocate buffer text. */ -#undef USE_MMAP_FOR_BUFFERS - -/* Define to 1 if using the Motif X toolkit. */ -#undef USE_MOTIF - -/* Define to 1 if we should use toolkit scroll bars. */ -#undef USE_TOOLKIT_SCROLL_BARS - -/* Define to 1 if we should use XIM, if it is available. */ -#undef USE_XIM - -/* Define to 1 if using an X toolkit. */ -#undef USE_X_TOOLKIT - -/* Version number of package */ -#undef VERSION - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'wchar_t'. */ -#undef WCHAR_T_SUFFIX - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'wint_t'. */ -#undef WINT_T_SUFFIX - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define this to check for malloc buffer overrun. */ -#undef XMALLOC_OVERRUN_CHECK - -/* Define to the type of the 6th arg of XRegisterIMInstantiateCallback, either - XPointer or XPointer*. */ -#undef XRegisterIMInstantiateCallback_arg6 - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -#undef _LARGEFILE_SOURCE - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define to 500 only on HP-UX. */ -#undef _XOPEN_SOURCE - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Define to rpl_ if the getopt replacement functions and variables should be - used. */ -#undef __GETOPT_PREFIX - -/* Define like PROTOTYPES; this can be used by system headers. */ -#undef __PROTOTYPES - -/* Define to compiler's equivalent of C99 restrict keyword in array - declarations. Define as empty for no equivalent. */ -#undef __restrict_arr - -/* Define to the used machine dependent file. */ -#undef config_machfile - -/* Define to the used os dependent file. */ -#undef config_opsysfile - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports - the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of - earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. - __APPLE__ && __MACH__ test for MacOS X. - __APPLE_CC__ tests for the Apple compiler and its version. - __STDC_VERSION__ tests for the C99 mode. */ -#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ -# define __GNUC_STDC_INLINE__ 1 -#endif - -/* Define to a type if <wchar.h> does not define. */ -#undef mbstate_t - -/* Define to the name of the strftime replacement function. */ -#undef my_strftime - -/* Define to the type of st_nlink in struct stat, or a supertype. */ -#undef nlink_t - -/* Define to `int' if <sys/types.h> does not define. */ -#undef pid_t - -/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -#undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict or - __restrict__, even though the corresponding Sun C compiler ends up with - "#define restrict _Restrict" or "#define restrict __restrict__" in the - previous line. Perhaps some future version of Sun C++ will work with - restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT -# define _Restrict -# define __restrict__ -#endif - -/* Define to any substitute for sys_siglist. */ -#undef sys_siglist - -/* Define as a marker that can be attached to declarations that might not - be used. This helps to reduce warnings, such as from - GCC -Wunused-parameter. */ -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED __attribute__ ((__unused__)) -#else -# define _GL_UNUSED -#endif -/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name - is a misnomer outside of parameter lists. */ -#define _UNUSED_PARAMETER_ _GL_UNUSED - - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork - -/* Define to empty if the keyword `volatile' does not work. Warning: valid - code using `volatile' can become incorrect without. Disable with care. */ -#undef volatile - - -/* Define AMPERSAND_FULL_NAME if you use the convention - that & in the full name stands for the login id. */ -/* Turned on June 1996 supposing nobody will mind it. */ -#define AMPERSAND_FULL_NAME - -/* If using GNU, then support inline function declarations. */ -/* Don't try to switch on inline handling as detected by AC_C_INLINE - generally, because even if non-gcc compilers accept `inline', they - may reject `extern inline'. */ -#if defined (__GNUC__) -#define INLINE __inline__ -#else -#define INLINE -#endif - -/* `subprocesses' should be defined if you want to - have code for asynchronous subprocesses - (as used in M-x compile and M-x shell). - Only MSDOS does not support this (it overrides - this in its config_opsysfile below). */ - -#define subprocesses - -/* Include the os and machine dependent files. */ -#include config_opsysfile -#ifdef config_machfile -# include config_machfile -#endif - -/* GNUstep needs a bit more pure memory. Of the existing knobs, - SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. - (There is probably a better place to do this, but right now the - Cocoa side does this in s/darwin.h and we cannot parallel this - exactly since GNUstep is multi-OS. */ -#if defined HAVE_NS && defined NS_IMPL_GNUSTEP -# define SYSTEM_PURESIZE_EXTRA 30000 -#endif - -/* SIGTYPE is the macro we actually use. */ -#ifndef SIGTYPE -#define SIGTYPE RETSIGTYPE -#endif - -#ifdef emacs /* Don't do this for lib-src. */ -/* Tell regex.c to use a type compatible with Emacs. */ -#define RE_TRANSLATE_TYPE Lisp_Object -#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C) -#ifdef make_number -/* If make_number is a macro, use it. */ -#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) -#else -/* If make_number is a function, avoid it. */ -#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0)) -#endif -#endif - -/* These default definitions are good for almost all machines. - The exceptions override them in m/MACHINE.h. */ - -#ifndef BITS_PER_CHAR -#define BITS_PER_CHAR 8 -#endif - -#ifndef BITS_PER_SHORT -#define BITS_PER_SHORT 16 -#endif - -/* Note that lisp.h uses this in a preprocessor conditional, so it - would not work to use sizeof. That being so, we do all of them - without sizeof, for uniformity's sake. */ -#ifndef BITS_PER_INT -#define BITS_PER_INT 32 -#endif - -#ifndef BITS_PER_LONG -#ifdef _LP64 -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif -#endif - -/* Define if the compiler supports function prototypes. It may do so but - not define __STDC__ (e.g. DEC C by default) or may define it as zero. */ -#undef PROTOTYPES - -#include <string.h> -#include <stdlib.h> - -#ifdef HAVE_ALLOCA_H -# include <alloca.h> -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#else -# include <stddef.h> -# ifdef __cplusplus -extern "C" -# endif -void *alloca (size_t); -#endif - -#ifndef HAVE_SIZE_T -typedef unsigned size_t; -#endif - -#ifndef HAVE_STRCHR -#define strchr(a, b) index (a, b) -#endif - -#ifndef HAVE_STRRCHR -#define strrchr(a, b) rindex (a, b) -#endif - -#if defined __GNUC__ && (__GNUC__ > 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) -#define NO_RETURN __attribute__ ((__noreturn__)) -#else -#define NO_RETURN /* nothing */ -#endif - -#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE -#endif - -#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) -#define EXTERNALLY_VISIBLE __attribute__((externally_visible)) -#else -#define EXTERNALLY_VISIBLE -#endif - -/* Some versions of GNU/Linux define noinline in their headers. */ -#ifdef noinline -#undef noinline -#endif - -/* These won't be used automatically yet. We also need to know, at least, - that the stack is continuous. */ -#ifdef __GNUC__ -# ifndef GC_SETJMP_WORKS - /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */ -# define GC_SETJMP_WORKS 1 -# endif -# ifndef GC_LISP_OBJECT_ALIGNMENT -# define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object)) -# endif -#endif - -#endif /* EMACS_CONFIG_H */ - -/* -Local Variables: -mode: c -End: -*/ - diff --git a/src/data.c b/src/data.c index 6039743b1d5..e5c485f5322 100644 --- a/src/data.c +++ b/src/data.c @@ -807,7 +807,10 @@ variable chain of symbols. */) (Lisp_Object object) { if (SYMBOLP (object)) - XSETSYMBOL (object, indirect_variable (XSYMBOL (object))); + { + struct Lisp_Symbol *sym = indirect_variable (XSYMBOL (object)); + XSETSYMBOL (object, sym); + } return object; } @@ -817,9 +820,6 @@ variable chain of symbols. */) This does not handle buffer-local variables; use swap_in_symval_forwarding for that. */ -#define do_blv_forwarding(blv) \ - ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv)) - Lisp_Object do_symval_forwarding (register union Lisp_Fwd *valcontents) { @@ -866,14 +866,6 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents) BUF non-zero means set the value in buffer BUF instead of the current buffer. This only plays a role for per-buffer variables. */ -#define store_blv_forwarding(blv, newval, buf) \ - do { \ - if ((blv)->forwarded) \ - store_symval_forwarding (BLV_FWD (blv), (newval), (buf)); \ - else \ - SET_BLV_VALUE (blv, newval); \ - } while (0) - static void store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newval, struct buffer *buf) { @@ -909,12 +901,12 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) { - Lisp_Object buf; + Lisp_Object lbuf; struct buffer *b; - buf = Fcdr (XCAR (tail)); - if (!BUFFERP (buf)) continue; - b = XBUFFER (buf); + lbuf = Fcdr (XCAR (tail)); + if (!BUFFERP (lbuf)) continue; + b = XBUFFER (lbuf); if (! PER_BUFFER_VALUE_P (b, idx)) PER_BUFFER_VALUE (b, offset) = newval; @@ -1271,7 +1263,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register /* Return the default value of SYMBOL, but don't check for voidness. Return Qunbound if it is void. */ -Lisp_Object +static Lisp_Object default_value (Lisp_Object symbol) { struct Lisp_Symbol *sym; @@ -1505,8 +1497,8 @@ The function `default-value' gets the default value and `set-default' sets it. { struct Lisp_Symbol *sym; struct Lisp_Buffer_Local_Value *blv = NULL; - union Lisp_Val_Fwd valcontents; - int forwarded; + union Lisp_Val_Fwd valcontents IF_LINT (= {0}); + int forwarded IF_LINT (= 0); CHECK_SYMBOL (variable); sym = XSYMBOL (variable); @@ -1581,8 +1573,8 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) (register Lisp_Object variable) { register Lisp_Object tem; - int forwarded; - union Lisp_Val_Fwd valcontents; + int forwarded IF_LINT (= 0); + union Lisp_Val_Fwd valcontents IF_LINT (= {0}); struct Lisp_Symbol *sym; struct Lisp_Buffer_Local_Value *blv = NULL; @@ -2218,7 +2210,7 @@ bool-vector. IDX starts at 0. */) enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; -Lisp_Object +static Lisp_Object arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison) { double f1 = 0, f2 = 0; @@ -2486,7 +2478,7 @@ enum arithop static Lisp_Object float_arith_driver (double, int, enum arithop, int, Lisp_Object *); -Lisp_Object +static Lisp_Object arith_driver (enum arithop code, int nargs, register Lisp_Object *args) { register Lisp_Object val; @@ -3310,7 +3302,7 @@ syms_of_data (void) XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; } -SIGTYPE +static SIGTYPE arith_error (int signo) { sigsetmask (SIGEMPTYMASK); diff --git a/src/dbusbind.c b/src/dbusbind.c index 7e5104026cd..2c8de20a4d4 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -325,7 +325,7 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis if ((subtype == DBUS_TYPE_SIGNATURE) && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt))) && NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) - strcpy (x, SDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); + strcpy (x, SSDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); while (!NILP (elt)) { @@ -531,7 +531,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) but by not encoding it, we guarantee it's valid utf-8, even if it contains eight-bit-bytes. Of course, you can still send manually-crafted junk by passing a unibyte string. */ - char *val = SDATA (object); + char *val = SSDATA (object); XD_DEBUG_MESSAGE ("%c %s", dtype, val); if (!dbus_message_iter_append_basic (iter, dtype, &val)) XD_SIGNAL2 (build_string ("Unable to append argument"), object); @@ -569,7 +569,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object))) && NILP (CDR_SAFE (XD_NEXT_VALUE (object)))) { - strcpy (signature, SDATA (CAR_SAFE (XD_NEXT_VALUE (object)))); + strcpy (signature, SSDATA (CAR_SAFE (XD_NEXT_VALUE (object)))); object = CDR_SAFE (XD_NEXT_VALUE (object)); } @@ -789,7 +789,7 @@ xd_initialize (Lisp_Object bus, int raise_error) dbus_error_init (&derror); if (STRINGP (bus)) - connection = dbus_connection_open (SDATA (bus), &derror); + connection = dbus_connection_open (SSDATA (bus), &derror); else if (EQ (bus, QCdbus_system_bus)) connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); @@ -936,7 +936,7 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); /* We do not want to abort. */ - putenv ("DBUS_FATAL_WARNINGS=0"); + putenv ((char *) "DBUS_FATAL_WARNINGS=0"); /* Return. */ return Qnil; @@ -1089,10 +1089,10 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI connection = xd_initialize (bus, TRUE); /* Create the message. */ - dmessage = dbus_message_new_method_call (SDATA (service), - SDATA (path), - SDATA (interface), - SDATA (method)); + dmessage = dbus_message_new_method_call (SSDATA (service), + SSDATA (path), + SSDATA (interface), + SSDATA (method)); UNGCPRO; if (dmessage == NULL) XD_SIGNAL1 (build_string ("Unable to create a new message")); @@ -1272,10 +1272,10 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE connection = xd_initialize (bus, TRUE); /* Create the message. */ - dmessage = dbus_message_new_method_call (SDATA (service), - SDATA (path), - SDATA (interface), - SDATA (method)); + dmessage = dbus_message_new_method_call (SSDATA (service), + SSDATA (path), + SSDATA (interface), + SSDATA (method)); if (dmessage == NULL) XD_SIGNAL1 (build_string ("Unable to create a new message")); @@ -1386,7 +1386,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN); if ((dmessage == NULL) || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) - || (!dbus_message_set_destination (dmessage, SDATA (service)))) + || (!dbus_message_set_destination (dmessage, SSDATA (service)))) { UNGCPRO; XD_SIGNAL1 (build_string ("Unable to create a return message")); @@ -1475,7 +1475,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) if ((dmessage == NULL) || (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED)) || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) - || (!dbus_message_set_destination (dmessage, SDATA (service)))) + || (!dbus_message_set_destination (dmessage, SSDATA (service)))) { UNGCPRO; XD_SIGNAL1 (build_string ("Unable to create a error message")); @@ -1591,9 +1591,9 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) connection = xd_initialize (bus, TRUE); /* Create the message. */ - dmessage = dbus_message_new_signal (SDATA (path), - SDATA (interface), - SDATA (signal)); + dmessage = dbus_message_new_signal (SSDATA (path), + SSDATA (interface), + SSDATA (signal)); UNGCPRO; if (dmessage == NULL) XD_SIGNAL1 (build_string ("Unable to create a new message")); @@ -1745,11 +1745,11 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus) /* key has the structure (UNAME SERVICE PATH HANDLER). */ if (((uname == NULL) || (NILP (CAR_SAFE (key))) - || (strcmp (uname, SDATA (CAR_SAFE (key))) == 0)) + || (strcmp (uname, SSDATA (CAR_SAFE (key))) == 0)) && ((path == NULL) || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) || (strcmp (path, - SDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) + SSDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) == 0)) && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key))))))) { @@ -1888,7 +1888,6 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) (int nargs, register Lisp_Object *args) { Lisp_Object bus, service; - struct gcpro gcpro1, gcpro2; DBusConnection *connection; unsigned int i; unsigned int value; @@ -1921,7 +1920,7 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) /* Request the known name from the bus. */ dbus_error_init (&derror); - result = dbus_bus_request_name (connection, SDATA (service), flags, + result = dbus_bus_request_name (connection, SSDATA (service), flags, &derror); if (dbus_error_is_set (&derror)) XD_ERROR (derror); @@ -2019,8 +2018,8 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG name of "org.freedesktop.DBus" is that string itself. */ if ((STRINGP (service)) && (SBYTES (service) > 0) - && (strcmp (SDATA (service), DBUS_SERVICE_DBUS) != 0) - && (strncmp (SDATA (service), ":", 1) != 0)) + && (strcmp (SSDATA (service), DBUS_SERVICE_DBUS) != 0) + && (strncmp (SSDATA (service), ":", 1) != 0)) { uname = call2 (intern ("dbus-get-name-owner"), bus, service); /* When there is no unique name, we mark it with an empty @@ -2122,7 +2121,6 @@ discovering the still incomplete interface.*/) Lisp_Object dont_register_service) { Lisp_Object key, key1, value; - DBusError derror; Lisp_Object args[2] = { bus, service }; /* Check parameters. */ @@ -2350,4 +2348,3 @@ be called when the D-Bus reply message arrives. */); } #endif /* HAVE_DBUS */ - diff --git a/src/deps.mk b/src/deps.mk index 77994bcaadb..35754dfa7de 100644 --- a/src/deps.mk +++ b/src/deps.mk @@ -87,12 +87,13 @@ dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \ lisp.h $(config_h) editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ - coding.h frame.h blockinput.h atimer.h ../lib/unistd.h ../lib/strftime.h \ + coding.h frame.h blockinput.h atimer.h \ + ../lib/intprops.h ../lib/strftime.h ../lib/unistd.h \ lisp.h globals.h $(config_h) emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \ globals.h ../lib/unistd.h window.h dispextern.h keyboard.h keymap.h \ - frame.h coding.h gnutls.h msdos.h + frame.h coding.h gnutls.h msdos.h unexec.h fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h \ commands.h globals.h ../lib/unistd.h @@ -190,24 +191,23 @@ sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \ cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ - systty.h syssignal.h $(INTERVALS_H) buffer.h ../lib/unistd.h -termcap.o: termcap.c lisp.h $(config_h) + systty.h syssignal.h tparam.h $(INTERVALS_H) buffer.h ../lib/unistd.h +termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h) terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ msdos.h terminfo.o: terminfo.c lisp.h globals.h $(config_h) -tparam.o: tparam.c lisp.h $(config_h) +tparam.o: tparam.c tparam.h lisp.h $(config_h) undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ lisp.h globals.h $(config_h) -unexaix.o: unexaix.c lisp.h $(config_h) -unexalpha.o: unexalpha.c $(config_h) -unexcw.o: unexcw.c lisp.h $(config_h) -unexcoff.o: unexcoff.c lisp.h $(config_h) -unexelf.o: unexelf.c ../lib/unistd.h $(config_h) -unexhp9k800.o: unexhp9k800.c $(config_h) -unexmacosx.o: unexmacosx.c $(config_h) -unexsol.o: unexsol.c lisp.h $(config_h) -unexw32.o: unexw32.c $(config_h) +unexaix.o: unexaix.c lisp.h unexec.h $(config_h) +unexcw.o: unexcw.c lisp.h unexec.h $(config_h) +unexcoff.o: unexcoff.c lisp.h unexec.h $(config_h) +unexelf.o: unexelf.c unexec.h ../lib/unistd.h $(config_h) +unexhp9k800.o: unexhp9k800.c unexec.h $(config_h) +unexmacosx.o: unexmacosx.c unexec.h $(config_h) +unexsol.o: unexsol.c lisp.h unexec.h $(config_h) +unexw32.o: unexw32.c unexec.h $(config_h) w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \ msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h) widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \ diff --git a/src/dired.c b/src/dired.c index 96063680d4d..176f14925b4 100644 --- a/src/dired.c +++ b/src/dired.c @@ -79,11 +79,6 @@ extern struct direct *readdir (DIR *); #include "regex.h" #include "blockinput.h" -/* Returns a search buffer, with a fastmap allocated and ready to go. */ -extern struct re_pattern_buffer *compile_pattern (Lisp_Object, - struct re_registers *, - Lisp_Object, int, int); - Lisp_Object Qdirectory_files; Lisp_Object Qdirectory_files_and_attributes; Lisp_Object Qfile_name_completion; @@ -102,7 +97,7 @@ directory_files_internal_w32_unwind (Lisp_Object arg) } #endif -Lisp_Object +static Lisp_Object directory_files_internal_unwind (Lisp_Object dh) { DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; @@ -233,11 +228,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m int len; int wanted = 0; Lisp_Object name, finalname; - struct gcpro gcpro1, gcpro2; + struct gcpro inner_gcpro1, inner_gcpro2; len = NAMLEN (dp); name = finalname = make_unibyte_string (dp->d_name, len); - GCPRO2 (finalname, name); + GCPRO2_VAR (finalname, name, inner_gcpro); /* Note: DECODE_FILE can GC; it should protect its argument, though. */ @@ -293,23 +288,23 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m /* Construct an expanded filename for the directory entry. Use the decoded names for input to Ffile_attributes. */ Lisp_Object decoded_fullname, fileattrs; - struct gcpro gcpro1, gcpro2; + struct gcpro innermost_gcpro1, innermost_gcpro2; decoded_fullname = fileattrs = Qnil; - GCPRO2 (decoded_fullname, fileattrs); + GCPRO2_VAR (decoded_fullname, fileattrs, innermost_gcpro); /* Both Fexpand_file_name and Ffile_attributes can GC. */ decoded_fullname = Fexpand_file_name (name, directory); fileattrs = Ffile_attributes (decoded_fullname, id_format); list = Fcons (Fcons (finalname, fileattrs), list); - UNGCPRO; + UNGCPRO_VAR (innermost_gcpro); } else list = Fcons (finalname, list); } - UNGCPRO; + UNGCPRO_VAR (inner_gcpro); } } @@ -676,11 +671,11 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v if (!NILP (predicate)) { Lisp_Object val; - struct gcpro gcpro1; + struct gcpro inner_gcpro1; - GCPRO1 (name); + GCPRO1_VAR (name, inner_gcpro); val = call1 (predicate, name); - UNGCPRO; + UNGCPRO_VAR (inner_gcpro); if (NILP (val)) continue; @@ -702,16 +697,16 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v Lisp_Object zero = make_number (0); /* FIXME: This is a copy of the code in Ftry_completion. */ int compare = min (bestmatchsize, SCHARS (name)); - Lisp_Object tem + Lisp_Object cmp = Fcompare_strings (bestmatch, zero, make_number (compare), name, zero, make_number (compare), completion_ignore_case ? Qt : Qnil); int matchsize - = (EQ (tem, Qt) ? compare - : XINT (tem) < 0 ? - XINT (tem) - 1 - : XINT (tem) - 1); + = (EQ (cmp, Qt) ? compare + : XINT (cmp) < 0 ? - XINT (cmp) - 1 + : XINT (cmp) - 1); if (completion_ignore_case) { @@ -735,18 +730,18 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v (((matchsize == SCHARS (name)) == (matchsize + !!directoryp == SCHARS (bestmatch))) - && (tem = Fcompare_strings (name, zero, + && (cmp = Fcompare_strings (name, zero, make_number (SCHARS (file)), file, zero, Qnil, Qnil), - EQ (Qt, tem)) - && (tem = Fcompare_strings (bestmatch, zero, + EQ (Qt, cmp)) + && (cmp = Fcompare_strings (bestmatch, zero, make_number (SCHARS (file)), file, zero, Qnil, Qnil), - ! EQ (Qt, tem)))) + ! EQ (Qt, cmp)))) bestmatch = name; } bestmatchsize = matchsize; @@ -795,8 +790,8 @@ scmp (const char *s1, const char *s2, int len) if (completion_ignore_case) { while (l - && (DOWNCASE ((unsigned char) *s1++) - == DOWNCASE ((unsigned char) *s2++))) + && (downcase ((unsigned char) *s1++) + == downcase ((unsigned char) *s2++))) l--; } else @@ -848,13 +843,6 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad return value; } -Lisp_Object -make_time (time_t time) -{ - return Fcons (make_number (time >> 16), - Fcons (make_number (time & 0177777), Qnil)); -} - static char * stat_uname (struct stat *st) { diff --git a/src/dispextern.h b/src/dispextern.h index 37ae7ee5fd5..9843dfd1fcd 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2944,6 +2944,7 @@ enum tool_bar_item_image extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *); extern void bidi_move_to_visually_next (struct bidi_it *); +extern void bidi_dump_cached_states (void); extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int); extern int bidi_mirror_char (int); @@ -3325,9 +3326,10 @@ extern struct terminal *init_tty (const char *, const char *, int); extern int scrolling_max_lines_saved (int, int, int *, int *, int *); extern int scroll_cost (struct frame *, int, int, int); -extern void do_line_insertion_deletion_costs (struct frame *, char *, - char *, char *, char *, - char *, char *, int); +extern void do_line_insertion_deletion_costs (struct frame *, const char *, + const char *, const char *, + const char *, const char *, + const char *, int); void scrolling_1 (struct frame *, int, int, int, int *, int *, int *, int *, int); diff --git a/src/doc.c b/src/doc.c index b56464e7219..158b09790f7 100644 --- a/src/doc.c +++ b/src/doc.c @@ -323,17 +323,20 @@ string is passed through `substitute-command-keys'. */) { Lisp_Object fun; Lisp_Object funcar; - Lisp_Object tem, doc; + Lisp_Object doc; int try_reload = 1; documentation: doc = Qnil; - if (SYMBOLP (function) - && (tem = Fget (function, Qfunction_documentation), - !NILP (tem))) - return Fdocumentation_property (function, Qfunction_documentation, raw); + if (SYMBOLP (function)) + { + Lisp_Object tem = Fget (function, Qfunction_documentation); + if (!NILP (tem)) + return Fdocumentation_property (function, Qfunction_documentation, + raw); + } fun = Findirect_function (function, Qnil); if (SUBRP (fun)) @@ -349,13 +352,16 @@ string is passed through `substitute-command-keys'. */) { if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING) return Qnil; - tem = AREF (fun, COMPILED_DOC_STRING); - if (STRINGP (tem)) - doc = tem; - else if (NATNUMP (tem) || CONSP (tem)) - doc = tem; else - return Qnil; + { + Lisp_Object tem = AREF (fun, COMPILED_DOC_STRING); + if (STRINGP (tem)) + doc = tem; + else if (NATNUMP (tem) || CONSP (tem)) + doc = tem; + else + return Qnil; + } } else if (STRINGP (fun) || VECTORP (fun)) { @@ -372,9 +378,8 @@ string is passed through `substitute-command-keys'. */) || (EQ (funcar, Qclosure) && (fun = XCDR (fun), 1)) || EQ (funcar, Qautoload)) { - Lisp_Object tem1; - tem1 = Fcdr (Fcdr (fun)); - tem = Fcar (tem1); + Lisp_Object tem1 = Fcdr (Fcdr (fun)); + Lisp_Object tem = Fcar (tem1); if (STRINGP (tem)) doc = tem; /* Handle a doc reference--but these never come last @@ -542,7 +547,7 @@ the same file name is found in the `doc-directory'. */) char buf[1024 + 1]; register EMACS_INT filled; register EMACS_INT pos; - register char *p, *end; + register char *p; Lisp_Object sym; char *name; int skip_file = 0; @@ -601,6 +606,7 @@ the same file name is found in the `doc-directory'. */) pos = 0; while (1) { + register char *end; if (filled < 512) filled += emacs_read (fd, &buf[filled], sizeof buf - 1 - filled); if (!filled) diff --git a/src/editfns.c b/src/editfns.c index 28690e7c76d..1f98ff040b3 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -45,6 +45,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #include <ctype.h> +#include <limits.h> +#include <intprops.h> #include <strftime.h> #include "intervals.h" @@ -87,6 +89,7 @@ extern char **environ; extern Lisp_Object w32_get_internal_run_time (void); #endif +static void time_overflow (void) NO_RETURN; static int tm_diff (struct tm *, struct tm *); static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, EMACS_INT *, Lisp_Object, EMACS_INT *); @@ -119,7 +122,7 @@ Lisp_Object Qboundary; void init_editfns (void) { - char *user_name; + const char *user_name; register char *p; struct passwd *pw; /* password entry for the current user */ Lisp_Object tem; @@ -133,7 +136,7 @@ init_editfns (void) return; #endif /* not CANNOT_DUMP */ - pw = (struct passwd *) getpwuid (getuid ()); + pw = getpwuid (getuid ()); #ifdef MSDOS /* We let the real user name default to "root" because that's quite accurate on MSDOG and because it lets Emacs find the init file. @@ -145,17 +148,17 @@ init_editfns (void) /* Get the effective user name, by consulting environment variables, or the effective uid if those are unset. */ - user_name = (char *) getenv ("LOGNAME"); + user_name = getenv ("LOGNAME"); if (!user_name) #ifdef WINDOWSNT - user_name = (char *) getenv ("USERNAME"); /* it's USERNAME on NT */ + user_name = getenv ("USERNAME"); /* it's USERNAME on NT */ #else /* WINDOWSNT */ - user_name = (char *) getenv ("USER"); + user_name = getenv ("USER"); #endif /* WINDOWSNT */ if (!user_name) { - pw = (struct passwd *) getpwuid (geteuid ()); - user_name = (char *) (pw ? pw->pw_name : "unknown"); + pw = getpwuid (geteuid ()); + user_name = pw ? pw->pw_name : "unknown"; } Vuser_login_name = build_string (user_name); @@ -1263,9 +1266,9 @@ of the user with that uid, or nil if there is no such user. */) if (NILP (uid)) return Vuser_login_name; - id = (uid_t)XFLOATINT (uid); + id = XFLOATINT (uid); BLOCK_INPUT; - pw = (struct passwd *) getpwuid (id); + pw = getpwuid (id); UNBLOCK_INPUT; return (pw ? build_string (pw->pw_name) : Qnil); } @@ -1297,7 +1300,7 @@ Value is an integer or a float, depending on the value. */) /* Make sure we don't produce a negative UID due to signed integer overflow. */ if (euid < 0) - return make_float ((double)geteuid ()); + return make_float (geteuid ()); return make_fixnum_or_float (euid); } @@ -1313,7 +1316,7 @@ Value is an integer or a float, depending on the value. */) /* Make sure we don't produce a negative UID due to signed integer overflow. */ if (uid < 0) - return make_float ((double)getuid ()); + return make_float (getuid ()); return make_fixnum_or_float (uid); } @@ -1336,14 +1339,15 @@ name, or nil if there is no such user. */) return Vuser_full_name; else if (NUMBERP (uid)) { + uid_t u = XFLOATINT (uid); BLOCK_INPUT; - pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid)); + pw = getpwuid (u); UNBLOCK_INPUT; } else if (STRINGP (uid)) { BLOCK_INPUT; - pw = (struct passwd *) getpwnam (SSDATA (uid)); + pw = getpwnam (SSDATA (uid)); UNBLOCK_INPUT; } else @@ -1371,7 +1375,7 @@ name, or nil if there is no such user. */) memcpy (r, p, q - p); r[q - p] = 0; strcat (r, SSDATA (login)); - r[q - p] = UPCASE ((unsigned char) r[q - p]); + r[q - p] = upcase ((unsigned char) r[q - p]); strcat (r, q + 1); full = build_string (r); } @@ -1387,8 +1391,6 @@ DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, return Vsystem_name; } -/* For the benefit of callers who don't want to include lisp.h */ - const char * get_system_name (void) { @@ -1414,6 +1416,49 @@ DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, return make_number (getpid ()); } + + +#ifndef TIME_T_MIN +# define TIME_T_MIN TYPE_MINIMUM (time_t) +#endif +#ifndef TIME_T_MAX +# define TIME_T_MAX TYPE_MAXIMUM (time_t) +#endif + +/* Report that a time value is out of range for Emacs. */ +static void +time_overflow (void) +{ + error ("Specified time is not representable"); +} + +/* Return the upper part of the time T (everything but the bottom 16 bits), + making sure that it is representable. */ +static EMACS_INT +hi_time (time_t t) +{ + time_t hi = t >> 16; + + /* Check for overflow, helping the compiler for common cases where + no runtime check is needed, and taking care not to convert + negative numbers to unsigned before comparing them. */ + if (! ((! TYPE_SIGNED (time_t) + || MOST_NEGATIVE_FIXNUM <= TIME_T_MIN >> 16 + || MOST_NEGATIVE_FIXNUM <= hi) + && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM + || hi <= MOST_POSITIVE_FIXNUM))) + time_overflow (); + + return hi; +} + +/* Return the bottom 16 bits of the time T. */ +static EMACS_INT +lo_time (time_t t) +{ + return t & ((1 << 16) - 1); +} + DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0, doc: /* Return the current time, as the number of seconds since 1970-01-01 00:00:00. The time is returned as a list of three integers. The first has the @@ -1428,8 +1473,8 @@ resolution finer than a second. */) EMACS_TIME t; EMACS_GET_TIME (t); - return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff), - make_number ((EMACS_SECS (t) >> 0) & 0xffff), + return list3 (make_number (hi_time (EMACS_SECS (t))), + make_number (lo_time (EMACS_SECS (t))), make_number (EMACS_USECS (t))); } @@ -1448,7 +1493,8 @@ on systems that do not provide resolution finer than a second. */) { #ifdef HAVE_GETRUSAGE struct rusage usage; - int secs, usecs; + time_t secs; + int usecs; if (getrusage (RUSAGE_SELF, &usage) < 0) /* This shouldn't happen. What action is appropriate? */ @@ -1463,8 +1509,8 @@ on systems that do not provide resolution finer than a second. */) secs++; } - return list3 (make_number ((secs >> 16) & 0xffff), - make_number ((secs >> 0) & 0xffff), + return list3 (make_number (hi_time (secs)), + make_number (lo_time (secs)), make_number (usecs)); #else /* ! HAVE_GETRUSAGE */ #ifdef WINDOWSNT @@ -1476,6 +1522,19 @@ on systems that do not provide resolution finer than a second. */) } +/* Make a Lisp list that represents the time T. */ +Lisp_Object +make_time (time_t t) +{ + return list2 (make_number (hi_time (t)), + make_number (lo_time (t))); +} + +/* Decode a Lisp list SPECIFIED_TIME that represents a time. + If SPECIFIED_TIME is nil, use the current time. + Set *RESULT to seconds since the Epoch. + If USEC is not null, set *USEC to the microseconds component. + Return nonzero if successful. */ int lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) { @@ -1496,6 +1555,7 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) else { Lisp_Object high, low; + EMACS_INT hi; high = Fcar (specified_time); CHECK_NUMBER (high); low = Fcdr (specified_time); @@ -1519,8 +1579,21 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) else if (usec) *usec = 0; CHECK_NUMBER (low); - *result = (XINT (high) << 16) + (XINT (low) & 0xffff); - return *result >> 16 == XINT (high); + hi = XINT (high); + + /* Check for overflow, helping the compiler for common cases + where no runtime check is needed, and taking care not to + convert negative numbers to unsigned before comparing them. */ + if (! ((TYPE_SIGNED (time_t) + ? (TIME_T_MIN >> 16 <= MOST_NEGATIVE_FIXNUM + || TIME_T_MIN >> 16 <= hi) + : 0 <= hi) + && (MOST_POSITIVE_FIXNUM <= TIME_T_MAX >> 16 + || hi <= TIME_T_MAX >> 16))) + return 0; + + *result = (hi << 16) + (XINT (low) & 0xffff); + return 1; } } @@ -1648,7 +1721,7 @@ The modifiers are `E' and `O'. For certain characters X, %OX is like %X, but uses the locale's number symbols. For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) - (Lisp_Object format_string, Lisp_Object time, Lisp_Object universal) + (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal) { time_t value; int size; @@ -1659,7 +1732,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) CHECK_STRING (format_string); - if (! (lisp_time_argument (time, &value, &usec) + if (! (lisp_time_argument (timeval, &value, &usec) && 0 <= usec && usec < 1000000)) error ("Invalid time specification"); ns = usec * 1000; @@ -1674,7 +1747,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) tm = ut ? gmtime (&value) : localtime (&value); UNBLOCK_INPUT; if (! tm) - error ("Specified time is not representable"); + time_overflow (); synchronize_system_time_locale (); @@ -1732,8 +1805,10 @@ DOW and ZONE.) */) BLOCK_INPUT; decoded_time = localtime (&time_spec); UNBLOCK_INPUT; - if (! decoded_time) - error ("Specified time is not representable"); + if (! (decoded_time + && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= decoded_time->tm_year + && decoded_time->tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) + time_overflow (); XSETFASTINT (list_args[0], decoded_time->tm_sec); XSETFASTINT (list_args[1], decoded_time->tm_min); XSETFASTINT (list_args[2], decoded_time->tm_hour); @@ -1757,6 +1832,20 @@ DOW and ZONE.) */) return Flist (9, list_args); } +/* Return OBJ - OFFSET, checking that OBJ is a valid fixnum and that + the result is representable as an int. Assume OFFSET is small and + nonnegative. */ +static int +check_tm_member (Lisp_Object obj, int offset) +{ + EMACS_INT n; + CHECK_NUMBER (obj); + n = XINT (obj); + if (! (INT_MIN + offset <= n && n - offset <= INT_MAX)) + time_overflow (); + return n - offset; +} + DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0, doc: /* Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time. This is the reverse operation of `decode-time', which see. @@ -1781,23 +1870,16 @@ year values as low as 1901 do work. usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) (int nargs, register Lisp_Object *args) { - time_t time; + time_t value; struct tm tm; Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); - CHECK_NUMBER (args[0]); /* second */ - CHECK_NUMBER (args[1]); /* minute */ - CHECK_NUMBER (args[2]); /* hour */ - CHECK_NUMBER (args[3]); /* day */ - CHECK_NUMBER (args[4]); /* month */ - CHECK_NUMBER (args[5]); /* year */ - - tm.tm_sec = XINT (args[0]); - tm.tm_min = XINT (args[1]); - tm.tm_hour = XINT (args[2]); - tm.tm_mday = XINT (args[3]); - tm.tm_mon = XINT (args[4]) - 1; - tm.tm_year = XINT (args[5]) - TM_YEAR_BASE; + tm.tm_sec = check_tm_member (args[0], 0); + tm.tm_min = check_tm_member (args[1], 0); + tm.tm_hour = check_tm_member (args[2], 0); + tm.tm_mday = check_tm_member (args[3], 0); + tm.tm_mon = check_tm_member (args[4], 1); + tm.tm_year = check_tm_member (args[5], TM_YEAR_BASE); tm.tm_isdst = -1; if (CONSP (zone)) @@ -1805,7 +1887,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) if (NILP (zone)) { BLOCK_INPUT; - time = mktime (&tm); + value = mktime (&tm); UNBLOCK_INPUT; } else @@ -1833,7 +1915,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) set_time_zone_rule (tzstring); BLOCK_INPUT; - time = mktime (&tm); + value = mktime (&tm); UNBLOCK_INPUT; /* Restore TZ to previous value. */ @@ -1845,10 +1927,10 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) #endif } - if (time == (time_t) -1) - error ("Specified time is not representable"); + if (value == (time_t) -1) + time_overflow (); - return make_time (time); + return make_time (value); } DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 1, 0, @@ -1881,7 +1963,7 @@ but this is considered obsolete. */) tm = localtime (&value); UNBLOCK_INPUT; if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm)))) - error ("Specified time is not representable"); + time_overflow (); /* Remove the trailing newline. */ tem[strlen (tem) - 1] = '\0'; @@ -2258,7 +2340,7 @@ from adjoining text, if those properties are sticky. */) (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) { register char *string; - register EMACS_INT strlen; + register EMACS_INT stringlen; register int i; register EMACS_INT n; int len; @@ -2276,18 +2358,18 @@ from adjoining text, if those properties are sticky. */) n = XINT (count) * len; if (n <= 0) return Qnil; - strlen = min (n, 256 * len); - string = (char *) alloca (strlen); - for (i = 0; i < strlen; i++) + stringlen = min (n, 256 * len); + string = (char *) alloca (stringlen); + for (i = 0; i < stringlen; i++) string[i] = str[i % len]; - while (n >= strlen) + while (n >= stringlen) { QUIT; if (!NILP (inherit)) - insert_and_inherit (string, strlen); + insert_and_inherit (string, stringlen); else - insert (string, strlen); - n -= strlen; + insert (string, stringlen); + n -= stringlen; } if (n > 0) { @@ -2946,8 +3028,7 @@ It returns the number of characters changed. */) EMACS_INT size; /* Size of translate table. */ EMACS_INT pos, pos_byte, end_pos; int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); - int string_multibyte; - Lisp_Object val; + int string_multibyte IF_LINT (= 0); validate_region (&start, &end); if (CHAR_TABLE_P (table)) @@ -3846,7 +3927,7 @@ usage: (format STRING &rest OBJECTS) */) /* handle case (precision[n] >= 0) */ int width, padding; - EMACS_INT nbytes, start, end; + EMACS_INT nbytes, start; EMACS_INT nchars_string; /* lisp_string_width ignores a precision of 0, but GNU @@ -3878,7 +3959,6 @@ usage: (format STRING &rest OBJECTS) */) info[n].start = start = nchars; nchars += nchars_string; - end = nchars; if (p > buf && multibyte @@ -4130,7 +4210,7 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) { int i1, i2; /* Check they're chars, not just integers, otherwise we could get array - bounds violations in DOWNCASE. */ + bounds violations in downcase. */ CHECK_CHARACTER (c1); CHECK_CHARACTER (c2); @@ -4139,9 +4219,6 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) if (NILP (BVAR (current_buffer, case_fold_search))) return Qnil; - /* Do these in separate statements, - then compare the variables. - because of the way DOWNCASE uses temp variables. */ i1 = XFASTINT (c1); if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! ASCII_CHAR_P (i1)) @@ -4154,9 +4231,7 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) { MAKE_CHAR_MULTIBYTE (i2); } - i1 = DOWNCASE (i1); - i2 = DOWNCASE (i2); - return (i1 == i2 ? Qt : Qnil); + return (downcase (i1) == downcase (i2) ? Qt : Qnil); } /* Transpose the markers in two regions of the current buffer, and diff --git a/src/emacs.c b/src/emacs.c index 4455e6b4d9f..052f22ea622 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -141,7 +141,7 @@ Lisp_Object Qfile_name_handler_alist; Lisp_Object Qrisky_local_variable; -/* If non-zero, emacs should not attempt to use a window-specific code, +/* If non-zero, Emacs should not attempt to use a window-specific code, but instead should use the virtual terminal under which it was started. */ int inhibit_window_system; @@ -169,7 +169,6 @@ static unsigned long heap_bss_diff; #define MAX_HEAP_BSS_DIFF (1024*1024) /* Nonzero means running Emacs without interactive terminal. */ - int noninteractive; /* Nonzero means remove site-lisp directories from load-path. */ @@ -249,14 +248,14 @@ Display options:\n\ --border-color, -bd COLOR main border color\n\ --border-width, -bw WIDTH width of main border\n\ --color, --color=MODE override color mode for character terminals;\n\ - MODE defaults to `auto', and can also\n\ - be `never', `auto', `always',\n\ + MODE defaults to `auto', and\n\ + can also be `never', `always',\n\ or a mode name like `ansi8'\n\ --cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\ --font, -fn FONT default font; must be fixed-width\n\ --foreground-color, -fg COLOR window foreground color\n\ --fullheight, -fh make the first frame high as the screen\n\ ---fullscreen, -fs make first frame fullscreen\n\ +--fullscreen, -fs make the first frame fullscreen\n\ --fullwidth, -fw make the first frame wide as the screen\n\ --maximized, -mm make the first frame maximized\n\ --geometry, -g GEOMETRY window geometry\n\ @@ -382,7 +381,7 @@ static void init_cmdargs (int argc, char **argv, int skip_args) { register int i; - Lisp_Object name, dir, tem; + Lisp_Object name, dir, handler; int count = SPECPDL_INDEX (); Lisp_Object raw_name; @@ -393,8 +392,8 @@ init_cmdargs (int argc, char **argv, int skip_args) /* Add /: to the front of the name if it would otherwise be treated as magic. */ - tem = Ffind_file_name_handler (raw_name, Qt); - if (! NILP (tem)) + handler = Ffind_file_name_handler (raw_name, Qt); + if (! NILP (handler)) raw_name = concat2 (build_string ("/:"), raw_name); Vinvocation_name = Ffile_name_nondirectory (raw_name); @@ -411,8 +410,8 @@ init_cmdargs (int argc, char **argv, int skip_args) { /* Add /: to the front of the name if it would otherwise be treated as magic. */ - tem = Ffind_file_name_handler (found, Qt); - if (! NILP (tem)) + handler = Ffind_file_name_handler (found, Qt); + if (! NILP (handler)) found = concat2 (build_string ("/:"), found); Vinvocation_directory = Ffile_name_directory (found); } @@ -547,21 +546,22 @@ static char dump_tz[] = "UtC0"; Provide dummy definitions to avoid error. (We don't have any real constructors or destructors.) */ #ifdef __GNUC__ + +/* Define a dummy function F. Declare F too, to pacify gcc + -Wmissing-prototypes. */ +#define DEFINE_DUMMY_FUNCTION(f) void f (void); void f (void) {} + #ifndef GCC_CTORS_IN_LIBC -void __do_global_ctors (void) -{} -void __do_global_ctors_aux (void) -{} -void __do_global_dtors (void) -{} +DEFINE_DUMMY_FUNCTION (__do_global_ctors) +DEFINE_DUMMY_FUNCTION (__do_global_ctors_aux) +DEFINE_DUMMY_FUNCTION (__do_global_dtors) /* GNU/Linux has a bug in its library; avoid an error. */ #ifndef GNU_LINUX char * __CTOR_LIST__[2] = { (char *) (-1), 0 }; #endif char * __DTOR_LIST__[2] = { (char *) (-1), 0 }; #endif /* GCC_CTORS_IN_LIBC */ -void __main (void) -{} +DEFINE_DUMMY_FUNCTION (__main) #endif /* __GNUC__ */ #endif /* ORDINARY_LINK */ @@ -576,7 +576,8 @@ void __main (void) enough information to do it right. */ static int -argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr) +argmatch (char **argv, int argc, const char *sstr, const char *lstr, + int minlen, char **valptr, int *skipptr) { char *p = NULL; int arglen; @@ -948,7 +949,7 @@ main (int argc, char **argv) /* Convert --script to -scriptload, un-skip it, and sort again so that it will be handled in proper sequence. */ /* FIXME broken for --script=FILE - is that supposed to work? */ - argv[skip_args - 1] = "-scriptload"; + argv[skip_args - 1] = (char *) "-scriptload"; skip_args -= 2; sort_args (argc, argv); } @@ -1347,7 +1348,7 @@ main (int argc, char **argv) for (j = 0; j < count_before + 1; j++) new[j] = argv[j]; - new[count_before + 1] = "-d"; + new[count_before + 1] = (char *) "-d"; new[count_before + 2] = displayname; for (j = count_before + 2; j <argc; j++) new[j + 1] = argv[j]; @@ -1357,7 +1358,7 @@ main (int argc, char **argv) /* Change --display to -d, when its arg is separate. */ else if (displayname != 0 && skip_args > count_before && argv[count_before + 1][1] == '-') - argv[count_before + 1] = "-d"; + argv[count_before + 1] = (char *) "-d"; if (! no_site_lisp) { @@ -2084,9 +2085,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) #ifndef CANNOT_DUMP -/* FIXME: maybe this should go into header file, config.h seems the - only one appropriate. */ -extern int unexec (const char *, const char *); +#include "unexec.h" DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, doc: /* Dump current state of Emacs into executable file FILENAME. @@ -2380,7 +2379,7 @@ Special values: Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix, hpux, irix, usg-unix-v) indicates some sort of Unix system. */); Vsystem_type = intern_c_string (SYSTEM_TYPE); - /* Above values are from SYSTEM_TYPE in src/s/*.h. */ + /* The above values are from SYSTEM_TYPE in include files under src/s. */ DEFVAR_LISP ("system-configuration", Vsystem_configuration, doc: /* Value is string indicating configuration Emacs was built for. diff --git a/src/eval.c b/src/eval.c index 2fb89ce404e..c22e7d3f571 100644 --- a/src/eval.c +++ b/src/eval.c @@ -160,7 +160,7 @@ restore_stack_limits (Lisp_Object data) /* Call the Lisp debugger, giving it argument ARG. */ -Lisp_Object +static Lisp_Object call_debugger (Lisp_Object arg) { int debug_while_redisplaying; @@ -216,7 +216,7 @@ call_debugger (Lisp_Object arg) return unbind_to (count, val); } -void +static void do_debug_on_call (Lisp_Object code) { debug_on_next_call = 0; @@ -796,11 +796,11 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) if (SYMBOL_CONSTANT_P (sym)) { /* For upward compatibility, allow (defvar :foo (quote :foo)). */ - Lisp_Object tem = Fcar (tail); - if (! (CONSP (tem) - && EQ (XCAR (tem), Qquote) - && CONSP (XCDR (tem)) - && EQ (XCAR (XCDR (tem)), sym))) + Lisp_Object tem1 = Fcar (tail); + if (! (CONSP (tem1) + && EQ (XCAR (tem1), Qquote) + && CONSP (XCDR (tem1)) + && EQ (XCAR (XCDR (tem1)), sym))) error ("Constant symbol `%s' specified in defvar", SDATA (SYMBOL_NAME (sym))); } @@ -840,11 +840,12 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) Vinternal_interpreter_environment = Fcons (sym, Vinternal_interpreter_environment); else - /* Simple (defvar <var>) should not count as a definition at all. - It could get in the way of other definitions, and unloading this - package could try to make the variable unbound. */ - ; - + { + /* Simple (defvar <var>) should not count as a definition at all. + It could get in the way of other definitions, and unloading this + package could try to make the variable unbound. */ + } + return sym; } @@ -895,7 +896,8 @@ user_variable_p_eh (Lisp_Object ignore) static Lisp_Object lisp_indirect_variable (Lisp_Object sym) { - XSETSYMBOL (sym, indirect_variable (XSYMBOL (sym))); + struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym)); + XSETSYMBOL (sym, s); return sym; } @@ -1720,7 +1722,7 @@ See also the function `condition-case'. */) if (!NILP (clause)) break; } - + if (/* Don't run the debugger for a memory-full error. (There is no room in memory to do that!) */ !NILP (error_symbol) @@ -1737,13 +1739,13 @@ See also the function `condition-case'. */) can continue code which has signaled a quit. */ if (debugger_called && EQ (real_error_symbol, Qquit)) return Qnil; - } + } if (!NILP (clause)) { Lisp_Object unwind_data = (NILP (error_symbol) ? data : Fcons (error_symbol, data)); - + h->chosen_clause = clause; unwind_to_catch (h->tag, unwind_data); } @@ -1755,7 +1757,7 @@ See also the function `condition-case'. */) if (! NILP (error_symbol)) data = Fcons (error_symbol, data); - + string = Ferror_message_string (data); fatal ("%s", SDATA (string), 0); } @@ -2648,8 +2650,8 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) } else { - Lisp_Object globals = Qnil; - GCPRO3 (sym, val, globals); + Lisp_Object global_vals = Qnil; + GCPRO3 (sym, val, global_vals); for (; CONSP (val) && ((cond == to_completion) @@ -2661,23 +2663,25 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) { /* t indicates this hook has a local binding; it means to run the global binding too. */ - globals = Fdefault_value (sym); - if (NILP (globals)) continue; + global_vals = Fdefault_value (sym); + if (NILP (global_vals)) continue; - if (!CONSP (globals) || EQ (XCAR (globals), Qlambda)) + if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda)) { - args[0] = globals; + args[0] = global_vals; ret = Ffuncall (nargs, args); } else { for (; - CONSP (globals) && ((cond == to_completion) - || (cond == until_success ? NILP (ret) - : !NILP (ret))); - globals = XCDR (globals)) + (CONSP (global_vals) + && (cond == to_completion + || (cond == until_success + ? NILP (ret) + : !NILP (ret)))); + global_vals = XCDR (global_vals)) { - args[0] = XCAR (globals); + args[0] = XCAR (global_vals); /* In a global value, t should not occur. If it does, we must ignore it to avoid an endless loop. */ if (!EQ (args[0], Qt)) @@ -3248,7 +3252,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, return object; } -void +static void grow_specpdl (void) { register int count = SPECPDL_INDEX (); @@ -3823,4 +3827,3 @@ alist of active lexical bindings. */); defsubr (&Sspecial_variable_p); defsubr (&Sfunctionp); } - diff --git a/src/fileio.c b/src/fileio.c index 18e9dbe9680..5d33fb93878 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -178,7 +178,7 @@ report_file_error (const char *string, Lisp_Object data) str = SSDATA (errstring); c = STRING_CHAR ((unsigned char *) str); - Faset (errstring, make_number (0), make_number (DOWNCASE (c))); + Faset (errstring, make_number (0), make_number (downcase (c))); } xsignal (Qfile_error, @@ -433,8 +433,8 @@ get a current directory to run processes in. */) } -char * -file_name_as_directory (char *out, char *in) +static char * +file_name_as_directory (char *out, const char *in) { int size = strlen (in) - 1; @@ -496,7 +496,7 @@ For a Unix-syntax file name, just appends a slash. */) * Value is nonzero if the string output is different from the input. */ -int +static int directory_file_name (char *src, char *dst) { long slen; @@ -728,7 +728,8 @@ filesystem tree, not (expand-file-name ".." dirname). */) { /* These point to SDATA and need to be careful with string-relocation during GC (via DECODE_FILE). */ - char *nm, *newdir; + char *nm; + const char *newdir; /* This should only point to alloca'd data. */ char *target; @@ -1013,21 +1014,23 @@ filesystem tree, not (expand-file-name ".." dirname). */) if (!newdir && drive) { /* Get default directory if needed to make nm absolute. */ + char *adir = NULL; if (!IS_DIRECTORY_SEP (nm[0])) { - newdir = alloca (MAXPATHLEN + 1); - if (!getdefdir (toupper (drive) - 'A' + 1, newdir)) - newdir = NULL; + adir = alloca (MAXPATHLEN + 1); + if (!getdefdir (toupper (drive) - 'A' + 1, adir)) + adir = NULL; } - if (!newdir) + if (!adir) { /* Either nm starts with /, or drive isn't mounted. */ - newdir = alloca (4); - newdir[0] = DRIVE_LETTER (drive); - newdir[1] = ':'; - newdir[2] = '/'; - newdir[3] = 0; + adir = alloca (4); + adir[0] = DRIVE_LETTER (drive); + adir[1] = ':'; + adir[2] = '/'; + adir[3] = 0; } + newdir = adir; } #endif /* DOS_NT */ @@ -1074,7 +1077,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) when we have pointers into lisp strings, we accomplish this indirectly by prepending newdir to nm if necessary, and using cwd (or the wd of newdir's drive) as the new newdir. */ - + char *adir; if (IS_DRIVE (newdir[0]) && IS_DEVICE_SEP (newdir[1])) { drive = (unsigned char) newdir[0]; @@ -1087,14 +1090,15 @@ filesystem tree, not (expand-file-name ".." dirname). */) strcat (tmp, nm); nm = tmp; } - newdir = alloca (MAXPATHLEN + 1); + adir = alloca (MAXPATHLEN + 1); if (drive) { - if (!getdefdir (toupper (drive) - 'A' + 1, newdir)) + if (!getdefdir (toupper (drive) - 'A' + 1, adir)) newdir = "/"; } else - getwd (newdir); + getwd (adir); + newdir = adir; } /* Strip off drive name from prefix, if present. */ @@ -1111,13 +1115,13 @@ filesystem tree, not (expand-file-name ".." dirname). */) #ifdef WINDOWSNT if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1])) { - char *p; - newdir = strcpy (alloca (strlen (newdir) + 1), newdir); - p = newdir + 2; + char *adir = strcpy (alloca (strlen (newdir) + 1), newdir); + char *p = adir + 2; while (*p && !IS_DIRECTORY_SEP (*p)) p++; p++; while (*p && !IS_DIRECTORY_SEP (*p)) p++; *p = 0; + newdir = adir; } else #endif @@ -1734,7 +1738,7 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir) If QUICK is nonzero, we ask for y or n, not yes or no. */ -void +static void barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring, int interactive, struct stat *statptr, int quick) { @@ -2041,7 +2045,6 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal, (Lisp_Object directory) { const char *dir; - Lisp_Object handler; Lisp_Object encoded_dir; CHECK_STRING (directory); @@ -2753,7 +2756,7 @@ if file does not exist, is not accessible, or SELinux is disabled */) #if HAVE_LIBSELINUX if (is_selinux_enabled ()) { - conlength = lgetfilecon (SDATA (absname), &con); + conlength = lgetfilecon (SSDATA (absname), &con); if (conlength > 0) { context = context_new (con); @@ -2808,34 +2811,35 @@ is disabled. */) if (is_selinux_enabled ()) { /* Get current file context. */ - conlength = lgetfilecon (SDATA (encoded_absname), &con); + conlength = lgetfilecon (SSDATA (encoded_absname), &con); if (conlength > 0) { parsed_con = context_new (con); /* Change the parts defined in the parameter.*/ if (STRINGP (user)) { - if (context_user_set (parsed_con, SDATA (user))) + if (context_user_set (parsed_con, SSDATA (user))) error ("Doing context_user_set"); } if (STRINGP (role)) { - if (context_role_set (parsed_con, SDATA (role))) + if (context_role_set (parsed_con, SSDATA (role))) error ("Doing context_role_set"); } if (STRINGP (type)) { - if (context_type_set (parsed_con, SDATA (type))) + if (context_type_set (parsed_con, SSDATA (type))) error ("Doing context_type_set"); } if (STRINGP (range)) { - if (context_range_set (parsed_con, SDATA (range))) + if (context_range_set (parsed_con, SSDATA (range))) error ("Doing context_range_set"); } /* Set the modified context back to the file. */ - fail = lsetfilecon (SDATA (encoded_absname), context_str (parsed_con)); + fail = lsetfilecon (SSDATA (encoded_absname), + context_str (parsed_con)); if (fail) report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil)); @@ -2937,19 +2941,19 @@ The value is an integer. */) DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0, - doc: /* Set times of file FILENAME to TIME. + doc: /* Set times of file FILENAME to TIMESTAMP. Set both access and modification times. Return t on success, else nil. -Use the current time if TIME is nil. TIME is in the format of +Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of `current-time'. */) - (Lisp_Object filename, Lisp_Object time) + (Lisp_Object filename, Lisp_Object timestamp) { Lisp_Object absname, encoded_absname; Lisp_Object handler; time_t sec; int usec; - if (! lisp_time_argument (time, &sec, &usec)) + if (! lisp_time_argument (timestamp, &sec, &usec)) error ("Invalid time specification"); absname = Fexpand_file_name (filename, BVAR (current_buffer, directory)); @@ -2958,7 +2962,7 @@ Use the current time if TIME is nil. TIME is in the format of call the corresponding file handler. */ handler = Ffind_file_name_handler (absname, Qset_file_times); if (!NILP (handler)) - return call3 (handler, Qset_file_times, absname, time); + return call3 (handler, Qset_file_times, absname, timestamp); encoded_absname = ENCODE_FILE (absname); @@ -3354,13 +3358,13 @@ variable `last-coding-system-used' to the coding system actually used. */) else if (nread > 0) { struct buffer *prev = current_buffer; - Lisp_Object buffer; + Lisp_Object workbuf; struct buffer *buf; record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); - buffer = Fget_buffer_create (build_string (" *code-converting-work*")); - buf = XBUFFER (buffer); + workbuf = Fget_buffer_create (build_string (" *code-converting-work*")); + buf = XBUFFER (workbuf); delete_all_overlays (buf); BVAR (buf, directory) = BVAR (current_buffer, directory); @@ -3872,7 +3876,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (not_regular) { - Lisp_Object val; + Lisp_Object nbytes; /* Maybe make more room. */ if (gap_size < trytry) @@ -3887,15 +3891,16 @@ variable `last-coding-system-used' to the coding system actually used. */) non_regular_fd = fd; non_regular_inserted = inserted; non_regular_nbytes = trytry; - val = internal_condition_case_1 (read_non_regular, Qnil, Qerror, - read_non_regular_quit); - if (NILP (val)) + nbytes = internal_condition_case_1 (read_non_regular, + Qnil, Qerror, + read_non_regular_quit); + if (NILP (nbytes)) { read_quit = 1; break; } - this = XINT (val); + this = XINT (nbytes); } else { @@ -3986,7 +3991,7 @@ variable `last-coding-system-used' to the coding system actually used. */) care of marker adjustment. By this way, we can run Lisp program safely before decoding the inserted text. */ Lisp_Object unwind_data; - int count = SPECPDL_INDEX (); + int count1 = SPECPDL_INDEX (); unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), Fcons (BVAR (current_buffer, undo_list), @@ -4013,7 +4018,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (CONSP (coding_system)) coding_system = XCAR (coding_system); } - unbind_to (count, Qnil); + unbind_to (count1, Qnil); inserted = Z_BYTE - BEG_BYTE; } @@ -4116,7 +4121,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (inserted > 0) { /* Don't run point motion or modification hooks when decoding. */ - int count = SPECPDL_INDEX (); + int count1 = SPECPDL_INDEX (); EMACS_INT old_inserted = inserted; specbind (Qinhibit_point_motion_hooks, Qt); specbind (Qinhibit_modification_hooks, Qt); @@ -4228,7 +4233,7 @@ variable `last-coding-system-used' to the coding system actually used. */) Otherwise start with an empty undo_list. */ BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil; - unbind_to (count, Qnil); + unbind_to (count1, Qnil); } /* Call after-change hooks for the inserted text, aside from the case @@ -5059,8 +5064,8 @@ An argument specifies the modification time value to use return Qnil; } -Lisp_Object -auto_save_error (Lisp_Object error) +static Lisp_Object +auto_save_error (Lisp_Object error_val) { Lisp_Object args[3], msg; int i, nbytes; @@ -5074,7 +5079,7 @@ auto_save_error (Lisp_Object error) args[0] = build_string ("Auto-saving %s: %s"); args[1] = BVAR (current_buffer, name); - args[2] = Ferror_message_string (error); + args[2] = Ferror_message_string (error_val); msg = Fformat (3, args); GCPRO1 (msg); nbytes = SBYTES (msg); @@ -5095,7 +5100,7 @@ auto_save_error (Lisp_Object error) return Qnil; } -Lisp_Object +static Lisp_Object auto_save_1 (void) { struct stat st; @@ -5426,7 +5431,7 @@ before any other event (mouse or keypress) is handled. */) Lisp_Object Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate) { - struct gcpro gcpro1, gcpro2; + struct gcpro gcpro1; Lisp_Object args[7]; GCPRO1 (default_filename); diff --git a/src/filelock.c b/src/filelock.c index 7f8f0e1c0fb..2138eaa502b 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -344,13 +344,13 @@ static int lock_file_1 (char *lfname, int force) { register int err; - time_t boot_time; + time_t boot; const char *user_name; const char *host_name; char *lock_info_str; /* Call this first because it can GC. */ - boot_time = get_boot_time (); + boot = get_boot_time (); if (STRINGP (Fuser_login_name (Qnil))) user_name = SSDATA (Fuser_login_name (Qnil)); @@ -363,9 +363,9 @@ lock_file_1 (char *lfname, int force) lock_info_str = (char *)alloca (strlen (user_name) + strlen (host_name) + LOCK_PID_MAX + 30); - if (boot_time) + if (boot) sprintf (lock_info_str, "%s@%s.%lu:%lu", user_name, host_name, - (unsigned long) getpid (), (unsigned long) boot_time); + (unsigned long) getpid (), (unsigned long) boot); else sprintf (lock_info_str, "%s@%s.%lu", user_name, host_name, (unsigned long) getpid ()); @@ -382,7 +382,7 @@ lock_file_1 (char *lfname, int force) /* Return 1 if times A and B are no more than one second apart. */ -int +static int within_one_second (time_t a, time_t b) { return (a - b >= -1 && a - b <= 1); diff --git a/src/floatfns.c b/src/floatfns.c index c00923643d1..bc03509b757 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -187,8 +187,10 @@ static const char *float_error_fn_name; xsignal3 (Qrange_error, build_string ((op)), (a1), (a2)) #define domain_error(op,arg) \ xsignal2 (Qdomain_error, build_string ((op)), (arg)) +#ifdef FLOAT_CHECK_DOMAIN #define domain_error2(op,a1,a2) \ xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2)) +#endif /* Extract a Lisp number as a `double', or signal an error. */ @@ -326,9 +328,9 @@ If X is zero, both parts (SGNFCAND and EXP) are zero. */) return Fcons (make_float (0.0), make_number (0)); else { - int exp; - double sgnfcand = frexp (f, &exp); - return Fcons (make_float (sgnfcand), make_number (exp)); + int exponent; + double sgnfcand = frexp (f, &exponent); + return Fcons (make_float (sgnfcand), make_number (exponent)); } } @@ -336,10 +338,10 @@ DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0, doc: /* Construct number X from significand SGNFCAND and exponent EXP. Returns the floating point value resulting from multiplying SGNFCAND (the significand) by 2 raised to the power of EXP (the exponent). */) - (Lisp_Object sgnfcand, Lisp_Object exp) + (Lisp_Object sgnfcand, Lisp_Object exponent) { - CHECK_NUMBER (exp); - return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp))); + CHECK_NUMBER (exponent); + return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exponent))); } #endif @@ -1037,7 +1039,7 @@ syms_of_floatfns (void) defsubr (&Scopysign); defsubr (&Sfrexp); defsubr (&Sldexp); -#endif +#endif #if 0 defsubr (&Sacosh); defsubr (&Sasinh); @@ -1074,4 +1076,3 @@ syms_of_floatfns (void) defsubr (&Sround); defsubr (&Struncate); } - diff --git a/src/fns.c b/src/fns.c index b800846b781..9a009c8ab44 100644 --- a/src/fns.c +++ b/src/fns.c @@ -57,9 +57,6 @@ Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper; static int internal_equal (Lisp_Object , Lisp_Object, int, int); -extern long get_random (void); -extern void seed_random (long); - #ifndef HAVE_UNISTD_H extern long time (); #endif @@ -2136,15 +2133,15 @@ DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0, ARRAY is a vector, string, char-table, or bool-vector. */) (Lisp_Object array, Lisp_Object item) { - register EMACS_INT size, index; + register EMACS_INT size, idx; int charval; if (VECTORP (array)) { register Lisp_Object *p = XVECTOR (array)->contents; size = ASIZE (array); - for (index = 0; index < size; index++) - p[index] = item; + for (idx = 0; idx < size; idx++) + p[idx] = item; } else if (CHAR_TABLE_P (array)) { @@ -2180,8 +2177,8 @@ ARRAY is a vector, string, char-table, or bool-vector. */) *p++ = str[i % len]; } else - for (index = 0; index < size; index++) - p[index] = charval; + for (idx = 0; idx < size; idx++) + p[idx] = charval; } else if (BOOL_VECTOR_P (array)) { @@ -2191,14 +2188,14 @@ ARRAY is a vector, string, char-table, or bool-vector. */) / BOOL_VECTOR_BITS_PER_CHAR); charval = (! NILP (item) ? -1 : 0); - for (index = 0; index < size_in_chars - 1; index++) - p[index] = charval; - if (index < size_in_chars) + for (idx = 0; idx < size_in_chars - 1; idx++) + p[idx] = charval; + if (idx < size_in_chars) { /* Mask out bits beyond the vector size. */ if (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR) charval &= (1 << (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)) - 1; - p[index] = charval; + p[idx] = charval; } } else @@ -2601,9 +2598,9 @@ particular subfeatures supported in this version of FEATURE. */) /* List of features currently being require'd, innermost first. */ -Lisp_Object require_nesting_list; +static Lisp_Object require_nesting_list; -Lisp_Object +static Lisp_Object require_unwind (Lisp_Object old_value) { return require_nesting_list = old_value; diff --git a/src/font.c b/src/font.c index 35821ae34f9..9e8b7029c22 100644 --- a/src/font.c +++ b/src/font.c @@ -311,10 +311,10 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror { Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); int len = ASIZE (table); - int i, j; if (SYMBOLP (val)) { + int i, j; char *s; Lisp_Object args[2], elt; @@ -500,10 +500,9 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object val) enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX : EQ (style, QCslant) ? FONT_SLANT_INDEX : FONT_WIDTH_INDEX); - int n; if (INTEGERP (val)) { - n = XINT (val); + int n = XINT (val); if (((n >> 4) & 0xF) >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) val = Qerror; @@ -1163,7 +1162,8 @@ font_parse_xlfd (char *name, Lisp_Object font) int font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) { - char *f[XLFD_REGISTRY_INDEX + 1]; + char *p; + const char *f[XLFD_REGISTRY_INDEX + 1]; Lisp_Object val; int i, j, len = 0; @@ -1194,14 +1194,14 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) /* Change "jisx0208*" and "jisx0208" to "jisx0208*-*". */ if (SDATA (val)[SBYTES (val) - 1] == '*') { - f[j] = alloca (SBYTES (val) + 3); - sprintf (f[j], "%s-*", SDATA (val)); + f[j] = p = alloca (SBYTES (val) + 3); + sprintf (p, "%s-*", SDATA (val)); len += SBYTES (val) + 3; } else { - f[j] = alloca (SBYTES (val) + 4); - sprintf (f[j], "%s*-*", SDATA (val)); + f[j] = p = alloca (SBYTES (val) + 4); + sprintf (p, "%s*-*", SDATA (val)); len += SBYTES (val) + 4; } } @@ -1232,8 +1232,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) i = pixel_size; if (i > 0) { - f[XLFD_PIXEL_INDEX] = alloca (22); - len += sprintf (f[XLFD_PIXEL_INDEX], "%d-*", i) + 1; + f[XLFD_PIXEL_INDEX] = p = alloca (22); + len += sprintf (p, "%d-*", i) + 1; } else f[XLFD_PIXEL_INDEX] = "*-*", len += 4; @@ -1241,8 +1241,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) else if (FLOATP (val)) { i = XFLOAT_DATA (val) * 10; - f[XLFD_PIXEL_INDEX] = alloca (12); - len += sprintf (f[XLFD_PIXEL_INDEX], "*-%d", i) + 1; + f[XLFD_PIXEL_INDEX] = p = alloca (12); + len += sprintf (p, "*-%d", i) + 1; } else f[XLFD_PIXEL_INDEX] = "*-*", len += 4; @@ -1250,9 +1250,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) if (INTEGERP (AREF (font, FONT_DPI_INDEX))) { i = XINT (AREF (font, FONT_DPI_INDEX)); - f[XLFD_RESX_INDEX] = alloca (22); - len += sprintf (f[XLFD_RESX_INDEX], - "%d-%d", i, i) + 1; + f[XLFD_RESX_INDEX] = p = alloca (22); + len += sprintf (p, "%d-%d", i, i) + 1; } else f[XLFD_RESX_INDEX] = "*-*", len += 4; @@ -1270,8 +1269,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) f[XLFD_SPACING_INDEX] = "*", len += 2; if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) { - f[XLFD_AVGWIDTH_INDEX] = alloca (11); - len += sprintf (f[XLFD_AVGWIDTH_INDEX], "%ld", + f[XLFD_AVGWIDTH_INDEX] = p = alloca (11); + len += sprintf (p, "%ld", (long) XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; } else @@ -1448,12 +1447,10 @@ font_parse_fcname (char *name, Lisp_Object font) { /* Either a fontconfig-style name with no size and property data, or a GTK-style name. */ - Lisp_Object prop; Lisp_Object weight = Qnil, slant = Qnil; Lisp_Object width = Qnil, size = Qnil; char *word_start; int word_len; - int size_found = 0; /* Scan backwards from the end, looking for a size. */ for (p = name + len - 1; p >= name; p--) @@ -1569,8 +1566,10 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes) point_size = -1; len += 21; /* for ":pixelsize=NUM" */ } - else if (FLOATP (val)) + else { + if (! FLOATP (val)) + abort (); pixel_size = -1; point_size = (int) XFLOAT_DATA (val); len += 11; /* for "-NUM" */ @@ -1604,15 +1603,15 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes) len += strlen (":scalable=false"); /* or ":scalable=true" */ for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) { - Lisp_Object key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail)); + Lisp_Object key = XCAR (XCAR (tail)), value = XCDR (XCAR (tail)); len += SBYTES (SYMBOL_NAME (key)) + 1; /* for :KEY= */ - if (STRINGP (val)) - len += SBYTES (val); - else if (INTEGERP (val)) - len += sprintf (work, "%ld", (long) XINT (val)); - else if (SYMBOLP (val)) - len += (NILP (val) ? 5 : 4); /* for "false" or "true" */ + if (STRINGP (value)) + len += SBYTES (value); + else if (INTEGERP (value)) + len += sprintf (work, "%ld", (long) XINT (value)); + else if (SYMBOLP (value)) + len += (NILP (value) ? 5 : 4); /* for "false" or "true" */ } if (len > nbytes) @@ -2178,7 +2177,7 @@ font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int unsigned best_score; Lisp_Object best_entity; struct frame *f = XFRAME (frame); - Lisp_Object tail, vec; + Lisp_Object tail, vec IF_LINT (= Qnil); USE_SAFE_ALLOCA; for (i = FONT_WEIGHT_INDEX; i <= FONT_AVGWIDTH_INDEX; i++) @@ -2602,7 +2601,7 @@ static Lisp_Object scratch_font_spec, scratch_font_prefer; (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil). */ -Lisp_Object +static Lisp_Object font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size) { Lisp_Object entity, val; @@ -2951,22 +2950,6 @@ font_get_name (Lisp_Object font_object) } -/* Return the specification of FONT_OBJECT. */ - -Lisp_Object -font_get_spec (Lisp_Object font_object) -{ - Lisp_Object spec = font_make_spec (); - int i; - - for (i = 0; i < FONT_SIZE_INDEX; i++) - ASET (spec, i, AREF (font_object, i)); - ASET (spec, FONT_SIZE_INDEX, - make_number (XFONT_OBJECT (font_object)->pixel_size)); - return spec; -} - - /* Create a new font spec from FONT_NAME, and return it. If FONT_NAME could not be parsed by font_parse_name, return Qnil. */ @@ -3436,14 +3419,13 @@ Lisp_Object font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers) { Lisp_Object active_drivers = Qnil; - struct font_driver *driver; struct font_driver_list *list; /* At first, turn off non-requested drivers, and turn on requested drivers. */ for (list = f->font_driver_list; list; list = list->next) { - driver = list->driver; + struct font_driver *driver = list->driver; if ((EQ (new_drivers, Qt) || ! NILP (Fmemq (driver->type, new_drivers))) != list->on) { @@ -4669,7 +4651,7 @@ the corresponding element is nil. */) Lisp_Object object) { struct font *font; - int i, len, c; + int i, len; Lisp_Object *chars, vec; USE_SAFE_ALLOCA; @@ -4687,6 +4669,7 @@ the corresponding element is nil. */) bytepos = CHAR_TO_BYTE (charpos); for (i = 0; charpos < XFASTINT (to); i++) { + int c; FETCH_CHAR_ADVANCE (c, charpos, bytepos); chars[i] = make_number (c); } @@ -4708,7 +4691,7 @@ the corresponding element is nil. */) if (STRING_MULTIBYTE (object)) for (i = 0; i < len; i++) { - c = STRING_CHAR_ADVANCE (p); + int c = STRING_CHAR_ADVANCE (p); chars[i] = make_number (c); } else @@ -4959,7 +4942,7 @@ static Lisp_Object Vfont_log_deferred; void font_add_log (const char *action, Lisp_Object arg, Lisp_Object result) { - Lisp_Object tail, val; + Lisp_Object val; int i; if (EQ (Vfont_log, Qt)) @@ -5015,6 +4998,7 @@ font_add_log (const char *action, Lisp_Object arg, Lisp_Object result) } else if (CONSP (result)) { + Lisp_Object tail; result = Fcopy_sequence (result); for (tail = result; CONSP (tail); tail = XCDR (tail)) { diff --git a/src/fontset.c b/src/fontset.c index f297fd10a71..b5d8a0db434 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -233,14 +233,14 @@ fontset_id_valid_p (int id) /* Macros to access special values of (base) FONTSET. */ #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] -#define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] +/* #define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] */ /* Macros to access special values of (realized) FONTSET. */ #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] #define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4] #define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] -#define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] +/* #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] */ #define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] /* For both base and realized fontset. */ @@ -266,7 +266,6 @@ fontset_id_valid_p (int id) ASET ((rfont_def), 0, make_number (face_id)) #define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1) #define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1)) -#define RFONT_DEF_REPERTORY(rfont_def) FONT_DEF_REPERTORY (AREF (rfont_def, 1)) #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2) #define RFONT_DEF_SET_OBJECT(rfont_def, object) \ ASET ((rfont_def), 2, (object)) @@ -713,7 +712,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa static Lisp_Object fontset_font (Lisp_Object fontset, int c, struct face *face, int id) { - Lisp_Object rfont_def, default_rfont_def; + Lisp_Object rfont_def, default_rfont_def IF_LINT (= Qnil); Lisp_Object base_fontset; /* Try a font-group of FONTSET. */ @@ -836,7 +835,7 @@ fontset_ascii (int id) return elt; } -void +static void free_realized_fontset (FRAME_PTR f, Lisp_Object fontset) { Lisp_Object tail; @@ -1583,14 +1582,14 @@ appended. By default, FONT-SPEC overrides the previous settings. */) if (ascii_changed) { - Lisp_Object tail, frame, alist; + Lisp_Object tail, fr, alist; int fontset_id = XINT (FONTSET_ID (fontset)); FONTSET_ASCII (fontset) = fontname; name = FONTSET_NAME (fontset); - FOR_EACH_FRAME (tail, frame) + FOR_EACH_FRAME (tail, fr) { - FRAME_PTR f = XFRAME (frame); + FRAME_PTR f = XFRAME (fr); Lisp_Object font_object; struct face *face; @@ -1607,7 +1606,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */) { update_auto_fontset_alist (font_object, fontset); alist = Fcons (Fcons (Qfont, Fcons (name, font_object)), Qnil); - Fmodify_frame_parameters (frame, alist); + Fmodify_frame_parameters (fr, alist); } } } diff --git a/src/fringe.c b/src/fringe.c index d42d6467f31..ce75df766ee 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -913,7 +913,12 @@ update_window_fringes (struct window *w, int keep_current_p) int bitmap_cache[MAX_BITMAP_CACHE]; int top_ind_rn, bot_ind_rn; int top_ind_min_y, bot_ind_max_y; - int top_row_ends_at_zv_p, bot_row_ends_at_zv_p; + + /* top_ind_rn is set to a nonnegative value whenver + row->indicate_bob_p is set, so it's OK that top_row_ends_at_zv_p + is not initialized here. Similarly for bot_ind_rn, + row->indicate_eob_p and bot_row_ends_at_zv_p. */ + int top_row_ends_at_zv_p IF_LINT (= 0), bot_row_ends_at_zv_p IF_LINT (= 0); if (w->pseudo_window_p) return 0; @@ -949,18 +954,10 @@ update_window_fringes (struct window *w, int keep_current_p) y < yb && rn < nrows; y += row->height, ++rn) { - unsigned indicate_bob_p, indicate_top_line_p; - unsigned indicate_eob_p, indicate_bottom_line_p; - row = w->desired_matrix->rows + rn; if (!row->enabled_p) row = w->current_matrix->rows + rn; - indicate_bob_p = row->indicate_bob_p; - indicate_top_line_p = row->indicate_top_line_p; - indicate_eob_p = row->indicate_eob_p; - indicate_bottom_line_p = row->indicate_bottom_line_p; - row->indicate_bob_p = row->indicate_top_line_p = 0; row->indicate_eob_p = row->indicate_bottom_line_p = 0; @@ -1380,7 +1377,7 @@ compute_fringe_widths (struct frame *f, int redraw) /* Free resources used by a user-defined bitmap. */ -void +static void destroy_fringe_bitmap (int n) { struct fringe_bitmap **fbp; @@ -1448,7 +1445,7 @@ static const unsigned char swap_nibble[16] = { 0x3, 0xb, 0x7, 0xf}; /* 0011 1011 0111 1111 */ #endif /* HAVE_X_WINDOWS */ -void +static void init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p) { if (once_p || fb->dynamic) @@ -1831,4 +1828,3 @@ w32_reset_fringes (void) #endif /* HAVE_NTGUI */ #endif /* HAVE_WINDOW_SYSTEM */ - diff --git a/src/gtkutil.c b/src/gtkutil.c index 6ecd5d624af..754f61e366d 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -40,6 +40,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <X11/Xft/Xft.h> #endif +#ifdef HAVE_GTK3 +#include <gtk/gtkx.h> +#endif + #define FRAME_TOTAL_PIXEL_HEIGHT(f) \ (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) @@ -69,8 +73,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) #endif +#ifndef HAVE_GTK3 +#ifdef USE_GTK_TOOLTIP +#define gdk_window_get_screen(w) gdk_drawable_get_screen (w) +#endif +#define gdk_window_get_geometry(w, a, b, c, d) \ + gdk_window_get_geometry (w, a, b, c, d, 0) +#define gdk_x11_window_lookup_for_display(d, w) \ + gdk_xid_table_lookup_for_display (d, w) +#define GDK_KEY_g GDK_g +#endif + #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) +/* Get the current value of the range, truncated to an integer. */ +static int +int_gtk_range_get_value (GtkRange *range) +{ + return gtk_range_get_value (range); +} + /*********************************************************************** Display handling functions @@ -88,7 +110,7 @@ static GdkDisplay *gdpy_def; static void xg_set_screen (GtkWidget *w, FRAME_PTR f) { - if (FRAME_X_DISPLAY (f) != GDK_DISPLAY ()) + if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ()) { GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); GdkScreen *gscreen = gdk_display_get_default_screen (gdpy); @@ -229,29 +251,55 @@ xg_create_default_cursor (Display *dpy) return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); } +static GdkPixbuf * +xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix) +{ + int iunused; + GdkPixbuf *tmp_buf; + Window wunused; + unsigned int width, height, uunused; + XImage *xim; + + XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused, + &width, &height, &uunused, &uunused); + + xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height, + ~0, XYPixmap); + if (!xim) return 0; + + tmp_buf = gdk_pixbuf_new_from_data ((guchar *) xim->data, + GDK_COLORSPACE_RGB, + FALSE, + xim->bitmap_unit, + (int) width, + (int) height, + xim->bytes_per_line, + NULL, + NULL); + XDestroyImage (xim); + return tmp_buf; +} + /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ static GdkPixbuf * -xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, - GdkPixmap *gmask, - GdkColormap *cmap) +xg_get_pixbuf_from_pix_and_mask (FRAME_PTR f, + Pixmap pix, + Pixmap mask) { int width, height; GdkPixbuf *icon_buf, *tmp_buf; - gdk_drawable_get_size (gpix, &width, &height); - tmp_buf = gdk_pixbuf_get_from_drawable (NULL, gpix, cmap, - 0, 0, 0, 0, width, height); + tmp_buf = xg_get_pixbuf_from_pixmap (f, pix); icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0); g_object_unref (G_OBJECT (tmp_buf)); - if (gmask) + width = gdk_pixbuf_get_width (icon_buf); + height = gdk_pixbuf_get_height (icon_buf); + + if (mask) { - GdkPixbuf *mask_buf = gdk_pixbuf_get_from_drawable (NULL, - gmask, - NULL, - 0, 0, 0, 0, - width, height); + GdkPixbuf *mask_buf = xg_get_pixbuf_from_pixmap (f, mask); guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf); int rowstride = gdk_pixbuf_get_rowstride (icon_buf); @@ -316,10 +364,6 @@ xg_get_image_for_pixmap (FRAME_PTR f, GtkWidget *widget, GtkImage *old_widget) { - GdkPixmap *gpix; - GdkPixmap *gmask; - GdkDisplay *gdpy; - GdkColormap *cmap; GdkPixbuf *icon_buf; /* If we have a file, let GTK do all the image handling. @@ -347,10 +391,6 @@ xg_get_image_for_pixmap (FRAME_PTR f, on a monochrome display, and sometimes bad on all displays with certain themes. */ - gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap); - gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0; - /* This is a workaround to make icons look good on pseudo color displays. Apparently GTK expects the images to have an alpha channel. If they don't, insensitive and activated icons will @@ -360,18 +400,17 @@ xg_get_image_for_pixmap (FRAME_PTR f, not associated with the img->pixmap. The img->pixmap may be removed by clearing the image cache and then the tool bar redraw fails, since Gtk+ assumes the pixmap is always there. */ - cmap = gtk_widget_get_colormap (widget); - icon_buf = xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap); + icon_buf = xg_get_pixbuf_from_pix_and_mask (f, img->pixmap, img->mask); - if (! old_widget) - old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); - else - gtk_image_set_from_pixbuf (old_widget, icon_buf); - - g_object_unref (G_OBJECT (icon_buf)); + if (icon_buf) + { + if (! old_widget) + old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); + else + gtk_image_set_from_pixbuf (old_widget, icon_buf); - g_object_unref (G_OBJECT (gpix)); - if (gmask) g_object_unref (G_OBJECT (gmask)); + g_object_unref (G_OBJECT (icon_buf)); + } return GTK_WIDGET (old_widget); } @@ -455,22 +494,22 @@ get_utf8_string (const char *str) gsize bytes_written; unsigned char *p = (unsigned char *)str; char *cp, *up; - GError *error = NULL; + GError *err = NULL; while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read, - &bytes_written, &error)) - && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) + &bytes_written, &err)) + && err->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) { ++nr_bad; p += bytes_written+1; - g_error_free (error); - error = NULL; + g_error_free (err); + err = NULL; } - if (error) + if (err) { - g_error_free (error); - error = NULL; + g_error_free (err); + err = NULL; } if (cp) g_free (cp); @@ -478,16 +517,16 @@ get_utf8_string (const char *str) p = (unsigned char *)str; while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read, - &bytes_written, &error)) - && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) + &bytes_written, &err)) + && err->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) { strncpy (up, (char *)p, bytes_written); sprintf (up + bytes_written, "\\%03o", p[bytes_written]); up[bytes_written+4] = '\0'; up += bytes_written+4; p += bytes_written+1; - g_error_free (error); - error = NULL; + g_error_free (err); + err = NULL; } if (cp) @@ -495,10 +534,10 @@ get_utf8_string (const char *str) strcat (utf8_str, cp); g_free (cp); } - if (error) + if (err) { - g_error_free (error); - error = NULL; + g_error_free (err); + err = NULL; } } return utf8_str; @@ -514,28 +553,43 @@ xg_check_special_colors (struct frame *f, XColor *color) { int success_p = 0; - if (FRAME_GTK_WIDGET (f)) - { - if (strcmp ("gtk_selection_bg_color", color_name) == 0) - { - GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); - color->red = gsty->bg[GTK_STATE_SELECTED].red; - color->green = gsty->bg[GTK_STATE_SELECTED].green; - color->blue = gsty->bg[GTK_STATE_SELECTED].blue; - color->pixel = gsty->bg[GTK_STATE_SELECTED].pixel; - success_p = 1; - } - else if (strcmp ("gtk_selection_fg_color", color_name) == 0) - { - GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); - color->red = gsty->fg[GTK_STATE_SELECTED].red; - color->green = gsty->fg[GTK_STATE_SELECTED].green; - color->blue = gsty->fg[GTK_STATE_SELECTED].blue; - color->pixel = gsty->fg[GTK_STATE_SELECTED].pixel; - success_p = 1; - } - } + int get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0; + int get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0; + if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) + return success_p; + + BLOCK_INPUT; + { +#ifdef HAVE_GTK3 + GtkStyleContext *gsty + = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f)); + GdkRGBA col; + char buf[64]; + int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED; + if (get_fg) + gtk_style_context_get_color (gsty, state, &col); + else + gtk_style_context_get_background_color (gsty, state, &col); + + sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue); + success_p = XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), + buf, color); +#else + GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); + GdkColor *grgb = get_bg + ? &gsty->bg[GTK_STATE_SELECTED] + : &gsty->fg[GTK_STATE_SELECTED]; + + color->red = grgb->red; + color->green = grgb->green; + color->blue = grgb->blue; + color->pixel = grgb->pixel; + success_p = 1; +#endif + + } + UNBLOCK_INPUT; return success_p; } @@ -629,7 +683,7 @@ xg_prepare_tooltip (FRAME_PTR f, encoded_string = ENCODE_UTF_8 (string); widget = GTK_WIDGET (x->ttip_lbl); gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window)); - screen = gdk_drawable_get_screen (gwin); + screen = gdk_window_get_screen (gwin); settings = gtk_settings_get_for_screen (screen); g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL); if (tt_enabled) @@ -650,7 +704,7 @@ xg_prepare_tooltip (FRAME_PTR f, gtk_tooltip_set_custom (x->ttip_widget, widget); gtk_tooltip_set_text (x->ttip_widget, SDATA (encoded_string)); - gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (x->ttip_window), NULL, &req); if (width) *width = req.width; if (height) *height = req.height; @@ -696,7 +750,7 @@ xg_hide_tooltip (FRAME_PTR f) if (g_object_get_data (G_OBJECT (win), "restore-tt")) { GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win)); - GdkScreen *screen = gdk_drawable_get_screen (gwin); + GdkScreen *screen = gdk_window_get_screen (gwin); GtkSettings *settings = gtk_settings_get_for_screen (screen); g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); } @@ -797,7 +851,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight) if (FRAME_GTK_WIDGET (f) && gtk_widget_get_mapped (FRAME_GTK_WIDGET (f))) gdk_window_get_geometry (gtk_widget_get_window (FRAME_GTK_WIDGET (f)), 0, 0, - &pixelwidth, &pixelheight, 0); + &pixelwidth, &pixelheight); else return; } @@ -910,8 +964,8 @@ xg_win_to_widget (Display *dpy, Window wdesc) BLOCK_INPUT; - gdkwin = gdk_xid_table_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), - wdesc); + gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), + wdesc); if (gdkwin) { GdkEvent event; @@ -923,14 +977,29 @@ xg_win_to_widget (Display *dpy, Window wdesc) return gwdesc; } -/* Fill in the GdkColor C so that it represents PIXEL. - W is the widget that color will be used for. Used to find colormap. */ +/* Set the background of widget W to PIXEL. */ static void -xg_pix_to_gcolor (GtkWidget *w, long unsigned int pixel, GdkColor *c) +xg_set_widget_bg (FRAME_PTR f, GtkWidget *w, long unsigned int pixel) { +#ifdef HAVE_GTK3 + GdkRGBA bg; + XColor xbg; + xbg.pixel = pixel; + if (XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &xbg)) + { + bg.red = (double)xbg.red/65536.0; + bg.green = (double)xbg.green/65536.0; + bg.blue = (double)xbg.blue/65536.0; + bg.alpha = 1.0; + gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &bg); + } +#else + GdkColor bg; GdkColormap *map = gtk_widget_get_colormap (w); - gdk_colormap_query_color (map, pixel, c); + gdk_colormap_query_color (map, pixel, &bg); + gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &bg); +#endif } /* Callback called when the gtk theme changes. @@ -953,6 +1022,28 @@ style_changed_cb (GObject *go, kbd_buffer_store_event (&event); } +/* Called when a delete-event occurs on WIDGET. */ + +static gboolean +delete_cb (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ +#ifdef HAVE_GTK3 + /* The event doesn't arrive in the normal event loop. Send event + here. */ + FRAME_PTR f = (FRAME_PTR) user_data; + struct input_event ie; + + EVENT_INIT (ie); + ie.kind = DELETE_WINDOW_EVENT; + XSETFRAME (ie.frame_or_window, f); + kbd_buffer_store_event (&ie); +#endif + + return TRUE; +} + /* Create and set up the GTK widgets for frame F. Return 0 if creation failed, non-zero otherwise. */ @@ -962,7 +1053,6 @@ xg_create_frame_widgets (FRAME_PTR f) GtkWidget *wtop; GtkWidget *wvbox, *whbox; GtkWidget *wfixed; - GdkColor bg; GtkRcStyle *style; char *title = 0; @@ -1029,7 +1119,7 @@ xg_create_frame_widgets (FRAME_PTR f) /* Add callback to do nothing on WM_DELETE_WINDOW. The default in GTK is to destroy the widget. We want Emacs to do that instead. */ g_signal_connect (G_OBJECT (wtop), "delete-event", - G_CALLBACK (gtk_true), 0); + G_CALLBACK (delete_cb), f); /* Convert our geometry parameters into a geometry string and specify it. @@ -1057,9 +1147,9 @@ xg_create_frame_widgets (FRAME_PTR f) /* Since GTK clears its window by filling with the background color, we must keep X and GTK background in sync. */ - xg_pix_to_gcolor (wfixed, FRAME_BACKGROUND_PIXEL (f), &bg); - gtk_widget_modify_bg (wfixed, GTK_STATE_NORMAL, &bg); + xg_set_widget_bg (f, wfixed, FRAME_BACKGROUND_PIXEL (f)); +#ifndef HAVE_GTK3 /* Also, do not let any background pixmap to be set, this looks very bad as Emacs overwrites the background pixmap with its own idea of background color. */ @@ -1068,6 +1158,9 @@ xg_create_frame_widgets (FRAME_PTR f) /* Must use g_strdup because gtk_widget_modify_style does g_free. */ style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>"); gtk_widget_modify_style (wfixed, style); +#else + gtk_widget_set_can_focus (wfixed, TRUE); +#endif #ifdef USE_GTK_TOOLTIP /* Steal a tool tip window we can move ourselves. */ @@ -1104,7 +1197,9 @@ xg_free_frame_widgets (FRAME_PTR f) { if (FRAME_GTK_OUTER_WIDGET (f)) { +#ifdef USE_GTK_TOOLTIP struct x_output *x = f->output_data.x; +#endif gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f)); FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */ FRAME_GTK_OUTER_WIDGET (f) = 0; @@ -1224,11 +1319,8 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg) { if (FRAME_GTK_WIDGET (f)) { - GdkColor gdk_bg; - BLOCK_INPUT; - xg_pix_to_gcolor (FRAME_GTK_WIDGET (f), bg, &gdk_bg); - gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &gdk_bg); + xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f)); UNBLOCK_INPUT; } } @@ -1240,11 +1332,10 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg) void xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask) { - GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - GdkPixmap *gpix = gdk_pixmap_foreign_new_for_display (gdpy, icon_pixmap); - GdkPixmap *gmask = gdk_pixmap_foreign_new_for_display (gdpy, icon_mask); - GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (gpix, gmask, NULL); - + GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f, + icon_pixmap, + icon_mask); + if (gp) gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), gp); } @@ -1326,8 +1417,6 @@ create_dialog (widget_value *wv, GtkDialog *wd = GTK_DIALOG (wdialog); GtkBox *cur_box = GTK_BOX (gtk_dialog_get_action_area (wd)); widget_value *item; - GtkWidget *wvbox; - GtkWidget *whbox_up; GtkWidget *whbox_down; /* If the number of buttons is greater than 4, make two rows of buttons @@ -1343,8 +1432,8 @@ create_dialog (widget_value *wv, if (make_two_rows) { - wvbox = gtk_vbox_new (TRUE, button_spacing); - whbox_up = gtk_hbox_new (FALSE, 0); + GtkWidget *wvbox = gtk_vbox_new (TRUE, button_spacing); + GtkWidget *whbox_up = gtk_hbox_new (FALSE, 0); whbox_down = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (cur_box, wvbox, FALSE, FALSE, 0); @@ -1381,7 +1470,7 @@ create_dialog (widget_value *wv, /* Try to make dialog look better. Must realize first so the widget can calculate the size it needs. */ gtk_widget_realize (w); - gtk_widget_size_request (w, &req); + gtk_widget_get_preferred_size (w, NULL, &req); gtk_box_set_spacing (wvbox, req.height); if (item->value && strlen (item->value) > 0) button_spacing = 2*req.width/strlen (item->value); @@ -1613,7 +1702,7 @@ xg_get_file_with_chooser (FRAME_PTR f, int mustmatch_p, int only_dir_p, xg_get_file_func *func) { - char message[1024]; + char msgbuf[1024]; GtkWidget *filewin, *wtoggle, *wbox, *wmessage; GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)); @@ -1649,16 +1738,16 @@ xg_get_file_with_chooser (FRAME_PTR f, if (x_gtk_file_dialog_help_text) { - message[0] = '\0'; + msgbuf[0] = '\0'; /* Gtk+ 2.10 has the file name text entry box integrated in the dialog. Show the C-l help text only for versions < 2.10. */ if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE) - strcat (message, "\nType C-l to display a file name text entry box.\n"); - strcat (message, "\nIf you don't like this file selector, use the " + strcat (msgbuf, "\nType C-l to display a file name text entry box.\n"); + strcat (msgbuf, "\nIf you don't like this file selector, use the " "corresponding\nkey binding or customize " "use-file-dialog to turn it off."); - wmessage = gtk_label_new (message); + wmessage = gtk_label_new (msgbuf); gtk_widget_show (wmessage); } @@ -3028,7 +3117,7 @@ menubar_map_cb (GtkWidget *w, gpointer user_data) { GtkRequisition req; FRAME_PTR f = (FRAME_PTR) user_data; - gtk_widget_size_request (w, &req); + gtk_widget_get_preferred_size (w, NULL, &req); if (FRAME_MENUBAR_HEIGHT (f) != req.height) { FRAME_MENUBAR_HEIGHT (f) = req.height; @@ -3059,7 +3148,7 @@ xg_update_frame_menubar (FRAME_PTR f) g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f); gtk_widget_show_all (x->menubar_widget); - gtk_widget_size_request (x->menubar_widget, &req); + gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req); /* If menu bar doesn't know its height yet, cheat a little so the frame doesn't jump so much when resized later in menubar_map_cb. */ @@ -3120,7 +3209,7 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) return 0; gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - gw = gdk_xid_table_lookup_for_display (gdpy, event->xbutton.window); + gw = gdk_x11_window_lookup_for_display (gdpy, event->xbutton.window); if (! gw) return 0; gevent.any.window = gw; gwdesc = gtk_get_event_widget (&gevent); @@ -3284,8 +3373,12 @@ xg_create_scroll_bar (FRAME_PTR f, { GtkWidget *wscroll; GtkWidget *webox; - GtkObject *vadj; int scroll_id; +#ifdef HAVE_GTK3 + GtkAdjustment *vadj; +#else + GtkObject *vadj; +#endif /* Page, step increment values are not so important here, they will be corrected in x_set_toolkit_scroll_bar_thumb. */ @@ -3295,7 +3388,9 @@ xg_create_scroll_bar (FRAME_PTR f, wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); webox = gtk_event_box_new (); gtk_widget_set_name (wscroll, scroll_bar_name); +#ifndef HAVE_GTK3 gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS); +#endif g_object_set_data (G_OBJECT (wscroll), XG_FRAME_DATA, (gpointer)f); scroll_id = xg_store_widget_in_map (wscroll); @@ -3474,7 +3569,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, changed = 1; } - if (changed || (int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) + if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) { BLOCK_INPUT; @@ -3482,7 +3577,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, ignore_gtk_scrollbar to make the callback do nothing */ xg_ignore_gtk_scrollbar = 1; - if ((int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) + if (int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value); else if (changed) gtk_adjustment_changed (adj); @@ -3578,8 +3673,8 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data) { /* The EMACS_INT cast avoids a warning. */ int idx = (int) (EMACS_INT) client_data; - int mod = (int) (EMACS_INT) g_object_get_data (G_OBJECT (w), - XG_TOOL_BAR_LAST_MODIFIER); + gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER); + int mod = (int) (EMACS_INT) gmod; FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); Lisp_Object key, frame; @@ -3793,8 +3888,8 @@ xg_tool_bar_detach_callback (GtkHandleBox *wbox, { GtkRequisition req, req2; FRAME_X_OUTPUT (f)->toolbar_detached = 1; - gtk_widget_size_request (GTK_WIDGET (wbox), &req); - gtk_widget_size_request (w, &req2); + gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); + gtk_widget_get_preferred_size (w, NULL, &req2); req.width -= req2.width; req.height -= req2.height; if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) @@ -3828,8 +3923,8 @@ xg_tool_bar_attach_callback (GtkHandleBox *wbox, { GtkRequisition req, req2; FRAME_X_OUTPUT (f)->toolbar_detached = 0; - gtk_widget_size_request (GTK_WIDGET (wbox), &req); - gtk_widget_size_request (w, &req2); + gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); + gtk_widget_get_preferred_size (w, NULL, &req2); req.width += req2.width; req.height += req2.height; if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) @@ -3894,6 +3989,7 @@ xg_tool_bar_help_callback (GtkWidget *w, Returns FALSE to tell GTK to keep processing this event. */ +#ifndef HAVE_GTK3 static gboolean xg_tool_bar_item_expose_callback (GtkWidget *w, GdkEventExpose *event, @@ -3902,7 +3998,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w, gint width, height; gdk_drawable_get_size (event->window, &width, &height); - event->area.x -= width > event->area.width ? width-event->area.width : 0; event->area.y -= height > event->area.height ? height-event->area.height : 0; @@ -3914,6 +4009,7 @@ xg_tool_bar_item_expose_callback (GtkWidget *w, return FALSE; } +#endif #ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION #define toolbar_set_orientation(w, o) \ @@ -4063,13 +4159,14 @@ xg_make_tool_item (FRAME_PTR f, g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); +#ifndef HAVE_GTK3 /* Catch expose events to overcome an annoying redraw bug, see comment for xg_tool_bar_item_expose_callback. */ g_signal_connect (G_OBJECT (ti), "expose-event", G_CALLBACK (xg_tool_bar_item_expose_callback), 0); - +#endif gtk_tool_item_set_homogeneous (ti, FALSE); /* Callback to save modifyer mask (Shift/Control, etc). GTK makes @@ -4128,9 +4225,9 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, } else { - Pixmap old_img - = (Pixmap) g_object_get_data (G_OBJECT (wimage), - XG_TOOL_BAR_IMAGE_DATA); + gpointer gold_img = g_object_get_data (G_OBJECT (wimage), + XG_TOOL_BAR_IMAGE_DATA); + Pixmap old_img = (Pixmap) gold_img; if (old_img != img->pixmap) return 1; } @@ -4153,7 +4250,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f) GtkRequisition req; int nl = 0, nr = 0, nt = 0, nb = 0; - gtk_widget_size_request (GTK_WIDGET (x->handlebox_widget), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (x->handlebox_widget), NULL, &req); if (x->toolbar_in_hbox) { int pos; @@ -4203,7 +4300,6 @@ update_frame_tool_bar (FRAME_PTR f) GtkToolItem *ti; GtkTextDirection dir; int pack_tool_bar = x->handlebox_widget == NULL; - Lisp_Object style; int text_image, horiz; @@ -4551,13 +4647,13 @@ xg_initialize (void) /* Make dialogs close on C-g. Since file dialog inherits from dialog, this works for them also. */ binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_DIALOG)); - gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK, "close", 0); /* Make menus close on C-g. */ binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_MENU_SHELL)); - gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK, "cancel", 0); } diff --git a/src/image.c b/src/image.c index 73a45633f3b..91308c540b5 100644 --- a/src/image.c +++ b/src/image.c @@ -550,10 +550,6 @@ x_create_bitmap_mask (struct frame *f, int id) Image types ***********************************************************************/ -/* Value is the number of elements of vector VECTOR. */ - -#define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) - /* List of supported image types. Use define_image_type to add new types. Use lookup_image_type to find a type for a given symbol. */ @@ -1139,7 +1135,7 @@ static RGB_PIXEL_COLOR four_corners_best (XImagePtr_or_DC ximg, int *corners, unsigned long width, unsigned long height) { - RGB_PIXEL_COLOR corner_pixels[4], best; + RGB_PIXEL_COLOR corner_pixels[4], best IF_LINT (= 0); int i, best_count; if (corners && corners[BOT_CORNER] >= 0) @@ -1491,7 +1487,7 @@ free_image_cache (struct frame *f) If image-cache-eviction-delay is non-nil, this frees images in the cache which weren't displayed for at least that many seconds. */ -void +static void clear_image_cache (struct frame *f, Lisp_Object filter) { struct image_cache *c = FRAME_IMAGE_CACHE (f); @@ -1559,9 +1555,9 @@ clear_image_cache (struct frame *f, Lisp_Object filter) FOR_EACH_FRAME (tail, frame) { - struct frame *f = XFRAME (frame); - if (FRAME_IMAGE_CACHE (f) == c) - clear_current_matrices (f); + struct frame *fr = XFRAME (frame); + if (FRAME_IMAGE_CACHE (fr) == c) + clear_current_matrices (fr); } ++windows_or_buffers_changed; @@ -2653,11 +2649,11 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e if (LA1 == XBM_TK_NUMBER) { - char *p = strrchr (buffer, '_'); - p = p ? p + 1 : buffer; - if (strcmp (p, "width") == 0) + char *q = strrchr (buffer, '_'); + q = q ? q + 1 : buffer; + if (strcmp (q, "width") == 0) *width = value; - else if (strcmp (p, "height") == 0) + else if (strcmp (q, "height") == 0) *height = value; } expect (XBM_TK_NUMBER); @@ -3427,11 +3423,12 @@ xpm_load (struct frame *f, struct image *img) { Lisp_Object name; Lisp_Object color; + char *empty_string = (char *) ""; if (!CONSP (XCAR (tail))) { - xpm_syms[i].name = ""; - xpm_syms[i].value = ""; + xpm_syms[i].name = empty_string; + xpm_syms[i].value = empty_string; continue; } name = XCAR (XCAR (tail)); @@ -3442,14 +3439,14 @@ xpm_load (struct frame *f, struct image *img) strcpy (xpm_syms[i].name, SSDATA (name)); } else - xpm_syms[i].name = ""; + xpm_syms[i].name = empty_string; if (STRINGP (color)) { xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); strcpy (xpm_syms[i].value, SSDATA (color)); } else - xpm_syms[i].value = ""; + xpm_syms[i].value = empty_string; } } @@ -4605,14 +4602,14 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus for (x = 1; x < img->width - 1; ++x, ++p) { - int r, g, b, y1, x1; + int r, g, b, yy, xx; r = g = b = i = 0; - for (y1 = y - 1; y1 < y + 2; ++y1) - for (x1 = x - 1; x1 < x + 2; ++x1, ++i) + for (yy = y - 1; yy < y + 2; ++yy) + for (xx = x - 1; xx < x + 2; ++xx, ++i) if (matrix[i]) { - XColor *t = COLOR (colors, x1, y1); + XColor *t = COLOR (colors, xx, yy); r += matrix[i] * t->red; g += matrix[i] * t->green; b += matrix[i] * t->blue; @@ -4688,7 +4685,7 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix, color_adjust = make_number (0xffff / 2); if (i == 9 && NUMBERP (color_adjust)) - x_detect_edges (f, img, trans, (int) XFLOATINT (color_adjust)); + x_detect_edges (f, img, trans, XFLOATINT (color_adjust)); } @@ -5531,6 +5528,7 @@ init_png_functions (Lisp_Object libraries) /* Error and warning handlers installed when the PNG library is initialized. */ +static void my_png_error (png_struct *, const char *) NO_RETURN; static void my_png_error (png_struct *png_ptr, const char *msg) { @@ -6030,7 +6028,6 @@ jpeg_image_p (Lisp_Object object) /* Work around a warning about HAVE_STDLIB_H being redefined in jconfig.h. */ #ifdef HAVE_STDLIB_H -#define HAVE_STDLIB_H_1 #undef HAVE_STDLIB_H #endif /* HAVE_STLIB_H */ @@ -6106,6 +6103,7 @@ struct my_jpeg_error_mgr }; +static void my_error_exit (j_common_ptr) NO_RETURN; static void my_error_exit (j_common_ptr cinfo) { @@ -6366,10 +6364,10 @@ jpeg_load (struct frame *f, struct image *img) if (rc == 1) { /* Called from my_error_exit. Display a JPEG error. */ - char buffer[JMSG_LENGTH_MAX]; - cinfo.err->format_message ((j_common_ptr) &cinfo, buffer); + char buf[JMSG_LENGTH_MAX]; + cinfo.err->format_message ((j_common_ptr) &cinfo, buf); image_error ("Error reading JPEG image `%s': %s", img->spec, - build_string (buffer)); + build_string (buf)); } /* Close the input file and destroy the JPEG object. */ @@ -7105,7 +7103,7 @@ gif_load (struct frame *f, struct image *img) Lisp_Object file, specified_file; Lisp_Object specified_data; int rc, width, height, x, y, i; - boolean transparent_p; + boolean transparent_p = 0; XImagePtr ximg; ColorMapObject *gif_color_map; unsigned long pixel_colors[256]; @@ -7114,7 +7112,7 @@ gif_load (struct frame *f, struct image *img) int ino, image_height, image_width; gif_memory_source memsrc; unsigned char *raster; - unsigned int transparency_color_index; + unsigned int transparency_color_index IF_LINT (= 0); specified_file = image_spec_value (img->spec, QCfile, NULL); specified_data = image_spec_value (img->spec, QCdata, NULL); @@ -7129,7 +7127,7 @@ gif_load (struct frame *f, struct image *img) } /* Open the GIF file. */ - gif = fn_DGifOpenFileName (SDATA (file)); + gif = fn_DGifOpenFileName (SSDATA (file)); if (gif == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -7302,9 +7300,9 @@ gif_load (struct frame *f, struct image *img) for (x = 0; x < image_width; x++) { - int i = raster[(y * image_width) + x]; + int c = raster[(y * image_width) + x]; XPutPixel (ximg, x + img->corners[LEFT_CORNER], - row + img->corners[TOP_CORNER], pixel_colors[i]); + row + img->corners[TOP_CORNER], pixel_colors[c]); } row += interlace_increment[pass]; @@ -7315,9 +7313,9 @@ gif_load (struct frame *f, struct image *img) for (y = 0; y < image_height; ++y) for (x = 0; x < image_width; ++x) { - int i = raster[y * image_width + x]; + int c = raster[y * image_width + x]; XPutPixel (ximg, x + img->corners[LEFT_CORNER], - y + img->corners[TOP_CORNER], pixel_colors[i]); + y + img->corners[TOP_CORNER], pixel_colors[c]); } } diff --git a/src/indent.c b/src/indent.c index 37ce647556d..baea0641948 100644 --- a/src/indent.c +++ b/src/indent.c @@ -274,20 +274,20 @@ skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Ob This macro is used in current_column_1, Fmove_to_column, and compute_motion. */ -#define MULTIBYTE_BYTES_WIDTH(p, dp) \ +#define MULTIBYTE_BYTES_WIDTH(p, dp, bytes, width) \ do { \ - int c; \ + int ch; \ \ wide_column = 0; \ - c = STRING_CHAR_AND_LENGTH (p, bytes); \ + ch = STRING_CHAR_AND_LENGTH (p, bytes); \ if (BYTES_BY_CHAR_HEAD (*p) != bytes) \ width = bytes * 4; \ else \ { \ - if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) \ - width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; \ + if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ + width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \ else \ - width = CHAR_WIDTH (c); \ + width = CHAR_WIDTH (ch); \ if (width > 1) \ wide_column = width; \ } \ @@ -569,14 +569,14 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) prev_col = col; { /* Check display property. */ - EMACS_INT end; - int width = check_display_width (scan, col, &end); + EMACS_INT endp; + int width = check_display_width (scan, col, &endp); if (width >= 0) { col += width; - if (end > scan) /* Avoid infinite loops with 0-width overlays. */ + if (endp > scan) /* Avoid infinite loops with 0-width overlays. */ { - scan = end; scan_byte = charpos_to_bytepos (scan); + scan = endp; scan_byte = charpos_to_bytepos (scan); continue; } } @@ -669,7 +669,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) int bytes, width, wide_column; ptr = BYTE_POS_ADDR (scan_byte); - MULTIBYTE_BYTES_WIDTH (ptr, dp); + MULTIBYTE_BYTES_WIDTH (ptr, dp, bytes, width); /* Subtract one to compensate for the increment that is going to happen below. */ scan_byte += bytes - 1; @@ -1657,15 +1657,15 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ { /* Start of multi-byte form. */ unsigned char *ptr; - int bytes, width, wide_column; + int mb_bytes, mb_width, wide_column; pos_byte--; /* rewind POS_BYTE */ ptr = BYTE_POS_ADDR (pos_byte); - MULTIBYTE_BYTES_WIDTH (ptr, dp); - pos_byte += bytes; + MULTIBYTE_BYTES_WIDTH (ptr, dp, mb_bytes, mb_width); + pos_byte += mb_bytes; if (wide_column) wide_column_end_hpos = hpos + wide_column; - hpos += width; + hpos += mb_width; } else if (VECTORP (charvec)) ++hpos; @@ -1995,7 +1995,7 @@ whether or not it is currently displayed in some window. */) Lisp_Object old_buffer; struct gcpro gcpro1; Lisp_Object lcols = Qnil; - double cols; + double cols IF_LINT (= 0); /* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */ if (CONSP (lines) && (NUMBERP (XCAR (lines)))) @@ -2029,7 +2029,7 @@ whether or not it is currently displayed in some window. */) } else { - int it_start, first_x, it_overshoot_expected; + int it_start, first_x, it_overshoot_expected IF_LINT (= 0); SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); diff --git a/src/insdel.c b/src/insdel.c index 7fcf9522a33..ad3460f9a64 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -70,11 +70,14 @@ Lisp_Object combine_after_change_buffer; Lisp_Object Qinhibit_modification_hooks; #define CHECK_MARKERS() \ - if (check_markers_debug_flag) \ - check_markers (); \ - else + do \ + { \ + if (check_markers_debug_flag) \ + check_markers (); \ + } \ + while (0) -void +static void check_markers (void) { register struct Lisp_Marker *tail; @@ -411,9 +414,7 @@ adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes) { - BUF_PT (current_buffer) += nchars; - BUF_PT_BYTE (current_buffer) += nbytes; - + SET_BUF_PT_BOTH (current_buffer, PT + nchars, PT_BYTE + nbytes); /* In a single-byte buffer, the two positions must be equal. */ eassert (PT_BYTE >= PT && PT_BYTE - PT <= ZV_BYTE - ZV); } @@ -453,7 +454,7 @@ adjust_markers_for_replace (EMACS_INT from, EMACS_INT from_byte, /* Make the gap NBYTES_ADDED bytes longer. */ -void +static void make_gap_larger (EMACS_INT nbytes_added) { Lisp_Object tem; @@ -508,7 +509,7 @@ make_gap_larger (EMACS_INT nbytes_added) /* Make the gap NBYTES_REMOVED bytes shorter. */ -void +static void make_gap_smaller (EMACS_INT nbytes_removed) { Lisp_Object tem; @@ -595,7 +596,6 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr, { EMACS_INT nchars = 0; EMACS_INT bytes_left = nbytes; - Lisp_Object tbl = Qnil; while (bytes_left > 0) { @@ -2101,7 +2101,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, VARIABLE is the variable to maybe set to nil. NO-ERROR-FLAG is nil if there was an error, anything else meaning no error (so this function does nothing). */ -Lisp_Object +static Lisp_Object reset_var_on_error (Lisp_Object val) { if (NILP (XCDR (val))) @@ -2265,7 +2265,7 @@ signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins) unbind_to (count, Qnil); } -Lisp_Object +static Lisp_Object Fcombine_after_change_execute_1 (Lisp_Object val) { Vcombine_after_change_calls = val; diff --git a/src/intervals.c b/src/intervals.c index 6aee6e9d7fa..12b2789cc77 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -1892,8 +1892,7 @@ temp_set_point_both (struct buffer *buffer, if (charpos > BUF_ZV (buffer) || charpos < BUF_BEGV (buffer)) abort (); - BUF_PT_BYTE (buffer) = bytepos; - BUF_PT (buffer) = charpos; + SET_BUF_PT_BOTH (buffer, charpos, bytepos); } /* Set point "temporarily", without checking any text properties. */ @@ -2312,10 +2311,9 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer, old_zv = BUF_ZV (buffer); old_begv_byte = BUF_BEGV_BYTE (buffer); old_zv_byte = BUF_ZV_BYTE (buffer); - BUF_BEGV (buffer) = BUF_BEG (buffer); - BUF_ZV (buffer) = BUF_Z (buffer); - BUF_BEGV_BYTE (buffer) = BUF_BEG_BYTE (buffer); - BUF_ZV_BYTE (buffer) = BUF_Z_BYTE (buffer); + + SET_BUF_BEGV_BOTH (buffer, BUF_BEG (buffer), BUF_BEG_BYTE (buffer)); + SET_BUF_ZV_BOTH (buffer, BUF_Z (buffer), BUF_Z_BYTE (buffer)); XSETFASTINT (lispy_position, position); XSETBUFFER (lispy_buffer, buffer); @@ -2329,10 +2327,8 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer, if (NILP (prop)) prop = get_pos_property (lispy_position, type, lispy_buffer); - BUF_BEGV (buffer) = old_begv; - BUF_ZV (buffer) = old_zv; - BUF_BEGV_BYTE (buffer) = old_begv_byte; - BUF_ZV_BYTE (buffer) = old_zv_byte; + SET_BUF_BEGV_BOTH (buffer, old_begv, old_begv_byte); + SET_BUF_ZV_BOTH (buffer, old_zv, old_zv_byte); /* Use the local map only if it is valid. */ prop = get_keymap (prop, 0, 0); diff --git a/src/keyboard.c b/src/keyboard.c index 78aa1cfea77..63e7573fbe9 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -451,7 +451,7 @@ static int store_user_signal_events (void); C can be a character, which is printed prettily ("M-C-x" and all that jazz), or a symbol, whose name is printed. */ -void +static void echo_char (Lisp_Object c) { if (current_kboard->immediate_echo) @@ -538,7 +538,7 @@ echo_char (Lisp_Object c) /* Temporarily add a dash to the end of the echo string if it's not empty, so that it serves as a mini-prompt for the very next character. */ -void +static void echo_dash (void) { /* Do nothing if not echoing at all. */ @@ -967,7 +967,7 @@ restore_kboard_configuration (Lisp_Object was_locked) /* Handle errors that are not handled at inner levels by printing an error message and returning to the editor command loop. */ -Lisp_Object +static Lisp_Object cmd_error (Lisp_Object data) { Lisp_Object old_level, old_length; @@ -1132,7 +1132,7 @@ command_loop_2 (Lisp_Object ignore) return Qnil; } -Lisp_Object +static Lisp_Object top_level_2 (void) { return Feval (Vtop_level, Qnil); @@ -1169,6 +1169,7 @@ This also exits all active minibuffers. */) Fthrow (Qtop_level, Qnil); } +Lisp_Object Fexit_recursive_edit (void) NO_RETURN; DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", doc: /* Exit from the innermost recursive edit or minibuffer. */) (void) @@ -1179,6 +1180,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, error ("No recursive edit is in progress"); } +Lisp_Object Fabort_recursive_edit (void) NO_RETURN; DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", doc: /* Abort the command that requested this recursive edit or minibuffer input. */) (void) @@ -1885,7 +1887,7 @@ poll_for_input_1 (void) /* Timer callback function for poll_timer. TIMER is equal to poll_timer. */ -void +static void poll_for_input (struct atimer *timer) { if (poll_suppress_count == 0) @@ -2184,7 +2186,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event int *used_mouse_menu, struct timeval *end_time) { volatile Lisp_Object c; - int count, jmpcount; + int jmpcount; jmp_buf local_getcjmp; jmp_buf save_jump; volatile int key_already_recorded = 0; @@ -2461,21 +2463,21 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame)); if (kb != current_kboard) { - Lisp_Object link = KVAR (kb, kbd_queue); + Lisp_Object last = KVAR (kb, kbd_queue); /* We shouldn't get here if we were in single-kboard mode! */ if (single_kboard) abort (); - if (CONSP (link)) + if (CONSP (last)) { - while (CONSP (XCDR (link))) - link = XCDR (link); - if (!NILP (XCDR (link))) + while (CONSP (XCDR (last))) + last = XCDR (last); + if (!NILP (XCDR (last))) abort (); } - if (!CONSP (link)) + if (!CONSP (last)) KVAR (kb, kbd_queue) = Fcons (c, Qnil); else - XSETCDR (link, Fcons (c, Qnil)); + XSETCDR (last, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; current_kboard = kb; /* This is going to exit from read_char @@ -2692,7 +2694,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (NILP (c)) { - KBOARD *kb; + KBOARD *kb IF_LINT (= NULL); if (end_time) { @@ -2712,18 +2714,18 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (! NILP (c) && (kb != current_kboard)) { - Lisp_Object link = KVAR (kb, kbd_queue); - if (CONSP (link)) + Lisp_Object last = KVAR (kb, kbd_queue); + if (CONSP (last)) { - while (CONSP (XCDR (link))) - link = XCDR (link); - if (!NILP (XCDR (link))) + while (CONSP (XCDR (last))) + last = XCDR (last); + if (!NILP (XCDR (last))) abort (); } - if (!CONSP (link)) + if (!CONSP (last)) KVAR (kb, kbd_queue) = Fcons (c, Qnil); else - XSETCDR (link, Fcons (c, Qnil)); + XSETCDR (last, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; c = Qnil; if (single_kboard) @@ -2912,7 +2914,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event { Lisp_Object keys; int key_count, key_count_reset; - struct gcpro gcpro1; + struct gcpro inner_gcpro1; int count = SPECPDL_INDEX (); /* Save the echo status. */ @@ -2940,7 +2942,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event keys = Fcopy_sequence (this_command_keys); else keys = Qnil; - GCPRO1 (keys); + GCPRO1_VAR (keys, inner_gcpro); /* Clear out this_command_keys. */ this_command_key_count = 0; @@ -2978,7 +2980,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (saved_immediate_echo) echo_now (); - UNGCPRO; + UNGCPRO_VAR (inner_gcpro); /* The input method can return no events. */ if (! CONSP (tem)) @@ -3000,16 +3002,16 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) { /* (help-echo FRAME HELP WINDOW OBJECT POS). */ - Lisp_Object help, object, position, window, tem; + Lisp_Object help, object, position, window, htem; - tem = Fcdr (XCDR (c)); - help = Fcar (tem); - tem = Fcdr (tem); - window = Fcar (tem); - tem = Fcdr (tem); - object = Fcar (tem); - tem = Fcdr (tem); - position = Fcar (tem); + htem = Fcdr (XCDR (c)); + help = Fcar (htem); + htem = Fcdr (htem); + window = Fcar (htem); + htem = Fcdr (htem); + object = Fcar (htem); + htem = Fcdr (htem); + position = Fcar (htem); show_help_echo (help, window, object, position, 0); @@ -3051,7 +3053,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (!NILP (Vhelp_form) && help_char_p (c)) { Lisp_Object tem0; - count = SPECPDL_INDEX (); + int count = SPECPDL_INDEX (); help_form_saved_window_configs = Fcons (Fcurrent_window_configuration (Qnil), @@ -4024,7 +4026,7 @@ kbd_buffer_get_event (KBOARD **kbp, Lisp_Object bar_window; enum scroll_bar_part part; Lisp_Object x, y; - unsigned long time; + unsigned long t; *kbp = current_kboard; /* Note that this uses F to determine which terminal to look at. @@ -4035,7 +4037,7 @@ kbd_buffer_get_event (KBOARD **kbp, /* XXX Can f or mouse_position_hook be NULL here? */ if (f && FRAME_TERMINAL (f)->mouse_position_hook) (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, 0, &bar_window, - &part, &x, &y, &time); + &part, &x, &y, &t); obj = Qnil; @@ -4059,7 +4061,7 @@ kbd_buffer_get_event (KBOARD **kbp, /* If we didn't decide to make a switch-frame event, go ahead and return a mouse-motion event. */ if (!NILP (x) && NILP (obj)) - obj = make_lispy_movement (f, bar_window, part, x, y, time); + obj = make_lispy_movement (f, bar_window, part, x, y, t); } #endif /* HAVE_MOUSE || HAVE GPM */ else @@ -5037,7 +5039,7 @@ int double_click_count; static Lisp_Object make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, - unsigned long time) + unsigned long t) { enum window_part part; Lisp_Object posn = Qnil; @@ -5218,7 +5220,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, Fcons (posn, Fcons (Fcons (make_number (xret), make_number (yret)), - Fcons (make_number (time), + Fcons (make_number (t), extra_info)))); } @@ -5642,19 +5644,19 @@ make_lispy_event (struct input_event *event) /* On window-system frames, use the value of double-click-fuzz as is. On other frames, interpret it as a multiple of 1/8 characters. */ - struct frame *f; + struct frame *fr; int fuzz; int symbol_num; int is_double; if (WINDOWP (event->frame_or_window)) - f = XFRAME (XWINDOW (event->frame_or_window)->frame); + fr = XFRAME (XWINDOW (event->frame_or_window)->frame); else if (FRAMEP (event->frame_or_window)) - f = XFRAME (event->frame_or_window); + fr = XFRAME (event->frame_or_window); else abort (); - fuzz = FRAME_WINDOW_P (f) + fuzz = FRAME_WINDOW_P (fr) ? double_click_fuzz : double_click_fuzz / 8; if (event->modifiers & up_modifier) @@ -5927,7 +5929,7 @@ make_lispy_event (struct input_event *event) static Lisp_Object make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, - Lisp_Object x, Lisp_Object y, unsigned long time) + Lisp_Object x, Lisp_Object y, unsigned long t) { /* Is it a scroll bar movement? */ if (frame && ! NILP (bar_window)) @@ -5939,7 +5941,7 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa Fcons (list5 (bar_window, Qvertical_scroll_bar, Fcons (x, y), - make_number (time), + make_number (t), part_sym), Qnil)); } @@ -5947,7 +5949,7 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa else { Lisp_Object position; - position = make_lispy_position (frame, x, y, time); + position = make_lispy_position (frame, x, y, t); return list2 (Qmouse_movement, position); } } @@ -6236,7 +6238,7 @@ DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers, static Lisp_Object apply_modifiers (int modifiers, Lisp_Object base) { - Lisp_Object cache, index, entry, new_symbol; + Lisp_Object cache, idx, entry, new_symbol; /* Mask out upper bits. We don't know where this value's been. */ modifiers &= INTMASK; @@ -6246,8 +6248,8 @@ apply_modifiers (int modifiers, Lisp_Object base) /* The click modifier never figures into cache indices. */ cache = Fget (base, Qmodifier_cache); - XSETFASTINT (index, (modifiers & ~click_modifier)); - entry = assq_no_quit (index, cache); + XSETFASTINT (idx, (modifiers & ~click_modifier)); + entry = assq_no_quit (idx, cache); if (CONSP (entry)) new_symbol = XCDR (entry); @@ -6260,14 +6262,14 @@ apply_modifiers (int modifiers, Lisp_Object base) SBYTES (SYMBOL_NAME (base))); /* Add the new symbol to the base's cache. */ - entry = Fcons (index, new_symbol); + entry = Fcons (idx, new_symbol); Fput (base, Qmodifier_cache, Fcons (entry, cache)); /* We have the parsing info now for free, so we could add it to the caches: - XSETFASTINT (index, modifiers); + XSETFASTINT (idx, modifiers); Fput (new_symbol, Qevent_symbol_element_mask, - Fcons (base, Fcons (index, Qnil))); + Fcons (base, Fcons (idx, Qnil))); Fput (new_symbol, Qevent_symbol_elements, Fcons (base, lispy_modifier_list (modifiers))); Sadly, this is only correct if `base' is indeed a base event, @@ -6821,16 +6823,17 @@ decode_keyboard_code (struct tty_display_info *tty, return; for (i = 0, p = coding->destination; i < coding->produced_char; i++) { - struct input_event buf; + struct input_event event_buf; - EVENT_INIT (buf); - buf.code = STRING_CHAR_ADVANCE (p); - buf.kind = (ASCII_CHAR_P (buf.code) - ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); + EVENT_INIT (event_buf); + event_buf.code = STRING_CHAR_ADVANCE (p); + event_buf.kind = + (ASCII_CHAR_P (event_buf.code) + ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); /* See the comment in tty_read_avail_input. */ - buf.frame_or_window = tty->top_frame; - buf.arg = Qnil; - kbd_buffer_store_event (&buf); + event_buf.frame_or_window = tty->top_frame; + event_buf.arg = Qnil; + kbd_buffer_store_event (&event_buf); } } @@ -6890,11 +6893,11 @@ tty_read_avail_input (struct terminal *terminal, if (gpm_tty == tty) { Gpm_Event event; - struct input_event hold_quit; + struct input_event gpm_hold_quit; int gpm, fd = gpm_fd; - EVENT_INIT (hold_quit); - hold_quit.kind = NO_EVENT; + EVENT_INIT (gpm_hold_quit); + gpm_hold_quit.kind = NO_EVENT; /* gpm==1 if event received. gpm==0 if the GPM daemon has closed the connection, in which case @@ -6903,13 +6906,13 @@ tty_read_avail_input (struct terminal *terminal, select masks. gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ while (gpm = Gpm_GetEvent (&event), gpm == 1) { - nread += handle_one_term_event (tty, &event, &hold_quit); + nread += handle_one_term_event (tty, &event, &gpm_hold_quit); } if (gpm == 0) /* Presumably the GPM daemon has closed the connection. */ close_gpm (fd); - if (hold_quit.kind != NO_EVENT) - kbd_buffer_store_event (&hold_quit); + if (gpm_hold_quit.kind != NO_EVENT) + kbd_buffer_store_event (&gpm_hold_quit); if (nread) return nread; } @@ -7056,7 +7059,7 @@ tty_read_avail_input (struct terminal *terminal, return nread; } -void +static void handle_async_input (void) { interrupt_input_pending = 0; @@ -7329,8 +7332,6 @@ menu_bar_items (Lisp_Object old) int mapno; Lisp_Object oquit; - int i; - /* In order to build the menus, we need to call the keymap accessors. They all call QUIT. But this function is called during redisplay, during which a quit is fatal. So inhibit @@ -7432,15 +7433,18 @@ menu_bar_items (Lisp_Object old) } /* Add nil, nil, nil, nil at the end. */ - i = menu_bar_items_index; - if (i + 4 > XVECTOR (menu_bar_items_vector)->size) - menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil); - /* Add this item. */ - XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; - XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; - XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; - XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; - menu_bar_items_index = i; + { + int i = menu_bar_items_index; + if (i + 4 > XVECTOR (menu_bar_items_vector)->size) + menu_bar_items_vector = + larger_vector (menu_bar_items_vector, 2 * i, Qnil); + /* Add this item. */ + XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; + XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; + XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; + XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; + menu_bar_items_index = i; + } Vinhibit_quit = oquit; return menu_bar_items_vector; @@ -8118,12 +8122,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) /* Process the rest of the properties. */ for (; CONSP (item) && CONSP (XCDR (item)); item = XCDR (XCDR (item))) { - Lisp_Object key, value; + Lisp_Object ikey, value; - key = XCAR (item); + ikey = XCAR (item); value = XCAR (XCDR (item)); - if (EQ (key, QCenable)) + if (EQ (ikey, QCenable)) { /* `:enable FORM'. */ if (!NILP (Venable_disabled_menus_and_buttons)) @@ -8131,20 +8135,20 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) else PROP (TOOL_BAR_ITEM_ENABLED_P) = value; } - else if (EQ (key, QCvisible)) + else if (EQ (ikey, QCvisible)) { /* `:visible FORM'. If got a visible property and that evaluates to nil then ignore this item. */ if (NILP (menu_item_eval_property (value))) return 0; } - else if (EQ (key, QChelp)) + else if (EQ (ikey, QChelp)) /* `:help HELP-STRING'. */ PROP (TOOL_BAR_ITEM_HELP) = value; - else if (EQ (key, QCvert_only)) + else if (EQ (ikey, QCvert_only)) /* `:vert-only t/nil'. */ PROP (TOOL_BAR_ITEM_VERT_ONLY) = value; - else if (EQ (key, QClabel)) + else if (EQ (ikey, QClabel)) { const char *bad_label = "!!?GARBLED ITEM?!!"; /* `:label LABEL-STRING'. */ @@ -8153,10 +8157,10 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) : make_string (bad_label, strlen (bad_label)); have_label = 1; } - else if (EQ (key, QCfilter)) + else if (EQ (ikey, QCfilter)) /* ':filter FORM'. */ filter = value; - else if (EQ (key, QCbutton) && CONSP (value)) + else if (EQ (ikey, QCbutton) && CONSP (value)) { /* `:button (TYPE . SELECTED)'. */ Lisp_Object type, selected; @@ -8169,13 +8173,13 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) PROP (TOOL_BAR_ITEM_TYPE) = type; } } - else if (EQ (key, QCimage) + else if (EQ (ikey, QCimage) && (CONSP (value) || (VECTORP (value) && XVECTOR (value)->size == 4))) /* Value is either a single image specification or a vector of 4 such specifications for the different button states. */ PROP (TOOL_BAR_ITEM_IMAGES) = value; - else if (EQ (key, Qrtl)) + else if (EQ (ikey, Qrtl)) /* ':rtl STRING' */ PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value; } @@ -8184,35 +8188,34 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) if (!have_label) { /* Try to make one from caption and key. */ - Lisp_Object key = PROP (TOOL_BAR_ITEM_KEY); - Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION); - const char *label = SYMBOLP (key) ? SSDATA (SYMBOL_NAME (key)) : ""; - const char *caption = STRINGP (capt) ? SSDATA (capt) : ""; + Lisp_Object tkey = PROP (TOOL_BAR_ITEM_KEY); + Lisp_Object tcapt = PROP (TOOL_BAR_ITEM_CAPTION); + const char *label = SYMBOLP (tkey) ? SSDATA (SYMBOL_NAME (tkey)) : ""; + const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : ""; EMACS_INT max_lbl = 2 * tool_bar_max_label_size; char *buf = (char *) xmalloc (max_lbl + 1); Lisp_Object new_lbl; - size_t caption_len = strlen (caption); + size_t caption_len = strlen (capt); - if (caption_len <= max_lbl && caption[0] != '\0') + if (caption_len <= max_lbl && capt[0] != '\0') { - strcpy (buf, caption); + strcpy (buf, capt); while (caption_len > 0 && buf[caption_len - 1] == '.') caption_len--; buf[caption_len] = '\0'; - label = caption = buf; + label = capt = buf; } if (strlen (label) <= max_lbl && label[0] != '\0') { - int i; + int j; if (label != buf) strcpy (buf, label); - for (i = 0; buf[i] != '\0'; ++i) - if (buf[i] == '-') - buf[i] = ' '; + for (j = 0; buf[j] != '\0'; ++j) + if (buf[j] == '-') + buf[j] = ' '; label = buf; - } else label = ""; @@ -8871,7 +8874,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, /* The length of the echo buffer when we started reading, and the length of this_command_keys when we started reading. */ - int echo_start; + int echo_start IF_LINT (= 0); int keys_start; /* The number of keymaps we're scanning right now, and the number of @@ -8949,7 +8952,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, Lisp_Object first_event; #endif - Lisp_Object original_uppercase; + Lisp_Object original_uppercase IF_LINT (= Qnil); int original_uppercase_position = -1; /* Gets around Microsoft compiler limitations. */ @@ -8964,9 +8967,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, int junk; #endif - struct gcpro gcpro1; + struct gcpro outer_gcpro1; - GCPRO1 (fake_prefixed_keys); + GCPRO1_VAR (fake_prefixed_keys, outer_gcpro); raw_keybuf_count = 0; last_nonmenu_event = Qnil; @@ -9128,7 +9131,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, while those allow us to restart the entire key sequence, echo_local_start and keys_local_start allow us to throw away just one key. */ - int echo_local_start, keys_local_start, local_first_binding; + int echo_local_start IF_LINT (= 0); + int keys_local_start, local_first_binding; eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); eassert (indec.start <= indec.end); @@ -9260,7 +9264,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (EQ (key, Qt)) { unbind_to (count, Qnil); - UNGCPRO; + UNGCPRO_VAR (outer_gcpro); return -1; } @@ -9838,7 +9842,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t && INTEGERP (key) && ((CHARACTERP (make_number (XINT (key) & ~CHAR_MODIFIER_MASK)) - && UPPERCASEP (XINT (key) & ~CHAR_MODIFIER_MASK)) + && uppercasep (XINT (key) & ~CHAR_MODIFIER_MASK)) || (XINT (key) & shift_modifier))) { Lisp_Object new_key; @@ -9849,7 +9853,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (XINT (key) & shift_modifier) XSETINT (new_key, XINT (key) & ~shift_modifier); else - XSETINT (new_key, (DOWNCASE (XINT (key) & ~CHAR_MODIFIER_MASK) + XSETINT (new_key, (downcase (XINT (key) & ~CHAR_MODIFIER_MASK) | (XINT (key) & CHAR_MODIFIER_MASK))); /* We have to do this unconditionally, regardless of whether @@ -9877,13 +9881,13 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, || (INTEGERP (key) && (KEY_TO_CHAR (key) < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size) - && UPPERCASEP (KEY_TO_CHAR (key)))) + && uppercasep (KEY_TO_CHAR (key)))) { Lisp_Object new_key = (modifiers & shift_modifier ? apply_modifiers (modifiers & ~shift_modifier, XCAR (breakdown)) - : make_number (DOWNCASE (KEY_TO_CHAR (key)) | modifiers)); + : make_number (downcase (KEY_TO_CHAR (key)) | modifiers)); original_uppercase = key; original_uppercase_position = t - 1; @@ -9943,7 +9947,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, add_command_key (keybuf[t]); } - UNGCPRO; + UNGCPRO_VAR (outer_gcpro); return t; } @@ -9990,11 +9994,11 @@ is nil, then the event will be put off until after the current key sequence. sequences, where they wouldn't conflict with ordinary bindings. See `function-key-map' for more details. -The optional fifth argument COMMAND-LOOP, if non-nil, means +The optional fifth argument CMD-LOOP, if non-nil, means that this key sequence is being read by something that will read commands one after another. It should be nil if the caller will read just one key sequence. */) - (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) + (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop) { Lisp_Object keybuf[30]; register int i; @@ -10006,9 +10010,9 @@ will read just one key sequence. */) QUIT; specbind (Qinput_method_exit_on_first_char, - (NILP (command_loop) ? Qt : Qnil)); + (NILP (cmd_loop) ? Qt : Qnil)); specbind (Qinput_method_use_echo_area, - (NILP (command_loop) ? Qt : Qnil)); + (NILP (cmd_loop) ? Qt : Qnil)); memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); @@ -10051,7 +10055,7 @@ will read just one key sequence. */) DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, Sread_key_sequence_vector, 1, 5, 0, doc: /* Like `read-key-sequence' but always return a vector. */) - (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) + (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop) { Lisp_Object keybuf[30]; register int i; @@ -10063,9 +10067,9 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, QUIT; specbind (Qinput_method_exit_on_first_char, - (NILP (command_loop) ? Qt : Qnil)); + (NILP (cmd_loop) ? Qt : Qnil)); specbind (Qinput_method_use_echo_area, - (NILP (command_loop) ? Qt : Qnil)); + (NILP (cmd_loop) ? Qt : Qnil)); memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); diff --git a/src/keyboard.h b/src/keyboard.h index 10bf16d5c5c..00745a09140 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -90,7 +90,7 @@ struct kboard /* User-supplied table to translate input characters through. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table); - + /* Last command that may be repeated by `repeat'. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command); @@ -140,12 +140,12 @@ struct kboard /* Keymap mapping keys to alternative preferred forms. See the DEFVAR for more documentation. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map); - + /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. See the DEFVAR for more documentation. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map); - + /* Minibufferless frames on this display use this frame's minibuffer. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame); @@ -494,6 +494,7 @@ extern int input_polling_used (void); extern void clear_input_pending (void); extern int requeued_events_pending_p (void); extern void bind_polling_period (int); +extern int make_ctrl_char (int); extern void stuff_buffered_input (Lisp_Object); extern void clear_waiting_for_input (void); extern void swallow_events (int); @@ -517,4 +518,8 @@ extern void add_user_signal (int, const char *); extern int tty_read_avail_input (struct terminal *, int, struct input_event *); extern EMACS_TIME timer_check (int); +extern void mark_kboards (void); +#ifdef WINDOWSNT +extern const char *const lispy_function_keys[]; +#endif diff --git a/src/keymap.c b/src/keymap.c index 4459ef07d68..06968a0d944 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -34,9 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "keymap.h" #include "window.h" -/* The number of elements in keymap vectors. */ -#define DENSE_TABLE_SIZE (0200) - /* Actually allocate storage for these variables */ Lisp_Object current_global_map; /* Current global keymap */ @@ -191,8 +188,9 @@ when reading a key-sequence to be looked-up in this keymap. */) If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR is zero as well), return Qt. - ERROR controls how we respond if OBJECT isn't a keymap. - If ERROR is non-zero, signal an error; otherwise, just return Qnil. + ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap. + If ERROR_IF_NOT_KEYMAP is non-zero, signal an error; otherwise, + just return Qnil. Note that most of the time, we don't want to pursue autoloads. Functions like Faccessible_keymaps which scan entire keymap trees @@ -204,7 +202,7 @@ when reading a key-sequence to be looked-up in this keymap. */) do_autoload which can GC. */ Lisp_Object -get_keymap (Lisp_Object object, int error, int autoload) +get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload) { Lisp_Object tem; @@ -222,7 +220,7 @@ get_keymap (Lisp_Object object, int error, int autoload) /* Should we do an autoload? Autoload forms for keymaps have Qkeymap as their fifth element. */ - if ((autoload || !error) && EQ (XCAR (tem), Qautoload) + if ((autoload || !error_if_not_keymap) && EQ (XCAR (tem), Qautoload) && SYMBOLP (object)) { Lisp_Object tail; @@ -247,7 +245,7 @@ get_keymap (Lisp_Object object, int error, int autoload) } end: - if (error) + if (error_if_not_keymap) wrong_type_argument (Qkeymapp, object); return Qnil; } @@ -255,7 +253,7 @@ get_keymap (Lisp_Object object, int error, int autoload) /* Return the parent map of KEYMAP, or nil if it has none. We assume that KEYMAP is a valid keymap. */ -Lisp_Object +static Lisp_Object keymap_parent (Lisp_Object keymap, int autoload) { Lisp_Object list; @@ -283,7 +281,7 @@ If KEYMAP has no parent, return nil. */) } /* Check whether MAP is one of MAPS parents. */ -int +static int keymap_memberp (Lisp_Object map, Lisp_Object maps) { if (NILP (map)) return 0; @@ -468,19 +466,19 @@ access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int au /* See if there is a meta-map. If there's none, there is no binding for IDX, unless a default binding exists in MAP. */ struct gcpro gcpro1; - Lisp_Object meta_map; + Lisp_Object event_meta_map; GCPRO1 (map); /* A strange value in which Meta is set would cause infinite recursion. Protect against that. */ if (XINT (meta_prefix_char) & CHAR_META) meta_prefix_char = make_number (27); - meta_map = get_keymap (access_keymap (map, meta_prefix_char, - t_ok, noinherit, autoload), - 0, autoload); + event_meta_map = get_keymap (access_keymap (map, meta_prefix_char, + t_ok, noinherit, autoload), + 0, autoload); UNGCPRO; - if (CONSP (meta_map)) + if (CONSP (event_meta_map)) { - map = meta_map; + map = event_meta_map; idx = make_number (XUINT (idx) & ~meta_modifier); } else if (t_ok) @@ -598,7 +596,7 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val) /* Call FUN for every binding in MAP and stop at (and return) the parent. FUN is called with 4 arguments: FUN (KEY, BINDING, ARGS, DATA). */ -Lisp_Object +static Lisp_Object map_keymap_internal (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, @@ -960,7 +958,7 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def) EXFUN (Fcopy_keymap, 1); -Lisp_Object +static Lisp_Object copy_keymap_item (Lisp_Object elt) { Lisp_Object res, tem; @@ -1142,10 +1140,10 @@ binding KEY to DEF is added at the front of KEYMAP. */) int i = ASIZE (def); while (--i >= 0) { - Lisp_Object c = AREF (def, i); - if (CONSP (c) && lucid_event_type_list_p (c)) - c = Fevent_convert_list (c); - ASET (tmp, i, c); + Lisp_Object defi = AREF (def, i); + if (CONSP (defi) && lucid_event_type_list_p (defi)) + defi = Fevent_convert_list (defi); + ASET (tmp, i, defi); } def = tmp; } @@ -1337,7 +1335,7 @@ define_as_prefix (Lisp_Object keymap, Lisp_Object c) /* Append a key to the end of a key sequence. We always make a vector. */ -Lisp_Object +static Lisp_Object append_key (Lisp_Object key_sequence, Lisp_Object key) { Lisp_Object args[2]; @@ -2439,7 +2437,7 @@ around function keys and event symbols. */) return Qnil; } -char * +static char * push_text_char_description (register unsigned int c, register char *p) { if (c >= 0200) @@ -2774,8 +2772,8 @@ remapped command in the returned list. */) considered remapped sequences yet, copy them over and process them. */ || (!remapped && (sequences = remapped_sequences, - remapped = 1), - CONSP (sequences))) + remapped = 1, + CONSP (sequences)))) { Lisp_Object sequence, function; @@ -2815,9 +2813,9 @@ remapped command in the returned list. */) seems to be only one menu item to report. */ if (! NILP (sequence)) { - Lisp_Object tem; - tem = Faref (sequence, make_number (ASIZE (sequence) - 1)); - if (STRINGP (tem)) + Lisp_Object tem1; + tem1 = Faref (sequence, make_number (ASIZE (sequence) - 1)); + if (STRINGP (tem1)) Faset (sequence, make_number (ASIZE (sequence) - 1), build_string ("(any string)")); } @@ -3122,13 +3120,13 @@ key binding\n\ /* Delete from MAPS each element that is for the menu bar. */ for (list = maps; CONSP (list); list = XCDR (list)) { - Lisp_Object elt, prefix, tem; + Lisp_Object elt, elt_prefix, tem; elt = XCAR (list); - prefix = Fcar (elt); - if (XVECTOR (prefix)->size >= 1) + elt_prefix = Fcar (elt); + if (XVECTOR (elt_prefix)->size >= 1) { - tem = Faref (prefix, make_number (0)); + tem = Faref (elt_prefix, make_number (0)); if (EQ (tem, Qmenu_bar)) maps = Fdelq (elt, maps); } @@ -3153,10 +3151,10 @@ key binding\n\ for (; CONSP (maps); maps = XCDR (maps)) { - register Lisp_Object elt, prefix, tail; + register Lisp_Object elt, elt_prefix, tail; elt = XCAR (maps); - prefix = Fcar (elt); + elt_prefix = Fcar (elt); sub_shadows = Qnil; @@ -3168,8 +3166,8 @@ key binding\n\ /* If the sequence by which we reach this keymap is zero-length, then the shadow map for this keymap is just SHADOW. */ - if ((STRINGP (prefix) && SCHARS (prefix) == 0) - || (VECTORP (prefix) && XVECTOR (prefix)->size == 0)) + if ((STRINGP (elt_prefix) && SCHARS (elt_prefix) == 0) + || (VECTORP (elt_prefix) && XVECTOR (elt_prefix)->size == 0)) ; /* If the sequence by which we reach this keymap actually has some elements, then the sequence's definition in SHADOW is @@ -3195,12 +3193,12 @@ key binding\n\ for (tail = orig_maps; !EQ (tail, maps); tail = XCDR (tail)) { Lisp_Object tem; - tem = Fequal (Fcar (XCAR (tail)), prefix); + tem = Fequal (Fcar (XCAR (tail)), elt_prefix); if (!NILP (tem)) sub_shadows = Fcons (XCDR (XCAR (tail)), sub_shadows); } - describe_map (Fcdr (elt), prefix, + describe_map (Fcdr (elt), elt_prefix, transl ? describe_translation : describe_command, partial, sub_shadows, &seen, nomenu, mention_shadow); diff --git a/src/lisp.h b/src/lisp.h index e4788e63f5b..9cbaf24cacf 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -27,9 +27,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ types of run time checks for Lisp objects. */ #ifdef GC_CHECK_CONS_LIST -#define CHECK_CONS_LIST() check_cons_list() +extern void check_cons_list (void); +#define CHECK_CONS_LIST() check_cons_list () #else -#define CHECK_CONS_LIST() ((void)0) +#define CHECK_CONS_LIST() ((void) 0) #endif /* These are default choices for the types to use. */ @@ -85,7 +86,7 @@ extern void die (const char *, const char *, int) NO_RETURN; /* Define an Emacs version of "assert", since some system ones are flaky. */ #ifndef ENABLE_CHECKING -#define eassert(X) (void) 0 +#define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */ #else /* ENABLE_CHECKING */ #if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__) #define eassert(cond) CHECK(cond,"assertion failed: " #cond) @@ -841,6 +842,9 @@ struct Lisp_Vector #endif /* not __GNUC__ */ +/* Nonzero iff C is an ASCII character. */ +#define ASCII_CHAR_P(c) ((unsigned) (c) < 0x80) + /* Almost equivalent to Faref (CT, IDX) with optimization for ASCII characters. Do not check validity of CT. */ #define CHAR_TABLE_REF(CT, IDX) \ @@ -2046,50 +2050,6 @@ extern int pending_signals; #define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) -/* Variables used locally in the following case handling macros. */ -extern int case_temp1; -extern Lisp_Object case_temp2; - -/* Current buffer's map from characters to lower-case characters. */ - -#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table) - -/* Current buffer's map from characters to upper-case characters. */ - -#define UPCASE_TABLE BVAR (current_buffer, upcase_table) - -/* Downcase a character, or make no change if that cannot be done. */ - -#define DOWNCASE(CH) \ - ((case_temp1 = (CH), \ - case_temp2 = CHAR_TABLE_REF (DOWNCASE_TABLE, case_temp1), \ - NATNUMP (case_temp2)) \ - ? XFASTINT (case_temp2) : case_temp1) - -/* 1 if CH is upper case. */ - -#define UPPERCASEP(CH) (DOWNCASE (CH) != (CH)) - -/* 1 if CH is neither upper nor lower case. */ - -#define NOCASEP(CH) (UPCASE1 (CH) == (CH)) - -/* 1 if CH is lower case. */ - -#define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH)) - -/* Upcase a character, or make no change if that cannot be done. */ - -#define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH)) - -/* Upcase a character known to be not upper case. */ - -#define UPCASE1(CH) \ - ((case_temp1 = (CH), \ - case_temp2 = CHAR_TABLE_REF (UPCASE_TABLE, case_temp1), \ - NATNUMP (case_temp2)) \ - ? XFASTINT (case_temp2) : case_temp1) - extern Lisp_Object Vascii_downcase_table, Vascii_upcase_table; extern Lisp_Object Vascii_canon_table, Vascii_eqv_table; @@ -2155,126 +2115,143 @@ struct gcpro || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS) +#define GCPRO1(var) \ + GCPRO1_VAR (var, gcpro) +#define GCPRO2(var1, var2) \ + GCPRO2_VAR (var1, var2, gcpro) +#define GCPRO3(var1, var2, var3) \ + GCPRO3_VAR (var1, var2, var3, gcpro) +#define GCPRO4(var1, var2, var3, var4) \ + GCPRO4_VAR (var1, var2, var3, var4, gcpro) +#define GCPRO5(var1, var2, var3, var4, var5) \ + GCPRO5_VAR (var1, var2, var3, var4, var5, gcpro) +#define GCPRO6(var1, var2, var3, var4, var5, var6) \ + GCPRO6_VAR (var1, var2, var3, var4, var5, var6, gcpro) +#define UNGCPRO UNGCPRO_VAR (gcpro) + #if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS /* Do something silly with gcproN vars just so gcc shuts up. */ /* You get warnings from MIPSPro... */ -#define GCPRO1(varname) ((void) gcpro1) -#define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1)) -#define GCPRO3(varname1, varname2, varname3) \ - (((void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define GCPRO4(varname1, varname2, varname3, varname4) \ - (((void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ - (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ - (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define UNGCPRO ((void) 0) +#define GCPRO1_VAR(var, gcpro) ((void) gcpro##1) +#define GCPRO2_VAR(var1, var2, gcpro) \ + ((void) gcpro##2, (void) gcpro##1) +#define GCPRO3_VAR(var1, var2, var3, gcpro) \ + ((void) gcpro##3, (void) gcpro##2, (void) gcpro##1) +#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \ + ((void) gcpro##4, (void) gcpro##3, (void) gcpro##2, (void) gcpro##1) +#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \ + ((void) gcpro##5, (void) gcpro##4, (void) gcpro##3, (void) gcpro##2, \ + (void) gcpro##1) +#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \ + ((void) gcpro##6, (void) gcpro##5, (void) gcpro##4, (void) gcpro##3, \ + (void) gcpro##2, (void) gcpro##1) +#define UNGCPRO_VAR(gcpro) ((void) 0) #else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ #ifndef DEBUG_GCPRO -#define GCPRO1(varname) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ - gcprolist = &gcpro1; } - -#define GCPRO2(varname1, varname2) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcprolist = &gcpro2; } - -#define GCPRO3(varname1, varname2, varname3) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcprolist = &gcpro3; } - -#define GCPRO4(varname1, varname2, varname3, varname4) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcprolist = &gcpro4; } - -#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ - gcprolist = &gcpro5; } - -#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ - gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \ - gcprolist = &gcpro6; } - -#define UNGCPRO (gcprolist = gcpro1.next) +#define GCPRO1_VAR(var, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var; gcpro##1.nvars = 1; \ + gcprolist = &gcpro##1; } + +#define GCPRO2_VAR(var1, var2, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcprolist = &gcpro##2; } + +#define GCPRO3_VAR(var1, var2, var3, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcprolist = &gcpro##3; } + +#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcprolist = &gcpro##4; } + +#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \ + gcprolist = &gcpro##5; } + +#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \ + gcpro##6.next = &gcpro##5; gcpro##6.var = &var6; gcpro##6.nvars = 1; \ + gcprolist = &gcpro##6; } + +#define UNGCPRO_VAR(gcpro) (gcprolist = gcpro##1.next) #else extern int gcpro_level; -#define GCPRO1(varname) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level++; \ - gcprolist = &gcpro1; } - -#define GCPRO2(varname1, varname2) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro2.level = gcpro_level++; \ - gcprolist = &gcpro2; } - -#define GCPRO3(varname1, varname2, varname3) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro3.level = gcpro_level++; \ - gcprolist = &gcpro3; } - -#define GCPRO4(varname1, varname2, varname3, varname4) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro4.level = gcpro_level++; \ - gcprolist = &gcpro4; } - -#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ - gcpro5.level = gcpro_level++; \ - gcprolist = &gcpro5; } - -#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ - gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \ - gcpro6.level = gcpro_level++; \ - gcprolist = &gcpro6; } - -#define UNGCPRO \ - ((--gcpro_level != gcpro1.level) \ - ? (abort (), 0) \ - : ((gcprolist = gcpro1.next), 0)) +#define GCPRO1_VAR(var, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level++; \ + gcprolist = &gcpro##1; } + +#define GCPRO2_VAR(var1, var2, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##2.level = gcpro_level++; \ + gcprolist = &gcpro##2; } + +#define GCPRO3_VAR(var1, var2, var3, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##3.level = gcpro_level++; \ + gcprolist = &gcpro##3; } + +#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##4.level = gcpro_level++; \ + gcprolist = &gcpro##4; } + +#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \ + gcpro##5.level = gcpro_level++; \ + gcprolist = &gcpro##5; } + +#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \ + gcpro##6.next = &gcpro##5; gcpro##6.var = &var6; gcpro##6.nvars = 1; \ + gcpro##6.level = gcpro_level++; \ + gcprolist = &gcpro##6; } + +#define UNGCPRO_VAR(gcpro) \ + ((--gcpro_level != gcpro##1.level) \ + ? (abort (), 0) \ + : ((gcprolist = gcpro##1.next), 0)) #endif /* DEBUG_GCPRO */ #endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ @@ -2542,7 +2519,10 @@ extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y); /* Defined in fringe.c */ extern void syms_of_fringe (void); extern void init_fringe (void); +#ifdef HAVE_WINDOW_SYSTEM +extern void mark_fringe_data (void); extern void init_fringe_once (void); +#endif /* HAVE_WINDOW_SYSTEM */ /* Defined in image.c */ extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; @@ -2606,6 +2586,7 @@ extern void syms_of_insdel (void); /* Defined in dispnew.c */ extern Lisp_Object selected_frame; +extern Lisp_Object Vwindow_system; EXFUN (Fding, 1); EXFUN (Fredraw_frame, 1); EXFUN (Fsleep_for, 2); @@ -2788,6 +2769,7 @@ EXFUN (Fprint, 2); EXFUN (Ferror_message_string, 1); extern Lisp_Object Qstandard_output; extern Lisp_Object Qexternal_debugging_output; +extern void debug_output_compilation_hack (int); extern void temp_output_buffer_setup (const char *); extern int print_level; extern Lisp_Object Qprint_escape_newlines; @@ -2899,8 +2881,10 @@ extern Lisp_Object safe_call (int, Lisp_Object *); extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); extern void init_eval (void); +extern void mark_backtrace (void); extern void syms_of_eval (void); +/* Defined in editfns.c */ extern Lisp_Object Qfield; EXFUN (Fcurrent_message, 0); EXFUN (Fgoto_char, 1); @@ -2940,6 +2924,8 @@ extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int); extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int); extern void init_editfns (void); +const char *get_system_name (void); +const char *get_operating_system_release (void); extern void syms_of_editfns (void); EXFUN (Fconstrain_to_field, 5); EXFUN (Ffield_end, 3); @@ -2996,12 +2982,14 @@ extern EMACS_INT marker_byte_position (Lisp_Object); extern void clear_charpos_cache (struct buffer *); extern EMACS_INT charpos_to_bytepos (EMACS_INT); extern EMACS_INT buf_charpos_to_bytepos (struct buffer *, EMACS_INT); +extern EMACS_INT verify_bytepos (EMACS_INT charpos); extern EMACS_INT buf_bytepos_to_charpos (struct buffer *, EMACS_INT); extern void unchain_marker (struct Lisp_Marker *marker); extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT); extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT); +extern int count_markers (struct buffer *); extern void syms_of_marker (void); /* Defined in fileio.c */ @@ -3010,6 +2998,7 @@ extern Lisp_Object Qfile_error; extern Lisp_Object Qfile_exists_p; extern Lisp_Object Qfile_directory_p; extern Lisp_Object Qinsert_file_contents; +extern Lisp_Object Qfile_name_history; EXFUN (Ffind_file_name_handler, 2); EXFUN (Ffile_name_as_directory, 1); EXFUN (Fexpand_file_name, 2); @@ -3051,6 +3040,10 @@ EXFUN (Fset_match_data, 2); EXFUN (Fmatch_beginning, 1); EXFUN (Fmatch_end, 1); extern void record_unwind_save_match_data (void); +struct re_registers; +extern struct re_pattern_buffer *compile_pattern (Lisp_Object, + struct re_registers *, + Lisp_Object, int, int); extern int fast_string_match (Lisp_Object, Lisp_Object); extern int fast_c_string_match_ignore_case (Lisp_Object, const char *); extern int fast_string_match_ignore_case (Lisp_Object, Lisp_Object); @@ -3142,6 +3135,7 @@ extern void cmd_error_internal (Lisp_Object, const char *); extern Lisp_Object command_loop_1 (void); extern Lisp_Object recursive_edit_1 (void); extern void record_auto_save (void); +extern void force_auto_save_soon (void); extern void init_keyboard (void); extern void syms_of_keyboard (void); extern void keys_of_keyboard (void); @@ -3194,6 +3188,7 @@ extern Lisp_Object decode_env_path (const char *, const char *); extern Lisp_Object empty_unibyte_string, empty_multibyte_string; extern Lisp_Object Qfile_name_handler_alist; extern void (*fatal_error_signal_hook) (void); +extern SIGTYPE fatal_error_signal (int); EXFUN (Fkill_emacs, 1) NO_RETURN; #if HAVE_SETLOCALE void fixup_locale (void); @@ -3341,6 +3336,8 @@ extern void child_setup_tty (int); extern void setup_pty (int); extern int set_window_size (int, int, int); extern void create_process (Lisp_Object, char **, Lisp_Object); +extern long get_random (void); +extern void seed_random (long); extern int emacs_open (const char *, int, int); extern int emacs_close (int); extern int emacs_read (int, char *, unsigned int); @@ -3387,6 +3384,7 @@ extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, /* Defined in term.c */ extern int *char_ins_del_vector; +extern void mark_ttys (void); extern void syms_of_term (void); extern void fatal (const char *msgid, ...) NO_RETURN; @@ -3533,6 +3531,13 @@ extern void init_system_name (void); && (circular_list_error ((list)), 1))) \ : 0))) +/* Use this to suppress gcc's `...may be used before initialized' warnings. */ +#ifdef lint +# define IF_LINT(Code) Code +#else +# define IF_LINT(Code) /* empty */ +#endif + /* The ubiquitous min and max macros. */ #ifdef max diff --git a/src/lread.c b/src/lread.c index c8c07bed476..7a8d7cf9a6a 100644 --- a/src/lread.c +++ b/src/lread.c @@ -370,15 +370,15 @@ unreadchar (Lisp_Object readcharfun, int c) else if (BUFFERP (readcharfun)) { struct buffer *b = XBUFFER (readcharfun); + EMACS_INT charpos = BUF_PT (b); EMACS_INT bytepos = BUF_PT_BYTE (b); - BUF_PT (b)--; if (! NILP (BVAR (b, enable_multibyte_characters))) BUF_DEC_POS (b, bytepos); else bytepos--; - BUF_PT_BYTE (b) = bytepos; + SET_BUF_PT_BOTH (b, charpos - 1, bytepos); } else if (MARKERP (readcharfun)) { @@ -1133,10 +1133,10 @@ Return t if the file exists and loads successfully. */) Also, just loading a file recursively is not always an error in the general case; the second load may do something different. */ { - int count = 0; + int load_count = 0; Lisp_Object tem; for (tem = Vloads_in_progress; CONSP (tem); tem = XCDR (tem)) - if (!NILP (Fequal (found, XCAR (tem))) && (++count > 3)) + if (!NILP (Fequal (found, XCAR (tem))) && (++load_count > 3)) { if (fd >= 0) emacs_close (fd); @@ -1787,8 +1787,8 @@ readevalloop (Lisp_Object readcharfun, to a different value when evaluated. */ if (BUFFERP (readcharfun)) { - struct buffer *b = XBUFFER (readcharfun); - if (BUF_PT (b) == BUF_ZV (b)) + struct buffer *buf = XBUFFER (readcharfun); + if (BUF_PT (buf) == BUF_ZV (buf)) continue_reading_p = 0; } } @@ -2810,7 +2810,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) { char *p = read_buffer; char *end = read_buffer + read_buffer_size; - register int c; + register int ch; /* Nonzero if we saw an escape sequence specifying a multibyte character. */ int force_multibyte = 0; @@ -2820,8 +2820,8 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) int cancel = 0; int nchars = 0; - while ((c = READCHAR) >= 0 - && c != '\"') + while ((ch = READCHAR) >= 0 + && ch != '\"') { if (end - p < MAX_MULTIBYTE_LENGTH) { @@ -2832,44 +2832,44 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) end = read_buffer + read_buffer_size; } - if (c == '\\') + if (ch == '\\') { int modifiers; - c = read_escape (readcharfun, 1); + ch = read_escape (readcharfun, 1); - /* C is -1 if \ newline has just been seen */ - if (c == -1) + /* CH is -1 if \ newline has just been seen */ + if (ch == -1) { if (p == read_buffer) cancel = 1; continue; } - modifiers = c & CHAR_MODIFIER_MASK; - c = c & ~CHAR_MODIFIER_MASK; + modifiers = ch & CHAR_MODIFIER_MASK; + ch = ch & ~CHAR_MODIFIER_MASK; - if (CHAR_BYTE8_P (c)) + if (CHAR_BYTE8_P (ch)) force_singlebyte = 1; - else if (! ASCII_CHAR_P (c)) + else if (! ASCII_CHAR_P (ch)) force_multibyte = 1; - else /* i.e. ASCII_CHAR_P (c) */ + else /* i.e. ASCII_CHAR_P (ch) */ { /* Allow `\C- ' and `\C-?'. */ if (modifiers == CHAR_CTL) { - if (c == ' ') - c = 0, modifiers = 0; - else if (c == '?') - c = 127, modifiers = 0; + if (ch == ' ') + ch = 0, modifiers = 0; + else if (ch == '?') + ch = 127, modifiers = 0; } if (modifiers & CHAR_SHIFT) { /* Shift modifier is valid only with [A-Za-z]. */ - if (c >= 'A' && c <= 'Z') + if (ch >= 'A' && ch <= 'Z') modifiers &= ~CHAR_SHIFT; - else if (c >= 'a' && c <= 'z') - c -= ('a' - 'A'), modifiers &= ~CHAR_SHIFT; + else if (ch >= 'a' && ch <= 'z') + ch -= ('a' - 'A'), modifiers &= ~CHAR_SHIFT; } if (modifiers & CHAR_META) @@ -2877,7 +2877,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) /* Move the meta bit to the right place for a string. */ modifiers &= ~CHAR_META; - c = BYTE8_TO_CHAR (c | 0x80); + ch = BYTE8_TO_CHAR (ch | 0x80); force_singlebyte = 1; } } @@ -2885,20 +2885,20 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) /* Any modifiers remaining are invalid. */ if (modifiers) error ("Invalid modifier in string"); - p += CHAR_STRING (c, (unsigned char *) p); + p += CHAR_STRING (ch, (unsigned char *) p); } else { - p += CHAR_STRING (c, (unsigned char *) p); - if (CHAR_BYTE8_P (c)) + p += CHAR_STRING (ch, (unsigned char *) p); + if (CHAR_BYTE8_P (ch)) force_singlebyte = 1; - else if (! ASCII_CHAR_P (c)) + else if (! ASCII_CHAR_P (ch)) force_multibyte = 1; } nchars++; } - if (c < 0) + if (ch < 0) end_of_file_error (); /* If purifying, and string starts with \ newline, @@ -2917,8 +2917,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) p = read_buffer + nchars; } else - /* Otherwise, READ_BUFFER contains only ASCII. */ - ; + { + /* Otherwise, READ_BUFFER contains only ASCII. */ + } /* We want readchar_count to be the number of characters, not bytes. Hence we adjust for multibyte characters in the diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 7a702fd45bf..62c40ca1f94 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -221,7 +221,7 @@ GLOBAL_SOURCES = dosfns.c msdos.c \ region-cache.c sound.c atimer.c \ doprnt.c intervals.c textprop.c composite.c SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ - xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o + xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o obj = $(GLOBAL_SOURCES:.c=.o) globals.h: gl-stamp @@ -386,6 +386,7 @@ $(BLD)/alloc.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -396,7 +397,6 @@ $(BLD)/alloc.$(O) : \ $(SRC)/frame.h \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/puresize.h \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ @@ -484,8 +484,10 @@ $(BLD)/callproc.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -497,7 +499,6 @@ $(BLD)/callproc.$(O) : \ $(SRC)/dispextern.h \ $(SRC)/epaths.h \ $(SRC)/frame.h \ - $(PROCESS_H) \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/systty.h \ @@ -653,6 +654,7 @@ $(BLD)/dired.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/dir.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/lib/filemode.h \ $(LISP_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ @@ -662,7 +664,6 @@ $(BLD)/dired.$(O) : \ $(SRC)/coding.h \ $(SRC)/commands.h \ $(SRC)/composite.h \ - $(EMACS_ROOT)/lib/filemode.h \ $(SRC)/ndir.h \ $(SRC)/regex.h \ $(SRC)/systime.h @@ -673,6 +674,7 @@ $(BLD)/dispnew.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -687,7 +689,6 @@ $(BLD)/dispnew.$(O) : \ $(SRC)/indent.h \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/termchar.h \ @@ -726,6 +727,7 @@ $(BLD)/editfns.$(O) : \ $(EMACS_ROOT)/nt/inc/pwd.h \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/lib/intprops.h \ $(EMACS_ROOT)/lib/strftime.h \ $(LISP_H) \ $(SRC)/atimer.h \ @@ -746,8 +748,10 @@ $(BLD)/emacs.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -756,15 +760,14 @@ $(BLD)/emacs.$(O) : \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ $(SRC)/frame.h \ - $(SRC)/gnutls.h \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ - $(PROCESS_H) \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/systty.h \ $(SRC)/termhooks.h \ + $(SRC)/unexec.h \ $(SRC)/w32.h \ $(SRC)/w32gui.h \ $(SRC)/w32heap.h \ @@ -836,6 +839,7 @@ $(BLD)/fns.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/langinfo.h \ $(EMACS_ROOT)/nt/inc/nl_types.h \ + $(EMACS_ROOT)/nt/inc/stdint.h \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(EMACS_ROOT)/lib/md5.h \ @@ -1029,6 +1033,7 @@ $(BLD)/keyboard.$(O) : \ $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1043,7 +1048,6 @@ $(BLD)/keyboard.$(O) : \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ $(SRC)/macros.h \ - $(PROCESS_H) \ $(SRC)/puresize.h \ $(SRC)/syntax.h \ $(SRC)/syssignal.h \ @@ -1181,11 +1185,11 @@ $(BLD)/w32.$(O) : \ $(EMACS_ROOT)/nt/inc/sys/socket.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/coding.h \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ $(SRC)/ndir.h \ - $(PROCESS_H) \ $(SRC)/systime.h \ $(SRC)/w32.h \ $(SRC)/w32gui.h \ @@ -1224,11 +1228,11 @@ $(BLD)/w32proc.$(O) : \ $(EMACS_ROOT)/nt/inc/sys/file.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/character.h \ $(SRC)/coding.h \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ - $(PROCESS_H) \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/syswait.h \ @@ -1260,6 +1264,7 @@ $(BLD)/print.$(O) : \ $(EMACS_ROOT)/lib/ftoastr.h \ $(EMACS_ROOT)/lib/intprops.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1273,7 +1278,6 @@ $(BLD)/print.$(O) : \ $(SRC)/frame.h \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/systime.h \ $(SRC)/termchar.h \ $(SRC)/termhooks.h \ @@ -1288,9 +1292,11 @@ $(BLD)/process.$(O) : \ $(EMACS_ROOT)/nt/inc/arpa/inet.h \ $(EMACS_ROOT)/nt/inc/netinet/in.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/socket.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1301,7 +1307,6 @@ $(BLD)/process.$(O) : \ $(SRC)/dispextern.h \ $(SRC)/frame.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/sysselect.h \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ @@ -1414,10 +1419,12 @@ $(BLD)/sysdep.$(O) : \ $(EMACS_ROOT)/nt/inc/pwd.h \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/socket.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(EMACS_ROOT)/lib/ignore-value.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/cm.h \ @@ -1426,7 +1433,6 @@ $(BLD)/sysdep.$(O) : \ $(SRC)/dispextern.h \ $(SRC)/frame.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/sysselect.h \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ @@ -1444,6 +1450,7 @@ $(BLD)/term.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/atimer.h \ @@ -1466,6 +1473,7 @@ $(BLD)/term.$(O) : \ $(SRC)/termchar.h \ $(SRC)/termhooks.h \ $(SRC)/termopts.h \ + $(SRC)/tparam.h \ $(SRC)/w32gui.h \ $(SRC)/window.h @@ -1499,7 +1507,8 @@ $(BLD)/textprop.$(O) : \ $(BLD)/tparam.$(O) : \ $(SRC)/tparam.c \ $(CONFIG_H) \ - $(LISP_H) + $(LISP_H) \ + $(SRC)/tparam.h $(BLD)/undo.$(O) : \ $(SRC)/undo.c \ @@ -1514,6 +1523,7 @@ $(BLD)/undo.$(O) : \ $(BLD)/unexw32.$(O) : \ $(SRC)/unexw32.c \ $(CONFIG_H) \ + $(SRC)/unexec.h \ $(SRC)/w32heap.h $(BLD)/vm-limit.$(O) : \ @@ -1553,6 +1563,7 @@ $(BLD)/xdisp.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1572,7 +1583,6 @@ $(BLD)/xdisp.$(O) : \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ $(SRC)/macros.h \ - $(PROCESS_H) \ $(SRC)/region-cache.h \ $(SRC)/systime.h \ $(SRC)/termchar.h \ @@ -1664,8 +1674,10 @@ $(BLD)/w32term.$(O) : \ $(SRC)/w32term.c \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/unistd.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1682,7 +1694,6 @@ $(BLD)/w32term.$(O) : \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ - $(PROCESS_H) \ $(SRC)/systime.h \ $(SRC)/systty.h \ $(SRC)/termchar.h \ @@ -1705,7 +1716,6 @@ $(BLD)/w32select.$(O) : \ $(SRC)/charset.h \ $(SRC)/coding.h \ $(SRC)/composite.h \ - $(SRC)/keyboard.h \ $(SRC)/systime.h \ $(SRC)/w32gui.h \ $(SRC)/w32heap.h \ diff --git a/src/marker.c b/src/marker.c index 72c564f420f..7d461099140 100644 --- a/src/marker.c +++ b/src/marker.c @@ -257,9 +257,10 @@ verify_bytepos (EMACS_INT charpos) return below_byte; } -/* bytepos_to_charpos returns the char position corresponding to BYTEPOS. */ +/* buf_bytepos_to_charpos returns the char position corresponding to + BYTEPOS. */ -/* This macro is a subroutine of bytepos_to_charpos. +/* This macro is a subroutine of buf_bytepos_to_charpos. It is used when BYTEPOS is actually the byte position. */ #define CONSIDER(BYTEPOS, CHARPOS) \ @@ -303,12 +304,6 @@ verify_bytepos (EMACS_INT charpos) } EMACS_INT -bytepos_to_charpos (EMACS_INT bytepos) -{ - return buf_bytepos_to_charpos (current_buffer, bytepos); -} - -EMACS_INT buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos) { struct Lisp_Marker *tail; @@ -896,4 +891,3 @@ syms_of_marker (void) doc: /* Non-nil enables debugging checks in byte/char position conversions. */); byte_debug_flag = 0; } - diff --git a/src/minibuf.c b/src/minibuf.c index 75a24686d5a..986765ae6fb 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -72,6 +72,7 @@ Lisp_Object Qcompletion_ignore_case; Lisp_Object Qminibuffer_completion_table; Lisp_Object Qminibuffer_completion_predicate; Lisp_Object Qminibuffer_completion_confirm; +Lisp_Object Qcompleting_read_default; Lisp_Object Quser_variable_p; Lisp_Object Qminibuffer_default; @@ -135,7 +136,7 @@ choose_minibuf_frame (void) } } -Lisp_Object +static Lisp_Object choose_minibuf_frame_1 (Lisp_Object ignore) { choose_minibuf_frame (); @@ -1213,7 +1214,7 @@ is used to further constrain the set of candidates. */) && (!SYMBOLP (XCAR (collection)) || NILP (XCAR (collection))))) ? list_table : function_table)); - int index = 0, obsize = 0; + int idx = 0, obsize = 0; int matchcount = 0; int bindcount = -1; Lisp_Object bucket, zero, end, tem; @@ -1232,7 +1233,7 @@ is used to further constrain the set of candidates. */) { collection = check_obarray (collection); obsize = XVECTOR (collection)->size; - bucket = XVECTOR (collection)->contents[index]; + bucket = XVECTOR (collection)->contents[idx]; } while (1) @@ -1263,23 +1264,23 @@ is used to further constrain the set of candidates. */) else XSETFASTINT (bucket, 0); } - else if (++index >= obsize) + else if (++idx >= obsize) break; else { - bucket = XVECTOR (collection)->contents[index]; + bucket = XVECTOR (collection)->contents[idx]; continue; } } else /* if (type == hash_table) */ { - while (index < HASH_TABLE_SIZE (XHASH_TABLE (collection)) - && NILP (HASH_HASH (XHASH_TABLE (collection), index))) - index++; - if (index >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) + while (idx < HASH_TABLE_SIZE (XHASH_TABLE (collection)) + && NILP (HASH_HASH (XHASH_TABLE (collection), idx))) + idx++; + if (idx >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) break; else - elt = eltstring = HASH_KEY (XHASH_TABLE (collection), index++); + elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); } /* Is this element a possible completion? */ @@ -1334,7 +1335,7 @@ is used to further constrain the set of candidates. */) tem = (type == hash_table ? call2 (predicate, elt, HASH_VALUE (XHASH_TABLE (collection), - index - 1)) + idx - 1)) : call1 (predicate, elt)); UNGCPRO; } @@ -1478,7 +1479,7 @@ with a space are ignored unless STRING itself starts with a space. */) : NILP (collection) || (CONSP (collection) && (!SYMBOLP (XCAR (collection)) || NILP (XCAR (collection)))); - int index = 0, obsize = 0; + int idx = 0, obsize = 0; int bindcount = -1; Lisp_Object bucket, tem, zero; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -1495,7 +1496,7 @@ with a space are ignored unless STRING itself starts with a space. */) { collection = check_obarray (collection); obsize = XVECTOR (collection)->size; - bucket = XVECTOR (collection)->contents[index]; + bucket = XVECTOR (collection)->contents[idx]; } while (1) @@ -1526,23 +1527,23 @@ with a space are ignored unless STRING itself starts with a space. */) else XSETFASTINT (bucket, 0); } - else if (++index >= obsize) + else if (++idx >= obsize) break; else { - bucket = XVECTOR (collection)->contents[index]; + bucket = XVECTOR (collection)->contents[idx]; continue; } } else /* if (type == 3) */ { - while (index < HASH_TABLE_SIZE (XHASH_TABLE (collection)) - && NILP (HASH_HASH (XHASH_TABLE (collection), index))) - index++; - if (index >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) + while (idx < HASH_TABLE_SIZE (XHASH_TABLE (collection)) + && NILP (HASH_HASH (XHASH_TABLE (collection), idx))) + idx++; + if (idx >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) break; else - elt = eltstring = HASH_KEY (XHASH_TABLE (collection), index++); + elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); } /* Is this element a possible completion? */ @@ -1567,8 +1568,6 @@ with a space are ignored unless STRING itself starts with a space. */) { /* Yes. */ Lisp_Object regexps; - Lisp_Object zero; - XSETFASTINT (zero, 0); /* Ignore this element if it fails to match all the regexps. */ { @@ -1604,7 +1603,7 @@ with a space are ignored unless STRING itself starts with a space. */) GCPRO4 (tail, eltstring, allmatches, string); tem = type == 3 ? call2 (predicate, elt, - HASH_VALUE (XHASH_TABLE (collection), index - 1)) + HASH_VALUE (XHASH_TABLE (collection), idx - 1)) : call1 (predicate, elt); UNGCPRO; } @@ -1677,7 +1676,27 @@ If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits the current input method and the setting of `enable-multibyte-characters'. Completion ignores case if the ambient value of - `completion-ignore-case' is non-nil. */) + `completion-ignore-case' is non-nil. + +See also `completing-read-function'. */) + (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) +{ + Lisp_Object args[9]; + args[0] = Vcompleting_read_function; + args[1] = prompt; + args[2] = collection; + args[3] = predicate; + args[4] = require_match; + args[5] = initial_input; + args[6] = hist; + args[7] = def; + args[8] = inherit_input_method; + return Ffuncall (9, args); +} + +DEFUN ("completing-read-default", Fcompleting_read_default, Scompleting_read_default, 2, 8, 0, + doc: /* Default method for reading from the minibuffer with completion. +See `completing-read' for the meaning of the arguments. */) (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) { Lisp_Object val, histvar, histpos, position; @@ -1975,6 +1994,9 @@ syms_of_minibuf (void) minibuf_save_list = Qnil; staticpro (&minibuf_save_list); + Qcompleting_read_default = intern_c_string ("completing-read-default"); + staticpro (&Qcompleting_read_default); + Qcompletion_ignore_case = intern_c_string ("completion-ignore-case"); staticpro (&Qcompletion_ignore_case); @@ -2119,6 +2141,12 @@ If the value is `confirm-after-completion', the user may exit with an doc: /* Non-nil means completing file names. */); Vminibuffer_completing_file_name = Qnil; + DEFVAR_LISP ("completing-read-function", + Vcompleting_read_function, + doc: /* The function called by `completing-read' to do the work. +It should accept the same arguments as `completing-read'. */); + Vcompleting_read_function = Qcompleting_read_default; + DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form, doc: /* Value that `help-form' takes on inside the minibuffer. */); Vminibuffer_help_form = Qnil; @@ -2194,4 +2222,5 @@ properties. */); defsubr (&Stest_completion); defsubr (&Sassoc_string); defsubr (&Scompleting_read); + defsubr (&Scompleting_read_default); } diff --git a/src/msdos.c b/src/msdos.c index 261a09ac859..b0bf5c4fdd9 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -844,6 +844,7 @@ IT_set_face (int face) extern unsigned char *encode_terminal_code (struct glyph *, int, struct coding_system *); + static void IT_write_glyphs (struct frame *f, struct glyph *str, int str_len) { @@ -2998,17 +2999,17 @@ XMenuCreate (Display *foo1, Window foo2, char *foo3) to do. */ int -XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable) +XMenuAddPane (Display *foo, XMenu *menu, const char *txt, int enable) { int len; - char *p; + const char *p; if (!enable) abort (); IT_menu_make_room (menu); menu->submenu[menu->count] = IT_menu_create (); - menu->text[menu->count] = txt; + menu->text[menu->count] = (char *)txt; menu->panenumber[menu->count] = ++menu->panecount; menu->help_text[menu->count] = NULL; menu->count++; diff --git a/src/msdos.h b/src/msdos.h index 4bbe9b134de..5051f2f3837 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -105,7 +105,7 @@ typedef struct x_menu_struct } XMenu; XMenu *XMenuCreate (Display *, Window, char *); -int XMenuAddPane (Display *, XMenu *, char *, int); +int XMenuAddPane (Display *, XMenu *, const char *, int); int XMenuAddSelection (Display *, XMenu *, int, int, char *, int, char *); void XMenuLocate (Display *, XMenu *, int, int, int, int, int *, int *, int *, int *); diff --git a/src/nsterm.m b/src/nsterm.m index cc2c4cf9807..c7cd411c614 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2235,7 +2235,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, -------------------------------------------------------------------------- */ { NSRect r, s; - int fx, fy, h; + int fx, fy, h, cursor_height; struct frame *f = WINDOW_XFRAME (w); struct glyph *phys_cursor_glyph; int overspill; @@ -2279,13 +2279,20 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); /* The above get_phys_cursor_geometry call set w->phys_cursor_width - to the glyph width; replace with CURSOR_WIDTH for bar cursors. */ - if (cursor_type == BAR_CURSOR || cursor_type == HBAR_CURSOR) + to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */ + if (cursor_type == BAR_CURSOR) { if (cursor_width < 1) cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); w->phys_cursor_width = cursor_width; } + /* If we have an HBAR, "cursor_width" MAY specify height. */ + else if (cursor_type == HBAR_CURSOR) + { + cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width; + fy += h - cursor_height; + h = cursor_height; + } r.origin.x = fx, r.origin.y = fy; r.size.height = h; @@ -2337,10 +2344,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, [FRAME_CURSOR_COLOR (f) set]; break; case HBAR_CURSOR: - s = r; - s.origin.y += lrint (0.75 * s.size.height); - s.size.height = lrint (s.size.height * 0.25); - NSRectFill (s); + NSRectFill (r); break; case BAR_CURSOR: s = r; diff --git a/src/print.c b/src/print.c index 602575b5b08..b8266422473 100644 --- a/src/print.c +++ b/src/print.c @@ -801,7 +801,7 @@ append to existing target file. */) { file = Fexpand_file_name (file, Qnil); initial_stderr_stream = stderr; - stderr = fopen (SDATA (file), NILP (append) ? "w" : "a"); + stderr = fopen (SSDATA (file), NILP (append) ? "w" : "a"); if (stderr == NULL) { stderr = initial_stderr_stream; @@ -1120,6 +1120,16 @@ print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag) print_object (obj, printcharfun, escapeflag); } +#define PRINT_CIRCLE_CANDIDATE_P(obj) \ + (STRINGP (obj) || CONSP (obj) \ + || (VECTORLIKEP (obj) \ + && (VECTORP (obj) || COMPILEDP (obj) \ + || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \ + || HASH_TABLE_P (obj) || FONTP (obj))) \ + || (! NILP (Vprint_gensym) \ + && SYMBOLP (obj) \ + && !SYMBOL_INTERNED_P (obj))) + /* Construct Vprint_number_table according to the structure of OBJ. OBJ itself and all its elements will be added to Vprint_number_table recursively if it is a list, vector, compiled function, char-table, @@ -1154,12 +1164,7 @@ print_preprocess (Lisp_Object obj) halftail = obj; loop: - if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) - || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) - || HASH_TABLE_P (obj) - || (! NILP (Vprint_gensym) - && SYMBOLP (obj) - && !SYMBOL_INTERNED_P (obj))) + if (PRINT_CIRCLE_CANDIDATE_P (obj)) { if (!HASH_TABLE_P (Vprint_number_table)) { @@ -1336,12 +1341,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag error ("Apparently circular structure being printed"); /* Detect circularities and truncate them. */ - if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) - || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) - || HASH_TABLE_P (obj) - || (! NILP (Vprint_gensym) - && SYMBOLP (obj) - && !SYMBOL_INTERNED_P (obj))) + if (PRINT_CIRCLE_CANDIDATE_P (obj)) { if (NILP (Vprint_circle) && NILP (Vprint_gensym)) { diff --git a/src/process.c b/src/process.c index 210287a85f1..c9b420ab2ae 100644 --- a/src/process.c +++ b/src/process.c @@ -162,12 +162,6 @@ extern Lisp_Object QCfilter; /* Define first descriptor number available for subprocesses. */ #define FIRST_PROC_DESC 3 -extern const char *get_operating_system_release (void); - -/* From sysdep.c or w32.c */ -extern int serial_open (char *port); -extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); - #ifndef HAVE_H_ERRNO extern int h_errno; #endif @@ -499,7 +493,7 @@ status_message (struct Lisp_Process *p) string = (code_convert_string_norecord (string, Vlocale_coding_system, 0)); c1 = STRING_CHAR (SDATA (string)); - c2 = DOWNCASE (c1); + c2 = downcase (c1); if (c1 != c2) Faset (string, make_number (0), make_number (c2)); } @@ -541,17 +535,16 @@ static char pty_name[24]; static int allocate_pty (void) { - register int c, i; int fd; #ifdef PTY_ITERATION PTY_ITERATION #else + register int c, i; for (c = FIRST_PTY_LETTER; c <= 'z'; c++) for (i = 0; i < 16; i++) #endif { - struct stat stb; /* Used in some PTY_OPEN. */ #ifdef PTY_NAME_SPRINTF PTY_NAME_SPRINTF #else @@ -568,6 +561,7 @@ allocate_pty (void) three failures in a row before deciding that we've reached the end of the ptys. */ int failed_count = 0; + struct stat stb; if (stat (pty_name, &stb) < 0) { @@ -2730,7 +2724,8 @@ usage: (serial-process-configure &rest ARGS) */) } /* Used by make-serial-process to recover from errors. */ -Lisp_Object make_serial_process_unwind (Lisp_Object proc) +static Lisp_Object +make_serial_process_unwind (Lisp_Object proc) { if (!PROCESSP (proc)) abort (); @@ -5482,7 +5477,7 @@ read_process_output (Lisp_Object proc, register int channel) jmp_buf send_process_frame; Lisp_Object process_sent_to; -SIGTYPE +static SIGTYPE send_process_trap (int ignore) { SIGNAL_THREAD_CHECK (SIGPIPE); @@ -6391,7 +6386,7 @@ process has been transmitted to the serial port. */) indirectly; if it does, that is a bug */ #ifdef SIGCHLD -SIGTYPE +static SIGTYPE sigchld_handler (int signo) { int old_errno = errno; diff --git a/src/regex.c b/src/regex.c index 9284be95ffb..a60ff0ce35c 100644 --- a/src/regex.c +++ b/src/regex.c @@ -340,7 +340,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; || ((c) >= 'A' && (c) <= 'Z')) \ : SYNTAX (c) == Sword) -# define ISLOWER(c) (LOWERCASEP (c)) +# define ISLOWER(c) lowercasep (c) # define ISPUNCT(c) (IS_REAL_ASCII (c) \ ? ((c) > ' ' && (c) < 0177 \ @@ -351,7 +351,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; # define ISSPACE(c) (SYNTAX (c) == Swhitespace) -# define ISUPPER(c) (UPPERCASEP (c)) +# define ISUPPER(c) uppercasep (c) # define ISWORD(c) (SYNTAX (c) == Sword) @@ -551,8 +551,6 @@ init_syntax_once (void) /* (Re)Allocate N items of type T using malloc, or fail. */ #define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) #define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) -#define RETALLOC_IF(addr, n, t) \ - if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t) #define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) #define BYTEWIDTH 8 /* In bits. */ @@ -843,11 +841,6 @@ extract_number_and_incr (destination, source) ((p)[2 + CHARSET_BITMAP_SIZE (p)] \ + (p)[3 + CHARSET_BITMAP_SIZE (p)] * 0x100) -/* Test if C is listed in the bitmap of charset P. */ -#define CHARSET_LOOKUP_BITMAP(p, c) \ - ((c) < CHARSET_BITMAP_SIZE (p) * BYTEWIDTH \ - && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH))) - /* Return the address of end of RANGE_TABLE. COUNT is number of ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2' is start of range and end of range. `* 3' is size of each start @@ -861,14 +854,14 @@ extract_number_and_incr (destination, source) do \ { \ re_wchar_t range_start, range_end; \ - re_char *p; \ + re_char *rtp; \ re_char *range_table_end \ = CHARSET_RANGE_TABLE_END ((range_table), (count)); \ \ - for (p = (range_table); p < range_table_end; p += 2 * 3) \ + for (rtp = (range_table); rtp < range_table_end; rtp += 2 * 3) \ { \ - EXTRACT_CHARACTER (range_start, p); \ - EXTRACT_CHARACTER (range_end, p + 3); \ + EXTRACT_CHARACTER (range_start, rtp); \ + EXTRACT_CHARACTER (range_end, rtp + 3); \ \ if (range_start <= (c) && (c) <= range_end) \ { \ @@ -1274,6 +1267,13 @@ print_double_string (where, string1, size1, string2, size2) #endif /* not DEBUG */ +/* Use this to suppress gcc's `...may be used before initialized' warnings. */ +#ifdef lint +# define IF_LINT(Code) Code +#else +# define IF_LINT(Code) /* empty */ +#endif + /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can also be assigned to arbitrarily: each pattern buffer stores its own syntax, so it can be changed between regex compilations. */ @@ -1413,7 +1413,6 @@ typedef struct } fail_stack_type; #define FAIL_STACK_EMPTY() (fail_stack.frame == 0) -#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size) /* Define macros to initialize and free the failure stack. @@ -1433,8 +1432,6 @@ typedef struct fail_stack.avail = 0; \ fail_stack.frame = 0; \ } while (0) - -# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack) #else # define INIT_FAIL_STACK() \ do { \ @@ -1442,7 +1439,8 @@ typedef struct fail_stack.frame = 0; \ } while (0) -# define RESET_FAIL_STACK() ((void)0) +# define RETALLOC_IF(addr, n, t) \ + if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t) #endif @@ -1495,17 +1493,10 @@ typedef struct #define PUSH_FAILURE_INT(item) \ fail_stack.stack[fail_stack.avail++].integer = (item) -/* Push a fail_stack_elt_t value onto the failure stack. - Assumes the variable `fail_stack'. Probably should only - be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_ELT(item) \ - fail_stack.stack[fail_stack.avail++] = (item) - -/* These three POP... operations complement the three PUSH... operations. +/* These POP... operations complement the PUSH... operations. All assume that `fail_stack' is nonempty. */ #define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer #define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer -#define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail] /* Individual items aside from the registers. */ #define NUM_NONREG_ITEMS 3 @@ -1555,22 +1546,22 @@ do { \ /* Pop a saved register off the stack. */ #define POP_FAILURE_REG_OR_COUNT() \ do { \ - int reg = POP_FAILURE_INT (); \ - if (reg == -1) \ + int pfreg = POP_FAILURE_INT (); \ + if (pfreg == -1) \ { \ /* It's a counter. */ \ /* Here, we discard `const', making re_match non-reentrant. */ \ unsigned char *ptr = (unsigned char*) POP_FAILURE_POINTER (); \ - reg = POP_FAILURE_INT (); \ - STORE_NUMBER (ptr, reg); \ - DEBUG_PRINT3 (" Pop counter %p = %d\n", ptr, reg); \ + pfreg = POP_FAILURE_INT (); \ + STORE_NUMBER (ptr, pfreg); \ + DEBUG_PRINT3 (" Pop counter %p = %d\n", ptr, pfreg); \ } \ else \ { \ - regend[reg] = POP_FAILURE_POINTER (); \ - regstart[reg] = POP_FAILURE_POINTER (); \ + regend[pfreg] = POP_FAILURE_POINTER (); \ + regstart[pfreg] = POP_FAILURE_POINTER (); \ DEBUG_PRINT4 (" Pop reg %d (spanning %p -> %p)\n", \ - reg, regstart[reg], regend[reg]); \ + pfreg, regstart[pfreg], regend[pfreg]); \ } \ } while (0) @@ -1765,16 +1756,6 @@ static int analyse_first _RE_ARGS ((re_char *p, re_char *pend, } while (0) -/* As with BUF_PUSH_2, except for three bytes. */ -#define BUF_PUSH_3(c1, c2, c3) \ - do { \ - GET_BUFFER_SPACE (3); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ - *b++ = (unsigned char) (c3); \ - } while (0) - - /* Store a jump with opcode OP at LOC to location TO. We store a relative address offset by the three bytes the jump itself occupies. */ #define STORE_JUMP(op, loc, to) \ @@ -2524,9 +2505,6 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct /* We fetch characters from PATTERN here. */ register re_wchar_t c, c1; - /* A random temporary spot in PATTERN. */ - re_char *p1; - /* Points to the end of the buffer, where we should append. */ register unsigned char *b; @@ -2574,17 +2552,14 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct /* If the object matched can contain multibyte characters. */ const boolean multibyte = RE_MULTIBYTE_P (bufp); - /* If a target of matching can contain multibyte characters. */ - const boolean target_multibyte = RE_TARGET_MULTIBYTE_P (bufp); - /* Nonzero if we have pushed down into a subpattern. */ int in_subpattern = 0; /* These hold the values of p, pattern, and pend from the main pattern when we have pushed into a subpattern. */ - re_char *main_p; - re_char *main_pattern; - re_char *main_pend; + re_char *main_p IF_LINT (= NULL); + re_char *main_pattern IF_LINT (= NULL); + re_char *main_pend IF_LINT (= NULL); #ifdef DEBUG debug++; @@ -2894,6 +2869,8 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct case '[': { + re_char *p1; + CLEAR_RANGE_TABLE_WORK_USED (range_table_work); if (p == pend) FREE_STACK_RETURN (REG_EBRACK); @@ -2929,7 +2906,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct { boolean escaped_char = false; const unsigned char *p2 = p; - re_wchar_t ch, c2; + re_wchar_t ch; if (p == pend) FREE_STACK_RETURN (REG_EBRACK); @@ -2992,10 +2969,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct them). */ if (c == ':' && *p == ']') { - re_wctype_t cc; - int limit; - - cc = re_wctype (str); + re_wctype_t cc = re_wctype (str); if (cc == 0) FREE_STACK_RETURN (REG_ECTYPE); @@ -4329,10 +4303,6 @@ WEAK_ALIAS (__re_search, re_search) #define HEAD_ADDR_VSTRING(P) \ (((P) >= size1 ? string2 : string1)) -/* End address of virtual concatenation of string. */ -#define STOP_ADDR_VSTRING(P) \ - (((P) >= size1 ? string2 + size2 : string1 + size1)) - /* Address of POS in the concatenation of virtual string. */ #define POS_ADDR_VSTRING(POS) \ (((POS) >= size1 ? string2 - size1 : string1) + (POS)) @@ -4559,7 +4529,6 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const if (multibyte) { re_char *p = POS_ADDR_VSTRING (startpos); - re_char *pend = STOP_ADDR_VSTRING (startpos); int len = BYTES_BY_CHAR_HEAD (*p); range -= len; @@ -4644,16 +4613,6 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, #define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) #define AT_STRINGS_END(d) ((d) == end2) - -/* Test if D points to a character which is word-constituent. We have - two special cases to check for: if past the end of string1, look at - the first character in string2; and if before the beginning of - string2, look at the last character in string1. */ -#define WORDCHAR_P(d) \ - (SYNTAX ((d) == end1 ? *string2 \ - : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ - == Sword) - /* Disabled due to a compiler bug -- see comment at case wordbound */ /* The comment at case wordbound is following one, but we don't use @@ -4665,6 +4624,15 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, macro and introducing temporary variables works around the bug. */ #if 0 +/* Test if D points to a character which is word-constituent. We have + two special cases to check for: if past the end of string1, look at + the first character in string2; and if before the beginning of + string2, look at the last character in string1. */ +#define WORDCHAR_P(d) \ + (SYNTAX ((d) == end1 ? *string2 \ + : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ + == Sword) + /* Test if the character before D and the one at D differ with respect to being word-constituent. */ #define AT_WORD_BOUNDARY(d) \ @@ -4674,7 +4642,14 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, /* Free everything we malloc. */ #ifdef MATCH_MAY_ALLOCATE -# define FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else +# define FREE_VAR(var) \ + do { \ + if (var) \ + { \ + REGEX_FREE (var); \ + var = NULL; \ + } \ + } while (0) # define FREE_VARIABLES() \ do { \ REGEX_FREE_STACK (fail_stack.stack); \ @@ -5024,7 +4999,6 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int /* General temporaries. */ int mcnt; size_t reg; - boolean not; /* Just past the end of the corresponding string. */ re_char *end1, *end2; @@ -5464,7 +5438,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int else do { - int pat_charlen, buf_charlen; + int pat_charlen; int pat_ch, buf_ch; PREFETCH (); @@ -5535,7 +5509,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int /* Start of actual range_table, or end of bitmap if there is no range table. */ - re_char *range_table; + re_char *range_table IF_LINT (= NULL); /* Nonzero if there is a range table. */ int range_table_exists; @@ -5622,8 +5596,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int if (!not) goto fail; d += len; - break; } + break; /* The beginning of a group is represented by start_memory. @@ -6005,46 +5979,48 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int case wordbound: case notwordbound: - not = (re_opcode_t) *(p - 1) == notwordbound; - DEBUG_PRINT2 ("EXECUTING %swordbound.\n", not?"not":""); + { + boolean not = (re_opcode_t) *(p - 1) == notwordbound; + DEBUG_PRINT2 ("EXECUTING %swordbound.\n", not?"not":""); - /* We SUCCEED (or FAIL) in one of the following cases: */ + /* We SUCCEED (or FAIL) in one of the following cases: */ - /* Case 1: D is at the beginning or the end of string. */ - if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) - not = !not; - else - { - /* C1 is the character before D, S1 is the syntax of C1, C2 - is the character at D, and S2 is the syntax of C2. */ - re_wchar_t c1, c2; - int s1, s2; - int dummy; + /* Case 1: D is at the beginning or the end of string. */ + if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) + not = !not; + else + { + /* C1 is the character before D, S1 is the syntax of C1, C2 + is the character at D, and S2 is the syntax of C2. */ + re_wchar_t c1, c2; + int s1, s2; + int dummy; #ifdef emacs - int offset = PTR_TO_OFFSET (d - 1); - int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); - UPDATE_SYNTAX_TABLE (charpos); + int offset = PTR_TO_OFFSET (d - 1); + int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + UPDATE_SYNTAX_TABLE (charpos); #endif - GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); - s1 = SYNTAX (c1); + GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); + s1 = SYNTAX (c1); #ifdef emacs - UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); + UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); #endif - PREFETCH_NOLIMIT (); - GET_CHAR_AFTER (c2, d, dummy); - s2 = SYNTAX (c2); - - if (/* Case 2: Only one of S1 and S2 is Sword. */ - ((s1 == Sword) != (s2 == Sword)) - /* Case 3: Both of S1 and S2 are Sword, and macro - WORD_BOUNDARY_P (C1, C2) returns nonzero. */ - || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2))) - not = !not; - } - if (not) - break; - else - goto fail; + PREFETCH_NOLIMIT (); + GET_CHAR_AFTER (c2, d, dummy); + s2 = SYNTAX (c2); + + if (/* Case 2: Only one of S1 and S2 is Sword. */ + ((s1 == Sword) != (s2 == Sword)) + /* Case 3: Both of S1 and S2 are Sword, and macro + WORD_BOUNDARY_P (C1, C2) returns nonzero. */ + || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2))) + not = !not; + } + if (not) + break; + else + goto fail; + } case wordbeg: DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); @@ -6224,25 +6200,27 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int case syntaxspec: case notsyntaxspec: - not = (re_opcode_t) *(p - 1) == notsyntaxspec; - mcnt = *p++; - DEBUG_PRINT3 ("EXECUTING %ssyntaxspec %d.\n", not?"not":"", mcnt); - PREFETCH (); -#ifdef emacs { - int offset = PTR_TO_OFFSET (d); - int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); - UPDATE_SYNTAX_TABLE (pos1); - } + boolean not = (re_opcode_t) *(p - 1) == notsyntaxspec; + mcnt = *p++; + DEBUG_PRINT3 ("EXECUTING %ssyntaxspec %d.\n", not?"not":"", mcnt); + PREFETCH (); +#ifdef emacs + { + int offset = PTR_TO_OFFSET (d); + int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + UPDATE_SYNTAX_TABLE (pos1); + } #endif - { - int len; - re_wchar_t c; + { + int len; + re_wchar_t c; - GET_CHAR_AFTER (c, d, len); - if ((SYNTAX (c) != (enum syntaxcode) mcnt) ^ not) - goto fail; - d += len; + GET_CHAR_AFTER (c, d, len); + if ((SYNTAX (c) != (enum syntaxcode) mcnt) ^ not) + goto fail; + d += len; + } } break; @@ -6267,18 +6245,21 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int case categoryspec: case notcategoryspec: - not = (re_opcode_t) *(p - 1) == notcategoryspec; - mcnt = *p++; - DEBUG_PRINT3 ("EXECUTING %scategoryspec %d.\n", not?"not":"", mcnt); - PREFETCH (); { - int len; - re_wchar_t c; + boolean not = (re_opcode_t) *(p - 1) == notcategoryspec; + mcnt = *p++; + DEBUG_PRINT3 ("EXECUTING %scategoryspec %d.\n", + not?"not":"", mcnt); + PREFETCH (); - GET_CHAR_AFTER (c, d, len); - if ((!CHAR_HAS_CATEGORY (c, mcnt)) ^ not) - goto fail; - d += len; + { + int len; + re_wchar_t c; + GET_CHAR_AFTER (c, d, len); + if ((!CHAR_HAS_CATEGORY (c, mcnt)) ^ not) + goto fail; + d += len; + } } break; diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h index 443fc034570..c2715fffe01 100644 --- a/src/s/aix4-2.h +++ b/src/s/aix4-2.h @@ -32,7 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* In AIX, you allocate a pty by opening /dev/ptc to get the master side. To get the name of the slave side, you just ttyname() the master side. */ -#define PTY_ITERATION for (c = 0; !c ; c++) +#define PTY_ITERATION int c; for (c = 0; !c ; c++) #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc"); #define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd)); diff --git a/src/s/cygwin.h b/src/s/cygwin.h index ceebe23f1e7..af5308ff7bb 100644 --- a/src/s/cygwin.h +++ b/src/s/cygwin.h @@ -46,7 +46,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS -#define PTY_ITERATION for (i = 0; i < 1; i++) /* ick */ +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) /* ick */ #define PTY_NAME_SPRINTF /* none */ #define PTY_TTY_NAME_SPRINTF /* none */ #define PTY_OPEN \ @@ -102,4 +102,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Send signals to subprocesses by "typing" special chars at them. */ #define SIGNALS_VIA_CHARACTERS - diff --git a/src/s/darwin.h b/src/s/darwin.h index 4fc2f4d1031..dd0d0c34021 100644 --- a/src/s/darwin.h +++ b/src/s/darwin.h @@ -68,7 +68,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ Note: PTYs are broken on darwin <6. Use at your own risk. */ #define HAVE_PTYS /* Run only once. We need a `for'-loop because the code uses `continue'. */ -#define PTY_ITERATION for (i = 0; i < 1; i++) +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) #define PTY_NAME_SPRINTF /* none */ #define PTY_TTY_NAME_SPRINTF /* none */ /* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8. @@ -148,4 +148,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */ #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS - diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h index 84fe5b92da9..178d7082f72 100644 --- a/src/s/gnu-linux.h +++ b/src/s/gnu-linux.h @@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define UNIX98_PTYS /* Run only once. We need a `for'-loop because the code uses `continue'. */ -#define PTY_ITERATION for (i = 0; i < 1; i++) +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) #ifdef HAVE_GETPT #define PTY_NAME_SPRINTF diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h index 92465ded2ef..d283571d8fb 100644 --- a/src/s/irix6-5.h +++ b/src/s/irix6-5.h @@ -60,6 +60,7 @@ char *_getpty(); #define PTY_OPEN \ { \ struct sigaction ocstat, cstat; \ + struct stat stb; \ char * name; \ sigemptyset(&cstat.sa_mask); \ cstat.sa_handler = SIG_DFL; \ @@ -95,5 +96,3 @@ char *_getpty(); /* Tested on Irix 6.5. SCM worked on earlier versions. */ #define GC_SETJMP_WORKS 1 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS - - diff --git a/src/scroll.c b/src/scroll.c index 1343b89c41e..33af18d2090 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -938,8 +938,8 @@ line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int static void ins_del_costs (FRAME_PTR frame, - char *one_line_string, char *multi_string, - char *setup_string, char *cleanup_string, + const char *one_line_string, const char *multi_string, + const char *setup_string, const char *cleanup_string, int *costvec, int *ncostvec, int coefficient) { @@ -994,9 +994,12 @@ ins_del_costs (FRAME_PTR frame, void do_line_insertion_deletion_costs (FRAME_PTR frame, - char *ins_line_string, char *multi_ins_string, - char *del_line_string, char *multi_del_string, - char *setup_string, char *cleanup_string, + const char *ins_line_string, + const char *multi_ins_string, + const char *del_line_string, + const char *multi_del_string, + const char *setup_string, + const char *cleanup_string, int coefficient) { if (FRAME_INSERT_COST (frame) != 0) diff --git a/src/search.c b/src/search.c index 1e2036f6dc2..bf93a7fe442 100644 --- a/src/search.c +++ b/src/search.c @@ -114,17 +114,13 @@ matcher_overflow (void) PATTERN is the pattern to compile. CP is the place to put the result. TRANSLATE is a translation table for ignoring case, or nil for none. - REGP is the structure that says where to store the "register" - values that will result from matching this pattern. - If it is 0, we should compile the pattern not to record any - subexpression bounds. POSIX is nonzero if we want full backtracking (POSIX style) for this pattern. 0 means backtrack only enough to get a valid match. The behavior also depends on Vsearch_spaces_regexp. */ static void -compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, struct re_registers *regp, int posix) +compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, int posix) { char *val; reg_syntax_t old; @@ -247,7 +243,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object tra if (cp->next == 0) { compile_it: - compile_pattern_1 (cp, pattern, translate, regp, posix); + compile_pattern_1 (cp, pattern, translate, posix); break; } } @@ -1558,7 +1554,6 @@ simple_search (EMACS_INT n, unsigned char *pat, while (this_len > 0) { - int charlen; int pat_ch, buf_ch; DEC_BOTH (this_pos, this_pos_byte); @@ -1730,17 +1725,17 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, /* Setup translate_prev_byte1/2/3/4 from CHAR_BASE. Only a byte following them are the target of translation. */ unsigned char str[MAX_MULTIBYTE_LENGTH]; - int len = CHAR_STRING (char_base, str); + int cblen = CHAR_STRING (char_base, str); - translate_prev_byte1 = str[len - 2]; - if (len > 2) + translate_prev_byte1 = str[cblen - 2]; + if (cblen > 2) { - translate_prev_byte2 = str[len - 3]; - if (len > 3) + translate_prev_byte2 = str[cblen - 3]; + if (cblen > 3) { - translate_prev_byte3 = str[len - 4]; - if (len > 4) - translate_prev_byte4 = str[len - 5]; + translate_prev_byte3 = str[cblen - 4]; + if (cblen > 4) + translate_prev_byte4 = str[cblen - 5]; } } } @@ -2474,7 +2469,7 @@ since only regular expressions have distinguished subexpressions. */) else FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, pos, pos_byte); - if (LOWERCASEP (c)) + if (lowercasep (c)) { /* Cannot be all caps if any original char is lower case */ @@ -2484,7 +2479,7 @@ since only regular expressions have distinguished subexpressions. */) else some_multiletter_word = 1; } - else if (UPPERCASEP (c)) + else if (uppercasep (c)) { some_uppercase = 1; if (SYNTAX (prevc) != Sword) diff --git a/src/syntax.c b/src/syntax.c index 707c2c19f31..c1442c396c1 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -513,7 +513,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested EMACS_INT comment_end = from; EMACS_INT comment_end_byte = from_byte; EMACS_INT comstart_pos = 0; - EMACS_INT comstart_byte; + EMACS_INT comstart_byte IF_LINT (= 0); /* Place where the containing defun starts, or 0 if we didn't come across it yet. */ EMACS_INT defun_start = 0; @@ -554,7 +554,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); comstart = (com2start || code == Scomment); - + /* Nasty cases with overlapping 2-char comment markers: - snmp-mode: -- c -- foo -- c -- --- c -- @@ -1421,7 +1421,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl register unsigned int c; unsigned char fastmap[0400]; /* Store the ranges of non-ASCII characters. */ - int *char_ranges; + int *char_ranges IF_LINT (= NULL); int n_char_ranges = 0; int negate = 0; register EMACS_INT i, i_byte; @@ -2363,7 +2363,7 @@ between them, return t; otherwise return nil. */) if (code == Scomment_fence) { /* Skip until first preceding unquoted comment_fence. */ - int found = 0; + int fence_found = 0; EMACS_INT ini = from, ini_byte = from_byte; while (1) @@ -2374,13 +2374,13 @@ between them, return t; otherwise return nil. */) if (SYNTAX (c) == Scomment_fence && !char_quoted (from, from_byte)) { - found = 1; + fence_found = 1; break; } else if (from == stop) break; } - if (found == 0) + if (fence_found == 0) { from = ini; /* Set point to ini + 1. */ from_byte = ini_byte; @@ -2669,12 +2669,12 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf /* We must record the comment style encountered so that later, we can match only the proper comment begin sequence of the same style. */ - int c1, other_syntax; + int c2, other_syntax; DEC_BOTH (from, from_byte); UPDATE_SYNTAX_TABLE_BACKWARD (from); code = Sendcomment; - c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); - other_syntax = SYNTAX_WITH_FLAGS (c1); + c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte); + other_syntax = SYNTAX_WITH_FLAGS (c2); comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); comnested = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); @@ -3528,4 +3528,3 @@ In both cases, LIMIT bounds the search. */); defsubr (&Sbackward_prefix_chars); defsubr (&Sparse_partial_sexp); } - diff --git a/src/sysdep.c b/src/sysdep.c index 5760d0224eb..6ef3d88c5c8 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -292,10 +292,6 @@ init_baud_rate (int fd) int wait_debugging; /* Set nonzero to make following function work under dbx (at least for bsd). */ -SIGTYPE -wait_for_termination_signal (void) -{} - #ifndef MSDOS /* Wait for subprocess with process id `pid' to terminate and make sure it will get eliminated (not remain forever as a zombie) */ @@ -492,7 +488,7 @@ sys_subshell (void) int pid; struct save_signal saved_handlers[5]; Lisp_Object dir; - unsigned char *str = 0; + unsigned char * IF_LINT (volatile) str = 0; int len; saved_handlers[0].code = SIGINT; @@ -632,7 +628,7 @@ init_sigio (int fd) { } -void +static void reset_sigio (int fd) { } @@ -662,7 +658,7 @@ init_sigio (int fd) interrupts_deferred = 0; } -void +static void reset_sigio (int fd) { #ifdef FASYNC @@ -1890,13 +1886,13 @@ emacs_write (int fildes, const char *buf, unsigned int nbyte) * under error conditions. */ +#ifndef HAVE_GETWD + #ifndef MAXPATHLEN /* In 4.1, param.h fails to define this. */ #define MAXPATHLEN 1024 #endif -#ifndef HAVE_GETWD - char * getwd (char *pathname) { @@ -2671,8 +2667,8 @@ system_process_attributes (Lisp_Object pid) size_t cmdsize = 0, cmdline_size; unsigned char c; int proc_id, ppid, uid, gid, pgrp, sess, tty, tpgid, thcount; - unsigned long long utime, stime, cutime, cstime, start; - long priority, nice, rss; + unsigned long long u_time, s_time, cutime, cstime, start; + long priority, niceness, rss; unsigned long minflt, majflt, cminflt, cmajflt, vsize; time_t sec; unsigned usec; @@ -2752,8 +2748,8 @@ system_process_attributes (Lisp_Object pid) sscanf (p, "%c %d %d %d %d %d %*u %lu %lu %lu %lu %Lu %Lu %Lu %Lu %ld %ld %d %*d %Lu %lu %ld", &c, &ppid, &pgrp, &sess, &tty, &tpgid, &minflt, &cminflt, &majflt, &cmajflt, - &utime, &stime, &cutime, &cstime, - &priority, &nice, &thcount, &start, &vsize, &rss); + &u_time, &s_time, &cutime, &cstime, + &priority, &niceness, &thcount, &start, &vsize, &rss); { char state_str[2]; @@ -2781,13 +2777,14 @@ system_process_attributes (Lisp_Object pid) if (clocks_per_sec < 0) clocks_per_sec = 100; attrs = Fcons (Fcons (Qutime, - ltime_from_jiffies (utime, clocks_per_sec)), + ltime_from_jiffies (u_time, clocks_per_sec)), attrs); attrs = Fcons (Fcons (Qstime, - ltime_from_jiffies (stime, clocks_per_sec)), + ltime_from_jiffies (s_time, clocks_per_sec)), attrs); attrs = Fcons (Fcons (Qtime, - ltime_from_jiffies (stime+utime, clocks_per_sec)), + ltime_from_jiffies (s_time + u_time, + clocks_per_sec)), attrs); attrs = Fcons (Fcons (Qcutime, ltime_from_jiffies (cutime, clocks_per_sec)), @@ -2799,7 +2796,7 @@ system_process_attributes (Lisp_Object pid) ltime_from_jiffies (cstime+cutime, clocks_per_sec)), attrs); attrs = Fcons (Fcons (Qpri, make_number (priority)), attrs); - attrs = Fcons (Fcons (Qnice, make_number (nice)), attrs); + attrs = Fcons (Fcons (Qnice, make_number (niceness)), attrs); attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount_eint)), attrs); EMACS_GET_TIME (tnow); get_up_time (&sec, &usec); @@ -2829,7 +2826,7 @@ system_process_attributes (Lisp_Object pid) make_number (EMACS_USECS (telapsed)))), attrs); - time_from_jiffies (utime + stime, clocks_per_sec, &sec, &usec); + time_from_jiffies (u_time + s_time, clocks_per_sec, &sec, &usec); pcpu = (sec + usec / 1000000.0) / (EMACS_SECS (telapsed) + EMACS_USECS (telapsed) / 1000000.0); if (pcpu > 1.0) pcpu = 1.0; @@ -2848,8 +2845,10 @@ system_process_attributes (Lisp_Object pid) fd = emacs_open (fn, O_RDONLY, 0); if (fd >= 0) { - for (cmdline_size = 0; emacs_read (fd, &c, 1) == 1; cmdline_size++) + char ch; + for (cmdline_size = 0; emacs_read (fd, &ch, 1) == 1; cmdline_size++) { + c = ch; if (isspace (c) || c == '\\') cmdline_size++; /* for later quoting, see below */ } diff --git a/src/systime.h b/src/systime.h index eae302904fa..cb1ea230f7d 100644 --- a/src/systime.h +++ b/src/systime.h @@ -144,10 +144,8 @@ extern void set_waiting_for_input (EMACS_TIME *); happen when this files is used outside the src directory). Use GCPRO1 to determine if lisp.h was included. */ #ifdef GCPRO1 -/* defined in dired.c */ -extern Lisp_Object make_time (time_t); - /* defined in editfns.c*/ +extern Lisp_Object make_time (time_t); extern int lisp_time_argument (Lisp_Object, time_t *, int *); #endif @@ -172,4 +170,3 @@ extern int lisp_time_argument (Lisp_Object, time_t *, int *); #define EMACS_TIME_LE(T1, T2) (EMACS_TIME_CMP (T1, T2) <= 0) #endif /* EMACS_SYSTIME_H */ - diff --git a/src/systty.h b/src/systty.h index 2eacfdb2716..1548952e7a8 100644 --- a/src/systty.h +++ b/src/systty.h @@ -118,3 +118,6 @@ struct emacs_tty { extern int emacs_get_tty (int, struct emacs_tty *); extern int emacs_set_tty (int, struct emacs_tty *, int); +/* From sysdep.c or w32.c */ +extern int serial_open (char *); +extern void serial_configure (struct Lisp_Process *, Lisp_Object); diff --git a/src/term.c b/src/term.c index f082bb40e89..e84bbe125f8 100644 --- a/src/term.c +++ b/src/term.c @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "lisp.h" #include "termchar.h" #include "termopts.h" +#include "tparam.h" #include "buffer.h" #include "character.h" #include "charset.h" @@ -53,18 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ static int been_here = -1; #endif -/* For now, don't try to include termcap.h. On some systems, - configure finds a non-standard termcap.h that the main build - won't find. */ -extern void tputs (const char *, int, int (*)(int)); -extern int tgetent (char *, const char *); -extern int tgetflag (char *id); -extern int tgetnum (char *id); - -char *tparam (char *, char *, int, int, ...); - -extern char *tgetstr (char *, char **); - #include "cm.h" #ifdef HAVE_X_WINDOWS #include "xterm.h" @@ -262,7 +251,7 @@ tty_set_scroll_region (struct frame *f, int start, int stop) struct tty_display_info *tty = FRAME_TTY (f); if (tty->TS_set_scroll_region) - buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1); + buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1, 0, 0); else if (tty->TS_set_scroll_region_1) buf = tparam (tty->TS_set_scroll_region_1, 0, 0, FRAME_LINES (f), start, @@ -544,8 +533,8 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi { if (src->type == COMPOSITE_GLYPH) { - struct composition *cmp; - Lisp_Object gstring; + struct composition *cmp IF_LINT (= NULL); + Lisp_Object gstring IF_LINT (= Qnil); int i; nbytes = buf - encode_terminal_src; @@ -606,7 +595,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi else if (! CHAR_GLYPH_PADDING_P (*src)) { GLYPH g; - int c; + int c IF_LINT (= 0); Lisp_Object string; string = Qnil; @@ -664,8 +653,6 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi } else { - unsigned char *p = SDATA (string); - if (! STRING_MULTIBYTE (string)) string = string_to_multibyte (string); nbytes = buf - encode_terminal_src; @@ -861,7 +848,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len) if (tty->TS_ins_multi_chars) { - buf = tparam (tty->TS_ins_multi_chars, 0, 0, len); + buf = tparam (tty->TS_ins_multi_chars, 0, 0, len, 0, 0, 0); OUTPUT1 (tty, buf); xfree (buf); if (start) @@ -957,7 +944,7 @@ tty_delete_glyphs (struct frame *f, int n) if (tty->TS_del_multi_chars) { - buf = tparam (tty->TS_del_multi_chars, 0, 0, n); + buf = tparam (tty->TS_del_multi_chars, 0, 0, n, 0, 0, 0); OUTPUT1 (tty, buf); xfree (buf); } @@ -974,9 +961,10 @@ static void tty_ins_del_lines (struct frame *f, int vpos, int n) { struct tty_display_info *tty = FRAME_TTY (f); - char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; - char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; - char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; + const char *multi = + n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; + const char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; + const char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; register int i = n > 0 ? n : -n; register char *buf; @@ -999,7 +987,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n) { raw_cursor_to (f, vpos, 0); tty_background_highlight (tty); - buf = tparam (multi, 0, 0, i); + buf = tparam (multi, 0, 0, i, 0, 0, 0); OUTPUT (tty, buf); xfree (buf); } @@ -1151,9 +1139,9 @@ calculate_costs (struct frame *frame) if (FRAME_TERMCAP_P (frame)) { struct tty_display_info *tty = FRAME_TTY (frame); - register char *f = (tty->TS_set_scroll_region - ? tty->TS_set_scroll_region - : tty->TS_set_scroll_region_1); + register const char *f = (tty->TS_set_scroll_region + ? tty->TS_set_scroll_region + : tty->TS_set_scroll_region_1); FRAME_SCROLL_REGION_COST (frame) = string_cost (f); @@ -1207,7 +1195,7 @@ calculate_costs (struct frame *frame) } struct fkey_table { - char *cap, *name; + const char *cap, *name; }; /* Termcap capability names that correspond directly to X keysyms. @@ -1365,9 +1353,9 @@ term_get_fkeys_1 (void) "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. */ { - char *k_semi = tgetstr ("k;", address); - char *k0 = tgetstr ("k0", address); - char *k0_name = "f10"; + const char *k_semi = tgetstr ("k;", address); + const char *k0 = tgetstr ("k0", address); + const char *k0_name = "f10"; if (k_semi) { @@ -1460,7 +1448,7 @@ static void append_glyph (struct it *); static void produce_stretch_glyph (struct it *); static void append_composite_glyph (struct it *); static void produce_composite_glyph (struct it *); -static void append_glyphless_glyph (struct it *, int, char *); +static void append_glyphless_glyph (struct it *, int, const char *); static void produce_glyphless_glyph (struct it *, int, Lisp_Object); /* Append glyphs to IT's glyph_row. Called from produce_glyphs for @@ -1828,7 +1816,7 @@ produce_composite_glyph (struct it *it) comes from it->nglyphs bytes). */ static void -append_glyphless_glyph (struct it *it, int face_id, char *str) +append_glyphless_glyph (struct it *it, int face_id, const char *str) { struct glyph *glyph, *end; int i; @@ -1903,7 +1891,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) { int face_id; int len; - char buf[9], *str = " "; + char buf[9]; + char const *str = " "; /* Get a face ID for the glyph by utilizing a cache (the same way as done for `escape-glyph' in get_next_display_element). */ @@ -2122,12 +2111,13 @@ turn_on_face (struct frame *f, int face_id) if (tty->TN_max_colors > 0) { - char *ts, *p; + const char *ts; + char *p; ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; if (fg >= 0 && ts) { - p = tparam (ts, NULL, 0, (int) fg); + p = tparam (ts, NULL, 0, (int) fg, 0, 0, 0); OUTPUT (tty, p); xfree (p); } @@ -2135,7 +2125,7 @@ turn_on_face (struct frame *f, int face_id) ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; if (bg >= 0 && ts) { - p = tparam (ts, NULL, 0, (int) bg); + p = tparam (ts, NULL, 0, (int) bg, 0, 0, 0); OUTPUT (tty, p); xfree (p); } @@ -2698,14 +2688,14 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) Set *bar_window to Qnil, and *x and *y to the column and row of the character cell the mouse is over. - Set *time to the time the mouse was at the returned position. + Set *timeptr to the time the mouse was at the returned position. This clears mouse_moved until the next motion event arrives. */ static void term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, - Lisp_Object *y, unsigned long *time) + Lisp_Object *y, unsigned long *timeptr) { struct timeval now; @@ -2718,7 +2708,7 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, XSETINT (*x, last_mouse_x); XSETINT (*y, last_mouse_y); gettimeofday(&now, 0); - *time = (now.tv_sec * 1000) + (now.tv_usec / 1000); + *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000); } /* Prepare a mouse-event in *RESULT for placement in the input queue. @@ -3532,10 +3522,10 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ If it were in the termcap entry, it would confuse other programs. */ if (!tty->TS_set_window) { - p = tty->TS_termcap_modes; - while (*p && strcmp (p, "\033v ")) - p++; - if (*p) + const char *m = tty->TS_termcap_modes; + while (*m && strcmp (m, "\033v ")) + m++; + if (*m) tty->TS_set_window = "\033v%C %C %C %C "; } /* Termcap entry often fails to have :in: flag */ diff --git a/src/termcap.c b/src/termcap.c index 69ce56d93b3..27a20a67ae1 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -25,6 +25,10 @@ Boston, MA 02110-1301, USA. */ #include <unistd.h> #include "lisp.h" +#include "tparam.h" +#ifdef MSDOS +#include "msdos.h" +#endif #ifndef NULL #define NULL (char *) 0 @@ -65,7 +69,7 @@ static char *tgetst1 (char *ptr, char **area); 0 if not found. */ static char * -find_capability (register char *bp, register char *cap) +find_capability (register char *bp, register const char *cap) { for (; *bp; bp++) if (bp[0] == ':' @@ -76,7 +80,7 @@ find_capability (register char *bp, register char *cap) } int -tgetnum (char *cap) +tgetnum (const char *cap) { register char *ptr = find_capability (term_entry, cap); if (!ptr || ptr[-1] != '#') @@ -85,7 +89,7 @@ tgetnum (char *cap) } int -tgetflag (char *cap) +tgetflag (const char *cap) { register char *ptr = find_capability (term_entry, cap); return ptr && ptr[-1] == ':'; @@ -97,7 +101,7 @@ tgetflag (char *cap) If AREA is null, space is allocated with `malloc'. */ char * -tgetstr (char *cap, char **area) +tgetstr (const char *cap, char **area) { register char *ptr = find_capability (term_entry, cap); if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) @@ -263,7 +267,7 @@ tgetst1 (char *ptr, char **area) char PC; void -tputs (register char *str, int nlines, register int (*outfun) (/* ??? */)) +tputs (register const char *str, int nlines, int (*outfun) (int)) { register int padcount = 0; register int speed; @@ -355,7 +359,7 @@ valid_filename_p (fn) in it, and some other value otherwise. */ int -tgetent (char *bp, char *name) +tgetent (char *bp, const char *name) { register char *termcap_name; register int fd; @@ -442,7 +446,7 @@ tgetent (char *bp, char *name) buf.size = BUFSIZE; /* Add 1 to size to ensure room for terminating null. */ buf.beg = (char *) xmalloc (buf.size + 1); - term = indirect ? indirect : name; + term = indirect ? indirect : (char *)name; if (!bp) { diff --git a/src/termchar.h b/src/termchar.h index 277a96932b4..035974a8ce6 100644 --- a/src/termchar.h +++ b/src/termchar.h @@ -84,58 +84,58 @@ struct tty_display_info /* Strings, numbers and flags taken from the termcap entry. */ - char *TS_ins_line; /* "al" */ - char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */ - char *TS_bell; /* "bl" */ - char *TS_clr_to_bottom; /* "cd" */ - char *TS_clr_line; /* "ce", clear to end of line */ - char *TS_clr_frame; /* "cl" */ - char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */ - char *TS_set_scroll_region_1; /* "cS" (4 params: total lines, + const char *TS_ins_line; /* "al" */ + const char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */ + const char *TS_bell; /* "bl" */ + const char *TS_clr_to_bottom; /* "cd" */ + const char *TS_clr_line; /* "ce", clear to end of line */ + const char *TS_clr_frame; /* "cl" */ + const char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */ + const char *TS_set_scroll_region_1; /* "cS" (4 params: total lines, lines above scroll region, lines below it, total lines again) */ - char *TS_del_char; /* "dc" */ - char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */ - char *TS_del_line; /* "dl" */ - char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */ - char *TS_delete_mode; /* "dm", enter character-delete mode */ - char *TS_end_delete_mode; /* "ed", leave character-delete mode */ - char *TS_end_insert_mode; /* "ei", leave character-insert mode */ - char *TS_ins_char; /* "ic" */ - char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */ - char *TS_insert_mode; /* "im", enter character-insert mode */ - char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */ - char *TS_end_keypad_mode; /* "ke" */ - char *TS_keypad_mode; /* "ks" */ - char *TS_pad_char; /* "pc", char to use as padding */ - char *TS_repeat; /* "rp" (2 params, # times to repeat + const char *TS_del_char; /* "dc" */ + const char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */ + const char *TS_del_line; /* "dl" */ + const char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */ + const char *TS_delete_mode; /* "dm", enter character-delete mode */ + const char *TS_end_delete_mode; /* "ed", leave character-delete mode */ + const char *TS_end_insert_mode; /* "ei", leave character-insert mode */ + const char *TS_ins_char; /* "ic" */ + const char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */ + const char *TS_insert_mode; /* "im", enter character-insert mode */ + const char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */ + const char *TS_end_keypad_mode; /* "ke" */ + const char *TS_keypad_mode; /* "ks" */ + const char *TS_pad_char; /* "pc", char to use as padding */ + const char *TS_repeat; /* "rp" (2 params, # times to repeat and character to be repeated) */ - char *TS_end_standout_mode; /* "se" */ - char *TS_fwd_scroll; /* "sf" */ - char *TS_standout_mode; /* "so" */ - char *TS_rev_scroll; /* "sr" */ - char *TS_end_termcap_modes; /* "te" */ - char *TS_termcap_modes; /* "ti" */ - char *TS_visible_bell; /* "vb" */ - char *TS_cursor_normal; /* "ve" */ - char *TS_cursor_visible; /* "vs" */ - char *TS_cursor_invisible; /* "vi" */ - char *TS_set_window; /* "wi" (4 params, start and end of window, + const char *TS_end_standout_mode; /* "se" */ + const char *TS_fwd_scroll; /* "sf" */ + const char *TS_standout_mode; /* "so" */ + const char *TS_rev_scroll; /* "sr" */ + const char *TS_end_termcap_modes; /* "te" */ + const char *TS_termcap_modes; /* "ti" */ + const char *TS_visible_bell; /* "vb" */ + const char *TS_cursor_normal; /* "ve" */ + const char *TS_cursor_visible; /* "vs" */ + const char *TS_cursor_invisible; /* "vi" */ + const char *TS_set_window; /* "wi" (4 params, start and end of window, each as vpos and hpos) */ - char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ - char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ - char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */ - char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ - char *TS_exit_underline_mode; /* "us" -- start underlining. */ - char *TS_enter_underline_mode; /* "ue" -- end underlining. */ + const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ + const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ + const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */ + const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ + const char *TS_exit_underline_mode; /* "us" -- start underlining. */ + const char *TS_enter_underline_mode; /* "ue" -- end underlining. */ /* "as"/"ae" -- start/end alternate character set. Not really supported, yet. */ - char *TS_enter_alt_charset_mode; - char *TS_exit_alt_charset_mode; + const char *TS_enter_alt_charset_mode; + const char *TS_exit_alt_charset_mode; - char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */ + const char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */ /* Value of the "NC" (no_color_video) capability, or 0 if not present. */ int TN_no_color_video; @@ -147,12 +147,12 @@ struct tty_display_info int TN_max_pairs; /* "op" -- SVr4 set default pair to its original value. */ - char *TS_orig_pair; + const char *TS_orig_pair; /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color. 1 param, the color index. */ - char *TS_set_foreground; - char *TS_set_background; + const char *TS_set_foreground; + const char *TS_set_background; int TF_hazeltine; /* termcap hz flag. */ int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */ @@ -210,4 +210,3 @@ extern struct tty_display_info *tty_list; : (abort(), (struct tty_display_info *) 0)) #define CURTTY() FRAME_TTY (SELECTED_FRAME()) - diff --git a/src/termhooks.h b/src/termhooks.h index b147f6ed0a1..0ccd2dac9e1 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -654,6 +654,9 @@ extern void delete_terminal (struct terminal *); /* The initial terminal device, created by initial_term_init. */ extern struct terminal *initial_terminal; +extern unsigned char *encode_terminal_code (struct glyph *, int, + struct coding_system *); + #ifdef HAVE_GPM extern void close_gpm (int gpm_fd); #endif diff --git a/src/terminal.c b/src/terminal.c index 309cc0095e8..c5185601fb6 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -109,7 +109,7 @@ void raw_cursor_to (struct frame *f, int row, int col) { if (FRAME_TERMINAL (f)->raw_cursor_to_hook) - (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col); + (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col); } /* Erase operations */ @@ -444,7 +444,7 @@ selected frame's terminal). */) /* Set the value of terminal parameter PARAMETER in terminal D to VALUE. Return the previous value. */ -Lisp_Object +static Lisp_Object store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value) { Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); @@ -569,4 +569,3 @@ or some time later. */); Fprovide (intern_c_string ("multi-tty"), Qnil); } - diff --git a/src/tparam.c b/src/tparam.c index fcbb63881e6..6aae0b97db9 100644 --- a/src/tparam.c +++ b/src/tparam.c @@ -21,6 +21,7 @@ Boston, MA 02110-1301, USA. */ #include <config.h> #include <setjmp.h> #include "lisp.h" /* for xmalloc */ +#include "tparam.h" #ifndef NULL #define NULL (char *) 0 @@ -38,11 +39,12 @@ Boston, MA 02110-1301, USA. */ The fourth and following args to tparam serve as the parameter values. */ -static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp); +static char *tparam1 (char const *string, char *outstring, int len, + char *up, char *left, int *argp); -/* VARARGS 2 */ char * -tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3) +tparam (const char *string, char *outstring, int len, + int arg0, int arg1, int arg2, int arg3) { int arg[4]; @@ -59,7 +61,7 @@ char *UP; static char tgoto_buf[50]; char * -tgoto (char *cm, int hpos, int vpos) +tgoto (const char *cm, int hpos, int vpos) { int args[2]; if (!cm) @@ -70,10 +72,11 @@ tgoto (char *cm, int hpos, int vpos) } static char * -tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp) +tparam1 (const char *string, char *outstring, int len, + char *up, char *left, register int *argp) { register int c; - register char *p = string; + register const char *p = string; register char *op = outstring; char *outend; int outlen = 0; @@ -277,4 +280,3 @@ main (argc, argv) } #endif /* DEBUG */ - diff --git a/src/tparam.h b/src/tparam.h new file mode 100644 index 00000000000..3cd3e6053cc --- /dev/null +++ b/src/tparam.h @@ -0,0 +1,31 @@ +/* Interface definitions for termcap entries. + +Copyright (C) 2011 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ + + +/* Don't try to include termcap.h. On some systems, configure finds a + non-standard termcap.h that the main build won't find. */ + +void tputs (const char *, int, int (*) (int)); +int tgetent (char *, const char *); +int tgetflag (const char *); +int tgetnum (const char *); +char *tgetstr (const char *, char **); +char *tgoto (const char *, int, int); + +char *tparam (const char *, char *, int, int, int, int, int); diff --git a/src/unexaix.c b/src/unexaix.c index fe9d13d3e47..df4c5b8905c 100644 --- a/src/unexaix.c +++ b/src/unexaix.c @@ -40,6 +40,8 @@ what you give them. Help stamp out software-hoarding! */ */ #include <config.h> +#include "unexec.h" + #define PERROR(file) report_error (file, new) #include <a.out.h> /* Define getpagesize () if the system does not. @@ -119,7 +121,8 @@ static void write_segment (int, char *, char *); * * driving logic. */ -int unexec (const char *new_name, const char *a_name) +void +unexec (const char *new_name, const char *a_name) { int new = -1, a_out = -1; @@ -139,14 +142,13 @@ int unexec (const char *new_name, const char *a_name) || unrelocate_symbols (new, a_out, a_name, new_name) < 0) { close (new); - return -1; + return; } close (new); if (a_out >= 0) close (a_out); mark_x (new_name); - return 0; } /* **************************************************************** @@ -637,4 +639,3 @@ start_of_text (void) { return ((char *) 0x10000000); } - diff --git a/src/unexcoff.c b/src/unexcoff.c index 4dafabab689..ef86a400239 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c @@ -50,6 +50,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ */ #include <config.h> +#include "unexec.h" + #define PERROR(file) report_error (file, new) #ifndef CANNOT_DUMP /* all rest of file! */ @@ -522,7 +524,7 @@ adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name) * * driving logic. */ -int +void unexec (const char *new_name, const char *a_name) { int new = -1, a_out = -1; @@ -543,15 +545,13 @@ unexec (const char *new_name, const char *a_name) ) { close (new); - return -1; + return; } close (new); if (a_out >= 0) close (a_out); mark_x (new_name); - return 0; } #endif /* not CANNOT_DUMP */ - diff --git a/src/unexcw.c b/src/unexcw.c index 02add901bbd..f643c196de0 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> +#include "unexec.h" + #include <setjmp.h> #include <lisp.h> #include <stdio.h> @@ -247,7 +249,7 @@ add_exe_suffix_if_necessary (const char *name, char *modified) return (modified); } -int +void unexec (const char *outfile, const char *infile) { char infile_buffer[FILENAME_MAX]; @@ -261,7 +263,7 @@ unexec (const char *outfile, const char *infile) { /* can only dump once */ printf ("You can only dump Emacs once on this platform.\n"); - return (1); + return; } report_sheap_usage (1); @@ -296,7 +298,4 @@ unexec (const char *outfile, const char *infile) ret = close (fd_out); assert (ret == 0); - - return (0); } - diff --git a/src/unexec.h b/src/unexec.h new file mode 100644 index 00000000000..343eb6d8db5 --- /dev/null +++ b/src/unexec.h @@ -0,0 +1 @@ +void unexec (const char *, const char *); diff --git a/src/unexelf.c b/src/unexelf.c index 1009c87066b..b58c78501b8 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -386,6 +386,8 @@ temacs: Instead we read the whole file, modify it, and write it out. */ #include <config.h> +#include <unexec.h> + extern void fatal (const char *msgid, ...); #include <sys/types.h> @@ -518,10 +520,6 @@ typedef struct { # define ElfW(type) ElfExpandBitsW (ELFSIZE, type) #endif -#ifndef ELF_BSS_SECTION_NAME -#define ELF_BSS_SECTION_NAME ".bss" -#endif - /* Get the address of a particular section or program header entry, * accounting for the size of the entries. */ @@ -553,8 +551,6 @@ typedef struct { (*(ElfW(Shdr) *) ((byte *) old_section_h + old_file_h->e_shentsize * (n))) #define NEW_SECTION_H(n) \ (*(ElfW(Shdr) *) ((byte *) new_section_h + new_file_h->e_shentsize * (n))) -#define OLD_PROGRAM_H(n) \ - (*(ElfW(Phdr) *) ((byte *) old_program_h + old_file_h->e_phentsize * (n))) #define NEW_PROGRAM_H(n) \ (*(ElfW(Phdr) *) ((byte *) new_program_h + new_file_h->e_phentsize * (n))) @@ -623,6 +619,10 @@ unexec (const char *new_name, const char *old_name) { int new_file, old_file, new_file_size; +#if defined (emacs) || !defined (DEBUG) + void *new_break; +#endif + /* Pointers to the base of the image of the two files. */ caddr_t old_base, new_base; @@ -753,7 +753,8 @@ unexec (const char *new_name, const char *old_name) old_name, old_file_h, old_section_h, 0); #if defined (emacs) || !defined (DEBUG) - new_bss_addr = (ElfW(Addr)) sbrk (0); + new_break = sbrk (0); + new_bss_addr = (ElfW(Addr)) new_break; #else new_bss_addr = old_bss_addr + old_bss_size + 0x1234; #endif @@ -954,13 +955,13 @@ temacs: Link Info Adralgn Entsize [22] 1 3 0x335150 0x315150 0x4 .data.rel.local - 0 0 0x4 0 + 0 0 0x4 0 [23] 8 3 0x335158 0x315158 0x42720 .bss - 0 0 0x8 0 + 0 0 0x8 0 [24] 2 0 0 0x315154 0x1c9d0 .symtab - 25 1709 0x4 0x10 + 25 1709 0x4 0x10 */ if (NEW_SECTION_H (nn).sh_offset >= old_bss_offset @@ -1228,8 +1229,8 @@ temacs: ElfW(Shdr) section = NEW_SECTION_H (n); /* Cause a compilation error if anyone uses n instead of nn below. */ - struct {int a;} n; - (void)n.a; /* Prevent `unused variable' warnings. */ + #define n ((void) 0); + n /* Prevent 'macro "n" is not used' warnings. */ switch (section.sh_type) { @@ -1276,6 +1277,8 @@ temacs: } break; } + + #undef n } /* Write out new_file, and free the buffers. */ @@ -1307,4 +1310,3 @@ temacs: if (chmod (new_name, stat_buf.st_mode) == -1) fatal ("Can't chmod (%s): errno %d\n", new_name, errno); } - diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c index c0471992a72..f27415a252c 100644 --- a/src/unexhp9k800.c +++ b/src/unexhp9k800.c @@ -50,6 +50,8 @@ */ #include <config.h> +#include "unexec.h" + #include <stdio.h> #include <fcntl.h> #include <errno.h> @@ -74,7 +76,7 @@ run_time_remap (ignored) /* Create a new a.out file, same as old but with current data space */ -int +void unexec (const char *new_name, /* name of the new a.out file to be created */ const char *old_name) /* name of the old a.out file */ { @@ -131,7 +133,6 @@ unexec (const char *new_name, /* name of the new a.out file to be created * /* Close the binary file */ close (old); close (new); - return 0; } /* Save current data space in the file, update header. */ @@ -319,4 +320,3 @@ display_header (hdr, auxhdr) hdr->unloadable_sp_location, hdr->unloadable_sp_size); } #endif /* DEBUG */ - diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 7a55498085d..04e3edf463e 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -95,6 +95,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #undef malloc #undef realloc #undef free + +#include "unexec.h" + #include <stdio.h> #include <fcntl.h> #include <stdarg.h> @@ -828,6 +831,7 @@ copy_data_segment (struct load_command *lc) } else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 + || strncmp (sectp->sectname, "__got", 16) == 0 || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0 || strncmp (sectp->sectname, "__dyld", 16) == 0 || strncmp (sectp->sectname, "__const", 16) == 0 @@ -1223,7 +1227,7 @@ dump_it (void) from it. The file names of the output and input files are outfile and infile, respectively. The three other parameters are ignored. */ -int +void unexec (const char *outfile, const char *infile) { if (in_dumped_exec) @@ -1254,7 +1258,6 @@ unexec (const char *outfile, const char *infile) dump_it (); close (outfd); - return 0; } @@ -1379,4 +1382,3 @@ unexec_free (void *ptr) else malloc_zone_free (emacs_zone, (unexec_malloc_header_t *) ptr - 1); } - diff --git a/src/unexsol.c b/src/unexsol.c index e1a10f7d211..ef1e34e6f0f 100644 --- a/src/unexsol.c +++ b/src/unexsol.c @@ -1,6 +1,8 @@ /* Trivial unexec for Solaris. */ #include <config.h> +#include "unexec.h" + #include <dlfcn.h> #include <setjmp.h> @@ -9,14 +11,14 @@ #include "charset.h" #include "coding.h" -int +void unexec (const char *new_name, const char *old_name) { Lisp_Object data; Lisp_Object errstring; if (! dldump (0, new_name, RTLD_MEMORY)) - return 0; + return; data = Fcons (build_string (new_name), Qnil); synchronize_system_messages_locale (); @@ -26,4 +28,3 @@ unexec (const char *new_name, const char *old_name) xsignal (Qfile_error, Fcons (build_string ("Cannot unexec"), Fcons (errstring, data))); } - diff --git a/src/unexw32.c b/src/unexw32.c index 829c864c960..cd8211d6bee 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ */ #include <config.h> +#include "unexec.h" #include <stdio.h> #include <fcntl.h> @@ -723,7 +724,7 @@ copy_executable_and_dump_data (file_data *p_infile, /* Dump out .data and .bss sections into a new executable. */ -int +void unexec (const char *new_name, const char *old_name) { file_data in_file, out_file; @@ -819,9 +820,6 @@ unexec (const char *new_name, const char *old_name) close_file_data (&in_file); close_file_data (&out_file); - - return 0; } /* eof */ - diff --git a/src/w32.c b/src/w32.c index ae2373be46e..721cea07d20 100644 --- a/src/w32.c +++ b/src/w32.c @@ -147,9 +147,6 @@ typedef HRESULT (WINAPI * ShGetFolderPath_fn) void globals_of_w32 (void); static DWORD get_rid (PSID); -/* Defined in process.c for its own purpose. */ -extern Lisp_Object Qlocal; - /* Initialization states. @@ -5666,8 +5663,6 @@ sys_write (int fd, const void * buffer, unsigned int count) static void check_windows_init_file (void) { - extern int noninteractive, inhibit_window_system; - /* A common indication that Emacs is not installed properly is when it cannot find the Windows installation file. If this file does not exist in the expected place, tell the user. */ diff --git a/src/w32console.c b/src/w32console.c index 31c4a7c4e5a..3c200405cb5 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -41,12 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* from window.c */ extern Lisp_Object Frecenter (Lisp_Object); -/* from keyboard.c */ -extern int detect_input_pending (void); - -/* from sysdep.c */ -extern int read_input_pending (void); - static void w32con_move_cursor (struct frame *f, int row, int col); static void w32con_clear_to_end (struct frame *f); static void w32con_clear_frame (struct frame *f); @@ -277,9 +271,6 @@ w32con_insert_glyphs (struct frame *f, register struct glyph *start, } } -extern unsigned char *encode_terminal_code (struct glyph *, int, - struct coding_system *); - static void w32con_write_glyphs (struct frame *f, register struct glyph *string, register int len) diff --git a/src/w32fns.c b/src/w32fns.c index ec48397657a..0c899cdceff 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -60,6 +60,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <dlgs.h> #include <imm.h> #define FILE_NAME_TEXT_FIELD edt1 +#define FILE_NAME_COMBO_BOX cmb13 +#define FILE_NAME_LIST lst1 #include "font.h" #include "w32font.h" @@ -78,10 +80,6 @@ extern void w32_menu_display_help (HWND, HMENU, UINT, UINT); extern void w32_free_menu_strings (HWND); extern const char *map_w32_filename (const char *, const char **); -extern int quit_char; - -extern const char *const lispy_function_keys[]; - /* If non-zero, a w32 timer that, when it expires, displays an hourglass cursor on all frames. */ static unsigned hourglass_timer = 0; @@ -185,18 +183,10 @@ unsigned int msh_mousewheel = 0; #define MENU_FREE_DELAY 1000 static unsigned menu_free_timer = 0; -extern Lisp_Object Qtooltip; - #ifdef GLYPH_DEBUG int image_cache_refcount, dpyinfo_refcount; #endif - -extern HWND w32_system_caret_hwnd; - -extern int w32_system_caret_height; -extern int w32_system_caret_x; -extern int w32_system_caret_y; static HWND w32_visible_system_caret_hwnd; /* From w32menu.c */ @@ -5849,7 +5839,6 @@ Value is t if tooltip was open, nil otherwise. */) /*********************************************************************** File selection dialog ***********************************************************************/ -extern Lisp_Object Qfile_name_history; /* Callback for altering the behavior of the Open File dialog. Makes the Filename text field contain "Current Directory" and be @@ -5868,13 +5857,37 @@ file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND dialog = GetParent (hwnd); HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); + HWND list = GetDlgItem (dialog, FILE_NAME_LIST); - /* Directories is in index 2. */ + /* At least on Windows 7, the above attempt to get the window handle + to the File Name Text Field fails. The following code does the + job though. Note that this code is based on my examination of the + window hierarchy using Microsoft Spy++. bk */ + if (edit_control == NULL) + { + HWND tmp = GetDlgItem (dialog, FILE_NAME_COMBO_BOX); + if (tmp) + { + tmp = GetWindow (tmp, GW_CHILD); + if (tmp) + edit_control = GetWindow (tmp, GW_CHILD); + } + } + + /* Directories is in index 2. */ if (notify->lpOFN->nFilterIndex == 2) { CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, "Current Directory"); EnableWindow (edit_control, FALSE); + /* Note that at least on Windows 7, the above call to EnableWindow + disables the window that would ordinarily have focus. If we + do not set focus to some other window here, focus will land in + no man's land and the user will be unable to tab through the + dialog box (pressing tab will only result in a beep). + Avoid that problem by setting focus to the list here. */ + if (notify->hdr.code == CDN_INITDONE) + SetFocus (list); } else { @@ -5951,6 +5964,13 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) else filename[0] = '\0'; + /* The code in file_dialog_callback that attempts to set the text + of the file name edit window when handling the CDN_INITDONE + WM_NOTIFY message does not work. Setting filename to "Current + Directory" in the only_dir_p case here does work however. */ + if (filename[0] == 0 && ! NILP (only_dir_p)) + strcpy (filename, "Current Directory"); + { NEWOPENFILENAME new_file_details; BOOL file_opened = FALSE; diff --git a/src/w32font.c b/src/w32font.c index aef62f61a3a..40ff0782b88 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -54,8 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define JOHAB_CHARSET 130 #endif -extern struct font_driver w32font_driver; - Lisp_Object Qgdi; Lisp_Object Quniscribe; static Lisp_Object QCformat; @@ -64,7 +62,6 @@ static Lisp_Object Qserif, Qscript, Qdecorative; static Lisp_Object Qraster, Qoutline, Qunknown; /* antialiasing */ -extern Lisp_Object QCantialias, QCotf, QClang; /* defined in font.c */ extern Lisp_Object Qnone; /* reuse from w32fns.c */ static Lisp_Object Qstandard, Qsubpixel, Qnatural; diff --git a/src/w32inevt.c b/src/w32inevt.c index d0b097100fd..c4858dea908 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -40,18 +40,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "w32heap.h" #include "w32term.h" -/* stdin, from ntterm */ +/* stdin, from w32console.c */ extern HANDLE keyboard_handle; /* Info for last mouse motion */ static COORD movement_pos; static DWORD movement_time; -/* from keyboard.c */ -extern void reinvoke_input_signal (void); - +/* from w32fns.c */ extern unsigned int map_keypad_keys (unsigned int, unsigned int); - extern unsigned int w32_key_to_modifier (int key); /* Event queue */ @@ -261,8 +258,6 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event) } -extern const char *const lispy_function_keys[]; - static int faked_key = 0; /* return code -1 means that event_queue_ptr won't be incremented. diff --git a/src/w32menu.c b/src/w32menu.c index 92447eb9fae..a2e62f24f6a 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -84,14 +84,6 @@ MessageBoxW_Proc unicode_message_box = NULL; Lisp_Object Qdebug_on_next_call; -extern Lisp_Object Qmenu_bar; - -extern Lisp_Object QCtoggle, QCradio; - -extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; - -extern Lisp_Object Qmenu_bar_update_hook; - void set_frame_menubar (FRAME_PTR, int, int); #ifdef HAVE_DIALOGS diff --git a/src/w32proc.c b/src/w32proc.c index bb8b428ffe4..e94d9aa3254 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -67,8 +67,6 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD); + ((DWORD)(var) - (section)->VirtualAddress) \ + (filedata).file_base)) -extern Lisp_Object Qlocal; - Lisp_Object Qhigh, Qlow; #ifdef EMACSDEBUG @@ -1053,7 +1051,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) detect that we were woken up by C-g, we return -1 with errno set to EINTR as on Unix. */ -/* From ntterm.c */ +/* From w32console.c */ extern HANDLE keyboard_handle; /* From w32xfns.c */ @@ -1559,8 +1557,6 @@ sys_kill (int pid, int sig) return rc; } -/* extern int report_file_error (char *, Lisp_Object); */ - /* The following two routines are used to manipulate stdin, stdout, and stderr of our child processes. @@ -1660,7 +1656,7 @@ set_process_dir (char * dir) dial-up users to only be connected when they actually need to use socket services. */ -/* From nt.c */ +/* From w32.c */ extern HANDLE winsock_lib; extern BOOL term_winsock (void); extern BOOL init_winsock (int load_now); diff --git a/src/w32select.c b/src/w32select.c index 23d5fb68c77..ef0cb3adc24 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -78,7 +78,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "w32term.h" /* for all of the w32 includes */ #include "w32heap.h" /* os_subtype */ #include "blockinput.h" -#include "keyboard.h" /* cmd_error_internal() */ #include "charset.h" #include "coding.h" #include "character.h" @@ -391,6 +390,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg) with global variables and calling strange looking functions. Is this really the right way to run Lisp callbacks? */ + extern int waiting_for_input; /* from keyboard.c */ int owfi; BLOCK_INPUT; diff --git a/src/w32term.c b/src/w32term.c index 67e853f21f0..f31c4e90e77 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -88,8 +88,6 @@ extern void free_frame_menubar (struct frame *); extern int w32_codepage_for_font (char *fontname); extern Cursor w32_load_cursor (LPCTSTR name); -extern Lisp_Object Vwindow_system; - #define x_any_window_to_frame x_window_to_frame #define x_top_window_to_frame x_window_to_frame @@ -138,13 +136,6 @@ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); #define WS_EX_LAYERED 0x80000 #endif -/* Frame being updated by update_frame. This is declared in term.c. - This is set by update_begin and looked at by all the - w32 functions. It is zero while not inside an update. - In that case, the w32 functions assume that `SELECTED_FRAME ()' - is the frame to apply to. */ -extern struct frame *updating_frame; - /* This is a frame waiting to be autoraised, within w32_read_socket. */ struct frame *pending_autoraise_frame; @@ -2536,8 +2527,7 @@ x_delete_glyphs (struct frame *f, register int n) } -/* Clear entire frame. If updating_frame is non-null, clear that - frame. Otherwise clear the selected frame. */ +/* Clear entire frame. */ static void x_clear_frame (struct frame *f) @@ -6060,7 +6050,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) terminal->mouse_position_hook = w32_mouse_position; terminal->frame_rehighlight_hook = w32_frame_rehighlight; terminal->frame_raise_lower_hook = w32_frame_raise_lower; - // terminal->fullscreen_hook = XTfullscreen_hook; + /* terminal->fullscreen_hook = XTfullscreen_hook; */ terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar; terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars; terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar; diff --git a/src/w32term.h b/src/w32term.h index c79352a8db8..cf6751b7d63 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -547,7 +547,7 @@ do { \ #define WM_APPCOMMAND 0x319 #define GET_APPCOMMAND_LPARAM(lParam) (HIWORD(lParam) & 0x7fff) #endif -#ifndef WM_UNICHAR +#ifndef WM_UNICHAR #define WM_UNICHAR 0x109 #endif #ifndef UNICODE_NOCHAR @@ -697,3 +697,7 @@ typedef BOOL (WINAPI * AppendMenuW_Proc) ( IN UINT_PTR, IN LPCWSTR); +extern HWND w32_system_caret_hwnd; +extern int w32_system_caret_height; +extern int w32_system_caret_x; +extern int w32_system_caret_y; diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 319f934e3bb..39d1ee5c851 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -52,10 +52,6 @@ int uniscribe_available = 0; extern Lisp_Object Quniscribe; extern Lisp_Object Qopentype; -extern int initialized; - -extern struct font_driver uniscribe_font_driver; - /* EnumFontFamiliesEx callback. */ static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *, NEWTEXTMETRICEX *, diff --git a/src/w32xfns.c b/src/w32xfns.c index df9acca5fb9..fbbf11bd65c 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -97,7 +97,7 @@ select_palette (FRAME_PTR f, HDC hdc) else f->output_data.w32->old_palette = NULL; - if (RealizePalette (hdc)) + if (RealizePalette (hdc) != GDI_ERROR) { Lisp_Object frame, framelist; FOR_EACH_FRAME (framelist, frame) diff --git a/src/window.c b/src/window.c index 9a0955955fa..f35815d757c 100644 --- a/src/window.c +++ b/src/window.c @@ -2209,13 +2209,13 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame case DELETE_BUFFER_WINDOWS: if (EQ (w->buffer, obj)) { - struct frame *f = XFRAME (WINDOW_FRAME (w)); + struct frame *fr = XFRAME (WINDOW_FRAME (w)); /* If this window is dedicated, and in a frame of its own, kill the frame. */ - if (EQ (window, FRAME_ROOT_WINDOW (f)) + if (EQ (window, FRAME_ROOT_WINDOW (fr)) && !NILP (w->dedicated) - && other_visible_frames (f)) + && other_visible_frames (fr)) { /* Skip the other windows on this frame. There might be one, the minibuffer! */ @@ -2267,16 +2267,16 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame if (EQ (w->buffer, obj)) { Lisp_Object buffer; - struct frame *f = XFRAME (w->frame); + struct frame *fr = XFRAME (w->frame); /* Find another buffer to show in this window. */ buffer = Fother_buffer (obj, Qnil, w->frame); /* If this window is dedicated, and in a frame of its own, kill the frame. */ - if (EQ (window, FRAME_ROOT_WINDOW (f)) + if (EQ (window, FRAME_ROOT_WINDOW (fr)) && !NILP (w->dedicated) - && other_visible_frames (f)) + && other_visible_frames (fr)) { /* Skip the other windows on this frame. There might be one, the minibuffer! */ @@ -2290,11 +2290,11 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame } else if (!NILP (w->dedicated) && !NILP (w->parent)) { - Lisp_Object window; - XSETWINDOW (window, w); + Lisp_Object window_to_delete; + XSETWINDOW (window_to_delete, w); /* If this window is dedicated and not the only window in its frame, then kill it. */ - Fdelete_window (window); + Fdelete_window (window_to_delete); } else { @@ -3124,7 +3124,7 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs } else if (!NILP (*forward)) { - int fixed_size, each, extra, n; + int fixed_size, each IF_LINT (= 0), extra IF_LINT (= 0), n; int resize_fixed_p, nfixed; int last_pos, first_pos, nchildren, total; int *new_sizes = NULL; @@ -3170,11 +3170,11 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs last_pos = first_pos; for (n = 0, child = *forward; !NILP (child); child = c->next, ++n) { - int new_size, old_size; + int new_child_size, old_child_size; c = XWINDOW (child); - old_size = WINDOW_TOTAL_SIZE (c, width_p); - new_size = old_size; + old_child_size = WINDOW_TOTAL_SIZE (c, width_p); + new_child_size = old_child_size; /* The top or left edge position of this child equals the bottom or right edge of its predecessor. */ @@ -3186,18 +3186,20 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs /* If this child can be resized, do it. */ if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) { - new_size = new_sizes ? new_sizes[n] : old_size + each + extra; + new_child_size = + new_sizes ? new_sizes[n] : old_child_size + each + extra; extra = 0; } /* Set new size. Note that size_window also propagates edge positions to children, so it's not a no-op if we didn't change the child's size. */ - size_window (child, new_size, width_p, 1, first_only, last_only); + size_window (child, new_child_size, width_p, 1, + first_only, last_only); /* Remember the bottom/right edge position of this child; it will be used to set the top/left edge of the next child. */ - last_pos += new_size; + last_pos += new_child_size; } xfree (new_sizes); @@ -3325,12 +3327,12 @@ run_window_configuration_change_hook (struct frame *f) if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, buffer))) { - int count = SPECPDL_INDEX (); + int count1 = SPECPDL_INDEX (); record_unwind_protect (select_window_norecord, Fselected_window ()); select_window_norecord (window); run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, buffer)); - unbind_to (count, Qnil); + unbind_to (count1, Qnil); } } } @@ -3602,7 +3604,7 @@ select_frame_norecord (Lisp_Object frame) ? Fselect_frame (frame, Qt) : selected_frame; } -Lisp_Object +static Lisp_Object display_buffer (Lisp_Object buffer, Lisp_Object not_this_window_p, Lisp_Object override_frame) { return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame); @@ -4128,7 +4130,7 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag) { /* If trying to grow this window to or beyond size of the parent, just delete all the sibling windows. */ - Lisp_Object start, tem, next; + Lisp_Object start, tem; start = XWINDOW (parent)->vchild; if (NILP (start)) @@ -4138,9 +4140,9 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag) tem = XWINDOW (window)->next; while (! NILP (tem)) { - next = XWINDOW (tem)->next; + Lisp_Object next1 = XWINDOW (tem)->next; delete_window (tem); - tem = next; + tem = next1; } /* Delete any siblings that come after WINDOW. @@ -4149,9 +4151,9 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag) tem = start; while (! EQ (tem, window)) { - next = XWINDOW (tem)->next; + Lisp_Object next1 = XWINDOW (tem)->next; delete_window (tem); - tem = next; + tem = next1; } } else @@ -5529,7 +5531,7 @@ and redisplay normally--don't erase and redraw the frame. */) struct buffer *obuf = current_buffer; int center_p = 0; EMACS_INT charpos, bytepos; - int iarg; + int iarg IF_LINT (= 0); int this_scroll_margin; /* If redisplay is suppressed due to an error, try again. */ @@ -7211,4 +7213,3 @@ keys_of_window (void) initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); initial_define_key (meta_map, 'v', "scroll-down-command"); } - diff --git a/src/window.h b/src/window.h index 9f0809e4f16..ad627aca340 100644 --- a/src/window.h +++ b/src/window.h @@ -778,6 +778,7 @@ extern void freeze_window_starts (struct frame *, int); extern void grow_mini_window (struct window *, int); extern void shrink_mini_window (struct window *); extern int window_relative_x_coord (struct window *, enum window_part, int); +extern void check_all_windows (void); void run_window_configuration_change_hook (struct frame *f); diff --git a/src/xdisp.c b/src/xdisp.c index 44cb7130119..a7955f41e0c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10909,7 +10909,7 @@ hscroll_window_tree (Lisp_Object window) current_buffer = XBUFFER (w->buffer); if (w == XWINDOW (selected_window)) - pt = BUF_PT (current_buffer); + pt = PT; else { pt = marker_position (w->pointm); @@ -11347,7 +11347,7 @@ reconsider_clip_changes (struct window *w, struct buffer *b) EMACS_INT pt; if (w == XWINDOW (selected_window)) - pt = BUF_PT (current_buffer); + pt = PT; else pt = marker_position (w->pointm); @@ -13697,6 +13697,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) int buffer_unchanged_p = 0; int temp_scroll_step = 0; int count = SPECPDL_INDEX (); + int rc; int centering_position = -1; int last_line_misfit = 0; EMACS_INT beg_unchanged, end_unchanged; @@ -14008,15 +14009,12 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* Handle case where text has not changed, only point, and it has not moved off the frame, and we are not retrying after hscroll. (current_matrix_up_to_date_p is nonzero when retrying.) */ - if (current_matrix_up_to_date_p) + if (current_matrix_up_to_date_p + && (rc = try_cursor_movement (window, startp, &temp_scroll_step), + rc != CURSOR_MOVEMENT_CANNOT_BE_USED)) { - int rc = try_cursor_movement (window, startp, &temp_scroll_step); - switch (rc) { - case CURSOR_MOVEMENT_CANNOT_BE_USED: - break; - case CURSOR_MOVEMENT_SUCCESS: used_current_matrix_p = 1; goto done; @@ -14165,11 +14163,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p) { /* The function returns -1 if new fonts were loaded, 1 if successful, 0 if not successful. */ - int rc = try_scrolling (window, just_this_one_p, + int ss = try_scrolling (window, just_this_one_p, scroll_conservatively, emacs_scroll_step, temp_scroll_step, last_line_misfit); - switch (rc) + switch (ss) { case SCROLLING_SUCCESS: goto done; @@ -17231,14 +17229,16 @@ display_line (struct it *it) struct glyph_row *row = it->glyph_row; Lisp_Object overlay_arrow_string; struct it wrap_it; - int may_wrap = 0, wrap_x; - int wrap_row_used = -1, wrap_row_ascent, wrap_row_height; - int wrap_row_phys_ascent, wrap_row_phys_height; - int wrap_row_extra_line_spacing; - EMACS_INT wrap_row_min_pos, wrap_row_min_bpos; - EMACS_INT wrap_row_max_pos, wrap_row_max_bpos; + int may_wrap = 0, wrap_x IF_LINT (= 0); + int wrap_row_used = -1; + int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0); + int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0); + int wrap_row_extra_line_spacing IF_LINT (= 0); + EMACS_INT wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0); + EMACS_INT wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0); int cvpos; - EMACS_INT min_pos = ZV + 1, min_bpos, max_pos = 0, max_bpos; + EMACS_INT min_pos = ZV + 1, max_pos = 0; + EMACS_INT min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0); /* We always start displaying at hpos zero even if hscrolled. */ xassert (it->hpos == 0 && it->current_x == 0); @@ -17912,16 +17912,13 @@ paragraphs, text begins at the right margin and is read from right to left. See also `bidi-paragraph-direction'. */) (Lisp_Object buffer) { - struct buffer *buf; - struct buffer *old; + struct buffer *buf = current_buffer; + struct buffer *old = buf; - if (NILP (buffer)) - buf = current_buffer; - else + if (! NILP (buffer)) { CHECK_BUFFER (buffer); buf = XBUFFER (buffer); - old = current_buffer; } if (NILP (BVAR (buf, bidi_display_reordering))) @@ -17938,8 +17935,7 @@ See also `bidi-paragraph-direction'. */) EMACS_INT bytepos = BUF_PT_BYTE (buf); int c; - if (buf != current_buffer) - set_buffer_temp (buf); + set_buffer_temp (buf); /* bidi_paragraph_init finds the base direction of the paragraph by searching forward from paragraph start. We need the base direction of the current or _previous_ paragraph, so we need @@ -17967,8 +17963,7 @@ See also `bidi-paragraph-direction'. */) itb.paragraph_dir = NEUTRAL_DIR; bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); - if (buf != current_buffer) - set_buffer_temp (old); + set_buffer_temp (old); switch (itb.paragraph_dir) { case L2R: @@ -21092,7 +21087,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) int cmp_id = (row)->glyphs[area][START].u.cmp.id; \ struct composition *cmp = composition_table[cmp_id]; \ XChar2b *char2b; \ - struct glyph_string *first_s; \ + struct glyph_string *first_s IF_LINT (= NULL); \ int n; \ \ char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \ @@ -21296,7 +21291,8 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, { struct glyph_string *h, *t; Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - int mouse_beg_col, mouse_end_col, check_mouse_face = 0; + int mouse_beg_col IF_LINT (= 0), mouse_end_col IF_LINT (= 0); + int check_mouse_face = 0; int dummy_x = 0; /* If mouse highlighting is on, we may need to draw adjacent @@ -22292,7 +22288,13 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) if (metrics_upper.width >= metrics_lower.width) lower_xoff = (width - metrics_lower.width) / 2; else - upper_xoff = (width - metrics_upper.width) / 2; + { + /* FIXME: This code doesn't look right. It formerly was + missing the "lower_xoff = 0;", which couldn't have + been right since it left lower_xoff uninitialized. */ + lower_xoff = 0; + upper_xoff = (width - metrics_upper.width) / 2; + } } /* +5 is for horizontal bars of a box plus 1-pixel spaces at @@ -25453,7 +25455,8 @@ note_mouse_highlight (struct frame *f, int x, int y) { /* The mouse-highlighting, if any, comes from an overlay or text property in the buffer. */ - Lisp_Object buffer, cover_string; + Lisp_Object buffer IF_LINT (= Qnil); + Lisp_Object cover_string IF_LINT (= Qnil); if (STRINGP (object)) { diff --git a/src/xfaces.c b/src/xfaces.c index 4cc47c85050..0fc5dd6f8a3 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -297,16 +297,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) -/* Make a copy of string S on the stack using alloca. Value is a pointer - to the copy. */ - -#define STRDUPA(S) strcpy ((char *) alloca (strlen ((S)) + 1), (S)) - -/* Make a copy of the contents of Lisp string S on the stack using - alloca. Value is a pointer to the copy. */ - -#define LSTRDUPA(S) STRDUPA (SDATA ((S))) - /* Size of hash table of realized faces in face caches (should be a prime number). */ @@ -847,7 +837,6 @@ clear_face_cache (int clear_fonts_p) { #ifdef HAVE_WINDOW_SYSTEM Lisp_Object tail, frame; - struct frame *f; if (clear_fonts_p || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT) @@ -875,7 +864,7 @@ clear_face_cache (int clear_fonts_p) /* Clear GCs of realized faces. */ FOR_EACH_FRAME (tail, frame) { - f = XFRAME (frame); + struct frame *f = XFRAME (frame); if (FRAME_WINDOW_P (f)) clear_face_gcs (FRAME_FACE_CACHE (f)); } @@ -1113,7 +1102,7 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor /* A version of defined_color for non-X frames. */ -int +static int tty_defined_color (struct frame *f, const char *color_name, XColor *color_def, int alloc) { @@ -1721,7 +1710,7 @@ the WIDTH times as wide as FACE on FRAME. */) (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width) { struct frame *f; - int size, avgwidth; + int size, avgwidth IF_LINT (= 0); check_x (); CHECK_STRING (pattern); @@ -1754,14 +1743,14 @@ the WIDTH times as wide as FACE on FRAME. */) /* This is of limited utility since it works with character widths. Keep it for compatibility. --gerd. */ int face_id = lookup_named_face (f, face, 0); - struct face *face = (face_id < 0 - ? NULL - : FACE_FROM_ID (f, face_id)); + struct face *width_face = (face_id < 0 + ? NULL + : FACE_FROM_ID (f, face_id)); - if (face && face->font) + if (width_face && width_face->font) { - size = face->font->pixel_size; - avgwidth = face->font->average_width; + size = width_face->font->pixel_size; + avgwidth = width_face->font->average_width; } else { @@ -1838,6 +1827,7 @@ the WIDTH times as wide as FACE on FRAME. */) #define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) #define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) +#if XASSERTS /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ @@ -1845,6 +1835,7 @@ the WIDTH times as wide as FACE on FRAME. */) (VECTORP (LFACE) \ && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ && EQ (AREF (LFACE, 0), Qface)) +#endif #if GLYPH_DEBUG @@ -2252,7 +2243,7 @@ set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object `relative' heights; the returned value is always an absolute height unless both FROM and TO are relative. */ -Lisp_Object +static Lisp_Object merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid) { Lisp_Object result = invalid; @@ -3869,19 +3860,19 @@ return the font name used for CHARACTER. */) { struct frame *f = frame_or_selected_frame (frame, 1); int face_id = lookup_named_face (f, face, 1); - struct face *face = FACE_FROM_ID (f, face_id); + struct face *fface = FACE_FROM_ID (f, face_id); - if (! face) + if (! fface) return Qnil; #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f) && !NILP (character)) { CHECK_CHARACTER (character); - face_id = FACE_FOR_CHAR (f, face, XINT (character), -1, Qnil); - face = FACE_FROM_ID (f, face_id); + face_id = FACE_FOR_CHAR (f, fface, XINT (character), -1, Qnil); + fface = FACE_FROM_ID (f, face_id); } - return (face->font - ? face->font->props[FONT_NAME_INDEX] + return (fface->font + ? fface->font->props[FONT_NAME_INDEX] : Qnil); #else /* !HAVE_WINDOW_SYSTEM */ return build_string (FRAME_MSDOS_P (f) @@ -4313,45 +4304,6 @@ free_realized_faces (struct face_cache *c) } -/* Free all realized faces that are using FONTSET on frame F. */ - -void -free_realized_faces_for_fontset (struct frame *f, int fontset) -{ - struct face_cache *cache = FRAME_FACE_CACHE (f); - struct face *face; - int i; - - /* We must block input here because we can't process X events safely - while only some faces are freed, or when the frame's current - matrix still references freed faces. */ - BLOCK_INPUT; - - for (i = 0; i < cache->used; i++) - { - face = cache->faces_by_id[i]; - if (face - && face->fontset == fontset) - { - uncache_face (cache, face); - free_realized_face (f, face); - } - } - - /* Must do a thorough redisplay the next time. Mark current - matrices as invalid because they will reference faces freed - above. This function is also called when a frame is destroyed. - In this case, the root window of F is nil. */ - if (WINDOWP (f->root_window)) - { - clear_current_matrices (f); - ++windows_or_buffers_changed; - } - - UNBLOCK_INPUT; -} - - /* Free all realized faces on FRAME or on all frames if FRAME is nil. This is done after attributes of a named face have been changed, because we can't tell which realized faces depend on that face. */ @@ -5287,10 +5239,6 @@ be found. Value is ALIST. */) #ifdef HAVE_WINDOW_SYSTEM -/* Ignore the difference of font point size less than this value. */ - -#define FONT_POINT_SIZE_QUANTUM 5 - /* Return the fontset id of the base fontset name or alias name given by the fontset attribute of ATTRS. Value is -1 if the fontset attribute of ATTRS doesn't name a fontset. */ @@ -6349,7 +6297,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) CHECK_STRING (filename); abspath = Fexpand_file_name (filename, Qnil); - fp = fopen (SDATA (filename), "rt"); + fp = fopen (SDATA (abspath), "rt"); if (fp) { char buf[512]; diff --git a/src/xfns.c b/src/xfns.c index deb0e192a54..e50d6887179 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -461,7 +461,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr) Window win = f->output_data.x->parent_desc; Atom actual_type; unsigned long actual_size, bytes_remaining; - int i, rc, actual_format; + int rc, actual_format; struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); long max_len = 400; Display *dpy = FRAME_X_DISPLAY (f); @@ -648,7 +648,7 @@ x_defined_color (struct frame *f, const char *color_name, is a monochrome frame, return MONO_COLOR regardless of what ARG says. Signal an error if color can't be allocated. */ -int +static int x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color) { XColor cdef; @@ -746,7 +746,6 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file) int xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data) { - int result = 0; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); if (!pixbuf) @@ -1635,7 +1634,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name) suggesting a new name, which lisp code should override; if F->explicit_name is set, ignore the new name; otherwise, set it. */ -void +static void x_set_name (struct frame *f, Lisp_Object name, int explicit) { /* Make sure that requests from lisp code override requests from @@ -2620,7 +2619,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only) #else /* not USE_X_TOOLKIT */ #ifdef USE_GTK -void +static void x_window (FRAME_PTR f) { if (! xg_create_frame_widgets (f)) @@ -2660,7 +2659,7 @@ x_window (FRAME_PTR f) #else /*! USE_GTK */ /* Create and set up the X window for frame F. */ -void +static void x_window (struct frame *f) { XClassHint class_hints; @@ -3184,7 +3183,7 @@ This function is an internal primitive--use `make-frame' instead. */) to get the color reference counts right, so initialize them! */ { Lisp_Object black; - struct gcpro gcpro1; + struct gcpro inner_gcpro1; /* Function x_decode_color can signal an error. Make sure to initialize color slots so that we won't try @@ -3197,7 +3196,7 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_data.x->mouse_pixel = -1; black = build_string ("black"); - GCPRO1 (black); + GCPRO1_VAR (black, inner_gcpro); FRAME_FOREGROUND_PIXEL (f) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); FRAME_BACKGROUND_PIXEL (f) @@ -3210,7 +3209,7 @@ This function is an internal primitive--use `make-frame' instead. */) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); f->output_data.x->mouse_pixel = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); - UNGCPRO; + UNGCPRO_VAR (inner_gcpro); } /* Specify the parent under which to make this X window. */ @@ -3448,8 +3447,9 @@ This function is an internal primitive--use `make-frame' instead. */) else if (! NILP (visibility)) x_make_frame_visible (f); else - /* Must have been Qnil. */ - ; + { + /* Must have been Qnil. */ + } } BLOCK_INPUT; @@ -4577,7 +4577,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object text) { struct frame *f; - Lisp_Object frame, tem; + Lisp_Object frame; Lisp_Object name; long window_prompting = 0; int width, height; @@ -4651,7 +4651,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, to get the color reference counts right, so initialize them! */ { Lisp_Object black; - struct gcpro gcpro1; + struct gcpro inner_gcpro1; /* Function x_decode_color can signal an error. Make sure to initialize color slots so that we won't try @@ -4664,7 +4664,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, f->output_data.x->mouse_pixel = -1; black = build_string ("black"); - GCPRO1 (black); + GCPRO1_VAR (black, inner_gcpro); FRAME_FOREGROUND_PIXEL (f) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); FRAME_BACKGROUND_PIXEL (f) @@ -4677,7 +4677,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); f->output_data.x->mouse_pixel = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); - UNGCPRO; + UNGCPRO_VAR (inner_gcpro); } /* Set the name; the functions to which we pass f expect the name to @@ -5035,7 +5035,7 @@ Text larger than the specified size is clipped. */) && !NILP (Fequal (last_string, string)) && !NILP (Fequal (last_parms, parms))) { - struct frame *f = XFRAME (tip_frame); + struct frame *tip_f = XFRAME (tip_frame); /* Only DX and DY have changed. */ if (!NILP (tip_timer)) @@ -5046,9 +5046,9 @@ Text larger than the specified size is clipped. */) } BLOCK_INPUT; - compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f), - FRAME_PIXEL_HEIGHT (f), &root_x, &root_y); - XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), + FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y); + XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f), root_x, root_y); UNBLOCK_INPUT; goto start_timer; @@ -5565,11 +5565,11 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) BLOCK_INPUT; if (STRINGP (default_filename)) - cdef_file = SDATA (default_filename); + cdef_file = SSDATA (default_filename); else - cdef_file = SDATA (dir); + cdef_file = SSDATA (dir); - fn = xg_get_file_name (f, SDATA (prompt), cdef_file, + fn = xg_get_file_name (f, SSDATA (prompt), cdef_file, ! NILP (mustmatch), ! NILP (only_dir_p)); @@ -5625,12 +5625,12 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) XSETFONT (font, FRAME_FONT (f)); font_param = Ffont_get (font, intern (":name")); if (STRINGP (font_param)) - default_name = xstrdup (SDATA (font_param)); + default_name = xstrdup (SSDATA (font_param)); else { font_param = Fframe_parameter (frame, Qfont_param); if (STRINGP (font_param)) - default_name = xstrdup (SDATA (font_param)); + default_name = xstrdup (SSDATA (font_param)); } if (default_name == NULL && x_last_font_name != NULL) @@ -5694,7 +5694,7 @@ present and mapped to the usual X keysyms. */) struct frame *f = check_x_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); Lisp_Object have_keys; - int major, minor, op, event, error; + int major, minor, op, event, error_code; BLOCK_INPUT; @@ -5710,7 +5710,7 @@ present and mapped to the usual X keysyms. */) /* Check that the server supports XKB. */ major = XkbMajorVersion; minor = XkbMinorVersion; - if (!XkbQueryExtension (dpy, &op, &event, &error, &major, &minor)) + if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor)) { UNBLOCK_INPUT; return Qlambda; diff --git a/src/xgselect.c b/src/xgselect.c index 359a8fbc89b..96d763ff088 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -38,7 +38,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, GMainContext *context = g_main_context_default (); int have_wfds = wfds != NULL; int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0; - int prio, i, nfds, tmo_in_millisec; + int i, nfds, tmo_in_millisec; if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds)); else FD_ZERO (&all_rfds); @@ -49,9 +49,9 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, g_main_context_pending (context); do { - if (n_gfds > gfds_size) + if (n_gfds > gfds_size) { - while (n_gfds > gfds_size) + while (n_gfds > gfds_size) gfds_size *= 2; xfree (gfds); gfds = xmalloc (sizeof (*gfds) * gfds_size); @@ -64,7 +64,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, gfds_size); } while (n_gfds > gfds_size); - for (i = 0; i < n_gfds; ++i) + for (i = 0; i < n_gfds; ++i) { if (gfds[i].events & G_IO_IN) { @@ -87,7 +87,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, else { EMACS_TIME difference; - + EMACS_SUB_TIME (difference, tmo, *timeout); if (EMACS_TIME_NEG_P (difference)) our_tmo = 1; } @@ -100,7 +100,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, if (nfds < 0) retval = nfds; - else if (nfds > 0) + else if (nfds > 0) { for (i = 0; i < max_fds+1; ++i) { @@ -127,7 +127,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, if (our_fds > 0 || (nfds == 0 && our_tmo)) { - + /* If Gtk+ is in use eventually gtk_main_iteration will be called, unless retval is zero. */ #ifdef USE_GTK @@ -137,7 +137,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, g_main_context_dispatch (context); /* To not have to recalculate timeout, return like this. */ - if (retval == 0) + if (retval == 0) { retval = -1; errno = EINTR; @@ -156,4 +156,3 @@ xgselect_initialize (void) gfds = xmalloc (sizeof (*gfds)*gfds_size); #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */ } - diff --git a/src/xmenu.c b/src/xmenu.c index 934db0f0406..eab7bb03f20 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -124,11 +124,11 @@ static int update_frame_menubar (struct frame *); Xt on behalf of one of the widget sets. */ static int popup_activated_flag; -static int next_menubar_widget_id; - #ifdef USE_X_TOOLKIT +static int next_menubar_widget_id; + /* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */ static struct frame * @@ -723,7 +723,7 @@ show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help) unhighlighting. */ #ifdef USE_GTK -void +static void menu_highlight_callback (GtkWidget *widget, gpointer call_data) { xg_menu_item_cb_data *cb_data; @@ -742,7 +742,7 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data) show_help_event (cb_data->cl_data->f, widget, help); } #else -void +static void menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data) { struct frame *f; @@ -1175,8 +1175,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) } else { - GtkWidget *wvbox = f->output_data.x->vbox_widget; - menubar_widget = xg_create_widget ("menubar", "menubar", f, first_wv, G_CALLBACK (menubar_selection_callback), @@ -1390,7 +1388,7 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer /* Check if there is room for the menu. If not, adjust x/y so that the menu is fully visible. */ - gtk_widget_size_request (GTK_WIDGET (menu), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req); if (data->x + req.width > disp_width) *x -= data->x + req.width - disp_width; if (data->y + req.height > disp_height) @@ -1600,7 +1598,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, EMACS_UINT timestamp) { int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; @@ -1615,11 +1613,11 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, if (! FRAME_X_P (f)) abort (); - *error = NULL; + *error_name = NULL; if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) { - *error = "Empty menu"; + *error_name = "Empty menu"; return Qnil; } @@ -1664,7 +1662,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, { /* Create a new pane. */ Lisp_Object pane_name, prefix; - char *pane_string; + const char *pane_string; pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); @@ -2012,7 +2010,7 @@ xdialog_show (FRAME_PTR f, representing the text label and buttons. */ { Lisp_Object pane_name, prefix; - char *pane_string; + const char *pane_string; pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; pane_string = (NILP (pane_name) @@ -2307,7 +2305,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, { /* Create a new pane. */ Lisp_Object pane_name, prefix; - char *pane_string; + const char *pane_string; maxlines = max (maxlines, lines); lines = 0; diff --git a/src/xrdb.c b/src/xrdb.c index 9fb3f3474fb..a79f453e5e1 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -28,6 +28,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <setjmp.h> +#include "lisp.h" + +/* This may include sys/types.h, and that somehow loses + if this is not done before the other system files. */ +#include "xterm.h" + #include <X11/Xlib.h> #include <X11/Xatom.h> #include <X11/X.h> @@ -38,8 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #include <sys/stat.h> -#include "lisp.h" - #ifdef USE_MOTIF /* For Vdouble_click_time. */ #include "keyboard.h" @@ -50,8 +54,6 @@ extern char *getenv (const char *); extern struct passwd *getpwuid (uid_t); extern struct passwd *getpwnam (const char *); -extern const char *get_system_name (void); - char *x_get_string_resource (XrmDatabase rdb, const char *name, const char *class); static int file_p (const char *filename); diff --git a/src/xselect.c b/src/xselect.c index a502a74f904..5254fa96838 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -97,7 +97,6 @@ static Lisp_Object clean_local_selection_data (Lisp_Object); #define TRACE0(fmt) (void) 0 #define TRACE1(fmt, a0) (void) 0 #define TRACE2(fmt, a0, a1) (void) 0 -#define TRACE3(fmt, a0, a1) (void) 0 #endif @@ -330,7 +329,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) struct frame *sf = SELECTED_FRAME (); Window selecting_window; Display *display; - Time time = last_event_timestamp; + Time timestamp = last_event_timestamp; Atom selection_atom; struct x_display_info *dpyinfo; @@ -346,7 +345,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) BLOCK_INPUT; x_catch_errors (display); - XSetSelectionOwner (display, selection_atom, selecting_window, time); + XSetSelectionOwner (display, selection_atom, selecting_window, timestamp); x_check_errors (display, "Can't set selection: %s"); x_uncatch_errors (); UNBLOCK_INPUT; @@ -357,7 +356,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) Lisp_Object selection_data; Lisp_Object prev_value; - selection_time = long_to_cons ((unsigned long) time); + selection_time = long_to_cons ((unsigned long) timestamp); selection_data = list4 (selection_name, selection_value, selection_time, selected_frame); prev_value = assq_no_quit (selection_name, Vselection_alist); @@ -2085,7 +2084,7 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal, Sx_disown_selection_internal, 1, 2, 0, doc: /* If we own the selection SELECTION, disown it. Disowning it means there is no such selection. */) - (Lisp_Object selection, Lisp_Object time) + (Lisp_Object selection, Lisp_Object time_object) { Time timestamp; Atom selection_atom; @@ -2104,10 +2103,10 @@ Disowning it means there is no such selection. */) display = FRAME_X_DISPLAY (sf); dpyinfo = FRAME_X_DISPLAY_INFO (sf); CHECK_SYMBOL (selection); - if (NILP (time)) + if (NILP (time_object)) timestamp = last_event_timestamp; else - timestamp = cons_to_long (time); + timestamp = cons_to_long (time_object); if (NILP (assq_no_quit (selection, Vselection_alist))) return Qnil; /* Don't disown the selection when we're not the owner. */ @@ -2131,26 +2130,6 @@ Disowning it means there is no such selection. */) return Qt; } -/* Get rid of all the selections in buffer BUFFER. - This is used when we kill a buffer. */ - -void -x_disown_buffer_selections (Lisp_Object buffer) -{ - Lisp_Object tail; - struct buffer *buf = XBUFFER (buffer); - - for (tail = Vselection_alist; CONSP (tail); tail = XCDR (tail)) - { - Lisp_Object elt, value; - elt = XCAR (tail); - value = XCDR (elt); - if (CONSP (value) && MARKERP (XCAR (value)) - && XMARKER (XCAR (value))->buffer == buf) - Fx_disown_selection_internal (XCAR (elt), Qnil); - } -} - DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, 0, 1, 0, doc: /* Whether the current Emacs process owns the given X Selection. @@ -2455,7 +2434,6 @@ x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, struct x_disp if (event->format == 32 && event->format < BITS_PER_LONG) { - int i; for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */ idata[i] = (int) event->data.l[i]; data = (unsigned char *) idata; diff --git a/src/xsmfns.c b/src/xsmfns.c index 825cec451d9..f3879dbcec0 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -41,6 +41,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "process.h" #include "keyboard.h" +#ifndef HAVE_GTK3 +#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w) +#endif + /* This is the event used when SAVE_SESSION_EVENT occurs. */ static struct input_event emacs_event; @@ -459,7 +463,7 @@ x_session_initialize (struct x_display_info *dpyinfo) #ifdef USE_GTK /* GTK creats a leader window by itself, but we need to tell it about our client_id. */ - gdk_set_sm_client_id (client_id); + gdk_x11_set_sm_client_id (client_id); #else create_client_leader_window (dpyinfo, client_id); #endif diff --git a/src/xterm.c b/src/xterm.c index 909b6978f5a..fd7ffd68e62 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -279,10 +279,6 @@ Lisp_Object Qx_gtk_map_stock; /* Some functions take this as char *, not const char *. */ static char emacs_class[] = EMACS_CLASS; -/* XEmbed implementation. */ - -#define XEMBED_VERSION 0 - enum xembed_info { XEMBED_MAPPED = 1 << 0 @@ -321,6 +317,7 @@ static void XTframe_up_to_date (struct frame *); static void XTset_terminal_modes (struct terminal *); static void XTreset_terminal_modes (struct terminal *); static void x_clear_frame (struct frame *); +static void x_ins_del_lines (struct frame *, int, int) NO_RETURN; static void frame_highlight (struct frame *); static void frame_unhighlight (struct frame *); static void x_new_focus_frame (struct x_display_info *, struct frame *); @@ -877,6 +874,7 @@ static void x_draw_glyph_string_foreground (struct glyph_string *); static void x_draw_composite_glyph_string_foreground (struct glyph_string *); static void x_draw_glyph_string_box (struct glyph_string *); static void x_draw_glyph_string (struct glyph_string *); +static void x_delete_glyphs (struct frame *, int) NO_RETURN; static void x_compute_glyph_string_overhangs (struct glyph_string *); static void x_set_cursor_gc (struct glyph_string *); static void x_set_mode_line_face_gc (struct glyph_string *); @@ -1791,27 +1789,6 @@ x_copy_color (struct frame *f, long unsigned int pixel) } -/* Allocate color PIXEL on display DPY. PIXEL must already be allocated. - It's necessary to do this instead of just using PIXEL directly to - get color reference counts right. */ - -unsigned long -x_copy_dpy_color (Display *dpy, Colormap cmap, long unsigned int pixel) -{ - XColor color; - - color.pixel = pixel; - BLOCK_INPUT; - XQueryColor (dpy, cmap, &color); - XAllocColor (dpy, cmap, &color); - UNBLOCK_INPUT; -#ifdef DEBUG_X_COLORS - register_color (pixel); -#endif - return color.pixel; -} - - /* Brightness beyond which a color won't have its highlight brightness boosted. @@ -2260,12 +2237,12 @@ x_draw_image_foreground (struct glyph_string *s) nothing here for mouse-face. */ if (s->hl == DRAW_CURSOR) { - int r = s->img->relief; - if (r < 0) r = -r; + int relief = s->img->relief; + if (relief < 0) relief = -relief; XDrawRectangle (s->display, s->window, s->gc, - x - r, y - r, - s->slice.width + r*2 - 1, - s->slice.height + r*2 - 1); + x - relief, y - relief, + s->slice.width + relief*2 - 1, + s->slice.height + relief*2 - 1); } } } @@ -2907,7 +2884,7 @@ x_draw_glyph_string (struct glyph_string *s) /* Shift display to make room for inserted glyphs. */ -void +static void x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) { XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f), @@ -3011,7 +2988,7 @@ timeval_subtract (struct timeval *result, struct timeval x, struct timeval y) return x.tv_sec < y.tv_sec; } -void +static void XTflash (struct frame *f) { BLOCK_INPUT; @@ -3021,6 +2998,17 @@ XTflash (struct frame *f) /* Use Gdk routines to draw. This way, we won't draw over scroll bars when the scroll bars and the edit widget share the same X window. */ GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); +#ifdef HAVE_GTK3 + cairo_t *cr = gdk_cairo_create (window); + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE); +#define XFillRectangle(d, win, gc, x, y, w, h) \ + do { \ + cairo_rectangle (cr, x, y, w, h); \ + cairo_fill (cr); \ + } \ + while (0) +#else /* ! HAVE_GTK3 */ GdkGCValues vals; GdkGC *gc; vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f) @@ -3030,7 +3018,8 @@ XTflash (struct frame *f) &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND); #define XFillRectangle(d, win, gc, x, y, w, h) \ gdk_draw_rectangle (window, gc, TRUE, x, y, w, h) -#else +#endif /* ! HAVE_GTK3 */ +#else /* ! USE_GTK */ GC gc; /* Create a GC that will use the GXxor function to flip foreground @@ -3151,7 +3140,11 @@ XTflash (struct frame *f) width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); #ifdef USE_GTK +#ifdef HAVE_GTK3 + cairo_destroy (cr); +#else g_object_unref (G_OBJECT (gc)); +#endif #undef XFillRectangle #else XFreeGC (FRAME_X_DISPLAY (f), gc); @@ -3186,7 +3179,7 @@ XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) /* Make audible bell. */ -void +static void XTring_bell (struct frame *f) { if (FRAME_X_DISPLAY (f)) @@ -3800,7 +3793,7 @@ redo_mouse_highlight (void) mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell the mouse is over. - Set *TIME to the server time-stamp for the time at which the mouse + Set *TIMESTAMP to the server time-stamp for the time at which the mouse was at this position. Don't store anything if we don't have a valid set of values to report. @@ -3809,14 +3802,16 @@ redo_mouse_highlight (void) movement. */ static void -XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) +XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, + enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, + long unsigned int *timestamp) { FRAME_PTR f1; BLOCK_INPUT; if (! NILP (last_mouse_scroll_bar) && insist == 0) - x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); + x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp); else { Window root; @@ -3989,7 +3984,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scrol *fp = f1; XSETINT (*x, win_x); XSETINT (*y, win_y); - *time = last_mouse_movement_time; + *timestamp = last_mouse_movement_time; } } } @@ -5541,7 +5536,9 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) on the scroll bar. */ static void -x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) +x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, + enum scroll_bar_part *part, Lisp_Object *x, + Lisp_Object *y, long unsigned int *timestamp) { struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); Window w = bar->x_window; @@ -5601,7 +5598,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_ last_mouse_scroll_bar = Qnil; } - *time = last_mouse_movement_time; + *timestamp = last_mouse_movement_time; UNBLOCK_INPUT; } @@ -5775,7 +5772,8 @@ static void xembed_send_message (struct frame *f, Time time, We return the number of characters stored into the buffer. */ static int -handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct input_event *hold_quit) +handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, + int *finish, struct input_event *hold_quit) { union { struct input_event ie; @@ -5786,7 +5784,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, int nbytes = 0; struct frame *f = NULL; struct coding_system coding; - XEvent event = *eventp; + XEvent event = *eventptr; Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; *finish = X_EVENT_NORMAL; @@ -6486,7 +6484,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, { /* Raw bytes, not keysym. */ register int i; - register int c; int nchars, len; for (i = 0, nchars = 0; i < nbytes; i++) @@ -6526,14 +6523,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, character events. */ for (i = 0; i < nbytes; i += len) { + int ch; if (nchars == nbytes) - c = copy_bufptr[i], len = 1; + ch = copy_bufptr[i], len = 1; else - c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); - inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) + ch = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); + inev.ie.kind = (SINGLE_BYTE_CHAR_P (ch) ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); - inev.ie.code = c; + inev.ie.code = ch; kbd_buffer_store_event_hold (&inev.ie, hold_quit); } @@ -6972,7 +6970,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, count++; } - *eventp = event; + *eventptr = event; return count; } @@ -7012,7 +7010,6 @@ static int XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) { int count = 0; - XEvent event; int event_found = 0; if (interrupt_input_blocked) @@ -7046,6 +7043,7 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold while (XPending (terminal->display_info.x->display)) { int finish; + XEvent event; XNextEvent (terminal->display_info.x->display, &event); @@ -7063,6 +7061,8 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold goto out; } + out:; + #else /* USE_GTK */ /* For GTK we must use the GTK event loop. But XEvents gets passed @@ -7089,8 +7089,6 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold } #endif /* USE_GTK */ - out:; - /* On some systems, an X bug causes Emacs to get no more events when the window is destroyed. Detect that. (1994.) */ if (! event_found) @@ -7226,9 +7224,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text the bar might not be in the window. */ if (cursor_glyph->type == IMAGE_GLYPH) { - struct glyph_row *row; - row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); - draw_phys_cursor_glyph (w, row, DRAW_CURSOR); + struct glyph_row *r; + r = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); + draw_phys_cursor_glyph (w, r, DRAW_CURSOR); } else { @@ -7517,9 +7515,9 @@ static struct x_error_message_stack *x_error_message; x_catch_errors is in effect. */ static void -x_error_catcher (Display *display, XErrorEvent *error) +x_error_catcher (Display *display, XErrorEvent *event) { - XGetErrorText (display, error->error_code, + XGetErrorText (display, event->error_code, x_error_message->string, X_ERROR_MESSAGE_SIZE); } @@ -7668,17 +7666,6 @@ x_connection_signal (int signalnum) /* If we don't have an argument, */ static char *error_msg; -/* Function installed as fatal_error_signal_hook in - x_connection_closed. Print the X error message, and exit normally, - instead of dumping core when XtCloseDisplay fails. */ - -static void -x_fatal_error_signal (void) -{ - fprintf (stderr, "%s\n", error_msg); - exit (70); -} - /* Handle the loss of connection to display DPY. ERROR_MESSAGE is the text of an error message that lead to the connection loss. */ @@ -7687,7 +7674,7 @@ x_connection_closed (Display *dpy, const char *error_message) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); Lisp_Object frame, tail; - int index = SPECPDL_INDEX (); + int idx = SPECPDL_INDEX (); error_msg = (char *) alloca (strlen (error_message) + 1); strcpy (error_msg, error_message); @@ -7782,8 +7769,12 @@ For details, see etc/PROBLEMS.\n", sigunblock (sigmask (SIGALRM)); TOTALLY_UNBLOCK_INPUT; - unbind_to (index, Qnil); + unbind_to (idx, Qnil); clear_waiting_for_input (); + + /* Tell GCC not to suggest attribute 'noreturn' for this function. */ + IF_LINT (if (! terminal_list) return; ) + /* Here, we absolutely have to use a non-local exit (e.g. signal, throw, longjmp), because returning from this function would get us back into Xlib's code which will directly call `exit'. */ @@ -7798,12 +7789,12 @@ static void x_error_quitter (Display *, XErrorEvent *); It calls x_error_quitter or x_error_catcher. */ static int -x_error_handler (Display *display, XErrorEvent *error) +x_error_handler (Display *display, XErrorEvent *event) { if (x_error_message) - x_error_catcher (display, error); + x_error_catcher (display, event); else - x_error_quitter (display, error); + x_error_quitter (display, event); return 0; } @@ -7817,22 +7808,22 @@ x_error_handler (Display *display, XErrorEvent *error) after x_error_handler prevents inlining into the former. */ static void NO_INLINE -x_error_quitter (Display *display, XErrorEvent *error) +x_error_quitter (Display *display, XErrorEvent *event) { char buf[256], buf1[356]; /* Ignore BadName errors. They can happen because of fonts or colors that are not defined. */ - if (error->error_code == BadName) + if (event->error_code == BadName) return; /* Note that there is no real way portable across R3/R4 to get the original error handler. */ - XGetErrorText (display, error->error_code, buf, sizeof (buf)); + XGetErrorText (display, event->error_code, buf, sizeof (buf)); sprintf (buf1, "X protocol error: %s on protocol request %d", - buf, error->request_code); + buf, event->request_code); x_connection_closed (display, buf1); } @@ -8119,7 +8110,7 @@ xim_close_dpy (struct x_display_info *dpyinfo) /* Calculate the absolute position in frame F from its current recorded position values and gravity. */ -void +static void x_calc_absolute_position (struct frame *f) { int flags = f->size_hint_flags; @@ -8862,31 +8853,6 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) UNBLOCK_INPUT; } -/* focus shifting, raising and lowering. */ - -void -x_focus_on_frame (struct frame *f) -{ -#if 0 - /* I don't think that the ICCCM allows programs to do things like this - without the interaction of the window manager. Whatever you end up - doing with this code, do it to x_unfocus_frame too. */ - XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - RevertToPointerRoot, CurrentTime); -#endif /* ! 0 */ -} - -void -x_unfocus_frame (struct frame *f) -{ -#if 0 - /* Look at the remarks in x_focus_on_frame. */ - if (FRAME_X_DISPLAY_INFO (f)->x_focus_frame == f) - XSetInputFocus (FRAME_X_DISPLAY (f), PointerRoot, - RevertToPointerRoot, CurrentTime); -#endif /* ! 0 */ -} - /* Raise frame F. */ void @@ -8947,6 +8913,12 @@ XTframe_raise_lower (FRAME_PTR f, int raise_flag) /* XEmbed implementation. */ +#if defined USE_X_TOOLKIT || ! defined USE_GTK + +/* XEmbed implementation. */ + +#define XEMBED_VERSION 0 + static void xembed_set_info (struct frame *f, enum xembed_info flags) { @@ -8960,9 +8932,11 @@ xembed_set_info (struct frame *f, enum xembed_info flags) dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO, 32, PropModeReplace, (unsigned char *) data, 2); } +#endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */ static void -xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2) +xembed_send_message (struct frame *f, Time t, enum xembed_message msg, + long int detail, long int data1, long int data2) { XEvent event; @@ -8970,8 +8944,8 @@ xembed_send_message (struct frame *f, Time time, enum xembed_message message, lo event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc; event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED; event.xclient.format = 32; - event.xclient.data.l[0] = time; - event.xclient.data.l[1] = message; + event.xclient.data.l[0] = t; + event.xclient.data.l[1] = msg; event.xclient.data.l[2] = detail; event.xclient.data.l[3] = data1; event.xclient.data.l[4] = data2; @@ -9212,7 +9186,9 @@ x_make_frame_invisible (struct frame *f) void x_iconify_frame (struct frame *f) { +#ifdef USE_X_TOOLKIT int result; +#endif Lisp_Object type; /* Don't keep the highlight on an invisible frame. */ @@ -9295,19 +9271,19 @@ x_iconify_frame (struct frame *f) /* X11R4: send a ClientMessage to the window manager using the WM_CHANGE_STATE type. */ { - XEvent message; + XEvent msg; - message.xclient.window = FRAME_X_WINDOW (f); - message.xclient.type = ClientMessage; - message.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; - message.xclient.format = 32; - message.xclient.data.l[0] = IconicState; + msg.xclient.window = FRAME_X_WINDOW (f); + msg.xclient.type = ClientMessage; + msg.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; + msg.xclient.format = 32; + msg.xclient.data.l[0] = IconicState; if (! XSendEvent (FRAME_X_DISPLAY (f), DefaultRootWindow (FRAME_X_DISPLAY (f)), False, SubstructureRedirectMask | SubstructureNotifyMask, - &message)) + &msg)) { UNBLOCK_INPUT_RESIGNAL; error ("Can't notify window manager of iconification"); @@ -9339,9 +9315,11 @@ void x_free_frame_resources (struct frame *f) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; +#ifdef USE_X_TOOLKIT Lisp_Object bar; struct scroll_bar *b; - Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; +#endif BLOCK_INPUT; @@ -9797,10 +9775,11 @@ x_display_ok (const char *display) #ifdef USE_GTK static void -my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) +my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, + const gchar *msg, gpointer user_data) { - if (!strstr (message, "g_set_prgname")) - fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); + if (!strstr (msg, "g_set_prgname")) + fprintf (stderr, "%s-WARNING **: %s\n", log_domain, msg); } #endif @@ -9863,6 +9842,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) XSetLocaleModifiers (""); + /* Emacs can only handle core input events, so make sure + Gtk doesn't use Xinput or Xinput2 extensions. */ + { + static char fix_events[] = "GDK_CORE_DEVICE_EVENTS=1"; + putenv (fix_events); + } + /* Work around GLib bug that outputs a faulty warning. See https://bugzilla.gnome.org/show_bug.cgi?id=563627. */ id = g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL @@ -9874,11 +9860,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) fixup_locale (); xg_initialize (); - dpy = GDK_DISPLAY (); + dpy = DEFAULT_GDK_DISPLAY (); /* NULL window -> events for all windows go to our function */ gdk_window_add_filter (NULL, event_handler_gdk, NULL); +#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 90 /* Load our own gtkrc if it exists. */ { const char *file = "~/.emacs.d/gtkrc"; @@ -9890,6 +9877,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file))) gtk_rc_parse (SSDATA (abs_file)); } +#endif XSetErrorHandler (x_error_handler); XSetIOErrorHandler (x_io_error_quitter); diff --git a/src/xterm.h b/src/xterm.h index 48d68557796..15630e902e5 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -675,9 +675,20 @@ enum #define gtk_adjustment_get_upper(w) ((w)->upper) #endif +#ifdef HAVE_GTK3 +#define DEFAULT_GDK_DISPLAY() \ + gdk_x11_display_get_xdisplay (gdk_display_get_default ()) +#else +#undef GDK_WINDOW_XID +#define GDK_WINDOW_XID(w) GDK_WINDOW_XWINDOW (w) +#define DEFAULT_GDK_DISPLAY() GDK_DISPLAY () +#define gtk_widget_get_preferred_size(a, ign, b) \ + gtk_widget_size_request(a, b) +#endif + #define GTK_WIDGET_TO_X_WIN(w) \ ((w) && gtk_widget_get_window (w) \ - ? GDK_WINDOW_XWINDOW (gtk_widget_get_window (w)) : 0) + ? GDK_WINDOW_XID (gtk_widget_get_window (w)) : 0) #define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget) #define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget) @@ -979,6 +990,7 @@ extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *); extern void x_query_colors (struct frame *f, XColor *, int); extern void x_query_color (struct frame *f, XColor *); extern void x_clear_area (Display *, Window, int, int, int, int, int); +extern void x_mouse_leave (struct x_display_info *); extern void set_vertical_scroll_bar (struct window *); extern int x_dispatch_event (XEvent *, Display *); |