libpayload: Rename PDCurses-3.4 to PDCurses
Change-Id: If881ec130833c7e7e62caa3d31e350a531f5bc8e Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: http://review.coreboot.org/12398 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
49
payloads/libpayload/curses/PDCurses/dos/README
Normal file
49
payloads/libpayload/curses/PDCurses/dos/README
Normal file
@@ -0,0 +1,49 @@
|
||||
PDCurses for DOS
|
||||
================
|
||||
|
||||
This directory contains PDCurses source code files specific to DOS.
|
||||
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
. Choose the appropriate makefile for your compiler:
|
||||
|
||||
bccdos.mak - Borland C++ 3.0+
|
||||
gccdos.mak - DJGPP V2
|
||||
mscdos.mak - Microsoft C
|
||||
wccdos16.mak - Watcom 10.6+ (16-bit)
|
||||
wccdos4g.mak - Watcom 10.6+ (32-bit)
|
||||
|
||||
. For 16-bit compilers, you can change the memory MODEL in the makefile.
|
||||
(Large model is the default, and recommended.)
|
||||
|
||||
. Optionally, you can build in a different directory than the platform
|
||||
directory by setting PDCURSES_SRCDIR to point to the directory where
|
||||
you unpacked PDCurses, and changing to your target directory:
|
||||
|
||||
set PDCURSES_SRCDIR=c:\pdcurses
|
||||
|
||||
. Build it:
|
||||
|
||||
make -f makefile
|
||||
|
||||
(For Watcom, use "wmake" instead of "make"; for MSVC, "nmake".) You'll
|
||||
get the libraries (pdcurses.lib or .a, depending on your compiler; and
|
||||
panel.lib or .a), the demos (*.exe), and a lot of object files. Note
|
||||
that the panel library is just a copy of the main library, provided
|
||||
for convenience; both panel and curses functions are in the main
|
||||
library.
|
||||
|
||||
|
||||
Distribution Status
|
||||
-------------------
|
||||
|
||||
The files in this directory are released to the Public Domain.
|
||||
|
||||
|
||||
Acknowledgements
|
||||
----------------
|
||||
|
||||
Watcom C port was provided by Pieter Kunst <kunst@prl.philips.nl>
|
||||
DJGPP 1.x port was provided by David Nugent <davidn@csource.oz.au>
|
9
payloads/libpayload/curses/PDCurses/dos/bccdos.lrf
Normal file
9
payloads/libpayload/curses/PDCurses/dos/bccdos.lrf
Normal file
@@ -0,0 +1,9 @@
|
||||
+addch.obj +addchstr.obj +addstr.obj +attr.obj +beep.obj +bkgd.obj &
|
||||
+border.obj +clear.obj +color.obj +delch.obj +deleteln.obj +deprec.obj &
|
||||
+getch.obj +getstr.obj +getyx.obj +inch.obj +inchstr.obj +initscr.obj &
|
||||
+inopts.obj +insch.obj +insstr.obj +instr.obj +kernel.obj +keyname.obj &
|
||||
+mouse.obj +move.obj +outopts.obj +overlay.obj +pad.obj +panel.obj &
|
||||
+printw.obj +refresh.obj +scanw.obj +scr_dump.obj +scroll.obj +slk.obj &
|
||||
+termattr.obj +terminfo.obj +touch.obj +util.obj +window.obj +debug.obj &
|
||||
+pdcclip.obj +pdcdisp.obj +pdcgetsc.obj +pdckbd.obj +pdcscrn.obj &
|
||||
+pdcsetsc.obj +pdcutil.obj ,lib.map
|
82
payloads/libpayload/curses/PDCurses/dos/bccdos.mak
Normal file
82
payloads/libpayload/curses/PDCurses/dos/bccdos.mak
Normal file
@@ -0,0 +1,82 @@
|
||||
# Borland MAKE Makefile for PDCurses library - DOS BC++ 3.0+
|
||||
#
|
||||
# Usage: make -f [path\]bccdos.mak [DEBUG=] [target]
|
||||
#
|
||||
# where target can be any of:
|
||||
# [all|demos|pdcurses.lib|testcurs.exe...]
|
||||
|
||||
# Change the memory MODEL here, if desired
|
||||
MODEL = l
|
||||
|
||||
O = obj
|
||||
|
||||
!ifndef PDCURSES_SRCDIR
|
||||
PDCURSES_SRCDIR = ..
|
||||
!endif
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\version.mif
|
||||
!include $(PDCURSES_SRCDIR)\libobjs.mif
|
||||
|
||||
osdir = $(PDCURSES_SRCDIR)\dos
|
||||
|
||||
!ifdef DEBUG
|
||||
CFLAGS = -N -v -y -DPDCDEBUG
|
||||
!else
|
||||
CFLAGS = -O
|
||||
!endif
|
||||
|
||||
CPPFLAGS = -I$(PDCURSES_SRCDIR)
|
||||
|
||||
BUILD = $(CC) -1- -K -G -rd -d -w-eff -w-par -c \
|
||||
-m$(MODEL) $(CFLAGS) $(CPPFLAGS)
|
||||
|
||||
LIBEXE = tlib /C /E
|
||||
|
||||
LIBCURSES = pdcurses.lib
|
||||
|
||||
all: $(LIBCURSES) $(DEMOS)
|
||||
|
||||
clean:
|
||||
-del *.obj
|
||||
-del *.lib
|
||||
-del *.map
|
||||
-del *.exe
|
||||
|
||||
demos: $(DEMOS)
|
||||
|
||||
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
|
||||
-del $@
|
||||
$(LIBEXE) $@ @$(osdir)\bccdos.lrf
|
||||
-copy $(LIBCURSES) panel.lib
|
||||
|
||||
.autodepend
|
||||
|
||||
{$(srcdir)\}.c.obj:
|
||||
$(BUILD) $<
|
||||
|
||||
{$(osdir)\}.c.obj:
|
||||
$(BUILD) $<
|
||||
|
||||
{$(demodir)\}.c.obj:
|
||||
$(BUILD) $<
|
||||
|
||||
.c.obj:
|
||||
$(BUILD) $<
|
||||
|
||||
.obj.exe:
|
||||
$(CC) -m$(MODEL) -e$@ $** $(LIBCURSES)
|
||||
|
||||
tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES)
|
||||
$(CC) -m$(MODEL) -e$@ $**
|
||||
|
||||
tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H)
|
||||
$(BUILD) -I$(demodir) $(demodir)\tui.c
|
||||
|
||||
tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H)
|
||||
$(BUILD) -I$(demodir) $(demodir)\tuidemo.c
|
||||
|
||||
PLATFORM1 = Borland C++ 3.1
|
||||
PLATFORM2 = Borland C/C++ 3.1 for DOS
|
||||
ARCNAME = pdc$(VER)bcc
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\makedist.mif
|
87
payloads/libpayload/curses/PDCurses/dos/gccdos.mak
Normal file
87
payloads/libpayload/curses/PDCurses/dos/gccdos.mak
Normal file
@@ -0,0 +1,87 @@
|
||||
# GNU MAKE (3.79.1) Makefile for PDCurses library - DOS DJGPP V2.0+
|
||||
#
|
||||
# Usage: make -f [path\]gccdos.mak [DEBUG=Y] [target]
|
||||
#
|
||||
# where target can be any of:
|
||||
# [all|libs|demos|dist|pdcurses.a|testcurs.exe...]
|
||||
|
||||
O = o
|
||||
|
||||
ifndef PDCURSES_SRCDIR
|
||||
PDCURSES_SRCDIR = ..
|
||||
endif
|
||||
|
||||
include $(PDCURSES_SRCDIR)/version.mif
|
||||
include $(PDCURSES_SRCDIR)/libobjs.mif
|
||||
|
||||
osdir = $(PDCURSES_SRCDIR)/dos
|
||||
|
||||
PDCURSES_DOS_H = $(osdir)/pdcdos.h
|
||||
|
||||
CC = gcc
|
||||
|
||||
ifeq ($(DEBUG),Y)
|
||||
CFLAGS = -g -Wall -DPDCDEBUG
|
||||
LDFLAGS = -g
|
||||
else
|
||||
CFLAGS = -O2 -Wall
|
||||
LDFLAGS =
|
||||
endif
|
||||
|
||||
CFLAGS += -I$(PDCURSES_SRCDIR)
|
||||
|
||||
LINK = gcc
|
||||
|
||||
LIBEXE = ar
|
||||
LIBFLAGS = rcv
|
||||
|
||||
LIBCURSES = pdcurses.a
|
||||
|
||||
.PHONY: all libs clean demos dist
|
||||
|
||||
all: libs demos
|
||||
|
||||
libs: $(LIBCURSES)
|
||||
|
||||
clean:
|
||||
-del *.o
|
||||
-del *.a
|
||||
-del *.exe
|
||||
|
||||
demos: $(DEMOS)
|
||||
strip *.exe
|
||||
|
||||
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
|
||||
$(LIBEXE) $(LIBFLAGS) $@ $?
|
||||
-copy $(LIBCURSES) panel.a
|
||||
|
||||
$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
|
||||
$(PDCOBJS) : $(PDCURSES_DOS_H)
|
||||
$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
|
||||
panel.o : $(PANEL_HEADER)
|
||||
terminfo.o: $(TERM_HEADER)
|
||||
|
||||
$(LIBOBJS) : %.o: $(srcdir)/%.c
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
$(PDCOBJS) : %.o: $(osdir)/%.c
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
firework.exe newdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \
|
||||
ptest.exe: %.exe: $(demodir)/%.c
|
||||
$(CC) $(CFLAGS) -o$@ $< $(LIBCURSES)
|
||||
|
||||
tuidemo.exe: tuidemo.o tui.o
|
||||
$(LINK) $(LDFLAGS) -o$@ tuidemo.o tui.o $(LIBCURSES)
|
||||
|
||||
tui.o: $(demodir)/tui.c $(demodir)/tui.h $(PDCURSES_CURSES_H)
|
||||
$(CC) -c $(CFLAGS) -I$(demodir) -o$@ $<
|
||||
|
||||
tuidemo.o: $(demodir)/tuidemo.c $(PDCURSES_CURSES_H)
|
||||
$(CC) -c $(CFLAGS) -I$(demodir) -o$@ $<
|
||||
|
||||
PLATFORM1 = DJGPP 2.03
|
||||
PLATFORM2 = DJGPP 2.03 for DOS
|
||||
ARCNAME = pdc$(VER)djg
|
||||
|
||||
include $(PDCURSES_SRCDIR)/makedist.mif
|
50
payloads/libpayload/curses/PDCurses/dos/mscdos.lrf
Normal file
50
payloads/libpayload/curses/PDCurses/dos/mscdos.lrf
Normal file
@@ -0,0 +1,50 @@
|
||||
-+addch.obj &
|
||||
-+addchstr.obj &
|
||||
-+addstr.obj &
|
||||
-+attr.obj &
|
||||
-+beep.obj &
|
||||
-+bkgd.obj &
|
||||
-+border.obj &
|
||||
-+clear.obj &
|
||||
-+color.obj &
|
||||
-+delch.obj &
|
||||
-+deleteln.obj &
|
||||
-+deprec.obj &
|
||||
-+getch.obj &
|
||||
-+getstr.obj &
|
||||
-+getyx.obj &
|
||||
-+inch.obj &
|
||||
-+inchstr.obj &
|
||||
-+initscr.obj &
|
||||
-+inopts.obj &
|
||||
-+insch.obj &
|
||||
-+insstr.obj &
|
||||
-+instr.obj &
|
||||
-+kernel.obj &
|
||||
-+keyname.obj &
|
||||
-+mouse.obj &
|
||||
-+move.obj &
|
||||
-+outopts.obj &
|
||||
-+overlay.obj &
|
||||
-+pad.obj &
|
||||
-+panel.obj &
|
||||
-+printw.obj &
|
||||
-+refresh.obj &
|
||||
-+scanw.obj &
|
||||
-+scr_dump.obj &
|
||||
-+scroll.obj &
|
||||
-+slk.obj &
|
||||
-+termattr.obj &
|
||||
-+terminfo.obj &
|
||||
-+touch.obj &
|
||||
-+util.obj &
|
||||
-+window.obj &
|
||||
-+debug.obj &
|
||||
-+pdcclip.obj &
|
||||
-+pdcdisp.obj &
|
||||
-+pdcgetsc.obj &
|
||||
-+pdckbd.obj &
|
||||
-+pdcscrn.obj &
|
||||
-+pdcsetsc.obj &
|
||||
-+pdcutil.obj &
|
||||
,lib.map;
|
114
payloads/libpayload/curses/PDCurses/dos/mscdos.mak
Normal file
114
payloads/libpayload/curses/PDCurses/dos/mscdos.mak
Normal file
@@ -0,0 +1,114 @@
|
||||
# NMAKE Makefile for PDCurses library - Microsoft C for DOS
|
||||
#
|
||||
# Usage: nmake -f [path\]dosmsc.mak [DEBUG=] [target]
|
||||
#
|
||||
# where target can be any of:
|
||||
# [all|demos|pdcurses.lib|testcurs.exe...]
|
||||
|
||||
# Change the memory MODEL here, if desired
|
||||
MODEL = L # one of L, S, M, T, H, C
|
||||
SIZE = LARGE # one of LARGE, SMALL, MEDIUM, TINY, HUGE, COMPACT
|
||||
|
||||
O = obj
|
||||
|
||||
!ifndef PDCURSES_SRCDIR
|
||||
PDCURSES_SRCDIR = ..
|
||||
!endif
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\version.mif
|
||||
!include $(PDCURSES_SRCDIR)\libobjs.mif
|
||||
|
||||
osdir = $(PDCURSES_SRCDIR)\dos
|
||||
|
||||
PDCURSES_DOS_H = $(osdir)\pdcdos.h
|
||||
|
||||
CC = cl
|
||||
|
||||
!ifdef DEBUG
|
||||
CFLAGS = /Od /Zi /DPDCDEBUG
|
||||
LDFLAGS = /CO /NOE /SE:160
|
||||
!else
|
||||
CFLAGS = /Ox
|
||||
LDFLAGS = /NOE /SE:160
|
||||
!endif
|
||||
|
||||
CPPFLAGS = -I$(PDCURSES_SRCDIR)
|
||||
|
||||
BUILD = $(CC) /J /nologo /c /D$(SIZE) /A$(MODEL) $(CFLAGS) $(CPPFLAGS)
|
||||
|
||||
LINK = link
|
||||
|
||||
CCLIBS =
|
||||
|
||||
LIBEXE = lib
|
||||
|
||||
LIBCURSES = pdcurses.lib
|
||||
|
||||
all: $(LIBCURSES) $(DEMOS)
|
||||
|
||||
clean:
|
||||
-del *.obj
|
||||
-del *.lib
|
||||
-del *.exe
|
||||
|
||||
demos: $(DEMOS)
|
||||
|
||||
DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj
|
||||
|
||||
$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
|
||||
$(DEMOOBJS) : $(PDCURSES_CURSES_H)
|
||||
$(DEMOS) : $(LIBCURSES)
|
||||
panel.obj : $(PANEL_HEADER)
|
||||
terminfo.obj: $(TERM_HEADER)
|
||||
|
||||
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
|
||||
$(LIBEXE) $@ @$(osdir)\mscdos.lrf
|
||||
-copy $(LIBCURSES) panel.lib
|
||||
|
||||
{$(srcdir)\}.c{}.obj:
|
||||
$(BUILD) $<
|
||||
|
||||
{$(osdir)\}.c{}.obj:
|
||||
$(BUILD) $<
|
||||
|
||||
{$(demodir)\}.c{}.obj:
|
||||
$(BUILD) $<
|
||||
|
||||
firework.exe: firework.obj
|
||||
$(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
|
||||
|
||||
newdemo.exe: newdemo.obj
|
||||
$(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
|
||||
|
||||
ptest.exe: ptest.obj
|
||||
$(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
|
||||
|
||||
rain.exe: rain.obj
|
||||
$(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
|
||||
|
||||
testcurs.exe: testcurs.obj
|
||||
$(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
|
||||
|
||||
tuidemo.exe: tuidemo.obj tui.obj
|
||||
$(LINK) $(LDFLAGS) $*.obj+tui.obj,$*,,$(LIBCURSES);
|
||||
|
||||
worm.exe: worm.obj
|
||||
$(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
|
||||
|
||||
xmas.exe: xmas.obj
|
||||
$(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
|
||||
|
||||
ptest.obj: $(demodir)\ptest.c $(PANEL_HEADER)
|
||||
$(BUILD) $(demodir)\ptest.c
|
||||
|
||||
tui.obj: $(demodir)\tui.c $(demodir)\tui.h
|
||||
$(BUILD) -I$(demodir) $(demodir)\tui.c
|
||||
|
||||
tuidemo.obj: $(demodir)\tuidemo.c
|
||||
$(BUILD) -I$(demodir) $(demodir)\tuidemo.c
|
||||
|
||||
PLATFORM1 = Microsoft C
|
||||
PLATFORM2 = Microsoft C for DOS
|
||||
ARCNAME = pdc$(VER)msc
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\makedist.mif
|
129
payloads/libpayload/curses/PDCurses/dos/pdcclip.c
Normal file
129
payloads/libpayload/curses/PDCurses/dos/pdcclip.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Public Domain Curses */
|
||||
|
||||
#include "pdcdos.h"
|
||||
|
||||
RCSID("$Id: pdcclip.c,v 1.33 2008/07/13 16:08:17 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 */
|
||||
|
||||
static char *pdc_DOS_clipboard = NULL;
|
||||
|
||||
int PDC_getclipboard(char **contents, long *length)
|
||||
{
|
||||
int len;
|
||||
|
||||
PDC_LOG(("PDC_getclipboard() - called\n"));
|
||||
|
||||
if (!pdc_DOS_clipboard)
|
||||
return PDC_CLIP_EMPTY;
|
||||
|
||||
len = strlen(pdc_DOS_clipboard);
|
||||
if ((*contents = malloc(len + 1)) == NULL)
|
||||
return PDC_CLIP_MEMORY_ERROR;
|
||||
|
||||
strcpy(*contents, pdc_DOS_clipboard);
|
||||
*length = len;
|
||||
|
||||
return PDC_CLIP_SUCCESS;
|
||||
}
|
||||
|
||||
int PDC_setclipboard(const char *contents, long length)
|
||||
{
|
||||
PDC_LOG(("PDC_setclipboard() - called\n"));
|
||||
|
||||
if (pdc_DOS_clipboard)
|
||||
{
|
||||
free(pdc_DOS_clipboard);
|
||||
pdc_DOS_clipboard = NULL;
|
||||
}
|
||||
|
||||
if (contents)
|
||||
{
|
||||
if ((pdc_DOS_clipboard = malloc(length + 1)) == NULL)
|
||||
return PDC_CLIP_MEMORY_ERROR;
|
||||
|
||||
strcpy(pdc_DOS_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_DOS_clipboard)
|
||||
{
|
||||
free(pdc_DOS_clipboard);
|
||||
pdc_DOS_clipboard = NULL;
|
||||
}
|
||||
|
||||
return PDC_CLIP_SUCCESS;
|
||||
}
|
158
payloads/libpayload/curses/PDCurses/dos/pdcdisp.c
Normal file
158
payloads/libpayload/curses/PDCurses/dos/pdcdisp.c
Normal file
@@ -0,0 +1,158 @@
|
||||
/* Public Domain Curses */
|
||||
|
||||
#include "pdcdos.h"
|
||||
|
||||
RCSID("$Id: pdcdisp.c,v 1.65 2008/07/13 16:08:17 wmcbrine Exp $")
|
||||
|
||||
/* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these
|
||||
match code page 437 and compatible pages (CP850, CP852, etc.) */
|
||||
|
||||
#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
|
||||
|
||||
#ifdef __PACIFIC__
|
||||
void movedata(unsigned sseg, unsigned soff, unsigned dseg,
|
||||
unsigned doff, unsigned n)
|
||||
{
|
||||
far char *src = MK_FP(sseg, soff);
|
||||
far char *dst = MK_FP(dseg, doff);
|
||||
|
||||
while (n--)
|
||||
*dst++ = *src++;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* position hardware cursor at (y, x) */
|
||||
|
||||
void PDC_gotoyx(int row, int col)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col));
|
||||
|
||||
regs.h.ah = 0x02;
|
||||
regs.h.bh = 0;
|
||||
regs.h.dh = (unsigned char) row;
|
||||
regs.h.dl = (unsigned char) col;
|
||||
PDCINT(0x10, regs);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
int j;
|
||||
|
||||
PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));
|
||||
|
||||
if (pdc_direct_video)
|
||||
{
|
||||
#if SMALL || MEDIUM
|
||||
# ifndef __PACIFIC__
|
||||
struct SREGS segregs;
|
||||
# endif
|
||||
int ds;
|
||||
#endif
|
||||
/* this should be enough for the maximum width of a screen */
|
||||
|
||||
struct {unsigned char text, attr;} temp_line[256];
|
||||
|
||||
/* replace the attribute part of the chtype with the actual
|
||||
color value for each chtype in the line */
|
||||
|
||||
for (j = 0; j < len; j++)
|
||||
{
|
||||
chtype ch = srcp[j];
|
||||
|
||||
temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT];
|
||||
#ifdef CHTYPE_LONG
|
||||
if (ch & A_ALTCHARSET && !(ch & 0xff80))
|
||||
ch = acs_map[ch & 0x7f];
|
||||
#endif
|
||||
temp_line[j].text = ch & 0xff;
|
||||
}
|
||||
|
||||
#ifdef __DJGPP__
|
||||
dosmemput(temp_line, len * 2,
|
||||
(unsigned long)_FAR_POINTER(pdc_video_seg,
|
||||
pdc_video_ofs + (lineno * curscr->_maxx + x) * 2));
|
||||
#else
|
||||
# if SMALL || MEDIUM
|
||||
# ifdef __PACIFIC__
|
||||
ds = FP_SEG((void far *) temp_line);
|
||||
# else
|
||||
segread(&segregs);
|
||||
ds = segregs.ds;
|
||||
# endif
|
||||
movedata(ds, (int)temp_line, pdc_video_seg,
|
||||
pdc_video_ofs + (lineno * curscr->_maxx + x) * 2, len * 2);
|
||||
# else
|
||||
memcpy((void *)_FAR_POINTER(pdc_video_seg,
|
||||
pdc_video_ofs + (lineno * curscr->_maxx + x) * 2),
|
||||
temp_line, len * 2);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
for (j = 0; j < len;)
|
||||
{
|
||||
PDCREGS regs;
|
||||
unsigned short count = 1;
|
||||
chtype ch = srcp[j];
|
||||
|
||||
while ((j + count < len) && (ch == srcp[j + count]))
|
||||
count++;
|
||||
|
||||
PDC_gotoyx(lineno, j + x);
|
||||
|
||||
regs.h.ah = 0x09;
|
||||
regs.W.bx = pdc_atrtab[ch >> PDC_ATTR_SHIFT];
|
||||
regs.W.cx = count;
|
||||
#ifdef CHTYPE_LONG
|
||||
if (ch & A_ALTCHARSET && !(ch & 0xff80))
|
||||
ch = acs_map[ch & 0x7f];
|
||||
#endif
|
||||
regs.h.al = (unsigned char) (ch & 0xff);
|
||||
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
j += count;
|
||||
}
|
||||
}
|
186
payloads/libpayload/curses/PDCurses/dos/pdcdos.h
Normal file
186
payloads/libpayload/curses/PDCurses/dos/pdcdos.h
Normal file
@@ -0,0 +1,186 @@
|
||||
/* Public Domain Curses */
|
||||
|
||||
/* $Id: pdcdos.h,v 1.30 2008/07/13 16:08:17 wmcbrine Exp $ */
|
||||
|
||||
#include <curspriv.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(_QC)
|
||||
# define MSC 1
|
||||
#endif
|
||||
|
||||
#if defined(__PACIFIC__) && !defined(__SMALL__)
|
||||
# define __SMALL__
|
||||
#endif
|
||||
|
||||
#if defined(__HIGHC__) || MSC
|
||||
# include <bios.h>
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* MEMORY MODEL SUPPORT:
|
||||
*
|
||||
* MODELS
|
||||
* TINY cs,ds,ss all in 1 segment (not enough memory!)
|
||||
* SMALL cs:1 segment, ds:1 segment
|
||||
* MEDIUM cs:many segments, ds:1 segment
|
||||
* COMPACT cs:1 segment, ds:many segments
|
||||
* LARGE cs:many segments, ds:many segments
|
||||
* HUGE cs:many segments, ds:segments > 64K
|
||||
*/
|
||||
|
||||
#ifdef __TINY__
|
||||
# define SMALL 1
|
||||
#endif
|
||||
#ifdef __SMALL__
|
||||
# define SMALL 1
|
||||
#endif
|
||||
#ifdef __MEDIUM__
|
||||
# define MEDIUM 1
|
||||
#endif
|
||||
#ifdef __COMPACT__
|
||||
# define COMPACT 1
|
||||
#endif
|
||||
#ifdef __LARGE__
|
||||
# define LARGE 1
|
||||
#endif
|
||||
#ifdef __HUGE__
|
||||
# define HUGE 1
|
||||
#endif
|
||||
|
||||
#include <dos.h>
|
||||
|
||||
extern unsigned char *pdc_atrtab;
|
||||
extern int pdc_adapter;
|
||||
extern int pdc_scrnmode;
|
||||
extern int pdc_font;
|
||||
extern bool pdc_direct_video;
|
||||
extern bool pdc_bogus_adapter;
|
||||
extern unsigned pdc_video_seg;
|
||||
extern unsigned pdc_video_ofs;
|
||||
|
||||
#ifdef __DJGPP__ /* Note: works only in plain DOS... */
|
||||
# if DJGPP == 2
|
||||
# define _FAR_POINTER(s,o) ((((int)(s)) << 4) + ((int)(o)))
|
||||
# else
|
||||
# define _FAR_POINTER(s,o) (0xe0000000 + (((int)(s)) << 4) + ((int)(o)))
|
||||
# endif
|
||||
# define _FP_SEGMENT(p) (unsigned short)((((long)p) >> 4) & 0xffff)
|
||||
#else
|
||||
# ifdef __TURBOC__
|
||||
# define _FAR_POINTER(s,o) MK_FP(s,o)
|
||||
# else
|
||||
# if defined(__WATCOMC__) && defined(__FLAT__)
|
||||
# define _FAR_POINTER(s,o) ((((int)(s)) << 4) + ((int)(o)))
|
||||
# else
|
||||
# define _FAR_POINTER(s,o) (((long)s << 16) | (long)o)
|
||||
# endif
|
||||
# endif
|
||||
# define _FP_SEGMENT(p) (unsigned short)(((long)p) >> 4)
|
||||
#endif
|
||||
#define _FP_OFFSET(p) ((unsigned short)p & 0x000f)
|
||||
|
||||
#ifdef __DJGPP__
|
||||
# include <sys/movedata.h>
|
||||
unsigned char getdosmembyte(int offs);
|
||||
unsigned short getdosmemword(int offs);
|
||||
unsigned long getdosmemdword(int offs);
|
||||
void setdosmembyte(int offs, unsigned char b);
|
||||
void setdosmemword(int offs, unsigned short w);
|
||||
#else
|
||||
# if SMALL || MEDIUM || MSC
|
||||
# define PDC_FAR far
|
||||
# else
|
||||
# define PDC_FAR
|
||||
# endif
|
||||
# define getdosmembyte(offs) \
|
||||
(*((unsigned char PDC_FAR *) _FAR_POINTER(0,offs)))
|
||||
# define getdosmemword(offs) \
|
||||
(*((unsigned short PDC_FAR *) _FAR_POINTER(0,offs)))
|
||||
# define getdosmemdword(offs) \
|
||||
(*((unsigned long PDC_FAR *) _FAR_POINTER(0,offs)))
|
||||
# define setdosmembyte(offs,x) \
|
||||
(*((unsigned char PDC_FAR *) _FAR_POINTER(0,offs)) = (x))
|
||||
# define setdosmemword(offs,x) \
|
||||
(*((unsigned short PDC_FAR *) _FAR_POINTER(0,offs)) = (x))
|
||||
#endif
|
||||
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned long edi, esi, ebp, res, ebx, edx, ecx, eax;
|
||||
} d;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned short di, di_hi, si, si_hi, bp, bp_hi, res, res_hi,
|
||||
bx, bx_hi, dx, dx_hi, cx, cx_hi, ax, ax_hi,
|
||||
flags, es, ds, fs, gs, ip, cs, sp, ss;
|
||||
} w;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned char edi[4], esi[4], ebp[4], res[4],
|
||||
bl, bh, ebx_b2, ebx_b3, dl, dh, edx_b2, edx_b3,
|
||||
cl, ch, ecx_b2, ecx_b3, al, ah, eax_b2, eax_b3;
|
||||
} h;
|
||||
} pdc_dpmi_regs;
|
||||
|
||||
void PDC_dpmi_int(int, pdc_dpmi_regs *);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __DJGPP__
|
||||
# include <dpmi.h>
|
||||
# define PDCREGS __dpmi_regs
|
||||
# define PDCINT(vector, regs) __dpmi_int(vector, ®s)
|
||||
#else
|
||||
# ifdef __WATCOMC__
|
||||
# ifdef __386__
|
||||
# define PDCREGS pdc_dpmi_regs
|
||||
# define PDCINT(vector, regs) PDC_dpmi_int(vector, ®s)
|
||||
# else
|
||||
# define PDCREGS union REGPACK
|
||||
# define PDCINT(vector, regs) intr(vector, ®s)
|
||||
# endif
|
||||
# else
|
||||
# define PDCREGS union REGS
|
||||
# define PDCINT(vector, regs) int86(vector, ®s, ®s)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Wide registers in REGS: w or x? */
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
# define W w
|
||||
#else
|
||||
# define W x
|
||||
#endif
|
||||
|
||||
/* Monitor (terminal) type information */
|
||||
|
||||
enum
|
||||
{
|
||||
_NONE, _MDA, _CGA,
|
||||
_EGACOLOR = 0x04, _EGAMONO,
|
||||
_VGACOLOR = 0x07, _VGAMONO,
|
||||
_MCGACOLOR = 0x0a, _MCGAMONO,
|
||||
_MDS_GENIUS = 0x30
|
||||
};
|
||||
|
||||
/* Text-mode font size information */
|
||||
|
||||
enum
|
||||
{
|
||||
_FONT8 = 8,
|
||||
_FONT14 = 14,
|
||||
_FONT15, /* GENIUS */
|
||||
_FONT16
|
||||
};
|
||||
|
||||
#ifdef __PACIFIC__
|
||||
void movedata(unsigned, unsigned, unsigned, unsigned, unsigned);
|
||||
#endif
|
100
payloads/libpayload/curses/PDCurses/dos/pdcgetsc.c
Normal file
100
payloads/libpayload/curses/PDCurses/dos/pdcgetsc.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* Public Domain Curses */
|
||||
|
||||
#include "pdcdos.h"
|
||||
|
||||
RCSID("$Id: pdcgetsc.c,v 1.42 2008/07/13 16:08:17 wmcbrine Exp $")
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* return width of screen/viewport */
|
||||
|
||||
int PDC_get_columns(void)
|
||||
{
|
||||
PDCREGS regs;
|
||||
int cols;
|
||||
const char *env_cols;
|
||||
|
||||
PDC_LOG(("PDC_get_columns() - called\n"));
|
||||
|
||||
/* use the value from COLS environment variable, if set. MH 10-Jun-92 */
|
||||
/* and use the minimum of COLS and return from int10h MH 18-Jun-92 */
|
||||
|
||||
regs.h.ah = 0x0f;
|
||||
PDCINT(0x10, regs);
|
||||
cols = (int)regs.h.ah;
|
||||
|
||||
env_cols = getenv("COLS");
|
||||
|
||||
if (env_cols)
|
||||
cols = min(atoi(env_cols), cols);
|
||||
|
||||
PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols));
|
||||
|
||||
return cols;
|
||||
}
|
||||
|
||||
/* get the cursor size/shape */
|
||||
|
||||
int PDC_get_cursor_mode(void)
|
||||
{
|
||||
PDC_LOG(("PDC_get_cursor_mode() - called\n"));
|
||||
|
||||
return getdosmemword(0x460);
|
||||
}
|
||||
|
||||
/* return number of screen rows */
|
||||
|
||||
int PDC_get_rows(void)
|
||||
{
|
||||
const char *env_rows;
|
||||
int rows;
|
||||
|
||||
PDC_LOG(("PDC_get_rows() - called\n"));
|
||||
|
||||
/* use the value from LINES environment variable, if set. MH 10-Jun-92 */
|
||||
/* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */
|
||||
|
||||
rows = getdosmembyte(0x484) + 1;
|
||||
env_rows = getenv("LINES");
|
||||
|
||||
if (env_rows)
|
||||
rows = min(atoi(env_rows), rows);
|
||||
|
||||
if (rows == 1 && pdc_adapter == _MDS_GENIUS)
|
||||
rows = 66;
|
||||
if (rows == 1 && pdc_adapter == _MDA)
|
||||
rows = 25;
|
||||
|
||||
if (rows == 1)
|
||||
{
|
||||
rows = 25;
|
||||
pdc_direct_video = FALSE;
|
||||
}
|
||||
|
||||
switch (pdc_adapter)
|
||||
{
|
||||
case _EGACOLOR:
|
||||
case _EGAMONO:
|
||||
switch (rows)
|
||||
{
|
||||
case 25:
|
||||
case 43:
|
||||
break;
|
||||
default:
|
||||
rows = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case _VGACOLOR:
|
||||
case _VGAMONO:
|
||||
break;
|
||||
|
||||
default:
|
||||
rows = 25;
|
||||
break;
|
||||
}
|
||||
|
||||
PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows));
|
||||
|
||||
return rows;
|
||||
}
|
511
payloads/libpayload/curses/PDCurses/dos/pdckbd.c
Normal file
511
payloads/libpayload/curses/PDCurses/dos/pdckbd.c
Normal file
@@ -0,0 +1,511 @@
|
||||
/* Public Domain Curses */
|
||||
|
||||
/* MS C doesn't return flags from int86() */
|
||||
#ifdef MSC
|
||||
# define USE_KBHIT
|
||||
#endif
|
||||
|
||||
#ifdef USE_KBHIT
|
||||
# include <conio.h>
|
||||
#endif
|
||||
|
||||
#include "pdcdos.h"
|
||||
|
||||
RCSID("$Id: pdckbd.c,v 1.87 2008/07/13 16:08:17 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****************************************************************/
|
||||
|
||||
#ifdef __DJGPP__
|
||||
# include <fcntl.h>
|
||||
# include <io.h>
|
||||
# include <signal.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* Table for key code translation of function keys in keypad mode *
|
||||
* These values are for strict IBM keyboard compatibles only *
|
||||
************************************************************************/
|
||||
|
||||
static short key_table[] =
|
||||
{
|
||||
-1, ALT_ESC, -1, 0,
|
||||
-1, -1, -1, -1,
|
||||
-1, -1, -1, -1,
|
||||
-1, -1, ALT_BKSP, KEY_BTAB,
|
||||
ALT_Q, ALT_W, ALT_E, ALT_R,
|
||||
ALT_T, ALT_Y, ALT_U, ALT_I,
|
||||
ALT_O, ALT_P, ALT_LBRACKET, ALT_RBRACKET,
|
||||
ALT_ENTER, -1, ALT_A, ALT_S,
|
||||
ALT_D, ALT_F, ALT_G, ALT_H,
|
||||
ALT_J, ALT_K, ALT_L, ALT_SEMICOLON,
|
||||
ALT_FQUOTE, ALT_BQUOTE, -1, ALT_BSLASH,
|
||||
ALT_Z, ALT_X, ALT_C, ALT_V,
|
||||
ALT_B, ALT_N, ALT_M, ALT_COMMA,
|
||||
ALT_STOP, ALT_FSLASH, -1, ALT_PADSTAR,
|
||||
-1, -1, -1, KEY_F(1),
|
||||
KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5),
|
||||
KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9),
|
||||
KEY_F(10), -1, -1, KEY_HOME,
|
||||
KEY_UP, KEY_PPAGE, ALT_PADMINUS, KEY_LEFT,
|
||||
KEY_B2, KEY_RIGHT, ALT_PADPLUS, KEY_END,
|
||||
KEY_DOWN, KEY_NPAGE, KEY_IC, KEY_DC,
|
||||
KEY_F(13), KEY_F(14), KEY_F(15), KEY_F(16),
|
||||
KEY_F(17), KEY_F(18), KEY_F(19), KEY_F(20),
|
||||
KEY_F(21), KEY_F(22), KEY_F(25), KEY_F(26),
|
||||
KEY_F(27), KEY_F(28), KEY_F(29), KEY_F(30),
|
||||
KEY_F(31), KEY_F(32), KEY_F(33), KEY_F(34),
|
||||
KEY_F(37), KEY_F(38), KEY_F(39), KEY_F(40),
|
||||
KEY_F(41), KEY_F(42), KEY_F(43), KEY_F(44),
|
||||
KEY_F(45), KEY_F(46), -1, CTL_LEFT,
|
||||
CTL_RIGHT, CTL_END, CTL_PGDN, CTL_HOME,
|
||||
ALT_1, ALT_2, ALT_3, ALT_4,
|
||||
ALT_5, ALT_6, ALT_7, ALT_8,
|
||||
ALT_9, ALT_0, ALT_MINUS, ALT_EQUAL,
|
||||
CTL_PGUP, KEY_F(11), KEY_F(12), KEY_F(23),
|
||||
KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47),
|
||||
KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER,
|
||||
CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL,
|
||||
CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME,
|
||||
ALT_UP, ALT_PGUP, -1, ALT_LEFT,
|
||||
-1, ALT_RIGHT, -1, ALT_END,
|
||||
ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL,
|
||||
ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1
|
||||
};
|
||||
|
||||
unsigned long pdc_key_modifiers = 0L;
|
||||
|
||||
static struct {unsigned short pressed, released;} button[3];
|
||||
|
||||
static bool mouse_avail = FALSE, mouse_vis = FALSE, mouse_moved = FALSE,
|
||||
mouse_button = FALSE, key_pressed = FALSE;
|
||||
|
||||
static unsigned char mouse_scroll = 0;
|
||||
static PDCREGS ms_regs, old_ms;
|
||||
static unsigned short shift_status, old_shift = 0;
|
||||
static unsigned char keyboard_function = 0xff, shift_function = 0xff,
|
||||
check_function = 0xff;
|
||||
|
||||
static const unsigned short button_map[3] = {0, 2, 1};
|
||||
|
||||
unsigned long PDC_get_input_fd(void)
|
||||
{
|
||||
PDC_LOG(("PDC_get_input_fd() - called\n"));
|
||||
|
||||
return (unsigned long)fileno(stdin);
|
||||
}
|
||||
|
||||
void PDC_set_keyboard_binary(bool on)
|
||||
{
|
||||
PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
|
||||
|
||||
#ifdef __DJGPP__
|
||||
setmode(fileno(stdin), on ? O_BINARY : O_TEXT);
|
||||
signal(SIGINT, on ? SIG_IGN : SIG_DFL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check if a key or mouse event is waiting */
|
||||
|
||||
bool PDC_check_key(void)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
if (shift_function == 0xff)
|
||||
{
|
||||
int scan;
|
||||
|
||||
/* get shift status for all keyboards */
|
||||
|
||||
regs.h.ah = 0x02;
|
||||
PDCINT(0x16, regs);
|
||||
scan = regs.h.al;
|
||||
|
||||
/* get shift status for enhanced keyboards */
|
||||
|
||||
regs.h.ah = 0x12;
|
||||
PDCINT(0x16, regs);
|
||||
|
||||
if (scan == regs.h.al && getdosmembyte(0x496) == 0x10)
|
||||
{
|
||||
keyboard_function = 0x10;
|
||||
check_function = 0x11;
|
||||
shift_function = 0x12;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyboard_function = 0;
|
||||
check_function = 1;
|
||||
shift_function = 2;
|
||||
}
|
||||
}
|
||||
|
||||
regs.h.ah = shift_function;
|
||||
PDCINT(0x16, regs);
|
||||
|
||||
shift_status = regs.W.ax;
|
||||
|
||||
if (mouse_vis)
|
||||
{
|
||||
unsigned short i;
|
||||
|
||||
ms_regs.W.ax = 3;
|
||||
PDCINT(0x33, ms_regs);
|
||||
|
||||
mouse_button = FALSE;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
regs.W.ax = 6;
|
||||
regs.W.bx = button_map[i];
|
||||
PDCINT(0x33, regs);
|
||||
button[i].released = regs.W.bx;
|
||||
if (regs.W.bx)
|
||||
{
|
||||
ms_regs.W.cx = regs.W.cx;
|
||||
ms_regs.W.dx = regs.W.dx;
|
||||
mouse_button = TRUE;
|
||||
}
|
||||
|
||||
regs.W.ax = 5;
|
||||
regs.W.bx = button_map[i];
|
||||
PDCINT(0x33, regs);
|
||||
button[i].pressed = regs.W.bx;
|
||||
if (regs.W.bx)
|
||||
{
|
||||
ms_regs.W.cx = regs.W.cx;
|
||||
ms_regs.W.dx = regs.W.dx;
|
||||
mouse_button = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
mouse_scroll = ms_regs.h.bh;
|
||||
|
||||
mouse_moved = !mouse_button && ms_regs.h.bl &&
|
||||
ms_regs.h.bl == old_ms.h.bl &&
|
||||
(((ms_regs.W.cx ^ old_ms.W.cx) >> 3) ||
|
||||
((ms_regs.W.dx ^ old_ms.W.dx) >> 3));
|
||||
|
||||
if (mouse_scroll || mouse_button || mouse_moved)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (old_shift && !shift_status) /* modifier released */
|
||||
{
|
||||
if (!key_pressed && SP->return_key_modifiers)
|
||||
return TRUE;
|
||||
}
|
||||
else if (!old_shift && shift_status) /* modifier pressed */
|
||||
key_pressed = FALSE;
|
||||
|
||||
old_shift = shift_status;
|
||||
|
||||
#ifndef USE_KBHIT
|
||||
regs.h.ah = check_function;
|
||||
PDCINT(0x16, regs);
|
||||
|
||||
return !(regs.W.flags & 64);
|
||||
#else
|
||||
return kbhit();
|
||||
#endif
|
||||
}
|
||||
|
||||
static int _process_mouse_events(void)
|
||||
{
|
||||
int i;
|
||||
short shift_flags = 0;
|
||||
|
||||
memset(&pdc_mouse_status, 0, sizeof(pdc_mouse_status));
|
||||
|
||||
key_pressed = TRUE;
|
||||
old_shift = shift_status;
|
||||
SP->key_code = TRUE;
|
||||
|
||||
/* Set shift modifiers */
|
||||
|
||||
if (shift_status & 3)
|
||||
shift_flags |= BUTTON_SHIFT;
|
||||
|
||||
if (shift_status & 4)
|
||||
shift_flags |= BUTTON_CONTROL;
|
||||
|
||||
if (shift_status & 8)
|
||||
shift_flags |= BUTTON_ALT;
|
||||
|
||||
/* Scroll wheel support for CuteMouse */
|
||||
|
||||
if (mouse_scroll)
|
||||
{
|
||||
pdc_mouse_status.changes = mouse_scroll & 0x80 ?
|
||||
PDC_MOUSE_WHEEL_UP : PDC_MOUSE_WHEEL_DOWN;
|
||||
|
||||
pdc_mouse_status.x = -1;
|
||||
pdc_mouse_status.y = -1;
|
||||
|
||||
return KEY_MOUSE;
|
||||
}
|
||||
|
||||
if (mouse_moved)
|
||||
{
|
||||
pdc_mouse_status.changes = PDC_MOUSE_MOVED;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (ms_regs.h.bl & (1 << button_map[i]))
|
||||
{
|
||||
pdc_mouse_status.button[i] = BUTTON_MOVED | shift_flags;
|
||||
pdc_mouse_status.changes |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* button event */
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (button[i].pressed)
|
||||
{
|
||||
/* Check for a click -- a PRESS followed
|
||||
immediately by a release */
|
||||
|
||||
if (!button[i].released)
|
||||
{
|
||||
if (SP->mouse_wait)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
napms(SP->mouse_wait);
|
||||
|
||||
regs.W.ax = 6;
|
||||
regs.W.bx = button_map[i];
|
||||
PDCINT(0x33, regs);
|
||||
|
||||
pdc_mouse_status.button[i] = regs.W.bx ?
|
||||
BUTTON_CLICKED : BUTTON_PRESSED;
|
||||
}
|
||||
else
|
||||
pdc_mouse_status.button[i] = BUTTON_PRESSED;
|
||||
}
|
||||
else
|
||||
pdc_mouse_status.button[i] = BUTTON_CLICKED;
|
||||
}
|
||||
|
||||
if (button[i].pressed || button[i].released)
|
||||
{
|
||||
pdc_mouse_status.button[i] |= shift_flags;
|
||||
pdc_mouse_status.changes |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pdc_mouse_status.x = ms_regs.W.cx >> 3;
|
||||
pdc_mouse_status.y = ms_regs.W.dx >> 3;
|
||||
|
||||
old_ms = ms_regs;
|
||||
|
||||
return KEY_MOUSE;
|
||||
}
|
||||
|
||||
/* return the next available key or mouse event */
|
||||
|
||||
int PDC_get_key(void)
|
||||
{
|
||||
PDCREGS regs;
|
||||
int key, scan;
|
||||
|
||||
pdc_key_modifiers = 0;
|
||||
|
||||
if (mouse_vis && (mouse_scroll || mouse_button || mouse_moved))
|
||||
return _process_mouse_events();
|
||||
|
||||
/* Return modifiers as keys? */
|
||||
|
||||
if (old_shift && !shift_status)
|
||||
{
|
||||
key = -1;
|
||||
|
||||
if (old_shift & 1)
|
||||
key = KEY_SHIFT_R;
|
||||
|
||||
if (old_shift & 2)
|
||||
key = KEY_SHIFT_L;
|
||||
|
||||
if (shift_function == 0x12)
|
||||
{
|
||||
if (old_shift & 0x400)
|
||||
key = KEY_CONTROL_R;
|
||||
|
||||
if (old_shift & 0x100)
|
||||
key = KEY_CONTROL_L;
|
||||
|
||||
if (old_shift & 0x800)
|
||||
key = KEY_ALT_R;
|
||||
|
||||
if (old_shift & 0x200)
|
||||
key = KEY_ALT_L;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (old_shift & 4)
|
||||
key = KEY_CONTROL_R;
|
||||
|
||||
if (old_shift & 8)
|
||||
key = KEY_ALT_R;
|
||||
}
|
||||
|
||||
key_pressed = FALSE;
|
||||
old_shift = shift_status;
|
||||
|
||||
SP->key_code = TRUE;
|
||||
return key;
|
||||
}
|
||||
|
||||
regs.h.ah = keyboard_function;
|
||||
PDCINT(0x16, regs);
|
||||
key = regs.h.al;
|
||||
scan = regs.h.ah;
|
||||
|
||||
if (SP->save_key_modifiers)
|
||||
{
|
||||
if (shift_status & 3)
|
||||
pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT;
|
||||
|
||||
if (shift_status & 4)
|
||||
pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL;
|
||||
|
||||
if (shift_status & 8)
|
||||
pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT;
|
||||
|
||||
if (shift_status & 0x20)
|
||||
pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK;
|
||||
}
|
||||
|
||||
if (scan == 0x1c && key == 0x0a) /* ^Enter */
|
||||
key = CTL_ENTER;
|
||||
else if (scan == 0xe0 && key == 0x0d) /* PadEnter */
|
||||
key = PADENTER;
|
||||
else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */
|
||||
key = CTL_PADENTER;
|
||||
else if (scan == 0x37 && key == 0x2a) /* Star */
|
||||
key = PADSTAR;
|
||||
else if (scan == 0x4a && key == 0x2d) /* Minus */
|
||||
key = PADMINUS;
|
||||
else if (scan == 0x4e && key == 0x2b) /* Plus */
|
||||
key = PADPLUS;
|
||||
else if (scan == 0xe0 && key == 0x2f) /* Slash */
|
||||
key = PADSLASH;
|
||||
else if (key == 0x00 || (key == 0xe0 && scan > 53 && scan != 86))
|
||||
key = (scan > 0xa7) ? -1 : key_table[scan];
|
||||
|
||||
if (shift_status & 3)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KEY_HOME: /* Shift Home */
|
||||
key = KEY_SHOME;
|
||||
break;
|
||||
case KEY_UP: /* Shift Up */
|
||||
key = KEY_SUP;
|
||||
break;
|
||||
case KEY_PPAGE: /* Shift PgUp */
|
||||
key = KEY_SPREVIOUS;
|
||||
break;
|
||||
case KEY_LEFT: /* Shift Left */
|
||||
key = KEY_SLEFT;
|
||||
break;
|
||||
case KEY_RIGHT: /* Shift Right */
|
||||
key = KEY_SRIGHT;
|
||||
break;
|
||||
case KEY_END: /* Shift End */
|
||||
key = KEY_SEND;
|
||||
break;
|
||||
case KEY_DOWN: /* Shift Down */
|
||||
key = KEY_SDOWN;
|
||||
break;
|
||||
case KEY_NPAGE: /* Shift PgDn */
|
||||
key = KEY_SNEXT;
|
||||
break;
|
||||
case KEY_IC: /* Shift Ins */
|
||||
key = KEY_SIC;
|
||||
break;
|
||||
case KEY_DC: /* Shift Del */
|
||||
key = KEY_SDC;
|
||||
}
|
||||
}
|
||||
|
||||
key_pressed = TRUE;
|
||||
SP->key_code = ((unsigned)key >= 256);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
/* discard any pending keyboard or mouse input -- this is the core
|
||||
routine for flushinp() */
|
||||
|
||||
void PDC_flushinp(void)
|
||||
{
|
||||
PDC_LOG(("PDC_flushinp() - called\n"));
|
||||
|
||||
/* Force the BIOS keyboard buffer head and tail pointers to be
|
||||
the same... Real nasty trick... */
|
||||
|
||||
setdosmemword(0x41a, getdosmemword(0x41c));
|
||||
}
|
||||
|
||||
int PDC_mouse_set(void)
|
||||
{
|
||||
PDCREGS regs;
|
||||
unsigned long mbe = SP->_trap_mbe;
|
||||
|
||||
if (mbe && !mouse_avail)
|
||||
{
|
||||
regs.W.ax = 0;
|
||||
PDCINT(0x33, regs);
|
||||
|
||||
mouse_avail = !!(regs.W.ax);
|
||||
}
|
||||
|
||||
if (mbe)
|
||||
{
|
||||
if (mouse_avail && !mouse_vis)
|
||||
{
|
||||
memset(&old_ms, 0, sizeof(old_ms));
|
||||
|
||||
regs.W.ax = 1;
|
||||
PDCINT(0x33, regs);
|
||||
|
||||
mouse_vis = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mouse_avail && mouse_vis)
|
||||
{
|
||||
regs.W.ax = 2;
|
||||
PDCINT(0x33, regs);
|
||||
|
||||
mouse_vis = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return (mouse_avail || !mbe) ? OK : ERR;
|
||||
}
|
||||
|
||||
int PDC_modifiers_set(void)
|
||||
{
|
||||
key_pressed = FALSE;
|
||||
|
||||
return OK;
|
||||
}
|
757
payloads/libpayload/curses/PDCurses/dos/pdcscrn.c
Normal file
757
payloads/libpayload/curses/PDCurses/dos/pdcscrn.c
Normal file
@@ -0,0 +1,757 @@
|
||||
/* Public Domain Curses */
|
||||
|
||||
#include "pdcdos.h"
|
||||
|
||||
RCSID("$Id: pdcscrn.c,v 1.89 2008/07/13 16:08:17 wmcbrine Exp $")
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef CHTYPE_LONG
|
||||
# define PDC_OFFSET 32
|
||||
#else
|
||||
# define PDC_OFFSET 8
|
||||
#endif
|
||||
|
||||
/* COLOR_PAIR to attribute encoding table. */
|
||||
|
||||
unsigned char *pdc_atrtab = (unsigned char *)NULL;
|
||||
|
||||
int pdc_adapter; /* screen type */
|
||||
int pdc_scrnmode; /* default screen mode */
|
||||
int pdc_font; /* default font size */
|
||||
bool pdc_direct_video; /* allow direct screen memory writes */
|
||||
bool pdc_bogus_adapter; /* TRUE if adapter has insane values */
|
||||
unsigned pdc_video_seg; /* video base segment */
|
||||
unsigned pdc_video_ofs; /* video base offset */
|
||||
|
||||
static short curstoreal[16], realtocurs[16] =
|
||||
{
|
||||
COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED,
|
||||
COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8,
|
||||
COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8,
|
||||
COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8
|
||||
};
|
||||
|
||||
static bool sizeable = FALSE; /* TRUE if adapter is resizeable */
|
||||
|
||||
static unsigned short *saved_screen = NULL;
|
||||
static int saved_lines = 0;
|
||||
static int saved_cols = 0;
|
||||
|
||||
static int saved_scrnmode[3];
|
||||
static int saved_font[3];
|
||||
|
||||
/* Thanks to Jeff Duntemann, K16RA for providing the impetus
|
||||
(through the Dr. Dobbs Journal, March 1989 issue) for getting
|
||||
the routines below merged into Bjorn Larsson's PDCurses 1.3...
|
||||
-- frotz@dri.com 900730 */
|
||||
|
||||
/* _get_font() - Get the current font size */
|
||||
|
||||
static int _get_font(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = getdosmemword(0x485);
|
||||
|
||||
/* Assume the MDS Genius is in 66 line mode. */
|
||||
|
||||
if ((retval == 0) && (pdc_adapter == _MDS_GENIUS))
|
||||
retval = _FONT15;
|
||||
|
||||
switch (pdc_adapter)
|
||||
{
|
||||
case _MDA:
|
||||
retval = 10; /* POINTS is not certain on MDA/Hercules */
|
||||
break;
|
||||
|
||||
case _EGACOLOR:
|
||||
case _EGAMONO:
|
||||
switch (retval)
|
||||
{
|
||||
case _FONT8:
|
||||
case _FONT14:
|
||||
break;
|
||||
default:
|
||||
retval = _FONT14;
|
||||
}
|
||||
break;
|
||||
|
||||
case _CGA:
|
||||
retval = _FONT8;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* _set_font() - Sets the current font size, if the adapter allows such a
|
||||
change. It is an error to attempt to change the font size on a
|
||||
"bogus" adapter. The reason for this is that we have a known video
|
||||
adapter identity problem. e.g. Two adapters report the same identifying
|
||||
characteristics. */
|
||||
|
||||
static void _set_font(int size)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
if (pdc_bogus_adapter)
|
||||
return;
|
||||
|
||||
switch (pdc_adapter)
|
||||
{
|
||||
case _CGA:
|
||||
case _MDA:
|
||||
case _MCGACOLOR:
|
||||
case _MCGAMONO:
|
||||
case _MDS_GENIUS:
|
||||
break;
|
||||
|
||||
case _EGACOLOR:
|
||||
case _EGAMONO:
|
||||
if (sizeable && (pdc_font != size))
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case _FONT8:
|
||||
regs.W.ax = 0x1112;
|
||||
regs.h.bl = 0x00;
|
||||
PDCINT(0x10, regs);
|
||||
break;
|
||||
case _FONT14:
|
||||
regs.W.ax = 0x1111;
|
||||
regs.h.bl = 0x00;
|
||||
PDCINT(0x10, regs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case _VGACOLOR:
|
||||
case _VGAMONO:
|
||||
if (sizeable && (pdc_font != size))
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case _FONT8:
|
||||
regs.W.ax = 0x1112;
|
||||
regs.h.bl = 0x00;
|
||||
PDCINT(0x10, regs);
|
||||
break;
|
||||
case _FONT14:
|
||||
regs.W.ax = 0x1111;
|
||||
regs.h.bl = 0x00;
|
||||
PDCINT(0x10, regs);
|
||||
break;
|
||||
case _FONT16:
|
||||
regs.W.ax = 0x1114;
|
||||
regs.h.bl = 0x00;
|
||||
PDCINT(0x10, regs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
curs_set(SP->visibility);
|
||||
|
||||
pdc_font = _get_font();
|
||||
}
|
||||
|
||||
/* _set_80x25() - force a known screen state: 80x25 text mode. Forces the
|
||||
appropriate 80x25 alpha mode given the display adapter. */
|
||||
|
||||
static void _set_80x25(void)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
switch (pdc_adapter)
|
||||
{
|
||||
case _CGA:
|
||||
case _EGACOLOR:
|
||||
case _EGAMONO:
|
||||
case _VGACOLOR:
|
||||
case _VGAMONO:
|
||||
case _MCGACOLOR:
|
||||
case _MCGAMONO:
|
||||
regs.h.ah = 0x00;
|
||||
regs.h.al = 0x03;
|
||||
PDCINT(0x10, regs);
|
||||
break;
|
||||
case _MDA:
|
||||
regs.h.ah = 0x00;
|
||||
regs.h.al = 0x07;
|
||||
PDCINT(0x10, regs);
|
||||
}
|
||||
}
|
||||
|
||||
/* _get_scrn_mode() - Return the current BIOS video mode */
|
||||
|
||||
static int _get_scrn_mode(void)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
regs.h.ah = 0x0f;
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
return (int)regs.h.al;
|
||||
}
|
||||
|
||||
/* _set_scrn_mode() - Sets the BIOS Video Mode Number only if it is
|
||||
different from the current video mode. */
|
||||
|
||||
static void _set_scrn_mode(int new_mode)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
if (_get_scrn_mode() != new_mode)
|
||||
{
|
||||
regs.h.ah = 0;
|
||||
regs.h.al = (unsigned char) new_mode;
|
||||
PDCINT(0x10, regs);
|
||||
}
|
||||
|
||||
pdc_font = _get_font();
|
||||
pdc_scrnmode = new_mode;
|
||||
LINES = PDC_get_rows();
|
||||
COLS = PDC_get_columns();
|
||||
}
|
||||
|
||||
/* _sanity_check() - A video adapter identification sanity check. This
|
||||
routine will force sane values for various control flags. */
|
||||
|
||||
static int _sanity_check(int adapter)
|
||||
{
|
||||
int fontsize = _get_font();
|
||||
int rows = PDC_get_rows();
|
||||
|
||||
PDC_LOG(("_sanity_check() - called: Adapter %d\n", adapter));
|
||||
|
||||
switch (adapter)
|
||||
{
|
||||
case _EGACOLOR:
|
||||
case _EGAMONO:
|
||||
switch (rows)
|
||||
{
|
||||
case 25:
|
||||
case 43:
|
||||
break;
|
||||
default:
|
||||
pdc_bogus_adapter = TRUE;
|
||||
}
|
||||
|
||||
switch (fontsize)
|
||||
{
|
||||
case _FONT8:
|
||||
case _FONT14:
|
||||
break;
|
||||
default:
|
||||
pdc_bogus_adapter = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case _VGACOLOR:
|
||||
case _VGAMONO:
|
||||
break;
|
||||
|
||||
case _CGA:
|
||||
case _MDA:
|
||||
case _MCGACOLOR:
|
||||
case _MCGAMONO:
|
||||
switch (rows)
|
||||
{
|
||||
case 25:
|
||||
break;
|
||||
default:
|
||||
pdc_bogus_adapter = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
pdc_bogus_adapter = TRUE;
|
||||
}
|
||||
|
||||
if (pdc_bogus_adapter)
|
||||
{
|
||||
sizeable = FALSE;
|
||||
pdc_direct_video = FALSE;
|
||||
}
|
||||
|
||||
return adapter;
|
||||
}
|
||||
|
||||
/* _query_adapter_type() - Determine PC video adapter type. */
|
||||
|
||||
static int _query_adapter_type(void)
|
||||
{
|
||||
PDCREGS regs;
|
||||
int retval = _NONE;
|
||||
|
||||
/* thanks to paganini@ax.apc.org for the GO32 fix */
|
||||
|
||||
#if !defined(__DJGPP__) && !defined(__WATCOMC__)
|
||||
struct SREGS segs;
|
||||
#endif
|
||||
short video_base = getdosmemword(0x463);
|
||||
|
||||
PDC_LOG(("_query_adapter_type() - called\n"));
|
||||
|
||||
/* attempt to call VGA Identify Adapter Function */
|
||||
|
||||
regs.W.ax = 0x1a00;
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
if ((regs.h.al == 0x1a) && (retval == _NONE))
|
||||
{
|
||||
/* We know that the PS/2 video BIOS is alive and well. */
|
||||
|
||||
switch (regs.h.al)
|
||||
{
|
||||
case 0:
|
||||
retval = _NONE;
|
||||
break;
|
||||
case 1:
|
||||
retval = _MDA;
|
||||
break;
|
||||
case 2:
|
||||
retval = _CGA;
|
||||
break;
|
||||
case 4:
|
||||
retval = _EGACOLOR;
|
||||
sizeable = TRUE;
|
||||
break;
|
||||
case 5:
|
||||
retval = _EGAMONO;
|
||||
break;
|
||||
case 26: /* ...alt. VGA BIOS... */
|
||||
case 7:
|
||||
retval = _VGACOLOR;
|
||||
sizeable = TRUE;
|
||||
break;
|
||||
case 8:
|
||||
retval = _VGAMONO;
|
||||
break;
|
||||
case 10:
|
||||
case 13:
|
||||
retval = _MCGACOLOR;
|
||||
break;
|
||||
case 12:
|
||||
retval = _MCGAMONO;
|
||||
break;
|
||||
default:
|
||||
retval = _CGA;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No VGA BIOS, check for an EGA BIOS by selecting an
|
||||
Alternate Function Service...
|
||||
|
||||
bx == 0x0010 --> return EGA information */
|
||||
|
||||
regs.h.ah = 0x12;
|
||||
regs.W.bx = 0x10;
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
if ((regs.h.bl != 0x10) && (retval == _NONE))
|
||||
{
|
||||
/* An EGA BIOS exists */
|
||||
|
||||
regs.h.ah = 0x12;
|
||||
regs.h.bl = 0x10;
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
if (regs.h.bh == 0)
|
||||
retval = _EGACOLOR;
|
||||
else
|
||||
retval = _EGAMONO;
|
||||
}
|
||||
else if (retval == _NONE)
|
||||
{
|
||||
/* Now we know we only have CGA or MDA */
|
||||
|
||||
PDCINT(0x11, regs);
|
||||
|
||||
switch (regs.h.al & 0x30)
|
||||
{
|
||||
case 0x10:
|
||||
case 0x20:
|
||||
retval = _CGA;
|
||||
break;
|
||||
case 0x30:
|
||||
retval = _MDA;
|
||||
break;
|
||||
default:
|
||||
retval = _NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (video_base == 0x3d4)
|
||||
{
|
||||
pdc_video_seg = 0xb800;
|
||||
switch (retval)
|
||||
{
|
||||
case _EGAMONO:
|
||||
retval = _EGACOLOR;
|
||||
break;
|
||||
case _VGAMONO:
|
||||
retval = _VGACOLOR;
|
||||
}
|
||||
}
|
||||
|
||||
if (video_base == 0x3b4)
|
||||
{
|
||||
pdc_video_seg = 0xb000;
|
||||
switch (retval)
|
||||
{
|
||||
case _EGACOLOR:
|
||||
retval = _EGAMONO;
|
||||
break;
|
||||
case _VGACOLOR:
|
||||
retval = _VGAMONO;
|
||||
}
|
||||
}
|
||||
|
||||
if ((retval == _NONE)
|
||||
#ifndef CGA_DIRECT
|
||||
|| (retval == _CGA)
|
||||
#endif
|
||||
)
|
||||
pdc_direct_video = FALSE;
|
||||
|
||||
if ((unsigned)pdc_video_seg == 0xb000)
|
||||
SP->mono = TRUE;
|
||||
else
|
||||
SP->mono = FALSE;
|
||||
|
||||
/* Check for DESQview shadow buffer
|
||||
thanks to paganini@ax.apc.org for the GO32 fix */
|
||||
|
||||
#ifndef __WATCOMC__
|
||||
regs.h.ah = 0xfe;
|
||||
regs.h.al = 0;
|
||||
regs.x.di = pdc_video_ofs;
|
||||
# ifdef __DJGPP__
|
||||
regs.x.es = pdc_video_seg;
|
||||
__dpmi_int(0x10, ®s);
|
||||
pdc_video_seg = regs.x.es;
|
||||
# else
|
||||
segs.es = pdc_video_seg;
|
||||
int86x(0x10, ®s, ®s, &segs);
|
||||
pdc_video_seg = segs.es;
|
||||
# endif
|
||||
pdc_video_ofs = regs.x.di;
|
||||
#endif
|
||||
if (!pdc_adapter)
|
||||
pdc_adapter = retval;
|
||||
|
||||
return _sanity_check(retval);
|
||||
}
|
||||
|
||||
/* close the physical screen -- may restore the screen to its state
|
||||
before PDC_scr_open(); miscellaneous cleanup */
|
||||
|
||||
void PDC_scr_close(void)
|
||||
{
|
||||
#if SMALL || MEDIUM
|
||||
# ifndef __PACIFIC__
|
||||
struct SREGS segregs;
|
||||
# endif
|
||||
int ds;
|
||||
#endif
|
||||
PDC_LOG(("PDC_scr_close() - called\n"));
|
||||
|
||||
if (getenv("PDC_RESTORE_SCREEN") && saved_screen)
|
||||
{
|
||||
#ifdef __DJGPP__
|
||||
dosmemput(saved_screen, saved_lines * saved_cols * 2,
|
||||
(unsigned long)_FAR_POINTER(pdc_video_seg,
|
||||
pdc_video_ofs));
|
||||
#else
|
||||
# if (SMALL || MEDIUM)
|
||||
# ifdef __PACIFIC__
|
||||
ds = FP_SEG((void far *)saved_screen);
|
||||
# else
|
||||
segread(&segregs);
|
||||
ds = segregs.ds;
|
||||
# endif
|
||||
movedata(ds, (int)saved_screen, pdc_video_seg, pdc_video_ofs,
|
||||
(saved_lines * saved_cols * 2));
|
||||
# else
|
||||
memcpy((void *)_FAR_POINTER(pdc_video_seg, pdc_video_ofs),
|
||||
(void *)saved_screen, (saved_lines * saved_cols * 2));
|
||||
# endif
|
||||
#endif
|
||||
free(saved_screen);
|
||||
saved_screen = NULL;
|
||||
}
|
||||
|
||||
reset_shell_mode();
|
||||
|
||||
if (SP->visibility != 1)
|
||||
curs_set(1);
|
||||
|
||||
/* Position cursor to the bottom left of the screen. */
|
||||
|
||||
PDC_gotoyx(PDC_get_rows() - 2, 0);
|
||||
}
|
||||
|
||||
void PDC_scr_free(void)
|
||||
{
|
||||
if (SP)
|
||||
free(SP);
|
||||
if (pdc_atrtab)
|
||||
free(pdc_atrtab);
|
||||
|
||||
pdc_atrtab = (unsigned char *)NULL;
|
||||
}
|
||||
|
||||
/* open the physical screen -- allocate SP, miscellaneous intialization,
|
||||
and may save the existing screen for later restoration */
|
||||
|
||||
int PDC_scr_open(int argc, char **argv)
|
||||
{
|
||||
#if SMALL || MEDIUM
|
||||
# ifndef __PACIFIC__
|
||||
struct SREGS segregs;
|
||||
# endif
|
||||
int ds;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
PDC_LOG(("PDC_scr_open() - called\n"));
|
||||
|
||||
SP = calloc(1, sizeof(SCREEN));
|
||||
pdc_atrtab = calloc(PDC_COLOR_PAIRS * PDC_OFFSET, 1);
|
||||
|
||||
if (!SP || !pdc_atrtab)
|
||||
return ERR;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
curstoreal[realtocurs[i]] = i;
|
||||
|
||||
SP->orig_attr = FALSE;
|
||||
|
||||
pdc_direct_video = TRUE; /* Assume that we can */
|
||||
pdc_video_seg = 0xb000; /* Base screen segment addr */
|
||||
pdc_video_ofs = 0x0; /* Base screen segment ofs */
|
||||
|
||||
pdc_adapter = _query_adapter_type();
|
||||
pdc_scrnmode = _get_scrn_mode();
|
||||
pdc_font = _get_font();
|
||||
|
||||
SP->lines = PDC_get_rows();
|
||||
SP->cols = PDC_get_columns();
|
||||
|
||||
SP->mouse_wait = PDC_CLICK_PERIOD;
|
||||
SP->audible = TRUE;
|
||||
|
||||
/* If the environment variable PDCURSES_BIOS is set, the DOS int10()
|
||||
BIOS calls are used in place of direct video memory access. */
|
||||
|
||||
if (getenv("PDCURSES_BIOS"))
|
||||
pdc_direct_video = FALSE;
|
||||
|
||||
/* This code for preserving the current screen. */
|
||||
|
||||
if (getenv("PDC_RESTORE_SCREEN"))
|
||||
{
|
||||
saved_lines = SP->lines;
|
||||
saved_cols = SP->cols;
|
||||
|
||||
saved_screen = malloc(saved_lines * saved_cols * 2);
|
||||
|
||||
if (!saved_screen)
|
||||
{
|
||||
SP->_preserve = FALSE;
|
||||
return OK;
|
||||
}
|
||||
#ifdef __DJGPP__
|
||||
dosmemget((unsigned long)_FAR_POINTER(pdc_video_seg, pdc_video_ofs),
|
||||
saved_lines * saved_cols * 2, saved_screen);
|
||||
#else
|
||||
# if SMALL || MEDIUM
|
||||
# ifdef __PACIFIC__
|
||||
ds = FP_SEG((void far *) saved_screen);
|
||||
# else
|
||||
segread(&segregs);
|
||||
ds = segregs.ds;
|
||||
# endif
|
||||
movedata(pdc_video_seg, pdc_video_ofs, ds, (int)saved_screen,
|
||||
(saved_lines * saved_cols * 2));
|
||||
# else
|
||||
memcpy((void *)saved_screen,
|
||||
(void *)_FAR_POINTER(pdc_video_seg, pdc_video_ofs),
|
||||
(saved_lines * saved_cols * 2));
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* the core of resize_term() */
|
||||
|
||||
int PDC_resize_screen(int nlines, int ncols)
|
||||
{
|
||||
PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n",
|
||||
nlines, ncols));
|
||||
|
||||
/* Trash the stored value of orig_cursor -- it's only good if the
|
||||
video mode doesn't change */
|
||||
|
||||
SP->orig_cursor = 0x0607;
|
||||
|
||||
switch (pdc_adapter)
|
||||
{
|
||||
case _EGACOLOR:
|
||||
if (nlines >= 43)
|
||||
_set_font(_FONT8);
|
||||
else
|
||||
_set_80x25();
|
||||
break;
|
||||
|
||||
case _VGACOLOR:
|
||||
if (nlines > 28)
|
||||
_set_font(_FONT8);
|
||||
else
|
||||
if (nlines > 25)
|
||||
_set_font(_FONT14);
|
||||
else
|
||||
_set_80x25();
|
||||
}
|
||||
|
||||
PDC_set_blink(COLORS == 8);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void PDC_reset_prog_mode(void)
|
||||
{
|
||||
PDC_LOG(("PDC_reset_prog_mode() - called.\n"));
|
||||
}
|
||||
|
||||
void PDC_reset_shell_mode(void)
|
||||
{
|
||||
PDC_LOG(("PDC_reset_shell_mode() - called.\n"));
|
||||
}
|
||||
|
||||
void PDC_restore_screen_mode(int i)
|
||||
{
|
||||
if (i >= 0 && i <= 2)
|
||||
{
|
||||
pdc_font = _get_font();
|
||||
_set_font(saved_font[i]);
|
||||
|
||||
if (_get_scrn_mode() != saved_scrnmode[i])
|
||||
_set_scrn_mode(saved_scrnmode[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void PDC_save_screen_mode(int i)
|
||||
{
|
||||
if (i >= 0 && i <= 2)
|
||||
{
|
||||
saved_font[i] = pdc_font;
|
||||
saved_scrnmode[i] = pdc_scrnmode;
|
||||
}
|
||||
}
|
||||
|
||||
void PDC_init_pair(short pair, short fg, short bg)
|
||||
{
|
||||
unsigned char att, temp_bg;
|
||||
chtype i;
|
||||
|
||||
fg = curstoreal[fg];
|
||||
bg = curstoreal[bg];
|
||||
|
||||
for (i = 0; i < PDC_OFFSET; i++)
|
||||
{
|
||||
att = fg | (bg << 4);
|
||||
|
||||
if (i & (A_REVERSE >> PDC_ATTR_SHIFT))
|
||||
att = bg | (fg << 4);
|
||||
if (i & (A_UNDERLINE >> PDC_ATTR_SHIFT))
|
||||
att = 1;
|
||||
if (i & (A_INVIS >> PDC_ATTR_SHIFT))
|
||||
{
|
||||
temp_bg = att >> 4;
|
||||
att = temp_bg << 4 | temp_bg;
|
||||
}
|
||||
if (i & (A_BOLD >> PDC_ATTR_SHIFT))
|
||||
att |= 8;
|
||||
if (i & (A_BLINK >> PDC_ATTR_SHIFT))
|
||||
att |= 128;
|
||||
|
||||
pdc_atrtab[pair * PDC_OFFSET + i] = att;
|
||||
}
|
||||
}
|
||||
|
||||
int PDC_pair_content(short pair, short *fg, short *bg)
|
||||
{
|
||||
*fg = realtocurs[pdc_atrtab[pair * PDC_OFFSET] & 0x0F];
|
||||
*bg = realtocurs[(pdc_atrtab[pair * PDC_OFFSET] & 0xF0) >> 4];
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* _egapal() - Find the EGA palette value (0-63) for the color (0-15).
|
||||
On VGA, this is an index into the DAC. */
|
||||
|
||||
static short _egapal(short color)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
regs.W.ax = 0x1007;
|
||||
regs.h.bl = curstoreal[color];
|
||||
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
return regs.h.bh;
|
||||
}
|
||||
|
||||
bool PDC_can_change_color(void)
|
||||
{
|
||||
return (pdc_adapter == _VGACOLOR);
|
||||
}
|
||||
|
||||
/* These are only valid when pdc_adapter == _VGACOLOR */
|
||||
|
||||
int PDC_color_content(short color, short *red, short *green, short *blue)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
/* Read single DAC register */
|
||||
|
||||
regs.W.ax = 0x1015;
|
||||
regs.h.bl = _egapal(color);
|
||||
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
/* Scale and store */
|
||||
|
||||
*red = DIVROUND((unsigned)(regs.h.dh) * 1000, 63);
|
||||
*green = DIVROUND((unsigned)(regs.h.ch) * 1000, 63);
|
||||
*blue = DIVROUND((unsigned)(regs.h.cl) * 1000, 63);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int PDC_init_color(short color, short red, short green, short blue)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
/* Scale */
|
||||
|
||||
regs.h.dh = DIVROUND((unsigned)red * 63, 1000);
|
||||
regs.h.ch = DIVROUND((unsigned)green * 63, 1000);
|
||||
regs.h.cl = DIVROUND((unsigned)blue * 63, 1000);
|
||||
|
||||
/* Set single DAC register */
|
||||
|
||||
regs.W.ax = 0x1010;
|
||||
regs.W.bx = _egapal(color);
|
||||
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
return OK;
|
||||
}
|
99
payloads/libpayload/curses/PDCurses/dos/pdcsetsc.c
Normal file
99
payloads/libpayload/curses/PDCurses/dos/pdcsetsc.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/* Public Domain Curses */
|
||||
|
||||
#include "pdcdos.h"
|
||||
|
||||
RCSID("$Id: pdcsetsc.c,v 1.39 2008/07/13 16:08:17 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)
|
||||
{
|
||||
PDCREGS regs;
|
||||
int ret_vis, start, end;
|
||||
|
||||
PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
|
||||
|
||||
ret_vis = SP->visibility;
|
||||
SP->visibility = visibility;
|
||||
|
||||
switch (visibility)
|
||||
{
|
||||
case 0: /* invisible */
|
||||
start = 32;
|
||||
end = 0; /* was 32 */
|
||||
break;
|
||||
case 2: /* highly visible */
|
||||
start = 0; /* full-height block */
|
||||
end = 7;
|
||||
break;
|
||||
default: /* normal visibility */
|
||||
start = (SP->orig_cursor >> 8) & 0xff;
|
||||
end = SP->orig_cursor & 0xff;
|
||||
}
|
||||
|
||||
/* if scrnmode is not set, some BIOSes hang */
|
||||
|
||||
regs.h.ah = 0x01;
|
||||
regs.h.al = (unsigned char)pdc_scrnmode;
|
||||
regs.h.ch = (unsigned char)start;
|
||||
regs.h.cl = (unsigned char)end;
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
return ret_vis;
|
||||
}
|
||||
|
||||
void PDC_set_title(const char *title)
|
||||
{
|
||||
PDC_LOG(("PDC_set_title() - called: <%s>\n", title));
|
||||
}
|
||||
|
||||
int PDC_set_blink(bool blinkon)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
switch (pdc_adapter)
|
||||
{
|
||||
case _EGACOLOR:
|
||||
case _EGAMONO:
|
||||
case _VGACOLOR:
|
||||
case _VGAMONO:
|
||||
regs.W.ax = 0x1003;
|
||||
regs.W.bx = blinkon;
|
||||
|
||||
PDCINT(0x10, regs);
|
||||
|
||||
if (pdc_color_started)
|
||||
COLORS = blinkon ? 8 : 16;
|
||||
|
||||
break;
|
||||
default:
|
||||
COLORS = 8;
|
||||
}
|
||||
|
||||
return (COLORS - (blinkon * 8) != 8) ? OK : ERR;
|
||||
}
|
105
payloads/libpayload/curses/PDCurses/dos/pdcutil.c
Normal file
105
payloads/libpayload/curses/PDCurses/dos/pdcutil.c
Normal file
@@ -0,0 +1,105 @@
|
||||
/* Public Domain Curses */
|
||||
|
||||
#include "pdcdos.h"
|
||||
|
||||
RCSID("$Id: pdcutil.c,v 1.24 2008/07/13 16:08:17 wmcbrine Exp $")
|
||||
|
||||
void PDC_beep(void)
|
||||
{
|
||||
PDCREGS regs;
|
||||
|
||||
PDC_LOG(("PDC_beep() - called\n"));
|
||||
|
||||
regs.W.ax = 0x0e07; /* Write ^G in TTY fashion */
|
||||
regs.W.bx = 0;
|
||||
PDCINT(0x10, regs);
|
||||
}
|
||||
|
||||
void PDC_napms(int ms)
|
||||
{
|
||||
PDCREGS regs;
|
||||
long goal, start, current;
|
||||
|
||||
PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
|
||||
|
||||
goal = DIVROUND((long)ms, 50);
|
||||
if (!goal)
|
||||
goal++;
|
||||
|
||||
start = getdosmemdword(0x46c);
|
||||
|
||||
goal += start;
|
||||
|
||||
while (goal > (current = getdosmemdword(0x46c)))
|
||||
{
|
||||
if (current < start) /* in case of midnight reset */
|
||||
return;
|
||||
|
||||
regs.W.ax = 0x1680;
|
||||
PDCINT(0x2f, regs);
|
||||
PDCINT(0x28, regs);
|
||||
}
|
||||
}
|
||||
|
||||
const char *PDC_sysname(void)
|
||||
{
|
||||
return "DOS";
|
||||
}
|
||||
|
||||
#ifdef __DJGPP__
|
||||
|
||||
unsigned char getdosmembyte(int offset)
|
||||
{
|
||||
unsigned char b;
|
||||
|
||||
dosmemget(offset, sizeof(unsigned char), &b);
|
||||
return b;
|
||||
}
|
||||
|
||||
unsigned short getdosmemword(int offset)
|
||||
{
|
||||
unsigned short w;
|
||||
|
||||
dosmemget(offset, sizeof(unsigned short), &w);
|
||||
return w;
|
||||
}
|
||||
|
||||
unsigned long getdosmemdword(int offset)
|
||||
{
|
||||
unsigned long dw;
|
||||
|
||||
dosmemget(offset, sizeof(unsigned long), &dw);
|
||||
return dw;
|
||||
}
|
||||
|
||||
void setdosmembyte(int offset, unsigned char b)
|
||||
{
|
||||
dosmemput(&b, sizeof(unsigned char), offset);
|
||||
}
|
||||
|
||||
void setdosmemword(int offset, unsigned short w)
|
||||
{
|
||||
dosmemput(&w, sizeof(unsigned short), offset);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
|
||||
void PDC_dpmi_int(int vector, pdc_dpmi_regs *rmregs)
|
||||
{
|
||||
union REGPACK regs = {0};
|
||||
|
||||
rmregs->w.ss = 0;
|
||||
rmregs->w.sp = 0;
|
||||
rmregs->w.flags = 0;
|
||||
|
||||
regs.w.ax = 0x300;
|
||||
regs.h.bl = vector;
|
||||
regs.x.edi = FP_OFF(rmregs);
|
||||
regs.x.es = FP_SEG(rmregs);
|
||||
|
||||
intr(0x31, ®s);
|
||||
}
|
||||
|
||||
#endif
|
48
payloads/libpayload/curses/PDCurses/dos/wccdos16.mak
Normal file
48
payloads/libpayload/curses/PDCurses/dos/wccdos16.mak
Normal file
@@ -0,0 +1,48 @@
|
||||
# Watcom WMAKE Makefile for PDCurses library - DOS (16 bit) Watcom C/C++ 10.6+
|
||||
#
|
||||
# Usage: wmake -f [path\]wccdos16.mak [DEBUG=Y] [target]
|
||||
#
|
||||
# where target can be any of:
|
||||
# [all|demos|pdcurses.lib|testcurs.exe...]
|
||||
|
||||
# Change the memory MODEL here, if desired
|
||||
MODEL = l
|
||||
|
||||
!ifdef %PDCURSES_SRCDIR
|
||||
PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR)
|
||||
!else
|
||||
PDCURSES_SRCDIR = ..
|
||||
!endif
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\version.mif
|
||||
|
||||
osdir = $(PDCURSES_SRCDIR)\dos
|
||||
|
||||
CC = wcc
|
||||
TARGET = dos
|
||||
|
||||
CFLAGS = /bt=$(TARGET) /zq /wx /m$(MODEL) /i=$(PDCURSES_SRCDIR)
|
||||
|
||||
!ifeq DEBUG Y
|
||||
CFLAGS += /d2 /DPDCDEBUG
|
||||
LDFLAGS = D W A op q sys $(TARGET)
|
||||
!else
|
||||
CFLAGS += /oneatx
|
||||
LDFLAGS = op q sys $(TARGET)
|
||||
!endif
|
||||
|
||||
LIBEXE = wlib /q /n /t
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\watcom.mif
|
||||
|
||||
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
|
||||
%write wccdos.lrf $(LIBOBJS) $(PDCOBJS)
|
||||
$(LIBEXE) $@ @wccdos.lrf
|
||||
-del wccdos.lrf
|
||||
-copy $(LIBCURSES) panel.lib
|
||||
|
||||
PLATFORM1 = Watcom C++ 16-bit DOS
|
||||
PLATFORM2 = Open Watcom 1.6 for 16-bit DOS
|
||||
ARCNAME = pdc$(VER)16w
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\makedist.mif
|
45
payloads/libpayload/curses/PDCurses/dos/wccdos4g.mak
Normal file
45
payloads/libpayload/curses/PDCurses/dos/wccdos4g.mak
Normal file
@@ -0,0 +1,45 @@
|
||||
# Watcom WMAKE Makefile for PDCurses library - DOS/4GW Watcom C/C++ 10.6+
|
||||
#
|
||||
# Usage: wmake -f [path\]wccdos4g.mak [DEBUG=Y] [target]
|
||||
#
|
||||
# where target can be any of:
|
||||
# [all|demos|pdcurses.lib|testcurs.exe...]
|
||||
|
||||
!ifdef %PDCURSES_SRCDIR
|
||||
PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR)
|
||||
!else
|
||||
PDCURSES_SRCDIR = ..
|
||||
!endif
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\version.mif
|
||||
|
||||
osdir = $(PDCURSES_SRCDIR)\dos
|
||||
|
||||
CC = wcc386
|
||||
TARGET = dos4g
|
||||
|
||||
CFLAGS = /bt=$(TARGET) /zq /wx /mf /i=$(PDCURSES_SRCDIR)
|
||||
|
||||
!ifeq DEBUG Y
|
||||
CFLAGS += /d2 /DPDCDEBUG
|
||||
LDFLAGS = D W A op q sys $(TARGET)
|
||||
!else
|
||||
CFLAGS += /oneatx
|
||||
LDFLAGS = op q sys $(TARGET)
|
||||
!endif
|
||||
|
||||
LIBEXE = wlib /q /n /t
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\watcom.mif
|
||||
|
||||
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
|
||||
%write wccdos.lrf $(LIBOBJS) $(PDCOBJS)
|
||||
$(LIBEXE) $@ @wccdos.lrf
|
||||
-del wccdos.lrf
|
||||
-copy $(LIBCURSES) panel.lib
|
||||
|
||||
PLATFORM1 = Watcom C++ 32-bit DOS
|
||||
PLATFORM2 = Open Watcom 1.6 for 32-bit DOS
|
||||
ARCNAME = pdc$(VER)32w
|
||||
|
||||
!include $(PDCURSES_SRCDIR)\makedist.mif
|
Reference in New Issue
Block a user