From 3b77b723ca209199c8a224702812441e2196d452 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Thu, 7 Jul 2011 15:41:53 +0200 Subject: libpayload: Add PDCurses and ncurses' libform/libmenu PDCurses provides an alternative implementation of the curses library standard in addition to tinycurses. Where tinycurses is really tiny, PDCurses is more complete and provides virtually unlimited windows and the full API. The PDCurses code is brought in "vanilla", with all local changes residing in curses/pdcurses-backend/ In addition to a curses library, this change also provides libpanel (as part of the PDCurses code), and libform and libmenu which were derived from ncurses-5.9. As they rely on ncurses internals (and PDCurses is not ncurses), more changes were required for these libraries to work. The build system is extended to install the right set of header files depending on the selected curses implementation. Change-Id: I9e5b920f94b6510da01da2f656196a993170d1c5 Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/106 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones --- .../libpayload/curses/PDCurses-3.4/sdl1/Makefile | 101 ++++++ .../curses/PDCurses-3.4/sdl1/Makefile.mng | 105 ++++++ .../libpayload/curses/PDCurses-3.4/sdl1/README | 33 ++ .../libpayload/curses/PDCurses-3.4/sdl1/deffont.h | 385 ++++++++++++++++++++ .../libpayload/curses/PDCurses-3.4/sdl1/deficon.h | 23 ++ .../libpayload/curses/PDCurses-3.4/sdl1/pdcclip.c | 128 +++++++ .../libpayload/curses/PDCurses-3.4/sdl1/pdcdisp.c | 301 ++++++++++++++++ .../libpayload/curses/PDCurses-3.4/sdl1/pdcgetsc.c | 32 ++ .../libpayload/curses/PDCurses-3.4/sdl1/pdckbd.c | 389 +++++++++++++++++++++ .../libpayload/curses/PDCurses-3.4/sdl1/pdcscrn.c | 295 ++++++++++++++++ .../libpayload/curses/PDCurses-3.4/sdl1/pdcsdl.h | 26 ++ .../libpayload/curses/PDCurses-3.4/sdl1/pdcsetsc.c | 62 ++++ .../libpayload/curses/PDCurses-3.4/sdl1/pdcutil.c | 23 ++ .../libpayload/curses/PDCurses-3.4/sdl1/sdltest.c | 81 +++++ 14 files changed, 1984 insertions(+) create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/Makefile create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/Makefile.mng create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/README create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/deffont.h create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/deficon.h create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcclip.c create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcdisp.c create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcgetsc.c create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/pdckbd.c create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcscrn.c create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcsdl.h create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcsetsc.c create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcutil.c create mode 100644 payloads/libpayload/curses/PDCurses-3.4/sdl1/sdltest.c (limited to 'payloads/libpayload/curses/PDCurses-3.4/sdl1') diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/Makefile b/payloads/libpayload/curses/PDCurses-3.4/sdl1/Makefile new file mode 100644 index 0000000000..a8393f0b90 --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/Makefile @@ -0,0 +1,101 @@ +# 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 + +SFLAGS = $(shell sdl-config --cflags) +SLIBS = $(shell sdl-config --libs) + +# 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 = -O2 -Wall +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 newdemo ptest rain testcurs tuidemo worm xmas \ +sdltest + +.PHONY: all libs clean demos + +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: $(PANEL_HEADER) + +$(LIBOBJS) : %.o: $(srcdir)/%.c + $(BUILD) $(SFLAGS) -c $< + +$(PDCOBJS) : %.o: $(osdir)/%.c + $(BUILD) $(SFLAGS) -c $< + +firework: $(demodir)/firework.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +newdemo: $(demodir)/newdemo.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +ptest: $(demodir)/ptest.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +rain: $(demodir)/rain.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +testcurs: $(demodir)/testcurs.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +tuidemo: tuidemo.o tui.o + $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) + +worm: $(demodir)/worm.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +xmas: $(demodir)/xmas.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +sdltest: $(osdir)/sdltest.c + $(BUILD) $(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 diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/Makefile.mng b/payloads/libpayload/curses/PDCurses-3.4/sdl1/Makefile.mng new file mode 100644 index 0000000000..427edc670b --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/Makefile.mng @@ -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 diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/README b/payloads/libpayload/curses/PDCurses-3.4/sdl1/README new file mode 100644 index 0000000000..35234d397d --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/README @@ -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 diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/deffont.h b/payloads/libpayload/curses/PDCurses-3.4/sdl1/deffont.h new file mode 100644 index 0000000000..cf9cab193a --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/deffont.h @@ -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 +}; diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/deficon.h b/payloads/libpayload/curses/PDCurses-3.4/sdl1/deficon.h new file mode 100644 index 0000000000..7248ab5094 --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/deficon.h @@ -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 +}; diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcclip.c b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcclip.c new file mode 100644 index 0000000000..203c975d24 --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcclip.c @@ -0,0 +1,128 @@ +/* Public Domain Curses */ + +#include "pdcsdl.h" + +RCSID("$Id: pdcclip.c,v 1.6 2008/07/14 04:24:52 wmcbrine Exp $") + +#include + +/*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 */ + +static char *pdc_SDL_clipboard = NULL; + +int PDC_getclipboard(char **contents, long *length) +{ + int len; + + PDC_LOG(("PDC_getclipboard() - called\n")); + + if (!pdc_SDL_clipboard) + return PDC_CLIP_EMPTY; + + len = strlen(pdc_SDL_clipboard); + if ((*contents = malloc(len + 1)) == NULL) + return PDC_CLIP_MEMORY_ERROR; + + strcpy(*contents, pdc_SDL_clipboard); + *length = len; + + return PDC_CLIP_SUCCESS; +} + +int PDC_setclipboard(const char *contents, long length) +{ + PDC_LOG(("PDC_setclipboard() - called\n")); + + if (pdc_SDL_clipboard) + { + free(pdc_SDL_clipboard); + pdc_SDL_clipboard = NULL; + } + + if (contents) + { + if ((pdc_SDL_clipboard = malloc(length + 1)) == NULL) + return PDC_CLIP_MEMORY_ERROR; + + strcpy(pdc_SDL_clipboard, contents); + } + + return PDC_CLIP_SUCCESS; +} + +int PDC_freeclipboard(char *contents) +{ + PDC_LOG(("PDC_freeclipboard() - called\n")); + + /* should we also free empty the system clipboard? probably not */ + + if (contents) + { + /* NOTE: We free the memory, but we can not set caller's pointer + to NULL, so if caller calls again then will try to access + free'd memory. We 1st overwrite memory with a string so if + caller tries to use free memory they won't get what they + expect & hopefully notice. */ + + /* memset(contents, 0xFD, strlen(contents)); */ + + if (strlen(contents) >= strlen("PDCURSES")) + strcpy(contents, "PDCURSES"); + + free(contents); + } + + return PDC_CLIP_SUCCESS; +} + +int PDC_clearclipboard(void) +{ + PDC_LOG(("PDC_clearclipboard() - called\n")); + + if (pdc_SDL_clipboard) + { + free(pdc_SDL_clipboard); + pdc_SDL_clipboard = NULL; + } + + return PDC_CLIP_SUCCESS; +} diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcdisp.c b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcdisp.c new file mode 100644 index 0000000000..3712e6622e --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcdisp.c @@ -0,0 +1,301 @@ +/* Public Domain Curses */ + +#include "pdcsdl.h" + +RCSID("$Id: pdcdisp.c,v 1.35 2008/07/14 04:24:52 wmcbrine Exp $") + +#include +#include + +#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), ' ', '!', '"', '#', '$', '%', '&', + '\'', '(', ')', '*', + + A(0x1a), A(0x1b), A(0x18), A(0x19), + + '/', + + 0xdb, + + '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', '[', '\\', ']', '^', '_', + + A(0x04), 0xb1, + + 'b', 'c', 'd', 'e', + + 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, + + 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_Flip(pdc_screen); + else + SDL_UpdateRects(pdc_screen, rectcount, uprect); + + pdc_lastupdate = SDL_GetTicks(); + rectcount = 0; + } +} + +/* set the font colors to match the chtype's attribute */ + +static void _set_attr(chtype ch) +{ + 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; + } +} + +/* draw a cursor at (y, x) */ + +void PDC_gotoyx(int row, int col) +{ + SDL_Rect src, dest; + chtype ch; + int oldrow, oldcol; + + 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 + 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); + + 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; + + if (SP->mono) + return; + + if (ch & A_UNDERLINE) + { + 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); + } + + 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; + + 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); + + src.x = (ch & 0xff) % 32 * pdc_fwidth; + src.y = (ch & 0xff) / 32 * pdc_fheight; + + SDL_LowerBlit(pdc_font, &src, pdc_screen, &dest); + + if (ch & (A_UNDERLINE|A_LEFTLINE|A_RIGHTLINE)) + _highlight(&src, &dest, ch); + + dest.x += pdc_fwidth; + } +} diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcgetsc.c b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcgetsc.c new file mode 100644 index 0000000000..4319235072 --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcgetsc.c @@ -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; +} diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdckbd.c b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdckbd.c new file mode 100644 index 0000000000..56bf1e470d --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdckbd.c @@ -0,0 +1,389 @@ +/* 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 + +unsigned long pdc_key_modifiers = 0L; + +static SDL_Event event; +static SDLKey oldkey; +static MOUSE_STATUS old_mouse_status; + +static struct +{ + SDLKey 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_PRINT, 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_BREAK, 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_KP0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, + {SDLK_KP1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, + {SDLK_KP2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, + {SDLK_KP3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, + {SDLK_KP4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, + {SDLK_KP5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, + {SDLK_KP6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, + {SDLK_KP7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, + {SDLK_KP8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, + {SDLK_KP9, 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; +} + +static int _process_key_event(void) +{ + int i, key = 0; + + pdc_key_modifiers = 0L; + SP->key_code = FALSE; + + if (event.type == SDL_KEYUP) + { + 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; + } + + 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; + } + } + + if (!key) + { + key = event.key.keysym.unicode; + + 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) +{ + SDLMod 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_VIDEORESIZE: + if (pdc_own_screen && + (event.resize.h / pdc_fheight != LINES || + event.resize.w / pdc_fwidth != COLS)) + { + pdc_sheight = event.resize.h; + pdc_swidth = event.resize.w; + + if (!SP->resized) + { + SP->resized = TRUE; + return KEY_RESIZE; + } + } + 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; +} diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcscrn.c b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcscrn.c new file mode 100644 index 0000000000..e422b25cee --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcscrn.c @@ -0,0 +1,295 @@ +/* Public Domain Curses */ + +#include "pdcsdl.h" + +RCSID("$Id: pdcscrn.c,v 1.34 2008/07/14 04:24:52 wmcbrine Exp $") + +#include +#include "deffont.h" +#include "deficon.h" + +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]; + +void PDC_retile(void) +{ + if (pdc_tileback) + SDL_FreeSurface(pdc_tileback); + + pdc_tileback = SDL_DisplayFormat(pdc_screen); + + 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) < 0) + { + fprintf(stderr, "Could not start SDL: %s\n", SDL_GetError()); + return ERR; + } + + atexit(SDL_Quit); + } + + 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; + + 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; + + pdc_fheight = pdc_font->h / 8; + pdc_fwidth = pdc_font->w / 32; + + if (!SP->mono) + pdc_flastc = pdc_font->format->palette->ncolors - 1; + + 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_icon) + SDL_WM_SetIcon(pdc_icon, NULL); + } + + 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_screen = SDL_SetVideoMode(pdc_swidth, pdc_sheight, 0, + SDL_SWSURFACE|SDL_ANYFORMAT|SDL_RESIZABLE); + } + 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); + + SDL_EnableUNICODE(1); + + 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_FreeSurface(pdc_screen); + + pdc_screen = SDL_SetVideoMode(pdc_swidth, pdc_sheight, 0, + SDL_SWSURFACE|SDL_ANYFORMAT|SDL_RESIZABLE); + + 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(); + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +} + +void PDC_reset_shell_mode(void) +{ + PDC_LOG(("PDC_reset_shell_mode() - called.\n")); + + SDL_EnableKeyRepeat(0, 0); + 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; +} diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcsdl.h b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcsdl.h new file mode 100644 index 0000000000..79df21a52d --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcsdl.h @@ -0,0 +1,26 @@ +/* Public Domain Curses */ + +/* $Id: pdcsdl.h,v 1.17 2008/07/14 04:24:52 wmcbrine Exp $ */ + +#include + +#include + +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); diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcsetsc.c b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcsetsc.c new file mode 100644 index 0000000000..0df97ab744 --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcsetsc.c @@ -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)); + + SDL_WM_SetCaption(title, title); +} + +int PDC_set_blink(bool blinkon) +{ + if (pdc_color_started) + COLORS = 16; + + return blinkon ? ERR : OK; +} diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcutil.c b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcutil.c new file mode 100644 index 0000000000..b2d84045ff --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/pdcutil.c @@ -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"; +} diff --git a/payloads/libpayload/curses/PDCurses-3.4/sdl1/sdltest.c b/payloads/libpayload/curses/PDCurses-3.4/sdl1/sdltest.c new file mode 100644 index 0000000000..d39533b303 --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/sdl1/sdltest.c @@ -0,0 +1,81 @@ +/* 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 +#include +#include +#include + +/* You could #include pdcsdl.h, or just add the relevant declarations + here: */ + +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_screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE|SDL_ANYFORMAT); + + /* 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_UpdateRect(pdc_screen, 0, 0, 640, 416); + + /* 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; +} -- cgit v1.2.3