diff src/device-x.c @ 5125:b5df3737028a ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Wed, 24 Feb 2010 01:58:04 -0600
parents d1247f3cc363 3c3c1d139863
children 2a462149bd6a
line wrap: on
line diff
--- a/src/device-x.c	Wed Jan 20 07:05:57 2010 -0600
+++ b/src/device-x.c	Wed Feb 24 01:58:04 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>
 
@@ -208,7 +208,7 @@
   last_xrm_db = db;
 
   locale = XrmLocaleOfDatabase (db);
-  localestr = build_ext_string (locale, Qbinary);
+  localestr = build_extstring (locale, Qbinary);
   last_coding_system = call1 (Qget_coding_system_from_locale, localestr);
 
   return last_coding_system;
@@ -263,9 +263,9 @@
     {
       Ibyte *app_name_int, *app_class_int, *value_addr_int;
       Lisp_Object codesys = coding_system_of_xrm_database (XtDatabase (dpy));
-      EXTERNAL_TO_C_STRING (app_name, app_name_int, codesys);
-      EXTERNAL_TO_C_STRING (app_class, app_class_int, codesys);
-      EXTERNAL_TO_C_STRING (value.addr, value_addr_int, codesys);
+      app_name_int = EXTERNAL_TO_ITEXT (app_name, codesys);
+      app_class_int = EXTERNAL_TO_ITEXT (app_class, codesys);
+      value_addr_int = EXTERNAL_TO_ITEXT (value.addr, codesys);
 
       warn_when_safe (Qgeometry, Qerror,
 		      "\n"
@@ -387,7 +387,7 @@
   Bytecount len;
   Extbyte *data;
 
-  TO_EXTERNAL_FORMAT (LISP_STRING, str, ALLOCA, (data, len), Qbinary);
+  LISP_STRING_TO_SIZED_EXTERNAL (str, data, len, Qbinary); 
   Dynarr_add_many (cda, data, len);
   validify_resource_component (Dynarr_atp (cda, Dynarr_length (cda) - len),
 			       len);
@@ -583,7 +583,8 @@
       {
 	/* Look for the Xaw3d function */
 	dll_func xaw_function_handle =
-	  dll_function (xaw_dll_handle, "Xaw3dComputeTopShadowRGB");
+	  dll_function (xaw_dll_handle,
+			(const Ibyte *) "Xaw3dComputeTopShadowRGB");
 
 	/* If we found it, warn the user in big, nasty, unfriendly letters */
 	if (xaw_function_handle != NULL)
@@ -621,7 +622,7 @@
 
   make_argc_argv (Vx_initial_argv_list, &argc, &argv);
 
-  LISP_STRING_TO_EXTERNAL (display, disp_name, Qctext);
+  disp_name = LISP_STRING_TO_EXTERNAL (display, Qctext);
 
   /*
    * Break apart the old XtOpenDisplay call into XOpenDisplay and
@@ -645,7 +646,7 @@
 
   if (STRINGP (Vx_emacs_application_class) &&
       XSTRING_LENGTH (Vx_emacs_application_class) > 0)
-    LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, app_class, Qctext);
+    app_class = LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, Qctext);
   else
     {
       if (egetenv ("USE_EMACS_AS_DEFAULT_APPLICATION_CLASS"))
@@ -665,7 +666,7 @@
 	}
 
       /* need to update Vx_emacs_application_class: */
-      Vx_emacs_application_class = build_string (app_class);
+      Vx_emacs_application_class = build_cistring (app_class);
     }
 
   slow_down_interrupts ();
@@ -694,14 +695,13 @@
     if (STRINGP (Vx_app_defaults_directory) &&
 	XSTRING_LENGTH (Vx_app_defaults_directory) > 0)
       {
-	LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir,
-				 Qfile_name);
+	LISP_PATHNAME_CONVERT_OUT (Vx_app_defaults_directory, data_dir);
 	path = alloca_extbytes (strlen (data_dir) + strlen (locale) + 7);
 	format = "%s%s/Emacs";
       }
     else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0)
       {
-	LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name);
+	LISP_PATHNAME_CONVERT_OUT (Vdata_directory, data_dir);
 	path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7);
 	format = "%sapp-defaults/%s/Emacs";
       }
@@ -740,7 +740,7 @@
     {
       /* Cast off const for G++ 4.3. */
       Extbyte *temp = (Extbyte *) locale;
-      xfree (temp, Extbyte*);
+      xfree (temp);
     }
  }
 #endif /* MULE */
@@ -948,7 +948,7 @@
 static void
 free_x_device_struct (struct device *d)
 {
-  xfree (d->device_data, void *);
+  xfree (d->device_data);
 }
 #endif /* not NEW_GC */
 
@@ -1003,10 +1003,10 @@
 /*				handle X errors				*/
 /************************************************************************/
 
-const char *
+const Ascbyte *
 x_event_name (int event_type)
 {
-  static const char *events[] =
+  static const Ascbyte *events[] =
   {
     "0: ERROR!",
     "1: REPLY",
@@ -1196,19 +1196,19 @@
     return 0;
   data = Qnil;
   qxesprintf (num, "0x%X", (unsigned int) last_error.resourceid);
-  data = Fcons (build_intstring (num), data);
+  data = Fcons (build_istring (num), data);
   qxesprintf (num, "%d", last_error.request_code);
   XGetErrorDatabaseText (last_error.display, "XRequest", (char *) num, "",
 			 buf, sizeof (buf));
   if (*buf)
-    data = Fcons (build_ext_string (buf, Qnative), data);
+    data = Fcons (build_extstring (buf, Qx_error_message_encoding), data);
   else
     {
       qxesprintf (num, "Request-%d", last_error.request_code);
-      data = Fcons (build_intstring (num), data);
+      data = Fcons (build_istring (num), data);
     }
   XGetErrorText (last_error.display, last_error.error_code, buf, sizeof (buf));
-  data = Fcons (build_ext_string (buf, Qnative), data);
+  data = Fcons (build_extstring (buf, Qx_error_message_encoding), data);
  again:
   Fsignal (Qx_error, data);
   if (! resumable_p) goto again;
@@ -1425,8 +1425,8 @@
     class_len = strlen (appclass);
     Dynarr_add_many (name,  appname,  name_len);
     Dynarr_add_many (class_, appclass, class_len);
-    validify_resource_component (Dynarr_atp (name,  0), name_len);
-    validify_resource_component (Dynarr_atp (class_, 0), class_len);
+    validify_resource_component (Dynarr_begin (name), name_len);
+    validify_resource_component (Dynarr_begin (class_), class_len);
   }
 
   if (EQ (locale, Qglobal))
@@ -1568,8 +1568,8 @@
   Dynarr_add (name_Extbyte_dynarr,  '\0');
   Dynarr_add (class_Extbyte_dynarr, '\0');
 
-  name_string  = Dynarr_atp (name_Extbyte_dynarr,  0);
-  class_string = Dynarr_atp (class_Extbyte_dynarr, 0);
+  name_string  = Dynarr_begin (name_Extbyte_dynarr);
+  class_string = Dynarr_begin (class_Extbyte_dynarr);
 
   {
     XrmValue xrm_value;
@@ -1603,7 +1603,7 @@
   }
 
   if (EQ (type, Qstring))
-    return build_ext_string (raw_result, codesys);
+    return build_extstring (raw_result, codesys);
   else if (EQ (type, Qboolean))
     {
       if (!strcasecmp (raw_result, "off")   ||
@@ -1616,8 +1616,8 @@
 	return Fcons (Qt, Qnil);
       return maybe_signal_continuable_error_2
 	(Qinvalid_operation, "Can't convert to a Boolean",
-	 build_ext_string (name_string, Qbinary),
-	 build_ext_string (raw_result, codesys), Qresource,
+	 build_extstring (name_string, Qbinary),
+	 build_extstring (raw_result, codesys), Qresource,
 	 errb);
     }
   else if (EQ (type, Qinteger) || EQ (type, Qnatnum))
@@ -1627,13 +1627,13 @@
       if (1 != sscanf (raw_result, "%d%c", &i, &c))
       return maybe_signal_continuable_error_2
 	(Qinvalid_operation, "Can't convert to an integer",
-	 build_ext_string (name_string, Qbinary),
-	 build_ext_string (raw_result, codesys), Qresource,
+	 build_extstring (name_string, Qbinary),
+	 build_extstring (raw_result, codesys), Qresource,
 	 errb);
       else if (EQ (type, Qnatnum) && i < 0)
 	return maybe_signal_continuable_error_2
 	  (Qinvalid_argument, "Invalid numerical value for resource",
-	   make_int (i), build_ext_string (name_string, Qbinary),
+	   make_int (i), build_extstring (name_string, Qbinary),
 	   Qresource, errb);
       else
 	return make_int (i);
@@ -1668,9 +1668,9 @@
   if (!display)
     return Qnil;
 
-  return Fcons (make_string ((Ibyte *) Dynarr_atp (name_Extbyte_dynarr, 0),
+  return Fcons (make_string ((Ibyte *) Dynarr_begin (name_Extbyte_dynarr),
 			     Dynarr_length (name_Extbyte_dynarr)),
-		make_string ((Ibyte *) Dynarr_atp (class_Extbyte_dynarr, 0),
+		make_string ((Ibyte *) Dynarr_begin (class_Extbyte_dynarr),
 			     Dynarr_length (class_Extbyte_dynarr)));
 }
 
@@ -1689,8 +1689,8 @@
       Extbyte *str, *colon_pos;
 
       CHECK_STRING (resource_line);
-      LISP_STRING_TO_EXTERNAL (resource_line, str,
-			       coding_system_of_xrm_database (db));
+      str = LISP_STRING_TO_EXTERNAL (resource_line,
+				     coding_system_of_xrm_database (db));
       if (!(colon_pos = strchr (str, ':')) || strchr (str, '\n'))
       invalid:
 	syntax_error ("Invalid resource line", resource_line);
@@ -1801,7 +1801,7 @@
   Display *dpy = get_x_display (device);
   Extbyte *vendor = ServerVendor (dpy);
 
-  return build_ext_string (vendor ? vendor : "", Qx_hpc_encoding);
+  return build_extstring (vendor ? vendor : "", Qx_hpc_encoding);
 }
 
 DEFUN ("x-server-version", Fx_server_version, 0, 1, 0, /*
@@ -1829,7 +1829,7 @@
   const Extbyte *keysym_ext;
 
   CHECK_STRING (keysym);
-  LISP_STRING_TO_EXTERNAL (keysym, keysym_ext, Qctext);
+  keysym_ext = LISP_STRING_TO_EXTERNAL (keysym, Qctext);
 
   return XStringToKeysym (keysym_ext) ? Qt : Qnil;
 }
@@ -2046,7 +2046,7 @@
     gui_error ("Can't get X font path", device);
 
   while (ndirs_return--)
-      font_path = Fcons (build_ext_string (directories[ndirs_return],
+      font_path = Fcons (build_extstring (directories[ndirs_return],
                                            Qfile_name),
 			 font_path);
 
@@ -2087,10 +2087,7 @@
 
   {
     EXTERNAL_LIST_LOOP_2 (path_entry, font_path)
-      {
-	LISP_STRING_TO_EXTERNAL (path_entry, directories[i++],
-				 Qfile_name);
-      }
+      LISP_PATHNAME_CONVERT_OUT (path_entry, directories[i++]);
   }
 
   expect_x_error (dpy);