From facfbbbdad272decb23553d827fbc2c0fabaf078 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 17 Jul 2008 03:33:59 +0000 Subject: [PATCH] * Makefile.in: Undef LIB_STANDARD before defining it to silence warning in case it was defined already. USE @GNUSTEP_MAKEFILES@ rather than envvars. * nsterm.m (ns_term_init): Pass Qt and Qnil rather than YES/NO to ns_default. (applicationShouldTerminate, setValuesFromPanel): Use EQ to compare Lisp_Objects. * nsterm.h (Fx_display_grayscale_p, Fx_display_planes) (ns_defined_color, ns_color_to_lisp): Declare. * nsselect.m (ns_handle_selection_request, ns_handle_selection_clear) (Fns_own_selection_internal): Make the big ugly hack more explicit, so it's accepted even with USE_LISP_UNION_TYPE. * nsmenu.m (ns_update_menubar): Use EQ to compare Lisp_Objects. (update_frame_tool_bar): Remove apparently obsolete tests for non-integerness of f->tool_bar_lines. (windowShouldClose, addButton, clicked, runDialogAt): Make the big ugly hack more explicit, so it's accepted even with USE_LISP_UNION_TYPE. * nsfont.m (nsfont_driver): Use just 0 rather than an invalid cast. (nsfont_open): Don't confuse NULL for Qnil. * nsfns.m (ns_implicitly_set_icon_type): Use EQ to compare Lisp_Objects. * menu.h (find_and_call_menu_selection): * menu.c (find_and_call_menu_selection): Use just int for vector size. (find_and_return_menu_selection): Always return something. * frame.h: Include dispextern.h for Display_Info. (display_x_get_resource): Declare. * configure.in: Extract and substitute GNUSTEP_MAKEFILES. --- ChangeLog | 4 ++ configure | 40 ++++++++---- configure.in | 2 + src/.gitignore | 1 + src/ChangeLog | 32 +++++++++ src/Makefile.in | 8 +-- src/frame.h | 9 +++ src/menu.c | 3 +- src/menu.h | 2 +- src/nsfns.m | 139 +++++++++++++++++++-------------------- src/nsfont.m | 8 +-- src/nsmenu.m | 46 ++++++------- src/nsselect.m | 49 +++++++------- src/nsterm.h | 11 +++- src/nsterm.m | 168 ++++++++++++++++++++++++------------------------ 15 files changed, 299 insertions(+), 223 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf8bfe8350..5644ff7c81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-07-17 Stefan Monnier + + * configure.in: Extract and substitute GNUSTEP_MAKEFILES. + 2008-07-16 Adrian Robert * configure.in: Change GNUSTEP to NS_IMPL_GNUSTEP, COCOA to diff --git a/configure b/configure index 52f9f54d39..e2b2c36476 100755 --- a/configure +++ b/configure @@ -735,6 +735,7 @@ machfile opsysfile carbon_appdir ns_appdir +GNUSTEP_MAKEFILES LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias @@ -9337,6 +9338,7 @@ if test "${with_ns}" != no; then NS_IMPL_GNUSTEP=yes GNUSTEP_SYSTEM_HEADERS="$(source /etc/GNUstep/GNUstep.conf; echo $GNUSTEP_SYSTEM_HEADERS)" GNUSTEP_SYSTEM_LIBRARIES="$(source /etc/GNUstep/GNUstep.conf; echo $GNUSTEP_SYSTEM_LIBRARIES)" + GNUSTEP_MAKEFILES="$(source /etc/GNUstep/GNUstep.conf; echo $GNUSTEP_MAKEFILES)" CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" @@ -16905,6 +16907,7 @@ cat >>conftest.$ac_ext <<_ACEOF # endif #endif +#include #include #ifdef HAVE_UNISTD_H @@ -17053,12 +17056,15 @@ main () isn't worth using anyway. */ alarm (60); - for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) - continue; - time_t_max--; - if ((time_t) -1 < 0) - for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2) - continue; + for (;;) + { + t = (time_t_max << 1) + 1; + if (t <= time_t_max) + break; + time_t_max = t; + } + time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; + delta = time_t_max / 997; /* a suitable prime number */ for (i = 0; i < N_STRINGS; i++) { @@ -17073,10 +17079,12 @@ main () && mktime_test ((time_t) (60 * 60 * 24)))) return 1; - for (j = 1; 0 < j; j *= 2) + for (j = 1; ; j <<= 1) if (! bigtime_test (j)) return 1; - if (! bigtime_test (j - 1)) + else if (INT_MAX / 2 < j) + break; + if (! bigtime_test (INT_MAX)) return 1; } return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); @@ -18985,11 +18993,13 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include /* for off_t */ + #include int main () { -return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); +int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } @@ -19029,11 +19039,13 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 -#include +#include /* for off_t */ + #include int main () { -return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); +int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } @@ -24169,6 +24181,7 @@ fi + cat >>confdefs.h <<_ACEOF @@ -25193,10 +25206,11 @@ machfile!$machfile$ac_delim opsysfile!$opsysfile$ac_delim carbon_appdir!$carbon_appdir$ac_delim ns_appdir!$ns_appdir$ac_delim +GNUSTEP_MAKEFILES!$GNUSTEP_MAKEFILES$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 23; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.in b/configure.in index 94ffd228fc..b42b347242 100644 --- a/configure.in +++ b/configure.in @@ -1234,6 +1234,7 @@ if test "${with_ns}" != no; then NS_IMPL_GNUSTEP=yes GNUSTEP_SYSTEM_HEADERS="$(source /etc/GNUstep/GNUstep.conf; echo $GNUSTEP_SYSTEM_HEADERS)" GNUSTEP_SYSTEM_LIBRARIES="$(source /etc/GNUstep/GNUstep.conf; echo $GNUSTEP_SYSTEM_LIBRARIES)" + GNUSTEP_MAKEFILES="$(source /etc/GNUstep/GNUstep.conf; echo $GNUSTEP_MAKEFILES)" CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" @@ -2471,6 +2472,7 @@ AC_SUBST(opsysfile) AC_SUBST(GETLOADAVG_LIBS) AC_SUBST(carbon_appdir) AC_SUBST(ns_appdir) +AC_SUBST(GNUSTEP_MAKEFILES) AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}", [Define to the canonical Emacs configuration name.]) diff --git a/src/.gitignore b/src/.gitignore index 950ce883e7..bb195398ff 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,5 +1,6 @@ *-spd *.core +*.d *.pdb .gdb_history Makefile diff --git a/src/ChangeLog b/src/ChangeLog index a47586e08c..205a6a108f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,35 @@ +2008-07-17 Stefan Monnier + + Use SDATA. Follow coding convention of placing operators at + beginning of next line rather than end of previous line, and placing + spaces around infix operators. + + * Makefile.in: Undef LIB_STANDARD before defining it to silence warning + in case it was defined already. + USE @GNUSTEP_MAKEFILES@ rather than envvars. + * nsterm.m (ns_term_init): Pass Qt and Qnil rather than YES/NO to + ns_default. + (applicationShouldTerminate, setValuesFromPanel): Use EQ to compare + Lisp_Objects. + * nsterm.h (Fx_display_grayscale_p, Fx_display_planes) + (ns_defined_color, ns_color_to_lisp): Declare. + * nsselect.m (ns_handle_selection_request, ns_handle_selection_clear) + (Fns_own_selection_internal): Make the big ugly hack more explicit, so + it's accepted even with USE_LISP_UNION_TYPE. + * nsmenu.m (ns_update_menubar): Use EQ to compare Lisp_Objects. + (update_frame_tool_bar): Remove apparently obsolete tests for + non-integerness of f->tool_bar_lines. + (windowShouldClose, addButton, clicked, runDialogAt): Make the big ugly + hack more explicit, so it's accepted even with USE_LISP_UNION_TYPE. + * nsfont.m (nsfont_driver): Use just 0 rather than an invalid cast. + (nsfont_open): Don't confuse NULL for Qnil. + * nsfns.m (ns_implicitly_set_icon_type): Use EQ to compare Lisp_Objects. + * menu.h (find_and_call_menu_selection): + * menu.c (find_and_call_menu_selection): Use just int for vector size. + (find_and_return_menu_selection): Always return something. + * frame.h: Include dispextern.h for Display_Info. + (display_x_get_resource): Declare. + 2008-07-16 Adrian Robert * syntax.c: Remove stdio.h include accidentally introduced in diff --git a/src/Makefile.in b/src/Makefile.in index a715b83be2..cba9dffddc 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -114,6 +114,7 @@ SHELL=/bin/sh /* Under GNUstep, putting libc on the link line causes problems. */ #ifdef NS_IMPL_GNUSTEP +#undef LIB_STANDARD #define LIB_STANDARD #endif @@ -238,8 +239,8 @@ STARTFILES = START_FILES /* Pull in stuff from GNUstep-make. */ FOUNDATION_LIB=gnu GUI_LIB=gnu -include $(GNUSTEP_MAKEFILES)/Additional/base.make -include $(GNUSTEP_MAKEFILES)/Additional/gui.make +include @GNUSTEP_MAKEFILES@/Additional/base.make +include @GNUSTEP_MAKEFILES@/Additional/gui.make shared=no #endif @@ -899,8 +900,7 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \ ../lisp/mouse.elc \ ../lisp/term/x-win.elc \ ../lisp/term/ns-win.elc \ - ../lisp/ns-carbon-compat.elc \ - ../lisp/emacs-lisp/easymenu.elc + ../lisp/ns-carbon-compat.elc /* Construct full set of libraries to be linked. Note that SunOS needs -lm to come before -lc; otherwise, you get diff --git a/src/frame.h b/src/frame.h index b744c9e56b..d070feeaef 100644 --- a/src/frame.h +++ b/src/frame.h @@ -24,6 +24,8 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_FRAME_H #define EMACS_FRAME_H +#include "dispextern.h" + /* Miscellanea. */ @@ -1114,6 +1116,13 @@ extern void x_set_alpha P_ ((struct frame *, Lisp_Object, Lisp_Object)); extern void validate_x_resource_name P_ ((void)); +extern Lisp_Object display_x_get_resource (Display_Info *, + Lisp_Object attribute, + Lisp_Object class, + Lisp_Object component, + Lisp_Object subclass); + + #endif /* HAVE_WINDOW_SYSTEM */ #endif /* not EMACS_FRAME_H */ diff --git a/src/menu.c b/src/menu.c index 969225d4c7..e3882dbd96 100644 --- a/src/menu.c +++ b/src/menu.c @@ -881,7 +881,7 @@ update_submenu_strings (first_wv) void find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) FRAME_PTR f; - EMACS_INT menu_bar_items_used; + int menu_bar_items_used; Lisp_Object vector; void *client_data; { @@ -1023,6 +1023,7 @@ find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data) i += MENU_ITEMS_ITEM_LENGTH; } } + return Qnil; } #endif diff --git a/src/menu.h b/src/menu.h index 2bf912f9f7..b91f2891a7 100644 --- a/src/menu.h +++ b/src/menu.h @@ -29,7 +29,7 @@ extern void list_of_panes P_ ((Lisp_Object)); #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) extern void free_menubar_widget_value_tree P_ ((widget_value *)); extern void update_submenu_strings P_ ((widget_value *)); -extern void find_and_call_menu_selection P_ ((FRAME_PTR, EMACS_INT, +extern void find_and_call_menu_selection P_ ((FRAME_PTR, int, Lisp_Object, void *)); #endif diff --git a/src/nsfns.m b/src/nsfns.m index b996ecf89a..8ec6518aea 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -268,7 +268,7 @@ ns_display_info_for_name (name) dpyinfo = ns_display_list; if (dpyinfo == 0) - error ("OpenStep on %s not responding.\n", XSTRING (name)->data); + error ("OpenStep on %s not responding.\n", SDATA (name)); return dpyinfo; } @@ -401,8 +401,8 @@ ns_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (face) { col = NS_FACE_BACKGROUND (face); - face->background = - (EMACS_UINT) [[col colorWithAlphaComponent: alpha] retain]; + face->background + = (EMACS_UINT) [[col colorWithAlphaComponent: alpha] retain]; [col release]; update_face_from_frame_parameter (f, Qbackground_color, arg); @@ -478,11 +478,11 @@ ns_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if ([[view window] miniwindowTitle] && ([[[view window] miniwindowTitle] isEqualToString: [NSString stringWithUTF8String: - XSTRING (arg)->data]])) + SDATA (arg)]])) return; [[view window] setMiniwindowTitle: - [NSString stringWithUTF8String: XSTRING (arg)->data]]; + [NSString stringWithUTF8String: SDATA (arg)]]; } @@ -527,11 +527,11 @@ ns_set_name_iconic (struct frame *f, Lisp_Object name, int explicit) if ([[view window] miniwindowTitle] && ([[[view window] miniwindowTitle] isEqualToString: [NSString stringWithUTF8String: - XSTRING (name)->data]])) + SDATA (name)]])) return; [[view window] setMiniwindowTitle: - [NSString stringWithUTF8String: XSTRING (name)->data]]; + [NSString stringWithUTF8String: SDATA (name)]]; } @@ -573,10 +573,10 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit) /* Don't change the name if it's already NAME. */ if ([[[view window] title] isEqualToString: [NSString stringWithUTF8String: - XSTRING (name)->data]]) + SDATA (name)]]) return; [[view window] setTitle: [NSString stringWithUTF8String: - XSTRING (name)->data]]; + SDATA (name)]]; } @@ -660,7 +660,7 @@ ns_set_name_as_filename (struct frame *f) title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String] : [[[view window] title] UTF8String]; - if (title && (! strcmp (title, XSTRING (name)->data))) + if (title && (! strcmp (title, SDATA (name)))) { [pool release]; UNBLOCK_INPUT; @@ -673,7 +673,7 @@ ns_set_name_as_filename (struct frame *f) /* work around a bug observed on 10.3 where setTitleWithRepresentedFilename does not clear out previous state if given filename does not exist */ - NSString *str = [NSString stringWithUTF8String: XSTRING (name)->data]; + NSString *str = [NSString stringWithUTF8String: SDATA (name)]; if (![[NSFileManager defaultManager] fileExistsAtPath: str]) { [[view window] setTitleWithRepresentedFilename: @""]; @@ -685,14 +685,14 @@ ns_set_name_as_filename (struct frame *f) } #else [[view window] setTitleWithRepresentedFilename: - [NSString stringWithUTF8String: XSTRING (name)->data]]; + [NSString stringWithUTF8String: SDATA (name)]]; #endif f->name = name; } else { [[view window] setMiniwindowTitle: - [NSString stringWithUTF8String: XSTRING (name)->data]]; + [NSString stringWithUTF8String: SDATA (name)]]; } [pool release]; UNBLOCK_INPUT; @@ -806,7 +806,7 @@ ns_implicitly_set_icon_type (struct frame *f) BLOCK_INPUT; pool = [[NSAutoreleasePool alloc] init]; if (f->output_data.ns->miniimage - && [[NSString stringWithUTF8String: XSTRING (f->name)->data] + && [[NSString stringWithUTF8String: SDATA (f->name)] isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]]) { [pool release]; @@ -828,10 +828,10 @@ ns_implicitly_set_icon_type (struct frame *f) { elt = XCAR (chain); /* special case: 't' means go by file type */ - if (SYMBOLP (elt) && elt == Qt && XSTRING (f->name)->data[0] == '/') + if (SYMBOLP (elt) && EQ (elt, Qt) && SDATA (f->name)[0] == '/') { - NSString *str = - [NSString stringWithUTF8String: XSTRING (f->name)->data]; + NSString *str + = [NSString stringWithUTF8String: SDATA (f->name)]; if ([[NSFileManager defaultManager] fileExistsAtPath: str]) image = [[[NSWorkspace sharedWorkspace] iconForFile: str] retain]; } @@ -844,7 +844,7 @@ ns_implicitly_set_icon_type (struct frame *f) if (image == nil) image = [[NSImage imageNamed: [NSString stringWithUTF8String: - XSTRING (XCDR (elt))->data]] retain]; + SDATA (XCDR (elt))]] retain]; } } @@ -873,7 +873,7 @@ ns_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (!NILP (arg) && SYMBOLP (arg)) { - arg =build_string (XSTRING (XSYMBOL (arg)->xname)->data); + arg =build_string (SDATA (SYMBOL_NAME (arg))); store_frame_param (f, Qicon_type, arg); } @@ -889,7 +889,7 @@ ns_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) image = [EmacsImage allocInitFromFile: arg]; if (image == nil) image =[NSImage imageNamed: [NSString stringWithUTF8String: - XSTRING (arg)->data]]; + SDATA (arg)]]; if (image == nil) { @@ -918,9 +918,9 @@ ns_lisp_to_cursor_type (Lisp_Object arg) { char *str; if (XTYPE (arg) == Lisp_String) - str =XSTRING (arg)->data; + str = SDATA (arg); else if (XTYPE (arg) == Lisp_Symbol) - str =XSTRING (XSYMBOL (arg)->xname)->data; + str = SDATA (SYMBOL_NAME (arg)); else return -1; if (!strcmp (str, "box")) return filled_box; if (!strcmp (str, "hollow")) return hollow_box; @@ -1125,8 +1125,8 @@ be shared by the new frame.") be set. */ if (EQ (name, Qunbound) || NILP (name) || (XTYPE (name) != Lisp_String)) { - f->name = - build_string ([[[NSProcessInfo processInfo] processName] UTF8String]); + f->name + = build_string ([[[NSProcessInfo processInfo] processName] UTF8String]); f->explicit_name =0; } else @@ -1197,15 +1197,15 @@ be shared by the new frame.") /* default scrollbars on right on Mac */ { - Lisp_Object spos = + Lisp_Object spos #ifdef NS_IMPL_GNUSTEP - Qt; + = Qt; #else - Qright; + = Qright; #endif - x_default_parameter (f, parms, Qvertical_scroll_bars, spos, - "verticalScrollBars", "VerticalScrollBars", - RES_TYPE_SYMBOL); + x_default_parameter (f, parms, Qvertical_scroll_bars, spos, + "verticalScrollBars", "VerticalScrollBars", + RES_TYPE_SYMBOL); } x_default_parameter (f, parms, Qforeground_color, build_string ("Black"), "foreground", "Foreground", RES_TYPE_STRING); @@ -1236,30 +1236,31 @@ be shared by the new frame.") /*PENDING: other terms seem to get away w/o this complexity.. */ if (NILP (Fassq (Qwidth, parms))) { - Lisp_Object value = - x_get_arg (dpyinfo, parms, Qwidth, "width", "Width", RES_TYPE_NUMBER); + Lisp_Object value + = x_get_arg (dpyinfo, parms, Qwidth, "width", "Width", + RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parms = Fcons (Fcons (Qwidth, value), parms); } if (NILP (Fassq (Qheight, parms))) { - Lisp_Object value = - x_get_arg (dpyinfo, parms, Qheight, "height", "Height", - RES_TYPE_NUMBER); + Lisp_Object value + = x_get_arg (dpyinfo, parms, Qheight, "height", "Height", + RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parms = Fcons (Fcons (Qheight, value), parms); } if (NILP (Fassq (Qleft, parms))) { - Lisp_Object value = - x_get_arg (dpyinfo, parms, Qleft, "left", "Left", RES_TYPE_NUMBER); + Lisp_Object value + = x_get_arg (dpyinfo, parms, Qleft, "left", "Left", RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parms = Fcons (Fcons (Qleft, value), parms); } if (NILP (Fassq (Qtop, parms))) { - Lisp_Object value = - x_get_arg (dpyinfo, parms, Qtop, "top", "Top", RES_TYPE_NUMBER); + Lisp_Object value + = x_get_arg (dpyinfo, parms, Qtop, "top", "Top", RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parms = Fcons (Fcons (Qtop, value), parms); } @@ -1277,8 +1278,8 @@ be shared by the new frame.") f->output_data.ns->hand_cursor = [NSCursor pointingHandCursor]; f->output_data.ns->hourglass_cursor = [NSCursor disappearingItemCursor]; f->output_data.ns->horizontal_drag_cursor = [NSCursor resizeLeftRightCursor]; - FRAME_NS_DISPLAY_INFO (f)->vertical_scroll_bar_cursor = - [NSCursor arrowCursor]; + FRAME_NS_DISPLAY_INFO (f)->vertical_scroll_bar_cursor + = [NSCursor arrowCursor]; f->output_data.ns->current_pointer = f->output_data.ns->text_cursor; [[EmacsView alloc] initFrameFromEmacs: f]; @@ -1435,12 +1436,12 @@ Set ISLOAD non-nil if file being read for a save.") NSString *fname; NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil : - [NSString stringWithUTF8String: XSTRING (prompt)->data]; + [NSString stringWithUTF8String: SDATA (prompt)]; NSString *dirS = NILP (dir) || !STRINGP (dir) ? - [NSString stringWithUTF8String: XSTRING (current_buffer->directory)->data] : - [NSString stringWithUTF8String: XSTRING (dir)->data]; + [NSString stringWithUTF8String: SDATA (current_buffer->directory)] : + [NSString stringWithUTF8String: SDATA (dir)]; NSString *initS = NILP (init) || !STRINGP (init) ? nil : - [NSString stringWithUTF8String: XSTRING (init)->data]; + [NSString stringWithUTF8String: SDATA (init)]; check_ns (); @@ -1502,12 +1503,12 @@ If OWNER is nil, Emacs is assumed.") /*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name)); */ value =[[[NSUserDefaults standardUserDefaults] - objectForKey: [NSString stringWithUTF8String: XSTRING (name)->data]] + objectForKey: [NSString stringWithUTF8String: SDATA (name)]] UTF8String]; if (value) return build_string (value); -/*fprintf (stderr, "Nothing found for NS resource '%s'.\n", XSTRING (name)->data); */ +/*fprintf (stderr, "Nothing found for NS resource '%s'.\n", SDATA (name)); */ return Qnil; } @@ -1521,22 +1522,22 @@ If VALUE is nil, the default is removed.") { check_ns (); if (NILP (owner)) - owner = - build_string ([[[NSProcessInfo processInfo] processName] UTF8String]); + owner + = build_string ([[[NSProcessInfo processInfo] processName] UTF8String]); CHECK_STRING (owner); CHECK_STRING (name); if (NILP (value)) { [[NSUserDefaults standardUserDefaults] removeObjectForKey: - [NSString stringWithUTF8String: XSTRING (name)->data]]; + [NSString stringWithUTF8String: SDATA (name)]]; } else { CHECK_STRING (value); [[NSUserDefaults standardUserDefaults] setObject: - [NSString stringWithUTF8String: XSTRING (value)->data] + [NSString stringWithUTF8String: SDATA (value)] forKey: [NSString stringWithUTF8String: - XSTRING (name)->data]]; + SDATA (name)]]; } return Qnil; @@ -1763,10 +1764,10 @@ Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored.") { if (!NILP (must_succeed)) fatal ("OpenStep on %s not responding.\n", - XSTRING (display)->data); + SDATA (display)); else error ("OpenStep on %s not responding.\n", - XSTRING (display)->data); + SDATA (display)); } /* Register our external input/output types, used for determining @@ -1858,17 +1859,17 @@ DEFUN ("ns-emacs-info-panel", Fns_emacs_info_panel, Sns_emacs_info_panel, DEFUN ("x-list-fonts", Fns_list_fonts, Sns_list_fonts, 1, 4, 0, - "Return a list of the names of available fonts matching PATTERN.\n\ -If optional arguments FACE and FRAME are specified, return only fonts\n\ -the same size as FACE on FRAME.\n\ -If optional argument MAX is specified, return at most MAX matches.\n\ -\n\ -PATTERN is a regular expression; FACE is a face name - a symbol.\n\ -\n\ -The return value is a list of strings, suitable as arguments to\n\ -set-face-font.\n\ -\n\ -The font names are _NOT_ X names.") + doc: /* Return a list of the names of available fonts matching PATTERN. +If optional arguments FACE and FRAME are specified, return only fonts +the same size as FACE on FRAME. +If optional argument MAX is specified, return at most MAX matches. + +PATTERN is a regular expression; FACE is a face name - a symbol. + +The return value is a list of strings, suitable as arguments to +set-face-font. + +The font names are _NOT_ X names. */) (pattern, face, frame, max) Lisp_Object pattern, face, frame, max; { @@ -1906,7 +1907,7 @@ The font names are _NOT_ X names.") for (tem = flist; CONSP (tem); tem = XCDR (tem)) { Lisp_Object fname = XCAR (tem); - olist = Fcons (build_string (ns_xlfd_to_fontname (XSTRING (fname)->data)), + olist = Fcons (build_string (ns_xlfd_to_fontname (SDATA (fname))), olist); } @@ -2039,7 +2040,7 @@ Returns result of service as string or nil if no result.") CHECK_STRING (service); check_ns (); - utfStr = XSTRING (service)->data; + utfStr = SDATA (service); svcName = [NSString stringWithUTF8String: utfStr]; pb =[NSPasteboard pasteboardWithUniqueName]; @@ -2063,7 +2064,7 @@ DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc, NSString *utfStr; CHECK_STRING (str); - utfStr = [[NSString stringWithUTF8String: XSTRING (str)->data] + utfStr = [[NSString stringWithUTF8String: SDATA (str)] precomposedStringWithCanonicalMapping]; return build_string ([utfStr UTF8String]); } @@ -2448,7 +2449,7 @@ Text larger than the specified size is clipped. */) GCPRO4 (string, parms, frame, timeout); CHECK_STRING (string); - str = XSTRING (string)->data; + str = SDATA (string); f = check_x_frame (frame); if (NILP (timeout)) timeout = make_number (5); diff --git a/src/nsfont.m b/src/nsfont.m index 55c71a54c0..bbf991e7d4 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -234,7 +234,7 @@ static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, struct font_driver nsfont_driver = { - (Lisp_Object) NULL, /* Qns */ + 0, /* Qns */ 1, /* case sensitive */ nsfont_get_cache, nsfont_list, @@ -518,7 +518,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) font_info = (struct nsfont_info *) XFONT_OBJECT (font_object); font = (struct font *)font_info; if (!font) - return NULL; /*PENDING: this copies w32, but causes a segfault */ + return Qnil; /*PENDING: this copies w32, but causes a segfault */ if (NSFONT_TRACE) { @@ -571,7 +571,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) if (!nsfont) { fprintf (stderr, "*** Emacs.app: unable to load backup font\n"); - return NULL; + return Qnil; } } @@ -601,7 +601,7 @@ fprintf (stderr, "*** CACHE HIT!\n"); font_info->metrics = (struct font_metrics *) xmalloc (0x100 * sizeof (struct font_metrics *)); if (!font_info->glyphs || !font_info->metrics) - return NULL; + return Qnil; bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *)); bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *)); diff --git a/src/nsmenu.m b/src/nsmenu.m index e48a82b7d2..7fbc1b10c0 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -401,9 +401,9 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) { for (i = 0; icontents[4*i+1]; + string = AREF (items, 4*i+1); - if (!string) + if (EQ (string, make_number (0))) // FIXME: Why??? --Stef continue; if (NILP (string)) if (previous_strings[i][0]) @@ -691,10 +691,10 @@ name_is_separator (name) - (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f { NSString *titleStr = [NSString stringWithUTF8String: title]; - id item = - [self addItemWithTitle: titleStr - action: nil /*@selector (menuDown:) */ - keyEquivalent: @""]; + id item + = [self addItemWithTitle: titleStr + action: nil /*@selector (menuDown:) */ + keyEquivalent: @""]; EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; [self setSubmenu: submenu forItem: item]; [submenu release]; @@ -724,8 +724,9 @@ name_is_separator (name) [NSMenu popUpContextMenu: self withEvent: event forView: view]; retVal = context_menu_value; context_menu_value = 0; - return retVal > 0 ? - find_and_return_menu_selection (f, keymaps, (void *)retVal) : Qnil; + return retVal > 0 + ? find_and_return_menu_selection (f, keymaps, (void *)retVal) + : Qnil; } @end /* EmacsMenu */ @@ -1061,8 +1062,8 @@ ns_popup_menu (Lisp_Object position, Lisp_Object menu) /* If this item has a null value, make the call_data null so that it won't display a box when the mouse is on it. */ - wv->call_data = - !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0; + wv->call_data + = !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0; wv->enabled = !NILP (enable); if (NILP (type)) @@ -1157,9 +1158,6 @@ update_frame_tool_bar (FRAME_PTR f) int i; EmacsToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; - if (NILP (f->tool_bar_lines) || !INTEGERP (f->tool_bar_lines)) - return; - [toolbar clearActive]; /* update EmacsToolbar as in GtkUtils, build items list */ @@ -1294,8 +1292,8 @@ update_frame_tool_bar (FRAME_PTR f) helpText: (char *)help enabled: (BOOL)enabled { /* 1) come up w/identifier */ - NSString *identifier = - [NSString stringWithFormat: @"%u", [img hash]]; + NSString *identifier + = [NSString stringWithFormat: @"%u", [img hash]]; /* 2) create / reuse item */ NSToolbarItem *item = [identifierToItem objectForKey: identifier]; @@ -1557,7 +1555,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) NSSize spacing = {SPACER, SPACER}; NSRect area; char this_cmd_name[80]; - id cell, tem; + id cell; static NSImageView *imgView; static FlippedView *contentView; @@ -1649,7 +1647,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) - (BOOL)windowShouldClose: (id)sender { - [NSApp stopModalWithCode: Qnil]; + [NSApp stopModalWithCode: XHASH (Qnil)]; // FIXME: BIG UGLY HACK!! return NO; } @@ -1693,7 +1691,7 @@ void process_dialog (id window, Lisp_Object list) [cell setTarget: self]; [cell setAction: @selector (clicked: )]; [cell setTitle: [NSString stringWithUTF8String: str]]; - [cell setTag: (int)val]; + [cell setTag: XHASH (val)]; // FIXME: BIG UGLY HACK!! [cell setBordered: YES]; [cell setEnabled: YES]; @@ -1730,14 +1728,14 @@ void process_dialog (id window, Lisp_Object list) - clicked: sender { NSArray *sellist = nil; - Lisp_Object seltag; + EMACS_INT seltag; sellist = [sender selectedCells]; if ([sellist count]<1) return self; - seltag = (Lisp_Object)[[sellist objectAtIndex: 0] tag]; - if (! EQ (seltag, Qundefined)) + seltag = [[sellist objectAtIndex: 0] tag]; + if (seltag == XHASH (Qundefined)) // FIXME: BIG UGLY HACK!! [NSApp stopModalWithCode: seltag]; return self; } @@ -1844,7 +1842,11 @@ void process_dialog (id window, Lisp_Object list) } [NSApp endModalSession: session]; - return (Lisp_Object)ret; + { // FIXME: BIG UGLY HACK!!! + Lisp_Object tmp; + *(EMACS_INT*)(&tmp) = ret; + return tmp; + } } @end diff --git a/src/nsselect.m b/src/nsselect.m index 0b9927dbb5..4a7729d12d 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -108,15 +108,14 @@ clean_local_selection_data (Lisp_Object obj) if (VECTORP (obj)) { int i; - int size = XVECTOR (obj)->size; + int size = ASIZE (obj); Lisp_Object copy; if (size == 1) - return clean_local_selection_data (XVECTOR (obj)->contents [0]); - copy = Fmake_vector (size, Qnil); + return clean_local_selection_data (AREF (obj, 0)); + copy = Fmake_vector (make_number (size), Qnil); for (i = 0; i < size; i++) - XVECTOR (copy)->contents [i] - = clean_local_selection_data (XVECTOR (obj)->contents [i]); + AREF (copy, i) = clean_local_selection_data (AREF (obj, i)); return copy; } @@ -188,13 +187,13 @@ ns_get_local_selection (Lisp_Object selection_name, CHECK_SYMBOL (target_type); handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); if (!NILP (handler_fn)) - value =call3 (handler_fn, selection_name, target_type, + value = call3 (handler_fn, selection_name, target_type, XCAR (XCDR (local_value))); else - value =Qnil; + value = Qnil; unbind_to (count, Qnil); - check =value; + check = value; if (CONSP (value) && SYMBOLP (XCAR (value))) { type = XCAR (value); @@ -213,9 +212,12 @@ ns_get_local_selection (Lisp_Object selection_name, && NILP (XCDR (XCDR (check)))))) return value; + // FIXME: Why `quit' rather than `error'? Fsignal (Qquit, Fcons (build_string ( "invalid data returned by selection-conversion function"), Fcons (handler_fn, Fcons (value, Qnil)))); + // FIXME: Beware, `quit' can return!! + return Qnil; } @@ -231,15 +233,16 @@ ns_get_foreign_selection (Lisp_Object symbol, Lisp_Object target) static void ns_handle_selection_request (struct input_event *event) { - id pb =(id)event->x; - NSString *type =(NSString *)event->y; + // FIXME: BIG UGLY HACK!!! + id pb = (id)*(EMACS_INT*)&(event->x); + NSString *type = (NSString *)*(EMACS_INT*)&(event->y); Lisp_Object selection_name, selection_data, target_symbol, data; Lisp_Object successful_p, rest; - selection_name =ns_string_to_symbol ([(NSPasteboard *)pb name]); - target_symbol =ns_string_to_symbol (type); + selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]); + target_symbol = ns_string_to_symbol (type); selection_data = assq_no_quit (selection_name, Vselection_alist); - successful_p =Qnil; + successful_p = Qnil; if (!NILP (selection_data)) { @@ -248,13 +251,13 @@ ns_handle_selection_request (struct input_event *event) { if (STRINGP (data)) ns_string_to_pasteboard_internal (pb, data, type); - successful_p =Qt; + successful_p = Qt; } } if (!EQ (Vns_sent_selection_hooks, Qunbound)) { - for (rest =Vns_sent_selection_hooks;CONSP (rest); rest =Fcdr (rest)) + for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest)) call3 (Fcar (rest), selection_name, target_symbol, successful_p); } } @@ -263,11 +266,11 @@ ns_handle_selection_request (struct input_event *event) static void ns_handle_selection_clear (struct input_event *event) { - id pb = (id)event->x; + id pb = (id)*(EMACS_INT*)&(event->x); Lisp_Object selection_name, selection_data, rest; - selection_name =ns_string_to_symbol ([(NSPasteboard *)pb name]); - selection_data =assq_no_quit (selection_name, Vselection_alist); + selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]); + selection_data = assq_no_quit (selection_name, Vselection_alist); if (NILP (selection_data)) return; if (EQ (selection_data, Fcar (Vselection_alist))) @@ -281,7 +284,7 @@ ns_handle_selection_clear (struct input_event *event) if (!EQ (Vns_lost_selection_hooks, Qunbound)) { - for (rest =Vns_lost_selection_hooks;CONSP (rest); rest =Fcdr (rest)) + for (rest = Vns_lost_selection_hooks;CONSP (rest); rest = Fcdr (rest)) call1 (Fcar (rest), selection_name); } } @@ -384,10 +387,10 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal, error ("selection-value may not be nil."); pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; ns_declare_pasteboard (pb); - old_value =assq_no_quit (selection_name, Vselection_alist); + old_value = assq_no_quit (selection_name, Vselection_alist); new_value = Fcons (selection_name, Fcons (selection_value, Qnil)); if (NILP (old_value)) - Vselection_alist =Fcons (new_value, Vselection_alist); + Vselection_alist = Fcons (new_value, Vselection_alist); else Fsetcdr (old_value, Fcdr (new_value)); /* XXX An evil hack, but a necessary one I fear XXX */ @@ -396,8 +399,8 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal, ev.kind = SELECTION_REQUEST_EVENT; ev.modifiers = 0; ev.code = 0; - ev.x = (int)pb; - ev.y = (int)NSStringPboardType; + *(EMACS_INT*)(&(ev.x)) = (EMACS_INT)pb; // FIXME: BIG UGLY HACK!! + *(EMACS_INT*)(&(ev.y)) = (EMACS_INT)NSStringPboardType; ns_handle_selection_request (&ev); } return selection_value; diff --git a/src/nsterm.h b/src/nsterm.h index c934ed8e79..260263549b 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -717,6 +717,9 @@ extern void ns_term_shutdown (int sig); #define NS_DUMPGLYPH_MOUSEFACE 3 +EXFUN (Fx_display_grayscale_p, 1); +EXFUN (Fx_display_planes, 1); + /* In nsfont, called from fontset.c */ extern void nsfont_make_fontset_for_font (Lisp_Object name, Lisp_Object font_object); @@ -747,11 +750,13 @@ extern Lisp_Object ns_cursor_type_to_lisp (int arg); extern Lisp_Object Qnone; /* XColor defined in dispextern.h (we use color_def->pixel = NSColor id), but - this causes an #include snafu, so we can't declare it. - extern int ns_defined_color (struct frame *f, char *name, XColor *color_def, - int alloc); */ + this causes an #include snafu, so we can't declare it. */ +extern int +ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc, + char makeIndex); #ifdef __OBJC__ +extern Lisp_Object ns_color_to_lisp (NSColor *col); extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); extern unsigned long ns_index_color (NSColor *color, struct frame *f); diff --git a/src/nsterm.m b/src/nsterm.m index 81506be651..6076364514 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -367,10 +367,10 @@ ns_init_paths () if (isDir) { if ([resourcePaths length] > 0) - resourcePaths = - [resourcePaths stringByAppendingString: pathSeparator]; - resourcePaths = - [resourcePaths stringByAppendingString: resourcePath]; + resourcePaths + = [resourcePaths stringByAppendingString: pathSeparator]; + resourcePaths + = [resourcePaths stringByAppendingString: resourcePath]; } } if ([resourcePaths length] > 0) @@ -391,10 +391,10 @@ ns_init_paths () if (isDir) { if ([resourcePaths length] > 0) - resourcePaths = - [resourcePaths stringByAppendingString: pathSeparator]; - resourcePaths = - [resourcePaths stringByAppendingString: resourcePath]; + resourcePaths + = [resourcePaths stringByAppendingString: pathSeparator]; + resourcePaths + = [resourcePaths stringByAppendingString: resourcePath]; } } if ([resourcePaths length] > 0) @@ -949,8 +949,8 @@ ns_frame_rehighlight (struct frame *frame) NSTRACE (ns_frame_rehighlight); if (dpyinfo->ns_focus_frame) { - dpyinfo->ns_highlight_frame = - (FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) + dpyinfo->ns_highlight_frame + = (FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) : dpyinfo->ns_focus_frame); if (!FRAME_LIVE_P (dpyinfo->ns_highlight_frame)) @@ -1161,10 +1161,10 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) /* PENDING: GNUstep has not yet implemented the first method below, added in Panther, however the second is incorrect under Cocoa. */ #ifdef NS_IMPL_GNUSTEP - FRAME_NS_TOOLBAR_HEIGHT (f) = - NSHeight ([NSWindow frameRectForContentRect: NSMakeRect (0, 0, 0, 0) - styleMask: [window styleMask]]) - - FRAME_NS_TITLEBAR_HEIGHT (f); + FRAME_NS_TOOLBAR_HEIGHT (f) + = NSHeight ([NSWindow frameRectForContentRect: NSMakeRect (0, 0, 0, 0) + styleMask: [window styleMask]]) + - FRAME_NS_TITLEBAR_HEIGHT (f); #else FRAME_NS_TOOLBAR_HEIGHT (f) = 32; /* actually get wrong result here if toolbar not yet displayed @@ -1260,8 +1260,8 @@ ns_index_color (NSColor *color, struct frame *f) { color_table->size = NS_COLOR_CAPACITY; color_table->avail = 1; /* skip idx=0 as marker */ - color_table->colors = - (NSColor **)xmalloc (color_table->size * sizeof (NSColor *)); + color_table->colors + = (NSColor **)xmalloc (color_table->size * sizeof (NSColor *)); color_table->empty_indices = [[NSMutableSet alloc] init]; } @@ -1289,9 +1289,9 @@ ns_index_color (NSColor *color, struct frame *f) if (color_table->avail == color_table->size) { color_table->size += NS_COLOR_CAPACITY; - color_table->colors = - (NSColor **)xrealloc (color_table->colors, - color_table->size * sizeof (NSColor *)); + color_table->colors + = (NSColor **)xrealloc (color_table->colors, + color_table->size * sizeof (NSColor *)); } idx = color_table->avail++; index = [NSNumber numberWithUnsignedInt: idx]; @@ -1590,9 +1590,9 @@ ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc, color_def->blue = b * 256; if (!makeIndex) - color_def->pixel = - ARGB_TO_ULONG((int)(a*256), - color_def->red, color_def->green, color_def->blue); + color_def->pixel + = ARGB_TO_ULONG((int)(a*256), + color_def->red, color_def->green, color_def->blue); return 1; } @@ -1945,8 +1945,8 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height) { /* clip out the resize handle */ NSWindow *window = [FRAME_NS_VIEW (f) window]; - NSRect ir = - [view convertRect: ns_resize_handle_rect (window) fromView: nil]; + NSRect ir + = [view convertRect: ns_resize_handle_rect (window) fromView: nil]; ir = NSIntersectionRect (r, ir); if (NSIsEmptyRect (ir)) @@ -2137,8 +2137,9 @@ ns_compute_glyph_string_overhangs (struct glyph_string *s) font->driver->text_extents (font, codes, 2, &metrics); s->left_overhang = -metrics.lbearing; - s->right_overhang = - metrics.rbearing > metrics.width ? metrics.rbearing - metrics.width : 0; + s->right_overhang + = metrics.rbearing > metrics.width + ? metrics.rbearing - metrics.width : 0; } else { @@ -2173,11 +2174,11 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, /* NS-specific: move internal border inside fringe */ int x = p->bx < 0 ? p->x : p->bx; int wd = p->bx < 0 ? p->wd : p->nx; - BOOL fringeOnVeryLeft = - x - WINDOW_LEFT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) + BOOL fringeOnVeryLeft + = x - WINDOW_LEFT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) - FRAME_INTERNAL_BORDER_WIDTH (f) < 10; - BOOL fringeOnVeryRight = - FRAME_PIXEL_WIDTH (f) - x - wd - FRAME_INTERNAL_BORDER_WIDTH (f) + BOOL fringeOnVeryRight + = FRAME_PIXEL_WIDTH (f) - x - wd - FRAME_INTERNAL_BORDER_WIDTH (f) - WINDOW_RIGHT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) < 10; int xAdjust = FRAME_INTERNAL_BORDER_WIDTH (f) * (fringeOnVeryLeft ? -1 : (fringeOnVeryRight ? 1 : 0)); @@ -2185,8 +2186,8 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, /* grow bimgs if needed */ if (nBimgs < max_used_fringe_bitmap) { - EmacsImage **newBimgs = - xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); + EmacsImage **newBimgs + = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *)); if (nBimgs) @@ -2321,8 +2322,8 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, /* PENDING: 23: use emacs stored f->cursor_type instead of ns-specific */ oldCursorType = FRAME_CURSOR (f); cursorType = FRAME_CURSOR (f) = FRAME_NEW_CURSOR (f); - f->output_data.ns->current_cursor_color = - f->output_data.ns->desired_cursor_color; + f->output_data.ns->current_cursor_color + = f->output_data.ns->desired_cursor_color; /* PENDING: only needed in rare cases with last-resort font in HELLO.. should we do this more efficiently? */ @@ -3192,10 +3193,10 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, cursor_blink_entry = 0; if (dpyinfo->ns_highlight_frame) { - Lisp_Object tem = - get_frame_param (dpyinfo->ns_highlight_frame, Qcursor_type); - dpyinfo->ns_highlight_frame->output_data.ns->desired_cursor = - ns_lisp_to_cursor_type (tem); + Lisp_Object tem + = get_frame_param (dpyinfo->ns_highlight_frame, Qcursor_type); + dpyinfo->ns_highlight_frame->output_data.ns->desired_cursor + = ns_lisp_to_cursor_type (tem); } } @@ -3543,8 +3544,8 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) NSColorSpaceFromDepth (depth)]; dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); dpyinfo->image_cache = make_image_cache (); - dpyinfo->color_table = - (struct ns_color_table *)xmalloc (sizeof (struct ns_color_table)); + dpyinfo->color_table + = (struct ns_color_table *)xmalloc (sizeof (struct ns_color_table)); dpyinfo->color_table->colors = NULL; dpyinfo->root_window = 42; /* a placeholder.. */ @@ -3799,15 +3800,15 @@ handling_signal = 0; ns_default ("ExpandSpace", &ns_expand_space, make_float (0.5), make_float (0.0), YES, NO); ns_default ("GSFontAntiAlias", &ns_antialias_text, - YES, NO, NO, NO); + Qt, Qnil, NO, NO); tmp = Qnil; ns_default ("AppleAntiAliasingThreshold", &tmp, make_float (10.0), make_float (6.0), YES, NO); ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); ns_default ("UseQuickdrawSmoothing", &ns_use_qd_smoothing, - YES, NO, NO, NO); + Qt, Qnil, NO, NO); ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color, - YES, NO, NO, NO); + Qt, Qnil, NO, NO); if (ns_use_system_highlight_color == YES) { ns_selection_color = [[NSUserDefaults standardUserDefaults] @@ -3829,17 +3830,17 @@ handling_signal = 0; { /* first try data_dir, then invocation-dir and finally source-directory/etc */ - tem1 = tem = - Fexpand_file_name (build_string ("Emacs.clr"), Vdata_directory); + tem1 = tem + = Fexpand_file_name (build_string ("Emacs.clr"), Vdata_directory); if (NILP (Ffile_exists_p (tem))) { tem = Fexpand_file_name (build_string ("Emacs.clr"), Vinvocation_directory); if (NILP (Ffile_exists_p (tem))) { - Lisp_Object newdir = - Fexpand_file_name (build_string ("etc/"), - Vsource_directory); + Lisp_Object newdir + = Fexpand_file_name (build_string ("etc/"), + Vsource_directory); tem = Fexpand_file_name (build_string ("Emacs.clr"), newdir); } @@ -4211,8 +4212,8 @@ baseline level. The default value is nil. */); Fcons (build_string ("Cancel"), Qnil), Fcons (build_string ("Save and Exit"), Qt)); Lisp_Object res = ns_popup_dialog (Qt, contents, Qnil); -fprintf (stderr, "res = %d\n", res ==Qt); - if (res == Qt) +fprintf (stderr, "res = %d\n", EQ (res, Qt)); // FIXME + if (EQ (res, Qt)) { Feval (Fcons (intern ("save-buffers-kill-emacs"), Qnil)); return NSTerminateNow; @@ -4671,8 +4672,8 @@ if (NS_KEYLOG) NSLog (@"insertText '%@'\tlen = %d", aString, len); if (code == 0x2DC) code = '~'; /* 0x7E */ emacs_event->modifiers = 0; - emacs_event->kind = - code > 0xFF ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; + emacs_event->kind + = code > 0xFF ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; emacs_event->code = code; EV_TRAILER ((id)nil); } @@ -4920,8 +4921,8 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); NSTRACE (mouseMoved); last_mouse_movement_time = EV_TIMESTAMP (e); - last_mouse_motion_position = - [self convertPoint: [e locationInWindow] fromView: nil]; + last_mouse_motion_position + = [self convertPoint: [e locationInWindow] fromView: nil]; /* update any mouse face */ if (dpyinfo->mouse_face_hidden) @@ -5361,8 +5362,8 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); { NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; NSRect r; - struct ns_display_info *dpyinfo = - emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL; + struct ns_display_info *dpyinfo + = emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL; NSTRACE (mouseExited); @@ -5924,14 +5925,14 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); if (inKnob) return self; - scroll_repeat_entry = - [[NSTimer scheduledTimerWithTimeInterval: - SCROLL_BAR_CONTINUOUS_DELAY + scroll_repeat_entry + = [[NSTimer scheduledTimerWithTimeInterval: + SCROLL_BAR_CONTINUOUS_DELAY target: self selector: @selector (repeatScroll:) userInfo: 0 repeats: YES] - retain]; + retain]; } [self sendScrollEventAtLoc: 0 fromEvent: e]; @@ -5975,13 +5976,13 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); pos = 0; /* ignored */ /* set a timer to repeat, as we can't let superclass do this modally */ - scroll_repeat_entry = - [[NSTimer scheduledTimerWithTimeInterval: 0.5 - target: self - selector: @selector (repeatScroll:) - userInfo: 0 - repeats: YES] - retain]; + scroll_repeat_entry + = [[NSTimer scheduledTimerWithTimeInterval: 0.5 + target: self + selector: @selector (repeatScroll:) + userInfo: 0 + repeats: YES] + retain]; } else { @@ -6133,8 +6134,8 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag) - (void) setPanelFromValues { - int cursorType = - ns_lisp_to_cursor_type (get_frame_param (frame, Qcursor_type)); + int cursorType + = ns_lisp_to_cursor_type (get_frame_param (frame, Qcursor_type)); prevExpandSpace = XFLOATINT (ns_expand_space); prevBlinkRate = NILP (ns_cursor_blink_rate) ? 0 : XFLOATINT (ns_cursor_blink_rate); @@ -6199,7 +6200,7 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag) ns_cursor_blink_rate = make_float (blinkRate); ns_cursor_blink_mode = Qt; } - if (ns_cursor_blink_mode != old_cursor_blink_mode) + if (!EQ (ns_cursor_blink_mode, old_cursor_blink_mode)) Feval (Fcons (intern ("blink-cursor-mode"), Qnil)); if (blinkRate != 0.0 && prevBlinkRate != 0.0) @@ -6210,18 +6211,18 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag) cursor_blink_entry = 0; if (dpyinfo->ns_highlight_frame) { - Lisp_Object tem = - get_frame_param (dpyinfo->ns_highlight_frame, Qcursor_type); - dpyinfo->ns_highlight_frame->output_data.ns->desired_cursor = - ns_lisp_to_cursor_type (tem); + Lisp_Object tem + = get_frame_param (dpyinfo->ns_highlight_frame, Qcursor_type); + dpyinfo->ns_highlight_frame->output_data.ns->desired_cursor + = ns_lisp_to_cursor_type (tem); } } prevBlinkRate = blinkRate; } - FRAME_NEW_CURSOR (frame) = - (cursorTag == 1 ? filled_box : - (cursorTag == 2 ? bar : - (cursorTag == 3 ? underscore : hollow_box))); + FRAME_NEW_CURSOR (frame) + = (cursorTag == 1 ? filled_box + : cursorTag == 2 ? bar + : cursorTag == 3 ? underscore : hollow_box); store_frame_param (frame, Qcursor_type, ns_cursor_type_to_lisp (FRAME_NEW_CURSOR (frame))); ns_alternate_modifier = ns_mod_to_lisp (altTag); @@ -6446,14 +6447,15 @@ ns_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames) synthItalFont = NULL; while (membInfo = [senum nextObject]) { - xlfdName = - ns_fontname_to_xlfd ([[membInfo objectAtIndex: 0] UTF8String]); + xlfdName + = ns_fontname_to_xlfd ([[membInfo objectAtIndex: 0] + UTF8String]); list = Fcons (build_string (xlfdName), list); if (!synthItalFont) { - NSString *synthName = - [[membInfo objectAtIndex: 0] - stringByAppendingString: @"-synthItal"]; + NSString *synthName + = [[membInfo objectAtIndex: 0] + stringByAppendingString: @"-synthItal"]; synthItalFont = [synthName UTF8String]; } else if ([[membInfo objectAtIndex: 3] intValue] -- 2.20.1