]> git.eshelyaron.com Git - emacs.git/commitdiff
Consolidate XChar2b macros for the X, W32, and NS
authorDaiki Ueno <ueno@gnu.org>
Wed, 16 Jul 2014 04:11:08 +0000 (13:11 +0900)
committerDaiki Ueno <ueno@gnu.org>
Wed, 16 Jul 2014 04:11:08 +0000 (13:11 +0900)
Suggested by Jan Djärv in:
https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html
* w32gui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
Move the fallback definitions to dispextern.h.
* nsgui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
Likewise.  Share the same definition with W32.
* xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ...
* dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
... here for the consistency with W32 and NS.

src/ChangeLog
src/dispextern.h
src/nsgui.h
src/w32gui.h
src/xterm.h

index 87dd0eacc04330cc5eeb86fbbc9f91a35f52c5c0..70c76e34c8c8bf8b4d6ea268360d5a5d908dfc24 100644 (file)
@@ -1,3 +1,16 @@
+2014-07-16  Daiki Ueno  <ueno@gnu.org>
+
+       Consolidate XChar2b macros for the X, W32, and NS
+       Suggested by Jan Djärv in:
+       https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html
+       * w32gui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
+       Move the fallback definitions to dispextern.h.
+       * nsgui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
+       Likewise.  Share the same definition with W32.
+       * xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ...
+       * dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
+       ... here for the consistency with W32 and NS.
+
 2014-07-15  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id.
index 0e04cc466d3cbcedf1b1676e177152e645f5d12e..615d41d5a7f77ca39318de6f14802e17b03795ad 100644 (file)
@@ -31,6 +31,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <X11/Intrinsic.h>
 #endif /* USE_X_TOOLKIT */
 
+#define STORE_XCHAR2B(chp, b1, b2) \
+  ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
+
+#define XCHAR2B_BYTE1(chp) \
+  ((chp)->byte1)
+
+#define XCHAR2B_BYTE2(chp) \
+  ((chp)->byte2)
+
 #else /* !HAVE_X_WINDOWS */
 
 /* X-related stuff used by non-X gui code.  */
@@ -42,6 +51,17 @@ typedef struct {
   char pad;
 } XColor;
 
+typedef unsigned short XChar2b;
+
+#define STORE_XCHAR2B(chp, b1, b2) \
+  (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
+
+#define XCHAR2B_BYTE1(chp) \
+  ((*(chp) & 0xff00) >> 8)
+
+#define XCHAR2B_BYTE2(chp) \
+  (*(chp) & 0x00ff)
+
 #endif /* HAVE_X_WINDOWS */
 
 #ifdef MSDOS
index 0e1e9bb73e9d2d521afa6da3195dcf2f47c37389..b38b4482b87a5d9c3ce7ba39fb06a06caa4eda35 100644 (file)
@@ -58,21 +58,6 @@ typedef struct _XCharStruct
   int descent;
 } XCharStruct;
 
-/* Fake structure from Xlib.h to represent two-byte characters.  */
-#ifndef __OBJC__
-typedef unsigned short unichar;
-#endif
-typedef unichar XChar2b;
-
-#define STORE_XCHAR2B(chp, b1, b2) \
-  (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
-
-#define XCHAR2B_BYTE1(chp) \
- (((*chp) & 0xff00) >> 8)
-
-#define XCHAR2B_BYTE2(chp) \
- ((*chp) & 0x00ff)
-
 
 /* XXX: xfaces requires these structures, but the question is are we
         forced to use them? */
index d04ce625d1de6b94dd85804d856654764b6840c5..8642c479be86e9398929b50ee260d442f636c255 100644 (file)
@@ -52,18 +52,6 @@ typedef HCURSOR Cursor;
 
 #define No_Cursor (0)
 
-#define XChar2b wchar_t
-
-/* Dealing with bits of wchar_t as if they were an XChar2b.  */
-#define STORE_XCHAR2B(chp, byte1, byte2) \
-  ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
-
-#define XCHAR2B_BYTE1(chp) \
-  (((*(chp)) & 0xff00) >> 8)
-
-#define XCHAR2B_BYTE2(chp) \
-  ((*(chp)) & 0x00ff)
-
 
 /* Windows equivalent of XImage.  */
 typedef struct _XImage
index 6d80d1253ae006f80143de19c9ca26f610cd7e2c..370006366ef2effb8d0cfabe93d5f89bd5ce3103 100644 (file)
@@ -1047,15 +1047,6 @@ extern void x_clear_under_internal_border (struct frame *f);
 
 #define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)
 
-#define STORE_XCHAR2B(chp, b1, b2) \
-  ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
-
-#define XCHAR2B_BYTE1(chp) \
-  ((chp)->byte1)
-
-#define XCHAR2B_BYTE2(chp) \
-  ((chp)->byte2)
-
 #define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight)     \
   ((nr).x = (rx),                                      \
    (nr).y = (ry),                                      \