diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-10-15 17:55:33 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-10-15 17:55:33 -0400 |
commit | 0c747cb143fa227e78f350ac353d703f489209df (patch) | |
tree | 5b434055c797bd75eaa1e3d9d0773e586d44daee /src | |
parent | a01a7932080e8a6e7bc8472c58cefabcc2c37df3 (diff) | |
parent | aa095b2db98ae149737f8de00ee733b1d257ed33 (diff) | |
download | emacs-0c747cb143fa227e78f350ac353d703f489209df.tar.gz emacs-0c747cb143fa227e78f350ac353d703f489209df.tar.bz2 emacs-0c747cb143fa227e78f350ac353d703f489209df.zip |
Merge from trunk
Diffstat (limited to 'src')
76 files changed, 1391 insertions, 1267 deletions
diff --git a/src/ChangeLog.2 b/src/ChangeLog.2 index f087802e27d..0397478f09d 100644 --- a/src/ChangeLog.2 +++ b/src/ChangeLog.2 @@ -1563,10 +1563,10 @@ 1987-04-27 Richard Mlynarik (mly@prep) * fileio.c (APOLLO from lnz): - Fcopy_file, Fset_file_modes: Don't use un*x modes if + (Fcopy_file, Fset_file_modes): Don't use un*x modes if env var USE_DOMAIN_ACLS is set. - Fset_file_modes: utimes fix. - Finsert_file_contents: Must do fstat after open for Apollo. + (Fset_file_modes): utimes fix. + (Finsert_file_contents): Must do fstat after open for Apollo. * emacs.c (main): (APOLLO from lnz): Don't use un*x modes if env var USE_DOMAIN_ACLS set. @@ -2073,7 +2073,7 @@ * xfns.c (Fx_get_default): Add (unsigned char *) cast. - * window.c: typo. + * window.c: Typo. 1987-02-09 Richard M. Stallman (rms@prep) diff --git a/src/ChangeLog.3 b/src/ChangeLog.3 index e3c5ab70f66..e3ba2b37ccd 100644 --- a/src/ChangeLog.3 +++ b/src/ChangeLog.3 @@ -5146,7 +5146,7 @@ Change mouse movement events to be arranged like click events. (format_modifiers): Note that the click modifier has no written representation. - (modifier_names, modifer_symbols): New variables, used to + (modifier_names, modifier_symbols): New variables, used to create the Qevent_symbol_elements property. (modify_event_symbol): Change the format of the modified symbol cache; there are too many modifier bits now to use a @@ -5154,8 +5154,8 @@ Document the format of the cache. Put the Qevent_symbol_elements property on each new symbol, instead of a Qevent_unmodified property. - (symbols_of_keyboard): Put Qevent_symbol_elements properties on - the symbols specified in head_table, not Qevent_unmodifed properties. + (symbols_of_keyboard): Put Qevent_symbol_elements properties on the + symbols specified in head_table, not Qevent_unmodified properties. Initialize and staticpro modifier_symbols, and staticpro the window elements of button_down_location. @@ -11207,7 +11207,7 @@ events to send the function key number instead of a symbol. * keyboard.c (modify_event_symbol): Re-arranged to work well with function key/mouse button numbers instead of symbols. - And if (MODIFIERS & up_modifer), prepend "U-" to the name of the + And if (MODIFIERS & up_modifier), prepend "U-" to the name of the symbol being constructed. (make_lispy_event): Use the new modify_event_symbol. diff --git a/src/ChangeLog.7 b/src/ChangeLog.7 index 7421aba4403..b5927108808 100644 --- a/src/ChangeLog.7 +++ b/src/ChangeLog.7 @@ -491,7 +491,7 @@ * xselect.c (selection_data_to_lisp_data): Set Vlast_coding_system_used. - (lisp_data_to_selection_data): Likewize. + (lisp_data_to_selection_data): Likesize. 1998-07-07 Richard Stallman <rms@psilocin.ai.mit.edu> @@ -502,7 +502,7 @@ * editfns.c (Fformat): Replace explicit numeric constants with proper macros. - * fns.c (concat): Likewize. + * fns.c (concat): Likewise. 1998-07-06 Kenichi Handa <handa@etl.go.jp> diff --git a/src/ChangeLog.8 b/src/ChangeLog.8 index 5033a055576..9c38b29ff32 100644 --- a/src/ChangeLog.8 +++ b/src/ChangeLog.8 @@ -3686,7 +3686,7 @@ * lread.c (read_escape): For Control modifier, pay attention to multibyte character. (read1): Likewise. Signal error or a multibyte character which - has a modifer bit. Check validity of Shift modifer. + has a modifier bit. Check validity of Shift modifier. * charset.c (non_ascii_char_to_string): Handle modifier bits as the same as Lisp reader. diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk index de4ba68bdc0..567bf2868e7 100644 --- a/src/ChangeLog.trunk +++ b/src/ChangeLog.trunk @@ -1,3 +1,386 @@ +2010-10-15 Eli Zaretskii <eliz@gnu.org> + + * image.c (tiff_load): Cast 3rd argument to avoid compiler warning. + +2010-10-15 Tassilo Horn <tassilo@member.fsf.org> + + * Makefile.in (really-oldXMenu): Fix typo in variable name that + made building the X menu fail. + (really-oldXMenu): Fix my previous fix. + +2010-10-14 Damyan Pepper <damyanp@gmail.com> + + Fix handling of font properties on Windows (bug#6303). + * font.c (font_filter_properties): New function, refactored from + ftfont_filter_properties. + * font.h (font_filter_properties): Declare. + * ftfont.c (ftfont_filter_properties): Use font_filter_properties. + * w32font.c (w32font_booleans, w32font_non_booleans): New variables. + (w32font_filter_properties): New function. + (w32font_driver): Add w32font_filter_properties. + +2010-10-14 Juanma Barranquero <lekktu@gmail.com> + + * font.c (Ffont_variation_glyphs): + * ccl.c (Fccl_execute_on_string): Fix typo in docstring. + +2010-10-14 Juanma Barranquero <lekktu@gmail.com> + + * w32fns.c (w32_wnd_proc, file_dialog_callback): + * w32font.c (w32_generic_family): + * w32inevt.c (key_event): + * w32menu.c (fill_in_menu): + * w32proc.c (reader_thread, w32_executable_type, compare_env) + (merge_and_sort_env, int_from_hex, enum_locale_fn, enum_codepage_fn): + * w32term.c (w32_read_socket): Make static. + +2010-10-13 Juanma Barranquero <lekktu@gmail.com> + + * image.c (DEF_IMGLIB_FN): Add argument to adapt to strict + prototypes; all callers changed. + +2010-10-13 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (TLIB2): Rename from TLIBW32. + (OBJ2): New macro. + (WIN32OBJ, FONTOBJ): Remove. + (OBJ1): Redistribute object files with OBJ2. + (LIBS, $(TEMACS)): Use TLIB2. + (make-buildobj-CMD, make-buildobj-SH): Use OBJ2. + ($(TLIB2), TAGS, TAGS-LISP, TAGS-gmake): Depend on OBJ2. + +2010-10-13 Juanma Barranquero <lekktu@gmail.com> + + * emacs.c (Vdynamic_library_alist) + (syms_of_emacs) <dynamic-library-alist>: Move from image.c and rename. + Doc fix. + + * lisp.h (Vdynamic_library_alist): Declare extern. + + * image.c (Vimage_library_alist) + (syms_of_image) <image-library-alist>: Move to emacs.c and rename. + (lookup_image_type): Use Vdynamic_library_alist. + (Finit_image_library): Doc fix. + +2010-10-12 Dan Nicolaescu <dann@ics.uci.edu> + + * Makefile.in (lispsource, libsrc, etc, oldxmenudir, lwlibdir) + (lispdir): Remove trailing /, update all uses. + +2010-10-12 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (Qleft): Declare. + (ns_right_alternate_modifier): New variable + (NSRightAlternateKeyMask): New define. + (EV_MODIFIERS): Parse NSRightAlternateKeyMask if + ns_right_alternate_modifier isn't Qleft. + (keyDown): If ns_right_alternate_modifier isn't Qleft, use it + as emacs modifier for NSRightAlternateKeyMask. + (syms_of_nsterm): DEFVAR_LISP ns-right-alternate-modifier. + +2010-10-10 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * gnutls.c (emacs_gnutls_write): If we're trying to write before + gnutls is ready, return EAGAIN as the errno. + +2010-10-10 Dan Nicolaescu <dann@ics.uci.edu> + + * vm-limit.c: + * unexhp9k800.c: + * unexelf.c: + * unexaix.c: + * termcap.c: Remove #ifdef emacs / #ifndef emacs code, unused. + + * Makefile.in (temacs): Use $(ALL_CFLAGS) on the link line. + (PROFILING_LDFLAGS): Remove, not needed anymore. + + * Makefile.in: Use $(...) everywhere instead of ${...} + (CRT_DIR): Move near potential user. + (START_FILE): Move near CRT_DIR, it might use it. + + * sysdep.c (LPASS8): Remove, unused. + (emacs_ospeed): Change from being a global to a local in the only + user: init_baud_rate. + +2010-10-09 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * gnutls.c (syms_of_gnutls): All the bootprops are keywords. + (emacs_gnutls_write): Remove the debuggin fsync call. + (emacs_gnutls_read): Return -1 if we got an error from + gnutls_read. This allows us to actually read lots of data from + the GnuTLS stream. + (emacs_gnutls_write): Check for GNUTLS_E_AGAIN and not EINTR. + According to the documentation, this is correct, and it seems to + make things work. + +2010-10-09 Chong Yidong <cyd@stupidchicken.com> + + * xterm.c (x_draw_relief_rect): Clear corner pixels. + +2010-10-08 Michael Albinus <michael.albinus@gmx.de> + + * keyboard.c: Revert last change; it was not intended to be + synchronized with the trunk. + +2010-10-08 Kenichi Handa <handa@m17n.org> + + * coding.c (complement_process_encoding_system): Fix previous change. + +2010-10-08 Michael Albinus <michael.albinus@gmx.de> + + * dbusbind.c (syms_of_dbusbind): Move putenv call ... + (Fdbus_init_bus): ... here. (Bug#7113) + +2010-10-08 Glenn Morris <rgm@gnu.org> + + * buffer.c (before-change-functions, after-change-functions): + Three-year overdue doc fix following 2007-08-13 change. + +2010-10-08 Kenichi Handa <handa@m17n.org> + + * coding.c (coding_inherit_eol_type): If parent doesn't specify + eol-format, inherit from the system's default. + (complement_process_encoding_system): Make a new coding system + inherit the original eol-format. + +2010-10-08 Kenichi Handa <handa@m17n.org> + + * coding.c (complement_process_encoding_system): New function. + + * coding.h (complement_process_encoding_system): Extern it. + + * callproc.c (Fcall_process): Complement the coding system for + encoding arguments. + (Fcall_process_region): Complement the coding system for encoding + the input to the process. + + * process.c (Fstart_process): Complement the coding system for + encoding arguments. + (send_process): Complement the coding system for encoding what + sent to the process. + +2010-10-08 Kenichi Handa <handa@m17n.org> + + * xfont.c (xfont_open): Fix setting of font->average_width from + :avgwidth property (Bug#7123). + +2010-10-08 Michael Albinus <michael.albinus@gmx.de> + + * dbusbind.c (syms_of_dbusbind): Use putenv instead of setenv, it + is more portable. + + * keyboard.c (gobble_input): Move call of xd_read_queued_messages ... + (kbd_buffer_get_event): ... here. This is needed for cygwin, which + has not defined SIGIO. + +2010-10-08 Chong Yidong <cyd@stupidchicken.com> + + * xterm.c (x_draw_relief_rect): If box width is larger than 1, + draw the outermost line using the black relief, for legibility. + Omit drawing the four corner pixels. + +2010-10-04 Chong Yidong <cyd@stupidchicken.com> + + * keyboard.c (echo_prompt): Function moved into read_key_sequence. + (read_key_sequence): Inline echo_prompt. + (echo_dash): Add a dash only if key is continued (Bug#7137). + +2010-10-04 Dan Nicolaescu <dann@ics.uci.edu> + + Remove O_RDONLY, O_WRONLY definitions, not needed. + * unexcoff.c: + * lread.c: + * fileio.c: + * doc.c: + * callproc.c: + * alloc.c: + * termcap.c: Remove O_RDONLY O_WRONLY definitions. + +2010-10-03 Teodor Zlatanov <tzz@lifelogs.com> + + * gnutls.h (GNUTLS_LOG2): Convenience macro. + + * gnutls.c: Add property list symbol holders. + (emacs_gnutls_handshake): Clarify how sockets are passed to + GnuTLS. + (gnutls_log_function2): Convenience function using GNUTLS_LOG2. + (Fgnutls_boot): Get all parameters from a plist. Require trustfiles + and keyfiles to be a list of file names. Default to "NORMAL" for + the priority string. Improve logging. + +2010-10-03 Glenn Morris <rgm@gnu.org> + + * fileio.c (Vdirectory_sep_char): Remove. + +2010-10-03 Dan Nicolaescu <dann@ics.uci.edu> + + * termhooks.h: Remove #ifdef CONSP. + + * xterm.c (NO_INLINE, noinline): Move definitions to ../configure.in. + + Include <fcntl.h> unconditionally. + * termcap.c: + * sysdep.c: + * lread.c: + * keyboard.c: + * filelock.c: + * fileio.c: + * doc.c: + * callproc.c: + * alloc.c: Remove include guards for <fcntl.h>, process.c already + does it. + + * process.c: Do not include <sys/wait.h>, syswait.h does it. + + * sysdep.c (flush_pending_output): Remove code, does not do + anything on any platform. + + Remove unused code. + * sysdep.c (select_alarm, sys_select, read_input_waiting): Remove + select emulation, all systems support select. + (set_exclusive_use): Remove, the only user is in an #if 0 block. + * process.c (create_process): Remove #if 0 code. + + Remove unused arguments for unexec. + The third one is never used, and the last two are always passed as zero. + * emacs.c (unexec): Add declaration. + (Fdump_emacs): Only pass the first two arguments to unexec. + Simplify #ifdef. + * unexw32.c (unexec): + * unexsol.c (unexec): + * unexhp9k800.c (unexec): + * unexcw.c (unexec): Remove the last 3 arguments, unused. + * unexelf.c (unexec): Remove the last 3 arguments, unused. + (find_section): Use const. + * unexmacosx.c (unexec): Remove the last 3 arguments, unused. + (unexec_error): Declare it NO_RETURN. + * unexcoff.c (make_hdr): Assume bss_start is always zero, remove + it as an argument, remove data_start and entry_address arguments, unused. + (unexec): Remove bss_start, data_start and + entry_address arguments. + * unexaix.c (make_hdr): Assume bss_start is always zero, remove + it as an argument, remove data_start and entry_address arguments, unused. + (unexec): Remove bss_start, data_start and + entry_address arguments. + +2010-10-03 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (TAGS, TAGS-LISP, TAGS-gmake): Add $(FONTOBJ). + + * gnutls.c (emacs_gnutls_handshake, gnutls_make_error) + (gnutls_emacs_global_init, gnutls_emacs_global_deinit): Make static. + (Fgnutls_get_initstage, Fgnutls_deinit, Fgnutls_boot, Fgnutls_bye): + Fix typos in docstrings. + (Fgnutls_error_fatalp, Fgnutls_error_string): Doc fixes. + (Fgnutls_errorp): Doc fix; use ERR for the argument name. + +2010-10-03 Chong Yidong <cyd@stupidchicken.com> + + * keyboard.c (command_loop_1): Make sure the mark is really alive + before using it (Bug#7044). + +2010-10-02 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (tags): Rename target to full-tags. + +2010-10-02 Eli Zaretskii <eliz@gnu.org> + + * emacs.c (main): Remove !WINDOWSNT conditional. + (Fkill_emacs): Don't mention exemption on MS-Windows. + +2010-10-02 Glenn Morris <rgm@gnu.org> + + * character.c (Fchar_bytes): Remove obsolete function. + (syms_of_character): Remove Schar_bytes. + + * emacs.c (fatal_error_signal): Also run Fkill_emacs on SIGINT. + (main) [!WINDOWSNT]: Handle SIGINT with fatal_error_signal + in batch-mode. + (Fkill_emacs): Doc fix. Also run the hook in batch mode. + (kill-emacs-hook): Doc fix. + +2010-10-02 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * xml.c (Flibxml_parse_xml_region, Flibxml_parse_html_region) + (parse_region): Reworked to take regions instead of strings, and + renamed to reflect that these are the libxml functions. + +2010-10-01 Eli Zaretskii <eliz@gnu.org> + + * term.c (init_tty) [DOS_NT]: Don't call Wcm_clear after setting + screen dimensions in tty->Wcm. + + * xdisp.c (set_cursor_from_row): When the row is truncated and + point is outside the range of displayed characters, position the + cursor inside the scroll margin. (Bug#6349) + +2010-10-01 Dan Nicolaescu <dann@ics.uci.edu> + + Do not include stdlib.h and string.h, config.h does it. + * xfont.c: + * w32term.c: + * w32reg.c: + * w32inevt.c: + * w32heap.c: + * w32console.c: + * w16select.c: + * unexsol.c: + * term.c: + * sound.c: + * scroll.c (m): + * gtkutil.c: + * font.c: + * filelock.c: + * fileio.c: + * dosfns.c: + * dbusbind.c: + * bidi.c: + * callproc.c: + * process.c: + * msdos.c: + * charset.c: Do not include stdlib.h and string.h, config.h does it. + + * callproc.c (SIGCHLD): Remove conditional definition, syssignal.h defines it. + + * process.c: Move #include <pty.h> earlier. + (SIGCHLD): Remove conditional definition, syssignal.h defines it. + (pty_name): Move definition later. + + * nsselect.m (syms_of_nsselect): + * nsmenu.m (syms_of_nsmenu): + * nsfns.m (syms_of_nsfns): + * msdos.c (syms_of_msdos): + + * image.c (syms_of_image): + * charset.c (syms_of_charset): Use intern_c_string instead of intern. + + * point.h: Remove, unused. + +2010-10-01 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in (TAGS, frc, TAGS-LISP, ../nt/TAGS, tags) + (TAGS-gmake, TAGS-nmake, TAGS-LISP-gmake, TAGS-LISP-nmake) + (nt-TAGS-gmake, nt-TAGS-nmake): New targets. + +2010-09-30 Dan Nicolaescu <dann@ics.uci.edu> + + * xml.c (parse_string): Use const. + +2010-09-30 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * eval.c (Fbacktrace): Don't overwrite print-level on exit. Also + only override Vprint_level if it isn't already bound, and increase + the level to 8 to produce more useful backtraces for bug reports. + +2010-09-30 Dan Nicolaescu <dann@ics.uci.edu> + + * Makefile.in: ecrt0.c does not exist anymore, do not mention it. + +2010-09-30 Juanma Barranquero <lekktu@gmail.com> + + * w32console.c (vga_stdcolor_name): Remove unused function; + presumed dead after 2007-11-30T13:57:21Z!jasonr@gnu.org. + 2010-09-29 Lars Magne Ingebrigtsen <larsi@gnus.org> * gnutls.c (emacs_gnutls_handshake): Made into internal function. diff --git a/src/Makefile.in b/src/Makefile.in index 00706460d25..0d496aea73a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -46,28 +46,25 @@ version = @version@ # LIBS = @LIBS@ LIBOBJS = @LIBOBJS@ -lispsource = ${srcdir}/../lisp/ -libsrc = ../lib-src/ -etc = ../etc/ -oldXMenudir = ../oldXMenu/ -lwlibdir = ../lwlib/ -lispdir = ../lisp/ +lispsource = $(srcdir)/../lisp +libsrc = ../lib-src +etc = ../etc +oldXMenudir = ../oldXMenu +lwlibdir = ../lwlib +lispdir = ../lisp # Configuration files for .o files to depend on. -M_FILE = ${srcdir}/@machfile@ -S_FILE = ${srcdir}/@opsysfile@ +M_FILE = $(srcdir)/@machfile@ +S_FILE = $(srcdir)/@opsysfile@ config_h = config.h $(M_FILE) $(S_FILE) -bootstrap_exe = ${abs_builddir}/bootstrap-emacs${EXEEXT} +bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT) ## ns-app if HAVE_NS, else empty. OTHER_FILES = @OTHER_FILES@ -CRT_DIR=@CRT_DIR@ - ## Flags to pass for profiling builds PROFILING_CFLAGS = @PROFILING_CFLAGS@ -PROFILING_LDFLAGS = @PROFILING_LDFLAGS@ ## Flags to pass to the compiler to enable build warnings C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ @@ -116,7 +113,7 @@ LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@ ## Flags to pass to ld only for temacs. TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS) -## $LDFLAGS $PROFILING_LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason). +## $LDFLAGS or empty if NS_IMPL_GNUSTEP (for some reason). TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@ ## Some systems define this to request special libraries. @@ -125,8 +122,10 @@ LIBS_SYSTEM=@LIBS_SYSTEM@ ## Where to find libgcc.a, if using gcc and necessary. LIB_GCC=@LIB_GCC@ +CRT_DIR=@CRT_DIR@ ## May use $CRT_DIR. LIB_STANDARD=@LIB_STANDARD@ +START_FILES = @START_FILES@ ## -lm, or empty. LIB_MATH=@LIB_MATH@ @@ -177,8 +176,8 @@ LIBXT_OTHER=@LIBXT_OTHER@ OLDXMENU_TARGET=@OLDXMENU_TARGET@ ## If !HAVE_X11 || USE_GTK, empty. -## Else if USE_X_TOOLKIT, ${lwlibdir}liblw.a. -## Else ${oldXMenudir}libXMenu11.a. +## Else if USE_X_TOOLKIT, $(lwlibdir)/liblw.a. +## Else $(oldxmenudir)/libXMenu11.a. ## (Actually, rather than being empty, it is set to "nothing". ## It is never actually used for anything in this case. ## This is done because there is a rule with target $(OLDXMENU) below, @@ -188,7 +187,7 @@ OLDXMENU_TARGET=@OLDXMENU_TARGET@ ## The alternative would be to put that rule in a makefile fragment.) OLDXMENU=@OLDXMENU@ -## If HAVE_X11 && !USE_GTK, ${OLDXMENU} ../src/${OLDXMENU}; else empty. +## If HAVE_X11 && !USE_GTK, $(OLDXMENU) ../src/$(OLDXMENU); else empty. ## We use stamp-xmenu with these two deps to both ensure that lwlib ## gets remade based on its dependencies in its own makefile, ## and remake temacs if lwlib gets changed by this. @@ -238,9 +237,9 @@ CYGWIN_OBJ=@CYGWIN_OBJ@ MSDOS_OBJ = ## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS. MSDOS_X_OBJ = -MSDOS_SUPPORT_REAL = ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \ - ${lispsource}dos-fns.elc ${lispsource}dos-w32.elc ${lispsource}dos-vars.elc \ - ${lispsource}term/internal.elc ${lispsource}term/pc-win.elc +MSDOS_SUPPORT_REAL = $(lispsource)/ls-lisp.elc $(lispsource)/disp-table.elc \ + $(lispsource)/dos-fns.elc $(lispsource)/dos-w32.elc $(lispsource)/dos-vars.elc \ + $(lispsource)/term/internal.elc $(lispsource)/term/pc-win.elc ## $MSDOS_SUPPORT_REAL if MSDOS. MSDOS_SUPPORT = @@ -259,23 +258,23 @@ GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@ FONT_OBJ=@FONT_OBJ@ ## Used if HAVE_MOUSE. -REAL_MOUSE_SUPPORT=${lispsource}mouse.elc ${lispsource}select.elc \ - ${lispsource}scroll-bar.elc +REAL_MOUSE_SUPPORT=$(lispsource)/mouse.elc $(lispsource)/select.elc \ + $(lispsource)/scroll-bar.elc ## Used if HAVE_GPM && !HAVE_MOUSE -GPM_MOUSE_SUPPORT=${lispsource}mouse.elc +GPM_MOUSE_SUPPORT=$(lispsource)/mouse.elc LIBGPM = @LIBGPM@ ## Either of the two preceding options, or empty. MOUSE_SUPPORT=@MOUSE_SUPPORT@ -## ${lispsource}tooltip.elc if HAVE_WINDOW_SYSTEM, else empty. +## $(lispsource)/tooltip.elc if HAVE_WINDOW_SYSTEM, else empty. TOOLTIP_SUPPORT=@TOOLTIP_SUPPORT@ -BASE_WINDOW_SUPPORT=${lispsource}fringe.elc ${lispsource}image.elc \ - ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ - ${lispsource}tool-bar.elc ${lispsource}mwheel.elc +BASE_WINDOW_SUPPORT=$(lispsource)/fringe.elc $(lispsource)/image.elc \ + $(lispsource)/international/fontset.elc $(lispsource)/dnd.elc \ + $(lispsource)/tool-bar.elc $(lispsource)/mwheel.elc -X_WINDOW_SUPPORT=${lispsource}x-dnd.elc ${lispsource}term/common-win.elc \ - ${lispsource}term/x-win.elc ${lispsource}dynamic-setting.elc +X_WINDOW_SUPPORT=$(lispsource)/x-dnd.elc $(lispsource)/term/common-win.elc \ + $(lispsource)/term/x-win.elc $(lispsource)/dynamic-setting.elc ## If HAVE_X_WINDOWS, both the above ## else if HAVE_WINDOW_SYSTEM (ie, HAVE_NS) just the former; else empty. @@ -295,16 +294,14 @@ GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ RUN_TEMACS = `/bin/pwd`/temacs -START_FILES = @START_FILES@ - UNEXEC_OBJ = @UNEXEC_OBJ@ CANNOT_DUMP=@CANNOT_DUMP@ DEPDIR=deps -## -MMD -MF ${DEPDIR}/$*.d if AUTO_DEPEND; else empty. +## -MMD -MF $(DEPDIR)/$*.d if AUTO_DEPEND; else empty. DEPFLAGS=@DEPFLAGS@ -## test -d ${DEPDIR} || mkdir ${DEPDIR} (if AUTO_DEPEND); else ':'. +## test -d $(DEPDIR) || mkdir $(DEPDIR) (if AUTO_DEPEND); else ':'. MKDEPDIR=@MKDEPDIR@ ## DO NOT use -R. There is a special hack described in lastfile.c @@ -322,14 +319,14 @@ MKDEPDIR=@MKDEPDIR@ ## since it may have -I options that should override those. ## ## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. -ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \ - ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \ - ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} \ - ${LIBXML2_CFLAGS} ${DBUS_CFLAGS} \ - ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \ - ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \ +ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \ + $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ + $(C_SWITCH_X_SYSTEM) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ + $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ + $(GCONF_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ + $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ $(LIBGNUTLS_CFLAGS) \ - ${C_WARNINGS_SWITCH} ${CFLAGS} + $(C_WARNINGS_SWITCH) $(CFLAGS) ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) .SUFFIXES: .m @@ -400,93 +397,93 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \ ## Place loaddefs.el first, so it gets generated first, since it is on ## the critical path (relevant in parallel compilations). lisp= \ - ${lispsource}loaddefs.el \ - ${lispsource}abbrev.elc \ - ${lispsource}buff-menu.elc \ - ${lispsource}button.elc \ - ${lispsource}emacs-lisp/byte-run.elc \ - ${lispsource}composite.elc \ - ${lispsource}cus-face.elc \ - ${lispsource}cus-start.elc \ - ${lispsource}custom.elc \ - ${lispsource}emacs-lisp/backquote.elc \ - ${lispsource}emacs-lisp/lisp-mode.elc \ - ${lispsource}emacs-lisp/lisp.elc \ - ${lispsource}env.elc \ - ${lispsource}faces.elc \ - ${lispsource}files.elc \ - ${lispsource}format.elc \ - ${lispsource}facemenu.elc \ - ${MOUSE_SUPPORT} \ - ${lispsource}emacs-lisp/float-sup.elc \ - ${lispsource}frame.elc \ - ${lispsource}help.elc \ - ${lispsource}indent.elc \ - ${lispsource}isearch.elc \ - ${lispsource}rfn-eshadow.elc \ - ${lispsource}loadup.el \ - ${lispsource}bindings.elc \ - ${lispsource}emacs-lisp/map-ynp.elc \ - ${lispsource}menu-bar.elc \ - ${lispsource}international/mule.elc \ - ${lispsource}international/mule-conf.elc \ - ${lispsource}international/mule-cmds.elc \ - ${lispsource}international/characters.elc \ - ${lispsource}international/charprop.el \ - ${lispsource}case-table.elc \ - ${lispsource}language/chinese.elc \ - ${lispsource}language/cyrillic.elc \ - ${lispsource}language/indian.elc \ - ${lispsource}language/sinhala.el \ - ${lispsource}language/english.el \ - ${lispsource}language/ethiopic.elc \ - ${lispsource}language/european.elc \ - ${lispsource}language/czech.el \ - ${lispsource}language/slovak.el \ - ${lispsource}language/romanian.el \ - ${lispsource}language/greek.el \ - ${lispsource}language/hebrew.elc \ - ${lispsource}language/japanese.el \ - ${lispsource}language/korean.el \ - ${lispsource}language/lao.el \ - ${lispsource}language/cham.el \ - ${lispsource}language/tai-viet.el \ - ${lispsource}language/thai.el \ - ${lispsource}language/tibetan.elc \ - ${lispsource}language/vietnamese.elc \ - ${lispsource}language/misc-lang.el \ - ${lispsource}language/utf-8-lang.el \ - ${lispsource}language/georgian.el \ - ${lispsource}language/khmer.el \ - ${lispsource}language/burmese.el \ - ${lispsource}paths.el \ - ${lispsource}register.elc \ - ${lispsource}replace.elc \ - ${lispsource}simple.elc \ - ${lispsource}minibuffer.elc \ - ${lispsource}startup.elc \ - ${lispsource}subr.elc \ - ${lispsource}term/tty-colors.elc \ - ${lispsource}font-core.elc \ - ${lispsource}emacs-lisp/syntax.elc \ - ${lispsource}font-lock.elc \ - ${lispsource}jit-lock.elc \ - ${lispsource}textmodes/fill.elc \ - ${lispsource}textmodes/page.elc \ - ${lispsource}textmodes/paragraphs.elc \ - ${lispsource}textmodes/text-mode.elc \ - ${lispsource}emacs-lisp/timer.elc \ - ${lispsource}jka-cmpr-hook.elc \ - ${lispsource}vc/vc-hooks.elc \ - ${lispsource}vc/ediff-hook.elc \ - ${lispsource}epa-hook.elc \ - ${TOOLTIP_SUPPORT} \ - ${MSDOS_SUPPORT} \ - ${WINDOW_SUPPORT} \ - ${NS_SUPPORT} \ - ${lispsource}widget.elc \ - ${lispsource}window.elc \ - ${lispsource}version.el + $(lispsource)/loaddefs.el \ + $(lispsource)/abbrev.elc \ + $(lispsource)/buff-menu.elc \ + $(lispsource)/button.elc \ + $(lispsource)/emacs-lisp/byte-run.elc \ + $(lispsource)/composite.elc \ + $(lispsource)/cus-face.elc \ + $(lispsource)/cus-start.elc \ + $(lispsource)/custom.elc \ + $(lispsource)/emacs-lisp/backquote.elc \ + $(lispsource)/emacs-lisp/lisp-mode.elc \ + $(lispsource)/emacs-lisp/lisp.elc \ + $(lispsource)/env.elc \ + $(lispsource)/faces.elc \ + $(lispsource)/files.elc \ + $(lispsource)/format.elc \ + $(lispsource)/facemenu.elc \ + $(MOUSE_SUPPORT) \ + $(lispsource)/emacs-lisp/float-sup.elc \ + $(lispsource)/frame.elc \ + $(lispsource)/help.elc \ + $(lispsource)/indent.elc \ + $(lispsource)/isearch.elc \ + $(lispsource)/rfn-eshadow.elc \ + $(lispsource)/loadup.el \ + $(lispsource)/bindings.elc \ + $(lispsource)/emacs-lisp/map-ynp.elc \ + $(lispsource)/menu-bar.elc \ + $(lispsource)/international/mule.elc \ + $(lispsource)/international/mule-conf.elc \ + $(lispsource)/international/mule-cmds.elc \ + $(lispsource)/international/characters.elc \ + $(lispsource)/international/charprop.el \ + $(lispsource)/case-table.elc \ + $(lispsource)/language/chinese.elc \ + $(lispsource)/language/cyrillic.elc \ + $(lispsource)/language/indian.elc \ + $(lispsource)/language/sinhala.el \ + $(lispsource)/language/english.el \ + $(lispsource)/language/ethiopic.elc \ + $(lispsource)/language/european.elc \ + $(lispsource)/language/czech.el \ + $(lispsource)/language/slovak.el \ + $(lispsource)/language/romanian.el \ + $(lispsource)/language/greek.el \ + $(lispsource)/language/hebrew.elc \ + $(lispsource)/language/japanese.el \ + $(lispsource)/language/korean.el \ + $(lispsource)/language/lao.el \ + $(lispsource)/language/cham.el \ + $(lispsource)/language/tai-viet.el \ + $(lispsource)/language/thai.el \ + $(lispsource)/language/tibetan.elc \ + $(lispsource)/language/vietnamese.elc \ + $(lispsource)/language/misc-lang.el \ + $(lispsource)/language/utf-8-lang.el \ + $(lispsource)/language/georgian.el \ + $(lispsource)/language/khmer.el \ + $(lispsource)/language/burmese.el \ + $(lispsource)/paths.el \ + $(lispsource)/register.elc \ + $(lispsource)/replace.elc \ + $(lispsource)/simple.elc \ + $(lispsource)/minibuffer.elc \ + $(lispsource)/startup.elc \ + $(lispsource)/subr.elc \ + $(lispsource)/term/tty-colors.elc \ + $(lispsource)/font-core.elc \ + $(lispsource)/emacs-lisp/syntax.elc \ + $(lispsource)/font-lock.elc \ + $(lispsource)/jit-lock.elc \ + $(lispsource)/textmodes/fill.elc \ + $(lispsource)/textmodes/page.elc \ + $(lispsource)/textmodes/paragraphs.elc \ + $(lispsource)/textmodes/text-mode.elc \ + $(lispsource)/emacs-lisp/timer.elc \ + $(lispsource)/jka-cmpr-hook.elc \ + $(lispsource)/vc/vc-hooks.elc \ + $(lispsource)/vc/ediff-hook.elc \ + $(lispsource)/epa-hook.elc \ + $(TOOLTIP_SUPPORT) \ + $(MSDOS_SUPPORT) \ + $(WINDOW_SUPPORT) \ + $(NS_SUPPORT) \ + $(lispsource)/widget.elc \ + $(lispsource)/window.elc \ + $(lispsource)/version.el ## List of relative names for those files from $lisp that are loaded ## unconditionally (i.e. on all platforms). Files from $lisp that @@ -601,80 +598,80 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \ ## duplicated symbols. If the standard libraries were compiled ## with GCC, we might need LIB_GCC again after them. LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ - $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) \ - ${LIBXML2_LIBS} $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ - $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \ + $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(DBUS_LIBS) \ + $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ + $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(GCONF_LIBS) $(LIBSELINUX_LIBS) \ $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ $(LIBGNUTLS_LIBS) \ $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) -all: emacs${EXEEXT} $(OTHER_FILES) +all: emacs$(EXEEXT) $(OTHER_FILES) ## Does anyone ever pay attention to the load-path-shadows output here? ## The dumped Emacs is as functional and more efficient than ## bootstrap-emacs, so we replace the latter with the former. -emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp} - if test "${CANNOT_DUMP}" = "yes"; then \ - ln -f temacs${EXEEXT} emacs${EXEEXT}; \ - EMACSLOADPATH=${lispsource} ./emacs -q -batch \ +emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) + if test "$(CANNOT_DUMP)" = "yes"; then \ + ln -f temacs$(EXEEXT) emacs$(EXEEXT); \ + EMACSLOADPATH=$(lispsource) ./emacs -q -batch \ -f list-load-path-shadows || true; \ else \ LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \ - ln -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}; \ + ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ ./emacs -q -batch -f list-load-path-shadows || true; \ fi ## We run make-docfile twice because the command line may get too long ## on some systems. -## ${SOME_MACHINE_OBJECTS} comes before ${obj} because some files may -## or may not be included in ${obj}, but they are always included in -## ${SOME_MACHINE_OBJECTS}. Since a file is processed when it is mentioned +## $(SOME_MACHINE_OBJECTS) comes before $(obj) because some files may +## or may not be included in $(obj), but they are always included in +## $(SOME_MACHINE_OBJECTS). Since a file is processed when it is mentioned ## for the first time, this prevents any variation between configurations ## in the contents of the DOC file. -## Likewise for ${SOME_MACHINE_LISP}. -## Most of this Makefile refers to Lisp files via ${lispsource}, so -## we also use ${lisp} rather than ${shortlisp} for the dependency since +## Likewise for $(SOME_MACHINE_LISP). +## Most of this Makefile refers to Lisp files via $(lispsource), so +## we also use $(lisp) rather than $(shortlisp) for the dependency since ## the Makefile uses string equality to decide when we talk about identical -## files. Apparently we pass ${shortlisp} rather than ${lisp} to make-docfile +## files. Apparently we pass $(shortlisp) rather than $(lisp) to make-docfile ## only in order to reduce the command line length. --Stef -${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${lisp} ${SOME_MACHINE_LISP} - -rm -f ${etc}DOC - ${libsrc}make-docfile -d ${srcdir} ${SOME_MACHINE_OBJECTS} ${obj} > ${etc}DOC - ${libsrc}make-docfile -a ${etc}DOC -d ${srcdir} ${SOME_MACHINE_LISP} ${shortlisp} +$(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp) $(SOME_MACHINE_LISP) + -rm -f $(etc)/DOC + $(libsrc)/make-docfile -d $(srcdir) $(SOME_MACHINE_OBJECTS) $(obj) > $(etc)/DOC + $(libsrc)/make-docfile -a $(etc)/DOC -d $(srcdir) $(SOME_MACHINE_LISP) $(shortlisp) -${libsrc}make-docfile${EXEEXT}: - cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile${EXEEXT} +$(libsrc)/make-docfile$(EXEEXT): + cd $(libsrc); $(MAKE) $(MFLAGS) make-docfile$(EXEEXT) buildobj.h: Makefile - echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h + echo "#define BUILDOBJ \"$(obj) $(otherobj) " "\"" > buildobj.h -temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} - $(CC) $(LD_FIRSTFLAG) ${TEMACS_LDFLAGS} ${TEMACS_LDFLAGS2} \ - -o temacs ${START_FILES} ${obj} ${otherobj} ${LIBES} +temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) + $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(TEMACS_LDFLAGS2) \ + -o temacs $(START_FILES) $(obj) $(otherobj) $(LIBES) ## The following oldxmenu-related rules are only (possibly) used if ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them ## (provided we take a little care that OLDXMENU is never empty). really-lwlib: - cd ${lwlibdir}; ${MAKE} ${MFLAGS} \ - CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' + cd $(lwlibdir); $(MAKE) $(MFLAGS) \ + CC='$(CC)' CFLAGS='$(CFLAGS)' MAKE='$(MAKE)' @true # make -t should not create really-lwlib. .PHONY: really-lwlib really-oldXMenu: - cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \ - CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' + cd $(oldXMenudir); $(MAKE) $(MFLAGS) \ + CC='$(CC)' CFLAGS='$(CFLAGS)' MAKE='$(MAKE)' @true # make -t should not create really-oldXMenu. .PHONY: really-oldXMenu ## We do not really need this when OLDXMENU_DEPS is empty, but as ## things stand we need something to satisfy the temacs dependency. -stamp-oldxmenu: ${OLDXMENU_DEPS} +stamp-oldxmenu: $(OLDXMENU_DEPS) touch stamp-oldxmenu ## Supply an ordering for parallel make. -../src/$(OLDXMENU): ${OLDXMENU} +../src/$(OLDXMENU): $(OLDXMENU) $(OLDXMENU): $(OLDXMENU_TARGET) @@ -688,9 +685,6 @@ $(OLDXMENU): $(OLDXMENU_TARGET) @echo "Please run the `configure' script again." exit 1 -ecrt0.o: ecrt0.c $(config_h) - @$(MKDEPDIR) - $(CC) -c $(ALL_CFLAGS) ${srcdir}/ecrt0.c doc.o: buildobj.h @@ -699,14 +693,14 @@ doc.o: buildobj.h mostlyclean: - rm -f temacs${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a + rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a rm -f ../etc/DOC - rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT} + rm -f bootstrap-emacs$(EXEEXT) emacs-$(version)$(EXEEXT) rm -f buildobj.h clean: mostlyclean - rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT} - -rm -rf ${DEPDIR} - test "X${ns_appdir}" = "X" || rm -rf ${ns_appdir} + rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) + -rm -rf $(DEPDIR) + test "X$(ns_appdir)" = "X" || rm -rf $(ns_appdir) ## bootstrap-clean is used to clean up just before a bootstrap. ## It should remove all files generated during a compilation/bootstrap, @@ -715,7 +709,7 @@ bootstrap-clean: clean rm -f epaths.h config.h config.stamp stamp-oldxmenu ../etc/DOC-* if test -f ./.gdbinit; then \ mv ./.gdbinit ./.gdbinit.save; \ - if test -f "${srcdir}/.gdbinit"; then rm -f ./.gdbinit.save; \ + if test -f "$(srcdir)/.gdbinit"; then rm -f ./.gdbinit.save; \ else mv ./.gdbinit.save ./.gdbinit; fi; \ fi ## This is used in making a distribution. @@ -727,7 +721,7 @@ maintainer-clean: distclean @echo "it deletes files that may require special tools to rebuild." rm -f TAGS versionclean: - -rm -f emacs${EXEEXT} emacs-*.*.*${EXEEXT} ../etc/DOC* + -rm -f emacs$(EXEEXT) emacs-*.*.*$(EXEEXT) ../etc/DOC* extraclean: distclean -rm -f *~ \#* m/?*~ s/?*~ @@ -738,17 +732,17 @@ ctagsfiles1 = [xyzXYZ]*.[hcm] ctagsfiles2 = [a-wA-W]*.[hcm] TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) - ../lib-src/etags --include=TAGS-LISP --include=${lwlibdir}/TAGS \ + ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \ --regex='/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) frc: TAGS-LISP: frc - $(MAKE) -f ${lispdir}Makefile TAGS-LISP ETAGS=../lib-src/etags + $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags -$(lwlibdir)TAGS: - (cd $(lwlibdir); $(MAKE) -f $(lwlibdir)Makefile tags ETAGS=../lib-src/etags) +$(lwlibdir)/TAGS: + (cd $(lwlibdir); $(MAKE) -f $(lwlibdir)/Makefile tags ETAGS=../lib-src/etags) -tags: TAGS TAGS-LISP $(lwlibdir)TAGS +tags: TAGS TAGS-LISP $(lwlibdir)/TAGS .PHONY: tags @@ -770,10 +764,10 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS ## it), so it was compiled in parallel, leading typically to having 2 ## processes dumping bootstrap-emacs at the same time). ## So instead, we replace the witness-emacs dependencies by conditional -## bootstrap-dependencies (via ${BOOTSTRAPEMACS}). Of course, since we do +## bootstrap-dependencies (via $(BOOTSTRAPEMACS)). Of course, since we do ## not want to rely on GNU Make features, we have to rely on an external ## script to do the conditional part of the dependency -## (i.e. see the ${SUBDIR} rule ../Makefile.in). +## (i.e. see the $(SUBDIR) rule ../Makefile.in). .SUFFIXES: .elc .el @@ -783,28 +777,28 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS ## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)" .el.elc: @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \ - THEFILE=$< EMACS=${bootstrap_exe} + THEFILE=$< EMACS=$(bootstrap_exe) ## Since the .el.elc rule cannot specify an extra dependency, we do it here. -${lisp} ${SOME_MACHINE_LISP}: $(BOOTSTRAPEMACS) +$(lisp) $(SOME_MACHINE_LISP): $(BOOTSTRAPEMACS) ## VCSWITNESS points to the file that holds info about the current checkout. ## We use it as a heuristic to decide when to rebuild loaddefs.el. -${lispsource}loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) - cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=${bootstrap_exe} +$(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) + cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=$(bootstrap_exe) ## Dump an Emacs executable named bootstrap-emacs containing the ## files from loadup.el in source form. -bootstrap-emacs${EXEEXT}: temacs${EXEEXT} +bootstrap-emacs$(EXEEXT): temacs$(EXEEXT) cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs - if test "${CANNOT_DUMP}" = "yes"; then \ - ln -f temacs${EXEEXT} bootstrap-emacs${EXEEXT}; \ + if test "$(CANNOT_DUMP)" = "yes"; then \ + ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ else \ $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \ - mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}; \ + mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ fi @: Compile some files earlier to speed up further compilation. - cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe} + cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=$(bootstrap_exe) ## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk. @deps_frag@ diff --git a/src/alloc.c b/src/alloc.c index f2bb28e2d96..0f83f375d40 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -65,15 +65,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ extern POINTER_TYPE *sbrk (); #endif -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif -#ifndef O_WRONLY -#define O_WRONLY 1 -#endif #ifdef WINDOWSNT -#include <fcntl.h> #include "w32.h" #endif diff --git a/src/bidi.c b/src/bidi.c index b7c6fdc2ddd..1f14f6ab840 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -51,7 +51,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> -#include <string.h> #include <setjmp.h> #include "lisp.h" diff --git a/src/buffer.c b/src/buffer.c index 6b6b6efc633..3eb96beeb0f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5958,10 +5958,7 @@ No information is given about the length of the text after the change. Buffer changes made while executing the `before-change-functions' don't call any before-change or after-change functions. -That's because these variables are temporarily set to nil. -As a result, a hook function cannot straightforwardly alter the -value of these variables. See the Emacs Lisp manual for a way of -accomplishing an equivalent result by using other variables. +That's because `inhibit-modification-hooks' is temporarily set non-nil. If an unhandled error happens in running these functions, the variable's value remains nil. That prevents the error @@ -5979,10 +5976,7 @@ and the post-change beginning and end are at the same place.) Buffer changes made while executing the `after-change-functions' don't call any before-change or after-change functions. -That's because these variables are temporarily set to nil. -As a result, a hook function cannot straightforwardly alter the -value of these variables. See the Emacs Lisp manual for a way of -accomplishing an equivalent result by using other variables. +That's because `inhibit-modification-hooks' is temporarily set non-nil. If an unhandled error happens in running these functions, the variable's value remains nil. That prevents the error diff --git a/src/callproc.c b/src/callproc.c index 6f70631a484..ee0872b5562 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -24,13 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <stdio.h> #include <setjmp.h> - -/* Define SIGCHLD as an alias for SIGCLD. */ - -#if !defined (SIGCHLD) && defined (SIGCLD) -#define SIGCHLD SIGCLD -#endif /* SIGCLD */ - #include <sys/types.h> #ifdef HAVE_UNISTD_H @@ -38,33 +31,20 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #include <sys/file.h> -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif #ifdef WINDOWSNT #define NOMINMAX #include <windows.h> -#include <stdlib.h> /* for proper declaration of environ */ -#include <fcntl.h> #include "w32.h" #define _P_NOWAIT 1 /* from process.h */ #endif #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ -#include <fcntl.h> #include <sys/stat.h> #include <sys/param.h> #endif /* MSDOS */ -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - -#ifndef O_WRONLY -#define O_WRONLY 1 -#endif - #include "lisp.h" #include "commands.h" #include "buffer.h" @@ -274,21 +254,16 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; else if (! must_encode) - val = Qnil; + val = Qraw_text; else { args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); args2[0] = Qcall_process; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; coding_systems = Ffind_operation_coding_system (nargs + 1, args2); - if (CONSP (coding_systems)) - val = XCDR (coding_systems); - else if (CONSP (Vdefault_process_coding_system)) - val = XCDR (Vdefault_process_coding_system); - else - val = Qnil; + val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil; } - val = coding_inherit_eol_type (val, Qnil); + val = complement_process_encoding_system (val); setup_coding_system (Fcheck_coding_system (val), &argument_coding); coding_attrs = CODING_ID_ATTRS (argument_coding.id); if (NILP (CODING_ATTR_ASCII_COMPAT (coding_attrs))) @@ -932,20 +907,16 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; else if (NILP (current_buffer->enable_multibyte_characters)) - val = Qnil; + val = Qraw_text; else { args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); args2[0] = Qcall_process_region; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; coding_systems = Ffind_operation_coding_system (nargs + 1, args2); - if (CONSP (coding_systems)) - val = XCDR (coding_systems); - else if (CONSP (Vdefault_process_coding_system)) - val = XCDR (Vdefault_process_coding_system); - else - val = Qnil; + val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil; } + val = complement_process_encoding_system (val); { int count1 = SPECPDL_INDEX (); diff --git a/src/ccl.c b/src/ccl.c index f98897b51fa..ca4a1479091 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -448,7 +448,7 @@ Lisp_Object Vtranslation_hash_table_vector; Therefore, the instruction code range is 0..16384(0x3fff). */ -/* Read a multibyte characeter. +/* Read a multibyte character. A code point is stored into reg[rrr]. A charset ID is stored into reg[RRR]. */ @@ -2044,7 +2044,7 @@ If R0..R7 are nil, they are initialized to 0. If IC is nil, it is initialized to head of the CCL program. If optional 4th arg CONTINUE is non-nil, keep IC on read operation -when read buffer is exausted, else, IC is always set to the end of +when read buffer is exhausted, else, IC is always set to the end of CCL-PROGRAM on exit. It returns the contents of write buffer as a string, diff --git a/src/character.c b/src/character.c index d80f8139486..1c8fae88176 100644 --- a/src/character.c +++ b/src/character.c @@ -336,16 +336,6 @@ If the multibyte character does not represent a byte, return -1. */) } } -DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, - doc: /* Return 1 regardless of the argument CHAR. -This is now an obsolete function. We keep it just for backward compatibility. -usage: (char-bytes CHAR) */) - (Lisp_Object ch) -{ - CHECK_CHARACTER (ch); - return make_number (1); -} - DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, doc: /* Return width of CHAR when displayed in the current buffer. The width is measured by how many columns it occupies on the screen. @@ -1073,7 +1063,6 @@ syms_of_character (void) defsubr (&Scharacterp); defsubr (&Sunibyte_char_to_multibyte); defsubr (&Smultibyte_char_to_unibyte); - defsubr (&Schar_bytes); defsubr (&Schar_width); defsubr (&Sstring_width); defsubr (&Schar_direction); diff --git a/src/charset.c b/src/charset.c index 8051b11330e..0ab776b6914 100644 --- a/src/charset.c +++ b/src/charset.c @@ -28,7 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> -#include <stdlib.h> #include <unistd.h> #include <ctype.h> #include <sys/types.h> @@ -2365,8 +2364,8 @@ syms_of_charset (void) Vemacs_mule_charset_list = Qnil; /* Don't staticpro them here. It's done in syms_of_fns. */ - QCtest = intern (":test"); - Qeq = intern ("eq"); + QCtest = intern_c_string (":test"); + Qeq = intern_c_string ("eq"); staticpro (&Vcharset_hash_table); { diff --git a/src/coding.c b/src/coding.c index d6285ed9245..7a3bc40b9c7 100644 --- a/src/coding.c +++ b/src/coding.c @@ -166,7 +166,7 @@ detect_coding_XXX (struct coding_system *coding, while (1) { - /* Get one byte from the source. If the souce is exausted, jump + /* Get one byte from the source. If the source is exhausted, jump to no_more_source:. */ ONE_MORE_BYTE (c); @@ -180,7 +180,7 @@ detect_coding_XXX (struct coding_system *coding, return 0; no_more_source: - /* The source exausted successfully. */ + /* The source exhausted successfully. */ detect_info->found |= found; return 1; } @@ -530,7 +530,7 @@ enum iso_code_class_type on output. */ #define CODING_ISO_FLAG_DESIGNATE_AT_BOL 0x0400 -/* If set, do not encode unsafe charactes on output. */ +/* If set, do not encode unsafe characters on output. */ #define CODING_ISO_FLAG_SAFE 0x0800 /* If set, extra latin codes (128..159) are accepted as a valid code @@ -686,7 +686,7 @@ enum coding_category static Lisp_Object Vcoding_category_list; /* Table of coding categories (Lisp symbols). This variable is for - internal use oly. */ + internal use only. */ static Lisp_Object Vcoding_category_table; /* Table of coding-categories ordered by priority. */ @@ -818,7 +818,7 @@ static struct coding_system coding_categories[coding_category_max]; } while (0) -/* Like EMIT_ONE_ASCII_BYTE byt store two bytes; C1 and C2. */ +/* Like EMIT_ONE_ASCII_BYTE but store two bytes; C1 and C2. */ #define EMIT_TWO_ASCII_BYTES(c1, c2) \ do { \ @@ -1227,7 +1227,7 @@ alloc_destination (struct coding_system *coding, EMACS_INT nbytes, METHOD is one of enum composition_method. - Optionnal COMPOSITION-COMPONENTS are characters and composition + Optional COMPOSITION-COMPONENTS are characters and composition rules. In the case of CODING_ANNOTATE_CHARSET_MASK, one element CHARSET-ID @@ -1932,7 +1932,7 @@ encode_coding_utf_16 (struct coding_system *coding) CHARS is 0xA0 plus a number of characters composed by this data, - COMPONENTs are characters of multibye form or composition + COMPONENTs are characters of multibyte form or composition rules encoded by two-byte of ASCII codes. In addition, for backward compatibility, the following formats are @@ -2428,8 +2428,8 @@ decode_coding_emacs_mule (struct coding_system *coding) const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base; int *charbuf = coding->charbuf + coding->charbuf_used; - /* We may produce two annocations (charset and composition) in one - loop and one more charset annocation at the end. */ + /* We may produce two annotations (charset and composition) in one + loop and one more charset annotation at the end. */ int *charbuf_end = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3); int consumed_chars = 0, consumed_chars_base; @@ -2505,7 +2505,7 @@ decode_coding_emacs_mule (struct coding_system *coding) /* 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 - original pointer to buffer text, and fixup all related + original pointer to buffer text, and fix up all related pointers after the call. */ const unsigned char *orig = coding->source; EMACS_INT offset; @@ -2532,7 +2532,7 @@ decode_coding_emacs_mule (struct coding_system *coding) cmp_status->ncomps -= nchars; } - /* Now if C >= 0, we found a normally encoded characer, if C < + /* Now if C >= 0, we found a normally encoded character, if C < 0, we found an old-style composition component character or rule. */ @@ -3043,7 +3043,7 @@ setup_iso_safe_charsets (Lisp_Object attrs) /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". - Check if a text is encoded in one of ISO-2022 based codig systems. + Check if a text is encoded in one of ISO-2022 based coding systems. If it is, return 1, else return 0. */ static int @@ -3452,7 +3452,7 @@ finish_composition (int *charbuf, struct composition_status *cmp_status) return new_chars; } -/* If characers are under composition, finish the composition. */ +/* If characters are under composition, finish the composition. */ #define MAYBE_FINISH_COMPOSITION() \ do { \ if (cmp_status->state != COMPOSING_NO) \ @@ -3558,8 +3558,8 @@ decode_coding_iso_2022 (struct coding_system *coding) const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base; int *charbuf = coding->charbuf + coding->charbuf_used; - /* We may produce two annocations (charset and composition) in one - loop and one more charset annocation at the end. */ + /* We may produce two annotations (charset and composition) in one + loop and one more charset annotation at the end. */ int *charbuf_end = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3); int consumed_chars = 0, consumed_chars_base; @@ -3861,7 +3861,7 @@ decode_coding_iso_2022 (struct coding_system *coding) goto invalid_code; /* For the moment, nested direction is not supported. So, `coding->mode & CODING_MODE_DIRECTION' zero means - left-to-right, and nozero means right-to-left. */ + left-to-right, and nonzero means right-to-left. */ ONE_MORE_BYTE (c1); switch (c1) { @@ -4766,7 +4766,7 @@ decode_coding_sjis (struct coding_system *coding) const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base; int *charbuf = coding->charbuf + coding->charbuf_used; - /* We may produce one charset annocation in one loop and one more at + /* We may produce one charset annotation in one loop and one more at the end. */ int *charbuf_end = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); @@ -4884,7 +4884,7 @@ decode_coding_big5 (struct coding_system *coding) const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base; int *charbuf = coding->charbuf + coding->charbuf_used; - /* We may produce one charset annocation in one loop and one more at + /* We may produce one charset annotation in one loop and one more at the end. */ int *charbuf_end = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); @@ -5541,7 +5541,7 @@ decode_coding_charset (struct coding_system *coding) const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base; int *charbuf = coding->charbuf + coding->charbuf_used; - /* We may produce one charset annocation in one loop and one more at + /* We may produce one charset annotation in one loop and one more at the end. */ int *charbuf_end = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); @@ -6016,10 +6016,9 @@ raw_text_coding_system (Lisp_Object coding_system) } -/* If CODING_SYSTEM doesn't specify end-of-line format but PARENT - does, return one of the subsidiary that has the same eol-spec as - PARENT. Otherwise, return CODING_SYSTEM. If PARENT is nil, - inherit end-of-line format from the system's setting +/* If CODING_SYSTEM doesn't specify end-of-line format, return one of + the subsidiary that has the same eol-spec as PARENT (if it is not + nil and specifies end-of-line format) or the system's setting (system_eol_type). */ Lisp_Object @@ -6041,6 +6040,8 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent) parent_spec = CODING_SYSTEM_SPEC (parent); parent_eol_type = AREF (parent_spec, 2); + if (VECTORP (parent_eol_type)) + parent_eol_type = system_eol_type; } else parent_eol_type = system_eol_type; @@ -6054,6 +6055,45 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent) return coding_system; } + +/* Check if text-conversion and eol-conversion of CODING_SYSTEM are + decided for writing to a process. If not, complement them, and + return a new coding system. */ + +Lisp_Object +complement_process_encoding_system (Lisp_Object coding_system) +{ + Lisp_Object coding_base = Qnil, eol_base = Qnil; + Lisp_Object spec, attrs; + int i; + + for (i = 0; i < 3; i++) + { + if (i == 1) + coding_system = CDR_SAFE (Vdefault_process_coding_system); + else if (i == 2) + coding_system = preferred_coding_system (); + spec = CODING_SYSTEM_SPEC (coding_system); + if (NILP (spec)) + continue; + attrs = AREF (spec, 0); + if (NILP (coding_base) && ! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) + coding_base = CODING_ATTR_BASE_NAME (attrs); + if (NILP (eol_base) && ! VECTORP (AREF (spec, 2))) + eol_base = coding_system; + if (! NILP (coding_base) && ! NILP (eol_base)) + break; + } + + if (i > 0) + /* The original CODING_SYSTEM didn't specify text-conversion or + eol-conversion. Be sure that we return a fully complemented + coding system. */ + coding_system = coding_inherit_eol_type (coding_base, eol_base); + return coding_system; +} + + /* Emacs has a mechanism to automatically detect a coding system if it is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But, it's impossible to distinguish some coding systems accurately @@ -6104,14 +6144,14 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent) o coding-category-iso-7-else The category for a coding system which has the same code range - as ISO2022 of 7-bit environemnt but uses locking shift or + as ISO2022 of 7-bit environment but uses locking shift or single shift functions. Assigned the coding-system (Lisp symbol) `iso-2022-7bit-lock' by default. o coding-category-iso-8-else The category for a coding system which has the same code range - as ISO2022 of 8-bit environemnt but uses locking shift or + as ISO2022 of 8-bit environment but uses locking shift or single shift functions. Assigned the coding-system (Lisp symbol) `iso-2022-8bit-ss2' by default. @@ -7508,7 +7548,7 @@ static Lisp_Object Vcode_conversion_reused_workbuf; static int reused_workbuf_in_use; -/* Return a working buffer of code convesion. MULTIBYTE specifies the +/* Return a working buffer of code conversion. MULTIBYTE specifies the multibyteness of returning buffer. */ static Lisp_Object @@ -8160,7 +8200,7 @@ function `define-coding-system'. */) /* Detect how the bytes at SRC of length SRC_BYTES are encoded. If HIGHEST is nonzero, return the coding system of the highest - priority among the detected coding systems. Otherwize return a + priority among the detected coding systems. Otherwise return a list of detected coding systems sorted by their priorities. If MULTIBYTEP is nonzero, it is assumed that the bytes are in correct multibyte form but contains only ASCII and eight-bit chars. @@ -9262,7 +9302,7 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); /* We had better not send unsafe characters to terminal. */ terminal_coding->mode |= CODING_MODE_SAFE_ENCODING; - /* Characer composition should be disabled. */ + /* Character composition should be disabled. */ terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; terminal_coding->src_multibyte = 1; terminal_coding->dst_multibyte = 0; @@ -9278,7 +9318,7 @@ DEFUN ("set-safe-terminal-coding-system-internal", CHECK_SYMBOL (coding_system); setup_coding_system (Fcheck_coding_system (coding_system), &safe_terminal_coding); - /* Characer composition should be disabled. */ + /* Character composition should be disabled. */ safe_terminal_coding.common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; safe_terminal_coding.src_multibyte = 1; safe_terminal_coding.dst_multibyte = 0; @@ -9312,7 +9352,7 @@ DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_intern else Fcheck_coding_system (coding_system); setup_coding_system (coding_system, TERMINAL_KEYBOARD_CODING (t)); - /* Characer composition should be disabled. */ + /* Character composition should be disabled. */ TERMINAL_KEYBOARD_CODING (t)->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; return Qnil; @@ -9680,7 +9720,7 @@ usage: (define-coding-system-internal ...) */) If Nth element is a list of charset IDs, N is the first byte of one of them. The list is sorted by dimensions of the - charsets. A charset of smaller dimension comes firtst. */ + charsets. A charset of smaller dimension comes first. */ val = Fmake_vector (make_number (256), Qnil); for (tail = charset_list; CONSP (tail); tail = XCDR (tail)) diff --git a/src/coding.h b/src/coding.h index 0caa5b2f96f..7233726a250 100644 --- a/src/coding.h +++ b/src/coding.h @@ -707,6 +707,7 @@ extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object, int); extern Lisp_Object raw_text_coding_system (Lisp_Object); extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object); +extern Lisp_Object complement_process_encoding_system (Lisp_Object); extern int decode_coding_gap (struct coding_system *, EMACS_INT, EMACS_INT); diff --git a/src/config.in b/src/config.in index 43ebb756215..add2ac73d55 100644 --- a/src/config.in +++ b/src/config.in @@ -255,7 +255,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have a gif (or ungif) library. */ #undef HAVE_GIF -/* Define if we have the GNU TLS library. */ +/* Define if using GnuTLS. */ #undef HAVE_GNUTLS /* Define to 1 if you have the gpm library (-lgpm). */ @@ -408,6 +408,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* 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 @@ -816,9 +819,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the SM library (-lSM). */ #undef HAVE_X_SM -/* Define to 1 if you have the libxml2 library (-lxml2). */ -#undef HAVE_LIBXML2 - /* Define to 1 if you want to use the X window system. */ #undef HAVE_X_WINDOWS @@ -1097,12 +1097,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include config_opsysfile #include config_machfile -#if HAVE_GNUTLS -#define LIBGNUTLS $(LIBGNUTLS_LIBS) -#else /* not HAVE_GNUTLS */ -#define LIBGNUTLS -#endif /* not HAVE_GNUTLS */ - /* Set up some defines, C and LD flags for NeXTstep interface on GNUstep. (There is probably a better place to do this, but right now the Cocoa side does this in s/darwin.h and we cannot @@ -1170,13 +1164,8 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ not define __STDC__ (e.g. DEC C by default) or may define it as zero. */ #undef PROTOTYPES -#ifdef HAVE_STRING_H #include <string.h> -#endif - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif #ifdef HAVE_ALLOCA_H # include <alloca.h> @@ -1211,6 +1200,17 @@ typedef unsigned size_t; #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 + +/* 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__ diff --git a/src/dbusbind.c b/src/dbusbind.c index ffa02e8e9c9..683b7cb583b 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #ifdef HAVE_DBUS -#include <stdlib.h> #include <stdio.h> #include <dbus/dbus.h> #include <setjmp.h> @@ -901,6 +900,9 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, /* Add bus to list of registered buses. */ Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); + /* We do not want to abort. */ + putenv ("DBUS_FATAL_WARNINGS=0"); + /* Return. */ return Qnil; } @@ -2161,12 +2163,11 @@ be called when the D-Bus reply message arrives. */); doc: /* If non-nil, debug messages of D-Bus bindings are raised. */); #ifdef DBUS_DEBUG Vdbus_debug = Qt; - /* We can also set environment DBUS_VERBOSE=1 in order to see more - traces. */ + /* We can also set environment variable DBUS_VERBOSE=1 in order to + see more traces. This requires libdbus-1 to be configured with + --enable-verbose-mode. */ #else Vdbus_debug = Qnil; - /* We do not want to abort. */ - setenv ("DBUS_FATAL_WARNINGS", "0", 1); #endif Fprovide (intern_c_string ("dbusbind"), Qnil); diff --git a/src/doc.c b/src/doc.c index 8ec94f9836c..b887b3149bc 100644 --- a/src/doc.c +++ b/src/doc.c @@ -25,19 +25,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/file.h> /* Must be after sys/types.h for USG*/ #include <ctype.h> #include <setjmp.h> - -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - #include "lisp.h" #include "buffer.h" #include "keyboard.h" diff --git a/src/dosfns.c b/src/dosfns.c index e66b50ed3ff..fea70386f18 100644 --- a/src/dosfns.c +++ b/src/dosfns.c @@ -24,7 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* The entire file is within this conditional */ #include <stdio.h> -#include <string.h> #include <dos.h> #include <setjmp.h> #include "lisp.h" diff --git a/src/emacs.c b/src/emacs.c index 397b6d1ce88..70a0fae4ebf 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -187,6 +187,9 @@ Lisp_Object Vprevious_system_time_locale; Lisp code. */ Lisp_Object Vemacs_copyright, Vemacs_version; +/* Alist of external libraries and files implementing them. */ +Lisp_Object Vdynamic_library_alist; + /* 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; @@ -378,7 +381,7 @@ fatal_error_signal (int sig) { fatal_error_in_progress = 1; - if (sig == SIGTERM || sig == SIGHUP) + if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT) Fkill_emacs (make_number (sig)); shut_down_emacs (sig, 0, Qnil); @@ -1240,6 +1243,12 @@ main (int argc, char **argv) #ifdef SIGSYS signal (SIGSYS, fatal_error_signal); #endif + /* May need special treatment on MS-Windows. See + http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html + Please update the doc of kill-emacs, kill-emacs-hook, and + NEWS if you change this. + */ + if (noninteractive) signal (SIGINT, fatal_error_signal); signal (SIGTERM, fatal_error_signal); #ifdef SIGXCPU signal (SIGXCPU, fatal_error_signal); @@ -1988,6 +1997,9 @@ DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P", If ARG is an integer, return ARG as the exit program code. If ARG is a string, stuff it as keyboard input. +This function is called upon receipt of the signals SIGTERM +or SIGHUP, and upon SIGINT in batch mode. + The value of `kill-emacs-hook', if not void, is a list of functions (of no args), all of which are called before Emacs is actually killed. */) @@ -2000,7 +2012,7 @@ all of which are called before Emacs is actually killed. */) if (feof (stdin)) arg = Qt; - if (!NILP (Vrun_hooks) && !noninteractive) + if (!NILP (Vrun_hooks)) call1 (Vrun_hooks, intern ("kill-emacs-hook")); UNGCPRO; @@ -2109,6 +2121,10 @@ 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 *); + DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, doc: /* Dump current state of Emacs into executable file FILENAME. Take symbols from SYMFILE (presumably the file you executed to run Emacs). @@ -2176,13 +2192,13 @@ You must run Emacs in batch mode in order to dump it. */) Meanwhile, my_edata is not valid on Windows. */ memory_warnings (my_edata, malloc_warning); #endif /* not WINDOWSNT */ -#endif -#if !defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT +#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT /* Pthread may call malloc before main, and then we will get an endless loop, because pthread_self (see alloc.c) calls malloc the first time it is called on some systems. */ reset_malloc_hooks (); #endif +#endif /* not SYSTEM_MALLOC */ #ifdef DOUG_LEA_MALLOC malloc_state_ptr = malloc_get_state (); #endif @@ -2190,8 +2206,7 @@ You must run Emacs in batch mode in order to dump it. */) #ifdef USE_MMAP_FOR_BUFFERS mmap_set_vars (0); #endif - unexec (SDATA (filename), - !NILP (symfile) ? SDATA (symfile) : 0, my_edata, 0, 0); + unexec (SDATA (filename), !NILP (symfile) ? SDATA (symfile) : 0); #ifdef USE_MMAP_FOR_BUFFERS mmap_set_vars (1); #endif @@ -2421,7 +2436,8 @@ in other similar situations), functions placed on this hook should not expect to be able to interact with the user. To ask for confirmation, see `kill-emacs-query-functions' instead. -The hook is not run in batch mode, i.e., if `noninteractive' is non-nil. */); +Before Emacs 24.1, the hook was not run in batch mode, i.e., if +`noninteractive' was non-nil. */); Vkill_emacs_hook = Qnil; DEFVAR_INT ("emacs-priority", &emacs_priority, @@ -2494,6 +2510,24 @@ This is nil during initialization. */); doc: /* Version numbers of this version of Emacs. */); Vemacs_version = build_string (emacs_version); + DEFVAR_LISP ("dynamic-library-alist", &Vdynamic_library_alist, + doc: /* Alist of dynamic libraries vs external files implementing them. +Each element is a list (LIBRARY FILE...), where the car is a symbol +representing a supported external library, and the rest are strings giving +alternate filenames for that library. + +Emacs tries to load the library from the files in the order they appear on +the list; if none is loaded, the running session of Emacs won't have access +to that library. + +Note that image types `pbm' and `xbm' do not need entries in this variable +because they do not depend on external libraries and are always available. + +Also note that this is not a generic facility for accessing external +libraries; only those already known by Emacs will be loaded. */); + Vdynamic_library_alist = Qnil; + Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt); + /* Make sure IS_DAEMON starts up as false. */ daemon_pipe[1] = 0; } diff --git a/src/eval.c b/src/eval.c index 6383a672ae3..c07e7a37323 100644 --- a/src/eval.c +++ b/src/eval.c @@ -186,7 +186,7 @@ init_eval_once (void) specpdl = (struct specbinding *) xmalloc (specpdl_size * sizeof (struct specbinding)); specpdl_ptr = specpdl; /* Don't forget to update docs (lispref node "Local Variables"). */ - max_specpdl_size = 1000; + max_specpdl_size = 1200; /* 1000 is not enough for CEDET's c-by.el. */ max_lisp_eval_depth = 500; Vrun_hooks = Qnil; @@ -3717,8 +3717,10 @@ Output stream used is value of `standard-output'. */) Lisp_Object tail; Lisp_Object tem; struct gcpro gcpro1; + Lisp_Object old_print_level = Vprint_level; - XSETFASTINT (Vprint_level, 3); + if (NILP (Vprint_level)) + XSETFASTINT (Vprint_level, 8); tail = Qnil; GCPRO1 (tail); @@ -3759,7 +3761,7 @@ Output stream used is value of `standard-output'. */) backlist = backlist->next; } - Vprint_level = Qnil; + Vprint_level = old_print_level; UNGCPRO; return Qnil; } diff --git a/src/fileio.c b/src/fileio.c index 3d08e881e8f..36b6cc3ca8b 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1,7 +1,8 @@ /* File IO for GNU Emacs. - Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -20,11 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <limits.h> - -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif - #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> @@ -71,7 +68,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef WINDOWSNT #define NOMINMAX 1 #include <windows.h> -#include <stdlib.h> #include <fcntl.h> #endif /* not WINDOWSNT */ @@ -79,7 +75,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "msdos.h" #include <sys/param.h> #include <fcntl.h> -#include <string.h> #endif #ifdef DOS_NT @@ -105,14 +100,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "commands.h" -#ifndef O_WRONLY -#define O_WRONLY 1 -#endif - -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - #ifndef S_ISLNK # define lstat stat #endif @@ -188,10 +175,6 @@ Lisp_Object Vauto_save_visited_file_name; /* Whether or not to continue auto-saving after a large deletion. */ Lisp_Object Vauto_save_include_big_deletions; -/* On NT, specifies the directory separator character, used (eg.) when - expanding file names. This can be bound to / or \. */ -Lisp_Object Vdirectory_sep_char; - #ifdef HAVE_FSYNC /* Nonzero means skip the call to fsync in Fwrite-region. */ int write_region_inhibit_fsync; diff --git a/src/filelock.c b/src/filelock.c index 15ed546bc50..acca7234419 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -31,10 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #include <sys/file.h> -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif -#include <string.h> #ifdef HAVE_UNISTD_H #include <unistd.h> diff --git a/src/font.c b/src/font.c index dee55d1e976..aee6b483353 100644 --- a/src/font.c +++ b/src/font.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> -#include <stdlib.h> #include <ctype.h> #include <setjmp.h> @@ -3724,6 +3723,58 @@ font_get_frame_data (FRAME_PTR f, struct font_driver *driver) } +/* Sets attributes on a font. Any properties that appear in ALIST and + BOOLEAN_PROPERTIES or NON_BOOLEAN_PROPERTIES are set on the font. + BOOLEAN_PROPERTIES and NON_BOOLEAN_PROPERTIES are NULL-terminated + arrays of strings. This function is intended for use by the font + drivers to implement their specific font_filter_properties. */ +void +font_filter_properties (Lisp_Object font, + Lisp_Object alist, + const char *boolean_properties[], + const char *non_boolean_properties[]) +{ + Lisp_Object it; + int i; + + /* Set boolean values to Qt or Qnil */ + for (i = 0; boolean_properties[i] != NULL; ++i) + for (it = alist; ! NILP (it); it = XCDR (it)) + { + Lisp_Object key = XCAR (XCAR (it)); + Lisp_Object val = XCDR (XCAR (it)); + char *keystr = SDATA (SYMBOL_NAME (key)); + + if (strcmp (boolean_properties[i], keystr) == 0) + { + const char *str = INTEGERP (val) ? (XINT (val) ? "true" : "false") + : SYMBOLP (val) ? (const char *) SDATA (SYMBOL_NAME (val)) + : "true"; + + if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0 + || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0 + || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0 + || strcmp ("Off", str) == 0) + val = Qnil; + else + val = Qt; + + Ffont_put (font, key, val); + } + } + + for (i = 0; non_boolean_properties[i] != NULL; ++i) + for (it = alist; ! NILP (it); it = XCDR (it)) + { + Lisp_Object key = XCAR (XCAR (it)); + Lisp_Object val = XCDR (XCAR (it)); + char *keystr = SDATA (SYMBOL_NAME (key)); + if (strcmp (non_boolean_properties[i], keystr) == 0) + Ffont_put (font, key, val); + } +} + + /* Return the font used to draw character C by FACE at buffer position POS in window W. If STRING is non-nil, it is a string containing C at index POS. If C is negative, get C from the current buffer or @@ -4487,7 +4538,7 @@ DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs, doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT. Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID), where - VARIATION-SELECTOR is a chracter code of variation selection + VARIATION-SELECTOR is a character code of variation selection (#xFE00..#xFE0F or #xE0100..#xE01EF) GLYPH-ID is a glyph code of the corresponding variation glyph. */) (Lisp_Object font_object, Lisp_Object character) diff --git a/src/font.h b/src/font.h index c322b8e590f..b2d7e49fa29 100644 --- a/src/font.h +++ b/src/font.h @@ -581,7 +581,7 @@ struct font_driver FONT-ENTITY and it must be opened to check it, return -1. */ int (*has_char) (Lisp_Object font, int c); - /* Return a glyph code of FONT for characer C (Unicode code point). + /* Return a glyph code of FONT for character C (Unicode code point). If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ unsigned (*encode_char) (struct font *font, int c); @@ -821,6 +821,11 @@ extern int font_put_frame_data (FRAME_PTR f, extern void *font_get_frame_data (FRAME_PTR f, struct font_driver *driver); +extern void font_filter_properties (Lisp_Object font, + Lisp_Object alist, + const char *boolean_properties[], + const char *non_boolean_properties[]); + #ifdef HAVE_FREETYPE extern struct font_driver ftfont_driver; extern void syms_of_ftfont (void); diff --git a/src/ftfont.c b/src/ftfont.c index 97bf265a84c..b0d10791379 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -88,7 +88,7 @@ static Lisp_Object ftfont_lookup_cache (Lisp_Object, enum ftfont_cache_for); static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist); - + Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object); #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) @@ -260,7 +260,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) else { /* As this font is not scalable, parhaps this is a BDF or PCF - font. */ + font. */ FT_Face ft_face; ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); @@ -2093,7 +2093,7 @@ ftfont_drive_otf (font, spec, in, from, to, out, adjustment) return to; } -static int +static int ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in, int from, int to) { @@ -2645,42 +2645,7 @@ static const char *ftfont_non_booleans [] = { static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist) { - Lisp_Object it; - int i; - - /* Set boolean values to Qt or Qnil */ - for (i = 0; ftfont_booleans[i] != NULL; ++i) - for (it = alist; ! NILP (it); it = XCDR (it)) - { - Lisp_Object key = XCAR (XCAR (it)); - Lisp_Object val = XCDR (XCAR (it)); - char *keystr = SDATA (SYMBOL_NAME (key)); - - if (strcmp (ftfont_booleans[i], keystr) == 0) - { - const char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL; - if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false"; - if (str == NULL) str = "true"; - - val = Qt; - if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0 - || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0 - || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0 - || strcmp ("Off", str) == 0) - val = Qnil; - Ffont_put (font, key, val); - } - } - - for (i = 0; ftfont_non_booleans[i] != NULL; ++i) - for (it = alist; ! NILP (it); it = XCDR (it)) - { - Lisp_Object key = XCAR (XCAR (it)); - Lisp_Object val = XCDR (XCAR (it)); - char *keystr = SDATA (SYMBOL_NAME (key)); - if (strcmp (ftfont_non_booleans[i], keystr) == 0) - Ffont_put (font, key, val); - } + font_filter_properties (font, alist, ftfont_booleans, ftfont_non_booleans); } diff --git a/src/gnutls.c b/src/gnutls.c index 37b4341d184..577cca247ee 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -32,7 +32,14 @@ Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again, Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake; int global_initialized; -void +/* The following are for the property list of `gnutls-boot'. */ +Lisp_Object Qgnutls_bootprop_priority; +Lisp_Object Qgnutls_bootprop_trustfiles; +Lisp_Object Qgnutls_bootprop_keyfiles; +Lisp_Object Qgnutls_bootprop_callbacks; +Lisp_Object Qgnutls_bootprop_loglevel; + +static void emacs_gnutls_handshake (struct Lisp_Process *proc) { gnutls_session_t state = proc->gnutls_state; @@ -43,6 +50,9 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) if (proc->gnutls_initstage < GNUTLS_STAGE_TRANSPORT_POINTERS_SET) { + /* This is how GnuTLS takes sockets: as file descriptors passed + in. For an Emacs process socket, infd and outfd are the + same but we use this two-argument version for clarity. */ gnutls_transport_set_ptr2 (state, (gnutls_transport_ptr_t) (long) proc->infd, (gnutls_transport_ptr_t) (long) proc->outfd); @@ -67,8 +77,15 @@ emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf, register int rtnval, bytes_written; gnutls_session_t state = proc->gnutls_state; - if (proc->gnutls_initstage != GNUTLS_STAGE_READY) + if (proc->gnutls_initstage != GNUTLS_STAGE_READY) { +#ifdef EWOULDBLOCK + errno = EWOULDBLOCK; +#endif +#ifdef EAGAIN + errno = EAGAIN; +#endif return -1; + } bytes_written = 0; @@ -76,9 +93,9 @@ emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf, { rtnval = gnutls_write (state, buf, nbyte); - if (rtnval == -1) + if (rtnval < 0) { - if (errno == EINTR) + if (rtnval == GNUTLS_E_AGAIN || rtnval == GNUTLS_E_INTERRUPTED) continue; else return (bytes_written ? bytes_written : -1); @@ -88,7 +105,6 @@ emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf, nbyte -= rtnval; bytes_written += rtnval; } - fsync (STDOUT_FILENO); return (bytes_written); } @@ -110,14 +126,15 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf, if (rtnval >= 0) return rtnval; else - return 0; + return -1; } /* convert an integer error to a Lisp_Object; it will be either a known symbol like `gnutls_e_interrupted' and `gnutls_e_again' or simply the integer value of the error. GNUTLS_E_SUCCESS is mapped to Qt. */ -Lisp_Object gnutls_make_error (int error) +static Lisp_Object +gnutls_make_error (int error) { switch (error) { @@ -135,9 +152,9 @@ Lisp_Object gnutls_make_error (int error) } DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0, - doc: /* Return the GnuTLS init stage of PROCESS. + doc: /* Return the GnuTLS init stage of process PROC. See also `gnutls-boot'. */) - (Lisp_Object proc) + (Lisp_Object proc) { CHECK_PROCESS (proc); @@ -145,19 +162,21 @@ See also `gnutls-boot'. */) } DEFUN ("gnutls-errorp", Fgnutls_errorp, Sgnutls_errorp, 1, 1, 0, - doc: /* Returns t if ERROR (as generated by gnutls_make_error) -indicates a GnuTLS problem. */) - (Lisp_Object error) + doc: /* Return t if ERROR indicates a GnuTLS problem. +ERROR is an integer or a symbol with an integer `gnutls-code' property. +usage: (gnutls-errorp ERROR) */) + (Lisp_Object err) { - if (EQ (error, Qt)) return Qnil; + if (EQ (err, Qt)) return Qnil; return Qt; } DEFUN ("gnutls-error-fatalp", Fgnutls_error_fatalp, Sgnutls_error_fatalp, 1, 1, 0, - doc: /* Checks if ERROR is fatal. -ERROR is an integer or a symbol with an integer `gnutls-code' property. */) - (Lisp_Object err) + doc: /* Check if ERROR is fatal. +ERROR is an integer or a symbol with an integer `gnutls-code' property. +usage: (gnutls-error-fatalp ERROR) */) + (Lisp_Object err) { Lisp_Object code; @@ -186,9 +205,10 @@ ERROR is an integer or a symbol with an integer `gnutls-code' property. */) } DEFUN ("gnutls-error-string", Fgnutls_error_string, Sgnutls_error_string, 1, 1, 0, - doc: /* Returns a description of ERROR. -ERROR is an integer or a symbol with an integer `gnutls-code' property. */) - (Lisp_Object err) + doc: /* Return a description of ERROR. +ERROR is an integer or a symbol with an integer `gnutls-code' property. +usage: (gnutls-error-string ERROR) */) + (Lisp_Object err) { Lisp_Object code; @@ -214,9 +234,9 @@ ERROR is an integer or a symbol with an integer `gnutls-code' property. */) } DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0, - doc: /* Deallocate GNU TLS resources associated with PROCESS. + doc: /* Deallocate GnuTLS resources associated with process PROC. See also `gnutls-init'. */) - (Lisp_Object proc) + (Lisp_Object proc) { gnutls_session_t state; @@ -232,10 +252,11 @@ See also `gnutls-init'. */) return Qt; } -/* Initializes global GNU TLS state to defaults. -Call `gnutls-global-deinit' when GNU TLS usage is no longer needed. +/* Initializes global GnuTLS state to defaults. +Call `gnutls-global-deinit' when GnuTLS usage is no longer needed. Returns zero on success. */ -Lisp_Object gnutls_emacs_global_init (void) +static Lisp_Object +gnutls_emacs_global_init (void) { int ret = GNUTLS_E_SUCCESS; @@ -247,9 +268,10 @@ Lisp_Object gnutls_emacs_global_init (void) return gnutls_make_error (ret); } -/* Deinitializes global GNU TLS state. +/* Deinitializes global GnuTLS state. See also `gnutls-global-init'. */ -Lisp_Object gnutls_emacs_global_deinit (void) +static Lisp_Object +gnutls_emacs_global_deinit (void) { if (global_initialized) gnutls_global_deinit (); @@ -259,40 +281,48 @@ Lisp_Object gnutls_emacs_global_deinit (void) return gnutls_make_error (GNUTLS_E_SUCCESS); } -static void gnutls_log_function (int level, const char* string) +static void +gnutls_log_function (int level, const char* string) +{ + message ("gnutls.c: [%d] %s", level, string); +} + +static void +gnutls_log_function2 (int level, const char* string, const char* extra) { - message("gnutls.c: [%d] %s", level, string); + message ("gnutls.c: [%d] %s %s", level, string, extra); } -DEFUN ("gnutls-boot", Fgnutls_boot, Sgnutls_boot, 3, 7, 0, - doc: /* Initializes client-mode GnuTLS for process PROC. +DEFUN ("gnutls-boot", Fgnutls_boot, Sgnutls_boot, 3, 3, 0, + doc: /* Initialize GnuTLS client for process PROC with TYPE+PROPLIST. Currently only client mode is supported. Returns a success/failure value you can check with `gnutls-errorp'. -PRIORITY_STRING is a string describing the priority. -TYPE is either `gnutls-anon' or `gnutls-x509pki'. -TRUSTFILE is a PEM encoded trust file for `gnutls-x509pki'. -KEYFILE is ... for `gnutls-x509pki' (TODO). -CALLBACK is ... for `gnutls-x509pki' (TODO). -LOGLEVEL is the debug level requested from GnuTLS, try 4. +TYPE is a symbol, either `gnutls-anon' or `gnutls-x509pki'. +PROPLIST is a property list with the following keys: -LOGLEVEL will be set for this process AND globally for GnuTLS. So if -you set it higher or lower at any point, it affects global debugging. +:priority is a GnuTLS priority string, defaults to "NORMAL". +:trustfiles is a list of PEM-encoded trust files for `gnutls-x509pki'. +:keyfiles is a list of PEM-encoded key files for `gnutls-x509pki'. +:callbacks is an alist of callback functions (TODO). +:loglevel is the debug level requested from GnuTLS, try 4. + +The debug level will be set for this process AND globally for GnuTLS. +So if you set it higher or lower at any point, it affects global +debugging. Note that the priority is set on the client. The server does not use the protocols's priority except for disabling protocols that were not specified. -Processes must be initialized with this function before other GNU TLS +Processes must be initialized with this function before other GnuTLS functions are used. This function allocates resources which can only be deallocated by calling `gnutls-deinit' or by calling it again. Each authentication type may need additional information in order to -work. For X.509 PKI (`gnutls-x509pki'), you need TRUSTFILE and -KEYFILE and optionally CALLBACK. */) - (Lisp_Object proc, Lisp_Object priority_string, Lisp_Object type, - Lisp_Object trustfile, Lisp_Object keyfile, Lisp_Object callback, - Lisp_Object loglevel) +work. For X.509 PKI (`gnutls-x509pki'), you probably need at least +one trustfile (usually a CA bundle). */) + (Lisp_Object proc, Lisp_Object type, Lisp_Object proplist) { int ret = GNUTLS_E_SUCCESS; @@ -305,10 +335,25 @@ KEYFILE and optionally CALLBACK. */) gnutls_certificate_credentials_t x509_cred; gnutls_anon_client_credentials_t anon_cred; Lisp_Object global_init; + char* priority_string_ptr = "NORMAL"; /* default priority string. */ + Lisp_Object tail; + + /* Placeholders for the property list elements. */ + Lisp_Object priority_string; + Lisp_Object trustfiles; + Lisp_Object keyfiles; + Lisp_Object callbacks; + Lisp_Object loglevel; CHECK_PROCESS (proc); CHECK_SYMBOL (type); - CHECK_STRING (priority_string); + CHECK_LIST (proplist); + + priority_string = Fplist_get (proplist, Qgnutls_bootprop_priority); + trustfiles = Fplist_get (proplist, Qgnutls_bootprop_trustfiles); + keyfiles = Fplist_get (proplist, Qgnutls_bootprop_keyfiles); + callbacks = Fplist_get (proplist, Qgnutls_bootprop_callbacks); + loglevel = Fplist_get (proplist, Qgnutls_bootprop_loglevel); state = XPROCESS (proc)->gnutls_state; XPROCESS (proc)->gnutls_p = 1; @@ -387,29 +432,49 @@ KEYFILE and optionally CALLBACK. */) if (EQ (type, Qgnutls_x509pki)) { - if (STRINGP (trustfile)) + for (tail = trustfiles; !NILP (tail); tail = Fcdr (tail)) { - GNUTLS_LOG (1, max_log_level, "setting the trustfile"); - ret = gnutls_certificate_set_x509_trust_file - (x509_cred, - SDATA (trustfile), - file_format); - - if (ret < GNUTLS_E_SUCCESS) - return gnutls_make_error (ret); - } + Lisp_Object trustfile = Fcar (tail); + if (STRINGP (trustfile)) + { + GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ", + SDATA (trustfile)); + ret = gnutls_certificate_set_x509_trust_file + (x509_cred, + SDATA (trustfile), + file_format); + + if (ret < GNUTLS_E_SUCCESS) + return gnutls_make_error (ret); + } + else + { + error ("Sorry, GnuTLS can't use non-string trustfile %s", + trustfile); + } + } - if (STRINGP (keyfile)) + for (tail = keyfiles; !NILP (tail); tail = Fcdr (tail)) { - GNUTLS_LOG (1, max_log_level, "setting the keyfile"); - ret = gnutls_certificate_set_x509_crl_file - (x509_cred, - SDATA (keyfile), - file_format); - - if (ret < GNUTLS_E_SUCCESS) - return gnutls_make_error (ret); - } + Lisp_Object keyfile = Fcar (tail); + if (STRINGP (keyfile)) + { + GNUTLS_LOG2 (1, max_log_level, "setting the keyfile: ", + SDATA (keyfile)); + ret = gnutls_certificate_set_x509_crl_file + (x509_cred, + SDATA (keyfile), + file_format); + + if (ret < GNUTLS_E_SUCCESS) + return gnutls_make_error (ret); + } + else + { + error ("Sorry, GnuTLS can't use non-string keyfile %s", + keyfile); + } + } } GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_FILES; @@ -425,11 +490,23 @@ KEYFILE and optionally CALLBACK. */) GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_INIT; + if (STRINGP (priority_string)) + { + priority_string_ptr = (char*) SDATA (priority_string); + GNUTLS_LOG2 (1, max_log_level, "got non-default priority string:", + priority_string_ptr); + } + else + { + GNUTLS_LOG2 (1, max_log_level, "using default priority string:", + priority_string_ptr); + } + GNUTLS_LOG (1, max_log_level, "setting the priority string"); - ret = gnutls_priority_set_direct(state, - (char*) SDATA (priority_string), - NULL); + ret = gnutls_priority_set_direct (state, + priority_string_ptr, + NULL); if (ret < GNUTLS_E_SUCCESS) return gnutls_make_error (ret); @@ -466,11 +543,11 @@ KEYFILE and optionally CALLBACK. */) DEFUN ("gnutls-bye", Fgnutls_bye, Sgnutls_bye, 2, 2, 0, - doc: /* Terminate current GNU TLS connection for PROCESS. + doc: /* Terminate current GnuTLS connection for process PROC. The connection should have been initiated using `gnutls-handshake'. If CONT is not nil the TLS connection gets terminated and further -receives and sends will be disallowed. If the return value is zero you +receives and sends will be disallowed. If the return value is zero you may continue using the connection. If CONT is nil, GnuTLS actually sends an alert containing a close request and waits for the peer to reply with the same message. In order to reuse the connection you @@ -507,6 +584,21 @@ syms_of_gnutls (void) Qgnutls_x509pki = intern_c_string ("gnutls-x509pki"); staticpro (&Qgnutls_x509pki); + Qgnutls_bootprop_priority = intern_c_string (":priority"); + staticpro (&Qgnutls_bootprop_priority); + + Qgnutls_bootprop_trustfiles = intern_c_string (":trustfiles"); + staticpro (&Qgnutls_bootprop_trustfiles); + + Qgnutls_bootprop_keyfiles = intern_c_string (":keyfiles"); + staticpro (&Qgnutls_bootprop_keyfiles); + + Qgnutls_bootprop_callbacks = intern_c_string (":callbacks"); + staticpro (&Qgnutls_bootprop_callbacks); + + Qgnutls_bootprop_loglevel = intern_c_string (":loglevel"); + staticpro (&Qgnutls_bootprop_loglevel); + Qgnutls_e_interrupted = intern_c_string ("gnutls-e-interrupted"); staticpro (&Qgnutls_e_interrupted); Fput (Qgnutls_e_interrupted, Qgnutls_code, diff --git a/src/gnutls.h b/src/gnutls.h index bcf9776963f..2669317e97a 100644 --- a/src/gnutls.h +++ b/src/gnutls.h @@ -48,6 +48,8 @@ typedef enum #define GNUTLS_LOG(level, max, string) if (level <= max) { gnutls_log_function (level, "(Emacs) " string); } +#define GNUTLS_LOG2(level, max, string, extra) if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } + int emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf, unsigned int nbyte); diff --git a/src/gtkutil.c b/src/gtkutil.c index f82be62965d..3b7e6888753 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #ifdef USE_GTK -#include <string.h> #include <signal.h> #include <stdio.h> #include <setjmp.h> diff --git a/src/image.c b/src/image.c index 3c74c516d3f..4cdd7f2bbab 100644 --- a/src/image.c +++ b/src/image.c @@ -567,10 +567,6 @@ static struct image_type *image_types; Lisp_Object Vimage_types; -/* An alist of image types and libraries that implement the type. */ - -Lisp_Object Vimage_library_alist; - /* Cache for delayed-loading image types. */ static Lisp_Object Vimage_type_cache; @@ -645,7 +641,7 @@ lookup_image_type (Lisp_Object symbol) struct image_type *type; /* We must initialize the image-type if it hasn't been already. */ - if (NILP (Finit_image_library (symbol, Vimage_library_alist))) + if (NILP (Finit_image_library (symbol, Vdynamic_library_alist))) return 0; /* unimplemented */ for (type = image_types; type; type = type->next) @@ -1914,7 +1910,7 @@ mark_image_cache (struct image_cache *c) #ifdef HAVE_NTGUI /* Macro for defining functions that will be loaded from image DLLs. */ -#define DEF_IMGLIB_FN(func) int (FAR CDECL *fn_##func)() +#define DEF_IMGLIB_FN(func,args) int (FAR CDECL *fn_##func)args /* Macro for loading those image functions from the library. */ #define LOAD_IMGLIB_FN(lib,func) { \ @@ -1923,10 +1919,11 @@ mark_image_cache (struct image_cache *c) } /* Load a DLL implementing an image type. - The `image-library-alist' variable associates a symbol, - identifying an image type, to a list of possible filenames. + The argument LIBRARIES is usually the variable + `dynamic-library-alist', which associates a symbol, identifying + an external DLL library, to a list of possible filenames. The function returns NULL if no library could be loaded for - the given image type, or if the library was previously loaded; + the given symbol, or if the library was previously loaded; else the handle of the DLL. */ static HMODULE w32_delayed_load (Lisp_Object libraries, Lisp_Object type) @@ -3268,10 +3265,12 @@ xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void * /* XPM library details. */ -DEF_IMGLIB_FN (XpmFreeAttributes); -DEF_IMGLIB_FN (XpmCreateImageFromBuffer); -DEF_IMGLIB_FN (XpmReadFileToImage); -DEF_IMGLIB_FN (XImageFree); +DEF_IMGLIB_FN (XpmFreeAttributes, (XpmAttributes *)); +DEF_IMGLIB_FN (XpmCreateImageFromBuffer, (Display *, char *, xpm_XImage **, + xpm_XImage **, XpmAttributes *)); +DEF_IMGLIB_FN (XpmReadFileToImage, (Display *, char *, xpm_XImage **, + xpm_XImage **, XpmAttributes *)); +DEF_IMGLIB_FN (XImageFree, (xpm_XImage *)); static int init_xpm_functions (Lisp_Object libraries) @@ -5439,27 +5438,31 @@ png_image_p (Lisp_Object object) #ifdef HAVE_NTGUI /* PNG library details. */ -DEF_IMGLIB_FN (png_get_io_ptr); -DEF_IMGLIB_FN (png_sig_cmp); -DEF_IMGLIB_FN (png_create_read_struct); -DEF_IMGLIB_FN (png_create_info_struct); -DEF_IMGLIB_FN (png_destroy_read_struct); -DEF_IMGLIB_FN (png_set_read_fn); -DEF_IMGLIB_FN (png_set_sig_bytes); -DEF_IMGLIB_FN (png_read_info); -DEF_IMGLIB_FN (png_get_IHDR); -DEF_IMGLIB_FN (png_get_valid); -DEF_IMGLIB_FN (png_set_strip_16); -DEF_IMGLIB_FN (png_set_expand); -DEF_IMGLIB_FN (png_set_gray_to_rgb); -DEF_IMGLIB_FN (png_set_background); -DEF_IMGLIB_FN (png_get_bKGD); -DEF_IMGLIB_FN (png_read_update_info); -DEF_IMGLIB_FN (png_get_channels); -DEF_IMGLIB_FN (png_get_rowbytes); -DEF_IMGLIB_FN (png_read_image); -DEF_IMGLIB_FN (png_read_end); -DEF_IMGLIB_FN (png_error); +DEF_IMGLIB_FN (png_get_io_ptr, (png_structp)); +DEF_IMGLIB_FN (png_sig_cmp, (png_bytep, png_size_t, png_size_t)); +DEF_IMGLIB_FN (png_create_read_struct, (png_const_charp, png_voidp, + png_error_ptr, png_error_ptr)); +DEF_IMGLIB_FN (png_create_info_struct, (png_structp)); +DEF_IMGLIB_FN (png_destroy_read_struct, (png_structpp, png_infopp, png_infopp)); +DEF_IMGLIB_FN (png_set_read_fn, (png_structp, png_voidp, png_rw_ptr)); +DEF_IMGLIB_FN (png_set_sig_bytes, (png_structp, int)); +DEF_IMGLIB_FN (png_read_info, (png_structp, png_infop)); +DEF_IMGLIB_FN (png_get_IHDR, (png_structp, png_infop, + png_uint_32 *, png_uint_32 *, + int *, int *, int *, int *, int *)); +DEF_IMGLIB_FN (png_get_valid, (png_structp, png_infop, png_uint_32)); +DEF_IMGLIB_FN (png_set_strip_16, (png_structp)); +DEF_IMGLIB_FN (png_set_expand, (png_structp)); +DEF_IMGLIB_FN (png_set_gray_to_rgb, (png_structp)); +DEF_IMGLIB_FN (png_set_background, (png_structp, png_color_16p, + int, int, double)); +DEF_IMGLIB_FN (png_get_bKGD, (png_structp, png_infop, png_color_16p *)); +DEF_IMGLIB_FN (png_read_update_info, (png_structp, png_infop)); +DEF_IMGLIB_FN (png_get_channels, (png_structp, png_infop)); +DEF_IMGLIB_FN (png_get_rowbytes, (png_structp, png_infop)); +DEF_IMGLIB_FN (png_read_image, (png_structp, png_bytepp)); +DEF_IMGLIB_FN (png_read_end, (png_structp, png_infop)); +DEF_IMGLIB_FN (png_error, (png_structp, png_const_charp)); static int init_png_functions (Lisp_Object libraries) @@ -6042,14 +6045,14 @@ jpeg_image_p (Lisp_Object object) #ifdef HAVE_NTGUI /* JPEG library details. */ -DEF_IMGLIB_FN (jpeg_CreateDecompress); -DEF_IMGLIB_FN (jpeg_start_decompress); -DEF_IMGLIB_FN (jpeg_finish_decompress); -DEF_IMGLIB_FN (jpeg_destroy_decompress); -DEF_IMGLIB_FN (jpeg_read_header); -DEF_IMGLIB_FN (jpeg_read_scanlines); -DEF_IMGLIB_FN (jpeg_std_error); -DEF_IMGLIB_FN (jpeg_resync_to_restart); +DEF_IMGLIB_FN (jpeg_CreateDecompress, (j_decompress_ptr, int, size_t)); +DEF_IMGLIB_FN (jpeg_start_decompress, (j_decompress_ptr)); +DEF_IMGLIB_FN (jpeg_finish_decompress, (j_decompress_ptr)); +DEF_IMGLIB_FN (jpeg_destroy_decompress, (j_decompress_ptr)); +DEF_IMGLIB_FN (jpeg_read_header, (j_decompress_ptr, boolean)); +DEF_IMGLIB_FN (jpeg_read_scanlines, (j_decompress_ptr, JSAMPARRAY, JDIMENSION)); +DEF_IMGLIB_FN (jpeg_std_error, (struct jpeg_error_mgr *)); +DEF_IMGLIB_FN (jpeg_resync_to_restart, (j_decompress_ptr, int)); static int init_jpeg_functions (Lisp_Object libraries) @@ -6575,14 +6578,17 @@ tiff_image_p (Lisp_Object object) #ifdef HAVE_NTGUI /* TIFF library details. */ -DEF_IMGLIB_FN (TIFFSetErrorHandler); -DEF_IMGLIB_FN (TIFFSetWarningHandler); -DEF_IMGLIB_FN (TIFFOpen); -DEF_IMGLIB_FN (TIFFClientOpen); -DEF_IMGLIB_FN (TIFFGetField); -DEF_IMGLIB_FN (TIFFReadRGBAImage); -DEF_IMGLIB_FN (TIFFClose); -DEF_IMGLIB_FN (TIFFSetDirectory); +DEF_IMGLIB_FN (TIFFSetErrorHandler, (TIFFErrorHandler)); +DEF_IMGLIB_FN (TIFFSetWarningHandler, (TIFFErrorHandler)); +DEF_IMGLIB_FN (TIFFOpen, (const char *, const char *)); +DEF_IMGLIB_FN (TIFFClientOpen, (const char *, const char *, thandle_t, + TIFFReadWriteProc, TIFFReadWriteProc, + TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, + TIFFMapFileProc, TIFFUnmapFileProc)); +DEF_IMGLIB_FN (TIFFGetField, (TIFF *, ttag_t, ...)); +DEF_IMGLIB_FN (TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int)); +DEF_IMGLIB_FN (TIFFClose, (TIFF *)); +DEF_IMGLIB_FN (TIFFSetDirectory, (TIFF *, tdir_t)); static int init_tiff_functions (Lisp_Object libraries) @@ -6787,8 +6793,9 @@ tiff_load (struct frame *f, struct image *img) memsrc.len = SBYTES (specified_data); memsrc.index = 0; - /* Casting return value avoids a GCC warning on W32. */ - tiff = (TIFF *)fn_TIFFClientOpen ("memory_source", "r", &memsrc, + /* Casting arguments return value avoids a GCC warning on W32. */ + tiff = (TIFF *)fn_TIFFClientOpen ("memory_source", "r", + (thandle_t) &memsrc, (TIFFReadWriteProc) tiff_read_from_memory, (TIFFReadWriteProc) tiff_write_from_memory, tiff_seek_in_memory, @@ -7024,10 +7031,10 @@ gif_image_p (Lisp_Object object) #ifdef HAVE_NTGUI /* GIF library details. */ -DEF_IMGLIB_FN (DGifCloseFile); -DEF_IMGLIB_FN (DGifSlurp); -DEF_IMGLIB_FN (DGifOpen); -DEF_IMGLIB_FN (DGifOpenFileName); +DEF_IMGLIB_FN (DGifCloseFile, (GifFileType *)); +DEF_IMGLIB_FN (DGifSlurp, (GifFileType *)); +DEF_IMGLIB_FN (DGifOpen, (void *, InputFunc)); +DEF_IMGLIB_FN (DGifOpenFileName, (const char *)); static int init_gif_functions (Lisp_Object libraries) @@ -8583,7 +8590,7 @@ Return non-nil if TYPE is a supported image type. Image types pbm and xbm are prebuilt; other types are loaded here. Libraries to load are specified in alist LIBRARIES (usually, the value -of `image-library-alist', which see). */) +of `dynamic-library-alist', which see). */) (Lisp_Object type, Lisp_Object libraries) { Lisp_Object tested; @@ -8659,20 +8666,6 @@ Each element of the list is a symbol for an image type, like 'jpeg or 'png. To check whether it is really supported, use `image-type-available-p'. */); Vimage_types = Qnil; - DEFVAR_LISP ("image-library-alist", &Vimage_library_alist, - doc: /* Alist of image types vs external libraries needed to display them. - -Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol -representing a supported image type, and the rest are strings giving -alternate filenames for the corresponding external libraries. - -Emacs tries to load the libraries in the order they appear on the -list; if none is loaded, the running session of Emacs won't -support the image type. Types 'pbm and 'xbm don't need to be -listed; they are always supported. */); - Vimage_library_alist = Qnil; - Fput (intern_c_string ("image-library-alist"), Qrisky_local_variable, Qt); - DEFVAR_LISP ("max-image-size", &Vmax_image_size, doc: /* Maximum size of images. Emacs will not load an image into memory if its pixel width or @@ -8718,11 +8711,11 @@ non-numeric, there is no explicit limit on the size of images. */); staticpro (&QCheuristic_mask); QCindex = intern_c_string (":index"); staticpro (&QCindex); - QCgeometry = intern (":geometry"); + QCgeometry = intern_c_string (":geometry"); staticpro (&QCgeometry); - QCcrop = intern (":crop"); + QCcrop = intern_c_string (":crop"); staticpro (&QCcrop); - QCrotation = intern (":rotation"); + QCrotation = intern_c_string (":rotation"); staticpro (&QCrotation); QCmatrix = intern_c_string (":matrix"); staticpro (&QCmatrix); @@ -8785,7 +8778,7 @@ non-numeric, there is no explicit limit on the size of images. */); #endif #if defined (HAVE_IMAGEMAGICK) - Qimagemagick = intern ("imagemagick"); + Qimagemagick = intern_c_string ("imagemagick"); staticpro (&Qimagemagick); ADD_IMAGE_TYPE (Qimagemagick); #endif diff --git a/src/keyboard.c b/src/keyboard.c index b77689bde06..7f770ae4df1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -62,9 +62,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> #endif -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif /* This is to get the definitions of the XK_ symbols. */ #ifdef HAVE_X_WINDOWS @@ -647,18 +645,6 @@ static int store_user_signal_events (void); static int cannot_suspend; -/* Install the string STR as the beginning of the string of echoing, - so that it serves as a prompt for the next character. - Also start echoing. */ - -void -echo_prompt (Lisp_Object str) -{ - current_kboard->echo_string = str; - current_kboard->echo_after_prompt = SCHARS (str); - echo_now (); -} - /* Add C to the echo string, if echoing is going on. C can be a character, which is printed prettily ("M-C-x" and all that jazz), or a symbol, whose name is printed. */ @@ -757,6 +743,9 @@ echo_dash (void) if (NILP (current_kboard->echo_string)) return; + if (this_command_key_count == 0) + return; + if (!current_kboard->immediate_echo && SCHARS (current_kboard->echo_string) == 0) return; @@ -1786,7 +1775,8 @@ command_loop_1 (void) this_single_command_key_start = 0; } - if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) + if (!NILP (current_buffer->mark_active) + && !NILP (Vrun_hooks)) { /* In Emacs 22, setting transient-mark-mode to `only' was a way of turning it on for just one command. This usage is @@ -1805,6 +1795,9 @@ command_loop_1 (void) /* Even if not deactivating the mark, set PRIMARY if `select-active-regions' is non-nil. */ if (!NILP (Fwindow_system (Qnil)) + /* Even if mark_active is non-nil, the actual buffer + marker may not have been set yet (Bug#7044). */ + && XMARKER (current_buffer->mark)->buffer && (EQ (Vselect_active_regions, Qonly) ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) : (!NILP (Vselect_active_regions) @@ -9123,7 +9116,14 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (INTERACTIVE) { if (!NILP (prompt)) - echo_prompt (prompt); + { + /* Install the string STR as the beginning of the string of + echoing, so that it serves as a prompt for the next + character. */ + current_kboard->echo_string = prompt; + current_kboard->echo_after_prompt = SCHARS (prompt); + echo_now (); + } else if (cursor_in_echo_area && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) && NILP (Fzerop (Vecho_keystrokes))) diff --git a/src/lisp.h b/src/lisp.h index d942e792957..89d01ec6872 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3328,6 +3328,7 @@ extern Lisp_Object Vbefore_init_time, Vafter_init_time; extern Lisp_Object Vinstallation_directory; extern Lisp_Object empty_unibyte_string, empty_multibyte_string; extern Lisp_Object Qfile_name_handler_alist; +extern Lisp_Object Vdynamic_library_alist; extern void (*fatal_error_signal_hook) (void); EXFUN (Fkill_emacs, 1) NO_RETURN; #if HAVE_SETLOCALE diff --git a/src/lread.c b/src/lread.c index 64633a6e442..e150078f6e2 100644 --- a/src/lread.c +++ b/src/lread.c @@ -54,12 +54,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <locale.h> #endif /* HAVE_SETLOCALE */ -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif #ifdef HAVE_FSEEKO #define file_offset off_t diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 752a3c211b3..21bdeb8443f 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -37,7 +37,7 @@ TEMACS = $(BLD)/temacs.exe TEMACS_TMP = $(BLD)/temacs.bin TLIB0 = $(BLD)/temacs0.$(A) TLIB1 = $(BLD)/temacs1.$(A) -TLIBW32 = $(BLD)/temacw32.$(A) +TLIB2 = $(BLD)/temacs2.$(A) TOBJ = $(BLD)/firstfile.$(O) TRES = $(BLD)/emacs.res TLASTLIB = $(BLD)/lastfile.$(A) @@ -94,8 +94,9 @@ OBJ1 = $(BLD)/alloc.$(O) \ $(BLD)/scroll.$(O) \ $(BLD)/search.$(O) \ $(BLD)/sound.$(O) \ - $(BLD)/syntax.$(O) \ - $(BLD)/sysdep.$(O) \ + $(BLD)/syntax.$(O) + +OBJ2 = $(BLD)/sysdep.$(O) \ $(BLD)/term.$(O) \ $(BLD)/tparam.$(O) \ $(BLD)/undo.$(O) \ @@ -125,28 +126,27 @@ OBJ1 = $(BLD)/alloc.$(O) \ $(BLD)/fringe.$(O) \ $(BLD)/image.$(O) \ $(BLD)/terminal.$(O) \ - $(BLD)/menu.$(O) - -WIN32OBJ = $(BLD)/w32term.$(O) \ - $(BLD)/w32xfns.$(O) \ - $(BLD)/w32fns.$(O) \ - $(BLD)/xfaces.$(O) \ - $(BLD)/w32select.$(O) \ - $(BLD)/w32menu.$(O) \ - $(BLD)/w32reg.$(O) - -FONTOBJ = $(BLD)/w32font.$(O) $(BLD)/w32uniscribe.$(O) + $(BLD)/menu.$(O) \ + $(BLD)/w32term.$(O) \ + $(BLD)/w32xfns.$(O) \ + $(BLD)/w32fns.$(O) \ + $(BLD)/xfaces.$(O) \ + $(BLD)/w32select.$(O) \ + $(BLD)/w32menu.$(O) \ + $(BLD)/w32reg.$(O) \ + $(BLD)/w32font.$(O) \ + $(BLD)/w32uniscribe.$(O) LIBS = $(TLIB0) \ $(TLIB1) \ - $(TLIBW32) \ + $(TLIB2) \ $(TLASTLIB) \ $(WINMM) \ $(ADVAPI32) \ $(GDI32) \ $(COMDLG32) \ $(USER32) \ - $(MPR) \ + $(MPR) \ $(SHELL32) \ $(WINSPOOL) \ $(OLE32) \ @@ -174,7 +174,7 @@ $(EMACS): $(DOC) $(TEMACS) # (it is the preload heap size in MB). # temacs: stamp_BLD $(TEMACS) -$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) \ +$(TEMACS): $(TLIB0) $(TLIB1) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \ ../nt/$(BLD)/addsection.exe $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS) "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21 @@ -190,16 +190,14 @@ make-buildobj-CMD: echo #define BUILDOBJ ^"\> buildobj.h echo $(OBJ0) \>> buildobj.h echo $(OBJ1) \>> buildobj.h - echo $(WIN32OBJ) \>> buildobj.h - echo $(FONTOBJ) \>> buildobj.h + echo $(OBJ2) \>> buildobj.h echo ^">> buildobj.h make-buildobj-SH: echo '#define BUILDOBJ $(DQUOTE)\' > buildobj.h echo $(OBJ0) '\' >> buildobj.h echo $(OBJ1) '\' >> buildobj.h - echo $(WIN32OBJ) '\' >> buildobj.h - echo $(FONTOBJ) '\' >> buildobj.h + echo $(OBJ2) '\' >> buildobj.h echo '$(DQUOTE)' >> buildobj.h bootstrap: bootstrap-emacs @@ -249,7 +247,7 @@ $(TLIB0): $(OBJ0) $(TLIB1): $(OBJ1) - $(DEL) $@ $(AR) $(AR_OUT)$@ $(ALL_DEPS) -$(TLIBW32): $(WIN32OBJ) $(FONTOBJ) +$(TLIB2): $(OBJ2) - $(DEL) $@ $(AR) $(AR_OUT)$@ $(ALL_DEPS) @@ -293,6 +291,52 @@ cleanall: clean - $(DEL_TREE) oo - $(DEL_TREE) oo-spd +## Arrange to make a tags table TAGS-LISP for ../lisp, +## plus TAGS for the C files, which includes ../lisp/TAGS by reference. +## +## This works only with GNU Make. + +TAGS: $(OBJ0) $(OBJ1) $(OBJ2) + $(MAKE) $(MFLAGS) TAGS-$(MAKETYPE) + +TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2) + $(MAKE) $(MFLAGS) TAGS-LISP-$(MAKETYPE) + +TAGS-gmake: + ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \ + --regex=@../nt/emacs-src.tags \ + $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0)) + ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \ + $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1)) + ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \ + $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) \ + $(CURDIR)/*.h + +TAGS-nmake: + echo This target is not supported with NMake + exit -1 + +frc: +TAGS-LISP-gmake: frc + $(MAKE) $(MFLAGS) -C ../lisp TAGS-LISP DEST=../src + +TAGS-LISP-nmake: + echo This target is not supported with NMake + exit -1 + +../nt/TAGS: frc + $(MAKE) $(MFLAGS) nt-TAGS-$(MAKETYPE) + +nt-TAGS-gmake: + $(MAKE) $(MFLAGS) -C ../nt TAGS + +nt-TAGS-nmake: + echo This target is not supported with NMake + exit -1 + +full-tags: TAGS TAGS-LISP ../nt/TAGS +.PHONY: full-tags + ### DEPENDENCIES ### EMACS_ROOT = .. @@ -1705,4 +1749,4 @@ $(BLD)/w32uniscribe.$(O) : \ # Each object file depends on stamp_BLD, because in parallel builds we must # make sure $(BLD) exists before starting compilations. # -$(OBJ0) $(OBJ1) $(WIN32OBJ) $(FONTOBJ) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD +$(OBJ0) $(OBJ1) $(OBJ2) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD diff --git a/src/msdos.c b/src/msdos.c index 086cad2ff84..0957221f597 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -29,13 +29,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <setjmp.h> #include "lisp.h" #include <stdio.h> -#include <stdlib.h> #include <time.h> #include <sys/param.h> #include <sys/time.h> #include <dos.h> #include <errno.h> -#include <string.h> /* for memset and string functions */ #include <sys/stat.h> /* for _fixpath */ #include <unistd.h> /* for chdir, dup, dup2, etc. */ #include <dir.h> /* for getdisk */ @@ -4706,7 +4704,7 @@ syms_of_msdos (void) #ifndef HAVE_X_WINDOWS /* The following two are from xfns.c: */ - Qreverse = intern ("reverse"); + Qreverse = intern_c_string ("reverse"); staticpro (&Qreverse); DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph, diff --git a/src/nsfns.m b/src/nsfns.m index 576131e0bdf..db8bbeb5f76 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2598,7 +2598,7 @@ syms_of_nsfns (void) { int i; - Qfontsize = intern ("fontsize"); + Qfontsize = intern_c_string ("fontsize"); staticpro (&Qfontsize); DEFVAR_LISP ("ns-icon-type-alist", &Vns_icon_type_alist, diff --git a/src/nsmenu.m b/src/nsmenu.m index 9534aec8f2b..d0276c50bf7 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1808,7 +1808,7 @@ syms_of_nsmenu (void) defsubr (&Sns_reset_menu); defsubr (&Smenu_or_popup_active_p); - Qdebug_on_next_call = intern ("debug-on-next-call"); + Qdebug_on_next_call = intern_c_string ("debug-on-next-call"); staticpro (&Qdebug_on_next_call); } diff --git a/src/nsselect.m b/src/nsselect.m index 9e434515edf..786ca36069c 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -549,10 +549,10 @@ nxatoms_of_nsselect (void) void syms_of_nsselect (void) { - QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD); - QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); - QTEXT = intern ("TEXT"); staticpro (&QTEXT); - QFILE_NAME = intern ("FILE_NAME"); staticpro (&QFILE_NAME); + QCLIPBOARD = intern_c_string ("CLIPBOARD"); staticpro (&QCLIPBOARD); + QSECONDARY = intern_c_string ("SECONDARY"); staticpro (&QSECONDARY); + QTEXT = intern_c_string ("TEXT"); staticpro (&QTEXT); + QFILE_NAME = intern_c_string ("FILE_NAME"); staticpro (&QFILE_NAME); defsubr (&Sx_disown_selection_internal); defsubr (&Sx_get_selection_internal); @@ -605,7 +605,7 @@ The functions are called with one argument, the selection type\n\ \(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD')."); Vns_lost_selection_hooks = Qnil; - Qforeign_selection = intern ("foreign-selection"); + Qforeign_selection = intern_c_string ("foreign-selection"); staticpro (&Qforeign_selection); } diff --git a/src/nsterm.m b/src/nsterm.m index f0efb948ab9..247ef4dd40c 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -142,22 +142,27 @@ Lisp_Object ns_input_spi_name, ns_input_spi_arg; Lisp_Object Vx_toolkit_scroll_bars; static Lisp_Object Qmodifier_value; Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper, Qnone; -extern Lisp_Object Qcursor_color, Qcursor_type, Qns; +extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft; /* Specifies which emacs modifier should be generated when NS receives - the Alternate modifer. May be Qnone or any of the modifier lisp symbols. */ + the Alternate modifier. May be Qnone or any of the modifier lisp symbols. */ Lisp_Object ns_alternate_modifier; /* Specifies which emacs modifier should be generated when NS receives - the Command modifer. May be any of the modifier lisp symbols. */ + the right Alternate modifier. Has same values as ns_alternate_modifier plus + the value Qleft which means whatever value ns_alternate_modifier has. */ +Lisp_Object ns_right_alternate_modifier; + +/* Specifies which emacs modifier should be generated when NS receives + the Command modifier. May be any of the modifier lisp symbols. */ Lisp_Object ns_command_modifier; /* Specifies which emacs modifier should be generated when NS receives - the Control modifer. May be any of the modifier lisp symbols. */ + the Control modifier. May be any of the modifier lisp symbols. */ Lisp_Object ns_control_modifier; /* Specifies which emacs modifier should be generated when NS receives - the Function modifer (laptops). May be any of the modifier lisp symbols. */ + the Function modifier (laptops). May be any of the modifier lisp symbols. */ Lisp_Object ns_function_modifier; /* Control via default 'GSFontAntiAlias' on OS X and GNUstep. */ @@ -218,12 +223,17 @@ static BOOL inNsSelect = 0; /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ #define NS_FUNCTION_KEY_MASK 0x800000 +#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) #define EV_MODIFIERS(e) \ ((([e modifierFlags] & NSHelpKeyMask) ? \ hyper_modifier : 0) \ - | (([e modifierFlags] & NSAlternateKeyMask) ? \ + | (!EQ (ns_right_alternate_modifier, Qleft) && \ + (([e modifierFlags] & NSRightAlternateKeyMask) \ + == NSRightAlternateKeyMask) ? \ + parse_solitary_modifier (ns_right_alternate_modifier) : 0) \ + | (([e modifierFlags] & NSAlternateKeyMask) ? \ parse_solitary_modifier (ns_alternate_modifier) : 0) \ - | (([e modifierFlags] & NSShiftKeyMask) ? \ + | (([e modifierFlags] & NSShiftKeyMask) ? \ shift_modifier : 0) \ | (([e modifierFlags] & NSControlKeyMask) ? \ parse_solitary_modifier (ns_control_modifier) : 0) \ @@ -4440,7 +4450,13 @@ ns_term_shutdown (int sig) emacs_event->modifiers |= parse_solitary_modifier (ns_function_modifier); - if (flags & NSAlternateKeyMask) /* default = meta */ + if (!EQ (ns_right_alternate_modifier, Qleft) + && ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)) + { + emacs_event->modifiers |= parse_solitary_modifier + (ns_right_alternate_modifier); + } + else if (flags & NSAlternateKeyMask) /* default = meta */ { if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) && !fnKeysym) @@ -6203,6 +6219,14 @@ Set to none means that the alternate / option key is not interpreted by Emacs\n\ at all, allowing it to be used at a lower level for accented character entry."); ns_alternate_modifier = Qmeta; + DEFVAR_LISP ("ns-right-alternate-modifier", &ns_right_alternate_modifier, + "This variable describes the behavior of the right alternate or option key.\n\ +Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ +Set to left means be the same key as `ns-alternate-modifier'.\n\ +Set to none means that the alternate / option key is not interpreted by Emacs\n\ +at all, allowing it to be used at a lower level for accented character entry."); + ns_right_alternate_modifier = Qleft; + DEFVAR_LISP ("ns-command-modifier", &ns_command_modifier, "This variable describes the behavior of the command key.\n\ Set to control, meta, alt, super, or hyper means it is taken to be that key."); diff --git a/src/point.h b/src/point.h deleted file mode 100644 index 0156e1baed2..00000000000 --- a/src/point.h +++ /dev/null @@ -1,8 +0,0 @@ -#define point_width 5 -#define point_height 19 -static char point_bits[] = { - 0x1f, 0x0e, 0x0e, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x04, 0x04, 0x0e, 0x0e, 0x1f}; - -/* arch-tag: a8dad510-7254-4964-b71e-bb6f81cce572 - (do not change this comment) */ diff --git a/src/print.c b/src/print.c index d4cbc2ac24a..0f8718877d2 100644 --- a/src/print.c +++ b/src/print.c @@ -1401,7 +1401,7 @@ static void print_check_string_charset_prop (INTERVAL interval, Lisp_Object stri #define PRINT_STRING_NON_CHARSET_FOUND 1 #define PRINT_STRING_UNSAFE_CHARSET_FOUND 2 -/* Bitwize or of the abobe macros. */ +/* Bitwise or of the above macros. */ static int print_check_string_result; static void diff --git a/src/process.c b/src/process.c index a698e56fe39..e1515065957 100644 --- a/src/process.c +++ b/src/process.c @@ -31,7 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif -#include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -68,10 +67,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <bsdtty.h> #endif -#ifdef HAVE_SYS_WAIT -#include <sys/wait.h> -#endif - #ifdef HAVE_RES_INIT #include <netinet/in.h> #include <arpa/nameser.h> @@ -82,6 +77,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <util.h> #endif +#ifdef HAVE_PTY_H +#include <pty.h> +#endif + #endif /* subprocesses */ #include "lisp.h" @@ -115,6 +114,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_NS #include "nsterm.h" #endif + extern int timers_run; Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; @@ -171,13 +171,6 @@ extern Lisp_Object QCfilter; /* Define first descriptor number available for subprocesses. */ #define FIRST_PROC_DESC 3 -/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals - testing SIGCHLD. */ - -#if !defined (SIGCHLD) && defined (SIGCLD) -#define SIGCHLD SIGCLD -#endif /* SIGCLD */ - extern const char *get_operating_system_release (void); /* From sysdep.c or w32.c */ @@ -356,14 +349,6 @@ struct sockaddr_and_len { /* Maximum number of bytes to send to a pty without an eof. */ static int pty_max_bytes; -#ifdef HAVE_PTYS -#ifdef HAVE_PTY_H -#include <pty.h> -#endif -/* The file name of the pty opened by allocate_pty. */ - -static char pty_name[24]; -#endif struct fd_callback_data @@ -563,6 +548,9 @@ status_message (struct Lisp_Process *p) #ifdef HAVE_PTYS +/* The file name of the pty opened by allocate_pty. */ +static char pty_name[24]; + /* Open an available pty, returning a file descriptor. Return -1 on failure. The file name of the terminal corresponding to the pty @@ -1682,6 +1670,11 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) val = XCDR (Vdefault_process_coding_system); } XPROCESS (proc)->encode_coding_system = val; + /* Note: At this momemnt, the above coding system may leave + text-conversion or eol-conversion unspecified. They will be + decided after we read output from the process and decode it by + some coding system, or just before we actually send a text to + the process. */ } @@ -1724,6 +1717,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) tem = Fsubstring (tem, make_number (2), Qnil); { + Lisp_Object arg_encoding = Qnil; struct gcpro gcpro1; GCPRO1 (tem); @@ -1741,9 +1735,14 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) tem = Fcons (args[i], tem); CHECK_STRING (XCAR (tem)); if (STRING_MULTIBYTE (XCAR (tem))) - XSETCAR (tem, - code_convert_string_norecord - (XCAR (tem), XPROCESS (proc)->encode_coding_system, 1)); + { + if (NILP (arg_encoding)) + arg_encoding = (complement_process_encoding_system + (XPROCESS (proc)->encode_coding_system)); + XSETCAR (tem, + code_convert_string_norecord + (XCAR (tem), arg_encoding, 1)); + } } UNGCPRO; @@ -1879,12 +1878,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) } #endif -#if 0 - /* Replaced by close_process_descs */ - set_exclusive_use (inchannel); - set_exclusive_use (outchannel); -#endif - #ifdef O_NONBLOCK fcntl (inchannel, F_SETFL, O_NONBLOCK); fcntl (outchannel, F_SETFL, O_NONBLOCK); @@ -5547,12 +5540,21 @@ send_process (volatile Lisp_Object proc, const unsigned char *volatile buf, && !NILP (XBUFFER (object)->enable_multibyte_characters)) || EQ (object, Qt)) { + p->encode_coding_system + = complement_process_encoding_system (p->encode_coding_system); if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) - /* The coding system for encoding was changed to raw-text - because we sent a unibyte text previously. Now we are - sending a multibyte text, thus we must encode it by the - original coding system specified for the current process. */ - setup_coding_system (p->encode_coding_system, coding); + { + /* The coding system for encoding was changed to raw-text + because we sent a unibyte text previously. Now we are + sending a multibyte text, thus we must encode it by the + original coding system specified for the current process. + + Another reason we comming here is that the coding system + was just complemented and new one was returned by + complement_process_encoding_system. */ + setup_coding_system (p->encode_coding_system, coding); + Vlast_coding_system_used = p->encode_coding_system; + } coding->src_multibyte = 1; } else diff --git a/src/regex.c b/src/regex.c index b563d93fe29..17158552a95 100644 --- a/src/regex.c +++ b/src/regex.c @@ -4089,7 +4089,7 @@ analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int m && match_any_multibyte_characters == false) { /* Set fastmap[I] to 1 where I is a leading code of each - multibyte characer in the range table. */ + multibyte character in the range table. */ int c, count; unsigned char lc1, lc2; diff --git a/src/scroll.c b/src/scroll.c index ce26acbce64..4d1c4045bd4 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> -#include <string.h> #include <setjmp.h> #include "lisp.h" #include "termchar.h" diff --git a/src/sound.c b/src/sound.c index b93099283da..3869f3a57ff 100644 --- a/src/sound.c +++ b/src/sound.c @@ -86,8 +86,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* BEGIN: Windows Specific Includes */ #include <stdio.h> -#include <stdlib.h> -#include <string.h> #include <limits.h> #include <windows.h> #include <mmsystem.h> diff --git a/src/sysdep.c b/src/sysdep.c index e7d35d46bf7..f68d475d22c 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -71,10 +71,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #include <sys/file.h> - -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif #include "systty.h" #include "syswait.h" @@ -126,19 +123,12 @@ struct utimbuf { #endif #endif -/* LPASS8 is new in 4.3, and makes cbreak mode provide all 8 bits. */ -#ifndef LPASS8 -#define LPASS8 0 -#endif - static const int baud_convert[] = { 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400 }; -int emacs_ospeed; - void croak (char *) NO_RETURN; /* Temporary used by `sigblock' when defined in terms of signprocmask. */ @@ -278,6 +268,8 @@ stuff_char (char c) void init_baud_rate (int fd) { + int emacs_ospeed; + if (noninteractive) emacs_ospeed = 0; else @@ -300,16 +292,6 @@ init_baud_rate (int fd) } -/*ARGSUSED*/ -void -set_exclusive_use (int fd) -{ -#ifdef FIOCLEX - ioctl (fd, FIOCLEX, 0); -#endif - /* Ok to do nothing if this feature does not exist */ -} - int wait_debugging; /* Set nonzero to make following function work under dbx (at least for bsd). */ @@ -373,22 +355,7 @@ wait_for_termination (int pid) void flush_pending_output (int channel) { -#ifndef DOS_NT - /* If we try this, we get hit with SIGTTIN, because - the child's tty belongs to the child's pgrp. */ -#else -#ifdef TCFLSH - ioctl (channel, TCFLSH, 1); -#else -#ifdef TIOCFLUSH - int zero = 0; - /* 3rd arg should be ignored - but some 4.2 kernels actually want the address of an int - and nonzero means something different. */ - ioctl (channel, TIOCFLUSH, &zero); -#endif -#endif -#endif + /* FIXME: maybe this function should be removed */ } /* Set up the terminal at the other end of a pseudo-terminal that @@ -483,7 +450,7 @@ child_setup_tty (int out) EMACS_SET_TTY (out, &s, 0); #endif /* not WINDOWSNT */ } -#endif /* MSDOS */ +#endif /* not MSDOS */ /* Record a signal code and the handler for it. */ @@ -1486,242 +1453,6 @@ init_system_name (void) } } -#ifndef MSDOS -#if !defined (HAVE_SELECT) - -#include "sysselect.h" -#undef select - -#if defined (HAVE_X_WINDOWS) && !defined (HAVE_SELECT) -/* Cause explanatory error message at compile time, - since the select emulation is not good enough for X. */ -int *x = &x_windows_lose_if_no_select_system_call; -#endif - -/* Emulate as much as select as is possible under 4.1 and needed by Gnu Emacs - * Only checks read descriptors. - */ -/* How long to wait between checking fds in select */ -#define SELECT_PAUSE 1 -int select_alarmed; - -/* For longjmp'ing back to read_input_waiting. */ - -jmp_buf read_alarm_throw; - -/* Nonzero if the alarm signal should throw back to read_input_waiting. - The read_socket_hook function sets this to 1 while it is waiting. */ - -int read_alarm_should_throw; - -void -select_alarm (int ignore) -{ - select_alarmed = 1; - signal (SIGALRM, SIG_IGN); - SIGNAL_THREAD_CHECK (SIGALRM); - if (read_alarm_should_throw) - longjmp (read_alarm_throw, 1); -} - -#ifndef WINDOWSNT -/* Only rfds are checked. */ -int -sys_select (int nfds, - SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, - EMACS_TIME *timeout) -{ - /* XXX This needs to be updated for multi-tty support. Is there - anybody who needs to emulate select these days? */ - int ravail = 0; - SELECT_TYPE orfds; - int timeoutval; - int *local_timeout; - extern int proc_buffered_char[]; - extern int process_tick, update_tick; - unsigned char buf; - -#if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS) - /* If we're using X, then the native select will work; we only need the - emulation for non-X usage. */ - if (!NILP (Vinitial_window_system)) - return select (nfds, rfds, wfds, efds, timeout); -#endif - timeoutval = timeout ? EMACS_SECS (*timeout) : 100000; - local_timeout = &timeoutval; - FD_ZERO (&orfds); - if (rfds) - { - orfds = *rfds; - FD_ZERO (rfds); - } - if (wfds) - FD_ZERO (wfds); - if (efds) - FD_ZERO (efds); - - /* If we are looking only for the terminal, with no timeout, - just read it and wait -- that's more efficient. */ - if (*local_timeout == 100000 && process_tick == update_tick - && FD_ISSET (0, &orfds)) - { - int fd; - for (fd = 1; fd < nfds; ++fd) - if (FD_ISSET (fd, &orfds)) - goto hardway; - if (! detect_input_pending ()) - read_input_waiting (); - FD_SET (0, rfds); - return 1; - } - - hardway: - /* Once a second, till the timer expires, check all the flagged read - * descriptors to see if any input is available. If there is some then - * set the corresponding bit in the return copy of rfds. - */ - while (1) - { - register int to_check, fd; - - if (rfds) - { - for (to_check = nfds, fd = 0; --to_check >= 0; fd++) - { - if (FD_ISSET (fd, &orfds)) - { - int avail = 0, status = 0; - - if (fd == 0) - avail = detect_input_pending (); /* Special keyboard handler */ - else - { -#ifdef FIONREAD - status = ioctl (fd, FIONREAD, &avail); -#else /* no FIONREAD */ - /* Hoping it will return -1 if nothing available - or 0 if all 0 chars requested are read. */ - if (proc_buffered_char[fd] >= 0) - avail = 1; - else - { - avail = read (fd, &buf, 1); - if (avail > 0) - proc_buffered_char[fd] = buf; - } -#endif /* no FIONREAD */ - } - if (status >= 0 && avail > 0) - { - FD_SET (fd, rfds); - ravail++; - } - } - } - } - if (*local_timeout == 0 || ravail != 0 || process_tick != update_tick) - break; - - turn_on_atimers (0); - signal (SIGALRM, select_alarm); - select_alarmed = 0; - alarm (SELECT_PAUSE); - - /* Wait for a SIGALRM (or maybe a SIGTINT) */ - while (select_alarmed == 0 && *local_timeout != 0 - && process_tick == update_tick) - { - /* If we are interested in terminal input, - wait by reading the terminal. - That makes instant wakeup for terminal input at least. */ - if (FD_ISSET (0, &orfds)) - { - read_input_waiting (); - if (detect_input_pending ()) - select_alarmed = 1; - } - else - pause (); - } - (*local_timeout) -= SELECT_PAUSE; - - /* Reset the old alarm if there was one. */ - turn_on_atimers (1); - - if (*local_timeout == 0) /* Stop on timer being cleared */ - break; - } - return ravail; -} -#endif /* not WINDOWSNT */ - -/* Read keyboard input into the standard buffer, - waiting for at least one character. */ - -void -read_input_waiting (void) -{ - /* XXX This needs to be updated for multi-tty support. Is there - anybody who needs to emulate select these days? */ - int nread, i; - - if (read_socket_hook) - { - struct input_event hold_quit; - - EVENT_INIT (hold_quit); - hold_quit.kind = NO_EVENT; - - read_alarm_should_throw = 0; - if (! setjmp (read_alarm_throw)) - nread = (*read_socket_hook) (0, 1, &hold_quit); - else - nread = -1; - - if (hold_quit.kind != NO_EVENT) - kbd_buffer_store_event (&hold_quit); - } - else - { - struct input_event e; - char buf[3]; - nread = read (fileno (stdin), buf, 1); - EVENT_INIT (e); - - /* Scan the chars for C-g and store them in kbd_buffer. */ - e.kind = ASCII_KEYSTROKE_EVENT; - e.frame_or_window = selected_frame; - e.modifiers = 0; - for (i = 0; i < nread; i++) - { - /* Convert chars > 0177 to meta events if desired. - We do this under the same conditions that read_avail_input does. */ - if (read_socket_hook == 0) - { - /* If the user says she has a meta key, then believe her. */ - if (meta_key == 1 && (buf[i] & 0x80)) - e.modifiers = meta_modifier; - if (meta_key != 2) - buf[i] &= ~0x80; - } - - XSETINT (e.code, buf[i]); - kbd_buffer_store_event (&e); - /* Don't look at input that follows a C-g too closely. - This reduces lossage due to autorepeat on C-g. */ - if (buf[i] == quit_char) - break; - } - } -} - -#if !defined (HAVE_SELECT) -#define select sys_select -#endif - -#endif /* not HAVE_SELECT */ -#endif /* not MSDOS */ - /* POSIX signals support - DJB */ /* Anyone with POSIX signals should have ANSI C declarations */ @@ -2271,7 +2002,6 @@ dup2 (int oldd, int newd) #ifndef HAVE_GETTIMEOFDAY #ifdef HAVE_TIMEVAL -/* ARGSUSED */ int gettimeofday (struct timeval *tp, struct timezone *tzp) { diff --git a/src/term.c b/src/term.c index a2f7a9cbabe..4baea231de3 100644 --- a/src/term.c +++ b/src/term.c @@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include <ctype.h> -#include <string.h> #include <errno.h> #include <sys/file.h> @@ -3658,9 +3657,6 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ add_keyboard_wait_descriptor (0); - /* FIXME: this should be removed, done earlier. */ - Wcm_clear (tty); - tty->delete_in_insert_mode = 1; UseTabs (tty) = 0; diff --git a/src/termcap.c b/src/termcap.c index ea4ef244f64..4ad0cee6264 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -20,24 +20,18 @@ Boston, MA 02110-1301, USA. */ /* Emacs config.h may rename various library functions such as malloc. */ #include <config.h> #include <setjmp.h> -#include <lisp.h> /* xmalloc is here */ -/* Get the O_* definitions for open et al. */ #include <sys/file.h> -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif +#include "lisp.h" + #ifndef NULL #define NULL (char *) 0 #endif -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - /* BUFSIZE is the initial size allocated for the buffer for reading the termcap file. It is not a limit. @@ -268,45 +262,20 @@ tgetst1 (char *ptr, char **area) /* Outputting a string with padding. */ -#ifndef emacs -short ospeed; -/* If OSPEED is 0, we use this as the actual baud rate. */ -int tputs_baud_rate; -#endif - char PC; -#ifndef emacs -/* Actual baud rate if positive; - - baud rate / 100 if negative. */ - -static const int speeds[] = - { - 0, 50, 75, 110, 135, 150, -2, -3, -6, -12, - -18, -24, -48, -96, -192, -288, -384, -576, -1152 - }; - -#endif /* not emacs */ - void tputs (register char *str, int nlines, register int (*outfun) (/* ??? */)) { register int padcount = 0; register int speed; -#ifdef emacs extern EMACS_INT baud_rate; speed = baud_rate; /* For quite high speeds, convert to the smaller units to avoid overflow. */ if (speed > 10000) speed = - speed / 100; -#else - if (ospeed == 0) - speed = tputs_baud_rate; - else - speed = speeds[ospeed]; -#endif if (!str) return; diff --git a/src/termhooks.h b/src/termhooks.h index b16c36f9551..b9358896bae 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -44,11 +44,6 @@ extern void (*fullscreen_hook) (struct frame *f); /* Input queue declarations and hooks. */ -/* Expedient hack: only provide the below definitions to files that - are prepared to handle lispy things. CONSP is defined if lisp.h - has been included before this file. */ -#ifdef CONSP - enum event_kind { NO_EVENT, /* nothing happened. This should never @@ -317,8 +312,6 @@ extern void term_mouse_moveto (int, int); extern struct tty_display_info *gpm_tty; #endif -#endif /* CONSP */ - struct ns_display_info; struct x_display_info; diff --git a/src/unexaix.c b/src/unexaix.c index 949616d5e31..2d128bc6806 100644 --- a/src/unexaix.c +++ b/src/unexaix.c @@ -31,33 +31,17 @@ what you give them. Help stamp out software-hoarding! */ * Mike Sperber <sperber@informatik.uni-tuebingen.de> * * Synopsis: - * unexec (new_name, a_name, data_start, bss_start, entry_address) - * char *new_name, *a_name; - * unsigned data_start, bss_start, entry_address; + * unexec (const char *new_name, const *old_name); * * Takes a snapshot of the program and makes an a.out format file in the * file named by the string argument new_name. * If a_name is non-NULL, the symbol table will be taken from the given file. * On some machines, an existing a_name file is required. * - * data_start and entry_address are ignored. - * - * bss_start indicates how much of the data segment is to be saved in the - * a.out file and restored when the program is executed. It gives the lowest - * unsaved address, and is rounded up to a page boundary. The default when 0 - * is given assumes that the entire data segment is to be stored, including - * the previous data and bss as well as any additional storage allocated with - * sbrk(2). - * */ -#ifndef emacs -#define PERROR(arg) perror (arg); return -1 -#else #include <config.h> #define PERROR(file) report_error (file, new) -#endif - #include <a.out.h> /* Define getpagesize () if the system does not. Note that this may depend on symbols defined in a.out.h @@ -103,7 +87,6 @@ static int adjust_lnnoptrs (int, int, char *); static int pagemask; -#ifdef emacs #include <setjmp.h> #include "lisp.h" @@ -114,7 +97,6 @@ report_error (char *file, int fd) close (fd); report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil)); } -#endif /* emacs */ #define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1 #define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 @@ -124,12 +106,7 @@ static void report_error_1 (int fd, char *msg, int a1, int a2) { close (fd); -#ifdef emacs error (msg, a1, a2); -#else - fprintf (stderr, msg, a1, a2); - fprintf (stderr, "\n"); -#endif } static int make_hdr (int, int, unsigned, unsigned, unsigned, char *, char *); @@ -143,10 +120,7 @@ static void write_segment (int, char *, char *); * * driving logic. */ -int unexec (char *new_name, char *a_name, - unsigned data_start, - unsigned bss_start, - unsigned entry_address) +int unexec (const char *new_name, const char *a_name) { int new = -1, a_out = -1; @@ -159,8 +133,6 @@ int unexec (char *new_name, char *a_name, PERROR (new_name); } if (make_hdr (new, a_out, - data_start, bss_start, - entry_address, a_name, new_name) < 0 || copy_text_and_data (new) < 0 || copy_sym (new, a_out, a_name, new_name) < 0 @@ -186,12 +158,11 @@ int unexec (char *new_name, char *a_name, */ static int make_hdr (int new, int a_out, - unsigned data_start, unsigned bss_start, - unsigned entry_address, char *a_name, char *new_name) { int scns; - unsigned int bss_end; + unsigned int bss_start; + unsigned int data_start; struct scnhdr section[MAX_SECTIONS]; struct scnhdr * f_thdr; /* Text section header */ @@ -211,22 +182,8 @@ make_hdr (int new, int a_out, data_start = data_start & ~pagemask; /* (Down) to page boundary. */ - bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; - bss_end &= ~ pagemask; - /* Adjust data/bss boundary. */ - if (bss_start != 0) - { - bss_start = (ADDR_CORRECT (bss_start) + pagemask); - /* (Up) to page bdry. */ - bss_start &= ~ pagemask; - if (bss_start > bss_end) - { - ERROR1 ("unexec: Specified bss_start (%u) is past end of program", - bss_start); - } - } - else - bss_start = bss_end; + bss_start = ADDR_CORRECT (sbrk (0)) + pagemask; + bss_start &= ~ pagemask; if (data_start > bss_start) /* Can't have negative data size. */ { @@ -311,7 +268,7 @@ make_hdr (int new, int a_out, f_hdr.f_flags |= (F_RELFLG | F_EXEC); f_ohdr.dsize = bss_start - f_ohdr.data_start; - f_ohdr.bsize = bss_end - bss_start; + f_ohdr.bsize = 0; f_dhdr->s_size = f_ohdr.dsize; f_bhdr->s_size = f_ohdr.bsize; diff --git a/src/unexcoff.c b/src/unexcoff.c index cb4b8d603b5..0c6af414d82 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c @@ -34,37 +34,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ * Modified heavily since then. * * Synopsis: - * unexec (new_name, a_name, data_start, bss_start, entry_address) - * char *new_name, *a_name; - * unsigned data_start, bss_start, entry_address; + * unexec (const char *new_name, const char *old_name); * * Takes a snapshot of the program and makes an a.out format file in the * file named by the string argument new_name. * If a_name is non-NULL, the symbol table will be taken from the given file. * On some machines, an existing a_name file is required. * - * The boundaries within the a.out file may be adjusted with the data_start - * and bss_start arguments. Either or both may be given as 0 for defaults. - * - * Data_start gives the boundary between the text segment and the data - * segment of the program. The text segment can contain shared, read-only - * program code and literal data, while the data segment is always unshared - * and unprotected. Data_start gives the lowest unprotected address. - * The value you specify may be rounded down to a suitable boundary - * as required by the machine you are using. - * - * Specifying zero for data_start means the boundary between text and data - * should not be the same as when the program was loaded. - * - * Bss_start indicates how much of the data segment is to be saved in the - * a.out file and restored when the program is executed. It gives the lowest - * unsaved address, and is rounded up to a page boundary. The default when 0 - * is given assumes that the entire data segment is to be stored, including - * the previous data and bss as well as any additional storage allocated with - * break (2). - * - * The new file is set up to start at entry_address. - * * If you make improvements I'd like to get them too. * harpo!utah-cs!thomas, thomas@Utah-20 * @@ -121,14 +97,6 @@ struct aouthdr #include <sys/file.h> -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif -#ifndef O_RDWR -#define O_RDWR 2 -#endif - - extern char *start_of_data (void); /* Start of initialized data */ static long block_copy_start; /* Old executable start point */ @@ -186,15 +154,16 @@ static void mark_x (const char *); * Modify the text and data sizes. */ static int -make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, - unsigned entry_address, const char *a_name, const char *new_name) +make_hdr (int new, int a_out, + const char *a_name, const char *new_name) { auto struct scnhdr f_thdr; /* Text section header */ auto struct scnhdr f_dhdr; /* Data section header */ auto struct scnhdr f_bhdr; /* Bss section header */ auto struct scnhdr scntemp; /* Temporary section header */ register int scns; - unsigned int bss_end; + unsigned int bss_start; + unsigned int data_start; pagemask = getpagesize () - 1; @@ -203,23 +172,8 @@ make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, data_start = ADDR_CORRECT (data_start); data_start = data_start & ~pagemask; /* (Down) to page boundary. */ - bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; - bss_end &= ~ pagemask; - - /* Adjust data/bss boundary. */ - if (bss_start != 0) - { - bss_start = (ADDR_CORRECT (bss_start) + pagemask); - /* (Up) to page bdry. */ - bss_start &= ~ pagemask; - if (bss_start > bss_end) - { - ERROR1 ("unexec: Specified bss_start (%u) is past end of program", - bss_start); - } - } - else - bss_start = bss_end; + bss_start = ADDR_CORRECT (sbrk (0)) + pagemask; + bss_start &= ~ pagemask; if (data_start > bss_start) /* Can't have negative data size. */ { @@ -300,7 +254,7 @@ make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, f_hdr.f_flags |= (F_RELFLG | F_EXEC); f_ohdr.dsize = bss_start - f_ohdr.data_start; - f_ohdr.bsize = bss_end - bss_start; + f_ohdr.bsize = 0; f_thdr.s_size = f_ohdr.tsize; f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr); f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr)); @@ -571,8 +525,7 @@ adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name) * driving logic. */ int -unexec (const char *new_name, const char *a_name, - unsigned data_start, unsigned bss_start, unsigned entry_address) +unexec (const char *new_name, const char *a_name) { int new = -1, a_out = -1; @@ -585,7 +538,7 @@ unexec (const char *new_name, const char *a_name, PERROR (new_name); } - if (make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) < 0 + if (make_hdr (new, a_out, a_name, new_name) < 0 || copy_text_and_data (new, a_out) < 0 || copy_sym (new, a_out, a_name, new_name) < 0 || adjust_lnnoptrs (new, a_out, new_name) < 0 diff --git a/src/unexcw.c b/src/unexcw.c index 4930eb46315..c33d9d90215 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -248,8 +248,7 @@ add_exe_suffix_if_necessary (const char *name, char *modified) } int -unexec (char *outfile, char *infile, unsigned start_data, unsigned d1, - unsigned d2) +unexec (const char *outfile, const char *infile) { char infile_buffer[FILENAME_MAX]; char outfile_buffer[FILENAME_MAX]; diff --git a/src/unexelf.c b/src/unexelf.c index 0de69a4cabc..605b9f75ac0 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -33,34 +33,13 @@ what you give them. Help stamp out software-hoarding! */ * Modified heavily since then. * * Synopsis: - * unexec (new_name, old_name, data_start, bss_start, entry_address) - * char *new_name, *old_name; - * unsigned data_start, bss_start, entry_address; + * unexec (const char *new_name, const char *old_name); * * Takes a snapshot of the program and makes an a.out format file in the * file named by the string argument new_name. * If old_name is non-NULL, the symbol table will be taken from the given file. * On some machines, an existing old_name file is required. * - * The boundaries within the a.out file may be adjusted with the data_start - * and bss_start arguments. Either or both may be given as 0 for defaults. - * - * Data_start gives the boundary between the text segment and the data - * segment of the program. The text segment can contain shared, read-only - * program code and literal data, while the data segment is always unshared - * and unprotected. Data_start gives the lowest unprotected address. - * The value you specify may be rounded down to a suitable boundary - * as required by the machine you are using. - * - * Bss_start indicates how much of the data segment is to be saved in the - * a.out file and restored when the program is executed. It gives the lowest - * unsaved address, and is rounded up to a page boundary. The default when 0 - * is given assumes that the entire data segment is to be stored, including - * the previous data and bss as well as any additional storage allocated with - * break (2). - * - * The new file is set up to start at entry_address. - * */ /* Even more heavily modified by james@bigtex.cactus.org of Dell Computer Co. @@ -407,13 +386,8 @@ temacs: /* We do not use mmap because that fails with NFS. Instead we read the whole file, modify it, and write it out. */ -#ifndef emacs -#define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1) -#include <string.h> -#else #include <config.h> extern void fatal (const char *msgid, ...); -#endif #include <sys/types.h> #include <stdio.h> @@ -424,7 +398,7 @@ extern void fatal (const char *msgid, ...); #include <fcntl.h> #if !defined (__NetBSD__) && !defined (__OpenBSD__) #include <elf.h> -#endif +#endif /* not __NetBSD__ and not __OpenBSD__ */ #include <sys/mman.h> #if defined (_SYSTYPE_SYSV) #include <sys/elf_mips.h> @@ -610,7 +584,7 @@ round_up (ElfW(Addr) x, ElfW(Addr) y) if NOERROR is 0; we return -1 if NOERROR is nonzero. */ static int -find_section (const char *name, char *section_names, char *file_name, +find_section (const char *name, const char *section_names, const char *file_name, ElfW(Ehdr) *old_file_h, ElfW(Shdr) *old_section_h, int noerror) { int idx; @@ -646,8 +620,7 @@ find_section (const char *name, char *section_names, char *file_name, * */ void -unexec (char *new_name, char *old_name, unsigned int data_start, - unsigned int bss_start, unsigned int entry_address) +unexec (const char *new_name, const char *old_name) { int new_file, old_file, new_file_size; @@ -1309,13 +1282,8 @@ temacs: /* Write out new_file, and free the buffers. */ if (write (new_file, new_base, new_file_size) != new_file_size) -#ifndef emacs - fatal ("Didn't write %d bytes: errno %d\n", - new_file_size, errno); -#else fatal ("Didn't write %d bytes to %s: errno %d\n", new_file_size, new_name, errno); -#endif munmap (old_base, old_file_size); munmap (new_base, new_file_size); diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c index cad2a5025ab..b9edd4f3a84 100644 --- a/src/unexhp9k800.c +++ b/src/unexhp9k800.c @@ -49,16 +49,11 @@ sigsetreturn (_sigreturn); */ -#ifdef emacs #include <config.h> -#endif - #include <stdio.h> #include <fcntl.h> #include <errno.h> - #include <a.out.h> - #include <dl.h> /* brk value to restore, stored as a global. @@ -79,12 +74,9 @@ run_time_remap (ignored) /* Create a new a.out file, same as old but with current data space */ - -unexec (new_name, old_name, new_end_of_text, dummy1, dummy2) - char new_name[]; /* name of the new a.out file to be created */ - char old_name[]; /* name of the old a.out file */ - char *new_end_of_text; /* ptr to new edata/etext; NOT USED YET */ - int dummy1, dummy2; /* not used by emacs */ +int +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 */ { int old, new; int old_size, new_size; diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 5c450e062c6..f48c8d7dfa6 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -190,6 +190,8 @@ static off_t data_segment_old_fileoff = 0; static struct segment_command *data_segment_scp; +static void unexec_error (const char *format, ...) NO_RETURN; + /* Read N bytes from infd into memory starting at address DEST. Return true if successful, false otherwise. */ static int @@ -1217,9 +1219,8 @@ 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. */ -void -unexec (char *outfile, char *infile, void *start_data, void *start_bss, - void *entry_address) +int +unexec (const char *outfile, const char *infile) { if (in_dumped_exec) unexec_error ("Unexec from a dumped executable is not supported."); @@ -1249,6 +1250,7 @@ unexec (char *outfile, char *infile, void *start_data, void *start_bss, dump_it (); close (outfd); + return 0; } diff --git a/src/unexsol.c b/src/unexsol.c index 04e3f40799c..1d58ed46d4b 100644 --- a/src/unexsol.c +++ b/src/unexsol.c @@ -1,7 +1,6 @@ /* Trivial unexec for Solaris. */ #include <config.h> -#include <stdlib.h> #include <dlfcn.h> #include <setjmp.h> @@ -11,8 +10,7 @@ #include "coding.h" int -unexec (char *new_name, char *old_name, unsigned int data_start, - unsigned int bss_start, unsigned int entry_address) +unexec (const char *new_name, const char *old_name) { Lisp_Object data; Lisp_Object errstring; diff --git a/src/unexw32.c b/src/unexw32.c index d3e4e812480..a4dba647f53 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -724,9 +724,8 @@ copy_executable_and_dump_data (file_data *p_infile, /* Dump out .data and .bss sections into a new executable. */ -void -unexec (char *new_name, char *old_name, void *start_data, void *start_bss, - void *entry_address) +int +unexec (const char *new_name, const char *old_name) { file_data in_file, out_file; char out_filename[MAX_PATH], in_filename[MAX_PATH]; @@ -821,6 +820,8 @@ unexec (char *new_name, char *old_name, void *start_data, void *start_bss, close_file_data (&in_file); close_file_data (&out_file); + + return 0; } /* eof */ diff --git a/src/vm-limit.c b/src/vm-limit.c index 63f0f47e2d0..813ee6163c9 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c @@ -17,12 +17,9 @@ 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/>. */ -#ifdef emacs #include <config.h> #include <setjmp.h> #include "lisp.h" -#endif - #include "mem-limits.h" /* diff --git a/src/w16select.c b/src/w16select.c index ef1b974752b..4d471e97911 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -28,7 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef MSDOS #include <config.h> -#include <string.h> #include <dpmi.h> #include <go32.h> #include <sys/farptr.h> diff --git a/src/w32.c b/src/w32.c index 4ccda449b47..ae34ac6aadb 100644 --- a/src/w32.c +++ b/src/w32.c @@ -2970,7 +2970,7 @@ convert_time (FILETIME ft) if (!init) { - initialize_utc_base(); + initialize_utc_base (); init = 1; } @@ -5037,7 +5037,7 @@ fcntl (int s, int cmd, int options) unsigned long nblock = 1; int rc = pfn_ioctlsocket (SOCK_HANDLE (s), FIONBIO, &nblock); if (rc == SOCKET_ERROR) - set_errno(); + set_errno (); /* Keep track of the fact that we set this to non-blocking. */ fd_info[s].flags |= FILE_NDELAY; return rc; @@ -5935,8 +5935,7 @@ serial_open (char *port) /* For serial-process-configure */ void -serial_configure (struct Lisp_Process *p, - Lisp_Object contact) +serial_configure (struct Lisp_Process *p, Lisp_Object contact) { Lisp_Object childp2 = Qnil; Lisp_Object tem = Qnil; diff --git a/src/w32console.c b/src/w32console.c index 26fa544d670..35f0fc195f7 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -25,10 +25,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> -#include <stdlib.h> #include <stdio.h> #include <windows.h> -#include <string.h> #include <setjmp.h> #include "lisp.h" @@ -585,28 +583,6 @@ w32_face_attributes (struct frame *f, int face_id) return char_attr; } - - -/* Given a color index, return its standard name. */ -Lisp_Object -vga_stdcolor_name (int idx) -{ - /* Standard VGA colors, in the order of their standard numbering - in the default VGA palette. */ - static char *vga_colors[16] = { - "black", "blue", "green", "cyan", "red", "magenta", "brown", - "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan", - "lightred", "lightmagenta", "yellow", "white" - }; - - extern Lisp_Object Qunspecified; - - if (idx >= 0 && idx < sizeof (vga_colors) / sizeof (vga_colors[0])) - return build_string (vga_colors[idx]); - else - return Qunspecified; /* meaning the default */ -} - void initialize_w32_display (struct terminal *term) { diff --git a/src/w32fns.c b/src/w32fns.c index 5e5f11c813d..808503547f1 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -245,7 +245,7 @@ struct MONITOR_INFO }; /* Reportedly, VS 6 does not have this in its headers. */ -#if defined(_MSC_VER) && _MSC_VER < 1300 +#if defined (_MSC_VER) && _MSC_VER < 1300 DECLARE_HANDLE(HMONITOR); #endif @@ -1870,7 +1870,6 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) } } - void x_set_scroll_bar_default_width (struct frame *f) { @@ -1900,7 +1899,7 @@ w32_load_cursor (LPCTSTR name) return cursor; } -extern LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM); +static LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM); static BOOL w32_init_class (HINSTANCE hinst) @@ -2672,7 +2671,7 @@ post_character_message (HWND hwnd, UINT msg, /* Main window procedure */ -LRESULT CALLBACK +static LRESULT CALLBACK w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct frame *f; @@ -3918,7 +3917,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return DefWindowProc (hwnd, msg, wParam, lParam); } - /* The most common default return code for handled messages is 0. */ return 0; } @@ -4359,7 +4357,6 @@ This function is an internal primitive--use `make-frame' instead. */) x_default_parameter (f, parameters, Qright_fringe, Qnil, "rightFringe", "RightFringe", RES_TYPE_NUMBER); - /* Init faces before x_default_parameter is called for scroll-bar parameters because that function calls x_set_scroll_bar_width, which calls change_frame_size, which calls Fset_window_buffer, @@ -5903,7 +5900,7 @@ extern Lisp_Object Qfile_name_history; read-only when "Directories" is selected in the filter. This allows us to work around the fact that the standard Open File dialog does not support directories. */ -UINT CALLBACK +static UINT CALLBACK file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_NOTIFY) diff --git a/src/w32font.c b/src/w32font.c index 46fca5d78d5..f489fe2d763 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -333,7 +333,7 @@ w32font_has_char (Lisp_Object entity, int c) } /* w32 implementation of encode_char for font backend. - Return a glyph code of FONT for characer C (Unicode code point). + Return a glyph code of FONT for character C (Unicode code point). If FONT doesn't have such a glyph, return FONT_INVALID_CODE. For speed, the gdi backend uses unicode (Emacs calls encode_char @@ -1058,7 +1058,7 @@ w32_enumfont_pattern_entity (Lisp_Object frame, /* Convert generic families to the family portion of lfPitchAndFamily. */ -BYTE +static BYTE w32_generic_family (Lisp_Object name) { /* Generic families. */ @@ -1798,7 +1798,7 @@ w32_decode_weight (int fnweight) if (fnweight >= FW_NORMAL) return 100; if (fnweight >= FW_LIGHT) return 50; if (fnweight >= FW_EXTRALIGHT) return 40; - if (fnweight > FW_THIN) return 20; + if (fnweight > FW_THIN) return 20; return 0; } @@ -1812,7 +1812,7 @@ w32_encode_weight (int n) if (n >= 100) return FW_NORMAL; if (n >= 50) return FW_LIGHT; if (n >= 40) return FW_EXTRALIGHT; - if (n >= 20) return FW_THIN; + if (n >= 20) return FW_THIN; return 0; } @@ -1822,9 +1822,9 @@ static Lisp_Object w32_to_fc_weight (int n) { if (n >= FW_EXTRABOLD) return intern ("black"); - if (n >= FW_BOLD) return intern ("bold"); - if (n >= FW_SEMIBOLD) return intern ("demibold"); - if (n >= FW_NORMAL) return intern ("medium"); + if (n >= FW_BOLD) return intern ("bold"); + if (n >= FW_SEMIBOLD) return intern ("demibold"); + if (n >= FW_NORMAL) return intern ("medium"); return intern ("light"); } @@ -1912,7 +1912,6 @@ fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) logfont->lfPitchAndFamily = family | DEFAULT_PITCH; } - /* Set pitch based on the spacing property. */ tmp = AREF (font_spec, FONT_SPACING_INDEX); if (INTEGERP (tmp)) @@ -2378,6 +2377,23 @@ in the font selection dialog. */) return DECODE_SYSTEM (build_string (buf)); } +static const char *w32font_booleans [] = { + NULL, +}; + +static const char *w32font_non_booleans [] = { + ":script", + ":antialias", + ":style", + NULL, +}; + +static void +w32font_filter_properties (Lisp_Object font, Lisp_Object alist) +{ + font_filter_properties (font, alist, w32font_booleans, w32font_non_booleans); +} + struct font_driver w32font_driver = { 0, /* Qgdi */ @@ -2407,7 +2423,7 @@ struct font_driver w32font_driver = NULL, /* shape */ NULL, /* check */ NULL, /* get_variation_glyphs */ - NULL, /* filter_properties */ + w32font_filter_properties, }; diff --git a/src/w32heap.c b/src/w32heap.c index e307694a563..285325e3f8b 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -25,7 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #endif -#include <stdlib.h> #include <stdio.h> #include <setjmp.h> @@ -279,7 +278,7 @@ round_heap (unsigned long align) sbrk (need_to_alloc); } -#if (_MSC_VER >= 1000 && _MSC_VER < 1300 && !defined(USE_CRT_DLL)) +#if (_MSC_VER >= 1000 && _MSC_VER < 1300 && !defined (USE_CRT_DLL)) /* MSVC 4.2 invokes these functions from mainCRTStartup to initialize a heap via HeapCreate. They are normally defined by the runtime, diff --git a/src/w32inevt.c b/src/w32inevt.c index 1ab0546d44f..1111f8dfa44 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -27,7 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #endif -#include <stdlib.h> #include <stdio.h> #include <windows.h> #include <setjmp.h> @@ -289,7 +288,7 @@ static int faked_key = 0; /* return code -1 means that event_queue_ptr won't be incremented. In other word, this event makes two key codes. (by himi) */ -int +static int key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead) { static int mod_key_state = 0; diff --git a/src/w32menu.c b/src/w32menu.c index 0ed9bffe70c..ff6bd977bea 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -106,6 +106,7 @@ static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object); #endif static void utf8to16 (unsigned char *, int, WCHAR *); +static int fill_in_menu (HMENU, widget_value *); void w32_free_menu_strings (HWND); @@ -996,7 +997,7 @@ w32_dialog_show (FRAME_PTR f, int keymaps, Lisp_Object title, Lisp_Object header, char **error) { - int i, nb_buttons=0; + int i, nb_buttons = 0; char dialog_name[6]; int menu_item_selection; @@ -1568,7 +1569,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) } /* Construct native Windows menu(bar) based on widget_value tree. */ -int +static int fill_in_menu (HMENU menu, widget_value *wv) { int items_added = 0; @@ -1739,7 +1740,7 @@ syms_of_w32menu (void) void globals_of_w32menu (void) { - /* See if Get/SetMenuItemInfo functions are available. */ + /* See if Get/SetMenuItemInfo functions are available. */ HMODULE user32 = GetModuleHandle ("user32.dll"); get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA"); set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA"); diff --git a/src/w32proc.c b/src/w32proc.c index ae4e725b6ef..49687574472 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -159,7 +159,7 @@ int child_proc_count = 0; child_process child_procs[ MAX_CHILDREN ]; child_process *dead_child = NULL; -DWORD WINAPI reader_thread (void *arg); +static DWORD WINAPI reader_thread (void *arg); /* Find an unused process slot. */ child_process * @@ -168,7 +168,7 @@ new_child (void) child_process *cp; DWORD id; - for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) + for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--) if (!CHILD_ACTIVE (cp)) goto Initialise; if (child_proc_count == MAX_CHILDREN) @@ -268,7 +268,7 @@ find_child_pid (DWORD pid) { child_process *cp; - for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) + for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--) if (CHILD_ACTIVE (cp) && pid == cp->pid) return cp; return NULL; @@ -279,7 +279,7 @@ find_child_pid (DWORD pid) is normally blocked until woken by select() to check for input by reading one char. When the read completes, char_avail is signaled to wake up the select emulator and the thread blocks itself again. */ -DWORD WINAPI +static DWORD WINAPI reader_thread (void *arg) { child_process *cp; @@ -495,7 +495,7 @@ sys_wait (int *status) } else { - for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) + for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--) /* some child_procs might be sockets; ignore them */ if (CHILD_ACTIVE (cp) && cp->procinfo.hProcess && (cp->fd < 0 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0)) @@ -608,7 +608,7 @@ get_result: # define IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER #endif -void +static void w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, @@ -726,7 +726,7 @@ unwind: close_file_data (&executable); } -int +static int compare_env (const void *strp1, const void *strp2) { const char *str1 = *(const char **)strp1, *str2 = *(const char **)strp2; @@ -750,7 +750,7 @@ compare_env (const void *strp1, const void *strp2) return 1; } -void +static void merge_and_sort_env (char **envp1, char **envp2, char **new_envp) { char **optr, **nptr; @@ -895,7 +895,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) escape_char = is_cygnus_app ? '"' : '\\'; } - /* Cygwin apps needs quoting a bit more often */ + /* Cygwin apps needs quoting a bit more often. */ if (escape_char == '"') sepchars = "\r\n\t\f '"; @@ -1245,7 +1245,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, count_children: /* Add handles of child processes. */ nc = 0; - for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) + for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--) /* Some child_procs might be sockets; ignore them. Also some children may have died already, but we haven't finished reading the process output; ignore them too. */ @@ -1999,7 +1999,7 @@ human-readable form. */) return make_number (GetThreadLocale ()); } -DWORD +static DWORD int_from_hex (char * s) { DWORD val = 0; @@ -2021,7 +2021,7 @@ int_from_hex (char * s) function isn't given a context pointer. */ Lisp_Object Vw32_valid_locale_ids; -BOOL CALLBACK +static BOOL CALLBACK enum_locale_fn (LPTSTR localeNum) { DWORD id = int_from_hex (localeNum); @@ -2085,7 +2085,7 @@ If successful, the new locale id is returned, otherwise nil. */) function isn't given a context pointer. */ Lisp_Object Vw32_valid_codepages; -BOOL CALLBACK +static BOOL CALLBACK enum_codepage_fn (LPTSTR codepageNum) { DWORD id = atoi (codepageNum); diff --git a/src/w32reg.c b/src/w32reg.c index 77667eb7dc9..5c02dd376c7 100644 --- a/src/w32reg.c +++ b/src/w32reg.c @@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "blockinput.h" #include <stdio.h> -#include <string.h> #define REG_ROOT "SOFTWARE\\GNU\\Emacs" diff --git a/src/w32select.c b/src/w32select.c index bd013a5ece9..f9bab384062 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -1072,7 +1072,7 @@ syms_of_w32select (void) When sending or receiving text via cut_buffer, selection, and clipboard, the text is encoded or decoded by this coding system. The default value is the current system default encoding on 9x/Me and -`utf-16le-dos' (Unicode) on NT/W2K/XP. */); +`utf-16le-dos' (Unicode) on NT/W2K/XP. */); /* The actual value is set dynamically in the dumped Emacs, see below. */ Vselection_coding_system = Qnil; diff --git a/src/w32term.c b/src/w32term.c index 992538e0e88..1f53860de2e 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <signal.h> #include <stdio.h> -#include <stdlib.h> #include <setjmp.h> #include "lisp.h" #include "blockinput.h" @@ -894,7 +893,7 @@ w32_set_terminal_modes (struct terminal *term) { } -/* This is called when exiting or suspending Emacs. Exiting will make +/* This is called when exiting or suspending Emacs. Exiting will make the W32 windows go away, and suspending requires no action. */ static void @@ -3955,7 +3954,7 @@ static char dbcs_lead = 0; recursively with different messages by the system. */ -int +static int w32_read_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) { @@ -4240,7 +4239,7 @@ w32_read_socket (struct terminal *terminal, int expected, inev.frame_or_window = window; } - last_window=window; + last_window = window; } if (!note_mouse_movement (f, &msg.msg)) help_echo_string = previous_help_echo_string; @@ -5602,7 +5601,7 @@ x_make_frame_visible (struct frame *f) /* Adjust vertical window position in order to avoid being covered by a task bar placed at the bottom of the desktop. */ SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0); - GetWindowRect (FRAME_W32_WINDOW(f), &window_rect); + GetWindowRect (FRAME_W32_WINDOW (f), &window_rect); if (window_rect.bottom > workarea_rect.bottom && window_rect.top > workarea_rect.top) f->top_pos = max (window_rect.top diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 05cc8346a50..6c29e6ee2d0 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -439,7 +439,7 @@ uniscribe_shape (Lisp_Object lgstring) } /* Uniscribe implementation of encode_char for font backend. - Return a glyph code of FONT for characer C (Unicode code point). + Return a glyph code of FONT for character C (Unicode code point). If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ static unsigned uniscribe_encode_char (struct font *font, int c) diff --git a/src/w32xfns.c b/src/w32xfns.c index 8fee42dae48..4cbd812ec0f 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -408,7 +408,6 @@ XParseGeometry (char *string, return (0); strind = nextCharacter; mask |= YNegative; - } else { @@ -422,7 +421,7 @@ XParseGeometry (char *string, } } - /* If strind isn't at the end of the string the it's an invalid + /* If strind isn't at the end of the string then it's an invalid geometry specification. */ if (*strind != '\0') return (0); diff --git a/src/xdisp.c b/src/xdisp.c index 9b0f94ef657..4c007e572ce 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12494,8 +12494,10 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, /* Non-zero means we've seen at least one glyph that came from a display string. */ int string_seen = 0; - /* Largest buffer position seen so far during scan of glyph row. */ - EMACS_INT bpos_max = last_pos; + /* Largest and smalles buffer positions seen so far during scan of + glyph row. */ + EMACS_INT bpos_max = pos_before; + EMACS_INT bpos_min = pos_after; /* Last buffer position covered by an overlay string with an integer `cursor' property. */ EMACS_INT bpos_covered = 0; @@ -12585,6 +12587,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, if (glyph->charpos > bpos_max) bpos_max = glyph->charpos; + if (glyph->charpos < bpos_min) + bpos_min = glyph->charpos; if (!glyph->avoid_cursor_p) { /* If we hit point, we've found the glyph on which to @@ -12659,6 +12663,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, if (glyph->charpos > bpos_max) bpos_max = glyph->charpos; + if (glyph->charpos < bpos_min) + bpos_min = glyph->charpos; if (!glyph->avoid_cursor_p) { if (dpos == 0) @@ -12745,7 +12751,13 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, } } else if (match_with_avoid_cursor - /* zero-width characters produce no glyphs */ + /* A truncated row may not include PT among its + character positions. Setting the cursor inside the + scroll margin will trigger recalculation of hscroll + in hscroll_window_tree. */ + || (row->truncated_on_left_p && pt_old < bpos_min) + || (row->truncated_on_right_p && pt_old > bpos_max) + /* Zero-width characters produce no glyphs. */ || ((row->reversed_p ? glyph_after > glyphs_end : glyph_after < glyphs_end) diff --git a/src/xfont.c b/src/xfont.c index 368587de6d8..d4c6af17c49 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> -#include <stdlib.h> #include <setjmp.h> #include <X11/Xlib.h> @@ -842,7 +841,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) val = Ffont_get (font_object, QCavgwidth); if (INTEGERP (val)) - font->average_width = XINT (val); + font->average_width = XINT (val) / 10; if (font->average_width < 0) font->average_width = - font->average_width; if (font->average_width == 0 diff --git a/src/xml.c b/src/xml.c index 5829f1da538..a686e55f0b0 100644 --- a/src/xml.c +++ b/src/xml.c @@ -74,17 +74,24 @@ Lisp_Object make_dom (xmlNode *node) } static Lisp_Object -parse_string (Lisp_Object string, Lisp_Object base_url, int htmlp) +parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int htmlp) { xmlDoc *doc; xmlNode *node; Lisp_Object result = Qnil; - int ibeg, iend; - char *burl = ""; + const char *burl = ""; + EMACS_INT bytes; + EMACS_INT istart, iend; LIBXML_TEST_VERSION; - CHECK_STRING (string); + validate_region (&start, &end); + + istart = XINT (start); + iend = XINT (end); + + if (istart < GPT && GPT < iend) + move_gap (iend); if (! NILP (base_url)) { @@ -92,13 +99,18 @@ parse_string (Lisp_Object string, Lisp_Object base_url, int htmlp) burl = SDATA (base_url); } - doc = htmlp - ? htmlReadMemory (SDATA (string), SBYTES (string), burl, "utf-8", - HTML_PARSE_RECOVER|HTML_PARSE_NONET| - HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR) - : xmlReadMemory (SDATA (string), SBYTES (string), burl, "utf-8", - XML_PARSE_NONET|XML_PARSE_NOWARNING| - XML_PARSE_NOERROR); + bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart); + + if (htmlp) + doc = htmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), + bytes, burl, "utf-8", + HTML_PARSE_RECOVER|HTML_PARSE_NONET| + HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR); + else + doc = xmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), + bytes, burl, "utf-8", + XML_PARSE_NONET|XML_PARSE_NOWARNING| + XML_PARSE_NOERROR); if (doc != NULL) { @@ -112,24 +124,24 @@ parse_string (Lisp_Object string, Lisp_Object base_url, int htmlp) return result; } -DEFUN ("xml-parse-html-string-internal", Fxml_parse_html_string_internal, - Sxml_parse_html_string_internal, - 1, 2, 0, - doc: /* Parse STRING as an HTML document and return the parse tree. +DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region, + Slibxml_parse_html_region, + 2, 3, 0, + doc: /* Parse the region as an HTML document and return the parse tree. If BASE-URL is non-nil, it is used to expand relative URLs. */) - (Lisp_Object string, Lisp_Object base_url) + (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) { - return parse_string (string, base_url, 1); + return parse_region (start, end, base_url, 1); } -DEFUN ("xml-parse-string-internal", Fxml_parse_string_internal, - Sxml_parse_string_internal, - 1, 2, 0, - doc: /* Parse STRING as an XML document and return the parse tree. +DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region, + Slibxml_parse_xml_region, + 2, 3, 0, + doc: /* Parse the region as an XML document and return the parse tree. If BASE-URL is non-nil, it is used to expand relative URLs. */) - (Lisp_Object string, Lisp_Object base_url) + (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) { - return parse_string (string, base_url, 0); + return parse_region (start, end, base_url, 0); } @@ -139,8 +151,8 @@ If BASE-URL is non-nil, it is used to expand relative URLs. */) void syms_of_xml (void) { - defsubr (&Sxml_parse_html_string_internal); - defsubr (&Sxml_parse_string_internal); + defsubr (&Slibxml_parse_html_region); + defsubr (&Slibxml_parse_xml_region); } #endif /* HAVE_LIBXML2 */ diff --git a/src/xterm.c b/src/xterm.c index f9dd21c87fe..d9d908d4396 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1942,18 +1942,38 @@ x_draw_relief_rect (struct frame *f, gc = f->output_data.x->black_relief.gc; XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted); + /* This code is more complicated than it has to be, because of two + minor hacks to make the boxes look nicer: (i) if width > 1, draw + the outermost line using the black relief. (ii) Omit the four + corner pixels. */ + /* Top. */ if (top_p) - for (i = 0; i < width; ++i) - XDrawLine (dpy, window, gc, - left_x + i * left_p, top_y + i, - right_x + 1 - i * right_p, top_y + i); + { + if (width == 1) + XDrawLine (dpy, window, gc, + left_x + (left_p ? 1 : 0), top_y, + right_x + (right_p ? 0 : 1), top_y); + + for (i = 1; i < width; ++i) + XDrawLine (dpy, window, gc, + left_x + i * left_p, top_y + i, + right_x + 1 - i * right_p, top_y + i); + } /* Left. */ if (left_p) - for (i = 0; i < width; ++i) - XDrawLine (dpy, window, gc, - left_x + i, top_y + i, left_x + i, bottom_y - i + 1); + { + if (width == 1) + XDrawLine (dpy, window, gc, left_x, top_y + 1, left_x, bottom_y); + + XClearArea (dpy, window, left_x, top_y, 1, 1, False); + XClearArea (dpy, window, left_x, bottom_y, 1, 1, False); + + for (i = (width > 1 ? 1 : 0); i < width; ++i) + XDrawLine (dpy, window, gc, + left_x + i, top_y + i, left_x + i, bottom_y - i + 1); + } XSetClipMask (dpy, gc, None); if (raised_p) @@ -1962,18 +1982,40 @@ x_draw_relief_rect (struct frame *f, gc = f->output_data.x->white_relief.gc; XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted); + if (width > 1) + { + /* Outermost top line. */ + if (top_p) + XDrawLine (dpy, window, gc, + left_x + (left_p ? 1 : 0), top_y, + right_x + (right_p ? 0 : 1), top_y); + + /* Outermost left line. */ + if (left_p) + XDrawLine (dpy, window, gc, left_x, top_y + 1, left_x, bottom_y); + } + /* Bottom. */ if (bot_p) - for (i = 0; i < width; ++i) + { XDrawLine (dpy, window, gc, - left_x + i * left_p, bottom_y - i, - right_x + 1 - i * right_p, bottom_y - i); + left_x + (left_p ? 1 : 0), bottom_y, + right_x + (right_p ? 0 : 1), bottom_y); + for (i = 1; i < width; ++i) + XDrawLine (dpy, window, gc, + left_x + i * left_p, bottom_y - i, + right_x + 1 - i * right_p, bottom_y - i); + } /* Right. */ if (right_p) - for (i = 0; i < width; ++i) - XDrawLine (dpy, window, gc, - right_x - i, top_y + i + 1, right_x - i, bottom_y - i); + { + XClearArea (dpy, window, right_x, top_y, 1, 1, False); + XClearArea (dpy, window, right_x, bottom_y, 1, 1, False); + for (i = 0; i < width; ++i) + XDrawLine (dpy, window, gc, + right_x - i, top_y + i + 1, right_x - i, bottom_y - i); + } XSetClipMask (dpy, gc, None); } @@ -7729,18 +7771,6 @@ x_error_handler (Display *display, XErrorEvent *error) /* .gdbinit puts a breakpoint here, so make sure it is not inlined. */ -#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE -#endif - -/* Some versions of GNU/Linux define noinline in their headers. */ - -#ifdef noinline -#undef noinline -#endif - /* On older GCC versions, just putting x_error_quitter after x_error_handler prevents inlining into the former. */ |