Skip to content

Commit 6e1026a

Browse files
committed
Optimizations and 64-bitfixif.
1 parent c98e18e commit 6e1026a

9 files changed

Lines changed: 639 additions & 384 deletions

File tree

NEWS

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
-*-outline-*-
2+
3+
NEWS for Python X Library
4+
5+
6+
* Version 0.7 6 Jan 2001
7+
8+
** Fixed the 64-bit platform fix.
9+
10+
As it turns out, the attempted fix for 64-bit platforms in v0.6 didn't
11+
really work. Close study of structmodules.c gave the answer why, and
12+
now it really should work. Yeah.
13+
14+
** Optimizations of core protocol engine
15+
16+
Python Xlib is now at least 25% faster after the core of the protocol
17+
engine has been rewritten. This is some quite cute code: tailor-made
18+
methods are generated for all structures, resulting in a 650% speed-up
19+
in generating binary data, and a 75% speed-up in parsing binary data.
20+
21+
Interested Python hackers are recommended to take a look at the Struct
22+
class in Xlib/protocol/rq.py.
23+
24+
125

226
* Version 0.6 29 Dec 2000
327

README

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11

22
The Python X Library
33

4-
Version 0.4, 4 Oct 2000
4+
Version 0.7, 6 Jan 2000
55

66

77
*** Copyright
88

9+
Copyright (C) 2000,2001 Peter Liljenberg
10+
911
The Python X Library is released under GPL, see the file COPYING for
1012
details.
1113

1214

15+
*** Requirements
16+
17+
The Python X Library requires Python 1.5.2 or newer, though it hasn't
18+
been tested with any newer Python versions yet.
19+
20+
1321
*** Installation
1422

1523
Just copy the Xlib directory to some place in the module path. E.g.:
@@ -34,12 +42,11 @@ and the newer plxlib) which were interfaces to the C Xlib.
3442

3543
This is possible to do since X client programs communicate with the X
3644
server via the X protocol. The communication takes place over TCP/IP,
37-
Unix sockets, DECnet or any other suitable streaming network protocol.
38-
The C Xlib is merely an interface to this protocol, providing
39-
functions suited for a C environment.
45+
Unix sockets, DECnet or any other streaming network protocol. The C
46+
Xlib is merely an interface to this protocol, providing functions
47+
suitable for a C environment.
4048

41-
There are three advantages of choosing to implement a pure Python
42-
library:
49+
There are three advantages of implementing a pure Python library:
4350

4451
* Integration: The library can make use of the wonderful object
4552
system in Python, providing an easy-to-use class hierarchy.
@@ -54,22 +61,21 @@ library:
5461

5562
*** Project status
5663

57-
The low-level protocol and a rudimentary object oriented interface is
58-
complete, implementing client-side X11R6. This should be usable for
59-
writing applications. It runs at least on Linux using XFree86 as the
60-
server, but should run on most Unices.
64+
The low-level protocol is complete, implementing client-side X11R6.
65+
The high-level object oriented interface is also fully functional.
66+
It is possible to write client applications with the library.
67+
Currently, the only real application using Python Xlib is the window
68+
manager PLWM, starting with version 2.0.
6169

62-
A resource database has been implemented and there is a framework for
63-
adding X extension code. Currently only the XTEST extension has been
64-
implemented.
70+
There is a resource database implementation, ICCCM support and a
71+
framework for adding X extension code. Currently only the XTEST
72+
extension has been implemented.
6573

66-
There are most likely bugs, as only a rather small subset of all the
67-
requests and methods have been tested. The code is released anyway to
68-
let other interested Python hackers have a look (and hopefully help
69-
out with debugging and coding :).
74+
There are most likely still bugs, although a large part of the library
75+
has been exercised now and seems to work just fine.
7076

71-
There are some documentation now, but it doesn't cover any methods
72-
yet.
77+
There are some documentation, but it doesn't cover the object oriented
78+
interface methods yet.
7379

7480
See the file TODO for a detailed list of what is missing,
7581
approximately ordered by importance.
@@ -81,7 +87,7 @@ Author email: Peter Liljenberg <petli@ctrl-c.liu.se>
8187

8288
The Python X Library is a SourceForged project. The project page is
8389
http://sourgeforge.net/projects/python-xlib/. Source is available
84-
from that page as real releases and from the CVS tree.
90+
from that page as tar.gz-releases and from the CVS tree.
8591

8692
There isn't any real web page yet, only a derivative of this file. It
8793
is located at http://python-xlib.sourceforge.net/.

TODO

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
*** To be a real C Xlib replacement
1010

11-
* High-level functions: currently, there are only methods which
12-
directly correspond to X requests. Perhaps there should be some
13-
simpler functions (e.g. Window.resize_window() in addition to
11+
* High-level functions: currently, there are mostly methods which
12+
directly correspond to X requests. There should be some simpler
13+
functions (e.g. Window.resize_window() in addition to
1414
Window.configure(), Drawable.rectangle() in addition to
1515
Drawable.poly_rectangle(), etc), and possibly also compound
1616
functions (e.g. create_pixmap_from_image() which would load an image
@@ -24,6 +24,9 @@
2424

2525
*** Miscellaneous
2626

27+
* Faster, faster! The protocol engine isn't very fast, despite the
28+
optimizations in version 0.7.
29+
2730
* The tread support and the protocol engine needs to be stress
2831
tested. They _seem_ to work, but that's no guarantee.
2932

Xlib/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# $Id: __init__.py,v 1.7 2000-12-29 16:16:54 petli Exp $
1+
# $Id: __init__.py,v 1.8 2001-01-06 17:58:06 petli Exp $
22
#
33
# Xlib.__init__ -- glue for Xlib package
44
#
5-
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
5+
# Copyright (C) 2000,2001 Peter Liljenberg <petli@ctrl-c.liu.se>
66
#
77
# This program is free software; you can redistribute it and/or modify
88
# it under the terms of the GNU General Public License as published by
@@ -33,4 +33,6 @@
3333
'xobject',
3434
]
3535

36-
__version__ = (0, 6)
36+
__version__ = (0, 7)
37+
38+

Xlib/protocol/ChangeLog

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2001-01-04 <petli@cendio.se>
2+
3+
* rq.py: The fix for 64-bit platforms didn't work, and close
4+
scrutiny of structmodule.c shows why: it turns out that '='
5+
translates into '<' or '>', the one the platform would use. This
6+
means B is one byte, H is two and L is four, and no extra
7+
alignment, always. '@', which is the default, selects native
8+
number of bytes, which on Alpha means that 'L' is eight bytes.
9+
10+
Now the code goes to pains to ensure that '=' encoding is always
11+
used, so _now_ it should work on all platforms. Ahem.
12+
13+
14+
2000-12-29 <petli@cendio.se>
15+
16+
* rq.py: Optimizations:
17+
+ replace calls to Field.get_name() with access to attribute
18+
name.
19+
(Struct.build_from_args):
20+
121
Fri Dec 29 17:05:02 2000 Peter Liljenberg <petli@cendio.se>
222

323
* rq.py: Alpha forces us to probe how many bytes each struct code

Xlib/protocol/display.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# $Id: display.py,v 1.9 2000-12-22 13:23:34 petli Exp $
1+
# $Id: display.py,v 1.10 2001-01-06 17:58:06 petli Exp $
22
#
33
# Xlib.protocol.display -- core display communication
44
#
5-
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
5+
# Copyright (C) 2000,2001 Peter Liljenberg <petli@ctrl-c.liu.se>
66
#
77
# This program is free software; you can redistribute it and/or modify
88
# it under the terms of the GNU General Public License as published by
@@ -659,7 +659,7 @@ def parse_error_response(self, request):
659659
estruct = self.error_classes.get(code, error.XError)
660660

661661
e = estruct(self, self.data_recv[:32])
662-
self.data_recv = self.data_recv[32:]
662+
self.data_recv = buffer(self.data_recv, 32)
663663

664664
# print 'recv Error:', e
665665

@@ -713,7 +713,7 @@ def parse_request_response(self, request):
713713
req._parse_response(self.data_recv[:self.request_length])
714714
# print 'recv Request:', req
715715

716-
self.data_recv = self.data_recv[self.request_length:]
716+
self.data_recv = buffer(self.data_recv, self.request_length)
717717
self.request_length = 0
718718

719719

@@ -735,7 +735,7 @@ def parse_event_response(self, etype):
735735
estruct = self.event_classes.get(etype, event.AnyEvent)
736736

737737
e = estruct(display = self, binarydata = self.data_recv[:32])
738-
self.data_recv = self.data_recv[32:]
738+
self.data_recv = buffer(self.data_recv, 32)
739739

740740
# Drop all requests having an error handler,
741741
# but which obviously succeded
@@ -953,7 +953,7 @@ class ConnectionSetupRequest(rq.GetAttrData):
953953

954954

955955
def __init__(self, display, *args, **keys):
956-
self._binary = self._request.build_from_args(args, keys)
956+
self._binary = apply(self._request.to_binary, args, keys)
957957
self._data = None
958958

959959
# Don't bother about locking, since no other threads have

0 commit comments

Comments
 (0)