unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 31118@debbugs.gnu.org
Subject: bug#31118: 27.0.50; Can't load/compile websocket in 32bit master
Date: Sun, 15 Apr 2018 15:11:50 -0700	[thread overview]
Message-ID: <80fbbf82-c20f-6a01-b257-45caa4a87fdf@cs.ucla.edu> (raw)
In-Reply-To: <jwvvacx4mlz.fsf-monnier+emacsbugs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]

Although I still can't build ELPA (see Bug#31118#31), I took a shot at 
making ELPA build for 32-bit Emacs on master by installing the attached 
patches into the xelb and exwm packages, respectively.

As I understand it, some parts of ELPA still assume 64-bit Emacs, but 
that's lower priority as it's not a regression. Also, one still cannot 
reliably build ELPA on 64-bit Emacs and run it on 32-bit Emacs (or vice 
versa), but people don't do that much and I suspect it wasn't really 
working either.

[-- Attachment #2: 0001-Port-to-32-bit-Emacs-master.patch --]
[-- Type: text/x-patch, Size: 8039 bytes --]

From 0a46cc62a3a82dcaa1d1bf0929a5207260f635e3 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 15 Apr 2018 15:00:09 -0700
Subject: [PATCH] Port to 32-bit Emacs master

Rewrite #xFFFFFFFF to 4294967295. and similarly for other
hex constants intended to be floating-point on 32-bit Emacs.
* el_client.el (xelb-parse-enum):
Omit enums that do not fit in 32-bit Emacs.
* xcb-xinput.el (xcb:xinput:ModifierMask:Any):
* xcb-xkb.el (xcb:xkb:Control:IgnoreLockMods)
(xcb:xkb:Control:PerKeyRepeat, xcb:xkb:Control:ControlsEnabled):
Remove.
---
 el_client.el  |  8 +++++++-
 xcb-cursor.el |  2 +-
 xcb-icccm.el  |  2 +-
 xcb-types.el  | 28 ++++++++++++++--------------
 xcb-xinput.el |  2 --
 xcb-xkb.el    |  3 ---
 6 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/el_client.el b/el_client.el
index 9b7077f98..393745ef0 100644
--- a/el_client.el
+++ b/el_client.el
@@ -351,7 +351,13 @@ an `xelb-auto-padding' attribute."
                         (if expression
                             (setq value (xelb-parse-expression expression))
                           (setq value (1+ value)))
-                        `(defconst ,name ,value))))
+			;; Omit the rare enums that do not fit in a fixnum in
+			;; 32-bit Emacs, so that the resulting .el and .elc
+			;; files are portable to 32-bit Emacs.  Admittedly
+			;; this is a kludge.
+			(unless (and ((integerp value)
+				      (not (<= -536870912 value 536870911))))
+			  `(defconst ,name ,value)))))
                   items))))
 
 (defun xelb-parse-typedef (node)
diff --git a/xcb-cursor.el b/xcb-cursor.el
index 12bbf27ac..71842a383 100644
--- a/xcb-cursor.el
+++ b/xcb-cursor.el
@@ -230,7 +230,7 @@
 
 (defconst xcb:cursor:-file-chunk-image-header 36
   "Header value of image-type chunk in Xcursor file.")
-(defconst xcb:cursor:-file-chunk-image-type #xFFFD0002
+(defconst xcb:cursor:-file-chunk-image-type 4294770690.
   "Type of image-type chunk in Xcursor file.")
 (defconst xcb:cursor:-file-chunk-image-version 1
   "Version of image-type chunk in Xcursor file.")
diff --git a/xcb-icccm.el b/xcb-icccm.el
index 613bed187..4599a7dbf 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -119,7 +119,7 @@ A valid timestamp (rather than `xcb:Time:CurrentTime') must be supplied.")
 (defclass xcb:icccm:-GetProperty (xcb:GetProperty)
   ((delete :initform 0)
    (long-offset :initform 0)
-   (long-length :initform 1000000000))  ;as long as possible
+   (long-length :initform 1000000000.))  ;as long as possible
   :documentation "Get an ICCCM property (request part).")
 
 (defclass xcb:icccm:-GetProperty~reply (xcb:GetProperty~reply)
diff --git a/xcb-types.el b/xcb-types.el
index f5c1a3c13..0c172b64d 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -155,8 +155,8 @@
                       (logand (lsh value -16) #xFF)
                       (logand (lsh value -8) #xFF)
                       (logand value #xFF))
-            (let* ((msdw (min #xFFFFFFFF (truncate value #x100000000)))
-                   (lsdw (min #xFFFFFFFF
+            (let* ((msdw (min 4294967295. (truncate value 4294967296.)))
+                   (lsdw (min 4294967295.
                               (truncate (- value (* msdw 4294967296.0))))))
               (vector (logand (lsh msdw -24) #xFF) (logand (lsh msdw -16) #xFF)
                       (logand (lsh msdw -8) #xFF) (logand msdw #xFF)
@@ -173,8 +173,8 @@
                       (logand (lsh value -40) #xFF)
                       (logand (lsh value -48) #xFF)
                       (logand (lsh value -56) #xFF))
-            (let* ((msdw (min #xFFFFFFFF (truncate value #x100000000)))
-                   (lsdw (min #xFFFFFFFF
+            (let* ((msdw (min 4294967295. (truncate value 4294967296.)))
+                   (lsdw (min 4294967295.
                               (truncate (- value (* msdw 4294967296.0))))))
               (vector (logand lsdw #xFF) (logand (lsh lsdw -8) #xFF)
                       (logand (lsh lsdw -16) #xFF) (logand (lsh lsdw -24) #xFF)
@@ -207,11 +207,11 @@
           (vector 0 0 0 0
                   (logand (lsh value -24) #xFF) (logand (lsh value -16) #xFF)
                   (logand (lsh value -8) #xFF) (logand value #xFF))
-        (let* ((msw (min #xFFFF (truncate value #x1000000000000)))
+        (let* ((msw (min #xFFFF (truncate value 281474976710656.)))
                (w1 (min #xFFFF
                         (truncate (setq value
                                         (- value (* msw 281474976710656.0)))
-                                  #x100000000)))
+                                  4294967296.)))
                (w2 (min #xFFFF
                         (truncate (setq value (- value (* w1 4294967296.0)))
                                   #x10000)))
@@ -226,11 +226,11 @@
           (vector (logand value #xFF) (logand (lsh value -8) #xFF)
                   (logand (lsh value -16) #xFF) (logand (lsh value -24) #xFF)
                   0 0 0 0)
-        (let* ((msw (min #xFFFF (truncate value #x1000000000000)))
+        (let* ((msw (min #xFFFF (truncate value 281474976710656.)))
                (w1 (min #xFFFF
                         (truncate (setq value
                                         (- value (* msw 281474976710656.0)))
-                                  #x100000000)))
+                                  4294967296.)))
                (w2 (min #xFFFF
                         (truncate (setq value (- value (* w1 4294967296.0)))
                                   #x10000)))
@@ -244,13 +244,13 @@
   "4 bytes signed integer => byte array (MSB first)."
   (xcb:-pack-u4 (if (>= value 0)
                     value
-                  (+ value #x100000000)))) ;treated as float for 32-bit
+                  (+ value 4294967296.)))) ;treated as float for 32-bit
 
 (defsubst xcb:-pack-i4-lsb (value)
   "4 bytes signed integer => byte array (LSB first)."
   (xcb:-pack-u4-lsb (if (>= value 0)
                         value
-                      (+ value #x100000000)))) ;treated as float for 32-bit
+                      (+ value 4294967296.)))) ;treated as float for 32-bit
 
 (defsubst xcb:-unpack-u1 (data offset)
   "Byte array => 1 byte unsigned integer."
@@ -361,16 +361,16 @@
 (defsubst xcb:-unpack-i4 (data offset)
   "Byte array => 4 bytes signed integer (MSB first)."
   (let ((value (xcb:-unpack-u4 data offset)))
-    (if (< value #x80000000)            ;treated as float for 32-bit
+    (if (< value 2147483648.)           ;treated as float for 32-bit
         value
-      (- value #x100000000))))          ;treated as float for 32-bit
+      (- value 4294967296.))))          ;treated as float for 32-bit
 
 (defsubst xcb:-unpack-i4-lsb (data offset)
   "Byte array => 4 bytes signed integer (LSB first)."
   (let ((value (xcb:-unpack-u4-lsb data offset)))
-    (if (< value #x80000000)            ;treated as float for 32-bit
+    (if (< value 2147483648.)           ;treated as float for 32-bit
         value
-      (- value #x100000000))))          ;treated as float for 32-bit
+      (- value 4294967296.))))          ;treated as float for 32-bit
 
 (defmacro xcb:-fieldref (field)
   "Evaluate a <fieldref> field."
diff --git a/xcb-xinput.el b/xcb-xinput.el
index b2ef72b8c..f4da64e37 100644
--- a/xcb-xinput.el
+++ b/xcb-xinput.el
@@ -1862,8 +1862,6 @@
 (defconst xcb:xinput:GrabType:FocusIn 3)
 (defconst xcb:xinput:GrabType:TouchBegin 4)
 
-(defconst xcb:xinput:ModifierMask:Any 2147483648)
-
 (defclass xcb:xinput:GrabModifierInfo
   (xcb:-struct)
   ((modifiers :initarg :modifiers :type xcb:CARD32)
diff --git a/xcb-xkb.el b/xcb-xkb.el
index 881f4df0f..1f26deb68 100644
--- a/xcb-xkb.el
+++ b/xcb-xkb.el
@@ -105,9 +105,6 @@
 
 (defconst xcb:xkb:Control:GroupsWrap 134217728)
 (defconst xcb:xkb:Control:InternalMods 268435456)
-(defconst xcb:xkb:Control:IgnoreLockMods 536870912)
-(defconst xcb:xkb:Control:PerKeyRepeat 1073741824)
-(defconst xcb:xkb:Control:ControlsEnabled 2147483648)
 
 (defconst xcb:xkb:AXOption:SKPressFB 1)
 (defconst xcb:xkb:AXOption:SKAcceptFB 2)
-- 
2.14.3


[-- Attachment #3: 0001-Port-to-32-bit-Emacs-on-master-branch.patch --]
[-- Type: text/x-patch, Size: 1260 bytes --]

From ff4ae82fd7ca9101da92f21c7f46f991da99a30e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 15 Apr 2018 14:52:39 -0700
Subject: [PATCH] Port to 32-bit Emacs on master branch

---
 exwm-layout.el | 2 +-
 exwm.el        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index b74f512a4..764259870 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -117,7 +117,7 @@
   (with-current-buffer (exwm--id->buffer id)
     (unless (or (exwm-layout--iconic-state-p)
                 (and exwm--floating-frame
-                     (eq #xffffffff exwm--desktop)))
+                     (eq 4294967295. exwm--desktop)))
       (exwm--log "Hide #x%x" id)
       (when exwm--floating-frame
         (let* ((container (frame-parameter exwm--floating-frame
diff --git a/exwm.el b/exwm.el
index 195ca7b80..17f73d8ca 100644
--- a/exwm.el
+++ b/exwm.el
@@ -154,7 +154,7 @@
       (when reply
         (setq desktop (slot-value reply 'value))
         (cond
-         ((eq desktop #xffffffff)
+         ((eq desktop 4294967295.)
           (unless (or (not exwm--floating-frame)
                       (eq exwm--frame exwm-workspace--current)
                       (and exwm--desktop
-- 
2.14.3


  parent reply	other threads:[~2018-04-15 22:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  3:03 bug#31118: 27.0.50; Can't load/compile websocket in 32bit master Stefan Monnier
2018-04-10 22:41 ` Paul Eggert
2018-04-11  1:56   ` Stefan Monnier
2018-04-11  8:07     ` Paul Eggert
     [not found]       ` <mvmwoxe40f3.fsf@suse.de>
2018-04-11  8:35         ` Paul Eggert
2018-04-11 12:19       ` Stefan Monnier
2018-04-11 12:47         ` Basil L. Contovounesios
2018-04-11 16:22         ` Paul Eggert
2018-04-11 18:37           ` Stefan Monnier
2018-04-11 19:47             ` Glenn Morris
2018-04-15 22:11             ` Paul Eggert [this message]
2018-04-16  1:26               ` Stefan Monnier
2018-04-17  7:50                 ` Paul Eggert
2018-04-17 12:18                   ` Stefan Monnier
2018-04-17 23:53                     ` Paul Eggert
2018-04-18 12:22                       ` Stefan Monnier
2018-04-18 19:50                         ` Paul Eggert
2018-04-11 16:41         ` Eli Zaretskii
2018-04-11 18:38           ` Stefan Monnier
2018-04-12 12:50             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80fbbf82-c20f-6a01-b257-45caa4a87fdf@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=31118@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).