@@ -0,0 +1,108 @@
# Makefile for PDCurses library for X11

SHELL = @SHELL@

@SET_MAKE@

srcdir =@srcdir@
prefix =@prefix@
exec_prefix =$(DESTDIR)@exec_prefix@
libdir =$(exec_prefix)/lib
bindir =$(exec_prefix)/bin
includedir =$(exec_prefix)/include
pdcursesdir =./x11

INSTALL =$(srcdir)/install-sh
RANLIB =@RANLIB@
SHLPRE = @SHLPRE@
SHLPST = @SHLPST@
SHLFILE = XCurses

include $(srcdir)/version.mif

PDC_DIR=PDCurses-$(VERDOT)

ZIPFILE = pdcurs$(VER).zip
TARBALL = $(PDC_DIR).tar.gz

all \
clean \
distclean \
mostlyclean \
realclean ::
cd x11; $(MAKE) $(MFLAGS) $@
cd doc; $(MAKE) $(MFLAGS) $@

install ::
$(INSTALL) -d -m 755 $(libdir)
$(INSTALL) -d -m 755 $(bindir)
$(INSTALL) -d -m 755 $(includedir)
$(INSTALL) -d -m 755 $(includedir)/xcurses
$(INSTALL) -c -m 644 $(srcdir)/curses.h $(includedir)/xcurses.h
$(INSTALL) -c -m 644 $(srcdir)/curses.h $(includedir)/xcurses/curses.h
sed -e 's/#include <curses.h>/#include <xcurses.h>/' \
< $(srcdir)/panel.h > ./xpanel.h
$(INSTALL) -m 644 ./xpanel.h $(includedir)/xpanel.h
$(INSTALL) -c -m 644 $(srcdir)/panel.h $(includedir)/xcurses/panel.h
$(INSTALL) -c -m 644 $(srcdir)/term.h $(includedir)/xcurses/term.h
$(INSTALL) -c -m 644 $(pdcursesdir)/libXCurses.a $(libdir)/libXCurses.a
-$(RANLIB) $(libdir)/libXCurses.a
-$(INSTALL) -c -m 755 $(pdcursesdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) \
$(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST)
ln -f -s $(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) \
$(libdir)/$(SHLPRE)Xpanel$(SHLPST)
ln -f -s $(libdir)/libXCurses.a $(libdir)/libXpanel.a
-$(RANLIB) $(libdir)/libXpanel.a
$(INSTALL) -c -m 755 x11/xcurses-config $(bindir)/xcurses-config

clean ::
rm -f config.log config.cache config.status

distclean ::
rm -f config.log config.cache config.status
rm -f config.h Makefile x11/xcurses-config

manual:
cd doc; $(MAKE) $(MFLAGS) $@

$(ZIPFILE):
zip -9y $(ZIPFILE) README HISTORY IMPLEMNT *.spec *.mif *.def \
Makefile.in config.h.in configure configure.ac config.guess \
config.sub x11/xcurses-config.in install-sh aclocal.m4 curses.h \
curspriv.h panel.h term.h pdcurses/README \
pdcurses/*.c demos/README demos/*.c demos/*.h dos/README dos/*.c \
dos/*.h dos/*.mak dos/*.lrf os2/README os2/*.c os2/*.h os2/*.mak \
os2/*.lrf sdl1/README sdl1/*.c sdl1/*.h sdl1/Make* \
win32/README win32/*.c win32/*.h win32/*.mak \
win32/*.ico win32/*.rc x11/README x11/*.c x11/*.h x11/Makefile.* \
x11/*.xbm doc/*.txt doc/manext.c doc/Makefile

zip: $(ZIPFILE)

../$(TARBALL):
(cd ..; tar cvf - $(PDC_DIR)/README $(PDC_DIR)/HISTORY \
$(PDC_DIR)/IMPLEMNT $(PDC_DIR)/*.spec $(PDC_DIR)/*.mif \
$(PDC_DIR)/*.def $(PDC_DIR)/Makefile.in $(PDC_DIR)/aclocal.m4 \
$(PDC_DIR)/config.h.in $(PDC_DIR)/configure \
$(PDC_DIR)/config.guess $(PDC_DIR)/x11/xcurses-config.in \
$(PDC_DIR)/config.sub $(PDC_DIR)/configure.ac \
$(PDC_DIR)/install-sh $(PDC_DIR)/curses.h $(PDC_DIR)/curspriv.h \
$(PDC_DIR)/panel.h $(PDC_DIR)/term.h \
$(PDC_DIR)/pdcurses/README $(PDC_DIR)/pdcurses/*.c \
$(PDC_DIR)/demos/README $(PDC_DIR)/demos/*.c $(PDC_DIR)/demos/*.h \
$(PDC_DIR)/doc/*.txt $(PDC_DIR)/dos/README $(PDC_DIR)/dos/*.c \
$(PDC_DIR)/dos/*.h $(PDC_DIR)/dos/*.mak $(PDC_DIR)/dos/*.lrf \
$(PDC_DIR)/os2/README $(PDC_DIR)/os2/*.c $(PDC_DIR)/os2/*.h \
$(PDC_DIR)/os2/*.mak $(PDC_DIR)/os2/*.lrf \
$(PDC_DIR)/sdl1/README $(PDC_DIR)/sdl1/*.c $(PDC_DIR)/sdl1/*.h \
$(PDC_DIR)/sdl1/Make* $(PDC_DIR)/win32/README $(PDC_DIR)/win32/*.c \
$(PDC_DIR)/win32/*.h $(PDC_DIR)/win32/*.mak \
$(PDC_DIR)/win32/*.ico $(PDC_DIR)/win32/*.rc $(PDC_DIR)/x11/README \
$(PDC_DIR)/x11/*.c $(PDC_DIR)/x11/*.xbm $(PDC_DIR)/x11/*.h \
$(PDC_DIR)/x11/Makefile.* $(PDC_DIR)/doc/manext.c \
$(PDC_DIR)/doc/Makefile | gzip -9 > $(TARBALL))

dist: ../$(TARBALL)

rpm: ../$(TARBALL)
rpmbuild -ba $(srcdir)/PDCurses.spec
@@ -0,0 +1,52 @@
# $Id: PDCurses.spec,v 1.18 2008/07/21 12:25:20 wmcbrine Exp $

%define ver 34
%define verdot 3.4
%define base /usr

Summary: Public Domain Curses for X11
Name: PDCurses
Version: %verdot
Release: 1
Copyright: Public Domain
Group: Development/Libraries
Source: %{name}-%{version}.tar.gz
URL: http://pdcurses.sourceforge.net
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Prefix: %base

%description
PDCurses for X11 is an implementation of the curses library that lets
you build text-mode curses programs as native X11 applications. For more
information, visit http://pdcurses.sourceforge.net/

%prep
%setup -q

%build
./configure --prefix=%{base}
make

%install
make DESTDIR=$RPM_BUILD_ROOT install

%clean
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/%{name}-%{version}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README HISTORY
%{base}/bin/xcurses-config
%{base}/lib/libXCurses.a
%{base}/lib/libXpanel.a
%{base}/lib/libXCurses.so
%{base}/include/xcurses.h
%{base}/include/xpanel.h
%{base}/include/xcurses/curses.h
%{base}/include/xcurses/panel.h
%{base}/include/xcurses/term.h
@@ -0,0 +1,48 @@
Welcome to PDCurses!
====================

Public Domain Curses, aka PDCurses, is an implementation of X/Open
curses for multiple platforms. The latest version can be found at:

http://pdcurses.sourceforge.net/

For changes, see the HISTORY file.


Legal Stuff
-----------

The core package is in the public domain, but small portions of PDCurses
are subject to copyright under various licenses. Each directory
contains a README file, with a section titled "Distribution Status"
which describes the status of the files in that directory.

If you use PDCurses in an application, an acknowledgement would be
appreciated, but is not mandatory. If you make corrections or
enhancements to PDCurses, please forward them to the current maintainer
for the benefit of other users.

This software is provided AS IS with NO WARRANTY whatsoever.


Ports
-----

PDCurses has been ported to DOS, OS/2, Win32, X11 and SDL. A directory
containing the port-specific source files exists for each of these
platforms. Build instructions are in the README file for each platform.


Distribution Status
-------------------

All files in this directory except configure, config.guess and
config.sub are released to the Public Domain. config.guess and
config.sub are under the GPL; configure is under a free license
described within it.


Maintainer
----------

William McBrine <wmcbrine@users.sf.net>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,134 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */

/* Define if you have the <DECkeySym.h> header file */
#define HAVE_DECKEYSYM_H 1

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the <dl.h> header file. */
/* #undef HAVE_DL_H */

/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define if you have the <Sunkeysym.h> header file */
#define HAVE_SUNKEYSYM_H 1

/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if you have the `usleep' function. */
#define HAVE_USLEEP 1

/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1

/* Define to 1 if you have the `vsscanf' function. */
#define HAVE_VSSCANF 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_BEGIN 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_DELETE 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_DOWN 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_END 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_HOME 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_INSERT 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_LEFT 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_NEXT 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_PRIOR 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_RIGHT 1

/* Define if you have this defined in <keysym.h> */
#define HAVE_XK_KP_UP 1

/* Define if you have the <xpm.h> header file */
#define HAVE_XPM_H 1

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "wmcbrine@users.sf.net"

/* Define to the full name of this package. */
#define PACKAGE_NAME "PDCurses"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "PDCurses 3.4"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "PDCurses"

/* Define to the version of this package. */
#define PACKAGE_VERSION "3.4"

/* Define as the system defined limit for number of signals */
#define PDC_MAX_SIGNALS NSIG

/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1

/* Define if you want to use neXtaw library */
/* #undef USE_NEXTAW */

/* Define if you want to use Xaw3d library */
/* #undef USE_XAW3D */

/* Define XPointer is typedefed in X11/Xlib.h */
#define XPOINTER_TYPEDEFED 1
@@ -0,0 +1,133 @@
/* config.h.in. Generated from configure.ac by autoheader. */

/* Define if you have the <DECkeySym.h> header file */
#undef HAVE_DECKEYSYM_H

/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H

/* Define to 1 if you have the <dl.h> header file. */
#undef HAVE_DL_H

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the `poll' function. */
#undef HAVE_POLL

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define if you have the <Sunkeysym.h> header file */
#undef HAVE_SUNKEYSYM_H

/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP

/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF

/* Define to 1 if you have the `vsscanf' function. */
#undef HAVE_VSSCANF

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_BEGIN

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_DELETE

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_DOWN

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_END

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_HOME

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_INSERT

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_LEFT

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_NEXT

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_PRIOR

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_RIGHT

/* Define if you have this defined in <keysym.h> */
#undef HAVE_XK_KP_UP

/* Define if you have the <xpm.h> header file */
#undef HAVE_XPM_H

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define as the system defined limit for number of signals */
#undef PDC_MAX_SIGNALS

/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME

/* Define if you want to use neXtaw library */
#undef USE_NEXTAW

/* Define if you want to use Xaw3d library */
#undef USE_XAW3D

/* Define XPointer is typedefed in X11/Xlib.h */
#undef XPOINTER_TYPEDEFED

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,285 @@
dnl $Id: configure.ac,v 1.35 2008/07/21 12:19:21 wmcbrine Exp $
dnl Process this file with autoconf to produce a configure script.

AC_INIT([PDCurses], [3.4], [wmcbrine@users.sf.net], [PDCurses])
AC_CONFIG_SRCDIR([curspriv.h])

AC_SUBST(prefix)

AC_PROG_CC

AC_CONFIG_HEADER(config.h)
dnl Checks for system first
AC_CANONICAL_SYSTEM([])

mymakefile="Makefile"
on_qnx=no
case "$target" in
*hp-hpux*)
SYS_DEFS="-D_HPUX_SOURCE"
;;
*ibm-aix*)
SYS_DEFS="-D_ALL_SOURCE"
mymakefile="Makefile.aix"
;;
*dec-osf*)
SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED"
;;
*pc-sco*)
SYS_DEFS="-UM_XENIX -b elf"
;;
*qnx*)
on_qnx=yes
SYS_DEFS="-Q"
;;
*)
;;
esac
AC_SUBST(SYS_DEFS)

MH_CHECK_MAX_SIGNALS(NSIG __sys_nsig)

dnl Check for other programs.
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_MAKE_SET

dnl ensure that the system has System V IPC support
MH_IPC

if test $ac_cv_header_stdc != yes; then
AC_MSG_ERROR([Need ANSI C headers])
fi

dnl Checks for libraries.

AC_CHECK_HEADERS(fcntl.h \
sys/time.h \
sys/select.h \
dlfcn.h \
dl.h
)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
MH_CHECK_LIB(socket nls)
AC_SUBST(MH_EXTRA_LIBS)
MH_CHECK_CC_O

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(vsscanf usleep poll vsnprintf)

dnl Check for X includes and X libraries
AC_PATH_X
MH_CHECK_X_INC
MH_CHECK_X_LIB
MH_CHECK_X_HEADERS(DECkeysym.h Sunkeysym.h xpm.h)
MH_CHECK_X_KEYDEFS(XK_KP_Delete XK_KP_Insert XK_KP_End XK_KP_Down XK_KP_Next \
XK_KP_Left XK_KP_Right XK_KP_Home XK_KP_Up XK_KP_Prior XK_KP_Begin)
MH_CHECK_X_TYPEDEF(XPointer)
dnl
dnl extra for xpm library
if test $ac_cv_header_xpm_h = yes; then
MH_XLIBS="$MH_XLIBS -lXpm"
fi
dnl ---------- allow --enable-debug to compile in debug mode ---------
AC_ARG_ENABLE(debug,
[ --enable-debug turn on debugging],
[with_debug=$enableval],
[with_debug=no],
)
cflags_g="`echo $CFLAGS | grep -c '\-g'`"
cflags_O="`echo $CFLAGS | grep -c '\-O'`"

if test "$with_debug" = yes; then
if test "$cflags_g" = "0"; then
CFLAGS="${CFLAGS} -g"
fi
if test "$cflags_O" != "0"; then
CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`"
fi
CFLAGS="${CFLAGS} -DPDCDEBUG"
else
if test "$cflags_O" = "0"; then
CFLAGS="${CFLAGS} -O"
fi
if test "$cflags_g" != "0"; then
CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`"
fi
fi
if test "$ac_cv_prog_CC" = "gcc"; then
if test "$with_debug" = yes; then
CFLAGS="${CFLAGS} -Wall"
else
CFLAGS="-O2 -Wall -fomit-frame-pointer"
fi
fi
if test "$on_qnx" = yes; then
if test "$with_debug" = yes; then
CFLAGS="-g"
else
CFLAGS="-Otax"
fi
fi

dnl --------------- check for wide character support -----------------
dnl allow --enable-widec to include wide character support
AC_ARG_ENABLE(widec,
[ --enable-widec include support for wide characters],
[with_widec=$enableval],
[with_widec=no],
)
if test "$with_widec" = yes; then
SYS_DEFS="$SYS_DEFS -DPDC_WIDE"
fi

dnl -------------------- check for XIM support -----------------------
dnl allow --enable-xim to include XIM support
AC_ARG_ENABLE(xim,
[ --enable-xim include support for XIM],
[with_xim=$enableval],
[with_xim=no],
)
if test "$with_xim" = yes; then
SYS_DEFS="$SYS_DEFS -DPDC_XIM"
fi

dnl ------------------------ force UTF-8? ----------------------------
dnl allow --enable-force-utf8 to override locale settings
AC_ARG_ENABLE(force-utf8,
[ --enable-force-utf8 override locale settings; use UTF-8],
[force_utf8=$enableval],
[force_utf8=no],
)
if test "$force_utf8" = yes; then
SYS_DEFS="$SYS_DEFS -DPDC_FORCE_UTF8"
fi

dnl ----------------- check for Purify support -----------------------
dnl allow --enable-purify to enable linking with Purify
AC_ARG_ENABLE(purify,
[ --enable-purify link with Purify (TM)],
[with_purify=$enableval],
[with_purify=no],
)
if test "$with_purify" = yes; then
PURIFY="purify"
else
PURIFY=""
fi
AC_SUBST(PURIFY)

dnl --------------------- check for Xaw3d library --------------------
dnl allow --with-xaw3d to link with PDCurses
AC_ARG_WITH(xaw3d,
[ --with-xaw3d link with Xaw3d],
[with_xaw3d=$withval],
[with_xaw3d=no],
)
if test "$with_xaw3d" = yes; then
AC_DEFINE([USE_XAW3D], [1],
[Define if you want to use Xaw3d library]
)
fi

dnl --------------------- check for neXtaw library -------------------
dnl allow --with-nextaw to link with PDCurses
AC_ARG_WITH(nextaw,
[ --with-nextaw link with neXtaw],
[with_nextaw=$withval],
[with_nextaw=no],
)
if test "$with_nextaw" = yes; then
AC_DEFINE([USE_NEXTAW], [1],
[Define if you want to use neXtaw library]
)
fi

dnl -------------- check how to make shared libraries ----------------
dnl Force the ability of shared library usage
MH_SHARED_LIBRARY(XCurses)

AC_CONFIG_FILES([Makefile x11/$mymakefile x11/xcurses-config])
AC_OUTPUT

case "$target" in
*ibm-aix*)
mv x11/Makefile.aix x11/Makefile
AC_MSG_RESULT(renaming x11/Makefile.aix to x11/Makefile)
;;
*)
;;
esac

AC_DEFINE([PDC_MAX_SIGNALS], [],
[Define as the system defined limit for number of signals]
)

AC_DEFINE([HAVE_DECKEYSYM_H], [],
[Define if you have the <DECkeySym.h> header file]
)

AC_DEFINE([HAVE_SUNKEYSYM_H], [],
[Define if you have the <Sunkeysym.h> header file]
)

AC_DEFINE([HAVE_XPM_H], [],
[Define if you have the <xpm.h> header file]
)

AC_DEFINE([HAVE_XK_KP_DELETE], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_INSERT], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_END], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_DOWN], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_NEXT], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_LEFT], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_RIGHT], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_HOME], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_UP], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_PRIOR], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([HAVE_XK_KP_BEGIN], [],
[Define if you have this defined in <keysym.h>]
)

AC_DEFINE([USE_XAW3D], [],
[Define if you want to use Xaw3d library]
)

AC_DEFINE([USE_NEXTAW], [],
[Define if you want to use neXtaw library]
)

AC_DEFINE([XPOINTER_TYPEDEFED], [],
[Define XPointer is typedefed in X11/Xlib.h]
)

Large diffs are not rendered by default.

@@ -0,0 +1,142 @@
/* Public Domain Curses */

/* $Id: curspriv.h,v 1.158 2008/07/13 16:08:16 wmcbrine Exp $ */

/* Private definitions and declarations for use within PDCurses.
These should generally not be referenced by applications. */

#ifndef __CURSES_INTERNALS__
#define __CURSES_INTERNALS__ 1

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#define CURSES_LIBRARY
#include <curses.h>

#if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \
defined(__CYGWIN32__) || defined(__MINGW32__) || \
defined(__WATCOMC__) || defined(__PACIFIC__)
# ifndef HAVE_VSSCANF
# define HAVE_VSSCANF /* have vsscanf() */
# endif
#endif

#if defined(__CYGWIN32__) || defined(__MINGW32__) || \
defined(__LCC__) || defined(__WATCOMC__)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF /* have vsnprintf() */
# endif
#endif

#if defined(_MSC_VER) && defined(_WIN32) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */
#endif

/*----------------------------------------------------------------------*/

typedef struct /* structure for ripped off lines */
{
int line;
int (*init)(WINDOW *, int);
} RIPPEDOFFLINE;

/* Window properties */

#define _SUBWIN 0x01 /* window is a subwindow */
#define _PAD 0x10 /* X/Open Pad. */
#define _SUBPAD 0x20 /* X/Open subpad. */

/* Miscellaneous */

#define _NO_CHANGE -1 /* flags line edge unchanged */

#define _ECHAR 0x08 /* Erase char (^H) */
#define _DWCHAR 0x17 /* Delete Word char (^W) */
#define _DLCHAR 0x15 /* Delete Line char (^U) */

extern WINDOW *pdc_lastscr;
extern bool pdc_trace_on; /* tracing flag */
extern bool pdc_color_started;
extern unsigned long pdc_key_modifiers;
extern MOUSE_STATUS pdc_mouse_status;

/*----------------------------------------------------------------------*/

/* Platform implementation functions */

void PDC_beep(void);
bool PDC_can_change_color(void);
int PDC_color_content(short, short *, short *, short *);
bool PDC_check_key(void);
int PDC_curs_set(int);
void PDC_flushinp(void);
int PDC_get_columns(void);
int PDC_get_cursor_mode(void);
int PDC_get_key(void);
int PDC_get_rows(void);
void PDC_gotoyx(int, int);
int PDC_init_color(short, short, short, short);
void PDC_init_pair(short, short, short);
int PDC_modifiers_set(void);
int PDC_mouse_set(void);
void PDC_napms(int);
int PDC_pair_content(short, short *, short *);
void PDC_reset_prog_mode(void);
void PDC_reset_shell_mode(void);
int PDC_resize_screen(int, int);
void PDC_restore_screen_mode(int);
void PDC_save_screen_mode(int);
void PDC_scr_close(void);
void PDC_scr_free(void);
int PDC_scr_open(int, char **);
void PDC_set_keyboard_binary(bool);
void PDC_transform_line(int, int, int, const chtype *);
const char *PDC_sysname(void);

/* Internal cross-module functions */

void PDC_init_atrtab(void);
WINDOW *PDC_makelines(WINDOW *);
WINDOW *PDC_makenew(int, int, int, int);
int PDC_mouse_in_slk(int, int);
void PDC_slk_free(void);
void PDC_slk_initialize(void);
void PDC_sync(WINDOW *);

#ifdef PDC_WIDE
int PDC_mbtowc(wchar_t *, const char *, size_t);
size_t PDC_mbstowcs(wchar_t *, const char *, size_t);
size_t PDC_wcstombs(char *, const wchar_t *, size_t);
#endif

#ifdef PDCDEBUG
# define PDC_LOG(x) if (pdc_trace_on) PDC_debug x
# define RCSID(x) static const char *rcsid = x;
#else
# define PDC_LOG(x)
# define RCSID(x)
#endif

/* Internal macros for attributes */

#ifdef CHTYPE_LONG
# define PDC_COLOR_PAIRS 256
#else
# define PDC_COLOR_PAIRS 32
#endif

#ifndef max
# define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
# define min(a,b) (((a) < (b)) ? (a) : (b))
#endif

#define DIVROUND(num, divisor) ((num) + ((divisor) >> 1)) / (divisor)

#define PDC_CLICK_PERIOD 150 /* time to wait for a click, if
not set by mouseinterval() */

#endif /* __CURSES_INTERNALS__*/
@@ -0,0 +1,150 @@
/* $Id: firework.c,v 1.25 2008/07/13 16:08:17 wmcbrine Exp $ */

#include <stdio.h>
#include <signal.h>
#include "../curses.h"
#include <ctype.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>

#define DELAYSIZE 200

void myrefresh(void);
void get_color(void);
void explode(int, int);

short color_table[] =
{
COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN,
COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE
};

int main(int argc, char **argv)
{
int i, start, end, row, diff, flag, direction;
const unsigned seed = (unsigned)time((time_t *)0);

#ifdef XCURSES
Xinitscr(argc, argv);
#else
initscr();
#endif
nodelay(stdscr, TRUE);
noecho();
nonl();
refresh();

if (has_colors())
start_color();

for (i = 0; i < 8; i++)
init_pair((short)i, color_table[i], COLOR_BLACK);

srand(seed);
flag = 0;

while (getch() == ERR) /* loop until a key is hit */
{
do {
start = rand() % (COLS - 3);
end = rand() % (COLS - 3);
start = (start < 2) ? 2 : start;
end = (end < 2) ? 2 : end;
direction = (start > end) ? -1 : 1;
diff = abs(start - end);

} while (diff < 2 || diff >= LINES - 2);

attrset(A_NORMAL);

for (row = 0; row < diff; row++)
{
mvaddstr(LINES - row, row * direction + start,
(direction < 0) ? "\\" : "/");

if (flag++)
{
myrefresh();
erase();
flag = 0;
}
}

if (flag++)
{
myrefresh();
flag = 0;
}

explode(LINES - row, diff * direction + start);
erase();
myrefresh();
}

endwin();

return 0;
}

void explode(int row, int col)
{
erase();
mvaddstr(row, col, "-");
myrefresh();

--col;

get_color();
mvaddstr(row - 1, col, " - ");
mvaddstr(row, col, "-+-");
mvaddstr(row + 1, col, " - ");
myrefresh();

--col;

get_color();
mvaddstr(row - 2, col, " --- ");
mvaddstr(row - 1, col, "-+++-");
mvaddstr(row, col, "-+#+-");
mvaddstr(row + 1, col, "-+++-");
mvaddstr(row + 2, col, " --- ");
myrefresh();

get_color();
mvaddstr(row - 2, col, " +++ ");
mvaddstr(row - 1, col, "++#++");
mvaddstr(row, col, "+# #+");
mvaddstr(row + 1, col, "++#++");
mvaddstr(row + 2, col, " +++ ");
myrefresh();

get_color();
mvaddstr(row - 2, col, " # ");
mvaddstr(row - 1, col, "## ##");
mvaddstr(row, col, "# #");
mvaddstr(row + 1, col, "## ##");
mvaddstr(row + 2, col, " # ");
myrefresh();

get_color();
mvaddstr(row - 2, col, " # # ");
mvaddstr(row - 1, col, "# #");
mvaddstr(row, col, " ");
mvaddstr(row + 1, col, "# #");
mvaddstr(row + 2, col, " # # ");
myrefresh();
}

void myrefresh(void)
{
napms(DELAYSIZE);
move(LINES - 1, COLS - 1);
refresh();
}

void get_color(void)
{
chtype bold = (rand() % 2) ? A_BOLD : A_NORMAL;
attrset(COLOR_PAIR(rand() % 8) | bold);
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,285 @@
/* $Id: ptest.c,v 1.24 2008/07/13 16:08:17 wmcbrine Exp $ */

#include <curses.h>
#include <panel.h>
#include <stdlib.h>

PANEL *p1, *p2, *p3, *p4, *p5;
WINDOW *w4, *w5;

long nap_msec = 1;

char *mod[] =
{
"test ", "TEST ", "(**) ", "*()* ", "<--> ", "LAST "
};

void pflush(void)
{
update_panels();
doupdate();
}

void backfill(void)
{
int y, x;

erase();

for (y = 0; y < LINES - 1; y++)
for (x = 0; x < COLS; x++)
printw("%d", (y + x) % 10);
}

void wait_a_while(long msec)
{
int c;

if (msec != 1)
timeout(msec);

c = getch();

if (c == 'q')
{
endwin();
exit(1);
}
}

void saywhat(const char *text)
{
mvprintw(LINES - 1, 0, "%-20.20s", text);
}

/* mkpanel - alloc a win and panel and associate them */

PANEL *mkpanel(int rows, int cols, int tly, int tlx)
{
WINDOW *win = newwin(rows, cols, tly, tlx);
PANEL *pan = (PANEL *)0;

if (win)
{
pan = new_panel(win);

if (!pan)
delwin(win);
}

return pan;
}

void rmpanel(PANEL *pan)
{
WINDOW *win = pan->win;

del_panel(pan);
delwin(win);
}

void fill_panel(PANEL *pan)
{
WINDOW *win = pan->win;
char num = *((char *)pan->user + 1);
int y, x, maxy, maxx;

box(win, 0, 0);
mvwprintw(win, 1, 1, "-pan%c-", num);
getmaxyx(win, maxy, maxx);

for (y = 2; y < maxy - 1; y++)
for (x = 1; x < maxx - 1; x++)
mvwaddch(win, y, x, num);
}

int main(int argc, char **argv)
{
int itmp, y;

if (argc > 1 && atol(argv[1]))
nap_msec = atol(argv[1]);

#ifdef XCURSES
Xinitscr(argc, argv);
#else
initscr();
#endif
backfill();

for (y = 0; y < 5; y++)
{
p1 = mkpanel(10, 10, 0, 0);
set_panel_userptr(p1, "p1");

p2 = mkpanel(14, 14, 5, 5);
set_panel_userptr(p2, "p2");

p3 = mkpanel(6, 8, 12, 12);
set_panel_userptr(p3, "p3");

p4 = mkpanel(10, 10, 10, 30);
w4 = panel_window(p4);
set_panel_userptr(p4, "p4");

p5 = mkpanel(10, 10, 13, 37);
w5 = panel_window(p5);
set_panel_userptr(p5, "p5");

fill_panel(p1);
fill_panel(p2);
fill_panel(p3);
fill_panel(p4);
fill_panel(p5);
hide_panel(p4);
hide_panel(p5);
pflush();
wait_a_while(nap_msec);

saywhat("h3 s1 s2 s4 s5;");
move_panel(p1, 0, 0);
hide_panel(p3);
show_panel(p1);
show_panel(p2);
show_panel(p4);
show_panel(p5);
pflush();
wait_a_while(nap_msec);

saywhat("s1;");
show_panel(p1);
pflush();
wait_a_while(nap_msec);

saywhat("s2;");
show_panel(p2);
pflush();
wait_a_while(nap_msec);

saywhat("m2;");
move_panel(p2, 10, 10);
pflush();
wait_a_while(nap_msec);

saywhat("s3;");
show_panel(p3);
pflush();
wait_a_while(nap_msec);

saywhat("m3;");
move_panel(p3, 5, 5);
pflush();
wait_a_while(nap_msec);

saywhat("b3;");
bottom_panel(p3);
pflush();
wait_a_while(nap_msec);

saywhat("s4;");
show_panel(p4);
pflush();
wait_a_while(nap_msec);

saywhat("s5;");
show_panel(p5);
pflush();
wait_a_while(nap_msec);

saywhat("t3;");
top_panel(p3);
pflush();
wait_a_while(nap_msec);

saywhat("t1;");
top_panel(p1);
pflush();
wait_a_while(nap_msec);

saywhat("t2;");
top_panel(p2);
pflush();
wait_a_while(nap_msec);

saywhat("t3;");
top_panel(p3);
pflush();
wait_a_while(nap_msec);

saywhat("t4;");
top_panel(p4);
pflush();
wait_a_while(nap_msec);

for (itmp = 0; itmp < 6; itmp++)
{
saywhat("m4;");
mvwaddstr(w4, 3, 1, mod[itmp]);
move_panel(p4, 4, itmp * 10);
mvwaddstr(w5, 4, 1, mod[itmp]);
pflush();
wait_a_while(nap_msec);

saywhat("m5;");
mvwaddstr(w4, 4, 1, mod[itmp]);
move_panel(p5, 7, itmp * 10 + 6);
mvwaddstr(w5, 3, 1, mod[itmp]);
pflush();
wait_a_while(nap_msec);
}

saywhat("m4;");
move_panel(p4, 4, itmp * 10);
pflush();
wait_a_while(nap_msec);

saywhat("t5;");
top_panel(p5);
pflush();
wait_a_while(nap_msec);

saywhat("t2;");
top_panel(p2);
pflush();
wait_a_while(nap_msec);

saywhat("t1;");
top_panel(p1);
pflush();
wait_a_while(nap_msec);

saywhat("d2;");
rmpanel(p2);
pflush();
wait_a_while(nap_msec);

saywhat("h3;");
hide_panel(p3);
pflush();
wait_a_while(nap_msec);

saywhat("d1;");
rmpanel(p1);
pflush();
wait_a_while(nap_msec);

saywhat("d4; ");
rmpanel(p4);
pflush();
wait_a_while(nap_msec);

saywhat("d5; ");
rmpanel(p5);
pflush();
wait_a_while(nap_msec);

if (nap_msec == 1)
break;

nap_msec = 100L;
}

endwin();

return 0;
} /* end of main */
@@ -0,0 +1,159 @@
/****************************************************************************
* Copyright (c) 2002 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/

/* $Id: rain.c,v 1.11 2008/07/13 16:08:17 wmcbrine Exp $ */

#include <curses.h>
#include <stdlib.h>
#include <time.h>

/* rain 11/3/1980 EPS/CITHEP */

static int next_j(int j)
{
if (j == 0)
j = 4;
else
--j;

if (has_colors())
{
int z = rand() % 3;
chtype color = COLOR_PAIR(z);

if (z)
color |= A_BOLD;

attrset(color);
}

return j;
}

int main(int argc, char *argv[])
{
int x, y, j, r, c;
static int xpos[5], ypos[5];
const unsigned seed = (unsigned)time((time_t *)0);

#ifdef XCURSES
Xinitscr(argc, argv);
#else
initscr();
#endif
srand(seed);

if (has_colors())
{
short bg = COLOR_BLACK;

start_color();

#if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000)
if (use_default_colors() == OK)
bg = -1;
#endif
init_pair(1, COLOR_BLUE, bg);
init_pair(2, COLOR_CYAN, bg);
}

nl();
noecho();
curs_set(0);
timeout(0);
keypad(stdscr, TRUE);

r = LINES - 4;
c = COLS - 4;

for (j = 5; --j >= 0;)
{
xpos[j] = rand() % c + 2;
ypos[j] = rand() % r + 2;
}

for (j = 0;;)
{
x = rand() % c + 2;
y = rand() % r + 2;

mvaddch(y, x, '.');

mvaddch(ypos[j], xpos[j], 'o');

j = next_j(j);
mvaddch(ypos[j], xpos[j], 'O');

j = next_j(j);
mvaddch(ypos[j] - 1, xpos[j], '-');
mvaddstr(ypos[j], xpos[j] - 1, "|.|");
mvaddch(ypos[j] + 1, xpos[j], '-');

j = next_j(j);
mvaddch(ypos[j] - 2, xpos[j], '-');
mvaddstr(ypos[j] - 1, xpos[j] - 1, "/ \\");
mvaddstr(ypos[j], xpos[j] - 2, "| O |");
mvaddstr(ypos[j] + 1, xpos[j] - 1, "\\ /");
mvaddch(ypos[j] + 2, xpos[j], '-');

j = next_j(j);
mvaddch(ypos[j] - 2, xpos[j], ' ');
mvaddstr(ypos[j] - 1, xpos[j] - 1, " ");
mvaddstr(ypos[j], xpos[j] - 2, " ");
mvaddstr(ypos[j] + 1, xpos[j] - 1, " ");
mvaddch(ypos[j] + 2, xpos[j], ' ');

xpos[j] = x;
ypos[j] = y;

switch (getch())
{
case 'q':
case 'Q':
curs_set(1);
endwin();
return EXIT_SUCCESS;
case 's':
nodelay(stdscr, FALSE);
break;
case ' ':
nodelay(stdscr, TRUE);
#ifdef KEY_RESIZE
break;
case KEY_RESIZE:
# ifdef PDCURSES
resize_term(0, 0);
erase();
# endif
r = LINES - 4;
c = COLS - 4;
#endif
}
napms(50);
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,67 @@
/*
* 'textual user interface'
*
* $Id: tui.h,v 1.11 2008/07/14 12:35:23 wmcbrine Exp $
*
* Author : P.J. Kunst <kunst@prl.philips.nl>
* Date : 25-02-93
*/

#ifndef _TUI_H_
#define _TUI_H_

#include <curses.h>

#ifdef A_COLOR
#define A_ATTR (A_ATTRIBUTES ^ A_COLOR) /* A_BLINK, A_REVERSE, A_BOLD */
#else
#define A_ATTR (A_ATTRIBUTES) /* standard UNIX attributes */
#endif

#define MAXSTRLEN 256
#define KEY_ESC 0x1b /* Escape */

typedef void (*FUNC)(void);

typedef struct
{
char *name; /* item label */
FUNC func; /* (pointer to) function */
char *desc; /* function description */
} menu;

/* ANSI C function prototypes: */

void clsbody(void);
int bodylen(void);
WINDOW *bodywin(void);

void rmerror(void);
void rmstatus(void);

void titlemsg(char *msg);
void bodymsg(char *msg);
void errormsg(char *msg);
void statusmsg(char *msg);

bool keypressed(void);
int getkey(void);
int waitforkey(void);

void DoExit(void);
void startmenu(menu *mp, char *title);
void domenu(menu *mp);

int weditstr(WINDOW *win, char *buf, int field);
WINDOW *winputbox(WINDOW *win, int nlines, int ncols);
int getstrings(char *desc[], char *buf[], int field);

#define editstr(s,f) (weditstr(stdscr,s,f))
#define mveditstr(y,x,s,f) (move(y,x)==ERR?ERR:editstr(s,f))
#define mvweditstr(w,y,x,s,f) (wmove(w,y,x)==ERR?ERR:weditstr(w,s,f))

#define inputbox(l,c) (winputbox(stdscr,l,c))
#define mvinputbox(y,x,l,c) (move(y,x)==ERR?w:inputbox(l,c))
#define mvwinputbox(w,y,x,l,c) (wmove(w,y,x)==ERR?w:winputbox(w,l,c))

#endif
@@ -0,0 +1,233 @@
/*
* $Id: tuidemo.c,v 1.22 2008/07/14 12:35:23 wmcbrine Exp $
*
* Author : P.J. Kunst <kunst@prl.philips.nl>
* Date : 25-02-93
*
* Purpose: This program demonstrates the use of the 'curses' library
* for the creation of (simple) menu-operated programs.
* In the PDCurses version, use is made of colors for the
* highlighting of subwindows (title bar, status bar etc).
*
* Acknowledgement: some ideas were borrowed from Mark Hessling's
* version of the 'testcurs' program.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include "tui.h"

/* change this if source at other location */

#ifdef XCURSES
# define FNAME "../demos/tui.c"
#else
# define FNAME "..\\demos\\tui.c"
#endif

/**************************** strings entry box ***************************/

void address(void)
{
char *fieldname[6] =
{
"Name", "Street", "City", "State", "Country", (char *)0
};

char *fieldbuf[5];
WINDOW *wbody = bodywin();
int i, field = 50;

for (i = 0; i < 5; i++)
fieldbuf[i] = calloc(1, field + 1);

if (getstrings(fieldname, fieldbuf, field) != KEY_ESC)
{
for (i = 0; fieldname[i]; i++)
wprintw(wbody, "%10s : %s\n",
fieldname[i], fieldbuf[i]);

wrefresh(wbody);
}

for (i = 0; i < 5; i++)
free(fieldbuf[i]);
}

/**************************** string entry box ****************************/

char *getfname(char *desc, char *fname, int field)
{
char *fieldname[2];
char *fieldbuf[1];

fieldname[0] = desc;
fieldname[1] = 0;
fieldbuf[0] = fname;

return (getstrings(fieldname, fieldbuf, field) == KEY_ESC) ? NULL : fname;
}

/**************************** a very simple file browser ******************/

void showfile(char *fname)
{
int i, bh = bodylen();
FILE *fp;
char buf[MAXSTRLEN];
bool ateof = FALSE;

statusmsg("FileBrowser: Hit key to continue, Q to quit");

if ((fp = fopen(fname, "r")) != NULL) /* file available? */
{
while (!ateof)
{
clsbody();

for (i = 0; i < bh - 1 && !ateof; i++)
{
buf[0] = '\0';
fgets(buf, MAXSTRLEN, fp);

if (strlen(buf))
bodymsg(buf);
else
ateof = TRUE;
}

switch (waitforkey())
{
case 'Q':
case 'q':
case 0x1b:
ateof = TRUE;
}
}

fclose(fp);
}
else
{
sprintf(buf, "ERROR: file '%s' not found", fname);
errormsg(buf);
}
}

/***************************** forward declarations ***********************/

void sub0(void), sub1(void), sub2(void), sub3(void);
void func1(void), func2(void);
void subfunc1(void), subfunc2(void);
void subsub(void);

/***************************** menus initialization ***********************/

menu MainMenu[] =
{
{ "Asub", sub0, "Go inside first submenu" },
{ "Bsub", sub1, "Go inside second submenu" },
{ "Csub", sub2, "Go inside third submenu" },
{ "Dsub", sub3, "Go inside fourth submenu" },
{ "", (FUNC)0, "" } /* always add this as the last item! */
};

menu SubMenu0[] =
{
{ "Exit", DoExit, "Terminate program" },
{ "", (FUNC)0, "" }
};

menu SubMenu1[] =
{
{ "OneBeep", func1, "Sound one beep" },
{ "TwoBeeps", func2, "Sound two beeps" },
{ "", (FUNC)0, "" }
};

menu SubMenu2[] =
{
{ "Browse", subfunc1, "Source file lister" },
{ "Input", subfunc2, "Interactive file lister" },
{ "Address", address, "Get address data" },
{ "", (FUNC)0, "" }
};

menu SubMenu3[] =
{
{ "SubSub", subsub, "Go inside sub-submenu" },
{ "", (FUNC)0, "" }
};

/***************************** main menu functions ************************/

void sub0(void)
{
domenu(SubMenu0);
}

void sub1(void)
{
domenu(SubMenu1);
}

void sub2(void)
{
domenu(SubMenu2);
}

void sub3(void)
{
domenu(SubMenu3);
}

/***************************** submenu1 functions *************************/

void func1(void)
{
beep();
bodymsg("One beep! ");
}

void func2(void)
{
beep();
bodymsg("Two beeps! ");
beep();
}

/***************************** submenu2 functions *************************/

void subfunc1(void)
{
showfile(FNAME);
}

void subfunc2(void)
{
char fname[MAXSTRLEN];

strcpy(fname, FNAME);
if (getfname ("File to browse:", fname, 50))
showfile(fname);
}

/***************************** submenu3 functions *************************/

void subsub(void)
{
domenu(SubMenu2);
}

/***************************** start main menu ***************************/

int main(int argc, char **argv)
{
setlocale(LC_ALL, "");

startmenu(MainMenu, "TUI - 'textual user interface' demonstration program");

return 0;
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,37 @@
# Makefile for PDCurses manext program.

all: manual

manual: PDCurses.txt

PDCurses.txt: manext
cat intro.txt > PDCurses.txt
echo PDCurses Definitions and Variables >> PDCurses.txt
echo ================================== >> PDCurses.txt
./manext ../curses.h >> PDCurses.txt
echo PDCurses Functions >> PDCurses.txt
echo ================== >> PDCurses.txt
./manext ../pdcurses/*.c >> PDCurses.txt
./manext ../x11/*.c >> PDCurses.txt
cat x11.txt >> PDCurses.txt
echo >> PDCurses.txt
echo >> PDCurses.txt
echo \
-------------------------------------------------------------------------- \
>> PDCurses.txt
echo >> PDCurses.txt
cat sdl.txt >> PDCurses.txt

manext: manext.c

install:
echo Does nothing at the moment

clean:
-rm -rf *.o manext PDCurses.txt

distclean: clean

mostlyclean: clean

realclean: distclean

Large diffs are not rendered by default.

@@ -0,0 +1,21 @@
PDCurses Documentation
======================

Some plain text documents to provide a basic overview of PDCurses and
details for specific platforms, along with a program to combine them
with the "man page" sections from the source code files, into
"PDCurses.txt".


Building
--------

. Type "make". ("make clean" to remove the built files.) A Unix-like
environment is required for the Makefile. This is called automatically
when doing a top-level make of the X11 port.


Distribution Status
-------------------

Public Domain, except for manext.c, which is GPL 2+.

Large diffs are not rendered by default.

@@ -0,0 +1,119 @@
/***********************************************************************/
/* MANEXT - Extract manual pages from C source code. */
/***********************************************************************/
/*
* MANEXT - A program to extract manual pages from C source code.
* Copyright (C) 1991-1996 Mark Hessling
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* If you make modifications to this software that you feel increases
* it usefulness for the rest of the community, please email the
* changes, enhancements, bug fixes as well as any and all ideas to me.
* This software is going to be maintained and enhanced as deemed
* necessary by the community.
*
* Mark Hessling <mark@rexx.org>
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_LINE 255

void display_info()
{
fprintf(stderr, "\nMANEXT 1.03 Copyright (C) 1991-1996 Mark Hessling\n"
"All rights reserved.\n"
"MANEXT is distributed under the terms of the GNU\n"
"General Public License and comes with NO WARRANTY.\n"
"See the file COPYING for details.\n"
"\nUsage: manext sourcefile [...]\n\n");
}

int main(int argc, char **argv)
{
char s[MAX_LINE + 1]; /* input line */
int i;
FILE *fp;

#ifdef __EMX__
_wildcard(&argc, &argv);
#endif
if (strcmp(argv[1], "-h") == 0)
{
display_info();
exit(1);
}

for (i = 1; i < argc; i++)
{
if ((fp = fopen(argv[i], "r")) == NULL)
{
fprintf(stderr, "\nCould not open %s\n", argv[i]);
continue;
}

while (!feof(fp))
{
if (fgets(s, (int)sizeof(s), fp) == NULL)
{
if (ferror(fp) != 0)
{
fprintf(stderr, "*** Error reading %s. Exiting.\n",
argv[i]);
exit(1);
}

break;
}

/* check for manual entry marker at beginning of line */

if (strncmp(s, "/*man-start*", 12) != 0)
continue;

/* inner loop */

for (;;)
{
/* read next line of manual entry */

if (fgets(s, (int)sizeof(s), fp) == NULL)
{
if (ferror(fp) != 0)
{
fprintf(stderr, "*** Error reading %s. Exiting.\n",
argv[i]);
exit(1);
}

break;
}

/* check for end of entry marker */

if (strncmp(s, "**man-end", 9) == 0)
break;

printf("%s", s);
}

printf("\n\n-----------------------------------"
"---------------------------------------\n\n");
}

fclose(fp);
}

return 0;
}
@@ -0,0 +1,152 @@
SDL Considerations
==================

There are no special requirements to use PDCurses for SDL -- all
PDCurses-compatible code should work fine. (In fact, you can even build
against the Win32 console pdcurses.dll, and then swap in the SDL
pdcurses.dll.) Nothing extra is needed beyond the base SDL library.
However, there are some optional special features, described here.

The principal limitation of this port is that input is currently
restricted to ASCII (i.e., 0-127), plus the special keys like KEY_LEFT.
(You could have Unicode input, but then the input wouldn't match the
output, which is in Code Page 437.) Also, see the note about the
potential for incomplete output under "PDC_update_rects()", below.


Fonts
-----

The font is a simple BMP, 32 characters wide by 8 characters tall,
preferably with a palette. (BMPs without palettes still work, but in
that case, no attributes will be available, nor will the cursor work.)
The first entry in the palette (usually black) is treated as the
background color; the last entry (usually white) is treated as the
foreground. These are changed or made transparent as appropriate; any
other colors in the palette are passed through unchanged. So -- although
a one-bit depth is sufficient for a normal font -- you could redraw some
characters as multi-colored tiles.

The font must be monospaced. The size of each character is derived by
dividing the width of the BMP by 32 and the height by 8. There is no
constraint on the dimensions.

As provided in the default font and expected by acs_map[], the font is
in Code Page 437 form. But you can of course use any layout if you're
not relying on correct values for the ACS_* macros.

The font can be set via the environment variable PDC_FONT. If it's not
set, PDCurses looks for a file named "pdcfont.bmp" in the current
directory at the time of initscr(). If neither is found, it uses the
built-in default font encoded in deffont.h.


Backgrounds
-----------

PDCurses for SDL supports an optional background image BMP. This is used
whenever start_color() has not been called (see the ptest demo for an
example), or when use_default_colors() has been called after
start_color(), and the background color of a pair has been set to -1
(see newdemo, worm, and rain for examples). The usage parallels that of
ncurses in an appropriate terminal (e.g., Gnome Terminal). The image is
tiled to cover the PDCurses window, and can be any size or depth.

As with the font, you can point to a location for the background via the
environment variable PDC_BACKGROUND; "pdcback.bmp" is the fallback.
(There is no default background.)


Icons
-----

The icon (used with SDL_WM_SetIcon() -- not used for the executable
file) can be set via the environment variable PDC_ICON, and falls back
to "pdcicon.bmp", and then to the built-in icon from deficon.h. The
built-in icon is the PDCurses logo, as seen in ../x11/little_icon.xbm.
The SDL docs say that the icon must be 32x32, at least for use with MS
Windows.

If pdc_screen is preinitialized (see below), PDCurses does not attempt
to set the icon.


Screen size
-----------

The default screen size is 80x25 characters (whatever size they may be),
but you can override this via the environment variables PDC_COLS and/or
PDC_LINES. (Some other ports use COLS and LINES; this is not done here
because those values are, or should be, those of the controlling
terminal, and PDCurses for SDL is independent of the terminal.) If
pdc_screen is preinitialized (see below), these are ignored.


Integration with SDL
--------------------

If you want to go further, you can mix PDCurses and SDL functions. (Of
course this is extremely non-portable!) To aid you, there are several
external variables and functions specific to the SDL port; you could
include pdcsdl.h, or just add the declarations you need in your code:

PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;

void PDC_update_rects(void);
void PDC_retile(void);

pdc_screen is the main surface, created by SDL_SetVideoMode(), unless
it's preset before initscr(). You can perform normal SDL operations on
this surface, but PDCurses won't respect them when it updates. (For
that, see PDC_retile().) As an alternative, you can preinitialize this
surface before calling initscr(). In that case, you can use pdc_sheight,
pdc_swidth, pdc_yoffset and/or pdc_xoffset (q.v.) to confine PDCurses to
only a specific area of the surface, reserving the rest for other SDL
operations. If you preinitialize pdc_screen, you'll have to close it
yourself; PDCurses will ignore resize events, and won't try to set the
icon. Also note that if you preinitialize pdc_screen, it need not be the
display surface.

pdc_font, pdc_icon, and pdc_back are the SDL_surfaces for the font,
icon, and background, respectively. You can set any or all of them
before initscr(), and thus override any of the other ways to set them.
But note that pdc_icon will be ignored if pdc_screen is preset.

pdc_sheight and pdc_swidth are the dimensions of the area of pdc_screen
to be used by PDCurses. You can preset them before initscr(); if either
is not set, it defaults to the full screen size minus the x or y offset,
as appropriate.

pdc_xoffset and pdc_yoffset are the x and y offset for the area of
pdc_screen to be used by PDCurses. See the sdltest demo for an example.

PDC_retile() makes a copy of pdc_screen, then tiles it with the
background image, if any. The resulting surface is used as the
background for transparent character cells. PDC_retile() is called from
initscr() and resize_term(). However, you can also use it at other
times, to take advantage of the way it copies pdc_screen: Draw some SDL
stuff; call PDC_retile(); do some curses stuff -- it will use whatever
was on pdc_screen as the background. Then you can erase the curses
screen, do some more SDL stuff, and call PDC_retile() again to make a
new background. (If you don't erase the curses screen, it will be
incorporated into the background when you call PDC_retile().) But this
only works if no background image is set.

PDC_update_rects() is how the screen actually gets updated. For
performance reasons, when drawing, PDCurses for SDL maintains a table of
rectangles that need updating, and only updates (by calling this
function) during getch(), napms(), or when the table gets full.
Normally, this is sufficient; but if you're pausing in some way other
than by using napms(), and you're not doing keyboard checks, you may get
an incomplete update. If that happens, you can call PDC_update_rects()
manually.


Interaction with stdio
----------------------

As with X11, it's a bad idea to mix curses and stdio calls. (In fact,
that's true for PDCurses on any platform; but especially these two,
which don't run under terminals.) Depending on how SDL is built, stdout
and stderr may be redirected to files.

Large diffs are not rendered by default.

@@ -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>
@@ -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
@@ -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 -md
!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
@@ -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
@@ -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;
@@ -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
@@ -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;
}
@@ -0,0 +1,170 @@
/* 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 */

/* NOTE: the original indexing into pdc_atrtab[] relied on three or five
attribute bits in 'chtype' being adjacent to the color bits. Such is
not the case for 64-bit chtypes (CHTYPE_LONG == 2), so we have to do
additional bit-fiddling for that situation. Code is similar in Win32
and DOS flavors. (BJG) */

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];

#if defined( CHTYPE_LONG) && (CHTYPE_LONG >= 2)
temp_line[j].attr = pdc_atrtab[((ch >> PDC_ATTR_SHIFT) & 0x1f)
| (((ch >> PDC_COLOR_SHIFT) & 0xff) << 5)];
#else
temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT];
#endif

#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;
}
}