Mercurial > hg > xemacs-beta
changeset 4969:cbe181529c34
Automatic merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 03 Feb 2010 21:46:21 -0600 |
parents | 4d35e52790f8 (current diff) 5274591ce707 (diff) |
children | 5c89ceb69819 |
files | ChangeLog configure configure.ac lib-src/ChangeLog lisp/ChangeLog lwlib/ChangeLog man/ChangeLog man/internals/internals.texi nt/ad2c.sed nt/x11.patch src/ChangeLog src/Makefile.in.in src/alloc.c src/bytecode.c src/compiler.h src/config.h.in src/console-x.h src/depend src/device-x.c src/emacs.c src/eval.c src/faces.c src/frame-x.c src/gc.c src/glyphs-x.c src/lisp.h src/lread.c src/objects-x.c src/symbols.c src/symeval.h src/toolbar-common.c src/toolbar-common.h src/toolbar-xlike.c src/xgccache.c src/xgccache.h |
diffstat | 71 files changed, 2572 insertions(+), 1886 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Feb 03 21:06:14 2010 -0600 +++ b/ChangeLog Wed Feb 03 21:46:21 2010 -0600 @@ -50,6 +50,12 @@ +2010-02-01 Ben Wing <ben@xemacs.org> + + * configure: + * configure.ac (TAB): + USE_XFT* -> HAVE_XFT*. + 2010-01-14 Ben Wing <ben@xemacs.org> * PROBLEMS:
--- a/configure Wed Feb 03 21:06:14 2010 -0600 +++ b/configure Wed Feb 03 21:46:21 2010 -0600 @@ -13702,7 +13702,7 @@ with_fontconfig=yes $as_echo "#define HAVE_FONTCONFIG 1" >>confdefs.h - $as_echo "#define USE_XFT 1" >>confdefs.h + $as_echo "#define HAVE_XFT 1" >>confdefs.h unset xft_includes_found fi @@ -16676,11 +16676,11 @@ test "$with_widgets" = "motif" && $as_echo "#define LWLIB_WIDGETS_MOTIF 1" >>confdefs.h -test "$with_xft_menubars" = "yes" && $as_echo "#define USE_XFT_MENUBARS 1" >>confdefs.h - -test "$with_xft_tabs" = "yes" && $as_echo "#define USE_XFT_TABS 1" >>confdefs.h - -test "$with_xft_gauges" = "yes" && $as_echo "#define USE_XFT_GAUGES 1" >>confdefs.h +test "$with_xft_menubars" = "yes" && $as_echo "#define HAVE_XFT_MENUBARS 1" >>confdefs.h + +test "$with_xft_tabs" = "yes" && $as_echo "#define HAVE_XFT_TABS 1" >>confdefs.h + +test "$with_xft_gauges" = "yes" && $as_echo "#define HAVE_XFT_GAUGES 1" >>confdefs.h
--- a/configure.ac Wed Feb 03 21:06:14 2010 -0600 +++ b/configure.ac Wed Feb 03 21:46:21 2010 -0600 @@ -3207,9 +3207,9 @@ dnl #### detect fontconfig properly!!!! with_fontconfig=yes AC_DEFINE(HAVE_FONTCONFIG) - AC_DEFINE(USE_XFT) + AC_DEFINE(HAVE_XFT) dnl Due to interactions with other libraries, must postpone AC_DEFINE - dnl of USE_XFT_MENUBARS, USE_XFT_TABS, and USE_XFT_GAUGES. + dnl of HAVE_XFT_MENUBARS, HAVE_XFT_TABS, and HAVE_XFT_GAUGES. unset xft_includes_found fi fi @@ -4166,9 +4166,9 @@ test "$with_dialogs" = "motif" && AC_DEFINE(LWLIB_DIALOGS_MOTIF) test "$with_widgets" = "motif" && AC_DEFINE(LWLIB_WIDGETS_MOTIF) -test "$with_xft_menubars" = "yes" && AC_DEFINE(USE_XFT_MENUBARS) -test "$with_xft_tabs" = "yes" && AC_DEFINE(USE_XFT_TABS) -test "$with_xft_gauges" = "yes" && AC_DEFINE(USE_XFT_GAUGES) +test "$with_xft_menubars" = "yes" && AC_DEFINE(HAVE_XFT_MENUBARS) +test "$with_xft_tabs" = "yes" && AC_DEFINE(HAVE_XFT_TABS) +test "$with_xft_gauges" = "yes" && AC_DEFINE(HAVE_XFT_GAUGES) dnl ---------------------- dnl Mule-dependent options
--- a/lib-src/ChangeLog Wed Feb 03 21:06:14 2010 -0600 +++ b/lib-src/ChangeLog Wed Feb 03 21:46:21 2010 -0600 @@ -10,6 +10,10 @@ * ootags.c (C_entries): Fix warnings about possible use of uninitialized vars. +2010-02-01 Vin Shelton <acs@xemacs.org> + + * make-mswin-unicode.pl: Add description of override. + 2010-01-30 Ben Wing <ben@xemacs.org> * make-mswin-unicode.pl:
--- a/lib-src/make-mswin-unicode.pl Wed Feb 03 21:06:14 2010 -0600 +++ b/lib-src/make-mswin-unicode.pl Wed Feb 03 21:46:21 2010 -0600 @@ -63,6 +63,8 @@ yes indicates a function to be automatically Unicode-encapsulated. (All parameters either need no special processing or are LPTSTR or LPCTSTR.) +override indidates a function where the prototype can be overridden + due to errors in Cygwin or Visual Studio. soon indicates a function that should be automatically Unicode-encapsulated, but we're not ready to process it yet. no indicates a function we don't support (it will be #defined to cause
--- a/lisp/ChangeLog Wed Feb 03 21:06:14 2010 -0600 +++ b/lisp/ChangeLog Wed Feb 03 21:46:21 2010 -0600 @@ -173,6 +173,37 @@ Remove support in our generated code for emacs versions where keywords are not self-quoting. +2010-02-03 Aidan Kehoe <kehoea@parhasard.net> + + Delete a couple of XEmacs-specific functions that duplicate CL + functions. + + * find-paths.el (paths-filter, paths-uniq-append): + Remove #'paths-filter, a reimplementation of #'remove-if-not, and + #'paths-uniq-append, a reimplementation of #'union with test + #'equal. + (paths-decode-directory-path): Don't use #'path-filter here. + * packages.el (packages-package-hierarchy-directory-names): + Don't use #'path-filter here. + (packages-find-installation-package-directories): + Use #'union, not #'paths-uniq-append here. + * setup-paths.el (paths-find-invocation-roots) + (paths-find-emacs-roots, paths-construct-info-path) + (paths-construct-info-path): + Replace #'paths-filter with #'remove-if-not, #'paths-uniq-append + with #'union. + +2010-02-01 Aidan Kehoe <kehoea@parhasard.net> + + * loadhist.el (symbol-file): + If #'built-in-symbol-file returns a Lisp file name, and + source-lisp is readable, construct a full pathname to include + that. Otherwise use lisp-directory, as we used to. + * loadup.el: + Delete load-history entries for those files in + preloaded-file-list; unloading the associated features makes very + little sense, and the symbol file information can be had from DOC. + 2010-02-01 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (equalp):
--- a/lisp/find-paths.el Wed Feb 03 21:06:14 2010 -0600 +++ b/lisp/find-paths.el Wed Feb 03 21:46:21 2010 -0600 @@ -352,25 +352,6 @@ (setq directories (cdr directories))) (reverse reverse-directories))) -(defun paths-uniq-append (list-1 list-2) - "Append LIST-1 and LIST-2, omitting EQUAL duplicates." - (let ((reverse-survivors '())) - (while list-2 - (if (null (member (car list-2) list-1)) - (setq reverse-survivors (cons (car list-2) reverse-survivors))) - (setq list-2 (cdr list-2))) - (append list-1 - (reverse reverse-survivors)))) - -(defun paths-filter (predicate list) - "Delete all matches of PREDICATE from LIST." - (let ((reverse-result '())) - (while list - (if (funcall predicate (car list)) - (setq reverse-result (cons (car list) reverse-result))) - (setq list (cdr list))) - (nreverse reverse-result))) - (defun paths-decode-directory-path (string &optional drop-empties) "Split STRING at path separators into a directory list. Non-\"\" components are converted into directory form. @@ -384,9 +365,7 @@ (file-name-as-directory component))) components))) (if drop-empties - (paths-filter #'(lambda (component) - (null (string-equal "" component))) - directories) + (delete "" directories) directories))) ;;; find-paths.el ends here
--- a/lisp/loadhist.el Wed Feb 03 21:06:14 2010 -0600 +++ b/lisp/loadhist.el Wed Feb 03 21:46:21 2010 -0600 @@ -90,7 +90,10 @@ ;; This is a bit heuristic, but shouldn't realistically be a ;; problem: (if (string-match "\.elc?$" built-in-file) - (concat lisp-directory built-in-file) + (concat (if (file-readable-p source-lisp) + source-lisp + lisp-directory) + built-in-file) (concat source-directory "/src/" built-in-file)))))) (defun feature-symbols (feature)
--- a/lisp/loadup.el Wed Feb 03 21:06:14 2010 -0600 +++ b/lisp/loadup.el Wed Feb 03 21:46:21 2010 -0600 @@ -218,8 +218,12 @@ ;; See also "site-load" above. (when (stringp site-start-file) (load "site-init" t)) -;; Add information from this file to the load history: -(setq load-history (cons (nreverse current-load-list) load-history) + +;; Add information from this file to the load history. Delete information +;; for those files in preloaded-file-list; the symbol file information can +;; be taken from DOC, and #'unload-feature makes very little sense for +;; dumped functionality. +(setq load-history (cons (nreverse current-load-list) (last load-history)) ;; Clear current-load-list; this (and adding information to ;; load-history) is normally done in lread.c after reading the ;; entirety of a file, something which never happens for loadup.el. @@ -227,12 +231,6 @@ ;; Make the path to this file look a little nicer: (setcar (car load-history) (file-truename (caar load-history))) -;; Make #'find-function behave better with dumped files. -(let ((source-lisp (concat "^" (regexp-quote source-lisp)))) - (mapc - #'(lambda (elt) (setcar elt (replace-in-string (car elt) source-lisp ""))) - load-history)) - (garbage-collect) ;;; At this point, we're ready to resume undo recording for scratch.
--- a/lisp/packages.el Wed Feb 03 21:06:14 2010 -0600 +++ b/lisp/packages.el Wed Feb 03 21:46:21 2010 -0600 @@ -106,11 +106,10 @@ "Returns a list package hierarchy directory names. These are the valid immediate directory names of package directories, directories with higher priority first" - (paths-filter #'(lambda (x) x) - `("site-packages" - ,(when (featurep 'infodock) "infodock-packages") - ,(when (featurep 'mule) "mule-packages") - "xemacs-packages"))) + (delq nil `("site-packages" + ,(when (featurep 'infodock) "infodock-packages") + ,(when (featurep 'mule) "mule-packages") + "xemacs-packages"))) (defun package-get-key-1 (info key) "Locate keyword `key' in list." @@ -386,8 +385,8 @@ (defun packages-find-installation-package-directories (roots) "Find the package directories in the XEmacs installation. ROOTS is a list of installation roots." - (paths-uniq-append (paths-find-version-directories roots (list "") nil nil nil t) - (paths-find-site-directories roots (list "") nil))) + (union (paths-find-version-directories roots (list "") nil nil nil t) + (paths-find-site-directories roots (list "") nil) :test #'equal)) (defun packages-find-package-hierarchies (package-directories &optional envvar default) "Find package hierarchies in a list of package directories.
--- a/lisp/setup-paths.el Wed Feb 03 21:06:14 2010 -0600 +++ b/lisp/setup-paths.el Wed Feb 03 21:46:21 2010 -0600 @@ -127,8 +127,7 @@ (maybe-root-2 (file-name-as-directory (paths-construct-path '(".." "..") executable-directory)))) - (paths-filter root-p - (list maybe-root-1 maybe-root-2)))) + (delete-if-not root-p (list maybe-root-1 maybe-root-2)))) (defun paths-find-emacs-roots (invocation-directory invocation-name @@ -143,17 +142,17 @@ invocation-name root-p)) (potential-installation-roots - (paths-uniq-append + (union (and configure-exec-prefix-directory (list (file-name-as-directory configure-exec-prefix-directory))) (and configure-prefix-directory (list (file-name-as-directory - configure-prefix-directory))))) + configure-prefix-directory))) + :test #'equal)) (installation-roots - (paths-filter root-p potential-installation-roots))) - (paths-uniq-append invocation-roots - installation-roots))) + (remove-if-not root-p potential-installation-roots))) + (union invocation-roots installation-roots :test #'equal))) (defun paths-find-site-lisp-directory (roots) "Find the site Lisp directory of the XEmacs hierarchy. @@ -261,7 +260,7 @@ LAST-PACKAGE-HIERARCHIES are lists of package hierarchy roots, respectively." (let ((info-path-envval (getenv "INFOPATH"))) - (paths-uniq-append + (union (append (let ((info-directory (paths-find-version-directory roots (list "info") @@ -275,9 +274,11 @@ (and info-path-envval (paths-decode-directory-path info-path-envval 'drop-empties))) (and (null info-path-envval) - (paths-uniq-append + (union (paths-directories-which-exist configure-info-path) - (paths-directories-which-exist paths-default-info-directories)))))) + (paths-directories-which-exist paths-default-info-directories) + :test #'equal)) + :test #'equal))) (defun paths-find-doc-directory (roots) "Find the documentation directory.
--- a/lwlib/ChangeLog Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/ChangeLog Wed Feb 03 21:46:21 2010 -0600 @@ -4,6 +4,37 @@ * xlwgauge.c (GaugeSize): Fix warnings about possible use of uninitialized vars. +2010-02-01 Ben Wing <ben@xemacs.org> + + * lwlib-colors.c: + * lwlib-colors.h: + * lwlib-fonts.c: + * lwlib-fonts.h: + * xlwmenu.c: + * xlwmenu.c (xlwMenuResources): + * xlwmenu.c (x_xft_text_width): + * xlwmenu.c (label_button_draw): + * xlwmenu.c (push_button_size): + * xlwmenu.c (push_button_draw): + * xlwmenu.c (make_drawing_gcs): + * xlwmenu.c (extract_font_extents): + * xlwmenu.c (default_font_of_font_list): + * xlwmenu.c (XlwMenuInitialize): + * xlwmenu.c (XlwMenuDestroy): + * xlwmenu.c (XlwMenuSetValues): + * xlwmenuP.h: + * xlwmenuP.h (_XlwMenu_part): + * xlwtabs.c: + * xlwtabs.c (TabsInit): + * xlwtabs.c (TabsDestroy): + * xlwtabs.c (TabsSetValues): + * xlwtabs.c (DrawTab): + * xlwtabs.c (TabWidth): + * xlwtabs.c (TabsAllocFgGC): + * xlwtabs.c (TabsAllocGreyGC): + * xlwtabsP.h: + USE_XFT* -> HAVE_XFT*. + 2010-01-28 Jerry James <james@xemacs.org> * lwlib-internal.h: Add copyright and license boilerplate text
--- a/lwlib/lwlib-colors.c Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/lwlib-colors.c Wed Feb 03 21:46:21 2010 -0600 @@ -328,7 +328,7 @@ #endif -#ifdef USE_XFT +#ifdef HAVE_XFT XftColor xft_convert_color (Display *dpy, Colormap cmap, Visual *visual, int c, int dim) @@ -356,6 +356,6 @@ return result; } -#endif /* USE_XFT */ +#endif /* HAVE_XFT */ /* end of lwlib-colors.c */
--- a/lwlib/lwlib-colors.h Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/lwlib-colors.h Wed Feb 03 21:46:21 2010 -0600 @@ -39,7 +39,7 @@ int x_allocate_nearest_color (Display *display, Colormap screen_colormap, Visual *visual, XColor *color_def); -#ifdef USE_XFT +#ifdef HAVE_XFT #define _XFT_NO_COMPAT_ /* shut up GCC */ #define face_index face_index_arg @@ -54,6 +54,6 @@ XftColor xft_convert_color (Display *dpy, Colormap cmap, Visual *visual, int c, int dim); -#endif /* USE_XFT */ +#endif /* HAVE_XFT */ #endif /* INCLUDED_lwlib_colors_h_ */
--- a/lwlib/lwlib-fonts.c Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/lwlib-fonts.c Wed Feb 03 21:46:21 2010 -0600 @@ -45,7 +45,7 @@ * code for handling Xft */ -#ifdef USE_XFT +#ifdef HAVE_XFT /* helper function to correctly open Xft/core fonts by name #### Can't we use FcParseName here? @@ -112,6 +112,6 @@ return res; } -#endif /* USE_XFT */ +#endif /* HAVE_XFT */ /* End of lwlib-fonts.c */
--- a/lwlib/lwlib-fonts.h Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/lwlib-fonts.h Wed Feb 03 21:46:21 2010 -0600 @@ -29,7 +29,7 @@ /* get headers */ -#ifdef USE_XFT +#ifdef HAVE_XFT #define _XFT_NO_COMPAT_ /* shut up GCC */ #define face_index face_index_arg @@ -41,11 +41,11 @@ #if XFT_MAJOR < 2 #error Xft versions < 2 not supported #endif -#endif /* USE_XFT */ +#endif /* HAVE_XFT */ /* Xt name macros */ -#ifdef USE_XFT +#ifdef HAVE_XFT #ifndef XtNxftFont #define XtNxftFont "xftFont" #define XtCXftFont "XftFont" @@ -54,16 +54,16 @@ #define XtNfcFontName "fcFontName" #define XtCFcFontName "FcFontName" #endif -#endif /* USE_XFT */ +#endif /* HAVE_XFT */ /* code 'n' stuff */ -#ifdef USE_XFT +#ifdef HAVE_XFT #define FCSTRLEN 512 /* non-Lisp prototypes */ /* #### change this back to _open_name */ XftFont *xft_open_font_by_name (Display *dpy, char *name); -#endif /* USE_XFT */ +#endif /* HAVE_XFT */ #endif /* INCLUDED_lwlib_fonts_h_ */
--- a/lwlib/xlwmenu.c Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/xlwmenu.c Wed Feb 03 21:46:21 2010 -0600 @@ -46,7 +46,7 @@ #endif /* XmVersion < 1.2 */ #endif -/* #### we may want to turn off USE_XFT here if !USE_XFT_MENUBARS +/* #### we may want to turn off HAVE_XFT here if !HAVE_XFT_MENUBARS In fact, maybe that's the right interface overall? */ #include "lwlib-fonts.h" #include "lwlib-colors.h" @@ -98,7 +98,7 @@ #define pmres(name,cls,member) \ Xt_RESOURCE (name, cls, XtRPixmap, Pixmap, offset(member), XtRImmediate, None) -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) /* There are three font list resources, so that we can accept either of the resources *fontList: or *font:, and so that we can tell the difference between them being specified, and being defaulted to a @@ -113,7 +113,7 @@ #else fontres (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, font, "XtDefaultFont"), -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS fontres (XtNfcFontName, XtCFcFontName, XtRString, String, fcFontName, "sans-serif-12:bold"), /* #### This needs to be fixed to give a proper type and converter for @@ -191,7 +191,7 @@ static void Drag (Widget w, XEvent *ev, String *params, Cardinal *num_params); static void Select(Widget w, XEvent *ev, String *params, Cardinal *num_params); -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) static XFontStruct *default_font_of_font_list (XmFontList); #endif @@ -330,14 +330,14 @@ /* Size code */ static int string_width (XlwMenuWidget mw, -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XmString s #else char *s #endif ) { -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) Dimension width, height; XmStringExtent (mw->menu.font_list, s, &width, &height); return width; @@ -347,7 +347,7 @@ XmbTextExtents (mw->menu.font_set, s, strlen (s), &ri, &rl); return rl.width; # else -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XGlyphInfo glyphinfo; XftTextExtents8 (XtDisplay (mw), mw->menu.renderFont, (FcChar8 *) s, strlen (s), &glyphinfo); @@ -384,21 +384,21 @@ static int string_width_u (XlwMenuWidget mw, -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XmString string #else char *string #endif ) { -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) Dimension width, height; XmString newstring; #else # ifdef USE_XFONTSET XRectangle ri, rl; # else /* ! USE_XFONTSET */ -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XGlyphInfo glyphinfo; #else XCharStruct xcs; @@ -411,7 +411,7 @@ char *chars; int i, j; -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) chars = ""; if (!XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars)) chars = ""; @@ -428,7 +428,7 @@ newchars[j++] = chars[i]; newchars[j] = '\0'; -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) newstring = XmStringLtoRCreate (newchars, XmFONTLIST_DEFAULT_TAG); XmStringExtent (mw->menu.font_list, newstring, &width, &height); XmStringFree (newstring); @@ -439,7 +439,7 @@ XmbTextExtents (mw->menu.font_set, newchars, j, &ri, &rl); return rl.width; # else /* ! USE_XFONTSET */ -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XftTextExtents8 (XtDisplay (mw), mw->menu.renderFont, (FcChar8 *) newchars, j, &glyphinfo); return glyphinfo.xOff; @@ -613,7 +613,7 @@ return result; } -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) static XmString resource_widget_value (XlwMenuWidget mw, widget_value *val) @@ -764,7 +764,7 @@ #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ ? ((unsigned long) (x)) : ((unsigned long) (y))) -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS static int x_xft_text_width (Display *dpy, XftFont *xft_font, char *run, int len) { @@ -782,20 +782,20 @@ string_draw (XlwMenuWidget mw, Window window, int x, int y, -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XftColor *color, XftColor *colorBg, #else GC gc, #endif -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XmString string #else char *string #endif ) { -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XmStringDraw (XtDisplay (mw), window, mw->menu.font_list, string, gc, @@ -805,7 +805,7 @@ 0, /* ???? layout_direction */ 0); #else -# ifdef USE_XFT_MENUBARS +# ifdef HAVE_XFT_MENUBARS Display *display = XtDisplay (mw); Visual *visual = DefaultVisualOfScreen (XtScreen (mw)); Colormap cmap = mw->core.colormap; @@ -828,7 +828,7 @@ XDrawString (XtDisplay (mw), window, gc, x, y + mw->menu.font_ascent, string, strlen (string)); # endif /* USE_XFONTSET */ -# endif /* USE_XFT_MENUBARS */ +# endif /* HAVE_XFT_MENUBARS */ #endif /* NEED_MOTIF */ } @@ -837,7 +837,7 @@ XlwMenuWidget mw, Window window, int x, int y, -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XftColor *color, XftColor *colorBg, #else @@ -848,7 +848,7 @@ int end ) { -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) Dimension width, height; XmString newstring; int c; @@ -885,7 +885,7 @@ mw->menu.font_set, &string[start], end - start, &ri, &rl); return rl.width; # else -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS if (end <= start) return 0; else @@ -937,12 +937,12 @@ string_draw_u (XlwMenuWidget mw, Window window, int x, int y, -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XftColor *color, XftColor *colorBg, GC gc, #else GC gc, #endif -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XmString string #else char *string @@ -952,7 +952,7 @@ int i, s = 0; char *chars; -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) chars = ""; if (!XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars)) chars = ""; @@ -963,7 +963,7 @@ if (chars[i] == '%' && chars[i+1] == '_') { int w; -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS x += string_draw_range (mw, window, x, y, color, colorBg, chars, s, i); w = string_draw_range (mw, window, x, y, color, colorBg, chars, i+2, i+3); #else @@ -980,19 +980,19 @@ i += 2; } } -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS x += string_draw_range (mw, window, x, y, color, colorBg, chars, s, i); #else x += string_draw_range (mw, window, x, y, gc, chars, s, i); #endif -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XtFree (chars); #endif } static void /* XXX */ binding_draw (XlwMenuWidget mw, Window w, int x, int y, -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XftColor *color, XftColor *colorBg, #else @@ -1000,12 +1000,12 @@ #endif char *value) { -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XmString xm_value = XmStringCreateLtoR(value, XmSTRING_DEFAULT_CHARSET); string_draw (mw, w, x, y, gc, xm_value); XmStringFree (xm_value); #else -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS string_draw (mw, w, x, y, color, colorBg, value); #else string_draw (mw, w, x, y, gc, value); @@ -1652,7 +1652,7 @@ int y_offset = mw->menu.shadow_thickness + mw->menu.vertical_margin; GC gc; -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XftColor color, colorBg; Display *display = XtDisplay (mw); Colormap cmap = mw->core.colormap; @@ -1667,7 +1667,7 @@ if (highlighted && (in_menubar || val->contents)) { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS pixel = mw->menu.highlight_foreground; pixelBg = mw->core.background_pixel; #endif @@ -1675,7 +1675,7 @@ } else if (in_menubar || val->contents) { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS pixel = mw->menu.foreground; pixelBg = mw->core.background_pixel; #endif @@ -1683,13 +1683,13 @@ } else { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS pixel = mw->menu.title_foreground; pixelBg = mw->core.background_pixel; #endif gc = mw->menu.title_gc; } -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS color = xft_convert_color (display, cmap, visual, pixel, 0); colorBg = xft_convert_color (display, cmap, visual, pixelBg, 0); #endif @@ -1698,7 +1698,7 @@ string_draw_u (mw, /* XXX */ window, x + label_offset, y + y_offset, -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS &color, &colorBg, gc, #else gc, @@ -1724,7 +1724,7 @@ if (!in_menubar && val->key) { int w; -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XmString key = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET); w = string_width (mw, key); XmStringFree (key); @@ -1753,7 +1753,7 @@ shadow_type type; Boolean menu_pb = in_menubar && (menu_item_type (val) == BUTTON_TYPE); -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XftColor color, colorBg; Display *display = XtDisplay (mw); Colormap cmap = mw->core.colormap; @@ -1771,7 +1771,7 @@ { if (val->enabled) { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS pixel = mw->menu.highlight_foreground; pixelBg = mw->core.background_pixel; #endif @@ -1779,7 +1779,7 @@ } else { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS dim = 1; pixel = mw->menu.foreground; pixelBg = mw->core.background_pixel; @@ -1791,7 +1791,7 @@ { if (val->enabled) { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS pixel = mw->menu.button_foreground; pixelBg = mw->core.background_pixel; #endif @@ -1799,7 +1799,7 @@ } else { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS dim = 1; pixel = mw->menu.button_foreground; pixelBg = mw->core.background_pixel; @@ -1811,7 +1811,7 @@ { if (val->enabled) { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS pixel = mw->menu.foreground; pixelBg = mw->core.background_pixel; #endif @@ -1819,7 +1819,7 @@ } else { -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS dim = 1; pixel = mw->menu.foreground; pixelBg = mw->core.background_pixel; @@ -1828,7 +1828,7 @@ } } -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS color = xft_convert_color (display, cmap, visual, pixel, dim); colorBg = xft_convert_color (display, cmap, visual, pixelBg, 0); #endif @@ -1836,7 +1836,7 @@ string_draw_u (mw, window, x + label_offset, y + y_offset, -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS &color, &colorBg, gc, #else gc, @@ -1855,7 +1855,7 @@ binding_draw (mw, window, x + binding_offset + mw->menu.column_spacing, y + y_offset, -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS &color, &colorBg, #else gc, @@ -2806,16 +2806,16 @@ make_drawing_gcs (XlwMenuWidget mw) { XGCValues xgcv; -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS unsigned long flags = (GCForeground | GCBackground); #else unsigned long flags = (GCFont | GCForeground | GCBackground); #endif -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) xgcv.font = default_font_of_font_list (mw->menu.font_list)->fid; #else -#ifndef USE_XFT_MENUBARS +#ifndef HAVE_XFT_MENUBARS xgcv.font = mw->menu.font->fid; #endif #endif @@ -3064,7 +3064,7 @@ static void extract_font_extents (XlwMenuWidget mw) { -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) /* Find the maximal ascent/descent of the fonts in the font list so that all menu items can be the same height... */ mw->menu.font_ascent = 0; @@ -3149,7 +3149,7 @@ mw->menu.font_descent = font->descent; } # else /* ! USE_XFONTSET */ -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS mw->menu.font_ascent = mw->menu.renderFont->ascent; mw->menu.font_descent = mw->menu.renderFont->descent; #else @@ -3160,7 +3160,7 @@ #endif /* NEED_MOTIF */ } -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) static XFontStruct * default_font_of_font_list (XmFontList font_list) { @@ -3230,7 +3230,7 @@ XCreatePixmapFromBitmapData (display, window, (char *) gray_bits, gray_width, gray_height, 1, 0, 1); -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) /* #### Even if it's a kludge!!!, we should consider doing the same for X Font Sets. */ /* The menu.font_list slot came from the *fontList resource (Motif standard.) @@ -3252,7 +3252,7 @@ mw->menu.font_list = mw->menu.fallback_font_list; #endif -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS /* #### kludge for name change */ if (!mw->menu.fcFontName) mw->menu.fcFontName = mw->menu.xftFontName; @@ -3363,7 +3363,7 @@ XFreePixmap (XtDisplay (mw), mw->menu.gray_pixmap); mw->menu.gray_pixmap = (Pixmap) -1; -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS XftFontClose (XtDisplay (mw), mw->menu.renderFont); #endif @@ -3409,12 +3409,12 @@ if (newmw->core.background_pixel != oldmw->core.background_pixel || newmw->menu.foreground != oldmw->menu.foreground /* For the XEditResource protocol, which may want to change the font. */ -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) || newmw->menu.font_list != oldmw->menu.font_list || newmw->menu.font_list_2 != oldmw->menu.font_list_2 || newmw->menu.fallback_font_list != oldmw->menu.fallback_font_list #else -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS || newmw->menu.renderFont != oldmw->menu.renderFont #else || newmw->menu.font != oldmw->menu.font
--- a/lwlib/xlwmenuP.h Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/xlwmenuP.h Wed Feb 03 21:46:21 2010 -0600 @@ -4,7 +4,7 @@ #include "xlwmenu.h" #include <X11/CoreP.h> -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS #include <X11/Xft/Xft.h> #endif @@ -27,13 +27,13 @@ { /* slots set by the resources */ -#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) +#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS) XmFontList font_list; XmFontList font_list_2; XmFontList fallback_font_list; #else XFontStruct * font; -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS String fcFontName; String xftFontName; XftFont *renderFont; @@ -57,7 +57,7 @@ Pixel top_shadow_color; Pixel bottom_shadow_color; Pixel select_color; -#ifdef USE_XFT_MENUBARS +#ifdef HAVE_XFT_MENUBARS #endif Pixmap top_shadow_pixmap; Pixmap bottom_shadow_pixmap;
--- a/lwlib/xlwtabs.c Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/xlwtabs.c Wed Feb 03 21:46:21 2010 -0600 @@ -152,7 +152,7 @@ selectInsensitive, XtRImmediate, True), res (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, font, XtRString, XtDefaultFont), -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS /* #### Maybe use "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1" here? or XtDefaultFont? */ res (XtNfcFontName, XtCFcFontName, XtRString, String, @@ -430,7 +430,7 @@ static int debug_tabs = 0; /* increase for more verbosity */ -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS /* #### duplicated from xlwmenu.c -- CLEAN THIS SHIT UP! Undeclared so define at top. */ #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ @@ -484,7 +484,7 @@ */ newTw->tabs.tab_height = 2 * newTw->tabs.internalHeight + SHADWID ; -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS /* #### kludge for name change */ if (!newTw->tabs.fcFontName) newTw->tabs.fcFontName = newTw->tabs.xftFontName; @@ -501,11 +501,11 @@ newTw->tabs.tab_height += newTw->tabs.renderFont->ascent + newTw->tabs.renderFont->descent; #endif /* XFT_USE_HEIGHT_NOT_ASCENT_DESCENT */ -#else /* ! USE_XFT_TABS */ +#else /* ! HAVE_XFT_TABS */ if (newTw->tabs.font != NULL) newTw->tabs.tab_height += newTw->tabs.font->max_bounds.ascent + newTw->tabs.font->max_bounds.descent; -#endif /* ! USE_XFT_TABS */ +#endif /* ! HAVE_XFT_TABS */ /* if size not explicitly set, set it to our preferred size now. */ @@ -579,9 +579,9 @@ TabsDestroy(Widget w) { TabsWidget tw = (TabsWidget) w; -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS XftFontClose (XtDisplay (w), tw->tabs.renderFont); -#endif /* ! USE_XFT_TABS */ +#endif /* ! HAVE_XFT_TABS */ TabsFreeGCs (tw) ; } @@ -684,7 +684,7 @@ int i ; if( -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS tw->tabs.renderFont != curtw->tabs.renderFont || #else tw->tabs.font != curtw->tabs.font || @@ -694,7 +694,7 @@ { tw->tabs.tab_height = 2 * tw->tabs.internalHeight + SHADWID; -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS if (tw->tabs.renderFont != NULL) #if XFT_USE_HEIGHT_NOT_ASCENT_DESCENT tw->tabs.tab_height += tw->tabs.renderFont->height; @@ -702,11 +702,11 @@ tw->tabs.tab_height += tw->tabs.renderFont->ascent + tw->tabs.renderFont->descent; #endif /* XFT_USE_HEIGHT_NOT_ASCENT_DESCENT */ -#else /* ! USE_XFT_TABS */ +#else /* ! HAVE_XFT_TABS */ if (tw->tabs.font != NULL) tw->tabs.tab_height += tw->tabs.font->max_bounds.ascent + tw->tabs.font->max_bounds.descent; -#endif /* ! USE_XFT_TABS */ +#endif /* ! HAVE_XFT_TABS */ /* Tab size has changed. Resize all tabs and request a new size */ for(i=0, childP=tw->composite.children; @@ -723,7 +723,7 @@ if( tw->core.background_pixel != curtw->core.background_pixel || tw->core.background_pixmap != curtw->core.background_pixmap || -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS tw->tabs.renderFont != curtw->tabs.renderFont #else tw->tabs.font != curtw->tabs.font @@ -1644,7 +1644,7 @@ Window win = XtWindow((Widget)tw) ; String lbl = tab->tabs.label != NULL ? tab->tabs.label : XtName(child) ; -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS XftColor color; XftColor colorBG; Colormap cmap = tw->core.colormap; @@ -1662,7 +1662,7 @@ if (XtIsSensitive(child)) { gc = tw->tabs.foregroundGC; -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS color = xft_convert_color (dpy, cmap, visual, tab->tabs.foreground, 0); #else @@ -1684,7 +1684,7 @@ tab->tabs.greyAlloc = True; } gc = tw->tabs.greyGC; -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS color = xft_convert_color (dpy, cmap, visual, tab->tabs.grey, 0); #else XSetForeground(dpy, gc, tab->tabs.grey); @@ -1709,14 +1709,14 @@ } if (lbl != NULL && -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS tw->tabs.renderFont != NULL #else tw->tabs.font != NULL #endif ) { -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS XftDraw *xftDraw = XftDrawCreate (dpy, win, visual, cmap); XftFont *renderFont = tw->tabs.renderFont; XGlyphInfo glyphinfo; @@ -1984,7 +1984,7 @@ TabsWidget tw = (TabsWidget)XtParent(w) ; String lbl = tab->tabs.label != NULL ? tab->tabs.label : XtName(w); -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS XftFont *font = tw->tabs.renderFont; #else XFontStruct *font = tw->tabs.font; @@ -2003,7 +2003,7 @@ if( lbl != NULL && font != NULL ) { -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS tab->tabs.width += x_xft_text_width (XtDisplay(tw), font, (FcChar8 *) lbl, (int)strlen(lbl)) + iw; @@ -2444,7 +2444,7 @@ values.background = tw->core.background_pixel; values.font = -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS None; #else tw->tabs.font->fid; @@ -2454,13 +2454,13 @@ tw->tabs.foregroundGC = XtAllocateGC(w, w->core.depth, -#ifndef USE_XFT_TABS +#ifndef HAVE_XFT_TABS GCFont| #endif GCBackground|GCLineStyle, &values, GCForeground, -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS GCFont| #endif GCSubwindowMode|GCGraphicsExposures|GCDashOffset| @@ -2475,7 +2475,7 @@ values.background = tw->core.background_pixel; values.font = -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS None; #else tw->tabs.font->fid; @@ -2488,12 +2488,12 @@ tw->tabs.greyGC = XtAllocateGC(w, w->core.depth, -#ifndef USE_XFT_TABS +#ifndef HAVE_XFT_TABS GCFont| #endif GCBackground|GCStipple|GCFillStyle, &values, GCForeground, -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS GCFont| #endif GCSubwindowMode|GCGraphicsExposures|GCDashOffset| @@ -2503,14 +2503,14 @@ { tw->tabs.greyGC = XtAllocateGC(w, w->core.depth, -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS 0L, #else GCFont, #endif &values, GCForeground, -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS GCFont| #endif GCBackground|GCSubwindowMode|GCGraphicsExposures|GCDashOffset|
--- a/lwlib/xlwtabsP.h Wed Feb 03 21:06:14 2010 -0600 +++ b/lwlib/xlwtabsP.h Wed Feb 03 21:46:21 2010 -0600 @@ -41,7 +41,7 @@ #endif #include "xlwtabs.h" -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS #include <X11/Xft/Xft.h> #endif @@ -73,7 +73,7 @@ typedef struct { /* resources */ XFontStruct *font ; -#ifdef USE_XFT_TABS +#ifdef HAVE_XFT_TABS XftFont *renderFont; String fcFontName; String xftFontName;
--- a/man/ChangeLog Wed Feb 03 21:06:14 2010 -0600 +++ b/man/ChangeLog Wed Feb 03 21:46:21 2010 -0600 @@ -20,6 +20,27 @@ See comment in src/ChangeLog about this. +2010-02-03 Ben Wing <ben@xemacs.org> + + * internals/internals.texi (Top): + * internals/internals.texi (Evaluation; Stack Frames; Bindings): + * internals/internals.texi (Ben's README): + * internals/internals.texi (Consoles; Devices; Frames; Windows): + * internals/internals.texi (Window Hierarchy): + * internals/internals.texi (The Window Object): + * internals/internals.texi (Modules for the Basic Displayable Lisp Objects): + * internals/internals.texi (Window-System Support): + * internals/internals.texi (Creating a Window-System Type): + * internals/internals.texi (Discussion -- Garbage Collection): + Update the part at the top about how to maintain the file with + more tips. + + Add a chapter on "window-system support" describing in a general + way how the support for different window systems/device types + works, including the separation between device-independent and + device-dependent parts, device methods, the specific device types + and the "xlike" pseudo-type. + 2010-01-31 Aidan Kehoe <kehoea@parhasard.net> * xemacs/programs.texi (Defuns):
--- a/man/internals/internals.texi Wed Feb 03 21:06:14 2010 -0600 +++ b/man/internals/internals.texi Wed Feb 03 21:46:21 2010 -0600 @@ -129,13 +129,37 @@ @end ifinfo @ignore -Don't update this by hand!!!!!! -Use C-u C-c C-u m (aka C-u M-x texinfo-master-list). -NOTE: This command does not include the Index:: menu entry. +Tips for maintaining this file: + +1. Updating the forward, back and up pointers in a @@node line: +--------------------------------------------------------------- + +Don't do it by hand! + +Use C-c C-u C-e (aka M-x texinfo-every-node-update). + +2. Updating the menus: +---------------------- + +This section describes how to update the menus at the end of chapters, +sections with subsections, etc., and the master menu near the top of +the file: + +Don't do it by hand! + +Use C-u C-c C-u m (aka C-u M-x texinfo-master-menu). +N +OTE: This command does not include the Index:: menu entry. You must add it by hand. -Here are some useful Lisp routines for quickly Texinfo-izing text that -has been formatted into ASCII lists and tables. +3. Converting plain text into Texinfo: +-------------------------------------- + +3a. Here are some useful Lisp routines for quickly Texinfo-izing text + that has been formatted into ASCII lists and tables. + +Note: to define these routines, put point after the end of the definition +and type C-x C-e. (defun list-to-texinfo (b e) "Convert the selected region from an ASCII list to a Texinfo list." @@ -249,8 +273,8 @@ (beginning-of-line) (insert "@end table\n"))) -A useful Lisp routine for adding markup based on conventions used in plain -text files; see doc string below. +3b. A useful Lisp routine for adding markup based on conventions used + in plain text files; see doc string below. (defun convert-text-to-texinfo (&optional no-narrow) "Convert text to Texinfo. @@ -259,10 +283,10 @@ in text: @code{} surrounded by ` and ' or followed by a (); @strong{} surrounded by *'s; @file{} something that looks like a file name." (interactive) - (if (region-active-p) + (if (and (not no-narrow) (region-active-p)) (save-restriction (narrow-to-region (region-beginning) (region-end)) - (convert-comments-to-texinfo t)) + (convert-text-to-texinfo t)) (let ((p (point)) (case-replace nil)) (query-replace-regexp "`\\([^']+\\)'\\([^']\\)" "@code{\\1}\\2" nil) @@ -274,31 +298,38 @@ (query-replace-regexp "\\(\\(\\s_\\|\\sw\\)+\\.[A-Za-z]+\\)\\([^A-Za-z.}]\\)" "@file{\\1}\\3" nil) ))) -Macro the generate the "Future Work" section from a title; put -point at beginning. +4. Adding new sections: +----------------------- + +NOTE: These are in the form of macros. #### FIXME Convert them to +proper functions. To edit these macros, define them and then use +M-x edit-kbd-macro. + +Macro to generate the "Future Work" section from a title; put +point at the beginning of the title. (defalias 'make-future (read-kbd-macro -"<S-end> <f3> <home> @node SPC <end> RET @section SPC <f4> <home> <up> <C-right> <right> Future SPC Work SPC - - SPC <home> <down> <C-right> <right> Future SPC Work SPC - - SPC <end> RET @cindex SPC future SPC work, SPC <f4> C-r , RET C-x C-x M-l RET @cindex SPC <f4> <home> <C-right> <S-end> M-l , SPC future SPC work RET")) +"<S-end> M-w <home> @node SPC <end> RET @section SPC C-y <home> <up> <C-right> <right> Future SPC Work SPC - - SPC <home> <down> <C-right> <right> Future SPC Work SPC - - SPC <end> RET @cindex SPC future SPC work, SPC C-y C-r , RET C-x C-x M-l RET @cindex SPC C-y <home> <C-right> <S-end> M-l , SPC future SPC work RET")) Similar but generates a "Discussion" section. (defalias 'make-discussion (read-kbd-macro -"<S-end> <f3> <home> @node SPC <end> RET @section SPC <f4> <home> <up> <C-right> <right> Discussion SPC - - SPC <home> <down> <C-right> <right> Discussion SPC - - SPC <end> RET @cindex SPC discussion, SPC <f4> C-r , RET C-x C-x M-l RET @cindex SPC <f4> <home> <C-right> <S-end> M-l , SPC discussion RET")) +"<S-end> M-w <home> @node SPC <end> RET @section SPC C-y <home> <up> <C-right> <right> Discussion SPC - - SPC <home> <down> <C-right> <right> Discussion SPC - - SPC <end> RET @cindex SPC discussion, SPC C-y C-r , RET C-x C-x M-l RET @cindex SPC C-y <home> <C-right> <S-end> M-l , SPC discussion RET")) Similar but generates an "Old Future Work" section. (defalias 'make-old-future (read-kbd-macro -"<S-end> <f3> <home> @node SPC <end> RET @section SPC <f4> <home> <up> <C-right> <right> Old SPC Future SPC Work SPC - - SPC <home> <down> <C-right> <right> Old SPC Future SPC Work SPC - - SPC <end> RET @cindex SPC old SPC future SPC work, SPC <f4> C-r , RET C-x C-x M-l RET @cindex SPC <f4> <home> <C-right> <S-end> M-l , SPC old SPC future SPC work RET")) +"<S-end> M-w <home> @node SPC <end> RET @section SPC C-y <home> <up> <C-right> <right> Old SPC Future SPC Work SPC - - SPC <home> <down> <C-right> <right> Old SPC Future SPC Work SPC - - SPC <end> RET @cindex SPC old SPC future SPC work, SPC C-y C-r , RET C-x C-x M-l RET @cindex SPC C-y <home> <C-right> <S-end> M-l , SPC old SPC future SPC work RET")) Similar but generates a general section. (defalias 'make-section (read-kbd-macro -"<S-end> <f3> <home> @node SPC <end> RET @section SPC <f4> RET @cindex SPC C-SPC C-g <f4> C-x C-x M-l <home> <down>")) +"<S-end> M-w <home> @node SPC <end> RET @section SPC C-y RET @cindex SPC C-SPC C-g C-y C-x C-x M-l <home> <down>")) Similar but generates a general subsection. (defalias 'make-subsection (read-kbd-macro -"<S-end> <f3> <home> @node SPC <end> RET @subsection SPC <f4> RET @cindex SPC C-SPC C-g <f4> C-x C-x M-l <home> <down>")) +"<S-end> M-w <home> @node SPC <end> RET @subsection SPC C-y RET @cindex SPC C-SPC C-g C-y C-x C-x M-l <home> <down>")) @end ignore @menu @@ -328,6 +359,7 @@ * Text:: * Multilingual Support:: * Consoles; Devices; Frames; Windows:: +* Window-System Support:: * The Redisplay Mechanism:: * Extents:: * Faces:: @@ -451,7 +483,7 @@ * Evaluation:: * Dynamic Binding; The specbinding Stack; Unwind-Protects:: -* Simple Special Operators:: +* Simple Special Operators:: * Catch and Throw:: * Error Trapping:: @@ -558,9 +590,12 @@ * Point:: * Window Hierarchy:: * The Window Object:: -* Creating a New Console/Device/Frame Type:: * Modules for the Basic Displayable Lisp Objects:: +Window-System Support + +* Creating a Window-System Type:: + The Redisplay Mechanism * Critical Redisplay Sections:: @@ -740,8 +775,8 @@ Discussion -- Garbage Collection -* Discussion -- KKCC:: -* Discussion -- Incremental Collector:: +* Discussion -- KKCC:: +* Discussion -- Incremental Collector:: * Discussion -- Pure Space:: * Discussion -- Hashtable-Based Marking and Cleanup:: * Discussion -- The Anti-Cons:: @@ -8954,7 +8989,7 @@ @menu * Evaluation:: * Dynamic Binding; The specbinding Stack; Unwind-Protects:: -* Simple Special Operators:: +* Simple Special Operators:: * Catch and Throw:: * Error Trapping:: @end menu @@ -17141,7 +17176,7 @@ -@node Consoles; Devices; Frames; Windows, The Redisplay Mechanism, Multilingual Support, Top +@node Consoles; Devices; Frames; Windows, Window-System Support, Multilingual Support, Top @chapter Consoles; Devices; Frames; Windows @cindex consoles; devices; frames; windows @cindex devices; frames; windows, consoles; @@ -17153,7 +17188,6 @@ * Point:: * Window Hierarchy:: * The Window Object:: -* Creating a New Console/Device/Frame Type:: * Modules for the Basic Displayable Lisp Objects:: @end menu @@ -17323,7 +17357,7 @@ artifact that should be fixed.) @end enumerate -@node The Window Object, Creating a New Console/Device/Frame Type, Window Hierarchy, Consoles; Devices; Frames; Windows +@node The Window Object, Modules for the Basic Displayable Lisp Objects, Window Hierarchy, Consoles; Devices; Frames; Windows @section The Window Object @cindex window object, the @cindex object, the window @@ -17431,143 +17465,7 @@ @end table -@node Creating a New Console/Device/Frame Type, Modules for the Basic Displayable Lisp Objects, The Window Object, Consoles; Devices; Frames; Windows -@section Creating a New Console, Device, or Frame Type -@cindex creating a new console type -@cindex console type, creating a new -@cindex creating a new device type -@cindex device type, creating a new -@cindex creating a new frame type -@cindex frame type, creating a new - -Unfortunately, at the present time, only the console abstraction is at -all well-maintained. Device and frame internals are referred to from -many places in the redisplay and console code. The best that can be -done therefore is to create a whole new console type, even though much -code will be shared. (Ben Wing has complained about the code -duplication in the GTK+ v1 console, and probably would not be happy with -the unpublished Qt console or Andrew Choi's Carbon console, but it's -hard to see how those consoles could have been done better without -fixing the abstractions in the X (actually Xt), MS Windows, and tty -consoles as well as doing a complete refactoring of the console, device, -and frame code.) - -What is desireable is sharing console, device, and frame methods across -platforms in a more general way, reducing the amount of duplicated code -by pulling it back into the redisplay engine proper or the Lisp modules -as appropriate. For example, we should be able to use -@samp{make-frame-on-device} to share a single X connection among GTK, X, -and Xft frames. Xft is partially implemented, but GTK would be much -harder (impossible?) because it has its own event loop. (Xft shares the -Xt event loop with the X console.) - -The way all methods get added to the console type is uncool. A console -should be a composite, which indicates a collection of I/O resources -``used together.'' It should indicate where operations that change -``focus'' search for targets, @emph{i.e.}, by default new frames are -created on the selected device of the console where the input that -invoked the command was received, @samp{pop-to-buffer-other-window} only -considers existing windows on the same device of the same console, -@emph{etc.} But it should be possible to assemble consoles out of -component input channels, imaging devices, and multimedia (audio) -channels. - -The following notes may provide some guidance to those who wish to -create new console types (@emph{i.e.}, port the redisplay code to a new -platform). They are based on an unsuccessful attempt to refactor the -Xft code into a new console type while sharing most routines with the X -console. (For clarification or suggestions, feel free to write -@email{stephen@@xemacs.org,Stephen Turnbull}.) - -The first thing to realize is that the naming of many modules obscures -their relationship to the console abstraction. For example, the -@file{objects-@var{console-type}}, @file{redisplay-@var{console-type}}, -and @file{glyphs-@var{console-type}} series of modules have nothing to -do with Lisp objects and little to do with redisplay, respectively. -Rather they implement abstractions used for rendering on each console -type, such as fonts and colors (@file{objects}) and string and graphics -drawing primitives (@file{redisplay}). These modules are conceptually -part of the console implementations, not part of redisplay or Lisp. - -Public methods of a console are implemented as C functions declared -@code{static}, following a rigid naming convention: -@samp{@var{console-type}_@var{method-name}}. Methods are bound to the -console type in the @samp{console_type_create_@var{file}} functions for -each console component (console, device, and frame) using the -@samp{CONSOLE_HAS_METHOD} family of macros. Methods for displaying -images are bound using the @samp{IIFORMAT_HAS_DEVMETHOD} family of -macros. Methods are invoked using the @samp{CONMETH}, @samp{DEVMETH}, -and @samp{FRAMEMETH} families of macros, which look up the relevant -methods in the object's table of methods. - -@strong{N.B.} All of the object tables are actually references to -console method tables. To create a variant of an existing console, -there is a @samp{CONSOLE_INHERITS_METHOD} constructor, but this actually -constructs the name of the parent's method pointer and stores in the -derived console type's method table. Of course this is time-efficient, -and since there are few console types it is a neglible waste of space. -However in practice this may have contributed to breaking the various -abstractions, and the variant console must be coded in the same file as -the parent (because the methods are static). Another minor symptom of -the incompleteness of the abstraction is the fact that the API for -inheritance of device methods for image formats is named -@samp{IIFORMAT_HAS_SHARED_METHOD}, although the semantics are identical. - -One problem encountered in attempting to create an Xft console type as a -derivative of the X console type was that there is no support for such -union types in the consistency-checking code, whether for the -fundamental Lisp consistency checks (the @samp{CHECK_SOMETHING} family -of macros) or for the error-checking variants of many functions. These -APIs all simply check for the apparent console type, which is a single -symbol (or enumerator). - -To create a new console with mostly new methods, it's probably best to -copy all of the @file{@var{function}-@var{console-type}} files from a -similar console (or several, if the new console type seems like a -combination of several existing console types), renaming the files by -substituting @var{new-console-type} for @var{console-type}. Then -proceed in the obvious way by renaming methods from -@samp{@var{console-type}_@var{method-name}} to -@samp{@var{new-console-type}_@var{method-name}}, and implementing them. - -Once you've done that, then the fun starts. Insert the initialization -functions (@samp{syms_of_@var{file}}, @samp{vars_of_@var{file}}, -@samp{console_type_create_@var{file}}, @emph{etc.}) in @samp{main_1} in -@file{emacs.c}. - -Add a device creation function @samp{make-@var{console-type}-device} in -@file{device.el}. Add the device type to the calls to -@samp{Face-frob-property} in @file{faces.el}, as well as calls to the -device initializer functions for devices and frames, and ``additional -frobbing'' in that file. - -You may wish to add an option to force the initial frame to that device -type to @file{emacs.c}. Don't forget to document it in the command help -function in @file{startup.el}. - -You may need to add support for your console type in -@samp{init_event_stream} in @file{event-stream.c}. - -If your console has a different UI for fonts or colors, or adds new -capability, you may need to add a @file{@var{console-type}-faces.el} -file, or add code to the @file{@var{parent-type}-faces.el} file, to -support new font or color capability. Probably initialization code in -@file{faces.c} will be needed too. - -A check for the console type is probably needed in @samp{init_redisplay} -in @file{redisplay.c}. - -Ditto for the @file{@var{console-type}-init.el} file. - -Don't forget that Emacs windows are console-dependent, too. At least a -@samp{WINDOW_@var{console-type}_P}-checking macro should be added in -@file{window-impl.h}. - -Note that this project failed; there are probably many other details to -be implemented that I didn't get to. But don't let that stop you! - - -@node Modules for the Basic Displayable Lisp Objects, , Creating a New Console/Device/Frame Type, Consoles; Devices; Frames; Windows +@node Modules for the Basic Displayable Lisp Objects, , The Window Object, Consoles; Devices; Frames; Windows @section Modules for the Basic Displayable Lisp Objects @cindex modules for the basic displayable Lisp objects @cindex displayable Lisp objects, modules for the basic @@ -17718,7 +17616,190 @@ types such as scrollbars. -@node The Redisplay Mechanism, Extents, Consoles; Devices; Frames; Windows, Top +@node Window-System Support, The Redisplay Mechanism, Consoles; Devices; Frames; Windows, Top +@chapter Window-System Support +@cindex window-system support +@cindex window systems +@cindex X +@cindex X Windows +@cindex Windows +@cindex Microsoft Windows +@cindex MS-Windows +@cindex GTK +@cindex Gnome + +XEmacs defines the concept of a ``device type'', which approximately +corresponds to a window-system type, and separates out display-related +code into device-independent and device-dependent sections. +Generally, the device-independent code will go into a generally-named +file such as @file{redisplay.c}, while the device-dependent code goes +into @file{redisplay-x.c}, @file{redisplay-gtk.c}, +@file{redisplay-msw.c}, etc. Device-dependent methods are called +using the @code{DEVMETH} macro. + +The following device types are defined: + +@table @asis +@item X-Windows (@code{x}) +This supports rendering through @code{Xlib}, widget support through +@code{Xt}, and event-handling through @code{Xt}. +@item Microsoft Windows (@code{msw}) +@item GTK/Gnome (@code{gtk}) +@item TTY's (@code{tty}) +This is used for TTY connections (e.g. running inside of an @code{xterm} or +Windows console window). +@item Stream devices (@code{stream}) +This is used for ``stream'' devices, of which there is only one -- the +initial stdio device used when XEmacs is running noninteractively. +@end table + +In addition, there is a pseudo-device-type `xlike', which is used for +abstracting X and GTK code that is very similar. + +@menu +* Creating a Window-System Type:: +@end menu + +@node Creating a Window-System Type, , Window-System Support, Window-System Support +@section Creating a Window-System Type +@cindex creating a new window-system type +@cindex window-system types, creating +@cindex creating a new console type +@cindex console types, creating +@cindex creating a new device type +@cindex device types, creating +@cindex creating a new frame type +@cindex frame types, creating + +Unfortunately, at the present time, only the console abstraction is +really well-maintained. Device and frame internals are referred to +from many places in the redisplay and console code. The best that can +be done therefore is to create a whole new console type, even though +much code will be shared. (Ben Wing has complained about the code +duplication in the GTK+ v1 console, and probably would not be happy +with the unpublished Qt console or Andrew Choi's Carbon console, but +it's hard to see how those consoles could have been done better +without fixing the abstractions in the X (actually Xt), MS Windows, +and tty consoles as well as doing a complete refactoring of the +console, device, and frame code.) + +What is desireable is sharing console, device, and frame methods across +platforms in a more general way, reducing the amount of duplicated code +by pulling it back into the redisplay engine proper or the Lisp modules +as appropriate. For example, we should be able to use +@samp{make-frame-on-device} to share a single X connection among GTK, X, +and Xft frames. Xft is partially implemented, but GTK would be much +harder (impossible?) because it has its own event loop. (Xft shares the +Xt event loop with the X console.) + +The way all methods get added to the console type is uncool. A console +should be a composite, which indicates a collection of I/O resources +``used together.'' It should indicate where operations that change +``focus'' search for targets, @emph{i.e.}, by default new frames are +created on the selected device of the console where the input that +invoked the command was received, @samp{pop-to-buffer-other-window} only +considers existing windows on the same device of the same console, +@emph{etc.} But it should be possible to assemble consoles out of +component input channels, imaging devices, and multimedia (audio) +channels. + +The following notes may provide some guidance to those who wish to +create new console types (@emph{i.e.}, port the redisplay code to a new +platform). They are based on an unsuccessful attempt to refactor the +Xft code into a new console type while sharing most routines with the X +console. (For clarification or suggestions, feel free to write +@email{stephen@@xemacs.org,Stephen Turnbull}.) + +The first thing to realize is that the naming of many modules obscures +their relationship to the console abstraction. For example, the +@file{objects-@var{console-type}}, @file{redisplay-@var{console-type}}, +and @file{glyphs-@var{console-type}} series of modules have nothing to +do with Lisp objects and little to do with redisplay, respectively. +Rather they implement abstractions used for rendering on each console +type, such as fonts and colors (@file{objects}) and string and graphics +drawing primitives (@file{redisplay}). These modules are conceptually +part of the console implementations, not part of redisplay or Lisp. + +Public methods of a console are implemented as C functions declared +@code{static}, following a rigid naming convention: +@samp{@var{console-type}_@var{method-name}}. Methods are bound to the +console type in the @samp{console_type_create_@var{file}} functions for +each console component (console, device, and frame) using the +@samp{CONSOLE_HAS_METHOD} family of macros. Methods for displaying +images are bound using the @samp{IIFORMAT_HAS_DEVMETHOD} family of +macros. Methods are invoked using the @samp{CONMETH}, @samp{DEVMETH}, +and @samp{FRAMEMETH} families of macros, which look up the relevant +methods in the object's table of methods. + +@strong{N.B.} All of the object tables are actually references to +console method tables. To create a variant of an existing console, +there is a @samp{CONSOLE_INHERITS_METHOD} constructor, but this actually +constructs the name of the parent's method pointer and stores in the +derived console type's method table. Of course this is time-efficient, +and since there are few console types it is a neglible waste of space. +However in practice this may have contributed to breaking the various +abstractions, and the variant console must be coded in the same file as +the parent (because the methods are static). Another minor symptom of +the incompleteness of the abstraction is the fact that the API for +inheritance of device methods for image formats is named +@samp{IIFORMAT_HAS_SHARED_METHOD}, although the semantics are identical. + +One problem encountered in attempting to create an Xft console type as a +derivative of the X console type was that there is no support for such +union types in the consistency-checking code, whether for the +fundamental Lisp consistency checks (the @samp{CHECK_SOMETHING} family +of macros) or for the error-checking variants of many functions. These +APIs all simply check for the apparent console type, which is a single +symbol (or enumerator). + +To create a new console with mostly new methods, it's probably best to +copy all of the @file{@var{function}-@var{console-type}} files from a +similar console (or several, if the new console type seems like a +combination of several existing console types), renaming the files by +substituting @var{new-console-type} for @var{console-type}. Then +proceed in the obvious way by renaming methods from +@samp{@var{console-type}_@var{method-name}} to +@samp{@var{new-console-type}_@var{method-name}}, and implementing them. + +Once you've done that, then the fun starts. Insert the initialization +functions (@samp{syms_of_@var{file}}, @samp{vars_of_@var{file}}, +@samp{console_type_create_@var{file}}, @emph{etc.}) in @samp{main_1} in +@file{emacs.c}. + +Add a device creation function @samp{make-@var{console-type}-device} in +@file{device.el}. Add the device type to the calls to +@samp{Face-frob-property} in @file{faces.el}, as well as calls to the +device initializer functions for devices and frames, and ``additional +frobbing'' in that file. + +You may wish to add an option to force the initial frame to that device +type to @file{emacs.c}. Don't forget to document it in the command help +function in @file{startup.el}. + +You may need to add support for your console type in +@samp{init_event_stream} in @file{event-stream.c}. + +If your console has a different UI for fonts or colors, or adds new +capability, you may need to add a @file{@var{console-type}-faces.el} +file, or add code to the @file{@var{parent-type}-faces.el} file, to +support new font or color capability. Probably initialization code in +@file{faces.c} will be needed too. + +A check for the console type is probably needed in @samp{init_redisplay} +in @file{redisplay.c}. + +Ditto for the @file{@var{console-type}-init.el} file. + +Don't forget that Emacs windows are console-dependent, too. At least a +@samp{WINDOW_@var{console-type}_P}-checking macro should be added in +@file{window-impl.h}. + +Note that this project failed; there are probably many other details to +be implemented that I didn't get to. But don't let that stop you! + + + +@node The Redisplay Mechanism, Extents, Window-System Support, Top @chapter The Redisplay Mechanism @cindex redisplay mechanism, the @@ -28402,8 +28483,8 @@ @cindex garbage collection, discussion @menu -* Discussion -- KKCC:: -* Discussion -- Incremental Collector:: +* Discussion -- KKCC:: +* Discussion -- Incremental Collector:: * Discussion -- Pure Space:: * Discussion -- Hashtable-Based Marking and Cleanup:: * Discussion -- The Anti-Cons::
--- a/nt/ChangeLog Wed Feb 03 21:06:14 2010 -0600 +++ b/nt/ChangeLog Wed Feb 03 21:46:21 2010 -0600 @@ -1,3 +1,9 @@ +2010-02-03 Jerry James <james@xemacs.org> + + * xemacs.rc: Add license and copyright boilerplate text for Jonathan + Harris. + * xpm.mak: Ditto. + 2010-01-28 Jerry James <james@xemacs.org> * compface.mak: Add license and copyright boilerplate text based
--- a/nt/ad2c.sed Wed Feb 03 21:06:14 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -/^!/d -/^$/d -s/\\/\\\\/g -s/\\$//g -s/"/\\"/g -s/^/(String) "/ -: test -/\\$/b slash -s/$/",/ -p -d -: slash -n -/^!/d -/^$/d -s/"/\\"/g -s/\\\\/\\/g -s/\\n/\\\\n/g -s/\\t/\\\\t/g -s/\\f/\\\\f/g -s/\\b/\\\\b/g -b test
--- a/nt/x11.patch Wed Feb 03 21:06:14 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -*** X11.def.old Thu Apr 10 07:29:27 1997 ---- X11.def Wed Jul 02 22:20:16 1997 -*************** -*** 5,15 **** - VERSION 6.1 - EXPORTS - _Xdebug_p=_Xdebug CONSTANT -- _XCreateMutex_fn_p=_XCreateMutex_fn CONSTANT -- _XFreeMutex_fn_p=_XFreeMutex_fn CONSTANT -- _XLockMutex_fn_p=_XLockMutex_fn CONSTANT -- _XUnlockMutex_fn_p=_XUnlockMutex_fn CONSTANT -- _Xglobal_lock_p=_Xglobal_lock CONSTANT - XActivateScreenSaver - XAddConnectionWatch - XAddExtension ---- 5,10 ---- -*************** -*** 623,630 **** - _XUnregisterFilter - _XUnregisterInternalConnection - _XVIDtoVisual -- _Xthread_init -- _Xthread_waiter - XkbIgnoreExtension - XkbOpenDisplay - XkbQueryExtension ---- 618,623 ----
--- a/nt/xemacs.mak Wed Feb 03 21:06:14 2010 -0600 +++ b/nt/xemacs.mak Wed Feb 03 21:46:21 2010 -0600 @@ -1033,9 +1033,6 @@ set COPYCMD=$(COPYCMD) @copy $(SRC)\config.h.in $(SRC)\config.h -#$(SRC)\Emacs.ad.h: $(SRCROOT)\etc\Emacs.ad -# !"sed -f ad2c.sed < $(SRCROOT)\etc\Emacs.ad > $(SRC)\Emacs.ad.h" - #$(SRC)\paths.h: $(SRC)\paths.h.in # !"cd $(SRC); cp paths.h.in paths.h"
--- a/nt/xemacs.rc Wed Feb 03 21:06:14 2010 -0600 +++ b/nt/xemacs.rc Wed Feb 03 21:46:21 2010 -0600 @@ -1,3 +1,22 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +XEmacs is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin St. - Fifth Floor, +Boston, MA 02110-1301, USA. */ + #ifdef INCLUDE_DUMP 101 DUMP "xemacs.dmp" #endif
--- a/nt/xpm.mak Wed Feb 03 21:06:14 2010 -0600 +++ b/nt/xpm.mak Wed Feb 03 21:46:21 2010 -0600 @@ -1,6 +1,25 @@ # # XPM Makefile for Microsoft NMAKE without X libraries # +# Copyright (C) 1997 Free Software Foundation, Inc. +# +# This file is part of XEmacs. +# +# XEmacs is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any +# later version. +# +# XEmacs is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with XEmacs; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin St. - Fifth Floor, +# Boston, MA 02110-1301, USA. +# !if !defined(DEBUG) !if defined(DEBUG_XEMACS) DEBUG=$(DEBUG_XEMACS)
--- a/src/ChangeLog Wed Feb 03 21:06:14 2010 -0600 +++ b/src/ChangeLog Wed Feb 03 21:46:21 2010 -0600 @@ -128,6 +128,148 @@ * lrecord.h: Move XD_DYNARR_DESC to lisp.h, grouping with the dynarr code. +2010-02-03 Jerry James <james@xemacs.org> + + * s/mach-bsd4-3.h: Add historical copyright and license information, + unearthed by Ben Wing. + +2010-02-03 Ben Wing <ben@xemacs.org> + + * bytecode.c: + Fix minor compile problem. + +2010-02-03 Ben Wing <ben@xemacs.org> + + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defsymbol_nodump): + * symbols.c (defsymbol): + * symbols.c (defkeyword): + * symeval.h (DEFVAR_SYMVAL_FWD_OBJECT): + Temporarily back out staticpro-related changes in symbols.c and + symeval.h to fix compile problems, will put back when `latest-fix' + workspace gets merged in. + +2010-02-03 Ben Wing <ben@xemacs.org> + + * alloc.c (Fmake_byte_code): + * lread.c: + * lread.c (readevalloop): + * lread.c (Fread): + * lread.c (Fread_from_string): + * lread.c (read_list_conser): + * lread.c (read_list): + * lread.c (vars_of_lread): + Remove the old kludgy stuff bracketed by `#ifdef + COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY'. + +2010-02-03 Ben Wing <ben@xemacs.org> + + * alloc.c (Fmake_byte_code): + * bytecode.h: + * lisp.h: + * lread.c: + * lread.c (readevalloop): + * lread.c (Fread): + * lread.c (Fread_from_string): + * lread.c (read_list_conser): + * lread.c (read_list): + * lread.c (vars_of_lread): + * symbols.c: + * symbols.c (Fdefine_function): + Turn on the "compiled-function annotation hack". Implement it + properly by hooking into Fdefalias(). Note in the docstring to + `defalias' that we do this. Remove some old broken code and + change code that implemented the old kludgy way of hooking into + the Lisp reader into bracketed by `#ifdef + COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY', which is not enabled. + + Also enable byte-code metering when DEBUG_XEMACS -- this is a form + of profiling for computing histograms of which sequences of two + bytecodes are used most often. + + * bytecode-ops.h: + * bytecode-ops.h (OPCODE): + New file. Extract out all the opcodes and declare them using + OPCODE(), a bit like frame slots and such. This way the file can + be included multiple times if necessary to iterate multiple times + over the byte opcodes. + + * bytecode.c: + * bytecode.c (NUM_REMEMBERED_BYTE_OPS): + * bytecode.c (OPCODE): + * bytecode.c (assert_failed_with_remembered_ops): + * bytecode.c (READ_UINT_2): + * bytecode.c (READ_INT_1): + * bytecode.c (READ_INT_2): + * bytecode.c (PEEK_INT_1): + * bytecode.c (PEEK_INT_2): + * bytecode.c (JUMP_RELATIVE): + * bytecode.c (JUMP_NEXT): + * bytecode.c (PUSH): + * bytecode.c (POP_WITH_MULTIPLE_VALUES): + * bytecode.c (DISCARD): + * bytecode.c (UNUSED): + * bytecode.c (optimize_byte_code): + * bytecode.c (optimize_compiled_function): + * bytecode.c (Fbyte_code): + * bytecode.c (vars_of_bytecode): + * bytecode.c (init_opcode_table_multi_op): + * bytecode.c (reinit_vars_of_bytecode): + * emacs.c (main_1): + * eval.c (funcall_compiled_function): + * symsinit.h: + Any time we change either the instruction pointer or the stack + pointer, assert that we're going to move it to a valid location. + This should catch failures right when they occur rather than + sometime later. This requires that we pass in another couple of + parameters into some functions (only with error-checking enabled, + see below). + + Also keep track, using a circular queue, of the last 100 byte + opcodes seen, and when we hit an assert failure during byte-code + execution, output the contents of the queue in a nice readable + fashion. This requires that bytecode-ops.h be included a second + time so that a table mapping opcodes to the name of their operation + can be constructed. This table is constructed in new function + reinit_vars_of_bytecode(). + + Everything in the last two paras happens only when + ERROR_CHECK_BYTE_CODE. + + Add some longish comments describing how the arrays that hold the + stack and instructions, and the pointers used to access them, work. + + * gc.c: + Import some code from my `latest-fix' workspace to mark the + staticpro's in order from lowest to highest, rather than highest to + lowest, so it's easier to debug when something goes wrong. + + * lisp.h (abort_with_message): Renamed from abort_with_msg(). + + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defsymbol_nodump): + * symbols.c (defsymbol): + * symbols.c (defkeyword): + * symeval.h (DEFVAR_SYMVAL_FWD_OBJECT): + Make the various calls to staticpro() instead call staticpro_1(), + passing in the name of the C var being staticpro'ed, so that it + shows up in staticpro_names. Otherwise staticpro_names just has + 1000+ copies of the word `location'. + +2010-02-02 Ben Wing <ben@xemacs.org> + + * bytecode.c (execute_rare_opcode): + * lisp.h (abort_with_msg): New. + When aborting due to unknown opcode, output more descriptive msg. + +2010-02-01 Vin Shelton <acs@xemacs.org> + + * intl-encap-win32.c: Added description of override keyword. + Fix 2nd arg to CreateMDIWindowW. + + * intl-auto-encap-win32.c: + * intl-auto-encap-win32.h: Fix 2nd arg to qxeCreateMDIWindow. + 2010-02-01 Aidan Kehoe <kehoea@parhasard.net> * fns.c (internal_equalp): @@ -144,6 +286,87 @@ * bytecode.c (bytecode_arithcompare): Make this visible to other files. +2010-02-03 Ben Wing <ben@xemacs.org> + + * Makefile.in.in: + * Makefile.in.in (x_objs): + * Makefile.in.in (gtk_gui_objs): + * console-xlike-inc.h: + * depend: + * device-x.c: + * emacs.c: + * gccache-gtk.h: + * gccache-gtk.h (gc_cache_lookup): + * gccache-x.c: + * gccache-x.c (GCCACHE_HASH): + * gccache-x.h: + * toolbar-gtk.c: + * toolbar-gtk.c (gtk_initialize_frame_toolbars): + * toolbar-x.c: + * toolbar-x.c (x_initialize_frame_toolbars): + * toolbar-xlike.c: + * toolbar-xlike.c (xlike_draw_blank_toolbar_button): + * toolbar-xlike.c (xlike_output_toolbar_button): + * toolbar-xlike.c (xlike_get_button_size): + * toolbar-xlike.c (XLIKE_OUTPUT_BUTTONS_LOOP): + * toolbar-xlike.c (xlike_output_toolbar): + * toolbar-xlike.c (xlike_clear_toolbar): + * toolbar-xlike.c (xlike_output_frame_toolbars): + * toolbar-xlike.c (xlike_clear_frame_toolbars): + * toolbar-xlike.c (xlike_redraw_exposed_toolbar): + * toolbar-xlike.c (xlike_redraw_exposed_toolbars): + * toolbar-xlike.c (xlike_redraw_frame_toolbars): + * toolbar-xlike.h: + * toolbar-xlike.h (xlike_clear_frame_toolbars): + Rename some files to make them consistent with general naming rules: + + xgccache.c -> gccache-x.c + xgccache.h -> gccache-x.h + toolbar-common.c -> toolbar-xlike.c + toolbar-common.h -> toolbar-xlike.h + + Fix include-file references. Also change the names of functions + in now-named toolbar-xlike.c to be xlike_foo() instead of common_foo(). + + Add a longish comment in console-xlike-inc.h describing the "xlike" + system, how it works and what the various files are used for. + + +2010-02-01 Ben Wing <ben@xemacs.org> + + * Makefile.in.in: + * compiler.h: + * config.h.in: + * console-x-impl.h: + * console-x-impl.h (struct x_frame): + * console-x-impl.h (FRAME_X_TOTALLY_VISIBLE_P): + * console-x.h: + * console-xlike-inc.h: + * emacs.c (main_1): + * faces.c (complex_vars_of_faces): + * font-mgr.h: + * frame-x.c (x_delete_frame): + * frame-x.c (x_update_frame_external_traits): + * glyphs-x.c (update_widget_face): + * inline.c: + * objects-x-impl.h: + * objects-x-impl.h (struct x_color_instance_data): + * objects-x-impl.h (struct x_font_instance_data): + * objects-x.c: + * objects-x.c (x_initialize_color_instance): + * objects-x.c (x_initialize_font_instance): + * objects-x.c (x_print_font_instance): + * objects-x.c (x_finalize_font_instance): + * objects-x.c (x_font_instance_truename): + * objects-x.c (vars_of_objects_x): + * objects-x.h: + USE_XFT* -> HAVE_XFT*. But in objects-xlike-inc.c and + redisplay-xlike-inc.c, continue to use USE_XFT, and define + it appropriately in console-xlike-inc.h when both HAVE_XFT + and THIS_IS_X -- even if HAVE_XFT, we don't want to enable + XFT code when included in a *-gtk.c file. + + 2010-02-01 Ben Wing <ben@xemacs.org> * alloc.c (common_init_alloc_early): @@ -403,6 +626,16 @@ * keymap.c (keymap_hash): Implement. +2010-02-01 Ben Wing <ben@xemacs.org> + + * syntax.c: + * syntax.c (scan_lists): + * syntax.c (syms_of_syntax): + Declare `scan-error' as a type of `syntax-error'. In `scan-lists' + et al., don't signal a syntax error but instead a `scan-error', and + pass a couple of integer arguments, for GNU compatibility. Fixes + problems with typing double-quote in texinfo.el. + 2010-01-31 Aidan Kehoe <kehoea@parhasard.net> * symbols.c (Fspecial_operator_p, syms_of_symbols):
--- a/src/Makefile.in.in Wed Feb 03 21:06:14 2010 -0600 +++ b/src/Makefile.in.in Wed Feb 03 21:46:21 2010 -0600 @@ -132,13 +132,13 @@ #ifdef HAVE_X_WINDOWS x_objs=console-x.o device-x.o event-Xt.o frame-x.o \ - glyphs-x.o objects-x.o redisplay-x.o select-x.o xgccache.o intl-x.o -#ifdef USE_XFT + glyphs-x.o objects-x.o redisplay-x.o select-x.o gccache-x.o intl-x.o +#ifdef HAVE_XFT x_objs += font-mgr.o #endif x_gui_objs=$(gui_objs:.o=-x.o) #ifdef HAVE_TOOLBARS -x_gui_objs += toolbar-common.o +x_gui_objs += toolbar-xlike.o #endif #endif @@ -159,7 +159,7 @@ gtk-xemacs.o ui-gtk.o gtk_gui_objs=$(gui_objs:.o=-gtk.o) #ifdef HAVE_TOOLBARS -gtk_gui_objs += toolbar-common.o +gtk_gui_objs += toolbar-xlike.o #endif #endif
--- a/src/alloc.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/alloc.c Wed Feb 03 21:46:21 2010 -0600 @@ -1930,19 +1930,7 @@ f->stack_depth = (unsigned short) XINT (stack_depth); #ifdef COMPILED_FUNCTION_ANNOTATION_HACK - if (!NILP (Vcurrent_compiled_function_annotation)) - f->annotated = Fcopy (Vcurrent_compiled_function_annotation); - else if (!NILP (Vload_file_name_internal_the_purecopy)) - f->annotated = Vload_file_name_internal_the_purecopy; - else if (!NILP (Vload_file_name_internal)) - { - struct gcpro gcpro1; - GCPRO1 (fun); /* don't let fun get reaped */ - Vload_file_name_internal_the_purecopy = - Ffile_name_nondirectory (Vload_file_name_internal); - f->annotated = Vload_file_name_internal_the_purecopy; - UNGCPRO; - } + f->annotated = Vload_file_name_internal; #endif /* COMPILED_FUNCTION_ANNOTATION_HACK */ /* doc_string may be nil, string, int, or a cons (string . int).
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/bytecode-ops.h Wed Feb 03 21:46:21 2010 -0600 @@ -0,0 +1,185 @@ +/* Execution of byte code produced by bytecomp.el. + Implementation of compiled-function objects. + Copyright (C) 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1995, 2002, 2010 Ben Wing. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +XEmacs is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Synched up with: Mule 2.0, FSF 19.30. */ + +/* There is more than one place in bytecode.c that may want to do something + with the list of all the opcodes. To handle this, we extract them into + a separate file that can get included after defining OPCODE(sym, val) + appropriately. No need to undefine OPCODE; that happens automatically. +*/ + + OPCODE (varref, 010) + OPCODE (varset, 020) + OPCODE (varbind, 030) + OPCODE (call, 040) + OPCODE (unbind, 050) + + OPCODE (nth, 070) + OPCODE (symbolp, 071) + OPCODE (consp, 072) + OPCODE (stringp, 073) + OPCODE (listp, 074) + OPCODE (old_eq, 075) + OPCODE (old_memq, 076) + OPCODE (not, 077) + OPCODE (car, 0100) + OPCODE (cdr, 0101) + OPCODE (cons, 0102) + OPCODE (list1, 0103) + OPCODE (list2, 0104) + OPCODE (list3, 0105) + OPCODE (list4, 0106) + OPCODE (length, 0107) + OPCODE (aref, 0110) + OPCODE (aset, 0111) + OPCODE (symbol_value, 0112) + OPCODE (symbol_function, 0113) + OPCODE (set, 0114) + OPCODE (fset, 0115) + OPCODE (get, 0116) + OPCODE (substring, 0117) + OPCODE (concat2, 0120) + OPCODE (concat3, 0121) + OPCODE (concat4, 0122) + OPCODE (sub1, 0123) + OPCODE (add1, 0124) + OPCODE (eqlsign, 0125) + OPCODE (gtr, 0126) + OPCODE (lss, 0127) + OPCODE (leq, 0130) + OPCODE (geq, 0131) + OPCODE (diff, 0132) + OPCODE (negate, 0133) + OPCODE (plus, 0134) + OPCODE (max, 0135) + OPCODE (min, 0136) + OPCODE (mult, 0137) + + OPCODE (point, 0140) + OPCODE (eq, 0141) /* was Bmark, but no longer + generated as of v18 */ + OPCODE (goto_char, 0142) + OPCODE (insert, 0143) + OPCODE (point_max, 0144) + OPCODE (point_min, 0145) + OPCODE (char_after, 0146) + OPCODE (following_char, 0147) + OPCODE (preceding_char, 0150) + OPCODE (current_column, 0151) + OPCODE (indent_to, 0152) + OPCODE (equal, 0153) /* was Bscan_buffer, but no + longer generated as of + v18 */ + OPCODE (eolp, 0154) + OPCODE (eobp, 0155) + OPCODE (bolp, 0156) + OPCODE (bobp, 0157) + OPCODE (current_buffer, 0160) + OPCODE (set_buffer, 0161) + OPCODE (save_current_buffer, 0162) /* was Bread_char, but no + longer generated as of + v19 */ + OPCODE (memq, 0163) /* was Bset_mark, but no + longer generated as of + v18 */ + OPCODE (interactive_p, 0164) /* Needed since interactive-p + takes unevalled args */ + OPCODE (forward_char, 0165) + OPCODE (forward_word, 0166) + OPCODE (skip_chars_forward, 0167) + OPCODE (skip_chars_backward, 0170) + OPCODE (forward_line, 0171) + OPCODE (char_syntax, 0172) + OPCODE (buffer_substring, 0173) + OPCODE (delete_region, 0174) + OPCODE (narrow_to_region, 0175) + OPCODE (widen, 0176) + OPCODE (end_of_line, 0177) + + OPCODE (constant2, 0201) + OPCODE (goto, 0202) + OPCODE (gotoifnil, 0203) + OPCODE (gotoifnonnil, 0204) + OPCODE (gotoifnilelsepop, 0205) + OPCODE (gotoifnonnilelsepop, 0206) + OPCODE (return, 0207) + OPCODE (discard, 0210) + OPCODE (dup, 0211) + + OPCODE (save_excursion, 0212) + OPCODE (save_window_excursion, 0213) + OPCODE (save_restriction, 0214) + OPCODE (catch, 0215) + + OPCODE (unwind_protect, 0216) + OPCODE (condition_case, 0217) + OPCODE (temp_output_buffer_setup, 0220) + OPCODE (temp_output_buffer_show, 0221) + + OPCODE (unbind_all, 0222) + + OPCODE (set_marker, 0223) + OPCODE (match_beginning, 0224) + OPCODE (match_end, 0225) + OPCODE (upcase, 0226) + OPCODE (downcase, 0227) + + OPCODE (string_equal, 0230) + OPCODE (string_lessp, 0231) + OPCODE (old_equal, 0232) + OPCODE (nthcdr, 0233) + OPCODE (elt, 0234) + OPCODE (old_member, 0235) + OPCODE (old_assq, 0236) + OPCODE (nreverse, 0237) + OPCODE (setcar, 0240) + OPCODE (setcdr, 0241) + OPCODE (car_safe, 0242) + OPCODE (cdr_safe, 0243) + OPCODE (nconc, 0244) + OPCODE (quo, 0245) + OPCODE (rem, 0246) + OPCODE (numberp, 0247) + OPCODE (fixnump, 0250) /* Was Bintegerp. */ + + OPCODE (Rgoto, 0252) + OPCODE (Rgotoifnil, 0253) + OPCODE (Rgotoifnonnil, 0254) + OPCODE (Rgotoifnilelsepop, 0255) + OPCODE (Rgotoifnonnilelsepop, 0256) + + OPCODE (listN, 0257) + OPCODE (concatN, 0260) + OPCODE (insertN, 0261) + + OPCODE (bind_multiple_value_limits, 0262) /* New in 21.5. */ + OPCODE (multiple_value_list_internal, 0263) /* New in 21.5. */ + OPCODE (multiple_value_call, 0264) /* New in 21.5. */ + OPCODE (throw, 0265) /* New in 21.5. */ + + OPCODE (member, 0266) /* new in v20 */ + OPCODE (assq, 0267) /* new in v20 */ + + OPCODE (constant, 0300) + +#undef OPCODE
--- a/src/bytecode.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/bytecode.c Wed Feb 03 21:46:21 2010 -0600 @@ -58,6 +58,8 @@ #include "syntax.h" #include "window.h" +#define NUM_REMEMBERED_BYTE_OPS 100 + #ifdef NEW_GC static Lisp_Object make_compiled_function_args (int totalargs) @@ -101,169 +103,104 @@ Lisp_Object Qbyte_code, Qcompiled_functionp, Qinvalid_byte_code; + enum Opcode /* Byte codes */ { - Bvarref = 010, - Bvarset = 020, - Bvarbind = 030, - Bcall = 040, - Bunbind = 050, - - Bnth = 070, - Bsymbolp = 071, - Bconsp = 072, - Bstringp = 073, - Blistp = 074, - Bold_eq = 075, - Bold_memq = 076, - Bnot = 077, - Bcar = 0100, - Bcdr = 0101, - Bcons = 0102, - Blist1 = 0103, - Blist2 = 0104, - Blist3 = 0105, - Blist4 = 0106, - Blength = 0107, - Baref = 0110, - Baset = 0111, - Bsymbol_value = 0112, - Bsymbol_function = 0113, - Bset = 0114, - Bfset = 0115, - Bget = 0116, - Bsubstring = 0117, - Bconcat2 = 0120, - Bconcat3 = 0121, - Bconcat4 = 0122, - Bsub1 = 0123, - Badd1 = 0124, - Beqlsign = 0125, - Bgtr = 0126, - Blss = 0127, - Bleq = 0130, - Bgeq = 0131, - Bdiff = 0132, - Bnegate = 0133, - Bplus = 0134, - Bmax = 0135, - Bmin = 0136, - Bmult = 0137, - - Bpoint = 0140, - Beq = 0141, /* was Bmark, - but no longer generated as of v18 */ - Bgoto_char = 0142, - Binsert = 0143, - Bpoint_max = 0144, - Bpoint_min = 0145, - Bchar_after = 0146, - Bfollowing_char = 0147, - Bpreceding_char = 0150, - Bcurrent_column = 0151, - Bindent_to = 0152, - Bequal = 0153, /* was Bscan_buffer, - but no longer generated as of v18 */ - Beolp = 0154, - Beobp = 0155, - Bbolp = 0156, - Bbobp = 0157, - Bcurrent_buffer = 0160, - Bset_buffer = 0161, - Bsave_current_buffer = 0162, /* was Bread_char, - but no longer generated as of v19 */ - Bmemq = 0163, /* was Bset_mark, - but no longer generated as of v18 */ - Binteractive_p = 0164, /* Needed since interactive-p takes - unevalled args */ - Bforward_char = 0165, - Bforward_word = 0166, - Bskip_chars_forward = 0167, - Bskip_chars_backward = 0170, - Bforward_line = 0171, - Bchar_syntax = 0172, - Bbuffer_substring = 0173, - Bdelete_region = 0174, - Bnarrow_to_region = 0175, - Bwiden = 0176, - Bend_of_line = 0177, - - Bconstant2 = 0201, - Bgoto = 0202, - Bgotoifnil = 0203, - Bgotoifnonnil = 0204, - Bgotoifnilelsepop = 0205, - Bgotoifnonnilelsepop = 0206, - Breturn = 0207, - Bdiscard = 0210, - Bdup = 0211, - - Bsave_excursion = 0212, - Bsave_window_excursion= 0213, - Bsave_restriction = 0214, - Bcatch = 0215, - - Bunwind_protect = 0216, - Bcondition_case = 0217, - Btemp_output_buffer_setup = 0220, - Btemp_output_buffer_show = 0221, - - Bunbind_all = 0222, - - Bset_marker = 0223, - Bmatch_beginning = 0224, - Bmatch_end = 0225, - Bupcase = 0226, - Bdowncase = 0227, - - Bstring_equal = 0230, - Bstring_lessp = 0231, - Bold_equal = 0232, - Bnthcdr = 0233, - Belt = 0234, - Bold_member = 0235, - Bold_assq = 0236, - Bnreverse = 0237, - Bsetcar = 0240, - Bsetcdr = 0241, - Bcar_safe = 0242, - Bcdr_safe = 0243, - Bnconc = 0244, - Bquo = 0245, - Brem = 0246, - Bnumberp = 0247, - Bfixnump = 0250, /* Was Bintegerp. */ - - BRgoto = 0252, - BRgotoifnil = 0253, - BRgotoifnonnil = 0254, - BRgotoifnilelsepop = 0255, - BRgotoifnonnilelsepop = 0256, - - BlistN = 0257, - BconcatN = 0260, - BinsertN = 0261, - - Bbind_multiple_value_limits = 0262, /* New in 21.5. */ - Bmultiple_value_list_internal = 0263, /* New in 21.5. */ - Bmultiple_value_call = 0264, /* New in 21.5. */ - Bthrow = 0265, /* New in 21.5. */ - - Bmember = 0266, /* new in v20 */ - Bassq = 0267, /* new in v20 */ - - Bconstant = 0300 +#define OPCODE(sym, val) B##sym = val, +#include "bytecode-ops.h" }; typedef enum Opcode Opcode; - Lisp_Object * execute_rare_opcode (Lisp_Object *stack_ptr, +#ifdef ERROR_CHECK_BYTE_CODE + Lisp_Object *stack_beg, + Lisp_Object *stack_end, +#endif /* ERROR_CHECK_BYTE_CODE */ const Opbyte *program_ptr, Opcode opcode); -/* Define BYTE_CODE_METER to enable generation of a byte-op usage histogram. - This isn't defined in FSF Emacs and isn't defined in XEmacs v19. */ -/* #define BYTE_CODE_METER */ +#ifndef ERROR_CHECK_BYTE_CODE + +# define bytecode_assert(x) disabled_assert (x) +# define bytecode_assert_with_message(x, msg) disabled_assert(x) +# define bytecode_abort_with_message(msg) abort_with_message (msg) + +#else /* ERROR_CHECK_BYTE_CODE */ + +# define bytecode_assert(x) \ + ((x) ? (void) 0 : assert_failed_with_remembered_ops (__FILE__, __LINE__, #x)) +# define bytecode_assert_with_message(x, msg) \ + ((x) ? (void) 0 : assert_failed_with_remembered_ops (__FILE__, __LINE__, msg)) +# define bytecode_abort_with_message(msg) \ + assert_failed_with_remembered_ops (__FILE__, __LINE__, msg) + +/* Table mapping opcodes to their names. This handles opcodes like + Bvarref+7, but it doesn't list any of the Bconstant+N opcodes; those + are handled specially. */ +Ascbyte *opcode_name_table[256]; + +/* Circular queue remembering the most recent operations. */ +Opcode remembered_ops[NUM_REMEMBERED_BYTE_OPS]; +int remembered_op_next_pos, num_remembered; + +static void +remember_operation (Opcode op) +{ + remembered_ops[remembered_op_next_pos] = op; + remembered_op_next_pos = + (remembered_op_next_pos + 1) % NUM_REMEMBERED_BYTE_OPS; + if (num_remembered < NUM_REMEMBERED_BYTE_OPS) + num_remembered++; +} + +static void +assert_failed_with_remembered_ops (const Ascbyte *file, int line, + Ascbyte *msg_to_abort_with) +{ + Ascbyte *msg = + alloca_array (Ascbyte, + NUM_REMEMBERED_BYTE_OPS*50 + strlen (msg_to_abort_with)); + int i; + + if (msg_to_abort_with) + strcpy (msg, msg_to_abort_with); + strcat (msg, "\n\nRecent bytecodes, oldest first:\n\n"); + + for (i = 0; i < num_remembered; i++) + { + Ascbyte msg2[50]; + int pos; + Opcode op; + + sprintf (msg2, "%5d: ", i - num_remembered + 1); + strcat (msg, msg2); + pos = (remembered_op_next_pos + NUM_REMEMBERED_BYTE_OPS + + i - num_remembered) % NUM_REMEMBERED_BYTE_OPS; + op = remembered_ops[pos]; + if (op >= Bconstant) + { + sprintf (msg2, "constant+%d", op - Bconstant); + strcat (msg, msg2); + } + else + { + Ascbyte *opname = opcode_name_table[op]; + if (!opname) + { + stderr_out ("Internal error! NULL pointer in opcode_name_table, opcode %d\n", op); + strcat (msg, "NULL"); + } + else + strcat (msg, opname); + } + sprintf (msg2, " (%d)\n", op); + strcat (msg, msg2); + } + + assert_failed (file, line, msg); +} + +#endif /* ERROR_CHECK_BYTE_CODE */ #ifdef BYTE_CODE_METER @@ -619,72 +556,127 @@ } + +/*********************** The instruction array *********************/ + +/* Check that there are at least LEN elements left in the end of the + instruction array before fetching them. Note that we allow for + PROGRAM_PTR == PROGRAM_END after the fetch -- that means there are + no more elements to fetch next time around, but we might exit before + next time comes. + + When checking the destination if jumps, however, we don't allow + PROGRAM_PTR to equal PROGRAM_END, since we will always be fetching + another instruction after the jump. */ + +#define CHECK_OPCODE_SPACE(len) \ + bytecode_assert (program_ptr + len <= program_end) + /* Read next uint8 from the instruction stream. */ -#define READ_UINT_1 ((unsigned int) (unsigned char) *program_ptr++) +#define READ_UINT_1 \ + (CHECK_OPCODE_SPACE (1), (unsigned int) (unsigned char) *program_ptr++) /* Read next uint16 from the instruction stream. */ #define READ_UINT_2 \ - (program_ptr += 2, \ + (CHECK_OPCODE_SPACE (2), \ + program_ptr += 2, \ (((unsigned int) (unsigned char) program_ptr[-1]) * 256 + \ ((unsigned int) (unsigned char) program_ptr[-2]))) /* Read next int8 from the instruction stream. */ -#define READ_INT_1 ((int) (signed char) *program_ptr++) +#define READ_INT_1 \ + (CHECK_OPCODE_SPACE (1), (int) (signed char) *program_ptr++) /* Read next int16 from the instruction stream. */ #define READ_INT_2 \ - (program_ptr += 2, \ + (CHECK_OPCODE_SPACE (2), \ + program_ptr += 2, \ (((int) ( signed char) program_ptr[-1]) * 256 + \ ((int) (unsigned char) program_ptr[-2]))) /* Read next int8 from instruction stream; don't advance program_pointer */ -#define PEEK_INT_1 ((int) (signed char) program_ptr[0]) +#define PEEK_INT_1 \ + (CHECK_OPCODE_SPACE (1), (int) (signed char) program_ptr[0]) /* Read next int16 from instruction stream; don't advance program_pointer */ #define PEEK_INT_2 \ - ((((int) ( signed char) program_ptr[1]) * 256) | \ + (CHECK_OPCODE_SPACE (2), \ + (((int) ( signed char) program_ptr[1]) * 256) | \ ((int) (unsigned char) program_ptr[0])) /* Do relative jumps from the current location. We only do a QUIT if we jump backwards, for efficiency. No infloops without backward jumps! */ -#define JUMP_RELATIVE(jump) do { \ - int JR_jump = (jump); \ - if (JR_jump < 0) QUIT; \ - program_ptr += JR_jump; \ +#define JUMP_RELATIVE(jump) do { \ + int _JR_jump = (jump); \ + if (_JR_jump < 0) QUIT; \ + /* Check that where we're going to is in range. Note that we don't use \ + CHECK_OPCODE_SPACE() -- that only checks the end, and it allows \ + program_ptr == program_end, which we don't allow. */ \ + bytecode_assert (program_ptr + _JR_jump >= program && \ + program_ptr + _JR_jump < program_end); \ + program_ptr += _JR_jump; \ } while (0) #define JUMP JUMP_RELATIVE (PEEK_INT_2) #define JUMPR JUMP_RELATIVE (PEEK_INT_1) -#define JUMP_NEXT ((void) (program_ptr += 2)) -#define JUMPR_NEXT ((void) (program_ptr += 1)) +#define JUMP_NEXT (CHECK_OPCODE_SPACE (2), (void) (program_ptr += 2)) +#define JUMPR_NEXT (CHECK_OPCODE_SPACE (1), (void) (program_ptr += 1)) + +/*********************** The stack array *********************/ + +/* NOTE: The stack array doesn't work quite like you'd expect. + + STACK_PTR points to the value on the top of the stack. Popping a value + fetches the value from the STACK_PTR and then decrements it. Pushing a + value first increments it, then writes the new value. STACK_PTR - + STACK_BEG is the number of elements on the stack. + + This means that when STACK_PTR == STACK_BEG, the stack is empty, and + the space at STACK_BEG is never written to -- the first push will write + into the space directly after STACK_BEG. This is why the call to + alloca_array() below has a count of `stack_depth + 1', and why + we GCPRO1 (stack_ptr[1]) -- the value at stack_ptr[0] is unused and + uninitialized. + + Also, STACK_END actually points to the last usable storage location, + and does not point past the end, like you'd expect. */ + +#define CHECK_STACKPTR_OFFSET(len) \ + bytecode_assert (stack_ptr + (len) >= stack_beg && \ + stack_ptr + (len) <= stack_end) /* Push x onto the execution stack. */ -#define PUSH(x) (*++stack_ptr = (x)) +#define PUSH(x) (CHECK_STACKPTR_OFFSET (1), *++stack_ptr = (x)) /* Pop a value, which may be multiple, off the execution stack. */ -#define POP_WITH_MULTIPLE_VALUES (*stack_ptr--) +#define POP_WITH_MULTIPLE_VALUES (CHECK_STACKPTR_OFFSET (-1), *stack_ptr--) /* Pop a value off the execution stack, treating multiple values as single. */ #define POP (IGNORE_MULTIPLE_VALUES (POP_WITH_MULTIPLE_VALUES)) -#define DISCARD_PRESERVING_MULTIPLE_VALUES(n) (stack_ptr -= (n)) +/* ..._UNSAFE() means it evaluates its argument more than once. */ +#define DISCARD_PRESERVING_MULTIPLE_VALUES_UNSAFE(n) \ + (CHECK_STACKPTR_OFFSET (-(n)), stack_ptr -= (n)) /* Discard n values from the execution stack. */ #define DISCARD(n) do { \ + int _discard_n = (n); \ if (1 != multiple_value_current_limit) \ { \ - int i, en = n; \ - for (i = 0; i < en; i++) \ + int i; \ + for (i = 0; i < _discard_n; i++) \ { \ + CHECK_STACKPTR_OFFSET (-1); \ *stack_ptr = ignore_multiple_values (*stack_ptr); \ stack_ptr--; \ } \ } \ else \ { \ - stack_ptr -= (n); \ + CHECK_STACKPTR_OFFSET (-_discard_n); \ + stack_ptr -= _discard_n; \ } \ } while (0) @@ -705,6 +697,7 @@ /* See comment before the big switch in execute_optimized_program(). */ #define GCPRO_STACK (gcpro1.nvars = stack_ptr - stack_beg) + /* The actual interpreter for byte code. This function has been seriously optimized for performance. Don't change the constructs unless you are willing to do @@ -713,18 +706,25 @@ Lisp_Object execute_optimized_program (const Opbyte *program, +#ifdef ERROR_CHECK_BYTE_CODE + Elemcount program_length, +#endif int stack_depth, Lisp_Object *constants_data) { /* This function can GC */ REGISTER const Opbyte *program_ptr = (Opbyte *) program; +#ifdef ERROR_CHECK_BYTE_CODE + const Opbyte *program_end = program_ptr + program_length; +#endif + /* See comment above explaining the `+ 1' */ Lisp_Object *stack_beg = alloca_array (Lisp_Object, stack_depth + 1); REGISTER Lisp_Object *stack_ptr = stack_beg; int speccount = specpdl_depth (); struct gcpro gcpro1; #ifdef BYTE_CODE_METER - Opcode this_opcode = 0; + Opcode this_opcode = (Opcode) 0; Opcode prev_opcode; #endif @@ -759,13 +759,22 @@ return from the interpreter do we need to finalize the struct gcpro itself, and that's done at case Breturn. */ + + /* See comment above explaining the `[1]' */ GCPRO1 (stack_ptr[1]); while (1) { REGISTER Opcode opcode = (Opcode) READ_UINT_1; +#ifdef ERROR_CHECK_BYTE_CODE + remember_operation (opcode); +#endif + GCPRO_STACK; /* Get nvars right before maybe signaling. */ + /* #### NOTE: This code should probably never get triggered, since we + now catch the problems earlier, farther down, before we ever set + a bad value for STACK_PTR. */ #ifdef ERROR_CHECK_BYTE_CODE if (stack_ptr > stack_end) stack_overflow ("byte code stack overflow", Qunbound); @@ -790,7 +799,13 @@ { /* We're not sure what these do, so better safe than sorry. */ /* GCPRO_STACK; */ - stack_ptr = execute_rare_opcode (stack_ptr, program_ptr, opcode); + stack_ptr = execute_rare_opcode (stack_ptr, +#ifdef ERROR_CHECK_BYTE_CODE + stack_beg, + stack_end, +#endif /* ERROR_CHECK_BYTE_CODE */ + program_ptr, opcode); + CHECK_STACKPTR_OFFSET (0); } break; @@ -1438,6 +1453,10 @@ Don't make this function static, since then the compiler might inline it. */ Lisp_Object * execute_rare_opcode (Lisp_Object *stack_ptr, +#ifdef ERROR_CHECK_BYTE_CODE + Lisp_Object *stack_beg, + Lisp_Object *stack_end, +#endif /* ERROR_CHECK_BYTE_CODE */ const Opbyte *UNUSED (program_ptr), Opcode opcode) { @@ -1445,7 +1464,7 @@ switch (opcode) { - + case Bsave_excursion: record_unwind_protect (save_excursion_restore, save_excursion_save ()); @@ -1714,7 +1733,7 @@ case Bmultiple_value_call: { n = XINT (POP); - DISCARD_PRESERVING_MULTIPLE_VALUES (n - 1); + DISCARD_PRESERVING_MULTIPLE_VALUES_UNSAFE (n - 1); /* Discard multiple values for the first (function) argument: */ TOP_LVALUE = TOP; TOP_LVALUE = multiple_value_call (n, TOP_ADDRESS); @@ -1723,7 +1742,7 @@ case Bmultiple_value_list_internal: { - DISCARD_PRESERVING_MULTIPLE_VALUES (3); + DISCARD_PRESERVING_MULTIPLE_VALUES_UNSAFE (3); TOP_LVALUE = multiple_value_list_internal (4, TOP_ADDRESS); break; } @@ -1738,7 +1757,11 @@ } default: - ABORT(); + { + Ascbyte msg[100]; + sprintf (msg, "Unknown opcode %d", opcode); + bytecode_abort_with_message (msg); + } break; } return stack_ptr; @@ -1862,8 +1885,8 @@ Lisp_Object constants, /* out */ Opbyte * const program, - int * const program_length, - int * const varbind_count) + Elemcount * const program_length, + Elemcount * const varbind_count) { Bytecount instructions_length = XSTRING_LENGTH (instructions); Elemcount comfy_size = (Elemcount) (2 * instructions_length); @@ -2127,8 +2150,8 @@ optimize_compiled_function (Lisp_Object compiled_function) { Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (compiled_function); - int program_length; - int varbind_count; + Elemcount program_length; + Elemcount varbind_count; Opbyte *program; { @@ -2700,8 +2723,8 @@ (instructions, constants, stack_depth)) { /* This function can GC */ - int varbind_count; - int program_length; + Elemcount varbind_count; + Elemcount program_length; Opbyte *program; CHECK_STRING (instructions); @@ -2716,6 +2739,9 @@ &program_length, &varbind_count); SPECPDL_RESERVE (varbind_count); return execute_optimized_program (program, +#ifdef ERROR_CHECK_BYTE_CODE + program_length, +#endif XINT (stack_depth), XVECTOR_DATA (constants)); } @@ -2758,7 +2784,6 @@ vars_of_bytecode (void) { #ifdef BYTE_CODE_METER - DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter /* A vector of vectors which holds a histogram of byte code usage. \(aref (aref byte-code-meter 0) CODE) indicates how many times the byte @@ -2783,3 +2808,57 @@ } #endif /* BYTE_CODE_METER */ } + +#ifdef ERROR_CHECK_BYTE_CODE + +/* Initialize the opcodes in the table that correspond to a base opcode + plus an offset (except for Bconstant). */ + +static void +init_opcode_table_multi_op (Opcode op) +{ + Ascbyte *basename = opcode_name_table[op]; + Ascbyte temp[300]; + int i; + + for (i = 1; i < 7; i++) + { + assert (!opcode_name_table[op + i]); + sprintf (temp, "%s+%d", basename, i); + opcode_name_table[op + i] = xstrdup (temp); + } +} + +#endif /* ERROR_CHECK_BYTE_CODE */ + +void +reinit_vars_of_bytecode (void) +{ +#ifdef ERROR_CHECK_BYTE_CODE + int i; + +#define OPCODE(sym, val) opcode_name_table[val] = xstrdup (#sym); +#include "bytecode-ops.h" + + for (i = 0; i < countof (opcode_name_table); i++) + { + int j; + Ascbyte *name = opcode_name_table[i]; + if (name) + { + Bytecount len = strlen (name); + /* Prettify the name by converting underscores to hyphens, similar + to what happens with DEFSYMBOL. */ + for (j = 0; j < len; j++) + if (name[j] == '_') + name[j] = '-'; + } + } + + init_opcode_table_multi_op (Bvarref); + init_opcode_table_multi_op (Bvarset); + init_opcode_table_multi_op (Bvarbind); + init_opcode_table_multi_op (Bcall); + init_opcode_table_multi_op (Bunbind); +#endif /* ERROR_CHECK_BYTE_CODE */ +}
--- a/src/bytecode.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/bytecode.h Wed Feb 03 21:46:21 2010 -0600 @@ -67,8 +67,19 @@ #define COMPILED_INTERACTIVE 5 #define COMPILED_DOMAIN 6 -/* It doesn't make sense to have this and also have load-history */ -/* #define COMPILED_FUNCTION_ANNOTATION_HACK */ +/* Someone claims: [[ It doesn't make sense to have this and also have + load-history ]] But in fact they are quite different things. Perhaps + we should turn this on only when DEBUG_XEMACS but there's no speed + harm at all, so no reason not to do it always. */ +#define COMPILED_FUNCTION_ANNOTATION_HACK + +#ifdef DEBUG_XEMACS +/* Define BYTE_CODE_METER to enable generation of a byte-op usage + histogram. This isn't defined in FSF Emacs and isn't defined in XEmacs + v19. But this is precisely the thing to turn on when DEBUG_XEMACS. It + may lead to a slight speed penalty but nothing major. */ +#define BYTE_CODE_METER +#endif struct Lisp_Compiled_Function { @@ -131,6 +142,9 @@ typedef unsigned char Opbyte; Lisp_Object execute_optimized_program (const Opbyte *program, +#ifdef ERROR_CHECK_BYTE_CODE + Elemcount program_length, +#endif int stack_depth, Lisp_Object *constants_data);
--- a/src/compiler.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/compiler.h Wed Feb 03 21:46:21 2010 -0600 @@ -238,7 +238,7 @@ # else # define USED_IF_MULE(decl) UNUSED (decl) # endif -# ifdef USE_XFT +# ifdef HAVE_XFT # define USED_IF_XFT(decl) decl # else # define USED_IF_XFT(decl) UNUSED (decl)
--- a/src/config.h.in Wed Feb 03 21:06:14 2010 -0600 +++ b/src/config.h.in Wed Feb 03 21:46:21 2010 -0600 @@ -217,11 +217,11 @@ #undef HAVE_FCCONFIGSETRESCANINTERVAL /* Compile with support for Xft? */ -#undef USE_XFT +#undef HAVE_XFT /* Per-widget stuff will go away? */ -#undef USE_XFT_MENUBARS -#undef USE_XFT_TABS -#undef USE_XFT_GAUGES +#undef HAVE_XFT_MENUBARS +#undef HAVE_XFT_TABS +#undef HAVE_XFT_GAUGES /* Defines for building X applications */ #ifdef HAVE_X_WINDOWS
--- a/src/console-x-impl.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/console-x-impl.h Wed Feb 03 21:46:21 2010 -0600 @@ -316,7 +316,7 @@ #endif /* XIM_XLIB */ #endif /* HAVE_XIM */ -#ifdef USE_XFT +#ifdef HAVE_XFT /* The Xft Drawable wrapper for this device. #### Should this be per-device, or per-frame? */ /* This is persistent to take advantage of the ability of Xft's glyph @@ -386,7 +386,7 @@ #define FRAME_X_GEOM_FREE_ME_PLEASE(f) (FRAME_X_DATA (f)->geom_free_me_please) -#ifdef USE_XFT +#ifdef HAVE_XFT #define FRAME_X_XFTDRAW(f) (FRAME_X_DATA (f)->xftDraw) #endif
--- a/src/console-x.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/console-x.h Wed Feb 03 21:46:21 2010 -0600 @@ -51,7 +51,7 @@ #include <X11/xpm.h> #endif -#ifdef USE_XFT +#ifdef HAVE_XFT /* shut up GCC */ #define face_index face_index_arg #define glyph_index glyph_index_arg
--- a/src/console-xlike-inc.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/console-xlike-inc.h Wed Feb 03 21:46:21 2010 -0600 @@ -34,17 +34,29 @@ would lead to a large number of very small functions and very hard-to-read code. - Instead, we handle the situation by having only one copy, placed in a - file called *-xlike-inc.c (e.g. redisplay-xlike-inc.c) and - conditionalizing using ifdefs. Because we can compile with both X and - GTK at once, we include this file inside of the appropriate - device-specific file (e.g. redisplay-gtk.c or redisplay-x.c). The `inc' - in *-xlike-inc.c indicates that this is a file meant to be included in - another file, despite the fact that it is a .c file. + Instead, we handle the situation by the following: + + (1) In cases where there are lots of individual differences, we have + only one copy, placed in a file called *-xlike-inc.c + (e.g. redisplay-xlike-inc.c), and conditionalize using ifdefs. Because + we can compile with both X and GTK at once, we include this file inside + of the appropriate device-specific file (e.g. redisplay-gtk.c or + redisplay-x.c). The `inc' in *-xlike-inc.c indicates that this is a + file meant to be included in another file, despite the fact that it is a + .c file. To signal which variety of "xlike" we are compiling for, either THIS_IS_X or THIS_IS_GTK needs to be defined, prior to including the - *-xlike-inc.c file. */ + *-xlike-inc.c file. + + (2) For code that is identical in both versions, or where it's possible + to have only one copy at runtime through some other means, we name + the file *-xlike.c. This is a normal file, not included in some other + file. An example of "other means" is toolbar-xlike.c, where all + functions are passed a frame or device, and it's possible to do run-time + conditionalization based on the device type. (This isn't currently the + case but will be soon once the related changes from my `hg-fixup' + workspace are checked in. --ben) */ /* About the representation of color below: @@ -72,7 +84,7 @@ #ifdef THIS_IS_X # include "console-x-impl.h" # ifdef NEED_GCCACHE_H -# include "xgccache.h" +# include "gccache-x.h" # endif # ifdef NEED_GLYPHS_H # include "glyphs-x.h" @@ -93,6 +105,20 @@ # endif #endif /* THIS_IS_GTK */ +/* Just because we have XFT support doesn't mean we should use it. + In particular, the xlike routines are used by both X and GTK code, + but XFT stuff is X-specific. HAVE_XFT will still be defined when + the GTK flavor is active, but we don't want to trigger the XFT code + in this case. We could just undefine HAVE_XFT but I'd rather make + it clearer that something else is going on. --ben */ + +#if defined (THIS_IS_X) && defined (HAVE_XFT) +#define USE_XFT +#define USE_XFT_MENUBARS +#define USE_XFT_TABS +#define USE_XFT_GAUGES +#endif + /***************************************************************************/ /* Common definitions */ /***************************************************************************/
--- a/src/depend Wed Feb 03 21:06:14 2010 -0600 +++ b/src/depend Wed Feb 03 21:46:21 2010 -0600 @@ -32,8 +32,9 @@ #endif #if defined(HAVE_XLIKE) event-xlike-inc.o: -objects-xlike-inc.o: $(LWLIB_SRCDIR)/lwlib.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h gccache-gtk.h glyphs-gtk.h glyphs-x.h glyphs.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h sysgtk.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h -redisplay-xlike-inc.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h +objects-xlike-inc.o: $(LWLIB_SRCDIR)/lwlib.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h gccache-gtk.h gccache-x.h glyphs-gtk.h glyphs-x.h glyphs.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h sysgtk.h window-impl.h window.h winslots.h xintrinsic.h +redisplay-xlike-inc.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h +toolbar-xlike.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h toolbar-xlike.h toolbar.h vdb.h window-impl.h window.h winslots.h xintrinsic.h #endif #if defined(HAVE_X_WINDOWS) EmacsFrame.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h charset.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h @@ -43,19 +44,19 @@ balloon-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h balloon_help.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h specifier.h symeval.h symsinit.h text.h vdb.h xintrinsic.h balloon_help.o: $(CONFIG_H) balloon_help.h compiler.h xintrinsic.h console-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h elhash.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h process.h redisplay.h specifier.h symeval.h symsinit.h text.h vdb.h xintrinsic.h -device-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h elhash.h events.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h intl-auto-encap-win32.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysdll.h sysfile.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h +device-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h elhash.h events.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-x.h general-slots.h glyphs-x.h glyphs.h intl-auto-encap-win32.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysdll.h sysfile.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h dialog-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h dumper.h events.h frame-impl.h frame.h frameslots.h gc.h general-slots.h gui.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window.h xintrinsic.h frame-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h EmacsShell.h ExternalShell.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h dumper.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h gutter.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar-x.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h +gccache-x.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h gccache-x.h general-slots.h hash.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h glyphs-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h gui.h imgproc.h insdel.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects-x-impl.h objects-x.h objects.h opaque.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xmotif.h gui-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h events.h frame.h gc.h general-slots.h glyphs.h gui.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xmotif.h intl-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h compiler.h console-x.h console.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h xintrinsic.h menubar-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h events.h frame-impl.h frame.h frameslots.h gc.h general-slots.h gui.h keymap-buttons.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h -objects-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h device-impl.h device.h devslots.h dumper.h elhash.h font-mgr.h gc.h gccache-gtk.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects-xlike-inc.c objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h -redisplay-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay-xlike-inc.c redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h +objects-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h device-impl.h device.h devslots.h dumper.h elhash.h font-mgr.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects-xlike-inc.c objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h +redisplay-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay-xlike-inc.c redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h scrollbar-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar-x.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h select-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h opaque.h redisplay.h select-common.h select.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h xintrinsic.h xmotif.h -toolbar-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h charset.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h dumper.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h toolbar-common.h toolbar.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h -xgccache.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h hash.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h xgccache.h +toolbar-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h charset.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h dumper.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h toolbar-xlike.h toolbar.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h #endif #if defined(HAVE_TTY) console-tty.o: $(CONFIG_H) $(LISP_H) charset.h coding-system-slots.h compiler.h conslots.h console-impl.h console-stream.h console-tty-impl.h console-tty.h console.h dumper.h elhash.h faces.h file-coding.h frame.h gc.h general-slots.h glyphs.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systty.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h @@ -81,11 +82,11 @@ gui-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h frame.h gc.h general-slots.h gui.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h specifier.h symeval.h symsinit.h sysgtk.h text.h vdb.h menubar-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h events.h frame-impl.h frame.h frameslots.h gc.h general-slots.h gui.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdll.h sysgtk.h systime.h text.h ui-gtk.h vdb.h window-impl.h window.h winslots.h native-gtk-toolbar.o: $(CONFIG_H) $(LISP_H) charset.h compiler.h console-gtk.h console.h dumper.h faces.h frame.h gc.h general-slots.h glyphs-gtk.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h -objects-gtk.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h device-impl.h device.h devslots.h dumper.h gc.h gccache-gtk.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects-xlike-inc.c objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgdkx.h sysgtk.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h -redisplay-gtk.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay-xlike-inc.c redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgdkx.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h +objects-gtk.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h device-impl.h device.h devslots.h dumper.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects-xlike-inc.c objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgdkx.h sysgtk.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h +redisplay-gtk.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay-xlike-inc.c redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgdkx.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h scrollbar-gtk.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-gtk.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h vdb.h window-impl.h window.h winslots.h select-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h events.h frame.h gc.h general-slots.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h select-common.h select.h specifier.h symeval.h symsinit.h sysgtk.h systime.h text.h vdb.h -toolbar-gtk.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h dumper.h frame.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h specifier.h symeval.h symsinit.h sysgtk.h text.h toolbar-common.h vdb.h +toolbar-gtk.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h dumper.h frame.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h specifier.h symeval.h symsinit.h sysgtk.h text.h toolbar-xlike.h vdb.h ui-byhand.o: gui.h ui-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device.h dumper.h elhash.h emacs-marshals.c emacs-widget-accessors.c events.h faces.h gc.h general-slots.h glade.c glyphs-gtk.h glyphs.h gtk-glue.c gui.h hash.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdll.h sysgtk.h systime.h text.h ui-byhand.c ui-gtk.h vdb.h window-impl.h window.h winslots.h #endif @@ -111,7 +112,7 @@ alsaplay.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h blocktype.o: $(CONFIG_H) $(LISP_H) blocktype.h compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h buffer.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h commands.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h elhash.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h insdel.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h ndir.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h select.h specifier.h symeval.h symsinit.h syntax.h sysdir.h sysfile.h syswindows.h text.h vdb.h window.h -bytecode.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h symeval.h symsinit.h syntax.h text.h vdb.h window.h +bytecode.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode-ops.h bytecode.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h symeval.h symsinit.h syntax.h text.h vdb.h window.h callint.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h compiler.h dumper.h events.h gc.h general-slots.h insdel.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h casefiddle.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h syntax.h text.h vdb.h casetab.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h symeval.h symsinit.h text.h vdb.h @@ -225,7 +226,7 @@ strftime.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h sunplay.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysdep.h sysfile.h syssignal.h syswindows.h text.h vdb.h sunpro.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h -symbols.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h dumper.h elhash.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h specifier.h symeval.h symsinit.h text.h vdb.h +symbols.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h dumper.h elhash.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h specifier.h symeval.h symsinit.h text.h vdb.h syntax.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h extents.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h syntax.h text.h vdb.h sysdep.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h dumper.h events.h frame.h gc.h general-slots.h intl-auto-encap-win32.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h ndir.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h systty.h syswait.h syswindows.h text.h vdb.h window.h sysdll.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h sysdll.h sysfile.h syswindows.h text.h vdb.h @@ -233,7 +234,6 @@ terminfo.o: $(CONFIG_H) tests.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h elhash.h file-coding.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h symeval.h symsinit.h text.h vdb.h text.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h file-coding.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h profile.h symeval.h symsinit.h text.h vdb.h -toolbar-common.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h toolbar-common.h toolbar.h vdb.h window-impl.h window.h winslots.h xintrinsic.h toolbar.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h tooltalk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h elhash.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h process.h symeval.h symsinit.h syssignal.h text.h tooltalk.h vdb.h tparam.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h
--- a/src/device-x.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/device-x.c Wed Feb 03 21:46:21 2010 -0600 @@ -53,7 +53,7 @@ #include <X11/CoreP.h> /* Numerous places access the fields of a core widget directly. We could use XtGetValues(), but ... */ -#include "xgccache.h" +#include "gccache-x.h" #include <X11/Shell.h> #include <X11/Xmu/Error.h>
--- a/src/emacs.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/emacs.c Wed Feb 03 21:46:21 2010 -0600 @@ -391,7 +391,7 @@ sysdep.c (maybe; wait_for_termination) unexec.c unicode.c - xgccache.c (a bit) + gccache-x.c (a bit) #### review .h files; write a perl program to look for long comments throughout the files, ignoring stuff inside of DEFUN's. @@ -1641,7 +1641,7 @@ #endif #endif /* HAVE_XIM */ -#ifdef USE_XFT +#ifdef HAVE_XFT syms_of_font_mgr(); #endif @@ -2225,7 +2225,7 @@ vars_of_gui_x (); #endif -#ifdef USE_XFT +#ifdef HAVE_XFT vars_of_font_mgr (); #endif @@ -2296,6 +2296,7 @@ /* Now do additional vars_of_*() initialization that happens both at dump time and after pdump load. */ reinit_vars_of_buffer (); + reinit_vars_of_bytecode (); reinit_vars_of_console (); #ifdef DEBUG_XEMACS reinit_vars_of_debug (); @@ -2355,7 +2356,7 @@ #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_X_DIALOGS) || defined (HAVE_TOOLBARS) reinit_vars_of_gui_x (); #endif -#ifdef USE_XFT +#ifdef HAVE_XFT reinit_vars_of_font_mgr (); #endif #endif /* HAVE_X_WINDOWS */ @@ -2428,7 +2429,7 @@ quite soon, e.g. in complex_vars_of_glyphs_x(). */ inhibit_non_essential_conversion_operations = 0; -#ifdef USE_XFT +#ifdef HAVE_XFT /* This uses coding systems. Must be done before faces are init'ed. */ /* not in xft reloaded #3 */ complex_vars_of_font_mgr ();
--- a/src/eval.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/eval.c Wed Feb 03 21:46:21 2010 -0600 @@ -3620,6 +3620,10 @@ { Lisp_Object value = execute_optimized_program ((Opbyte *) XOPAQUE_DATA (f->instructions), +#ifdef ERROR_CHECK_BYTE_CODE + XOPAQUE_SIZE (f->instructions) / + sizeof (Opbyte), +#endif f->stack_depth, XVECTOR_DATA (f->constants));
--- a/src/faces.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/faces.c Wed Feb 03 21:46:21 2010 -0600 @@ -2272,12 +2272,12 @@ Lisp_Object device_symbol = Qx; #endif -#if defined (USE_XFT) || defined (MULE) +#if defined (HAVE_XFT) || defined (MULE) const Ascbyte **fontptr; const Ascbyte *fonts[] = { -#ifdef USE_XFT +#ifdef HAVE_XFT /************** Xft fonts *************/ /* Note that fontconfig can search for several font families in one @@ -2302,7 +2302,7 @@ "-*-*-medium-r-*-*-*-170-*-*-c-*-*-*", #endif }; -#endif /* defined (USE_XFT) || defined (MULE) */ +#endif /* defined (HAVE_XFT) || defined (MULE) */ #ifdef MULE @@ -2333,13 +2333,13 @@ #endif /* MULE */ -#ifdef USE_XFT +#ifdef HAVE_XFT for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) inst_list = Fcons (Fcons (list1 (device_symbol), build_cistring (*fontptr)), inst_list); -#else /* !USE_XFT */ +#else /* !HAVE_XFT */ inst_list = Fcons (Fcons @@ -2420,7 +2420,7 @@ build_ascstring ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")), inst_list); -#endif /* !USE_XFT */ +#endif /* !HAVE_XFT */ #endif /* HAVE_X_WINDOWS || HAVE_GTK */
--- a/src/font-mgr.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/font-mgr.h Wed Feb 03 21:46:21 2010 -0600 @@ -89,7 +89,7 @@ #endif /* FONTCONFIG_EXPOSE_CONFIG */ -#ifdef USE_XFT +#ifdef HAVE_XFT #ifndef HAVE_FCCONFIGGETRESCANINTERVAL /* Older fontconfig versions misspell this function name. */ @@ -164,8 +164,8 @@ DEBUG_XFT2 (level, "checking if %s handles %s\n", font, lang); \ } while (0) -#else /* USE_XFT */ +#else /* HAVE_XFT */ -#endif /* USE_XFT */ +#endif /* HAVE_XFT */ #endif /* INCLUDED_font_mgr_h_ */
--- a/src/frame-x.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/frame-x.c Wed Feb 03 21:46:21 2010 -0600 @@ -2606,7 +2606,7 @@ DtDndDropUnregister (FRAME_X_TEXT_WIDGET (f)); #endif /* HAVE_CDE */ -#ifdef USE_XFT +#ifdef HAVE_XFT /* If we have an XftDraw structure, we need to free it here. We can't ever have an XftDraw without a Display, so we are safe to free it in here, and we avoid too much playing around with the @@ -2713,7 +2713,7 @@ { if (0) ; -#ifdef USE_XFT +#ifdef HAVE_XFT else if (FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))) { Xt_SET_ARG (al[ac], XtNxftFont,
--- a/src/gccache-gtk.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/gccache-gtk.h Wed Feb 03 21:46:21 2010 -0600 @@ -1,4 +1,4 @@ -/* Efficient caching of X GCs (graphics contexts). +/* Efficient caching of GTK GCs (graphics contexts). Copyright (C) 1993 Free Software Foundation, Inc. @@ -34,4 +34,4 @@ void free_gc_cache (struct gc_cache *cache); GdkGC *gc_cache_lookup (struct gc_cache *, GdkGCValues *, unsigned long mask); -#endif /* _XGCCACHE_H_ */ +#endif /* _GCCACHE_GTK_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gccache-x.c Wed Feb 03 21:46:21 2010 -0600 @@ -0,0 +1,362 @@ +/* Efficient caching of X GCs (graphics contexts). + Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +XEmacs is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Synched up with: Not in FSF. */ + +/* Emacs uses a lot of different display attributes; for example, assume + that only four fonts are in use (normal, bold, italic, and bold-italic). + Then assume that one stipple or background is used for text selections, + and another is used for highlighting mousable regions. That makes 16 + GCs already. Add in the fact that another GC may be needed to display + the text cursor in any of those regions, and you've got 32. Add in + more fonts, and it keeps increasing exponentially. + + We used to keep these GCs in a cache of merged (fully qualified) faces. + However, a lot of other code in xterm.c used XChangeGC of existing GCs, + which is kind of slow and kind of random. Also, managing the face cache + was tricky because it was hard to know when a face was no longer visible + on the frame -- we had to mark all frames as garbaged whenever a face + was changed, which caused an unpleasant amount of flicker (since faces are + created/destroyed (= changed) whenever a frame is created/destroyed. + + So this code maintains a cache at the GC level instead of at the face + level. There is an upper limit on the size of the cache, after which we + will stop creating GCs and start reusing them (reusing the least-recently- + used ones first). So if faces get changed, their GCs will eventually be + recycled. Also more sharing of GCs is possible. + + This code uses hash tables. It could be that, if the cache size is small + enough, a linear search might be faster; but I doubt it, since we need + `equal' comparisons, not `eq', and I expect that the optimal cache size + will be ~100. + + Written by jwz, 14 jun 93 + */ + +#include <config.h> +#include "lisp.h" +#include "hash.h" + +#include "gccache-x.h" + +#define GC_CACHE_SIZE 100 + +#define GCCACHE_HASH + +struct gcv_and_mask { + XGCValues gcv; + unsigned long mask; +}; + +struct gc_cache_cell { + GC gc; + struct gcv_and_mask gcvm; + struct gc_cache_cell *prev, *next; +}; + +struct gc_cache { + Display *dpy; /* used only as arg to XCreateGC/XFreeGC */ + Window window; /* used only as arg to XCreateGC */ + int size; + struct gc_cache_cell *head; + struct gc_cache_cell *tail; +#ifdef GCCACHE_HASH + struct hash_table *table; +#endif + + int create_count; + int delete_count; +}; + +#ifdef GCCACHE_HASH +static Hashcode +gc_cache_hash (const void *arg) +{ + const struct gcv_and_mask *gcvm = (const struct gcv_and_mask *) arg; + unsigned long *longs = (unsigned long *) &gcvm->gcv; + Hashcode hash = gcvm->mask; + int i; + /* This could look at the mask and only use the used slots in the + hash code. That would win in that we wouldn't have to initialize + every slot of the gcv when calling gc_cache_lookup. But we need + the hash function to be as fast as possible; some timings should + be done. */ + for (i = 0; i < (int) (sizeof (XGCValues) / sizeof (unsigned long)); i++) + hash = (hash << 1) ^ *longs++; + return hash; +} + +#endif /* GCCACHE_HASH */ + +static int +gc_cache_eql (const void *arg1, const void *arg2) +{ + /* See comment in gc_cache_hash */ + return !memcmp (arg1, arg2, sizeof (struct gcv_and_mask)); +} + +struct gc_cache * +make_gc_cache (Display *dpy, Window window) +{ + struct gc_cache *cache = xnew (struct gc_cache); + cache->dpy = dpy; + cache->window = window; + cache->size = 0; + cache->head = cache->tail = 0; + cache->create_count = cache->delete_count = 0; +#ifdef GCCACHE_HASH + cache->table = + make_general_hash_table (GC_CACHE_SIZE, gc_cache_hash, gc_cache_eql); +#endif + return cache; +} + +void +free_gc_cache (struct gc_cache *cache) +{ + struct gc_cache_cell *rest, *next; + rest = cache->head; + while (rest) + { + XFreeGC (cache->dpy, rest->gc); + next = rest->next; + xfree (rest, struct gc_cache_cell *); + rest = next; + } +#ifdef GCCACHE_HASH + free_hash_table (cache->table); +#endif + xfree (cache, struct gc_cache *); +} + +GC +gc_cache_lookup (struct gc_cache *cache, XGCValues *gcv, unsigned long mask) +{ + struct gc_cache_cell *cell, *next, *prev; + struct gcv_and_mask gcvm; + +#ifdef DEBUG_XEMACS + (void) describe_gc_cache (cache, DGCCFLAG_DISABLE); +#endif + + if ((!!cache->head) != (!!cache->tail)) ABORT (); + if (cache->head && (cache->head->prev || cache->tail->next)) ABORT (); + + gcvm.mask = mask; + gcvm.gcv = *gcv; /* this copies... */ + +#ifdef GCCACHE_HASH + + /* The intermediate cast fools gcc into not outputting strict-aliasing + complaints */ + if (gethash (&gcvm, cache->table, (const void **) (void *) &cell)) + +#else /* !GCCACHE_HASH */ + + cell = cache->tail; /* start at the end (most recently used) */ + while (cell) + { + if (gc_cache_eql (&gcvm, &cell->gcvm)) + break; + else + cell = cell->prev; + } + + /* #### This whole file needs some serious overhauling. */ + if (!(mask | GCTile) && cell->gc->values.tile) + cell = 0; + else if (!(mask | GCStipple) && cell->gc->values.stipple) + cell = 0; + + if (cell) + +#endif /* !GCCACHE_HASH */ + + { + /* Found a cell. Move this cell to the end of the list, so that it + will be less likely to be collected than a cell that was accessed + less recently. + */ +#if 0 + debug_out ("Returning cached GC: %08lx\n", XE_GCONTEXT(cell)); +#endif + if (cell == cache->tail) + return cell->gc; + + next = cell->next; + prev = cell->prev; + if (prev) prev->next = next; + if (next) next->prev = prev; + if (cache->head == cell) cache->head = next; + cell->next = 0; + cell->prev = cache->tail; + cache->tail->next = cell; + cache->tail = cell; + if (cache->head == cell) ABORT (); + if (cell->next) ABORT (); + if (cache->head->prev) ABORT (); + if (cache->tail->next) ABORT (); + return cell->gc; + } + + /* else, cache miss. */ + + if (cache->size == GC_CACHE_SIZE) + /* Reuse the first cell on the list (least-recently-used). + Remove it from the list, and unhash it from the table. + */ + { + cell = cache->head; + cache->head = cell->next; + cache->head->prev = 0; + if (cache->tail == cell) cache->tail = 0; /* only one */ +#if 0 + debug_out ("Cache full, freeing GC: %08lx\n ", XE_GCONTEXT(cell)); +#endif + XFreeGC (cache->dpy, cell->gc); + cache->delete_count++; +#ifdef GCCACHE_HASH + remhash (&cell->gcvm, cache->table); +#endif + } + else if (cache->size > GC_CACHE_SIZE) + ABORT (); + else + { + /* Allocate a new cell (don't put it in the list or table yet). */ + cell = xnew (struct gc_cache_cell); + cache->size++; + } + + /* Now we've got a cell (new or reused). Fill it in. */ + memcpy (&cell->gcvm.gcv, gcv, sizeof (XGCValues)); + cell->gcvm.mask = mask; + + /* Put the cell on the end of the list. */ + cell->next = 0; + cell->prev = cache->tail; + if (cache->tail) cache->tail->next = cell; + cache->tail = cell; + if (! cache->head) cache->head = cell; + + cache->create_count++; +#ifdef GCCACHE_HASH + /* Hash it in the table */ + puthash (&cell->gcvm, cell, cache->table); +#endif + + /* Now make and return the GC. */ + cell->gc = XCreateGC (cache->dpy, cache->window, mask, gcv); + + /* debug */ + assert (cell->gc == gc_cache_lookup (cache, gcv, mask)); + +#if 0 + debug_out ("Returning new GC: %08lx\n ", XE_GCONTEXT(cell)); +#endif + return cell->gc; +} + + +#ifdef DEBUG_XEMACS + +/* FLAGS + The flags argument is a bitwise or of any of the following: + + DGCCFLAG_SUMMARY Summary statistics for cache + DGCCFLAG_LIST_CELLS If summary is being printed, print cell IDs too. + DGCCFLAG_CELL_DETAILS If cell IDs are being printed, additionally + print the internal fields used and values. + + DGCCFLAG_DEFAULT A predefined combination giving whatever the + maintainers are currently interested in seeing. +*/ +void +describe_gc_cache (struct gc_cache *cache, int flags) +{ + int count = 0; + struct gc_cache_cell *cell = cache->head; + + if (! flags & DGCCFLAG_SUMMARY) return; + + stderr_out ("\nsize: %d", cache->size); + stderr_out ("\ncreated: %d", cache->create_count); + stderr_out ("\ndeleted: %d", cache->delete_count); + + if (flags & DGCCFLAG_LIST_CELLS) + while (cell) + { + struct gc_cache_cell *cell2; + int i = 0; + stderr_out ("\n%d:\t0x%lx GC: 0x%08lx hash: 0x%08lx\n", + count, (long) cell, (long) XE_GCONTEXT(cell), + gc_cache_hash (&cell->gcvm)); + + for (cell2 = cache->head; cell2; cell2 = cell2->next, i++) + if (count != i && + gc_cache_hash (&cell->gcvm) == gc_cache_hash (&cell2->gcvm)) + stderr_out ("\tHASH COLLISION with cell %d\n", i); + stderr_out ("\tmask: %8lx\n", cell->gcvm.mask); + + if (flags & DGCCFLAG_CELL_DETAILS) + { +#define FROB(field) do { \ + if ((int)cell->gcvm.gcv.field != (~0)) \ + stderr_out ("\t%-12s%8x\n", #field ":", (int)cell->gcvm.gcv.field); \ +} while (0) + FROB (function); + FROB (plane_mask); + FROB (foreground); + FROB (background); + FROB (line_width); + FROB (line_style); + FROB (cap_style); + FROB (join_style); + FROB (fill_style); + FROB (fill_rule); + FROB (arc_mode); + FROB (tile); + FROB (stipple); + FROB (ts_x_origin); + FROB (ts_y_origin); + FROB (font); + FROB (subwindow_mode); + FROB (graphics_exposures); + FROB (clip_x_origin); + FROB (clip_y_origin); + FROB (clip_mask); + FROB (dash_offset); +#undef FROB + } + + count++; + if (cell->next && cell == cache->tail) + stderr_out ("\nERROR! tail is here!\n\n"); + else if (!cell->next && cell != cache->tail) + stderr_out ("\nERROR! tail is not at the end\n\n"); + cell = cell->next; + } /* while (cell) */ + + if (count != cache->size) + stderr_out ("\nERROR! count should be %d\n\n", cache->size); +} + +#endif /* DEBUG_XEMACS */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gccache-x.h Wed Feb 03 21:46:21 2010 -0600 @@ -0,0 +1,50 @@ +/* Efficient caching of X GCs (graphics contexts). + Copyright (C) 1993 Free Software Foundation, Inc. + + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +XEmacs is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Synched up with: Not in FSF. */ + +/* Written by jwz, 14 jun 93 */ + +#ifndef INCLUDED_gccache_x_h_ +#define INCLUDED_gccache_x_h_ + +#include <X11/Xlib.h> + +struct gc_cache; +struct gc_cache *make_gc_cache (Display *, Window); +void free_gc_cache (struct gc_cache *cache); +GC gc_cache_lookup (struct gc_cache *, XGCValues *, unsigned long mask); + +#define XE_GCONTEXT(cell) (XGContextFromGC(cell->gc)) + +#ifdef DEBUG_XEMACS + +void describe_gc_cache (struct gc_cache *cache, int flags); + +#define DGCCFLAG_DISABLE 0 +#define DGCCFLAG_SUMMARY 1 << 0 +#define DGCCFLAG_LIST_CELLS 1 << 1 +#define DGCCFLAG_CELL_DETAILS 1 << 2 +/* A combination of the flags above. */ +#define DGCCFLAG_DEFAULT DGCCFLAG_SUMMARY | DGCCFLAG_LIST_CELLS +#endif + +#endif /* INCLUDED_gccache_x_h_ */
--- a/src/glyphs-x.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/glyphs-x.c Wed Feb 03 21:46:21 2010 -0600 @@ -2376,7 +2376,7 @@ face, domain)); XFontStruct *fs = FONT_INSTANCE_X_FONT (fi); -#ifdef USE_XFT +#ifdef HAVE_XFT XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi); if (rf) @@ -2395,7 +2395,7 @@ lw_add_widget_value_arg (wv, XtNfont, (XtArgVal) fs); } -#ifdef USE_XFT +#ifdef HAVE_XFT /* #### sanity check, should wrap in appropriate ERROR_CHECK macro */ if (!rf && !fs) warn_when_safe_lispobj
--- a/src/inline.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/inline.c Wed Feb 03 21:46:21 2010 -0600 @@ -101,7 +101,7 @@ #ifdef HAVE_X_WINDOWS #include "glyphs-x.h" -#ifdef USE_XFT +#ifdef HAVE_XFT #include "font-mgr.h" #endif #endif
--- a/src/intl-auto-encap-win32.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/intl-auto-encap-win32.c Wed Feb 03 21:46:21 2010 -0600 @@ -947,16 +947,16 @@ Header file claims: WINUSERAPI HWND WINAPI CreateMDIWindow(LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HINSTANCE,LPARAM) Overridden with: - HWND CreateMDIWindow(LPWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HINSTANCE,LPARAM) + HWND CreateMDIWindow(LPWSTR,LPWSTR,DWORD,int,int,int,int,HWND,HINSTANCE,LPARAM) Differences in return-type qualifiers, e.g. WINAPI, are not important. */ HWND -qxeCreateMDIWindow (Extbyte * arg1, const Extbyte * arg2, DWORD arg3, int arg4, int arg5, int arg6, int arg7, HWND arg8, HINSTANCE arg9, LPARAM arg10) -{ - if (XEUNICODE_P) - return CreateMDIWindowW ((LPWSTR) arg1, (LPCWSTR) arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); - else - return CreateMDIWindowA ((LPSTR) arg1, (LPCSTR) arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); +qxeCreateMDIWindow (Extbyte * arg1, Extbyte * arg2, DWORD arg3, int arg4, int arg5, int arg6, int arg7, HWND arg8, HINSTANCE arg9, LPARAM arg10) +{ + if (XEUNICODE_P) + return CreateMDIWindowW ((LPWSTR) arg1, (LPWSTR) arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); + else + return CreateMDIWindowA ((LPSTR) arg1, (LPSTR) arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } HWND
--- a/src/intl-auto-encap-win32.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/intl-auto-encap-win32.h Wed Feb 03 21:46:21 2010 -0600 @@ -661,7 +661,7 @@ #undef CreateMDIWindow #define CreateMDIWindow error_use_qxeCreateMDIWindow_or_CreateMDIWindowA_and_CreateMDIWindowW #endif -HWND qxeCreateMDIWindow (Extbyte * arg1, const Extbyte * arg2, DWORD arg3, int arg4, int arg5, int arg6, int arg7, HWND arg8, HINSTANCE arg9, LPARAM arg10); +HWND qxeCreateMDIWindow (Extbyte * arg1, Extbyte * arg2, DWORD arg3, int arg4, int arg5, int arg6, int arg7, HWND arg8, HINSTANCE arg9, LPARAM arg10); #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED #undef CreateWindowEx
--- a/src/intl-encap-win32.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/intl-encap-win32.c Wed Feb 03 21:46:21 2010 -0600 @@ -51,6 +51,8 @@ yes indicates a function to be automatically Unicode-encapsulated. (All parameters either need no special processing or are LPTSTR or LPCTSTR.) +override indidates a function where the prototype can be overridden + due to errors in Cygwin or Visual Studio. soon indicates a function that should be automatically Unicode-encapsulated, but we're not ready to process it yet. no indicates a function we don't support (it will be #defined to cause @@ -429,7 +431,7 @@ yes DlgDirSelectComboBoxEx yes DefFrameProc no DefMDIChildProc return value is conditionalized on _MAC, messes up parser -override HWND CreateMDIWindowW(LPWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HINSTANCE,LPARAM); error arg 1, VS6 prototype, missing const +override HWND CreateMDIWindowW(LPWSTR,LPWSTR,DWORD,int,int,int,int,HWND,HINSTANCE,LPARAM); error arg 1, VS6 prototype, missing const yes WinHelp no ChangeDisplaySettings split-sized LPDEVMODE no ChangeDisplaySettingsEx split-sized LPDEVMODE; NT 5.0/Win98+ only
--- a/src/lisp.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/lisp.h Wed Feb 03 21:46:21 2010 -0600 @@ -1258,7 +1258,8 @@ /* Highly dubious kludge */ /* (thanks, Jamie, I feel better now -- ben) */ MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *); -#define ABORT() (assert_failed (__FILE__, __LINE__, "ABORT()")) +#define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()") +#define abort_with_message(msg) assert_failed (__FILE__, __LINE__, msg) /* This used to be ((void) (0)) but that triggers lots of unused variable warnings. It's pointless to force all that code to be rewritten, with @@ -6145,7 +6146,7 @@ extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory; extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory; extern Lisp_Object Vconsole_list, Vcontrolling_terminal; -extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list; +extern Lisp_Object Vcurrent_load_list; extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory; extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook; extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
--- a/src/lread.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/lread.c Wed Feb 03 21:46:21 2010 -0600 @@ -1,7 +1,7 @@ /* Lisp parsing and input streams. Copyright (C) 1985-1989, 1992-1995 Free Software Foundation, Inc. Copyright (C) 1995 Tinker Systems. - Copyright (C) 1996, 2001, 2002, 2003 Ben Wing. + Copyright (C) 1996, 2001, 2002, 2003, 2010 Ben Wing. This file is part of XEmacs. @@ -148,10 +148,6 @@ /* A resizing-buffer stream used to temporarily hold data while reading */ static Lisp_Object Vread_buffer_stream; -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK -Lisp_Object Vcurrent_compiled_function_annotation; -#endif - static int load_byte_code_version; /* An array describing all known built-in structure types */ @@ -1451,9 +1447,6 @@ internal_bind_lisp_object (&Vcurrent_load_list, Qnil); -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = Qnil; -#endif GCPRO2 (val, sourcename); LOADHIST_ATTACH (sourcename); @@ -1619,9 +1612,6 @@ Vread_objects = Qnil; -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = Qnil; -#endif if (EQ (stream, Qread_char)) { Lisp_Object val = call1 (Qread_from_minibuffer, @@ -1648,9 +1638,6 @@ Lisp_Object lispstream = Qnil; struct gcpro gcpro1; -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = Qnil; -#endif GCPRO1 (lispstream); CHECK_STRING (string); get_string_range_byte (string, start, end, &startval, &endval, @@ -3011,16 +2998,6 @@ } } -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - if (s->length == 1 && s->allow_dotted_lists && EQ (XCAR (s->head), Qfset)) - { - if (CONSP (elt) && EQ (XCAR (elt), Qquote) && CONSP (XCDR (elt))) - Vcurrent_compiled_function_annotation = XCAR (XCDR (elt)); - else - Vcurrent_compiled_function_annotation = elt; - } -#endif - elt = Fcons (elt, Qnil); if (!NILP (s->tail)) XCDR (s->tail) = elt; @@ -3056,10 +3033,6 @@ { struct read_list_state s; struct gcpro gcpro1, gcpro2; -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Lisp_Object old_compiled_function_annotation = - Vcurrent_compiled_function_annotation; -#endif s.head = Qnil; s.tail = Qnil; @@ -3069,9 +3042,6 @@ GCPRO2 (s.head, s.tail); sequence_reader (readcharfun, terminator, &s, read_list_conser); -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = old_compiled_function_annotation; -#endif if ((purify_flag || load_force_doc_strings) && check_for_doc_references) { @@ -3479,11 +3449,6 @@ Vload_file_name_internal = Qnil; staticpro (&Vload_file_name_internal); -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = Qnil; - staticpro (&Vcurrent_compiled_function_annotation); -#endif - /* So that early-early stuff will work */ Ffset (Qload, Qload_internal);
--- a/src/objects-x-impl.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/objects-x-impl.h Wed Feb 03 21:46:21 2010 -0600 @@ -29,7 +29,7 @@ #include "objects-impl.h" #include "objects-x.h" -#ifdef USE_XFT +#ifdef HAVE_XFT /* for resource name definitions, etc */ #include "../lwlib/lwlib-fonts.h" #endif @@ -45,7 +45,7 @@ XColor color; /* Yes, it looks crazy to have both the XColor and the XftColor, but pragmatically both are used. */ -#ifdef USE_XFT +#ifdef HAVE_XFT XftColor xftColor; #endif char dealloc_on_gc; @@ -54,7 +54,7 @@ #define X_COLOR_INSTANCE_DATA(c) ((struct x_color_instance_data *) (c)->data) #define COLOR_INSTANCE_X_COLOR(c) (X_COLOR_INSTANCE_DATA (c)->color) #define XCOLOR_INSTANCE_X_COLOR(c) COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (c)) -#ifdef USE_XFT +#ifdef HAVE_XFT #define COLOR_INSTANCE_X_XFTCOLOR(c) (X_COLOR_INSTANCE_DATA (c)->xftColor) #endif #define COLOR_INSTANCE_X_DEALLOC(c) (X_COLOR_INSTANCE_DATA (c)->dealloc_on_gc) @@ -70,7 +70,7 @@ pragmatically both are used (lwlib delegates labels to the widget sets, which internally use XFontStructs). */ XFontStruct * font; -#ifdef USE_XFT +#ifdef HAVE_XFT XftFont *xftFont; #endif @@ -79,7 +79,7 @@ #define X_FONT_INSTANCE_DATA(f) ((struct x_font_instance_data *) (f)->data) #define FONT_INSTANCE_X_FONT(f) (X_FONT_INSTANCE_DATA (f)->font) #define XFONT_INSTANCE_X_FONT(c) FONT_INSTANCE_X_FONT (XFONT_INSTANCE (c)) -#ifdef USE_XFT +#ifdef HAVE_XFT #define FONT_INSTANCE_X_XFTFONT(f) (X_FONT_INSTANCE_DATA (f)->xftFont) #endif
--- a/src/objects-x.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/objects-x.c Wed Feb 03 21:46:21 2010 -0600 @@ -39,7 +39,7 @@ #include "objects-x-impl.h" #include "elhash.h" -#ifdef USE_XFT +#ifdef HAVE_XFT #include "font-mgr.h" #endif @@ -92,7 +92,7 @@ Lisp_Object device, Error_Behavior errb) { XColor color; -#ifdef USE_XFT +#ifdef HAVE_XFT XftColor xftColor; #endif int result; @@ -111,7 +111,7 @@ COLOR_INSTANCE_X_DEALLOC (c) = 1; COLOR_INSTANCE_X_COLOR (c) = color; -#ifdef USE_XFT +#ifdef HAVE_XFT xftColor.pixel = color.pixel; xftColor.color.red = color.red; xftColor.color.green = color.green; @@ -218,13 +218,13 @@ Display *dpy = DEVICE_X_DISPLAY (XDEVICE (device)); Extbyte *extname; XFontStruct *fs = NULL; /* _F_ont _S_truct */ -#ifdef USE_XFT +#ifdef HAVE_XFT XftFont *rf = NULL; /* _R_ender _F_ont (X Render extension) */ #else #define rf (0) #endif -#ifdef USE_XFT +#ifdef HAVE_XFT DEBUG_XFT1 (2, "attempting to initialize font spec %s\n", XSTRING_DATA(f->name)); /* #### serialize (optimize) these later... */ @@ -272,7 +272,7 @@ fear that the finalize method may get fucked. */ f->data = xnew (struct x_font_instance_data); -#ifdef USE_XFT +#ifdef HAVE_XFT FONT_INSTANCE_X_XFTFONT (f) = rf; if (rf) /* Have an Xft font, initialize font info from it. */ @@ -379,7 +379,7 @@ !fs->all_chars_exist)); } -#ifdef USE_XFT +#ifdef HAVE_XFT if (debug_xft > 0) { int n = 3, d = 5; @@ -411,7 +411,7 @@ write_fmt_string (printcharfun, " font id: 0x%lx,", (unsigned long) FONT_INSTANCE_X_FONT (f)->fid); -#ifdef USE_XFT +#ifdef HAVE_XFT /* #### What should we do here? For now, print the address. */ if (FONT_INSTANCE_X_XFTFONT (f)) write_fmt_string (printcharfun, " xft font: 0x%lx", @@ -423,7 +423,7 @@ x_finalize_font_instance (Lisp_Font_Instance *f) { -#ifdef USE_XFT +#ifdef HAVE_XFT DEBUG_XFT1 (0, "finalizing %s\n", (STRINGP (f->name) ? (char *) XSTRING_DATA (f->name) : "(unnamed font)")); @@ -437,7 +437,7 @@ if (FONT_INSTANCE_X_FONT (f)) XFreeFont (dpy, FONT_INSTANCE_X_FONT (f)); -#ifdef USE_XFT +#ifdef HAVE_XFT if (FONT_INSTANCE_X_XFTFONT (f)) XftFontClose (dpy, FONT_INSTANCE_X_XFTFONT (f)); #endif @@ -752,7 +752,7 @@ and otherwise only return when we return something desperate that doesn't get stored for future use. */ -#ifdef USE_XFT +#ifdef HAVE_XFT /* First, try an Xft font. */ if (NILP (FONT_INSTANCE_TRUENAME (f)) && FONT_INSTANCE_X_XFTFONT (f)) { @@ -779,7 +779,7 @@ /* used to return Qnil here */ } } -#endif /* USE_XFT */ +#endif /* HAVE_XFT */ /* OK, fall back to core font. */ if (NILP (FONT_INSTANCE_TRUENAME (f)) @@ -961,7 +961,7 @@ */ ); x_handle_non_fully_specified_fonts = 0; -#ifdef USE_XFT +#ifdef HAVE_XFT Fprovide (intern ("xft-fonts")); #endif }
--- a/src/objects-x.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/objects-x.h Wed Feb 03 21:46:21 2010 -0600 @@ -32,7 +32,7 @@ #ifdef HAVE_X_WINDOWS -#ifdef USE_XFT +#ifdef HAVE_XFT EXFUN (Ffc_font_real_pattern, 2); #endif
--- a/src/s/mach-bsd4-3.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/s/mach-bsd4-3.h Wed Feb 03 21:46:21 2010 -0600 @@ -1,3 +1,23 @@ +/* Definitions file for XEmacs running on Mach (BSD 4.3) + Copyright (C) 1985, 1986, 1993 Free Software Foundation, Inc. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +XEmacs is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin St. - Fifth Floor, +Boston, MA 02110-1301, USA. */ + /* Synched up with: FSF 19.31. */ /* I don't care if this doesn't do more than including bsd4-3.h;
--- a/src/symbols.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/symbols.c Wed Feb 03 21:46:21 2010 -0600 @@ -54,6 +54,8 @@ #include <config.h> #include "lisp.h" +#include "bytecode.h" /* for COMPILED_FUNCTION_ANNOTATION_HACK, + defined in bytecode.h and used here. */ #include "buffer.h" /* for Vbuffer_defaults */ #include "console-impl.h" #include "elhash.h" @@ -716,12 +718,19 @@ DEFUN ("define-function", Fdefine_function, 2, 2, 0, /* Set SYMBOL's function definition to NEWDEF, and return NEWDEF. Associates the function with the current load file, if any. +If NEWDEF is a compiled-function object, stores the function name in +the `annotated' slot of the compiled-function (retrievable using +`compiled-function-annotation'). */ (symbol, newdef)) { /* This function can GC */ Ffset (symbol, newdef); LOADHIST_ATTACH (Fcons (Qdefun, symbol)); +#ifdef COMPILED_FUNCTION_ANNOTATION_HACK + if (COMPILED_FUNCTIONP (newdef)) + XCOMPILED_FUNCTION (newdef)->annotated = symbol; +#endif /* COMPILED_FUNCTION_ANNOTATION_HACK */ return newdef; }
--- a/src/symsinit.h Wed Feb 03 21:06:14 2010 -0600 +++ b/src/symsinit.h Wed Feb 03 21:46:21 2010 -0600 @@ -333,6 +333,7 @@ void vars_of_buffer (void); void reinit_vars_of_buffer (void); void vars_of_bytecode (void); +void reinit_vars_of_bytecode (void); void vars_of_callint (void); EXTERN_C void vars_of_canna_api (void); void vars_of_chartab (void);
--- a/src/syntax.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/syntax.c Wed Feb 03 21:46:21 2010 -0600 @@ -69,6 +69,8 @@ /* A value that is guaranteed not be in a syntax table. */ Lisp_Object Vbogus_syntax_table_value; +Lisp_Object Qscan_error; + static void syntax_cache_table_was_changed (struct buffer *buf); /* This is the internal form of the parse state used in parse-partial-sexp. */ @@ -1353,6 +1355,7 @@ int syncode; int min_depth = depth; /* Err out if depth gets less than this. */ struct syntax_cache *scache; + Charbpos last_good = from; if (depth > 0) min_depth = 0; @@ -1370,6 +1373,8 @@ c = BUF_FETCH_CHAR (buf, from); syncode = SYNTAX_CODE_FROM_CACHE (scache, c); code = SYNTAX_FROM_CODE (syncode); + if (depth == min_depth) + last_good = from; from++; /* a 1-char comment start sequence */ @@ -1483,8 +1488,9 @@ { if (noerror) return Qnil; - syntax_error ("Containing expression ends prematurely", - Qunbound); + signal_error_2 (Qscan_error, + "Containing expression ends prematurely", + make_int (last_good), make_int (from)); } break; @@ -1656,8 +1662,9 @@ { if (noerror) return Qnil; - syntax_error ("Containing expression ends prematurely", - Qunbound); + signal_error_2 (Qscan_error, + "Containing expression ends prematurely", + make_int (last_good), make_int (from)); } break; @@ -1727,7 +1734,8 @@ lose: if (!noerror) - syntax_error ("Unbalanced parentheses", Qunbound); + signal_error_2 (Qscan_error, "Unbalanced parentheses", + make_int (last_good), make_int (from)); return Qnil; } @@ -2418,6 +2426,8 @@ DEFSUBR (Fscan_sexps); DEFSUBR (Fbackward_prefix_chars); DEFSUBR (Fparse_partial_sexp); + + DEFERROR_STANDARD (Qscan_error, Qsyntax_error); } void
--- a/src/toolbar-common.c Wed Feb 03 21:06:14 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,730 +0,0 @@ -/* toolbar implementation -- "Generic" (X or GTK) redisplay interface. - Copyright (C) 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 1995, 1996, 2002 Ben Wing. - Copyright (C) 1996 Chuck Thompson. - -This file is part of XEmacs. - -XEmacs is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -XEmacs is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Synched up with: Not in FSF. */ - -#include <config.h> -#include "lisp.h" - -#include "device-impl.h" -#include "faces.h" -#include "frame-impl.h" -#include "glyphs.h" -#include "toolbar.h" -#include "window.h" - -/* This is used when we need to draw the toolbars ourselves -- on X or GTK. - On MS Windows, we use the built-in toolbar controls. */ - -/* Only a very few things need to differ based on the toolkit used. -** -** Some of the routines used assert(FRAME_yyy_P(f)) checks, this is -** now abstracted into __INTERNAL_APPROPRIATENESS_CHECK(). When we -** add new window systems that use this code, we should either add a -** new case here, or just remove the checks completely. -** -** At least for X & GTK redraw_frame_toolbars() might end up getting -** called before we are completely initialized. To avoid this, we use -** the __INTERNAL_MAPPED_P(f) macro, that should return 0 if we should -** not draw the toolbars yet. When we add new window systems that use -** this code, we should add a new case here, if they need it. -** -** When clearing the toolbar, it is nice to flush the drawing queue. -** Use __INTERNAL_FLUSH to do this. It is passed a device. -*/ -#if defined(HAVE_GTK) -#include "console-gtk-impl.h" -#define __INTERNAL_MAPPED_P(f) GTK_WIDGET_REALIZED (FRAME_GTK_TEXT_WIDGET (f)) -#define __INTERNAL_FLUSH(d) gdk_flush() -#define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_GTK_P (f)) -#elif defined(HAVE_X_WINDOWS) -#include "console-x-impl.h" -#define __INTERNAL_MAPPED_P(f) XtIsRealized (FRAME_X_SHELL_WIDGET (f)) -#define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_X_P (f)) -#define __INTERNAL_FLUSH(d) XFlush (DEVICE_X_DISPLAY (d)) -#else -#define __INTERNAL_MAPPED_P(f) ABORT() -#define __INTERNAL_APPROPRIATENESS_CHECK(f) ABORT() -#define __INTERNAL_FLUSH(f) ABORT() -#endif - -#include "toolbar-common.h" - -extern Lisp_Object Vtoolbar_shadow_thickness; - -static void __prepare_button_area (struct frame *f, - struct toolbar_button *tb) -{ - int sx = tb->x; - int sy = tb->y; - int swidth = tb->width; - int sheight = tb->height; - int border_width = tb->border_width; - int x_adj, width_adj, y_adj, height_adj; - struct device *d = XDEVICE (f->device); - Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f); - struct window *w = XWINDOW (window); - int shadow_thickness; - int def_shadow_thickness = XINT (Fspecifier_instance(Vtoolbar_shadow_thickness, window, Qnil, Qnil)); - face_index toolbar_findex; - - if (tb->vertical) - { - x_adj = border_width; - width_adj = - 2 * border_width; - y_adj = height_adj = 0; - } - else - { - x_adj = width_adj = 0; - y_adj = border_width; - height_adj = - 2 * border_width; - } - - toolbar_findex = get_builtin_face_cache_index (w, Vtoolbar_face); - - /* Blank toolbar buttons that should be 3d will have EQ(tb->up_glyph, Qt) - ** Blank toolbar buttons that should be flat will have NILP (tb->up_glyph) - ** - ** Real toolbar buttons will check tb->enabled && tb->down - */ - if (EQ (Qt, tb->up_glyph)) - { - shadow_thickness = def_shadow_thickness; - } - else if (NILP (tb->up_glyph)) - { - shadow_thickness = 0; - } - else - { - if (tb->enabled) - { - if (tb->down) - shadow_thickness = -def_shadow_thickness; - else - shadow_thickness = def_shadow_thickness; - } - else - { - shadow_thickness = 0; - } - } - - /* Blank the entire area. */ - redisplay_clear_region (window, toolbar_findex, - sx + x_adj, sy + y_adj, - swidth + width_adj, - sheight + height_adj); - - /* Draw the outline. */ - if (shadow_thickness) - { - MAYBE_DEVMETH (d, bevel_area, - (w, toolbar_findex, sx + x_adj, - sy + y_adj, swidth + width_adj, - sheight + height_adj, abs(shadow_thickness), - EDGE_ALL, (shadow_thickness < 0) ? EDGE_BEVEL_IN - : EDGE_BEVEL_OUT)); - } - - /* Handle the borders... */ - redisplay_clear_region (window, toolbar_findex, - sx, sy, - (tb->vertical ? border_width : swidth), - (tb->vertical ? sheight : border_width)); - redisplay_clear_region (window, toolbar_findex, - (tb->vertical ? sx + swidth : sx), - (tb->vertical ? sy : sy + sheight), - (tb->vertical ? border_width : swidth), - (tb->vertical ? sheight : border_width)); -} - -#define common_draw_blank_toolbar_button(f,tb) __prepare_button_area (f,tb) - -void -common_output_toolbar_button (struct frame *f, Lisp_Object button) -{ - int shadow_thickness = 2; - int x_adj, y_adj, width_adj, height_adj; - struct device *d = XDEVICE (f->device); - Lisp_Object instance, window, glyph; - struct toolbar_button *tb = XTOOLBAR_BUTTON (button); - struct Lisp_Image_Instance *p; - struct window *w; - int vertical = tb->vertical; - int border_width = tb->border_width; - face_index button_findex; - - if (vertical) - { - x_adj = border_width; - width_adj = - 2 * border_width; - y_adj = 0; - height_adj = 0; - } - else - { - x_adj = 0; - width_adj = 0; - y_adj = border_width; - height_adj = - 2 * border_width; - } - - window = FRAME_LAST_NONMINIBUF_WINDOW (f); - w = XWINDOW (window); - - glyph = get_toolbar_button_glyph (w, tb); - - if (tb->enabled) - { - if (tb->down) - { - shadow_thickness = -2; - } - else - { - shadow_thickness = 2; - } - } - else - { - shadow_thickness = 0; - } - - /* #### It is currently possible for users to trash us by directly - changing the toolbar glyphs. Avoid crashing in that case. */ - if (GLYPHP (glyph)) - { - /* WARNING: this interface may change */ - Lisp_Object face_list[2] = { XGLYPH_FACE (glyph), Vtoolbar_face }; - - button_findex = merge_face_list_to_cache_index (w, face_list, 2); - instance = glyph_image_instance (glyph, window, ERROR_ME_DEBUG_WARN, 1); - } - else - { - button_findex = get_builtin_face_cache_index (w, Vtoolbar_face); - instance = Qnil; - } - - __prepare_button_area (f, tb); - - if (IMAGE_INSTANCEP (instance)) - { - int width = tb->width + width_adj - shadow_thickness * 2; - int height = tb->height + height_adj - shadow_thickness * 2; - int x_offset = x_adj + shadow_thickness; - int y_offset = y_adj + shadow_thickness; - - p = XIMAGE_INSTANCE (instance); - - if (IMAGE_INSTANCE_PIXMAP_TYPE_P (p)) - { - struct display_box db; - struct display_glyph_area dga; - - if (width > (int) IMAGE_INSTANCE_PIXMAP_WIDTH (p)) - { - x_offset += ((int) (width - IMAGE_INSTANCE_PIXMAP_WIDTH (p)) - / 2); - width = IMAGE_INSTANCE_PIXMAP_WIDTH (p); - } - if (height > (int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p)) - { - y_offset += ((int) (height - IMAGE_INSTANCE_PIXMAP_HEIGHT (p)) - / 2); - height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p); - } - - /* Draw exactly in the area specified... */ - db.xpos = tb->x + x_offset; - db.ypos = tb->y + y_offset; - db.width = width; - db.height = height; - - /* Display the whole glyph */ - dga.xoffset = 0; - dga.yoffset = 0; - dga.width = width; - dga.height = height; - - redisplay_output_pixmap (w, instance, - &db, &dga, - button_findex, 0, 0, 0, 0); - } - else if (IMAGE_INSTANCE_TYPE (p) == IMAGE_TEXT) - { - /* #### We need to make the face used configurable. */ - struct face_cachel *cachel = - WINDOW_FACE_CACHEL (w, DEFAULT_INDEX); - struct display_line dl; - Lisp_Object string = IMAGE_INSTANCE_TEXT_STRING (p); - unsigned char charsets[NUM_LEADING_BYTES]; - Ichar_dynarr *buf; - struct font_metric_info fm; - - /* This could be true if we were called via the Expose event - handler. Mark the button as dirty and return - immediately. */ - if (f->window_face_cache_reset) - { - tb->dirty = 1; - MARK_TOOLBAR_CHANGED; - return; - } - buf = Dynarr_new (Ichar); - convert_ibyte_string_into_ichar_dynarr - (XSTRING_DATA (string), XSTRING_LENGTH (string), buf); - find_charsets_in_ichar_string (charsets, Dynarr_begin (buf), - Dynarr_length (buf)); - ensure_face_cachel_complete (cachel, window, charsets); - face_cachel_charset_font_metric_info (cachel, charsets, &fm); - - dl.ascent = fm.ascent; - dl.descent = fm.descent; - dl.ypos = tb->y + y_offset + fm.ascent; - - if (fm.ascent + fm.descent <= height) - { - dl.ypos += (height - fm.ascent - fm.descent) / 2; - dl.clip = 0; - } - else - { - dl.clip = fm.ascent + fm.descent - height; - } - - MAYBE_DEVMETH (d, output_string, - (w, &dl, buf, tb->x + x_offset, 0, 0, width, - button_findex, 0, 0, 0, 0)); - Dynarr_free (buf); - } - - /* We silently ignore the image if it isn't a pixmap or text. */ - } - - tb->dirty = 0; -} - -static int -common_get_button_size (struct frame *f, Lisp_Object window, - struct toolbar_button *tb, int vert, int pos) -{ - int shadow_thickness = 2; - int size; - - if (tb->blank) - { - if (!NILP (tb->down_glyph)) - size = XINT (tb->down_glyph); - else - size = DEFAULT_TOOLBAR_BLANK_SIZE; - } - else - { - struct window *w = XWINDOW (window); - Lisp_Object glyph = get_toolbar_button_glyph (w, tb); - - /* Unless, of course, the user has done something stupid like - change the glyph out from under us. Use a blank placeholder - in that case. */ - if (NILP (glyph)) - return XINT (f->toolbar_size[pos]); - - if (vert) - size = glyph_height (glyph, window); - else - size = glyph_width (glyph, window); - } - - if (!size) - { - /* If the glyph doesn't have a size we'll insert a blank - placeholder instead. */ - return XINT (f->toolbar_size[pos]); - } - - size += shadow_thickness * 2; - - return (size); -} - -#define COMMON_OUTPUT_BUTTONS_LOOP(left) \ - do { \ - while (!NILP (button)) \ - { \ - struct toolbar_button *tb = XTOOLBAR_BUTTON (button); \ - int size, height, width; \ - \ - if (left && tb->pushright) \ - break; \ - \ - size = common_get_button_size (f, window, tb, vert, pos); \ - \ - if (vert) \ - { \ - width = bar_width; \ - if (y + size > max_pixpos) \ - height = max_pixpos - y; \ - else \ - height = size; \ - } \ - else \ - { \ - if (x + size > max_pixpos) \ - width = max_pixpos - x; \ - else \ - width = size; \ - height = bar_height; \ - } \ - \ - if (tb->x != x \ - || tb->y != y \ - || tb->width != width \ - || tb->height != height \ - || tb->dirty \ - || f->clear) /* This is clearly necessary. */ \ - { \ - if (width && height) \ - { \ - tb->x = x; \ - tb->y = y; \ - tb->width = width; \ - tb->height = height; \ - tb->border_width = border_width; \ - tb->vertical = vert; \ - \ - if (tb->blank || NILP (tb->up_glyph)) \ - { \ - common_draw_blank_toolbar_button (f, tb); \ - } \ - else \ - common_output_toolbar_button (f, button); \ - } \ - } \ - \ - if (vert) \ - y += height; \ - else \ - x += width; \ - \ - if ((vert && y == max_pixpos) || (!vert && x == max_pixpos)) \ - button = Qnil; \ - else \ - button = tb->next; \ - } \ - } while (0) - -#define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag) \ - do { \ - switch (pos) \ - { \ - case TOP_TOOLBAR: \ - (frame)->top_toolbar_was_visible = flag; \ - break; \ - case BOTTOM_TOOLBAR: \ - (frame)->bottom_toolbar_was_visible = flag; \ - break; \ - case LEFT_TOOLBAR: \ - (frame)->left_toolbar_was_visible = flag; \ - break; \ - case RIGHT_TOOLBAR: \ - (frame)->right_toolbar_was_visible = flag; \ - break; \ - default: \ - ABORT (); \ - } \ - } while (0) - -static void -common_output_toolbar (struct frame *f, enum toolbar_pos pos) -{ - int x, y, bar_width, bar_height, vert; - int max_pixpos, right_size, right_start, blank_size; - int border_width = FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, pos); - Lisp_Object button, window; - face_index toolbar_findex; - - get_toolbar_coords (f, pos, &x, &y, &bar_width, &bar_height, &vert, 1); - window = FRAME_LAST_NONMINIBUF_WINDOW (f); - toolbar_findex = get_builtin_face_cache_index (XWINDOW (window), Vtoolbar_face); - - /* Do the border */ - redisplay_clear_region (window, toolbar_findex, - x, y, - (vert ? bar_width : border_width), - (vert ? border_width : bar_height)); - redisplay_clear_region (window, toolbar_findex, - (vert ? x : x + bar_width - border_width), - (vert ? y + bar_height - border_width : y), - (vert ? bar_width : border_width), - (vert ? border_width : bar_height)); - - if (vert) - { - max_pixpos = y + bar_height - border_width; - y += border_width; - } - else - { - max_pixpos = x + bar_width - border_width; - x += border_width; - } - - button = FRAME_TOOLBAR_BUTTONS (f, pos); - right_size = 0; - - /* First loop over all of the buttons to determine how much room we - need for left hand and right hand buttons. This loop will also - make sure that all instances are instantiated so when we actually - output them they will come up immediately. */ - while (!NILP (button)) - { - struct toolbar_button *tb = XTOOLBAR_BUTTON (button); - int size = common_get_button_size (f, window, tb, vert, pos); - - if (tb->pushright) - right_size += size; - - button = tb->next; - } - - button = FRAME_TOOLBAR_BUTTONS (f, pos); - - /* Loop over the left buttons, updating and outputting them. */ - COMMON_OUTPUT_BUTTONS_LOOP (1); - - /* Now determine where the right buttons start. */ - right_start = max_pixpos - right_size; - if (right_start < (vert ? y : x)) - right_start = (vert ? y : x); - - /* Output the blank which goes from the end of the left buttons to - the start of the right. */ - blank_size = right_start - (vert ? y : x); - if (blank_size) - { - int height, width; - - if (vert) - { - width = bar_width; - height = blank_size; - } - else - { - width = blank_size; - height = bar_height; - } - - /* - * Use a 3D pushright separator only if there isn't a toolbar - * border. A flat separator meshes with the border and looks - * better. - */ - if (1) - { - struct toolbar_button tb; - - tb.x = x; - tb.y = y; - tb.width = width; - tb.height = height; - tb.border_width = border_width; - tb.vertical = vert; - tb.enabled = 1; - tb.up_glyph = border_width ? Qt : Qnil; - - __prepare_button_area (f, &tb); - } - - if (vert) - y += height; - else - x += width; - } - - /* Loop over the right buttons, updating and outputting them. */ - COMMON_OUTPUT_BUTTONS_LOOP (0); - - if (!vert) - { - Lisp_Object frame = wrap_frame (f); - - redisplay_clear_region (frame, - DEFAULT_INDEX, FRAME_PIXWIDTH (f) - 1, y, 1, - bar_height); - } - - SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1); - __INTERNAL_FLUSH (XDEVICE (f->device)); -} - -static void -common_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change) -{ - Lisp_Object frame; - int x, y, width, height, vert; - - get_toolbar_coords (f, pos, &x, &y, &width, &height, &vert, 1); - frame = wrap_frame (f); - - /* The thickness_change parameter is used by the toolbar resize routines - to clear any excess toolbar if the size shrinks. */ - if (thickness_change < 0) - { - if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR) - { - x = x + width + thickness_change; - width = -thickness_change; - } - else - { - y = y + height + thickness_change; - height = -thickness_change; - } - } - - SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0); - - redisplay_clear_region (frame, DEFAULT_INDEX, x, y, width, height); - - __INTERNAL_FLUSH (XDEVICE (f->device)); -} - -void -common_output_frame_toolbars (struct frame *f) -{ - __INTERNAL_APPROPRIATENESS_CHECK(f); - - if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)) - common_output_toolbar (f, TOP_TOOLBAR); - - if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)) - common_output_toolbar (f, BOTTOM_TOOLBAR); - - if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f)) - common_output_toolbar (f, LEFT_TOOLBAR); - - if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f)) - common_output_toolbar (f, RIGHT_TOOLBAR); -} - -void -common_clear_frame_toolbars (struct frame *f) -{ - __INTERNAL_APPROPRIATENESS_CHECK(f); - - if (f->top_toolbar_was_visible - && !FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)) - common_clear_toolbar (f, TOP_TOOLBAR, 0); - if (f->bottom_toolbar_was_visible - && !FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)) - common_clear_toolbar (f, BOTTOM_TOOLBAR, 0); - if (f->left_toolbar_was_visible - && !FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f)) - common_clear_toolbar (f, LEFT_TOOLBAR, 0); - if (f->right_toolbar_was_visible - && !FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f)) - common_clear_toolbar (f, RIGHT_TOOLBAR, 0); -} - -static void -common_redraw_exposed_toolbar (struct frame *f, enum toolbar_pos pos, int x, int y, - int width, int height) -{ - int bar_x, bar_y, bar_width, bar_height, vert; - Lisp_Object button = FRAME_TOOLBAR_BUTTONS (f, pos); - - get_toolbar_coords (f, pos, &bar_x, &bar_y, &bar_width, &bar_height, - &vert, 1); - - if (((y + height) < bar_y) || (y > (bar_y + bar_height))) - return; - if (((x + width) < bar_x) || (x > (bar_x + bar_width))) - return; - - while (!NILP (button)) - { - struct toolbar_button *tb = XTOOLBAR_BUTTON (button); - - if (vert) - { - if (((tb->y + tb->height) > y) && (tb->y < (y + height))) - tb->dirty = 1; - - /* If this is true we have gone past the exposed region. */ - if (tb->y > (y + height)) - break; - } - else - { - if (((tb->x + tb->width) > x) && (tb->x < (x + width))) - tb->dirty = 1; - - /* If this is true we have gone past the exposed region. */ - if (tb->x > (x + width)) - break; - } - - button = tb->next; - } - - /* Even if none of the buttons is in the area, the blank region at - the very least must be because the first thing we did is verify - that some portion of the toolbar is in the exposed region. */ - common_output_toolbar (f, pos); -} - -void -common_redraw_exposed_toolbars (struct frame *f, int x, int y, int width, - int height) -{ - __INTERNAL_APPROPRIATENESS_CHECK(f); - - if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)) - common_redraw_exposed_toolbar (f, TOP_TOOLBAR, x, y, width, height); - - if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)) - common_redraw_exposed_toolbar (f, BOTTOM_TOOLBAR, x, y, width, height); - - if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f)) - common_redraw_exposed_toolbar (f, LEFT_TOOLBAR, x, y, width, height); - - if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f)) - common_redraw_exposed_toolbar (f, RIGHT_TOOLBAR, x, y, width, height); -} - -void -common_redraw_frame_toolbars (struct frame *f) -{ - /* There are certain startup paths that lead to update_EmacsFrame in - faces.c being called before a new frame is fully initialized. In - particular before we have actually mapped it. That routine can - call this one. So, we need to make sure that the frame is - actually ready before we try and draw all over it. */ - if (__INTERNAL_MAPPED_P(f)) - common_redraw_exposed_toolbars (f, 0, 0, FRAME_PIXWIDTH (f), - FRAME_PIXHEIGHT (f)); -}
--- a/src/toolbar-common.h Wed Feb 03 21:06:14 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -/* toolbar-common.h -** -** Description: -** -** Created by: William M. Perry -** Copyright (c) 2001 Free Software Foundation -** -*/ - -#ifndef __TOOLBAR_COMMON_H__ -#define __TOOLBAR_COMMON_H__ - -extern void common_output_frame_toolbars (struct frame *f); -extern void common_redraw_exposed_toolbars (struct frame *f, - int x, int y, - int width, int height); -extern void common_redraw_frame_toolbars (struct frame *f); -extern void common_output_toolbar_button (struct frame *f, Lisp_Object button); -extern void common_clear_frame_toolbars (struct frame *f); - -#endif /* __TOOLBAR_COMMON_H__ */
--- a/src/toolbar-gtk.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/toolbar-gtk.c Wed Feb 03 21:46:21 2010 -0600 @@ -28,19 +28,19 @@ #include "frame.h" -#include "toolbar-common.h" +#include "toolbar-xlike.h" #include "console-gtk-impl.h" -/* We should really create a 'common' console type and fill it with +/* We should really create a 'xlike' console type and fill it with ** all the shared code. We would then just use -** CONSOLE_INHERITS_METHOD(x,common,blah) +** CONSOLE_INHERITS_METHOD(x,xlike,blah) */ -#define gtk_output_frame_toolbars common_output_frame_toolbars -#define gtk_output_toolbar_button common_output_toolbar_button -#define gtk_redraw_exposed_toolbars common_redraw_exposed_toolbars -#define gtk_redraw_frame_toolbars common_redraw_frame_toolbars -#define gtk_clear_frame_toolbars common_clear_frame_toolbars +#define gtk_output_frame_toolbars xlike_output_frame_toolbars +#define gtk_output_toolbar_button xlike_output_toolbar_button +#define gtk_redraw_exposed_toolbars xlike_redraw_exposed_toolbars +#define gtk_redraw_frame_toolbars xlike_redraw_frame_toolbars +#define gtk_clear_frame_toolbars xlike_clear_frame_toolbars static void
--- a/src/toolbar-x.c Wed Feb 03 21:06:14 2010 -0600 +++ b/src/toolbar-x.c Wed Feb 03 21:46:21 2010 -0600 @@ -33,7 +33,7 @@ #include "toolbar.h" #include "window.h" -#include "toolbar-common.h" +#include "toolbar-xlike.h" #include "console-x-impl.h" #include "glyphs-x.h" @@ -42,15 +42,15 @@ #include "EmacsFrame.h" #include "EmacsFrameP.h" -/* We should really create a 'common' console type and fill it with +/* We should really create a 'xlike' console type and fill it with ** all the shared code. We would then just use -** CONSOLE_INHERITS_METHOD(x,common,blah) +** CONSOLE_INHERITS_METHOD(x,xlike,blah) */ -#define x_output_frame_toolbars common_output_frame_toolbars -#define x_output_toolbar_button common_output_toolbar_button -#define x_redraw_exposed_toolbars common_redraw_exposed_toolbars -#define x_redraw_frame_toolbars common_redraw_frame_toolbars -#define x_clear_frame_toolbars common_clear_frame_toolbars +#define x_output_frame_toolbars xlike_output_frame_toolbars +#define x_output_toolbar_button xlike_output_toolbar_button +#define x_redraw_exposed_toolbars xlike_redraw_exposed_toolbars +#define x_redraw_frame_toolbars xlike_redraw_frame_toolbars +#define x_clear_frame_toolbars xlike_clear_frame_toolbars static void x_initialize_frame_toolbars (struct frame *f)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/toolbar-xlike.c Wed Feb 03 21:46:21 2010 -0600 @@ -0,0 +1,730 @@ +/* toolbar implementation -- "Generic" (X or GTK) redisplay interface. + Copyright (C) 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995 Sun Microsystems, Inc. + Copyright (C) 1995, 1996, 2002, 2010 Ben Wing. + Copyright (C) 1996 Chuck Thompson. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +XEmacs is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Synched up with: Not in FSF. */ + +#include <config.h> +#include "lisp.h" + +#include "device-impl.h" +#include "faces.h" +#include "frame-impl.h" +#include "glyphs.h" +#include "toolbar.h" +#include "window.h" + +/* This is used when we need to draw the toolbars ourselves -- on X or GTK. + On MS Windows, we use the built-in toolbar controls. */ + +/* Only a very few things need to differ based on the toolkit used. +** +** Some of the routines used assert(FRAME_yyy_P(f)) checks, this is +** now abstracted into __INTERNAL_APPROPRIATENESS_CHECK(). When we +** add new window systems that use this code, we should either add a +** new case here, or just remove the checks completely. +** +** At least for X & GTK redraw_frame_toolbars() might end up getting +** called before we are completely initialized. To avoid this, we use +** the __INTERNAL_MAPPED_P(f) macro, that should return 0 if we should +** not draw the toolbars yet. When we add new window systems that use +** this code, we should add a new case here, if they need it. +** +** When clearing the toolbar, it is nice to flush the drawing queue. +** Use __INTERNAL_FLUSH to do this. It is passed a device. +*/ +#if defined(HAVE_GTK) +#include "console-gtk-impl.h" +#define __INTERNAL_MAPPED_P(f) GTK_WIDGET_REALIZED (FRAME_GTK_TEXT_WIDGET (f)) +#define __INTERNAL_FLUSH(d) gdk_flush() +#define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_GTK_P (f)) +#elif defined(HAVE_X_WINDOWS) +#include "console-x-impl.h" +#define __INTERNAL_MAPPED_P(f) XtIsRealized (FRAME_X_SHELL_WIDGET (f)) +#define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_X_P (f)) +#define __INTERNAL_FLUSH(d) XFlush (DEVICE_X_DISPLAY (d)) +#else +#define __INTERNAL_MAPPED_P(f) ABORT() +#define __INTERNAL_APPROPRIATENESS_CHECK(f) ABORT() +#define __INTERNAL_FLUSH(f) ABORT() +#endif + +#include "toolbar-xlike.h" + +extern Lisp_Object Vtoolbar_shadow_thickness; + +static void __prepare_button_area (struct frame *f, + struct toolbar_button *tb) +{ + int sx = tb->x; + int sy = tb->y; + int swidth = tb->width; + int sheight = tb->height; + int border_width = tb->border_width; + int x_adj, width_adj, y_adj, height_adj; + struct device *d = XDEVICE (f->device); + Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f); + struct window *w = XWINDOW (window); + int shadow_thickness; + int def_shadow_thickness = XINT (Fspecifier_instance(Vtoolbar_shadow_thickness, window, Qnil, Qnil)); + face_index toolbar_findex; + + if (tb->vertical) + { + x_adj = border_width; + width_adj = - 2 * border_width; + y_adj = height_adj = 0; + } + else + { + x_adj = width_adj = 0; + y_adj = border_width; + height_adj = - 2 * border_width; + } + + toolbar_findex = get_builtin_face_cache_index (w, Vtoolbar_face); + + /* Blank toolbar buttons that should be 3d will have EQ(tb->up_glyph, Qt) + ** Blank toolbar buttons that should be flat will have NILP (tb->up_glyph) + ** + ** Real toolbar buttons will check tb->enabled && tb->down + */ + if (EQ (Qt, tb->up_glyph)) + { + shadow_thickness = def_shadow_thickness; + } + else if (NILP (tb->up_glyph)) + { + shadow_thickness = 0; + } + else + { + if (tb->enabled) + { + if (tb->down) + shadow_thickness = -def_shadow_thickness; + else + shadow_thickness = def_shadow_thickness; + } + else + { + shadow_thickness = 0; + } + } + + /* Blank the entire area. */ + redisplay_clear_region (window, toolbar_findex, + sx + x_adj, sy + y_adj, + swidth + width_adj, + sheight + height_adj); + + /* Draw the outline. */ + if (shadow_thickness) + { + MAYBE_DEVMETH (d, bevel_area, + (w, toolbar_findex, sx + x_adj, + sy + y_adj, swidth + width_adj, + sheight + height_adj, abs(shadow_thickness), + EDGE_ALL, (shadow_thickness < 0) ? EDGE_BEVEL_IN + : EDGE_BEVEL_OUT)); + } + + /* Handle the borders... */ + redisplay_clear_region (window, toolbar_findex, + sx, sy, + (tb->vertical ? border_width : swidth), + (tb->vertical ? sheight : border_width)); + redisplay_clear_region (window, toolbar_findex, + (tb->vertical ? sx + swidth : sx), + (tb->vertical ? sy : sy + sheight), + (tb->vertical ? border_width : swidth), + (tb->vertical ? sheight : border_width)); +} + +#define xlike_draw_blank_toolbar_button(f,tb) __prepare_button_area (f,tb) + +void +xlike_output_toolbar_button (struct frame *f, Lisp_Object button) +{ + int shadow_thickness = 2; + int x_adj, y_adj, width_adj, height_adj; + struct device *d = XDEVICE (f->device); + Lisp_Object instance, window, glyph; + struct toolbar_button *tb = XTOOLBAR_BUTTON (button); + struct Lisp_Image_Instance *p; + struct window *w; + int vertical = tb->vertical; + int border_width = tb->border_width; + face_index button_findex; + + if (vertical) + { + x_adj = border_width; + width_adj = - 2 * border_width; + y_adj = 0; + height_adj = 0; + } + else + { + x_adj = 0; + width_adj = 0; + y_adj = border_width; + height_adj = - 2 * border_width; + } + + window = FRAME_LAST_NONMINIBUF_WINDOW (f); + w = XWINDOW (window); + + glyph = get_toolbar_button_glyph (w, tb); + + if (tb->enabled) + { + if (tb->down) + { + shadow_thickness = -2; + } + else + { + shadow_thickness = 2; + } + } + else + { + shadow_thickness = 0; + } + + /* #### It is currently possible for users to trash us by directly + changing the toolbar glyphs. Avoid crashing in that case. */ + if (GLYPHP (glyph)) + { + /* WARNING: this interface may change */ + Lisp_Object face_list[2] = { XGLYPH_FACE (glyph), Vtoolbar_face }; + + button_findex = merge_face_list_to_cache_index (w, face_list, 2); + instance = glyph_image_instance (glyph, window, ERROR_ME_DEBUG_WARN, 1); + } + else + { + button_findex = get_builtin_face_cache_index (w, Vtoolbar_face); + instance = Qnil; + } + + __prepare_button_area (f, tb); + + if (IMAGE_INSTANCEP (instance)) + { + int width = tb->width + width_adj - shadow_thickness * 2; + int height = tb->height + height_adj - shadow_thickness * 2; + int x_offset = x_adj + shadow_thickness; + int y_offset = y_adj + shadow_thickness; + + p = XIMAGE_INSTANCE (instance); + + if (IMAGE_INSTANCE_PIXMAP_TYPE_P (p)) + { + struct display_box db; + struct display_glyph_area dga; + + if (width > (int) IMAGE_INSTANCE_PIXMAP_WIDTH (p)) + { + x_offset += ((int) (width - IMAGE_INSTANCE_PIXMAP_WIDTH (p)) + / 2); + width = IMAGE_INSTANCE_PIXMAP_WIDTH (p); + } + if (height > (int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p)) + { + y_offset += ((int) (height - IMAGE_INSTANCE_PIXMAP_HEIGHT (p)) + / 2); + height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p); + } + + /* Draw exactly in the area specified... */ + db.xpos = tb->x + x_offset; + db.ypos = tb->y + y_offset; + db.width = width; + db.height = height; + + /* Display the whole glyph */ + dga.xoffset = 0; + dga.yoffset = 0; + dga.width = width; + dga.height = height; + + redisplay_output_pixmap (w, instance, + &db, &dga, + button_findex, 0, 0, 0, 0); + } + else if (IMAGE_INSTANCE_TYPE (p) == IMAGE_TEXT) + { + /* #### We need to make the face used configurable. */ + struct face_cachel *cachel = + WINDOW_FACE_CACHEL (w, DEFAULT_INDEX); + struct display_line dl; + Lisp_Object string = IMAGE_INSTANCE_TEXT_STRING (p); + unsigned char charsets[NUM_LEADING_BYTES]; + Ichar_dynarr *buf; + struct font_metric_info fm; + + /* This could be true if we were called via the Expose event + handler. Mark the button as dirty and return + immediately. */ + if (f->window_face_cache_reset) + { + tb->dirty = 1; + MARK_TOOLBAR_CHANGED; + return; + } + buf = Dynarr_new (Ichar); + convert_ibyte_string_into_ichar_dynarr + (XSTRING_DATA (string), XSTRING_LENGTH (string), buf); + find_charsets_in_ichar_string (charsets, Dynarr_begin (buf), + Dynarr_length (buf)); + ensure_face_cachel_complete (cachel, window, charsets); + face_cachel_charset_font_metric_info (cachel, charsets, &fm); + + dl.ascent = fm.ascent; + dl.descent = fm.descent; + dl.ypos = tb->y + y_offset + fm.ascent; + + if (fm.ascent + fm.descent <= height) + { + dl.ypos += (height - fm.ascent - fm.descent) / 2; + dl.clip = 0; + } + else + { + dl.clip = fm.ascent + fm.descent - height; + } + + MAYBE_DEVMETH (d, output_string, + (w, &dl, buf, tb->x + x_offset, 0, 0, width, + button_findex, 0, 0, 0, 0)); + Dynarr_free (buf); + } + + /* We silently ignore the image if it isn't a pixmap or text. */ + } + + tb->dirty = 0; +} + +static int +xlike_get_button_size (struct frame *f, Lisp_Object window, + struct toolbar_button *tb, int vert, int pos) +{ + int shadow_thickness = 2; + int size; + + if (tb->blank) + { + if (!NILP (tb->down_glyph)) + size = XINT (tb->down_glyph); + else + size = DEFAULT_TOOLBAR_BLANK_SIZE; + } + else + { + struct window *w = XWINDOW (window); + Lisp_Object glyph = get_toolbar_button_glyph (w, tb); + + /* Unless, of course, the user has done something stupid like + change the glyph out from under us. Use a blank placeholder + in that case. */ + if (NILP (glyph)) + return XINT (f->toolbar_size[pos]); + + if (vert) + size = glyph_height (glyph, window); + else + size = glyph_width (glyph, window); + } + + if (!size) + { + /* If the glyph doesn't have a size we'll insert a blank + placeholder instead. */ + return XINT (f->toolbar_size[pos]); + } + + size += shadow_thickness * 2; + + return (size); +} + +#define XLIKE_OUTPUT_BUTTONS_LOOP(left) \ + do { \ + while (!NILP (button)) \ + { \ + struct toolbar_button *tb = XTOOLBAR_BUTTON (button); \ + int size, height, width; \ + \ + if (left && tb->pushright) \ + break; \ + \ + size = xlike_get_button_size (f, window, tb, vert, pos); \ + \ + if (vert) \ + { \ + width = bar_width; \ + if (y + size > max_pixpos) \ + height = max_pixpos - y; \ + else \ + height = size; \ + } \ + else \ + { \ + if (x + size > max_pixpos) \ + width = max_pixpos - x; \ + else \ + width = size; \ + height = bar_height; \ + } \ + \ + if (tb->x != x \ + || tb->y != y \ + || tb->width != width \ + || tb->height != height \ + || tb->dirty \ + || f->clear) /* This is clearly necessary. */ \ + { \ + if (width && height) \ + { \ + tb->x = x; \ + tb->y = y; \ + tb->width = width; \ + tb->height = height; \ + tb->border_width = border_width; \ + tb->vertical = vert; \ + \ + if (tb->blank || NILP (tb->up_glyph)) \ + { \ + xlike_draw_blank_toolbar_button (f, tb); \ + } \ + else \ + xlike_output_toolbar_button (f, button); \ + } \ + } \ + \ + if (vert) \ + y += height; \ + else \ + x += width; \ + \ + if ((vert && y == max_pixpos) || (!vert && x == max_pixpos)) \ + button = Qnil; \ + else \ + button = tb->next; \ + } \ + } while (0) + +#define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag) \ + do { \ + switch (pos) \ + { \ + case TOP_TOOLBAR: \ + (frame)->top_toolbar_was_visible = flag; \ + break; \ + case BOTTOM_TOOLBAR: \ + (frame)->bottom_toolbar_was_visible = flag; \ + break; \ + case LEFT_TOOLBAR: \ + (frame)->left_toolbar_was_visible = flag; \ + break; \ + case RIGHT_TOOLBAR: \ + (frame)->right_toolbar_was_visible = flag; \ + break; \ + default: \ + ABORT (); \ + } \ + } while (0) + +static void +xlike_output_toolbar (struct frame *f, enum toolbar_pos pos) +{ + int x, y, bar_width, bar_height, vert; + int max_pixpos, right_size, right_start, blank_size; + int border_width = FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, pos); + Lisp_Object button, window; + face_index toolbar_findex; + + get_toolbar_coords (f, pos, &x, &y, &bar_width, &bar_height, &vert, 1); + window = FRAME_LAST_NONMINIBUF_WINDOW (f); + toolbar_findex = get_builtin_face_cache_index (XWINDOW (window), Vtoolbar_face); + + /* Do the border */ + redisplay_clear_region (window, toolbar_findex, + x, y, + (vert ? bar_width : border_width), + (vert ? border_width : bar_height)); + redisplay_clear_region (window, toolbar_findex, + (vert ? x : x + bar_width - border_width), + (vert ? y + bar_height - border_width : y), + (vert ? bar_width : border_width), + (vert ? border_width : bar_height)); + + if (vert) + { + max_pixpos = y + bar_height - border_width; + y += border_width; + } + else + { + max_pixpos = x + bar_width - border_width; + x += border_width; + } + + button = FRAME_TOOLBAR_BUTTONS (f, pos); + right_size = 0; + + /* First loop over all of the buttons to determine how much room we + need for left hand and right hand buttons. This loop will also + make sure that all instances are instantiated so when we actually + output them they will come up immediately. */ + while (!NILP (button)) + { + struct toolbar_button *tb = XTOOLBAR_BUTTON (button); + int size = xlike_get_button_size (f, window, tb, vert, pos); + + if (tb->pushright) + right_size += size; + + button = tb->next; + } + + button = FRAME_TOOLBAR_BUTTONS (f, pos); + + /* Loop over the left buttons, updating and outputting them. */ + XLIKE_OUTPUT_BUTTONS_LOOP (1); + + /* Now determine where the right buttons start. */ + right_start = max_pixpos - right_size; + if (right_start < (vert ? y : x)) + right_start = (vert ? y : x); + + /* Output the blank which goes from the end of the left buttons to + the start of the right. */ + blank_size = right_start - (vert ? y : x); + if (blank_size) + { + int height, width; + + if (vert) + { + width = bar_width; + height = blank_size; + } + else + { + width = blank_size; + height = bar_height; + } + + /* + * Use a 3D pushright separator only if there isn't a toolbar + * border. A flat separator meshes with the border and looks + * better. + */ + if (1) + { + struct toolbar_button tb; + + tb.x = x; + tb.y = y; + tb.width = width; + tb.height = height; + tb.border_width = border_width; + tb.vertical = vert; + tb.enabled = 1; + tb.up_glyph = border_width ? Qt : Qnil; + + __prepare_button_area (f, &tb); + } + + if (vert) + y += height; + else + x += width; + } + + /* Loop over the right buttons, updating and outputting them. */ + XLIKE_OUTPUT_BUTTONS_LOOP (0); + + if (!vert) + { + Lisp_Object frame = wrap_frame (f); + + redisplay_clear_region (frame, + DEFAULT_INDEX, FRAME_PIXWIDTH (f) - 1, y, 1, + bar_height); + } + + SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1); + __INTERNAL_FLUSH (XDEVICE (f->device)); +} + +static void +xlike_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change) +{ + Lisp_Object frame; + int x, y, width, height, vert; + + get_toolbar_coords (f, pos, &x, &y, &width, &height, &vert, 1); + frame = wrap_frame (f); + + /* The thickness_change parameter is used by the toolbar resize routines + to clear any excess toolbar if the size shrinks. */ + if (thickness_change < 0) + { + if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR) + { + x = x + width + thickness_change; + width = -thickness_change; + } + else + { + y = y + height + thickness_change; + height = -thickness_change; + } + } + + SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0); + + redisplay_clear_region (frame, DEFAULT_INDEX, x, y, width, height); + + __INTERNAL_FLUSH (XDEVICE (f->device)); +} + +void +xlike_output_frame_toolbars (struct frame *f) +{ + __INTERNAL_APPROPRIATENESS_CHECK(f); + + if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)) + xlike_output_toolbar (f, TOP_TOOLBAR); + + if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)) + xlike_output_toolbar (f, BOTTOM_TOOLBAR); + + if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f)) + xlike_output_toolbar (f, LEFT_TOOLBAR); + + if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f)) + xlike_output_toolbar (f, RIGHT_TOOLBAR); +} + +void +xlike_clear_frame_toolbars (struct frame *f) +{ + __INTERNAL_APPROPRIATENESS_CHECK(f); + + if (f->top_toolbar_was_visible + && !FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)) + xlike_clear_toolbar (f, TOP_TOOLBAR, 0); + if (f->bottom_toolbar_was_visible + && !FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)) + xlike_clear_toolbar (f, BOTTOM_TOOLBAR, 0); + if (f->left_toolbar_was_visible + && !FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f)) + xlike_clear_toolbar (f, LEFT_TOOLBAR, 0); + if (f->right_toolbar_was_visible + && !FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f)) + xlike_clear_toolbar (f, RIGHT_TOOLBAR, 0); +} + +static void +xlike_redraw_exposed_toolbar (struct frame *f, enum toolbar_pos pos, int x, int y, + int width, int height) +{ + int bar_x, bar_y, bar_width, bar_height, vert; + Lisp_Object button = FRAME_TOOLBAR_BUTTONS (f, pos); + + get_toolbar_coords (f, pos, &bar_x, &bar_y, &bar_width, &bar_height, + &vert, 1); + + if (((y + height) < bar_y) || (y > (bar_y + bar_height))) + return; + if (((x + width) < bar_x) || (x > (bar_x + bar_width))) + return; + + while (!NILP (button)) + { + struct toolbar_button *tb = XTOOLBAR_BUTTON (button); + + if (vert) + { + if (((tb->y + tb->height) > y) && (tb->y < (y + height))) + tb->dirty = 1; + + /* If this is true we have gone past the exposed region. */ + if (tb->y > (y + height)) + break; + } + else + { + if (((tb->x + tb->width) > x) && (tb->x < (x + width))) + tb->dirty = 1; + + /* If this is true we have gone past the exposed region. */ + if (tb->x > (x + width)) + break; + } + + button = tb->next; + } + + /* Even if none of the buttons is in the area, the blank region at + the very least must be because the first thing we did is verify + that some portion of the toolbar is in the exposed region. */ + xlike_output_toolbar (f, pos); +} + +void +xlike_redraw_exposed_toolbars (struct frame *f, int x, int y, int width, + int height) +{ + __INTERNAL_APPROPRIATENESS_CHECK(f); + + if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)) + xlike_redraw_exposed_toolbar (f, TOP_TOOLBAR, x, y, width, height); + + if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)) + xlike_redraw_exposed_toolbar (f, BOTTOM_TOOLBAR, x, y, width, height); + + if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f)) + xlike_redraw_exposed_toolbar (f, LEFT_TOOLBAR, x, y, width, height); + + if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f)) + xlike_redraw_exposed_toolbar (f, RIGHT_TOOLBAR, x, y, width, height); +} + +void +xlike_redraw_frame_toolbars (struct frame *f) +{ + /* There are certain startup paths that lead to update_EmacsFrame in + faces.c being called before a new frame is fully initialized. In + particular before we have actually mapped it. That routine can + call this one. So, we need to make sure that the frame is + actually ready before we try and draw all over it. */ + if (__INTERNAL_MAPPED_P(f)) + xlike_redraw_exposed_toolbars (f, 0, 0, FRAME_PIXWIDTH (f), + FRAME_PIXHEIGHT (f)); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/toolbar-xlike.h Wed Feb 03 21:46:21 2010 -0600 @@ -0,0 +1,21 @@ +/* toolbar-xlike.h +** +** Description: +** +** Created by: William M. Perry +** Copyright (c) 2001 Free Software Foundation +** +*/ + +#ifndef __TOOLBAR_XLIKE_H__ +#define __TOOLBAR_XLIKE_H__ + +extern void xlike_output_frame_toolbars (struct frame *f); +extern void xlike_redraw_exposed_toolbars (struct frame *f, + int x, int y, + int width, int height); +extern void xlike_redraw_frame_toolbars (struct frame *f); +extern void xlike_output_toolbar_button (struct frame *f, Lisp_Object button); +extern void xlike_clear_frame_toolbars (struct frame *f); + +#endif /* __TOOLBAR_XLIKE_H__ */
--- a/src/xgccache.c Wed Feb 03 21:06:14 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,362 +0,0 @@ -/* Efficient caching of X GCs (graphics contexts). - Copyright (C) 1993 Free Software Foundation, Inc. - Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. - -This file is part of XEmacs. - -XEmacs is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -XEmacs is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Synched up with: Not in FSF. */ - -/* Emacs uses a lot of different display attributes; for example, assume - that only four fonts are in use (normal, bold, italic, and bold-italic). - Then assume that one stipple or background is used for text selections, - and another is used for highlighting mousable regions. That makes 16 - GCs already. Add in the fact that another GC may be needed to display - the text cursor in any of those regions, and you've got 32. Add in - more fonts, and it keeps increasing exponentially. - - We used to keep these GCs in a cache of merged (fully qualified) faces. - However, a lot of other code in xterm.c used XChangeGC of existing GCs, - which is kind of slow and kind of random. Also, managing the face cache - was tricky because it was hard to know when a face was no longer visible - on the frame -- we had to mark all frames as garbaged whenever a face - was changed, which caused an unpleasant amount of flicker (since faces are - created/destroyed (= changed) whenever a frame is created/destroyed. - - So this code maintains a cache at the GC level instead of at the face - level. There is an upper limit on the size of the cache, after which we - will stop creating GCs and start reusing them (reusing the least-recently- - used ones first). So if faces get changed, their GCs will eventually be - recycled. Also more sharing of GCs is possible. - - This code uses hash tables. It could be that, if the cache size is small - enough, a linear search might be faster; but I doubt it, since we need - `equal' comparisons, not `eq', and I expect that the optimal cache size - will be ~100. - - Written by jwz, 14 jun 93 - */ - -#include <config.h> -#include "lisp.h" -#include "hash.h" - -#include "xgccache.h" - -#define GC_CACHE_SIZE 100 - -#define GCCACHE_HASH - -struct gcv_and_mask { - XGCValues gcv; - unsigned long mask; -}; - -struct gc_cache_cell { - GC gc; - struct gcv_and_mask gcvm; - struct gc_cache_cell *prev, *next; -}; - -struct gc_cache { - Display *dpy; /* used only as arg to XCreateGC/XFreeGC */ - Window window; /* used only as arg to XCreateGC */ - int size; - struct gc_cache_cell *head; - struct gc_cache_cell *tail; -#ifdef GCCACHE_HASH - struct hash_table *table; -#endif - - int create_count; - int delete_count; -}; - -#ifdef GCCACHE_HASH -static Hashcode -gc_cache_hash (const void *arg) -{ - const struct gcv_and_mask *gcvm = (const struct gcv_and_mask *) arg; - unsigned long *longs = (unsigned long *) &gcvm->gcv; - Hashcode hash = gcvm->mask; - int i; - /* This could look at the mask and only use the used slots in the - hash code. That would win in that we wouldn't have to initialize - every slot of the gcv when calling gc_cache_lookup. But we need - the hash function to be as fast as possible; some timings should - be done. */ - for (i = 0; i < (int) (sizeof (XGCValues) / sizeof (unsigned long)); i++) - hash = (hash << 1) ^ *longs++; - return hash; -} - -#endif /* GCCACHE_HASH */ - -static int -gc_cache_eql (const void *arg1, const void *arg2) -{ - /* See comment in gc_cache_hash */ - return !memcmp (arg1, arg2, sizeof (struct gcv_and_mask)); -} - -struct gc_cache * -make_gc_cache (Display *dpy, Window window) -{ - struct gc_cache *cache = xnew (struct gc_cache); - cache->dpy = dpy; - cache->window = window; - cache->size = 0; - cache->head = cache->tail = 0; - cache->create_count = cache->delete_count = 0; -#ifdef GCCACHE_HASH - cache->table = - make_general_hash_table (GC_CACHE_SIZE, gc_cache_hash, gc_cache_eql); -#endif - return cache; -} - -void -free_gc_cache (struct gc_cache *cache) -{ - struct gc_cache_cell *rest, *next; - rest = cache->head; - while (rest) - { - XFreeGC (cache->dpy, rest->gc); - next = rest->next; - xfree (rest, struct gc_cache_cell *); - rest = next; - } -#ifdef GCCACHE_HASH - free_hash_table (cache->table); -#endif - xfree (cache, struct gc_cache *); -} - -GC -gc_cache_lookup (struct gc_cache *cache, XGCValues *gcv, unsigned long mask) -{ - struct gc_cache_cell *cell, *next, *prev; - struct gcv_and_mask gcvm; - -#ifdef DEBUG_XEMACS - (void) describe_gc_cache (cache, DGCCFLAG_DISABLE); -#endif - - if ((!!cache->head) != (!!cache->tail)) ABORT (); - if (cache->head && (cache->head->prev || cache->tail->next)) ABORT (); - - gcvm.mask = mask; - gcvm.gcv = *gcv; /* this copies... */ - -#ifdef GCCACHE_HASH - - /* The intermediate cast fools gcc into not outputting strict-aliasing - complaints */ - if (gethash (&gcvm, cache->table, (const void **) (void *) &cell)) - -#else /* !GCCACHE_HASH */ - - cell = cache->tail; /* start at the end (most recently used) */ - while (cell) - { - if (gc_cache_eql (&gcvm, &cell->gcvm)) - break; - else - cell = cell->prev; - } - - /* #### This whole file needs some serious overhauling. */ - if (!(mask | GCTile) && cell->gc->values.tile) - cell = 0; - else if (!(mask | GCStipple) && cell->gc->values.stipple) - cell = 0; - - if (cell) - -#endif /* !GCCACHE_HASH */ - - { - /* Found a cell. Move this cell to the end of the list, so that it - will be less likely to be collected than a cell that was accessed - less recently. - */ -#if 0 - debug_out ("Returning cached GC: %08lx\n", XE_GCONTEXT(cell)); -#endif - if (cell == cache->tail) - return cell->gc; - - next = cell->next; - prev = cell->prev; - if (prev) prev->next = next; - if (next) next->prev = prev; - if (cache->head == cell) cache->head = next; - cell->next = 0; - cell->prev = cache->tail; - cache->tail->next = cell; - cache->tail = cell; - if (cache->head == cell) ABORT (); - if (cell->next) ABORT (); - if (cache->head->prev) ABORT (); - if (cache->tail->next) ABORT (); - return cell->gc; - } - - /* else, cache miss. */ - - if (cache->size == GC_CACHE_SIZE) - /* Reuse the first cell on the list (least-recently-used). - Remove it from the list, and unhash it from the table. - */ - { - cell = cache->head; - cache->head = cell->next; - cache->head->prev = 0; - if (cache->tail == cell) cache->tail = 0; /* only one */ -#if 0 - debug_out ("Cache full, freeing GC: %08lx\n ", XE_GCONTEXT(cell)); -#endif - XFreeGC (cache->dpy, cell->gc); - cache->delete_count++; -#ifdef GCCACHE_HASH - remhash (&cell->gcvm, cache->table); -#endif - } - else if (cache->size > GC_CACHE_SIZE) - ABORT (); - else - { - /* Allocate a new cell (don't put it in the list or table yet). */ - cell = xnew (struct gc_cache_cell); - cache->size++; - } - - /* Now we've got a cell (new or reused). Fill it in. */ - memcpy (&cell->gcvm.gcv, gcv, sizeof (XGCValues)); - cell->gcvm.mask = mask; - - /* Put the cell on the end of the list. */ - cell->next = 0; - cell->prev = cache->tail; - if (cache->tail) cache->tail->next = cell; - cache->tail = cell; - if (! cache->head) cache->head = cell; - - cache->create_count++; -#ifdef GCCACHE_HASH - /* Hash it in the table */ - puthash (&cell->gcvm, cell, cache->table); -#endif - - /* Now make and return the GC. */ - cell->gc = XCreateGC (cache->dpy, cache->window, mask, gcv); - - /* debug */ - assert (cell->gc == gc_cache_lookup (cache, gcv, mask)); - -#if 0 - debug_out ("Returning new GC: %08lx\n ", XE_GCONTEXT(cell)); -#endif - return cell->gc; -} - - -#ifdef DEBUG_XEMACS - -/* FLAGS - The flags argument is a bitwise or of any of the following: - - DGCCFLAG_SUMMARY Summary statistics for cache - DGCCFLAG_LIST_CELLS If summary is being printed, print cell IDs too. - DGCCFLAG_CELL_DETAILS If cell IDs are being printed, additionally - print the internal fields used and values. - - DGCCFLAG_DEFAULT A predefined combination giving whatever the - maintainers are currently interested in seeing. -*/ -void -describe_gc_cache (struct gc_cache *cache, int flags) -{ - int count = 0; - struct gc_cache_cell *cell = cache->head; - - if (! flags & DGCCFLAG_SUMMARY) return; - - stderr_out ("\nsize: %d", cache->size); - stderr_out ("\ncreated: %d", cache->create_count); - stderr_out ("\ndeleted: %d", cache->delete_count); - - if (flags & DGCCFLAG_LIST_CELLS) - while (cell) - { - struct gc_cache_cell *cell2; - int i = 0; - stderr_out ("\n%d:\t0x%lx GC: 0x%08lx hash: 0x%08lx\n", - count, (long) cell, (long) XE_GCONTEXT(cell), - gc_cache_hash (&cell->gcvm)); - - for (cell2 = cache->head; cell2; cell2 = cell2->next, i++) - if (count != i && - gc_cache_hash (&cell->gcvm) == gc_cache_hash (&cell2->gcvm)) - stderr_out ("\tHASH COLLISION with cell %d\n", i); - stderr_out ("\tmask: %8lx\n", cell->gcvm.mask); - - if (flags & DGCCFLAG_CELL_DETAILS) - { -#define FROB(field) do { \ - if ((int)cell->gcvm.gcv.field != (~0)) \ - stderr_out ("\t%-12s%8x\n", #field ":", (int)cell->gcvm.gcv.field); \ -} while (0) - FROB (function); - FROB (plane_mask); - FROB (foreground); - FROB (background); - FROB (line_width); - FROB (line_style); - FROB (cap_style); - FROB (join_style); - FROB (fill_style); - FROB (fill_rule); - FROB (arc_mode); - FROB (tile); - FROB (stipple); - FROB (ts_x_origin); - FROB (ts_y_origin); - FROB (font); - FROB (subwindow_mode); - FROB (graphics_exposures); - FROB (clip_x_origin); - FROB (clip_y_origin); - FROB (clip_mask); - FROB (dash_offset); -#undef FROB - } - - count++; - if (cell->next && cell == cache->tail) - stderr_out ("\nERROR! tail is here!\n\n"); - else if (!cell->next && cell != cache->tail) - stderr_out ("\nERROR! tail is not at the end\n\n"); - cell = cell->next; - } /* while (cell) */ - - if (count != cache->size) - stderr_out ("\nERROR! count should be %d\n\n", cache->size); -} - -#endif /* DEBUG_XEMACS */
--- a/src/xgccache.h Wed Feb 03 21:06:14 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* Efficient caching of X GCs (graphics contexts). - Copyright (C) 1993 Free Software Foundation, Inc. - - -This file is part of XEmacs. - -XEmacs is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -XEmacs is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Synched up with: Not in FSF. */ - -/* Written by jwz, 14 jun 93 */ - -#ifndef INCLUDED_xgccache_h_ -#define INCLUDED_xgccache_h_ - -#include <X11/Xlib.h> - -struct gc_cache; -struct gc_cache *make_gc_cache (Display *, Window); -void free_gc_cache (struct gc_cache *cache); -GC gc_cache_lookup (struct gc_cache *, XGCValues *, unsigned long mask); - -#define XE_GCONTEXT(cell) (XGContextFromGC(cell->gc)) - -#ifdef DEBUG_XEMACS - -void describe_gc_cache (struct gc_cache *cache, int flags); - -#define DGCCFLAG_DISABLE 0 -#define DGCCFLAG_SUMMARY 1 << 0 -#define DGCCFLAG_LIST_CELLS 1 << 1 -#define DGCCFLAG_CELL_DETAILS 1 << 2 -/* A combination of the flags above. */ -#define DGCCFLAG_DEFAULT DGCCFLAG_SUMMARY | DGCCFLAG_LIST_CELLS -#endif - -#endif /* INCLUDED_xgccache_h_ */