changeset 96749:e18e64789955

(lisp_to_mod): Use parse_solitary_modifier instead. (ns_lisp_to_color): Don't mess with internal Lisp data fields. (ns_term_init, ns_term_shutdown, initFrameFromEmacs, ns_list_fonts): Use SDATA.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 16 Jul 2008 20:34:57 +0000
parents 92f7bbffcb45
children da03cfcc85a1
files src/ChangeLog src/nsterm.m
diffstat 2 files changed, 31 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Jul 16 20:06:14 2008 +0000
+++ b/src/ChangeLog	Wed Jul 16 20:34:57 2008 +0000
@@ -1,5 +1,10 @@
 2008-07-16  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* nsterm.m (lisp_to_mod): Use parse_solitary_modifier instead.
+	(ns_lisp_to_color): Don't mess with internal Lisp data fields.
+	(ns_term_init, ns_term_shutdown, initFrameFromEmacs, ns_list_fonts):
+	Use SDATA.
+
 	* keymap.c: Remove all NS-specific code.
 	(where_is_preferred_modifier, Vwhere_is_preferred_modifier): New vars.
 	(preferred_sequence_p): Rename from ascii_sequence_p; pay attention to
--- a/src/nsterm.m	Wed Jul 16 20:06:14 2008 +0000
+++ b/src/nsterm.m	Wed Jul 16 20:34:57 2008 +0000
@@ -143,7 +143,6 @@
 /*PENDING: unsure why these defined in term files, anyway we need in keymap.c */
 Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper;
 extern Lisp_Object Qcursor_color, Qcursor_type, Qns;
-extern int lisp_to_mod (Lisp_Object lmod);
 
 
 EmacsPrefsController *prefsController;
@@ -255,15 +254,15 @@
     ((([e modifierFlags] & NSHelpKeyMask) ?           \
            hyper_modifier : 0)                        \
      | (([e modifierFlags] & NSAlternateKeyMask) ?    \
-           lisp_to_mod (ns_alternate_modifier) : 0)   \
+           parse_solitary_modifier (ns_alternate_modifier) : 0)   \
      | (([e modifierFlags] & NSShiftKeyMask) ?        \
            shift_modifier : 0)                        \
      | (([e modifierFlags] & NSControlKeyMask) ?      \
-           lisp_to_mod (ns_control_modifier) : 0)     \
+           parse_solitary_modifier (ns_control_modifier) : 0)     \
      | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ?  \
-           lisp_to_mod (ns_function_modifier) : 0)    \
+           parse_solitary_modifier (ns_function_modifier) : 0)    \
      | (([e modifierFlags] & NSCommandKeyMask) ?      \
-           lisp_to_mod (ns_command_modifier):0))
+           parse_solitary_modifier (ns_command_modifier):0))
 
 #define EV_UDMODIFIERS(e)                                      \
     ((([e type] == NSLeftMouseDown) ? down_modifier : 0)       \
@@ -1513,10 +1512,10 @@
    -------------------------------------------------------------------------- */
 {
   NSTRACE (ns_lisp_to_color);
-  if (XTYPE (color) == Lisp_String)
-    return ns_get_color (XSTRING (color)->data, col);
-  else if (XTYPE (color) == Lisp_Symbol)
-    return ns_get_color (XSTRING (XSYMBOL (color)->xname)->data, col);
+  if (STRINGP (color))
+    return ns_get_color (SDATA (color), col);
+  else if (SYMBOLP (color))
+    return ns_get_color (SDATA (SYMBOL_NAME (color)), col);
   return 1;
 }
 
@@ -3848,9 +3847,9 @@
 
         cl = [[NSColorList alloc]
                initWithName: @"Emacs"
-                   fromFile: [NSString stringWithCString: XSTRING (tem)->data]];
+                   fromFile: [NSString stringWithCString: SDATA (tem)]];
         if (cl ==nil)
-          fatal ("Could not find %s.\n", XSTRING (tem1)->data);
+          fatal ("Could not find %s.\n", SDATA (tem1));
         [cl writeToFile: nil];
       }
   }
@@ -3938,7 +3937,7 @@
 {
   /* code not reached in emacs.c after this is called by shut_down_emacs: */
   if (STRINGP (Vauto_save_list_file_name))
-    unlink (XSTRING (Vauto_save_list_file_name)->data);
+    unlink (SDATA (Vauto_save_list_file_name));
 
   ns_shutdown_properly = YES;
   [NSApp terminate: NSApp];
@@ -4552,7 +4551,7 @@
 
       if (flags & NSCommandKeyMask)
         {
-          emacs_event->modifiers |= lisp_to_mod (ns_command_modifier);
+          emacs_event->modifiers |= parse_solitary_modifier (ns_command_modifier);
           /* if super (default), take input manager's word so things like
              dvorak / qwerty layout work */
           if (EQ (ns_command_modifier, Qsuper)
@@ -4586,10 +4585,10 @@
         }
 
       if (flags & NSControlKeyMask)
-          emacs_event->modifiers |= lisp_to_mod (ns_control_modifier);
+          emacs_event->modifiers |= parse_solitary_modifier (ns_control_modifier);
 
       if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym)
-          emacs_event->modifiers |= lisp_to_mod (ns_function_modifier);
+          emacs_event->modifiers |= parse_solitary_modifier (ns_function_modifier);
 
       if (flags & NSAlternateKeyMask) /* default = meta */
         {
@@ -4602,7 +4601,7 @@
                 emacs_event->modifiers = 0;
             }
           else
-              emacs_event->modifiers |= lisp_to_mod (ns_alternate_modifier);
+              emacs_event->modifiers |= parse_solitary_modifier (ns_alternate_modifier);
         }
 
 /*fprintf (stderr,"code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",code,fnKeysym,flags,emacs_event->modifiers); */
@@ -5223,7 +5222,7 @@
 
   tem = f->name;
   name = [NSString stringWithUTF8String:
-                   NILP (tem) ? (unsigned char *)"Emacs" : XSTRING (tem)->data];
+                   NILP (tem) ? (unsigned char *)"Emacs" : SDATA (tem)];
   [win setTitle: name];
 
   /* toolbar support */
@@ -5242,7 +5241,7 @@
   tem = f->icon_name;
   if (!NILP (tem))
     [win setMiniwindowTitle:
-           [NSString stringWithUTF8String: XSTRING (tem)->data]];
+           [NSString stringWithUTF8String: SDATA (tem)]];
 
   {
     NSScreen *screen = [win screen];
@@ -6149,11 +6148,15 @@
   [cursorTypeMatrix selectCellWithTag: (cursorType == filled_box ? 1 :
                                         (cursorType == bar ? 2 :
                                          (cursorType == underscore ? 3 : 4)))];
-  selectItemWithTag (alternateModMenu, lisp_to_mod (ns_alternate_modifier));
-  selectItemWithTag (commandModMenu, lisp_to_mod (ns_command_modifier));
+  selectItemWithTag (alternateModMenu,
+		     parse_solitary_modifier (ns_alternate_modifier));
+  selectItemWithTag (commandModMenu,
+		     parse_solitary_modifier (ns_command_modifier));
 #ifdef NS_IMPL_COCOA
-  selectItemWithTag (controlModMenu, lisp_to_mod (ns_control_modifier));
-  selectItemWithTag (functionModMenu, lisp_to_mod (ns_function_modifier));
+  selectItemWithTag (controlModMenu,
+		     parse_solitary_modifier (ns_control_modifier));
+  selectItemWithTag (functionModMenu,
+		     parse_solitary_modifier (ns_function_modifier));
   [smoothFontsCheck setState: ns_antialias_text ? YES : NO];
   [useQuickdrawCheck setState: ns_use_qd_smoothing ? YES : NO];
   [useSysHiliteCheck setState: prevUseHighlightColor ? YES : NO];
@@ -6372,7 +6375,7 @@
   NSTRACE (ns_list_fonts);
 
   CHECK_STRING (pattern);
-  patt = XSTRING (pattern)->data;
+  patt = SDATA (pattern);
 
 #if 0
 /* temporary: for font_backend, we use fontsets, and when these are defined,