This commit was generated by cvs2svn to compensate for changes in r5670,
[chise/xemacs-chise.git.1] / src / select-x.c
index 2a15974..cc6031a 100644 (file)
@@ -139,9 +139,7 @@ symbol_to_x_atom (struct device *d, Lisp_Object sym, int only_if_exists)
 
   {
     CONST char *nameext;
-    TO_EXTERNAL_FORMAT (LISP_STRING, Fsymbol_name (sym),
-                       C_STRING_ALLOCA, nameext,
-                       Qctext);
+    GET_C_STRING_CTEXT_DATA_ALLOCA (Fsymbol_name (sym), nameext);
     return XInternAtom (display, nameext, only_if_exists ? True : False);
   }
 }
@@ -185,16 +183,16 @@ x_atom_to_symbol (struct device *d, Atom atom)
 #endif
 
   {
-    char *intstr;
+    Lisp_Object newsym;
+    CONST Bufbyte *intstr;
     char *str = XGetAtomName (display, atom);
 
     if (! str) return Qnil;
 
-    TO_INTERNAL_FORMAT (C_STRING, str,
-                       C_STRING_ALLOCA, intstr,
-                       Qctext);
+    GET_C_CHARPTR_INT_CTEXT_DATA_ALLOCA (str, intstr);
+    newsym = intern ((char *) intstr);
     XFree (str);
-    return intern (intstr);
+    return newsym;
   }
 }
 
@@ -232,7 +230,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
      
      Opaque pointers are the clean way to go here.
   */
-  selection_time = make_opaque (&thyme, sizeof (thyme));
+  selection_time = make_opaque (sizeof (thyme), (void *) &thyme);
 
 #ifdef MOTIF_CLIPBOARDS
   hack_motif_clipboard_selection (selection_atom, selection_value,
@@ -316,14 +314,10 @@ hack_motif_clipboard_selection (Atom selection_atom,
          }
 
        if (chartypes == LATIN_1)
-         TO_EXTERNAL_FORMAT (LISP_STRING, selection_value,
-                             ALLOCA, (data, bytes),
-                             Qbinary);
+         GET_STRING_BINARY_DATA_ALLOCA (selection_value, data, bytes);
        else if (chartypes == WORLD)
          {
-           TO_EXTERNAL_FORMAT (LISP_STRING, selection_value,
-                               ALLOCA, (data, bytes),
-                               Qctext);
+           GET_STRING_CTEXT_DATA_ALLOCA (selection_value, data, bytes);
            encoding = "COMPOUND_TEXT";
          }
       }
@@ -1170,7 +1164,7 @@ selection_data_to_lisp_data (struct device *d,
     return make_ext_string (data, size,
                            type == DEVICE_XATOM_TEXT (d) ||
                            type == DEVICE_XATOM_COMPOUND_TEXT (d)
-                           ? Qctext : Qbinary);
+                           ? FORMAT_CTEXT : FORMAT_BINARY);
 
   /* Convert a single atom to a Lisp Symbol.
      Convert a set of atoms to a vector of symbols. */
@@ -1269,9 +1263,10 @@ lisp_data_to_selection_data (struct device *d,
       CONST Extbyte *extval;
       Extcount extvallen;
 
-      TO_EXTERNAL_FORMAT (LISP_STRING, obj,
-                         ALLOCA, (extval, extvallen),
-                         (NILP (type) ? Qctext : Qbinary));
+      if (NILP (type))
+       GET_STRING_CTEXT_DATA_ALLOCA (obj, extval, extvallen);
+      else
+       GET_STRING_BINARY_DATA_ALLOCA (obj, extval, extvallen);
       *format_ret = 8;
       *size_ret = extvallen;
       *data_ret = (unsigned char *) xmalloc (*size_ret);
@@ -1291,9 +1286,7 @@ lisp_data_to_selection_data (struct device *d,
 
       *format_ret = 8;
       len = set_charptr_emchar (buf, XCHAR (obj));
-      TO_EXTERNAL_FORMAT (DATA, (buf, len),
-                         ALLOCA, (extval, extvallen),
-                         Qctext);
+      GET_CHARPTR_EXT_CTEXT_DATA_ALLOCA (buf, len, extval, extvallen);
       *size_ret = extvallen;
       *data_ret = (unsigned char *) xmalloc (*size_ret);
       memcpy (*data_ret, extval, *size_ret);
@@ -1499,18 +1492,15 @@ initialize_cut_buffers (Display *display, Window window)
   cut_buffers_initialized = 1;
 }
 
-#define CHECK_CUTBUFFER(symbol) do {                           \
-  CHECK_SYMBOL (symbol);                                       \
-  if (! (EQ (symbol, QCUT_BUFFER0) ||                          \
-        EQ (symbol, QCUT_BUFFER1) ||                           \
-        EQ (symbol, QCUT_BUFFER2) ||                           \
-        EQ (symbol, QCUT_BUFFER3) ||                           \
-        EQ (symbol, QCUT_BUFFER4) ||                           \
-        EQ (symbol, QCUT_BUFFER5) ||                           \
-        EQ (symbol, QCUT_BUFFER6) ||                           \
-        EQ (symbol, QCUT_BUFFER7)))                            \
-    signal_simple_error ("Doesn't name a cutbuffer", symbol);  \
-} while (0)
+#define CHECK_CUTBUFFER(symbol)                                                \
+  { CHECK_SYMBOL (symbol);                                             \
+    if (!EQ((symbol),QCUT_BUFFER0) && !EQ((symbol),QCUT_BUFFER1) &&    \
+       !EQ((symbol),QCUT_BUFFER2) && !EQ((symbol),QCUT_BUFFER3) &&     \
+       !EQ((symbol),QCUT_BUFFER4) && !EQ((symbol),QCUT_BUFFER5) &&     \
+       !EQ((symbol),QCUT_BUFFER6) && !EQ((symbol),QCUT_BUFFER7))       \
+      signal_error (Qerror, list2 (build_string ("Doesn't name a cutbuffer"), \
+                                   (symbol))); \
+  }
 
 DEFUN ("x-get-cutbuffer-internal", Fx_get_cutbuffer_internal, 1, 1, 0, /*
 Return the value of the named CUTBUFFER (typically CUT_BUFFER0).
@@ -1547,7 +1537,7 @@ Return the value of the named CUTBUFFER (typically CUT_BUFFER0).
   ret = (bytes ?
         make_ext_string (data, bytes,
                          memchr (data, 0x1b, bytes) ?
-                         Qctext : Qbinary)
+                         FORMAT_CTEXT : FORMAT_BINARY)
         : Qnil);
   xfree (data);
   return ret;
@@ -1610,13 +1600,9 @@ Set the value of the named CUTBUFFER (typically CUT_BUFFER0) to STRING.
     }
 
   if (chartypes == LATIN_1)
-    TO_EXTERNAL_FORMAT (LISP_STRING, string,
-                       ALLOCA, (data, bytes),
-                       Qbinary);
+    GET_STRING_BINARY_DATA_ALLOCA (string, data, bytes);
   else if (chartypes == WORLD)
-    TO_EXTERNAL_FORMAT (LISP_STRING, string,
-                       ALLOCA, (data, bytes),
-                       Qctext);
+    GET_STRING_CTEXT_DATA_ALLOCA  (string, data, bytes);
 #endif /* MULE */
 
   bytes_remaining = bytes;
@@ -1672,7 +1658,7 @@ positive means move values forward, negative means backward.
 /************************************************************************/
 
 void
-syms_of_select_x (void)
+syms_of_xselect (void)
 {
 
 #ifdef CUT_BUFFER_SUPPORT
@@ -1708,24 +1694,18 @@ console_type_create_select_x (void)
 }
 
 void
-reinit_vars_of_select_x (void)
+vars_of_xselect (void)
 {
+#ifdef CUT_BUFFER_SUPPORT
+  cut_buffers_initialized = 0;
+  Fprovide (intern ("cut-buffer"));
+#endif
+
   reading_selection_reply = 0;
   reading_which_selection = 0;
   selection_reply_timed_out = 0;
   for_whom_the_bell_tolls = 0;
   prop_location_tick = 0;
-}
-
-void
-vars_of_select_x (void)
-{
-  reinit_vars_of_select_x ();
-
-#ifdef CUT_BUFFER_SUPPORT
-  cut_buffers_initialized = 0;
-  Fprovide (intern ("cut-buffer"));
-#endif
 
   DEFVAR_LISP ("x-sent-selection-hooks", &Vx_sent_selection_hooks /*
 A function or functions to be called after we have responded to some
@@ -1752,7 +1732,7 @@ A value of 0 means wait as long as necessary.  This is initialized from the
 }
 
 void
-Xatoms_of_select_x (struct device *d)
+Xatoms_of_xselect (struct device *d)
 {
   Display *D = DEVICE_X_DISPLAY (d);