Alexander V. Voinov
Wed, 23 Jun 99 18:01:01 GMT
This release provides more Pythonic way to invoke three SLang functions
which deal with the 'raw' representation of the portions of the screen
as a sequence of pairs (color, character):
SLsmg_write_color_chars( [(color1, char1), (color2, char2), ...])
list_length, [(color, char), ...] = SLsmg_read_raw(list_length))
SLsmg_write_raw([(color, char), ...])
The 'char's in these synopses are represented also pythonically as
strings of the length 1.
An element of the list used as the parameter (but NOT the result) here
may also be just an unsigned short, composed as color << 8 | char. In
that case 'char' is really the character's integer representation
(obtained, e.g., via ord()). This is retained for better compatibility
with the underlying C library, but may be discontinued in future
releases. The result of the function SLsmg_read_raw is always a list of
tuples as depicted above.
When color value is OR'd with 0x80 it represents the alternative
character set, supposed to contain pseudographic characters.
Unfortunately, this part of SLang occur to work differently under Unix
and win32. In the first case, at least under Linux, one switches the
character sets or uses 0x80-d colors and gets pseudographics by
specifying chars as 'q', 'v', etc from a subset of the first 128 ASCII
characters. Under win32, however, both switching the character sets and
0x80-ing the colors does nothing, and pseudographics is found, in usual
PC manner, in the higher half of the ASCII table.
Certainly one would easily map the win32 behaviour onto the Unix one
within the slang.i interface file. But it would break proper
transparency on the pyslang wrapper. The best would be if the
appropriate mapping was done within the SLang library itself, probably
with some additional 'option-set' function, which would retain standard
win32 behaviour for those who requires best backward compatibility with
the older PC/DOS stuff. Any ideas/comments/desires are welcome to be
reflected in future releases.
In that version the demo_*.py examples are best viewed under Unix. They
run however, under win32, with some minor ugliness.
The distribution is found at the Starship:
It contains sources for Unices and win32 together with two binaries: for
Linux (latest glibc) and win32.
0.2.0</A> - Python interface to SLang text-mode user interface
----------- comp.lang.python.announce (moderated) ----------
Article Submission Address: email@example.com
Python Language Home Page: http://www.python.org/
Python Quick Help Index: http://www.python.org/Help.html