Create new SDL2 port based on Laura Michaels' patch

The patch was originally intended to be applied to the existing
SDL port. However, as SDL2 is arguably a separate platform, altering
the existing SDL port is disallowed by the Implementor's Guide.
This commit is contained in:
Robin Gustafsson
2016-11-10 17:35:59 +01:00
parent 6909c66c13
commit de5bc06453
15 changed files with 2487 additions and 0 deletions

103
doc/sdl2.txt Normal file
View File

@@ -0,0 +1,103 @@
SDL2 Considerations
===================
Clipboard
---------
SDL2 port uses functionality provided by the SDL2 clipboard functions to add
basic clipboard support.
Fonts
-----
If the PDC_WIDE flag is set, SDL2 version uses SDL2_ttf and SDL version
uses SDL_ttf to render fonts. This allows for use of a full UCS-2 (16 bit
Unicode) character set.
SDL2 has several changes from SDL on how to handle Unicode character input
including the addition of SDL_TEXTINPUT event and new functions to use with it.
This allows use of an input method editor to enter characters that may not be
standard for the keyboard. For simplicity, the pdcurses SDL_ttf additions
don't use this new added functionality. They take an approach that will work
with SDL or SDL2. Windows users may be familiar with holding down the alt key
while entering a numeric value via the keypad. Windows translates this input
and the number into a character. The SDL ports with PDC_WIDE option use a
similar technique across all platforms not just Windows.
To enter a hexidecimal value for a character, hold down the alt key and press
plus on the numeric keypad. Then, enter the hexidecimal code for the
character. Then, release the alt key. To enter a decimal number, hold down
the alt key and press 0 on the keypad, followed by the decimal equivalent of
the character. Release the alt key. This allows users to enter characters not
available on their keyboards without need for additional code or programs to
deal with input.
The default Truetype font used is a monospaced font. One can specify another
font using the integration methods described. The font does not necessarily
need to be a monospaced font. Since PDCurses assumes a fixed size (default
screen size is 80x25), a monospaced font may look better on screen than other
types of fonts.
Integration with SDL2 and SDL2_TTF or SDL_TTF
---------------------------------------------
As mentioned in SDL Considerations document, the SDL port uses the following
variables:
PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
The SDL2 port adds:
SDL_Window *pdc_window;
SDL_Renderer *pdc_render;
SDL_Texture *pdc_texture;
Using SDL_ttf (with SDL2 or SDL) adds:
TTF_Font *pdc_ttffont;
SDL_Color *pdc_ttffont_foregroundcolor;
SDL_Color *pdc_ttffont_backgroundcolor;
int pdc_ttffont_spointsz;
int pdc_ttffont_hint;
These can be used or modified in your own code. Like the pdc_screen variable
used by the SDL port, you can initialize pdc_window, pdc_render,
pdc_texture in your own code. If it's not initialized, PDCurses will do
it for you. See the sdltest demo for an example. If PDCurses is built with
the PDC_WIDE flag, it will clean up/deallocate these variables on exit when
needed.
Default font for SDL_TTF is assumed to be DejaVuSansMono.ttf from the Open
Source DejaVu fonts. The code looks for this font to already be installed in
a standard directory (based on the Filesystem Hierarchy Standard)
/usr/local/share/fonts/truetype/dejavu/. This can be modified by setting a
define during compile time
( -DPDC_FONT_PATH=/usr/share/fonts/truetype/dejavu/ ) This can be overridden
by initializing pdc_ttffont in your own code. Similar to the
PDC_FONT environment variable for SDL bitmap fonts, one can also override TTF
fonts using the PDC_FONT and PDC_FONT_POINT_SIZE environment variables.
How a font is rendered on the screen depends on a number of factors.
TTF_SetFontHinting (from SDL_TTF or SDL2_TTF) uses the pdc_ttffont_hint setting
which can affect how the font appears on the screen. Default for PDCurses is
currently TTF_HINTING_MONO, but one can also use TTF_HINTING_NORMAL,
TTF_HINTING_LIGHT, TTF_HINTING_NONE by setting pdc_ttffont_hint before
PDCurses initializes pdc_ttffont. If you initialize pdc_ttffont in your own
code, TTF_SetFontHinting is not called by PDCurses and the default setting is
TTF_HINTING_NORMAL. This can always be changed in your own code by calling
TTF_SetFontHinting. The font is also affected by the settings used when
building the freetype library (which SDL_TTF or SDL2_TTF uses). For example,
on Windows, one may want to add the following compile time flags when building
the freetype library:
-DTT_CONFIG_OPTION_SUBPIXEL_HINTING -DFT_CONFIG_OPTION_SUBPIXEL_RENDERING
Some testing was done building freetype with and without harfbuzz library and
that did not seem to affect TTF rendering. (Harfbuzz mainly relates to
OpenType fonts, OTF rendering.)
SDL2 and SDL_TTF modifications were added by Laura Michaels in 2015.
SDL2 and SDL_TTF modifications are licensed using the Creative Commons license
CC0 ( https://creativecommons.org/publicdomain/zero/1.0/ ).

130
sdl2/Makefile Normal file
View File

@@ -0,0 +1,130 @@
# Makefile for PDCurses library for SDL
O = o
ifndef PDCURSES_SRCDIR
PDCURSES_SRCDIR = ..
endif
prefix =$(DESTDIR)$(PREFIX)
exec_prefix =$(prefix)
libdir =$(exec_prefix)/lib
bindir =$(exec_prefix)/bin
includedir =$(exec_prefix)/include
docdir =$(exec_prefix)/share/doc/pdcurses
mandir =../doc
include $(PDCURSES_SRCDIR)/libobjs.mif
osdir = $(PDCURSES_SRCDIR)/sdl2
PDCURSES_SDL_H = $(osdir)/pdcsdl.h
SFLAGS = $(shell pkg-config --cflags sdl2_ttf sdl2)
SLIBS = $(shell pkg-config --libs sdl2_ttf sdl2)
# If your system doesn't have these, remove the defines here
SFLAGS += -DHAVE_VSNPRINTF -DHAVE_VSSCANF
ifeq ($(DEBUG),Y)
CFLAGS = -g -Wall -DPDCDEBUG
else
CFLAGS:= $(CFLAGS)
CFLAGS += -O2 -Wall
LDFLAGS:= $(LDFLAGS)
endif
ifeq ($(WIDE),Y)
CFLAGS += -DPDC_WIDE
endif
ifeq ($(UTF8),Y)
CFLAGS += -DPDC_FORCE_UTF8
endif
BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR)
ifeq ($(shell uname),Darwin)
DEMOFLAGS = -Dmain=SDL_main
endif
LINK = $(CC)
LDFLAGS = $(LIBCURSES) $(SLIBS)
RANLIB = ranlib
LIBCURSES = libpdcurses.a
DEMOS = firework$(EXE_EXTENSION) newdemo$(EXE_EXTENSION) ptest$(EXE_EXTENSION) rain$(EXE_EXTENSION) testcurs$(EXE_EXTENSION) tuidemo$(EXE_EXTENSION) worm$(EXE_EXTENSION) xmas$(EXE_EXTENSION) \
sdltest$(EXE_EXTENSION)
.PHONY: all libs clean demos install
all: libs demos
libs: $(LIBCURSES)
clean:
-rm -rf *.o trace $(LIBCURSES) $(DEMOS)
demos: $(DEMOS)
# strip $(DEMOS)
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
ar rv $@ $?
-$(RANLIB) $@
$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
$(PDCOBJS) : $(PDCURSES_SDL_H)
$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
tui.o tuidemo.o : $(PDCURSES_CURSES_H)
terminfo.o: $(TERM_HEADER)
panel.o ptest$(EXE_EXTENSION): $(PANEL_HEADER)
$(LIBOBJS) : %.o: $(srcdir)/%.c
$(BUILD) $(SFLAGS) -c $<
$(PDCOBJS) : %.o: $(osdir)/%.c
$(BUILD) $(SFLAGS) -c $<
firework$(EXE_EXTENSION): $(demodir)/firework.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
newdemo$(EXE_EXTENSION): $(demodir)/newdemo.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
ptest$(EXE_EXTENSION): $(demodir)/ptest.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
rain$(EXE_EXTENSION): $(demodir)/rain.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
testcurs$(EXE_EXTENSION): $(demodir)/testcurs.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
tuidemo$(EXE_EXTENSION): tuidemo.o tui.o
$(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS)
worm$(EXE_EXTENSION): $(demodir)/worm.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
xmas$(EXE_EXTENSION): $(demodir)/xmas.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
sdltest$(EXE_EXTENSION): $(osdir)/sdltest.c
$(BUILD) $(SFLAGS) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
tui.o: $(demodir)/tui.c $(demodir)/tui.h
$(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c
tuidemo.o: $(demodir)/tuidemo.c
$(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c
install:
if ( test ! -d $(bindir) ) ; then mkdir -p $(bindir) ; fi
cp $(DEMOS) $(bindir)
if ( test ! -d $(libdir) ) ; then mkdir -p $(libdir) ; fi
cp *.a $(libdir)
if ( test ! -d $(includedir) ) ; then mkdir -p $(includedir) ; fi
cp ../curses.h $(includedir)
cp ../panel.h $(includedir)
cp ../term.h $(includedir)
if ( test ! -d $(docdir) ) ; then mkdir -p $(docdir) ; fi
cp $(mandir)/*.txt $(docdir)

105
sdl2/Makefile.mng Normal file
View File

@@ -0,0 +1,105 @@
# Makefile for PDCurses library for SDL
O = o
ifndef PDCURSES_SRCDIR
PDCURSES_SRCDIR = ..
endif
include $(PDCURSES_SRCDIR)/libobjs.mif
osdir = $(PDCURSES_SRCDIR)/sdl1
PDCURSES_SDL_H = $(osdir)/pdcsdl.h
ifeq ($(DEBUG),Y)
CFLAGS = -g -Wall -DPDCDEBUG
else
CFLAGS = -O2 -Wall
endif
CC = gcc
BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR)
LDFLAGS = -mwindows $(LIBCURSES)
BASEDEF = $(PDCURSES_SRCDIR)\exp-base.def
DEFDEPS = $(BASEDEF)
DEFFILE = pdcurses.def
ifeq ($(DLL),Y)
BUILD += -DPDC_DLL_BUILD
LIBEXE = gcc $(DEFFILE)
LIBFLAGS = -Wl,--out-implib,libpdcurses.a -shared -o
LIBCURSES = pdcurses.dll
CLEAN = $(LIBCURSES) *.a $(DEFFILE)
POST = -lSDL
else
LIBEXE = ar
LIBFLAGS = rcv
LIBCURSES = libpdcurses.a
CLEAN = *.a
LDFLAGS += -lSDL
endif
DEMOS += sdltest.exe
.PHONY: all libs clean demos
all: libs demos
libs: $(LIBCURSES)
clean:
-del *.o $(CLEAN) *.exe
demos: $(DEMOS)
strip *.exe
pdcurses.dll: $(DEFFILE)
$(DEFFILE): $(DEFDEPS)
echo LIBRARY pdcurses > $@
echo EXPORTS >> $@
type $(BASEDEF) >> $@
echo pdc_screen >> $@
echo pdc_font >> $@
echo pdc_icon >> $@
echo pdc_back >> $@
echo pdc_sheight >> $@
echo pdc_swidth >> $@
echo pdc_yoffset >> $@
echo pdc_xoffset >> $@
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
$(LIBEXE) $(LIBFLAGS) $@ $? $(POST)
$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
$(PDCOBJS) : $(PDCURSES_SDL_H)
$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
tui.o tuidemo.o : $(PDCURSES_CURSES_H)
terminfo.o: $(TERM_HEADER)
panel.o ptest.exe: $(PANEL_HEADER)
$(LIBOBJS) : %.o: $(srcdir)/%.c
$(BUILD) -c $<
$(PDCOBJS) : %.o: $(osdir)/%.c
$(BUILD) -c $<
firework.exe newdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \
ptest.exe: %.exe: $(demodir)/%.c
$(BUILD) -o $@ $< $(LDFLAGS)
tuidemo.exe: tuidemo.o tui.o
$(CC) -o $@ tuidemo.o tui.o $(LDFLAGS)
tui.o: $(demodir)/tui.c $(demodir)/tui.h
$(BUILD) -c $<
tuidemo.o: $(demodir)/tuidemo.c $(demodir)/tui.h
$(BUILD) -c $<
sdltest.exe: $(osdir)/sdltest.c
$(BUILD) -o $@ $< -mwindows $(LIBCURSES) -lmingw32 -lSDLmain -lSDL

33
sdl2/README Normal file
View File

@@ -0,0 +1,33 @@
PDCurses for SDL
================
This is a port of PDCurses for SDL.
Building
--------
. On *nix (including Linux and Mac OS X), run "make" in the sdl1
directory. There is no configure script (yet?) for this port. This
assumes a working sdl-config, and GNU make. It builds the library
libpdcurses.a (dynamic lib not implemented).
With MinGW, run "make -f Makefile.mng". This assumes SDL is installed
in the standard directories. The MinGW makefile accepts the optional
parameters "DLL=Y" and "DEBUG=Y", as with the console version. (Wide-
character support is not yet implemented for SDL.) Both makefiles
recognize the optional PDCURSES_SRCDIR environment variable, as with
the console ports. Makefile.mng builds libpdcurses.a, along with
pdcurses.dll, if specified.
Distribution Status
-------------------
The files in this directory are released to the Public Domain.
Acknowledgements
----------------
SDL port was provided by William McBrine <wmcbrine@users.sf.net>

385
sdl2/deffont.h Normal file
View File

@@ -0,0 +1,385 @@
/* Default font -- this is simply a 256x128x1 BMP, in #include'able form.
The font is 8x16, code page 437, and is based on the pc8x16s.bdf font
from the vgafonts.tar.gz package, by "Myrlin". */
unsigned char deffont[] =
{
0x42, 0x4d, 0x3e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e,
0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x76, 0xf8, 0xc0, 0x6c, 0xfe, 0x70, 0x7c, 0x18,
0x7e, 0x38, 0xee, 0x3c, 0x00, 0xc0, 0x1c, 0xc6, 0x00, 0x7e, 0x7e,
0x7e, 0x18, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00,
0x00, 0x00, 0xdc, 0xcc, 0xc0, 0x6c, 0xc6, 0xd8, 0x66, 0x18, 0x18,
0x6c, 0x6c, 0x66, 0x00, 0x60, 0x30, 0xc6, 0xfe, 0x00, 0x00, 0x00,
0x18, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x7e,
0x00, 0xd8, 0xcc, 0xc0, 0x6c, 0x60, 0xd8, 0x66, 0x18, 0x3c, 0xc6,
0x6c, 0x66, 0x7e, 0x7e, 0x60, 0xc6, 0x00, 0x00, 0x30, 0x0c, 0x18,
0xd8, 0x18, 0xdc, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x7e, 0x00,
0xd8, 0xcc, 0xc0, 0x6c, 0x30, 0xd8, 0x66, 0x18, 0x66, 0xc6, 0x6c,
0x66, 0xdb, 0xf3, 0x60, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x76, 0x00, 0x18, 0x00, 0x6c, 0x00, 0x00, 0x7e, 0x00, 0xd8,
0xc8, 0xc0, 0x6c, 0x18, 0xd8, 0x66, 0x18, 0x66, 0xc6, 0x6c, 0x66,
0xdb, 0xdb, 0x60, 0xc6, 0xfe, 0x18, 0x0c, 0x30, 0x18, 0x18, 0x7e,
0x00, 0x00, 0x18, 0x18, 0xec, 0x00, 0x00, 0x7e, 0x00, 0xdc, 0xdc,
0xc0, 0x6c, 0x18, 0xd8, 0x66, 0x18, 0x66, 0xfe, 0xc6, 0x3e, 0xdb,
0xdb, 0x7c, 0xc6, 0x00, 0x7e, 0x06, 0x60, 0x18, 0x18, 0x00, 0xdc,
0x00, 0x00, 0x00, 0x0c, 0x36, 0x7e, 0x7e, 0x00, 0x76, 0xce, 0xc0,
0xfe, 0x30, 0x7e, 0x66, 0xdc, 0x66, 0xc6, 0xc6, 0x0c, 0x7e, 0x7e,
0x60, 0xc6, 0x00, 0x18, 0x0c, 0x30, 0x18, 0x18, 0x18, 0x76, 0x00,
0x00, 0x00, 0x0c, 0x36, 0x32, 0x7e, 0x00, 0x00, 0xc6, 0xc6, 0x00,
0x60, 0x00, 0x00, 0x76, 0x3c, 0xc6, 0xc6, 0x18, 0x00, 0x06, 0x60,
0xc6, 0xfe, 0x18, 0x18, 0x18, 0x1b, 0x18, 0x00, 0x00, 0x38, 0x00,
0x00, 0x0c, 0x36, 0x18, 0x7e, 0x00, 0x00, 0xce, 0xc6, 0x00, 0xc6,
0x00, 0x00, 0x00, 0x18, 0x6c, 0x6c, 0x30, 0x00, 0x03, 0x30, 0x7c,
0x00, 0x00, 0x30, 0x0c, 0x1b, 0x18, 0x00, 0x00, 0x6c, 0x00, 0x00,
0x0c, 0x36, 0x0c, 0x00, 0x00, 0x00, 0x7c, 0xfe, 0x00, 0xfe, 0x00,
0x00, 0x00, 0x7e, 0x38, 0x38, 0x1e, 0x00, 0x00, 0x1c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0e, 0x18, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x0c,
0x36, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0f, 0x6c,
0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00,
0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00,
0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f,
0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36,
0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00,
0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00,
0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18,
0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00,
0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36,
0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36,
0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00,
0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36,
0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36,
0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18,
0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00,
0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18,
0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18,
0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36,
0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00,
0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00,
0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18,
0xff, 0xff, 0xf0, 0x0f, 0x00, 0x1f, 0xff, 0xff, 0x1f, 0xff, 0xff,
0x1f, 0x37, 0x3f, 0x37, 0xff, 0xf7, 0x37, 0xff, 0xf7, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x1f, 0x1f, 0x3f, 0xff, 0xff, 0xf8, 0x1f, 0xff,
0xff, 0xf0, 0x0f, 0x00, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18,
0x36, 0x30, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x36, 0x00,
0x00, 0x36, 0x18, 0x18, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00,
0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x1f, 0x36,
0x37, 0x3f, 0xf7, 0xff, 0x37, 0xff, 0xf7, 0xff, 0x36, 0xff, 0x00,
0x36, 0x1f, 0x1f, 0x00, 0x36, 0xff, 0x18, 0x00, 0xff, 0x00, 0xf0,
0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36,
0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36,
0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f,
0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00,
0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18,
0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff,
0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36,
0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00,
0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18,
0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00,
0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00,
0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18,
0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36,
0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36,
0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18,
0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36,
0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x06, 0x00, 0x00, 0x00,
0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36,
0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0x11,
0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x18, 0x76, 0x18, 0x7c, 0x78, 0x66, 0xc6, 0x00,
0x00, 0x7c, 0x00, 0x00, 0x0c, 0x3f, 0x18, 0x00, 0x00, 0x44, 0xaa,
0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00,
0x00, 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xc6, 0x00, 0x00,
0xc6, 0xc0, 0x06, 0x86, 0x9a, 0x3c, 0x00, 0x00, 0x11, 0x55, 0xdd,
0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00,
0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xc6, 0x00, 0x00, 0xc6,
0xc0, 0x06, 0xdc, 0xce, 0x3c, 0x36, 0xd8, 0x44, 0xaa, 0x77, 0x18,
0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00,
0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xce, 0x00, 0x00, 0xc0, 0xc0,
0x06, 0x60, 0x66, 0x3c, 0x6c, 0x6c, 0x11, 0x55, 0xdd, 0x18, 0x18,
0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18,
0x7c, 0x18, 0xc6, 0xcc, 0x66, 0xde, 0x7e, 0x7c, 0x60, 0xc0, 0x06,
0x30, 0x30, 0x18, 0xd8, 0x36, 0x44, 0xaa, 0x77, 0x18, 0xf8, 0xf8,
0xf6, 0xfe, 0xf8, 0xf6, 0x36, 0xf6, 0xfe, 0xfe, 0xf8, 0xf8, 0x0c,
0x18, 0xc6, 0xcc, 0x66, 0xfe, 0x00, 0x00, 0x30, 0xfe, 0xfe, 0x18,
0x18, 0x18, 0x6c, 0x6c, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36,
0x00, 0x18, 0x06, 0x36, 0x06, 0x06, 0x36, 0x18, 0x00, 0x78, 0x38,
0x7c, 0xcc, 0x5c, 0xf6, 0x3e, 0x38, 0x30, 0x00, 0x00, 0x6c, 0x6c,
0x18, 0x36, 0xd8, 0x44, 0xaa, 0x77, 0x18, 0x18, 0xf8, 0x36, 0x00,
0xf8, 0xf6, 0x36, 0xfe, 0xf6, 0x36, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe6, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00,
0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00,
0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x60, 0x30, 0x60, 0x60,
0xdc, 0xc6, 0x6c, 0x6c, 0x30, 0x00, 0x00, 0x62, 0x62, 0x18, 0x00,
0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36,
0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x30, 0x18, 0x30, 0x30, 0x76,
0x00, 0x3c, 0x38, 0x30, 0x00, 0x00, 0xe0, 0xe0, 0x18, 0x00, 0x00,
0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36,
0x00, 0x36, 0x36, 0x18, 0x00, 0x18, 0x0c, 0x18, 0x18, 0x00, 0xdc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x44,
0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00,
0x36, 0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x55,
0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36,
0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x78, 0x7c, 0x76, 0x76, 0x76, 0x76, 0x7c, 0x7c, 0x7c, 0x7c, 0x18,
0x18, 0x18, 0xc6, 0xc6, 0xfc, 0x6e, 0xce, 0x7c, 0x7c, 0x7c, 0x78,
0x78, 0x76, 0x7c, 0x7c, 0x18, 0xfe, 0x18, 0xc6, 0x70, 0x3c, 0xcc,
0xc2, 0xcc, 0xcc, 0xcc, 0xcc, 0xc6, 0xc2, 0xc2, 0xc2, 0x18, 0x18,
0x18, 0xc6, 0xc6, 0xc0, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc,
0xce, 0xc6, 0xc6, 0x18, 0x60, 0x7e, 0xcc, 0xd8, 0x66, 0xcc, 0xc0,
0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x18, 0x18, 0x18,
0xc6, 0xc6, 0xc0, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6,
0xc6, 0xc6, 0x7c, 0x60, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0xc0, 0xcc,
0xcc, 0xcc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x18, 0x18, 0x18, 0xfe,
0xc6, 0xc0, 0x7e, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6,
0xc6, 0xc6, 0x60, 0x7e, 0xcc, 0x18, 0xc0, 0xcc, 0xfe, 0x7c, 0x7c,
0x7c, 0x7c, 0xc0, 0xfe, 0xfe, 0xfe, 0x18, 0x18, 0x18, 0xc6, 0xfe,
0xf0, 0x36, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6,
0xc0, 0x60, 0x18, 0xde, 0x18, 0xc0, 0xcc, 0xc6, 0x0c, 0x0c, 0x0c,
0x0c, 0xc6, 0xc6, 0xc6, 0xc6, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc0,
0x36, 0xfe, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0,
0xf8, 0x3c, 0xcc, 0x7e, 0xc0, 0xcc, 0x7c, 0x78, 0x78, 0x78, 0x78,
0x7c, 0x7c, 0x7c, 0x7c, 0x38, 0x38, 0x38, 0x6c, 0x6c, 0xc0, 0xec,
0xcc, 0x7c, 0x7c, 0x7c, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, 0x60,
0x66, 0xc4, 0x18, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0xc0, 0x00, 0xcc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x60, 0x66,
0xf8, 0x18, 0x3c, 0xcc, 0x30, 0x6c, 0x00, 0x18, 0x38, 0x00, 0x6c,
0x00, 0x18, 0x00, 0x66, 0x18, 0x10, 0x10, 0xfc, 0x00, 0x6c, 0x6c,
0x00, 0x18, 0xcc, 0x18, 0x00, 0x7c, 0xc6, 0x7c, 0x62, 0x66, 0xcc,
0x18, 0x00, 0xcc, 0x18, 0x38, 0xcc, 0x30, 0x6c, 0x00, 0x38, 0xc6,
0x30, 0x66, 0x3c, 0x30, 0x00, 0x38, 0x00, 0x00, 0x3e, 0x38, 0xc6,
0x30, 0x78, 0x30, 0xc6, 0x00, 0x00, 0x18, 0x3c, 0x66, 0xcc, 0x1b,
0x00, 0x00, 0x0c, 0x10, 0x00, 0x60, 0x38, 0x00, 0x10, 0x00, 0x60,
0x00, 0x18, 0x60, 0xc6, 0x6c, 0x30, 0x00, 0x00, 0x10, 0x00, 0x60,
0x30, 0x60, 0x00, 0xc6, 0xc6, 0x18, 0x00, 0x00, 0xf8, 0x0e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xf8, 0x78, 0x7c, 0x7c,
0x30, 0x7c, 0xcc, 0x18, 0x0c, 0xcc, 0x18, 0xc6, 0xcc, 0x78, 0xf8,
0x7c, 0xc0, 0x7c, 0x30, 0x78, 0x10, 0x6c, 0xc6, 0x76, 0xfe, 0x0e,
0x18, 0x70, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xc4, 0xcc, 0xc2, 0x30,
0xcc, 0xcc, 0x18, 0x0c, 0xcc, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc,
0xc0, 0x86, 0x30, 0xcc, 0x6c, 0xfe, 0x6c, 0xce, 0xc0, 0x18, 0x18,
0x18, 0x00, 0xfe, 0x00, 0xcc, 0xcc, 0xc0, 0xcc, 0xc0, 0x30, 0xcc,
0xcc, 0x18, 0x0c, 0xd8, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0,
0x06, 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x60, 0x18, 0x18, 0x18,
0x00, 0xc6, 0x00, 0xcc, 0xcc, 0xc0, 0xcc, 0xc0, 0x30, 0xcc, 0xcc,
0x18, 0x0c, 0xf0, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0x1c,
0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x30, 0x18, 0x18, 0x18, 0x00,
0xc6, 0x00, 0x7c, 0xcc, 0xc0, 0xcc, 0xfe, 0x30, 0xcc, 0xcc, 0x18,
0x0c, 0xf0, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x70, 0x30,
0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x18, 0x18, 0x18, 0x18, 0x00, 0xc6,
0x00, 0x0c, 0xcc, 0xc4, 0xcc, 0xc6, 0x78, 0xcc, 0xec, 0x18, 0x0c,
0xd8, 0x18, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xec, 0xc2, 0x30, 0xcc,
0xc6, 0xc6, 0x6c, 0xc6, 0x0c, 0x70, 0x18, 0x0e, 0x00, 0x6c, 0x00,
0x78, 0xf8, 0x78, 0x7c, 0x7c, 0x30, 0x7c, 0xd8, 0x38, 0x0c, 0xcc,
0x18, 0xec, 0xb8, 0x78, 0xf8, 0x7c, 0xb8, 0x7c, 0xfc, 0xcc, 0xc6,
0xc6, 0xc6, 0xc6, 0xfe, 0x18, 0x18, 0x18, 0x00, 0x38, 0x00, 0x00,
0xc0, 0x00, 0x0c, 0x00, 0x32, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x10, 0x0c, 0x00, 0xc0,
0x00, 0x0c, 0x00, 0x36, 0x00, 0xc0, 0x18, 0x0c, 0xc0, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00, 0xc0, 0x00,
0x0c, 0x00, 0x1c, 0x00, 0xc0, 0x18, 0x0c, 0xc0, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0e, 0x18, 0x70, 0xdc, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7c, 0xc6, 0xfc, 0x3c, 0xf8, 0xfc, 0xc0, 0x3e, 0xc6, 0x18, 0x78,
0xc2, 0xfc, 0xc6, 0xc6, 0x7c, 0xc0, 0x7c, 0xc6, 0x7c, 0x18, 0x7c,
0x10, 0x6c, 0xc6, 0x18, 0xfe, 0x3c, 0x02, 0x3c, 0x00, 0x00, 0xc0,
0xc6, 0xc6, 0x66, 0xdc, 0xc0, 0xc0, 0x66, 0xc6, 0x18, 0xcc, 0xc6,
0xc0, 0xc6, 0xc6, 0xc6, 0xc0, 0xde, 0xc6, 0x86, 0x18, 0xc6, 0x38,
0xee, 0xc6, 0x18, 0xc0, 0x30, 0x06, 0x0c, 0x00, 0x00, 0xdc, 0xc6,
0xc6, 0xc2, 0xce, 0xc0, 0xc0, 0xc6, 0xc6, 0x18, 0xcc, 0xcc, 0xc0,
0xc6, 0xc6, 0xc6, 0xc0, 0xd6, 0xcc, 0x06, 0x18, 0xc6, 0x6c, 0xfe,
0x6c, 0x18, 0xc0, 0x30, 0x0e, 0x0c, 0x00, 0x00, 0xde, 0xc6, 0xc6,
0xc0, 0xc6, 0xc0, 0xc0, 0xc6, 0xc6, 0x18, 0xcc, 0xd8, 0xc0, 0xc6,
0xc6, 0xc6, 0xc0, 0xc6, 0xcc, 0x06, 0x18, 0xc6, 0xc6, 0xd6, 0x7c,
0x18, 0x60, 0x30, 0x1c, 0x0c, 0x00, 0x00, 0xde, 0xfe, 0xc6, 0xc0,
0xc6, 0xc0, 0xc0, 0xde, 0xc6, 0x18, 0x0c, 0xf0, 0xc0, 0xc6, 0xce,
0xc6, 0xc0, 0xc6, 0xd8, 0x0c, 0x18, 0xc6, 0xc6, 0xd6, 0x38, 0x18,
0x30, 0x30, 0x38, 0x0c, 0x00, 0x00, 0xde, 0xc6, 0xfc, 0xc0, 0xc6,
0xf8, 0xf8, 0xc0, 0xfe, 0x18, 0x0c, 0xf0, 0xc0, 0xd6, 0xde, 0xc6,
0xfc, 0xc6, 0xfc, 0x38, 0x18, 0xc6, 0xc6, 0xd6, 0x38, 0x3c, 0x18,
0x30, 0x70, 0x0c, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc0, 0xc6, 0xc0,
0xc0, 0xc0, 0xc6, 0x18, 0x0c, 0xd8, 0xc0, 0xfe, 0xfe, 0xc6, 0xc6,
0xc6, 0xc6, 0x60, 0x18, 0xc6, 0xc6, 0xc6, 0x7c, 0x66, 0x0c, 0x30,
0xe0, 0x0c, 0x00, 0x00, 0xc6, 0x6c, 0xc6, 0xc2, 0xce, 0xc0, 0xc0,
0xc0, 0xc6, 0x18, 0x0c, 0xcc, 0xc0, 0xfe, 0xf6, 0xc6, 0xc6, 0xc6,
0xc6, 0xc0, 0x18, 0xc6, 0xc6, 0xc6, 0x6c, 0x66, 0x06, 0x30, 0xc0,
0x0c, 0x00, 0x00, 0x7c, 0x38, 0xc6, 0x66, 0xdc, 0xc0, 0xc0, 0x62,
0xc6, 0x18, 0x0c, 0xc6, 0xc0, 0xee, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6,
0xc2, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0x06, 0x30, 0x80, 0x0c,
0xc6, 0x00, 0x00, 0x10, 0xfc, 0x3c, 0xf8, 0xfc, 0xfc, 0x3c, 0xc6,
0x18, 0x1e, 0xc2, 0xc0, 0xc6, 0xc6, 0x7c, 0xfc, 0x7c, 0xfc, 0x7c,
0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0xfe, 0x3c, 0x00, 0x3c, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x7c,
0x86, 0x76, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x18, 0x00, 0x18, 0x80,
0x38, 0x18, 0xfe, 0x7c, 0x0c, 0x7c, 0x7c, 0x30, 0x7c, 0x78, 0x00,
0x30, 0x06, 0x00, 0x60, 0x18, 0x00, 0x18, 0x00, 0x6c, 0xc6, 0xc6,
0xcc, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00, 0x18, 0xc0, 0x6c,
0x18, 0xc0, 0x86, 0x0c, 0x86, 0xc6, 0x30, 0xc6, 0x8c, 0x18, 0x18,
0x0c, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0xfe, 0x86, 0x60, 0xcc,
0x00, 0x30, 0x0c, 0x66, 0x18, 0x18, 0x00, 0x00, 0x60, 0xc6, 0x18,
0xc0, 0x06, 0x0c, 0x06, 0xc6, 0x30, 0xc6, 0x06, 0x18, 0x18, 0x18,
0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x06, 0x30, 0xcc, 0x00,
0x30, 0x0c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x30, 0xe6, 0x18, 0x60,
0x06, 0x0c, 0x06, 0xc6, 0x30, 0xc6, 0x06, 0x00, 0x00, 0x30, 0x7e,
0x0c, 0x18, 0x00, 0x18, 0x00, 0x6c, 0x06, 0x18, 0xdc, 0x00, 0x30,
0x0c, 0xff, 0x7e, 0x00, 0xfe, 0x00, 0x18, 0xf6, 0x18, 0x30, 0x06,
0xfe, 0x06, 0xe6, 0x18, 0xc6, 0x06, 0x00, 0x00, 0x60, 0x00, 0x06,
0x18, 0x00, 0x18, 0x00, 0x6c, 0x7c, 0x0c, 0x76, 0x00, 0x30, 0x0c,
0x3c, 0x18, 0x00, 0x00, 0x00, 0x0c, 0xde, 0x18, 0x18, 0x3c, 0xcc,
0xfc, 0xdc, 0x0c, 0x7c, 0x7e, 0x00, 0x00, 0x30, 0x00, 0x0c, 0x18,
0x00, 0x3c, 0x00, 0xfe, 0xc0, 0xc6, 0x38, 0x00, 0x30, 0x0c, 0x66,
0x18, 0x00, 0x00, 0x00, 0x06, 0xce, 0x18, 0x0c, 0x06, 0x6c, 0xc0,
0xc0, 0x06, 0xc6, 0xc6, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x0c, 0x00,
0x3c, 0x24, 0x6c, 0xc2, 0xc2, 0x6c, 0x60, 0x30, 0x0c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0xc6, 0x78, 0x06, 0x06, 0x3c, 0xc0, 0xc0,
0x06, 0xc6, 0xc6, 0x18, 0x18, 0x0c, 0x00, 0x30, 0xc6, 0x00, 0x3c,
0x66, 0x6c, 0xc6, 0x00, 0x6c, 0x30, 0x18, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x6c, 0x38, 0xc6, 0x86, 0x1c, 0xc0, 0x60, 0x06,
0xc6, 0xc6, 0x00, 0x00, 0x06, 0x00, 0x60, 0xc6, 0x00, 0x18, 0x66,
0x00, 0x7c, 0x00, 0x38, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x18, 0x7c, 0x7c, 0x0c, 0xfe, 0x3c, 0xfe, 0x7c,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x66, 0x00,
0x18, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x00, 0xff, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x7e, 0x10, 0x00, 0x3c, 0x3c, 0x00, 0xff, 0x00,
0xff, 0x78, 0x18, 0xe0, 0xe6, 0x18, 0x80, 0x02, 0x00, 0x66, 0x1b,
0xc6, 0xfe, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x81, 0xff, 0x38, 0x10, 0x18, 0x18, 0x00, 0xff, 0x3c, 0xc3,
0xcc, 0x18, 0xf0, 0xe7, 0x18, 0xc0, 0x06, 0x18, 0x66, 0x1b, 0x0c,
0xfe, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x10, 0x00,
0x81, 0xff, 0x7c, 0x38, 0x18, 0x18, 0x18, 0xe7, 0x66, 0x99, 0xcc,
0x7e, 0x70, 0x67, 0xdb, 0xe0, 0x0e, 0x3c, 0x00, 0x1b, 0x38, 0xfe,
0x3c, 0x18, 0x7e, 0x18, 0x30, 0xfe, 0x28, 0xfe, 0x38, 0x00, 0x99,
0xe7, 0xfe, 0x7c, 0xe7, 0x7e, 0x3c, 0xc3, 0x42, 0xbd, 0xcc, 0x18,
0x30, 0x63, 0x3c, 0xf0, 0x1e, 0x7e, 0x66, 0x1b, 0x6c, 0xfe, 0x7e,
0x18, 0x18, 0x0c, 0x60, 0xc0, 0x6c, 0x7c, 0x38, 0x00, 0xbd, 0xc3,
0xfe, 0xfe, 0xe7, 0xff, 0x3c, 0xc3, 0x42, 0xbd, 0xcc, 0x3c, 0x30,
0x63, 0xe7, 0xf8, 0x3e, 0x18, 0x66, 0x1b, 0xc6, 0x00, 0x18, 0x18,
0x18, 0xfe, 0xfe, 0xc0, 0xfe, 0x7c, 0x7c, 0x00, 0x81, 0xff, 0xfe,
0x7c, 0xe7, 0xff, 0x18, 0xe7, 0x66, 0x99, 0x78, 0x66, 0x30, 0x63,
0x3c, 0xfe, 0xfe, 0x18, 0x66, 0x7b, 0xc6, 0x00, 0x18, 0x18, 0x18,
0x0c, 0x60, 0xc0, 0x6c, 0x38, 0x7c, 0x00, 0x81, 0xff, 0xfe, 0x38,
0x3c, 0x7e, 0x00, 0xff, 0x3c, 0xc3, 0x32, 0x66, 0x30, 0x63, 0xdb,
0xf8, 0x3e, 0x18, 0x66, 0xdb, 0x6c, 0x00, 0x18, 0x18, 0x18, 0x18,
0x30, 0x00, 0x28, 0x38, 0xfe, 0x00, 0xa5, 0xdb, 0x6c, 0x10, 0x3c,
0x3c, 0x00, 0xff, 0x00, 0xff, 0x1a, 0x66, 0x3f, 0x7f, 0x18, 0xf0,
0x1e, 0x7e, 0x66, 0xdb, 0x38, 0x00, 0x7e, 0x7e, 0x18, 0x00, 0x00,
0x00, 0x00, 0x10, 0xfe, 0x00, 0x81, 0xff, 0x00, 0x00, 0x18, 0x18,
0x00, 0xff, 0x00, 0xff, 0x0e, 0x66, 0x33, 0x63, 0x18, 0xe0, 0x0e,
0x3c, 0x66, 0xdb, 0x60, 0x00, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x00, 0xff, 0x1e, 0x3c, 0x3f, 0x7f, 0x00, 0xc0, 0x06, 0x18,
0x66, 0x7f, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

23
sdl2/deficon.h Normal file
View File

@@ -0,0 +1,23 @@
/* The PDCurses logo as #include'able BMP (from ../x11/little_icon.xbm) */
unsigned char deficon[] =
{
0x42, 0x4d, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e,
0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0x6f, 0x9c,
0xe7, 0xb5, 0xaf, 0x6b, 0x5b, 0xbd, 0xaf, 0xeb, 0xfb, 0xbd, 0xaf,
0x98, 0xe7, 0xbd, 0xaf, 0x7b, 0x5f, 0xb5, 0xa5, 0x6b, 0x5b, 0xcd,
0xab, 0x9c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xcf, 0x03, 0xff, 0xff, 0xce, 0x03, 0xff, 0xff, 0xcc, 0x73,
0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc,
0x73, 0xff, 0xff, 0xc6, 0x33, 0xff, 0xff, 0xc3, 0x13, 0xff, 0xff,
0xc1, 0x83, 0xff, 0xff, 0xc8, 0xc3, 0xff, 0xff, 0xcc, 0x63, 0xff,
0xff, 0xce, 0x33, 0xff, 0xff, 0xcf, 0x33, 0xff, 0xff, 0xcf, 0x33,
0xff, 0xff, 0xce, 0x33, 0xff, 0xff, 0xc0, 0x73, 0xff, 0xff, 0xc0,
0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff
};

91
sdl2/pdcclip.c Normal file
View File

@@ -0,0 +1,91 @@
/* Public Domain Curses */
#include "pdcsdl.h"
RCSID("$Id: pdcclip.c,v 1.6 2008/07/14 04:24:52 wmcbrine Exp $")
#include <stdlib.h>
/*man-start**************************************************************
Name: clipboard
Synopsis:
int PDC_getclipboard(char **contents, long *length);
int PDC_setclipboard(const char *contents, long length);
int PDC_freeclipboard(char *contents);
int PDC_clearclipboard(void);
Description:
PDC_getclipboard() gets the textual contents of the system's
clipboard. This function returns the contents of the clipboard
in the contents argument. It is the responsibilitiy of the
caller to free the memory returned, via PDC_freeclipboard().
The length of the clipboard contents is returned in the length
argument.
PDC_setclipboard copies the supplied text into the system's
clipboard, emptying the clipboard prior to the copy.
PDC_clearclipboard() clears the internal clipboard.
Return Values:
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
the clipboard contents
PDC_CLIP_EMPTY the clipboard contains no text
PDC_CLIP_ACCESS_ERROR no clipboard support
Portability X/Open BSD SYS V
PDC_getclipboard - - -
PDC_setclipboard - - -
PDC_freeclipboard - - -
PDC_clearclipboard - - -
**man-end****************************************************************/
/* global clipboard contents, should be NULL if none set */
int PDC_getclipboard(char **contents, long *length)
{
PDC_LOG(("PDC_getclipboard() - called\n"));
if (SDL_HasClipboardText() == SDL_FALSE)
return PDC_CLIP_EMPTY;
*contents = SDL_GetClipboardText();
*length = strlen (*contents);
return PDC_CLIP_SUCCESS;
}
int PDC_setclipboard(const char *contents, long length)
{
PDC_LOG(("PDC_setclipboard() - called\n"));
if (SDL_SetClipboardText(contents) != 0)
return PDC_CLIP_ACCESS_ERROR;
return PDC_CLIP_SUCCESS;
}
int PDC_freeclipboard(char *contents)
{
PDC_LOG(("PDC_freeclipboard() - called\n"));
SDL_free(contents);
return PDC_CLIP_SUCCESS;
}
int PDC_clearclipboard(void)
{
PDC_LOG(("PDC_clearclipboard() - called\n"));
if (SDL_HasClipboardText() == SDL_TRUE)
{
SDL_SetClipboardText(NULL);
}
return PDC_CLIP_SUCCESS;
}

453
sdl2/pdcdisp.c Normal file
View File

@@ -0,0 +1,453 @@
/* Public Domain Curses */
#include "pdcsdl.h"
RCSID("$Id: pdcdisp.c,v 1.35 2008/07/14 04:24:52 wmcbrine Exp $")
#include <stdlib.h>
#include <string.h>
#ifdef CHTYPE_LONG
# define A(x) ((chtype)x | A_ALTCHARSET)
chtype acs_map[128] =
{
A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10),
A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18), A(19),
A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28),
A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(',
')', '*',
# ifdef PDC_WIDE
0x2192, 0x2190, 0x2191, 0x2193,
# else
A(0x1a), A(0x1b), A(0x18), A(0x19),
# endif
'/',
# ifdef PDC_WIDE
0x2588,
# else
0xdb,
# endif
'1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
# ifdef PDC_WIDE
0x2666, 0x2592,
# else
A(0x04), 0xb1,
# endif
'b', 'c', 'd', 'e',
# ifdef PDC_WIDE
0x00b0, 0x00b1, 0x2591, 0x00a4, 0x2518, 0x2510, 0x250c, 0x2514,
0x253c, 0x23ba, 0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524,
0x2534, 0x252c, 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3,
0x00b7,
# else
0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d, 0x2d,
0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2, 0xe3,
0xd8, 0x9c, 0xf9,
# endif
A(127)
};
# undef A
#endif
Uint32 pdc_lastupdate = 0;
#define MAXRECT 200 /* maximum number of rects to queue up before
an update is forced; the number was chosen
arbitrarily */
static SDL_Rect uprect[MAXRECT]; /* table of rects to update */
static chtype oldch = (chtype)(-1); /* current attribute */
static int rectcount = 0; /* index into uprect */
static short foregr = -2, backgr = -2; /* current foreground, background */
/* do the real updates on a delay */
void PDC_update_rects(void)
{
if (rectcount)
{
/* if the maximum number of rects has been reached, we're
probably better off doing a full screen update */
if (rectcount == MAXRECT)
{
SDL_UpdateTexture(pdc_texture, NULL, pdc_screen->pixels, pdc_screen->pitch);
SDL_RenderClear(pdc_render);
SDL_RenderCopy(pdc_render, pdc_texture, NULL, NULL);
SDL_RenderPresent(pdc_render);
}
else
{
SDL_UpdateTexture(pdc_texture, NULL, pdc_screen->pixels, pdc_screen->pitch);
SDL_RenderClear(pdc_render);
SDL_RenderCopy(pdc_render, pdc_texture, NULL, NULL);
SDL_RenderPresent(pdc_render);
}
pdc_lastupdate = SDL_GetTicks();
rectcount = 0;
}
}
/* set the font colors to match the chtype's attribute */
static void _set_attr(chtype ch)
{
#ifdef PDC_WIDE
ch &= (A_COLOR|A_BOLD|A_BLINK|A_REVERSE);
if (oldch != ch)
{
short newfg, newbg;
if (SP->mono)
return;
PDC_pair_content(PAIR_NUMBER(ch), &newfg, &newbg);
newfg |= (ch & A_BOLD) ? 8 : 0;
newbg |= (ch & A_BLINK) ? 8 : 0;
if (ch & A_REVERSE)
{
short tmp = newfg;
newfg = newbg;
newbg = tmp;
}
if (newfg != foregr)
{
pdc_ttffont_foregroundcolor = &(pdc_color[newfg]);
foregr = newfg;
}
if (newbg != backgr)
{
if (newbg == -1)
pdc_ttffont_backgroundcolor = NULL;
else
{
pdc_ttffont_backgroundcolor = &(pdc_color[newbg]);
}
backgr = newbg;
}
oldch = ch;
}
#else
ch &= (A_COLOR|A_BOLD|A_BLINK|A_REVERSE);
if (oldch != ch)
{
short newfg, newbg;
if (SP->mono)
return;
PDC_pair_content(PAIR_NUMBER(ch), &newfg, &newbg);
newfg |= (ch & A_BOLD) ? 8 : 0;
newbg |= (ch & A_BLINK) ? 8 : 0;
if (ch & A_REVERSE)
{
short tmp = newfg;
newfg = newbg;
newbg = tmp;
}
if (newfg != foregr)
{
SDL_SetPalette(pdc_font, SDL_LOGPAL,
pdc_color + newfg, pdc_flastc, 1);
foregr = newfg;
}
if (newbg != backgr)
{
if (newbg == -1)
SDL_SetColorKey(pdc_font, SDL_SRCCOLORKEY, 0);
else
{
if (backgr == -1)
SDL_SetColorKey(pdc_font, 0, 0);
SDL_SetPalette(pdc_font, SDL_LOGPAL,
pdc_color + newbg, 0, 1);
}
backgr = newbg;
}
oldch = ch;
}
#endif
}
/* draw a cursor at (y, x) */
void PDC_gotoyx(int row, int col)
{
SDL_Rect src, dest;
chtype ch;
int oldrow, oldcol;
#ifdef PDC_WIDE
Uint16 chstr[2] = {0, 0};
Uint32 colorkey;
#endif
PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n",
row, col, SP->cursrow, SP->curscol));
if (SP->mono)
return;
oldrow = SP->cursrow;
oldcol = SP->curscol;
/* clear the old cursor */
PDC_transform_line(oldrow, oldcol, 1, curscr->_y[oldrow] + oldcol);
if (!SP->visibility)
return;
/* draw a new cursor by overprinting the existing character in
reverse, either the full cell (when visibility == 2) or the
lowest quarter of it (when visibility == 1) */
ch = curscr->_y[row][col] ^ A_REVERSE;
_set_attr(ch);
#ifdef CHTYPE_LONG
if (ch & A_ALTCHARSET && !(ch & 0xff80))
ch = acs_map[ch & 0x7f];
#endif
#ifdef PDC_WIDE
chstr[0] = ch & A_CHARTEXT;
pdc_font = TTF_RenderUNICODE_Solid (pdc_ttffont,chstr,*pdc_ttffont_foregroundcolor);
if (pdc_font)
{
colorkey = SDL_MapRGB(pdc_screen->format, pdc_ttffont_backgroundcolor->r,pdc_ttffont_backgroundcolor->g, pdc_ttffont_backgroundcolor->b);
src.h = (SP->visibility == 1) ? pdc_fheight >> 2 : pdc_fheight;
if (src.h > pdc_font->h)
src.h = pdc_font->h;
src.w = pdc_fwidth;
if (src.w > pdc_font->w)
src.w = pdc_font->w;
dest.y = (row + 1) * pdc_fheight - src.h + pdc_yoffset;
dest.x = col * pdc_fwidth + pdc_xoffset;
dest.h = (SP->visibility == 1) ? pdc_fheight >> 2 : pdc_fheight;
dest.w = pdc_fwidth;
SDL_FillRect (pdc_screen, &dest, colorkey);
dest.h = pdc_fheight;
src.x = 0;
src.y = 0;
colorkey = SDL_MapRGB(pdc_screen->format, 0,0,0);
SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest);
SDL_FreeSurface(pdc_font);
pdc_font = NULL;
}
#else
src.h = (SP->visibility == 1) ? pdc_fheight >> 2 : pdc_fheight;
src.w = pdc_fwidth;
dest.y = (row + 1) * pdc_fheight - src.h + pdc_yoffset;
dest.x = col * pdc_fwidth + pdc_xoffset;
src.x = (ch & 0xff) % 32 * pdc_fwidth;
src.y = (ch & 0xff) / 32 * pdc_fheight + (pdc_fheight - src.h);
SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest);
#endif
if (oldrow != row || oldcol != col)
{
if (rectcount == MAXRECT)
PDC_update_rects();
uprect[rectcount++] = dest;
}
}
/* handle the A_*LINE attributes */
static void _highlight(SDL_Rect *src, SDL_Rect *dest, chtype ch)
{
short col = SP->line_color;
#ifdef PDC_WIDE
char chstr[2] = {'_','\0'};
#endif
if (SP->mono)
return;
if (ch & A_UNDERLINE)
{
#ifdef PDC_WIDE
pdc_font = TTF_RenderText_Solid (pdc_ttffont,chstr,*pdc_ttffont_foregroundcolor);
if (pdc_font)
{
src->x = 0;
src->y = 0;
if (backgr != -1)
SDL_SetColorKey(pdc_font, SDL_TRUE, 0);
SDL_BlitSurface(pdc_font, src, pdc_screen, dest);
if (backgr != -1)
SDL_SetColorKey(pdc_font, 0, 0);
SDL_FreeSurface(pdc_font);
pdc_font = NULL;
}
#else
if (col != -1)
SDL_SetPalette(pdc_font, SDL_LOGPAL,
pdc_color + col, pdc_flastc, 1);
src->x = '_' % 32 * pdc_fwidth;
src->y = '_' / 32 * pdc_fheight;
if (backgr != -1)
SDL_SetColorKey(pdc_font, SDL_SRCCOLORKEY, 0);
SDL_BlitSurface(pdc_font, src, pdc_screen, dest);
if (backgr != -1)
SDL_SetColorKey(pdc_font, 0, 0);
if (col != -1)
SDL_SetPalette(pdc_font, SDL_LOGPAL,
pdc_color + foregr, pdc_flastc, 1);
#endif
}
if (ch & (A_LEFTLINE|A_RIGHTLINE))
{
if (col == -1)
col = foregr;
dest->w = 1;
if (ch & A_LEFTLINE)
SDL_FillRect(pdc_screen, dest, pdc_mapped[col]);
if (ch & A_RIGHTLINE)
{
dest->x += pdc_fwidth - 1;
SDL_FillRect(pdc_screen, dest, pdc_mapped[col]);
dest->x -= pdc_fwidth - 1;
}
dest->w = pdc_fwidth;
}
}
/* update the given physical line to look like the corresponding line in
curscr */
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
{
SDL_Rect src, dest, lastrect;
int j;
#ifdef PDC_WIDE
Uint16 chstr[2] = {0,0};
Uint32 colorkey;
#endif
PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno));
if (rectcount == MAXRECT)
PDC_update_rects();
src.h = pdc_fheight;
src.w = pdc_fwidth;
dest.y = pdc_fheight * lineno + pdc_yoffset;
dest.x = pdc_fwidth * x + pdc_xoffset;
dest.h = pdc_fheight;
dest.w = pdc_fwidth * len;
/* if the previous rect was just above this one, with the same width
and horizontal position, then merge the new one with it instead
of adding a new entry */
if (rectcount)
lastrect = uprect[rectcount - 1];
if (rectcount && lastrect.x == dest.x && lastrect.w == dest.w)
{
if (lastrect.y + lastrect.h == dest.y)
uprect[rectcount - 1].h = lastrect.h + pdc_fheight;
else
if (lastrect.y != dest.y)
uprect[rectcount++] = dest;
}
else
uprect[rectcount++] = dest;
dest.w = pdc_fwidth;
for (j = 0; j < len; j++)
{
chtype ch = srcp[j];
_set_attr(ch);
#ifdef CHTYPE_LONG
if (ch & A_ALTCHARSET && !(ch & 0xff80))
ch = (ch & (A_ATTRIBUTES ^ A_ALTCHARSET)) | acs_map[ch & 0x7f];
#endif
if (backgr == -1)
SDL_LowerBlit(pdc_tileback, &dest, pdc_screen, &dest);
#ifdef PDC_WIDE
chstr[0] = ch & A_CHARTEXT;
pdc_font = TTF_RenderUNICODE_Solid (pdc_ttffont,chstr,*pdc_ttffont_foregroundcolor);
if (pdc_font)
{
colorkey = SDL_MapRGB(pdc_screen->format, pdc_ttffont_backgroundcolor->r,pdc_ttffont_backgroundcolor->g, pdc_ttffont_backgroundcolor->b);
dest.w = pdc_fwidth;
dest.h = pdc_fheight;
SDL_FillRect (pdc_screen, &dest, colorkey);
src.x = 0;
src.y = 0;
src.h = pdc_font->h;
src.w = pdc_font->w;
colorkey = SDL_MapRGB(pdc_screen->format, 0,0,0);
SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest);
SDL_FreeSurface(pdc_font);
pdc_font = NULL;
}
#else
src.x = (ch & 0xff) % 32 * pdc_fwidth;
src.y = (ch & 0xff) / 32 * pdc_fheight;
SDL_LowerBlit(pdc_font, &src, pdc_screen, &dest);
#endif
if (ch & (A_UNDERLINE|A_LEFTLINE|A_RIGHTLINE))
_highlight(&src, &dest, ch);
dest.x += pdc_fwidth;
}
}

32
sdl2/pdcgetsc.c Normal file
View File

@@ -0,0 +1,32 @@
/* Public Domain Curses */
#include "pdcsdl.h"
RCSID("$Id: pdcgetsc.c,v 1.8 2008/07/14 04:24:52 wmcbrine Exp $")
/* get the cursor size/shape */
int PDC_get_cursor_mode(void)
{
PDC_LOG(("PDC_get_cursor_mode() - called\n"));
return 0;
}
/* return number of screen rows */
int PDC_get_rows(void)
{
PDC_LOG(("PDC_get_rows() - called\n"));
return pdc_sheight / pdc_fheight;
}
/* return width of screen/viewport */
int PDC_get_columns(void)
{
PDC_LOG(("PDC_get_columns() - called\n"));
return pdc_swidth / pdc_fwidth;
}

511
sdl2/pdckbd.c Normal file
View File

@@ -0,0 +1,511 @@
/* Public Domain Curses */
#include "pdcsdl.h"
RCSID("$Id: pdckbd.c,v 1.20 2008/07/14 04:24:52 wmcbrine Exp $")
/*man-start**************************************************************
Name: pdckbd
Synopsis:
unsigned long PDC_get_input_fd(void);
Description:
PDC_get_input_fd() returns the file descriptor that PDCurses
reads its input from. It can be used for select().
Portability X/Open BSD SYS V
PDC_get_input_fd - - -
**man-end****************************************************************/
#include <string.h>
unsigned long pdc_key_modifiers = 0L;
static SDL_Event event;
static SDL_Keycode oldkey;
static MOUSE_STATUS old_mouse_status;
static struct
{
SDL_Keycode keycode;
bool numkeypad;
unsigned short normal;
unsigned short shifted;
unsigned short control;
unsigned short alt;
} key_table[] =
{
/* keycode keypad normal shifted control alt*/
{SDLK_LEFT, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT},
{SDLK_RIGHT, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT},
{SDLK_UP, FALSE, KEY_UP, KEY_SUP, CTL_UP, ALT_UP},
{SDLK_DOWN, FALSE, KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN},
{SDLK_HOME, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME},
{SDLK_END, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END},
{SDLK_PAGEUP, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP},
{SDLK_PAGEDOWN,FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN},
{SDLK_INSERT, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS},
{SDLK_DELETE, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL},
{SDLK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)},
{SDLK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)},
{SDLK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)},
{SDLK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)},
{SDLK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)},
{SDLK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)},
{SDLK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)},
{SDLK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)},
{SDLK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)},
{SDLK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)},
{SDLK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)},
{SDLK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)},
{SDLK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)},
{SDLK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)},
{SDLK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)},
{SDLK_BACKSPACE,FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP},
{SDLK_TAB, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB},
{SDLK_PRINTSCREEN, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT},
{SDLK_PAUSE, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND},
{SDLK_CLEAR, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR},
{SDLK_PAUSE, FALSE, KEY_BREAK, KEY_BREAK, KEY_BREAK, KEY_BREAK},
{SDLK_HELP, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP},
{SDLK_MENU, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS},
{SDLK_ESCAPE, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC},
{SDLK_KP_ENTER,TRUE, PADENTER, PADENTER, CTL_PADENTER,ALT_PADENTER},
{SDLK_KP_PLUS, TRUE, PADPLUS, '+', CTL_PADPLUS, ALT_PADPLUS},
{SDLK_KP_MINUS,TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS},
{SDLK_KP_MULTIPLY,TRUE,PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR},
{SDLK_KP_DIVIDE,TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH},
{SDLK_KP_PERIOD,TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP},
{SDLK_KP_0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0},
{SDLK_KP_1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1},
{SDLK_KP_2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2},
{SDLK_KP_3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3},
{SDLK_KP_4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4},
{SDLK_KP_5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5},
{SDLK_KP_6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6},
{SDLK_KP_7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7},
{SDLK_KP_8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8},
{SDLK_KP_9, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9},
{0, 0, 0, 0, 0, 0}
};
unsigned long PDC_get_input_fd(void)
{
PDC_LOG(("PDC_get_input_fd() - called\n"));
return 0L; /* test this */
}
void PDC_set_keyboard_binary(bool on)
{
PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
}
/* check if a key or mouse event is waiting */
bool PDC_check_key(void)
{
Uint32 current = SDL_GetTicks();
int haveevent = SDL_PollEvent(&event);
/* if we have an event, or 30 ms have passed without a screen
update, or the timer has wrapped, update now */
if (haveevent ||
current < pdc_lastupdate || ((current - pdc_lastupdate) > 30))
PDC_update_rects();
return haveevent;
}
long PDC_atol (char *buffer, int radix)
{
unsigned long val = 0;
unsigned long tmp;
char *ptr;
for (ptr = buffer; *ptr != '\0'; ptr++)
{
tmp = *ptr - '0';
if (radix > 10)
if (tmp > 9)
tmp = *ptr - 'a' + 10;
if (tmp <= radix)
{
val += tmp;
if (ptr[1] != '\0')
val *= radix;
}
}
return (val);
}
static int _process_key_event(void)
{
int i, key = 0;
#ifdef PDC_WIDE
static int unikey = -1;
static int unikeyhex = 0;
static char unikeyval[7] = {'\0','\0','\0','\0','\0','\0','\0'};
#endif
pdc_key_modifiers = 0L;
SP->key_code = FALSE;
if (event.type == SDL_KEYUP)
{
#ifdef PDC_WIDE
if (unikey >= 0)
if ((event.key.keysym.sym == SDLK_LALT) || (event.key.keysym.sym == SDLK_RALT))
{
if ((unikeyhex != 0) && (unikey != 0))
{
unikeyval[unikey] = '\0';
key = (int) PDC_atol (unikeyval, unikeyhex);
memset (unikeyval, '\0', 7);
unikeyhex = 0;
unikey = -1;
if (key != 0)
return (key);
}
else
unikey = -1;
}
#endif
if (SP->return_key_modifiers && event.key.keysym.sym == oldkey)
{
switch (oldkey)
{
case SDLK_RSHIFT:
return KEY_SHIFT_R;
case SDLK_LSHIFT:
return KEY_SHIFT_L;
case SDLK_RCTRL:
return KEY_CONTROL_R;
case SDLK_LCTRL:
return KEY_CONTROL_L;
case SDLK_RALT:
return KEY_ALT_R;
case SDLK_LALT:
return KEY_ALT_L;
default:
break;
}
}
return -1;
}
#ifdef PDC_WIDE
else
{
if (event.type == SDL_KEYDOWN)
{
if ((event.key.keysym.sym == SDLK_LALT) || (event.key.keysym.sym == SDLK_RALT))
{
if (unikey < 0)
unikey = 0;
}
}
}
#endif
oldkey = event.key.keysym.sym;
if (SP->save_key_modifiers)
{
if (event.key.keysym.mod & KMOD_NUM)
pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK;
if (event.key.keysym.mod & KMOD_SHIFT)
pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT;
if (event.key.keysym.mod & KMOD_CTRL)
pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL;
if (event.key.keysym.mod & KMOD_ALT)
pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT;
}
for (i = 0; key_table[i].keycode; i++)
{
if (key_table[i].keycode == event.key.keysym.sym)
{
if ((event.key.keysym.mod & KMOD_SHIFT) ||
(key_table[i].numkeypad && (event.key.keysym.mod & KMOD_NUM)))
{
key = key_table[i].shifted;
}
else if (event.key.keysym.mod & KMOD_CTRL)
{
key = key_table[i].control;
}
else if (event.key.keysym.mod & KMOD_ALT)
{
key = key_table[i].alt;
}
/* To get here, we ignore all other modifiers */
else
key = key_table[i].normal;
SP->key_code = (key > 0x100);
break;
}
}
#ifdef PDC_WIDE
if (unikey >= 0)
{
if (event.key.keysym.mod & KMOD_ALT)
{
if (unikeyhex != 0)
{
if (unikey < 6)
{
if (key >= ALT_PAD0 && key <= ALT_PAD9)
{
unikeyval[unikey] = key - ALT_PAD0 + '0';
unikey++;
return -1;
}
else if ((event.key.keysym.sym >= 'a' && event.key.keysym.sym <= 'f') || (event.key.keysym.sym >= '0' && event.key.keysym.sym <= '9'))
{
unikeyval[unikey] = key;
unikey++;
return -1;
}
else if ((event.key.keysym.sym != SDLK_LALT) || (event.key.keysym.sym != SDLK_RALT))
{
unikeyhex = 0;
unikey = -1;
}
}
}
else if (unikey == 0)
{
if (event.key.keysym.sym == SDLK_KP_PLUS)
{
unikeyhex = 16;
return -1;
}
else if (event.key.keysym.sym == SDLK_KP_0)
{
unikeyhex = 10;
return -1;
}
else if ((event.key.keysym.sym != SDLK_LALT) || (event.key.keysym.sym != SDLK_RALT))
{
unikeyhex = 0;
unikey = -1;
}
}
}
}
#endif
if (!key)
{
key = (int) event.key.keysym.sym;
if (key >= 'a' && key <= 'z')
if (event.key.keysym.mod & KMOD_SHIFT)
key = toupper (key);
if (key > 0x7f)
key = 0;
}
/* Handle ALT letters and numbers */
if (event.key.keysym.mod & KMOD_ALT)
{
if (key >= 'A' && key <= 'Z')
{
key += ALT_A - 'A';
SP->key_code = TRUE;
}
if (key >= 'a' && key <= 'z')
{
key += ALT_A - 'a';
SP->key_code = TRUE;
}
if (key >= '0' && key <= '9')
{
key += ALT_0 - '0';
SP->key_code = TRUE;
}
}
return key ? key : -1;
}
static int _process_mouse_event(void)
{
SDL_Keymod keymods;
short shift_flags = 0;
memset(&pdc_mouse_status, 0, sizeof(MOUSE_STATUS));
keymods = SDL_GetModState();
if (keymods & KMOD_SHIFT)
shift_flags |= BUTTON_SHIFT;
if (keymods & KMOD_CTRL)
shift_flags |= BUTTON_CONTROL;
if (keymods & KMOD_ALT)
shift_flags |= BUTTON_ALT;
if (event.type == SDL_MOUSEMOTION)
{
int i;
pdc_mouse_status.x = event.motion.x / pdc_fwidth;
pdc_mouse_status.y = event.motion.y / pdc_fheight;
if (!event.motion.state ||
(pdc_mouse_status.x == old_mouse_status.x &&
pdc_mouse_status.y == old_mouse_status.y))
return -1;
pdc_mouse_status.changes = PDC_MOUSE_MOVED;
for (i = 0; i < 3; i++)
{
if (event.motion.state & SDL_BUTTON(i + 1))
{
pdc_mouse_status.button[i] = BUTTON_MOVED | shift_flags;
pdc_mouse_status.changes |= (1 << i);
}
}
}
else
{
short action = (event.button.state == SDL_PRESSED) ?
BUTTON_PRESSED : BUTTON_RELEASED;
Uint8 btn = event.button.button;
/* handle scroll wheel */
if ((btn == 4 || btn == 5) && action == BUTTON_RELEASED)
{
pdc_mouse_status.x = pdc_mouse_status.y = -1;
pdc_mouse_status.changes = (btn == 5) ?
PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP;
return KEY_MOUSE;
}
if (btn < 1 || btn > 3)
return -1;
/* check for a click -- a press followed immediately by a release */
if (action == BUTTON_PRESSED && SP->mouse_wait)
{
SDL_Event rel;
napms(SP->mouse_wait);
if (SDL_PollEvent(&rel))
{
if (rel.type == SDL_MOUSEBUTTONUP && rel.button.button == btn)
action = BUTTON_CLICKED;
else
SDL_PushEvent(&rel);
}
}
pdc_mouse_status.x = event.button.x / pdc_fwidth;
pdc_mouse_status.y = event.button.y / pdc_fheight;
btn--;
pdc_mouse_status.button[btn] = action | shift_flags;
pdc_mouse_status.changes = (1 << btn);
}
old_mouse_status = pdc_mouse_status;
return KEY_MOUSE;
}
/* return the next available key or mouse event */
int PDC_get_key(void)
{
switch (event.type)
{
case SDL_QUIT:
exit(1);
case SDL_WINDOWEVENT:
switch (event.window.event)
{
case SDL_WINDOWEVENT_SIZE_CHANGED:
case SDL_WINDOWEVENT_RESIZED:
if (pdc_own_screen &&
(event.window.data2 / pdc_fheight != LINES ||
event.window.data1 / pdc_fwidth != COLS))
{
pdc_sheight = event.window.data2;
pdc_swidth = event.window.data1;
if (!SP->resized)
{
SP->resized = TRUE;
return KEY_RESIZE;
}
}
break;
case SDL_WINDOWEVENT_RESTORED:
case SDL_WINDOWEVENT_EXPOSED:
SDL_RenderPresent(pdc_render);
/* SDL_UpdateWindowSurface(pdc_window); */
break;
}
break;
case SDL_MOUSEMOTION:
SDL_ShowCursor(SDL_ENABLE);
case SDL_MOUSEBUTTONUP:
case SDL_MOUSEBUTTONDOWN:
oldkey = SDLK_SPACE;
if (SP->_trap_mbe)
return _process_mouse_event();
break;
case SDL_KEYUP:
case SDL_KEYDOWN:
PDC_mouse_set();
return _process_key_event();
}
return -1;
}
/* discard any pending keyboard or mouse input -- this is the core
routine for flushinp() */
void PDC_flushinp(void)
{
PDC_LOG(("PDC_flushinp() - called\n"));
while (PDC_check_key());
}
int PDC_mouse_set(void)
{
SDL_ShowCursor(SP->_trap_mbe ? SDL_ENABLE : SDL_DISABLE);
return OK;
}
int PDC_modifiers_set(void)
{
return OK;
}

416
sdl2/pdcscrn.c Normal file
View File

@@ -0,0 +1,416 @@
/* Public Domain Curses */
#include "pdcsdl.h"
RCSID("$Id: pdcscrn.c,v 1.34 2008/07/14 04:24:52 wmcbrine Exp $")
#include <stdlib.h>
#include "deffont.h"
#include "deficon.h"
SDL_Window *pdc_window = NULL;
SDL_Renderer *pdc_render = NULL;
SDL_Texture *pdc_texture = NULL;
#ifdef PDC_WIDE
#ifndef PDC_FONT_PATH
#define PDC_FONT_PATH "/usr/local/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
#endif
TTF_Font *pdc_ttffont = NULL;
SDL_Color *pdc_ttffont_foregroundcolor = NULL;
SDL_Color *pdc_ttffont_backgroundcolor = NULL;
int pdc_ttffont_spointsz = 12;
int pdc_ttffont_hint = TTF_HINTING_MONO;
#endif
SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL,
*pdc_back = NULL, *pdc_tileback = NULL;
int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0;
SDL_Color pdc_color[16];
Uint32 pdc_mapped[16];
int pdc_fheight, pdc_fwidth, pdc_flastc;
bool pdc_own_screen;
/* COLOR_PAIR to attribute encoding table. */
static struct {short f, b;} atrtab[PDC_COLOR_PAIRS];
#ifdef PDC_WIDE
void PDC_clean (void)
{
if (pdc_ttffont)
{
TTF_CloseFont (pdc_ttffont);
pdc_ttffont = NULL;
TTF_Quit ();
}
if (pdc_tileback != NULL)
{
SDL_FreeSurface(pdc_tileback);
pdc_tileback = NULL;
}
if (pdc_back != NULL)
{
SDL_FreeSurface(pdc_back);
pdc_back = NULL;
}
if (pdc_icon != NULL)
{
SDL_FreeSurface(pdc_icon);
pdc_icon = NULL;
}
if (pdc_font != NULL)
{
SDL_FreeSurface(pdc_font);
pdc_font = NULL;
}
if (pdc_texture != NULL)
{
SDL_DestroyTexture (pdc_texture);
pdc_texture = NULL;
}
if (pdc_render != NULL)
{
SDL_DestroyRenderer (pdc_render);
pdc_render = NULL;
}
if (pdc_window != NULL)
{
SDL_DestroyWindow (pdc_window);
pdc_window = NULL;
}
SDL_Quit ();
}
#endif
void PDC_retile(void)
{
Uint32 pixel_format;
if (pdc_tileback)
SDL_FreeSurface(pdc_tileback);
pixel_format = SDL_GetWindowPixelFormat(pdc_window);
if (pixel_format == SDL_PIXELFORMAT_UNKNOWN)
return;
pdc_tileback = SDL_ConvertSurfaceFormat(pdc_screen, pixel_format, 0);
if (pdc_tileback == NULL)
return;
if (pdc_back)
{
SDL_Rect dest;
dest.y = 0;
while (dest.y < pdc_tileback->h)
{
dest.x = 0;
while (dest.x < pdc_tileback->w)
{
SDL_BlitSurface(pdc_back, 0, pdc_tileback, &dest);
dest.x += pdc_back->w;
}
dest.y += pdc_back->h;
}
SDL_BlitSurface(pdc_tileback, 0, pdc_screen, 0);
}
}
void PDC_scr_close(void)
{
PDC_LOG(("PDC_scr_close() - called\n"));
}
void PDC_scr_free(void)
{
if (SP)
free(SP);
}
/* open the physical screen -- allocate SP, miscellaneous intialization */
int PDC_scr_open(int argc, char **argv)
{
int i;
PDC_LOG(("PDC_scr_open() - called\n"));
SP = calloc(1, sizeof(SCREEN));
if (!SP)
return ERR;
pdc_own_screen = !pdc_screen;
if (pdc_own_screen)
{
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_EVENTS) < 0)
{
fprintf(stderr, "Could not start SDL: %s\n", SDL_GetError());
return ERR;
}
#ifdef PDC_WIDE
atexit(PDC_clean);
#else
atexit(SDL_Quit);
#endif
}
#ifdef PDC_WIDE
if (!pdc_ttffont)
{
if (TTF_Init () == -1)
{
fprintf(stderr, "Could not start SDL_TTF: %s\n", SDL_GetError());
return ERR;
}
const char *ptsz = getenv ("PDC_FONT_POINT_SIZE");
if (ptsz != NULL)
pdc_ttffont_spointsz = atoi (ptsz);
if (pdc_ttffont_spointsz <= 0)
pdc_ttffont_spointsz = 12;
const char *fname = getenv("PDC_FONT");
pdc_ttffont = TTF_OpenFont(fname ? fname : PDC_FONT_PATH, pdc_ttffont_spointsz);
TTF_SetFontKerning (pdc_ttffont, 0);
TTF_SetFontHinting(pdc_ttffont, pdc_ttffont_hint);
}
if (!pdc_ttffont)
{
fprintf(stderr, "Could not load font\n");
return ERR;
}
SP->mono = FALSE;
#else
if (!pdc_font)
{
const char *fname = getenv("PDC_FONT");
pdc_font = SDL_LoadBMP(fname ? fname : "pdcfont.bmp");
}
if (!pdc_font)
pdc_font = SDL_LoadBMP_RW(SDL_RWFromMem(deffont, sizeof(deffont)), 0);
if (!pdc_font)
{
fprintf(stderr, "Could not load font\n");
return ERR;
}
SP->mono = !pdc_font->format->palette;
#endif
if (!SP->mono && !pdc_back)
{
const char *bname = getenv("PDC_BACKGROUND");
pdc_back = SDL_LoadBMP(bname ? bname : "pdcback.bmp");
}
if (!SP->mono && (pdc_back || !pdc_own_screen))
{
SP->orig_attr = TRUE;
SP->orig_fore = COLOR_WHITE;
SP->orig_back = -1;
}
else
SP->orig_attr = FALSE;
#ifdef PDC_WIDE
TTF_SizeText(pdc_ttffont, "W", &pdc_fwidth, &pdc_fheight);
#else
pdc_fheight = pdc_font->h / 8;
pdc_fwidth = pdc_font->w / 32;
if (!SP->mono)
pdc_flastc = pdc_font->format->palette->ncolors - 1;
#endif
if (pdc_own_screen && !pdc_icon)
{
const char *iname = getenv("PDC_ICON");
pdc_icon = SDL_LoadBMP(iname ? iname : "pdcicon.bmp");
if (!pdc_icon)
pdc_icon = SDL_LoadBMP_RW(SDL_RWFromMem(deficon,
sizeof(deficon)), 0);
}
if (pdc_own_screen)
{
const char *env = getenv("PDC_LINES");
pdc_sheight = (env ? atoi(env) : 25) * pdc_fheight;
env = getenv("PDC_COLS");
pdc_swidth = (env ? atoi(env) : 80) * pdc_fwidth;
pdc_window = SDL_CreateWindow((argc ? argv[0] : "PDCurses"), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pdc_swidth, pdc_sheight, SDL_WINDOW_RESIZABLE);
if (pdc_window == NULL)
{
fprintf(stderr, "Could not open SDL window: %s\n", SDL_GetError());
return ERR;
}
SDL_SetWindowIcon(pdc_window, pdc_icon);
pdc_screen = SDL_GetWindowSurface(pdc_window);
if (pdc_screen == NULL)
{
fprintf(stderr, "Could not open SDL window surface: %s\n", SDL_GetError());
return ERR;
}
pdc_render = SDL_CreateRenderer(pdc_window, -1, 0);
if (pdc_render == NULL)
{
fprintf(stderr, "Could not open SDL window renderer: %s\n", SDL_GetError());
return ERR;
}
pdc_texture = SDL_CreateTexture(pdc_render, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, pdc_swidth, pdc_sheight);
if (pdc_texture == NULL)
{
fprintf(stderr, "Could not open SDL texture: %s\n", SDL_GetError());
return ERR;
}
}
else
{
if (!pdc_sheight)
pdc_sheight = pdc_screen->h - pdc_yoffset;
if (!pdc_swidth)
pdc_swidth = pdc_screen->w - pdc_xoffset;
}
if (!pdc_screen)
{
fprintf(stderr, "Couldn't create a surface: %s\n", SDL_GetError());
return ERR;
}
if (SP->orig_attr)
PDC_retile();
for (i = 0; i < 8; i++)
{
pdc_color[i].r = (i & COLOR_RED) ? 0xc0 : 0;
pdc_color[i].g = (i & COLOR_GREEN) ? 0xc0 : 0;
pdc_color[i].b = (i & COLOR_BLUE) ? 0xc0 : 0;
pdc_color[i + 8].r = (i & COLOR_RED) ? 0xff : 0x40;
pdc_color[i + 8].g = (i & COLOR_GREEN) ? 0xff : 0x40;
pdc_color[i + 8].b = (i & COLOR_BLUE) ? 0xff : 0x40;
}
for (i = 0; i < 16; i++)
pdc_mapped[i] = SDL_MapRGB(pdc_screen->format, pdc_color[i].r,
pdc_color[i].g, pdc_color[i].b);
PDC_mouse_set();
if (pdc_own_screen)
PDC_set_title(argc ? argv[0] : "PDCurses");
SP->lines = PDC_get_rows();
SP->cols = PDC_get_columns();
SP->mouse_wait = PDC_CLICK_PERIOD;
SP->audible = FALSE;
PDC_reset_prog_mode();
return OK;
}
/* the core of resize_term() */
int PDC_resize_screen(int nlines, int ncols)
{
if (!pdc_own_screen)
return ERR;
if (nlines && ncols)
{
pdc_sheight = nlines * pdc_fheight;
pdc_swidth = ncols * pdc_fwidth;
}
SDL_SetWindowSize(pdc_window, pdc_swidth, pdc_sheight);
pdc_screen = SDL_GetWindowSurface(pdc_window);
if (pdc_texture != NULL)
SDL_DestroyTexture (pdc_texture);
SDL_RenderClear(pdc_render);
pdc_texture = SDL_CreateTexture(pdc_render, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, pdc_swidth, pdc_sheight);
if (pdc_tileback)
PDC_retile();
SP->resized = FALSE;
SP->cursrow = SP->curscol = 0;
return OK;
}
void PDC_reset_prog_mode(void)
{
PDC_LOG(("PDC_reset_prog_mode() - called.\n"));
PDC_flushinp();
}
void PDC_reset_shell_mode(void)
{
PDC_LOG(("PDC_reset_shell_mode() - called.\n"));
PDC_flushinp();
}
void PDC_restore_screen_mode(int i)
{
}
void PDC_save_screen_mode(int i)
{
}
void PDC_init_pair(short pair, short fg, short bg)
{
atrtab[pair].f = fg;
atrtab[pair].b = bg;
}
int PDC_pair_content(short pair, short *fg, short *bg)
{
*fg = atrtab[pair].f;
*bg = atrtab[pair].b;
return OK;
}
bool PDC_can_change_color(void)
{
return TRUE;
}
int PDC_color_content(short color, short *red, short *green, short *blue)
{
*red = DIVROUND(pdc_color[color].r * 1000, 255);
*green = DIVROUND(pdc_color[color].g * 1000, 255);
*blue = DIVROUND(pdc_color[color].b * 1000, 255);
return OK;
}
int PDC_init_color(short color, short red, short green, short blue)
{
pdc_color[color].r = DIVROUND(red * 255, 1000);
pdc_color[color].g = DIVROUND(green * 255, 1000);
pdc_color[color].b = DIVROUND(blue * 255, 1000);
pdc_mapped[color] = SDL_MapRGB(pdc_screen->format, pdc_color[color].r,
pdc_color[color].g, pdc_color[color].b);
wrefresh(curscr);
return OK;
}

37
sdl2/pdcsdl.h Normal file
View File

@@ -0,0 +1,37 @@
/* Public Domain Curses */
/* $Id: pdcsdl.h,v 1.17 2008/07/14 04:24:52 wmcbrine Exp $ */
#include <curspriv.h>
#include <SDL.h>
#include <SDL_ttf.h>
PDCEX SDL_Window *pdc_window;
PDCEX SDL_Renderer *pdc_render;
PDCEX SDL_Texture *pdc_texture;
#ifdef PDC_WIDE
PDCEX TTF_Font *pdc_ttffont;
PDCEX SDL_Color *pdc_ttffont_foregroundcolor;
PDCEX SDL_Color *pdc_ttffont_backgroundcolor;
PDCEX int pdc_ttffont_spointsz;
PDCEX int pdc_ttffont_hint;
#endif
PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
extern SDL_Surface *pdc_tileback; /* used to regenerate the background
of "transparent" cells */
extern SDL_Color pdc_color[16]; /* colors for font palette */
extern Uint32 pdc_mapped[16]; /* colors for FillRect(), as
used in _highlight() */
extern int pdc_fheight, pdc_fwidth; /* font height and width */
extern int pdc_flastc; /* font palette's last color
(treated as the foreground) */
extern bool pdc_own_screen; /* if pdc_screen was not set
before initscr(), PDCurses is
responsible for (owns) it */
extern Uint32 pdc_lastupdate; /* time of last update, in ticks */
void PDC_update_rects(void);
void PDC_retile(void);

62
sdl2/pdcsetsc.c Normal file
View File

@@ -0,0 +1,62 @@
/* Public Domain Curses */
#include "pdcsdl.h"
RCSID("$Id: pdcsetsc.c,v 1.7 2008/07/14 04:24:52 wmcbrine Exp $")
/*man-start**************************************************************
Name: pdcsetsc
Synopsis:
int PDC_set_blink(bool blinkon);
void PDC_set_title(const char *title);
Description:
PDC_set_blink() toggles whether the A_BLINK attribute sets an
actual blink mode (TRUE), or sets the background color to high
intensity (FALSE). The default is platform-dependent (FALSE in
most cases). It returns OK if it could set the state to match
the given parameter, ERR otherwise. Current platforms also
adjust the value of COLORS according to this function -- 16 for
FALSE, and 8 for TRUE.
PDC_set_title() sets the title of the window in which the curses
program is running. This function may not do anything on some
platforms. (Currently it only works in Win32 and X11.)
Portability X/Open BSD SYS V
PDC_set_blink - - -
PDC_set_title - - -
**man-end****************************************************************/
int PDC_curs_set(int visibility)
{
int ret_vis;
PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
ret_vis = SP->visibility;
SP->visibility = visibility;
PDC_gotoyx(SP->cursrow, SP->curscol);
return ret_vis;
}
void PDC_set_title(const char *title)
{
PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
void SDL_SetWindowTitle(sdl_window, title);
}
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = 16;
return blinkon ? ERR : OK;
}

23
sdl2/pdcutil.c Normal file
View File

@@ -0,0 +1,23 @@
/* Public Domain Curses */
#include "pdcsdl.h"
RCSID("$Id: pdcutil.c,v 1.6 2008/07/14 04:24:52 wmcbrine Exp $")
void PDC_beep(void)
{
PDC_LOG(("PDC_beep() - called\n"));
}
void PDC_napms(int ms)
{
PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
PDC_update_rects();
SDL_Delay(ms);
}
const char *PDC_sysname(void)
{
return "SDL";
}

83
sdl2/sdltest.c Normal file
View File

@@ -0,0 +1,83 @@
/* Here's a simple example of combining SDL and PDCurses functionality.
The top portion of the window is devoted to SDL, with a four-line
(assuming the default 8x16 font) stdscr at the bottom.
$Id: sdltest.c,v 1.2 2008/07/14 04:24:52 wmcbrine Exp $
*/
#include <SDL.h>
#include <curses.h>
#include <stdlib.h>
#include <time.h>
/* You could #include pdcsdl.h, or just add the relevant declarations
here: */
PDCEX SDL_Window *pdc_window;
PDCEX SDL_Surface *pdc_screen;
PDCEX int pdc_yoffset;
int main(int argc, char **argv)
{
char inp[60];
int i, j, seed;
seed = time((time_t *)0);
srand(seed);
/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) < 0)
exit(1);
atexit(SDL_Quit);
pdc_window = SDL_CreateWindow("PDCurses for SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
pdc_screen = SDL_GetWindowSurface(pdc_window);
/* Initialize PDCurses */
pdc_yoffset = 416; /* 480 - 4 * 16 */
initscr();
start_color();
scrollok(stdscr, TRUE);
PDC_set_title("PDCurses for SDL");
/* Do some SDL stuff */
for (i = 640, j = 416; j; i -= 2, j -= 2)
{
SDL_Rect dest;
dest.x = (640 - i) / 2;
dest.y = (416 - j) / 2;
dest.w = i;
dest.h = j;
SDL_FillRect(pdc_screen, &dest,
SDL_MapRGB(pdc_screen->format, rand() % 256,
rand() % 256, rand() % 256));
}
SDL_UpdateWindowSurface(pdc_window);
/* Do some curses stuff */
init_pair(1, COLOR_WHITE + 8, COLOR_BLUE);
bkgd(COLOR_PAIR(1));
addstr("This is a demo of ");
attron(A_UNDERLINE);
addstr("PDCurses for SDL");
attroff(A_UNDERLINE);
addstr(".\nYour comments here: ");
getnstr(inp, 59);
addstr("Press any key to exit.");
getch();
endwin();
return 0;
}