File: README-0.2.0

package info (click to toggle)
python-slang 0.2.0-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 400 kB
  • ctags: 339
  • sloc: ansic: 3,736; python: 151; sh: 97; makefile: 93
file content (39 lines) | stat: -rw-r--r-- 2,138 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 character in these synopses is represented also pythonically as the string 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.