diff --git a/Makefile.freebsd b/Makefile.freebsd index a6b4cd3..3a53a1a 100644 --- a/Makefile.freebsd +++ b/Makefile.freebsd @@ -7,7 +7,7 @@ LUA = deps/lua/liblua.a ODOORS = deps/odoors/libs-`uname -s`/libODoors.a JSMN = deps/jsmn/libjsmn.a -all: magicka magimail magiedit ticproc mgpost magichat +all: magicka magimail magiedit ticproc mgpost magichat fileapprove ${LUA}: cd deps/lua && $(MAKE) -f Makefile freebsd MAKEFLAGS= @@ -24,6 +24,10 @@ ${ODOORS}: $(JSMN): cd deps/jsmn/ && $(MAKE) +$(CDK): + cd deps/cdk-5.0-20161210/ && ./configure + cd deps/cdk-5.0-20161210/ && $(MAKE) + OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -46,6 +50,9 @@ magichat: $(JSMN) mgpost: $(JAMLIB) cd utils/mgpost && $(MAKE) +fileapprove: $(CDK) + cd utils/fileapprove && $(MAKE) + .PHONY: clean clean: @@ -58,4 +65,6 @@ clean: cd deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` cd utils/ticproc && $(MAKE) clean cd utils/mgpost && $(MAKE) clean - cd utils/magichat && $(MAKE) clean \ No newline at end of file + cd utils/magichat && $(MAKE) clean + cd deps/cdk-5.0-20161210 && $(MAKE) clean + cd utils/fileapprove && $(MAKE) clean \ No newline at end of file diff --git a/Makefile.freebsd.WWW b/Makefile.freebsd.WWW index 5ba2375..c9de55f 100644 --- a/Makefile.freebsd.WWW +++ b/Makefile.freebsd.WWW @@ -9,7 +9,7 @@ MICROHTTPD=-lmicrohttpd ODOORS = deps/odoors/libs-`uname -s`/libODoors.a JSMN = deps/jsmn/libjsmn.a -all: magicka magimail magiedit ticproc mgpost magichat +all: magicka magimail magiedit ticproc mgpost magichat fileapprove ${LUA}: cd deps/lua && $(MAKE) -f Makefile freebsd MAKEFLAGS= @@ -29,6 +29,10 @@ ${ODOORS}: $(JSMN): cd deps/jsmn/ && $(MAKE) +$(CDK): + cd deps/cdk-5.0-20161210/ && ./configure + cd deps/cdk-5.0-20161210/ && $(MAKE) + OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o hashmap/hashmap.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -51,6 +55,9 @@ mgpost: $(JAMLIB) magichat: $(JSMN) cd utils/magichat && $(MAKE) +fileapprove: $(CDK) + cd utils/fileapprove && $(MAKE) + .PHONY: clean clean: @@ -64,4 +71,6 @@ clean: cd deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` cd utils/ticproc && $(MAKE) clean cd utils/mgpost && $(MAKE) clean - cd utils/magichat && $(MAKE) clean \ No newline at end of file + cd utils/magichat && $(MAKE) clean + cd deps/cdk-5.0-20161210 && $(MAKE) clean + cd utils/fileapprove && $(MAKE) clean \ No newline at end of file diff --git a/Makefile.linux b/Makefile.linux index 27294ef..7a818ce 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -6,8 +6,9 @@ ZMODEM = deps/Xmodem/libzmodem.a LUA = deps/lua/liblua.a ODOORS = deps/odoors/libs-`uname -s`/libODoors.a JSMN = deps/jsmn/libjsmn.a +CDK = deps/cdk-5-20161210/libcdk.a -all: magicka magimail magiedit ticproc mgpost magichat +all: magicka magimail magiedit ticproc mgpost magichat fileapprove ${LUA}: cd deps/lua && $(MAKE) -f Makefile linux MAKEFLAGS= @@ -24,6 +25,11 @@ ${ODOORS}: $(JSMN): cd deps/jsmn/ && $(MAKE) +$(CDK): + cd deps/cdk-5.0-20161210/ && ./configure + cd deps/cdk-5.0-20161210/ && $(MAKE) + + OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -46,6 +52,9 @@ mgpost: $(JAMLIB) magichat: $(JSMN) cd utils/magichat && $(MAKE) +fileapprove: $(CDK) + cd utils/fileapprove && $(MAKE) + .PHONY: clean clean: @@ -58,4 +67,6 @@ clean: cd deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` cd utils/ticproc && $(MAKE) clean cd utils/mgpost && $(MAKE) clean - cd utils/magichat && $(MAKE) clean \ No newline at end of file + cd utils/magichat && $(MAKE) clean + cd deps/cdk-5.0-20161210 && $(MAKE) clean + cd utils/fileapprove && $(MAKE) clean diff --git a/Makefile.linux.WWW b/Makefile.linux.WWW index 5387cde..44a6eb2 100644 --- a/Makefile.linux.WWW +++ b/Makefile.linux.WWW @@ -9,7 +9,7 @@ MICROHTTPD=-lmicrohttpd ODOORS = deps/odoors/libs-`uname -s`/libODoors.a JSMN = deps/jsmn/libjsmn.a -all: magicka magimail magiedit ticproc mgpost magichat +all: magicka magimail magiedit ticproc mgpost magichat fileapprove ${LUA}: cd deps/lua && $(MAKE) -f Makefile linux MAKEFLAGS= @@ -29,6 +29,10 @@ ${ODOORS}: $(JSMN): cd deps/jsmn/ && $(MAKE) +$(CDK): + cd deps/cdk-5.0-20161210/ && ./configure + cd deps/cdk-5.0-20161210/ && $(MAKE) + OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o www.o www_email.o www_msgs.o www_last10.o bluewave.o hashmap/hashmap.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -51,6 +55,9 @@ mgpost: $(JAMLIB) magichat: $(JSMN) cd utils/magichat && $(MAKE) +fileapprove: $(CDK) + cd utils/fileapprove && $(MAKE) + .PHONY: clean clean: @@ -64,4 +71,6 @@ clean: cd deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` cd utils/ticproc && $(MAKE) clean cd utils/mgpost && $(MAKE) clean - cd utils/magichat && $(MAKE) clean \ No newline at end of file + cd utils/magichat && $(MAKE) clean + cd deps/cdk-5.0-20161210 && $(MAKE) clean + cd utils/fileapprove && $(MAKE) clean \ No newline at end of file diff --git a/Makefile.netbsd b/Makefile.netbsd index 4d469eb..099b5cb 100644 --- a/Makefile.netbsd +++ b/Makefile.netbsd @@ -7,7 +7,7 @@ LUA = deps/lua/liblua.a ODOORS = deps/odoors/libs-`uname -s`/libODoors.a JSMN = deps/jsmn/libjsmn.a -all: magicka magimail magiedit ticproc mgpost magichat +all: magicka magimail magiedit ticproc mgpost magichat fileapprove ${LUA}: cd deps/lua && $(MAKE) -f Makefile bsd MAKEFLAGS= @@ -24,6 +24,10 @@ ${ODOORS}: $(JSMN): cd deps/jsmn/ && $(MAKE) +$(CDK): + cd deps/cdk-5.0-20161210/ && ./configure + cd deps/cdk-5.0-20161210/ && $(MAKE) + OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -46,6 +50,9 @@ mgpost: $(JAMLIB) magichat: $(JSMN) cd utils/magichat && $(MAKE) +fileapprove: $(CDK) + cd utils/fileapprove && $(MAKE) + .PHONY: clean clean: @@ -58,4 +65,6 @@ clean: cd deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` cd utils/ticproc && $(MAKE) clean cd utils/mgpost && $(MAKE) clean - cd utils/magichat && $(MAKE) clean \ No newline at end of file + cd utils/magichat && $(MAKE) clean + cd deps/cdk-5.0-20161210 && $(MAKE) clean + cd utils/fileapprove && $(MAKE) clean \ No newline at end of file diff --git a/Makefile.netbsd.WWW b/Makefile.netbsd.WWW index c897cda..f60672d 100644 --- a/Makefile.netbsd.WWW +++ b/Makefile.netbsd.WWW @@ -9,7 +9,7 @@ MICROHTTPD=-lmicrohttpd ODOORS = deps/odoors/libs-`uname -s`/libODoors.a JSMN = deps/jsmn/libjsmn.a -all: magicka magimail magiedit ticproc mgpost magichat +all: magicka magimail magiedit ticproc mgpost magichat fileapprove ${LUA}: cd deps/lua && $(MAKE) -f Makefile bsd MAKEFLAGS= @@ -29,6 +29,10 @@ ${ODOORS}: $(JSMN): cd deps/jsmn/ && $(MAKE) +$(CDK): + cd deps/cdk-5.0-20161210/ && ./configure + cd deps/cdk-5.0-20161210/ && $(MAKE) + OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o hashmap/hashmap.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -51,6 +55,9 @@ mgpost: $(JAMLIB) magichat: $(JSMN) cd utils/magichat && $(MAKE) +fileapprove: $(CDK) + cd utils/fileapprove && $(MAKE) + .PHONY: clean clean: @@ -64,4 +71,6 @@ clean: cd deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` cd utils/ticproc && $(MAKE) clean cd utils/mgpost && $(MAKE) clean - cd utils/magichat && $(MAKE) clean \ No newline at end of file + cd utils/magichat && $(MAKE) clean + cd deps/cdk-5.0-20161210 && $(MAKE) clean + cd utils/fileapprove && $(MAKE) clean \ No newline at end of file diff --git a/Makefile.osx b/Makefile.osx index 605c741..01d1571 100644 --- a/Makefile.osx +++ b/Makefile.osx @@ -9,7 +9,7 @@ JSMN = deps/jsmn/libjsmn.a OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o -all: magicka magimail magiedit ticproc mgpost magichat +all: magicka magimail magiedit ticproc mgpost magichat fileapprove ${LUA}: cd deps/lua && $(MAKE) -f Makefile macosx MAKEFLAGS= @@ -26,6 +26,10 @@ ${ODOORS}: $(JSMN): cd deps/jsmn/ && $(MAKE) +$(CDK): + cd deps/cdk-5.0-20161210/ && ./configure + cd deps/cdk-5.0-20161210/ && $(MAKE) + %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -47,6 +51,9 @@ mgpost: $(JAMLIB) magichat: $(JSMN) cd utils/magichat && $(MAKE) +fileapprove: $(CDK) + cd utils/fileapprove && $(MAKE) + .PHONY: clean clean: @@ -59,4 +66,6 @@ clean: cd deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` cd utils/ticproc && $(MAKE) clean cd utils/mgpost && $(MAKE) clean - cd utils/magichat && $(MAKE) clean \ No newline at end of file + cd utils/magichat && $(MAKE) clean + cd deps/cdk-5.0-20161210 && $(MAKE) clean + cd utils/fileapprove && $(MAKE) clean \ No newline at end of file diff --git a/Makefile.osx.WWW b/Makefile.osx.WWW index dc0e8dc..db162ab 100644 --- a/Makefile.osx.WWW +++ b/Makefile.osx.WWW @@ -9,7 +9,7 @@ MICROHTTPD=-lmicrohttpd ODOORS = deps/odoors/libs-`uname -s`/libODoors.a JSMN = deps/jsmn/libjsmn.a -all: magicka magimail magiedit ticproc mgpost magichat +all: magicka magimail magiedit ticproc mgpost magichat fileapprove ${LUA}: cd deps/lua && $(MAKE) -f Makefile macosx MAKEFLAGS= @@ -29,6 +29,10 @@ ${ODOORS}: $(JSMN): cd deps/jsmn/ && $(MAKE) +$(CDK): + cd deps/cdk-5.0-20161210/ && ./configure + cd deps/cdk-5.0-20161210/ && $(MAKE) + OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o www.o www_email.o www_msgs.o www_last10.o bluewave.o hashmap/hashmap.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -51,6 +55,9 @@ mgpost: $(JAMLIB) magichat: $(JSMN) cd utils/magichat && $(MAKE) +fileapprove: $(CDK) + cd utils/fileapprove && $(MAKE) + .PHONY: clean clean: @@ -63,4 +70,6 @@ clean: cd deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` cd utils/ticproc && $(MAKE) clean cd utils/mgpost && $(MAKE) clean - cd utils/magichat && $(MAKE) clean \ No newline at end of file + cd utils/magichat && $(MAKE) clean + cd deps/cdk-5.0-20161210 && $(MAKE) clean + cd utils/fileapprove && $(MAKE) clean \ No newline at end of file diff --git a/deps/cdk-5.0-20161210/CHANGES b/deps/cdk-5.0-20161210/CHANGES new file mode 100644 index 0000000..6a2ae8f --- /dev/null +++ b/deps/cdk-5.0-20161210/CHANGES @@ -0,0 +1,1388 @@ +-- $Id: CHANGES,v 1.264 2016/12/11 02:27:55 tom Exp $ +------------------------------------------------------------------------------- +Cdk Version Change List +Copyright Mike Glover, 1995, 1996, 1997, 1998, 1999 +Modifications copyright Thomas E. Dickey 1999-2015, 2016 +------------------------------------------------------------------------------- + +This file outlines all of the changes/additions from one release to another. +Changes through 4.9.8 (December 1998) were recorded by Mike Glover. +Thereafter, changes have been recorded by Thomas E. Dickey. + +2016/12/10 + + improve formatting of manpages, using bullets + + add -C and -R options to matrix_ex.c to exercise the col/row spacing + features of matrix widget. + + modify matrix widget to highlight the current cell for the cases + when col/row spacing are greater than zero. + +2016/12/04 + + cleanup change for color pairs in 2016/11/20 + + modify initCDKScreen() to simplify initialization of curses by + calling initscr() in this function after initializing the locale. + That fixes a problem using PuTTY with CDK when built using ncurses + (report by Marc Smith). + +2016/11/20 + + fix warnings from cppcheck 1.76.1 + + updated configure macros: + + CF_CC_ENV_FLAGS don't limit the check to -I, -U and -D options, + since the added options can include various compiler options before + and after preprocessor options. + + CF_GNU_SOURCE recent glibc (Debian 2.23-4 for example) has + misordered ifdef/checks for new symbol _DEFAULT_SOURCE, producing + warning messages when only _GNU_SOURCE is defined. Add a followup + check to define _DEFAULT_SOURCE. + + CF_LD_RPATH_OPT change FreeBSD to use -Wl,-rpath rather than -rpath + option. According to FreeBSD #178732, either works since FreeBSD + 4.x; however scons does not accept anything except the -Wl,-rpath + form. + + CF_PROG_LINT add cpplint to programs to use; drop ad hoc tdlint and + alint. + + CF_WITH_NCURSES_ETC add check for ncurses pthreads + + CF_XOPEN_SOURCE add "uclinux" to list of Linux's and use + _GNU_SOURCE for cygwin headers, tested with cygwin 2.3, 2.5 + + CF__ADD_SHLIB_RULES improve scripting for ldconfig to avoid warning + messages if no permissions + + update config.guess, config.sub + > patches by Aarian P. Aleahmad: + + modify encodeAttribute() to allow up to 256 color pairs. + + corrected assignment in scroller_SetPosition(), to show highlighted + member. + + improve the way attributes are applied to Mentry widgets. + + improve Entry widget by using newwin rather than subwin, as well + as passing arguments to callback function. + +2016/11/19 + + add reRegisterCDKObject() + +2016/01/31 + + fix a few of the lintian errors in package/debian + + fix some too-wide tables in manpages, which caused Debian lintian + errors. + + take lower-limit's formatted length into account in slider, etc., + (patch by Guido Meusch). + + make similar repainting-fixes for radio.c and marquee.c + + fix repainting of Scroll widget when it has no box-outline + (patch by Manuel Schmitz). + + add highlight and callbackData members to CDKBUTTON, as well as + macros for setting/getting the highlight value. Use the highlight to + override the default A_REVERSE used in CDK button (patch by Aarian P. + Aleahmad). + + fix two bugs in template.c (patch by Aarian P. Aleahmad): + + in cleanCDKTemplate, fill all of the info string with nulls + + in setCDKTemplateValue, call cleanCDKTemplate whether or not + the pointer for newValue passed by the caller was a null. + + updated configure macros: + + CF_LIB_PREFIX, CF_WITH_LIBTOOL, and CF_XOPEN_SOURCE, build-fixes + for OS/2 + + CF_XOPEN_CURSES, improve check, making it define NCURSES_WIDECHAR + if we happen to be building on a platform (such as OSX) where we do + not define _XOPEN_SOURCE or _XOPEN_SOURCE_EXTENDED + + CF_WITH_VERSIONED_SYMS, avoid ncurses build error on ppc64 + architecture the nm tool is reporting _is_missing in Data section + for ppc64 (by comparison ppc64le is reporting it in Text section) + + update config.guess, config.sub + +2015/09/28 + + build ".deb" test-package with ncurses6, using versioned symbols. + + updated configure macros: + + modifications from ncurses/xterm to allow alternate to /bin/sh for + configure-shell, while dropping support for non-POSIX shell such + as Solaris. + + updated/integrated changes for versioned symbols from ncurses6. + + CF_DISABLE_LIBTOOL_VERSION when using -version-info (the native + libtool mode), get the ABI_VERSION value from $VERSION (which comes + from CF_VERSION_INFO) + + CF_ADD_INCDIR fix an infinite loop when the include-directory to be + added does not exist (Debian #786436) + + CF_WITH_NCURSES_ETC add --with-screen option + + CF_SUBDIR_PATH change this to a loop, adding /usr/pkg (NetBSD) and + /opt/local (Mac OSX) + + update config.guess, config.sub + +2015/01/03 + + modify cdk-config.in to work with systems where libdir is /usr/lib64 + (patch by Peter Hyman). + +2014/11/06 + + alter limit-check in setCDKLabelMessage to use the actual window size + rather than the label-array's latest size (prompted by suggestion by + Stuart Friedberg). + + reset label pointer to 0 after freeing it during resizing in + setCDKLabelMessage (report/analysis by Stuart Friedberg). + + fix most Coverity warnings, aside from demos using getenv. + + correct dependency of dpkg/mingw test packages; only "ncurses6" is + used rather than "libncurses6". + + change test-packages to use --with-shared rather than cdkshlib hack. + + add configure options to implement symbol versioning/hiding: + --with-versioned-syms=X markup versioned symbols using ld + --with-export-syms=XXX limit exported symbols using libtool + + updated configure macros: + + CF_ACVERSION_CHECK - + + work around another gratuitous incompatibility introduced in 2.69 + (reported by Ross Burton, openembedded.org) + + CF_ADD_CFLAGS - workaround for ash-shell with Minix 3.2 + + CF_ADD_LIBS - + + workaround in CF_X_TOOLKIT uses pkgconfig, whose files generally + are using incomplete dependencies - in turn introducing lots of + duplication. filter out the duplicates. + + CF_CHECK_CFLAGS - workaround for ash-shell with Minix 3.2 + + CF_CURSES_FUNCS - + + improve workaround for weak-linkage, seems to fix tests with + NetBSD 6.1 + + CF_GETOPT_HEADER - + + add NEED_GETOPT_H definition, since that's the only interesting + special case + + CF_INTEL_COMPILER - + + cleanup the -no-gcc option which was leftover from testing - prcs + does not build with this option. + + CF_LIB_SUFFIX - + + it is not necessary or even a good idea to make AIX's shared-library suffixes ".a" -- make it ".so" like everyone else (including the system's shared libraries). + + CF_MAKEFLAGS - + + workaround for GNU make 4.0 incompatibility with previous + releases. + + CF_X_ATHENA - add --with-Xaw3dxft option. + + CF_XOPEN_SOURCE - + + add case for UnixWare (report/discussion with Mark Ryan). + + Minix3.2 ifdef's the POSIX.1-2001 functions inside + _NETBSD_SOURCE, even though it was released 2012-02-29 - appease + it. At the same time, turn on the verbose flag to show that most + platforms need platform-specific define's to get POSIX (sic). + + for Solaris (tested with gcc/g++ 3.4.3 on Solaris 10 and gcc/g++ + 4.5.2 on Solaris 11), suppress the followup check for defining + _XOPEN_SOURCE because it is not needed, as well as because g++ + 4.7.3 (no package, used in Sage for Solaris 10) has some + unspecified header breakage which is triggered by the duplicate + definition. + + CF_X_TOOLKIT - + + add workaround for breakage in XQuartz upgrades. + + add 3rd parameter to AC_DEFINE for autoheader. + + modify spec-file to work with OpenSUSE's customization of + _defaultdocdir, which puts documentation for most packages in + /usr/share/doc/packages/ + + update config.guess, config.sub + +2014/01/18 + + fix memory leak in allocListArrays() in scroll.c (patch by Alexander + Gozman). + + amend changes for alphalist in 2012/03/23, to make its "list" + parameter read/write so that the caller's copy can be sorted as + before. + + add man/man2html.ignore, used when generating + http://invisible-island.net/cdk/manpage/ + +2014/01/01 + + improve limit-checks in trimCDKWindow() (patch by Tyson Nottingham). + + updated configure script (further improvments for shared libraries, + and clang). + + update config.guess + +2013/11/17 + + fix dependencies of Debian MinGW packages. + +2013/11/07 + + add scripts for testing cross-compiles to MinGW. + + add new scroller.h to CDKHDR variable in Makefile.in, so it will be + installed (report by Aitor Atuin). + + updated configure script (further improvments for shared libraries, + and MinGW). + + update config.guess, config.sub + +2013/09/01 + + add a limit-check in drawCDKSwindowList() (patch by Wang Weber). + + refactor scrolling support from radio.c, scroll.c, selection.c as new + file scroll.c, making functions from macros which were in cdk_int.h. + This change also modifies header files to move common fields to a new + SCROLLER_FIELDS macro - this is a source-compatible change, but not + binary-compatible (patch by Corentin Delorme). + + add FreeBSD port-files, for test-builds. + + add --enable-rpath and --disable-rpath-hack options to configure + script. + + deprecate the cdkshlib makefile target; it is not available if either + --with-libtool or --with-shared is given. + + corrected Makefile.in permissions of cdk5-config script, which was + not executable; this did not affect packages (cf: 2011/05/17). + + enable the configure --disable-libtool-version option by defining + LIBTOOL_VERSION in Makefile.in, so that the soname can be set or left + to libtool to manage. + + add configure options for manipulating linker rpath feature. + + improve configure options for curses variants by reusing macro + from ncurses-examples + + add lint rule to makefiles + + fix warnings from clang + + adapt configure --with-shared option from ncurses. + + updated configure script (mostly minor changes for autoheader). + + update config.guess, config.sub + +2012/03/23 + + use gmtime instead of localtime in a few places so that calendar + results are not offset by the hour of the day (report/analysis by + Alex Charis). + + add configure option --enable-const, which defines, like + NCURSES_CONST, the symbol CDK_CONST which can be used to address + improved const checking while preserving source-compatibility. + + revise copyChtypeList to correspond with copyCharList + + use const in cdk_util function prototypes, similar "string" uses + to improve writable-strings warnings. Arrays of strings are not + addressed due to compatibility. + + change document directory to /usr/share/doc + + add configure --enable-hdr-subdir to control whether cdk.h should + be in /usr/include/cdk for example, or in /usr/include. Make the + default the latter, standard layout. + + simplify dpkg script, provide only one library using ncursesw + + updated configure script macros, many changes for portability. + + add cdk_test.h to installed headers (Debian #500161). Resolution + of that bug report by the way did not actually install the requested + header file. + + update config.guess, config.sub + +2012/03/18 + + provide shlibs file in dpkg scripts. + +2011/05/17 + + modify calendar widget to allow applications to override the choice + of the first day of the week, by setting the "weekBase" member of + the widget. The calendar_ex example demonstrates this using the + "-w" option (request by Alex Karev). + + modify marquee widget so that changing its box flag will cause the + widget to be resized, e.g., after 2006/05/07 changes which caused the + example program to not display properly. + + corrected example for cdk_display.3 manpage (patch by Loïc + Pefferkorn). + + modify install rules to allow package scripts to specify that + libcdkw's header files go into /usr/include/cdkw, and its *-config + file is named "cdkw-config". + + autoconf'd the actual name for ctags and etags. + + modify cdkshlib rule in makefile to eliminate warnings by + dpkg-shlibdeps. + + correct algorithm for leap year in calendar.c (report by Olaf + Seibert). + + minor formatting of changelog to simplify extraction of credits. + +2011/05/14 + + add dpkg scripts, for test-builds. + +2011/05/13 + + drop cdk.spec, adapt 2-package rules from a Fedora spec file in + the package subdirectory. + + drop mkdirs.sh script, use "mkdir -p". + + updated configure script macros, many changes for portability. + These changes add "--with-pkg-config" and "--disable-libtool-version" + options. + + update config.guess, config.sub + +2010/11/07 + + indent using cdk-indent, from + http://invisible-island.net/cindent/ + +2009/02/15 + + add KEY_ERROR case to each widget to make vERROR events handled by + each. + + modify scroller_SetPosition() macro to improve scrolling behavior + (patch by Ricardo Cantu). + + add vERROR event type to EExitType enumeration, using this in + setCdkExitType() and the selection widget to handle errors (patch by + Ricardo Cantu). + + improve manpage descriptions for writeCharAttrib and + writeChtypeAttrib (report by Knut Schwichten). + + add EXTRA_LDFLAGS symbol to makefile rule for creating library, + in case options are needed (prompted by patch by Timothy Redaelli). + + modify matrix.c to allow defining empty column or row titles by + passing a null pointer in the newCDKMatrix() call. Fix repainting + of column titles by first erasing the cell (patch by Vincenzo Romano). + + regenerate configure script with autoconf 2.52 (patched) to make this + work in non-POSIX locales (report by Mart Stöör). + + updated configure script macros, e.g., to ensure that options are + appended to $CFLAGS rather than prepended. + + update config.guess, config.sub + +2008/11/05 + + modify matrix widget so that if title, row-title, column-title or + box-border are suppressed, the widget will shrink the matrix rather + than leave those parts blank (request by Vincenzo Romano). + + modify matrix_ex example to allow turning off title, column- and + row-headers using -t, -c and -r options, and changing sense of -S + option to allow turning off shadows. + + fix a limit-check in getcCDKObject(), found with valgrind in + buttonbox_ex. + + apply same limit-check to radio.c as from selection.c + + fix a limit-check in selection.c (report by Robin Lee Powell). + + add -f/-h options to examples/selection_ex.c to test change to + label.c + + fix a case where focus would be lost on a selection widget if there + was also a label on the screen, and both were repainted (report + by Robin Lee Powell). + + make CDK build/work with MinGW (patch by Gregory Sharp). + + correct setCDKTemplateValue() logic, which caused the source to + be repeated (report/patch by Christian Gaida). + + use prefix makefile-variable in DOCUMENT_DIR expression to allow + override of prefix at build-time (patch by Saurabh Nix). + + increase a buffer size in calendar.c (Debian #452401). + + allow widgets to create empty lists, a feature assumed by Harry + Brueckner's cpm program (reports by Lars Strand, Harry Brueckner). + + modify Makefile.in for consistent usage of DESTDIR. + + add cdk5-config script to install + + updated configure script, e.g., tests for curses libraries. + + update config.guess, config.sub + +2006/05/07 + + reduce the number of calls on touchwin(), which is used mainly for + cleanup after moving a window. + + improve focus in alphalist.c and fselect.c to ensure that the + dependent scroll widget highlights data after losing focus to the + entry widget (report by Harry Brueckner). + + add getCDKScrollCurrentItem(), setCDKScrollCurrentItem(), + getCDKScrollCurrentTop() and setCDKScrollCurrentTop(). + + add getCDKFselectCurrentItem(), setCDKFselectCurrentItem(), use these + in fselect_ex.c to illustrate how to modify list displayed by + the fselect widget. + + add getCDKAlphalistCurrentItem(), setCDKAlphalistCurrentItem(), use + these in alphalist_ex.c to illustrate how to modify list displayed by + the alphalist widget. + + add copyCharList(), copyChtypeList(), lenCharList(), lenChtypeList(). + + fix misformatted cdk_display manpage, which did not show vINT + and some other data properly (report by Dominik Douville-Belanger). + + split-out cdk_display.c to eliminate repeated logic in entry.c, + matrix.c and mentry.c, and implement hidden fields for the matrix + widget. + + correct box-height for marquee widget. The box parameter was + previously ignored; this correction will make some applications no + longer show a box (report by Michael White). + + modify logic for KEY_DC and KEY_BACKSPACE so the former only deletes + the current character, and the latter only deletes the previous, + rather than equating them. This affects alphalist, entry, mentry, + template (request by Harry Brueckner). + + suppress conversion of control characters in getcCDKObject() if the + character is bound to another. This was last changed in 2004/8/24 + (report by Harry Brueckner). + + add check in adjustAlphalistCB() in case the list is empty (report by + Harry Brueckner). + +2006/02/20 + + correct makefile dependency so $(MAN_DIR) and $(INCLUDE_DIR) are + created before headers.sed and manpage.sed, since headers.sh + relies on the existence of the destination directory (reports + by Marek Lipovean, Marcelo Goes, also Gentoo #123374). + +2005/12/30 + + add some redundant pointer checks, e.g., to entry.c, to avoid core + dump if one tries building Cdk with NetBSD curses (see lib/32417). + + split up traverseCDKScreen() to allow customized flavors of that to + be written in a calling application using the pieces: + traverseCDKOnce(), setCDKFocusFirst() (request by Jorgen Lundman). + + restore assignment of selectedItem in setCDKRadioCurrentItem() which + was dropped in 2005/04/24 (report by Fu Steve X). + + modify refreshCDKScreen() to ensure that only one widget will have + focus, i.e., the first which currently has focus, or if none, then + the first visible one (report by Fu Steve X). + + use cleanCDKTemplate() consistently in the template widget, ensuring + that the editing position is updated, and that the proper length is + used when clearing memory (report by Fu Steve X). + + modify calendar, radio, scroll, selection widgets so the cursor is + shown at the beginning of the selected item's row for better + accessibility (report by Fu Steve X). + + add null-pointer check in setCDKViewerInfo() in case caller gives + too-large value for list size (report by Jorgen Lundman). + + improve traverseCDKScreen() by updating curobj from the + getCDKFocusCurrent() function (patch by Jorgen Lundman). + + add setCDKFocusCurrent() (patch by Jorgen Lundman). + + add configure script option allowing manpage section to be changed + from "3" to other values such as "3CDK", e.g., for Debian. + + modify getCDKRadioItems(), getCDKScrollItems() and + getCDKSelectionItems() to return just the list-size if the list + pointer is null. + + correct highlighting of selected line in CDKSelection window when + the window is scrolled left/right (patch by Jorgen Lundman). + + various manpage fixes (report by Jorgen Lundman). + + change manpages to use ".XX" macro to indicate aliases, to make + the manpage more readable. + + eliminate duplication between cdk_util.3 and cdk_misc.3 manpages + (dialogs belong in the former, for instance). + + modify alphalist, itemlist, radio, selection and swindow to allow + creating a widget with an empty list (request by Harry Brueckner). + + modify mentry.c case for KEY_RIGHT so one can move the cursor past + the end of the string to add new text (report by Harry Brueckner). + + modify cdk_params.c to use strtol() rather than atoi() to allow + command-line parameters such as -h 0xffff for the slider examples. + + modify gen-slider.c to use sprintf/strlen to obtain length of + formatted integer types since intlen() does not give correct result + for maximum value of unsigned type. Modify increment/decrement logic + to take into account unsigned types (report by Keith J Outwater). + + modify cli examples to exit with 255 when reporting an error rather + than a -1 which is generally not portable. + + fix several memory leaks exposed by valgrind in the example programs. + + add configure --disable-leaks option to look for ncurses' debug + function _nc_free_and_exit(), using that to help with memory leak + checking. This uses a new header which will not be + installed, since it is used only for testing in the build tree. + > patches by Phuah Yee Keat: + + add an IsVisibleObj attribute to all CDK objects so the caller can + set some object to be invisible, and calling refreshCDKScreen + after that won't display it again, it enables one to dynamically + show or hide a particular widget based on user actions. + Note: this changes alignments in many of the structs from 5.0, + requiring an ABI bump. + + improve string length-computation in entry.c, allowing a 1-char + field, and also allowing movement past end of text with KEY_END. + + add setCDKRadioSelectedItem() and getCDKRadioSelectedItem(). + + fix some memory leaks by adding cleanCDKObjBindings() into all of + the _destroyXXX() functions, modify cleanCDKObjBindings() to free + and null (obj)->bindingList. + + fix makefile for installing manpages when building outside of the + source directory (patch by Mike Castle). + + remove obsolete lsm file + + review/correct some functions listed in manpages but not implemented, + and the reverse (report by Rajat Das). + + add setCDKMatrixCB() (report by 'zam). + + updated configure script (mostly fixes related to CF_XOPEN_SOURCE). + + update config.guess, config.sub + +2005/04/24 - T.E.Dickey + + bump major version to 5 (overdue). + + add built-in bindings for '<' and '>' to KEY_HOME and KEY_END + for radio.c, scroll.c, selection.c, swindow.c and viewer.c + (patch by Thorsten Glaser). + + add manpages for some of the non-widget utilities: + cdk_compat.3, cdk_objs.3, cdk_params.3 and cdk_util.3 + + correct drawCDKTitle, which did not account for border-size in + vertical position of titles. + + change addCDKScrollPosition() to not set the current item to the + beginning of the list. + + add insertCDKScrollPosition(), to allow insertions before the current + item. + + add a check in scroll.c to prevent overflow if the list is empty. + + modify deleteCDKScrollItem() to ensure the current item is on a + valid position after the deletion. + + modify setCDKScrollPosition() to avoid scrolling if the target is + already on the screen. + + make similar simplifications to radio.c and selection.c as in scroll.c + + simplify and make consistent bookkeeping in scroll.c using new + utility functions. As a result, addCDKScrollItem() and + deleteCDKScrollItem() update the size of the scrollbar toggle (report + by Fu Steve X). + + improve resequence function from 2005/03/23 by preserving attributes + in the target chtype array. + + modify scroll_ex.c, binding 'a', 'i' and 'd' to add, insert and + delete lines respectively (adapted from example by Fu Steve X). + + modify makefile so that cdk_config.h (which is generated by the + configure script) is not removed by "make clean". + + modify makefile to work around limitation of Solaris make program + which was confused by a header dependency in a "::" line (report by + Fu Steve X). + + modify makefile and scripts for configure --srcdir (adapted from + patch by Mike Castle). + +2005/03/23 - T.E.Dickey + + modify deleteCDKScrollItem() to resequence numbers (request by Fu + Steve X). + + cleanup memory allocation in scroll.c, make addCDKScrollItem + reallocate the scroll widget's arrays (report by Fu Steve X). + +2005/03/08 - T.E.Dickey + + correct logic of deleteCDKScrollItem(), which did not preserve the + final null-pointer at the end of the list (report by Fu Steve X). + + add isCDKOBjectBind() to simply check if the given object/key + combination is bound, rather than invoke the bound function. + + modify binding.c so that all of the functions share the same logic + for mapping the given object to the bindable object, e.g., the entry + widget for alphalist and fselect composite widgets. In particular, + checkCDKObjectBind() and getcCDKObject() did not use the same binding + data. + + correct initialization of traverseCDKScreen(), which required two + tab keypresses to make the first traversal (report by Fu Steve X). + + updated configure script checks for _XOPEN_SOURCE, etc. + + update config.guess and config.sub + + correct prototype shown in manpage for setCDKScroll() (report by + Stefan Heimann). + + correct equivalent expressions in setCDKRadioItems() and + setCDKSelectionItems(). + + correct expression in setCDKScrollItems() which caused the updated + window to shrink by 2 lines (report by Stefan Heimann). + +2004/12/24 - T.E.Dickey +======================================== + + correct expression in CDKCalendarField from 2004/08/31 changes, which + caused it to show only 6 days/week, broken by a fix for + demos/appointment (reports/patches by Ryan Flannery, Greg Martin). + +2004/11/07 - T.E.Dickey +======================================== + + correct top-level Makefile.in to remove libtool's auxiliary files + in the "make clean" rule. + + amend simplification of writeCharAttrib(), ensuring that attributes + passed in the chtype-string are not ignored (report by Benoit + Bidoggia). + +2004/10/04 - T.E.Dickey +======================================== + + correct logic of writeBlanks(), which did not check for malloc + failure and made an unnecessary call to freeChar(). + + simplify draw.c a little by using writeCharAttrib() and + writeChtypeAttrib() to implement writeChar() and writeChtype(). + + revert 2002/07/27 change that used waddchnstr() in writeChtype(), + since it does not render control characters (report by Mike Leib). + + fix an infinite loop in viewer.c when displaying control characters + such as form-feed. + +2004/08/31 - T.E.Dickey +======================================== + + add a simple compatibility header (cdk_compat.h), which can be + put in an application's include-path when compiling old applications + against new/old Cdk. + + updated libtool ABI to 2.0.0 since several items are added to CDKOBJS, + as well as cleanup of slider- and scale-header templates. + + add check for ANSI compiler, needed for example with HPUX 10.20. + + ifdef'd out nonfunctional saveData and refreshData methods of entry + and itemlist widgets. + + moved functions for setting background color or attribute into + CDKOBJS. + + moved pre- and post-processing data into CDKOBJS, changing the + functions that set those per-widget into macros using cdk_objs.c + + modify scale and slider widgets to allow the user to directly modify + the value by typing over it (request by Keith Outwater). + + add slider widgets for types float, unsigned. + + add scale widgets for types double, unsigned. + + add script gen-scale.sh, and templates (e.g., gen-scale.c, + gen-scale.h) to allow easy generation of scale and slider widgets of + various types. Use this to replace the existing CDKSCALE, CDKFSCALE, + CDKSLIDER widgets (discussion with Keith Outwater). + + adapt fix from dialog for porting getmaxx(), etc., to systems such + as HPUX which do not provide these legacy definitions. + + remove duplicate vinstall.c from examples directory. + + modify install scripting to translate generated names in cdk_config.h + to add "CDK_" prefix to most, reducing name-pollution. These names + are used to allow applications to compile against the Cdk header + files, but are otherwise of no general interest. In particular, + "PACKAGE" is no longer conflicting (report by Phuah Yee Keat). + + add earlyExit member to CDKOBJS, using this to implement a method + for applications to specify whether the widget's exitType should + be modified after calling checkCDKObjectBind(), and what value + (discussion with Bernhard Walle, comparing with NetBSD variation). + + correct logic in calendar widget for decrementing day- and + month-values. + + modify treatment of exitType field so it is only set to vESCAPE_HIT + if an escape character was received. Hide most of the internal + details of exitType, making it available as an object value (but + retaining the widget field to ease upgrading old applications). + + implement shadow option for newCDKMarquee(). + + rewrite activateCDKMarquee(), eliminating an infinite-loop bug + found in traverse_ex.c, as well as making it work properly with and + without box-outline. + + modify deleteCursesWindow() to call eraseCursesWindow(), so that + deleting an object will also erase it, following the various manpages + comment about removing the object from the screen (report by + Mukovoz I.S.). + + correct positionCDKObject() for CDKSCREEN's which do not happen to + be the same size/shape as stdscr. + + change layout of menus to account for parent window's origin + since subwin() since uses absolute screen position (report by "Anna" + w/o a return address). + + correct off-by-one in positionCDKObject() which prevented user from + reaching the right- and bottom-margins. + + fix a few limits on sprintf's involving strings. + + eliminate fixed array limit MAX_OBJECT in CDKSCREEN. + + use CTRL() macro consistently in preference to CONTROL(). + + remove delwin(stdscr) from example programs since it is both unneeded + and nonportable. + + use EXIT_SUCCESS and EXIT_FAILURE consistently in example programs. + + remove all KEY_xxx symbols which are in X/Open curses from curdefs.h + + remove all ACS_xxx symbols from curdefs.h + + remove all A_xxx symbols from curdefs.h + + add/use isChar() and CharOf() macros to get rid of A_CHARTEXT usage. + + fix menus to allow them to scroll if there are too many entries to + fit on the screen. + + collect most uses of touchwin/refresh into new function + refreshCDKWindow(). + + clear background of menu windows, in case they are drawn over another + widget. + + correct length of title in menu if more than one is placed on the + right side of the screen. + + add getcCDKBind() function, to which keys can be bound for simple + translation of the inputs via getcCDKObject(). Use this in + examples/traverse_ex.c to bind F1 to menu. + + eliminate mapChtype() function, since it could conflict with curses' + definitions. Use the given key value instead, since it is always + positive. + + use KEY_MAX in preference to MAX_BINDINGS symbol. + + eliminate internal use of literal backspace, DEL, tab, newline and + carriage-return constants, etc., by mapping them to KEY_BACKSPACE, + KEY_DC, KEY_ENTER, etc., in getcCDKObject(). + + modify examples and demos to read input using getcCDKObject(), to + solve problems with stdscr refresh overwriting the widgets. + + modify matrix.c and menu.c to read input using getcCDKObject(), like + all of the other widgets. + + rewrote examples/traverse_ex.c to use menus to select the left, + center and right widgets used for demonstrating traversal. + + modify traversal to update object focus properly if a menu action + removes or moves the object associated with the focus. + + cleanup menu in traverse.c if escape character is used to cancel it. + + move curs_set() calls out of focus/unfocus functions, into traverse.c + + remove the SIGBUS/SIGSEGV handler, since it is redundant. + + updated configure script, e.g,. macros CF_ADD_CFLAGS, + CF_CHECK_CACHE, CF_GCC_WARNINGS, CF_NCURSES_LIBS, CF_PROG_EXT, + CF_WITH_DBMALLOC, CF_WITH_DMALLOC, CF_WITH_LIBTOOL, CF_WITH_WARNINGS, + CF_X_ATHENA, CF_X_TOOLKIT. + + update config.guess, config.sub + > fixes for fselect.c by ewigg (Ed Wigg): + + add a range check to ensure that filename completion at the end of + the list does not reference past the end of the list. + + correct the value returned from filename completion (fixes in + 2002/07/27 mistook an assignment that removed the last character + of the result - it is actually used to trim the "/", "@" or similar + character from the displayed filename). + + remove an unnecessary if statement. + > patches by Phuah Yee Keat: + + enable focus in mentry.c, radio.c + + implement unfocus in entry.c + + implement focus/unfocus in mentry.c, template.c + + add setCDKRadioCurrentItem() and getCDKRadioCurrentItem(). + + improve entry.c: When the user types until the last character, do + not shift the cursor to one character beyond the end of the maximum + value allowed in the field, that will create an extra '.' that will + give the user an impression that he can still enter more characters, + when he actually can't. + + fix two core dumps with Solaris curses in scroll.c: + + On solaris curses, just pressing the "down" key on a scroll list + will coredump, on certain sizes of the scroll list. On my + fullscreen test, it will coredump on any number of items unless if + the number of items is a multiple of 5. I assume that it's because + that under certain conditions, the togglePos actually exceeds the + boundary at the end of the scroll bar. Does not happen in ncurses. + + On solaris curses, press 'G' will coredump. + Does not happen in ncurses. + + make wording in COPYING consistent with other fixes from 1999/05/15 + (report by Ahmad Attia). + +2003/12/10 - T.E.Dickey +======================================== + + bump version to 4.9.11 (corresponding source from Mike Glover added + install.sh to tarball; no other source changes were made). + + rename "install.sh" to "install-sh" to work around bugs in certain + make-programs. + + allocate marker[] array in calendar dynamically. Reduce + corresponding array limits to reasonable values. + + add getCDKCalendarMarker() + + correct seconds in calendar's return value. + + eliminate fixed array limits from dialog widget. + + eliminate fixed array limits from label widget. + + eliminate fixed array limits from selection widget. + + eliminate fixed array limits from viewer widget. + + eliminate fixed array limits from buttonbox widget. + + eliminate fixed array limits from matrix widget. Passing around + 1000x1000 arrays was inefficient, and caused core dumps in the Perl + binding for this widget. + + correct one of the attrbox() calls in drawCDKMatrixCell(), which used + a left-tee where a right-tee was needed (report by William L Davis). + + add setCDKMatrixCells(), redefining setCDKMatrix() as a macro to + call it. + + add cleanCDKMatrixCell(). + + correct position for right-aligned menus, which was off by one from + 2003/11/30 changes (report/patch by William L Davis). + +2003/12/01 - T.E.Dickey +======================================== + + correct logic in char2Chtype() for <#UL>, <#UR> and <#LR>, broken in + 1999/06/05 (report by William L Davis). + +2003/11/30 - T.E.Dickey +======================================== + + remove borderSize parameter from alignxy(). + + modify all widgets to account for borderSize consistently, allowing + one to display a widget that uses the full screen size (report by + Phuah Yee Keat ). + + add cdk_params.c, use this to simplify cli programs and add getopt + processing systematically to the demos and examples. + + correct an off-by-one in baseName() that would return the slash + character in the result. + + add setCDKCalendarMonthsNames() and setCDKCalendarDaysNames (patch + by Stanislaw Bierowka ). + + split-out several files from draw.c since they are wrappers for + widgets rather than drawing functions. Doing this reduces the + executable size: get_index.c, get_string.c, popup_dialog.c, + popup_label.c, select_file.c, view_file.c and view_info.c + + eliminate static MAX_LINES limit from graph-widget values. + + eliminate static MAX_LINES limit from widget titles. + + updated configure script, improved checks for curses functions. + + update config.guess, config.sub + +2003/11/24 - T.E.Dickey +======================================== + + display a "processing..." message in setCDKViewerInfo while building + the internal data structures (request by Mike Leib). + + modify viewer widget to compute the total number of lines to display, + making it independent of the listSize parameter. + + modify viewer widget to accept a negative listSize parameter, + making it count the length of list[], ending with a null. + + modify viewer_ex, adding -f, -i and -l options. The -f option + bypasses the fselect widget, specifying the filename directly. + The -i option tells whether to interpret embedded markup, and + the -l option tells viewer_ex to load the file using an embedded + link. + +2003/11/19 - T.E.Dickey +======================================== + + modify searches in viewer widget to allow for overlapping partial + matches, e.g., if the pattern is "00A", it will find the match in + a line consisting of "000A". Also corrected logic to matches can + extend to the end of a line. + + add 'N' to viewer to implement reverse search. + + modify ':' command in viewer to start with current line number + rather than 0. Also adjust the size of the scale widget to allow + for very large line numbers, e.g., more than 5 digits. + + remove an obsolete limit-check in viewer widget that limited view + to 4996 lines, fix a few off-by-one indices. + +2003/11/18 - T.E.Dickey +======================================== + + correct viewer widget, making it interpret tabs and non-printing + characters for the non-interpreted file viewer case. The curses + library cannot display control characters in chtype's. + + add cleanCDKViewer(). + + rename a few .itemCount members to .listSize for consistency. + + eliminate static list-size limit MAX_LINES from swindow, viewer + widgets. Renamed .info, .infoPos, .infoLen to .list, .listPos and + .listLen members to be consistent with other widgets. + +2003/11/16 - T.E.Dickey +======================================== + + suppress "." from fselect listing, since it was not useful. + + eliminate static list-size limit MAX_ITEMS from alphalist, fselect + itemlist, radio, scroll and selection widgets (request by Mike Leib). + + change functions that set line-drawing characters to macros, mapping + those to method calls in CDKOBJS. + + add setCDKEntryBox(). + + add setCDKMarqueeBox() and getCDKMarqueeBox(). + + add setCDKMatrixBox() and getCDKMatrixBox(). + + adjust some title lines to be offset by the borderSize rather than + a hardcoded "1" (report by Max Mikhanosha). + + strip trailing newlines from text read via pipe in execCDKSwindow(), + lost in original cleanup (report by Max Mikhanosha + ). + +2003/04/18 - T.E.Dickey +================================================= + + for variants built with ncursesw and pdcurses, name the libraries + "-lcdkw" and "-lcdkX" respectively. + + add a missing assignment to store the result in _injectCDKFScale() + (report by Barry Davis ). + + fix missing definition of mvwhline(), mvwvline() in pdcurses. + + add a .c.i rule in top-level makefile + + fix uninstall rule, was missing a line-continuation. + + fix several prototypes in manpages which did not match header files + (reported by Lucas Gonze ). + + fix a few compiler warnings, e.g., by parentheses in + drawCDKEntryField() and drawCDKMatrixCell(). + + updates to configure script macros + + add --with-ncursesw option. + + add --with-XawPlus option. + + add --with-curses-dir option. + + modify CF_DISABLE_ECHO to make libtool quiet also. + + use AC_PROG_PATH to find libtool; show the version which is found. + + change sed delimiter to '%' to accommodate AFS. + + improve/correct CF_HEADER_PATH, CF_LIBRARY_PATH to cover special + cases of ncurses/ncursesw configurations. + + change ordering of options in CF_ADD_CFLAGS, CF_ADD_CPPFLAGS, + CF_INCLUDE_DIRS. + + workaround gcc 3.x defects in CF_ADD_INCDIR. + +2002/08/09 - T.E.Dickey +================================================= + + fix entry, matrix, template, viewer widgets to display 8-bit input + characters (reported by Bernhard Walle ). + + modify manpage install to create links for each function name listed + in the NAME section. + + correct cursor location in dialog's radio-box, which was left on the + separator line (reported by Peter Farley ) + +2002/07/27 - T.E.Dickey +================================================= + + several changes to make destroyCDKScreenObjects() and + destroyCDKScreen() actually work (needed for perlcdk): + + record all objects and screens created/destroyed, in cdkscreen.c + + reimplement destroyCDKObject() by a function _destroyCDKObject(), + which first does an erase for the given object, then calls the + destroy method, and finally frees the object. + + add a check in each erase-method to ensure that the object is still + valid. + + add check in setCDKGraphValues() to ensure that X and Y scales are + nonzero, since they are used as denominators. This makes perlcdk's + graph example work. + + add configure check for curses feature which would allow one to move + a subwindow, or (in the case of NetBSD curses) at least compile. + + add configure check and fallback for addchnstr() to accommodate + NetBSD's partial implementation of curses. + + move version information to VERSION file. + + add --with-libtool configure option + + make most wgetch() calls use the object's inputWindow via the + getcCDKObject() function. + + improve type-checking and array-limits in cdkscreen.c + + remove cdktype member from CDKSCREEN since it is redundant. + + eliminate several fixed-buffers with new function writeBlanks(). + + interpret home/end keys in entry widget. + + warn about special keys such as insert which are not recognized in + alphalist, entry, matrix, mentry, template (it was using the low 8 + bits of those, inserting that). + + rewrote/simplified dirName(). + + rewrote/simplified baseName(). + + eliminate fixed-size buffers in fselect.c + + correct a couple of places where fselect.c freed constant memory. + + correct an unterminated string in fselect.c tilde-expansion, and use + $HOME if no account name is given. + + simplified several functions using mvhline(), mvvline() and + mvaddchnstr(). + + add vFSCALE as a valid object type in cdkscreen.c + + modify moveCursesWindow(), which did not work with ncurses after + 2000/9/15 changes to use mvwin() in preference to directly modifying + the _begx/_begy members of WINDOW. That made position_ex not work. + The change was originally for NetBSD's curses implementation which + does not move derived windows properly anyway. + + simplify calls to moveCursesWindow() by moving null-pointer check + inside that function. + + change tab-expansion in char2Chtype() to expand based on the current + length of the string rather than always to 8 columns. + + correct limit-checks in stripWhiteSpace() + + interpret back-tab in buttonbox.c and dialog.c inject-methods for + symmetry with tab. + + corrected return-values of button, matrix, scale widgets to match + documentation as well as to conform with other widgets. + + reorganized inject methods (which may return data of different types) + to return the actual data in an area of the widget, and defined macros + to preserve source-compatibility. + + rewrote initCDKColor() to check if color is available before trying + to initialize it, and to use the terminal's actual number of colors + in making color pairs. + + use 2-digit fields in bind_ex.c for time, date. + + modify matrix.c to add borderSize before the column titles, to + match the change to box layout. + + modify matrix_ex.c to consistently center row-titles. Some were + centered, some were right- and some left-justified. The change to + justifyString() produced an odd effect. + + add functions + CDKVersion() + chtype2String(). + + > patches by Tim Moloney: + + added a setCDKxxxBackgroundAttrib() function to all the widgets. + This function takes a chtype. The setCDKxxxBackgroundColor() still + exists and converts from a character string to a chtype, but it now + calls the new function to eliminate duplicate code. + + fix minor bugs in marquee_ex and radio1_ex. + + fix an off-by-one error in the dialog widget when it is not drawing + its box. The buttons were displayed one line too high. + + add object type to each widget. + + correct _drawCDKEntry(), which did not account for whether a box was + used when computing layout. + + change moveCDKButton() from a function to a macro using + moveCDKObject(). + + add functions + popupLabelAttrib() + setCDKButtonboxButtonAttrib() + setCDKEntryHighlight() + + > integrated/adapted changes by Grant Edwards: + + make the destroy function in each widget a method in CDKOBJS. + + make the inject function in each widget a method in CDKOBJS. + (this was incomplete, and did not provide for different return-types) + + add focus, unfocus, refreshData, saveData methods and supporting + data to CDKOBJS (not all widgets implement these methods). See + entry.c, itemlist.c, selection.c for example. + + store a borderSize value in CDKOBJS for each widget, which is used to + reserve space for a box/border around each widget if the Box + parameter is true when creating the widget. Several related changes + also made, including modifying the alignxy() interface to add + a borderSize parameter. + + modify justifyString() to not subtract 1 on each side, since that + is generally assumed to be done to compensate for boxes drawn around + the text. + + change drawCDKItemlistField() to add a highlight parameter. + + change the label window to a subwin() in entry.c + + hide cursor while in popupLabel() function. + + simplified scroll.c, a little. + + add files + button.c + examples/radio1_ex.c + examples/traverse_ex.c + + added functions: + destroyCDKScreenObjects() + getCDKSelectionCurrent() + setCDKSelectionCurrent() + getCDKScrollCurrent() + setCDKScrollCurrent() + destroyCDKScreenObjects() + cmpStrChstr() + chstrncpy() + + removed these functions: + setCDKEntryBox() + +2002/04/30 - T.E.Dickey +================================================= + + correct parsing of in char2Chtype() where "xx" contains digits + (patch by Robert R Landon ). + + updated cdk.spec for RPM (patch by Vladimir Kondratiev + ). + + introduce CDKINCLUDES ifdef's so that any of the header files may + be included separately. Previously only could be included + due to interdependencies among the headers. + + add some #undef's to cdk.h in case curses.h includes term.h producing + a symbol conflict (reported by Kenneth Pronovici + ). + + miscellaneous updates to configure script, including workarounds for + incompatibilies in autoconf 2.5x. + +2002/02/25 - T.E.Dickey +================================================= + + add cdk_process manpage. + + remove redundant description of bindCDKObject() from several manpages. + + add rcs identifiers to header files. + + add ifdef's in each header file for C++, to make the C externs link + properly without requiring the application to declare them (reported + in comp.unix.programmer newsgroup by ). + + correct typo in template.c introduced in 2000/01/16 substitutions + to use macro isPlateChar() which made templates not work with + interspersed punctuation (reported by jiny ). + +2001/12/30 - T.E.Dickey +================================================= + + remove some redundant wrefresh() calls in various widgets. + + correct an uninitialized pointer in cli/cdkalphalist.c + + modify cli/samples/alphalist.sh to check for non-empty return from + the selection rather than hang attempting to find that account. + + remove -B option from cli/samples/alphalist.sh since it should have a + value, but does not. + + corrected some display-limits in writeChtype() and + writeChtypeAttrib(). + + modify CDKreadFile() to trim newlines from file as read, making it + more like the original readFile(). This is needed to prevent the + trailing newlines loaded into label widgets from clearing the rest + of the line when they are drawn. + + add floatized-scale widget (Lutz Mueller ). + + modify headers.sh script to remove gzip'd versions of the manpages + just in case some were previously installed that way, i.e., by + hand. The gzip'd version would be found instead of the new install. + (prompted by a report by Ron Poulton ). + + correct typo in uninstall rule for manpages which made + "make installCDKHeaderFiles" remove the manpages after installing. + +2001/04/21 - T.E.Dickey +================================================= + + add an uninstall rule. + + move the installed documentation to /usr/local/doc/cdk (it does not + belong in /usr/local/include/cdk). + + modify install rules so that references to header files such as cdk.h + are transformed to , which matches the actual install + location (reports by Pawel Gajda , Carlos Alberto + Pereira Gomes and Ron Poulton + , who found that Cdk's menu.h conflicts with + ncurses' menu.h when building the Perl interface). + + correct cli examples' callbacks, which did not return a value. + + update config.guess and config.sub + + modify CF_CURSES_LIBS to allow build with SunOS 4.x 5lib curses. + + split out CF_CURSES_CPPFLAGS from CF_CURSES_LIBS to allow an interim + check if the curses implementation is really ncurses. + + modify some configure script macros to work when the curses header + file is not , e.g., . + + modify configure script macros to avoid using changequote(), which + is broken in the current autoconf alpha versions, e.g., 2.49d. + + change configure script macros to use $CPPFLAGS consistently for + preprocessor options, and $CFLAG for other compiler flags. + + modify several configure script macros which checked for $GCC, to + ensure it is not actually the compiler name versus an existence + check. + +2001/01/06 - T.E.Dickey +================================================= + + reverted part of 1999/6/5 change, allowing callback functions to + return a value. Note that this makes PROCESSFN and BINDFN use + the same prototype (report by Ian Eure ). + + SCO OpenServer does not define S_IFSOCK + +2000/09/23 - T.E.Dickey +================================================= + + change literal 48's in calendar.c to '0'. + + eliminate nonprinting/nonspace characters using macro CTRL(). + + integrated new examples into makefiles. + + use raiseCDKObject_ex.c and lowerCDKObject_ex.c to debug/fix the + raiseCDKObject() and lowerCDKObject() functions which shared the same + defect in 4.9.9 (the code did not properly update two objects, but + modified screenIndex of one twice). + + modified cli programs to work with CDKreadFile(), CDKsplitString() + and CDKcountStrings() since readFile() and splitString() are not + provided in this version. + + > reviewed/integrated changes from Mike Glover's 4.9.10 (August 2000): + + add examples/raiseCDKObject_ex.c, examples/lowerCDKObject_ex.c + + add cli subdirectory + + modify itemlist.c to make labels one cell wider. + + did not use changes to cdkscreen.c (see 1999/5/15). + + did not use casts to unsigned char, since those are incorrect + (they are casting chtype's which are wider than a char). + +2000/09/15 - T.E.Dickey +================================================= + + add/use configure check for some curses functions/macros which use + internals of the WINDOW struct, which is opaque on NetBSD (patch by + Simon Burge ). + + update autoconf scripts (config.guess, config.sub, macros + CF_CURSES_LIBS, CF_UPPER, CF_X_ATHENA) to my 20000819 autoconf patch. + + revised man-pages: reorder so that functions are listed + alphabetically within the NAME, SYNOPSIS, DESCRIPTION sections, the + prototypes shown only in the SYNOPSIS section (and formatted for + readability), remove excess wording and convert as needed to use tbl. + +2000/08/28 - T.E.Dickey +================================================= + + add cdk_position.3 man page. + + rename cdk_cdk.3 to cdk.3 + +2000/08/20 - T.E.Dickey +================================================= + + remove obsolete comments from manpages telling users to define + NCURSES for that library. The configure script creates cdk_config.h, + which has settings as needed. + +2000/08/20 - T.E.Dickey +================================================= + + fix some array-overruns in viewer.c if it happens to load a binary + file. + + fix symbol conflict with newkey in waitCDKLabel(), as well as keycode + truncation in that function. + +2000/06/28 - T.E.Dickey +================================================= + + add RPM spec-file (patch by Wai-Sun Chia ). + + add Linux-specific makefile rule for generating a shared library + (patch by Pawel Gajda ). + + eliminate fixed-length lists assumed in getDirectoryContents() using + new function CDKgetDirectoryContents(). + + eliminate fixed-length lists assumed in readFile() using new function + CDKreadFile(). + + remove unused substring(). + + use qsort-wrapper sortList() instead of quickSort(). + + change configure.in to avoid having configure script check for X + libraries as a side-effect of adding tests for PDCurses. + + updates to configure script macros: + CF_CURSES_FUNCS, CF_FIND_LIBRARY, CF_HEADER_PATH, CF_LIBRARY_PATH, + CF_NCURSES_LIBS and CF_XOPEN_CURSES + + update config.guess, config.sub + +2000/04/09 - T.E.Dickey +========================================== + + modify newwin() call in subwindow_ex.c to account for actual screen + size rather than assuming 25 lines (reported by Gary Funck + ). + + add CF_X_ATHENA and CF_X_TOOLKIT configure macros for --with-pdcurses + option, needed if the Xcurses or dependent libraries are static + rather than shared. + + correct typo in configure check for HPUX 11.x (reported by Bjorn + Helgaas ). + +2000/02/18 - T.E.Dickey +========================================== + + add case for HPUX 11.x use of cur_colr library (reported by + Bjorn Helgaas ). + + add configure option --with-pdcurses, to link with the X11 version + of PDCurses. + + eliminate quoted includes, in favor of bracketed form. + + ifdef'd limits.h, moving that into cdk.h with a fallback definition + for INT_MIN and INT_MAX. + + minor fixes for building with SunOS 5lib version: configure check + for getopt variables, correction to demos/Makefile.in + +2000/01/17 - T.E.Dickey +========================================== + + add lib-prefix and executable suffix checks to configure script for + port to OS/2 EMX. + + add configure check for lstat(). + +2000/01/16 - T.E.Dickey +========================================== + + drop dependency on usleep(), using napms() which is standard with + SVr4 curses. + + rewrote mode2Char(), making it table-driven and splitting out + mode2Filetype() to make porting simpler, by putting ifdef's for + S_ISSOCK in one place only. + + use new freeCharList() to reduce clutter. + + eliminate casts of NULL, to reduce clutter. + + change several uses of control characters in source to use CONTROL() + macro. + + correct format of date shown in bind_ex.c + + correct nonstandard getcwd() usage in fselect.c + + change demo and example makefiles to not strip executables. + + modify demo/Makefile.in to work around Solaris' make program which + does not process ".c" rule as desired. + +2000/01/08 - T.E.Dickey +========================================== + + fix compiler warnings with Solaris cc. + +1999/12/19 - T.E.Dickey +========================================== + + updated email and url for Mike Glover based on 4.9.9 version dated + 1999/7/29. + +1999/06/26 - T.E.Dickey +========================================== + + add configure options --with-dbmalloc and --with-dmalloc to simplify + testing with those libraries. + + correct error in rewrite of char2Chtype which broke repeat-counts. + +1999/06/05 - T.E.Dickey +========================================== + + correct reference to uninitialized memory in bindCDKObject() + + add/use BINDFN_PROTO macro to simplify maintenance of Perl extension, + corrected corresponding functions to be typed void. + + shorten/simplify mapChtype by making it table-driven. + + shorten/simplify char2DisplayType by making it table-driven. + + replace splitString() by CDKsplitString() and CDKcountStrings() to + eliminate buffer-limits. + + simplify char2Chtype, eliminate fixed-buffer limits. + + prevent recursion in segvTrap. + +1999/05/29 - T.E.Dickey +========================================== + + remove bindFunction and bindData arrays from individual widgets + + make draw, erase, move methods accessed only via the CDKFUNCS table + in each widget. + + add move method for menu.c + + split-out positionCDKObject function from widget code. + +1999/05/23 - T.E.Dickey +========================================== + + remove WIN_WIDTH and related macros, use the more common getmaxx, + and similar macros. Provide fallback definitions for those. + + replace log10() call in intlen with simple recursion. + + add getendx() and getendy() macros. + + add moveCursesWindow(). + + generate include/cdk_config.h, to simplify ifdef'ing for gcc + features, and to reduce clutter in the makefiles. + + add functions ceilCDK() and floorCDK() to eliminate dependency on + the math library + + simplified, corrected upper-limit checks in alignxy(). + + change bindings to be dynamically allocated, part of the CDKOBJS + structure. + + correct overlap between title and percentage in drawCDKViewerInfo() + +1999/05/15 - T.E.Dickey +========================================== + + revised configure script, using autoconf macros which I've written + for other programs to check for ncurses configuration. + + corrected language of copyrights - Mike Glover's intent to retain + copyright of CDK is not served by putting a 1990 copyright attributed + to UC Berkeley. + + except for unused parameters, fix gcc compiler warnings. + + change prototypes to not use parameter names, since this causes + namespace pollution. + + make functions that do not have public prototypes static. + + add missing exit() call in fileview.c, after endCDK() call. + + move delwin() calls before endCDK() call in a few other examples. + + correct apparent bug in widgets which process a binding (such as + KEY_DOWN, in the alphalist and fileview.c demos). They set the + exitType to vESCAPE_HIT rather than the expected vEARLY_EXIT. + + ifdef'd out some debug code in scroll_ex.c + + correct a loop limit freeing mesg[] array in selection_ex.c + + move common object data into new struct CDKOBJS, making cdkscreen.c + much simpler and extensible. + + change erase and draw functions (called from cdkscreen.c) to + object pointers, so only widgets used are linked, making example + programs half as big. + +4.9.7 -> 4.9.8 (December 1998) +========================================== + * Changed the way key bindings worked. If the key binding exited + with a non-zero value then the widget would exit like the user + pressed the escape key. This provides more control over key + binding callbacks. Now the bind prototype is: + int function (EObjectType cdktype, void *object, void *clientData, chtype key); + * Reversed the order of this file. The most recent first. + +4.9.6 -> 4.9.7 (December 1998) +========================================== + * Went from static Makefiles to autoconf and configure. (finally) + +4.9.2 -> 4.9.6 +========================================== + * Once again, it's a complete mystery. + +4.9.1 -> 4.9.2 +========================================== + * Changed the activateCDKViewer funtion to be more compliant + with the rest of the activateCDKXXX functions. + +4.9.0 -> 4.9.1 +========================================== + * Added the functions setCDKXXXULChar/URChar/LLChar/LRChar, + setCDKXXXVerticalChar, setCDKHorizontalChar, and + setCDKXXXBoxAttribute to each of the widgets but the menu + widget. These functions allow the programmer to define + the corner characters of the widget as well as the vertical, + horizontal, and attributes of the box. + * Added the function setCDKXXXBackgroundColor. This sets the + background color of the widget's window. + * Added makefile for the SGI + * Created the buttonbox widget. + * Added in Ctrl-N and Ctrl-P to switch between buttons on the + dialog box and viewer. + * Added the functions setCDKRadioItems and setCDKSelectionItems. + * Added the functions setCDKRadioTitle, setCDKSelectionTitle, + setCDKScrollTitle. + +4.8.3 -> 4.9.0 +========================================== + * Added a parameter to the setCDKViewer function to turn on/off the + line X of Y in the top left corner. + * Removed the eraseCDKXXX in each of the drawCDKXXX functions. This + results in a quicker refresh and less overhead when using the + widgets. This should make things A LOT faster. (I suppose it's about + time I had complete faith in curses optimized screen refreshing. :) ) + The side effect is that you might have to change some programs to + force an eraseCDKXXX/drawCDKXXX when you think the screen is garbled. + * Added a little bit of logic in char2Chtype when a terminal cannot + display color, bold will be used instead. + * Cleaned up the way filename completion works in the file selector. + You may now type in a path and hit tab and that directory tree + will be loaded. + * Added the ability to use the ~ character to refer to a users home + directory, in the file selector. (like csh variants) + * Changed the setCDKXXX functions. Made many different setCDKXXX + functions, one for each item being set. This reduces the overhead + of all the setCDKXXX functions. + * Drastically changed cdk.h. Split the widget definitions and + functions into their own header files. This makes it easier + to expand CDK. + * Added the ability to have multiple line titles on most of the widgets. + * Added the functions setCDKSelectionChoice/getCDKSelectionChoice to + set/get a single choice value from a selection list. + * Added the functions setCDKSelectionModes/getCDKSelectionModes to + set/get the ability to set some items in the selection list as + editable/uneditable. + * Added makefile for the DEC Alpha (I forget who sent me this, if + you want recognition, mail me again) + * Created a 'visual install' using some of the widgets. Try it. + (type in make vinstall once the library has been made) + * Added the ability to set the width of the widget respective to the + screen size. If you pass in a negative value, the widget will + adjust to the width of the window the widget sits in minus the + given value. If zero is given, then the widget will be the full + width of the window. This removes the need to know how wide the + window is when the widget is created. + * Changed the demos and examples makefiles. I was making things too + difficult. It's simpler and easier to compile these directories. + * Re-Purified the code. (no leaks, no UMR's, no problem... :) ) + * Quantified the code a bit for those who complained about the + performance. It has been sped up; I just hope it's enough for + some of you speed freaks. :) + * Added the functions get/setCDKTemplateMin. This allows you to + set the minimum number of characters to type in before the + widget will accept the typed in value. + * Changed the documentation to reflect all the changes. + +4.8.1 -> 4.8.2 -> 4.8.3 +========================================== + * It's a complete mystery. + +4.8.0 -> 4.8.1 +========================================== + * Changed the bind prototype function from + void function (EObjectType cdktype, void *object, void *clientData); + to + void function (EObjectType cdktype, void *object, void *clientData, chtype key); + * Added scroll bars to the scrolling list, the selection list, and + the radio list. + * Modified the template widget so the new character takes on the + color/attributes of the plate widget. + * Added the function classes moveCDKXXX and positionCDKXXX. + * Changed the structure of the makefile and created a single makefile + for each platform to compile on. + * Added support for the delete character KEY_DC. + +4.7.0 -> 4.8.0 +========================================== + * Fixed bugs documented by Miguel Marques (miguel@apex.cos.yorku.ca) + in the entry and mentry widgets. The bug displays itself when you + use vHINT or vINT display types. The vHINT actually showed the + numbers being typed in (which goes against the hidden element of + this display type) and in certain cases vINT allowed non-alpha + characters to be entered. + * Added compile support for Free BSD. + * Cleaned up the behavior of the entry field. + * Cleaned up the behavior of the scrolling list. + * Cleaned up the behavior of the radio list. + * Cleaned up the behavior of the selection list. + * Changed (improved) the behavior of the file selector widget. + * Made the activateCDKFselect behave like the other widgets. + * Added injectCDKFselect function. + * Added the calendar widget. + * Added the slider widget. + * Added the alphalist widget on the request of Luigi Rizzo. + (luigi@ien.unipi.it) + * Fixed a bug with addCDKScrollItem. + * Fixed segmentation fault in the rolodex demo. + * Changed the macros MAX, MIN, and DIFF to MAXIMUM, MINIMUM, + and DIFFERENCE respectively to avoid conflicts. + * Fixed errors with the alphalist and fselect widgets. + * Added the link format comand for the file viewer. This allows + users to 'hyper-link' text files. + * Removed the use of CTRL-N. + * Added the ability to load/save with the scrolling window. + * Added filename completion to the file selector. + * Cleaned up massive changes and errors in the documentation. + * Added 'emacs-like' field editing capabilities to the entry + and mentry widgets. + +4.6.1 -> 4.7.0 +========================================== + * Added injectCDKXXX class of functions. This allows you to inject a + single character into the widget. + * Changed the activateCDKXXX to take an array of chtype to send in a + set of predefined characters. This is very useful for performing + automated tests of your programs. + * Added functions setCDKXXXPreProcess and setCDKXXXPosProcess to + perform actions before and after a character has been hit. + * Made the use of CTRL-N consistent. + * Fixed manual page errors. + * Added the ability to cut text from the entry, mentry, and template + widgets. (uses a global buffer) + * Added the ability to copy text from the entry, mentry, and template + widgets. (uses a global buffer) + * Added the ability to paste text into the entry, mentry, and template + widgets. (uses a global buffer) + * Added the use of the escape key to exit a widget early. + * Added the functions addCDKScroll/deleteCDKScroll to insert and + delete items in an active scrolling list. + * Added a parameter to the menu to specify where the menu windows + were to be drawn. (top or bottom) + * Added execCDKSwindow to the swindow function list. This allows the + user to 'spawn' a command and direct the output to the scrolling + window. + +4.6.0 -> 4.6.1 +========================================== + * Removed the callback function parameter from the entry, mentry, + matrix, and template widgets. Added in a function setCDKXXXCB. + The XXX is the name of the widget. + * Changed the viewer widget functions around. Moved activateCDKViewer + to setCDKViewer. Moved manageCDKViewer to activateCDKViewer and + removed the old setCDKViewer. + * Added in special drawing characters. + * Added in indent format to indent lines. + +4.6.0 (January 1996) +========================================== + * First pulic release of Cdk. + +If you want to get a hold of me mail me at one of the following: + glover@credit.erin.utoronto.ca + mike@vexus.ca + +The CDK Web page has several homes. They are: + http://www.vexus.ca/CDK.html (official) + http://www.datasoft.on.ca/~cdk (Sponsered by the nice folks at Datasoft) + +ttfn, + Mike + +PS: There is also a Perl5 extension of this library for you Perl5 fans. + Look under any CPAN site under the directory CPAN/authors/id/GLOVER. + +-- vile:fk=8bit txtmode diff --git a/deps/cdk-5.0-20161210/COPYING b/deps/cdk-5.0-20161210/COPYING new file mode 100644 index 0000000..8422e5d --- /dev/null +++ b/deps/cdk-5.0-20161210/COPYING @@ -0,0 +1,92 @@ +Modifications copyright Thomas Dickey 1999-2015,2016 + +The software and documentation are still under the same licensing are the +original Cdk, but noting that substantial work and enhancements have been made, +I've added my name as needed -TD + +The original COPYING file follows (with corrections as noted in CHANGES). +------------------------------------------------------------------------------- +Cdk Copying Guide +Copyright Mike Glover, 1995, 1996, 1997, 1998, 1999 +------------------------------------------------------------------------------- +In order to copy Cdk around I have some requirements that will protect me, +and possibly even you. First thing, I feel I should say that this little project +of mine has taken quite a bit 'free' time and I have put a lot of work +into it. I do ask that if anyone asks you about Cdk, tell them where you got it +and who wrote it. If you see Cdk installed without this file on the system +somewhere, then assume the copy the person has is a 'corrupt' version. I will +not be responsible for any unfortunate results if someone else makes a personal +modification to the Cdk library. I will also not be responsible if for some +reason the installation of Cdk creates a negative effect on your machine. You +do have my word that there are no "Trojan horses", worms, or other security +worries lurking in this code. If there are I did not put them there and you +should remove the version of Cdk you have and go get a proper copy. I hate +virus writers as much as anyone else! + +Instead of writing my own license (I'm a programmer, not a lawyer!) I'm going +to adapt the BSD public license on public software. If you do not agree to +this license then remove the Cdk distribution and we all will be happier in +the end. Here is the complete BSD public license in its true form, for +reference. + +I will say one thing, Cdk is my copyright. I will continue to support any +released versions out there as long as they are in their released form. I am +releasing this into the "public" because I feel I have benefited from other +people's hard work, I'd like to chip into the pot as well. This does NOT make +Cdk public domain though. Cdk is still my copyright, and owned by me, I am +merely stating this so I don't see 40 different versions of my code floating +around with other people's names attached. + +With that ugly stuff said, I will happily take any comments or questions about +Cdk. Input is more than welcomed. In fact I encourage it. Feel free to mail +me and ask questions you think the supplied documents don't cover. If I get +enough I may build a FAQ to help newcomers. (We'll see how Cdk is accepted +though). + +For you Perl programmers, there is a Perl5 extension to Cdk. Look at your +closest CPAN site under authors/id/GLOVER. + +If you want to get a hold of me mail me at one of the following: + glover@credit.erin.utoronto.ca + mike@vexus.ca + +The CDK Web page has several homes. They are: + http://www.vexus.ca/CDK.html (official) + http://www.datasoft.on.ca/~cdk (Sponsored by the nice folks at Datasoft) + +ttfn, + Mike +------------------------------------------------------------------------------- + +/* + * Copyright (c) 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/deps/cdk-5.0-20161210/EXPANDING b/deps/cdk-5.0-20161210/EXPANDING new file mode 100644 index 0000000..cab4c9d --- /dev/null +++ b/deps/cdk-5.0-20161210/EXPANDING @@ -0,0 +1,76 @@ +Cdk New Widget Guide +Copyright Mike Glover, 1995, 1996, 1997, 1998, 1999 +------------------------------------------------------------------------------- + +If you want to create a new widget for Cdk, and want it in the standard +dist of Cdk, you will have to follow some requisites that I have. I state +these because Cdk has been worked on for quite some time and I finally +got it to a state where the functions calls are somewhat consistent. Any new +widgets should adhere to this. The requirements are as follows: + + * The function names should be like: + newCDKXXX, destroyCDKXXX, setCDKXXX, drawCDKXX,... + Any widgets with functions not in this format should be 'private'. + If this is not the case one of three things will happen: + 1) The widget will not get accepted + 2) I will mail you back asking you to follow the standards. + 3) I will do it myself. (HIGHLY unlikely) + + * The first parameter of the newCDKXXX function should be of type + CDKSCREEN. + * If applicable, the next two parameters should be xpos and ypos in + that order. + * If applicable, the next two parameters should be the height and + width of the widget. + * If the widget has a title, the next parameter should be a char * + for the title. + * If the widget has a label, the next parameter should be a char * + for the label. + * The last two parameters of the newCDKXXX function should be: + Boolean box, Boolean shadow if the parameters apply. + * The drawCDKXXX function should only have the pointer to the object and + a Boolean box as it's parameters. (in that order) + * The first parameters of any other function relating to the widget + should be a pointer to the widget type. ie: CDKRADIO *, CDKFSELECT *... + * A destroyCDKXXX function has to be provided as well as a drawCDKXXX + function. + * Try to contain anything specific to the widget in a single file. This + keeps the overhead of misc. files from floating around. + * Create a standalone header file which includes cdk.h if needed. + +If you follow the guidelines, then the files you need to change to sew the new +widget into Cdk, are: + + cdkscreen.c So this widget will get refreshed on a refreshCDKScreen + function call. + binding.c To allow key bindings for the widget. If it is possible + to have key bindings I stress that this be incorporated. + cdk.h To add in the function def's to the header file. (ie: + include the newly created header file.) + Makefile Add in the new widget files. + +If you have done all of this then what I need from you is the following: + + * A diff of all the files from the dist. that you modified. Use + patch, I prefer it. If you haven't got it, get it and use it. It makes + life easy. + * A copy of the new widget file. + * tar this up and send it to me at + glover@credit.erin.utoronto.ca or at mike@vexus.ca + I will mail you back when I get it and I will tell you if everything is + OK or not. + +I hate to be such a nit pick, but if we follow the above standards, Cdk will +evolve into a very nice library, with a lot of really nice widgets. + +If you want to get a hold of me mail me at one of the following: + glover@credit.erin.utoronto.ca + mike@vexus.ca + +The CDK Web page has several homes. They are: + http://www.vexus.ca/CDK.html (official) + http://www.datasoft.on.ca/~cdk (Sponsored by the nice folks at Datasoft) + + +ttfn, + Mike diff --git a/deps/cdk-5.0-20161210/INSTALL b/deps/cdk-5.0-20161210/INSTALL new file mode 100644 index 0000000..734d6a1 --- /dev/null +++ b/deps/cdk-5.0-20161210/INSTALL @@ -0,0 +1,55 @@ +Cdk Installation Guide +------------------------------------------------------------------------------- + +Cdk should build/work on any Unix system running SVr4 curses or X/Open curses. + +The original INSTALL notes follow: + +------------------------------------------------------------------------------- +Copyright Mike Glover, 1995, 1996, 1997, 1998, 1999 +------------------------------------------------------------------------------- + +General +------- +This document details how to build and install the Cdk library. The first thing +you should know is what compile options you may require. I have had the +fortunate luck of being able to compile this library on the following +platforms: + * Sun/OS 4.1.* + * Solaris 2.3/2.4/2.5/2.5.1/2.6 + * AIX 3.2.* (and even AIX 4.1 but there is no mention of this in the + makefile. Sorry.) + * HPUX 9.* (and even HPUX 10.* but there is no mention of this in the + makefile. Sorry.) + * Linux (all sorts Slackware, BSD, and Redhat) + +Building +-------- +To build the library cd into the Cdk distribution directory and follow +the following steps: + +1) Run configure. This will create a Makefile with a default + install directory root of /usr/local. If you want to + change the default install directory use the --prefix + command line argument on configure. For example, if you + want to install under /export/local instead, run the command: + ./configure --prefix="/export/local" + +2) Type make. This will make the library, the example binaries + and the demonstration binaries. + +3) Type make install. This will install the CDK distribution. Look + at step 1 if you want to install other than /usr/local. + +4) Start to play. :) + +If you want to get a hold of me mail me at one of the following: + glover@credit.erin.utoronto.ca + mike@vexus.ca + +The CDK Web page has several homes. They are: + http://www.vexus.ca/CDK.html (official) + http://www.datasoft.on.ca/~cdk (Sponsered by the nice folks at Datasoft) + +ttfn, + Mike diff --git a/deps/cdk-5.0-20161210/Makefile.in b/deps/cdk-5.0-20161210/Makefile.in new file mode 100644 index 0000000..14d91f5 --- /dev/null +++ b/deps/cdk-5.0-20161210/Makefile.in @@ -0,0 +1,622 @@ +# $Id: Makefile.in,v 1.123 2015/09/28 23:37:35 tom Exp $ +# +# Copyright 2001-2014,2015 Thomas E. Dickey +# Copyright 1999, Mike Glover +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgment: +# This product includes software developed by Mike Glover +# and contributors. +# 4. Neither the name of Mike Glover, nor the names of contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +SHELL = /bin/sh +@SET_MAKE@ +MAKE_RECUR = @cf_cv_makeflags@ prefix=$(prefix) + +PACKAGE = @PACKAGE@ + +CFG_ROOTNAME = @CFG_ROOTNAME@ +HDR_ROOTNAME = @HDR_ROOTNAME@ +LIB_ROOTNAME = @LIB_ROOTNAME@ +LIB_PREFIX = @LIB_PREFIX@ +LIB_SUFFIX = @DFT_LIB_SUFFIX@ + +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MINOR = @VERSION_MINOR@ +VERSION = $(VERSION_MAJOR).$(VERSION_MINOR) +REL_VERSION = @REL_VERSION@ +ABI_VERSION = @ABI_VERSION@ + +RESULTING_SYMS = @RESULTING_SYMS@ +VERSIONED_SYMS = @VERSIONED_SYMS@ + +@SET_SHLIB_VARS@ +CDKLIB = @LIB_TARGET@ +IMPORT_LIB = lib$(LIB_ROOTNAME).dll.a +@MAKE_NORMAL@OLD_SHLIB_LINK = @LIB_PREFIX@$(LIB_ROOTNAME).so +@MAKE_NORMAL@OLD_SONAME = $(OLD_SHLIB_LINK).$(VERSION_MAJOR) +@MAKE_NORMAL@OLD_SHLIB_FILE = $(OLD_SONAME).$(VERSION_MINOR) + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +top_srcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = $(srcdir) + +x = @EXEEXT@ +o = .@OBJEXT@ +a = $(LIB_SUFFIX) + +DESTDIR = +bindir = @bindir@ +includedir = @includedir@ +libdir = @libdir@ +shlibdir = @shlibdir@ +datarootdir = @datarootdir@ +datadir = @datadir@ +mandir = @mandir@ + +DOCUMENT_DIR = $(DESTDIR)$(datadir)/doc/$(PACKAGE) +BIN_DIR = $(DESTDIR)$(bindir) +INCLUDE_DIR = $(DESTDIR)$(includedir) +INCLUDE_SUBDIR = $(DESTDIR)$(includedir)/$(HDR_ROOTNAME) +SHLIB_DIR = $(DESTDIR)$(shlibdir) +LIB_DIR = $(DESTDIR)$(libdir) +MAN_DIR = $(DESTDIR)$(mandir)/man@MAN_TAG@ +MANSECT = @MANSECT@ + +CC = @CC@ +CPP = @CPP@ +AR = @AR@ +RANLIB = @LIB_PREP@ +RM = rm -f +LN_S = @LN_S@ +CTAGS = @CTAGS@ +ETAGS = @ETAGS@ +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ + +LIBS = @LIBS@ + +CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@ +CPPFLAGS = @DEFS@ -I./include -I$(srcdir)/include @CPPFLAGS@ + +LDFLAGS = @LDFLAGS@ +RPATH_LIST = @RPATH_LIST@ + +LIBTOOL = @LIBTOOL@ @ECHO_LT@ +LIBTOOL_OPTS = @LIBTOOL_OPTS@ +LIBTOOL_CLEAN = @LIB_CLEAN@ +LIBTOOL_COMPILE = @LIB_COMPILE@ +LIBTOOL_CREATE = @LIB_CREATE@ $(EXTRA_LDFLAGS) +LIBTOOL_LINK = @LIB_LINK@ +LIBTOOL_INSTALL = @LIB_INSTALL@ +LIBTOOL_UNINSTALL = @LIB_UNINSTALL@ +LIBTOOL_VERSION = @LIBTOOL_VERSION@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = $(LIBTOOL_INSTALL) @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_LIB = $(LIBTOOL_INSTALL) $(INSTALL_DATA) +UNINSTALL_LIB = $(LIBTOOL_UNINSTALL) $(RM) + +.SUFFIXES: .c .o .lo .os .i + +default :: $(CDKLIB) + +# +# Create the file lists. +# +AUTO_HDR = \ + include/dscale.h \ + include/fscale.h \ + include/fslider.h \ + include/scale.h \ + include/slider.h \ + include/uscale.h \ + include/uslider.h + +AUTO_SRC = \ + dscale.c \ + fscale.c \ + fslider.c \ + scale.c \ + slider.c \ + uscale.c \ + uslider.c + +AUTO_MAN = \ + man/cdk_dscale.3 \ + man/cdk_fscale.3 \ + man/cdk_fslider.3 \ + man/cdk_scale.3 \ + man/cdk_slider.3 \ + man/cdk_uscale.3 \ + man/cdk_uslider.3 + +MY_HDR = \ + include/cdk_config.h \ + $(AUTO_HDR) + +CDKHDR = \ + alphalist.h \ + binding.h \ + button.h \ + buttonbox.h \ + calendar.h \ + cdk.h \ + cdk_compat.h \ + cdk_objs.h \ + cdk_params.h \ + cdk_test.h \ + cdk_util.h \ + cdk_version.h \ + cdkscreen.h \ + curdefs.h \ + dialog.h \ + draw.h \ + entry.h \ + fselect.h \ + graph.h \ + histogram.h \ + itemlist.h \ + label.h \ + marquee.h \ + matrix.h \ + mentry.h \ + menu.h \ + radio.h \ + scroll.h \ + scroller.h \ + selection.h \ + swindow.h \ + template.h \ + traverse.h \ + viewer.h + +CDKSRC = \ + $(AUTO_SRC) \ + alphalist.c \ + binding.c \ + button.c \ + buttonbox.c \ + calendar.c \ + cdk.c \ + cdk_compat.c \ + cdk_display.c \ + cdk_objs.c \ + cdk_params.c \ + cdkscreen.c \ + debug.c \ + dialog.c \ + draw.c \ + entry.c \ + fselect.c \ + get_index.c \ + get_string.c \ + graph.c \ + histogram.c \ + itemlist.c \ + label.c \ + marquee.c \ + matrix.c \ + mentry.c \ + menu.c \ + popup_dialog.c \ + popup_label.c \ + position.c \ + radio.c \ + scroll.c \ + scroller.c \ + selection.c \ + swindow.c \ + select_file.c \ + template.c \ + traverse.c \ + version.c \ + view_file.c \ + view_info.c \ + viewer.c + +CDKMAN = \ + cdk.3 \ + cdk_alphalist.3 \ + cdk_binding.3 \ + cdk_button.3 \ + cdk_buttonbox.3 \ + cdk_calendar.3 \ + cdk_compat.3 \ + cdk_dialog.3 \ + cdk_display.3 \ + cdk_draw.3 \ + cdk_entry.3 \ + cdk_fscale.3 \ + cdk_fselect.3 \ + cdk_graph.3 \ + cdk_histogram.3 \ + cdk_itemlist.3 \ + cdk_label.3 \ + cdk_marquee.3 \ + cdk_matrix.3 \ + cdk_mentry.3 \ + cdk_menu.3 \ + cdk_misc.3 \ + cdk_objs.3 \ + cdk_params.3 \ + cdk_position.3 \ + cdk_process.3 \ + cdk_radio.3 \ + cdk_scale.3 \ + cdk_screen.3 \ + cdk_scroll.3 \ + cdk_selection.3 \ + cdk_swindow.3 \ + cdk_template.3 \ + cdk_traverse.3 \ + cdk_util.3 \ + cdk_viewer.3 + +CDKREADME = EXPANDING NOTES TODO COPYING INSTALL README + +OBJECTS = $(CDKSRC:.c=.o) +CDKSHOBJS = $(CDKSRC:.c=.os) +LIB_OBJECT = @LIB_OBJECT@ + +all sources :: $(AUTO_SRC) + +$(OBJECTS) : include/cdk_config.h + +# +# Standard library directive. +# +all cdklib :: $(CDKLIB) + +@MAKE_NORMAL@cdkshlib $(OLD_SHLIB_FILE) :: $(CDKSHOBJS) +@MAKE_NORMAL@ gcc -shared -Wl,-soname=$(OLD_SONAME) $(LDFLAGS) $(LIBS) -o $(OLD_SHLIB_FILE) $(CDKSHOBJS) + +# +# Make the examples directory. +# +all examples :: + cd examples && $(MAKE) $(MAKE_RECUR) + +# +# Make the demos directory. +# +all demos :: + cd demos && $(MAKE) $(MAKE_RECUR) + +# +# Make the cli directory. +# +all cli :: + cd cli && $(MAKE) $(MAKE_RECUR) + +# +# Make the generated manpages. +# +all manpages :: $(AUTO_MAN) + +# Order of install-targets should match the order of uninstalls. Put the +# documentation first, then the headers, and finally the library: +# (un)installCDKReadme +# (un)installCDKManPages +# (un)installCDKHeaderFiles +# (un)installCDKLibrary + +# +# This installs the informational readme files. +# +install \ +installCDKReadme :: $(DOCUMENT_DIR) + @echo "Installing CDK Readme files in $(DOCUMENT_DIR)..." + @for i in $(CDKREADME); do \ + echo " ... $$i"; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOCUMENT_DIR)/$$i; \ + done + +uninstall \ +uninstallCDKReadme :: + @echo "Uninstalling CDK Readme files from $(DOCUMENT_DIR)..." + @- for i in $(CDKREADME); do \ + $(RM) $(DOCUMENT_DIR)/$$i; \ + done + +# +# This installs the CDK man pages. +# +install \ +installCDKManPages :: headers.sed $(MAN_DIR) manpage.sed $(AUTO_MAN) + @echo "Installing the CDK man pages in $(MAN_DIR) ..." + @for i in $(AUTO_MAN); do \ + $(SHELL) $(srcdir)/headers.sh \ + -x "$(INSTALL_DATA)" \ + -d $(MAN_DIR) \ + -s . \ + -t $(MANSECT) \ + -e manpage.sed $$i; \ + $(SHELL) $(srcdir)/manlinks.sh installing $(srcdir) $(MAN_DIR) $(MANSECT) $$i; \ + done + @for i in $(CDKMAN); do \ + $(SHELL) $(srcdir)/headers.sh \ + -x "$(INSTALL_DATA)" \ + -d $(MAN_DIR) \ + -s . \ + -t $(MANSECT) \ + -e manpage.sed $(srcdir)/man/$$i; \ + $(SHELL) $(srcdir)/manlinks.sh installing $(srcdir) $(MAN_DIR) $(MANSECT) $(srcdir)/man/$$i; \ + done + +uninstall \ +uninstallCDKManPages :: + @echo "Uninstalling the CDK man pages from $(MAN_DIR) ..." + @- for i in $(AUTO_MAN); do \ + $(SHELL) $(srcdir)/manlinks.sh removing $(srcdir) $(MAN_DIR) $(MANSECT) $(srcdir)/$$i; \ + done + @- for i in $(CDKMAN); do \ + $(SHELL) $(srcdir)/manlinks.sh removing $(srcdir) $(MAN_DIR) $(MANSECT) $(srcdir)/man/$$i; \ + done + +# +# This installs the header files. +# +HDR_SUBDIR = @HDR_SUBDIR@ -h cdk.h +HEADERS_SH = $(SHELL) $(srcdir)/headers.sh $(HDR_SUBDIR) -x "$(INSTALL_DATA)" -d $(INCLUDE_SUBDIR) -s $(srcdir) +install \ +installCDKHeaderFiles :: \ + $(INCLUDE_DIR) \ + $(INCLUDE_SUBDIR) \ + headers.sed \ + $(MY_HDR) + @echo "Installing CDK header files in $(INCLUDE_SUBDIR)..." + $(HEADERS_SH) $(MY_HDR) + @for i in $(CDKHDR); do \ + $(HEADERS_SH) include/$$i; \ + done +@HDR_SUBDIR@ rm -f $(INCLUDE_DIR)/cdk.h && mv $(INCLUDE_SUBDIR)/cdk.h $(INCLUDE_DIR)/$(PACKAGE).h + +uninstall \ +uninstallCDKHeaderFiles :: + @echo "Uninstalling CDK header files from $(INCLUDE_SUBDIR)..." + @- for i in $(MY_HDR); do \ + $(RM) $(INCLUDE_SUBDIR)/`basename $$i`; \ + done + @- for i in $(CDKHDR); do \ + $(RM) $(INCLUDE_SUBDIR)/$$i; \ + done +@HDR_SUBDIR@ rm -f $(INCLUDE_DIR)/cdk.h + +# +# This installs the CDK library. +# +install \ +installCDKLibrary :: $(SHLIB_DIR) $(CDKLIB) + @echo "Installing CDK library" + @$(INSTALL_LIB) $(CDKLIB) $(SHLIB_DIR)/$(CDKLIB) + +uninstall \ +uninstallCDKLibrary :: + @echo "Uninstalling CDK library" + @- $(UNINSTALL_LIB) $(SHLIB_DIR)/$(CDKLIB) + +@MAKE_DLLS@install \ +@MAKE_DLLS@installImportLibrary :: $(LIB_DIR) $(IMPORT_LIB) +@MAKE_DLLS@ @echo "Installing Import library" +@MAKE_DLLS@ @$(INSTALL_LIB) $(IMPORT_LIB) $(LIB_DIR)/$(IMPORT_LIB) + +@MAKE_DLLS@uninstall \ +@MAKE_DLLS@uninstallImportLibrary :: +@MAKE_DLLS@ @echo "Uninstalling Import library" +@MAKE_DLLS@ @- $(UNINSTALL_LIB) $(LIB_DIR)/$(IMPORT_LIB) + +# +# This installs the CDK package-config script. +# +install \ +installCDKHeaderFiles \ +installCDKLibrary :: $(BIN_DIR) cdk-config + @echo "Installing script $(CFG_ROOTNAME)$(VERSION_MAJOR)-config" + @$(INSTALL) cdk-config $(BIN_DIR)/$(CFG_ROOTNAME)$(VERSION_MAJOR)-config + +uninstall \ +uninstallCDKHeaderFiles \ +uninstallCDKLibrary :: cdk-config + @echo "Uninstalling script $(CFG_ROOTNAME)$(VERSION_MAJOR)-config" + @$(RM) $(BIN_DIR)/$(CFG_ROOTNAME)$(VERSION_MAJOR)-config + +# +# This installs the CDK shared library. The rules are for an RPM spec, and +# not of general interest. +# +@MAKE_NORMAL@installCDKSHLibrary :: $(SHLIB_DIR) $(OLD_SHLIB_FILE) +@MAKE_NORMAL@ @echo "Installing CDK library" +@MAKE_NORMAL@ @ECHO_CC@$(INSTALL_DATA) $(OLD_SHLIB_FILE) $(SHLIB_DIR) +@MAKE_NORMAL@ @ECHO_CC@$(SHELL) -c "cd $(SHLIB_DIR) && $(LN_S) $(OLD_SHLIB_FILE) $(OLD_SONAME)" +@MAKE_NORMAL@ @ECHO_CC@$(SHELL) -c "cd $(SHLIB_DIR) && $(LN_S) $(OLD_SHLIB_FILE) $(OLD_SHLIB_LINK)" +@MAKE_NORMAL@ +@MAKE_NORMAL@uninstall \ +@MAKE_NORMAL@uninstallCDKSHLibrary :: +@MAKE_NORMAL@ @ECHO_CC@- $(RM) $(SHLIB_DIR)/$(LIB_BASENAME) +@MAKE_NORMAL@ @ECHO_CC@- $(RM) $(SHLIB_DIR)/$(OLD_SONAME) +@MAKE_NORMAL@ @ECHO_CC@- $(RM) $(SHLIB_DIR)/$(OLD_SHLIB_FILE) + +headers.sed : $(srcdir)/headers.sh + $(SHELL) $(srcdir)/headers.sh -p CDK $(HDR_SUBDIR) -c include/cdk_config.h -d $(INCLUDE_SUBDIR) -s $(srcdir)/include -i -s include -i + +manpage.sed : + @echo "creating $@" + @echo "s/(3)/($(MANSECT))/g" >$@ + @echo "/^\.TH/s/\<3\>/$(MANSECT)/" >>$@ + +@MAKE_LOWER_TAGS@tags : +@MAKE_LOWER_TAGS@ $(CTAGS) *.[ch] */*.[ch] + +@MAKE_LOWER_TAGS@TAGS : +@MAKE_LOWER_TAGS@ $(ETAGS) *.[ch] */*.[ch] + +lint: $(AUTO_HDR) $(AUTO_SRC) $(CDKSRC) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(AUTO_SRC) $(CDKSRC) + +all-lint: lint + cd examples && $(MAKE) $(MAKE_RECUR) lint + cd demos && $(MAKE) $(MAKE_RECUR) lint + cd cli && $(MAKE) $(MAKE_RECUR) lint + +# +# Clean up after ourselves... +# +clean :: + @- $(RM) -r autom4te.cache + - $(LIBTOOL_CLEAN) $(RM) $(LIB_OBJECT) $(CDKLIB) $(RM_SHARED_OPTS) +@MAKE_NORMAL@ - $(RM) *.os $(OLD_SHLIB_FILE) + - $(RM) headers.sed manpage.sed core tags *.i *~ + $(RM) $(AUTO_HDR) + $(RM) $(AUTO_SRC) + $(RM) $(AUTO_MAN) + +realclean :: clean + cd examples && $(MAKE) $(MAKE_RECUR) clean + cd demos && $(MAKE) $(MAKE_RECUR) clean + cd cli && $(MAKE) $(MAKE_RECUR) clean + +# +# Use this to clean the distribution. +# +distclean :: realclean + $(RM) config.cache config.log config.status + cd examples && $(RM) Makefile + cd demos && $(RM) Makefile + cd cli && $(RM) Makefile + $(RM) include/cdk_config.h + $(RM) include/cdk_version.h + $(RM) Makefile + $(RM) cdk-config + $(RM) mk_shared_lib.sh + @- $(SHELL) -c 'if test "$(srcdir)" != . ; then \ + rmdir examples; \ + rmdir demos; \ + rmdir cli; \ + rmdir include; \ + fi' + +# +# Standard .c to .o compile line. +# +.c.o: + @RULE_CC@ + @ECHO_CC@$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + +.c.lo: + @RULE_CC@ + @ECHO_CC@$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + +.c.i: + @RULE_CC@ + @ECHO_CC@$(CPP) $(CPPFLAGS) -E -C $< >$@ + +.c.os: + @RULE_CC@ + @ECHO_CC@$(CC) $(CFLAGS) $(CPPFLAGS) -c -fPIC $< -o $@ + +man \ +$(BIN_DIR) \ +$(DOCUMENT_DIR) \ +$(INCLUDE_DIR) \ +$(INCLUDE_SUBDIR) \ +$(LIB_DIR) \ +$(MAN_DIR) : ; mkdir -p $@ + +# +# Files generated from templates: +# +GEN_SCALE = $(SHELL) $(srcdir)/gen-scale.sh + +SCALE_H = $(srcdir)/include/gen-scale.h +SCALE_C = $(srcdir)/gen-scale.c +SCALE_M = $(srcdir)/man/gen-scale.3 + +MKDIR_MAN = test -d man || mkdir man + +include/dscale.h : $(SCALE_H) + $(GEN_SCALE) DSCALE DScale Double double $(SCALE_H) >$@ +dscale.c : $(SCALE_C) $(AUTO_HDR) + $(GEN_SCALE) DSCALE DScale Double double $(SCALE_C) >$@ +man/cdk_dscale.3 : $(SCALE_M) man + -$(MKDIR_MAN) + $(GEN_SCALE) DSCALE DScale Double double $(SCALE_M) >$@ + +include/fscale.h : $(SCALE_H) + $(GEN_SCALE) FSCALE FScale Float float $(SCALE_H) >$@ +fscale.c : $(SCALE_C) $(AUTO_HDR) + $(GEN_SCALE) FSCALE FScale Float float $(SCALE_C) >$@ +man/cdk_fscale.3 : $(SCALE_M) man + -$(MKDIR_MAN) + $(GEN_SCALE) FSCALE FScale Float float $(SCALE_M) >$@ + +include/scale.h : $(SCALE_H) + $(GEN_SCALE) SCALE Scale Int int $(SCALE_H) >$@ +scale.c : $(SCALE_C) $(AUTO_HDR) + $(GEN_SCALE) SCALE Scale Int int $(SCALE_C) >$@ +man/cdk_scale.3 : $(SCALE_M) man + -$(MKDIR_MAN) + $(GEN_SCALE) SCALE Scale Int int $(SCALE_M) >$@ + +include/uscale.h : $(SCALE_H) + $(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_H) >$@ +uscale.c : $(SCALE_C) $(AUTO_HDR) + $(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_C) >$@ +man/cdk_uscale.3 : $(SCALE_M) man + -$(MKDIR_MAN) + $(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_M) >$@ + +SLIDER_H = $(srcdir)/include/gen-slider.h +SLIDER_C = $(srcdir)/gen-slider.c +SLIDER_M = $(srcdir)/man/gen-slider.3 + +include/fslider.h : $(SLIDER_H) + $(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_H) >$@ +fslider.c : $(SLIDER_C) $(AUTO_HDR) + $(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_C) >$@ +man/cdk_fslider.3 : $(SLIDER_M) man + -$(MKDIR_MAN) + $(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_M) >$@ + +include/slider.h : $(SLIDER_H) + $(GEN_SCALE) SLIDER Slider Int int $(SLIDER_H) >$@ +slider.c : $(SLIDER_C) $(AUTO_HDR) + $(GEN_SCALE) SLIDER Slider Int int $(SLIDER_C) >$@ +man/cdk_slider.3 : $(SLIDER_M) man + -$(MKDIR_MAN) + $(GEN_SCALE) SLIDER Slider Int int $(SLIDER_M) >$@ + +include/uslider.h : $(SLIDER_H) + $(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_H) >$@ +uslider.c : $(SLIDER_C) $(AUTO_HDR) + $(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_C) >$@ +man/cdk_uslider.3 : $(SLIDER_M) man + -$(MKDIR_MAN) + $(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_M) >$@ diff --git a/deps/cdk-5.0-20161210/NOTES b/deps/cdk-5.0-20161210/NOTES new file mode 100644 index 0000000..70d5f62 --- /dev/null +++ b/deps/cdk-5.0-20161210/NOTES @@ -0,0 +1,48 @@ +Cdk Notes +Copyright Mike Glover, 1995, 1996, 1997, 1998, 1999 +------------------------------------------------------------------------------- + +This document states some of the testing and history of the Cdk widget set. + +Cdk has gone through a major facelift since I first created it, and it's +current look I like enough to release and attach my name to. :) I have made sure +to remain as consistent as possible with function parameter positions, names, +purposes, and what-not. I hope I have been, if not mail me tell me what you +find inconsistent and I may change it. I say may because I don't want to kill +anyone's code if I can help it. That is why I waited so long before releasing +Cdk. I wanted it to be as stable as possible before sending it out into the +world. I think it's stable, and hopefully so will you. There are a few things +worth noting before continuing. + +Cdk has gone through some fairly rigorous testing, but since I did the testing +it may not be complete. I have complied the code with Purify (TM) and +Centerline's Testcenter (TM) and both say my code is clean. There are no +memory leaks, and the only problems exist in the curses library. If you use the +Ncurses library, it has been cleaned. Of course I am not the best to ask. The +only reason why I can say this is because I asked the Ncurses author. I don't +know how clean it is. I will assume very clean. + +But since I may not be able to see the forest for the trees, I'm willing to +bet that bugs still do exist, and you folks will find them. If you do find bugs +read the BUGS document supplied with this release to find out what to do. + +I do not plan on changing the interface to Cdk, so any code developed in it now +should pass the test of time. The only changes I can see are bug fixes and new +widgets. Lets hope this wish of mine remains true... + +There is an examples directory available which demonstrates all of the widgets +and some extra concepts, it's a great place to tool around in before banging +away at your own code. + +If you want to get a hold of me mail me at one of the following: + glover@credit.erin.utoronto.ca + mike@vexus.ca + +The CDK Web page has several homes. They are: + http://www.vexus.ca/CDK.html (official) + http://www.datasoft.on.ca/~cdk (Sponsered by the nice folks at Datasoft) + +Have fun. :) + +ttfn, + Mike diff --git a/deps/cdk-5.0-20161210/README b/deps/cdk-5.0-20161210/README new file mode 100644 index 0000000..0bc7fcf --- /dev/null +++ b/deps/cdk-5.0-20161210/README @@ -0,0 +1,150 @@ +-- $Id: README,v 1.10 2016/01/31 19:55:06 tom Exp $ +------------------------------------------------------------------------------- + +Copyright Thomas Dickey 1999-2015,2016 + +This is a modified/enhanced version of Cdk. The original README contents are +given below. + +This version of Cdk is found at + + http://invisible-island.net/cdk/ + ftp://invisible-island.net/cdk/ + +The intent of the modifications is to preserve nominal compatibility with the +original Cdk, while fixing bugs and design limitations. Some macros such as +ObjOf() have been introduced to move details out of individual widgets into +common functionality (see the cdk_objs.h header). In addition, fixed array +limits have been removed, using new functions in some instances which do not +have the fixed limits. + +Converting a program which uses the original Cdk is done by wrapping the widget +pointers in ObjOf() for struct members which have been moved into the CDKOBJS +struct. This is not a one-way conversion (for many applications), since a +header cdk_compat.h defines ObjOf() and a few obsolete functions which may be +used by older programs. By wrapping the widget pointers as needed in ObjOf(), +one may compile the same source against the old/new versions of Cdk to check +that the application is correctly upgraded. + +Once converted, there are additional functions and widgets provided by the +new version of Cdk. Bugs should (as noted on the webpage) be reported to me. + +------------------------------------------------------------------------------- +Cdk Readme Guide +Copyright Mike Glover, 1995, 1996, 1997, 1998, 1999 +------------------------------------------------------------------------------- + +Overview: +--------- +Cdk stands for 'Curses Development Kit' and it currently contains 21 ready +to use widgets which facilitate the speedy development of full screen +curses programs. This little project of mine started as a test to see how +compatible my Linux machine was to other UNIX breeds. While doing this I +discovered Ncurses, and played with it. These widgets are the result of +over a years worth of playing. The current complement of widgets are: + +Widget Type Quick Description +=========================================================================== +Alphalist Allows a user to select from a list of words, with + the ability to narrow the search list by typing in a + few characters of the desired word. +Buttonbox This creates a multiple button widget. +Calendar Creates a little simple calendar widget. +Dialog Prompts the user with a message, and the user + can pick an answer from the buttons provided. +Entry Allows the user to enter various types of information. +File Selector A file selector built from Cdk base widgets. This + example shows how to create more complicated widgets + using the Cdk widget library. +Graph Draws a graph. +Histogram Draws a histogram. +Item List Creates a pop up field which allows the user to select + one of several choices in a small field. Very useful + for things like days of the week or month names. +Label Displays messages in a pop up box, or the label can be + considered part of the screen. +Marquee Displays a message in a scrolling marquee. +Matrix Creates a complex matrix with lots of options. +Menu Creates a pull-down menu interface. +Multiple Line Entry A multiple line entry field. Very useful + for long fields. (like a description + field) +Radio List Creates a radio button list. +Scale Creates a numeric scale. Used for allowing a user to + pick a numeric value and restrict them to a range of + values. +Scrolling List Creates a scrolling list/menu list. +Scrolling Window Creates a scrolling log file viewer. Can add + information into the window while its running. + A good widget for displaying the progress of + something. (akin to a console window) +Selection List Creates a multiple option selection list. +Slider Akin to the scale widget, this widget provides a + visual slide bar to represent the numeric value. +Template Creates a entry field with character sensitive + positions. Used for pre-formatted fields like + dates and phone numbers. +Viewer This is a file/information viewer. Very useful + when you need to display loads of information. +=========================================================================== + +Each widget has the ability to display color, or other character attributes. +Cdk comes with a attribute/color format command set which allows a programmer +to add colors and characters attributes simply. + +The code has been cleaned using both Purify(TM) and Sun's Testcenter(TM), +so it is as clean as a babies butt. :) Any leaks I have seen are in the curses +libraries; there is nothing I can do about that, sorry. There should be no +memory leaks within the code, it shouldn't core dump, and it shouldn't do +anything unexpected. Unfortunately this probably is not the case. If you do +see something like this tell me after you read the BUGS file. + +Distribution: +------------- +This distribution has a full complement of manual pages, so any specifics to +the widgets will not be addressed in this read me. If you want to get right in +there, nroff the cdk.3 file in the man directory. It is the starting point +for all the manual pages. + +There are some other files to look at if you want to get anywhere. They are: + +INSTALL - This will show you how to build Cdk and install it on your system. + If there are any personal modifications that you think may be + needed, read this file. In fact read it regardless. :) + +COPYING - The legal stuff to protect my butt and all of the hard work that I + have put into this library. + +EXPANDING - You feel creative enough to add a widget, here are my requirements + that you have to follow to make the integration of a new widget + seamless. + +BUGS - What to do when you find a bug. It also lists all of the bugs found, + who found them, who fixed them, and when they were fixed. If you think + you have found a bug look at this file. If you do not think you have + the most up to date version of Cdk, go get it and try to replicate the + problem. Then look at the BUGS file again. If it is NOT there, then you + can mail me notifying me of a possible bug. I will try my hardest to get + back to you, but I have a pretty busy schedule so don't expect an instant + reply. This file will also explain how I would like any bug fixes sent to + me. + +NOTES - Misc babblings of myself somewhat related to this distribution. + +TODO - A list of things I plan to do in the future. (sleep) + +CHANGES - A list of changes from one release to another. + +If you want to get a hold of me mail me at one of the following: + glover@credit.erin.utoronto.ca + mike@vexus.ca + +The CDK Web page has several homes. They are: + http://www.vexus.ca/CDK.html (official) + http://www.datasoft.on.ca/~cdk (Sponsored by the nice folks at Datasoft) + +ttfn, + Mike + +PS: There is also a Perl5 extension of this library for you Perl5 fans. + Look under any CPAN site under the directory CPAN/authors/id/GLOVER. diff --git a/deps/cdk-5.0-20161210/TODO b/deps/cdk-5.0-20161210/TODO new file mode 100644 index 0000000..cb337a2 --- /dev/null +++ b/deps/cdk-5.0-20161210/TODO @@ -0,0 +1,53 @@ +Cdk To-Do List +Copyright Mike Glover, 1995, 1996, 1997, 1998, 1999 +------------------------------------------------------------------------------ + +There are a few things that I am either currently working on, or going to +work on in the near future. They are: + + * Add more functions to the drawing routines. (yadda, yadda, yadda...) + * Working on a tree widget... + * Working on a tab list widget... + * I would like to be able to have a captive shell widget. This + would allow you to start a subshell and have the user interact + with a spawned command via the captive shell. This would allow + you to spawn an interactive command through the widget. If any + one knows how to do this, please mail me. Maybe we'll work this + through. (I WOULD LOVE TO ADD THIS, IF ANYONE HAS ANY IDEAS + PLEASE MAIL ME) + * I am thinking about adding an X windows element to Cdk using + the Xforms library, because it seems to have roughly the same + widgets as I do. The plan is to have a simple environment variable + which tells the program what you want curses/X windows. We'll + see how this goes. + * I am going to (in the next revision), make the Cdk library more + X like with the ability to set/get attributes of the widgets via + functions. The proposed method is something like : + + value = CdkEntryGetXXX (widget) + CdkEntrySetXXX (widget, value) + + Where XXX is a property of the widget. It would be nice to create + a singlar widget type (CdkWidget) and to have generic functions + set/get the properties. (this is all being thought of to phase + in the X/Cdk idea mentioned above.) + * I'm also working on fixing the way the default callback function + for the widget editing functions is called. (i know this is brief, + but it's there more to remind me of an idea which was spurred on by + someone else's suggestion.) + * Version 5 should have the ability to properly attach widgets + together via constraints, positioning within forms, etc... The + next inception should make it simpler to create home-grown widgets. + (Version 5 may also only support Ncurses because I'm losing a lot + of functionality by being backward compatible.) + +If you want to get a hold of me mail me at one of the following: + glover@credit.erin.utoronto.ca + mike@vexus.ca + +The CDK Web page has several homes. They are: + http://www.vexus.ca/CDK.html (official) + http://www.datasoft.on.ca/~cdk (Sponsored by the nice folks at Datasoft) + +ttfn, + Mike diff --git a/deps/cdk-5.0-20161210/VERSION b/deps/cdk-5.0-20161210/VERSION new file mode 100644 index 0000000..560e939 --- /dev/null +++ b/deps/cdk-5.0-20161210/VERSION @@ -0,0 +1 @@ +6:1:4 5.0 20161210 diff --git a/deps/cdk-5.0-20161210/aclocal.m4 b/deps/cdk-5.0-20161210/aclocal.m4 new file mode 100644 index 0000000..703a5aa --- /dev/null +++ b/deps/cdk-5.0-20161210/aclocal.m4 @@ -0,0 +1,4949 @@ +dnl $Id: aclocal.m4,v 1.98 2016/11/20 15:18:17 tom Exp $ +dnl macros used for CDK configure script +dnl --------------------------------------------------------------------------- +dnl Copyright 1999-2015,2016 Thomas E. Dickey +dnl +dnl Permission is hereby granted, free of charge, to any person obtaining a +dnl copy of this software and associated documentation files (the "Software"), +dnl to deal in the Software without restriction, including without limitation +dnl the rights to use, copy, modify, merge, publish, distribute, distribute +dnl with modifications, sublicense, and/or sell copies of the Software, and to +dnl permit persons to whom the Software is furnished to do so, subject to the +dnl following conditions: +dnl +dnl The above copyright notice and this permission notice shall be included in +dnl all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +dnl THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +dnl DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name(s) of the above copyright +dnl holders shall not be used in advertising or otherwise to promote the sale, +dnl use or other dealings in this Software without prior written +dnl authorization. +dnl --------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------- +dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 +dnl ------------------ +dnl Conditionally generate script according to whether we're using a given autoconf. +dnl +dnl $1 = version to compare against +dnl $2 = code to use if AC_ACVERSION is at least as high as $1. +dnl $3 = code to use if AC_ACVERSION is older than $1. +define([CF_ACVERSION_CHECK], +[ +ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl +ifdef([m4_version_compare], +[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], +[CF_ACVERSION_COMPARE( +AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), +AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 +dnl -------------------- +dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, +dnl MAJOR2, MINOR2, TERNARY2, +dnl PRINTABLE2, not FOUND, FOUND) +define([CF_ACVERSION_COMPARE], +[ifelse(builtin([eval], [$2 < $5]), 1, +[ifelse([$8], , ,[$8])], +[ifelse([$9], , ,[$9])])])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_CFLAGS version: 12 updated: 2015/04/12 15:39:00 +dnl ------------- +dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS +dnl The second parameter if given makes this macro verbose. +dnl +dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, +dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily +dnl confused by the quotes (which require backslashes to keep them usable). +AC_DEFUN([CF_ADD_CFLAGS], +[ +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $1 +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +AC_SUBST(EXTRA_CPPFLAGS) + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_INCDIR version: 14 updated: 2015/05/25 20:53:04 +dnl ------------- +dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's +dnl redundant. We don't normally need to add -I/usr/local/include for gcc, +dnl but old versions (and some misinstalled ones) need that. To make things +dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to +dnl the include-path). +AC_DEFUN([CF_ADD_INCDIR], +[ +if test -n "$1" ; then + for cf_add_incdir in $1 + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + AC_TRY_COMPILE([#include ], + [printf("Hello")], + [], + [cf_have_incdir=yes]) + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + CF_VERBOSE(adding $cf_add_incdir to include-path) + ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 +dnl ---------- +dnl Add a library, used to enforce consistency. +dnl +dnl $1 = library to add, without the "-l" +dnl $2 = variable to update (default $LIBS) +AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57 +dnl ------------- +dnl Adds to the library-path +dnl +dnl Some machines have trouble with multiple -L options. +dnl +dnl $1 is the (list of) directory(s) to add +dnl $2 is the optional name of the variable to update (default LDFLAGS) +dnl +AC_DEFUN([CF_ADD_LIBDIR], +[ +if test -n "$1" ; then + for cf_add_libdir in $1 + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + CF_VERBOSE(adding $cf_add_libdir to library-path) + ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])" + fi + fi + done +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27 +dnl ----------- +dnl Add one or more libraries, used to enforce consistency. Libraries are +dnl prepended to an existing list, since their dependencies are assumed to +dnl already exist in the list. +dnl +dnl $1 = libraries to add, with the "-l", etc. +dnl $2 = variable to update (default $LIBS) +AC_DEFUN([CF_ADD_LIBS],[ +cf_add_libs="$1" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in [$]ifelse($2,,LIBS,[$2]) +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +ifelse($2,,LIBS,[$2])="$cf_add_libs" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 +dnl ---------------- +dnl Add a given library after another, e.g., following the one it satisfies a +dnl dependency for. +dnl +dnl $1 = the first library +dnl $2 = its dependency +AC_DEFUN([CF_ADD_LIB_AFTER],[ +CF_VERBOSE(...before $LIBS) +LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` +CF_VERBOSE(...after $LIBS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05 +dnl ------------------ +dnl Append to a search-list for a nonstandard header/lib-file +dnl $1 = the variable to return as result +dnl $2 = the package name +dnl $3 = the subdirectory, e.g., bin, include or lib +dnl $4 = the directory under which we will test for subdirectories +dnl $5 = a directory that we do not want $4 to match +AC_DEFUN([CF_ADD_SUBDIR_PATH], +[ +test "x$4" != "x$5" && \ +test -d "$4" && \ +ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) { + test -n "$verbose" && echo " ... testing for $3-directories under $4" + test -d $4/$3 && $1="[$]$1 $4/$3" + test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" + test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3" + test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3" + test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2" +} +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ANSI_CC_CHECK version: 13 updated: 2012/10/06 11:17:15 +dnl ---------------- +dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and +dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution. +AC_DEFUN([CF_ANSI_CC_CHECK], +[ +CF_CC_ENV_FLAGS + +AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[ +cf_cv_ansi_cc=no +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc +# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) +for cf_arg in "-DCC_HAS_PROTOS" \ + "" \ + -qlanglvl=ansi \ + -std1 \ + -Ae \ + "-Aa -D_HPUX_SOURCE" \ + -Xc +do + CF_ADD_CFLAGS($cf_arg) + AC_TRY_COMPILE( +[ +#ifndef CC_HAS_PROTOS +#if !defined(__STDC__) || (__STDC__ != 1) +choke me +#endif +#endif +],[ + int test (int i, double x); + struct s1 {int (*f) (int a);}; + struct s2 {int (*f) (double a);};], + [cf_cv_ansi_cc="$cf_arg"; break]) +done +CFLAGS="$cf_save_CFLAGS" +CPPFLAGS="$cf_save_CPPFLAGS" +]) + +if test "$cf_cv_ansi_cc" != "no"; then +if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then + CF_ADD_CFLAGS($cf_cv_ansi_cc) +else + AC_DEFINE(CC_HAS_PROTOS,1,[Define to 1 if C compiler supports prototypes]) +fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 +dnl --------------- +dnl For programs that must use an ANSI compiler, obtain compiler options that +dnl will make it recognize prototypes. We'll do preprocessor checks in other +dnl macros, since tools such as unproto can fake prototypes, but only part of +dnl the preprocessor. +AC_DEFUN([CF_ANSI_CC_REQD], +[AC_REQUIRE([CF_ANSI_CC_CHECK]) +if test "$cf_cv_ansi_cc" = "no"; then + AC_MSG_ERROR( +[Your compiler does not appear to recognize prototypes. +You have the following choices: + a. adjust your compiler options + b. get an up-to-date compiler + c. use a wrapper such as unproto]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 +dnl -------------- +dnl Allow user to disable a normally-on option. +AC_DEFUN([CF_ARG_DISABLE], +[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 +dnl ------------- +dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus +dnl values. +dnl +dnl Parameters: +dnl $1 = option name +dnl $2 = help-string +dnl $3 = action to perform if option is not default +dnl $4 = action if perform if option is default +dnl $5 = default option value (either 'yes' or 'no') +AC_DEFUN([CF_ARG_OPTION], +[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) + if test "$enableval" != "$5" ; then +ifelse([$3],,[ :]dnl +,[ $3]) ifelse([$4],,,[ + else + $4]) + fi],[enableval=$5 ifelse([$4],,,[ + $4 +])dnl +])])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CC_ENV_FLAGS version: 6 updated: 2016/08/29 20:57:00 +dnl --------------- +dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content +dnl into CC. This will not help with broken scripts that wrap the compiler +dnl with options, but eliminates a more common category of user confusion. +dnl +dnl In particular, it addresses the problem of being able to run the C +dnl preprocessor in a consistent manner. +dnl +dnl Caveat: this also disallows blanks in the pathname for the compiler, but +dnl the nuisance of having inconsistent settings for compiler and preprocessor +dnl outweighs that limitation. +AC_DEFUN([CF_CC_ENV_FLAGS], +[ +# This should have been defined by AC_PROG_CC +: ${CC:=cc} + +AC_MSG_CHECKING(\$CC variable) +case "$CC" in +(*[[\ \ ]]-*) + AC_MSG_RESULT(broken) + AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) + # humor him... + cf_flags=`echo "$CC" | sed -e 's/^.*[[ ]]\(-[[^ ]]\)/\1/'` + CC=`echo "$CC " | sed -e 's/[[ ]]-[[^ ]].*$//' -e 's/[[ ]]*$//'` + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[[IUDfgOW]]*) + CF_ADD_CFLAGS($cf_flags) + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done + CF_VERBOSE(resulting CC: '$CC') + CF_VERBOSE(resulting CFLAGS: '$CFLAGS') + CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') + ;; +(*) + AC_MSG_RESULT(ok) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 +dnl -------------- +dnl Check if we're accidentally using a cache from a different machine. +dnl Derive the system name, as a check for reusing the autoconf cache. +dnl +dnl If we've packaged config.guess and config.sub, run that (since it does a +dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow +dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM +dnl which is useful in cross-compiles. +dnl +dnl Note: we would use $ac_config_sub, but that is one of the places where +dnl autoconf 2.5x broke compatibility with autoconf 2.13 +AC_DEFUN([CF_CHECK_CACHE], +[ +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then + ifelse([$1],,[AC_CANONICAL_HOST],[$1]) + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) +AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) + +if test ".$system_name" != ".$cf_cv_system_name" ; then + AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) + AC_MSG_ERROR("Please remove config.cache and try again.") +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57 +dnl --------------- +dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from +dnl a build-configuration such as imake. These have the pitfall that they +dnl often contain compiler-specific options which we cannot use, mixed with +dnl preprocessor options that we usually can. +AC_DEFUN([CF_CHECK_CFLAGS], +[ +CF_VERBOSE(checking additions to CFLAGS) +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" +CF_ADD_CFLAGS($1,yes) +if test "x$cf_check_cflags" != "x$CFLAGS" ; then +AC_TRY_LINK([#include ],[printf("Hello world");],, + [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then + CF_VERBOSE(but keeping change to \$CPPFLAGS) + fi + CFLAGS="$cf_check_flags"]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09 +dnl ------------------------ +dnl Show the version of libtool +dnl +dnl Save the version in a cache variable - this is not entirely a good thing, +dnl but the version string from libtool is very ugly, and for bug reports it +dnl might be useful to have the original string. +AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[ +if test -n "$LIBTOOL" && test "$LIBTOOL" != none +then + AC_MSG_CHECKING(version of $LIBTOOL) + CF_LIBTOOL_VERSION + AC_MSG_RESULT($cf_cv_libtool_version) + if test -z "$cf_cv_libtool_version" ; then + AC_MSG_ERROR(This is not GNU libtool) + fi +else + AC_MSG_ERROR(GNU libtool has not been found) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 +dnl ----------------- +dnl Check if the given compiler is really clang. clang's C driver defines +dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does +dnl not ignore some gcc options. +dnl +dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to +dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from +dnl the wrappers for gcc and g++ warnings. +dnl +dnl $1 = GCC (default) or GXX +dnl $2 = CLANG_COMPILER (default) +dnl $3 = CFLAGS (default) or CXXFLAGS +AC_DEFUN([CF_CLANG_COMPILER],[ +ifelse([$2],,CLANG_COMPILER,[$2])=no + +if test "$ifelse([$1],,[$1],GCC)" = yes ; then + AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) + cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" + ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" + AC_TRY_COMPILE([],[ +#ifdef __clang__ +#else +make an error +#endif +],[ifelse([$2],,CLANG_COMPILER,[$2])=yes +cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" +],[]) + ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" + AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_CHTYPE version: 8 updated: 2012/10/06 08:57:51 +dnl ---------------- +dnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses). +AC_DEFUN([CF_CURSES_CHTYPE], +[ +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl +AC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[ + AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], + [chtype foo], + [cf_cv_chtype_decl=yes], + [cf_cv_chtype_decl=no])]) +if test $cf_cv_chtype_decl = yes ; then + AC_DEFINE(HAVE_TYPE_CHTYPE,1,[Define to 1 if chtype is declared]) + AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[ + AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], + [chtype foo; long x = foo], + [cf_cv_chtype_type=scalar], + [cf_cv_chtype_type=struct])]) + if test $cf_cv_chtype_type = scalar ; then + AC_DEFINE(TYPE_CHTYPE_IS_SCALAR,1,[Define to 1 if chtype is a scaler/integer]) + fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27 +dnl ---------------- +dnl Tie together the configure-script macros for curses. It may be ncurses, +dnl but unless asked, we do not make a special search for ncurses. However, +dnl still check for the ncurses version number, for use in other macros. +AC_DEFUN([CF_CURSES_CONFIG], +[ +CF_CURSES_CPPFLAGS +CF_NCURSES_VERSION +CF_CURSES_LIBS +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_CPPFLAGS version: 12 updated: 2015/04/15 19:08:48 +dnl ------------------ +dnl Look for the curses headers. +AC_DEFUN([CF_CURSES_CPPFLAGS],[ + +AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[ +cf_cv_curses_incdir=no +case $host_os in +(hpux10.*) + if test "x$cf_cv_screen" = "xcurses_colr" + then + test -d /usr/include/curses_colr && \ + cf_cv_curses_incdir="-I/usr/include/curses_colr" + fi + ;; +(sunos3*|sunos4*) + if test "x$cf_cv_screen" = "xcurses_5lib" + then + test -d /usr/5lib && \ + test -d /usr/5include && \ + cf_cv_curses_incdir="-I/usr/5include" + fi + ;; +esac +]) +test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" + +CF_CURSES_HEADER +CF_TERM_HEADER +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_FUNCS version: 18 updated: 2014/07/19 18:44:41 +dnl --------------- +dnl Curses-functions are a little complicated, since a lot of them are macros. +AC_DEFUN([CF_CURSES_FUNCS], +[ +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl +AC_REQUIRE([CF_XOPEN_CURSES]) +AC_REQUIRE([CF_CURSES_TERM_H]) +AC_REQUIRE([CF_CURSES_UNCTRL_H]) +for cf_func in $1 +do + CF_UPPER(cf_tr_func,$cf_func) + AC_MSG_CHECKING(for ${cf_func}) + CF_MSG_LOG(${cf_func}) + AC_CACHE_VAL(cf_cv_func_$cf_func,[ + eval cf_result='$ac_cv_func_'$cf_func + if test ".$cf_result" != ".no"; then + AC_TRY_LINK(CF__CURSES_HEAD, + [ +#ifndef ${cf_func} +long foo = (long)(&${cf_func}); +fprintf(stderr, "testing linkage of $cf_func:%p\n", foo); +if (foo + 1234 > 5678) + ${cf_cv_main_return:-return}(foo); +#endif + ], + [cf_result=yes], + [cf_result=no]) + fi + eval 'cf_cv_func_'$cf_func'=$cf_result' + ]) + # use the computed/retrieved cache-value: + eval 'cf_result=$cf_cv_func_'$cf_func + AC_MSG_RESULT($cf_result) + if test $cf_result != no; then + AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func}) + fi +done +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30 +dnl ---------------- +dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common +dnl variations of ncurses' installs. +dnl +dnl $1 = ncurses when looking for ncurses, or is empty +AC_DEFUN([CF_CURSES_HEADER],[ +AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ +cf_cv_ncurses_header=none +for cf_header in \ + ncurses.h ifelse($1,,,[$1/ncurses.h]) \ + curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) +do +AC_TRY_COMPILE([#include <${cf_header}>], + [initscr(); tgoto("?", 0,0)], + [cf_cv_ncurses_header=$cf_header; break],[]) +done +]) + +if test "$cf_cv_ncurses_header" = none ; then + AC_MSG_ERROR(No curses header-files found) +fi + +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. +AC_CHECK_HEADERS($cf_cv_ncurses_header) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_LIBS version: 39 updated: 2015/05/10 19:52:14 +dnl -------------- +dnl Look for the curses libraries. Older curses implementations may require +dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. +AC_DEFUN([CF_CURSES_LIBS],[ + +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl +AC_MSG_CHECKING(if we have identified curses libraries) +AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr(); tgoto("?", 0,0)], + cf_result=yes, + cf_result=no) +AC_MSG_RESULT($cf_result) + +if test "$cf_result" = no ; then +case $host_os in +(freebsd*) + AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) + ;; +(hpux10.*) + # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr + # next (1998), and xcurses "newer" (2000). There is no header file for + # Hcurses; the subdirectory curses_colr has the headers (curses.h and + # term.h) for cur_colr + if test "x$cf_cv_screen" = "xcurses_colr" + then + AC_CHECK_LIB(cur_colr,initscr,[ + CF_ADD_LIBS(-lcur_colr) + ac_cv_func_initscr=yes + ],[ + AC_CHECK_LIB(Hcurses,initscr,[ + # HP's header uses __HP_CURSES, but user claims _HP_CURSES. + CF_ADD_LIBS(-lHcurses) + CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" + ac_cv_func_initscr=yes + ])]) + fi + ;; +(linux*) + case `arch 2>/dev/null` in + (x86_64) + if test -d /lib64 + then + CF_ADD_LIBDIR(/lib64) + else + CF_ADD_LIBDIR(/lib) + fi + ;; + (*) + CF_ADD_LIBDIR(/lib) + ;; + esac + ;; +(sunos3*|sunos4*) + if test "x$cf_cv_screen" = "xcurses_5lib" + then + if test -d /usr/5lib ; then + CF_ADD_LIBDIR(/usr/5lib) + CF_ADD_LIBS(-lcurses -ltermcap) + fi + fi + ac_cv_func_initscr=yes + ;; +esac + +if test ".$ac_cv_func_initscr" != .yes ; then + cf_save_LIBS="$LIBS" + + if test ".${cf_cv_ncurses_version:-no}" != .no + then + cf_check_list="ncurses curses cursesX" + else + cf_check_list="cursesX curses ncurses" + fi + + # Check for library containing tgoto. Do this before curses library + # because it may be needed to link the test-case for initscr. + if test "x$cf_term_lib" = x + then + AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ + for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown + do + AC_CHECK_LIB($cf_term_lib,tgoto,[break]) + done + ]) + fi + + # Check for library containing initscr + test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" + if test "x$cf_curs_lib" = x + then + for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown + do + AC_CHECK_LIB($cf_curs_lib,initscr,[break]) + done + fi + test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) + + LIBS="-l$cf_curs_lib $cf_save_LIBS" + if test "$cf_term_lib" = unknown ; then + AC_MSG_CHECKING(if we can link with $cf_curs_lib library) + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr()], + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + test $cf_result = no && AC_MSG_ERROR(Cannot link curses library) + elif test "$cf_curs_lib" = "$cf_term_lib" ; then + : + elif test "$cf_term_lib" != predefined ; then + AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr(); tgoto((char *)0, 0, 0);], + [cf_result=no], + [ + LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr()], + [cf_result=yes], + [cf_result=error]) + ]) + AC_MSG_RESULT($cf_result) + fi +fi +fi + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_SETBEGYX version: 3 updated: 2013/06/15 11:12:27 +dnl ------------------ +dnl See if we can define a function to set a window's beginning y/x coordinates. +AC_DEFUN([CF_CURSES_SETBEGYX],[ +AC_MSG_CHECKING(how to define setbegyx) +cf_result=ERR +for cf_check in \ + '((win)->_begy = (y), (win)->_begx = (x), OK)' +do + AC_TRY_COMPILE([ +#include <${cf_cv_ncurses_header:-curses.h}> +],[ +WINDOW *win = 0; +#define setbegyx(win,y,x) $cf_check +setbegyx(win, 2, 3); +],[cf_result=$cf_check; break]) +done +AC_MSG_RESULT("$cf_result") +AC_DEFINE_UNQUOTED(setbegyx(win,y,x),$cf_result,[Define to function for setting window's y/x coordinates]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_TERM_H version: 11 updated: 2015/04/15 19:08:48 +dnl ---------------- +dnl SVr4 curses should have term.h as well (where it puts the definitions of +dnl the low-level interface). This may not be true in old/broken implementations, +dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4 +dnl running with Solaris 2.5.1). +AC_DEFUN([CF_CURSES_TERM_H], +[ +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl + +AC_CACHE_CHECK(for term.h, cf_cv_term_header,[ + +# If we found , look for , but always look +# for if we do not find the variant. + +cf_header_list="term.h ncurses/term.h ncursesw/term.h" + +case ${cf_cv_ncurses_header:-curses.h} in +(*/*) + cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h + cf_header_list="$cf_header_item $cf_header_list" + ;; +esac + +for cf_header in $cf_header_list +do + AC_TRY_COMPILE([ +#include <${cf_cv_ncurses_header:-curses.h}> +#include <${cf_header}>], + [WINDOW *x], + [cf_cv_term_header=$cf_header + break], + [cf_cv_term_header=no]) +done + +case $cf_cv_term_header in +(no) + # If curses is ncurses, some packagers still mess it up by trying to make + # us use GNU termcap. This handles the most common case. + for cf_header in ncurses/term.h ncursesw/term.h + do + AC_TRY_COMPILE([ +#include <${cf_cv_ncurses_header:-curses.h}> +#ifdef NCURSES_VERSION +#include <${cf_header}> +#else +make an error +#endif], + [WINDOW *x], + [cf_cv_term_header=$cf_header + break], + [cf_cv_term_header=no]) + done + ;; +esac +]) + +case $cf_cv_term_header in +(term.h) + AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) + ;; +(ncurses/term.h) + AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) + ;; +(ncursesw/term.h) + AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CURSES_UNCTRL_H version: 4 updated: 2015/04/15 19:08:48 +dnl ------------------ +dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages +dnl may put it in a subdirectory (along with ncurses' other headers, of +dnl course). Packages which put the headers in inconsistent locations are +dnl broken). +AC_DEFUN([CF_CURSES_UNCTRL_H], +[ +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl + +AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[ + +# If we found , look for , but always look +# for if we do not find the variant. + +cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" + +case ${cf_cv_ncurses_header:-curses.h} in +(*/*) + cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h + cf_header_list="$cf_header_item $cf_header_list" + ;; +esac + +for cf_header in $cf_header_list +do + AC_TRY_COMPILE([ +#include <${cf_cv_ncurses_header:-curses.h}> +#include <${cf_header}>], + [WINDOW *x], + [cf_cv_unctrl_header=$cf_header + break], + [cf_cv_unctrl_header=no]) +done +]) + +case $cf_cv_unctrl_header in +(no) + AC_MSG_WARN(unctrl.h header not found) + ;; +esac + +case $cf_cv_unctrl_header in +(unctrl.h) + AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h]) + ;; +(ncurses/unctrl.h) + AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h]) + ;; +(ncursesw/unctrl.h) + AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h]) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 +dnl ---------- +dnl "dirname" is not portable, so we fake it with a shell script. +AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 +dnl --------------- +dnl You can always use "make -n" to see the actual options, but it's hard to +dnl pick out/analyze warning messages when the compile-line is long. +dnl +dnl Sets: +dnl ECHO_LT - symbol to control if libtool is verbose +dnl ECHO_LD - symbol to prefix "cc -o" lines +dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) +dnl SHOW_CC - symbol to put before explicit "cc -c" lines +dnl ECHO_CC - symbol to put before any "cc" line +dnl +AC_DEFUN([CF_DISABLE_ECHO],[ +AC_MSG_CHECKING(if you want to see long compiling messages) +CF_ARG_DISABLE(echo, + [ --disable-echo do not display "compiling" commands], + [ + ECHO_LT='--silent' + ECHO_LD='@echo linking [$]@;' + RULE_CC='@echo compiling [$]<' + SHOW_CC='@echo compiling [$]@' + ECHO_CC='@' +],[ + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' +]) +AC_MSG_RESULT($enableval) +AC_SUBST(ECHO_LT) +AC_SUBST(ECHO_LD) +AC_SUBST(RULE_CC) +AC_SUBST(SHOW_CC) +AC_SUBST(ECHO_CC) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 +dnl ---------------- +dnl Combine no-leak checks with the libraries or tools that are used for the +dnl checks. +AC_DEFUN([CF_DISABLE_LEAKS],[ + +AC_REQUIRE([CF_WITH_DMALLOC]) +AC_REQUIRE([CF_WITH_DBMALLOC]) +AC_REQUIRE([CF_WITH_VALGRIND]) + +AC_MSG_CHECKING(if you want to perform memory-leak testing) +AC_ARG_ENABLE(leaks, + [ --disable-leaks test: free permanent memory, analyze leaks], + [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], + : ${with_no_leaks:=no}) +AC_MSG_RESULT($with_no_leaks) + +if test "$with_no_leaks" = yes ; then + AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) + AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_LIBTOOL_VERSION version: 3 updated: 2015/04/17 21:13:04 +dnl -------------------------- +dnl Check if we should use the libtool 1.5 feature "-version-number" instead of +dnl the older "-version-info" feature. The newer feature allows us to use +dnl version numbering on shared libraries which make them compatible with +dnl various systems. +AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION], +[ +AC_MSG_CHECKING(if libtool -version-number should be used) +CF_ARG_DISABLE(libtool-version, + [ --disable-libtool-version enable to use libtool's incompatible naming scheme], + [cf_libtool_version=no], + [cf_libtool_version=yes]) +AC_MSG_RESULT($cf_libtool_version) + +if test "$cf_libtool_version" = yes ; then + LIBTOOL_VERSION="-version-number" +else + LIBTOOL_VERSION="-version-info" + case "x$VERSION" in + (x) + AC_MSG_WARN(VERSION was not set) + ;; + (x*.*.*) + ABI_VERSION="$VERSION" + CF_VERBOSE(ABI_VERSION: $ABI_VERSION) + ;; + (x*:*:*) + ABI_VERSION=`echo "$VERSION" | sed -e 's/:/./g'` + CF_VERBOSE(ABI_VERSION: $ABI_VERSION) + ;; + (*) + AC_MSG_WARN(unexpected VERSION value: $VERSION) + ;; + esac +fi + +AC_SUBST(ABI_VERSION) +AC_SUBST(LIBTOOL_VERSION) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33 +dnl --------------------- +dnl The rpath-hack makes it simpler to build programs, particularly with the +dnl *BSD ports which may have essential libraries in unusual places. But it +dnl can interfere with building an executable for the base system. Use this +dnl option in that case. +AC_DEFUN([CF_DISABLE_RPATH_HACK], +[ +AC_MSG_CHECKING(if rpath-hack should be disabled) +CF_ARG_DISABLE(rpath-hack, + [ --disable-rpath-hack don't add rpath options for additional libraries], + [cf_disable_rpath_hack=yes], + [cf_disable_rpath_hack=no]) +AC_MSG_RESULT($cf_disable_rpath_hack) +if test "$cf_disable_rpath_hack" = no ; then + CF_RPATH_HACK +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42 +dnl --------------- +dnl Check if the rpath option should be used, setting cache variable +dnl cf_cv_enable_rpath if so. +AC_DEFUN([CF_ENABLE_RPATH], +[ +AC_MSG_CHECKING(if rpath option should be used) +AC_ARG_ENABLE(rpath, +[ --enable-rpath use rpath option when generating shared libraries], +[cf_cv_enable_rpath=$enableval], +[cf_cv_enable_rpath=no]) +AC_MSG_RESULT($cf_cv_enable_rpath) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54 +dnl --------------- +dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We +dnl prefer a standard location, and use -L options only if we do not find the +dnl library in the standard library location(s). +dnl $1 = library name +dnl $2 = library class, usually the same as library name +dnl $3 = includes +dnl $4 = code fragment to compile/link +dnl $5 = corresponding function-name +dnl $6 = flag, nonnull if failure should not cause an error-exit +dnl +dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had +dnl to use a -L option. +AC_DEFUN([CF_FIND_LIBRARY], +[ + eval 'cf_cv_have_lib_'$1'=no' + cf_libdir="" + AC_CHECK_FUNC($5, + eval 'cf_cv_have_lib_'$1'=yes',[ + cf_save_LIBS="$LIBS" + AC_MSG_CHECKING(for $5 in -l$1) + LIBS="-l$1 $LIBS" + AC_TRY_LINK([$3],[$4], + [AC_MSG_RESULT(yes) + eval 'cf_cv_have_lib_'$1'=yes' + ], + [AC_MSG_RESULT(no) + CF_LIBRARY_PATH(cf_search,$2) + for cf_libdir in $cf_search + do + AC_MSG_CHECKING(for -l$1 in $cf_libdir) + LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" + AC_TRY_LINK([$3],[$4], + [AC_MSG_RESULT(yes) + eval 'cf_cv_have_lib_'$1'=yes' + break], + [AC_MSG_RESULT(no) + LIBS="$cf_save_LIBS"]) + done + ]) + ]) +eval 'cf_found_library=[$]cf_cv_have_lib_'$1 +ifelse($6,,[ +if test $cf_found_library = no ; then + AC_MSG_ERROR(Cannot link $1 library) +fi +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_FIND_LINKAGE version: 20 updated: 2015/04/18 08:56:57 +dnl --------------- +dnl Find a library (specifically the linkage used in the code fragment), +dnl searching for it if it is not already in the library path. +dnl See also CF_ADD_SEARCHPATH. +dnl +dnl Parameters (4-on are optional): +dnl $1 = headers for library entrypoint +dnl $2 = code fragment for library entrypoint +dnl $3 = the library name without the "-l" option or ".so" suffix. +dnl $4 = action to perform if successful (default: update CPPFLAGS, etc) +dnl $5 = action to perform if not successful +dnl $6 = module name, if not the same as the library name +dnl $7 = extra libraries +dnl +dnl Sets these variables: +dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found +dnl $cf_cv_header_path_$3 - include-directory if needed +dnl $cf_cv_library_path_$3 - library-directory if needed +dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3 +AC_DEFUN([CF_FIND_LINKAGE],[ + +# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these +# will be set on completion of the AC_TRY_LINK below. +cf_cv_header_path_$3= +cf_cv_library_path_$3= + +CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)]) + +cf_save_LIBS="$LIBS" + +AC_TRY_LINK([$1],[$2],[ + cf_cv_find_linkage_$3=yes + cf_cv_header_path_$3=/usr/include + cf_cv_library_path_$3=/usr/lib +],[ + +LIBS="-l$3 $7 $cf_save_LIBS" + +AC_TRY_LINK([$1],[$2],[ + cf_cv_find_linkage_$3=yes + cf_cv_header_path_$3=/usr/include + cf_cv_library_path_$3=/usr/lib + cf_cv_library_file_$3="-l$3" +],[ + cf_cv_find_linkage_$3=no + LIBS="$cf_save_LIBS" + + CF_VERBOSE(find linkage for $3 library) + CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)]) + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_test_CPPFLAGS="$CPPFLAGS" + + CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) + for cf_cv_header_path_$3 in $cf_search + do + if test -d $cf_cv_header_path_$3 ; then + CF_VERBOSE(... testing $cf_cv_header_path_$3) + CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3" + AC_TRY_COMPILE([$1],[$2],[ + CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) + cf_cv_find_linkage_$3=maybe + cf_test_CPPFLAGS="$CPPFLAGS" + break],[ + CPPFLAGS="$cf_save_CPPFLAGS" + ]) + fi + done + + if test "$cf_cv_find_linkage_$3" = maybe ; then + + CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)]) + + cf_save_LIBS="$LIBS" + cf_save_LDFLAGS="$LDFLAGS" + + ifelse([$6],,,[ + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-l$3 $7 $cf_save_LIBS" + AC_TRY_LINK([$1],[$2],[ + CF_VERBOSE(... found $3 library in system) + cf_cv_find_linkage_$3=yes]) + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + ]) + + if test "$cf_cv_find_linkage_$3" != yes ; then + CF_LIBRARY_PATH(cf_search,$3) + for cf_cv_library_path_$3 in $cf_search + do + if test -d $cf_cv_library_path_$3 ; then + CF_VERBOSE(... testing $cf_cv_library_path_$3) + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-l$3 $7 $cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" + AC_TRY_LINK([$1],[$2],[ + CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) + cf_cv_find_linkage_$3=yes + cf_cv_library_file_$3="-l$3" + break],[ + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS" + ]) + fi + done + CPPFLAGS="$cf_save_CPPFLAGS" + LDFLAGS="$cf_save_LDFLAGS" + fi + + else + cf_cv_find_linkage_$3=no + fi + ],$7) +]) + +LIBS="$cf_save_LIBS" + +if test "$cf_cv_find_linkage_$3" = yes ; then +ifelse([$4],,[ + CF_ADD_INCDIR($cf_cv_header_path_$3) + CF_ADD_LIBDIR($cf_cv_library_path_$3) + CF_ADD_LIB($3) +],[$4]) +else +ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09 +dnl -------------- +dnl Forget that we saw the given tool. +AC_DEFUN([CF_FORGET_TOOL],[ +unset ac_cv_prog_ac_ct_$1 +unset ac_ct_$1 +unset $1 +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_FUNC_LSTAT version: 3 updated: 2012/11/08 20:57:52 +dnl ------------- +dnl A conventional existence-check for 'lstat' won't work with the Linux +dnl version of gcc 2.7.0, since the symbol is defined only within +dnl as an inline function. +dnl +dnl So much for portability. +AC_DEFUN([CF_FUNC_LSTAT], +[ +AC_MSG_CHECKING(for lstat) +AC_CACHE_VAL(ac_cv_func_lstat,[ +AC_TRY_LINK([ +#include +#include ], + [lstat(".", (struct stat *)0)], + [ac_cv_func_lstat=yes], + [ac_cv_func_lstat=no]) + ]) +AC_MSG_RESULT($ac_cv_func_lstat ) +if test $ac_cv_func_lstat = yes; then + AC_DEFINE(HAVE_LSTAT,1,[Define to 1 if we have lstat]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00 +dnl ----------------- +dnl Test for availability of useful gcc __attribute__ directives to quiet +dnl compiler warnings. Though useful, not all are supported -- and contrary +dnl to documentation, unrecognized directives cause older compilers to barf. +AC_DEFUN([CF_GCC_ATTRIBUTES], +[ +if test "$GCC" = yes +then +cat > conftest.i < conftest.$ac_ext <&AC_FD_CC + + case $cf_attribute in + (printf) + cf_printf_attribute=yes + cat >conftest.h <conftest.h <conftest.h <>confdefs.h + case $cf_attribute in + (noreturn) + AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) + ;; + (printf) + cf_value='/* nothing */' + if test "$cf_printf_attribute" != no ; then + cf_value='__attribute__((format(printf,fmt,var)))' + AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) + fi + AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) + ;; + (scanf) + cf_value='/* nothing */' + if test "$cf_scanf_attribute" != no ; then + cf_value='__attribute__((format(scanf,fmt,var)))' + AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) + fi + AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) + ;; + (unused) + AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) + ;; + esac + fi + done +else + fgrep define conftest.i >>confdefs.h +fi +rm -rf conftest* +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 +dnl -------------- +dnl Find version of gcc +AC_DEFUN([CF_GCC_VERSION],[ +AC_REQUIRE([AC_PROG_CC]) +GCC_VERSION=none +if test "$GCC" = yes ; then + AC_MSG_CHECKING(version of $CC) + GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" + test -z "$GCC_VERSION" && GCC_VERSION=unknown + AC_MSG_RESULT($GCC_VERSION) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GCC_WARNINGS version: 32 updated: 2015/04/12 15:39:00 +dnl --------------- +dnl Check if the compiler supports useful warning options. There's a few that +dnl we don't use, simply because they're too noisy: +dnl +dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) +dnl -Wredundant-decls (system headers make this too noisy) +dnl -Wtraditional (combines too many unrelated messages, only a few useful) +dnl -Wwrite-strings (too noisy, but should review occasionally). This +dnl is enabled for ncurses using "--enable-const". +dnl -pedantic +dnl +dnl Parameter: +dnl $1 is an optional list of gcc warning flags that a particular +dnl application might want to use, e.g., "no-unused" for +dnl -Wno-unused +dnl Special: +dnl If $with_ext_const is "yes", add a check for -Wwrite-strings +dnl +AC_DEFUN([CF_GCC_WARNINGS], +[ +AC_REQUIRE([CF_GCC_VERSION]) +CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) +CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) + +cat > conftest.$ac_ext <], +[int x = optind; char *y = optarg], +[cf_cv_getopt_header=$cf_header + break]) +done +]) +if test $cf_cv_getopt_header != none ; then + AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header]) +fi +if test $cf_cv_getopt_header = getopt.h ; then + AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37 +dnl ------------- +dnl Check if we must define _GNU_SOURCE to get a reasonable value for +dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect +dnl (or misfeature) of glibc2, which breaks portability of many applications, +dnl since it is interwoven with GNU extensions. +dnl +dnl Well, yes we could work around it... +AC_DEFUN([CF_GNU_SOURCE], +[ +AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ +AC_TRY_COMPILE([#include ],[ +#ifndef _XOPEN_SOURCE +make an error +#endif], + [cf_cv_gnu_source=no], + [cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + AC_TRY_COMPILE([#include ],[ +#ifdef _XOPEN_SOURCE +make an error +#endif], + [cf_cv_gnu_source=no], + [cf_cv_gnu_source=yes]) + CPPFLAGS="$cf_save" + ]) +]) + +if test "$cf_cv_gnu_source" = yes +then +AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ +CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + AC_TRY_COMPILE([#include ],[ +#ifdef _DEFAULT_SOURCE +make an error +#endif], + [cf_cv_default_source=no], + [cf_cv_default_source=yes]) + ]) +test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48 +dnl -------------- +dnl Construct a search-list of directories for a nonstandard header-file +dnl +dnl Parameters +dnl $1 = the variable to return as result +dnl $2 = the package name +AC_DEFUN([CF_HEADER_PATH], +[ +$1= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in + (-I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE) + cf_header_path_list="$cf_header_path_list [$]$1" + ;; + esac + done +fi + +# add the variations for the package we are looking for +CF_SUBDIR_PATH($1,$2,include) + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && $1="[$]$1 $includedir" + test -d $includedir/$2 && $1="[$]$1 $includedir/$2" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && $1="[$]$1 $oldincludedir" + test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2" +} + +$1="[$]$1 $cf_header_path_list" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 +dnl ----------------- +dnl Check if the given compiler is really the Intel compiler for Linux. It +dnl tries to imitate gcc, but does not return an error when it finds a mismatch +dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. +dnl +dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to +dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from +dnl the wrappers for gcc and g++ warnings. +dnl +dnl $1 = GCC (default) or GXX +dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS +dnl $3 = CFLAGS (default) or CXXFLAGS +AC_DEFUN([CF_INTEL_COMPILER],[ +AC_REQUIRE([AC_CANONICAL_HOST]) +ifelse([$2],,INTEL_COMPILER,[$2])=no + +if test "$ifelse([$1],,[$1],GCC)" = yes ; then + case $host_os in + (linux*|gnu*) + AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) + cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" + ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" + AC_TRY_COMPILE([],[ +#ifdef __INTEL_COMPILER +#else +make an error +#endif +],[ifelse([$2],,INTEL_COMPILER,[$2])=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147" +],[]) + ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" + AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) + ;; + esac +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_LD_RPATH_OPT version: 7 updated: 2016/02/20 18:01:19 +dnl --------------- +dnl For the given system and compiler, find the compiler flags to pass to the +dnl loader to use the "rpath" feature. +AC_DEFUN([CF_LD_RPATH_OPT], +[ +AC_REQUIRE([CF_CHECK_CACHE]) + +LD_RPATH_OPT= +AC_MSG_CHECKING(for an rpath option) +case $cf_cv_system_name in +(irix*) + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; +(linux*|gnu*|k*bsd*-gnu|freebsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; +(openbsd[[2-9]].*|mirbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; +(dragonfly*) + LD_RPATH_OPT="-rpath " + ;; +(netbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; +(osf*|mls+*) + LD_RPATH_OPT="-rpath " + ;; +(solaris2*) + LD_RPATH_OPT="-R" + ;; +(*) + ;; +esac +AC_MSG_RESULT($LD_RPATH_OPT) + +case "x$LD_RPATH_OPT" in +(x-R*) + AC_MSG_CHECKING(if we need a space after rpath option) + cf_save_LIBS="$LIBS" + CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) + AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) + LIBS="$cf_save_LIBS" + AC_MSG_RESULT($cf_rpath_space) + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48 +dnl --------------- +dnl Construct a search-list of directories for a nonstandard library-file +dnl +dnl Parameters +dnl $1 = the variable to return as result +dnl $2 = the package name +AC_DEFUN([CF_LIBRARY_PATH], +[ +$1= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in + (-L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE) + cf_library_path_list="$cf_library_path_list [$]$1" + ;; + esac + done +fi + +CF_SUBDIR_PATH($1,$2,lib) + +$1="$cf_library_path_list [$]$1" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09 +dnl ------------------ +AC_DEFUN([CF_LIBTOOL_VERSION],[ +if test -n "$LIBTOOL" && test "$LIBTOOL" != none +then + cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'` +else + cf_cv_libtool_version= +fi +test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_LIB_PREFIX version: 12 updated: 2015/10/17 19:03:33 +dnl ------------- +dnl Compute the library-prefix for the given host system +dnl $1 = variable to set +define([CF_LIB_PREFIX], +[ + case $cf_cv_system_name in + (OS/2*|os2*) + if test "$DFT_LWR_MODEL" = libtool; then + LIB_PREFIX='lib' + else + LIB_PREFIX='' + fi + ;; + (*) LIB_PREFIX='lib' + ;; + esac +ifelse($1,,,[$1=$LIB_PREFIX]) + AC_SUBST(LIB_PREFIX) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_LIB_SUFFIX version: 25 updated: 2015/04/17 21:13:04 +dnl ------------- +dnl Compute the library file-suffix from the given model name +dnl $1 = model name +dnl $2 = variable to set (the nominal library suffix) +dnl $3 = dependency variable to set (actual filename) +dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. +AC_DEFUN([CF_LIB_SUFFIX], +[ + case X$1 in + (Xlibtool) + $2='.la' + $3=[$]$2 + ;; + (Xdebug) + $2='_g.a' + $3=[$]$2 + ;; + (Xprofile) + $2='_p.a' + $3=[$]$2 + ;; + (Xshared) + case $cf_cv_system_name in + (aix[[5-7]]*) + $2='.so' + $3=[$]$2 + ;; + (cygwin*|msys*|mingw*) + $2='.dll' + $3='.dll.a' + ;; + (darwin*) + $2='.dylib' + $3=[$]$2 + ;; + (hpux*) + case $target in + (ia64*) + $2='.so' + $3=[$]$2 + ;; + (*) + $2='.sl' + $3=[$]$2 + ;; + esac + ;; + (*) + $2='.so' + $3=[$]$2 + ;; + esac + ;; + (*) + $2='.a' + $3=[$]$2 + ;; + esac + if test -n "${LIB_SUFFIX}${EXTRA_SUFFIX}" + then + $2="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$2}" + $3="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$3}" + fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_LOCALE version: 5 updated: 2012/10/06 11:17:15 +dnl --------- +dnl Check if we have setlocale() and its header, +dnl The optional parameter $1 tells what to do if we do have locale support. +AC_DEFUN([CF_LOCALE], +[ +AC_MSG_CHECKING(for setlocale()) +AC_CACHE_VAL(cf_cv_locale,[ +AC_TRY_LINK([#include ], + [setlocale(LC_ALL, "")], + [cf_cv_locale=yes], + [cf_cv_locale=no]) + ]) +AC_MSG_RESULT($cf_cv_locale) +test $cf_cv_locale = yes && { ifelse($1,,AC_DEFINE(LOCALE,1,[Define to 1 if we have locale support]),[$1]) } +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MAKEFLAGS version: 17 updated: 2015/08/05 20:44:28 +dnl ------------ +dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' +dnl options to lower-levels. It's very useful for "make -n" -- if we have it. +dnl (GNU 'make' does both, something POSIX 'make', which happens to make the +dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) +AC_DEFUN([CF_MAKEFLAGS], +[ +AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ + cf_cv_makeflags='' + for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' + do + cat >cf_makeflags.tmp </dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'` + case "$cf_result" in + (.*k|.*kw) + cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` + case "$cf_result" in + (.*CC=*) cf_cv_makeflags= + ;; + (*) cf_cv_makeflags=$cf_option + ;; + esac + break + ;; + (.-) ;; + (*) echo "given option \"$cf_option\", no match \"$cf_result\"" + ;; + esac + done + rm -f cf_makeflags.tmp +]) + +AC_SUBST(cf_cv_makeflags) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 +dnl ------------ +dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have +dnl a monocase filesystem. +AC_DEFUN([CF_MAKE_TAGS],[ +AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) + +AC_CHECK_PROGS(CTAGS, exctags ctags) +AC_CHECK_PROGS(ETAGS, exetags etags) + +AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) + +if test "$cf_cv_mixedcase" = yes ; then + AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) +else + MAKE_UPPER_TAGS=no +fi + +if test "$MAKE_UPPER_TAGS" = yes ; then + MAKE_UPPER_TAGS= +else + MAKE_UPPER_TAGS="#" +fi + +if test "$MAKE_LOWER_TAGS" = yes ; then + MAKE_LOWER_TAGS= +else + MAKE_LOWER_TAGS="#" +fi + +AC_SUBST(CTAGS) +AC_SUBST(ETAGS) + +AC_SUBST(MAKE_UPPER_TAGS) +AC_SUBST(MAKE_LOWER_TAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00 +dnl ---------------------- +dnl Check if the file-system supports mixed-case filenames. If we're able to +dnl create a lowercase name and see it as uppercase, it doesn't support that. +AC_DEFUN([CF_MIXEDCASE_FILENAMES], +[ +AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ +if test "$cross_compiling" = yes ; then + case $target_alias in + (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) + cf_cv_mixedcase=no + ;; + (*) + cf_cv_mixedcase=yes + ;; + esac +else + rm -f conftest CONFTEST + echo test >conftest + if test -f CONFTEST ; then + cf_cv_mixedcase=no + else + cf_cv_mixedcase=yes + fi + rm -f conftest CONFTEST +fi +]) +test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 +dnl ---------- +dnl Write a debug message to config.log, along with the line number in the +dnl configure script. +AC_DEFUN([CF_MSG_LOG],[ +echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05 +dnl ------------------- +dnl Check if we can compile with ncurses' header file +dnl $1 is the cache variable to set +dnl $2 is the header-file to include +dnl $3 is the root name (ncurses or ncursesw) +AC_DEFUN([CF_NCURSES_CC_CHECK],[ + AC_TRY_COMPILE([ +]ifelse($3,ncursesw,[ +#define _XOPEN_SOURCE_EXTENDED +#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ +#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ +])[ +#include <$2>],[ +#ifdef NCURSES_VERSION +]ifelse($3,ncursesw,[ +#ifndef WACS_BSSB + make an error +#endif +])[ +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); +#else + make an error +#endif +#endif + ] + ,[$1=$2] + ,[$1=no]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_CONFIG version: 17 updated: 2015/07/07 04:22:07 +dnl ----------------- +dnl Tie together the configure-script macros for ncurses, preferring these in +dnl order: +dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG +dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG +dnl c) just plain libraries +dnl +dnl $1 is the root library name (default: "ncurses") +AC_DEFUN([CF_NCURSES_CONFIG],[ +AC_REQUIRE([CF_PKG_CONFIG]) +cf_ncuconfig_root=ifelse($1,,ncurses,$1) +cf_have_ncuconfig=no + +if test "x${PKG_CONFIG:=none}" != xnone; then + AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root) + if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then + AC_MSG_RESULT(yes) + + AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work) + cf_have_ncuconfig=unknown + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" + + CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`" + CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`) + + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], + [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}> + int main(void) + { char *xx = curses_version(); return (xx == 0); }], + [cf_have_ncuconfig=yes], + [cf_have_ncuconfig=no], + [cf_have_ncuconfig=maybe])], + [cf_have_ncuconfig=no]) + AC_MSG_RESULT($cf_have_ncuconfig) + test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes + if test "$cf_have_ncuconfig" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + NCURSES_CONFIG_PKG=none + else + AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + NCURSES_CONFIG_PKG=$cf_ncuconfig_root + fi + + else + AC_MSG_RESULT(no) + NCURSES_CONFIG_PKG=none + fi +else + NCURSES_CONFIG_PKG=none +fi + +if test "x$cf_have_ncuconfig" = "xno"; then + echo "Looking for ${cf_ncuconfig_root}-config" + + CF_ACVERSION_CHECK(2.52, + [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], + [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) + + if test "$NCURSES_CONFIG" != none ; then + + CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" + CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) + + # even with config script, some packages use no-override for curses.h + CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) + + dnl like CF_NCURSES_CPPFLAGS + AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + + dnl like CF_NCURSES_LIBS + CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) + AC_DEFINE_UNQUOTED($cf_nculib_ROOT) + + dnl like CF_NCURSES_VERSION + cf_cv_ncurses_version=`$NCURSES_CONFIG --version` + + else + + CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) + CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) + + fi +else + NCURSES_CONFIG=none +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51 +dnl ------------------- +dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting +dnl the CPPFLAGS variable so we can include its header. +dnl +dnl The header files may be installed as either curses.h, or ncurses.h (would +dnl be obsolete, except that some packagers prefer this name to distinguish it +dnl from a "native" curses implementation). If not installed for overwrite, +dnl the curses.h file would be in an ncurses subdirectory (e.g., +dnl /usr/include/ncurses), but someone may have installed overwriting the +dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd +dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in +dnl the header. +dnl +dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header +dnl is already in the include-path, don't even bother with this, since we cannot +dnl easily determine which file it is. In this case, it has to be . +dnl +dnl The optional parameter gives the root name of the library, in case it is +dnl not installed as the default curses library. That is how the +dnl wide-character version of ncurses is installed. +AC_DEFUN([CF_NCURSES_CPPFLAGS], +[AC_REQUIRE([CF_WITH_CURSES_DIR]) + +AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl +cf_ncuhdr_root=ifelse($1,,ncurses,$1) + +test -n "$cf_cv_curses_dir" && \ +test "$cf_cv_curses_dir" != "no" && { \ + CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root) +} + +AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[ + cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" + ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" + for cf_header in $cf_header_list + do + CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1) + test "$cf_cv_ncurses_h" != no && break + done +]) + +CF_NCURSES_HEADER +CF_TERM_HEADER + +# some applications need this, but should check for NCURSES_VERSION +AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + +CF_NCURSES_VERSION +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_HEADER version: 4 updated: 2015/04/15 19:08:48 +dnl ----------------- +dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common +dnl variations of ncurses' installs. +dnl +dnl See also CF_CURSES_HEADER, which sets the same cache variable. +AC_DEFUN([CF_NCURSES_HEADER],[ + +if test "$cf_cv_ncurses_h" != no ; then + cf_cv_ncurses_header=$cf_cv_ncurses_h +else + +AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[ + test -n "$verbose" && echo + CF_HEADER_PATH(cf_search,$cf_ncuhdr_root) + test -n "$verbose" && echo search path $cf_search + cf_save2_CPPFLAGS="$CPPFLAGS" + for cf_incdir in $cf_search + do + CF_ADD_INCDIR($cf_incdir) + for cf_header in \ + ncurses.h \ + curses.h + do + CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1) + if test "$cf_cv_ncurses_h2" != no ; then + cf_cv_ncurses_h2=$cf_incdir/$cf_header + test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG + break + fi + test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG + done + CPPFLAGS="$cf_save2_CPPFLAGS" + test "$cf_cv_ncurses_h2" != no && break + done + test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found) + ]) + + CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2) + cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` + if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then + cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header + fi + CF_ADD_INCDIR($cf_1st_incdir) + +fi + +# Set definitions to allow ifdef'ing for ncurses.h + +case $cf_cv_ncurses_header in +(*ncurses.h) + AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h]) + ;; +esac + +case $cf_cv_ncurses_header in +(ncurses/curses.h|ncurses/ncurses.h) + AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h]) + ;; +(ncursesw/curses.h|ncursesw/ncurses.h) + AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h]) + ;; +esac + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_LIBS version: 17 updated: 2015/04/15 19:08:48 +dnl --------------- +dnl Look for the ncurses library. This is a little complicated on Linux, +dnl because it may be linked with the gpm (general purpose mouse) library. +dnl Some distributions have gpm linked with (bsd) curses, which makes it +dnl unusable with ncurses. However, we don't want to link with gpm unless +dnl ncurses has a dependency, since gpm is normally set up as a shared library, +dnl and the linker will record a dependency. +dnl +dnl The optional parameter gives the root name of the library, in case it is +dnl not installed as the default curses library. That is how the +dnl wide-character version of ncurses is installed. +AC_DEFUN([CF_NCURSES_LIBS], +[AC_REQUIRE([CF_NCURSES_CPPFLAGS]) + +cf_nculib_root=ifelse($1,,ncurses,$1) + # This works, except for the special case where we find gpm, but + # ncurses is in a nonstandard location via $LIBS, and we really want + # to link gpm. +cf_ncurses_LIBS="" +cf_ncurses_SAVE="$LIBS" +AC_CHECK_LIB(gpm,Gpm_Open, + [AC_CHECK_LIB(gpm,initscr, + [LIBS="$cf_ncurses_SAVE"], + [cf_ncurses_LIBS="-lgpm"])]) + +case $host_os in +(freebsd*) + # This is only necessary if you are linking against an obsolete + # version of ncurses (but it should do no harm, since it's static). + if test "$cf_nculib_root" = ncurses ; then + AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) + fi + ;; +esac + +CF_ADD_LIBS($cf_ncurses_LIBS) + +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + CF_ADD_LIBS(-l$cf_nculib_root) +else + CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root, + [#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr()], + initscr) +fi + +if test -n "$cf_ncurses_LIBS" ; then + AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS) + cf_ncurses_SAVE="$LIBS" + for p in $cf_ncurses_LIBS ; do + q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` + if test "$q" != "$LIBS" ; then + LIBS="$q" + fi + done + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + LIBS="$cf_ncurses_SAVE"]) +fi + +CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) +AC_DEFINE_UNQUOTED($cf_nculib_ROOT) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_PTHREADS version: 2 updated: 2016/04/22 05:07:41 +dnl ------------------- +dnl Use this followup check to ensure that we link with pthreads if ncurses +dnl uses it. +AC_DEFUN([CF_NCURSES_PTHREADS],[ +: ${cf_nculib_root:=ifelse($1,,ncurses,$1)} +AC_CHECK_LIB($cf_nculib_root,_nc_init_pthreads, + cf_cv_ncurses_pthreads=yes, + cf_cv_ncurses_pthreads=no) +if test "$cf_cv_ncurses_pthreads" = yes +then + CF_ADD_LIBS(-lpthread) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51 +dnl ------------------ +dnl Check for the version of ncurses, to aid in reporting bugs, etc. +dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use +dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi. +AC_DEFUN([CF_NCURSES_VERSION], +[ +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl +AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ + cf_cv_ncurses_version=no + cf_tempfile=out$$ + rm -f $cf_tempfile + AC_TRY_RUN([ +#include <${cf_cv_ncurses_header:-curses.h}> +#include +int main() +{ + FILE *fp = fopen("$cf_tempfile", "w"); +#ifdef NCURSES_VERSION +# ifdef NCURSES_VERSION_PATCH + fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); +# else + fprintf(fp, "%s\n", NCURSES_VERSION); +# endif +#else +# ifdef __NCURSES_H + fprintf(fp, "old\n"); +# else + make an error +# endif +#endif + ${cf_cv_main_return:-return}(0); +}],[ + cf_cv_ncurses_version=`cat $cf_tempfile`],,[ + + # This will not work if the preprocessor splits the line after the + # Autoconf token. The 'unproto' program does that. + cat > conftest.$ac_ext < +#undef Autoconf +#ifdef NCURSES_VERSION +Autoconf NCURSES_VERSION +#else +#ifdef __NCURSES_H +Autoconf "old" +#endif +; +#endif +EOF + cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out" + AC_TRY_EVAL(cf_try) + if test -f conftest.out ; then + cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'` + test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" + rm -f conftest.out + fi +]) + rm -f $cf_tempfile +]) +test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00 +dnl ------------------ +dnl see CF_WITH_NO_LEAKS +AC_DEFUN([CF_NO_LEAKS_OPTION],[ +AC_MSG_CHECKING(if you want to use $1 for testing) +AC_ARG_WITH($1, + [$2], + [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ + $4 +]) + : ${with_cflags:=-g} + : ${with_no_leaks:=yes} + with_$1=yes], + [with_$1=]) +AC_MSG_RESULT(${with_$1:-no}) + +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) + ;; + (*) + CF_ADD_CFLAGS([-g]) + ;; + esac + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NUMBER_SYNTAX version: 2 updated: 2015/04/17 21:13:04 +dnl ---------------- +dnl Check if the given variable is a number. If not, report an error. +dnl $1 is the variable +dnl $2 is the message +AC_DEFUN([CF_NUMBER_SYNTAX],[ +if test -n "$1" ; then + case $1 in + ([[0-9]]*) + ;; + (*) + AC_MSG_ERROR($2 is not a number: $1) + ;; + esac +else + AC_MSG_ERROR($2 value is empty) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57 +dnl -------------- +dnl Check the argument to see that it looks like a pathname. Rewrite it if it +dnl begins with one of the prefix/exec_prefix variables, and then again if the +dnl result begins with 'NONE'. This is necessary to work around autoconf's +dnl delayed evaluation of those symbols. +AC_DEFUN([CF_PATH_SYNTAX],[ +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".[$]$1" in +(.\[$]\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX + ;; +(.\[$]{*prefix}*|.\[$]{*dir}*) + eval $1="[$]$1" + case ".[$]$1" in + (.NONE/*) + $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58 +dnl --------------- +dnl Configure for PDCurses' X11 library +AC_DEFUN([CF_PDCURSES_X11],[ +AC_REQUIRE([CF_X_ATHENA]) + +CF_ACVERSION_CHECK(2.52, + [AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)], + [AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)]) + +if test "$XCURSES_CONFIG" != none ; then + +CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" +CF_ADD_LIBS(`$XCURSES_CONFIG --libs`) + +cf_cv_lib_XCurses=yes + +else + +LDFLAGS="$LDFLAGS $X_LIBS" +CF_CHECK_CFLAGS($X_CFLAGS) +AC_CHECK_LIB(X11,XOpenDisplay, + [CF_ADD_LIBS(-lX11)],, + [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) +AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[ +CF_ADD_LIBS(-lXCurses) +AC_TRY_LINK([ +#include +char *XCursesProgramName = "test"; +],[XCursesExit();], +[cf_cv_lib_XCurses=yes], +[cf_cv_lib_XCurses=no]) +]) + +fi + +if test $cf_cv_lib_XCurses = yes ; then + AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix]) + AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix]) + AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix])) +else + AC_MSG_ERROR(Cannot link with XCurses) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58 +dnl ------------- +dnl Check for the package-config program, unless disabled by command-line. +AC_DEFUN([CF_PKG_CONFIG], +[ +AC_MSG_CHECKING(if you want to use pkg-config) +AC_ARG_WITH(pkg-config, + [ --with-pkg-config{=path} enable/disable use of pkg-config], + [cf_pkg_config=$withval], + [cf_pkg_config=yes]) +AC_MSG_RESULT($cf_pkg_config) + +case $cf_pkg_config in +(no) + PKG_CONFIG=none + ;; +(yes) + CF_ACVERSION_CHECK(2.52, + [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], + [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) + ;; +(*) + PKG_CONFIG=$withval + ;; +esac + +test -z "$PKG_CONFIG" && PKG_CONFIG=none +if test "$PKG_CONFIG" != none ; then + CF_PATH_SYNTAX(PKG_CONFIG) +elif test "x$cf_pkg_config" != xno ; then + AC_MSG_WARN(pkg-config is not installed) +fi + +AC_SUBST(PKG_CONFIG) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_POSIX_C_SOURCE version: 9 updated: 2015/04/12 15:39:00 +dnl ----------------- +dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. +dnl +dnl POSIX.1-1990 _POSIX_SOURCE +dnl POSIX.1-1990 and _POSIX_SOURCE and +dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 +dnl Bindings Option +dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L +dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L +dnl X/Open 2000 _POSIX_C_SOURCE=200112L +dnl +dnl Parameters: +dnl $1 is the nominal value for _POSIX_C_SOURCE +AC_DEFUN([CF_POSIX_C_SOURCE], +[ +cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) +CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) + +AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ + CF_MSG_LOG(if the symbol is already defined go no further) + AC_TRY_COMPILE([#include ],[ +#ifndef _POSIX_C_SOURCE +make an error +#endif], + [cf_cv_posix_c_source=no], + [cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + (.[[12]]??*) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + (.2) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + (.*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + AC_TRY_COMPILE([#include ],[ +#ifdef _POSIX_SOURCE +make an error +#endif],[], + cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") + fi + CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" + CF_MSG_LOG(if the second compile does not leave our definition intact error) + AC_TRY_COMPILE([#include ],[ +#ifndef _POSIX_C_SOURCE +make an error +#endif],, + [cf_cv_posix_c_source=no]) + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + ]) +]) + +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + CF_ADD_CFLAGS($cf_cv_posix_c_source) +fi + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58 +dnl ---------- +dnl standard check for CC, plus followup sanity checks +dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name +AC_DEFUN([CF_PROG_CC],[ +ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) +CF_GCC_VERSION +CF_ACVERSION_CHECK(2.52, + [AC_PROG_CC_STDC], + [CF_ANSI_CC_REQD]) +CF_CC_ENV_FLAGS +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROG_EXT version: 13 updated: 2015/04/18 09:03:58 +dnl ----------- +dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. +AC_DEFUN([CF_PROG_EXT], +[ +AC_REQUIRE([CF_CHECK_CACHE]) +case $cf_cv_system_name in +(os2*) + CFLAGS="$CFLAGS -Zmt" + CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" + CXXFLAGS="$CXXFLAGS -Zmt" + # autoconf's macro sets -Zexe and suffix both, which conflict:w + LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" + ac_cv_exeext=.exe + ;; +esac + +AC_EXEEXT +AC_OBJEXT + +PROG_EXT="$EXEEXT" +AC_SUBST(PROG_EXT) +test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54 +dnl ------------ +AC_DEFUN([CF_PROG_LINT], +[ +AC_CHECK_PROGS(LINT, lint cppcheck splint) +AC_SUBST(LINT_OPTS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37 +dnl ------------ +dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f" +dnl option if it is supported. +AC_DEFUN([CF_PROG_LN_S],[ +AC_PROG_LN_S +AC_MSG_CHECKING(if $LN_S -f options work) + +rm -f conf$$.src conf$$dst +echo >conf$$.dst +echo first >conf$$.src +if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then + cf_prog_ln_sf=yes +else + cf_prog_ln_sf=no +fi +rm -f conf$$.dst conf$$src +AC_MSG_RESULT($cf_prog_ln_sf) + +test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 +dnl ---------------- +dnl Remove all -U and -D options that refer to the given symbol from a list +dnl of C compiler options. This works around the problem that not all +dnl compilers process -U and -D options from left-to-right, so a -U option +dnl cannot be used to cancel the effect of a preceding -D option. +dnl +dnl $1 = target (which could be the same as the source variable) +dnl $2 = source (including '$') +dnl $3 = symbol to remove +define([CF_REMOVE_DEFINE], +[ +$1=`echo "$2" | \ + sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ + -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00 +dnl ------------- +AC_DEFUN([CF_RPATH_HACK], +[ +AC_REQUIRE([CF_LD_RPATH_OPT]) +AC_MSG_CHECKING(for updated LDFLAGS) +if test -n "$LD_RPATH_OPT" ; then + AC_MSG_RESULT(maybe) + + AC_CHECK_PROGS(cf_ldd_prog,ldd,no) + cf_rpath_list="/usr/lib /lib" + if test "$cf_ldd_prog" != no + then + cf_rpath_oops= + +AC_TRY_LINK([#include ], + [printf("Hello");], + [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` + cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) + + # If we passed the link-test, but get a "not found" on a given library, + # this could be due to inept reconfiguration of gcc to make it only + # partly honor /usr/local/lib (or whatever). Sometimes this behavior + # is intentional, e.g., installing gcc in /usr/bin and suppressing the + # /usr/local libraries. + if test -n "$cf_rpath_oops" + then + for cf_rpath_src in $cf_rpath_oops + do + for cf_rpath_dir in \ + /usr/local \ + /usr/pkg \ + /opt/sfw + do + if test -f $cf_rpath_dir/lib/$cf_rpath_src + then + CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) + LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" + break + fi + done + done + fi + fi + + CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) + + CF_RPATH_HACK_2(LDFLAGS) + CF_RPATH_HACK_2(LIBS) + + CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) +else + AC_MSG_RESULT(no) +fi +AC_SUBST(EXTRA_LDFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_RPATH_HACK_2 version: 7 updated: 2015/04/12 15:39:00 +dnl --------------- +dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to +dnl EXTRA_LDFLAGS for each -L option found. +dnl +dnl $cf_rpath_list contains a list of directories to ignore. +dnl +dnl $1 = variable name to update. The LDFLAGS variable should be the only one, +dnl but LIBS often has misplaced -L options. +AC_DEFUN([CF_RPATH_HACK_2], +[ +CF_VERBOSE(...checking $1 [$]$1) + +cf_rpath_dst= +for cf_rpath_src in [$]$1 +do + case $cf_rpath_src in + (-L*) + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +$1=$cf_rpath_dst + +CF_VERBOSE(...checked $1 [$]$1) +AC_SUBST(EXTRA_LDFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SHARED_OPTS version: 89 updated: 2015/08/15 18:38:59 +dnl -------------- +dnl -------------- +dnl Attempt to determine the appropriate CC/LD options for creating a shared +dnl library. +dnl +dnl Notes: +dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within +dnl the build-tree, i.e., by making use of the libraries that are compiled in +dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the +dnl shared library since that can lead to unexpected results at runtime. +dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared +dnl libraries are compiled in ../../lib +dnl +dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure +dnl to install symbolic links to the rel/abi versions of shared libraries. +dnl +dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi +dnl version when making symbolic links. +dnl +dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library +dnl version numbers are infix (ex: libncurses..dylib) or postfix +dnl (ex: libncurses.so.). +dnl +dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. +AC_DEFUN([CF_SHARED_OPTS], +[ + AC_REQUIRE([CF_LD_RPATH_OPT]) + RM_SHARED_OPTS= + LOCAL_LDFLAGS= + LOCAL_LDFLAGS2= + LD_SHARED_OPTS= + INSTALL_LIB="-m 644" + : ${rel_builddir:=.} + + shlibdir=$libdir + AC_SUBST(shlibdir) + + MAKE_DLLS="#" + AC_SUBST(MAKE_DLLS) + + cf_cv_do_symlinks=no + cf_ld_rpath_opt= + test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT" + + AC_MSG_CHECKING(if release/abi version should be used for shared libs) + AC_ARG_WITH(shlib-version, + [ --with-shlib-version=X Specify rel or abi version for shared libs], + [test -z "$withval" && withval=auto + case $withval in + (yes) + cf_cv_shlib_version=auto + ;; + (rel|abi|auto) + cf_cv_shlib_version=$withval + ;; + (*) + AC_MSG_RESULT($withval) + AC_MSG_ERROR([option value must be one of: rel, abi, or auto]) + ;; + esac + ],[cf_cv_shlib_version=auto]) + AC_MSG_RESULT($cf_cv_shlib_version) + + cf_cv_rm_so_locs=no + cf_try_cflags= + + # Some less-capable ports of gcc support only -fpic + CC_SHARED_OPTS= + if test "$GCC" = yes + then + AC_MSG_CHECKING(which $CC option to use) + cf_save_CFLAGS="$CFLAGS" + for CC_SHARED_OPTS in -fPIC -fpic '' + do + CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" + AC_TRY_COMPILE([#include ],[int x = 1],[break],[]) + done + AC_MSG_RESULT($CC_SHARED_OPTS) + CFLAGS="$cf_save_CFLAGS" + fi + + cf_cv_shlib_version_infix=no + + case $cf_cv_system_name in + (aix4.[3-9]*|aix[[5-7]]*) + if test "$GCC" = yes; then + CC_SHARED_OPTS='-Wl,-brtl' + MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@' + else + CC_SHARED_OPTS='-brtl' + # as well as '-qpic=large -G' or perhaps "-bM:SRE -bnoentry -bexpall" + MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@' + fi + ;; + (beos*) + MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0' + ;; + (cygwin*) + CC_SHARED_OPTS= + MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' + RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" + cf_cv_shlib_version=cygdll + cf_cv_shlib_version_infix=cygdll + shlibdir=$bindir + MAKE_DLLS= + cat >mk_shared_lib.sh <<-CF_EOF + #!$SHELL + SHARED_LIB=\[$]1 + IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` + shift + cat <<-EOF + Linking shared library + ** SHARED_LIB \[$]SHARED_LIB + ** IMPORT_LIB \[$]IMPORT_LIB +EOF + exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} +CF_EOF + chmod +x mk_shared_lib.sh + ;; + (msys*) + CC_SHARED_OPTS= + MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' + RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" + cf_cv_shlib_version=msysdll + cf_cv_shlib_version_infix=msysdll + shlibdir=$bindir + MAKE_DLLS= + cat >mk_shared_lib.sh <<-CF_EOF + #!$SHELL + SHARED_LIB=\[$]1 + IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` + shift + cat <<-EOF + Linking shared library + ** SHARED_LIB \[$]SHARED_LIB + ** IMPORT_LIB \[$]IMPORT_LIB +EOF + exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} +CF_EOF + chmod +x mk_shared_lib.sh + ;; + (darwin*) + cf_try_cflags="no-cpp-precomp" + CC_SHARED_OPTS="-dynamic" + MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]' + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi + cf_cv_shlib_version_infix=yes + AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [ + cf_save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-search_paths_first" + AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no) + LDFLAGS=$cf_save_LDFLAGS]) + if test $cf_cv_ldflags_search_paths_first = yes; then + LDFLAGS="$LDFLAGS -Wl,-search_paths_first" + fi + ;; + (hpux[[7-8]]*) + # HP-UX 8.07 ld lacks "+b" option used for libdir search-list + if test "$GCC" != yes; then + CC_SHARED_OPTS='+Z' + fi + MK_SHARED_LIB='${LD} -b -o $[@]' + INSTALL_LIB="-m 555" + ;; + (hpux*) + # (tested with gcc 2.7.2 -- I don't have c89) + if test "$GCC" = yes; then + LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}' + else + CC_SHARED_OPTS='+Z' + LD_SHARED_OPTS='-Wl,+b,${libdir}' + fi + MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]' + # HP-UX shared libraries must be executable, and should be + # readonly to exploit a quirk in the memory manager. + INSTALL_LIB="-m 555" + ;; + (interix*) + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + if test "$cf_cv_shlib_version" = rel; then + cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' + else + cf_shared_soname='`basename $@`' + fi + CC_SHARED_OPTS= + MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@' + ;; + (irix*) + if test "$cf_cv_enable_rpath" = yes ; then + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + fi + # tested with IRIX 5.2 and 'cc'. + if test "$GCC" != yes; then + CC_SHARED_OPTS='-KPIC' + MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]' + else + MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $[@]` -o $[@]' + fi + cf_cv_rm_so_locs=yes + ;; + (linux*|gnu*|k*bsd*-gnu) + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + fi + if test "$cf_cv_enable_rpath" = yes ; then + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + fi + CF_SHARED_SONAME + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' + ;; + (mingw*) + cf_cv_shlib_version=mingw + cf_cv_shlib_version_infix=mingw + shlibdir=$bindir + MAKE_DLLS= + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="-Wl,--enable-auto-import" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS" + fi + CC_SHARED_OPTS= + MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' + RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" + cat >mk_shared_lib.sh <<-CF_EOF + #!$SHELL + SHARED_LIB=\[$]1 + IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` + shift + cat <<-EOF + Linking shared library + ** SHARED_LIB \[$]SHARED_LIB + ** IMPORT_LIB \[$]IMPORT_LIB +EOF + exec \[$]* -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} +CF_EOF + chmod +x mk_shared_lib.sh + ;; + (openbsd[[2-9]].*|mirbsd*) + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + fi + if test "$cf_cv_enable_rpath" = yes ; then + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + fi + CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" + CF_SHARED_SONAME + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' + ;; + (nto-qnx*|openbsd*|freebsd[[12]].*) + CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" + MK_SHARED_LIB='${LD} -Bshareable -o $[@]' + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + ;; + (dragonfly*|freebsd*) + CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" + if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then + LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS" + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + fi + CF_SHARED_SONAME + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' + ;; + (netbsd*) + CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" + if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then + LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + if test "$cf_cv_shlib_version" = auto; then + if test -f /usr/libexec/ld.elf_so; then + cf_cv_shlib_version=abi + else + cf_cv_shlib_version=rel + fi + fi + CF_SHARED_SONAME + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]' + else + MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $[@]' + fi + ;; + (osf*|mls+*) + # tested with OSF/1 V3.2 and 'cc' + # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't + # link with shared libs). + MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`' + case $host_os in + (osf4*) + MK_SHARED_LIB="${MK_SHARED_LIB} -msym" + ;; + esac + MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]' + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + fi + cf_cv_rm_so_locs=yes + ;; + (sco3.2v5*) # also uw2* and UW7: hops 13-Apr-98 + # tested with osr5.0.5 + if test "$GCC" != yes; then + CC_SHARED_OPTS='-belf -KPIC' + fi + MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@' + if test "$cf_cv_enable_rpath" = yes ; then + # only way is to set LD_RUN_PATH but no switch for it + RUN_PATH=$libdir + fi + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + LINK_PROGS='LD_RUN_PATH=${libdir}' + LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib' + ;; + (sunos4*) + # tested with SunOS 4.1.1 and gcc 2.7.0 + if test "$GCC" != yes; then + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='${LD} -assert pure-text -o $[@]' + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + ;; + (solaris2*) + # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 + # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3 + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + fi + if test "$cf_cv_enable_rpath" = yes ; then + EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS" + fi + CF_SHARED_SONAME + if test "$GCC" != yes; then + cf_save_CFLAGS="$CFLAGS" + for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O + do + CFLAGS="$cf_shared_opts $cf_save_CFLAGS" + AC_TRY_COMPILE([#include ],[printf("Hello\n");],[break]) + done + CFLAGS="$cf_save_CFLAGS" + CC_SHARED_OPTS=$cf_shared_opts + MK_SHARED_LIB='${CC} -dy -G -h '$cf_cv_shared_soname' -o $[@]' + else + MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]' + fi + ;; + (sysv5uw7*|unix_sv*) + # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc) + if test "$GCC" != yes; then + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='${LD} -d y -G -o [$]@' + ;; + (*) + CC_SHARED_OPTS='unknown' + MK_SHARED_LIB='echo unknown' + ;; + esac + + # This works if the last tokens in $MK_SHARED_LIB are the -o target. + case "$cf_cv_shlib_version" in + (rel|abi) + case "$MK_SHARED_LIB" in + (*'-o $[@]') + test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes + ;; + (*) + AC_MSG_WARN(ignored --with-shlib-version) + ;; + esac + ;; + esac + + if test -n "$cf_try_cflags" + then +cat > conftest.$ac_ext < +int main(int argc, char *argv[[]]) +{ + printf("hello\n"); + return (argv[[argc-1]] == 0) ; +} +EOF + cf_save_CFLAGS="$CFLAGS" + for cf_opt in $cf_try_cflags + do + CFLAGS="$cf_save_CFLAGS -$cf_opt" + AC_MSG_CHECKING(if CFLAGS option -$cf_opt works) + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + cf_save_CFLAGS="$CFLAGS" + else + AC_MSG_RESULT(no) + fi + done + CFLAGS="$cf_save_CFLAGS" + fi + + + # RPATH_LIST is a colon-separated list of directories + test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}" + test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}" + + test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" + + CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS) + CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) + + AC_SUBST(CC_SHARED_OPTS) + AC_SUBST(LD_RPATH_OPT) + AC_SUBST(LD_SHARED_OPTS) + AC_SUBST(MK_SHARED_LIB) + AC_SUBST(RM_SHARED_OPTS) + + AC_SUBST(LINK_PROGS) + AC_SUBST(LINK_TESTS) + + AC_SUBST(EXTRA_LDFLAGS) + AC_SUBST(LOCAL_LDFLAGS) + AC_SUBST(LOCAL_LDFLAGS2) + + AC_SUBST(INSTALL_LIB) + AC_SUBST(RPATH_LIST) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43 +dnl ---------------- +dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for +dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar) +dnl option. +dnl +dnl $1 is the default that should be used for "$cf_cv_shlib_version". +dnl If missing, use "rel". +define([CF_SHARED_SONAME], +[ + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1) + if test "$cf_cv_shlib_version" = rel; then + cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}' + else + cf_cv_shared_soname='`basename $[@]`' + fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06 +dnl -------------- +dnl Construct a search-list for a nonstandard header/lib-file +dnl $1 = the variable to return as result +dnl $2 = the package name +dnl $3 = the subdirectory, e.g., bin, include or lib +AC_DEFUN([CF_SUBDIR_PATH], +[ +$1= + +CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE) + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + [$]HOME +do + CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix) +done +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TERM_HEADER version: 4 updated: 2015/04/15 19:08:48 +dnl -------------- +dnl Look for term.h, which is part of X/Open curses. It defines the interface +dnl to terminfo database. Usually it is in the same include-path as curses.h, +dnl but some packagers change this, breaking various applications. +AC_DEFUN([CF_TERM_HEADER],[ +AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[ +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +AC_TRY_COMPILE([#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> +],[int x = auto_left_margin],[ + cf_cv_term_header="$cf_test"],[ + cf_cv_term_header=unknown + ]) + test "$cf_cv_term_header" != unknown && break +done +]) + +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in +(*term.h) + AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) + ;; +esac + +case $cf_cv_term_header in +(ncurses/term.h) + AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) + ;; +(ncursesw/term.h) + AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32 +dnl --------------- +dnl Define a top_builddir symbol, for applications that need an absolute path. +AC_DEFUN([CF_TOP_BUILDDIR], +[ +top_builddir=ifelse($1,,`pwd`,$1) +AC_SUBST(top_builddir) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00 +dnl -------------- +dnl Trim extra base X libraries added as a workaround for inconsistent library +dnl dependencies returned by "new" pkg-config files. +AC_DEFUN([CF_TRIM_X_LIBS],[ + for cf_trim_lib in Xmu Xt X11 + do + case "$LIBS" in + (*-l$cf_trim_lib\ *-l$cf_trim_lib*) + LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` + CF_VERBOSE(..trimmed $LIBS) + ;; + esac + done +]) +dnl --------------------------------------------------------------------------- +dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06 +dnl ----------------- +dnl This is a simple wrapper to use for pkg-config, for libraries which may be +dnl available in that form. +dnl +dnl $1 = package name +dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS +dnl $3 = logic to use if pkg-config does not have the package +AC_DEFUN([CF_TRY_PKG_CONFIG],[ +AC_REQUIRE([CF_PKG_CONFIG]) + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then + CF_VERBOSE(found package $1) + cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" + CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) + CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) + CF_ADD_CFLAGS($cf_pkgconfig_incs) + CF_ADD_LIBS($cf_pkgconfig_libs) + ifelse([$2],,:,[$2]) +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + ifelse([$3],,:,[$3]) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 +dnl ------------------- +dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we +dnl can define it successfully. +AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ +AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ + AC_TRY_COMPILE([ +#include +#include +#include +],[ +#ifndef _XOPEN_SOURCE +make an error +#endif], + [cf_cv_xopen_source=no], + [cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + AC_TRY_COMPILE([ +#include +#include +#include +],[ +#ifdef _XOPEN_SOURCE +make an error +#endif], + [cf_cv_xopen_source=no], + [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) + CPPFLAGS="$cf_save" + ]) +]) + +if test "$cf_cv_xopen_source" != no ; then + CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) + CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + CF_ADD_CFLAGS($cf_temp_xopen_source) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 +dnl -------- +dnl Make an uppercase version of a variable +dnl $1=uppercase($2) +AC_DEFUN([CF_UPPER], +[ +$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51 +dnl ----------- +dnl Check for multibyte support, and if not found, utf8 compatibility library +AC_DEFUN([CF_UTF8_LIB], +[ +AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ + cf_save_LIBS="$LIBS" + AC_TRY_LINK([ +#include ],[putwc(0,0);], + [cf_cv_utf8_lib=yes], + [CF_FIND_LINKAGE([ +#include ],[putwc(0,0);],utf8, + [cf_cv_utf8_lib=add-on], + [cf_cv_utf8_lib=no]) +])]) + +# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between +# ncurses/ncursesw: +if test "$cf_cv_utf8_lib" = "add-on" ; then + AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h]) + CF_ADD_INCDIR($cf_cv_header_path_utf8) + CF_ADD_LIBDIR($cf_cv_library_path_utf8) + CF_ADD_LIBS($cf_cv_library_file_utf8) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 +dnl ---------- +dnl Use AC_VERBOSE w/o the warnings +AC_DEFUN([CF_VERBOSE], +[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG +CF_MSG_LOG([$1]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_VERSION_INFO version: 7 updated: 2015/04/17 21:13:04 +dnl --------------- +dnl Define several useful symbols derived from the VERSION file. A separate +dnl file is preferred to embedding the version numbers in various scripts. +dnl (automake is a textbook-example of why the latter is a bad idea, but there +dnl are others). +dnl +dnl The file contents are: +dnl libtool-version release-version patch-version +dnl or +dnl release-version +dnl where +dnl libtool-version (see ?) consists of 3 integers separated by '.' +dnl release-version consists of a major version and minor version +dnl separated by '.', optionally followed by a patch-version +dnl separated by '-'. The minor version need not be an +dnl integer (but it is preferred). +dnl patch-version is an integer in the form yyyymmdd, so ifdef's and +dnl scripts can easily compare versions. +dnl +dnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL +dnl simply extracts the first field using 'cut -f1'. +dnl +dnl Optional parameters: +dnl $1 = internal name for package +dnl $2 = external name for package +AC_DEFUN([CF_VERSION_INFO], +[ +if test -f $srcdir/VERSION ; then + AC_MSG_CHECKING(for package version) + + # if there are not enough fields, cut returns the last one... + cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1` + cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2` + cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3` + + # this is how CF_BUNDLED_INTL uses $VERSION: + VERSION="$cf_field1" + + VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'` + test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version) + + VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'` + test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version) + + AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR}) + + AC_MSG_CHECKING(for package patch date) + VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'` + case .$VERSION_PATCH in + (.) + AC_MSG_ERROR(missing patch-date $VERSION_PATCH) + ;; + (.[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]) + ;; + (*) + AC_MSG_ERROR(illegal patch-date $VERSION_PATCH) + ;; + esac + AC_MSG_RESULT($VERSION_PATCH) +else + AC_MSG_ERROR(did not find $srcdir/VERSION) +fi + +# show the actual data that we have for versions: +CF_VERBOSE(ABI VERSION $VERSION) +CF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR) +CF_VERBOSE(VERSION_MINOR $VERSION_MINOR) +CF_VERBOSE(VERSION_PATCH $VERSION_PATCH) + +AC_SUBST(VERSION) +AC_SUBST(VERSION_MAJOR) +AC_SUBST(VERSION_MINOR) +AC_SUBST(VERSION_PATCH) + +dnl if a package name is given, define its corresponding version info. We +dnl need the package name to ensure that the defined symbols are unique. +ifelse($1,,,[ + cf_PACKAGE=$1 + PACKAGE=ifelse($2,,$1,$2) + AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name]) + AC_SUBST(PACKAGE) + CF_UPPER(cf_PACKAGE,$cf_PACKAGE) + AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}") + AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH}) +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_ABI_VERSION version: 3 updated: 2015/06/06 16:10:11 +dnl ------------------- +dnl Allow library's ABI to be overridden. Generally this happens when a +dnl packager has incremented the ABI past that used in the original package, +dnl and wishes to keep doing this. +dnl +dnl $1 is the package name, if any, to derive a corresponding {package}_ABI +dnl symbol. +AC_DEFUN([CF_WITH_ABI_VERSION],[ +test -z "$cf_cv_abi_version" && cf_cv_abi_version=0 +AC_ARG_WITH(abi-version, +[ --with-abi-version=XXX override derived ABI version],[ + if test "x$cf_cv_abi_version" != "x$withval" + then + AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval) + case $cf_cv_rel_version in + (5.*) + cf_cv_rel_version=$withval.0 + ;; + (6.*) + cf_cv_rel_version=$withval.9 # FIXME: should be 10 as of 6.0 release + ;; + esac + fi + cf_cv_abi_version=$withval]) + CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version) +ifelse($1,,,[ +$1_ABI=$cf_cv_abi_version +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38 +dnl ------------------ +dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses +dnl libraries. +AC_DEFUN([CF_WITH_CURSES_DIR],[ + +AC_MSG_CHECKING(for specific curses-directory) +AC_ARG_WITH(curses-dir, + [ --with-curses-dir=DIR directory in which (n)curses is installed], + [cf_cv_curses_dir=$withval], + [cf_cv_curses_dir=no]) +AC_MSG_RESULT($cf_cv_curses_dir) + +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + CF_PATH_SYNTAX(withval) + if test -d "$cf_cv_curses_dir" + then + CF_ADD_INCDIR($cf_cv_curses_dir/include) + CF_ADD_LIBDIR($cf_cv_curses_dir/lib) + fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 +dnl ---------------- +dnl Configure-option for dbmalloc. The optional parameter is used to override +dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. +AC_DEFUN([CF_WITH_DBMALLOC],[ +CF_NO_LEAKS_OPTION(dbmalloc, + [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], + [USE_DBMALLOC]) + +if test "$with_dbmalloc" = yes ; then + AC_CHECK_HEADER(dbmalloc.h, + [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 +dnl --------------- +dnl Configure-option for dmalloc. The optional parameter is used to override +dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. +AC_DEFUN([CF_WITH_DMALLOC],[ +CF_NO_LEAKS_OPTION(dmalloc, + [ --with-dmalloc test: use Gray Watson's dmalloc library], + [USE_DMALLOC]) + +if test "$with_dmalloc" = yes ; then + AC_CHECK_HEADER(dmalloc.h, + [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_EXPORT_SYMS version: 3 updated: 2014/12/20 19:16:08 +dnl ------------------- +dnl Use this with libtool to specify the list of symbols that may be exported. +dnl The input file contains one symbol per line; comments work with "#". +dnl +dnl $1 = basename of the ".sym" file (default $PACKAGE) +AC_DEFUN([CF_WITH_EXPORT_SYMS], +[ +AC_MSG_CHECKING(if exported-symbols file should be used) +AC_ARG_WITH(export-syms, + [ --with-export-syms=XXX limit exported symbols using libtool], + [with_export_syms=$withval], + [with_export_syms=no]) +if test "x$with_export_syms" = xyes +then + with_export_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).sym' + AC_SUBST(PACKAGE) +fi +AC_MSG_RESULT($with_export_syms) +if test "x$with_export_syms" != xno +then + EXPORT_SYMS="-export-symbols $with_export_syms" + AC_SUBST(EXPORT_SYMS) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_LIBTOOL version: 33 updated: 2015/10/17 19:03:33 +dnl --------------- +dnl Provide a configure option to incorporate libtool. Define several useful +dnl symbols for the makefile rules. +dnl +dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses +dnl macros from libtool.m4 which is in the aclocal directory of automake. +dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro. +dnl But that still does not work properly since the macro is expanded outside +dnl the CF_WITH_LIBTOOL macro: +dnl +dnl #!/bin/sh +dnl ACLOCAL=`aclocal --print-ac-dir` +dnl if test -z "$ACLOCAL" ; then +dnl echo cannot find aclocal directory +dnl exit 1 +dnl elif test ! -f $ACLOCAL/libtool.m4 ; then +dnl echo cannot find libtool.m4 file +dnl exit 1 +dnl fi +dnl +dnl LOCAL=aclocal.m4 +dnl ORIG=aclocal.m4.orig +dnl +dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15 +dnl rm -f $ORIG +dnl mv $LOCAL $ORIG +dnl +dnl # sed the LIBTOOL= assignment to omit the current directory? +dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL +dnl cat $ORIG >>$LOCAL +dnl +dnl autoconf-257 $* +dnl +AC_DEFUN([CF_WITH_LIBTOOL], +[ +AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION]) +ifdef([AC_PROG_LIBTOOL],,[ +LIBTOOL= +]) +# common library maintenance symbols that are convenient for libtool scripts: +LIB_CREATE='${AR} -cr' +LIB_OBJECT='${OBJECTS}' +LIB_SUFFIX=.a +LIB_PREP="$RANLIB" + +# symbols used to prop libtool up to enable it to determine what it should be +# doing: +LIB_CLEAN= +LIB_COMPILE= +LIB_LINK='${CC}' +LIB_INSTALL= +LIB_UNINSTALL= + +AC_MSG_CHECKING(if you want to build libraries with libtool) +AC_ARG_WITH(libtool, + [ --with-libtool generate libraries with libtool], + [with_libtool=$withval], + [with_libtool=no]) +AC_MSG_RESULT($with_libtool) +if test "$with_libtool" != "no"; then +ifdef([AC_PROG_LIBTOOL],[ + # missing_content_AC_PROG_LIBTOOL{{ + AC_PROG_LIBTOOL + # missing_content_AC_PROG_LIBTOOL}} +],[ + if test "$with_libtool" != "yes" ; then + CF_PATH_SYNTAX(with_libtool) + LIBTOOL=$with_libtool + else + AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none) + CF_LIBTOOL_VERSION + if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool + then + CF_FORGET_TOOL(LIBTOOL) + AC_CHECK_TOOLS(LIBTOOL,[glibtool],none) + CF_LIBTOOL_VERSION + fi + fi + if test -z "$LIBTOOL" ; then + AC_MSG_ERROR(Cannot find libtool) + fi +])dnl + LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${top_srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o' + LIB_OBJECT='${OBJECTS:.o=.lo}' + LIB_SUFFIX=.la + LIB_CLEAN='${LIBTOOL} --mode=clean' + LIB_COMPILE='${LIBTOOL} --mode=compile' + LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}' + LIB_INSTALL='${LIBTOOL} --mode=install' + LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' + LIB_PREP=: + + CF_CHECK_LIBTOOL_VERSION + + # special hack to add -no-undefined (which libtool should do for itself) + LT_UNDEF= + case "$cf_cv_system_name" in + (cygwin*|msys*|mingw32*|os2*|uwin*|aix[[4-7]]) + LT_UNDEF=-no-undefined + ;; + esac + AC_SUBST([LT_UNDEF]) + + # special hack to add --tag option for C++ compiler + case $cf_cv_libtool_version in + (1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) + LIBTOOL_CXX="$LIBTOOL --tag=CXX" + LIBTOOL="$LIBTOOL --tag=CC" + ;; + (*) + LIBTOOL_CXX="$LIBTOOL" + ;; + esac +else + LIBTOOL="" + LIBTOOL_CXX="" +fi + +test -z "$LIBTOOL" && ECHO_LT= + +AC_SUBST(LIBTOOL) +AC_SUBST(LIBTOOL_CXX) +AC_SUBST(LIBTOOL_OPTS) + +AC_SUBST(LIB_CREATE) +AC_SUBST(LIB_OBJECT) +AC_SUBST(LIB_SUFFIX) +AC_SUBST(LIB_PREP) + +AC_SUBST(LIB_CLEAN) +AC_SUBST(LIB_COMPILE) +AC_SUBST(LIB_LINK) +AC_SUBST(LIB_INSTALL) +AC_SUBST(LIB_UNINSTALL) + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_LIBTOOL_OPTS version: 4 updated: 2015/04/17 21:13:04 +dnl -------------------- +dnl Allow user to pass additional libtool options into the library creation +dnl and link steps. The main use for this is to do something like +dnl ./configure --with-libtool-opts=-static +dnl to get the same behavior as automake-flavored +dnl ./configure --enable-static +AC_DEFUN([CF_WITH_LIBTOOL_OPTS],[ +AC_MSG_CHECKING(for additional libtool options) +AC_ARG_WITH(libtool-opts, + [ --with-libtool-opts=XXX specify additional libtool options], + [with_libtool_opts=$withval], + [with_libtool_opts=no]) +AC_MSG_RESULT($with_libtool_opts) + +case .$with_libtool_opts in +(.yes|.no|.) + ;; +(*) + LIBTOOL_OPTS="$LIBTOOL_OPTS $with_libtool_opts" + ;; +esac + +AC_SUBST(LIBTOOL_OPTS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_NCURSES_ETC version: 5 updated: 2016/02/20 19:23:20 +dnl ------------------- +dnl Use this macro for programs which use any variant of "curses", e.g., +dnl "ncurses", and "PDCurses". Programs that can use curses and some unrelated +dnl library (such as slang) should use a "--with-screen=XXX" option. +dnl +dnl This does not use AC_DEFUN, because that would tell autoconf to run each +dnl of the macros inside this one - before this macro. +define([CF_WITH_NCURSES_ETC],[ +CF_WITH_CURSES_DIR + +cf_cv_screen=curses + +AC_MSG_CHECKING(for specified curses library type) +AC_ARG_WITH(screen, + [ --with-screen=XXX use specified curses-libraries], + [cf_cv_screen=$withval],[ + +AC_ARG_WITH(ncursesw, + [ --with-ncursesw use wide ncurses-libraries], + [cf_cv_screen=ncursesw],[ + +AC_ARG_WITH(ncurses, + [ --with-ncurses use ncurses-libraries], + [cf_cv_screen=ncurses],[ + +AC_ARG_WITH(pdcurses, + [ --with-pdcurses compile/link with pdcurses X11 library], + [cf_cv_screen=pdcurses],[ + +AC_ARG_WITH(curses-colr, + [ --with-curses-colr compile/link with HPUX 10.x color-curses], + [cf_cv_screen=curses_colr],[ + +AC_ARG_WITH(curses-5lib, + [ --with-curses-5lib compile/link with SunOS 5lib curses], + [cf_cv_screen=curses_5lib])])])])])]) + +AC_MSG_RESULT($cf_cv_screen) + +case $cf_cv_screen in +(curses|curses_*) + CF_CURSES_CONFIG + ;; +(ncursesw*) + CF_UTF8_LIB + CF_NCURSES_CONFIG($cf_cv_screen) + ;; +(ncurses*) + CF_NCURSES_CONFIG($cf_cv_screen) + ;; +(pdcurses) + CF_PDCURSES_X11 + ;; +(*) + AC_MSG_ERROR(unexpected screen-value: $cf_cv_screen) + ;; +esac + +CF_NCURSES_PTHREADS($cf_cv_screen) + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_NC_ALLOC_H version: 4 updated: 2008/11/01 12:44:02 +dnl ------------------ +dnl Applications that use ncurses can provide better leak-checking if they +dnl call ncurses' functions to free its memory on exit. That is normally not +dnl configured (--disable-leaks), but is useful in a debugging library. +dnl +dnl Use this after checking for ncurses/ncursesw libraries. +AC_DEFUN([CF_WITH_NC_ALLOC_H], +[ +AC_REQUIRE([CF_DISABLE_LEAKS]) + +case $LIBS in #(vi +*ncurses*) + +if test "$with_no_leaks" = yes ; then + AC_CHECK_HEADER(nc_alloc.h) + AC_CHECK_FUNCS(_nc_free_and_exit) +fi +;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49 +dnl ------------------- +dnl Allow library's release-version to be overridden. Generally this happens when a +dnl packager has incremented the release-version past that used in the original package, +dnl and wishes to keep doing this. +dnl +dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR +dnl and {package}_MINOR symbols +dnl symbol. +AC_DEFUN([CF_WITH_REL_VERSION],[ +test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0 +AC_ARG_WITH(rel-version, +[ --with-rel-version=XXX override derived release version], +[AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval) + cf_cv_rel_version=$withval]) +ifelse($1,,[ + CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version) +],[ + $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'` + $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'` + CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version) + CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version) +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_SHARED_OR_LIBTOOL version: 7 updated: 2014/11/02 16:11:49 +dnl ------------------------- +dnl Provide shared libraries using either autoconf macros (--with-shared) or +dnl using the external libtool script (--with-libtool). +dnl +dnl $1 = program name (all caps preferred) +dnl $1 = release version +dnl $2 = ABI version +define([CF_WITH_SHARED_OR_LIBTOOL],[ + +REL_VERSION=$2 +ABI_VERSION=$3 +cf_cv_rel_version=$REL_VERSION +AC_SUBST(ABI_VERSION) +AC_SUBST(REL_VERSION) + +CF_WITH_REL_VERSION($1) +CF_WITH_ABI_VERSION + +LIB_MODEL=static +DFT_LWR_MODEL=$LIB_MODEL +LIBTOOL_MAKE="#" + +# use to comment-out makefile lines +MAKE_NORMAL= +MAKE_STATIC= +MAKE_SHARED="#" +MAKE_DLLS="#" + +shlibdir=$libdir +AC_SUBST(shlibdir) + +CF_WITH_LIBTOOL + +LIB_CREATE="$LIB_CREATE \[$]@" + +if test "$with_libtool" = "yes" ; then + OBJEXT="lo" + LIB_MODEL=libtool + DFT_LWR_MODEL=$LIB_MODEL + LIBTOOL_MAKE= + CF_WITH_LIBTOOL_OPTS + CF_WITH_EXPORT_SYMS + MAKE_NORMAL="#" + MAKE_STATIC="#" + MAKE_SHARED= +else + AC_MSG_CHECKING(if you want to build shared libraries) + AC_ARG_WITH(shared, + [ --with-shared generate shared-libraries], + [with_shared=$withval], + [with_shared=no]) + AC_MSG_RESULT($with_shared) + if test "$with_shared" = "yes" ; then + LIB_MODEL=shared + DFT_LWR_MODEL=$LIB_MODEL + CF_SHARED_OPTS + CF_WITH_VERSIONED_SYMS + LIB_PREP=: + LIB_CREATE="[$]MK_SHARED_LIB" + CFLAGS="$CFLAGS $CC_SHARED_OPTS" + MAKE_NORMAL="#" + MAKE_STATIC="#" + MAKE_SHARED= + fi +fi + +LIB_SUFFIX= +CF_LIB_SUFFIX($LIB_MODEL, DFT_LIB_SUFFIX, DFT_DEP_SUFFIX) +LIB_SUFFIX=$DFT_LIB_SUFFIX + +AC_SUBST(DFT_LWR_MODEL) +AC_SUBST(DFT_LIB_SUFFIX) +AC_SUBST(DFT_DEP_SUFFIX) +AC_SUBST(LIB_MODEL) + +AC_SUBST(LIBTOOL_MAKE) + +AC_SUBST(MAKE_DLLS) +AC_SUBST(MAKE_NORMAL) +AC_SUBST(MAKE_SHARED) +AC_SUBST(MAKE_STATIC) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 +dnl ---------------- +AC_DEFUN([CF_WITH_VALGRIND],[ +CF_NO_LEAKS_OPTION(valgrind, + [ --with-valgrind test: use valgrind], + [USE_VALGRIND]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_VERSIONED_SYMS version: 7 updated: 2015/10/24 20:50:26 +dnl ---------------------- +dnl Use this when building shared library with ELF, to markup symbols with the +dnl version identifier from the given input file. Generally that identifier is +dnl the same as the SONAME at which the symbol was first introduced. +dnl +dnl $1 = basename of the ".map" file (default $PACKAGE) +AC_DEFUN([CF_WITH_VERSIONED_SYMS], +[ +AC_MSG_CHECKING(if versioned-symbols file should be used) +AC_ARG_WITH(versioned-syms, + [ --with-versioned-syms=X markup versioned symbols using ld], + [with_versioned_syms=$withval], + [with_versioned_syms=no]) +if test "x$with_versioned_syms" = xyes +then + with_versioned_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).map' + AC_SUBST(PACKAGE) +fi +AC_MSG_RESULT($with_versioned_syms) + +RESULTING_SYMS= +VERSIONED_SYMS= +WILDCARD_SYMS= + +if test "x$with_versioned_syms" != xno +then + RESULTING_SYMS=$with_versioned_syms + case "x$MK_SHARED_LIB" in + (*-Wl,*) + VERSIONED_SYMS="-Wl,--version-script,\${RESULTING_SYMS}" + MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-Wl,%\\[$]{VERSIONED_SYMS} -Wl,%"` + CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) + ;; + (*-dy\ *) + VERSIONED_SYMS="-Wl,-M,\${RESULTING_SYMS}" + MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-dy%\\[$]{VERSIONED_SYMS} -dy%"` + CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) + ;; + (*) + AC_MSG_WARN(this system does not support versioned-symbols) + ;; + esac + + # Linux ld can selectively override scope, e.g., of symbols beginning with + # "_" by first declaring some as global, and then using a wildcard to + # declare the others as local. Some other loaders cannot do this. Check + # by constructing a (very) simple shared library and inspecting its + # symbols. + if test "x$VERSIONED_SYMS" != "x" + then + AC_MSG_CHECKING(if wildcards can be used to selectively omit symbols) + WILDCARD_SYMS=no + + # make sources + rm -f conftest.* + + cat >conftest.ver <conftest.$ac_ext <conftest.mk <&AC_FD_CC >/dev/null + then + # test for missing symbol in either Data or Text section + cf_missing=`nm -P conftest.so 2>&AC_FD_CC |fgrep _ismissing | egrep '[[ ]][[DT]][[ ]]'` + test -n "$cf_missing" && WILDCARD_SYMS=yes + fi + AC_MSG_RESULT($WILDCARD_SYMS) + rm -f conftest.* + fi +fi +AC_SUBST(RESULTING_SYMS) +AC_SUBST(VERSIONED_SYMS) +AC_SUBST(WILDCARD_SYMS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34 +dnl ---------------- +dnl Combine the checks for gcc features into a configure-script option +dnl +dnl Parameters: +dnl $1 - see CF_GCC_WARNINGS +AC_DEFUN([CF_WITH_WARNINGS], +[ +if ( test "$GCC" = yes || test "$GXX" = yes ) +then +AC_MSG_CHECKING(if you want to check for gcc warnings) +AC_ARG_WITH(warnings, + [ --with-warnings test: turn on gcc warnings], + [cf_opt_with_warnings=$withval], + [cf_opt_with_warnings=no]) +AC_MSG_RESULT($cf_opt_with_warnings) +if test "$cf_opt_with_warnings" != no ; then + CF_GCC_ATTRIBUTES + CF_GCC_WARNINGS([$1]) +fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_XOPEN_CURSES version: 13 updated: 2015/12/12 20:59:52 +dnl --------------- +dnl Test if we should define X/Open source for curses, needed on Digital Unix +dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. +dnl +dnl The getbegyx() check is needed for HPUX, which omits legacy macros such +dnl as getbegy(). The latter is better design, but the former is standard. +AC_DEFUN([CF_XOPEN_CURSES], +[ +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl +AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[ +cf_cv_need_xopen_extension=unknown +AC_TRY_LINK([ +#include +#include <${cf_cv_ncurses_header:-curses.h}>],[ +#if defined(NCURSES_VERSION_PATCH) +#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) + make an error +#endif +#endif +#ifdef NCURSES_VERSION + cchar_t check; + int check2 = curs_set((int)sizeof(check)); +#endif + long x = winnstr(stdscr, "", 0); + int x1, y1; + getbegyx(stdscr, y1, x1)], + [cf_cv_need_xopen_extension=none], + [ + for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR + do + AC_TRY_LINK([ +#define $cf_try_xopen_extension 1 +#include +#include <${cf_cv_ncurses_header:-curses.h}>],[ +#ifdef NCURSES_VERSION + cchar_t check; + int check2 = curs_set((int)sizeof(check)); +#endif + long x = winnstr(stdscr, "", 0); + int x1, y1; + getbegyx(stdscr, y1, x1)], + [cf_cv_need_xopen_extension=$cf_try_xopen_extension; break]) + done + ]) +]) + +case $cf_cv_need_xopen_extension in +(*_*) + CPPFLAGS="$CPPFLAGS -D$cf_cv_need_xopen_extension" + ;; +esac + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42 +dnl --------------- +dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, +dnl or adapt to the vendor's definitions to get equivalent functionality, +dnl without losing the common non-POSIX features. +dnl +dnl Parameters: +dnl $1 is the nominal value for _XOPEN_SOURCE +dnl $2 is the nominal value for _POSIX_C_SOURCE +AC_DEFUN([CF_XOPEN_SOURCE],[ +AC_REQUIRE([AC_CANONICAL_HOST]) + +cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) +cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) +cf_xopen_source= + +case $host_os in +(aix[[4-7]]*) + cf_xopen_source="-D_ALL_SOURCE" + ;; +(msys) + cf_XOPEN_SOURCE=600 + ;; +(darwin[[0-8]].*) + cf_xopen_source="-D_APPLE_C_SOURCE" + ;; +(darwin*) + cf_xopen_source="-D_DARWIN_C_SOURCE" + cf_XOPEN_SOURCE= + ;; +(freebsd*|dragonfly*) + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +(hpux11*) + cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" + ;; +(hpux*) + cf_xopen_source="-D_HPUX_SOURCE" + ;; +(irix[[56]].*) + cf_xopen_source="-D_SGI_SOURCE" + cf_XOPEN_SOURCE= + ;; +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) + CF_GNU_SOURCE + ;; +(minix*) + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; +(mirbsd*) + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types + cf_XOPEN_SOURCE= + CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + ;; +(netbsd*) + cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +(openbsd[[4-9]]*) + # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw + cf_xopen_source="-D_BSD_SOURCE" + cf_XOPEN_SOURCE=600 + ;; +(openbsd*) + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +(osf[[45]]*) + cf_xopen_source="-D_OSF_SOURCE" + ;; +(nto-qnx*) + cf_xopen_source="-D_QNX_SOURCE" + ;; +(sco*) + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +(solaris2.*) + cf_xopen_source="-D__EXTENSIONS__" + cf_cv_xopen_source=broken + ;; +(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) + cf_XOPEN_SOURCE= + cf_POSIX_C_SOURCE= + ;; +(*) + CF_TRY_XOPEN_SOURCE + CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + ;; +esac + +if test -n "$cf_xopen_source" ; then + CF_ADD_CFLAGS($cf_xopen_source,true) +fi + +dnl In anything but the default case, we may have system-specific setting +dnl which is still not guaranteed to provide all of the entrypoints that +dnl _XOPEN_SOURCE would yield. +if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then + AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) + AC_TRY_COMPILE([#include ],[ +#ifndef _XOPEN_SOURCE +make an error +#endif], + [cf_XOPEN_SOURCE_set=yes], + [cf_XOPEN_SOURCE_set=no]) + AC_MSG_RESULT($cf_XOPEN_SOURCE_set) + if test $cf_XOPEN_SOURCE_set = yes + then + AC_TRY_COMPILE([#include ],[ +#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE +make an error +#endif], + [cf_XOPEN_SOURCE_set_ok=yes], + [cf_XOPEN_SOURCE_set_ok=no]) + if test $cf_XOPEN_SOURCE_set_ok = no + then + AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) + fi + else + CF_TRY_XOPEN_SOURCE + fi +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_X_ATHENA version: 23 updated: 2015/04/12 15:39:00 +dnl ----------- +dnl Check for Xaw (Athena) libraries +dnl +dnl Sets $cf_x_athena according to the flavor of Xaw which is used. +AC_DEFUN([CF_X_ATHENA], +[ +cf_x_athena=${cf_x_athena:-Xaw} + +AC_MSG_CHECKING(if you want to link with Xaw 3d library) +withval= +AC_ARG_WITH(Xaw3d, + [ --with-Xaw3d link with Xaw 3d library]) +if test "$withval" = yes ; then + cf_x_athena=Xaw3d + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(if you want to link with Xaw 3d xft library) +withval= +AC_ARG_WITH(Xaw3dxft, + [ --with-Xaw3dxft link with Xaw 3d xft library]) +if test "$withval" = yes ; then + cf_x_athena=Xaw3dxft + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(if you want to link with neXT Athena library) +withval= +AC_ARG_WITH(neXtaw, + [ --with-neXtaw link with neXT Athena library]) +if test "$withval" = yes ; then + cf_x_athena=neXtaw + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(if you want to link with Athena-Plus library) +withval= +AC_ARG_WITH(XawPlus, + [ --with-XawPlus link with Athena-Plus library]) +if test "$withval" = yes ; then + cf_x_athena=XawPlus + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +cf_x_athena_lib="" + +if test "$PKG_CONFIG" != none ; then + cf_athena_list= + test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" + for cf_athena_pkg in \ + $cf_athena_list \ + ${cf_x_athena} \ + ${cf_x_athena}-devel \ + lib${cf_x_athena} \ + lib${cf_x_athena}-devel + do + CF_TRY_PKG_CONFIG($cf_athena_pkg,[ + cf_x_athena_lib="$cf_pkgconfig_libs" + CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) + AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) + + CF_TRIM_X_LIBS + +AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ +AC_TRY_LINK([ +#include +],[ +int check = XmuCompareISOLatin1("big", "small") +],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) + + if test "$cf_cv_xaw_compat" = no + then + # workaround for broken ".pc" files... + case "$cf_x_athena_lib" in + (*-lXmu*) + ;; + (*) + CF_VERBOSE(work around broken package) + cf_save_xmu="$LIBS" + cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` + CF_TRY_PKG_CONFIG(xmu,[ + LIBS="$cf_save_xmu" + CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) + ],[ + CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) + ]) + CF_TRIM_X_LIBS + ;; + esac + fi + + break]) + done +fi + +if test -z "$cf_x_athena_lib" ; then + CF_X_EXT + CF_X_TOOLKIT + CF_X_ATHENA_CPPFLAGS($cf_x_athena) + CF_X_ATHENA_LIBS($cf_x_athena) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 +dnl -------------------- +dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of +dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. +AC_DEFUN([CF_X_ATHENA_CPPFLAGS], +[ +cf_x_athena_root=ifelse([$1],,Xaw,[$1]) +cf_x_athena_inc="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + if test -z "$cf_x_athena_inc" ; then + cf_save="$CPPFLAGS" + cf_test=X11/$cf_x_athena_root/SimpleMenu.h + if test $cf_path != default ; then + CPPFLAGS="$cf_save -I$cf_path/include" + AC_MSG_CHECKING(for $cf_test in $cf_path) + else + AC_MSG_CHECKING(for $cf_test) + fi + AC_TRY_COMPILE([ +#include +#include <$cf_test>],[], + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + if test "$cf_result" = yes ; then + cf_x_athena_inc=$cf_path + break + else + CPPFLAGS="$cf_save" + fi + fi +done + +if test -z "$cf_x_athena_inc" ; then + AC_MSG_WARN( +[Unable to successfully find Athena header files with test program]) +elif test "$cf_x_athena_inc" != default ; then + CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02 +dnl ---------------- +dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of +dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. +AC_DEFUN([CF_X_ATHENA_LIBS], +[AC_REQUIRE([CF_X_TOOLKIT]) +cf_x_athena_root=ifelse([$1],,Xaw,[$1]) +cf_x_athena_lib="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + for cf_lib in \ + ${cf_x_athena_root} \ + ${cf_x_athena_root}7 \ + ${cf_x_athena_root}6 + do + for cf_libs in \ + "-l$cf_lib -lXmu" \ + "-l$cf_lib -lXpm -lXmu" \ + "-l${cf_lib}_s -lXmu_s" + do + if test -z "$cf_x_athena_lib" ; then + cf_save="$LIBS" + cf_test=XawSimpleMenuAddGlobalActions + if test $cf_path != default ; then + CF_ADD_LIBS(-L$cf_path/lib $cf_libs) + AC_MSG_CHECKING(for $cf_libs in $cf_path) + else + CF_ADD_LIBS($cf_libs) + AC_MSG_CHECKING(for $cf_test in $cf_libs) + fi + AC_TRY_LINK([ +#include +#include +],[ +$cf_test((XtAppContext) 0)], + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + if test "$cf_result" = yes ; then + cf_x_athena_lib="$cf_libs" + break + fi + LIBS="$cf_save" + fi + done # cf_libs + test -n "$cf_x_athena_lib" && break + done # cf_lib +done + +if test -z "$cf_x_athena_lib" ; then + AC_MSG_ERROR( +[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) +fi + +CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) +AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) +]) +dnl --------------------------------------------------------------------------- +dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 +dnl -------- +AC_DEFUN([CF_X_EXT],[ +CF_TRY_PKG_CONFIG(Xext,,[ + AC_CHECK_LIB(Xext,XextCreateExtension, + [CF_ADD_LIB(Xext)])]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_X_TOOLKIT version: 23 updated: 2015/04/12 15:39:00 +dnl ------------ +dnl Check for X Toolkit libraries +AC_DEFUN([CF_X_TOOLKIT], +[ +AC_REQUIRE([AC_PATH_XTRA]) +AC_REQUIRE([CF_CHECK_CACHE]) + +# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new), and (and +# in some cases has installed dummy files in the former, other cases replaced +# it with a link to the new location). This complicates the configure script. +# Check for that pitfall, and recover using pkg-config +# +# If none of these are set, the configuration is almost certainly broken. +if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" +then + CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)]) + CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)]) + CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)]) + CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)]) +fi + +cf_have_X_LIBS=no + +CF_TRY_PKG_CONFIG(xt,[ + + case "x$LIBS" in + (*-lX11*) + ;; + (*) +# we have an "xt" package, but it may omit Xt's dependency on X11 +AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ +AC_TRY_LINK([ +#include +],[ + int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); + int rc2 = XClearWindow((Display*) 0, (Window) 0); + int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); + int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); +],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) + if test "$cf_cv_xt_x11_compat" = no + then + CF_VERBOSE(work around broken X11 dependency) + # 2010/11/19 - good enough until a working Xt on Xcb is delivered. + CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) + fi + ;; + esac + +AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ +AC_TRY_LINK([ +#include +],[int num = IceConnectionNumber(0) +],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) + + if test "$cf_cv_xt_ice_compat" = no + then + # workaround for broken ".pc" files used for X Toolkit. + case "x$X_PRE_LIBS" in + (*-lICE*) + case "x$LIBS" in + (*-lICE*) + ;; + (*) + CF_VERBOSE(work around broken ICE dependency) + CF_TRY_PKG_CONFIG(ice, + [CF_TRY_PKG_CONFIG(sm)], + [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) + ;; + esac + ;; + esac + fi + + cf_have_X_LIBS=yes +],[ + + LDFLAGS="$X_LIBS $LDFLAGS" + CF_CHECK_CFLAGS($X_CFLAGS) + + AC_CHECK_FUNC(XOpenDisplay,,[ + AC_CHECK_LIB(X11,XOpenDisplay, + [CF_ADD_LIB(X11)],, + [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) + + AC_CHECK_FUNC(XtAppInitialize,,[ + AC_CHECK_LIB(Xt, XtAppInitialize, + [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) + cf_have_X_LIBS=Xt + LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, + [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) +]) + +if test $cf_have_X_LIBS = no ; then + AC_MSG_WARN( +[Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile.]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF__ADD_SHLIB_RULES version: 6 updated: 2016/04/21 21:07:50 +dnl ------------------- +dnl Append rules for creating, installing, uninstalling and cleaning library. +dnl In particular, this is needed for shared libraries since there are symbolic +dnl links which depend on configuration choices. +dnl +dnl The logic is controlled by these cache variables: +dnl $cf_cv_do_symlinks +dnl $cf_cv_shlib_version +dnl +dnl The macro uses variables set by CF__DEFINE_SHLIB_VARS +dnl +dnl $1 = makefile to append to +dnl $2 = model (static, shared, libtool) +dnl $3 = objects (dependencies) +dnl $4 = additional libraries needed to link the shared library +define([CF__ADD_SHLIB_RULES],[ + +CF__DEFINE_LIB_TARGET + +case x$2 in +(xlibtool|xshared) + cf_libdeps="ifelse($4,,,[$4])" + ;; +(x*) + cf_libdeps= + ;; +esac + +cat >>$1 <>$1 <>$1 <>$1 <>$1 <>$1 <>$1 <>$1 <>$1 <>$1 <>$1 <>$1 < and when they +dnl are both available. +define([CF__CURSES_HEAD],[ +#ifdef HAVE_XCURSES +#include +char * XCursesProgramName = "test"; +#else +#include <${cf_cv_ncurses_header:-curses.h}> +#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) +#include +#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) +#include +#elif defined(HAVE_TERM_H) +#include +#endif +#endif +]) +dnl --------------------------------------------------------------------------- +dnl CF__DEFINE_LIB_TARGET version: 2 updated: 2015/05/10 19:52:14 +dnl --------------------- +define([CF__DEFINE_LIB_TARGET],[ +cf_libname=\${LIB_BASENAME} +cf_liblink=$cf_libname +cf_libroot=$cf_libname + +if test "x$cf_cv_do_symlinks" = xyes +then + case "x$cf_cv_shlib_version" in + (xrel) + cf_liblink="\${LIB_ABI_NAME}" + cf_libname="\${LIB_REL_NAME}" + ;; + (xabi) + cf_liblink="\${LIB_REL_NAME}" + cf_libname="\${LIB_ABI_NAME}" + ;; + esac +fi +LIB_TARGET=$cf_libname +])dnl +dnl --------------------------------------------------------------------------- +dnl CF__DEFINE_SHLIB_VARS version: 4 updated: 2015/09/28 17:49:10 +dnl --------------------- +dnl Substitute makefile variables useful for CF__ADD_SHLIB_RULES. +dnl +dnl The substitution requires these variables: +dnl LIB_PREFIX - "lib" +dnl LIB_ROOTNAME - "foo" +dnl LIB_SUFFIX - ".so" +dnl REL_VERSION - "5.0" +dnl ABI_VERSION - "4.2.4" +define([CF__DEFINE_SHLIB_VARS],[ +CF__DEFINE_LIB_TARGET +SET_SHLIB_VARS="# begin CF__DEFINE_SHLIB_VARS\\ +LIB_BASENAME = \${LIB_PREFIX}\${LIB_ROOTNAME}\${LIB_SUFFIX}\\ +LIB_REL_NAME = \${LIB_BASENAME}.\${REL_VERSION}\\ +LIB_ABI_NAME = \${LIB_BASENAME}.\${ABI_VERSION}\\ +LIB_TARGET = $LIB_TARGET\\ +RM_SHARED_OPTS = $RM_SHARED_OPTS\\ +# end CF__DEFINE_SHLIB_VARS" +AC_SUBST(SET_SHLIB_VARS) +AC_SUBST(LIB_TARGET) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF__INIT_SHLIB_RULES version: 2 updated: 2013/07/27 17:38:32 +dnl -------------------- +dnl The third parameter to AC_OUTPUT, used to pass variables needed for +dnl CF__ADD_SHLIB_RULES. +define([CF__INIT_SHLIB_RULES],[ +ABI_VERSION="$ABI_VERSION" +REL_VERSION="$REL_VERSION" +LIB_MODEL="$LIB_MODEL" +LIB_PREFIX="$LIB_PREFIX" +LIB_ROOTNAME="$LIB_ROOTNAME" +DFT_DEP_SUFFIX="$DFT_DEP_SUFFIX" +RM_SHARED_OPTS="$RM_SHARED_OPTS" +cf_cv_do_symlinks="$cf_cv_do_symlinks" +cf_cv_shlib_version="$cf_cv_shlib_version" +]) diff --git a/deps/cdk-5.0-20161210/alphalist.c b/deps/cdk-5.0-20161210/alphalist.c new file mode 100644 index 0000000..7996aa2 --- /dev/null +++ b/deps/cdk-5.0-20161210/alphalist.c @@ -0,0 +1,939 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 18:39:12 $ + * $Revision: 1.111 $ + */ + +/* + * Declare file local prototypes. + */ +static BINDFN_PROTO (adjustAlphalistCB); +static BINDFN_PROTO (completeWordCB); +static int preProcessEntryField (EObjectType, void *, void *, chtype); +static int createList (CDKALPHALIST *alphalist, CDK_CSTRING *list, int listSize); + +DeclareSetXXchar (static, _setMy); +DeclareCDKObjects (ALPHALIST, Alphalist, _setMy, String); + +/* + * This creates the alphalist widget. + */ +CDKALPHALIST *newCDKAlphalist (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int height, + int width, + const char *title, + const char *label, + CDK_CSTRING *list, + int listSize, + chtype fillerChar, + chtype highlight, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKALPHALIST *alphalist = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int tempWidth = 0; + int tempHeight = 0; + int labelLen = 0; + int x, junk2; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { CDK_BACKCHAR, KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + }; + /* *INDENT-ON* */ + + if ((alphalist = newCDKObject (CDKALPHALIST, &my_funcs)) == 0 + || !createList (alphalist, list, listSize)) + { + destroyCDKObject (alphalist); + return (0); + } + + setCDKAlphalistBox (alphalist, Box); + + /* + * If the height is a negative value, the height will + * be ROWS-height, otherwise, the height will be the + * given height. + */ + boxHeight = setWidgetDimension (parentHeight, height, 0); + + /* + * If the width is a negative value, the width will + * be COLS-width, otherwise, the width will be the + * given width. + */ + boxWidth = setWidgetDimension (parentWidth, width, 0); + + /* Translate the label char *pointer to a chtype pointer. */ + if (label != 0) + { + chtype *chtypeLabel = char2Chtype (label, &labelLen, &junk2); + freeChtype (chtypeLabel); + } + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the file selector window. */ + alphalist->win = newwin (boxHeight, boxWidth, ypos, xpos); + + if (alphalist->win == 0) + { + destroyCDKObject (alphalist); + return (0); + } + keypad (alphalist->win, TRUE); + + /* *INDENT-EQLS* Set some variables. */ + ScreenOf (alphalist) = cdkscreen; + alphalist->parent = cdkscreen->window; + alphalist->highlight = highlight; + alphalist->fillerChar = fillerChar; + alphalist->boxHeight = boxHeight; + alphalist->boxWidth = boxWidth; + initExitType (alphalist); + alphalist->shadow = shadow; + alphalist->shadowWin = 0; + + /* Do we want a shadow? */ + if (shadow) + { + alphalist->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Create the entry field. */ + tempWidth = (isFullWidth (width) + ? FULL + : boxWidth - 2 - labelLen); + alphalist->entryField = newCDKEntry (cdkscreen, + getbegx (alphalist->win), + getbegy (alphalist->win), + title, label, + A_NORMAL, fillerChar, + vMIXED, tempWidth, 0, 512, + Box, FALSE); + if (alphalist->entryField == 0) + { + destroyCDKObject (alphalist); + return (0); + } + setCDKEntryLLChar (alphalist->entryField, ACS_LTEE); + setCDKEntryLRChar (alphalist->entryField, ACS_RTEE); + + /* Set the key bindings for the entry field. */ + bindCDKObject (vENTRY, + alphalist->entryField, + KEY_UP, + adjustAlphalistCB, + alphalist); + bindCDKObject (vENTRY, + alphalist->entryField, + KEY_DOWN, + adjustAlphalistCB, + alphalist); + bindCDKObject (vENTRY, + alphalist->entryField, + KEY_NPAGE, + adjustAlphalistCB, + alphalist); + bindCDKObject (vENTRY, + alphalist->entryField, + KEY_PPAGE, + adjustAlphalistCB, + alphalist); + bindCDKObject (vENTRY, + alphalist->entryField, + KEY_TAB, + completeWordCB, + alphalist); + + /* Set up the post-process function for the entry field. */ + setCDKEntryPreProcess (alphalist->entryField, preProcessEntryField, alphalist); + + /* + * Create the scrolling list. It overlaps the entry field by one line if + * we are using box-borders. + */ + tempHeight = getmaxy (alphalist->entryField->win) - BorderOf (alphalist); + tempWidth = (isFullWidth (width) + ? FULL + : boxWidth - 1); + alphalist->scrollField = newCDKScroll (cdkscreen, + getbegx (alphalist->win), + getbegy (alphalist->entryField->win) + + tempHeight, + RIGHT, + boxHeight - tempHeight, + tempWidth, + 0, (CDK_CSTRING2)list, listSize, + NONUMBERS, A_REVERSE, + Box, FALSE); + setCDKScrollULChar (alphalist->scrollField, ACS_LTEE); + setCDKScrollURChar (alphalist->scrollField, ACS_RTEE); + + /* Setup the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (vALPHALIST, + alphalist, + (chtype)bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + registerCDKObject (cdkscreen, vALPHALIST, alphalist); + + return (alphalist); +} + +/* + * This erases the file selector from the screen. + */ +static void _eraseCDKAlphalist (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + eraseCDKScroll (alphalist->scrollField); + eraseCDKEntry (alphalist->entryField); + + eraseCursesWindow (alphalist->shadowWin); + eraseCursesWindow (alphalist->win); + } +} + +/* + * This moves the alphalist field to the given location. + */ +static void _moveCDKAlphalist (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (alphalist->win); + int currentY = getbegy (alphalist->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (alphalist->win) + xplace; + ypos = getbegy (alphalist->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (alphalist), &xpos, &ypos, alphalist->boxWidth, alphalist->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (alphalist->win, -xdiff, -ydiff); + moveCursesWindow (alphalist->shadowWin, -xdiff, -ydiff); + + /* Move the sub-widgets. */ + moveCDKEntry (alphalist->entryField, xplace, yplace, relative, FALSE); + moveCDKScroll (alphalist->scrollField, xplace, yplace, relative, FALSE); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (alphalist)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKAlphalist (alphalist, ObjOf (alphalist)->box); + } +} + +/* + * The alphalist's focus resides in the entry widget. But the scroll widget + * will not draw items highlighted unless it has focus. Temporarily adjust the + * focus of the scroll widget when drawing on it to get the right highlighting. + */ +#define SaveFocus(widget) \ + boolean save = HasFocusObj (ObjOf (widget->scrollField)); \ + HasFocusObj (ObjOf (widget->scrollField)) = \ + HasFocusObj (ObjOf (widget->entryField)) + +#define RestoreFocus(widget) \ + HasFocusObj (ObjOf (widget->scrollField)) = save + +static void drawMyScroller (CDKALPHALIST *widget) +{ + SaveFocus (widget); + drawCDKScroll (widget->scrollField, ObjOf (widget->scrollField)->box); + RestoreFocus (widget); +} + +static void injectMyScroller (CDKALPHALIST *widget, chtype key) +{ + SaveFocus (widget); + (void)injectCDKScroll (widget->scrollField, key); + RestoreFocus (widget); +} + +/* + * This draws the file selector widget. + */ +static void _drawCDKAlphalist (CDKOBJS *obj, boolean Box GCC_UNUSED) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)obj; + + /* Does this widget have a shadow? */ + if (alphalist->shadowWin != 0) + { + drawShadow (alphalist->shadowWin); + } + + /* Draw in the entry field. */ + drawCDKEntry (alphalist->entryField, ObjOf (alphalist->entryField)->box); + + /* Draw in the scroll field. */ + drawMyScroller (alphalist); +} + +/* + * This activates the file selector. + */ +char *activateCDKAlphalist (CDKALPHALIST *alphalist, chtype *actions) +{ + char *ret = 0; + + /* Draw the widget. */ + drawCDKAlphalist (alphalist, ObjOf (alphalist)->box); + + /* Activate the widget. */ + ret = activateCDKEntry (alphalist->entryField, actions); + + /* Copy the exit type from the entry field. */ + copyExitType (alphalist, alphalist->entryField); + + /* Determine the exit status. */ + if (alphalist->exitType != vEARLY_EXIT) + { + return ret; + } + return 0; +} + +/* + * This injects a single character into the alphalist. + */ +static int _injectCDKAlphalist (CDKOBJS *object, chtype input) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + char *ret; + + /* Draw the widget. */ + drawCDKAlphalist (alphalist, ObjOf (alphalist)->box); + + /* Inject a character into the widget. */ + ret = injectCDKEntry (alphalist->entryField, input); + + /* Copy the exit type from the entry field. */ + copyExitType (alphalist, alphalist->entryField); + + /* Determine the exit status. */ + if (alphalist->exitType == vEARLY_EXIT) + ret = unknownString; + + ResultOf (alphalist).valueString = ret; + return (ret != unknownString); +} + +/* + * This sets multiple attributes of the widget. + */ +void setCDKAlphalist (CDKALPHALIST *alphalist, + CDK_CSTRING *list, + int listSize, + chtype fillerChar, + chtype highlight, + boolean Box) +{ + setCDKAlphalistContents (alphalist, list, listSize); + setCDKAlphalistFillerChar (alphalist, fillerChar); + setCDKAlphalistHighlight (alphalist, highlight); + setCDKAlphalistBox (alphalist, Box); +} + +/* + * This function sets the information inside the file selector. + */ +void setCDKAlphalistContents (CDKALPHALIST *widget, CDK_CSTRING *list, int listSize) +{ + CDKSCROLL *scrollp = widget->scrollField; + CDKENTRY *entry = widget->entryField; + + if (!createList (widget, list, listSize)) + return; + + /* Set the information in the scrolling list. */ + setCDKScroll (scrollp, + (CDK_CSTRING2)widget->list, + widget->listSize, + NONUMBERS, + scrollp->highlight, + ObjOf (scrollp)->box); + + /* Clean out the entry field. */ + setCDKAlphalistCurrentItem (widget, 0); + cleanCDKEntry (entry); + + /* Redraw the widget. */ + eraseCDKAlphalist (widget); + drawCDKAlphalist (widget, ObjOf (widget)->box); +} + +/* + * This returns the contents of the widget. + */ +char **getCDKAlphalistContents (CDKALPHALIST *widget, int *size) +{ + (*size) = widget->listSize; + return widget->list; +} + +/* + * Get/set the current position in the scroll-widget. + */ +int getCDKAlphalistCurrentItem (CDKALPHALIST *widget) +{ + return getCDKScrollCurrent (widget->scrollField); +} + +void setCDKAlphalistCurrentItem (CDKALPHALIST *widget, int item) +{ + if (widget->listSize != 0) + { + setCDKScrollCurrent (widget->scrollField, item); + setCDKEntryValue (widget->entryField, + widget->list[getCDKScrollCurrentItem (widget->scrollField)]); + } +} + +/* + * This sets the filler character of the entry field of the alphalist. + */ +void setCDKAlphalistFillerChar (CDKALPHALIST *alphalist, chtype fillerCharacter) +{ + CDKENTRY *entry = (CDKENTRY *)alphalist->entryField; + + alphalist->fillerChar = fillerCharacter; + + setCDKEntryFillerChar (entry, fillerCharacter); +} +chtype getCDKAlphalistFillerChar (CDKALPHALIST *alphalist) +{ + return alphalist->fillerChar; +} + +/* + * This sets the highlight bar attributes. + */ +void setCDKAlphalistHighlight (CDKALPHALIST *alphalist, chtype highlight) +{ + alphalist->highlight = highlight; +} +chtype getCDKAlphalistHighlight (CDKALPHALIST *alphalist) +{ + return alphalist->highlight; +} + +/* + * This sets whether or not the widget will be drawn with a box. + */ +void setCDKAlphalistBox (CDKALPHALIST *alphalist, boolean Box) +{ + ObjOf (alphalist)->box = Box; + ObjOf (alphalist)->borderSize = Box ? 1 : 0; +} + +boolean getCDKAlphalistBox (CDKALPHALIST *alphalist) +{ + return ObjOf (alphalist)->box; +} + +/* + * These functions set the drawing characters of the widget. + */ +static void _setMyULchar (CDKOBJS *object, chtype character) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + setCDKEntryULChar (alphalist->entryField, character); +} +static void _setMyURchar (CDKOBJS *object, chtype character) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + setCDKEntryURChar (alphalist->entryField, character); +} +static void _setMyLLchar (CDKOBJS *object, chtype character) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + setCDKScrollLLChar (alphalist->scrollField, character); +} +static void _setMyLRchar (CDKOBJS *object, chtype character) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + setCDKScrollLRChar (alphalist->scrollField, character); +} +static void _setMyVTchar (CDKOBJS *object, chtype character) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + setCDKEntryVerticalChar (alphalist->entryField, character); + setCDKScrollVerticalChar (alphalist->scrollField, character); +} +static void _setMyHZchar (CDKOBJS *object, chtype character) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + setCDKEntryHorizontalChar (alphalist->entryField, character); + setCDKScrollHorizontalChar (alphalist->scrollField, character); +} +static void _setMyBXattr (CDKOBJS *object, chtype character) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + setCDKEntryBoxAttribute (alphalist->entryField, character); + setCDKScrollBoxAttribute (alphalist->scrollField, character); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrAlphalist (CDKOBJS *obj, chtype attrib) +{ + CDKALPHALIST *alphalist = (CDKALPHALIST *)obj; + + setCDKEntryBackgroundAttrib (alphalist->entryField, attrib); + setCDKScrollBackgroundAttrib (alphalist->scrollField, attrib); +} + +static void destroyInfo (CDKALPHALIST *widget) +{ + CDKfreeStrings (widget->list); + widget->list = 0; + + widget->listSize = 0; +} + +/* + * This destroys the file selector. + */ +static void _destroyCDKAlphalist (CDKOBJS *object) +{ + if (object != 0) + { + CDKALPHALIST *alphalist = (CDKALPHALIST *)object; + + destroyInfo (alphalist); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vALPHALIST, alphalist); + + destroyCDKEntry (alphalist->entryField); + destroyCDKScroll (alphalist->scrollField); + + /* Free up the window pointers. */ + deleteCursesWindow (alphalist->shadowWin); + deleteCursesWindow (alphalist->win); + + /* Unregister the object. */ + unregisterCDKObject (vALPHALIST, alphalist); + } +} + +/* + * This function sets the pre-process function. + */ +void setCDKAlphalistPreProcess (CDKALPHALIST *alphalist, + PROCESSFN callback, + void *data) +{ + setCDKEntryPreProcess (alphalist->entryField, callback, data); +} + +/* + * This function sets the post-process function. + */ +void setCDKAlphalistPostProcess (CDKALPHALIST *alphalist, + PROCESSFN callback, + void *data) +{ + setCDKEntryPostProcess (alphalist->entryField, callback, data); +} + +/* + * Start of callback functions. + */ +static int adjustAlphalistCB (EObjectType objectType GCC_UNUSED, void + *object GCC_UNUSED, + void *clientData, + chtype key) +{ + /* *INDENT-EQLS* */ + CDKALPHALIST *alphalist = (CDKALPHALIST *)clientData; + CDKSCROLL *scrollp = alphalist->scrollField; + CDKENTRY *entry = alphalist->entryField; + + if (scrollp->listSize > 0) + { + char *current; + + /* Adjust the scrolling list. */ + injectMyScroller (alphalist, key); + + /* Set the value in the entry field. */ + current = chtype2Char (scrollp->item[scrollp->currentItem]); + setCDKEntryValue (entry, current); + drawCDKEntry (entry, ObjOf (entry)->box); + freeChar (current); + return (TRUE); + } + Beep (); + return (FALSE); +} + +/* + * This is the heart-beat of the widget. + */ +static int preProcessEntryField (EObjectType cdktype GCC_UNUSED, void + *object GCC_UNUSED, + void *clientData, + chtype input) +{ + /* *INDENT-EQLS* */ + CDKALPHALIST *alphalist = (CDKALPHALIST *)clientData; + CDKSCROLL *scrollp = alphalist->scrollField; + CDKENTRY *entry = alphalist->entryField; + int infoLen = ((entry->info != 0) + ? (int)strlen (entry->info) + : 0); + int result = 1; + bool empty = FALSE; + + /* Make sure the entry field isn't empty. */ + if (entry->info == 0) + { + empty = TRUE; + } + else if (isCDKObjectBind (ObjTypeOf (alphalist), ObjOf (alphalist), input)) + { + result = 1; /* don't try to use this key in editing */ + } + else if ((isChar (input) && + (isalnum (CharOf (input)) || + ispunct (input))) || + input == KEY_BACKSPACE || + input == KEY_DC) + { + int Index, difference, absoluteDifference, x; + int currPos = (entry->screenCol + entry->leftChar); + char *pattern = (char *)malloc ((size_t) infoLen + 2); + + if (pattern != 0) + { + strcpy (pattern, entry->info); + + if (input == KEY_BACKSPACE || input == KEY_DC) + { + if (input == KEY_BACKSPACE) + --currPos; + if (currPos >= 0) + strcpy (pattern + currPos, entry->info + currPos + 1); + } + else + { + pattern[currPos] = (char)input; + strcpy (pattern + currPos + 1, entry->info + currPos); + } + } + + if (pattern == 0) + { + Beep (); + } + else if (strlen (pattern) == 0) + { + empty = TRUE; + } + else if ((Index = searchList ((CDK_CSTRING2)alphalist->list, + alphalist->listSize, + pattern)) >= 0) + { + /* *INDENT-EQLS* */ + difference = Index - scrollp->currentItem; + absoluteDifference = abs (difference); + + /* + * If the difference is less than zero, then move up. + * Otherwise move down. + * + * If the difference is greater than 10 jump to the new + * index position. Otherwise provide the nice scroll. + */ + if (absoluteDifference <= 10) + { + for (x = 0; x < absoluteDifference; x++) + { + injectMyScroller (alphalist, + (chtype)((difference <= 0) + ? KEY_UP + : KEY_DOWN)); + } + } + else + { + setCDKScrollPosition (scrollp, Index); + } + drawMyScroller (alphalist); + } + else + { + Beep (); + result = 0; + } + + if (pattern != 0) + free (pattern); + } + + if (empty) + { + setCDKScrollPosition (scrollp, 0); + drawMyScroller (alphalist); + } + return result; +} + +/* + * This tries to complete the word in the entry field. + */ +static int completeWordCB (EObjectType objectType GCC_UNUSED, void *object GCC_UNUSED, + void *clientData, + chtype key GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + CDKALPHALIST *alphalist = (CDKALPHALIST *)clientData; + CDKENTRY *entry = (CDKENTRY *)alphalist->entryField; + CDKSCROLL *scrollp = 0; + int wordLength = 0; + int Index = 0; + int ret = 0; + char **altWords = 0; + + if (entry->info == 0) + { + Beep (); + return (TRUE); + } + wordLength = (int)strlen (entry->info); + + /* If the word length is equal to zero, just leave. */ + if (wordLength == 0) + { + Beep (); + return (TRUE); + } + + /* Look for a unique word match. */ + Index = searchList ((CDK_CSTRING2)alphalist->list, alphalist->listSize, entry->info); + + /* If the index is less than zero, return we didn't find a match. */ + if (Index < 0) + { + Beep (); + return (TRUE); + } + + /* Did we find the last word in the list? */ + if (Index == alphalist->listSize - 1) + { + setCDKEntryValue (entry, alphalist->list[Index]); + drawCDKEntry (entry, ObjOf (entry)->box); + return (TRUE); + } + + /* Ok, we found a match, is the next item similar? */ + ret = strncmp (alphalist->list[Index + 1], entry->info, (size_t) wordLength); + if (ret == 0) + { + int currentIndex = Index; + int altCount = 0; + unsigned used = 0; + int selected; + int height; + int match; + int x; + + /* Start looking for alternate words. */ + /* FIXME: bsearch would be more suitable */ + while ((currentIndex < alphalist->listSize) + && (strncmp (alphalist->list[currentIndex], + entry->info, + (size_t) wordLength) == 0)) + { + used = CDKallocStrings (&altWords, + alphalist->list[currentIndex++], + (unsigned)altCount++, + used); + } + + /* Determine the height of the scrolling list. */ + height = (altCount < 8 ? altCount + 3 : 11); + + /* Create a scrolling list of close matches. */ + scrollp = newCDKScroll (entry->obj.screen, + CENTER, CENTER, RIGHT, height, -30, + "Possible Matches.", + (CDK_CSTRING2)altWords, altCount, + NUMBERS, A_REVERSE, TRUE, FALSE); + + /* Allow them to select a close match. */ + match = activateCDKScroll (scrollp, 0); + selected = scrollp->currentItem; + + /* Check how they exited the list. */ + if (scrollp->exitType == vESCAPE_HIT) + { + /* Destroy the scrolling list. */ + destroyCDKScroll (scrollp); + + /* Clean up. */ + CDKfreeStrings (altWords); + + /* Beep at the user. */ + Beep (); + + /* Redraw the alphalist and return. */ + drawCDKAlphalist (alphalist, ObjOf (alphalist)->box); + return (TRUE); + } + + /* Destroy the scrolling list. */ + destroyCDKScroll (scrollp); + + /* Set the entry field to the selected value. */ + setCDKEntry (entry, + altWords[match], + entry->min, + entry->max, + ObjOf (entry)->box); + + /* Move the highlight bar down to the selected value. */ + for (x = 0; x < selected; x++) + { + injectMyScroller (alphalist, KEY_DOWN); + } + + /* Clean up. */ + CDKfreeStrings (altWords); + + /* Redraw the alphalist. */ + drawCDKAlphalist (alphalist, ObjOf (alphalist)->box); + } + else + { + /* Set the entry field with the found item. */ + setCDKEntry (entry, + alphalist->list[Index], + entry->min, + entry->max, + ObjOf (entry)->box); + drawCDKEntry (entry, ObjOf (entry)->box); + } + return (TRUE); +} + +static int createList (CDKALPHALIST *alphalist, CDK_CSTRING *list, int listSize) +{ + int status = 0; + + if (listSize >= 0) + { + char **newlist = typeCallocN (char *, listSize + 1); + + if (newlist != 0) + { + int x; + + /* + * We'll sort the list before we use it. It would have been better to + * declare list[] const and only modify the copy, but there may be + * clients that rely on the old behavior. + */ + sortList (list, listSize); + + /* Copy in the new information. */ + status = 1; + for (x = 0; x < listSize; x++) + { + if ((newlist[x] = copyChar (list[x])) == 0) + { + status = 0; + break; + } + } + if (status) + { + destroyInfo (alphalist); + alphalist->listSize = listSize; + alphalist->list = newlist; + } + else + { + CDKfreeStrings (newlist); + } + } + } + else + { + destroyInfo (alphalist); + status = TRUE; + } + return status; +} + +static void _focusCDKAlphalist (CDKOBJS *object) +{ + CDKALPHALIST *widget = (CDKALPHALIST *)object; + + FocusObj (ObjOf (widget->entryField)); +} + +static void _unfocusCDKAlphalist (CDKOBJS *object) +{ + CDKALPHALIST *widget = (CDKALPHALIST *)object; + + UnfocusObj (ObjOf (widget->entryField)); +} + +dummyRefreshData (Alphalist) + +dummySaveData (Alphalist) diff --git a/deps/cdk-5.0-20161210/binding.c b/deps/cdk-5.0-20161210/binding.c new file mode 100644 index 0000000..6e3d7f9 --- /dev/null +++ b/deps/cdk-5.0-20161210/binding.c @@ -0,0 +1,230 @@ +#include + +/* + * $Author: tom $ + * $Date: 2011/05/16 22:36:08 $ + * $Revision: 1.56 $ + * + * Notes: + * + * The cdktype parameter passed to bindCDKObject, etc., is redundant since + * the object parameter also has the same information. For compatibility + * just use it for a sanity check. + */ + +#ifndef KEY_MAX +#define KEY_MAX 512 +#endif + +static CDKOBJS *bindableObject (EObjectType * cdktype, void *object) +{ + CDKOBJS *obj = (CDKOBJS *)object; + + if (obj != 0 && *cdktype == ObjTypeOf (obj)) + { + if (*cdktype == vFSELECT) + { + *cdktype = vENTRY; + object = ((CDKFSELECT *)object)->entryField; + } + else if (*cdktype == vALPHALIST) + { + *cdktype = vENTRY; + object = ((CDKALPHALIST *)object)->entryField; + } + } + else + { + object = 0; + } + return (CDKOBJS *)object; +} + +/* + * This inserts a binding. + */ +void bindCDKObject (EObjectType cdktype, + void *object, + chtype key, + BINDFN function, + void *data) +{ + CDKOBJS *obj = bindableObject (&cdktype, object); + + if ((key < KEY_MAX) && obj != 0) + { + if (key != 0 && (unsigned)key >= obj->bindingCount) + { + unsigned next = (unsigned) (key + 1); + + if (obj->bindingList != 0) + obj->bindingList = typeReallocN (CDKBINDING, obj->bindingList, next); + else + obj->bindingList = typeMallocN (CDKBINDING, next); + + memset (&(obj->bindingList[obj->bindingCount]), 0, + (next - obj->bindingCount) * sizeof (CDKBINDING)); + obj->bindingCount = next; + } + + if (obj->bindingList != 0) + { + obj->bindingList[key].bindFunction = function; + obj->bindingList[key].bindData = data; + } + } +} + +/* + * This removes a binding on an object. + */ +void unbindCDKObject (EObjectType cdktype, void *object, chtype key) +{ + CDKOBJS *obj = bindableObject (&cdktype, object); + + if (obj != 0 && ((unsigned)key < obj->bindingCount)) + { + obj->bindingList[key].bindFunction = 0; + obj->bindingList[key].bindData = 0; + } +} + +/* + * This removes all the bindings for the given objects. + */ +void cleanCDKObjectBindings (EObjectType cdktype, void *object) +{ + CDKOBJS *obj = bindableObject (&cdktype, object); + + if (obj != 0 && obj->bindingList != 0) + { + unsigned x; + + for (x = 0; x < obj->bindingCount; x++) + { + (obj)->bindingList[x].bindFunction = 0; + (obj)->bindingList[x].bindData = 0; + } + freeAndNull ((obj)->bindingList); + } +} + +/* + * This checks to see if the binding for the key exists: + * If it does then it runs the command and returns its value, normally TRUE. + * If it doesn't it returns a FALSE. This way we can 'overwrite' coded + * bindings. + */ +int checkCDKObjectBind (EObjectType cdktype, void *object, chtype key) +{ + CDKOBJS *obj = bindableObject (&cdktype, object); + + if (obj != 0 && ((unsigned)key < obj->bindingCount)) + { + if ((obj)->bindingList[key].bindFunction != 0) + { + BINDFN function = obj->bindingList[key].bindFunction; + void *data = obj->bindingList[key].bindData; + + return function (cdktype, object, data, key); + } + } + return (FALSE); +} + +/* + * This checks to see if the binding for the key exists. + */ +bool isCDKObjectBind (EObjectType cdktype, void *object, chtype key) +{ + bool result = FALSE; + CDKOBJS *obj = bindableObject (&cdktype, object); + + if (obj != 0 && ((unsigned)key < obj->bindingCount)) + { + if ((obj)->bindingList[key].bindFunction != 0) + result = TRUE; + } + return (result); +} + +/* + * This is a dummy function used to ensure that the constant for mapping has + * a distinct address. + */ +int getcCDKBind (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData GCC_UNUSED, + chtype input GCC_UNUSED) +{ + return 0; +} + +/* + * Read from the input window, filtering keycodes as needed. + */ +int getcCDKObject (CDKOBJS *obj) +{ + EObjectType cdktype = ObjTypeOf (obj); + CDKOBJS *test = bindableObject (&cdktype, obj); + int result = wgetch (InputWindowOf (obj)); + + if (result >= 0 + && test != 0 + && (unsigned)result < test->bindingCount + && test->bindingList[result].bindFunction == getcCDKBind) + { + result = (int)(long)test->bindingList[result].bindData; + } + else if (test == 0 + || (unsigned)result >= test->bindingCount + || test->bindingList[result].bindFunction == 0) + { + switch (result) + { + case '\r': + case '\n': + result = KEY_ENTER; + break; + case '\t': + result = KEY_TAB; + break; + case DELETE: + result = KEY_DC; + break; + case '\b': /* same as CTRL('H'), for ASCII */ + result = KEY_BACKSPACE; + break; + case CDK_BEGOFLINE: + result = KEY_HOME; + break; + case CDK_ENDOFLINE: + result = KEY_END; + break; + case CDK_FORCHAR: + result = KEY_RIGHT; + break; + case CDK_BACKCHAR: + result = KEY_LEFT; + break; + case CDK_NEXT: + result = KEY_TAB; + break; + case CDK_PREV: + result = KEY_BTAB; + break; + } + } + return result; +} + +/* + * Use this function rather than getcCDKObject(), since we can extend it to + * handle wide-characters. + */ +int getchCDKObject (CDKOBJS *obj, boolean *functionKey) +{ + int key = getcCDKObject (obj); + *functionKey = (key >= KEY_MIN && key <= KEY_MAX); + return key; +} diff --git a/deps/cdk-5.0-20161210/button.c b/deps/cdk-5.0-20161210/button.c new file mode 100644 index 0000000..1798290 --- /dev/null +++ b/deps/cdk-5.0-20161210/button.c @@ -0,0 +1,572 @@ +#include +#include "button.h" +#include + +/* + * $Author: Aarian.P.Aleahmad $ + * $Date: 2016/01/31 20:32:25 $ + * $Revision: 1.38 $ + */ + +DeclareCDKObjects (BUTTON, Button, setCdk, Int); + +/* + * This creates a button widget. + */ +CDKBUTTON *newCDKButton (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + const char *text, + tButtonCallback callback, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKBUTTON *button = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth = 0; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + + if ((button = newCDKObject (CDKBUTTON, &my_funcs)) == 0) + return (0); + + setCDKButtonBox (button, Box); + boxHeight = 1 + 2 * BorderOf (button); + + /* Translate the char * to a chtype. */ + button->info = char2Chtype (text, &button->infoLen, &button->infoPos); + boxWidth = MAXIMUM (boxWidth, button->infoLen) + 2 * BorderOf (button); + + /* Create the string alignments. */ + button->infoPos = justifyString (boxWidth - 2 * BorderOf (button), + button->infoLen, button->infoPos); + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* *INDENT-EQLS* Create the button. */ + ScreenOf (button) = cdkscreen; + ObjOf (button)->fn = &my_funcs; + button->parent = cdkscreen->window; + button->win = newwin (boxHeight, boxWidth, ypos, xpos); + button->shadowWin = (WINDOW *)NULL; + button->xpos = xpos; + button->ypos = ypos; + button->boxWidth = boxWidth; + button->boxHeight = boxHeight; + button->callback = callback; + button->callbackData = NULL; + ObjOf (button)->inputWindow = button->win; + ObjOf (button)->acceptsFocus = TRUE; + initExitType (button); + button->shadow = shadow; + button->highlight = A_REVERSE; + + /* Is the window NULL? */ + if (button->win == (WINDOW *)NULL) + { + destroyCDKObject (button); + return (0); + } + + keypad (button->win, TRUE); + + /* If a shadow was requested, then create the shadow window. */ + if (shadow) + button->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + + /* Register this baby. */ + registerCDKObject (cdkscreen, vBUTTON, button); + + /* Return the button pointer. */ + return (button); +} + +/* + * This was added for the builder. + */ +int activateCDKButton (CDKBUTTON *button, chtype *actions) +{ + chtype input = 0; + boolean functionKey; + int ret; + + drawCDKButton (button, ObjOf (button)->box); + + if (actions == 0) + { + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (button), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKButton (button, input); + if (button->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKButton (button, actions[x]); + if (button->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and exit. */ + setExitType (button, 0); + return -1; +} + +/* + * This sets multiple attributes of the widget. + */ +void setCDKButton (CDKBUTTON *button, const char *mesg, boolean Box) +{ + setCDKButtonMessage (button, mesg); + setCDKButtonBox (button, Box); +} + +/* + * This sets the information within the button. + */ +void setCDKButtonMessage (CDKBUTTON *button, const char *info) +{ + /* Clean out the old message. */ + freeChtype (button->info); + button->infoPos = 0; + button->infoLen = 0; + + /* Copy in the new message. */ + + button->info = char2Chtype (info, &button->infoLen, &button->infoPos); + button->infoPos = justifyString (button->boxWidth - 2 * BorderOf (button), + button->infoLen, button->infoPos); + + /* Redraw the button widget. */ + eraseCDKButton (button); + drawCDKButton (button, ObjOf (button)->box); +} + +chtype *getCDKButtonMessage (CDKBUTTON *button) +{ + return button->info; +} + +/* + * This sets the box flag for the button widget. + */ +void setCDKButtonBox (CDKBUTTON *button, boolean Box) +{ + ObjOf (button)->box = Box; + ObjOf (button)->borderSize = Box ? 1 : 0; +} + +boolean getCDKButtonBox (CDKBUTTON *button) +{ + return ObjOf (button)->box; +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrButton (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKBUTTON *widget = (CDKBUTTON *)object; + + wbkgd (widget->win, attrib); + } +} + +static void drawCDKButtonText (CDKBUTTON *button) +{ + int boxWidth = button->boxWidth; + int i; + + /* Draw in the message. */ + + for (i = 0; i < boxWidth - 2 * BorderOf (button); i++) + { + chtype c; + int pos = button->infoPos; + int len = button->infoLen; + + if (i >= pos && (i - pos) < len) + c = button->info[i - pos]; + else + c = ' '; + + if (HasFocusObj (button)) + { + c = button->highlight | CharOf (c); + } + + (void)mvwaddch (button->win, BorderOf (button), i + BorderOf (button), c); + } +} + +/* + * This draws the button widget. + */ +static void _drawCDKButton (CDKOBJS *object, boolean Box GCC_UNUSED) +{ + CDKBUTTON *button = (CDKBUTTON *)object; + + /* Is there a shadow? */ + if (button->shadowWin != (WINDOW *)NULL) + { + drawShadow (button->shadowWin); + } + + /* Box the widget if asked. */ + if (ObjOf (button)->box) + { + drawObjBox (button->win, ObjOf (button)); + } + drawCDKButtonText (button); + wrefresh (button->win); +} + +/* + * This erases the button widget. + */ +static void _eraseCDKButton (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKBUTTON *button = (CDKBUTTON *)object; + + eraseCursesWindow (button->win); + eraseCursesWindow (button->shadowWin); + } +} + +/* + * This moves the button field to the given location. + */ +static void _moveCDKButton (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKBUTTON *button = (CDKBUTTON *)object; + int currentX = getbegx (button->win); + int currentY = getbegy (button->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (button->win) + xplace; + ypos = getbegy (button->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (button), &xpos, &ypos, button->boxWidth, + button->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (button->win, -xdiff, -ydiff); + moveCursesWindow (button->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (button)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKButton (button, ObjOf (button)->box); + } +} + +/* + * This allows the user to use the cursor keys to adjust the + * position of the widget. + */ +void positionCDKButton (CDKBUTTON *button) +{ + /* Declare some variables. */ + int origX = getbegx (button->win); + int origY = getbegy (button->win); + chtype key = (chtype)0; + boolean functionKey; + + /* Let them move the widget around until they hit return. */ + while (key != KEY_ENTER) + { + key = (chtype)getchCDKObject (ObjOf (button), &functionKey); + if (key == KEY_UP || key == '8') + { + if (getbegy (button->win) > 0) + { + moveCDKButton (button, 0, -1, TRUE, TRUE); + } + else + { + Beep (); + } + } + else if (key == KEY_DOWN || key == '2') + { + if (getbegy (button->win) + getmaxy (button->win) < + getmaxy (WindowOf (button)) - 1) + { + moveCDKButton (button, 0, 1, TRUE, TRUE); + } + else + { + Beep (); + } + } + else if (key == KEY_LEFT || key == '4') + { + if (getbegx (button->win) > 0) + { + moveCDKButton (button, -1, 0, TRUE, TRUE); + } + else + { + Beep (); + } + } + else if (key == KEY_RIGHT || key == '6') + { + if (getbegx (button->win) + getmaxx (button->win) < getmaxx + (WindowOf (button)) - 1) + { + moveCDKButton (button, 1, 0, TRUE, TRUE); + } + else + { + Beep (); + } + } + else if (key == '7') + { + if (getbegy (button->win) > 0 && getbegx (button->win) > 0) + { + moveCDKButton (button, -1, -1, TRUE, TRUE); + } + else + { + Beep (); + } + } + else if (key == '9') + { + if (getbegx (button->win) + getmaxx (button->win) < getmaxx + (WindowOf (button)) - 1 && + getbegy (button->win) > 0) + { + moveCDKButton (button, 1, -1, TRUE, TRUE); + } + else + { + Beep (); + } + } + else if (key == '1') + { + if (getbegx (button->win) > 0 && getbegx (button->win) + + getmaxx (button->win) < getmaxx (WindowOf (button)) - 1) + { + moveCDKButton (button, -1, 1, TRUE, TRUE); + } + else + { + Beep (); + } + } + else if (key == '3') + { + if (getbegx (button->win) + getmaxx (button->win) < + getmaxx (WindowOf (button)) - 1 + && getbegy (button->win) + getmaxy (button->win) < + getmaxy (WindowOf (button)) - 1) + { + moveCDKButton (button, 1, 1, TRUE, TRUE); + } + else + { + Beep (); + } + } + else if (key == '5') + { + moveCDKButton (button, CENTER, CENTER, FALSE, TRUE); + } + else if (key == 't') + { + moveCDKButton (button, getbegx (button->win), TOP, FALSE, TRUE); + } + else if (key == 'b') + { + moveCDKButton (button, getbegx (button->win), BOTTOM, FALSE, TRUE); + } + else if (key == 'l') + { + moveCDKButton (button, LEFT, getbegy (button->win), FALSE, TRUE); + } + else if (key == 'r') + { + moveCDKButton (button, RIGHT, getbegy (button->win), FALSE, TRUE); + } + else if (key == 'c') + { + moveCDKButton (button, CENTER, getbegy (button->win), FALSE, TRUE); + } + else if (key == 'C') + { + moveCDKButton (button, getbegx (button->win), CENTER, FALSE, TRUE); + } + else if (key == CDK_REFRESH) + { + eraseCDKScreen (ScreenOf (button)); + refreshCDKScreen (ScreenOf (button)); + } + else if (key == KEY_ESC) + { + moveCDKButton (button, origX, origY, FALSE, TRUE); + } + else if (key != KEY_ENTER) + { + Beep (); + } + } +} + +/* + * This destroys the button object pointer. + */ +static void _destroyCDKButton (CDKOBJS *object) +{ + if (object != 0) + { + CDKBUTTON *button = (CDKBUTTON *)object; + + /* Free up the character pointers. */ + freeChtype (button->info); + + /* Free up the window pointers. */ + deleteCursesWindow (button->shadowWin); + deleteCursesWindow (button->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vBUTTON, button); + + /* Unregister the object. */ + unregisterCDKObject (vBUTTON, button); + } +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKButton (CDKOBJS *object, chtype input) +{ + CDKBUTTON *widget = (CDKBUTTON *)object; + int ret = unknownInt; + bool complete = FALSE; + + setExitType (widget, 0); + + /* Check a predefined binding. */ + if (checkCDKObjectBind (vBUTTON, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ENTER: + case SPACE: + if (widget->callback) + widget->callback (widget); + setExitType (widget, KEY_ENTER); + ret = 0; + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + Beep (); + break; + } + } + + if (!complete) + { + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +static void _focusCDKButton (CDKOBJS *object) +{ + CDKBUTTON *button = (CDKBUTTON *)object; + + drawCDKButtonText (button); + wrefresh (button->win); +} + +static void _unfocusCDKButton (CDKOBJS *object) +{ + CDKBUTTON *button = (CDKBUTTON *)object; + + drawCDKButtonText (button); + wrefresh (button->win); +} + +dummyRefreshData (Button) + +dummySaveData (Button) diff --git a/deps/cdk-5.0-20161210/buttonbox.c b/deps/cdk-5.0-20161210/buttonbox.c new file mode 100644 index 0000000..43558f8 --- /dev/null +++ b/deps/cdk-5.0-20161210/buttonbox.c @@ -0,0 +1,590 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 18:41:25 $ + * $Revision: 1.68 $ + */ + +DeclareCDKObjects (BUTTONBOX, Buttonbox, setCdk, Int); + +/* + * This returns a CDK buttonbox widget pointer. + */ +CDKBUTTONBOX *newCDKButtonbox (CDKSCREEN *cdkscreen, + int xPos, + int yPos, + int height, + int width, + const char *title, + int rows, + int cols, + CDK_CSTRING2 buttons, + int buttonCount, + chtype highlight, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKBUTTONBOX *buttonbox = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth = 0; + int boxHeight = 0; + int maxColWidth = INT_MIN; + int colWidth = 0; + int xpos = xPos; + int ypos = yPos; + int currentButton = 0; + int x, y, junk; + + if (buttonCount <= 0 + || (buttonbox = newCDKObject (CDKBUTTONBOX, &my_funcs)) == 0 + || (buttonbox->button = typeCallocN (chtype *, buttonCount + 1)) == 0 + || (buttonbox->buttonLen = typeCallocN (int, buttonCount + 1)) == 0 + || (buttonbox->buttonPos = typeCallocN (int, buttonCount + 1)) == 0 + || (buttonbox->columnWidths = typeCallocN (int, buttonCount + 1)) == 0) + { + destroyCDKObject (buttonbox); + return (0); + } + + setCDKButtonboxBox (buttonbox, Box); + + /* Set some default values for the widget. */ + buttonbox->rowAdjust = 0; + buttonbox->colAdjust = 0; + + /* + * If the height is a negative value, the height will + * be ROWS-height, otherwise, the height will be the + * given height. + */ + boxHeight = setWidgetDimension (parentHeight, height, rows + 1); + + /* + * If the width is a negative value, the width will + * be COLS-width, otherwise, the width will be the + * given width. + */ + boxWidth = setWidgetDimension (parentWidth, width, 0); + + boxWidth = setCdkTitle (ObjOf (buttonbox), title, boxWidth); + + /* Translate the buttons char * to a chtype * */ + for (x = 0; x < buttonCount; x++) + { + buttonbox->button[x] = char2Chtype (buttons[x], + &buttonbox->buttonLen[x], + &junk); + } + + /* Set the button positions. */ + for (x = 0; x < cols; x++) + { + maxColWidth = INT_MIN; + + /* Look for the widest item in this column. */ + for (y = 0; y < rows; y++) + { + if (currentButton < buttonCount) + { + maxColWidth = MAXIMUM (buttonbox->buttonLen[currentButton], maxColWidth); + currentButton++; + } + } + + /* Keep the maximum column width for this column. */ + buttonbox->columnWidths[x] = maxColWidth; + colWidth += maxColWidth; + } + boxWidth++; + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + + /* Now we have to readjust the x and y positions. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* *INDENT-EQLS* Set up the buttonbox box attributes. */ + ScreenOf (buttonbox) = cdkscreen; + buttonbox->parent = cdkscreen->window; + buttonbox->win = newwin (boxHeight, boxWidth, ypos, xpos); + buttonbox->shadowWin = 0; + buttonbox->buttonCount = buttonCount; + buttonbox->currentButton = 0; + buttonbox->rows = rows; + buttonbox->cols = (buttonCount < cols ? buttonCount : cols); + buttonbox->boxHeight = boxHeight; + buttonbox->boxWidth = boxWidth; + buttonbox->highlight = highlight; + initExitType (buttonbox); + ObjOf (buttonbox)->acceptsFocus = TRUE; + ObjOf (buttonbox)->inputWindow = buttonbox->win; + buttonbox->shadow = shadow; + buttonbox->ButtonAttrib = A_NORMAL; + + /* Set up the row adjustment. */ + if (boxHeight - rows - TitleLinesOf (buttonbox) > 0) + { + buttonbox->rowAdjust = (int)((boxHeight + - rows + - TitleLinesOf (buttonbox)) / buttonbox->rows); + } + + /* Set the col adjustment. */ + if (boxWidth - colWidth > 0) + { + buttonbox->colAdjust = (int)((boxWidth - colWidth) + / buttonbox->cols) - 1; + } + + /* If we couldn't create the window, we should return a null value. */ + if (buttonbox->win == 0) + { + destroyCDKObject (buttonbox); + return (0); + } + keypad (buttonbox->win, TRUE); + + /* Was there a shadow? */ + if (shadow) + { + buttonbox->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Register this baby. */ + registerCDKObject (cdkscreen, vBUTTONBOX, buttonbox); + + /* Return the buttonbox box pointer. */ + return (buttonbox); +} + +/* + * This activates the widget. + */ +int activateCDKButtonbox (CDKBUTTONBOX *buttonbox, chtype *actions) +{ + chtype input = 0; + boolean functionKey; + int ret; + + /* Draw the buttonbox box. */ + drawCDKButtonbox (buttonbox, ObjOf (buttonbox)->box); + + if (actions == 0) + { + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (buttonbox), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKButtonbox (buttonbox, input); + if (buttonbox->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKButtonbox (buttonbox, actions[x]); + if (buttonbox->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and exit. */ + setExitType (buttonbox, 0); + return -1; +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKButtonbox (CDKOBJS *object, chtype input) +{ + /* *INDENT-EQLS* */ + CDKBUTTONBOX *widget = (CDKBUTTONBOX *)object; + int lastButton = widget->buttonCount - 1; + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + ppReturn = PreProcessFuncOf (widget) (vBUTTONBOX, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a key binding. */ + if (checkCDKObjectBind (vBUTTONBOX, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + int firstButton = 0; + + switch (input) + { + case KEY_LEFT: + case KEY_BTAB: + case KEY_BACKSPACE: + if ((widget->currentButton - widget->rows) < firstButton) + { + widget->currentButton = lastButton; + } + else + { + widget->currentButton -= widget->rows; + } + break; + + case KEY_RIGHT: + case KEY_TAB: + case SPACE: + if ((widget->currentButton + widget->rows) > lastButton) + { + widget->currentButton = firstButton; + } + else + { + widget->currentButton += widget->rows; + } + break; + + case KEY_UP: + if ((widget->currentButton - 1) < firstButton) + { + widget->currentButton = lastButton; + } + else + { + widget->currentButton--; + } + break; + + case KEY_DOWN: + if ((widget->currentButton + 1) > lastButton) + { + widget->currentButton = firstButton; + } + else + { + widget->currentButton++; + } + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ENTER: + setExitType (widget, input); + ret = widget->currentButton; + complete = TRUE; + break; + + default: + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vBUTTONBOX, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKButtonboxButtons (widget); + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * This sets multiple attributes of the widget. + */ +void setCDKButtonbox (CDKBUTTONBOX *buttonbox, chtype highlight, boolean Box) +{ + setCDKButtonboxHighlight (buttonbox, highlight); + setCDKButtonboxBox (buttonbox, Box); +} + +/* + * This sets the highlight attribute for the buttonboxs. + */ +void setCDKButtonboxHighlight (CDKBUTTONBOX *buttonbox, chtype highlight) +{ + buttonbox->highlight = highlight; +} +chtype getCDKButtonboxHighlight (CDKBUTTONBOX *buttonbox) +{ + return (chtype)buttonbox->highlight; +} + +/* + * This sets the box attribute of the widget. + */ +void setCDKButtonboxBox (CDKBUTTONBOX *buttonbox, boolean Box) +{ + ObjOf (buttonbox)->box = Box; + ObjOf (buttonbox)->borderSize = Box ? 1 : 0; +} +boolean getCDKButtonboxBox (CDKBUTTONBOX *buttonbox) +{ + return ObjOf (buttonbox)->box; +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrButtonbox (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKBUTTONBOX *widget = (CDKBUTTONBOX *)object; + + wbkgd (widget->win, attrib); + } +} + +/* + * This draws the buttonbox box widget. + */ +static void _drawCDKButtonbox (CDKOBJS *object, boolean Box) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)object; + + /* Is there a shadow? */ + if (buttonbox->shadowWin != 0) + { + drawShadow (buttonbox->shadowWin); + } + + /* Box the widget if they asked. */ + if (Box) + { + drawObjBox (buttonbox->win, ObjOf (buttonbox)); + } + + /* Draw in the title if there is one. */ + drawCdkTitle (buttonbox->win, object); + + /* Draw in the buttons. */ + drawCDKButtonboxButtons (buttonbox); +} + +/* + * This draws the buttons on the button box widget. + */ +void drawCDKButtonboxButtons (CDKBUTTONBOX *buttonbox) +{ + /* *INDENT-EQLS* */ + int row; + int col = (int)(buttonbox->colAdjust / 2); + int currentButton = 0; + int x, y; + int cur_row = -1; + int cur_col = -1; + + /* Draw the buttons. */ + while (currentButton < buttonbox->buttonCount) + { + for (x = 0; x < buttonbox->cols; x++) + { + row = TitleLinesOf (buttonbox) + BorderOf (buttonbox); + + for (y = 0; y < buttonbox->rows; y++) + { + chtype attr = buttonbox->ButtonAttrib; + if (currentButton == buttonbox->currentButton) + { + attr = buttonbox->highlight, + cur_row = row; + cur_col = col; + } + writeChtypeAttrib (buttonbox->win, + col, row, + buttonbox->button[currentButton], + attr, + HORIZONTAL, 0, + buttonbox->buttonLen[currentButton]); + row += (1 + buttonbox->rowAdjust); + currentButton++; + } + col += buttonbox->columnWidths[x] + buttonbox->colAdjust + BorderOf (buttonbox); + } + } + if (cur_row >= 0 && cur_col >= 0) + wmove (buttonbox->win, cur_row, cur_col); + wrefresh (buttonbox->win); +} + +/* + * This erases the buttonbox box from the screen. + */ +static void _eraseCDKButtonbox (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)object; + + eraseCursesWindow (buttonbox->win); + eraseCursesWindow (buttonbox->shadowWin); + } +} + +/* + * This moves the buttonbox box to a new screen location. + */ +static void _moveCDKButtonbox (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (buttonbox->win); + int currentY = getbegy (buttonbox->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (buttonbox->win) + xplace; + ypos = getbegy (buttonbox->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (buttonbox), &xpos, &ypos, buttonbox->boxWidth, buttonbox->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (buttonbox->win, -xdiff, -ydiff); + moveCursesWindow (buttonbox->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (buttonbox)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKButtonbox (buttonbox, ObjOf (buttonbox)->box); + } +} + +/* + * This destroys the widget and all the memory associated with it. + */ +static void _destroyCDKButtonbox (CDKOBJS *object) +{ + if (object != 0) + { + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)object; + + cleanCdkTitle (object); + CDKfreeChtypes (buttonbox->button); + freeChecked (buttonbox->buttonLen); + freeChecked (buttonbox->buttonPos); + freeChecked (buttonbox->columnWidths); + + /* Delete the windows. */ + deleteCursesWindow (buttonbox->shadowWin); + deleteCursesWindow (buttonbox->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vBUTTONBOX, buttonbox); + + /* Unregister this object. */ + unregisterCDKObject (vBUTTONBOX, buttonbox); + } +} + +/* + * + */ +void setCDKButtonboxCurrentButton (CDKBUTTONBOX *buttonbox, int button) +{ + if ((button >= 0) && (button < buttonbox->buttonCount)) + { + buttonbox->currentButton = button; + } +} +int getCDKButtonboxCurrentButton (CDKBUTTONBOX *buttonbox) +{ + return buttonbox->currentButton; +} +int getCDKButtonboxButtonCount (CDKBUTTONBOX *buttonbox) +{ + return buttonbox->buttonCount; +} + +static void _focusCDKButtonbox (CDKOBJS *object) +{ + CDKBUTTONBOX *widget = (CDKBUTTONBOX *)object; + + drawCDKButtonbox (widget, ObjOf (widget)->box); +} + +static void _unfocusCDKButtonbox (CDKOBJS *object) +{ + CDKBUTTONBOX *widget = (CDKBUTTONBOX *)object; + + drawCDKButtonbox (widget, ObjOf (widget)->box); +} + +dummyRefreshData (Buttonbox) + +dummySaveData (Buttonbox) diff --git a/deps/cdk-5.0-20161210/c++/cdkscreen.cc b/deps/cdk-5.0-20161210/c++/cdkscreen.cc new file mode 100644 index 0000000..11bf93d --- /dev/null +++ b/deps/cdk-5.0-20161210/c++/cdkscreen.cc @@ -0,0 +1,30 @@ +#include "cdkscreen.h" + +CDKScreen::CDKScreen() +{ + cdkscreen = initCDKScreen(NULL); + // Now, set up color. + initCDKColor(); +} + +CDKScreen::~CDKScreen() +{ + destroyCDKScreen(cdkscreen); + endCDK(); +} + +CDKSCREEN *CDKScreen::screen(void) +{ + return cdkscreen; +} + +void CDKScreen::refreshscr(void) +{ + refreshCDKScreen(cdkscreen); +} + +void CDKScreen::erasescr(void) +{ + eraseCDKScreen(cdkscreen); +} + diff --git a/deps/cdk-5.0-20161210/c++/cdkscreen.h b/deps/cdk-5.0-20161210/c++/cdkscreen.h new file mode 100644 index 0000000..ca22216 --- /dev/null +++ b/deps/cdk-5.0-20161210/c++/cdkscreen.h @@ -0,0 +1,30 @@ +#ifndef CDKSCREEN_H +#define CDK_SCREEN_H + +extern "C" +{ +#include +} + +class CDKScreen +{ + // The window which curses uses. + WINDOW *cursesWin; + // The CDKSCREEN struct assigned to this object. + CDKSCREEN *cdkscreen; + public: + // Constructor. + CDKScreen(); + // Deconstructor. + ~CDKScreen(); + // Return a pointer to the CDKScreen structure. + CDKSCREEN *screen(void); + // Refresh the screen. + // Note, this function is renamed to avoid clashing with the refresh() macro. + void refreshscr(void); + // Erase, but don't destroy, all widgets. + // Note, this function is renamed to avoid clashing with the erase() macro. + void erasescr(void); +}; + +#endif diff --git a/deps/cdk-5.0-20161210/calendar.c b/deps/cdk-5.0-20161210/calendar.c new file mode 100644 index 0000000..956f0c2 --- /dev/null +++ b/deps/cdk-5.0-20161210/calendar.c @@ -0,0 +1,1181 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 20:06:42 $ + * $Revision: 1.99 $ + */ + +#define YEAR2INDEX(year) (((year) >= 1900) ? ((year) - 1900) : (year)) + +/* + * Declare file local variables. + */ +static const char *monthsOfTheYear[] = +{ + "NULL", + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +}; + +static int daysOfTheMonth[] = +{ + -1, + 31, + 28, + 31, + 30, + 31, + 30, + 31, + 31, + 30, + 31, + 30, + 31 +}; + +/* + * Declare file local prototypes. + */ +static int getMonthLength (int year, int month); +static int getMonthStartWeekday (int year, int month); +static time_t getCurrentTime (CDKCALENDAR *calendar); +static void verifyCalendarDate (CDKCALENDAR *calendar); +static void incrementCalendarDay (CDKCALENDAR *calendar, int adjust); +static void decrementCalendarDay (CDKCALENDAR *calendar, int adjust); +static void incrementCalendarMonth (CDKCALENDAR *calendar, int adjust); +static void decrementCalendarMonth (CDKCALENDAR *calendar, int adjust); +static void incrementCalendarYear (CDKCALENDAR *calendar, int adjust); +static void decrementCalendarYear (CDKCALENDAR *calendar, int adjust); +static void drawCDKCalendarField (CDKCALENDAR *calendar); + +DeclareCDKObjects (CALENDAR, Calendar, setCdk, Int); + +/* + * This creates a calendar widget. + */ +CDKCALENDAR *newCDKCalendar (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + const char *title, + int day, + int month, + int year, + chtype dayAttrib, + chtype monthAttrib, + chtype yearAttrib, + chtype highlight, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKCALENDAR *calendar = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth = 24; + int boxHeight = 11; + int xpos = xplace; + int ypos = yplace; + int x; + struct tm *dateInfo; + time_t clck; + const char *dayname = "Su Mo Tu We Th Fr Sa "; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { 'T', KEY_HOME }, + { 't', KEY_HOME }, + { 'n', KEY_NPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + { 'p', KEY_PPAGE }, + { CDK_BACKCHAR, KEY_PPAGE }, + }; + /* *INDENT-ON* */ + + + if ((calendar = newCDKObject (CDKCALENDAR, &my_funcs)) == 0) + return (0); + + setCDKCalendarBox (calendar, Box); + + boxWidth = setCdkTitle (ObjOf (calendar), title, boxWidth); + + boxHeight += TitleLinesOf (calendar); + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Create the calendar window. */ + calendar->win = newwin (boxHeight, boxWidth, ypos, xpos); + + /* Is the window null? */ + if (calendar->win == 0) + { + destroyCDKObject (calendar); + return (0); + } + keypad (calendar->win, TRUE); + + /* Set some variables. */ + calendar->xOffset = (boxWidth - 20) / 2; + calendar->fieldWidth = boxWidth - 2 * (1 + BorderOf (calendar)); + + /* Set months and days names */ + for (x = 0; x < MAX_MONTHS; x++) + { + calendar->MonthName[x] = copyChar (monthsOfTheYear[x]); + } + calendar->DayName = copyChar (dayname); + + /* *INDENT-EQLS* Set the rest of the widget values. */ + ScreenOf (calendar) = cdkscreen; + calendar->parent = cdkscreen->window; + calendar->shadowWin = 0; + calendar->xpos = xpos; + calendar->ypos = ypos; + calendar->boxWidth = boxWidth; + calendar->boxHeight = boxHeight; + calendar->day = day; + calendar->month = month; + calendar->year = year; + calendar->dayAttrib = dayAttrib; + calendar->monthAttrib = monthAttrib; + calendar->yearAttrib = yearAttrib; + calendar->highlight = highlight; + calendar->width = boxWidth; + initExitType (calendar); + ObjOf (calendar)->acceptsFocus = TRUE; + ObjOf (calendar)->inputWindow = calendar->win; + calendar->shadow = shadow; + + calendar->labelWin = subwin (calendar->win, + 1, calendar->fieldWidth, + ypos + TitleLinesOf (calendar) + 1, + xpos + 1 + BorderOf (calendar)); + if (calendar->labelWin == 0) + { + destroyCDKObject (calendar); + return (0); + } + + calendar->fieldWin = subwin (calendar->win, + 7, 20, + ypos + TitleLinesOf (calendar) + 3, + xpos + calendar->xOffset); + if (calendar->fieldWin == 0) + { + destroyCDKObject (calendar); + return (0); + } + + setCDKCalendarBox (calendar, Box); + + calendar->marker = typeCallocN (chtype, CALENDAR_LIMIT); + if (calendar->marker == 0) + { + destroyCDKObject (calendar); + return (0); + } + + /* If the day/month/year values were 0, then use today's date. */ + if ((calendar->day == 0) && (calendar->month == 0) && (calendar->year == 0)) + { + time (&clck); + dateInfo = gmtime (&clck); + + /* *INDENT-EQLS* */ + calendar->day = dateInfo->tm_mday; + calendar->month = dateInfo->tm_mon + 1; + calendar->year = dateInfo->tm_year + 1900; + } + + /* Verify the dates provided. */ + verifyCalendarDate (calendar); + + /* Determine which day the month starts on. */ + calendar->weekDay = getMonthStartWeekday (calendar->year, calendar->month); + + /* If a shadow was requested, then create the shadow window. */ + if (shadow) + { + calendar->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Setup the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (vCALENDAR, + calendar, + (chtype)bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + registerCDKObject (cdkscreen, vCALENDAR, calendar); + + return (calendar); +} + +/* + * This function lets the user play with this widget. + */ +time_t activateCDKCalendar (CDKCALENDAR *calendar, chtype *actions) +{ + /* *INDENT-EQLS* */ + chtype input = 0; + boolean functionKey; + time_t ret = -1; + + /* Draw the widget. */ + drawCDKCalendar (calendar, ObjOf (calendar)->box); + + if (actions == 0) + { + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (calendar), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKCalendar (calendar, input); + if (calendar->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKCalendar (calendar, actions[x]); + if (calendar->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + return ret; +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKCalendar (CDKOBJS *object, chtype input) +{ + CDKCALENDAR *widget = (CDKCALENDAR *)object; + /* Declare local variables. */ + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Refresh the widget field. */ + drawCDKCalendarField (widget); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vCALENDAR, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check a predefined binding. */ + if (checkCDKObjectBind (vCALENDAR, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_UP: + decrementCalendarDay (widget, 7); + break; + + case KEY_DOWN: + incrementCalendarDay (widget, 7); + break; + + case KEY_LEFT: + decrementCalendarDay (widget, 1); + break; + + case KEY_RIGHT: + incrementCalendarDay (widget, 1); + break; + + case KEY_NPAGE: + incrementCalendarMonth (widget, 1); + break; + + case 'N': + incrementCalendarMonth (widget, 6); + break; + + case KEY_PPAGE: + decrementCalendarMonth (widget, 1); + break; + + case 'P': + decrementCalendarMonth (widget, 6); + break; + + case '-': + decrementCalendarYear (widget, 1); + break; + + case '+': + incrementCalendarYear (widget, 1); + break; + + case KEY_HOME: + setCDKCalendarDate (widget, -1, -1, -1); + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_TAB: + case KEY_ENTER: + setExitType (widget, input); + ret = (int)getCurrentTime (widget); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + } + } + + /* Should we do a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vCALENDAR, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * This moves the calendar field to the given location. + */ +static void _moveCDKCalendar (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (calendar->win); + int currentY = getbegy (calendar->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (calendar->win) + xplace; + ypos = getbegy (calendar->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (calendar), &xpos, &ypos, calendar->boxWidth, calendar->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (calendar->win, -xdiff, -ydiff); + moveCursesWindow (calendar->fieldWin, -xdiff, -ydiff); + moveCursesWindow (calendar->labelWin, -xdiff, -ydiff); + moveCursesWindow (calendar->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (calendar)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKCalendar (calendar, ObjOf (calendar)->box); + } +} + +/* + * This draws the calendar widget. + */ +static void _drawCDKCalendar (CDKOBJS *object, boolean Box) +{ + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + int headerLen = (int)strlen (calendar->DayName); + int colLen = (6 + headerLen) / 7; + int col; + + /* Is there a shadow? */ + if (calendar->shadowWin != 0) + { + drawShadow (calendar->shadowWin); + } + + /* Box the widget if asked. */ + if (Box) + { + drawObjBox (calendar->win, ObjOf (calendar)); + } + + drawCdkTitle (calendar->win, object); + + /* Draw in the day-of-the-week header. */ + for (col = 0; col < 7; ++col) + { + int src = colLen * ((col + (calendar->weekBase % 7)) % 7); + int dst = colLen * col; + writeChar (calendar->win, + calendar->xOffset + dst, + TitleLinesOf (calendar) + 2, + calendar->DayName + src, HORIZONTAL, 0, colLen); + } + + wrefresh (calendar->win); + + drawCDKCalendarField (calendar); +} + +/* + * This draws the month field. + */ +static void drawCDKCalendarField (CDKCALENDAR *calendar) +{ + /* *INDENT-EQLS* */ + char *monthName = calendar->MonthName[calendar->month]; + int monthLength = getMonthLength (calendar->year, calendar->month); + int yearIndex = YEAR2INDEX (calendar->year); + int day; + int row, col; + int save_y = -1; + int save_x = -1; + char temp[30]; + + day = (1 - calendar->weekDay + (calendar->weekBase % 7)); + if (day > 0) + day -= 7; + + for (row = 1; row <= 6; row++) + { + for (col = 0; col < 7; col++) + { + if (day >= 1 && day <= monthLength) + { + int xpos = col * 3; + int ypos = row; + + chtype marker = calendar->dayAttrib; + + sprintf (temp, "%02d", day); + + if (calendar->day == day) + { + marker = calendar->highlight; + save_y = (ypos + + getbegy (calendar->fieldWin) + - getbegy (InputWindowOf (calendar))); + save_x = 1; + } + else + { + marker |= getCDKCalendarMarker (calendar, + day, + calendar->month, + yearIndex); + } + writeCharAttrib (calendar->fieldWin, xpos, ypos, + temp, marker, HORIZONTAL, 0, 2); + } + day++; + } + } + wrefresh (calendar->fieldWin); + + /* Draw the month in. */ + if (calendar->labelWin != 0) + { + int yearLen = 0; + + sprintf (temp, "%s %d,", monthName, calendar->day); + writeChar (calendar->labelWin, 0, 0, + temp, HORIZONTAL, 0, (int)strlen (temp)); + wclrtoeol (calendar->labelWin); + + /* Draw the year in. */ + sprintf (temp, "%d", calendar->year); + yearLen = (int)strlen (temp); + writeChar (calendar->labelWin, + calendar->fieldWidth - yearLen, 0, + temp, HORIZONTAL, 0, yearLen); + + wmove (calendar->labelWin, 0, 0); + wrefresh (calendar->labelWin); + } + else if (save_y >= 0) + { + wmove (InputWindowOf (calendar), save_y, save_x); + wrefresh (InputWindowOf (calendar)); + } +} + +/* + * This sets multiple attributes of the widget. + */ +void setCDKCalendar (CDKCALENDAR *calendar, + int day, + int month, + int year, + chtype dayAttrib, + chtype monthAttrib, + chtype yearAttrib, + chtype highlight, + boolean Box) +{ + setCDKCalendarDate (calendar, day, month, year); + setCDKCalendarDayAttribute (calendar, dayAttrib); + setCDKCalendarMonthAttribute (calendar, monthAttrib); + setCDKCalendarYearAttribute (calendar, yearAttrib); + setCDKCalendarHighlight (calendar, highlight); + setCDKCalendarBox (calendar, Box); +} + +/* + * This sets the date and some attributes. + */ +void setCDKCalendarDate (CDKCALENDAR *calendar, int day, int month, int year) +{ + /* Declare local variables. */ + struct tm *dateInfo; + time_t clck; + + /* + * Get the current dates and set the default values for + * the day/month/year values for the calendar. + */ + time (&clck); + dateInfo = gmtime (&clck); + + /* Set the date elements if we need too. */ + /* *INDENT-EQLS* */ + calendar->day = (day == -1 ? dateInfo->tm_mday : day); + calendar->month = (month == -1 ? dateInfo->tm_mon + 1 : month); + calendar->year = (year == -1 ? dateInfo->tm_year + 1900 : year); + + /* Verify the date information. */ + verifyCalendarDate (calendar); + + /* Get the start of the current month. */ + calendar->weekDay = getMonthStartWeekday (calendar->year, calendar->month); +} + +/* + * This returns the current date on the calendar. + */ +void getCDKCalendarDate (CDKCALENDAR *calendar, int *day, int *month, int *year) +{ + /* *INDENT-EQLS* */ + (*day) = calendar->day; + (*month) = calendar->month; + (*year) = calendar->year; +} + +/* + * This sets the attribute of the days in the calendar. + */ +void setCDKCalendarDayAttribute (CDKCALENDAR *calendar, chtype attribute) +{ + calendar->dayAttrib = attribute; +} +chtype getCDKCalendarDayAttribute (CDKCALENDAR *calendar) +{ + return calendar->dayAttrib; +} + +/* + * This sets the attribute of the month names in the calendar. + */ +void setCDKCalendarMonthAttribute (CDKCALENDAR *calendar, chtype attribute) +{ + calendar->monthAttrib = attribute; +} +chtype getCDKCalendarMonthAttribute (CDKCALENDAR *calendar) +{ + return calendar->monthAttrib; +} + +/* + * This sets the attribute of the year in the calendar. + */ +void setCDKCalendarYearAttribute (CDKCALENDAR *calendar, chtype attribute) +{ + calendar->yearAttrib = attribute; +} +chtype getCDKCalendarYearAttribute (CDKCALENDAR *calendar) +{ + return calendar->yearAttrib; +} + +/* + * This sets the attribute of the highlight box. + */ +void setCDKCalendarHighlight (CDKCALENDAR *calendar, chtype highlight) +{ + calendar->highlight = highlight; +} +chtype getCDKCalendarHighlight (CDKCALENDAR *calendar) +{ + return calendar->highlight; +} + +/* + * This sets the box attibute of the widget. + */ +void setCDKCalendarBox (CDKCALENDAR *calendar, boolean Box) +{ + ObjOf (calendar)->box = Box; + ObjOf (calendar)->borderSize = Box ? 1 : 0; +} +boolean getCDKCalendarBox (CDKCALENDAR *calendar) +{ + return ObjOf (calendar)->box; +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrCalendar (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKCALENDAR *widget = (CDKCALENDAR *)object; + + wbkgd (widget->win, attrib); + wbkgd (widget->fieldWin, attrib); + if (widget->labelWin != 0) + { + wbkgd (widget->labelWin, attrib); + } + } +} + +/* + * This erases the calendar widget. + */ +static void _eraseCDKCalendar (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + + eraseCursesWindow (calendar->labelWin); + eraseCursesWindow (calendar->fieldWin); + eraseCursesWindow (calendar->win); + eraseCursesWindow (calendar->shadowWin); + } +} + +/* + * This destroys the calendar object pointer. + */ +static void _destroyCDKCalendar (CDKOBJS *object) +{ + if (object != 0) + { + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + int x; + + cleanCdkTitle (object); + + freeChar (calendar->DayName); + + for (x = 0; x < MAX_MONTHS; x++) + { + freeChar (calendar->MonthName[x]); + } + + freeChecked (calendar->marker); + + /* Free up the window pointers. */ + deleteCursesWindow (calendar->labelWin); + deleteCursesWindow (calendar->fieldWin); + deleteCursesWindow (calendar->shadowWin); + deleteCursesWindow (calendar->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vCALENDAR, calendar); + + /* Unregister the object. */ + unregisterCDKObject (vCALENDAR, calendar); + } +} + +/* + * This sets a marker on the calendar. + */ +void setCDKCalendarMarker (CDKCALENDAR *calendar, + int day, + int month, + int year, + chtype marker) +{ + int yearIndex = YEAR2INDEX (year); + chtype oldmarker = getCDKCalendarMarker (calendar, day, month, year); + + /* Check to see if a marker has not already been set. */ + if (oldmarker != 0) + { + CALENDAR_CELL (calendar, day, month, yearIndex) = oldmarker | A_BLINK; + } + else + { + CALENDAR_CELL (calendar, day, month, yearIndex) = marker; + } +} +chtype getCDKCalendarMarker (CDKCALENDAR *calendar, int day, int month, int year) +{ + chtype result = 0; + + year = YEAR2INDEX (year); + if (calendar->marker != 0) + result = CALENDAR_CELL (calendar, day, month, year); + return result; +} + +/* + * This sets a marker on the calendar. + */ +void removeCDKCalendarMarker (CDKCALENDAR *calendar, int day, int month, int year) +{ + int yearIndex = YEAR2INDEX (year); + CALENDAR_CELL (calendar, day, month, yearIndex) = 0; +} + +/* + * This function sets the month name. + */ +void setCDKCalendarMonthsNames (CDKCALENDAR *calendar, CDK_CSTRING2 months) +{ + int x; + + for (x = 1; x < MAX_MONTHS; x++) + { + freeChar (calendar->MonthName[x]); + calendar->MonthName[x] = copyChar (months[x]); + } +} + +/* + * This function sets the day's name. + */ +void setCDKCalendarDaysNames (CDKCALENDAR *calendar, const char *days) +{ + freeChar (calendar->DayName); + calendar->DayName = copyChar (days); +} + +/* + * This makes sure that the dates provided exist. + */ +static void verifyCalendarDate (CDKCALENDAR *calendar) +{ + int monthLength; + + /* Make sure the given year is not less than 1900. */ + if (calendar->year < 1900) + { + calendar->year = 1900; + } + + /* Make sure the month is within range. */ + if (calendar->month > 12) + { + calendar->month = 12; + } + if (calendar->month < 1) + { + calendar->month = 1; + } + + /* Make sure the day given is within range of the month. */ + monthLength = getMonthLength (calendar->year, calendar->month); + if (calendar->day < 1) + { + calendar->day = 1; + } + if (calendar->day > monthLength) + { + calendar->day = monthLength; + } +} + +/* + * This returns what day of the week the month starts on. + */ +static int getMonthStartWeekday (int year, int month) +{ + struct tm Date; + + /* *INDENT-EQLS* Set the tm structure correctly. */ + Date.tm_sec = 0; + Date.tm_min = 0; + Date.tm_hour = 10; + Date.tm_mday = 1; + Date.tm_mon = month - 1; + Date.tm_year = YEAR2INDEX (year); + Date.tm_isdst = 1; + + /* Call the mktime function to fill in the holes. */ + if (mktime (&Date) == (time_t) - 1) + { + return 0; + } + return Date.tm_wday; +} + +/* + * This function returns a 1 if it's a leap year and 0 if it's not. + */ +static int isLeapYear (int year) +{ + int result = 0; + + if ((year % 4) == 0) + { + if ((year % 100) == 0) + { + if ((year % 400) == 0) + { + result = 1; + } + } + else + { + result = 1; + } + } + return result; +} + +/* + * This increments the current day by the given value. + */ +static void incrementCalendarDay (CDKCALENDAR *calendar, int adjust) +{ + int monthLength = getMonthLength (calendar->year, calendar->month); + + /* Make sure we adjust the day correctly. */ + if (adjust + calendar->day > monthLength) + { + /* Have to increment the month by one. */ + calendar->day = calendar->day + adjust - monthLength; + incrementCalendarMonth (calendar, 1); + } + else + { + calendar->day += adjust; + drawCDKCalendarField (calendar); + } +} + +/* + * This decrments the current day by the given value. + */ +static void decrementCalendarDay (CDKCALENDAR *calendar, int adjust) +{ + /* Make sure we adjust the day correctly. */ + if (calendar->day - adjust < 1) + { + int monthLength; + + /* Set the day according to the length of the month. */ + if (calendar->month == 1) + { + /* Make sure we aren't going past the year limit. */ + if (calendar->year == 1900) + { + const char *mesg[] = + { + "Error", + "Can not go past the year 1900" + }; + Beep (); + popupLabel (ScreenOf (calendar), (CDK_CSTRING2)mesg, 2); + return; + } + monthLength = getMonthLength (calendar->year - 1, 12); + } + else + { + monthLength = getMonthLength (calendar->year, calendar->month - 1); + } + + calendar->day = monthLength - (adjust - calendar->day); + + /* Have to decrement the month by one. */ + decrementCalendarMonth (calendar, 1); + } + else + { + calendar->day -= adjust; + drawCDKCalendarField (calendar); + } +} + +/* + * This increments the current month by the given value. + */ +static void incrementCalendarMonth (CDKCALENDAR *calendar, int adjust) +{ + int monthLength; + + /* Are we at the end of the year. */ + if (calendar->month + adjust > 12) + { + calendar->month = (calendar->month + adjust) - 12; + calendar->year++; + } + else + { + calendar->month += adjust; + } + + /* Get the length of the current month. */ + monthLength = getMonthLength (calendar->year, calendar->month); + if (calendar->day > monthLength) + { + calendar->day = monthLength; + } + + /* Get the start of the current month. */ + calendar->weekDay = getMonthStartWeekday (calendar->year, calendar->month); + + /* Redraw the calendar. */ + eraseCDKCalendar (calendar); + drawCDKCalendar (calendar, ObjOf (calendar)->box); +} + +/* + * This decrements the current month by the given value. + */ +static void decrementCalendarMonth (CDKCALENDAR *calendar, int adjust) +{ + int monthLength; + + /* Are we at the end of the year. */ + if (calendar->month <= adjust) + { + if (calendar->year == 1900) + { + const char *mesg[] = + { + "Error", + "Can not go past the year 1900" + }; + Beep (); + popupLabel (ScreenOf (calendar), (CDK_CSTRING2)mesg, 2); + return; + } + else + { + calendar->month = 13 - adjust; + calendar->year--; + } + } + else + { + calendar->month -= adjust; + } + + /* Get the length of the current month. */ + monthLength = getMonthLength (calendar->year, calendar->month); + if (calendar->day > monthLength) + { + calendar->day = monthLength; + } + + /* Get the start of the current month. */ + calendar->weekDay = getMonthStartWeekday (calendar->year, calendar->month); + + /* Redraw the calendar. */ + eraseCDKCalendar (calendar); + drawCDKCalendar (calendar, ObjOf (calendar)->box); +} + +/* + * This increments the current year by the given value. + */ +static void incrementCalendarYear (CDKCALENDAR *calendar, int adjust) +{ + /* Increment the year. */ + calendar->year += adjust; + + /* If we are in Feb make sure we don't trip into voidness. */ + if (calendar->month == 2) + { + int monthLength = getMonthLength (calendar->year, calendar->month); + if (calendar->day > monthLength) + { + calendar->day = monthLength; + } + } + + /* Get the start of the current month. */ + calendar->weekDay = getMonthStartWeekday (calendar->year, calendar->month); + + /* Redraw the calendar. */ + eraseCDKCalendar (calendar); + drawCDKCalendar (calendar, ObjOf (calendar)->box); +} + +/* + * This decrements the current year by the given value. + */ +static void decrementCalendarYear (CDKCALENDAR *calendar, int adjust) +{ + /* Make sure we don't go out of bounds. */ + if (calendar->year - adjust < 1900) + { + const char *mesg[] = + { + "Error", + "Can not go past the year 1900" + }; + Beep (); + popupLabel (ScreenOf (calendar), (CDK_CSTRING2)mesg, 2); + return; + } + + /* Decrement the year. */ + calendar->year -= adjust; + + /* If we are in Feb make sure we don't trip into voidness. */ + if (calendar->month == 2) + { + int monthLength = getMonthLength (calendar->year, calendar->month); + if (calendar->day > monthLength) + { + calendar->day = monthLength; + } + } + + /* Get the start of the current month. */ + calendar->weekDay = getMonthStartWeekday (calendar->year, calendar->month); + + /* Redraw the calendar. */ + eraseCDKCalendar (calendar); + drawCDKCalendar (calendar, ObjOf (calendar)->box); +} + +/* + * This returns the length of the current month. + */ +static int getMonthLength (int year, int month) +{ + int monthLength = daysOfTheMonth[month]; + + if (month == 2) + { + monthLength += isLeapYear (year); + } + return monthLength; +} + +/* + * This returns what day of the week the month starts on. + */ +static time_t getCurrentTime (CDKCALENDAR *calendar) +{ + struct tm Date, *dateInfo; + time_t clck; + + /* Determine the current time and determine if we are in DST. */ + time (&clck); + dateInfo = gmtime (&clck); + + /* *INDENT-EQLS* Set the tm structure correctly. */ + Date.tm_sec = 0; + Date.tm_min = 0; + Date.tm_hour = 0; + Date.tm_mday = calendar->day; + Date.tm_mon = calendar->month - 1; + Date.tm_year = YEAR2INDEX (calendar->year); + Date.tm_isdst = dateInfo->tm_isdst; + + /* Call the mktime function to fill in the holes. */ + return mktime (&Date); +} + +static void _focusCDKCalendar (CDKOBJS *object) +{ + CDKCALENDAR *widget = (CDKCALENDAR *)object; + + drawCDKFScale (widget, ObjOf (widget)->box); +} + +static void _unfocusCDKCalendar (CDKOBJS *object) +{ + CDKCALENDAR *widget = (CDKCALENDAR *)object; + + drawCDKFScale (widget, ObjOf (widget)->box); +} + +dummyRefreshData (Calendar) + +dummySaveData (Calendar) diff --git a/deps/cdk-5.0-20161210/cdk-config.in b/deps/cdk-5.0-20161210/cdk-config.in new file mode 100644 index 0000000..44b23ad --- /dev/null +++ b/deps/cdk-5.0-20161210/cdk-config.in @@ -0,0 +1,136 @@ +#!@SHELL@ +# $Id: cdk-config.in,v 1.5 2015/01/04 01:45:59 tom Exp $ +############################################################################## +# Copyright (c) 2007-2013,2015 Thomas E. Dickey # +# # +# 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. # +############################################################################## + +prefix="@prefix@" +exec_prefix="@exec_prefix@" + +bindir="@bindir@" +libdir="@libdir@" +datarootdir="@datarootdir@" +datadir="@datadir@" +mandir="@mandir@" +includedir="@includedir@" + +THIS="@CFG_ROOTNAME@" +XHDR="@HDR_ROOTNAME@" +XLIB="@LIB_ROOTNAME@" + +test $# = 0 && exec @SHELL@ $0 --error + +while test $# -gt 0; do + case "$1" in + -*=*) + ARG=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` + ;; + *) + ARG= + ;; + esac + + case "$1" in + # basic configuration + --prefix=*) + prefix="$ARG" + test -z "$exec_prefix" && exec_prefix="$ARG" + ;; + --prefix) + echo "$prefix" + ;; + --exec-prefix=*) + exec_prefix="$ARG" + ;; + --exec-prefix) + echo "$exec_prefix" + ;; + # compile/link + --cflags) + INCS="-I$includedir/$XHDR" + sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO + $INCS +ENDECHO + ;; + --libs) + sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO + -L${libdir} -l${XLIB} @LIBS@ +ENDECHO + ;; + # identification + --version) + echo "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@" + ;; + --abi-version) + echo "@VERSION@" | sed -e 's/:/./g' + ;; + # locations + --bindir) + echo "${bindir}" + ;; + --datadir) + echo "${datadir}" + ;; + --libdir) + echo "${libdir}" + ;; + --mandir) + echo "${mandir}" + ;; + # general info + --help) + cat <&2 + exit 1 + ;; + esac + shift +done +# vile:shmode diff --git a/deps/cdk-5.0-20161210/cdk.c b/deps/cdk-5.0-20161210/cdk.c new file mode 100644 index 0000000..b866d2c --- /dev/null +++ b/deps/cdk-5.0-20161210/cdk.c @@ -0,0 +1,1504 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/12/04 19:33:34 $ + * $Revision: 1.219 $ + */ + +#define L_MARKER '<' +#define R_MARKER '>' + +char *GPasteBuffer = 0; + +/* + * This beeps then flushes the stdout stream. + */ +void Beep (void) +{ + beep (); + fflush (stdout); +} + +/* + * This sets a string to the given character. + */ +void cleanChar (char *s, int len, char character) +{ + if (s != 0) + { + int x; + for (x = 0; x < len; x++) + { + s[x] = character; + } + s[--x] = '\0'; + } +} + +void cleanChtype (chtype *s, int len, chtype character) +{ + if (s != 0) + { + int x; + for (x = 0; x < len; x++) + { + s[x] = character; + } + s[--x] = '\0'; + } +} + +/* + * This takes an x and y position and realigns the values iff they sent in + * values like CENTER, LEFT, RIGHT, ... + */ +void alignxy (WINDOW *window, int *xpos, int *ypos, int boxWidth, int boxHeight) +{ + int first, gap, last; + + first = getbegx (window); + last = getmaxx (window); + if ((gap = (last - boxWidth)) < 0) + gap = 0; + last = first + gap; + + switch (*xpos) + { + case LEFT: + (*xpos) = first; + break; + case RIGHT: + (*xpos) = first + gap; + break; + case CENTER: + (*xpos) = first + (gap / 2); + break; + default: + if ((*xpos) > last) + (*xpos) = last; + else if ((*xpos) < first) + (*xpos) = first; + break; + } + + first = getbegy (window); + last = getmaxy (window); + if ((gap = (last - boxHeight)) < 0) + gap = 0; + last = first + gap; + + switch (*ypos) + { + case TOP: + (*ypos) = first; + break; + case BOTTOM: + (*ypos) = first + gap; + break; + case CENTER: + (*ypos) = first + (gap / 2); + break; + default: + if ((*ypos) > last) + { + (*ypos) = last; + } + else if ((*ypos) < first) + { + (*ypos) = first; + } + break; + } +} + +/* + * This takes a string, a field width and a justification type + * and returns the adjustment to make, to fill + * the justification requirement. + */ +int justifyString (int boxWidth, int mesgLength, int justify) +{ + /* + * Make sure the message isn't longer than the width. + * If it is, return 0. + */ + if (mesgLength >= boxWidth) + return (0); + + /* Try to justify the message. */ + if (justify == LEFT) + return (0); + + if (justify == RIGHT) + return boxWidth - mesgLength; + + if (justify == CENTER) + return ((int)((boxWidth - mesgLength) / 2)); + + return (justify); +} + +/* + * This frees a string if it is not null. This is a safety + * measure. Some compilers let you free a null string. I + * don't like that idea. + */ +void freeChar (char *string) +{ + freeChecked (string); +} + +void freeChtype (chtype *string) +{ + freeChecked (string); +} + +/* + * Corresponding list freeing (does not free the list pointer). + */ +void freeCharList (char **list, unsigned size) +{ + if (list != 0) + { + while (size-- != 0) + { + freeChar (list[size]); + list[size] = 0; + } + } +} + +void freeChtypeList (chtype **list, unsigned size) +{ + if (list != 0) + { + while (size-- != 0) + { + freeChtype (list[size]); + list[size] = 0; + } + } +} + +/* + * This performs a safe copy of a string. This means it adds the null + * terminator on the end of the string, like strdup(). + */ +char *copyChar (const char *original) +{ + char *newstring = 0; + + if (original != 0) + { + if ((newstring = typeMallocN (char, strlen (original) + 1)) != 0) + strcpy (newstring, original); + } + return (newstring); +} + +chtype *copyChtype (const chtype *original) +{ + chtype *newstring = 0; + + if (original != 0) + { + int len = chlen (original); + + if ((newstring = typeMallocN (chtype, len + 4)) != 0) + { + int x; + + for (x = 0; x < len; x++) + { + newstring[x] = original[x]; + } + newstring[len] = '\0'; + newstring[len + 1] = '\0'; + } + } + return (newstring); +} + +/* + * Copy the given lists. + */ +char **copyCharList (const char **list) +{ + size_t size = (size_t) lenCharList (list) + 1; + char **result = typeMallocN (char *, size); + + if (result != 0) + { + unsigned n; + for (n = 0; n < size; ++n) + result[n] = copyChar (list[n]); + } + return result; +} + +chtype **copyChtypeList (const chtype **list) +{ + size_t size = (size_t) lenChtypeList (list) + 1; + chtype **result = typeMallocN (chtype *, size); + + if (result != 0) + { + unsigned n; + for (n = 0; n < size; ++n) + result[n] = copyChtype (list[n]); + } + return result; +} + +/* + * Return the length of the given lists. + */ +int lenCharList (const char **list) +{ + int result = 0; + if (list != 0) + { + while (*list++ != 0) + ++result; + } + return result; +} + +int lenChtypeList (const chtype **list) +{ + int result = 0; + if (list != 0) + { + while (*list++ != 0) + ++result; + } + return result; +} + +/* + * This reads a file and sticks it into the char *** provided. + */ +int CDKreadFile (const char *filename, char ***array) +{ + FILE *fd; + char temp[BUFSIZ]; + unsigned lines = 0; + unsigned used = 0; + + /* Can we open the file? */ + if ((fd = fopen (filename, "r")) == 0) + { + return (-1); + } + + while ((fgets (temp, sizeof (temp), fd) != 0)) + { + size_t len = strlen (temp); + if (len != 0 && temp[len - 1] == '\n') + temp[--len] = '\0'; + used = CDKallocStrings (array, temp, lines++, used); + } + fclose (fd); + + return (int)(lines); +} + +#define DigitOf(c) ((c)-'0') + +static int encodeAttribute (const char *string, int from, chtype *mask) +{ + int pair = 0; + + *mask = 0; + switch (string[from + 1]) + { + case 'B': + *mask = A_BOLD; + break; + case 'D': + *mask = A_DIM; + break; + case 'K': + *mask = A_BLINK; + break; + case 'R': + *mask = A_REVERSE; + break; + case 'S': + *mask = A_STANDOUT; + break; + case 'U': + *mask = A_UNDERLINE; + break; + } + + if (*mask != 0) + { + from++; + } + else + { + int digits; + + pair = 0; + for (digits = 1; digits <= 3; ++digits) + { + if (!isdigit (CharOf (string[1 + from]))) + break; + pair *= 10; + pair += DigitOf (string[++from]); + } +#ifdef HAVE_START_COLOR +#define MAX_PAIR (int) (A_COLOR / (((~A_COLOR) << 1) & A_COLOR)) + if (pair > MAX_PAIR) + pair = MAX_PAIR; + *mask = (chtype)COLOR_PAIR (pair); +#else + *mask = A_BOLD; +#endif + } + return from; +} + +/* + * The reverse of encodeAttribute() + * Well almost. If attributes such as bold and underline are combined in + * the same string, we do not necessarily reconstruct them in the same order. + * Also, alignment markers and tabs are lost. + */ +static unsigned decodeAttribute (char *string, + unsigned from, + chtype oldattr, + chtype newattr) +{ + /* *INDENT-OFF* */ + static const struct { + int code; + chtype mask; + } table[] = { + { 'B', A_BOLD }, + { 'D', A_DIM }, + { 'K', A_BLINK }, + { 'R', A_REVERSE }, + { 'S', A_STANDOUT }, + { 'U', A_UNDERLINE }, + }; + /* *INDENT-ON* */ + + char temp[80]; + char *result = (string != 0) ? string : temp; + char *base = result; + chtype tmpattr = oldattr & A_ATTRIBUTES; + + newattr &= A_ATTRIBUTES; + if (tmpattr != newattr) + { + while (tmpattr != newattr) + { + unsigned n; + bool found = FALSE; + + for (n = 0; n < sizeof (table) / sizeof (table[0]); ++n) + { + if ((table[n].mask & tmpattr) != (table[n].mask & newattr)) + { + found = TRUE; + *result++ = L_MARKER; + if (table[n].mask & tmpattr) + { + *result++ = '!'; + tmpattr &= ~(table[n].mask); + } + else + { + *result++ = '/'; + tmpattr |= (table[n].mask); + } + *result++ = (char)table[n].code; + break; + } + } +#ifdef HAVE_START_COLOR + if ((tmpattr & A_COLOR) != (newattr & A_COLOR)) + { + int oldpair = PAIR_NUMBER (tmpattr); + int newpair = PAIR_NUMBER (newattr); + if (!found) + { + found = TRUE; + *result++ = L_MARKER; + } + if (newpair == 0) + { + *result++ = '!'; + sprintf (result, "%d", oldpair); + } + else + { + *result++ = '/'; + sprintf (result, "%d", newpair); + } + result += strlen (result); + tmpattr &= ~A_COLOR; + newattr &= ~A_COLOR; + } +#endif + if (found) + *result++ = R_MARKER; + else + break; + } + } + + return (from + (unsigned)(result - base)); +} + +/* + * This function takes a character string, full of format markers + * and translates them into a chtype * array. This is better suited + * to curses, because curses uses chtype almost exclusively + */ +chtype *char2Chtype (const char *string, int *to, int *align) +{ + chtype *result = 0; + chtype attrib; + chtype lastChar; + chtype mask; + + (*to) = 0; + *align = LEFT; + + if (string != 0 && *string != 0) + { + int len = (int)strlen (string); + int pass; + int used = 0; + /* + * We make two passes because we may have indents and tabs to expand, and + * do not know in advance how large the result will be. + */ + for (pass = 0; pass < 2; pass++) + { + int insideMarker; + int from; + int adjust; + int start; + int x = 3; + + if (pass != 0) + { + if ((result = typeMallocN (chtype, used + 2)) == 0) + { + used = 0; + break; + } + } + adjust = 0; + attrib = A_NORMAL; + start = 0; + used = 0; + + /* Look for an alignment marker. */ + if (*string == L_MARKER) + { + if (string[1] == 'C' && string[2] == R_MARKER) + { + (*align) = CENTER; + start = 3; + } + else if (string[1] == 'R' && string[2] == R_MARKER) + { + (*align) = RIGHT; + start = 3; + } + else if (string[1] == 'L' && string[2] == R_MARKER) + { + start = 3; + } + else if (string[1] == 'B' && string[2] == '=') + { + /* Set the item index value in the string. */ + if (result != 0) + { + result[0] = ' '; + result[1] = ' '; + result[2] = ' '; + } + + /* Pull out the bullet marker. */ + while (string[x] != R_MARKER && string[x] != 0) + { + if (result != 0) + result[x] = (chtype)string[x] | A_BOLD; + x++; + } + adjust = 1; + + /* Set the alignment variables. */ + start = x; + used = x; + } + else if (string[1] == 'I' && string[2] == '=') + { + from = 2; + x = 0; + + while (string[++from] != R_MARKER && string[from] != 0) + { + if (isdigit (CharOf (string[from]))) + { + adjust = (adjust * 10) + DigitOf (string[from]); + x++; + } + } + + start = x + 4; + } + } + + while (adjust-- > 0) + { + if (result != 0) + result[used] = ' '; + used++; + } + + /* Set the format marker boolean to false. */ + insideMarker = FALSE; + + /* Start parsing the character string. */ + for (from = start; from < len; from++) + { + /* Are we inside a format marker? */ + if (!insideMarker) + { + if (string[from] == L_MARKER + && (string[from + 1] == '/' + || string[from + 1] == '!' + || string[from + 1] == '#')) + { + insideMarker = TRUE; + } + else if (string[from] == '\\' && string[from + 1] == L_MARKER) + { + from++; + if (result != 0) + result[used] = CharOf (string[from]) | attrib; + used++; + from++; + } + else if (string[from] == '\t') + { + do + { + if (result != 0) + result[used] = ' '; + used++; + } + while (used & 7); + } + else + { + if (result != 0) + result[used] = CharOf (string[from]) | attrib; + used++; + } + } + else + { + switch (string[from]) + { + case R_MARKER: + insideMarker = 0; + break; + case '#': + { + lastChar = 0; + switch (string[from + 2]) + { + case 'L': + switch (string[from + 1]) + { + case 'L': + lastChar = ACS_LLCORNER; + break; + case 'U': + lastChar = ACS_ULCORNER; + break; + case 'H': + lastChar = ACS_HLINE; + break; + case 'V': + lastChar = ACS_VLINE; + break; + case 'P': + lastChar = ACS_PLUS; + break; + } + break; + case 'R': + switch (string[from + 1]) + { + case 'L': + lastChar = ACS_LRCORNER; + break; + case 'U': + lastChar = ACS_URCORNER; + break; + } + break; + case 'T': + switch (string[from + 1]) + { + case 'T': + lastChar = ACS_TTEE; + break; + case 'R': + lastChar = ACS_RTEE; + break; + case 'L': + lastChar = ACS_LTEE; + break; + case 'B': + lastChar = ACS_BTEE; + break; + } + break; + case 'A': + switch (string[from + 1]) + { + case 'L': + lastChar = ACS_LARROW; + break; + case 'R': + lastChar = ACS_RARROW; + break; + case 'U': + lastChar = ACS_UARROW; + break; + case 'D': + lastChar = ACS_DARROW; + break; + } + break; + default: + if (string[from + 1] == 'D' && + string[from + 2] == 'I') + lastChar = ACS_DIAMOND; + else if (string[from + 1] == 'C' && + string[from + 2] == 'B') + lastChar = ACS_CKBOARD; + else if (string[from + 1] == 'D' && + string[from + 2] == 'G') + lastChar = ACS_DEGREE; + else if (string[from + 1] == 'P' && + string[from + 2] == 'M') + lastChar = ACS_PLMINUS; + else if (string[from + 1] == 'B' && + string[from + 2] == 'U') + lastChar = ACS_BULLET; + else if (string[from + 1] == 'S' && + string[from + 2] == '1') + lastChar = ACS_S1; + else if (string[from + 1] == 'S' && + string[from + 2] == '9') + lastChar = ACS_S9; + } + + if (lastChar != 0) + { + adjust = 1; + from += 2; + + if (string[from + 1] == '(') + /* Check for a possible numeric modifier. */ + { + from++; + adjust = 0; + + while (string[++from] != ')' && string[from] != 0) + { + if (isdigit (CharOf (string[from]))) + { + adjust = (adjust * 10) + DigitOf (string[from]); + } + } + } + } + for (x = 0; x < adjust; x++) + { + if (result != 0) + result[used] = lastChar | attrib; + used++; + } + break; + } + case '/': + from = encodeAttribute (string, from, &mask); + attrib = attrib | mask; + break; + case '!': + from = encodeAttribute (string, from, &mask); + attrib = attrib & ~mask; + break; + } + } + } + + if (result != 0) + { + result[used] = 0; + result[used + 1] = 0; + } + + /* + * If there are no characters, put the attribute into the + * the first character of the array. + */ + if (used == 0 + && result != 0) + { + result[0] = attrib; + } + } + *to = used; + } + else + { + /* + * Try always to return something; otherwise lists of chtype strings + * would get a spurious null pointer whenever there is a blank line, + * and CDKfreeChtypes() would fail to free the whole list. + */ + result = typeCallocN (chtype, 1); + } + return result; +} + +/* + * This determines the length of a chtype string + */ +int chlen (const chtype *string) +{ + int result = 0; + + if (string != 0) + { + while (string[result] != 0) + result++; + } + + return (result); +} + +/* + * Compare a regular string to a chtype string + */ +int cmpStrChstr (const char *str, const chtype *chstr) +{ + int r = 0; + + if (!str && !chstr) + return 0; + if (!str) + return 1; + if (!chstr) + return -1; + + while (!r && *str && *chstr) + { + r = *str - CharOf (*chstr); + ++str; + ++chstr; + } + + if (r) + return r; + else if (!*str) + return -1; + else if (!*chstr) + return 1; + return 0; +} + +void chstrncpy (char *dest, const chtype *src, int maxcount) +{ + int i = 0; + + while (i < maxcount && *src) + *dest++ = (char)(*src++); + + *dest = '\0'; +} + +/* + * This returns a pointer to char * of a chtype * + * Formatting codes are omitted. + */ +char *chtype2Char (const chtype *string) +{ + char *newstring = 0; + + if (string != 0) + { + int len = chlen (string); + + if ((newstring = typeMallocN (char, len + 1)) != 0) + { + int x; + + for (x = 0; x < len; x++) + { + newstring[x] = (char)CharOf (string[x]); + } + newstring[len] = '\0'; + } + } + return (newstring); +} + +/* + * This returns a pointer to char * of a chtype * + * Formatting codes are embedded. + */ +char *chtype2String (const chtype *string) +{ + char *newstring = 0; + + if (string != 0) + { + int pass; + int len = chlen (string); + + for (pass = 0; pass < 2; ++pass) + { + int x; + unsigned need = 0; + + for (x = 0; x < len; ++x) + { + need = decodeAttribute (newstring, need, + (x > 0) ? string[x - 1] : 0, + string[x]); + if (newstring != 0) + newstring[need] = (char)(string[x]); + ++need; + } + if (pass) + newstring[need] = 0; + ++need; + if (!pass) + { + if ((newstring = typeMallocN (char, need)) == 0) + break; + } + } + } + return (newstring); +} + +static int comparSort (const void *a, const void *b) +{ + return strcmp (*(const char *const *)a, (*(const char *const *)b)); +} + +void sortList (CDK_CSTRING *list, int length) +{ + if (length > 1) + qsort (list, (unsigned)length, sizeof (list[0]), comparSort); +} + +/* + * This strips white space from the given string. + */ +void stripWhiteSpace (EStripType stripType, char *string) +{ + /* Declare local variables. */ + size_t stringLength = 0; + + /* Make sure the string is not null. */ + if (string != 0 + && (stringLength = strlen (string)) != 0) + { + /* Strip leading whitespace */ + if (stripType == vFRONT || stripType == vBOTH) + { + unsigned alphaChar = 0; + unsigned x; + + /* Find the first non-whitespace character. */ + while (string[alphaChar] == ' ' || string[alphaChar] == '\t') + { + alphaChar++; + } + + for (x = alphaChar; x <= stringLength; ++x) + string[x - alphaChar] = string[x]; + } + + /* Strip trailing whitespace */ + if (stripType == vBACK || stripType == vBOTH) + { + stringLength = strlen (string); + while (stringLength-- != 0 && + (string[stringLength] == ' ' || + string[stringLength] == '\t')) + { + string[stringLength] = '\0'; + } + } + } +} + +static unsigned countChar (const char *string, int separator) +{ + unsigned result = 0; + int ch; + + while ((ch = *string++) != 0) + { + if (ch == separator) + result++; + } + return result; +} + +/* + * Split a string into a list of strings. + */ +char **CDKsplitString (const char *string, int separator) +{ + char **result = 0; + char *temp; + + if (string != 0 && *string != 0) + { + unsigned need = countChar (string, separator) + 2; + if ((result = typeMallocN (char *, need)) != 0) + { + unsigned item = 0; + const char *first = string; + for (;;) + { + while (*string != 0 && *string != separator) + string++; + + need = (unsigned)(string - first); + if ((temp = typeMallocN (char, need + 1)) == 0) + break; + + memcpy (temp, first, need); + temp[need] = 0; + result[item++] = temp; + + if (*string++ == 0) + break; + first = string; + } + result[item] = 0; + } + } + return result; +} + +/* + * Add a new string to a list. Keep a null pointer on the end so we can use + * CDKfreeStrings() to deallocate the whole list. + */ +unsigned CDKallocStrings (char ***list, char *item, unsigned length, unsigned used) +{ + unsigned need = 1; + + while (need < length + 2) + need *= 2; + if (need > used) + { + used = need; + if (*list == 0) + { + *list = typeMallocN (char *, used); + } + else + { + *list = typeReallocN (char *, *list, used); + } + } + (*list)[length++] = copyChar (item); + (*list)[length] = 0; + return used; +} + +/* + * Count the number of items in a list of strings. + */ +unsigned CDKcountStrings (CDK_CSTRING2 list) +{ + unsigned result = 0; + if (list != 0) + { + while (*list++ != 0) + result++; + } + return result; +} + +/* + * Free a list of strings, terminated by a null pointer. + */ +void CDKfreeStrings (char **list) +{ + if (list != 0) + { + void *base = (void *)list; + while (*list != 0) + free (*list++); + free (base); + } +} + +/* + * Free a list of chtype-strings, terminated by a null pointer. + */ +void CDKfreeChtypes (chtype **list) +{ + if (list != 0) + { + void *base = (void *)list; + while (*list != 0) + { + freeChtype (*list++); + } + free (base); + } +} + +int mode2Filetype (mode_t mode) +{ + /* *INDENT-OFF* */ + static const struct { + mode_t mode; + char code; + } table[] = { +#ifdef S_IFBLK + { S_IFBLK, 'b' }, /* Block device */ +#endif + { S_IFCHR, 'c' }, /* Character device */ + { S_IFDIR, 'd' }, /* Directory */ + { S_IFREG, '-' }, /* Regular file */ +#ifdef S_IFLNK + { S_IFLNK, 'l' }, /* Socket */ +#endif +#ifdef S_IFSOCK + { S_IFSOCK, '@' }, /* Socket */ +#endif + { S_IFIFO, '&' }, /* Pipe */ + }; + /* *INDENT-ON* */ + + int filetype = '?'; + unsigned n; + + for (n = 0; n < sizeof (table) / sizeof (table[0]); n++) + { + if ((mode & S_IFMT) == table[n].mode) + { + filetype = table[n].code; + break; + } + } + + return filetype; + +} + +/* + * This function takes a mode_t type and creates a string represntation + * of the permission mode. + */ +int mode2Char (char *string, mode_t mode) +{ + /* *INDENT-OFF* */ + static struct { + mode_t mask; + unsigned col; + char flag; + } table[] = { + { S_IRUSR, 1, 'r' }, + { S_IWUSR, 2, 'w' }, + { S_IXUSR, 3, 'x' }, +#if defined (S_IRGRP) && defined (S_IWGRP) && defined (S_IXGRP) + { S_IRGRP, 4, 'r' }, + { S_IWGRP, 5, 'w' }, + { S_IXGRP, 6, 'x' }, +#endif +#if defined (S_IROTH) && defined (S_IWOTH) && defined (S_IXOTH) + { S_IROTH, 7, 'r' }, + { S_IWOTH, 8, 'w' }, + { S_IXOTH, 9, 'x' }, +#endif +#ifdef S_ISUID + { S_ISUID, 3, 's' }, +#endif +#ifdef S_ISGID + { S_ISGID, 6, 's' }, +#endif +#ifdef S_ISVTX + { S_ISVTX, 9, 't' }, +#endif + }; + /* *INDENT-ON* */ + + /* Declare local variables. */ + int permissions = 0; + int filetype = mode2Filetype (mode); + unsigned n; + + /* Clean the string. */ + cleanChar (string, 11, '-'); + string[11] = '\0'; + + if (filetype == '?') + return -1; + + for (n = 0; n < sizeof (table) / sizeof (table[0]); n++) + { + if ((mode & table[n].mask) != 0) + { + string[table[n].col] = table[n].flag; + permissions |= (int)table[n].mask; + } + } + + /* Check for unusual permissions. */ +#ifdef S_ISUID + if (((mode & S_IXUSR) == 0) && + ((mode & S_IXGRP) == 0) && + ((mode & S_IXOTH) == 0) && + (mode & S_ISUID) != 0) + { + string[3] = 'S'; + } +#endif + + return permissions; +} + +/* + * This returns the length of the integer. + */ +int intlen (int value) +{ + if (value < 0) + return 1 + intlen (-value); + else if (value >= 10) + return 1 + intlen (value / 10); + return 1; +} + +/* + * This opens the current directory and reads the contents. + */ +int CDKgetDirectoryContents (const char *directory, char ***list) +{ + /* Declare local variables. */ + struct dirent *dirStruct; + int counter = 0; + DIR *dp; + unsigned used = 0; + + /* Open the directory. */ + dp = opendir (directory); + + /* Could we open the directory? */ + if (dp == 0) + { + return -1; + } + + /* Read the directory. */ + while ((dirStruct = readdir (dp)) != 0) + { + if (strcmp (dirStruct->d_name, ".")) + used = CDKallocStrings (list, dirStruct->d_name, + (unsigned)counter++, used); + } + + /* Close the directory. */ + closedir (dp); + + /* Sort the info. */ + sortList ((CDK_CSTRING *)*list, counter); + + /* Return the number of files in the directory. */ + return counter; +} + +/* + * This looks for a subset of a word in the given list. + */ +int searchList (CDK_CSTRING2 list, int listSize, const char *pattern) +{ + int Index = -1; + + /* Make sure the pattern isn't null. */ + if (pattern != 0) + { + size_t len = strlen (pattern); + int x; + + /* Cycle through the list looking for the word. */ + for (x = 0; x < listSize; x++) + { + /* Do a string compare. */ + int ret = strncmp (list[x], pattern, len); + + /* + * If 'ret' is less than 0, then the current word is alphabetically + * less than the provided word. At this point we will set the index + * to the current position. If 'ret' is greater than 0, then the + * current word is alphabetically greater than the given word. We + * should return with index, which might contain the last best match. + * If they are equal, then we've found it. + */ + if (ret < 0) + { + Index = ret; + } + else + { + if (ret == 0) + Index = x; + break; + } + } + } + return Index; +} + +/* + * This function checks to see if a link has been requested. + */ +int checkForLink (const char *line, char *filename) +{ + int len = 0; + int fPos = 0; + + /* Make sure the line isn't null. */ + if (line == 0) + { + return -1; + } + len = (int)strlen (line); + + /* Strip out the filename. */ + if (line[0] == L_MARKER && line[1] == 'F' && line[2] == '=') + { + int x = 3; + + /* Strip out the filename. */ + while (x < len) + { + if (line[x] == R_MARKER) + { + break; + } + if (fPos < CDK_PATHMAX) + filename[fPos++] = line[x]; + ++x; + } + } + filename[fPos] = '\0'; + return (fPos != 0); +} + +/* + * Returns the filename portion of the given pathname, i.e., after the last + * slash. + */ +char *baseName (char *pathname) +{ + char *base = 0; + + if (pathname != 0 + && *pathname != '\0' + && (base = copyChar (pathname)) != 0) + { + size_t pathLen; + + if ((pathLen = strlen (pathname)) != 0) + { + size_t x; + + for (x = pathLen - 1; x != 0; --x) + { + /* Find the last '/' in the pathname. */ + if (pathname[x] == '/') + { + strcpy (base, pathname + x + 1); + break; + } + } + } + } + return base; +} + +/* + * Returns the directory for the given pathname, i.e., the part before the + * last slash. + */ +char *dirName (char *pathname) +{ + char *dir = 0; + size_t pathLen; + + /* Check if the string is null. */ + if (pathname != 0 + && (dir = copyChar (pathname)) != 0 + && (pathLen = strlen (pathname)) != 0) + { + size_t x = pathLen; + while ((dir[x] != '/') && (x > 0)) + { + dir[x--] = '\0'; + } + } + + return dir; +} + +/* + * If the dimension is a negative value, the dimension will be the full + * height/width of the parent window - the value of the dimension. Otherwise, + * the dimension will be the given value. + */ +int setWidgetDimension (int parentDim, int proposedDim, int adjustment) +{ + int dimension = 0; + + /* If the user passed in FULL, return the parent's size. */ + if ((proposedDim == FULL) || (proposedDim == 0)) + { + dimension = parentDim; + } + else + { + /* If they gave a positive value, return it. */ + if (proposedDim >= 0) + { + if (proposedDim >= parentDim) + dimension = parentDim; + else + dimension = (proposedDim + adjustment); + } + else + { + /* + * If they gave a negative value, then return the + * dimension of the parent plus the value given. + */ + dimension = parentDim + proposedDim; + + /* Just to make sure. */ + if (dimension < 0) + dimension = parentDim; + } + } + return dimension; +} + +/* + * This safely erases a given window. + */ +void eraseCursesWindow (WINDOW *window) +{ + if (window != 0) + { + werase (window); + wrefresh (window); + } +} + +/* + * This safely deletes a given window. + */ +void deleteCursesWindow (WINDOW *window) +{ + if (window != 0) + { + eraseCursesWindow (window); + delwin (window); + } +} + +/* + * This moves a given window (if we're able to set the window's beginning). + * We do not use mvwin(), because it does (usually) not move subwindows. + */ +void moveCursesWindow (WINDOW *window, int xdiff, int ydiff) +{ + if (window != 0) + { + int xpos, ypos; + + getbegyx (window, ypos, xpos); + (void)setbegyx (window, (short)ypos, (short)xpos); + xpos += xdiff; + ypos += ydiff; + werase (window); + (void)setbegyx (window, (short)ypos, (short)xpos); + } +} + +/* + * Return an integer like 'floor()', which returns a double. + */ +int floorCDK (double value) +{ + int result = (int)value; + if (result > value) /* e.g., value < 0.0 and value is not an integer */ + result--; + return result; +} + +/* + * Return an integer like 'ceil()', which returns a double. + */ +int ceilCDK (double value) +{ + return -floorCDK (-value); +} + +/* + * Compatibility for different versions of curses. + */ +#if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY)) +int getbegx (WINDOW *win) +{ + int y, x; + getbegyx (win, y, x); + return x; +} +int getbegy (WINDOW *win) +{ + int y, x; + getbegyx (win, y, x); + return y; +} +#endif + +#if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY)) +int getmaxx (WINDOW *win) +{ + int y, x; + getmaxyx (win, y, x); + return x; +} +int getmaxy (WINDOW *win) +{ + int y, x; + getmaxyx (win, y, x); + return y; +} +#endif diff --git a/deps/cdk-5.0-20161210/cdk_compat.c b/deps/cdk-5.0-20161210/cdk_compat.c new file mode 100644 index 0000000..816f407 --- /dev/null +++ b/deps/cdk-5.0-20161210/cdk_compat.c @@ -0,0 +1,67 @@ +/* + * $Id: cdk_compat.c,v 1.5 2005/12/28 21:43:35 tom Exp $ + * These are functions that are obsolete, but provided as a porting aid. + * The obsolete functions use fixed limits, and inconsistent data handling. + */ +#include "cdk_compat.h" + +/* + * This opens the current directory and reads the contents. + */ +int getDirectoryContents (char *directory, char **list, int maxListSize) +{ + char **temp = 0; + int counter = CDKgetDirectoryContents (directory, &temp); + int n; + + for (n = 0; n < counter && n < maxListSize; ++n) + { + list[n] = copyChar (temp[n]); + } + CDKfreeStrings (temp); + + return counter; +} + +/* + * This reads a file and sticks it into the char ** provided. + */ +int readFile (char *filename, char **array, int maxlines) +{ + char **temp = 0; + int lines = CDKreadFile (filename, &temp); + int n; + + for (n = 0; n < maxlines; ++n) + { + if (n < lines) + { + array[n] = copyChar (temp[n]); + } + else + { + array[n] = copyChar (""); + break; + } + } + CDKfreeStrings (temp); + + return (lines); +} + +/* + * This splits a string into X parts given the split character. + */ +int splitString (char *string, char **items, char splitChar) +{ + char **temp = CDKsplitString (string, splitChar); + int chunks = 0; + + for (chunks = 0; chunks < MAX_LINES && temp[chunks] != 0; ++chunks) + { + items[chunks] = copyChar (temp[chunks]); + } + CDKfreeStrings (temp); + + return chunks; +} diff --git a/deps/cdk-5.0-20161210/cdk_display.c b/deps/cdk-5.0-20161210/cdk_display.c new file mode 100644 index 0000000..70b7a37 --- /dev/null +++ b/deps/cdk-5.0-20161210/cdk_display.c @@ -0,0 +1,131 @@ +#include + +/* + * $Author: tom $ + * $Date: 2012/03/20 09:54:37 $ + * $Revision: 1.4 $ + */ + +/* + * Given a character pointer, returns the equivalent display type. + */ +EDisplayType char2DisplayType (const char *string) +{ + /* *INDENT-OFF* */ + static const struct { + const char *name; + EDisplayType code; + } table[] = { + { "CHAR", vCHAR }, + { "HCHAR", vHCHAR }, + { "INT", vINT }, + { "HINT", vHINT }, + { "UCHAR", vUCHAR }, + { "LCHAR", vLCHAR }, + { "UHCHAR", vUHCHAR }, + { "LHCHAR", vLHCHAR }, + { "MIXED", vMIXED }, + { "HMIXED", vHMIXED }, + { "UMIXED", vUMIXED }, + { "LMIXED", vLMIXED }, + { "UHMIXED", vUHMIXED }, + { "LHMIXED", vLHMIXED }, + { "VIEWONLY", vVIEWONLY }, + { 0, vINVALID }, + }; + /* *INDENT-ON* */ + + if (string != 0) + { + int n; + for (n = 0; table[n].name != 0; n++) + { + if (!strcmp (string, table[n].name)) + return table[n].code; + } + } + return (EDisplayType) vINVALID; +} + +/* + * Tell if a display type is "hidden" + */ +boolean isHiddenDisplayType (EDisplayType type) +{ + boolean result = FALSE; + + switch (type) + { + case vHCHAR: + case vHINT: + case vHMIXED: + case vLHCHAR: + case vLHMIXED: + case vUHCHAR: + case vUHMIXED: + result = TRUE; + break; + case vCHAR: + case vINT: + case vINVALID: + case vLCHAR: + case vLMIXED: + case vMIXED: + case vUCHAR: + case vUMIXED: + case vVIEWONLY: + result = FALSE; + break; + } + return result; +} + +/* + * Given a character input, check if it is allowed by the display type, + * and return the character to apply to the display, or ERR if not. + */ +int filterByDisplayType (EDisplayType type, chtype input) +{ + int result = CharOf (input); + + if (!isChar (input)) + { + result = ERR; + } + else if ((type == vINT || + type == vHINT) && + !isdigit (CharOf (result))) + { + result = ERR; + } + else if ((type == vCHAR || + type == vUCHAR || + type == vLCHAR || + type == vUHCHAR || + type == vLHCHAR) && + isdigit (CharOf (result))) + { + result = ERR; + } + else if (type == vVIEWONLY) + { + result = ERR; + } + else if ((type == vUCHAR || + type == vUHCHAR || + type == vUMIXED || + type == vUHMIXED) && + isalpha (CharOf (result))) + { + result = toupper (result); + } + else if ((type == vLCHAR || + type == vLHCHAR || + type == vLMIXED || + type == vLHMIXED) && + isalpha (CharOf (result))) + { + result = tolower (result); + } + return result; +} diff --git a/deps/cdk-5.0-20161210/cdk_objs.c b/deps/cdk-5.0-20161210/cdk_objs.c new file mode 100644 index 0000000..c09828d --- /dev/null +++ b/deps/cdk-5.0-20161210/cdk_objs.c @@ -0,0 +1,230 @@ +#include + +/* + * Default method-functions for CDK objects. + * + * $Author: tom $ + * $Date: 2016/11/20 20:07:11 $ + * $Revision: 1.17 $ + */ + +/* + * Set the object's upper-left-corner line-drawing character. + */ +void setCdkULchar (CDKOBJS *obj, chtype ch) +{ + obj->ULChar = ch; +} + +/* + * Set the object's upper-right-corner line-drawing character. + */ +void setCdkURchar (CDKOBJS *obj, chtype ch) +{ + obj->URChar = ch; +} + +/* + * Set the object's lower-left-corner line-drawing character. + */ +void setCdkLLchar (CDKOBJS *obj, chtype ch) +{ + obj->LLChar = ch; +} + +/* + * Set the object's upper-right-corner line-drawing character. + */ +void setCdkLRchar (CDKOBJS *obj, chtype ch) +{ + obj->LRChar = ch; +} + +/* + * Set the object's horizontal line-drawing character. + */ +void setCdkHZchar (CDKOBJS *obj, chtype ch) +{ + obj->HZChar = ch; +} + +/* + * Set the object's vertical line-drawing character. + */ +void setCdkVTchar (CDKOBJS *obj, chtype ch) +{ + obj->VTChar = ch; +} + +/* + * Set the object's box-attributes. + */ +void setCdkBXattr (CDKOBJS *obj, chtype ch) +{ + obj->BXAttr = ch; +} + +/* + * This sets the background color of the widget. + */ +void setCDKObjectBackgroundColor (CDKOBJS *obj, const char *color) +{ + chtype *holder = 0; + int junk1, junk2; + + /* Make sure the color isn't null. */ + if (color == 0) + { + return; + } + + /* Convert the value of the environment variable to a chtype. */ + holder = char2Chtype (color, &junk1, &junk2); + + /* Set the widget's background color. */ + SetBackAttrObj (obj, holder[0]); + + /* Clean up. */ + freeChtype (holder); +} + +/* + * Set the widget's title. + */ +int setCdkTitle (CDKOBJS *obj, const char *title, int boxWidth) +{ + if (obj != 0) + { + cleanCdkTitle (obj); + + if (title != 0) + { + char **temp = 0; + int titleWidth; + int x; + int len; + int align; + + /* We need to split the title on \n. */ + temp = CDKsplitString (title, '\n'); + obj->titleLines = (int)CDKcountStrings ((CDK_CSTRING2)temp); + + obj->title = typeCallocN (chtype *, obj->titleLines + 1); + obj->titlePos = typeCallocN (int, obj->titleLines + 1); + obj->titleLen = typeCallocN (int, obj->titleLines + 1); + + if (boxWidth >= 0) + { + int maxWidth = 0; + + /* We need to determine the widest title line. */ + for (x = 0; x < obj->titleLines; x++) + { + chtype *holder = char2Chtype (temp[x], &len, &align); + maxWidth = MAXIMUM (maxWidth, len); + freeChtype (holder); + } + boxWidth = MAXIMUM (boxWidth, maxWidth + 2 * obj->borderSize); + } + else + { + boxWidth = -(boxWidth - 1); + } + + /* For each line in the title, convert from char * to chtype * */ + titleWidth = boxWidth - (2 * obj->borderSize); + for (x = 0; x < obj->titleLines; x++) + { + obj->title[x] = char2Chtype (temp[x], &obj->titleLen[x], + &obj->titlePos[x]); + obj->titlePos[x] = justifyString (titleWidth, obj->titleLen[x], + obj->titlePos[x]); + } + CDKfreeStrings (temp); + } + } + return boxWidth; +} + +/* + * Draw the widget's title. + */ +void drawCdkTitle (WINDOW *win, CDKOBJS *obj) +{ + if (obj != 0) + { + int x; + + for (x = 0; x < obj->titleLines; x++) + { + writeChtype (win, + obj->titlePos[x] + obj->borderSize, + x + obj->borderSize, + obj->title[x], + HORIZONTAL, 0, + obj->titleLen[x]); + } + } +} + +/* + * Remove storage for the widget's title. + */ +void cleanCdkTitle (CDKOBJS *obj) +{ + if (obj != 0) + { + CDKfreeChtypes (obj->title); + obj->title = 0; + + freeAndNull (obj->titlePos); + freeAndNull (obj->titleLen); + + obj->titleLines = 0; + } +} + +/* + * Set data for preprocessing. + */ +void setCDKObjectPreProcess (CDKOBJS *obj, PROCESSFN fn, void *data) +{ + obj->preProcessFunction = fn; + obj->preProcessData = data; +} + +/* + * Set data for postprocessing. + */ +void setCDKObjectPostProcess (CDKOBJS *obj, PROCESSFN fn, void *data) +{ + obj->postProcessFunction = fn; + obj->postProcessData = data; +} + +/* + * Set the object's exit-type based on the input. + * The .exitType field should have been part of the CDKOBJS struct, but it + * is used too pervasively in older applications to move (yet). + */ +void setCdkExitType (CDKOBJS *obj, EExitType *type, chtype ch) +{ + switch (ch) + { + case KEY_ERROR: + *type = vERROR; + break; + case KEY_ESC: + *type = vESCAPE_HIT; + break; + case KEY_TAB: + case KEY_ENTER: + *type = vNORMAL; + break; + case 0: + *type = vEARLY_EXIT; + break; + } + /* make the result available via ExitTypeOf(obj) */ + obj->exitType = *type; +} diff --git a/deps/cdk-5.0-20161210/cdk_params.c b/deps/cdk-5.0-20161210/cdk_params.c new file mode 100644 index 0000000..05b0e91 --- /dev/null +++ b/deps/cdk-5.0-20161210/cdk_params.c @@ -0,0 +1,250 @@ +#include + +/* + * Useful functions for command-line parsing. + * + * $Author: tom $ + * $Date: 2016/11/20 18:32:53 $ + * $Revision: 1.12 $ + */ + +#define OPTION_ON ((char *)1) +#define OPTION_OFF ((char *)0) + +static void usage (char **argv, + CDK_PARAMS * params, + const char *options) +{ + int n; + const char *str; + char *base = baseName (argv[0]); + + fprintf (stderr, "Usage: %s [options]\n\nOptions:\n", base); + + for (n = 1; n < MAX_CDK_PARAMS; ++n) + { + if (n != ':' + && (str = (strchr) (options, n)) != 0) + { + int value = (str[1] == ':'); + fprintf (stderr, " -%c", n); + if (value) + { + fprintf (stderr, " (%s)\n", + (params->allParams[n] + ? params->allParams[n] + : "not set")); + } + else + { + fprintf (stderr, " (%s)\n", + (params->allParams[n] + ? "set" + : "not set")); + } + } + } + free (base); + exit (EXIT_FAILURE); +} + +static int CDKparseSize (char *string, int fullSize) +{ + int result; + if (strcmp (string, "FULL") == 0) + { + result = fullSize; + } + else + { + result = (int)strtol (string, (char **)0, 0); + } + return result; +} + +/* + * Parse the string as one of CDK's positioning keywords, or an actual + * position. + */ +int CDKparsePosition (const char *string) +{ + int result; + + if (string == 0) + { + result = NONE; + } + else if (strcmp (string, "TOP") == 0) + { + result = TOP; + } + else if (strcmp (string, "BOTTOM") == 0) + { + result = BOTTOM; + } + else if (strcmp (string, "LEFT") == 0) + { + result = LEFT; + } + else if (strcmp (string, "RIGHT") == 0) + { + result = RIGHT; + } + else if (strcmp (string, "CENTER") == 0) + { + result = CENTER; + } + else + { + result = (int)strtol (string, (char **)0, 0); + } + return result; +} + +/* + * Parse the given argc/argv command-line, with the options passed to + * getopt()'s 3rd parameter. + */ +void CDKparseParams (int argc, + char **argv, + CDK_PARAMS * params, + const char *options) +{ + int code; + + memset (params, 0, sizeof (*params)); + params->Box = TRUE; + + while ((code = getopt (argc, argv, options)) != EOF) + { + const char *str; + + if (code == '?' || (str = (strchr) (options, code)) == 0) + { + usage (argv, params, options); + } + else + { + params->allParams[code] = OPTION_ON; + if (str[1] == ':') + { + params->allParams[code] = optarg; + } + switch (code) + { + case 'W': + params->wValue = CDKparseSize (optarg, FULL); + break; + + case 'H': + params->hValue = CDKparseSize (optarg, FULL); + break; + + case 'X': + params->xValue = CDKparsePosition (optarg); + break; + + case 'Y': + params->yValue = CDKparsePosition (optarg); + break; + + case 'N': + params->Box = FALSE; + break; + + case 'S': + params->Shadow = TRUE; + break; + } + } + } +} + +/* + * Retrieve a numeric option-value, default=0. + */ +int CDKparamNumber (CDK_PARAMS * params, int option) +{ + return CDKparamNumber2 (params, option, 0); +} + +/* + * Retrieve a numeric option-value, given default. + */ +int CDKparamNumber2 (CDK_PARAMS * params, int option, int missing) +{ + return CDKparamValue (params, option, missing); +} + +/* + * Retrieve the string value of an option, default=0. + */ +char *CDKparamString (CDK_PARAMS * params, int option) +{ + return CDKparamString2 (params, option, 0); +} + +/* + * Retrieve the string value of an option, with default for missing value. + */ +char *CDKparamString2 (CDK_PARAMS * params, int option, const char *missing) +{ + char *value = ((option > 0 && option < MAX_CDK_PARAMS) + ? params->allParams[option] + : 0); + if (value == 0) + value = copyChar (missing); + return value; +} + +/* + * Retrieve an integer (or boolean) option value from the parsed command-line. + * (prefer: CDKparamNumber). + */ +int CDKparamValue (CDK_PARAMS * params, int option, int missing) +{ + int result; + char *value = CDKparamString (params, option); + + if (value == 0) + { + result = missing; + } + else if (strchr (CDK_CLI_PARAMS, option) != 0) + { + switch (option) + { + case 'H': + result = params->hValue; + break; + case 'W': + result = params->wValue; + break; + case 'X': + result = params->xValue; + break; + case 'Y': + result = params->yValue; + break; + case 'N': + result = params->Box; + break; + case 'S': + result = params->Shadow; + break; + default: + result = missing; + break; + } + } + else if (value == OPTION_ON) + { + result = 1; + } + else + { + result = (int)strtol (value, (char **)0, 0); + } + + return result; +} diff --git a/deps/cdk-5.0-20161210/cdkscreen.c b/deps/cdk-5.0-20161210/cdkscreen.c new file mode 100644 index 0000000..b768b6d --- /dev/null +++ b/deps/cdk-5.0-20161210/cdkscreen.c @@ -0,0 +1,509 @@ +#include + +#ifdef HAVE_SETLOCALE +#include +#endif + +/* + * $Author: tom $ + * $Date: 2016/12/04 15:41:50 $ + * $Revision: 1.91 $ + */ + +typedef struct _all_screens +{ + struct _all_screens *link; + CDKSCREEN *screen; +} +ALL_SCREENS; + +static ALL_SCREENS *all_screens; + +typedef struct _all_objects +{ + struct _all_objects *link; + CDKOBJS *object; +} +ALL_OBJECTS; + +static ALL_OBJECTS *all_objects; + +static boolean validObjType (CDKOBJS *obj, EObjectType type) +{ + bool valid = FALSE; + + if (obj != 0 && ObjTypeOf (obj) == type) + { + switch (type) + { + case vALPHALIST: + case vBUTTON: + case vBUTTONBOX: + case vCALENDAR: + case vDIALOG: + case vDSCALE: + case vENTRY: + case vFSCALE: + case vFSELECT: + case vFSLIDER: + case vGRAPH: + case vHISTOGRAM: + case vITEMLIST: + case vLABEL: + case vMARQUEE: + case vMATRIX: + case vMENTRY: + case vMENU: + case vRADIO: + case vSCALE: + case vSCROLL: + case vSELECTION: + case vSLIDER: + case vSWINDOW: + case vTEMPLATE: + case vUSCALE: + case vUSLIDER: + case vVIEWER: + valid = TRUE; + break; + case vTRAVERSE: /* not really an object */ + case vNULL: + break; + } + } + return valid; +} + +/* + * Set indices so the screen and object point to each other. + */ +static void setScreenIndex (CDKSCREEN *screen, int number, CDKOBJS *obj) +{ + (obj)->screenIndex = number; + (obj)->screen = screen; + screen->object[number] = obj; +} + +/* + * Returns true if we have done a "new" on this object but no "destroy" + */ +bool validCDKObject (CDKOBJS *obj) +{ + bool result = FALSE; + if (obj != 0) + { + ALL_OBJECTS *ptr; + + for (ptr = all_objects; ptr != 0; ptr = ptr->link) + { + if (ptr->object == obj) + { + result = validObjType (obj, ObjTypeOf (obj)); + break; + } + } + } + return result; +} + +/* + * Create a new object beginning with a CDKOBJS struct. The whole object is + * initialized to zeroes except for special cases which have known values. + */ +void *_newCDKObject (unsigned size, const CDKFUNCS * funcs) +{ + ALL_OBJECTS *item; + CDKOBJS *result = 0; + if ((item = typeCalloc (ALL_OBJECTS)) != 0) + { + if ((result = (CDKOBJS *)calloc (1, size)) != 0) + { + result->fn = funcs; + result->hasFocus = TRUE; + result->isVisible = TRUE; + + item->link = all_objects; + item->object = result; + all_objects = item; + + /* set default line-drawing characters */ + result->ULChar = ACS_ULCORNER; + result->URChar = ACS_URCORNER; + result->LLChar = ACS_LLCORNER; + result->LRChar = ACS_LRCORNER; + result->HZChar = ACS_HLINE; + result->VTChar = ACS_VLINE; + result->BXAttr = A_NORMAL; + + /* set default exit-types */ + result->exitType = vNEVER_ACTIVATED; + result->earlyExit = vNEVER_ACTIVATED; + } + else + { + free (item); + } + } + return (void *)result; +} + +void _destroyCDKObject (CDKOBJS *obj) +{ + if (validCDKObject (obj)) + { + ALL_OBJECTS *p, *q; + + for (p = all_objects, q = 0; p != 0; q = p, p = p->link) + { + if (p->object == obj) + { + /* delink it first, to avoid problems with recursion */ + if (q != 0) + q->link = p->link; + else + all_objects = p->link; + + MethodPtr (obj, destroyObj) (obj); + free (obj); + free (p); + break; + } + } + } +} + +/* + * This creates a new CDK screen. + */ +CDKSCREEN *initCDKScreen (WINDOW *window) +{ + ALL_SCREENS *item; + CDKSCREEN *screen = 0; + + /* initialization, for the first time */ + if (all_screens == 0 || stdscr == 0 || window == 0) + { + /* Set up basic curses settings. */ +#ifdef HAVE_SETLOCALE + setlocale (LC_ALL, ""); +#endif + /* Initialize curses after setting the locale, since curses depends + * on having a correct locale to reflect the terminal's encoding. + */ + if (stdscr == 0 || window == 0) + { + window = initscr (); + } + noecho (); + cbreak (); + } + + if ((item = typeMalloc (ALL_SCREENS)) != 0) + { + if ((screen = typeCalloc (CDKSCREEN)) != 0) + { + item->link = all_screens; + item->screen = screen; + all_screens = item; + + /* Initialize the CDKSCREEN pointer. */ + screen->objectCount = 0; + screen->objectLimit = 2; + screen->object = typeMallocN (CDKOBJS *, screen->objectLimit); + screen->window = window; + + /* OK, we are done. */ + } + else + { + free (item); + } + } + return (screen); +} + +/* + * This registers a CDK object with a screen. + */ +void registerCDKObject (CDKSCREEN *screen, EObjectType cdktype, void *object) +{ + CDKOBJS *obj = (CDKOBJS *)object; + + if (screen->objectCount + 1 >= screen->objectLimit) + { + screen->objectLimit += 2; + screen->objectLimit *= 2; + screen->object = typeReallocN (CDKOBJS *, screen->object, screen->objectLimit); + } + if (validObjType (obj, cdktype)) + { + setScreenIndex (screen, screen->objectCount++, obj); + } +} + +/* + * This registers a CDK object with a screen. + */ +void reRegisterCDKObject (EObjectType cdktype, void *object) +{ + CDKOBJS *obj = (CDKOBJS *)object; + + registerCDKObject (obj->screen, cdktype, object); +} + +/* + * This removes an object from the CDK screen. + */ +void unregisterCDKObject (EObjectType cdktype, void *object) +{ + CDKOBJS *obj = (CDKOBJS *)object; + + if (validObjType (obj, cdktype) && obj->screenIndex >= 0) + { + CDKSCREEN *screen = (obj)->screen; + + if (screen != 0) + { + int Index = (obj)->screenIndex; + int x; + + obj->screenIndex = -1; + + /* + * Resequence the objects. + */ + for (x = Index; x < screen->objectCount - 1; x++) + { + setScreenIndex (screen, x, screen->object[x + 1]); + } + + if (screen->objectCount <= 1) + { + /* if no more objects, remove the array */ + freeAndNull (screen->object); + screen->objectCount = 0; + screen->objectLimit = 0; + } + else + { + /* Reduce the list by one object. */ + screen->object[screen->objectCount--] = 0; + + /* + * Update the object-focus + */ + if (screen->objectFocus == Index) + { + screen->objectFocus--; + (void)setCDKFocusNext (screen); + } + else if (screen->objectFocus > Index) + { + screen->objectFocus--; + } + } + } + } +} + +#define validIndex(screen, n) ((n) >= 0 && (n) < (screen)->objectCount) + +static void swapCDKIndices (CDKSCREEN *screen, int n1, int n2) +{ + if (n1 != n2 && validIndex (screen, n1) && validIndex (screen, n2)) + { + CDKOBJS *o1 = screen->object[n1]; + CDKOBJS *o2 = screen->object[n2]; + setScreenIndex (screen, n1, o2); + setScreenIndex (screen, n2, o1); + + if (screen->objectFocus == n1) + screen->objectFocus = n2; + else if (screen->objectFocus == n2) + screen->objectFocus = n1; + } +} + +/* + * This 'brings' a CDK object to the top of the stack. + */ +void raiseCDKObject (EObjectType cdktype, void *object) +{ + CDKOBJS *obj = (CDKOBJS *)object; + + if (validObjType (obj, cdktype)) + { + CDKSCREEN *screen = obj->screen; + swapCDKIndices (screen, obj->screenIndex, screen->objectCount - 1); + } +} + +/* + * This 'lowers' an object. + */ +void lowerCDKObject (EObjectType cdktype, void *object) +{ + CDKOBJS *obj = (CDKOBJS *)object; + + if (validObjType (obj, cdktype)) + { + CDKSCREEN *screen = obj->screen; + swapCDKIndices (screen, obj->screenIndex, 0); + } +} + +/* + * This calls refreshCDKScreen. (made consistent with widgets) + */ +void drawCDKScreen (CDKSCREEN *cdkscreen) +{ + refreshCDKScreen (cdkscreen); +} + +/* + * Refresh one CDK window. + * FIXME: this should be rewritten to use the panel library, so it would not + * be necessary to touch the window to ensure that it covers other windows. + */ +void refreshCDKWindow (WINDOW *win) +{ + touchwin (win); + wrefresh (win); +} + +/* + * This refreshes all the objects in the screen. + */ +void refreshCDKScreen (CDKSCREEN *cdkscreen) +{ + int objectCount = cdkscreen->objectCount; + int x; + int focused = -1; + int visible = -1; + + refreshCDKWindow (cdkscreen->window); + + /* We erase all the invisible objects, then only + * draw it all back, so that the objects + * can overlap, and the visible ones will always + * be drawn after all the invisible ones are erased */ + for (x = 0; x < objectCount; x++) + { + CDKOBJS *obj = cdkscreen->object[x]; + + if (validObjType (obj, ObjTypeOf (obj))) + { + if (obj->isVisible) + { + if (visible < 0) + visible = x; + if (obj->hasFocus && focused < 0) + focused = x; + } + else + { + obj->fn->eraseObj (obj); + } + } + } + + for (x = 0; x < objectCount; x++) + { + CDKOBJS *obj = cdkscreen->object[x]; + + if (validObjType (obj, ObjTypeOf (obj))) + { + obj->hasFocus = (x == focused); + + if (obj->isVisible) + { + obj->fn->drawObj (obj, obj->box); + } + } + } +} + +/* + * This clears all the objects in the screen. + */ +void eraseCDKScreen (CDKSCREEN *cdkscreen) +{ + int objectCount = cdkscreen->objectCount; + int x; + + /* We just call the drawObject function. */ + for (x = 0; x < objectCount; x++) + { + CDKOBJS *obj = cdkscreen->object[x]; + + if (validObjType (obj, ObjTypeOf (obj))) + { + obj->fn->eraseObj (obj); + } + } + + /* Refresh the screen. */ + wrefresh (cdkscreen->window); +} + +/* + * Destroy all of the objects on a screen + */ +void destroyCDKScreenObjects (CDKSCREEN *cdkscreen) +{ + int x; + + for (x = 0; x < cdkscreen->objectCount; x++) + { + CDKOBJS *obj = cdkscreen->object[x]; + int before = cdkscreen->objectCount; + + if (validObjType (obj, ObjTypeOf (obj))) + { + MethodPtr (obj, eraseObj) (obj); + _destroyCDKObject (obj); + x -= (cdkscreen->objectCount - before); + } + } +} + +/* + * This destroys a CDK screen. + */ +void destroyCDKScreen (CDKSCREEN *screen) +{ + ALL_SCREENS *p, *q; + + for (p = all_screens, q = 0; p != 0; q = p, p = p->link) + { + if (screen == p->screen) + { + if (q != 0) + q->link = p->link; + else + all_screens = p->link; + free (p); + free (screen); + break; + } + } +} + +/* + * This is added to remain consistent. + */ +void endCDK (void) +{ + /* Turn echoing back on. */ + echo (); + + /* Turn off cbreak. */ + nocbreak (); + + /* End the curses windows. */ + endwin (); + +#ifdef HAVE_XCURSES + XCursesExit (); +#endif +} diff --git a/deps/cdk-5.0-20161210/cli/Makefile.in b/deps/cdk-5.0-20161210/cli/Makefile.in new file mode 100644 index 0000000..4bfc204 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/Makefile.in @@ -0,0 +1,107 @@ +# $Id: Makefile.in,v 1.7 2013/07/19 23:55:03 tom Exp $ +# +# Makefile for the cli directory. +# +SHELL = /bin/sh + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +srcdir = @srcdir@ +VPATH = $(srcdir) + +CC = @CC@ +RM = rm -f +CTAGS = @CTAGS@ +ETAGS = @ETAGS@ +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ + +LIBS = -l@LIB_ROOTNAME@ @LIBS@ + +LIBTOOL = @LIBTOOL@ @ECHO_LT@ +LIBTOOL_CLEAN = @LIB_CLEAN@ +LIBTOOL_LINK = @LIB_LINK@ +LINK = $(LIBTOOL_LINK) + +x = @EXEEXT@ +o = .@OBJEXT@ +LOCAL_LIBDIR = @top_builddir@ + +CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@ +CPPFLAGS = @DEFS@ -I../include -I$(srcdir)/../include -I. @CPPFLAGS@ +LDFLAGS = -L.. @LDFLAGS@ @LOCAL_LDFLAGS@ + +BINS = \ + cdkalphalist$x \ + cdkcalendar$x \ + cdkdialog$x \ + cdkentry$x \ + cdkfselect$x \ + cdkitemlist$x \ + cdklabel$x \ + cdkmatrix$x \ + cdkmentry$x \ + cdkradio$x \ + cdkscale$x \ + cdkscroll$x \ + cdkselection$x \ + cdkslider$x \ + cdktemplate$x \ + cdkviewer$x + +CDKSRC = \ + cdkalphalist.c \ + cdkcalendar.c \ + cdkdialog.c \ + cdkentry.c \ + cdkfselect.c \ + cdkitemlist.c \ + cdklabel.c \ + cdkmatrix.c \ + cdkmentry.c \ + cdkradio.c \ + cdkscale.c \ + cdkscroll.c \ + cdkselection.c \ + cdkslider.c \ + cdktemplate.c \ + cdkviewer.c + +LINKIT = @ECHO_LD@$(LINK) $(CFLAGS) $(CPPFLAGS) $? -o $@ $(LDFLAGS) $(LIBS) + +all : $(BINS) + +cdkalphalist$x : cdkalphalist.c ; $(LINKIT) +cdkcalendar$x : cdkcalendar.c ; $(LINKIT) +cdkdialog$x : cdkdialog.c ; $(LINKIT) +cdkentry$x : cdkentry.c ; $(LINKIT) +cdkfselect$x : cdkfselect.c ; $(LINKIT) +cdkitemlist$x : cdkitemlist.c ; $(LINKIT) +cdklabel$x : cdklabel.c ; $(LINKIT) +cdkmatrix$x : cdkmatrix.c ; $(LINKIT) +cdkmentry$x : cdkmentry.c ; $(LINKIT) +cdkradio$x : cdkradio.c ; $(LINKIT) +cdkscale$x : cdkscale.c ; $(LINKIT) +cdkscroll$x : cdkscroll.c ; $(LINKIT) +cdkselection$x : cdkselection.c ; $(LINKIT) +cdkslider$x : cdkslider.c ; $(LINKIT) +cdktemplate$x : cdktemplate.c ; $(LINKIT) +cdkviewer$x : cdkviewer.c ; $(LINKIT) +# +# Standard clean directives. +# +clean:: + - $(LIBTOOL_CLEAN) $(RM) *.o core $(BINS) + +distclean:: clean + $(RM) Makefile + +@MAKE_LOWER_TAGS@tags : +@MAKE_LOWER_TAGS@ $(CTAGS) *.[ch] */*.[ch] + +@MAKE_LOWER_TAGS@TAGS : +@MAKE_LOWER_TAGS@ $(ETAGS) *.[ch] */*.[ch] + +lint: $(CDKSRC) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(CDKSRC) diff --git a/deps/cdk-5.0-20161210/cli/cdkalphalist.c b/deps/cdk-5.0-20161210/cli/cdkalphalist.c new file mode 100644 index 0000000..dd4a123 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkalphalist.c @@ -0,0 +1,276 @@ +/* $Id: cdkalphalist.c,v 1.18 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkalphalist"; +#endif + +/* + * Declare file local prototypes. + */ +int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-l List | -f filename [-F Field Character] [-T Title] [-L Label] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-H Height] [-W Width] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKALPHALIST *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + char *CDK_WIDGET_COLOR = 0; + char *answer = 0; + char *buttons; + char *temp = 0; + chtype *holder = 0; + chtype filler = A_NORMAL | '.'; + int scrollLines = -1; + int buttonCount = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **scrollList = 0; + char **buttonList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *filename; + char *label; + char *list; + char *outputFile; + char *tempFiller; + char *title; + int height; + int width; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "f:l:B:F:L:O:T:" CDK_CLI_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + height = CDKparamValue (¶ms, 'H', -1); + width = CDKparamValue (¶ms, 'W', -1); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + filename = CDKparamString (¶ms, 'f'); + list = CDKparamString (¶ms, 'l'); + buttons = CDKparamString (¶ms, 'B'); + tempFiller = CDKparamString (¶ms, 'F'); + label = CDKparamString (¶ms, 'L'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Did they provide a list of items. */ + if (list == 0) + { + /* Maybe they gave a filename to use to read. */ + if (filename != 0) + { + /* Read the file in. */ + scrollLines = CDKreadFile (filename, &scrollList); + + /* Check if there was an error. */ + if (scrollLines == -1) + { + fprintf (stderr, "Error: Could not open the file '%s'.\n", filename); + ExitProgram (CLI_ERROR); + } + } + else + { + /* They didn't provide anything. */ + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + } + else + { + /* Split the scroll lines up. */ + scrollList = CDKsplitString (list, '\n'); + scrollLines = (int)CDKcountStrings ((CDK_CSTRING2)scrollList); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* If they set the filler character, set it now. */ + if (tempFiller != 0) + { + holder = char2Chtype (tempFiller, &j1, &j2); + filler = holder[0]; + freeChtype (holder); + } + + /* Create the widget. */ + widget = newCDKAlphalist (cdkScreen, xpos, ypos, + height, width, + title, label, + (CDK_CSTRING *)scrollList, scrollLines, + filler, A_REVERSE, + boxWidget, shadowWidget); + + /* Make sure we could create the widget. */ + if (widget == 0) + { + CDKfreeStrings (scrollList); + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the alphalist. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2)buttonList); + + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win) + 1, + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 3, + 0, 1, buttonCount, + (CDK_CSTRING2)buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the entry field. + */ + setCDKAlphalistLLChar (widget, ACS_LTEE); + setCDKAlphalistLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the entry field to send a + * Tab key to the button box widget. + */ + bindCDKObject (vENTRY, widget->entryField, KEY_RIGHT, widgetCB, buttonWidget); + bindCDKObject (vENTRY, widget->entryField, KEY_LEFT, widgetCB, buttonWidget); + bindCDKObject (vENTRY, widget->entryField, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vENTRY, widget->entryField, CDK_PREV, widgetCB, buttonWidget); + + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKAlphalist (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKAlphalistBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Activate the widget. */ + answer = copyChar (activateCDKAlphalist (widget, 0)); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + destroyCDKButtonbox (buttonWidget); + } + + CDKfreeStrings (scrollList); + + destroyCDKAlphalist (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print out the answer. */ + if (answer != 0) + { + fprintf (fp, "%s\n", answer); + freeChar (answer); + } + + /* Exit with the selected button. */ + ExitProgram (0); +} + +int widgetCB (EObjectType cdktype GCC_UNUSED, void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void)injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkcalendar.c b/deps/cdk-5.0-20161210/cli/cdkcalendar.c new file mode 100644 index 0000000..5be4cbf --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkcalendar.c @@ -0,0 +1,252 @@ +/* $Id: cdkcalendar.c,v 1.17 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkcalendar"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static void getTodaysDate (int *day, int *month, int *year); + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKCALENDAR *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + struct tm *dateInfo = 0; + time_t selected = 0; + chtype dayAttrib = A_NORMAL; + chtype monthAttrib = A_NORMAL; + chtype yearAttrib = A_NORMAL; + chtype highlight = A_REVERSE; + chtype *holder = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **buttonList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *outputFile; + char *title; + int day; + int month; + int xpos; + int year; + int ypos; + + getTodaysDate (&day, &month, &year); + + CDKparseParams (argc, argv, ¶ms, "d:m:y:B:O:T:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + day = CDKparamValue (¶ms, 'd', day); + month = CDKparamValue (¶ms, 'm', month); + year = CDKparamValue (¶ms, 'y', year); + buttons = CDKparamString (¶ms, 'B'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Check if the user wants to set the background of the widget. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the calendar width. */ + widget = newCDKCalendar (cdkScreen, xpos, ypos, title, + day, month, year, + dayAttrib, monthAttrib, + yearAttrib, highlight, + boxWidget, shadowWidget); + /* Check to make sure we created the dialog box. */ + if (widget == 0) + { + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the calendar. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + 0, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKCalendarLLChar (widget, ACS_LTEE); + setCDKCalendarLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vCALENDAR, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vCALENDAR, widget, CDK_PREV, widgetCB, buttonWidget); + bindCDKObject (vCALENDAR, widget, CDK_NEXT, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKCalendar (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKCalendarBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Activate the calendar widget. */ + selected = activateCDKCalendar (widget, 0); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + CDKfreeStrings (buttonList); + + destroyCDKCalendar (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print out the date selected. D/M/Y format. */ + dateInfo = gmtime (&selected); + fprintf (fp, "%02d/%02d/%d\n", + dateInfo->tm_mday, + (dateInfo->tm_mon + 1), + (dateInfo->tm_year + 1900)); + fclose (fp); + + ExitProgram (selection); +} + +/* + * This returns what day of the week the month starts on. + */ +static void getTodaysDate (int *day, int *month, int *year) +{ + struct tm *dateInfo; + time_t clck; + + /* Determine the current time and determine if we are in DST. */ + time (&clck); + dateInfo = gmtime (&clck); + + /* Set the pointers accordingly. */ + (*day) = dateInfo->tm_mday; + (*month) = dateInfo->tm_mon + 1; + (*year) = dateInfo->tm_year + 1900; +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkdialog.c b/deps/cdk-5.0-20161210/cli/cdkdialog.c new file mode 100644 index 0000000..acc0b81 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkdialog.c @@ -0,0 +1,178 @@ +/* $Id: cdkdialog.c,v 1.15 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkdialog"; +#endif + +/* + * Define file local variables. + */ +static const char *FPUsage = "-m Message String | -f filename [-B Buttons] [-O Output file] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKDIALOG *widget = 0; + char *CDK_WIDGET_COLOR = 0; + char *button = 0; + char *temp = 0; + chtype *holder = 0; + int answer = 0; + int messageLines = -1; + int buttonCount = 0; + FILE *fp = stderr; + char **messageList = 0; + char **buttonList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *filename; + char *outputFile; + char *message; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "f:m:B:O:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + filename = CDKparamString (¶ms, 'f'); + message = CDKparamString (¶ms, 'm'); + buttons = CDKparamString (¶ms, 'B'); + outputFile = CDKparamString (¶ms, 'O'); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Make sure we have a message to display. */ + if (message == 0) + { + /* No message, maybe they provided a file to read. */ + if (filename != 0) + { + /* Read the file in. */ + messageLines = CDKreadFile (filename, &messageList); + + /* Check if there was an error. */ + if (messageLines == -1) + { + fprintf (stderr, "Error: Could not open the file %s\n", filename); + ExitProgram (CLI_ERROR); + } + } + else + { + /* No message, no file, it's an error. */ + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + } + else + { + /* Split the message up. */ + messageList = CDKsplitString (message, '\n'); + messageLines = (int)CDKcountStrings ((CDK_CSTRING2)messageList); + } + + /* Set up the buttons for the dialog box. */ + if (buttons == 0) + { + buttonList = calloc(sizeof(char *), 3); + buttonList[0] = copyChar ("OK"); + buttonList[1] = copyChar ("Cancel"); + buttonCount = 2; + } + else + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2)buttonList); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the dialog box. */ + widget = newCDKDialog (cdkScreen, xpos, ypos, + (CDK_CSTRING2)messageList, messageLines, + (CDK_CSTRING2)buttonList, buttonCount, + A_REVERSE, + boxWidget, boxWidget, shadowWidget); + + /* Check to make sure we created the dialog box. */ + if (widget == 0) + { + CDKfreeStrings (messageList); + CDKfreeStrings (buttonList); + + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the dialog box. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Check if the user wants to set the background of the widget. */ + setCDKDialogBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Activate the dialog box. */ + answer = activateCDKDialog (widget, 0); + + /* End CDK. */ + destroyCDKDialog (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print the name of the button selected. */ + if (answer >= 0) + { + button = copyChar (buttonList[answer]); + fprintf (fp, "%s\n", button); + freeChar (button); + } + + CDKfreeStrings (messageList); + CDKfreeStrings (buttonList); + + /* Exit with the button number picked. */ + ExitProgram (answer); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkentry.c b/deps/cdk-5.0-20161210/cli/cdkentry.c new file mode 100644 index 0000000..a064fb6 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkentry.c @@ -0,0 +1,267 @@ +/* $Id: cdkentry.c,v 1.16 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkentry"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-f Field Width [-d Display Type] [-F Field Character] [-i Initial Value] [-m Minimum Length] [-M Maximum Length] [-T Title] [-L Label] [-B Buttons] [-O Output file] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKENTRY *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + chtype *holder = 0; + chtype fieldAttr = A_NORMAL; + char *answer = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + char filler = '.'; + EDisplayType dType = vMIXED; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **buttonList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *outputFile; + char *initValue; + char *title; + char *label; + char *tempFiller; + int maxValue; + int fieldWidth; + int minValue; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "d:f:i:m:B:F:L:M:O:T:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + minValue = CDKparamValue (¶ms, 'm', 0); + fieldWidth = CDKparamValue (¶ms, 'f', 0); + maxValue = CDKparamValue (¶ms, 'M', 256); + initValue = CDKparamString (¶ms, 'i'); + buttons = CDKparamString (¶ms, 'B'); + tempFiller = CDKparamString (¶ms, 'F'); + label = CDKparamString (¶ms, 'L'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + if ((temp = CDKparamString (¶ms, 'd')) != 0) + dType = char2DisplayType (temp); + + /* Make sure all the command line parameters were provided. */ + if (fieldWidth <= 0) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* If the set the filler character, set it now. */ + if (tempFiller != 0) + { + holder = char2Chtype (tempFiller, &j1, &j2); + fieldAttr = A_ATTRIBUTES & holder[0]; + filler = (char)holder[0]; + freeChtype (holder); + } + + /* Create the entry widget. */ + widget = newCDKEntry (cdkScreen, xpos, ypos, + title, label, + fieldAttr, + (chtype)filler | fieldAttr, + dType, fieldWidth, + minValue, maxValue, + boxWidget, FALSE); + + /* Check to make sure we created the dialog box. */ + if (widget == 0) + { + /* Shut down curses and CDK. */ + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the entry field. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2)buttonList); + + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + 0, 1, buttonCount, + (CDK_CSTRING2)buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the entry field. + */ + setCDKEntryLLChar (widget, ACS_LTEE); + setCDKEntryLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the entry field to send a + * Tab key to the button box widget. + */ + bindCDKObject (vENTRY, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vENTRY, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vENTRY, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKEntry (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKEntryBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* If there was an initial value, set it. */ + if (initValue != 0) + { + setCDKEntryValue (widget, initValue); + } + + /* Activate the widget. */ + answer = copyChar (activateCDKEntry (widget, 0)); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* End CDK. */ + destroyCDKEntry (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print the value from the widget. */ + if (answer != 0) + { + fprintf (fp, "%s\n", answer); + freeChar (answer); + } + fclose (fp); + + /* Exit with the button number picked. */ + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void)injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkfselect.c b/deps/cdk-5.0-20161210/cli/cdkfselect.c new file mode 100644 index 0000000..926786e --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkfselect.c @@ -0,0 +1,238 @@ +/* $Id: cdkfselect.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkfselect"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKFSELECT *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + char *filename = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype *holder = 0; + int selection = 0; + int shadowHeight = 0; + int buttonCount = 0; + FILE *fp = stderr; + char **buttonList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *directory; + char *label; + char *outputFile; + char *title; + int height; + int width; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "d:B:L:O:T:" CDK_CLI_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + height = CDKparamValue (¶ms, 'H', 0); + width = CDKparamValue (¶ms, 'W', 0); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + directory = CDKparamString (¶ms, 'd'); + buttons = CDKparamString (¶ms, 'B'); + label = CDKparamString (¶ms, 'L'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* If they didn't provide a directory, use . */ + if (directory == 0) + { + directory = copyChar ("."); + } + + /* Set the label of the file selector if it hasn't been yet. */ + if (label == 0) + { + label = copyChar ("Directory: "); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the file selector widget. */ + widget = newCDKFselect (cdkScreen, xpos, ypos, height, width, + title, label, A_NORMAL, '.', A_REVERSE, + "", "", "", "", + boxWidget, shadowWidget); + freeChar (label); + + /* Check to make sure we created the file selector. */ + if (widget == 0) + { + CDKfreeStrings (buttonList); + + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the file selector. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 2), + 1, widget->boxWidth - 2, + 0, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKFselectLLChar (widget, ACS_LTEE); + setCDKFselectLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vFSELECT, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vFSELECT, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vFSELECT, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKFselect (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKFselectBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Set the information for the file selector. */ + setCDKFselectDirectory (widget, directory); + + /* Activate the file selector. */ + filename = copyChar (activateCDKFselect (widget, 0)); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + destroyCDKFselect (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print the filename selected. */ + fprintf (fp, "%s\n", filename); + freeChar (filename); + fclose (fp); + + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkitemlist.c b/deps/cdk-5.0-20161210/cli/cdkitemlist.c new file mode 100644 index 0000000..0fdcb5b --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkitemlist.c @@ -0,0 +1,271 @@ +/* $Id: cdkitemlist.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkitemlist"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-l List | -f filename [-d Default Item] [-T Title] [-L Label] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKITEMLIST *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + chtype *holder = 0; + char *answer = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + int ret = 0; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **itemlistList = 0; + char **buttonList = 0; + int itemlistLines, j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *filename; + char *label; + char *list; + char *outputFile; + char *title; + int defaultItem; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "d:f:l:B:L:O:T:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + defaultItem = CDKparamValue (¶ms, 'd', 0); + filename = CDKparamString (¶ms, 'f'); + list = CDKparamString (¶ms, 'l'); + buttons = CDKparamString (¶ms, 'B'); + label = CDKparamString (¶ms, 'L'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Did they provide a list of items. */ + if (list == 0) + { + /* Maybe they gave a filename to use to read. */ + if (filename != 0) + { + /* Read the file in. */ + itemlistLines = CDKreadFile (filename, &itemlistList); + + /* Check if there was an error. */ + if (itemlistLines == -1) + { + fprintf (stderr, "Error: Could not open the file '%s'.\n", filename); + ExitProgram (CLI_ERROR); + } + } + else + { + /* They didn't provide anything. */ + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + } + else + { + /* Split the itemlist lines up. */ + itemlistList = CDKsplitString (list, '\n'); + itemlistLines = (int)CDKcountStrings ((CDK_CSTRING2) itemlistList); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the item list. */ + widget = newCDKItemlist (cdkScreen, xpos, ypos, + title, label, + (CDK_CSTRING2) itemlistList, itemlistLines, + defaultItem, + boxWidget, shadowWidget); + + /* Make sure we could create the widget. */ + if (widget == 0) + { + CDKfreeStrings (itemlistList); + + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the item list. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + 0, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKItemlistLLChar (widget, ACS_LTEE); + setCDKItemlistLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vITEMLIST, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vITEMLIST, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vITEMLIST, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKItemlist (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKItemlistBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Activate the item list. */ + ret = activateCDKItemlist (widget, 0); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + destroyCDKItemlist (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print out the answer. */ + if (ret >= 0) + { + holder = char2Chtype (itemlistList[ret], &j1, &j2); + answer = chtype2Char (holder); + fprintf (fp, "%s\n", answer); + freeChar (answer); + freeChtype (holder); + } + CDKfreeStrings (itemlistList); + fclose (fp); + + /* Exit with the answer. */ + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdklabel.c b/deps/cdk-5.0-20161210/cli/cdklabel.c new file mode 100644 index 0000000..68b8944 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdklabel.c @@ -0,0 +1,164 @@ +/* $Id: cdklabel.c,v 1.15 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdklabel"; +#endif + +#if !defined (HAVE_SLEEP) && defined (_WIN32) /* Mingw */ +#define sleep(x) _sleep(x*1000) +#endif + +/* + * Declare file local variables. + */ +static const char *FPUsage = "-m Message String | -f filename [-c Command] [-p Pause Character] [-s Sleep] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKLABEL *widget = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype *holder = 0; + int messageLines = -1; + char **messageList = 0; + char tempCommand[1000]; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *command; + char *filename; + char *message; + char waitChar = 0; + int sleepLength; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "c:f:m:p:s:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + sleepLength = CDKparamValue (¶ms, 's', 0); + command = CDKparamString (¶ms, 'c'); + filename = CDKparamString (¶ms, 'f'); + message = CDKparamString (¶ms, 'm'); + + if ((temp = CDKparamString (¶ms, 'p')) != 0) + waitChar = *temp; + + /* Make sure we have a message to display. */ + if (message == 0) + { + /* No message, maybe they provided a file to read. */ + if (filename != 0) + { + /* Read the file in. */ + messageLines = CDKreadFile (filename, &messageList); + + /* Check if there was an error. */ + if (messageLines == -1) + { + fprintf (stderr, "Error: Could not open the file %s\n", filename); + ExitProgram (CLI_ERROR); + } + } + else + { + /* No message, no file, it's an error. */ + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + } + else + { + /* Split the message up. */ + messageList = CDKsplitString (message, '\n'); + messageLines = (int)CDKcountStrings ((CDK_CSTRING2) messageList); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the label widget. */ + widget = newCDKLabel (cdkScreen, xpos, ypos, + (CDK_CSTRING2) messageList, messageLines, + boxWidget, shadowWidget); + + /* Make sure we could create the widget. */ + if (widget == 0) + { + CDKfreeStrings (messageList); + + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the label. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Check if the user wants to set the background of the widget. */ + setCDKLabelBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Draw the widget. */ + drawCDKLabel (widget, boxWidget); + + /* If they supplied a command, run it. */ + if (command != 0) + { + const char *fmt = "(sh -c %.*s) >/dev/null 2>&1"; + sprintf (tempCommand, fmt, (int)(sizeof (tempCommand) - strlen (fmt)), command); + system (tempCommand); + } + + /* If they supplied a wait character, wait for the user to hit it. */ + if (waitChar != 0) + { + waitCDKLabel (widget, waitChar); + } + + /* If they supplied a sleep time, sleep for the given length. */ + if (sleepLength > 0) + { + sleep ((unsigned)sleepLength); + } + + CDKfreeStrings (messageList); + + destroyCDKLabel (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Exit cleanly. */ + ExitProgram (0); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkmatrix.c b/deps/cdk-5.0-20161210/cli/cdkmatrix.c new file mode 100644 index 0000000..78e8224 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkmatrix.c @@ -0,0 +1,386 @@ +/* $Id: cdkmatrix.c,v 1.19 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkmatrix"; +#endif + +#define MY_INFO(x,y) info[(x + 1) * cols + (y + 1)] + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-r Row Titles -c Column Titles -v Visible Rows -w Column Widths [-t Column Types] [-d Default Values] [-F Field Character] [-T Title] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKMATRIX *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + chtype *holder = 0; + char *buttons = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype filler = A_NORMAL | '.'; + int rows = -1; + int cols = -1; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **rowTitles; + char **colTitles; + char **rowTemp = 0; + char **colTemp = 0; + char **kolTemp = 0; + char **buttonList = 0; + int *colWidths; + int *colTypes; + int count, infoLines, x, y, j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *defaultValue; + char *myColTitles; + char *myColTypes; + char *myColWidths; + char *myFiller; + char *myRowTitles; + char *outputFile; + char *title; + int vrows; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "c:d:r:t:w:v:B:F:O:T:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + vrows = CDKparamValue (¶ms, 'v', -1); + myColTitles = CDKparamString (¶ms, 'c'); + defaultValue = CDKparamString (¶ms, 'd'); + myRowTitles = CDKparamString (¶ms, 'r'); + myColTypes = CDKparamString (¶ms, 't'); + myColWidths = CDKparamString (¶ms, 'w'); + buttons = CDKparamString (¶ms, 'B'); + myFiller = CDKparamString (¶ms, 'F'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Make sure all the needed command line parameters were provided. */ + if ((myRowTitles == 0) || + (myColTitles == 0) || + (myColWidths == 0) || + (vrows == -1)) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* Convert the char * titles to a char **, offset by one */ + rowTemp = CDKsplitString (myRowTitles, '\n'); + rows = (int)CDKcountStrings ((CDK_CSTRING2)rowTemp); + rowTitles = (char **)calloc ((size_t) rows + 1, sizeof (char *)); + for (x = 0; x < rows; x++) + { + rowTitles[x + 1] = rowTemp[x]; + } + + colTemp = CDKsplitString (myColTitles, '\n'); + cols = (int)CDKcountStrings ((CDK_CSTRING2)colTemp); + colTitles = (char **)calloc ((size_t) cols + 1, sizeof (char *)); + for (x = 0; x < cols; x++) + { + colTitles[x + 1] = colTemp[x]; + } + + /* Convert the column widths. */ + kolTemp = CDKsplitString (myColWidths, '\n'); + count = (int)CDKcountStrings ((CDK_CSTRING2)kolTemp); + colWidths = (int *)calloc ((size_t) count + 1, sizeof (int)); + for (x = 0; x < count; x++) + { + colWidths[x + 1] = atoi (kolTemp[x]); + } + + /* If they passed in the column types, convert them. */ + if (myColTypes != 0) + { + char **ss = CDKsplitString (myColTypes, '\n'); + count = (int)CDKcountStrings ((CDK_CSTRING2)ss); + colTypes = (int *)calloc ((size_t) MAXIMUM (cols, count) + 1, sizeof (int)); + for (x = 0; x < count; x++) + { + colTypes[x + 1] = char2DisplayType (ss[x]); + } + CDKfreeStrings (ss); + } + else + { + /* If they didn't set default values. */ + colTypes = (int *)calloc ((size_t) cols + 1, sizeof (int)); + for (x = 0; x < cols; x++) + { + colTypes[x + 1] = vMIXED; + } + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* If the set the filler character, set it now. */ + if (myFiller != 0) + { + holder = char2Chtype (myFiller, &j1, &j2); + filler = holder[0]; + freeChtype (holder); + } + + /* Create the matrix widget. */ + widget = newCDKMatrix (cdkScreen, xpos, ypos, + rows, cols, vrows, cols, + title, (CDK_CSTRING2)rowTitles, (CDK_CSTRING2)colTitles, + colWidths, colTypes, 1, 1, + filler, COL, + boxWidget, TRUE, shadowWidget); + free (rowTitles); + free (colTitles); + + /* Make sure we could create the widget. */ + if (widget == 0) + { + /* Shut down curses and CDK. */ + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Cannot create the matrix. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* + * If the user sent in a file of default values, read it and + * stick the values read in from the file into the matrix. + */ + if (defaultValue != 0) + { + size_t limit = (size_t) ((rows + 1) * (cols + 1)); + char **info = (char **)calloc (limit, sizeof (char *)); + char **lineTemp = 0; + + /* Read the file. */ + infoLines = CDKreadFile (defaultValue, &lineTemp); + if (infoLines > 0) + { + int *subSize = (int *)calloc ((size_t) infoLines + 1, sizeof (int)); + + /* For each line, split on a CTRL-V. */ + for (x = 0; x < infoLines; x++) + { + char **ss = CDKsplitString (lineTemp[x], CTRL ('V')); + subSize[x + 1] = (int)CDKcountStrings ((CDK_CSTRING2)ss); + for (y = 0; y < subSize[x + 1]; y++) + { + MY_INFO (x, y) = ss[y]; + } + free (ss); + } + CDKfreeStrings (lineTemp); + + setCDKMatrixCells (widget, (CDK_CSTRING2)info, rows, cols, subSize); + + for (x = 0; x < infoLines; x++) + { + for (y = 0; y < subSize[x + 1]; y++) + { + freeChar (MY_INFO (x, y)); + } + } + free (info); + free (subSize); + } + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2)buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + NULL, 1, buttonCount, + (CDK_CSTRING2)buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKMatrixLLChar (widget, ACS_LTEE); + setCDKMatrixLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vMATRIX, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vMATRIX, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vMATRIX, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == (CDKBUTTONBOX *)NULL ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKMatrix (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKMatrixBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Let them play. */ + activateCDKMatrix (widget, 0); + + /* Print out the matrix cells. */ + if (widget->exitType == vNORMAL) + { + for (x = 0; x < widget->rows; x++) + { + for (y = 0; y < widget->cols; y++) + { + char *data = getCDKMatrixCell (widget, x, y); + if (data != 0) + { + fprintf (fp, "%s%c", data, CTRL ('V')); + } + else + { + fprintf (fp, "%c", CTRL ('V')); + } + } + fprintf (fp, "\n"); + } + } + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* cleanup (not really needed) */ + CDKfreeStrings (buttonList); + free (colTypes); + free (colWidths); + + CDKfreeStrings (rowTemp); + CDKfreeStrings (colTemp); + CDKfreeStrings (kolTemp); + + destroyCDKMatrix (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* do this late, in case it was stderr */ + fclose (fp); + + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void)injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkmentry.c b/deps/cdk-5.0-20161210/cli/cdkmentry.c new file mode 100644 index 0000000..f282d44 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkmentry.c @@ -0,0 +1,270 @@ +/* $Id: cdkmentry.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkmentry"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-f Field Width -s Screen Rows -v Virtual Rows [-d Display Type] [-F Field Character] [-i Initial Value] [-m Minimum Length] [-T Title] [-L Label] [-B Buttons] [-O Output file] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKMENTRY *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + chtype *holder = 0; + chtype fieldAttr = 0; + char *answer = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + char filler = '.'; + EDisplayType dType = vMIXED; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **buttonList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *initValue; + char *label; + char *outputFile; + char *tempFiller; + char *title; + int fieldWidth; + int min; + int screenRows; + int virtualRows; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "d:f:i:m:s:v:B:F:L:O:T:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + fieldWidth = CDKparamValue (¶ms, 'f', 0); + min = CDKparamValue (¶ms, 'm', 0); + screenRows = CDKparamValue (¶ms, 's', 0); + virtualRows = CDKparamValue (¶ms, 'v', 0); + initValue = CDKparamString (¶ms, 'i'); + buttons = CDKparamString (¶ms, 'B'); + tempFiller = CDKparamString (¶ms, 'F'); + label = CDKparamString (¶ms, 'L'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + if ((temp = CDKparamString (¶ms, 'd')) != 0) + dType = char2DisplayType (temp); + + /* Make sure all the command line parameters were provided. */ + if ((fieldWidth <= 0) || (screenRows <= 0) || (virtualRows <= 0)) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* If the set the filler character, set it now. */ + if (tempFiller != 0) + { + holder = char2Chtype (tempFiller, &j1, &j2); + fieldAttr = A_ATTRIBUTES & holder[0]; + filler = (char)holder[0]; + freeChtype (holder); + } + /* Create the mentry widget. */ + widget = newCDKMentry (cdkScreen, xpos, ypos, + title, label, + fieldAttr, + (chtype)filler | fieldAttr, + dType, fieldWidth, + screenRows, virtualRows, + min, boxWidget, shadowWidget); + + /* Check to make sure we created the dialog box. */ + if (widget == 0) + { + /* Shut down curses and CDK. */ + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the multiple line entry field. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + NULL, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKMentryLLChar (widget, ACS_LTEE); + setCDKMentryLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vMENTRY, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vMENTRY, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vMENTRY, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == (CDKBUTTONBOX *)NULL ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKMentry (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKMentryBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* If there was an initial value, set it. */ + if (initValue != 0) + { + setCDKMentryValue (widget, initValue); + } + + /* Activate the widget. */ + answer = copyChar (activateCDKMentry (widget, 0)); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* End CDK. */ + destroyCDKMentry (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print the value from the widget. */ + if (answer != 0) + { + fprintf (fp, "%s\n", answer); + freeChar (answer); + } + fclose (fp); + + /* Exit with the button number picked. */ + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkradio.c b/deps/cdk-5.0-20161210/cli/cdkradio.c new file mode 100644 index 0000000..5f86c69 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkradio.c @@ -0,0 +1,293 @@ +/* $Id: cdkradio.c,v 1.13 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkradio"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-l List | -f filename [-c Choice Character] [-d Default Item] [-s Scroll Bar Position] [-n Numbers] [-i Item Index] [-T Title] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-H Height] [-W Width] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKRADIO *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + char *buttons = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype *holder = 0; + chtype *choiceChar = 0; + int answer = 0; + int spos = NONE; + int scrollLines = -1; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **buttonList = 0; + char **scrollList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean numberOutput; + boolean shadowWidget; + const char *choice; + char *filename; + char *list; + char *outputFile; + char *title; + int defaultItem; + int height; + int width; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "l:f:s:c:d:iB:O:T:" CDK_CLI_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + height = CDKparamValue (¶ms, 'H', 10); + width = CDKparamValue (¶ms, 'W', 1); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + defaultItem = CDKparamValue (¶ms, 'd', 0); + numberOutput = CDKparamValue (¶ms, 'i', FALSE); + filename = CDKparamString (¶ms, 'f'); + list = CDKparamString (¶ms, 'l'); + buttons = CDKparamString (¶ms, 'B'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + if ((choice = CDKparamString (¶ms, 'c')) == 0) + choice = "X"; + + spos = CDKparsePosition (CDKparamString (¶ms, 's')); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Did they provide a list of items. */ + if (list == 0) + { + /* Maybe they gave a filename to use to read. */ + if (filename != 0) + { + /* Read the file in. */ + scrollLines = CDKreadFile (filename, &scrollList); + + /* Check if there was an error. */ + if (scrollLines == -1) + { + fprintf (stderr, "Error: Could not open the file '%s'.\n", filename); + ExitProgram (CLI_ERROR); + } + } + else + { + /* They didn't provide anything. */ + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + } + else + { + /* Split the scroll lines up. */ + scrollList = CDKsplitString (list, '\n'); + scrollLines = (int)CDKcountStrings ((CDK_CSTRING2) scrollList); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Convert the char * choiceChar to a chtype * */ + choiceChar = char2Chtype (choice, &j1, &j2); + + /* Create the scrolling list. */ + widget = newCDKRadio (cdkScreen, xpos, ypos, spos, + height, width, title, + (CDK_CSTRING2) scrollList, scrollLines, + choiceChar[0], defaultItem, + A_REVERSE, + boxWidget, shadowWidget); + free (choiceChar); + + /* Make sure we could create the widget. */ + if (widget == 0) + { + CDKfreeStrings (scrollList); + + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the radio list. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + NULL, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKRadioLLChar (widget, ACS_LTEE); + setCDKRadioLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vRADIO, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vRADIO, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vRADIO, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == (CDKBUTTONBOX *)NULL ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKRadio (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKRadioBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Activate the scrolling list. */ + answer = activateCDKRadio (widget, 0); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* Shut down curses. */ + destroyCDKRadio (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print out the answer. */ + if (answer >= 0) + { + if (numberOutput == TRUE) + { + fprintf (fp, "%d\n", answer); + } + else + { + fprintf (fp, "%s\n", scrollList[answer]); + } + } + fclose (fp); + + CDKfreeStrings (scrollList); + + /* Exit with the button selected. */ + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkscale.c b/deps/cdk-5.0-20161210/cli/cdkscale.c new file mode 100644 index 0000000..d658942 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkscale.c @@ -0,0 +1,281 @@ +/* $Id: cdkscale.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkscale"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-f Field Width -l Low Value -h High Value [-s Initial Value]] [-i Increment Value] [-a Accelerated Increment Value] [-T Title] [-L Label] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKSCALE *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype *holder = 0; + int answer = 0; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **buttonList = 0; + int tmp, j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *label; + char *outputFile; + char *title; + int fieldWidth; + int incrementStep; + int acceleratedStep; + int initValue; + int lowValue; + int highValue; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "a:f:h:i:l:s:B:L:O:T:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + acceleratedStep = CDKparamValue (¶ms, 'a', -1); + fieldWidth = CDKparamValue (¶ms, 'f', 0); + highValue = CDKparamValue (¶ms, 'h', INT_MIN); + incrementStep = CDKparamValue (¶ms, 'i', 1); + lowValue = CDKparamValue (¶ms, 'l', INT_MAX); + initValue = CDKparamValue (¶ms, 's', INT_MIN); + buttons = CDKparamString (¶ms, 'B'); + label = CDKparamString (¶ms, 'L'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + incrementStep = abs (incrementStep); + + /* Make sure all the command line parameters were provided. */ + if (fieldWidth <= 0) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* Make sure the user supplied the low/high values. */ + if ((lowValue == INT_MAX) || (highValue == INT_MIN)) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Make sure the low is lower than the high (and vice versa). */ + if (lowValue > highValue) + { + /* *INDENT-EQLS* */ + tmp = lowValue; + lowValue = highValue; + highValue = tmp; + } + + /* Make sure the starting value is in range. */ + if (initValue < lowValue) + { + initValue = lowValue; + } + else if (initValue > highValue) + { + initValue = highValue; + } + + /* Check if the accelerated incremnt value was set. */ + if (acceleratedStep <= 0) + { + acceleratedStep = (int)((highValue - lowValue) / 10); + acceleratedStep = MAXIMUM (1, acceleratedStep); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the entry widget. */ + widget = newCDKScale (cdkScreen, xpos, ypos, + title, label, + A_NORMAL, fieldWidth, + initValue, lowValue, highValue, + incrementStep, acceleratedStep, + boxWidget, shadowWidget); + + /* Check to make sure we created the dialog box. */ + if (widget == 0) + { + /* Shut down curses and CDK. */ + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the numeric scale field. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + 0, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKScaleLLChar (widget, ACS_LTEE); + setCDKScaleLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vSCALE, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vSCALE, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vSCALE, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKScale (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKScaleBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Activate the widget. */ + answer = activateCDKScale (widget, 0); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* End CDK. */ + destroyCDKScale (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print the value from the widget. */ + fprintf (fp, "%d\n", answer); + fclose (fp); + + /* Exit with the answer. */ + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkscroll.c b/deps/cdk-5.0-20161210/cli/cdkscroll.c new file mode 100644 index 0000000..42d13b4 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkscroll.c @@ -0,0 +1,284 @@ +/* $Id: cdkscroll.c,v 1.13 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkscroll"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-l List | -f filename [-s Scroll Bar Position] [-n Numbers] [-i Item Index] [-T Title] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-H Height] [-W Width] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKSCROLL *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype *holder = 0; + int answer = 0; + int spos = NONE; + int buttonCount = 0; + int selection = 0; + int scrollLines = -1; + int shadowHeight = 0; + FILE *fp = stderr; + char **scrollList = 0; + char **buttonList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *filename; + char *list; + char *outputFile; + char *title; + int height; + int numberOutput; + int numbers; + int width; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "f:il:ns:B:O:T:" CDK_CLI_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + height = CDKparamValue (¶ms, 'H', 1); + width = CDKparamValue (¶ms, 'W', 1); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + numberOutput = CDKparamValue (¶ms, 'i', FALSE); + numbers = CDKparamValue (¶ms, 'n', FALSE); + filename = CDKparamString (¶ms, 'f'); + list = CDKparamString (¶ms, 'l'); + buttons = CDKparamString (¶ms, 'B'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + spos = CDKparsePosition (CDKparamString (¶ms, 's')); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Did they provide a list of items. */ + if (list == 0) + { + /* Maybe they gave a filename to use to read. */ + if (filename != 0) + { + /* Read the file in. */ + scrollLines = CDKreadFile (filename, &scrollList); + + /* Check if there was an error. */ + if (scrollLines == -1) + { + fprintf (stderr, "Error: Could not open the file '%s'.\n", filename); + ExitProgram (CLI_ERROR); + } + } + else + { + /* They didn't provide anything. */ + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + } + else + { + /* Split the scroll lines up. */ + scrollList = CDKsplitString (list, '\n'); + scrollLines = (int)CDKcountStrings ((CDK_CSTRING2) scrollList); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the scrolling list. */ + widget = newCDKScroll (cdkScreen, xpos, ypos, spos, + height, width, title, + (CDK_CSTRING2) scrollList, scrollLines, + numbers, A_REVERSE, + boxWidget, shadowWidget); + + /* Make sure we could create the widget. */ + if (widget == 0) + { + CDKfreeStrings (scrollList); + + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the scrolling list. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + 0, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKScrollLLChar (widget, ACS_LTEE); + setCDKScrollLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vSCROLL, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vSCROLL, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vSCROLL, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKScroll (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKScrollBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Activate the scrolling list. */ + answer = activateCDKScroll (widget, 0); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* Shut down curses. */ + destroyCDKScroll (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print out the answer. */ + if (answer >= 0) + { + if (numberOutput == TRUE) + { + fprintf (fp, "%d\n", answer); + } + else + { + fprintf (fp, "%s\n", scrollList[answer]); + } + } + fclose (fp); + + CDKfreeStrings (scrollList); + + /* Exit with the answer. */ + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkselection.c b/deps/cdk-5.0-20161210/cli/cdkselection.c new file mode 100644 index 0000000..421d3c6 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkselection.c @@ -0,0 +1,341 @@ +/* $Id: cdkselection.c,v 1.15 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkselection"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-l List | -f filename [-c Choices ] [-s Selection Bar Position] [-T Title] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-H Height] [-W Width] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKSELECTION *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + chtype *holder = 0; + char *item = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + int scrollLines = -1; + int choiceSize = -1; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **scrollList = 0; + char **choiceList = 0; + char **buttonList = 0; + char **items = 0; + int choiceValues[MAX_ITEMS]; + int editModes[MAX_ITEMS]; + int x, fields, j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *buttons; + char *choices; + char *filename; + char *list; + char *outputFile; + char *title; + int height; + int numbers; + int spos; + int width; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "c:f:ln:s:B:O:T:" CDK_CLI_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + height = CDKparamValue (¶ms, 'H', 10); + width = CDKparamValue (¶ms, 'W', 10); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + choices = CDKparamString (¶ms, 'c'); + filename = CDKparamString (¶ms, 'f'); + list = CDKparamString (¶ms, 'l'); + buttons = CDKparamString (¶ms, 'B'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + numbers = CDKparamValue (¶ms, 'n', FALSE); + spos = CDKparsePosition (CDKparamString (¶ms, 's')); + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Did they provide a list of items. */ + if (list == 0) + { + /* Maybe they gave a filename to use to read. */ + if (filename != 0) + { + /* Read the file in. */ + scrollLines = CDKreadFile (filename, &scrollList); + + /* Check if there was an error. */ + if (scrollLines == -1) + { + fprintf (stderr, "Error: Could not open the file '%s'.\n", filename); + ExitProgram (CLI_ERROR); + } + + /* + * For each line, we will split on a CTRL-V and look for a selection + * value/edit mode. The format of the input file can be the following: + * Index value [choice value] [edit flag] + */ + for (x = 0; x < scrollLines; x++) + { + /* Split the line on CTRL-V. */ + items = CDKsplitString (scrollList[x], CTRL ('V')); + fields = (int)CDKcountStrings ((CDK_CSTRING2)items); + + /* Check the field count. */ + if (fields == 1) + { + choiceValues[x] = 0; + editModes[x] = 0; + } + else if (fields == 2) + { + freeChar (scrollList[x]); + scrollList[x] = copyChar (items[0]); + + choiceValues[x] = (int)atoi (items[1]); + editModes[x] = 0; + } + else if (fields == 3) + { + freeChar (scrollList[x]); + scrollList[x] = copyChar (items[0]); + + choiceValues[x] = (int)atoi (items[1]); + editModes[x] = (int)atoi (items[2]); + } + + CDKfreeStrings (items); + } + } + else + { + /* They didn't provide anything. */ + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + } + else + { + /* Split the scroll lines up. */ + scrollList = CDKsplitString (list, '\n'); + scrollLines = (int)CDKcountStrings ((CDK_CSTRING2)scrollList); + } + + /* Did they supply a chopice list. */ + if (choices == 0) + { + choiceList = calloc(sizeof(char *), 3); + choiceList[0] = copyChar ("Yes "); + choiceList[1] = copyChar ("No "); + choiceSize = 2; + } + else + { + /* Split the choices up. */ + choiceList = CDKsplitString (choices, '\n'); + choiceSize = (int)CDKcountStrings ((CDK_CSTRING2)choiceList); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the scrolling list. */ + widget = newCDKSelection (cdkScreen, xpos, ypos, spos, + height, width, title, + (CDK_CSTRING2)scrollList, scrollLines, + (CDK_CSTRING2)choiceList, choiceSize, + A_REVERSE, + boxWidget, shadowWidget); + CDKfreeStrings (choiceList); + + /* Make sure we could create the widget. */ + if (widget == 0) + { + CDKfreeStrings (scrollList); + + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the selection list. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Set up the default selection choices. */ + setCDKSelectionChoices (widget, choiceValues); + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2)buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + 0, 1, buttonCount, + (CDK_CSTRING2)buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKSelectionLLChar (widget, ACS_LTEE); + setCDKSelectionLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vSELECTION, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vSELECTION, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vSELECTION, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKSelection (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKSelectionBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Set up the default selection modes. */ + setCDKSelectionModes (widget, editModes); + + /* Activate the selection list. */ + activateCDKSelection (widget, 0); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* Print out the answer. */ + for (x = 0; x < scrollLines; x++) + { + holder = char2Chtype (scrollList[x], &j1, &j2); + item = chtype2Char (holder); + fprintf (fp, "%d %s\n", widget->selections[x], item); + freeChtype (holder); + freeChar (item); + } + + CDKfreeStrings (scrollList); + + /* Shut down curses. */ + destroyCDKSelection (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void)injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkslider.c b/deps/cdk-5.0-20161210/cli/cdkslider.c new file mode 100644 index 0000000..bf752d4 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkslider.c @@ -0,0 +1,290 @@ +/* $Id: cdkslider.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkslider"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-f Field Width -l Low Value -h High Value [-s Initial Value]] [-i Increment Value] [-a Accelerated Increment Value] [-F Field Character] [-T Title] [-L Label] [-B Buttons] [-O Output File] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKSLIDER *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype *holder = 0; + chtype fieldAttr = A_REVERSE | ' '; + int answer = 0; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **buttonList = 0; + int j1, j2, tmp; + + CDK_PARAMS params; + boolean boxWidget; + boolean shadowWidget; + char *barAttribute; + char *buttons; + char *label; + char *outputFile; + char *title; + int fieldWidth; + int incrementStep; + int acceleratedStep; + int initValue; + int lowValue; + int highValue; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "a:f:h:i:l:s:B:F:L:O:T:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + acceleratedStep = CDKparamValue (¶ms, 'a', -1); + fieldWidth = CDKparamValue (¶ms, 'f', 0); + highValue = CDKparamValue (¶ms, 'h', INT_MIN); + incrementStep = CDKparamValue (¶ms, 'i', 1); + lowValue = CDKparamValue (¶ms, 'l', INT_MAX); + initValue = CDKparamValue (¶ms, 's', INT_MIN); + buttons = CDKparamString (¶ms, 'B'); + barAttribute = CDKparamString (¶ms, 'F'); + label = CDKparamString (¶ms, 'L'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + incrementStep = abs (incrementStep); + + /* Make sure all the command line parameters were provided. */ + if (fieldWidth <= 0) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* Make sure the user supplied the low/high values. */ + if ((lowValue == INT_MAX) || (highValue == INT_MIN)) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + /* Make sure the low is lower than the high (and vice versa). */ + if (lowValue > highValue) + { + tmp = lowValue; + lowValue = highValue; + highValue = tmp; + } + + /* Make sure the starting value is in range. */ + if (initValue < lowValue) + { + initValue = lowValue; + } + else if (initValue > highValue) + { + initValue = highValue; + } + + /* Check if the accelerated incremnt value was set. */ + if (acceleratedStep <= 0) + { + acceleratedStep = (int)((highValue - lowValue) / 10); + acceleratedStep = MAXIMUM (1, acceleratedStep); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Did the user ask to change the bar attribute? */ + if (barAttribute != 0) + { + holder = char2Chtype (barAttribute, &j1, &j2); + fieldAttr = holder[0]; + freeChtype (holder); + } + + /* Create the entry widget. */ + widget = newCDKSlider (cdkScreen, xpos, ypos, + title, label, + fieldAttr, fieldWidth, + initValue, lowValue, highValue, + incrementStep, acceleratedStep, + boxWidget, shadowWidget); + + /* Check to make sure we created the dialog box. */ + if (widget == 0) + { + /* Shut down curses and CDK. */ + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the numeric slider field. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + 0, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + CDKfreeStrings (buttonList); + + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKSliderLLChar (widget, ACS_LTEE); + setCDKSliderLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vSLIDER, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vSLIDER, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vSLIDER, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKSlider (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKSliderBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Activate the widget. */ + answer = activateCDKSlider (widget, 0); + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* End CDK. */ + destroyCDKSlider (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print the value from the widget. */ + fprintf (fp, "%d\n", answer); + fclose (fp); + + /* Exit with the button selected. */ + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdktemplate.c b/deps/cdk-5.0-20161210/cli/cdktemplate.c new file mode 100644 index 0000000..a8e43a1 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdktemplate.c @@ -0,0 +1,264 @@ +/* $Id: cdktemplate.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdktemplate"; +#endif + +/* + * Declare file local prototypes. + */ +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-p Plate [-o Overlay] [-P Mix Plate] [-d Default Answer] [-m Minimum Length] [-T Title] [-L Label] [-B Buttons] [-O Output file] [-X X Position] [-Y Y Position] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKTEMPLATE *widget = 0; + CDKBUTTONBOX *buttonWidget = 0; + char *answer = 0; + char *tmp = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype *holder = 0; + int buttonCount = 0; + int selection = 0; + int shadowHeight = 0; + FILE *fp = stderr; + char **buttonList = 0; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean mixPlate; + boolean shadowWidget; + char *buttons; + char *defaultAnswer; + char *label; + char *my_overlay; + char *outputFile; + char *plate; + char *title; + int minimum; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "d:m:o:p:B:L:O:P:T:" CDK_MIN_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + minimum = CDKparamValue (¶ms, 'm', 0); + mixPlate = CDKparamValue (¶ms, 'P', FALSE); + defaultAnswer = CDKparamString (¶ms, 'd'); + my_overlay = CDKparamString (¶ms, 'o'); + plate = CDKparamString (¶ms, 'p'); + buttons = CDKparamString (¶ms, 'B'); + label = CDKparamString (¶ms, 'L'); + outputFile = CDKparamString (¶ms, 'O'); + title = CDKparamString (¶ms, 'T'); + + /* Make sure all the command line parameters were provided. */ + if (plate == 0) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* If the user asked for an output file, try to open it. */ + if (outputFile != 0) + { + if ((fp = fopen (outputFile, "w")) == 0) + { + fprintf (stderr, "%s: Can not open output file %s\n", argv[0], outputFile); + ExitProgram (CLI_ERROR); + } + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the template widget. */ + widget = newCDKTemplate (cdkScreen, xpos, ypos, + title, label, + plate, my_overlay, + boxWidget, shadowWidget); + + /* Check to make sure we created the widget. */ + if (widget == 0) + { + /* Shut down curses and CDK. */ + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the template field. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Split the buttons if they supplied some. */ + if (buttons != 0) + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2) buttonList); + + /* We need to create a buttonbox widget. */ + buttonWidget = newCDKButtonbox (cdkScreen, + getbegx (widget->win), + (getbegy (widget->win) + + widget->boxHeight - 1), + 1, widget->boxWidth - 1, + 0, 1, buttonCount, + (CDK_CSTRING2) buttonList, buttonCount, + A_REVERSE, boxWidget, FALSE); + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * We need to set the lower left and right + * characters of the widget. + */ + setCDKTemplateLLChar (widget, ACS_LTEE); + setCDKTemplateLRChar (widget, ACS_RTEE); + + /* + * Bind the Tab key in the widget to send a + * Tab key to the button box widget. + */ + bindCDKObject (vTEMPLATE, widget, KEY_TAB, widgetCB, buttonWidget); + bindCDKObject (vTEMPLATE, widget, CDK_NEXT, widgetCB, buttonWidget); + bindCDKObject (vTEMPLATE, widget, CDK_PREV, widgetCB, buttonWidget); + + /* Check if the user wants to set the background of the widget. */ + setCDKButtonboxBackgroundColor (buttonWidget, CDK_WIDGET_COLOR); + + /* Draw the button widget. */ + drawCDKButtonbox (buttonWidget, boxWidget); + } + + /* + * If the user asked for a shadow, we need to create one. Do this instead + * of using the shadow parameter because the button widget is not part of + * the main widget and if the user asks for both buttons and a shadow, we + * need to create a shadow big enough for both widgets. Create the shadow + * window using the widgets shadowWin element, so screen refreshes will draw + * them as well. + */ + if (shadowWidget == TRUE) + { + /* Determine the height of the shadow window. */ + shadowHeight = (buttonWidget == 0 ? + widget->boxHeight : + widget->boxHeight + buttonWidget->boxHeight - 1); + + /* Create the shadow window. */ + widget->shadowWin = newwin (shadowHeight, + widget->boxWidth, + getbegy (widget->win) + 1, + getbegx (widget->win) + 1); + + /* Make sure we could have created the shadow window. */ + if (widget->shadowWin != 0) + { + widget->shadow = TRUE; + + /* + * We force the widget and buttonWidget to be drawn so the + * buttonbox widget will be drawn when the widget is activated. + * Otherwise the shadow window will draw over the button widget. + */ + drawCDKTemplate (widget, ObjOf (widget)->box); + eraseCDKButtonbox (buttonWidget); + drawCDKButtonbox (buttonWidget, ObjOf (buttonWidget)->box); + } + } + + /* Check if the user wants to set the background of the widget. */ + setCDKTemplateBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* If a default answer were proivded, set it in the widget. */ + if (defaultAnswer != 0) + { + setCDKTemplateValue (widget, defaultAnswer); + } + + /* If the user asked for a minimum value, set it. */ + setCDKTemplateMin (widget, minimum); + + /* Activate the widget. */ + tmp = activateCDKTemplate (widget, 0); + + /* If the user asked for plate mixing, give it to them. */ + if (mixPlate == TRUE) + { + answer = mixCDKTemplate (widget); + } + else + { + answer = copyChar (tmp); + } + + /* If there were buttons, get the button selected. */ + if (buttonWidget != 0) + { + selection = buttonWidget->currentButton; + destroyCDKButtonbox (buttonWidget); + } + + /* End CDK. */ + destroyCDKTemplate (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Print the value from the widget. */ + if (answer != 0) + { + fprintf (fp, "%s\n", answer); + freeChar (answer); + } + fclose (fp); + + /* Exit with the button number picked. */ + ExitProgram (selection); +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void) injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/cdkviewer.c b/deps/cdk-5.0-20161210/cli/cdkviewer.c new file mode 100644 index 0000000..58c8ea9 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/cdkviewer.c @@ -0,0 +1,285 @@ +/* $Id: cdkviewer.c,v 1.15 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef XCURSES +char *XCursesProgramName = "cdkviewer"; +#endif + +/* + * Declare file local prototypes. + */ +static void saveInformation (CDKVIEWER *widget); +static int dumpViewer (CDKVIEWER *widget, char *filename); +static int widgetCB (EObjectType cdktype, void *object, void *clientData, chtype key); + +/* + * Define file local variables. + */ +static const char *FPUsage = "-f filename [-i Interpret] [-l Show Line Stats] [-T Title] [-B Buttons] [-X X Position] [-Y Y Position] [-H Height] [-W Width] [-N] [-S]"; + +/* + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKVIEWER *widget = 0; + char *filename = 0; + char *CDK_WIDGET_COLOR = 0; + char *temp = 0; + chtype *holder = 0; + int answer = 0; + int messageLines = -1; + int buttonCount = 0; + char **messageList = 0; + char **buttonList = 0; + char tempTitle[256]; + int j1, j2; + + CDK_PARAMS params; + boolean boxWidget; + boolean interpret; + boolean shadowWidget; + boolean showInfoLine; + char *buttons; + char *title; + int height; + int width; + int xpos; + int ypos; + + CDKparseParams (argc, argv, ¶ms, "f:il:B:T:" CDK_CLI_PARAMS); + + /* *INDENT-EQLS* */ + xpos = CDKparamValue (¶ms, 'X', CENTER); + ypos = CDKparamValue (¶ms, 'Y', CENTER); + height = CDKparamValue (¶ms, 'H', 20); + width = CDKparamValue (¶ms, 'W', 60); + boxWidget = CDKparamValue (¶ms, 'N', TRUE); + shadowWidget = CDKparamValue (¶ms, 'S', FALSE); + interpret = CDKparamValue (¶ms, 'i', FALSE); + showInfoLine = CDKparamValue (¶ms, 'l', FALSE); + filename = CDKparamString (¶ms, 'f'); + buttons = CDKparamString (¶ms, 'B'); + title = CDKparamString (¶ms, 'T'); + + /* Make sure they gave us a file to read. */ + if (filename == 0) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (CLI_ERROR); + } + + /* Read the file in. */ + messageLines = CDKreadFile (filename, &messageList); + + /* Check if there was an error. */ + if (messageLines == -1) + { + fprintf (stderr, "Error: Could not open the file %s\n", filename); + ExitProgram (CLI_ERROR); + } + + /* Set up the buttons of the viewer. */ + if (buttons == 0) + { + /* *INDENT-EQLS* */ + buttonList = calloc(sizeof(char *), 3); + buttonList[0] = copyChar ("OK"); + buttonList[1] = copyChar ("Cancel"); + buttonCount = 2; + } + else + { + /* Split the button list up. */ + buttonList = CDKsplitString (buttons, '\n'); + buttonCount = (int)CDKcountStrings ((CDK_CSTRING2)buttonList); + } + + /* Set up the title of the viewer. */ + if (title == 0) + { + sprintf (tempTitle, "Filename: %s", filename); + title = copyChar (tempTitle); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Check if the user wants to set the background of the main screen. */ + if ((temp = getenv ("CDK_SCREEN_COLOR")) != 0) + { + holder = char2Chtype (temp, &j1, &j2); + wbkgd (cdkScreen->window, holder[0]); + wrefresh (cdkScreen->window); + freeChtype (holder); + } + + /* Get the widget color background color. */ + if ((CDK_WIDGET_COLOR = getenv ("CDK_WIDGET_COLOR")) == 0) + { + CDK_WIDGET_COLOR = 0; + } + + /* Create the viewer widget. */ + widget = newCDKViewer (cdkScreen, xpos, ypos, height, width, + (CDK_CSTRING2)buttonList, buttonCount, A_REVERSE, + boxWidget, shadowWidget); + + /* Check to make sure we created the file viewer. */ + if (widget == 0) + { + CDKfreeStrings (messageList); + CDKfreeStrings (buttonList); + + /* Shut down curses and CDK. */ + destroyCDKScreen (cdkScreen); + endCDK (); + + fprintf (stderr, + "Error: Could not create the file viewer. " + "Is the window too small?\n"); + + ExitProgram (CLI_ERROR); + } + + /* Check if the user wants to set the background of the widget. */ + setCDKViewerBackgroundColor (widget, CDK_WIDGET_COLOR); + + /* Set a binding for saving the info. */ + bindCDKObject (vVIEWER, widget, 'S', widgetCB, 0); + + /* Set the information needed for the viewer. */ + setCDKViewer (widget, title, (CDK_CSTRING2)messageList, messageLines, + A_REVERSE, interpret, showInfoLine, TRUE); + + /* Activate the viewer. */ + answer = activateCDKViewer (widget, 0); + + CDKfreeStrings (messageList); + CDKfreeStrings (buttonList); + + destroyCDKViewer (widget); + destroyCDKScreen (cdkScreen); + endCDK (); + + /* Exit with the button number picked. */ + ExitProgram (answer); +} + +/* + * This function allows the user to dump the + * information from the viewer into a file. + */ +static void saveInformation (CDKVIEWER *widget) +{ + /* *INDENT-EQLS* */ + CDKENTRY *entry = 0; + char *filename = 0; + char temp[256]; + const char *mesg[10]; + int linesSaved; + + /* Create the entry field to get the filename. */ + entry = newCDKEntry (ScreenOf (widget), CENTER, CENTER, + "Enter the filename of the save file.", + "Filename: ", + A_NORMAL, '_', vMIXED, + 20, 1, 256, + TRUE, FALSE); + + /* Get the filename. */ + filename = activateCDKEntry (entry, 0); + + /* Did they hit escape? */ + if (entry->exitType == vESCAPE_HIT) + { + /* Popup a message. */ + mesg[0] = "Save Canceled."; + mesg[1] = "Escape hit. Scrolling window information not saved."; + mesg[2] = " "; + mesg[3] = "Press any key to continue."; + popupLabel (ScreenOf (widget), (CDK_CSTRING2)mesg, 4); + + destroyCDKEntry (entry); + return; + } + + /* Write the contents of the viewer to the file. */ + linesSaved = dumpViewer (widget, filename); + + /* Was the save successful? */ + if (linesSaved == -1) + { + /* Nope, tell 'em. */ + mesg[0] = "Error"; + mesg[1] = "Could not save to the file."; + sprintf (temp, "(%s)", filename); + mesg[2] = temp; + mesg[3] = " "; + mesg[4] = "Press any key to continue."; + popupLabel (ScreenOf (widget), (CDK_CSTRING2)mesg, 5); + } + else + { + char *msg_1; + + mesg[0] = "Save Successful"; + sprintf (temp, "There were %d lines saved to the file", linesSaved); + mesg[1] = msg_1 = copyChar (temp); + sprintf (temp, "(%s)", filename); + mesg[2] = temp; + mesg[3] = " "; + mesg[4] = "Press any key to continue."; + popupLabel (ScreenOf (widget), (CDK_CSTRING2)mesg, 5); + freeChar (msg_1); + } + + destroyCDKEntry (entry); + eraseCDKScreen (ScreenOf (widget)); + drawCDKScreen (ScreenOf (widget)); +} + +/* + * This actually dumps the information from the viewer to a file. + */ +static int dumpViewer (CDKVIEWER *widget, char *filename) +{ + /* *INDENT-EQLS* */ + FILE *outputFile = 0; + char *rawLine = 0; + int listSize; + chtype **list = getCDKViewerInfo (widget, &listSize); + int x; + + /* Try to open the file. */ + if ((outputFile = fopen (filename, "w")) == 0) + { + return -1; + } + + /* Start writing out the file. */ + for (x = 0; x < listSize; x++) + { + rawLine = chtype2Char (list[x]); + fprintf (outputFile, "%s\n", rawLine); + freeChar (rawLine); + } + + /* Close the file and return the number of lines written. */ + fclose (outputFile); + return listSize; +} + +static int widgetCB (EObjectType cdktype GCC_UNUSED, void *object, + void *clientData GCC_UNUSED, + chtype key GCC_UNUSED) +{ + CDKVIEWER *widget = (CDKVIEWER *)object; + saveInformation (widget); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/cli/samples/alphalist.sh b/deps/cdk-5.0-20161210/cli/samples/alphalist.sh new file mode 100755 index 0000000..44dd92d --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/alphalist.sh @@ -0,0 +1,116 @@ +#!/bin/sh +# $Id: alphalist.sh,v 1.7 2005/12/27 16:04:57 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the alphalist widget. +# + +# +# This gets the password file. +# +getPasswordFile() +{ + system=$1 + file=$2 + + # + # Depeding on the system, get the password file + # using nicat, ypcat, or just plain old /etc/passwd + # + if [ "$system" = "NIS" ]; then + niscat passwd.org_dir > $file + elif [ "$system" = "YP" ]; then + ypcat passwd > $file + else + cp /etc/passwd $file + fi +} + +# +# This displays account information. +# +displayAccountInformation() +{ + userAccount=$1 + passwordFile=$2 + + # + # Get the user account information. + # + line=`grep "^${userAccount}" $passwordFile` + uid=`echo $line | cut -d: -f3` + gid=`echo $line | cut -d: -f4` + info=`echo $line | cut -d: -f5` + home=`echo $line | cut -d: -f6` + shell=`echo $line | cut -d: -f7` + + # + # Create the label message information. + # + accountMessage="Account +<#HL(30)> +Account: ${userAccount} +UID : ${uid} +GID : ${gid} +Info : ${info} +Home : ${home} +Shell : ${shell} +<#HL(30)> +Hit space to continue" + + # + # Create the popup label. + # + ${CDK_LABEL} -m "${accountMessage}" -p " " +} + +# +# Create some global variables. +# +CDK_ALPHALIST="${CDK_BINDIR=..}/cdkalphalist" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +tmpPass="${TMPDIR=/tmp}/sl.$$" +output="${TMPDIR=/tmp}/alphalist.$$" +userAccounts="${TMPDIR=/tmp}/ua.$$" + +# +# Create the message for the scrolling list. +# +title="Pick an account +you want to view." + +# +# Get the password file and stick it into the temp file. +# +#getPasswordFile "YP" "$tmpPass" +#getPasswordFile "NIS" "$tmpPass" +getPasswordFile "Other" "$tmpPass" + +# +# Get the user account from the password file. +# +awk 'BEGIN {FS=":"} {printf "%s\n", $1}' $tmpPass | sort > ${userAccounts} + +# +# Create the scrolling list. +# +${CDK_ALPHALIST} -T "${title}" -f ${userAccounts} -H -10 -W -20 2> ${output} +selected=$? +test $selected = 255 && exit 1 + +answer=`sed -e 's/^[ ]*//' -e 's/[ ]*$//' ${output}` + +# +# Display the account information. +# +if [ -n "$answer" ]; then + displayAccountInformation $answer $tmpPass +fi + +# +# Clean up. +# +rm -f ${output} ${tmpPass} ${userAccounts} diff --git a/deps/cdk-5.0-20161210/cli/samples/calendar.sh b/deps/cdk-5.0-20161210/cli/samples/calendar.sh new file mode 100755 index 0000000..e92ccf9 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/calendar.sh @@ -0,0 +1,89 @@ +#!/bin/sh +# $Id: calendar.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the celendar widget. +# + +# +# Create some global variables. +# +CDK_CALENDAR="${CDK_BINDIR=..}/cdkcalendar" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +date="${TMPDIR=/tmp}/cal.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +xpos=CENTER +ypos=CENTER + +# +# Get today's date. +# +day=`date +%d` +month=`date +%m` +year=`date +%Y` + +# +# Chop up the command line. +# +set -- `getopt d:m:y:X:Y: $*` +if [ $? != 0 ] +then + echo $USAGE + exit 2 +fi +for c in $* +do + case $c in + -d) day=$2; shift 2;; + -m) month=$2; shift 2;; + -y) year=$2; shift 2;; + -X) xpos=$2; shift 2;; + -Y) ypos=$2; shift 2;; + --) shift; break;; + esac +done + +# +# Create the title and buttons. +# +title="<#HL(22)> +Select a date +<#HL(22)>" +buttons=" OK +Cancel " + +# +# Create the calendar widget. +# +${CDK_CALENDAR} -B "${buttons}" -d ${day} -m ${month} -y ${year} -T "${title}" -X ${xpos} -Y ${ypos} -O ${date} -S +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${date}` + +# +# Create the message for the label widget. +# +echo "You chose the following date" > ${tmp} +echo " " >> ${tmp} +echo "<#HL(10)>" >> ${tmp} +echo "${answer}" >> ${tmp} +echo "<#HL(10)>" >> ${tmp} +echo " " >> ${tmp} +echo "You chose button #${selected}" >> ${tmp} +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${date} diff --git a/deps/cdk-5.0-20161210/cli/samples/dialog.sh b/deps/cdk-5.0-20161210/cli/samples/dialog.sh new file mode 100755 index 0000000..ac866fb --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/dialog.sh @@ -0,0 +1,88 @@ +#!/bin/sh +# $Id: dialog.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the dialog widget. +# + +# +# Create some global variables. +# +CDK_DIALOG="${CDK_BINDIR=..}/cdkdialog" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +output="${TMPDIR=/tmp}/dialog_output.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Create the message for the scrolling list. +# +message="Pick which command +you wish to run." + +# +# Create the button labels. +# +commands="who +w +uptime +date +pwd +whoami +df +fortune" + +# +# Create the dialog box. +# +${CDK_DIALOG} -m "${message}" -B "${commands}" 2> ${output} +selection=$? +if [ "$selection" -eq 255 ]; then + exit; +fi + +# +# Create the message for the label widget. +# +echo "Here is the result of the command" > ${tmp} +echo " " >> ${tmp} + +# +# Determine which command to run. +# +if [ "${selection}" -eq 0 ]; then + who | awk '{printf "%s\n", $0}' >> ${tmp} +elif [ "${selection}" -eq 1 ]; then + w | awk '{printf "%s\n", $0}' >> ${tmp} +elif [ "${selection}" -eq 2 ]; then + uptime | awk '{printf "%s\n", $0}' >> ${tmp} +elif [ "${selection}" -eq 3 ]; then + date | awk '{printf "%s\n", $0}' >> ${tmp} +elif [ "${selection}" -eq 4 ]; then + pwd | awk '{printf "%s\n", $0}' >> ${tmp} +elif [ "${selection}" -eq 5 ]; then + whoami | awk '{printf "%s\n", $0}' >> ${tmp} +elif [ "${selection}" -eq 6 ]; then + # + # We will use the label demo to do this. + # + ./label.sh + rm -f ${tmp} ${output} ${fileSystemList} + exit 0; +elif [ "${selection}" -eq 7 ]; then + fortune | awk '{printf "%s\n", $0}' >> ${tmp} +fi +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${output} ${fileSystemList} diff --git a/deps/cdk-5.0-20161210/cli/samples/entry.sh b/deps/cdk-5.0-20161210/cli/samples/entry.sh new file mode 100755 index 0000000..b5b19c3 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/entry.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# $Id: entry.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the entry widget. +# + +# +# Create some global variables. +# +CDK_ENTRY="${CDK_BINDIR=..}/cdkentry" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +output="${TMPDIR=/tmp}/entry_output.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Create the title. +# +title=" Type a simple string. " +buttons=" OK + Cancel " + +# +# Create the entry box. +# +${CDK_ENTRY} -f 20 -T "${title}" -B "${buttons}" -F "_ " -O ${output} -S +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${output}` + +# +# Create the message for the label widget. +# +echo "Here is the string you typed in" > ${tmp} +echo " " >> ${tmp} +echo "${answer}" >> ${tmp} +echo " " >> ${tmp} +echo "You chose button #${selected}" >> ${tmp} +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${output} diff --git a/deps/cdk-5.0-20161210/cli/samples/fselect.sh b/deps/cdk-5.0-20161210/cli/samples/fselect.sh new file mode 100755 index 0000000..4b334e3 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/fselect.sh @@ -0,0 +1,82 @@ +#!/bin/sh +# $Id: fselect.sh,v 1.4 2005/12/27 17:56:05 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the file selection widget. +# + +# +# Create some global variables. +# +CDK_FSELECT="${CDK_BINDIR=..}/cdkfselect" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +directory="." +label="File: " +title="Select a file" + +buttons=" OK + Cancel " + +xpos="CENTER" +ypos="CENTER" + +width=0 +height=-5 + +tmp="${TMPDIR=/tmp}/tmp.$$" +file="${TMPDIR=/tmp}/fs.$$" + +# +# Chop up the command line. +# +set -- `getopt d:L:T:X:Y:W:H: $*` +if [ $? != 0 ] +then + echo $USAGE + exit 2 +fi +for c in $* +do + case $c in + -d) directory=$2; shift 2;; + -T) title=$2; shift 2;; + -L) label=$2; shift 2;; + -X) xpos=$2; shift 2;; + -Y) ypos=$2; shift 2;; + -W) width=$2; shift 2;; + -H) height=$2; shift 2;; + --) shift; break;; + esac +done + +# +# Create the CDK file selector. +# +${CDK_FSELECT} -d "${directory}" -T "${title}" -L "${label}" -X ${xpos} -Y ${ypos} -W ${width} -H ${height} -B "${buttons}" 2> ${file} +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${file}` + +# +# Diplay the file the user selected. +# +echo "You selected the following file" > ${tmp} +echo " " >> ${tmp} +echo "<#HL(10)>" >> ${tmp} +echo "${answer}" >> ${tmp} +echo "<#HL(10)>" >> ${tmp} +echo " " >> ${tmp} +echo "You chose button #${selected}" >> ${tmp} +echo " " >> ${tmp} +echo "Press space to continue." >> ${tmp} + +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${file} diff --git a/deps/cdk-5.0-20161210/cli/samples/itemlist.sh b/deps/cdk-5.0-20161210/cli/samples/itemlist.sh new file mode 100755 index 0000000..54ad105 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/itemlist.sh @@ -0,0 +1,135 @@ +#!/bin/sh +# $Id: itemlist.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the itemlist list widget. +# + +# +# This gets the password file. +# +getPasswordFile() +{ + system=$1 + file=$2 + + # + # Depeding on the system, get the password file + # using nicat, ypcat, or just plain old /etc/passwd + # + if [ "$system" = "NIS" ]; then + niscat passwd.org_dir | sort > $file + elif [ "$system" = "YP" ]; then + ypcat passwd | sort > $file + else + sort /etc/passwd > $file + fi +} + +# +# This displays account information. +# +displayAccountInformation() +{ + userAccount=$1 + passwordFile=$2 + + # + # Get the user account information. + # + line=`grep "^${userAccount}" $passwordFile` + uid=`echo $line | cut -d: -f3` + gid=`echo $line | cut -d: -f4` + info=`echo $line | cut -d: -f5` + home=`echo $line | cut -d: -f6` + shell=`echo $line | cut -d: -f7` + + # + # Create the label message information. + # + accountMessage="Account +<#HL(30)> +Account: ${userAccount} +UID : ${uid} +GID : ${gid} +Info : ${info} +Home : ${home} +Shell : ${shell} +<#HL(30)> +Hit space to continue" + + # + # Create the popup label. + # + ${CDK_LABEL} -m "${accountMessage}" -p " " +} + +# +# Create some global variables. +# +CDK_ITEMLIST="${CDK_BINDIR=..}/cdkitemlist" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +tmpPass="${TMPDIR=/tmp}/sl.$$" +output="${TMPDIR=/tmp}/output.$$" +userAccounts="${TMPDIR=/tmp}/ua.$$" + +TYPE="Other"; + +# +# Chop up the command line. +# +set -- `getopt nNh $*` +if [ $? != 0 ] +then + echo $USAGE + exit 2 +fi +for c in $* +do + case $c in + -n) TYPE="YP"; shift;; + -N) TYPE="NIS"; shift;; + -h) echo "$0 [-n YP] [-N NIS+] [-h]"; exit 0;; + --) shift; break;; + esac +done + +# +# Create the message for the item list. +# +title="Pick an account you want to view." +label="Account Name " +buttons=" OK + Cancel " + +# +# Get the password file and stick it into the temp file. +# +getPasswordFile "${TYPE}" "$tmpPass" + +# +# Get the user account from the password file. +# +awk 'BEGIN {FS=":"} {printf "%s\n", $1}' $tmpPass | sort > ${userAccounts} + +# +# Create the item list. +# +${CDK_ITEMLIST} -d 3 -L "${label}" -T "${title}" -B "${buttons}" -f "${userAccounts}" 2> ${output} +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${output}` + +# +# Display the account information. +# +displayAccountInformation $answer $tmpPass + +# +# Clean up. +# +rm -f ${output} ${tmpPass} ${userAccounts} diff --git a/deps/cdk-5.0-20161210/cli/samples/label.sh b/deps/cdk-5.0-20161210/cli/samples/label.sh new file mode 100755 index 0000000..4fbf49a --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/label.sh @@ -0,0 +1,81 @@ +#!/bin/sh +# $Id: label.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the label widget. +# + +# +# Create some global variables. +# +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +dfTmp="${TMPDIR=/tmp}/label.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" +top="${TMPDIR=/tmp}/dfTop.$$" +bottom="${TMPDIR=/tmp}/dfBottom.$$" + +# +# Get the filesystem information. +# +getDiskInfo() +{ + fileName=$1; + command="df" + + # + # Determine the type of operating system. + # + machine=`uname -s` + if [ "$machine" = "SunOS" ]; then + level=`uname -r` + + if [ "$level" -gt 4 ]; then + command="df -kl" + fi + else + if [ "$machine" = "AIX" ]; then + command="df -i" + fi + fi + + # + # Run the command. + # + ${command} > ${fileName} +} + +# +# Get the disk information. +# +getDiskInfo ${dfTmp} + +# +# Bold the first line of the df command. +# +head -1 ${dfTmp} | awk '{printf "%s\n", $0}' > ${top} +tail +2 ${dfTmp} > ${bottom} + +# +# Create the message for the label widget. +# +echo "This is the current" > ${tmp} +echo "status of your local filesystems." >> ${tmp} +echo "<#HL(2)>" >> ${tmp} +cat ${top} >> ${tmp} +cat ${bottom} >> ${tmp} +echo "<#HL(2)>" >> ${tmp} +echo "" >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f "${tmp}" -p " " -c "ls" -S + +# +# Clean up. +# +rm -f ${tmp} ${output} ${dfTmp} ${top} ${bottom} diff --git a/deps/cdk-5.0-20161210/cli/samples/matrix.sh b/deps/cdk-5.0-20161210/cli/samples/matrix.sh new file mode 100755 index 0000000..34b6f4a --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/matrix.sh @@ -0,0 +1,123 @@ +#!/bin/sh +# $Id: matrix.sh,v 1.4 2005/12/27 17:07:00 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the matrix widget. +# + +# +# Create some global variables. +# +CDK_MATRIX="${CDK_BINDIR=..}/cdkmatrix" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +fileSystemList="${TMPDIR=/tmp}/fsList.$$" +info="${TMPDIR=/tmp}/fsInfo.$$" +diskInfo="${TMPDIR=/tmp}/diskInfo.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Get the filesystem information. +# +getDiskInfo() +{ + fileName=$1; + command="df" + + # + # Determine the type of operating system. + # + machine=`uname -s` + if [ "$machine" = "SunOS" ]; then + level=`uname -r` + + if [ "$level" -gt 4 ]; then + command="df -kl" + fi + else + if [ "$machine" = "AIX" ]; then + command="df -i" + fi + fi + + # + # Run the command. + # + ${command} > ${fileName} +} + +# +# Get the disk information. +# +getDiskInfo ${diskInfo} + +# +# Create the row titles. +# +rowTitles=`tail +2 ${diskInfo} | awk '{printf "%s\n", $1}'` + +# +# Create the column titles. +# +colTitles="KBytes +Used +Avail +Capacity +Mounted on" + +# +# Define the matrix title. +# +title="Current Filesystem Information" + +# +# Create the data file to fill in the matrix. +# +tail +2 ${diskInfo} | awk '{printf "%s%s%s%s%s\n", $2, $3, $4, $5, $6}' > ${info} + +# +# Set the widths of the columns. +# +colWidths="5 +5 +5 +5 +5" + +# +# Set the cells as uneditable. +# +types="VIEWONLY +VIEWONLY +VIEWONLY +VIEWONLY +VIEWONLY" + +buttons=" OK + Cancel " + +# +# Start the matrix. +# +${CDK_MATRIX} -r "${rowTitles}" -c "${colTitles}" -v 3 -w "${colWidths}" -d "${info}" -t "${types}" -T "${title}" -B "${buttons}" -O"$tmp" +selected=$? +test $selected = 255 && exit 1 + +# +# Create the message for the label widget. +# +echo "You chose button #${selected}" > ${tmp} +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f "${tmp}" -p " " + +# +# Clean up. +# +rm -f ${info} ${fileSystemList} ${tmp} ${diskInfo} diff --git a/deps/cdk-5.0-20161210/cli/samples/mentry.sh b/deps/cdk-5.0-20161210/cli/samples/mentry.sh new file mode 100755 index 0000000..83a66a1 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/mentry.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# $Id: mentry.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the multiple line entry widget. +# + +# +# Create some global variables. +# +CDK_MENTRY="${CDK_BINDIR=..}/cdkmentry" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +output="${TMPDIR=/tmp}/mentry_output.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Create the title. +# +title="Type in a short message." +buttons=" OK + Cancel " + +# +# Create the mentry box. +# +${CDK_MENTRY} -s 5 -v 10 -f 20 -T "${title}" -B "${buttons}" -F '_' -O ${output} +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${output}` + +# +# Create the message for the label widget. +# +echo "Here is the message you typed in" > ${tmp} +echo " " >> ${tmp} +echo "${answer}" >> ${tmp} +echo " " >> ${tmp} +echo "You chose button #${selected}" >> ${tmp} +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${output} diff --git a/deps/cdk-5.0-20161210/cli/samples/radio.sh b/deps/cdk-5.0-20161210/cli/samples/radio.sh new file mode 100755 index 0000000..752a21a --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/radio.sh @@ -0,0 +1,95 @@ +#!/bin/sh +# $Id: radio.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the radio widget. +# + +# +# Create some global variables. +# +CDK_RADIO="${CDK_BINDIR=..}/cdkradio" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +fileSystemList="${TMPDIR=/tmp}/fsList.$$" +diskInfo="${TMPDIR=/tmp}/diskInfo.$$" +output="${TMPDIR=/tmp}/radio_output.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Get the filesystem information. +# +getDiskInfo() +{ + fileName=$1; + command="df" + + # + # Determine the type of operating system. + # + machine=`uname -s` + if [ "$machine" = "SunOS" ]; then + level=`uname -r` + + if [ "$level" -gt 4 ]; then + command="df -kl" + fi + else + if [ "$machine" = "AIX" ]; then + command="df -i" + fi + fi + + # + # Run the command. + # + ${command} > ${fileName} +} + +# +# Create the title for the scrolling list. +# +title="Pick a filesystem to view." +buttons=" OK + Cancel " + +# +# Get a list of the local filesystems. +# +getDiskInfo ${diskInfo} + +# +# Create the file system list. +# +grep "^/" ${diskInfo} | awk '{printf "%s\n", $1}' > ${fileSystemList} + +# +# Create the radio list. +# +${CDK_RADIO} -T "${title}" -f "${fileSystemList}" -c "*" -B "${buttons}" 2> $output +selected=$? +test $selected = 255 && exit 1 + +# +# The selection is now in the file $output. +# +fs=`cat ${output}` +echo "File Statistics on the filesystem ${fs}" > ${tmp} +echo " " >> ${tmp} +grep "${fs}" ${diskInfo} | awk '{printf "%s\n", $0}' >> ${tmp} +echo " " >> ${tmp} +echo "You chose button #${selected}" >> ${tmp} +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${output} ${fileSystemList} ${diskInfo} diff --git a/deps/cdk-5.0-20161210/cli/samples/scale.sh b/deps/cdk-5.0-20161210/cli/samples/scale.sh new file mode 100755 index 0000000..d1bb997 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/scale.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# $Id: scale.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the scale widget. +# + +# +# Create some global variables. +# +CDK_SCALE="${CDK_BINDIR=..}/cdkscale" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +output="${TMPDIR=/tmp}/scale_output.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Create the title. +# +title="Enter a value using the cursor keys." +label="Value" +buttons=" OK + Cancel " + +# +# Create the scale box. +# +${CDK_SCALE} -f 20 -l 0 -h 100 -i 5 -L "${label}" -T "${title}" -B "${buttons}" -O ${output} +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${output}` + +# +# Create the message for the label widget. +# +echo "Here is the value you selected" > ${tmp} +echo " " >> ${tmp} +echo "${answer}" >> ${tmp} +echo " " >> ${tmp} +echo "You chose button #${selected}" >> ${tmp} +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${output} diff --git a/deps/cdk-5.0-20161210/cli/samples/scroll.sh b/deps/cdk-5.0-20161210/cli/samples/scroll.sh new file mode 100755 index 0000000..11dd6da --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/scroll.sh @@ -0,0 +1,136 @@ +#!/bin/sh +# $Id: scroll.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the scrolling list widget. +# + +# +# This gets the password file. +# +getPasswordFile() +{ + system=$1 + file=$2 + + # + # Depeding on the system, get the password file + # using nicat, ypcat, or just plain old /etc/passwd + # + if [ "$system" = "NIS" ]; then + niscat passwd.org_dir > $file + elif [ "$system" = "YP" ]; then + ypcat passwd > $file + else + cp /etc/passwd $file + fi +} + +# +# This displays account information. +# +displayAccountInformation() +{ + userAccount=$1 + passwordFile=$2 + + # + # Get the user account information. + # + line=`grep "^${userAccount}" $passwordFile` + uid=`echo $line | cut -d: -f3` + gid=`echo $line | cut -d: -f4` + info=`echo $line | cut -d: -f5` + home=`echo $line | cut -d: -f6` + shell=`echo $line | cut -d: -f7` + + # + # Create the label message information. + # + accountMessage="Account +<#HL(30)> +Account: ${userAccount} +UID : ${uid} +GID : ${gid} +Info : ${info} +Home : ${home} +Shell : ${shell} +<#HL(30)> +Hit space to continue" + + # + # Create the popup label. + # + ${CDK_LABEL} -m "${accountMessage}" -p " " +} + +# +# Create some global variables. +# +CDK_SCROLL="${CDK_BINDIR=..}/cdkscroll" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +tmpPass="${TMPDIR=/tmp}/sl.$$" +output="${TMPDIR=/tmp}/output.$$" +userAccounts="${TMPDIR=/tmp}/ua.$$" + +TYPE="Other" + +# +# Chop up the command line. +# +set -- `getopt nNh $*` +if [ $? != 0 ] +then + echo $USAGE + exit 2 +fi +for c in $* +do + case $c in + -n) TYPE="YP"; shift;; + -N) TYPE="NIS"; shift;; + -h) echo "$0 [-n YP] [-N NIS+] [-h]"; exit 0;; + --) shift; break;; + esac +done + +# +# Create the message for the scrolling list. +# +title="<#HL(30)> +Pick an account you want to view. +<#HL(30)>" +buttons=" OK + Cancel " + +# +# Get the password file and stick it into the temp file. +# +getPasswordFile "${TYPE}" "$tmpPass" + +# +# Get the user account from the password file. +# +awk 'BEGIN {FS=":"} {printf "%s\n", $1}' $tmpPass | sort > ${userAccounts} + +# +# Create the scrolling list. +# +${CDK_SCROLL} -T "${title}" -f ${userAccounts} -n -B "${buttons}" 2> ${output} +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${output}` + +# +# Display the account information. +# +displayAccountInformation $answer $tmpPass + +# +# Clean up. +# +rm -f ${output} ${tmpPass} ${userAccounts} diff --git a/deps/cdk-5.0-20161210/cli/samples/selection.sh b/deps/cdk-5.0-20161210/cli/samples/selection.sh new file mode 100755 index 0000000..a024838 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/selection.sh @@ -0,0 +1,191 @@ +#!/bin/sh +# $Id: selection.sh,v 1.4 2005/12/27 17:56:58 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the selection widget. +# + +# +# This gets the password file. +# +getPasswordFile() +{ + system=$1 + file=$2 + + # + # Depending on the system, get the password file + # using nicat, ypcat, or just plain old /etc/passwd + # + if [ "$system" = "NIS" ]; then + niscat passwd.org_dir > $file + elif [ "$system" = "YP" ]; then + ypcat passwd > $file + else + cp /etc/passwd $file + fi +} + +# +# This displays account information. +# +displayAccountInformation() +{ + totalSelections=$1 + currentSelection=$2 + userAccount=$3 + passwordFile=$4 + + # + # Get the user account information. + # + line=`grep "^${userAccount}" $passwordFile` + uid=`echo $line | cut -d: -f3` + gid=`echo $line | cut -d: -f4` + info=`echo $line | cut -d: -f5` + home=`echo $line | cut -d: -f6` + shell=`echo $line | cut -d: -f7` + + # + # Create the label message information. + # + accountMessage="Account ${currentSelection}/${totalSelections} +<#HL(30)> +Account: ${userAccount} +UID : ${uid} +GID : ${gid} +Info : ${info} +Home : ${home} +Shell : ${shell} +<#HL(30)> +Hit space to continue" + + # + # Create the popup label. + # + ${CDK_LABEL} -m "${accountMessage}" -p " " +} + +# +# Define where the CDK widgets are. +# +CDK_SELECTION="${CDK_BINDIR=..}/cdkselection" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +TYPE="Other" + +# +# Define the output files. +# +accountList="${TMPDIR=/tmp}/accList.$$" +userAccounts="${TMPDIR=/tmp}/userAccList.$$" +output="${TMPDIR=/tmp}/selection_output.$$" +tmpPass="${TMPDIR=/tmp}/ps.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Chop up the command line. +# +set -- `getopt nNh $*` +if [ $? != 0 ] +then + echo $USAGE + exit 2 +fi +for c in $* +do + case $c in + -n) TYPE="YP"; shift;; + -N) TYPE="NIS"; shift;; + -h) echo "$0 [-n YP] [-N NIS+] [-h]"; exit 0;; + --) shift; break;; + esac +done + +# +# Create the message for the selection list. +# +title="Pick a user account to view." + +# +# Get the password file and stick it into the temp file. +# +getPasswordFile "${TYPE}" "$tmpPass" + +# +# Create the user account list. +# +awk 'BEGIN {FS=":"} {printf "%s\n", $1}' $tmpPass | sort > ${userAccounts} +awk '{printf "%s\n", $1}' ${userAccounts} > ${accountList} +accounts=`cat ${userAccounts}` + +# +# Create the choices list. +# +choices="No + Yes " +buttons=" OK + Cancel " + +# +# Create the selection list. +# +${CDK_SELECTION} -T "${title}" -f "${accountList}" -c "${choices}" -B "${buttons}" 2> $output +selected=$? +test $selected = 255 && exit 1 + +# +# Initialize the variables. +# +selection="" +value="" + +# +# Count how many were selected. +# +count=`grep -c "^1" ${output}` +current=0 + +# +# Create the label. +# +for i in `cat ${output}` +do + # + # Since every other variable is value/selection, we + # store every other value in the correct variable. + # + if [ "$value" = "" ]; then + value="$i" + else + selection="$i" + + # + # Only display the selected accounts. + # + if [ "$value" -eq 1 ]; then + # + # Increment our counter. + # + current=`expr $current + 1` + + # + # Display the account information. + # + displayAccountInformation $count $current $selection $tmpPass + fi + + # + # Reset the variables. + # + value="" + selection="" + fi +done + +# +# Clean up. +# +rm -f ${accountList} ${userAccounts} ${output} ${tmpPass} ${tmp} diff --git a/deps/cdk-5.0-20161210/cli/samples/slider.sh b/deps/cdk-5.0-20161210/cli/samples/slider.sh new file mode 100755 index 0000000..20d37c6 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/slider.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# $Id: slider.sh,v 1.4 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the slider widget. +# + +# +# Create some global variables. +# +CDK_SLIDER="${CDK_BINDIR=..}/cdkslider" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +output="${TMPDIR=/tmp}/slider_output.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Create the title. +# +title="Enter a value using the cursor keys" +label="Value: " +buttons=" OK + Cancel " + +# +# Create the slider box. +# +${CDK_SLIDER} -f 20 -l 0 -h 100 -i 5 -L "${label}" -T "${title}" -F "*" -B "${buttons}" -O ${output} +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${output}` + +# +# Create the message for the label widget. +# +echo "Here is the value you selected" > ${tmp} +echo " " >> ${tmp} +echo "${answer}" >> ${tmp} +echo " " >> ${tmp} +echo "You chose button #${selected}" >> ${tmp} +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${output} diff --git a/deps/cdk-5.0-20161210/cli/samples/template.sh b/deps/cdk-5.0-20161210/cli/samples/template.sh new file mode 100755 index 0000000..d53c48c --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/template.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# $Id: template.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the template widget. +# + +# +# Create some global variables. +# +CDK_TEMPLATE="${CDK_BINDIR=..}/cdktemplate" +CDK_LABEL="${CDK_BINDIR=..}/cdklabel" + +output="${TMPDIR=/tmp}/template_output.$$" +tmp="${TMPDIR=/tmp}/tmp.$$" + +# +# Create the title. +# +title=" Type in the +IP Address for this machine." +buttons=" OK + Cancel " + +# +# Create the template box. +# +${CDK_TEMPLATE} -p "###.###.###.###" -o "___.___.___.___" -T "${title}" -P -B "${buttons}" 2> ${output} +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${output}` + +# +# Create the message for the label widget. +# +echo "Here is the IP you typed in" > ${tmp} +echo " " >> ${tmp} +echo "${answer}" >> ${tmp} +echo " " >> ${tmp} +echo "You chose button #${selected}" >> ${tmp} +echo " " >> ${tmp} +echo "Hit space to continue." >> ${tmp} + +# +# Create the label widget to display the information. +# +${CDK_LABEL} -f ${tmp} -p " " + +# +# Clean up. +# +rm -f ${tmp} ${output} diff --git a/deps/cdk-5.0-20161210/cli/samples/viewer.sh b/deps/cdk-5.0-20161210/cli/samples/viewer.sh new file mode 100755 index 0000000..d7750b4 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/samples/viewer.sh @@ -0,0 +1,76 @@ +#!/bin/sh +# $Id: viewer.sh,v 1.3 2005/12/27 15:53:06 tom Exp $ + +# +# Description: +# This demonstrates the CDK command line +# interface to the viewer widget. +# + +# +# Create some global variables. +# +CDK_FSELECT="${CDK_BINDIR=..}/cdkfselect" +CDK_VIEWER="${CDK_BINDIR=..}/cdkviewer" + +tmp="${TMPDIR=/tmp}/tmp.$$" +file="${TMPDIR=/tmp}/fs.$$" + +directory="." +xpos=CENTER +ypos=CENTER +width="-2" +height="0" +interpret=0 + +# +# Chop up the command line. +# +set -- `getopt d:x:y:w:h:i $*` +if [ $? != 0 ] +then + echo $USAGE + exit 2 +fi +for c in $* +do + case $c in + -d) directory=$2; shift 2;; + -x) xpos=$2; shift 2;; + -y) ypos=$2; shift 2;; + -w) width=$2; shift 2;; + -h) height=$2; shift 2;; + -i) interpret=1; shift 1;; + --) shift; break;; + esac +done + +# +# Create the CDK file selector. +# +${CDK_FSELECT} -T "Select a file" -d "${directory}" 2> ${file} +selected=$? +test $selected = 255 && exit 1 + +answer=`cat ${file}` + +# +# Create the title and buttons for the viewer. +# +title="CDK File Viewer Widget +${answer}" +buttons="OK" + +# +# Create the file viewer. +# +if [ "$interpret" -eq 1 ]; then + ${CDK_VIEWER} -f "${answer}" -T "${title}" -B "${buttons}" -i -X ${xpos} -Y ${ypos} -H "${height}" -W "${width}" +else + ${CDK_VIEWER} -f "${answer}" -T "${title}" -B "${buttons}" -X ${xpos} -Y ${ypos} -H "${height}" -W "${width}" -B "${buttons}" +fi + +# +# Clean up. +# +rm -f ${tmp} ${file} diff --git a/deps/cdk-5.0-20161210/cli/utils/adduser b/deps/cdk-5.0-20161210/cli/utils/adduser new file mode 100755 index 0000000..8e0b708 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/utils/adduser @@ -0,0 +1,686 @@ +#!/bin/sh +# $Id: adduser,v 1.3 2002/07/16 22:24:53 tom Exp $ + +# +# Written by: Mike Glover, March 1997 +# E-mail : vexus@home.com, glover@credit.erin.utoronto.ca +# +# Purpose: +# This is a graphical adduser program. The widgets are +# the CDK command line widgets provided by the CDK +# distribution. If you have any questions about CDK, +# or the command line widgets please feel free to mail +# me at one of the two above addresses. +# + +# +# Copyright 2000, Mike Glover +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgment: +# This product includes software developed by Mike Glover +# and contributors. +# 4. Neither the name of Mike Glover nor the names of contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# +# Set the screen and widget colors. +# +CDK_WIDGET_COLOR=""; export CDK_WIDGET_COLOR +CDK_SCREEN_COLOR=""; export CDK_SCREEN_COLOR + +# +# Set up some variables. +# +CDK_DIALOG="../cdkdialog" +CDK_ENTRY="../cdkentry" +CDK_SCROLL="../cdkscroll" +tmpFile="/tmp/tmp.$$" +tmpInfo="/tmp/adduserInfo.$$" +shellFile="/tmp/shells.$$" +ACCOUNT_SHELL="" +ACCOUNT_INFO="" +ACCOUNT_NAME="" +ACCOUNT_HOME="" +ACCOUNT_GID="" +ACCOUNT_UID="" +GROUP_NAME="" +CURRENT_FUNCTION=1; + +# +# This quits the program. +# +quitProgram() +{ + # + # The person has decided to quit. + # + buttons="< OK >" + message="<#HL(30)> +Add New User Canceled +Program exiting +<#HL(30)>" + ${CDK_DIALOG} -m "${message}" -B "${buttons}" -N 2> /dev/null + exit; +} + +# +# This warns the user to what is about to happen. It +# gives them a safe 'out' +# +warnUser() +{ + # + # Pop up a little message telling the user what is + # about to happen. + # + message="Adding New User + +You are about to add a new user. If you do not want to +do this, move the cursor to the cancel button and hit +return. This will exit this program. Otherwise hit +return to continue." + buttons="< OK > +< Cancel >" + ${CDK_DIALOG} -m "${message}" -B "${buttons}" 2> /dev/null + if [ $? -ne 0 ]; then + quitProgram; + fi +} + +# +# This gets the account name from the user. +# +getAccountName() +{ + # + # Keep doing this until we hit an account which does not + # already exist. + # + count=1; + while [ $count -ne 0 ]; do + # + # Get the account name from the user. + # + buttons="Next +Cancel" + label="Account Name: " + title="Account Name + +The name is the identity of the account which the +user will use to access the system. + +" + + ${CDK_ENTRY} -i "${ACCOUNT_NAME}" -f 15 -m 3 -F "_" -T "${title}" -L "${label}" -B "${buttons}" 2> ${tmpFile} + selected=$? + ACCOUNT_NAME=`cat ${tmpFile}` + + # + # Check the selected button. + # + if [ $selected -eq 0 ]; then + DIRECTION=1; export DIRECTION; + else + quitProgram; + fi + + # + # Look for the account name in the password file. + # + count=`grep -c "^${ACCOUNT_NAME}" /etc/passwd` + if [ ${count} -eq 1 ]; then + buttons="< OK >" + message="Account Found + +The account you provided +${ACCOUNT_NAME} +already exists in the password file. Please pick +another account name." + ${CDK_DIALOG} -m "${message}" -B "${buttons}" 2> /dev/null + fi + done +} + +# +# This gets the account information. +# +getAccountInfo() +{ + # + # Set up the entry field. + # + buttons="Next +Previous +Cancel" + label="Personal Info: " + title="Account Information. + +Enter in ${ACCOUNT_NAME}'s personal information. This is usually the +account holders name, phone number, or extension. This is fairly freeform. +The only character you can not use is a colon (:). If you do all colons will +be stripped out by this process. + +" + ${CDK_ENTRY} -f 40 -i "${ACCOUNT_INFO}" -F "_" -T "${title}" -L "${label}" -B "${buttons}" 2> ${tmpFile} + selected=$? + ACCOUNT_INFO=`cat ${tmpFile} | tr ':' ' '` + + # + # Check the selected button. + # + if [ $selected -eq 0 ]; then + DIRECTION=1; export DIRECTION; + elif [ $selected -eq 1 ]; then + DIRECTION=-1; export DIRECTION; + return; + else + quitProgram; + fi +} + +# +# This gets the account GID. +# +getAccountGID() +{ + # + # Get the 'users' GID from /etc/group. + # + if [ "$ACCOUNT_GID" = "" ]; then + count=`grep -c "^users" /etc/group` + if [ $count -eq 0 ]; then + USER_GID="100"; + else + USER_GID=`grep "^users" /etc/group | cut -d: -f3` + fi + else + USER_GID="$ACCOUNT_GID"; + fi + + # + # Keep doing this until we get a GID which exists. + # + count=0; + while [ $count -eq 0 ]; do + # + # Get the GID. + # + buttons="Next +Previous +Cancel" + label="Account GID: " + title="Account GID + +The GID (Group IDentification) must be a number which already +exists in the /etc/group file. The default group users +has been provided for you. + +" + ${CDK_ENTRY} -f 6 -m 1 -i "${USER_GID}" -F "_" -T "${title}" -L "${label}" -B "${buttons}" 2> ${tmpFile} + selected=$? + ACCOUNT_GID=`cat ${tmpFile}` + + # + # Check the selected button. + # + if [ $selected -eq 0 ]; then + DIRECTION=1; export DIRECTION; + elif [ $selected -eq 1 ]; then + DIRECTION=-1; export DIRECTION; + return; + else + quitProgram; + fi + + # + # Look for GID in the /etc/group + # + count=`grep -c ".*:.*:${ACCOUNT_GID}:" /etc/group` + if [ ${count} -eq 0 ]; then + buttons="< OK >" + message="Error: No Such GID + +The GID you provided does not exist. +Please pick a GID which does exist. +" + ${CDK_DIALOG} -m "${message}" -B "${buttons}" 2> /dev/null + if [ $? -ne 0 ]; then + quitProgram; + fi + else + # + # Get the group name for later. + # + GROUP_NAME=`grep ".*:.*:${ACCOUNT_GID}:" /etc/group | cut -d: -f1` + fi + done +} + +# +# This gets the account UID. +# +getAccountUID() +{ + # + # Try to find the next available UID. + # + if [ "$ACCOUNT_UID" = "" ]; then + nextUID=`awk 'BEGIN {FS=":"} {print $3}' /etc/passwd | sort -n | grep -v "65535" | tail -1` + nextUID=`expr $nextUID + 1` + else + nextUID="$ACCOUNT_UID" + fi + + # + # Keep doing this until we get a UID which does not exist. + # + count=1; + while [ $count -ne 0 ]; do + # + # Get the UID. + # + buttons="Next +Previous +Cancel" + label="Account UID: " + title="Account UID + +The UID (User IDentification) must be a number which does not +already exist in the /etc/passwd file. The value filled in is +the next available UID found from the password file. + +" + ${CDK_ENTRY} -f 6 -i "${nextUID}" -m 1 -F "_" -T "${title}" -L "${label}" -B "${buttons}" 2> ${tmpFile} + selected=$? + ACCOUNT_UID=`cat ${tmpFile}` + + # + # Check the selected button. + # + if [ $selected -eq 0 ]; then + DIRECTION=1; export DIRECTION; + elif [ $selected -eq 1 ]; then + DIRECTION=-1; export DIRECTION; + return; + else + quitProgram; + fi + + # + # Look for UID in the /etc/passwd + # + count=`grep -c ".*:.*:${ACCOUNT_UID}:" /etc/passwd` + if [ ${count} -ne 0 ]; then + owner=`grep ".*:.*:${ACCOUNT_UID}:" /etc/passwd | head -1 |cut -d: -f1` + buttons="< OK >" + message="Error: Duplicate UID + +The UID you provided is already owned by +the account $owner. Please pick a +UID which does not already exist. +" + ${CDK_DIALOG} -m "${message}" -B "${buttons}" 2> /dev/null + if [ $? -ne 0 ]; then + quitProgram; + fi + fi + done +} + +# +# This gets the account home directory. +# +getAccountHome() +{ + if [ "${ACCOUNT_HOME}" = "" ]; then + defaultHome="/home/${ACCOUNT_NAME}" + else + defaultHome="${ACCOUNT_HOME}" + fi + + # + # Set up the entry field. + # + buttons="Next +Previous +Cancel" + label="Home Directory: " + title="Account Home Directory. + +Enter in the account's home directory. If the directory +does not currently exist, it will be created in the account +creation phase of this process. A reasonable default value +for the home directory has been provided. + +" + ${CDK_ENTRY} -f 20 -F "_" -i "${defaultHome}" -T "${title}" -L "${label}" -B "${buttons}" 2> ${tmpFile} + selected=$? + ACCOUNT_HOME=`cat ${tmpFile}` + + # + # Check the selected button. + # + if [ $selected -eq 0 ]; then + DIRECTION=1; export DIRECTION; + elif [ $selected -eq 1 ]; then + DIRECTION=-1; export DIRECTION; + return; + else + quitProgram; + fi +} + +# +# This gets the shell the user want to assign to +# the account. +# +getAccountShell() +{ + count=0; + + while [ "$count" -eq 0 ]; do + # + # Get the shell they want to use. + # + buttons="Next +Previous +Cancel" + title="Account Shell + +Pick one of the shells to use. If you want to use a +custom shell, pick Custom and you will be +prompted for it's path. +" + echo "Custom" > ${shellFile} + cat /etc/shells >> ${shellFile} + ${CDK_SCROLL} -H 5 -W 10 -T "${title}" -f ${shellFile} -B "${buttons}" 2> ${tmpFile} + selected=$? + ACCOUNT_SHELL=`cat ${tmpFile}` + + # + # Check the selected buttons. + # + if [ $selected -eq 0 ]; then + DIRECTION=1; export DIRECTION; + count=1; + elif [ $selected -eq 1 ]; then + DIRECTION=-1; export DIRECTION; + return; + else + quitProgram; + fi + + # + # Check the answer. + # + if [ "$ACCOUNT_SHELL" = "Custom" ]; then + # + # Get the shell from the user. + # + buttons="Next +Previuous +Cancel" + label="Shell Pathname: " + title="Custom Account Shell + +Enter in the path to the custom shell. The authenticity +of the shell will not be checked here. It is assumed that +the shell will exist when the account is ready to be used. + +" + ${CDK_ENTRY} -f 20 -F "_" -T "${title}" -L "${label}" -B "${buttons}" 2> ${tmpFile} + selected=$? + ACCOUNT_SHELL=`cat ${tmpFile}` + + # + # Check the selected buttons. + # + if [ $selected -eq 0 ]; then + DIRECTION=1; export DIRECTION; + count=1; + elif [ $selected -eq 1 ]; then + count=0; + else + quitProgram; + fi + fi + done +} + +# +# This confirms the new account information. +# +confirmAccount() +{ + message="Confirm New Account. +You are about to add an account with the following +information: + +<#HL(30)> + Account Name : $ACCOUNT_NAME + Account Info : $ACCOUNT_INFO + Account Home : $ACCOUNT_HOME + Account Shell: $ACCOUNT_SHELL + Account UID : $ACCOUNT_UID + Account GID : $ACCOUNT_GID +<#HL(30)> + +Are you sure you want to do this. Hit Yes if you +want to add the account; hit No if you want to +edit the information; hit Cancel if you want to +abandon all information. +" + buttons="< Yes > +< No > +< Cancel >" + ${CDK_DIALOG} -m "${message}" -B "${buttons}" 2> /dev/null + answer=$? + + # + # Check the answer. + # + if [ "$answer" -eq 2 -o "$answer" -eq 255 ]; then + quitProgram; + fi + if [ "$answer" -eq 0 ]; then + confirm=1; export confirm; + else + confirm=0; export confirm; + fi +} + +# +# Find out if the user wants to change the password +# or not. +# +changeAccountPassword() +{ + buttons="< Yes > +< No >" + message="Change Account Password Now + +Since the account was added without a password, this account +can be logged in to without providing a password. Would you +like to change the account's password now? +" + ${CDK_DIALOG} -m "${message}" -B "${buttons}" 2> /dev/null + answer=$? + if [ "$answer" -eq 0 ]; then + passwd $ACCOUNT_NAME + fi +} + +# +# This verifies the users ability to modify the +# password file. +# +checkPermissions() +{ + # + # Try to touch the passwd file. + # + touch /etc/passwd >/dev/null 2>&1 + if [ $? -ne 0 ]; then + # + # Can't touch the password file. Let's tell them and go. + # + buttons="< Log Into Root Now > +< Exit >" + message="Can Not Edit Password File + +It appears that you do not have permission to edit the +password file. To add a new user to this machine you +must be logged in as root. Would you like to su to root +now or exit and log in. If you try to su now, this +program will be restarted. +" + ${CDK_DIALOG} -m "${message}" -B "${buttons}" 2> /dev/null + if [ $? -eq 0 ]; then + su root -c "$0" + fi + exit; + fi +} + +# +# This creates the account and copies all needed +# information. +# +createAccount() +{ + if [ ! -d "$ACCOUNT_HOME" ]; then + mkdir $ACCOUNT_HOME + fi + if [ "$ACCOUNT_SHELL" = "/bin/sh" ]; then + cp /etc/profile ${ACCOUNT_HOME}/.profile + fi + if [ "$ACCOUNT_SHELL" = "/bin/bash" ]; then + cp /etc/profile ${ACCOUNT_HOME}/.profile + fi + if [ "$ACCOUNT_SHELL" = "/bin/csh" ]; then + cp /etc/csh.cshrc ${ACCOUNT_HOME}/.cshrc + cp /etc/csh.login ${ACCOUNT_HOME}/.login + fi + if [ "$ACCOUNT_SHELL" = "/bin/tcsh" ]; then + cp /etc/csh.cshrc ${ACCOUNT_HOME}/.cshrc + cp /etc/csh.login ${ACCOUNT_HOME}/.login + fi + chown -R ${ACCOUNT_NAME}.${GROUP_NAME} $ACCOUNT_HOME +} + +########################################################### +# +# This is the start of the info retrieval. +# +########################################################### + +# +# Set up the intermiediate functions so we can go +# backward and forward. +# +function1() +{ + getAccountName; +} +function2() +{ + getAccountInfo; +} +function3() +{ + getAccountGID; +} +function4() +{ + getAccountUID; +} +function5() +{ + getAccountHome; +} +function6() +{ + getAccountShell; +} +function7() +{ + confirmAccount; +} + +# +# Make sure the user has permission to edit the password file. +# +checkPermissions; + +# +# Tell the user what they are about to do. +# +warnUser; + +# +# Call the functions to get the needed info. +# +confirm=0; +NUMBER=0; +DIRECTION=1; +while [ "$confirm" -eq 0 ]; do + NUMBER=`expr $NUMBER + $DIRECTION` + if [ $NUMBER -le 0 ]; then + NUMBER = 1; + fi + CURRENT_FUNCTION="function${NUMBER}"; + $CURRENT_FUNCTION; +done + +# +# Add the account to the password file. +# +cp /etc/passwd /etc/passwd.old +echo "${ACCOUNT_NAME}::${ACCOUNT_UID}:${ACCOUNT_GID}:${ACCOUNT_INFO}:${ACCOUNT_HOME}:${ACCOUNT_SHELL}" >> /etc/passwd + +# +# Find out if the user wants to change the password or not. +# +changeAccountPassword; + +# +# Create the account and copy . files. +# +createAccount; + +# +# Pop up a last little message and tell the user everything +# if OK. +# +buttons="< OK >" +message="Account Add Complete + +The account ${ACCOUNT_NAME} has been added to the password +file. You should be able to log in under this account +now. +" +${CDK_DIALOG} -m "${message}" -B "${buttons}" 2> /dev/null diff --git a/deps/cdk-5.0-20161210/cli/utils/netconfig b/deps/cdk-5.0-20161210/cli/utils/netconfig new file mode 100755 index 0000000..8d1fdf5 --- /dev/null +++ b/deps/cdk-5.0-20161210/cli/utils/netconfig @@ -0,0 +1,415 @@ +#!/bin/sh +# $Id: netconfig,v 1.3 2002/07/16 22:25:56 tom Exp $ + +# +# Written by: Mike Glover, March 1997 +# E-mail : vexus@home.com, glover@credit.erin.utoronto.ca +# +# Purpose: +# This is a graphical network configuration program. +# It was inspired by the cdialog interface that Linux +# uses. The widgets are the CDK command line widgets +# provided by the CDK distribution. If you have any +# questions about CDK, or the command line widgets +# please feel free to mail me at one of the two above +# addresses. +# + +# +# Copyright 2000, Mike Glover +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgment: +# This product includes software developed by Mike Glover +# and contributors. +# 4. Neither the name of Mike Glover nor the names of contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# +# Set up the root directory for the system files. +# +if [ "$1" = "" ]; then + ROOTDIR="" +else + ROOTDIR=$1; +fi + +# +# This copies a file to it's destination and +# sets the file mode. +# +copyFile() +{ + source=$1; + dest=$2; + mode=$3; + + # + # If the original exists, make a copy. + # + if [ -f "${dest}" ]; then + cp ${dest} ${dest}.old + fi + mv ${source} ${dest} + chmod ${mode} ${dest} +} + +# +# Set up some variables. +# +CDK_DIALOG="../cdkdialog" +CDK_ENTRY="../cdkentry" +CDK_TEMPLATE="../cdktemplate" +NETWORKS="${ROOTDIR}/etc/networks" +HOSTS="${ROOTDIR}/etc/hosts" +HOSTNAME_FILE="${ROOTDIR}/etc/HOSTNAME" +RESOLV="${ROOTDIR}/etc/resolv.conf" +INET="${ROOTDIR}/etc/rc.d/rc.inet1" +IFCONFIG="${ROOTDIR}/sbin/ifconfig" +ROUTE="${ROOTDIR}/sbin/route" +tmpFile="/tmp/tmp.$$" + +# +# Define some global variables. +# +IP="" +HOST="" +DOMAIN="" +GATEWAY="" +NETMASK="" +NETWORK="" +BROADCAST="" +NAMESERVER="" + +# +# Set the screen and widget colors. +# +CDK_WIDGET_COLOR=""; export CDK_WIDGET_COLOR +CDK_SCREEN_COLOR=""; export CDK_SCREEN_COLOR + +# +# +# +exitMessage() +{ + exit; +} + +# +# Create the opening window. +# +intro() +{ + program=`basename $0` + buttons="< OK >" + message="Network Configuration + +We will now attempt to configure your mail and TCP/IP. This +process probably won't work on all possible network +configurations; but should give you a good start. You will +be able to reconfigure your network at any time by typing +in the command: +${program}" + + ${CDK_DIALOG} -m "${message}" -B "${buttons}" -S 2> /dev/null +} + +# +# Get the hostname of the machine. +# +getHostname() +{ + label="Enter Hostname: " + title="Enter Hostname + +We need to give the machine a name. We only need the base +hostname of the machine; the domain will be queried for +next. +" + + ${CDK_ENTRY} -i "${HOST}" -f 20 -F "_" -T "${title}" -L "${label}" -S 2> ${tmpFile} + HOST=`cat ${tmpFile}` +} + +# +# Get the domain name of the machine. +# +getDomainName() +{ + label="Enter Domain Name: " + title="Enter Domain Name + +Now enter in the domain in which this machine will +reside. Do NOT supply a leading '.' + +" + + ${CDK_ENTRY} -i "${DOMAIN}" -f 20 -F "_" -T "${title}" -L "${label}" -S 2> ${tmpFile} + DOMAIN=`cat ${tmpFile}` +} + +# +# Ask them if they plan to use loopback only. +# +loopback() +{ + buttons="< Yes > +< No >" + message="Loopback + +Do you plan to only use loopback? If so then your address will +be 127.0.0.1 and most of the following questions can be skipped. + +Do you plan to ONLY use loopback? +" + + ${CDK_DIALOG} -m "${message}" -B "${buttons}" -S 2> /dev/null + answer=$? + if [ $answer -eq 0 ]; then + exitMessage; + fi +} + +# +# Get the IP Address. +# +getIPAddress() +{ + title=" Enter Machine IP Address + +Enter the IP address you plan to assign to this machine. +" + plate="###.###.###.###" + overlay="___.___.___.___" + ${CDK_TEMPLATE} -i "${IP}" -p "${plate}" -o "${overlay}" -T "${title}" -m 10 -P -S 2> ${tmpFile} + IP=`cat ${tmpFile}` +} + +# +# +# +getGatewayAddress() +{ + NETWORK=`echo ${IP} | awk 'BEGIN {FS="."} {printf ("%s.%s.%s.0",$1,$2,$3)}'` + BROADCAST=`echo ${IP} | awk 'BEGIN {FS="."} {printf ("%s.%s.%s.255",$1,$2,$3)}'` + + # + # Get the machine's gateway address. + # + title=" Enter Gateway Address + +Enter the address of the gateway for this machine. If you do not +know, or have one, use the IP address of this machine. The IP +address you assigned to this machine should already be filled +in. If you want to erase it press control-x to erase the field +or hit the backspace or delete key to erase portions of the field. +" + tmp=`echo ${IP} | sed 's/\.//g'` + plate="###.###.###.###" + overlay="___.___.___.___" + ${CDK_TEMPLATE} -d "${tmp}" -p "${plate}" -o "${overlay}" -T "${title}" -m 10 -P -S 2> ${tmpFile} + GATEWAY=`cat ${tmpFile}` + + # + # Get the machine's netmask. + # + title=" Enter Netmask + +Enter your netmask. More often than not this value will be +255.255.255.0 A defaulted value of 255.255.255.0 is already +filled in. If you want to erase it press control-x to erase +the field or hit the backspace or delete key to erase +portions of the field. +" + plate="###.###.###.###" + overlay="___.___.___.___" + ${CDK_TEMPLATE} -d "2552552550" -p "${plate}" -o "${overlay}" -T "${title}" -m 10 -P -S 2> ${tmpFile} + NETMASK=`cat ${tmpFile}` + + # + # Find out if the user will be accessing a domain name server. + # + message=" Named Services + +Will you be accessing a name server. +" + buttons="< Yes > +< No >" + ${CDK_DIALOG} -m "${message}" -B "${buttons}" -S 2> /dev/null + answer=$? + + # + # If they answered yes, get the IP address. + # + if [ "$answer" -eq 0 ]; then + # + # Get the machine's domain name server address. + # + title=" Enter DNS Address + +Enter the address of the domain name server (DNS) which you want to +use. The value of the DNS server has been filled in with the +gateway address you provided. If you want to erase it press +control-x to erase the field or hit the backspace or delete key +to erase portions of the field. +" + tmp=`echo ${GATEWAY} | sed 's/\.//g'` + plate="###.###.###.###" + overlay="___.___.___.___" + ${CDK_TEMPLATE} -d "${tmp}" -p "${plate}" -o "${overlay}" -T "${title}" -m 10 -P -S 2> ${tmpFile} + NAMESERVER=`cat ${tmpFile}` + fi +} + +# +# Call the functions needed. +# + + +######################################### +# Create the hosts file. +# +cat << EOF > ${tmpFile} +# +# hosts This file describes a number of hostname-to-address +# mappings for the TCP/IP subsystem. It is mostly +# used at boot time, when no name servers are running. +# On small systems, this file can be used instead of a +# "named" name server. Just add the names, addresses +# and any aliases to this file... +# +# By the way, Arnt Gulbrandsen says that 127.0.0.1 +# should NEVER be named with the name of the machine. It causes problems +# for some (stupid) programs, irc and reputedly talk. :^) +# + +# For loopbacking. +127.0.0.1 localhost +$IP ${HOST}.${DOMAIN} ${HOST} +# End of hosts +EOF +copyFile ${tmpFile} "${HOSTS}" 644 +echo "${HOST}.${DOMAIN}" > ${tmpFile} +copyFile ${tmpFile} ${HOSTNAME_FILE} 644 + +######################################### +# Create the resolv.conf file. +# +cat << EOF > ${tmpFile} +domain ${DOMAIN} +nameserver ${NAMESERVER} +EOF +copyFile ${tmpFile} "${RESOLV}" 644 + +######################################### +# Create the /etc/networks file. +# +cat << EOF > ${tmpFile} +# +# networks This file describes a number of netname-to-address +# mappings for the TCP/IP subsystem. It is mostly +# used at boot time, when no name servers are running. +# + +loopback 127.0.0.0 +localnet ${IP} + +# End of networks. +EOF +copyFile ${tmpFile} "${NETWORKS}" 644 + +######################################### +# Create the /etc/rc.d/inet1 file. +# +cat << EOF > ${tmpFile} +#! /bin/sh +# +# rc.inet1 This shell script boots up the base INET system. +# +# Version: @(#)/etc/rc.d/rc.inet1 1.01 05/27/93 +# + +HOSTNAME=\`cat /etc/HOSTNAME\` + +# Attach the loopback device. +${IFCONFIG} lo 127.0.0.1 +${ROUTE} add -net 127.0.0.0 + +# IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the +# eth0 interface. If you're only using loopback or SLIP, don't include the +# rest of the lines in this file. + +# Edit for your setup. +IPADDR="$IP" # REPLACE with YOUR IP address! +NETMASK="$NETMASK" # REPLACE with YOUR netmask! +NETWORK="$NETWORK" # REPLACE with YOUR network address! +BROADCAST="$BROADCAST" # REPLACE with YOUR broadcast address, if you + # have one. If not, leave blank and edit below. +GATEWAY="$GATEWAY" # REPLACE with YOUR gateway address! + +# Uncomment the line below to configure your ethernet card. +${IFCONFIG} eth0 \${IP} broadcast \${BROADCAST} netmask \${NETMASK} + +# If the line above is uncommented, the code below can also be uncommented. +# It sees if the ethernet was properly initialized, and gives the admin some +# hints about what to do if it wasn't. +if [ ! \$? = 0 ]; then + cat << END +Your ethernet card was not initialized properly. Here are some reasons why this +may have happened, and the solutions: +1. Your kernel does not contain support for your card. Including all the + network drivers in a Linux kernel can make it too large to even boot, and + sometimes including extra drivers can cause system hangs. To support your + ethernet, either edit /etc/rc.d/rc.modules to load the support at boottime, + or compile and install a kernel that contains support. +2. You don't have an ethernet card, in which case you should comment out this + section of /etc/rc.d/rc.inet1. (Unless you don't mind seeing this error...) +END +fi + +# Uncomment these to set up your IP routing table. +${ROUTE} add -net \${NETWORK} netmask \${NETMASK} +${ROUTE} add default gw \${GATEWAY} metric 1 + +# End of rc.inet1 +EOF +copyFile ${tmpFile} "${INET}" 755 + +# +# Spit out the 'we are done' message. +# +message="Network Setup Complete + +Your network software has now been configured. You may +rerun this program to reconfigure or you may edit the +respective system files." +buttons="< OK >" +${CDK_DIALOG} -m "${message}" -B "${buttons}" -S 2> /dev/null + +# +# Clean up +# +rm -f ${tmpFile} diff --git a/deps/cdk-5.0-20161210/config.guess b/deps/cdk-5.0-20161210/config.guess new file mode 100755 index 0000000..2e9ad7f --- /dev/null +++ b/deps/cdk-5.0-20161210/config.guess @@ -0,0 +1,1462 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2016 Free Software Foundation, Inc. + +timestamp='2016-10-02' + +# This file 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 3 of the License, or +# (at your option) 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# +# Please send patches to . + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2016 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = hppa2.0w ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + *:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-${LIBC} + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = 386; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; +esac + +cat >&2 </dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/deps/cdk-5.0-20161210/config.sub b/deps/cdk-5.0-20161210/config.sub new file mode 100755 index 0000000..3478c1f --- /dev/null +++ b/deps/cdk-5.0-20161210/config.sub @@ -0,0 +1,1825 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2016 Free Software Foundation, Inc. + +timestamp='2016-11-19' + +# This file 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 3 of the License, or +# (at your option) 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2016 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 | or1k | or1knd | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ + | pyramid \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | ba-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | e2k-* | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ + | pyramid-* \ + | riscv32-* | riscv64-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + asmjs) + basic_machine=asmjs-unknown + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -ios) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/deps/cdk-5.0-20161210/configure b/deps/cdk-5.0-20161210/configure new file mode 100755 index 0000000..ac201bd --- /dev/null +++ b/deps/cdk-5.0-20161210/configure @@ -0,0 +1,18776 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52.20150926. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="include/cdk.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${datarootdir}/info' +mandir='${datarootdir}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat < if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 </dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:917: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:928: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:936: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:952: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:956: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:962: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:964: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:966: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:985: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:987: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +case `echo "testing\c" 2>/dev/null; echo 1,2,3`,`echo -n testing 2>/dev/null; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C= # newlines do not sed ;-) only broken shells would use this case anyway + ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:1008: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:1011: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_config_headers="$ac_config_headers include/cdk_config.h:include/config.hin" + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:1039: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:1049: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:1053: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:1062: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:1066: error: $ac_config_sub $ac_cv_build_alias failed." >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1071: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then + echo "$as_me:1079: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:1088: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1093: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && +cat >>confdefs.h <&6 +else + cf_cv_system_name="$system_name" +fi + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && echo "$as_me:1119: result: Configuring for $cf_cv_system_name" >&5 +echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 + +if test ".$system_name" != ".$cf_cv_system_name" ; then + echo "$as_me:1123: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 +echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 + { { echo "$as_me:1125: error: \"Please remove config.cache and try again.\"" >&5 +echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} + { (exit 1); exit 1; }; } +fi + +if test -f $srcdir/VERSION ; then + echo "$as_me:1131: checking for package version" >&5 +echo $ECHO_N "checking for package version... $ECHO_C" >&6 + + # if there are not enough fields, cut returns the last one... + cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1` + cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2` + cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3` + + # this is how CF_BUNDLED_INTL uses $VERSION: + VERSION="$cf_field1" + + VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'` + test -z "$VERSION_MAJOR" && { { echo "$as_me:1143: error: missing major-version" >&5 +echo "$as_me: error: missing major-version" >&2;} + { (exit 1); exit 1; }; } + + VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[^.]*\.//' -e 's/-.*//'` + test -z "$VERSION_MINOR" && { { echo "$as_me:1148: error: missing minor-version" >&5 +echo "$as_me: error: missing minor-version" >&2;} + { (exit 1); exit 1; }; } + + echo "$as_me:1152: result: ${VERSION_MAJOR}.${VERSION_MINOR}" >&5 +echo "${ECHO_T}${VERSION_MAJOR}.${VERSION_MINOR}" >&6 + + echo "$as_me:1155: checking for package patch date" >&5 +echo $ECHO_N "checking for package patch date... $ECHO_C" >&6 + VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[^-]*-//'` + case .$VERSION_PATCH in + (.) + { { echo "$as_me:1160: error: missing patch-date $VERSION_PATCH" >&5 +echo "$as_me: error: missing patch-date $VERSION_PATCH" >&2;} + { (exit 1); exit 1; }; } + ;; + (.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + ;; + (*) + { { echo "$as_me:1167: error: illegal patch-date $VERSION_PATCH" >&5 +echo "$as_me: error: illegal patch-date $VERSION_PATCH" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + echo "$as_me:1172: result: $VERSION_PATCH" >&5 +echo "${ECHO_T}$VERSION_PATCH" >&6 +else + { { echo "$as_me:1175: error: did not find $srcdir/VERSION" >&5 +echo "$as_me: error: did not find $srcdir/VERSION" >&2;} + { (exit 1); exit 1; }; } +fi + +# show the actual data that we have for versions: +test -n "$verbose" && echo " ABI VERSION $VERSION" 1>&6 + +echo "${as_me:-configure}:1183: testing ABI VERSION $VERSION ..." 1>&5 + +test -n "$verbose" && echo " VERSION_MAJOR $VERSION_MAJOR" 1>&6 + +echo "${as_me:-configure}:1187: testing VERSION_MAJOR $VERSION_MAJOR ..." 1>&5 + +test -n "$verbose" && echo " VERSION_MINOR $VERSION_MINOR" 1>&6 + +echo "${as_me:-configure}:1191: testing VERSION_MINOR $VERSION_MINOR ..." 1>&5 + +test -n "$verbose" && echo " VERSION_PATCH $VERSION_PATCH" 1>&6 + +echo "${as_me:-configure}:1195: testing VERSION_PATCH $VERSION_PATCH ..." 1>&5 + + cf_PACKAGE=cdk + PACKAGE=cdk + +cat >>confdefs.h <>confdefs.h <>confdefs.h <&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1240: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1248: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1251: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:1260: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1275: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1283: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1286: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1299: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1314: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1322: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1325: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1334: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1349: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1357: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1360: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1373: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1393: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1415: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1418: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1429: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1444: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1452: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1455: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1468: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1483: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1491: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1494: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1506: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1511:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1514: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:1517: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1519: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:1522: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1524: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:1527: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1531 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1547: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1550: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1553: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1576: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1582: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1587: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1593: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1596: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1603: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1611: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1618: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1620: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1623: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1625: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1628: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1644: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1650: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1656: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1662 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1674: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1677: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1689: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1696: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1700: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1706 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1721: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1724: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1727: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1730: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1742: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1748: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1754 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1766: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1769: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1772: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1775: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1785: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1812: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1815: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1818: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1821: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1833 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1846: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1849: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1852: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1855: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1865 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1877: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1880: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1883: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1886: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -rf conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +GCC_VERSION=none +if test "$GCC" = yes ; then + echo "$as_me:1916: checking version of $CC" >&5 +echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 + GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" + test -z "$GCC_VERSION" && GCC_VERSION=unknown + echo "$as_me:1920: result: $GCC_VERSION" >&5 +echo "${ECHO_T}$GCC_VERSION" >&6 +fi + +echo "$as_me:1924: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line 1932 "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:1981: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1984: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1987: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1990: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:2007: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:2010: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# This should have been defined by AC_PROG_CC +: ${CC:=cc} + +echo "$as_me:2018: checking \$CC variable" >&5 +echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 +case "$CC" in +(*[\ \ ]-*) + echo "$as_me:2022: result: broken" >&5 +echo "${ECHO_T}broken" >&6 + { echo "$as_me:2024: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 +echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} + # humor him... + cf_flags=`echo "$CC" | sed -e 's/^.*[ ]\(-[^ ]\)/\1/'` + CC=`echo "$CC " | sed -e 's/[ ]-[^ ].*$//' -e 's/[ ]*$//'` + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[IUDfgOW]*) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_flags +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done + test -n "$verbose" && echo " resulting CC: '$CC'" 1>&6 + +echo "${as_me:-configure}:2120: testing resulting CC: '$CC' ..." 1>&5 + + test -n "$verbose" && echo " resulting CFLAGS: '$CFLAGS'" 1>&6 + +echo "${as_me:-configure}:2124: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5 + + test -n "$verbose" && echo " resulting CPPFLAGS: '$CPPFLAGS'" 1>&6 + +echo "${as_me:-configure}:2128: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5 + + ;; +(*) + echo "$as_me:2132: result: ok" >&5 +echo "${ECHO_T}ok" >&6 + ;; +esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return +echo "$as_me:2143: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2164 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:2169: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2175: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2198 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2202: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2208: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:2245: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2255 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:2260: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2266: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2289 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2293: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2299: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:2327: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:2342: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:2357: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:2365: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:2368: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:2377: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:2392: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:2401: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:2404: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:2425: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:2474: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:2485: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:2489: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:2492: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +echo "$as_me:2496: checking if $LN_S -f options work" >&5 +echo $ECHO_N "checking if $LN_S -f options work... $ECHO_C" >&6 + +rm -f conf$$.src conf$$dst +echo >conf$$.dst +echo first >conf$$.src +if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then + cf_prog_ln_sf=yes +else + cf_prog_ln_sf=no +fi +rm -f conf$$.dst conf$$src +echo "$as_me:2508: result: $cf_prog_ln_sf" >&5 +echo "${ECHO_T}$cf_prog_ln_sf" >&6 + +test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" + +for ac_prog in lint cppcheck splint +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2517: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LINT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LINT"; then + ac_cv_prog_LINT="$LINT" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_LINT="$ac_prog" +echo "$as_me:2532: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +LINT=$ac_cv_prog_LINT +if test -n "$LINT"; then + echo "$as_me:2540: result: $LINT" >&5 +echo "${ECHO_T}$LINT" >&6 +else + echo "$as_me:2543: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$LINT" && break +done + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo "$as_me:2553: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_AR="${ac_tool_prefix}ar" +echo "$as_me:2568: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:2576: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:2579: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:2588: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_AR="ar" +echo "$as_me:2603: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="ar" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:2612: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:2615: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + +echo "$as_me:2624: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:2644: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:2648: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +echo "$as_me:2653: checking for makeflags variable" >&5 +echo $ECHO_N "checking for makeflags variable... $ECHO_C" >&6 +if test "${cf_cv_makeflags+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_makeflags='' + for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' + do + cat >cf_makeflags.tmp </dev/null | fgrep -v "ing directory" | sed -e 's,[ ]*$,,'` + case "$cf_result" in + (.*k|.*kw) + cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` + case "$cf_result" in + (.*CC=*) cf_cv_makeflags= + ;; + (*) cf_cv_makeflags=$cf_option + ;; + esac + break + ;; + (.-) ;; + (*) echo "given option \"$cf_option\", no match \"$cf_result\"" + ;; + esac + done + rm -f cf_makeflags.tmp + +fi +echo "$as_me:2687: result: $cf_cv_makeflags" >&5 +echo "${ECHO_T}$cf_cv_makeflags" >&6 + +echo "$as_me:2690: checking if filesystem supports mixed-case filenames" >&5 +echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 +if test "${cf_cv_mixedcase+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +if test "$cross_compiling" = yes ; then + case $target_alias in + (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) + cf_cv_mixedcase=no + ;; + (*) + cf_cv_mixedcase=yes + ;; + esac +else + rm -f conftest CONFTEST + echo test >conftest + if test -f CONFTEST ; then + cf_cv_mixedcase=no + else + cf_cv_mixedcase=yes + fi + rm -f conftest CONFTEST +fi + +fi +echo "$as_me:2717: result: $cf_cv_mixedcase" >&5 +echo "${ECHO_T}$cf_cv_mixedcase" >&6 +test "$cf_cv_mixedcase" = yes && +cat >>confdefs.h <<\EOF +#define MIXEDCASE_FILENAMES 1 +EOF + +for ac_prog in exctags ctags +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2728: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CTAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CTAGS"; then + ac_cv_prog_CTAGS="$CTAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CTAGS="$ac_prog" +echo "$as_me:2743: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CTAGS=$ac_cv_prog_CTAGS +if test -n "$CTAGS"; then + echo "$as_me:2751: result: $CTAGS" >&5 +echo "${ECHO_T}$CTAGS" >&6 +else + echo "$as_me:2754: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CTAGS" && break +done + +for ac_prog in exetags etags +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2765: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ETAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ETAGS"; then + ac_cv_prog_ETAGS="$ETAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ETAGS="$ac_prog" +echo "$as_me:2780: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ETAGS=$ac_cv_prog_ETAGS +if test -n "$ETAGS"; then + echo "$as_me:2788: result: $ETAGS" >&5 +echo "${ECHO_T}$ETAGS" >&6 +else + echo "$as_me:2791: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ETAGS" && break +done + +# Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. +set dummy ${CTAGS:-ctags}; ac_word=$2 +echo "$as_me:2800: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$MAKE_LOWER_TAGS"; then + ac_cv_prog_MAKE_LOWER_TAGS="$MAKE_LOWER_TAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_MAKE_LOWER_TAGS="yes" +echo "$as_me:2815: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_MAKE_LOWER_TAGS" && ac_cv_prog_MAKE_LOWER_TAGS="no" +fi +fi +MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS +if test -n "$MAKE_LOWER_TAGS"; then + echo "$as_me:2824: result: $MAKE_LOWER_TAGS" >&5 +echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 +else + echo "$as_me:2827: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$cf_cv_mixedcase" = yes ; then + # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. +set dummy ${ETAGS:-etags}; ac_word=$2 +echo "$as_me:2834: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$MAKE_UPPER_TAGS"; then + ac_cv_prog_MAKE_UPPER_TAGS="$MAKE_UPPER_TAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_MAKE_UPPER_TAGS="yes" +echo "$as_me:2849: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_MAKE_UPPER_TAGS" && ac_cv_prog_MAKE_UPPER_TAGS="no" +fi +fi +MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS +if test -n "$MAKE_UPPER_TAGS"; then + echo "$as_me:2858: result: $MAKE_UPPER_TAGS" >&5 +echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 +else + echo "$as_me:2861: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +else + MAKE_UPPER_TAGS=no +fi + +if test "$MAKE_UPPER_TAGS" = yes ; then + MAKE_UPPER_TAGS= +else + MAKE_UPPER_TAGS="#" +fi + +if test "$MAKE_LOWER_TAGS" = yes ; then + MAKE_LOWER_TAGS= +else + MAKE_LOWER_TAGS="#" +fi + +cf_XOPEN_SOURCE=500 +cf_POSIX_C_SOURCE=199506L +cf_xopen_source= + +case $host_os in +(aix[4-7]*) + cf_xopen_source="-D_ALL_SOURCE" + ;; +(msys) + cf_XOPEN_SOURCE=600 + ;; +(darwin[0-8].*) + cf_xopen_source="-D_APPLE_C_SOURCE" + ;; +(darwin*) + cf_xopen_source="-D_DARWIN_C_SOURCE" + cf_XOPEN_SOURCE= + ;; +(freebsd*|dragonfly*) + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +(hpux11*) + cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" + ;; +(hpux*) + cf_xopen_source="-D_HPUX_SOURCE" + ;; +(irix[56].*) + cf_xopen_source="-D_SGI_SOURCE" + cf_XOPEN_SOURCE= + ;; +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) + +echo "$as_me:2919: checking if we must define _GNU_SOURCE" >&5 +echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_gnu_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 2926 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2941: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2944: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2947: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2950: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 2959 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2974: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2977: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2980: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2983: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_gnu_source=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:2998: result: $cf_cv_gnu_source" >&5 +echo "${ECHO_T}$cf_cv_gnu_source" >&6 + +if test "$cf_cv_gnu_source" = yes +then +echo "$as_me:3003: checking if we should also define _DEFAULT_SOURCE" >&5 +echo $ECHO_N "checking if we should also define _DEFAULT_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_default_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 3011 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifdef _DEFAULT_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3026: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3029: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3032: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3035: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_default_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_default_source=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3046: result: $cf_cv_default_source" >&5 +echo "${ECHO_T}$cf_cv_default_source" >&6 +test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" +fi + + ;; +(minix*) + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; +(mirbsd*) + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types + cf_XOPEN_SOURCE= + +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +echo "$as_me:3072: checking if we should define _POSIX_C_SOURCE" >&5 +echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_posix_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +echo "${as_me:-configure}:3078: testing if the symbol is already defined go no further ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3081 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3096: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3099: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3102: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3105: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_c_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + (.[12]??*) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + (.2) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + (.*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + cat >conftest.$ac_ext <<_ACEOF +#line 3126 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifdef _POSIX_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3141: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3144: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3147: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3150: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + +echo "${as_me:-configure}:3161: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 + + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" + +echo "${as_me:-configure}:3166: testing if the second compile does not leave our definition intact error ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3169 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3184: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3187: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3190: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3193: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3209: result: $cf_cv_posix_c_source" >&5 +echo "${ECHO_T}$cf_cv_posix_c_source" >&6 + +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_cv_posix_c_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +fi + + ;; +(netbsd*) + cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +(openbsd[4-9]*) + # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw + cf_xopen_source="-D_BSD_SOURCE" + cf_XOPEN_SOURCE=600 + ;; +(openbsd*) + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +(osf[45]*) + cf_xopen_source="-D_OSF_SOURCE" + ;; +(nto-qnx*) + cf_xopen_source="-D_QNX_SOURCE" + ;; +(sco*) + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +(solaris2.*) + cf_xopen_source="-D__EXTENSIONS__" + cf_cv_xopen_source=broken + ;; +(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) + cf_XOPEN_SOURCE= + cf_POSIX_C_SOURCE= + ;; +(*) + +echo "$as_me:3327: checking if we should define _XOPEN_SOURCE" >&5 +echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_xopen_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 3334 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main () +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3353: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3356: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3359: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3362: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 3371 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main () +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3390: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3393: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3396: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3399: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xopen_source=$cf_XOPEN_SOURCE +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3414: result: $cf_cv_xopen_source" >&5 +echo "${ECHO_T}$cf_cv_xopen_source" >&6 + +if test "$cf_cv_xopen_source" != no ; then + +CFLAGS=`echo "$CFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_temp_xopen_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +fi + +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +echo "$as_me:3522: checking if we should define _POSIX_C_SOURCE" >&5 +echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_posix_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +echo "${as_me:-configure}:3528: testing if the symbol is already defined go no further ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3531 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3546: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3549: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3552: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3555: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_c_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + (.[12]??*) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + (.2) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + (.*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + cat >conftest.$ac_ext <<_ACEOF +#line 3576 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifdef _POSIX_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3591: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3594: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3597: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3600: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + +echo "${as_me:-configure}:3611: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 + + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" + +echo "${as_me:-configure}:3616: testing if the second compile does not leave our definition intact error ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3619 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3634: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3637: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3640: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3643: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3659: result: $cf_cv_posix_c_source" >&5 +echo "${ECHO_T}$cf_cv_posix_c_source" >&6 + +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_cv_posix_c_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +fi + + ;; +esac + +if test -n "$cf_xopen_source" ; then + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_xopen_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:3817: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:3825: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:3833: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +fi + +if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then + echo "$as_me:3841: checking if _XOPEN_SOURCE really is set" >&5 +echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 3844 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3859: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3862: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3865: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3868: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_XOPEN_SOURCE_set=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_XOPEN_SOURCE_set=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:3877: result: $cf_XOPEN_SOURCE_set" >&5 +echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 + if test $cf_XOPEN_SOURCE_set = yes + then + cat >conftest.$ac_ext <<_ACEOF +#line 3882 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3897: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3900: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3903: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3906: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_XOPEN_SOURCE_set_ok=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_XOPEN_SOURCE_set_ok=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + if test $cf_XOPEN_SOURCE_set_ok = no + then + { echo "$as_me:3917: WARNING: _XOPEN_SOURCE is lower than requested" >&5 +echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} + fi + else + +echo "$as_me:3922: checking if we should define _XOPEN_SOURCE" >&5 +echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_xopen_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 3929 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main () +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3948: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3951: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3954: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3957: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 3966 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main () +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3985: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3988: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3991: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3994: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xopen_source=$cf_XOPEN_SOURCE +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:4009: result: $cf_cv_xopen_source" >&5 +echo "${ECHO_T}$cf_cv_xopen_source" >&6 + +if test "$cf_cv_xopen_source" != no ; then + +CFLAGS=`echo "$CFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_temp_xopen_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +fi + + fi +fi + +echo "$as_me:4107: checking if you want to see long compiling messages" >&5 +echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 + +# Check whether --enable-echo or --disable-echo was given. +if test "${enable_echo+set}" = set; then + enableval="$enable_echo" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + + ECHO_LT='--silent' + ECHO_LD='@echo linking $@;' + RULE_CC='@echo compiling $<' + SHOW_CC='@echo compiling $@' + ECHO_CC='@' + + else + + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' + + fi +else + enableval=yes + + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' + +fi; +echo "$as_me:4141: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 + +case $cf_cv_system_name in +(os2*) + CFLAGS="$CFLAGS -Zmt" + CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" + CXXFLAGS="$CXXFLAGS -Zmt" + # autoconf's macro sets -Zexe and suffix both, which conflict:w + LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" + ac_cv_exeext=.exe + ;; +esac + +PROG_EXT="$EXEEXT" + +test -n "$PROG_EXT" && +cat >>confdefs.h <&5 +echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6 + +# Check whether --with-curses-dir or --without-curses-dir was given. +if test "${with_curses_dir+set}" = set; then + withval="$with_curses_dir" + cf_cv_curses_dir=$withval +else + cf_cv_curses_dir=no +fi; +echo "$as_me:4198: result: $cf_cv_curses_dir" >&5 +echo "${ECHO_T}$cf_cv_curses_dir" >&6 + +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$withval" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval withval="$withval" + case ".$withval" in + (.NONE/*) + withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:4229: error: expected a pathname, not \"$withval\"" >&5 +echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + + if test -d "$cf_cv_curses_dir" + then + +if test -n "$cf_cv_curses_dir/include" ; then + for cf_add_incdir in $cf_cv_curses_dir/include + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 4262 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4274: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4277: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4280: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4283: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:4300: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + +if test -n "$cf_cv_curses_dir/lib" ; then + for cf_add_libdir in $cf_cv_curses_dir/lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me:-configure}:4336: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + fi +fi + +if ( test "$GCC" = yes || test "$GXX" = yes ) +then +echo "$as_me:4349: checking if you want to check for gcc warnings" >&5 +echo $ECHO_N "checking if you want to check for gcc warnings... $ECHO_C" >&6 + +# Check whether --with-warnings or --without-warnings was given. +if test "${with_warnings+set}" = set; then + withval="$with_warnings" + cf_opt_with_warnings=$withval +else + cf_opt_with_warnings=no +fi; +echo "$as_me:4359: result: $cf_opt_with_warnings" >&5 +echo "${ECHO_T}$cf_opt_with_warnings" >&6 +if test "$cf_opt_with_warnings" != no ; then + +if test "$GCC" = yes +then +cat > conftest.i <&5 +echo "$as_me: checking for $CC __attribute__ directives..." >&6;} +cat > conftest.$ac_ext <&5 + + case $cf_attribute in + (printf) + cf_printf_attribute=yes + cat >conftest.h <conftest.h <conftest.h <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4436: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:4438: result: ... $cf_attribute" >&5 +echo "${ECHO_T}... $cf_attribute" >&6 + cat conftest.h >>confdefs.h + case $cf_attribute in + (noreturn) + +cat >>confdefs.h <>confdefs.h <<\EOF +#define GCC_PRINTF 1 +EOF + + fi + +cat >>confdefs.h <>confdefs.h <<\EOF +#define GCC_SCANF 1 +EOF + + fi + +cat >>confdefs.h <>confdefs.h <>confdefs.h +fi +rm -rf conftest* +fi + +INTEL_COMPILER=no + +if test "$GCC" = yes ; then + case $host_os in + (linux*|gnu*) + echo "$as_me:4502: checking if this is really Intel C compiler" >&5 +echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -no-gcc" + cat >conftest.$ac_ext <<_ACEOF +#line 4507 "configure" +#include "confdefs.h" + +int +main () +{ + +#ifdef __INTEL_COMPILER +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4524: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4527: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4530: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4533: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + INTEL_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + echo "$as_me:4544: result: $INTEL_COMPILER" >&5 +echo "${ECHO_T}$INTEL_COMPILER" >&6 + ;; + esac +fi + +CLANG_COMPILER=no + +if test "$GCC" = yes ; then + echo "$as_me:4553: checking if this is really Clang C compiler" >&5 +echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Qunused-arguments" + cat >conftest.$ac_ext <<_ACEOF +#line 4558 "configure" +#include "confdefs.h" + +int +main () +{ + +#ifdef __clang__ +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4575: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4578: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4581: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4584: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + CLANG_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + echo "$as_me:4595: result: $CLANG_COMPILER" >&5 +echo "${ECHO_T}$CLANG_COMPILER" >&6 +fi + +cat > conftest.$ac_ext <&5 +echo "$as_me: checking for $CC warning options..." >&6;} + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-Wall" + for cf_opt in \ + wd1419 \ + wd1683 \ + wd1684 \ + wd193 \ + wd593 \ + wd279 \ + wd810 \ + wd869 \ + wd981 + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo "$as_me:4633: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4636: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:4638: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + fi + done + CFLAGS="$cf_save_CFLAGS" + +elif test "$GCC" = yes +then + { echo "$as_me:4647: checking for $CC warning options..." >&5 +echo "$as_me: checking for $CC warning options..." >&6;} + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS= + cf_warn_CONST="" + test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" + test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= + for cf_opt in W Wall \ + Wbad-function-cast \ + Wcast-align \ + Wcast-qual \ + Wdeclaration-after-statement \ + Wextra \ + Winline \ + Wmissing-declarations \ + Wmissing-prototypes \ + Wnested-externs \ + Wpointer-arith \ + Wshadow \ + Wstrict-prototypes \ + Wundef $cf_gcc_warnings $cf_warn_CONST + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo "$as_me:4671: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4674: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:4676: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + case $cf_opt in + (Wcast-qual) + CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" + ;; + (Winline) + case $GCC_VERSION in + ([34].*) + test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 + +echo "${as_me:-configure}:4687: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 + + continue;; + esac + ;; + (Wpointer-arith) + case $GCC_VERSION in + ([12].*) + test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 + +echo "${as_me:-configure}:4697: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 + + continue;; + esac + ;; + esac + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + fi + done + CFLAGS="$cf_save_CFLAGS" +fi +rm -rf conftest* + +fi +fi + +echo "$as_me:4713: checking if you want to use pkg-config" >&5 +echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6 + +# Check whether --with-pkg-config or --without-pkg-config was given. +if test "${with_pkg_config+set}" = set; then + withval="$with_pkg_config" + cf_pkg_config=$withval +else + cf_pkg_config=yes +fi; +echo "$as_me:4723: result: $cf_pkg_config" >&5 +echo "${ECHO_T}$cf_pkg_config" >&6 + +case $cf_pkg_config in +(no) + PKG_CONFIG=none + ;; +(yes) + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +echo "$as_me:4735: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:4752: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:4763: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:4766: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:4775: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:4792: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="none" + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:4804: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:4807: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + + ;; +(*) + PKG_CONFIG=$withval + ;; +esac + +test -z "$PKG_CONFIG" && PKG_CONFIG=none +if test "$PKG_CONFIG" != none ; then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$PKG_CONFIG" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval PKG_CONFIG="$PKG_CONFIG" + case ".$PKG_CONFIG" in + (.NONE/*) + PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:4850: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 +echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +elif test "x$cf_pkg_config" != xno ; then + { echo "$as_me:4857: WARNING: pkg-config is not installed" >&5 +echo "$as_me: WARNING: pkg-config is not installed" >&2;} +fi + +echo "$as_me:4861: checking if rpath option should be used" >&5 +echo $ECHO_N "checking if rpath option should be used... $ECHO_C" >&6 + +# Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + cf_cv_enable_rpath=$enableval +else + cf_cv_enable_rpath=no +fi; +echo "$as_me:4871: result: $cf_cv_enable_rpath" >&5 +echo "${ECHO_T}$cf_cv_enable_rpath" >&6 + +LD_RPATH_OPT= +echo "$as_me:4875: checking for an rpath option" >&5 +echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6 +case $cf_cv_system_name in +(irix*) + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; +(linux*|gnu*|k*bsd*-gnu|freebsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; +(openbsd[2-9].*|mirbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; +(dragonfly*) + LD_RPATH_OPT="-rpath " + ;; +(netbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; +(osf*|mls+*) + LD_RPATH_OPT="-rpath " + ;; +(solaris2*) + LD_RPATH_OPT="-R" + ;; +(*) + ;; +esac +echo "$as_me:4906: result: $LD_RPATH_OPT" >&5 +echo "${ECHO_T}$LD_RPATH_OPT" >&6 + +case "x$LD_RPATH_OPT" in +(x-R*) + echo "$as_me:4911: checking if we need a space after rpath option" >&5 +echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6 + cf_save_LIBS="$LIBS" + +cf_add_libs="${LD_RPATH_OPT}$libdir" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 4932 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4944: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4947: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4950: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4953: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_rpath_space=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_rpath_space=yes +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS="$cf_save_LIBS" + echo "$as_me:4963: result: $cf_rpath_space" >&5 +echo "${ECHO_T}$cf_rpath_space" >&6 + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; +esac + +echo "$as_me:4969: checking if rpath-hack should be disabled" >&5 +echo $ECHO_N "checking if rpath-hack should be disabled... $ECHO_C" >&6 + +# Check whether --enable-rpath-hack or --disable-rpath-hack was given. +if test "${enable_rpath_hack+set}" = set; then + enableval="$enable_rpath_hack" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_disable_rpath_hack=yes + else + cf_disable_rpath_hack=no + fi +else + enableval=yes + cf_disable_rpath_hack=no + +fi; +echo "$as_me:4986: result: $cf_disable_rpath_hack" >&5 +echo "${ECHO_T}$cf_disable_rpath_hack" >&6 +if test "$cf_disable_rpath_hack" = no ; then + +echo "$as_me:4990: checking for updated LDFLAGS" >&5 +echo $ECHO_N "checking for updated LDFLAGS... $ECHO_C" >&6 +if test -n "$LD_RPATH_OPT" ; then + echo "$as_me:4993: result: maybe" >&5 +echo "${ECHO_T}maybe" >&6 + + for ac_prog in ldd +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:5000: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_cf_ldd_prog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$cf_ldd_prog"; then + ac_cv_prog_cf_ldd_prog="$cf_ldd_prog" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_cf_ldd_prog="$ac_prog" +echo "$as_me:5015: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +cf_ldd_prog=$ac_cv_prog_cf_ldd_prog +if test -n "$cf_ldd_prog"; then + echo "$as_me:5023: result: $cf_ldd_prog" >&5 +echo "${ECHO_T}$cf_ldd_prog" >&6 +else + echo "$as_me:5026: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$cf_ldd_prog" && break +done +test -n "$cf_ldd_prog" || cf_ldd_prog="no" + + cf_rpath_list="/usr/lib /lib" + if test "$cf_ldd_prog" != no + then + cf_rpath_oops= + +cat >conftest.$ac_ext <<_ACEOF +#line 5040 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5052: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5055: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5058: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5061: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` + cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ ]/%/%' -e 's%/[^/][^/]*$%%' |sort | uniq` +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + + # If we passed the link-test, but get a "not found" on a given library, + # this could be due to inept reconfiguration of gcc to make it only + # partly honor /usr/local/lib (or whatever). Sometimes this behavior + # is intentional, e.g., installing gcc in /usr/bin and suppressing the + # /usr/local libraries. + if test -n "$cf_rpath_oops" + then + for cf_rpath_src in $cf_rpath_oops + do + for cf_rpath_dir in \ + /usr/local \ + /usr/pkg \ + /opt/sfw + do + if test -f $cf_rpath_dir/lib/$cf_rpath_src + then + test -n "$verbose" && echo " ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src" 1>&6 + +echo "${as_me:-configure}:5089: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 + + LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" + break + fi + done + done + fi + fi + + test -n "$verbose" && echo " ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 + +echo "${as_me:-configure}:5101: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 + +test -n "$verbose" && echo " ...checking LDFLAGS $LDFLAGS" 1>&6 + +echo "${as_me:-configure}:5105: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 + +cf_rpath_dst= +for cf_rpath_src in $LDFLAGS +do + case $cf_rpath_src in + (-L*) + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 + +echo "${as_me:-configure}:5142: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 + + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +LDFLAGS=$cf_rpath_dst + +test -n "$verbose" && echo " ...checked LDFLAGS $LDFLAGS" 1>&6 + +echo "${as_me:-configure}:5155: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 + +test -n "$verbose" && echo " ...checking LIBS $LIBS" 1>&6 + +echo "${as_me:-configure}:5159: testing ...checking LIBS $LIBS ..." 1>&5 + +cf_rpath_dst= +for cf_rpath_src in $LIBS +do + case $cf_rpath_src in + (-L*) + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 + +echo "${as_me:-configure}:5196: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 + + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +LIBS=$cf_rpath_dst + +test -n "$verbose" && echo " ...checked LIBS $LIBS" 1>&6 + +echo "${as_me:-configure}:5209: testing ...checked LIBS $LIBS ..." 1>&5 + + test -n "$verbose" && echo " ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 + +echo "${as_me:-configure}:5213: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 + +else + echo "$as_me:5216: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi + +REL_VERSION=${VERSION_MAJOR}.${VERSION_MINOR} +ABI_VERSION=`echo "$VERSION" |sed -e 's/:/./g'` +cf_cv_rel_version=$REL_VERSION + +test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0 + +# Check whether --with-rel-version or --without-rel-version was given. +if test "${with_rel_version+set}" = set; then + withval="$with_rel_version" + { echo "$as_me:5231: WARNING: overriding release version $cf_cv_rel_version to $withval" >&5 +echo "$as_me: WARNING: overriding release version $cf_cv_rel_version to $withval" >&2;} + cf_cv_rel_version=$withval +fi; + + CDK_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'` + CDK_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[^.]*//' -e 's/^\.//' -e 's/\..*//'` + +if test -n "$CDK_MAJOR" ; then + case $CDK_MAJOR in + ([0-9]*) + ;; + (*) + { { echo "$as_me:5244: error: Release major-version is not a number: $CDK_MAJOR" >&5 +echo "$as_me: error: Release major-version is not a number: $CDK_MAJOR" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +else + { { echo "$as_me:5250: error: Release major-version value is empty" >&5 +echo "$as_me: error: Release major-version value is empty" >&2;} + { (exit 1); exit 1; }; } +fi + +if test -n "$CDK_MINOR" ; then + case $CDK_MINOR in + ([0-9]*) + ;; + (*) + { { echo "$as_me:5260: error: Release minor-version is not a number: $CDK_MINOR" >&5 +echo "$as_me: error: Release minor-version is not a number: $CDK_MINOR" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +else + { { echo "$as_me:5266: error: Release minor-version value is empty" >&5 +echo "$as_me: error: Release minor-version value is empty" >&2;} + { (exit 1); exit 1; }; } +fi + +test -z "$cf_cv_abi_version" && cf_cv_abi_version=0 + +# Check whether --with-abi-version or --without-abi-version was given. +if test "${with_abi_version+set}" = set; then + withval="$with_abi_version" + + if test "x$cf_cv_abi_version" != "x$withval" + then + { echo "$as_me:5279: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&5 +echo "$as_me: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&2;} + case $cf_cv_rel_version in + (5.*) + cf_cv_rel_version=$withval.0 + ;; + (6.*) + cf_cv_rel_version=$withval.9 # FIXME: should be 10 as of 6.0 release + ;; + esac + fi + cf_cv_abi_version=$withval +fi; + +if test -n "$cf_cv_abi_version" ; then + case $cf_cv_abi_version in + ([0-9]*) + ;; + (*) + { { echo "$as_me:5298: error: ABI version is not a number: $cf_cv_abi_version" >&5 +echo "$as_me: error: ABI version is not a number: $cf_cv_abi_version" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +else + { { echo "$as_me:5304: error: ABI version value is empty" >&5 +echo "$as_me: error: ABI version value is empty" >&2;} + { (exit 1); exit 1; }; } +fi + +LIB_MODEL=static +DFT_LWR_MODEL=$LIB_MODEL +LIBTOOL_MAKE="#" + +# use to comment-out makefile lines +MAKE_NORMAL= +MAKE_STATIC= +MAKE_SHARED="#" +MAKE_DLLS="#" + +shlibdir=$libdir + +echo "$as_me:5321: checking if libtool -version-number should be used" >&5 +echo $ECHO_N "checking if libtool -version-number should be used... $ECHO_C" >&6 + +# Check whether --enable-libtool-version or --disable-libtool-version was given. +if test "${enable_libtool_version+set}" = set; then + enableval="$enable_libtool_version" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_libtool_version=no + else + cf_libtool_version=yes + fi +else + enableval=yes + cf_libtool_version=yes + +fi; +echo "$as_me:5338: result: $cf_libtool_version" >&5 +echo "${ECHO_T}$cf_libtool_version" >&6 + +if test "$cf_libtool_version" = yes ; then + LIBTOOL_VERSION="-version-number" +else + LIBTOOL_VERSION="-version-info" + case "x$VERSION" in + (x) + { echo "$as_me:5347: WARNING: VERSION was not set" >&5 +echo "$as_me: WARNING: VERSION was not set" >&2;} + ;; + (x*.*.*) + ABI_VERSION="$VERSION" + test -n "$verbose" && echo " ABI_VERSION: $ABI_VERSION" 1>&6 + +echo "${as_me:-configure}:5354: testing ABI_VERSION: $ABI_VERSION ..." 1>&5 + + ;; + (x*:*:*) + ABI_VERSION=`echo "$VERSION" | sed -e 's/:/./g'` + test -n "$verbose" && echo " ABI_VERSION: $ABI_VERSION" 1>&6 + +echo "${as_me:-configure}:5361: testing ABI_VERSION: $ABI_VERSION ..." 1>&5 + + ;; + (*) + { echo "$as_me:5365: WARNING: unexpected VERSION value: $VERSION" >&5 +echo "$as_me: WARNING: unexpected VERSION value: $VERSION" >&2;} + ;; + esac +fi + +LIBTOOL= + +# common library maintenance symbols that are convenient for libtool scripts: +LIB_CREATE='${AR} -cr' +LIB_OBJECT='${OBJECTS}' +LIB_SUFFIX=.a +LIB_PREP="$RANLIB" + +# symbols used to prop libtool up to enable it to determine what it should be +# doing: +LIB_CLEAN= +LIB_COMPILE= +LIB_LINK='${CC}' +LIB_INSTALL= +LIB_UNINSTALL= + +echo "$as_me:5387: checking if you want to build libraries with libtool" >&5 +echo $ECHO_N "checking if you want to build libraries with libtool... $ECHO_C" >&6 + +# Check whether --with-libtool or --without-libtool was given. +if test "${with_libtool+set}" = set; then + withval="$with_libtool" + with_libtool=$withval +else + with_libtool=no +fi; +echo "$as_me:5397: result: $with_libtool" >&5 +echo "${ECHO_T}$with_libtool" >&6 +if test "$with_libtool" != "no"; then + + if test "$with_libtool" != "yes" ; then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$with_libtool" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval with_libtool="$with_libtool" + case ".$with_libtool" in + (.NONE/*) + with_libtool=`echo $with_libtool | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + with_libtool=`echo $with_libtool | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:5428: error: expected a pathname, not \"$with_libtool\"" >&5 +echo "$as_me: error: expected a pathname, not \"$with_libtool\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + + LIBTOOL=$with_libtool + else + if test -n "$ac_tool_prefix"; then + for ac_prog in libtool glibtool + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:5441: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LIBTOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LIBTOOL"; then + ac_cv_prog_LIBTOOL="$LIBTOOL" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_LIBTOOL="$ac_tool_prefix$ac_prog" +echo "$as_me:5456: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +LIBTOOL=$ac_cv_prog_LIBTOOL +if test -n "$LIBTOOL"; then + echo "$as_me:5464: result: $LIBTOOL" >&5 +echo "${ECHO_T}$LIBTOOL" >&6 +else + echo "$as_me:5467: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$LIBTOOL" && break + done +fi +if test -z "$LIBTOOL"; then + ac_ct_LIBTOOL=$LIBTOOL + for ac_prog in libtool glibtool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:5480: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_LIBTOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_LIBTOOL"; then + ac_cv_prog_ac_ct_LIBTOOL="$ac_ct_LIBTOOL" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_LIBTOOL="$ac_prog" +echo "$as_me:5495: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_LIBTOOL=$ac_cv_prog_ac_ct_LIBTOOL +if test -n "$ac_ct_LIBTOOL"; then + echo "$as_me:5503: result: $ac_ct_LIBTOOL" >&5 +echo "${ECHO_T}$ac_ct_LIBTOOL" >&6 +else + echo "$as_me:5506: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_LIBTOOL" && break +done +test -n "$ac_ct_LIBTOOL" || ac_ct_LIBTOOL="none" + + LIBTOOL=$ac_ct_LIBTOOL +fi + +if test -n "$LIBTOOL" && test "$LIBTOOL" != none +then + cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'` +else + cf_cv_libtool_version= +fi +test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version + + if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool + then + +unset ac_cv_prog_ac_ct_LIBTOOL +unset ac_ct_LIBTOOL +unset LIBTOOL + + if test -n "$ac_tool_prefix"; then + for ac_prog in glibtool + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:5537: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LIBTOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LIBTOOL"; then + ac_cv_prog_LIBTOOL="$LIBTOOL" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_LIBTOOL="$ac_tool_prefix$ac_prog" +echo "$as_me:5552: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +LIBTOOL=$ac_cv_prog_LIBTOOL +if test -n "$LIBTOOL"; then + echo "$as_me:5560: result: $LIBTOOL" >&5 +echo "${ECHO_T}$LIBTOOL" >&6 +else + echo "$as_me:5563: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$LIBTOOL" && break + done +fi +if test -z "$LIBTOOL"; then + ac_ct_LIBTOOL=$LIBTOOL + for ac_prog in glibtool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:5576: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_LIBTOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_LIBTOOL"; then + ac_cv_prog_ac_ct_LIBTOOL="$ac_ct_LIBTOOL" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_LIBTOOL="$ac_prog" +echo "$as_me:5591: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_LIBTOOL=$ac_cv_prog_ac_ct_LIBTOOL +if test -n "$ac_ct_LIBTOOL"; then + echo "$as_me:5599: result: $ac_ct_LIBTOOL" >&5 +echo "${ECHO_T}$ac_ct_LIBTOOL" >&6 +else + echo "$as_me:5602: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_LIBTOOL" && break +done +test -n "$ac_ct_LIBTOOL" || ac_ct_LIBTOOL="none" + + LIBTOOL=$ac_ct_LIBTOOL +fi + +if test -n "$LIBTOOL" && test "$LIBTOOL" != none +then + cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'` +else + cf_cv_libtool_version= +fi +test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version + + fi + fi + if test -z "$LIBTOOL" ; then + { { echo "$as_me:5624: error: Cannot find libtool" >&5 +echo "$as_me: error: Cannot find libtool" >&2;} + { (exit 1); exit 1; }; } + fi + LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${top_srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o' + LIB_OBJECT='${OBJECTS:.o=.lo}' + LIB_SUFFIX=.la + LIB_CLEAN='${LIBTOOL} --mode=clean' + LIB_COMPILE='${LIBTOOL} --mode=compile' + LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}' + LIB_INSTALL='${LIBTOOL} --mode=install' + LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' + LIB_PREP=: + +if test -n "$LIBTOOL" && test "$LIBTOOL" != none +then + echo "$as_me:5640: checking version of $LIBTOOL" >&5 +echo $ECHO_N "checking version of $LIBTOOL... $ECHO_C" >&6 + +if test -n "$LIBTOOL" && test "$LIBTOOL" != none +then + cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'` +else + cf_cv_libtool_version= +fi +test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version + + echo "$as_me:5651: result: $cf_cv_libtool_version" >&5 +echo "${ECHO_T}$cf_cv_libtool_version" >&6 + if test -z "$cf_cv_libtool_version" ; then + { { echo "$as_me:5654: error: This is not GNU libtool" >&5 +echo "$as_me: error: This is not GNU libtool" >&2;} + { (exit 1); exit 1; }; } + fi +else + { { echo "$as_me:5659: error: GNU libtool has not been found" >&5 +echo "$as_me: error: GNU libtool has not been found" >&2;} + { (exit 1); exit 1; }; } +fi + + # special hack to add -no-undefined (which libtool should do for itself) + LT_UNDEF= + case "$cf_cv_system_name" in + (cygwin*|msys*|mingw32*|os2*|uwin*|aix[4-7]) + LT_UNDEF=-no-undefined + ;; + esac + + # special hack to add --tag option for C++ compiler + case $cf_cv_libtool_version in + (1.[5-9]*|[2-9].[0-9.a-z]*) + LIBTOOL_CXX="$LIBTOOL --tag=CXX" + LIBTOOL="$LIBTOOL --tag=CC" + ;; + (*) + LIBTOOL_CXX="$LIBTOOL" + ;; + esac +else + LIBTOOL="" + LIBTOOL_CXX="" +fi + +test -z "$LIBTOOL" && ECHO_LT= + +LIB_CREATE="$LIB_CREATE \$@" + +if test "$with_libtool" = "yes" ; then + OBJEXT="lo" + LIB_MODEL=libtool + DFT_LWR_MODEL=$LIB_MODEL + LIBTOOL_MAKE= + +echo "$as_me:5697: checking for additional libtool options" >&5 +echo $ECHO_N "checking for additional libtool options... $ECHO_C" >&6 + +# Check whether --with-libtool-opts or --without-libtool-opts was given. +if test "${with_libtool_opts+set}" = set; then + withval="$with_libtool_opts" + with_libtool_opts=$withval +else + with_libtool_opts=no +fi; +echo "$as_me:5707: result: $with_libtool_opts" >&5 +echo "${ECHO_T}$with_libtool_opts" >&6 + +case .$with_libtool_opts in +(.yes|.no|.) + ;; +(*) + LIBTOOL_OPTS="$LIBTOOL_OPTS $with_libtool_opts" + ;; +esac + +echo "$as_me:5718: checking if exported-symbols file should be used" >&5 +echo $ECHO_N "checking if exported-symbols file should be used... $ECHO_C" >&6 + +# Check whether --with-export-syms or --without-export-syms was given. +if test "${with_export_syms+set}" = set; then + withval="$with_export_syms" + with_export_syms=$withval +else + with_export_syms=no +fi; +if test "x$with_export_syms" = xyes +then + with_export_syms='${top_srcdir}/package/${PACKAGE}.sym' + +fi +echo "$as_me:5733: result: $with_export_syms" >&5 +echo "${ECHO_T}$with_export_syms" >&6 +if test "x$with_export_syms" != xno +then + EXPORT_SYMS="-export-symbols $with_export_syms" + +fi + + MAKE_NORMAL="#" + MAKE_STATIC="#" + MAKE_SHARED= +else + echo "$as_me:5745: checking if you want to build shared libraries" >&5 +echo $ECHO_N "checking if you want to build shared libraries... $ECHO_C" >&6 + +# Check whether --with-shared or --without-shared was given. +if test "${with_shared+set}" = set; then + withval="$with_shared" + with_shared=$withval +else + with_shared=no +fi; + echo "$as_me:5755: result: $with_shared" >&5 +echo "${ECHO_T}$with_shared" >&6 + if test "$with_shared" = "yes" ; then + LIB_MODEL=shared + DFT_LWR_MODEL=$LIB_MODEL + + RM_SHARED_OPTS= + LOCAL_LDFLAGS= + LOCAL_LDFLAGS2= + LD_SHARED_OPTS= + INSTALL_LIB="-m 644" + : ${rel_builddir:=.} + + shlibdir=$libdir + + MAKE_DLLS="#" + + cf_cv_do_symlinks=no + cf_ld_rpath_opt= + test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT" + + echo "$as_me:5776: checking if release/abi version should be used for shared libs" >&5 +echo $ECHO_N "checking if release/abi version should be used for shared libs... $ECHO_C" >&6 + +# Check whether --with-shlib-version or --without-shlib-version was given. +if test "${with_shlib_version+set}" = set; then + withval="$with_shlib_version" + test -z "$withval" && withval=auto + case $withval in + (yes) + cf_cv_shlib_version=auto + ;; + (rel|abi|auto) + cf_cv_shlib_version=$withval + ;; + (*) + echo "$as_me:5791: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6 + { { echo "$as_me:5793: error: option value must be one of: rel, abi, or auto" >&5 +echo "$as_me: error: option value must be one of: rel, abi, or auto" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + +else + cf_cv_shlib_version=auto +fi; + echo "$as_me:5802: result: $cf_cv_shlib_version" >&5 +echo "${ECHO_T}$cf_cv_shlib_version" >&6 + + cf_cv_rm_so_locs=no + cf_try_cflags= + + # Some less-capable ports of gcc support only -fpic + CC_SHARED_OPTS= + if test "$GCC" = yes + then + echo "$as_me:5812: checking which $CC option to use" >&5 +echo $ECHO_N "checking which $CC option to use... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + for CC_SHARED_OPTS in -fPIC -fpic '' + do + CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" + cat >conftest.$ac_ext <<_ACEOF +#line 5819 "configure" +#include "confdefs.h" +#include +int +main () +{ +int x = 1 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5831: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5834: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5837: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5840: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done + echo "$as_me:5849: result: $CC_SHARED_OPTS" >&5 +echo "${ECHO_T}$CC_SHARED_OPTS" >&6 + CFLAGS="$cf_save_CFLAGS" + fi + + cf_cv_shlib_version_infix=no + + case $cf_cv_system_name in + (aix4.3-9*|aix[5-7]*) + if test "$GCC" = yes; then + CC_SHARED_OPTS='-Wl,-brtl' + MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@' + else + CC_SHARED_OPTS='-brtl' + # as well as '-qpic=large -G' or perhaps "-bM:SRE -bnoentry -bexpall" + MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@' + fi + ;; + (beos*) + MK_SHARED_LIB='${CC} ${CFLAGS} -o $@ -Xlinker -soname=`basename $@` -nostart -e 0' + ;; + (cygwin*) + CC_SHARED_OPTS= + MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' + RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" + cf_cv_shlib_version=cygdll + cf_cv_shlib_version_infix=cygdll + shlibdir=$bindir + MAKE_DLLS= + cat >mk_shared_lib.sh <<-CF_EOF + #!$SHELL + SHARED_LIB=\$1 + IMPORT_LIB=\`echo "\$1" | sed -e 's/cyg/lib/' -e 's/[0-9]*\.dll$/.dll.a/'\` + shift + cat <<-EOF + Linking shared library + ** SHARED_LIB \$SHARED_LIB + ** IMPORT_LIB \$IMPORT_LIB +EOF + exec \$* -shared -Wl,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} +CF_EOF + chmod +x mk_shared_lib.sh + ;; + (msys*) + CC_SHARED_OPTS= + MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' + RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" + cf_cv_shlib_version=msysdll + cf_cv_shlib_version_infix=msysdll + shlibdir=$bindir + MAKE_DLLS= + cat >mk_shared_lib.sh <<-CF_EOF + #!$SHELL + SHARED_LIB=\$1 + IMPORT_LIB=\`echo "\$1" | sed -e 's/msys-/lib/' -e 's/[0-9]*\.dll$/.dll.a/'\` + shift + cat <<-EOF + Linking shared library + ** SHARED_LIB \$SHARED_LIB + ** IMPORT_LIB \$IMPORT_LIB +EOF + exec \$* -shared -Wl,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} +CF_EOF + chmod +x mk_shared_lib.sh + ;; + (darwin*) + cf_try_cflags="no-cpp-precomp" + CC_SHARED_OPTS="-dynamic" + MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $@` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $@' + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi + cf_cv_shlib_version_infix=yes + echo "$as_me:5920: checking if ld -search_paths_first works" >&5 +echo $ECHO_N "checking if ld -search_paths_first works... $ECHO_C" >&6 +if test "${cf_cv_ldflags_search_paths_first+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-search_paths_first" + cat >conftest.$ac_ext <<_ACEOF +#line 5929 "configure" +#include "confdefs.h" + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5941: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5944: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5947: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5950: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ldflags_search_paths_first=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_ldflags_search_paths_first=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$cf_save_LDFLAGS +fi +echo "$as_me:5961: result: $cf_cv_ldflags_search_paths_first" >&5 +echo "${ECHO_T}$cf_cv_ldflags_search_paths_first" >&6 + if test $cf_cv_ldflags_search_paths_first = yes; then + LDFLAGS="$LDFLAGS -Wl,-search_paths_first" + fi + ;; + (hpux[7-8]*) + # HP-UX 8.07 ld lacks "+b" option used for libdir search-list + if test "$GCC" != yes; then + CC_SHARED_OPTS='+Z' + fi + MK_SHARED_LIB='${LD} -b -o $@' + INSTALL_LIB="-m 555" + ;; + (hpux*) + # (tested with gcc 2.7.2 -- I don't have c89) + if test "$GCC" = yes; then + LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}' + else + CC_SHARED_OPTS='+Z' + LD_SHARED_OPTS='-Wl,+b,${libdir}' + fi + MK_SHARED_LIB='${LD} +b ${libdir} -b -o $@' + # HP-UX shared libraries must be executable, and should be + # readonly to exploit a quirk in the memory manager. + INSTALL_LIB="-m 555" + ;; + (interix*) + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + if test "$cf_cv_shlib_version" = rel; then + cf_shared_soname='`basename .${REL_VERSION}`.${ABI_VERSION}' + else + cf_shared_soname='`basename `' + fi + CC_SHARED_OPTS= + MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o ' + ;; + (irix*) + if test "$cf_cv_enable_rpath" = yes ; then + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + fi + # tested with IRIX 5.2 and 'cc'. + if test "$GCC" != yes; then + CC_SHARED_OPTS='-KPIC' + MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $@` -o $@' + else + MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $@` -o $@' + fi + cf_cv_rm_so_locs=yes + ;; + (linux*|gnu*|k*bsd*-gnu) + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + fi + if test "$cf_cv_enable_rpath" = yes ; then + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + fi + + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + if test "$cf_cv_shlib_version" = rel; then + cf_cv_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' + else + cf_cv_shared_soname='`basename $@`' + fi + + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@' + ;; + (mingw*) + cf_cv_shlib_version=mingw + cf_cv_shlib_version_infix=mingw + shlibdir=$bindir + MAKE_DLLS= + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="-Wl,--enable-auto-import" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS" + fi + CC_SHARED_OPTS= + MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh $@ ${CC} ${CFLAGS}' + RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" + cat >mk_shared_lib.sh <<-CF_EOF + #!$SHELL + SHARED_LIB=\$1 + IMPORT_LIB=\`echo "\$1" | sed -e 's/[0-9]*\.dll$/.dll.a/'\` + shift + cat <<-EOF + Linking shared library + ** SHARED_LIB \$SHARED_LIB + ** IMPORT_LIB \$IMPORT_LIB +EOF + exec \$* -shared -Wl,--enable-auto-import,--out-implib=\${IMPORT_LIB} -Wl,--export-all-symbols -o \${SHARED_LIB} +CF_EOF + chmod +x mk_shared_lib.sh + ;; + (openbsd[2-9].*|mirbsd*) + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + fi + if test "$cf_cv_enable_rpath" = yes ; then + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + fi + CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" + + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + if test "$cf_cv_shlib_version" = rel; then + cf_cv_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' + else + cf_cv_shared_soname='`basename $@`' + fi + + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@' + ;; + (nto-qnx*|openbsd*|freebsd[12].*) + CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" + MK_SHARED_LIB='${LD} -Bshareable -o $@' + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + ;; + (dragonfly*|freebsd*) + CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" + if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then + LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS" + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + fi + + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + if test "$cf_cv_shlib_version" = rel; then + cf_cv_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' + else + cf_cv_shared_soname='`basename $@`' + fi + + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@' + ;; + (netbsd*) + CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" + if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then + LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" + if test "$cf_cv_shlib_version" = auto; then + if test -f /usr/libexec/ld.elf_so; then + cf_cv_shlib_version=abi + else + cf_cv_shlib_version=rel + fi + fi + + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + if test "$cf_cv_shlib_version" = rel; then + cf_cv_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' + else + cf_cv_shared_soname='`basename $@`' + fi + + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $@' + else + MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $@' + fi + ;; + (osf*|mls+*) + # tested with OSF/1 V3.2 and 'cc' + # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't + # link with shared libs). + MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $@`' + case $host_os in + (osf4*) + MK_SHARED_LIB="${MK_SHARED_LIB} -msym" + ;; + esac + MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $@' + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + fi + cf_cv_rm_so_locs=yes + ;; + (sco3.2v5*) # also uw2* and UW7: hops 13-Apr-98 + # tested with osr5.0.5 + if test "$GCC" != yes; then + CC_SHARED_OPTS='-belf -KPIC' + fi + MK_SHARED_LIB='${LD} -dy -G -h `basename $@ .${REL_VERSION}`.${ABI_VERSION} -o $@' + if test "$cf_cv_enable_rpath" = yes ; then + # only way is to set LD_RUN_PATH but no switch for it + RUN_PATH=$libdir + fi + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + LINK_PROGS='LD_RUN_PATH=${libdir}' + LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib' + ;; + (sunos4*) + # tested with SunOS 4.1.1 and gcc 2.7.0 + if test "$GCC" != yes; then + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='${LD} -assert pure-text -o $@' + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + ;; + (solaris2*) + # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 + # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3 + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + fi + if test "$cf_cv_enable_rpath" = yes ; then + EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS" + fi + + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel + if test "$cf_cv_shlib_version" = rel; then + cf_cv_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' + else + cf_cv_shared_soname='`basename $@`' + fi + + if test "$GCC" != yes; then + cf_save_CFLAGS="$CFLAGS" + for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O + do + CFLAGS="$cf_shared_opts $cf_save_CFLAGS" + cat >conftest.$ac_ext <<_ACEOF +#line 6186 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello\n"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6198: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6201: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6204: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6207: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done + CFLAGS="$cf_save_CFLAGS" + CC_SHARED_OPTS=$cf_shared_opts + MK_SHARED_LIB='${CC} -dy -G -h '$cf_cv_shared_soname' -o $@' + else + MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $@' + fi + ;; + (sysv5uw7*|unix_sv*) + # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc) + if test "$GCC" != yes; then + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='${LD} -d y -G -o $@' + ;; + (*) + CC_SHARED_OPTS='unknown' + MK_SHARED_LIB='echo unknown' + ;; + esac + + # This works if the last tokens in $MK_SHARED_LIB are the -o target. + case "$cf_cv_shlib_version" in + (rel|abi) + case "$MK_SHARED_LIB" in + (*'-o $@') + test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes + ;; + (*) + { echo "$as_me:6244: WARNING: ignored --with-shlib-version" >&5 +echo "$as_me: WARNING: ignored --with-shlib-version" >&2;} + ;; + esac + ;; + esac + + if test -n "$cf_try_cflags" + then +cat > conftest.$ac_ext < +int main(int argc, char *argv[]) +{ + printf("hello\n"); + return (argv[argc-1] == 0) ; +} +EOF + cf_save_CFLAGS="$CFLAGS" + for cf_opt in $cf_try_cflags + do + CFLAGS="$cf_save_CFLAGS -$cf_opt" + echo "$as_me:6266: checking if CFLAGS option -$cf_opt works" >&5 +echo $ECHO_N "checking if CFLAGS option -$cf_opt works... $ECHO_C" >&6 + if { (eval echo "$as_me:6268: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6271: \$? = $ac_status" >&5 + (exit $ac_status); }; then + echo "$as_me:6273: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cf_save_CFLAGS="$CFLAGS" + else + echo "$as_me:6277: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + done + CFLAGS="$cf_save_CFLAGS" + fi + + # RPATH_LIST is a colon-separated list of directories + test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}" + test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}" + + test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" + + test -n "$verbose" && echo " CC_SHARED_OPTS: $CC_SHARED_OPTS" 1>&6 + +echo "${as_me:-configure}:6292: testing CC_SHARED_OPTS: $CC_SHARED_OPTS ..." 1>&5 + + test -n "$verbose" && echo " MK_SHARED_LIB: $MK_SHARED_LIB" 1>&6 + +echo "${as_me:-configure}:6296: testing MK_SHARED_LIB: $MK_SHARED_LIB ..." 1>&5 + +echo "$as_me:6298: checking if versioned-symbols file should be used" >&5 +echo $ECHO_N "checking if versioned-symbols file should be used... $ECHO_C" >&6 + +# Check whether --with-versioned-syms or --without-versioned-syms was given. +if test "${with_versioned_syms+set}" = set; then + withval="$with_versioned_syms" + with_versioned_syms=$withval +else + with_versioned_syms=no +fi; +if test "x$with_versioned_syms" = xyes +then + with_versioned_syms='${top_srcdir}/package/${PACKAGE}.map' + +fi +echo "$as_me:6313: result: $with_versioned_syms" >&5 +echo "${ECHO_T}$with_versioned_syms" >&6 + +RESULTING_SYMS= +VERSIONED_SYMS= +WILDCARD_SYMS= + +if test "x$with_versioned_syms" != xno +then + RESULTING_SYMS=$with_versioned_syms + case "x$MK_SHARED_LIB" in + (*-Wl,*) + VERSIONED_SYMS="-Wl,--version-script,\${RESULTING_SYMS}" + MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-Wl,%\\${VERSIONED_SYMS} -Wl,%"` + test -n "$verbose" && echo " MK_SHARED_LIB: $MK_SHARED_LIB" 1>&6 + +echo "${as_me:-configure}:6329: testing MK_SHARED_LIB: $MK_SHARED_LIB ..." 1>&5 + + ;; + (*-dy\ *) + VERSIONED_SYMS="-Wl,-M,\${RESULTING_SYMS}" + MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-dy%\\${VERSIONED_SYMS} -dy%"` + test -n "$verbose" && echo " MK_SHARED_LIB: $MK_SHARED_LIB" 1>&6 + +echo "${as_me:-configure}:6337: testing MK_SHARED_LIB: $MK_SHARED_LIB ..." 1>&5 + + ;; + (*) + { echo "$as_me:6341: WARNING: this system does not support versioned-symbols" >&5 +echo "$as_me: WARNING: this system does not support versioned-symbols" >&2;} + ;; + esac + + # Linux ld can selectively override scope, e.g., of symbols beginning with + # "_" by first declaring some as global, and then using a wildcard to + # declare the others as local. Some other loaders cannot do this. Check + # by constructing a (very) simple shared library and inspecting its + # symbols. + if test "x$VERSIONED_SYMS" != "x" + then + echo "$as_me:6353: checking if wildcards can be used to selectively omit symbols" >&5 +echo $ECHO_N "checking if wildcards can be used to selectively omit symbols... $ECHO_C" >&6 + WILDCARD_SYMS=no + + # make sources + rm -f conftest.* + + cat >conftest.ver <conftest.$ac_ext <conftest.mk <&5 >/dev/null + then + # test for missing symbol in either Data or Text section + cf_missing=`nm -P conftest.so 2>&5 |fgrep _ismissing | egrep '[ ][DT][ ]'` + test -n "$cf_missing" && WILDCARD_SYMS=yes + fi + echo "$as_me:6421: result: $WILDCARD_SYMS" >&5 +echo "${ECHO_T}$WILDCARD_SYMS" >&6 + rm -f conftest.* + fi +fi + + LIB_PREP=: + LIB_CREATE="$MK_SHARED_LIB" + CFLAGS="$CFLAGS $CC_SHARED_OPTS" + MAKE_NORMAL="#" + MAKE_STATIC="#" + MAKE_SHARED= + fi +fi + +LIB_SUFFIX= + + case X$LIB_MODEL in + (Xlibtool) + DFT_LIB_SUFFIX='.la' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + (Xdebug) + DFT_LIB_SUFFIX='_g.a' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + (Xprofile) + DFT_LIB_SUFFIX='_p.a' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + (Xshared) + case $cf_cv_system_name in + (aix[5-7]*) + DFT_LIB_SUFFIX='.so' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + (cygwin*|msys*|mingw*) + DFT_LIB_SUFFIX='.dll' + DFT_DEP_SUFFIX='.dll.a' + ;; + (darwin*) + DFT_LIB_SUFFIX='.dylib' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + (hpux*) + case $target in + (ia64*) + DFT_LIB_SUFFIX='.so' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + (*) + DFT_LIB_SUFFIX='.sl' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + esac + ;; + (*) + DFT_LIB_SUFFIX='.so' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + esac + ;; + (*) + DFT_LIB_SUFFIX='.a' + DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX + ;; + esac + if test -n "${LIB_SUFFIX}${EXTRA_SUFFIX}" + then + DFT_LIB_SUFFIX="${LIB_SUFFIX}${EXTRA_SUFFIX}${DFT_LIB_SUFFIX}" + DFT_DEP_SUFFIX="${LIB_SUFFIX}${EXTRA_SUFFIX}${DFT_DEP_SUFFIX}" + fi + +LIB_SUFFIX=$DFT_LIB_SUFFIX + +echo "$as_me:6496: checking if you want to use dmalloc for testing" >&5 +echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 + +# Check whether --with-dmalloc or --without-dmalloc was given. +if test "${with_dmalloc+set}" = set; then + withval="$with_dmalloc" + +cat >>confdefs.h <&5 +echo "${ECHO_T}${with_dmalloc:-no}" >&6 + +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) + ;; + (*) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + ;; + esac + ;; +esac + +if test "$with_dmalloc" = yes ; then + echo "$as_me:6607: checking for dmalloc.h" >&5 +echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_dmalloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6613 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:6617: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6623: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_dmalloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_dmalloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6642: result: $ac_cv_header_dmalloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 +if test $ac_cv_header_dmalloc_h = yes; then + +echo "$as_me:6646: checking for dmalloc_debug in -ldmalloc" >&5 +echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 +if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldmalloc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 6654 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dmalloc_debug (); +int +main () +{ +dmalloc_debug (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6673: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6676: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6679: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6682: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dmalloc_dmalloc_debug=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dmalloc_dmalloc_debug=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:6693: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 +if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 + +# Check whether --with-dbmalloc or --without-dbmalloc was given. +if test "${with_dbmalloc+set}" = set; then + withval="$with_dbmalloc" + +cat >>confdefs.h <&5 +echo "${ECHO_T}${with_dbmalloc:-no}" >&6 + +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) + ;; + (*) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + ;; + esac + ;; +esac + +if test "$with_dbmalloc" = yes ; then + echo "$as_me:6819: checking for dbmalloc.h" >&5 +echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_dbmalloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6825 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:6829: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6835: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_dbmalloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_dbmalloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6854: result: $ac_cv_header_dbmalloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 +if test $ac_cv_header_dbmalloc_h = yes; then + +echo "$as_me:6858: checking for debug_malloc in -ldbmalloc" >&5 +echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 +if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldbmalloc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 6866 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char debug_malloc (); +int +main () +{ +debug_malloc (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6885: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6888: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6891: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6894: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dbmalloc_debug_malloc=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dbmalloc_debug_malloc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:6905: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 +if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 + +# Check whether --with-valgrind or --without-valgrind was given. +if test "${with_valgrind+set}" = set; then + withval="$with_valgrind" + +cat >>confdefs.h <&5 +echo "${ECHO_T}${with_valgrind:-no}" >&6 + +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) + ;; + (*) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + ;; + esac + ;; +esac + +echo "$as_me:7030: checking if you want to perform memory-leak testing" >&5 +echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 + +# Check whether --enable-leaks or --disable-leaks was given. +if test "${enable_leaks+set}" = set; then + enableval="$enable_leaks" + if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi +else + : ${with_no_leaks:=no} +fi; +echo "$as_me:7040: result: $with_no_leaks" >&5 +echo "${ECHO_T}$with_no_leaks" >&6 + +if test "$with_no_leaks" = yes ; then + +cat >>confdefs.h <<\EOF +#define NO_LEAKS 1 +EOF + +cat >>confdefs.h <<\EOF +#define YY_NO_LEAKS 1 +EOF + +fi + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +echo "$as_me:7058: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7064 "configure" +#include "confdefs.h" +#include +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7079: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7082: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7085: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7088: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7098: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6 +if test "${ac_cv_lib_dir_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldir $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 7119 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7138: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7141: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7144: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7147: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dir_opendir=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dir_opendir=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:7158: result: $ac_cv_lib_dir_opendir" >&5 +echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6 +if test $ac_cv_lib_dir_opendir = yes; then + LIBS="$LIBS -ldir" +fi + +else + echo "$as_me:7165: checking for opendir in -lx" >&5 +echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6 +if test "${ac_cv_lib_x_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lx $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 7173 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7192: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7195: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7198: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7201: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_x_opendir=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_x_opendir=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:7212: result: $ac_cv_lib_x_opendir" >&5 +echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6 +if test $ac_cv_lib_x_opendir = yes; then + LIBS="$LIBS -lx" +fi + +fi + +echo "$as_me:7220: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7226 "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:7234: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:7240: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 7262 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -rf conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 7280 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -rf conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line 7301 "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + $ac_main_return(2); + $ac_main_return (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:7327: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7330: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:7332: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7335: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:7348: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_header in \ +limits.h \ +unistd.h \ +pwd.h \ +grp.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:7366: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7372 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:7376: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:7382: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:7401: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7423 "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7429: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7432: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7435: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7438: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7448: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 +if test "${ac_cv_type_mode_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7464 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((mode_t *) 0) + return 0; +if (sizeof (mode_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7479: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7482: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7485: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7488: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_mode_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_mode_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7498: result: $ac_cv_type_mode_t" >&5 +echo "${ECHO_T}$ac_cv_type_mode_t" >&6 +if test $ac_cv_type_mode_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 +if test "${ac_cv_struct_tm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7516 "configure" +#include "confdefs.h" +#include +#include + +int +main () +{ +struct tm *tp; tp->tm_sec; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7530: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7533: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7536: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7539: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_struct_tm=time.h +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_tm=sys/time.h +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7549: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6 +if test $ac_cv_struct_tm = sys/time.h; then + +cat >>confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + +echo "$as_me:7559: checking for extra include directories" >&5 +echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6 +if test "${cf_cv_curses_incdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_curses_incdir=no +case $host_os in +(hpux10.*) + if test "x$cf_cv_screen" = "xcurses_colr" + then + test -d /usr/include/curses_colr && \ + cf_cv_curses_incdir="-I/usr/include/curses_colr" + fi + ;; +(sunos3*|sunos4*) + if test "x$cf_cv_screen" = "xcurses_5lib" + then + test -d /usr/5lib && \ + test -d /usr/5include && \ + cf_cv_curses_incdir="-I/usr/5include" + fi + ;; +esac + +fi +echo "$as_me:7585: result: $cf_cv_curses_incdir" >&5 +echo "${ECHO_T}$cf_cv_curses_incdir" >&6 +test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" + +echo "$as_me:7589: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_ncurses_header=none +for cf_header in \ + ncurses.h \ + curses.h ncurses/ncurses.h ncurses/curses.h +do +cat >conftest.$ac_ext <<_ACEOF +#line 7601 "configure" +#include "confdefs.h" +#include <${cf_header}> +int +main () +{ +initscr(); tgoto("?", 0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7613: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7616: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7619: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7622: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_header=$cf_header; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:7633: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 + +if test "$cf_cv_ncurses_header" = none ; then + { { echo "$as_me:7637: error: No curses header-files found" >&5 +echo "$as_me: error: No curses header-files found" >&2;} + { (exit 1); exit 1; }; } +fi + +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. + +for ac_header in $cf_cv_ncurses_header +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:7647: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7653 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:7657: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:7663: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:7682: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 7710 "configure" +#include "confdefs.h" +#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> + +int +main () +{ +int x = auto_left_margin + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7725: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7728: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7731: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7734: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_term_header="$cf_test" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_term_header=unknown + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done + +fi +echo "$as_me:7750: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in +(*term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in +(ncurses/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +(ncursesw/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +echo "$as_me:7782: checking for chtype typedef" >&5 +echo $ECHO_N "checking for chtype typedef... $ECHO_C" >&6 +if test "${cf_cv_chtype_decl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 7789 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +chtype foo + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7801: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7804: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7807: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7810: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_chtype_decl=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_chtype_decl=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7820: result: $cf_cv_chtype_decl" >&5 +echo "${ECHO_T}$cf_cv_chtype_decl" >&6 +if test $cf_cv_chtype_decl = yes ; then + +cat >>confdefs.h <<\EOF +#define HAVE_TYPE_CHTYPE 1 +EOF + + echo "$as_me:7828: checking if chtype is scalar or struct" >&5 +echo $ECHO_N "checking if chtype is scalar or struct... $ECHO_C" >&6 +if test "${cf_cv_chtype_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 7835 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +chtype foo; long x = foo + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7847: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7850: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7853: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7856: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_chtype_type=scalar +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_chtype_type=struct +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7866: result: $cf_cv_chtype_type" >&5 +echo "${ECHO_T}$cf_cv_chtype_type" >&6 + if test $cf_cv_chtype_type = scalar ; then + +cat >>confdefs.h <<\EOF +#define TYPE_CHTYPE_IS_SCALAR 1 +EOF + + fi +fi + +for ac_header in unistd.h getopt.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:7880: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7886 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:7890: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:7896: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:7915: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for header declaring getopt variables... $ECHO_C" >&6 +if test "${cf_cv_getopt_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_getopt_header=none +for cf_header in stdio.h stdlib.h unistd.h getopt.h +do +cat >conftest.$ac_ext <<_ACEOF +#line 7935 "configure" +#include "confdefs.h" + +#include <$cf_header> +int +main () +{ +int x = optind; char *y = optarg + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7948: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7951: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7954: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7957: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_getopt_header=$cf_header + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:7969: result: $cf_cv_getopt_header" >&5 +echo "${ECHO_T}$cf_cv_getopt_header" >&6 +if test $cf_cv_getopt_header != none ; then + +cat >>confdefs.h <<\EOF +#define HAVE_GETOPT_HEADER 1 +EOF + +fi +if test $cf_cv_getopt_header = getopt.h ; then + +cat >>confdefs.h <<\EOF +#define NEED_GETOPT_H 1 +EOF + +fi + +for ac_func in \ +getcwd \ +mktime \ +strdup \ +strerror \ +getlogin \ +sleep \ + +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:7996: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 8002 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8033: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8036: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8039: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8042: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8052: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for lstat... $ECHO_C" >&6 +if test "${ac_cv_func_lstat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 8069 "configure" +#include "confdefs.h" + +#include +#include +int +main () +{ +lstat(".", (struct stat *)0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8083: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8086: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8089: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8092: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_lstat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_lstat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi + +echo "$as_me:8104: result: $ac_cv_func_lstat " >&5 +echo "${ECHO_T}$ac_cv_func_lstat " >&6 +if test $ac_cv_func_lstat = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LSTAT 1 +EOF + +fi + +echo "$as_me:8114: checking for setlocale()" >&5 +echo $ECHO_N "checking for setlocale()... $ECHO_C" >&6 +if test "${cf_cv_locale+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 8121 "configure" +#include "confdefs.h" +#include +int +main () +{ +setlocale(LC_ALL, "") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8133: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8136: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8139: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8142: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_locale=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_locale=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi + +echo "$as_me:8154: result: $cf_cv_locale" >&5 +echo "${ECHO_T}$cf_cv_locale" >&6 +test $cf_cv_locale = yes && { +cat >>confdefs.h <<\EOF +#define HAVE_SETLOCALE 1 +EOF + } + +echo "$as_me:8162: checking for specific curses-directory" >&5 +echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6 + +# Check whether --with-curses-dir or --without-curses-dir was given. +if test "${with_curses_dir+set}" = set; then + withval="$with_curses_dir" + cf_cv_curses_dir=$withval +else + cf_cv_curses_dir=no +fi; +echo "$as_me:8172: result: $cf_cv_curses_dir" >&5 +echo "${ECHO_T}$cf_cv_curses_dir" >&6 + +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$withval" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval withval="$withval" + case ".$withval" in + (.NONE/*) + withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:8203: error: expected a pathname, not \"$withval\"" >&5 +echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + + if test -d "$cf_cv_curses_dir" + then + +if test -n "$cf_cv_curses_dir/include" ; then + for cf_add_incdir in $cf_cv_curses_dir/include + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 8236 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8248: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8251: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8254: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8257: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:8274: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + +if test -n "$cf_cv_curses_dir/lib" ; then + for cf_add_libdir in $cf_cv_curses_dir/lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me:-configure}:8310: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + fi +fi + +cf_cv_screen=curses + +echo "$as_me:8323: checking for specified curses library type" >&5 +echo $ECHO_N "checking for specified curses library type... $ECHO_C" >&6 + +# Check whether --with-screen or --without-screen was given. +if test "${with_screen+set}" = set; then + withval="$with_screen" + cf_cv_screen=$withval +else + +# Check whether --with-ncursesw or --without-ncursesw was given. +if test "${with_ncursesw+set}" = set; then + withval="$with_ncursesw" + cf_cv_screen=ncursesw +else + +# Check whether --with-ncurses or --without-ncurses was given. +if test "${with_ncurses+set}" = set; then + withval="$with_ncurses" + cf_cv_screen=ncurses +else + +# Check whether --with-pdcurses or --without-pdcurses was given. +if test "${with_pdcurses+set}" = set; then + withval="$with_pdcurses" + cf_cv_screen=pdcurses +else + +# Check whether --with-curses-colr or --without-curses-colr was given. +if test "${with_curses_colr+set}" = set; then + withval="$with_curses_colr" + cf_cv_screen=curses_colr +else + +# Check whether --with-curses-5lib or --without-curses-5lib was given. +if test "${with_curses_5lib+set}" = set; then + withval="$with_curses_5lib" + cf_cv_screen=curses_5lib +fi; +fi; +fi; +fi; +fi; +fi; + +echo "$as_me:8367: result: $cf_cv_screen" >&5 +echo "${ECHO_T}$cf_cv_screen" >&6 + +case $cf_cv_screen in +(curses|curses_*) + +echo "$as_me:8373: checking for extra include directories" >&5 +echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6 +if test "${cf_cv_curses_incdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_curses_incdir=no +case $host_os in +(hpux10.*) + if test "x$cf_cv_screen" = "xcurses_colr" + then + test -d /usr/include/curses_colr && \ + cf_cv_curses_incdir="-I/usr/include/curses_colr" + fi + ;; +(sunos3*|sunos4*) + if test "x$cf_cv_screen" = "xcurses_5lib" + then + test -d /usr/5lib && \ + test -d /usr/5include && \ + cf_cv_curses_incdir="-I/usr/5include" + fi + ;; +esac + +fi +echo "$as_me:8399: result: $cf_cv_curses_incdir" >&5 +echo "${ECHO_T}$cf_cv_curses_incdir" >&6 +test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" + +echo "$as_me:8403: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_ncurses_header=none +for cf_header in \ + ncurses.h \ + curses.h ncurses/ncurses.h ncurses/curses.h +do +cat >conftest.$ac_ext <<_ACEOF +#line 8415 "configure" +#include "confdefs.h" +#include <${cf_header}> +int +main () +{ +initscr(); tgoto("?", 0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8427: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8430: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8433: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8436: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_header=$cf_header; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:8447: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 + +if test "$cf_cv_ncurses_header" = none ; then + { { echo "$as_me:8451: error: No curses header-files found" >&5 +echo "$as_me: error: No curses header-files found" >&2;} + { (exit 1); exit 1; }; } +fi + +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. + +for ac_header in $cf_cv_ncurses_header +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:8461: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 8467 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:8471: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:8477: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:8496: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 8524 "configure" +#include "confdefs.h" +#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> + +int +main () +{ +int x = auto_left_margin + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8539: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8542: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8545: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8548: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_term_header="$cf_test" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_term_header=unknown + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done + +fi +echo "$as_me:8564: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in +(*term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in +(ncurses/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +(ncursesw/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +echo "$as_me:8596: checking for ncurses version" >&5 +echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 +if test "${cf_cv_ncurses_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_ncurses_version=no + cf_tempfile=out$$ + rm -f $cf_tempfile + if test "$cross_compiling" = yes; then + + # This will not work if the preprocessor splits the line after the + # Autoconf token. The 'unproto' program does that. + cat > conftest.$ac_ext < +#undef Autoconf +#ifdef NCURSES_VERSION +Autoconf NCURSES_VERSION +#else +#ifdef __NCURSES_H +Autoconf "old" +#endif +; +#endif +EOF + cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" + { (eval echo "$as_me:8622: \"$cf_try\"") >&5 + (eval $cf_try) 2>&5 + ac_status=$? + echo "$as_me:8625: \$? = $ac_status" >&5 + (exit $ac_status); } + if test -f conftest.out ; then + cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` + test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" + rm -f conftest.out + fi + +else + cat >conftest.$ac_ext <<_ACEOF +#line 8635 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +#include +int main() +{ + FILE *fp = fopen("$cf_tempfile", "w"); +#ifdef NCURSES_VERSION +# ifdef NCURSES_VERSION_PATCH + fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); +# else + fprintf(fp, "%s\n", NCURSES_VERSION); +# endif +#else +# ifdef __NCURSES_H + fprintf(fp, "old\n"); +# else + make an error +# endif +#endif + ${cf_cv_main_return:-return}(0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:8660: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8663: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:8665: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8668: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_ncurses_version=`cat $cf_tempfile` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + rm -f $cf_tempfile + +fi +echo "$as_me:8682: result: $cf_cv_ncurses_version" >&5 +echo "${ECHO_T}$cf_cv_ncurses_version" >&6 +test "$cf_cv_ncurses_version" = no || +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +echo "$as_me:8689: checking if we have identified curses libraries" >&5 +echo $ECHO_N "checking if we have identified curses libraries... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line 8692 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr(); tgoto("?", 0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8704: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8707: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8710: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8713: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +echo "$as_me:8722: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + +if test "$cf_result" = no ; then +case $host_os in +(freebsd*) + echo "$as_me:8728: checking for tgoto in -lmytinfo" >&5 +echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 +if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmytinfo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 8736 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +int +main () +{ +tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8755: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8758: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8761: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8764: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mytinfo_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_mytinfo_tgoto=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8775: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 +if test $ac_cv_lib_mytinfo_tgoto = yes; then + +cf_add_libs="-lmytinfo" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +fi + + ;; +(hpux10.*) + # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr + # next (1998), and xcurses "newer" (2000). There is no header file for + # Hcurses; the subdirectory curses_colr has the headers (curses.h and + # term.h) for cur_colr + if test "x$cf_cv_screen" = "xcurses_colr" + then + echo "$as_me:8805: checking for initscr in -lcur_colr" >&5 +echo $ECHO_N "checking for initscr in -lcur_colr... $ECHO_C" >&6 +if test "${ac_cv_lib_cur_colr_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcur_colr $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 8813 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8832: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8835: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8838: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8841: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_cur_colr_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_cur_colr_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8852: result: $ac_cv_lib_cur_colr_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_cur_colr_initscr" >&6 +if test $ac_cv_lib_cur_colr_initscr = yes; then + +cf_add_libs="-lcur_colr" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + ac_cv_func_initscr=yes + +else + + echo "$as_me:8876: checking for initscr in -lHcurses" >&5 +echo $ECHO_N "checking for initscr in -lHcurses... $ECHO_C" >&6 +if test "${ac_cv_lib_Hcurses_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lHcurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 8884 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8903: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8906: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8909: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8912: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Hcurses_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Hcurses_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8923: result: $ac_cv_lib_Hcurses_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_Hcurses_initscr" >&6 +if test $ac_cv_lib_Hcurses_initscr = yes; then + + # HP's header uses __HP_CURSES, but user claims _HP_CURSES. + +cf_add_libs="-lHcurses" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" + ac_cv_func_initscr=yes + +fi + +fi + + fi + ;; +(linux*) + case `arch 2>/dev/null` in + (x86_64) + if test -d /lib64 + then + +if test -n "/lib64" ; then + for cf_add_libdir in /lib64 + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me:-configure}:8979: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + else + +if test -n "/lib" ; then + for cf_add_libdir in /lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me:-configure}:9008: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + fi + ;; + (*) + +if test -n "/lib" ; then + for cf_add_libdir in /lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me:-configure}:9039: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + ;; + esac + ;; +(sunos3*|sunos4*) + if test "x$cf_cv_screen" = "xcurses_5lib" + then + if test -d /usr/5lib ; then + +if test -n "/usr/5lib" ; then + for cf_add_libdir in /usr/5lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me:-configure}:9074: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + +cf_add_libs="-lcurses -ltermcap" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + fi + fi + ac_cv_func_initscr=yes + ;; +esac + +if test ".$ac_cv_func_initscr" != .yes ; then + cf_save_LIBS="$LIBS" + + if test ".${cf_cv_ncurses_version:-no}" != .no + then + cf_check_list="ncurses curses cursesX" + else + cf_check_list="cursesX curses ncurses" + fi + + # Check for library containing tgoto. Do this before curses library + # because it may be needed to link the test-case for initscr. + if test "x$cf_term_lib" = x + then + echo "$as_me:9118: checking for tgoto" >&5 +echo $ECHO_N "checking for tgoto... $ECHO_C" >&6 +if test "${ac_cv_func_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 9124 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char tgoto (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_tgoto) || defined (__stub___tgoto) +choke me +#else +f = tgoto; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9155: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9158: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9161: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9164: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_tgoto=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9174: result: $ac_cv_func_tgoto" >&5 +echo "${ECHO_T}$ac_cv_func_tgoto" >&6 +if test $ac_cv_func_tgoto = yes; then + cf_term_lib=predefined +else + + for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown + do + as_ac_Lib=`echo "ac_cv_lib_$cf_term_lib''_tgoto" | $as_tr_sh` +echo "$as_me:9183: checking for tgoto in -l$cf_term_lib" >&5 +echo $ECHO_N "checking for tgoto in -l$cf_term_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$cf_term_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 9191 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +int +main () +{ +tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9210: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9213: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9216: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9219: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Lib=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:9230: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + break +fi + + done + +fi + + fi + + # Check for library containing initscr + test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" + if test "x$cf_curs_lib" = x + then + for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown + do + as_ac_Lib=`echo "ac_cv_lib_$cf_curs_lib''_initscr" | $as_tr_sh` +echo "$as_me:9249: checking for initscr in -l$cf_curs_lib" >&5 +echo $ECHO_N "checking for initscr in -l$cf_curs_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$cf_curs_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 9257 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9276: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9279: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9282: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9285: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Lib=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:9296: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + break +fi + + done + fi + test $cf_curs_lib = unknown && { { echo "$as_me:9304: error: no curses library found" >&5 +echo "$as_me: error: no curses library found" >&2;} + { (exit 1); exit 1; }; } + + LIBS="-l$cf_curs_lib $cf_save_LIBS" + if test "$cf_term_lib" = unknown ; then + echo "$as_me:9310: checking if we can link with $cf_curs_lib library" >&5 +echo $ECHO_N "checking if we can link with $cf_curs_lib library... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 9313 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9325: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9328: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9331: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9334: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:9343: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + test $cf_result = no && { { echo "$as_me:9345: error: Cannot link curses library" >&5 +echo "$as_me: error: Cannot link curses library" >&2;} + { (exit 1); exit 1; }; } + elif test "$cf_curs_lib" = "$cf_term_lib" ; then + : + elif test "$cf_term_lib" != predefined ; then + echo "$as_me:9351: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 +echo $ECHO_N "checking if we need both $cf_curs_lib and $cf_term_lib libraries... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 9354 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr(); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9366: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9369: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9372: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9375: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 9384 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9396: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9399: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9402: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9405: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=error +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:9417: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + fi +fi +fi + + ;; +(ncursesw*) + +echo "$as_me:9426: checking for multibyte character support" >&5 +echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6 +if test "${cf_cv_utf8_lib+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_save_LIBS="$LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 9434 "configure" +#include "confdefs.h" + +#include +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9447: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9450: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9453: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9456: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_utf8_lib=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these +# will be set on completion of the AC_TRY_LINK below. +cf_cv_header_path_utf8= +cf_cv_library_path_utf8= + +echo "${as_me:-configure}:9468: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 + +cf_save_LIBS="$LIBS" + +cat >conftest.$ac_ext <<_ACEOF +#line 9473 "configure" +#include "confdefs.h" + +#include +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9486: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9489: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9492: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9495: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_find_linkage_utf8=yes + cf_cv_header_path_utf8=/usr/include + cf_cv_library_path_utf8=/usr/lib + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +LIBS="-lutf8 $cf_save_LIBS" + +cat >conftest.$ac_ext <<_ACEOF +#line 9509 "configure" +#include "confdefs.h" + +#include +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9522: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9525: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9528: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9531: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_find_linkage_utf8=yes + cf_cv_header_path_utf8=/usr/include + cf_cv_library_path_utf8=/usr/lib + cf_cv_library_file_utf8="-lutf8" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_find_linkage_utf8=no + LIBS="$cf_save_LIBS" + + test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 + +echo "${as_me:-configure}:9548: testing find linkage for utf8 library ..." 1>&5 + +echo "${as_me:-configure}:9550: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_test_CPPFLAGS="$CPPFLAGS" + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in + (-I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + +test "x$cf_header_path" != "xNONE" && \ +test -d "$cf_header_path" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" + test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" + test -d $cf_header_path/include/utf8 && cf_search="$cf_search $cf_header_path/include/utf8" + test -d $cf_header_path/include/utf8/include && cf_search="$cf_search $cf_header_path/include/utf8/include" + test -d $cf_header_path/utf8/include && cf_search="$cf_search $cf_header_path/utf8/include" + test -d $cf_header_path/utf8/include/utf8 && cf_search="$cf_search $cf_header_path/utf8/include/utf8" +} + + cf_header_path_list="$cf_header_path_list $cf_search" + ;; + esac + done +fi + +# add the variations for the package we are looking for + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/utf8 && cf_search="$cf_search $prefix/include/utf8" + test -d $prefix/include/utf8/include && cf_search="$cf_search $prefix/include/utf8/include" + test -d $prefix/utf8/include && cf_search="$cf_search $prefix/utf8/include" + test -d $prefix/utf8/include/utf8 && cf_search="$cf_search $prefix/utf8/include/utf8" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for include-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/include && cf_search="$cf_search $cf_subdir_prefix/include" + test -d $cf_subdir_prefix/include/utf8 && cf_search="$cf_search $cf_subdir_prefix/include/utf8" + test -d $cf_subdir_prefix/include/utf8/include && cf_search="$cf_search $cf_subdir_prefix/include/utf8/include" + test -d $cf_subdir_prefix/utf8/include && cf_search="$cf_search $cf_subdir_prefix/utf8/include" + test -d $cf_subdir_prefix/utf8/include/utf8 && cf_search="$cf_search $cf_subdir_prefix/utf8/include/utf8" +} + +done + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/utf8 && cf_search="$cf_search $includedir/utf8" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/utf8 && cf_search="$cf_search $oldincludedir/utf8" +} + +cf_search="$cf_search $cf_header_path_list" + + for cf_cv_header_path_utf8 in $cf_search + do + if test -d $cf_cv_header_path_utf8 ; then + test -n "$verbose" && echo " ... testing $cf_cv_header_path_utf8" 1>&6 + +echo "${as_me:-configure}:9641: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 + + CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8" + cat >conftest.$ac_ext <<_ACEOF +#line 9645 "configure" +#include "confdefs.h" + +#include +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9658: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9661: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9664: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9667: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6 + +echo "${as_me:-configure}:9672: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 + + cf_cv_find_linkage_utf8=maybe + cf_test_CPPFLAGS="$CPPFLAGS" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + done + + if test "$cf_cv_find_linkage_utf8" = maybe ; then + +echo "${as_me:-configure}:9690: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 + + cf_save_LIBS="$LIBS" + cf_save_LDFLAGS="$LDFLAGS" + + if test "$cf_cv_find_linkage_utf8" != yes ; then + +cf_search= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in + (-L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + +test "x$cf_library_path" != "xNONE" && \ +test -d "$cf_library_path" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" + test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" + test -d $cf_library_path/lib/utf8 && cf_search="$cf_search $cf_library_path/lib/utf8" + test -d $cf_library_path/lib/utf8/lib && cf_search="$cf_search $cf_library_path/lib/utf8/lib" + test -d $cf_library_path/utf8/lib && cf_search="$cf_search $cf_library_path/utf8/lib" + test -d $cf_library_path/utf8/lib/utf8 && cf_search="$cf_search $cf_library_path/utf8/lib/utf8" +} + + cf_library_path_list="$cf_library_path_list $cf_search" + ;; + esac + done +fi + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $prefix" + test -d $prefix/lib && cf_search="$cf_search $prefix/lib" + test -d $prefix/lib/utf8 && cf_search="$cf_search $prefix/lib/utf8" + test -d $prefix/lib/utf8/lib && cf_search="$cf_search $prefix/lib/utf8/lib" + test -d $prefix/utf8/lib && cf_search="$cf_search $prefix/utf8/lib" + test -d $prefix/utf8/lib/utf8 && cf_search="$cf_search $prefix/utf8/lib/utf8" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/lib && cf_search="$cf_search $cf_subdir_prefix/lib" + test -d $cf_subdir_prefix/lib/utf8 && cf_search="$cf_search $cf_subdir_prefix/lib/utf8" + test -d $cf_subdir_prefix/lib/utf8/lib && cf_search="$cf_search $cf_subdir_prefix/lib/utf8/lib" + test -d $cf_subdir_prefix/utf8/lib && cf_search="$cf_search $cf_subdir_prefix/utf8/lib" + test -d $cf_subdir_prefix/utf8/lib/utf8 && cf_search="$cf_search $cf_subdir_prefix/utf8/lib/utf8" +} + +done + +cf_search="$cf_library_path_list $cf_search" + + for cf_cv_library_path_utf8 in $cf_search + do + if test -d $cf_cv_library_path_utf8 ; then + test -n "$verbose" && echo " ... testing $cf_cv_library_path_utf8" 1>&6 + +echo "${as_me:-configure}:9765: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 + + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-lutf8 $cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8" + cat >conftest.$ac_ext <<_ACEOF +#line 9771 "configure" +#include "confdefs.h" + +#include +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9784: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9787: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9790: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9793: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + test -n "$verbose" && echo " ... found utf8 library in $cf_cv_library_path_utf8" 1>&6 + +echo "${as_me:-configure}:9798: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 + + cf_cv_find_linkage_utf8=yes + cf_cv_library_file_utf8="-lutf8" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS" + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi + done + CPPFLAGS="$cf_save_CPPFLAGS" + LDFLAGS="$cf_save_LDFLAGS" + fi + + else + cf_cv_find_linkage_utf8=no + fi + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +LIBS="$cf_save_LIBS" + +if test "$cf_cv_find_linkage_utf8" = yes ; then +cf_cv_utf8_lib=add-on +else +cf_cv_utf8_lib=no +fi + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9840: result: $cf_cv_utf8_lib" >&5 +echo "${ECHO_T}$cf_cv_utf8_lib" >&6 + +# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between +# ncurses/ncursesw: +if test "$cf_cv_utf8_lib" = "add-on" ; then + +cat >>confdefs.h <<\EOF +#define HAVE_LIBUTF8_H 1 +EOF + +if test -n "$cf_cv_header_path_utf8" ; then + for cf_add_incdir in $cf_cv_header_path_utf8 + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 9875 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9887: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9890: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9893: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9896: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:9913: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + +if test -n "$cf_cv_library_path_utf8" ; then + for cf_add_libdir in $cf_cv_library_path_utf8 + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me:-configure}:9949: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + +cf_add_libs="$cf_cv_library_file_utf8" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +fi + +cf_ncuconfig_root=$cf_cv_screen +cf_have_ncuconfig=no + +if test "x${PKG_CONFIG:=none}" != xnone; then + echo "$as_me:9979: checking pkg-config for $cf_ncuconfig_root" >&5 +echo $ECHO_N "checking pkg-config for $cf_ncuconfig_root... $ECHO_C" >&6 + if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then + echo "$as_me:9982: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + + echo "$as_me:9985: checking if the $cf_ncuconfig_root package files work" >&5 +echo $ECHO_N "checking if the $cf_ncuconfig_root package files work... $ECHO_C" >&6 + cf_have_ncuconfig=unknown + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" + + CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`" + +cf_add_libs="`$PKG_CONFIG --libs $cf_ncuconfig_root`" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 10011 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10023: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10026: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10029: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10032: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if test "$cross_compiling" = yes; then + cf_have_ncuconfig=maybe +else + cat >conftest.$ac_ext <<_ACEOF +#line 10038 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> + int main(void) + { char *xx = curses_version(); return (xx == 0); } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:10045: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10048: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:10050: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10053: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_have_ncuconfig=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_ncuconfig=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_ncuconfig=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:10070: result: $cf_have_ncuconfig" >&5 +echo "${ECHO_T}$cf_have_ncuconfig" >&6 + test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes + if test "$cf_have_ncuconfig" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + NCURSES_CONFIG_PKG=none + else + +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + + NCURSES_CONFIG_PKG=$cf_ncuconfig_root + fi + + else + echo "$as_me:10088: result: no" >&5 +echo "${ECHO_T}no" >&6 + NCURSES_CONFIG_PKG=none + fi +else + NCURSES_CONFIG_PKG=none +fi + +if test "x$cf_have_ncuconfig" = "xno"; then + echo "Looking for ${cf_ncuconfig_root}-config" + +if test -n "$ac_tool_prefix"; then + for ac_prog in ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:10104: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NCURSES_CONFIG"; then + ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" +echo "$as_me:10119: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG +if test -n "$NCURSES_CONFIG"; then + echo "$as_me:10127: result: $NCURSES_CONFIG" >&5 +echo "${ECHO_T}$NCURSES_CONFIG" >&6 +else + echo "$as_me:10130: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$NCURSES_CONFIG" && break + done +fi +if test -z "$NCURSES_CONFIG"; then + ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG + for ac_prog in ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:10143: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_NCURSES_CONFIG"; then + ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" +echo "$as_me:10158: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG +if test -n "$ac_ct_NCURSES_CONFIG"; then + echo "$as_me:10166: result: $ac_ct_NCURSES_CONFIG" >&5 +echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 +else + echo "$as_me:10169: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_NCURSES_CONFIG" && break +done +test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" + + NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG +fi + + if test "$NCURSES_CONFIG" != none ; then + + CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" + +cf_add_libs="`$NCURSES_CONFIG --libs`" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + # even with config script, some packages use no-override for curses.h + +echo "$as_me:10202: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_ncurses_header=none +for cf_header in \ + ncurses.h $cf_cv_screen/ncurses.h \ + curses.h $cf_cv_screen/curses.h +do +cat >conftest.$ac_ext <<_ACEOF +#line 10214 "configure" +#include "confdefs.h" +#include <${cf_header}> +int +main () +{ +initscr(); tgoto("?", 0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10226: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10229: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10232: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10235: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_header=$cf_header; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:10246: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 + +if test "$cf_cv_ncurses_header" = none ; then + { { echo "$as_me:10250: error: No curses header-files found" >&5 +echo "$as_me: error: No curses header-files found" >&2;} + { (exit 1); exit 1; }; } +fi + +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. + +for ac_header in $cf_cv_ncurses_header +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:10260: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 10266 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:10270: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:10276: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:10295: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <conftest.$ac_ext <<_ACEOF +#line 10348 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10360: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10363: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10366: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10369: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:10386: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + +} + +echo "$as_me:10405: checking for $cf_ncuhdr_root header in include-path" >&5 +echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 +if test "${cf_cv_ncurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" + ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" + for cf_header in $cf_header_list + do + + cat >conftest.$ac_ext <<_ACEOF +#line 10417 "configure" +#include "confdefs.h" + +#include <$cf_header> +int +main () +{ + +#ifdef NCURSES_VERSION + +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); +#else + make an error +#endif +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10441: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10444: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10447: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10450: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_h=$cf_header + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_ncurses_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + test "$cf_cv_ncurses_h" != no && break + done + +fi +echo "$as_me:10465: result: $cf_cv_ncurses_h" >&5 +echo "${ECHO_T}$cf_cv_ncurses_h" >&6 + +if test "$cf_cv_ncurses_h" != no ; then + cf_cv_ncurses_header=$cf_cv_ncurses_h +else + +echo "$as_me:10472: checking for $cf_ncuhdr_root include-path" >&5 +echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 +if test "${cf_cv_ncurses_h2+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + test -n "$verbose" && echo + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in + (-I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + +test "x$cf_header_path" != "xNONE" && \ +test -d "$cf_header_path" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" + test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" + test -d $cf_header_path/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root" + test -d $cf_header_path/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include" + test -d $cf_header_path/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include" + test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + + cf_header_path_list="$cf_header_path_list $cf_search" + ;; + esac + done +fi + +# add the variations for the package we are looking for + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" + test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" + test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" + test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for include-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/include && cf_search="$cf_search $cf_subdir_prefix/include" + test -d $cf_subdir_prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_subdir_prefix/include/$cf_ncuhdr_root" + test -d $cf_subdir_prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_subdir_prefix/include/$cf_ncuhdr_root/include" + test -d $cf_subdir_prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_subdir_prefix/$cf_ncuhdr_root/include" + test -d $cf_subdir_prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_subdir_prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +done + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" +} + +cf_search="$cf_search $cf_header_path_list" + + test -n "$verbose" && echo search path $cf_search + cf_save2_CPPFLAGS="$CPPFLAGS" + for cf_incdir in $cf_search + do + +if test -n "$cf_incdir" ; then + for cf_add_incdir in $cf_incdir + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 10590 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10602: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10605: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10608: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10611: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:10628: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + + for cf_header in \ + ncurses.h \ + curses.h + do + + cat >conftest.$ac_ext <<_ACEOF +#line 10651 "configure" +#include "confdefs.h" + +#include <$cf_header> +int +main () +{ + +#ifdef NCURSES_VERSION + +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); +#else + make an error +#endif +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10675: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10678: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10681: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10684: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_h2=$cf_header + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_ncurses_h2=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + if test "$cf_cv_ncurses_h2" != no ; then + cf_cv_ncurses_h2=$cf_incdir/$cf_header + test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 + break + fi + test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 + done + CPPFLAGS="$cf_save2_CPPFLAGS" + test "$cf_cv_ncurses_h2" != no && break + done + test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:10705: error: not found" >&5 +echo "$as_me: error: not found" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:10710: result: $cf_cv_ncurses_h2" >&5 +echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 + + cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` + cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` + if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then + cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header + fi + +if test -n "$cf_1st_incdir" ; then + for cf_add_incdir in $cf_1st_incdir + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 10743 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10755: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10758: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10761: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10764: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:10781: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + +fi + +# Set definitions to allow ifdef'ing for ncurses.h + +case $cf_cv_ncurses_header in +(*ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_H 1 +EOF + + ;; +esac + +case $cf_cv_ncurses_header in +(ncurses/curses.h|ncurses/ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_NCURSES_H 1 +EOF + + ;; +(ncursesw/curses.h|ncursesw/ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_NCURSES_H 1 +EOF + + ;; +esac + +echo "$as_me:10829: checking for terminfo header" >&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 10847 "configure" +#include "confdefs.h" +#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> + +int +main () +{ +int x = auto_left_margin + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10862: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10865: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10868: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10871: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_term_header="$cf_test" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_term_header=unknown + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done + +fi +echo "$as_me:10887: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in +(*term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in +(ncurses/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +(ncursesw/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +# some applications need this, but should check for NCURSES_VERSION + +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +echo "$as_me:10925: checking for ncurses version" >&5 +echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 +if test "${cf_cv_ncurses_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_ncurses_version=no + cf_tempfile=out$$ + rm -f $cf_tempfile + if test "$cross_compiling" = yes; then + + # This will not work if the preprocessor splits the line after the + # Autoconf token. The 'unproto' program does that. + cat > conftest.$ac_ext < +#undef Autoconf +#ifdef NCURSES_VERSION +Autoconf NCURSES_VERSION +#else +#ifdef __NCURSES_H +Autoconf "old" +#endif +; +#endif +EOF + cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" + { (eval echo "$as_me:10951: \"$cf_try\"") >&5 + (eval $cf_try) 2>&5 + ac_status=$? + echo "$as_me:10954: \$? = $ac_status" >&5 + (exit $ac_status); } + if test -f conftest.out ; then + cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` + test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" + rm -f conftest.out + fi + +else + cat >conftest.$ac_ext <<_ACEOF +#line 10964 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +#include +int main() +{ + FILE *fp = fopen("$cf_tempfile", "w"); +#ifdef NCURSES_VERSION +# ifdef NCURSES_VERSION_PATCH + fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); +# else + fprintf(fp, "%s\n", NCURSES_VERSION); +# endif +#else +# ifdef __NCURSES_H + fprintf(fp, "old\n"); +# else + make an error +# endif +#endif + ${cf_cv_main_return:-return}(0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:10989: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10992: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:10994: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10997: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_ncurses_version=`cat $cf_tempfile` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + rm -f $cf_tempfile + +fi +echo "$as_me:11011: result: $cf_cv_ncurses_version" >&5 +echo "${ECHO_T}$cf_cv_ncurses_version" >&6 +test "$cf_cv_ncurses_version" = no || +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +cf_nculib_root=$cf_cv_screen + # This works, except for the special case where we find gpm, but + # ncurses is in a nonstandard location via $LIBS, and we really want + # to link gpm. +cf_ncurses_LIBS="" +cf_ncurses_SAVE="$LIBS" +echo "$as_me:11024: checking for Gpm_Open in -lgpm" >&5 +echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11032 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char Gpm_Open (); +int +main () +{ +Gpm_Open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11051: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11054: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11057: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11060: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_Gpm_Open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_Gpm_Open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11071: result: $ac_cv_lib_gpm_Gpm_Open" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 +if test $ac_cv_lib_gpm_Gpm_Open = yes; then + echo "$as_me:11074: checking for initscr in -lgpm" >&5 +echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11082 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11101: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11104: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11107: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11110: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11121: result: $ac_cv_lib_gpm_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 +if test $ac_cv_lib_gpm_initscr = yes; then + LIBS="$cf_ncurses_SAVE" +else + cf_ncurses_LIBS="-lgpm" +fi + +fi + +case $host_os in +(freebsd*) + # This is only necessary if you are linking against an obsolete + # version of ncurses (but it should do no harm, since it's static). + if test "$cf_nculib_root" = ncurses ; then + echo "$as_me:11136: checking for tgoto in -lmytinfo" >&5 +echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 +if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmytinfo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11144 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +int +main () +{ +tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11163: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11166: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11169: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11172: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mytinfo_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_mytinfo_tgoto=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11183: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 +if test $ac_cv_lib_mytinfo_tgoto = yes; then + cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" +fi + + fi + ;; +esac + +cf_add_libs="$cf_ncurses_LIBS" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + +cf_add_libs="-l$cf_nculib_root" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +else + + eval 'cf_cv_have_lib_'$cf_nculib_root'=no' + cf_libdir="" + echo "$as_me:11232: checking for initscr" >&5 +echo $ECHO_N "checking for initscr... $ECHO_C" >&6 +if test "${ac_cv_func_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11238 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char initscr (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_initscr) || defined (__stub___initscr) +choke me +#else +f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11269: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11272: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11275: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11278: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:11288: result: $ac_cv_func_initscr" >&5 +echo "${ECHO_T}$ac_cv_func_initscr" >&6 +if test $ac_cv_func_initscr = yes; then + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' +else + + cf_save_LIBS="$LIBS" + echo "$as_me:11295: checking for initscr in -l$cf_nculib_root" >&5 +echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 + LIBS="-l$cf_nculib_root $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 11299 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11311: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11314: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11317: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11320: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:11322: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:11329: result: no" >&5 +echo "${ECHO_T}no" >&6 + +cf_search= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in + (-L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + +test "x$cf_library_path" != "xNONE" && \ +test -d "$cf_library_path" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" + test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" + test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" + test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" + test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" + test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" +} + + cf_library_path_list="$cf_library_path_list $cf_search" + ;; + esac + done +fi + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $prefix" + test -d $prefix/lib && cf_search="$cf_search $prefix/lib" + test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" + test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" + test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" + test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/lib && cf_search="$cf_search $cf_subdir_prefix/lib" + test -d $cf_subdir_prefix/lib/$cf_nculib_root && cf_search="$cf_search $cf_subdir_prefix/lib/$cf_nculib_root" + test -d $cf_subdir_prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_subdir_prefix/lib/$cf_nculib_root/lib" + test -d $cf_subdir_prefix/$cf_nculib_root/lib && cf_search="$cf_search $cf_subdir_prefix/$cf_nculib_root/lib" + test -d $cf_subdir_prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_subdir_prefix/$cf_nculib_root/lib/$cf_nculib_root" +} + +done + +cf_search="$cf_library_path_list $cf_search" + + for cf_libdir in $cf_search + do + echo "$as_me:11397: checking for -l$cf_nculib_root in $cf_libdir" >&5 +echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 + LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 11401 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11413: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11416: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11419: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11422: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:11424: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:11431: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS="$cf_save_LIBS" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi + +eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root + +if test $cf_found_library = no ; then + { { echo "$as_me:11446: error: Cannot link $cf_nculib_root library" >&5 +echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + +if test -n "$cf_ncurses_LIBS" ; then + echo "$as_me:11454: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 +echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 + cf_ncurses_SAVE="$LIBS" + for p in $cf_ncurses_LIBS ; do + q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` + if test "$q" != "$LIBS" ; then + LIBS="$q" + fi + done + cat >conftest.$ac_ext <<_ACEOF +#line 11464 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11476: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11479: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11482: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11485: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:11487: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:11492: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS="$cf_ncurses_SAVE" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + +cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cat >>confdefs.h <&5 +echo $ECHO_N "checking pkg-config for $cf_ncuconfig_root... $ECHO_C" >&6 + if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then + echo "$as_me:11520: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + + echo "$as_me:11523: checking if the $cf_ncuconfig_root package files work" >&5 +echo $ECHO_N "checking if the $cf_ncuconfig_root package files work... $ECHO_C" >&6 + cf_have_ncuconfig=unknown + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" + + CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`" + +cf_add_libs="`$PKG_CONFIG --libs $cf_ncuconfig_root`" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 11549 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11561: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11564: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11567: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11570: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if test "$cross_compiling" = yes; then + cf_have_ncuconfig=maybe +else + cat >conftest.$ac_ext <<_ACEOF +#line 11576 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> + int main(void) + { char *xx = curses_version(); return (xx == 0); } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:11583: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11586: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:11588: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11591: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_have_ncuconfig=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_ncuconfig=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_ncuconfig=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:11608: result: $cf_have_ncuconfig" >&5 +echo "${ECHO_T}$cf_have_ncuconfig" >&6 + test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes + if test "$cf_have_ncuconfig" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + NCURSES_CONFIG_PKG=none + else + +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + + NCURSES_CONFIG_PKG=$cf_ncuconfig_root + fi + + else + echo "$as_me:11626: result: no" >&5 +echo "${ECHO_T}no" >&6 + NCURSES_CONFIG_PKG=none + fi +else + NCURSES_CONFIG_PKG=none +fi + +if test "x$cf_have_ncuconfig" = "xno"; then + echo "Looking for ${cf_ncuconfig_root}-config" + +if test -n "$ac_tool_prefix"; then + for ac_prog in ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:11642: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NCURSES_CONFIG"; then + ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" +echo "$as_me:11657: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG +if test -n "$NCURSES_CONFIG"; then + echo "$as_me:11665: result: $NCURSES_CONFIG" >&5 +echo "${ECHO_T}$NCURSES_CONFIG" >&6 +else + echo "$as_me:11668: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$NCURSES_CONFIG" && break + done +fi +if test -z "$NCURSES_CONFIG"; then + ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG + for ac_prog in ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:11681: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_NCURSES_CONFIG"; then + ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" +echo "$as_me:11696: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG +if test -n "$ac_ct_NCURSES_CONFIG"; then + echo "$as_me:11704: result: $ac_ct_NCURSES_CONFIG" >&5 +echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 +else + echo "$as_me:11707: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_NCURSES_CONFIG" && break +done +test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" + + NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG +fi + + if test "$NCURSES_CONFIG" != none ; then + + CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" + +cf_add_libs="`$NCURSES_CONFIG --libs`" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + # even with config script, some packages use no-override for curses.h + +echo "$as_me:11740: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_ncurses_header=none +for cf_header in \ + ncurses.h $cf_cv_screen/ncurses.h \ + curses.h $cf_cv_screen/curses.h +do +cat >conftest.$ac_ext <<_ACEOF +#line 11752 "configure" +#include "confdefs.h" +#include <${cf_header}> +int +main () +{ +initscr(); tgoto("?", 0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:11764: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:11767: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:11770: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11773: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_header=$cf_header; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:11784: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 + +if test "$cf_cv_ncurses_header" = none ; then + { { echo "$as_me:11788: error: No curses header-files found" >&5 +echo "$as_me: error: No curses header-files found" >&2;} + { (exit 1); exit 1; }; } +fi + +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. + +for ac_header in $cf_cv_ncurses_header +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:11798: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11804 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:11808: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:11814: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:11833: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <conftest.$ac_ext <<_ACEOF +#line 11886 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:11898: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:11901: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:11904: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11907: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:11924: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + +} + +echo "$as_me:11943: checking for $cf_ncuhdr_root header in include-path" >&5 +echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 +if test "${cf_cv_ncurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" + ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" + for cf_header in $cf_header_list + do + + cat >conftest.$ac_ext <<_ACEOF +#line 11955 "configure" +#include "confdefs.h" + +#include <$cf_header> +int +main () +{ + +#ifdef NCURSES_VERSION + +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); +#else + make an error +#endif +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:11979: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:11982: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:11985: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11988: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_h=$cf_header + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_ncurses_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + test "$cf_cv_ncurses_h" != no && break + done + +fi +echo "$as_me:12003: result: $cf_cv_ncurses_h" >&5 +echo "${ECHO_T}$cf_cv_ncurses_h" >&6 + +if test "$cf_cv_ncurses_h" != no ; then + cf_cv_ncurses_header=$cf_cv_ncurses_h +else + +echo "$as_me:12010: checking for $cf_ncuhdr_root include-path" >&5 +echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 +if test "${cf_cv_ncurses_h2+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + test -n "$verbose" && echo + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in + (-I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + +test "x$cf_header_path" != "xNONE" && \ +test -d "$cf_header_path" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $cf_header_path" + test -d $cf_header_path/include && cf_search="$cf_search $cf_header_path/include" + test -d $cf_header_path/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root" + test -d $cf_header_path/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include" + test -d $cf_header_path/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include" + test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + + cf_header_path_list="$cf_header_path_list $cf_search" + ;; + esac + done +fi + +# add the variations for the package we are looking for + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" + test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" + test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" + test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for include-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/include && cf_search="$cf_search $cf_subdir_prefix/include" + test -d $cf_subdir_prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_subdir_prefix/include/$cf_ncuhdr_root" + test -d $cf_subdir_prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_subdir_prefix/include/$cf_ncuhdr_root/include" + test -d $cf_subdir_prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $cf_subdir_prefix/$cf_ncuhdr_root/include" + test -d $cf_subdir_prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $cf_subdir_prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +done + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" +} + +cf_search="$cf_search $cf_header_path_list" + + test -n "$verbose" && echo search path $cf_search + cf_save2_CPPFLAGS="$CPPFLAGS" + for cf_incdir in $cf_search + do + +if test -n "$cf_incdir" ; then + for cf_add_incdir in $cf_incdir + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 12128 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12140: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12143: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12146: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12149: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:12166: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + + for cf_header in \ + ncurses.h \ + curses.h + do + + cat >conftest.$ac_ext <<_ACEOF +#line 12189 "configure" +#include "confdefs.h" + +#include <$cf_header> +int +main () +{ + +#ifdef NCURSES_VERSION + +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); +#else + make an error +#endif +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12213: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12216: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12219: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12222: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_h2=$cf_header + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_ncurses_h2=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + if test "$cf_cv_ncurses_h2" != no ; then + cf_cv_ncurses_h2=$cf_incdir/$cf_header + test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 + break + fi + test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 + done + CPPFLAGS="$cf_save2_CPPFLAGS" + test "$cf_cv_ncurses_h2" != no && break + done + test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:12243: error: not found" >&5 +echo "$as_me: error: not found" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:12248: result: $cf_cv_ncurses_h2" >&5 +echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 + + cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` + cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` + if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then + cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header + fi + +if test -n "$cf_1st_incdir" ; then + for cf_add_incdir in $cf_1st_incdir + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 12281 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12293: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12296: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12299: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12302: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me:-configure}:12319: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + else + break + fi + done + done +fi + +fi + +# Set definitions to allow ifdef'ing for ncurses.h + +case $cf_cv_ncurses_header in +(*ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_H 1 +EOF + + ;; +esac + +case $cf_cv_ncurses_header in +(ncurses/curses.h|ncurses/ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_NCURSES_H 1 +EOF + + ;; +(ncursesw/curses.h|ncursesw/ncurses.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_NCURSES_H 1 +EOF + + ;; +esac + +echo "$as_me:12367: checking for terminfo header" >&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in +(*/ncurses.h|*/ncursesw.h) + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +(*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 12385 "configure" +#include "confdefs.h" +#include +#include <${cf_cv_ncurses_header:-curses.h}> +#include <$cf_test> + +int +main () +{ +int x = auto_left_margin + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12400: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12403: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12406: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12409: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_term_header="$cf_test" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_term_header=unknown + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done + +fi +echo "$as_me:12425: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in +(*term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in +(ncurses/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +(ncursesw/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +# some applications need this, but should check for NCURSES_VERSION + +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +echo "$as_me:12463: checking for ncurses version" >&5 +echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 +if test "${cf_cv_ncurses_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_ncurses_version=no + cf_tempfile=out$$ + rm -f $cf_tempfile + if test "$cross_compiling" = yes; then + + # This will not work if the preprocessor splits the line after the + # Autoconf token. The 'unproto' program does that. + cat > conftest.$ac_ext < +#undef Autoconf +#ifdef NCURSES_VERSION +Autoconf NCURSES_VERSION +#else +#ifdef __NCURSES_H +Autoconf "old" +#endif +; +#endif +EOF + cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" + { (eval echo "$as_me:12489: \"$cf_try\"") >&5 + (eval $cf_try) 2>&5 + ac_status=$? + echo "$as_me:12492: \$? = $ac_status" >&5 + (exit $ac_status); } + if test -f conftest.out ; then + cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` + test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" + rm -f conftest.out + fi + +else + cat >conftest.$ac_ext <<_ACEOF +#line 12502 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +#include +int main() +{ + FILE *fp = fopen("$cf_tempfile", "w"); +#ifdef NCURSES_VERSION +# ifdef NCURSES_VERSION_PATCH + fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); +# else + fprintf(fp, "%s\n", NCURSES_VERSION); +# endif +#else +# ifdef __NCURSES_H + fprintf(fp, "old\n"); +# else + make an error +# endif +#endif + ${cf_cv_main_return:-return}(0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:12527: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12530: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:12532: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12535: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_ncurses_version=`cat $cf_tempfile` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + rm -f $cf_tempfile + +fi +echo "$as_me:12549: result: $cf_cv_ncurses_version" >&5 +echo "${ECHO_T}$cf_cv_ncurses_version" >&6 +test "$cf_cv_ncurses_version" = no || +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +cf_nculib_root=$cf_cv_screen + # This works, except for the special case where we find gpm, but + # ncurses is in a nonstandard location via $LIBS, and we really want + # to link gpm. +cf_ncurses_LIBS="" +cf_ncurses_SAVE="$LIBS" +echo "$as_me:12562: checking for Gpm_Open in -lgpm" >&5 +echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12570 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char Gpm_Open (); +int +main () +{ +Gpm_Open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12589: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12592: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12595: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12598: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_Gpm_Open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_Gpm_Open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12609: result: $ac_cv_lib_gpm_Gpm_Open" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 +if test $ac_cv_lib_gpm_Gpm_Open = yes; then + echo "$as_me:12612: checking for initscr in -lgpm" >&5 +echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12620 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12639: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12642: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12645: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12648: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12659: result: $ac_cv_lib_gpm_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 +if test $ac_cv_lib_gpm_initscr = yes; then + LIBS="$cf_ncurses_SAVE" +else + cf_ncurses_LIBS="-lgpm" +fi + +fi + +case $host_os in +(freebsd*) + # This is only necessary if you are linking against an obsolete + # version of ncurses (but it should do no harm, since it's static). + if test "$cf_nculib_root" = ncurses ; then + echo "$as_me:12674: checking for tgoto in -lmytinfo" >&5 +echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 +if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmytinfo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12682 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +int +main () +{ +tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12701: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12704: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12707: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12710: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mytinfo_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_mytinfo_tgoto=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12721: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 +if test $ac_cv_lib_mytinfo_tgoto = yes; then + cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" +fi + + fi + ;; +esac + +cf_add_libs="$cf_ncurses_LIBS" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + +cf_add_libs="-l$cf_nculib_root" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +else + + eval 'cf_cv_have_lib_'$cf_nculib_root'=no' + cf_libdir="" + echo "$as_me:12770: checking for initscr" >&5 +echo $ECHO_N "checking for initscr... $ECHO_C" >&6 +if test "${ac_cv_func_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12776 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char initscr (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_initscr) || defined (__stub___initscr) +choke me +#else +f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12807: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12810: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12813: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12816: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:12826: result: $ac_cv_func_initscr" >&5 +echo "${ECHO_T}$ac_cv_func_initscr" >&6 +if test $ac_cv_func_initscr = yes; then + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' +else + + cf_save_LIBS="$LIBS" + echo "$as_me:12833: checking for initscr in -l$cf_nculib_root" >&5 +echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 + LIBS="-l$cf_nculib_root $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 12837 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12849: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12852: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12855: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12858: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:12860: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:12867: result: no" >&5 +echo "${ECHO_T}no" >&6 + +cf_search= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in + (-L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + +test "x$cf_library_path" != "xNONE" && \ +test -d "$cf_library_path" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" + test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" + test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" + test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" + test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" + test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" +} + + cf_library_path_list="$cf_library_path_list $cf_search" + ;; + esac + done +fi + +cf_search= + +test "x$prefix" != "xNONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $prefix" + test -d $prefix/lib && cf_search="$cf_search $prefix/lib" + test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" + test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" + test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" + test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" +} + +for cf_subdir_prefix in \ + /usr \ + /usr/local \ + /usr/pkg \ + /opt \ + /opt/local \ + $HOME +do + +test "x$cf_subdir_prefix" != "x$prefix" && \ +test -d "$cf_subdir_prefix" && \ +(test -z "$prefix" || test x$prefix = xNONE || test "x$cf_subdir_prefix" != "x$prefix") && { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_subdir_prefix" + test -d $cf_subdir_prefix/lib && cf_search="$cf_search $cf_subdir_prefix/lib" + test -d $cf_subdir_prefix/lib/$cf_nculib_root && cf_search="$cf_search $cf_subdir_prefix/lib/$cf_nculib_root" + test -d $cf_subdir_prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_subdir_prefix/lib/$cf_nculib_root/lib" + test -d $cf_subdir_prefix/$cf_nculib_root/lib && cf_search="$cf_search $cf_subdir_prefix/$cf_nculib_root/lib" + test -d $cf_subdir_prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_subdir_prefix/$cf_nculib_root/lib/$cf_nculib_root" +} + +done + +cf_search="$cf_library_path_list $cf_search" + + for cf_libdir in $cf_search + do + echo "$as_me:12935: checking for -l$cf_nculib_root in $cf_libdir" >&5 +echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 + LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 12939 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12951: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12954: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12957: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12960: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:12962: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:12969: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS="$cf_save_LIBS" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi + +eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root + +if test $cf_found_library = no ; then + { { echo "$as_me:12984: error: Cannot link $cf_nculib_root library" >&5 +echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + +if test -n "$cf_ncurses_LIBS" ; then + echo "$as_me:12992: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 +echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 + cf_ncurses_SAVE="$LIBS" + for p in $cf_ncurses_LIBS ; do + q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` + if test "$q" != "$LIBS" ; then + LIBS="$q" + fi + done + cat >conftest.$ac_ext <<_ACEOF +#line 13002 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ +initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13014: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13017: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13020: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13023: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:13025: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:13030: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS="$cf_ncurses_SAVE" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + +cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for X... $ECHO_C" >&6 + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + +fi; +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else + if test "${ac_cv_have_x+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -fr conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat >Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib dll; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -fr conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/usr/include/X11 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Intrinsic.h. + # First, try using that file with no special directory specified. + cat >conftest.$ac_ext <<_ACEOF +#line 13147 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:13151: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:13157: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Intrinsic.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lXt $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 13190 "configure" +#include "confdefs.h" +#include +int +main () +{ +XtMalloc (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13202: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13205: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13208: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13211: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +LIBS=$ac_save_LIBS +for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib dll; do + if test -r $ac_dir/libXt.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$as_me:13249: result: $have_x" >&5 +echo "${ECHO_T}$have_x" >&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$as_me:13259: result: libraries $x_libraries, headers $x_includes" >&5 +echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 +fi + +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + +cat >>confdefs.h <<\EOF +#define X_DISPLAY_MISSING 1 +EOF + + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case `(uname -sr) 2>/dev/null` in + "SunOS 5"*) + echo "$as_me:13283: checking whether -R must be followed by a space" >&5 +echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 + ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" + cat >conftest.$ac_ext <<_ACEOF +#line 13287 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13299: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13302: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13305: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13308: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_R_nospace=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_R_nospace=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test $ac_R_nospace = yes; then + echo "$as_me:13318: result: no" >&5 +echo "${ECHO_T}no" >&6 + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + cat >conftest.$ac_ext <<_ACEOF +#line 13324 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13336: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13339: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13342: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13345: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_R_space=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_R_space=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test $ac_R_space = yes; then + echo "$as_me:13355: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + X_LIBS="$X_LIBS -R $x_libraries" + else + echo "$as_me:13359: result: neither works" >&5 +echo "${ECHO_T}neither works" >&6 + fi + fi + LIBS=$ac_xsave_LIBS + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn Johnson says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And Karl Berry says + # the Alpha needs dnet_stub (dnet does not exist). + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" + cat >conftest.$ac_ext <<_ACEOF +#line 13379 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main () +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13398: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13401: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13404: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13407: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:13413: checking for dnet_ntoa in -ldnet" >&5 +echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 +if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 13421 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dnet_ntoa (); +int +main () +{ +dnet_ntoa (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13440: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13443: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13446: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13449: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dnet_dnet_ntoa=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dnet_dnet_ntoa=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:13460: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 +if test $ac_cv_lib_dnet_dnet_ntoa = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + echo "$as_me:13467: checking for dnet_ntoa in -ldnet_stub" >&5 +echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 +if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet_stub $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 13475 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dnet_ntoa (); +int +main () +{ +dnet_ntoa (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13494: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13497: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13500: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13503: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dnet_stub_dnet_ntoa=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dnet_stub_dnet_ntoa=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:13514: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 +if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +fi + + fi +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_xsave_LIBS" + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to T.E. Dickey. + # The functions gethostbyname, getservbyname, and inet_addr are + # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. + echo "$as_me:13533: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 13539 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +f = gethostbyname; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13570: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13573: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13576: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13579: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:13589: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 + + if test $ac_cv_func_gethostbyname = no; then + echo "$as_me:13593: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 13601 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13620: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13623: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13626: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13629: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:13640: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +fi + + if test $ac_cv_lib_nsl_gethostbyname = no; then + echo "$as_me:13647: checking for gethostbyname in -lbsd" >&5 +echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 13655 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13674: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13677: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13680: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13683: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_bsd_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_bsd_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:13694: result: $ac_cv_lib_bsd_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 +if test $ac_cv_lib_bsd_gethostbyname = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" +fi + + fi + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says Simon Leinen: it contains gethostby* + # variants that don't use the nameserver (or something). -lsocket + # must be given before -lnsl if both are needed. We assume that + # if connect needs -lnsl, so does gethostbyname. + echo "$as_me:13710: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 13716 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +f = connect; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13747: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13750: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13753: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13756: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:13766: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 + + if test $ac_cv_func_connect = no; then + echo "$as_me:13770: checking for connect in -lsocket" >&5 +echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 13778 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +int +main () +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13797: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13800: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13803: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13806: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_socket_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:13817: result: $ac_cv_lib_socket_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 +if test $ac_cv_lib_socket_connect = yes; then + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +fi + + fi + + # Guillermo Gomez says -lposix is necessary on A/UX. + echo "$as_me:13826: checking for remove" >&5 +echo $ECHO_N "checking for remove... $ECHO_C" >&6 +if test "${ac_cv_func_remove+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 13832 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char remove (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_remove) || defined (__stub___remove) +choke me +#else +f = remove; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13863: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13866: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13869: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13872: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_remove=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_remove=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:13882: result: $ac_cv_func_remove" >&5 +echo "${ECHO_T}$ac_cv_func_remove" >&6 + + if test $ac_cv_func_remove = no; then + echo "$as_me:13886: checking for remove in -lposix" >&5 +echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 +if test "${ac_cv_lib_posix_remove+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 13894 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove (); +int +main () +{ +remove (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13913: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13916: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13919: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13922: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_posix_remove=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_posix_remove=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:13933: result: $ac_cv_lib_posix_remove" >&5 +echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 +if test $ac_cv_lib_posix_remove = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +fi + + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + echo "$as_me:13942: checking for shmat" >&5 +echo $ECHO_N "checking for shmat... $ECHO_C" >&6 +if test "${ac_cv_func_shmat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 13948 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shmat (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shmat) || defined (__stub___shmat) +choke me +#else +f = shmat; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13979: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13982: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13985: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13988: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shmat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_shmat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:13998: result: $ac_cv_func_shmat" >&5 +echo "${ECHO_T}$ac_cv_func_shmat" >&6 + + if test $ac_cv_func_shmat = no; then + echo "$as_me:14002: checking for shmat in -lipc" >&5 +echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 +if test "${ac_cv_lib_ipc_shmat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lipc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 14010 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat (); +int +main () +{ +shmat (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14029: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14032: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14035: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14038: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ipc_shmat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ipc_shmat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:14049: result: $ac_cv_lib_ipc_shmat" >&5 +echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 +if test $ac_cv_lib_ipc_shmat = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +fi + + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS=$LDFLAGS + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # John Interrante, Karl Berry + echo "$as_me:14067: checking for IceConnectionNumber in -lICE" >&5 +echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 +if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lICE $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 14075 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char IceConnectionNumber (); +int +main () +{ +IceConnectionNumber (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14094: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14097: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14100: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14103: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ICE_IceConnectionNumber=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ICE_IceConnectionNumber=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:14114: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 +if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +fi + + LDFLAGS=$ac_save_LDFLAGS + +fi + +cf_x_athena=${cf_x_athena:-Xaw} + +echo "$as_me:14126: checking if you want to link with Xaw 3d library" >&5 +echo $ECHO_N "checking if you want to link with Xaw 3d library... $ECHO_C" >&6 +withval= + +# Check whether --with-Xaw3d or --without-Xaw3d was given. +if test "${with_Xaw3d+set}" = set; then + withval="$with_Xaw3d" + +fi; +if test "$withval" = yes ; then + cf_x_athena=Xaw3d + echo "$as_me:14137: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:14140: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:14144: checking if you want to link with Xaw 3d xft library" >&5 +echo $ECHO_N "checking if you want to link with Xaw 3d xft library... $ECHO_C" >&6 +withval= + +# Check whether --with-Xaw3dxft or --without-Xaw3dxft was given. +if test "${with_Xaw3dxft+set}" = set; then + withval="$with_Xaw3dxft" + +fi; +if test "$withval" = yes ; then + cf_x_athena=Xaw3dxft + echo "$as_me:14155: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:14158: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:14162: checking if you want to link with neXT Athena library" >&5 +echo $ECHO_N "checking if you want to link with neXT Athena library... $ECHO_C" >&6 +withval= + +# Check whether --with-neXtaw or --without-neXtaw was given. +if test "${with_neXtaw+set}" = set; then + withval="$with_neXtaw" + +fi; +if test "$withval" = yes ; then + cf_x_athena=neXtaw + echo "$as_me:14173: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:14176: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:14180: checking if you want to link with Athena-Plus library" >&5 +echo $ECHO_N "checking if you want to link with Athena-Plus library... $ECHO_C" >&6 +withval= + +# Check whether --with-XawPlus or --without-XawPlus was given. +if test "${with_XawPlus+set}" = set; then + withval="$with_XawPlus" + +fi; +if test "$withval" = yes ; then + cf_x_athena=XawPlus + echo "$as_me:14191: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:14194: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +cf_x_athena_lib="" + +if test "$PKG_CONFIG" != none ; then + cf_athena_list= + test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" + for cf_athena_pkg in \ + $cf_athena_list \ + ${cf_x_athena} \ + ${cf_x_athena}-devel \ + lib${cf_x_athena} \ + lib${cf_x_athena}-devel + do + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $cf_athena_pkg; then + test -n "$verbose" && echo " found package $cf_athena_pkg" 1>&6 + +echo "${as_me:-configure}:14214: testing found package $cf_athena_pkg ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs $cf_athena_pkg 2>/dev/null`" + test -n "$verbose" && echo " package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:14220: testing package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package $cf_athena_pkg LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:14224: testing package $cf_athena_pkg LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + cf_x_athena_lib="$cf_pkgconfig_libs" + +cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&6 + +echo "${as_me:-configure}:14335: testing ..trimmed $LIBS ..." 1>&5 + + ;; + esac + done + +echo "$as_me:14341: checking for usable $cf_x_athena/Xmu package" >&5 +echo $ECHO_N "checking for usable $cf_x_athena/Xmu package... $ECHO_C" >&6 +if test "${cf_cv_xaw_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 14348 "configure" +#include "confdefs.h" + +#include + +int +main () +{ + +int check = XmuCompareISOLatin1("big", "small") + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14364: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14367: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14370: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14373: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xaw_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xaw_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:14383: result: $cf_cv_xaw_compat" >&5 +echo "${ECHO_T}$cf_cv_xaw_compat" >&6 + + if test "$cf_cv_xaw_compat" = no + then + # workaround for broken ".pc" files... + case "$cf_x_athena_lib" in + (*-lXmu*) + ;; + (*) + test -n "$verbose" && echo " work around broken package" 1>&6 + +echo "${as_me:-configure}:14395: testing work around broken package ..." 1>&5 + + cf_save_xmu="$LIBS" + cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^ *//' -e 's/ .*//'` + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xmu; then + test -n "$verbose" && echo " found package xmu" 1>&6 + +echo "${as_me:-configure}:14403: testing found package xmu ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xmu 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xmu 2>/dev/null`" + test -n "$verbose" && echo " package xmu CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:14409: testing package xmu CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xmu LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:14413: testing package xmu LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + LIBS="$cf_save_xmu" + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:14513: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib $cf_pkgconfig_libs %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:14518: testing ...after $LIBS ..." 1>&5 + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:14526: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib -lXmu %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:14531: testing ...after $LIBS ..." 1>&5 + +fi + + for cf_trim_lib in Xmu Xt X11 + do + case "$LIBS" in + (*-l$cf_trim_lib\ *-l$cf_trim_lib*) + LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` + test -n "$verbose" && echo " ..trimmed $LIBS" 1>&6 + +echo "${as_me:-configure}:14542: testing ..trimmed $LIBS ..." 1>&5 + + ;; + esac + done + + ;; + esac + fi + + break +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + : +fi + + done +fi + +if test -z "$cf_x_athena_lib" ; then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then + test -n "$verbose" && echo " found package Xext" 1>&6 + +echo "${as_me:-configure}:14567: testing found package Xext ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs Xext 2>/dev/null`" + test -n "$verbose" && echo " package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:14573: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package Xext LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:14577: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + echo "$as_me:14678: checking for XextCreateExtension in -lXext" >&5 +echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6 +if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXext $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 14686 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XextCreateExtension (); +int +main () +{ +XextCreateExtension (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14705: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14708: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14711: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14714: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xext_XextCreateExtension=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xext_XextCreateExtension=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:14725: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 +echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6 +if test $ac_cv_lib_Xext_XextCreateExtension = yes; then + +cf_add_libs="-lXext" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +fi + +fi + +# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new), and (and +# in some cases has installed dummy files in the former, other cases replaced +# it with a link to the new location). This complicates the configure script. +# Check for that pitfall, and recover using pkg-config +# +# If none of these are set, the configuration is almost certainly broken. +if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" +then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then + test -n "$verbose" && echo " found package x11" 1>&6 + +echo "${as_me:-configure}:14761: testing found package x11 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" + test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:14767: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:14771: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:14871: WARNING: unable to find X11 library" >&5 +echo "$as_me: WARNING: unable to find X11 library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then + test -n "$verbose" && echo " found package ice" 1>&6 + +echo "${as_me:-configure}:14878: testing found package ice ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" + test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:14884: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:14888: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:14988: WARNING: unable to find ICE library" >&5 +echo "$as_me: WARNING: unable to find ICE library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then + test -n "$verbose" && echo " found package sm" 1>&6 + +echo "${as_me:-configure}:14995: testing found package sm ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" + test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:15001: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:15005: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:15105: WARNING: unable to find SM library" >&5 +echo "$as_me: WARNING: unable to find SM library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then + test -n "$verbose" && echo " found package xt" 1>&6 + +echo "${as_me:-configure}:15112: testing found package xt ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" + test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:15118: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:15122: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:15222: WARNING: unable to find Xt library" >&5 +echo "$as_me: WARNING: unable to find Xt library" >&2;} +fi + +fi + +cf_have_X_LIBS=no + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then + test -n "$verbose" && echo " found package xt" 1>&6 + +echo "${as_me:-configure}:15233: testing found package xt ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" + test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:15239: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:15243: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + case "x$LIBS" in + (*-lX11*) + ;; + (*) +# we have an "xt" package, but it may omit Xt's dependency on X11 +echo "$as_me:15344: checking for usable X dependency" >&5 +echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6 +if test "${cf_cv_xt_x11_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 15351 "configure" +#include "confdefs.h" + +#include + +int +main () +{ + + int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); + int rc2 = XClearWindow((Display*) 0, (Window) 0); + int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); + int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15370: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15373: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15376: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15379: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xt_x11_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xt_x11_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:15389: result: $cf_cv_xt_x11_compat" >&5 +echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6 + if test "$cf_cv_xt_x11_compat" = no + then + test -n "$verbose" && echo " work around broken X11 dependency" 1>&6 + +echo "${as_me:-configure}:15395: testing work around broken X11 dependency ..." 1>&5 + + # 2010/11/19 - good enough until a working Xt on Xcb is delivered. + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then + test -n "$verbose" && echo " found package x11" 1>&6 + +echo "${as_me:-configure}:15402: testing found package x11 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" + test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:15408: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:15412: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:15515: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt -lX11 %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:15520: testing ...after $LIBS ..." 1>&5 + +fi + + fi + ;; + esac + +echo "$as_me:15528: checking for usable X Toolkit package" >&5 +echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6 +if test "${cf_cv_xt_ice_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 15535 "configure" +#include "confdefs.h" + +#include + +int +main () +{ +int num = IceConnectionNumber(0) + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15550: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15553: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15556: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15559: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xt_ice_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xt_ice_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:15569: result: $cf_cv_xt_ice_compat" >&5 +echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6 + + if test "$cf_cv_xt_ice_compat" = no + then + # workaround for broken ".pc" files used for X Toolkit. + case "x$X_PRE_LIBS" in + (*-lICE*) + case "x$LIBS" in + (*-lICE*) + ;; + (*) + test -n "$verbose" && echo " work around broken ICE dependency" 1>&6 + +echo "${as_me:-configure}:15583: testing work around broken ICE dependency ..." 1>&5 + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then + test -n "$verbose" && echo " found package ice" 1>&6 + +echo "${as_me:-configure}:15588: testing found package ice ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" + test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:15594: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:15598: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then + test -n "$verbose" && echo " found package sm" 1>&6 + +echo "${as_me:-configure}:15697: testing found package sm ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" + test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:15703: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:15707: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +cf_add_libs="$cf_pkgconfig_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + : +fi + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:15816: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt $X_PRE_LIBS %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:15821: testing ...after $LIBS ..." 1>&5 + +fi + + ;; + esac + ;; + esac + fi + + cf_have_X_LIBS=yes + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + LDFLAGS="$X_LIBS $LDFLAGS" + +test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 + +echo "${as_me:-configure}:15841: testing checking additions to CFLAGS ..." 1>&5 + +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $X_CFLAGS +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:15912: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:15920: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:15928: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +if test "x$cf_check_cflags" != "x$CFLAGS" ; then +cat >conftest.$ac_ext <<_ACEOF +#line 15935 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello world"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15947: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15950: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15953: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15956: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 + +echo "${as_me:-configure}:15964: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 + + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then + test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 + +echo "${as_me:-configure}:15969: testing but keeping change to \$CPPFLAGS ..." 1>&5 + + fi + CFLAGS="$cf_check_flags" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + + echo "$as_me:15977: checking for XOpenDisplay" >&5 +echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6 +if test "${ac_cv_func_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 15983 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char XOpenDisplay (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay) +choke me +#else +f = XOpenDisplay; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16014: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16017: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16020: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16023: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:16033: result: $ac_cv_func_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6 +if test $ac_cv_func_XOpenDisplay = yes; then + : +else + + echo "$as_me:16039: checking for XOpenDisplay in -lX11" >&5 +echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 16047 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main () +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16066: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16069: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16072: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16075: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_X11_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_X11_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:16086: result: $ac_cv_lib_X11_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 +if test $ac_cv_lib_X11_XOpenDisplay = yes; then + +cf_add_libs="-lX11" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +fi + +fi + + echo "$as_me:16110: checking for XtAppInitialize" >&5 +echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6 +if test "${ac_cv_func_XtAppInitialize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 16116 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char XtAppInitialize (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XtAppInitialize (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize) +choke me +#else +f = XtAppInitialize; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16147: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16150: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16153: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16156: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XtAppInitialize=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XtAppInitialize=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:16166: result: $ac_cv_func_XtAppInitialize" >&5 +echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6 +if test $ac_cv_func_XtAppInitialize = yes; then + : +else + + echo "$as_me:16172: checking for XtAppInitialize in -lXt" >&5 +echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6 +if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 16180 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XtAppInitialize (); +int +main () +{ +XtAppInitialize (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16199: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16202: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16205: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16208: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xt_XtAppInitialize=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xt_XtAppInitialize=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:16219: result: $ac_cv_lib_Xt_XtAppInitialize" >&5 +echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6 +if test $ac_cv_lib_Xt_XtAppInitialize = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LIBXT 1 +EOF + + cf_have_X_LIBS=Xt + LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS" +fi + +fi + +fi + +if test $cf_have_X_LIBS = no ; then + { echo "$as_me:16236: WARNING: Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile." >&5 +echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile." >&2;} +fi + +cf_x_athena_root=$cf_x_athena +cf_x_athena_inc="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + if test -z "$cf_x_athena_inc" ; then + cf_save="$CPPFLAGS" + cf_test=X11/$cf_x_athena_root/SimpleMenu.h + if test $cf_path != default ; then + CPPFLAGS="$cf_save -I$cf_path/include" + echo "$as_me:16258: checking for $cf_test in $cf_path" >&5 +echo $ECHO_N "checking for $cf_test in $cf_path... $ECHO_C" >&6 + else + echo "$as_me:16261: checking for $cf_test" >&5 +echo $ECHO_N "checking for $cf_test... $ECHO_C" >&6 + fi + cat >conftest.$ac_ext <<_ACEOF +#line 16265 "configure" +#include "confdefs.h" + +#include +#include <$cf_test> +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:16279: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:16282: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:16285: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16288: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:16297: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + if test "$cf_result" = yes ; then + cf_x_athena_inc=$cf_path + break + else + CPPFLAGS="$cf_save" + fi + fi +done + +if test -z "$cf_x_athena_inc" ; then + { echo "$as_me:16309: WARNING: Unable to successfully find Athena header files with test program" >&5 +echo "$as_me: WARNING: Unable to successfully find Athena header files with test program" >&2;} +elif test "$cf_x_athena_inc" != default ; then + CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" +fi + +cf_x_athena_root=$cf_x_athena +cf_x_athena_lib="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + for cf_lib in \ + ${cf_x_athena_root} \ + ${cf_x_athena_root}7 \ + ${cf_x_athena_root}6 + do + for cf_libs in \ + "-l$cf_lib -lXmu" \ + "-l$cf_lib -lXpm -lXmu" \ + "-l${cf_lib}_s -lXmu_s" + do + if test -z "$cf_x_athena_lib" ; then + cf_save="$LIBS" + cf_test=XawSimpleMenuAddGlobalActions + if test $cf_path != default ; then + +cf_add_libs="-L$cf_path/lib $cf_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + echo "$as_me:16355: checking for $cf_libs in $cf_path" >&5 +echo $ECHO_N "checking for $cf_libs in $cf_path... $ECHO_C" >&6 + else + +cf_add_libs="$cf_libs" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + + echo "$as_me:16375: checking for $cf_test in $cf_libs" >&5 +echo $ECHO_N "checking for $cf_test in $cf_libs... $ECHO_C" >&6 + fi + cat >conftest.$ac_ext <<_ACEOF +#line 16379 "configure" +#include "confdefs.h" + +#include +#include + +int +main () +{ + +$cf_test((XtAppContext) 0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16395: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16398: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16401: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16404: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:16413: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + if test "$cf_result" = yes ; then + cf_x_athena_lib="$cf_libs" + break + fi + LIBS="$cf_save" + fi + done # cf_libs + test -n "$cf_x_athena_lib" && break + done # cf_lib +done + +if test -z "$cf_x_athena_lib" ; then + { { echo "$as_me:16427: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&5 +echo "$as_me: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&2;} + { (exit 1); exit 1; }; } +fi + +cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_XCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$XCURSES_CONFIG"; then + ac_cv_prog_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_XCURSES_CONFIG="$ac_tool_prefix$ac_prog" +echo "$as_me:16460: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +XCURSES_CONFIG=$ac_cv_prog_XCURSES_CONFIG +if test -n "$XCURSES_CONFIG"; then + echo "$as_me:16468: result: $XCURSES_CONFIG" >&5 +echo "${ECHO_T}$XCURSES_CONFIG" >&6 +else + echo "$as_me:16471: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$XCURSES_CONFIG" && break + done +fi +if test -z "$XCURSES_CONFIG"; then + ac_ct_XCURSES_CONFIG=$XCURSES_CONFIG + for ac_prog in xcurses-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:16484: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_XCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_XCURSES_CONFIG"; then + ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_ct_XCURSES_CONFIG" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_prog" +echo "$as_me:16499: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_XCURSES_CONFIG=$ac_cv_prog_ac_ct_XCURSES_CONFIG +if test -n "$ac_ct_XCURSES_CONFIG"; then + echo "$as_me:16507: result: $ac_ct_XCURSES_CONFIG" >&5 +echo "${ECHO_T}$ac_ct_XCURSES_CONFIG" >&6 +else + echo "$as_me:16510: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_XCURSES_CONFIG" && break +done +test -n "$ac_ct_XCURSES_CONFIG" || ac_ct_XCURSES_CONFIG="none" + + XCURSES_CONFIG=$ac_ct_XCURSES_CONFIG +fi + +if test "$XCURSES_CONFIG" != none ; then + +CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" + +cf_add_libs="`$XCURSES_CONFIG --libs`" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +cf_cv_lib_XCurses=yes + +else + +LDFLAGS="$LDFLAGS $X_LIBS" + +test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 + +echo "${as_me:-configure}:16549: testing checking additions to CFLAGS ..." 1>&5 + +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $X_CFLAGS +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + (*) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +(yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:16620: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:16628: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:16636: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +if test "x$cf_check_cflags" != "x$CFLAGS" ; then +cat >conftest.$ac_ext <<_ACEOF +#line 16643 "configure" +#include "confdefs.h" +#include +int +main () +{ +printf("Hello world"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16655: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16658: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16661: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16664: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 + +echo "${as_me:-configure}:16672: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 + + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then + test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 + +echo "${as_me:-configure}:16677: testing but keeping change to \$CPPFLAGS ..." 1>&5 + + fi + CFLAGS="$cf_check_flags" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + +echo "$as_me:16685: checking for XOpenDisplay in -lX11" >&5 +echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 16693 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main () +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16712: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16715: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16718: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16721: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_X11_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_X11_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:16732: result: $ac_cv_lib_X11_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 +if test $ac_cv_lib_X11_XOpenDisplay = yes; then + +cf_add_libs="-lX11" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +fi + +echo "$as_me:16754: checking for XCurses library" >&5 +echo $ECHO_N "checking for XCurses library... $ECHO_C" >&6 +if test "${cf_cv_lib_XCurses+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_add_libs="-lXCurses" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +cat >conftest.$ac_ext <<_ACEOF +#line 16777 "configure" +#include "confdefs.h" + +#include +char *XCursesProgramName = "test"; + +int +main () +{ +XCursesExit(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16792: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16795: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16798: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16801: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_lib_XCurses=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_lib_XCurses=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:16812: result: $cf_cv_lib_XCurses" >&5 +echo "${ECHO_T}$cf_cv_lib_XCurses" >&6 + +fi + +if test $cf_cv_lib_XCurses = yes ; then + +cat >>confdefs.h <<\EOF +#define UNIX 1 +EOF + +cat >>confdefs.h <<\EOF +#define XCURSES 1 +EOF + + echo "$as_me:16827: checking for xcurses.h" >&5 +echo $ECHO_N "checking for xcurses.h... $ECHO_C" >&6 +if test "${ac_cv_header_xcurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 16833 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:16837: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:16843: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_xcurses_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_xcurses_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:16862: result: $ac_cv_header_xcurses_h" >&5 +echo "${ECHO_T}$ac_cv_header_xcurses_h" >&6 +if test $ac_cv_header_xcurses_h = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_XCURSES 1 +EOF + +fi + +else + { { echo "$as_me:16873: error: Cannot link with XCurses" >&5 +echo "$as_me: error: Cannot link with XCurses" >&2;} + { (exit 1); exit 1; }; } +fi + + ;; +(*) + { { echo "$as_me:16880: error: unexpected screen-value: $cf_cv_screen" >&5 +echo "$as_me: error: unexpected screen-value: $cf_cv_screen" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +: ${cf_nculib_root:=$cf_cv_screen} +as_ac_Lib=`echo "ac_cv_lib_$cf_nculib_root''__nc_init_pthreads" | $as_tr_sh` +echo "$as_me:16888: checking for _nc_init_pthreads in -l$cf_nculib_root" >&5 +echo $ECHO_N "checking for _nc_init_pthreads in -l$cf_nculib_root... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$cf_nculib_root $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 16896 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _nc_init_pthreads (); +int +main () +{ +_nc_init_pthreads (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16915: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16918: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16921: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16924: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Lib=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:16935: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + cf_cv_ncurses_pthreads=yes +else + cf_cv_ncurses_pthreads=no +fi + +if test "$cf_cv_ncurses_pthreads" = yes +then + +cf_add_libs="-lpthread" +# Filter out duplicates - this happens with badly-designed ".pc" files... +for cf_add_1lib in $LIBS +do + for cf_add_2lib in $cf_add_libs + do + if test "x$cf_add_1lib" = "x$cf_add_2lib" + then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" +done +LIBS="$cf_add_libs" + +fi + +CFG_ROOTNAME=cdk +HDR_ROOTNAME=cdk +LIB_ROOTNAME=cdk + +case $cf_cv_screen in #(vi +ncurses) #(vi + ;; +ncursesw) + LIB_ROOTNAME=cdkw + ;; +pdcurses) #(vi + LIB_ROOTNAME=cdkX + ;; +esac + +echo "$as_me:16979: checking for XXX-config rootname" >&5 +echo $ECHO_N "checking for XXX-config rootname... $ECHO_C" >&6 + +# Check whether --with-cfgname or --without-cfgname was given. +if test "${with_cfgname+set}" = set; then + withval="$with_cfgname" + CFG_ROOTNAME=$withval +fi; +echo "$as_me:16987: result: $CFG_ROOTNAME" >&5 +echo "${ECHO_T}$CFG_ROOTNAME" >&6 + +echo "$as_me:16990: checking if cdk.h should be in header subdirectory" >&5 +echo $ECHO_N "checking if cdk.h should be in header subdirectory... $ECHO_C" >&6 + +# Check whether --with-hdrname or --without-hdrname was given. +if test "${with_hdrname+set}" = set; then + withval="$with_hdrname" + HDR_ROOTNAME=no +fi; +echo "$as_me:16998: result: $HDR_SUBDIR" >&5 +echo "${ECHO_T}$HDR_SUBDIR" >&6 + +if test "$HDR_SUBDIR" = yes +then + HDR_SUBDIR="#" +else + HDR_SUBDIR= +fi + +echo "$as_me:17008: checking for header subdirectory" >&5 +echo $ECHO_N "checking for header subdirectory... $ECHO_C" >&6 + +# Check whether --with-hdrname or --without-hdrname was given. +if test "${with_hdrname+set}" = set; then + withval="$with_hdrname" + HDR_ROOTNAME=$withval +fi; +echo "$as_me:17016: result: $HDR_ROOTNAME" >&5 +echo "${ECHO_T}$HDR_ROOTNAME" >&6 + +echo "$as_me:17019: checking for library name" >&5 +echo $ECHO_N "checking for library name... $ECHO_C" >&6 + +# Check whether --with-libname or --without-libname was given. +if test "${with_libname+set}" = set; then + withval="$with_libname" + LIB_ROOTNAME=$withval +fi; +echo "$as_me:17027: result: $LIB_ROOTNAME" >&5 +echo "${ECHO_T}$LIB_ROOTNAME" >&6 + +echo "$as_me:17030: checking if improved const-typing should be used" >&5 +echo $ECHO_N "checking if improved const-typing should be used... $ECHO_C" >&6 + +# Check whether --enable-const or --disable-const was given. +if test "${enable_const+set}" = set; then + enableval="$enable_const" + CDK_CONST=$enableval +else + CDK_CONST=no +fi; +echo "$as_me:17040: result: $CDK_CONST" >&5 +echo "${ECHO_T}$CDK_CONST" >&6 +if test "$CDK_CONST" = yes +then + +cat >>confdefs.h <<\EOF +#define CDK_CONST const +EOF + +else + cat >>confdefs.h <<\EOF +#define CDK_CONST /*nothing*/ +EOF + +fi + +# define these for casting convenience + +cat >>confdefs.h <<\EOF +#define CDK_CSTRING CDK_CONST char * +EOF + +cat >>confdefs.h <<\EOF +#define CDK_CSTRING2 CDK_CONST char * CDK_CONST * +EOF + +echo "$as_me:17066: checking definition to turn on extended curses functions" >&5 +echo $ECHO_N "checking definition to turn on extended curses functions... $ECHO_C" >&6 +if test "${cf_cv_need_xopen_extension+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_need_xopen_extension=unknown +cat >conftest.$ac_ext <<_ACEOF +#line 17074 "configure" +#include "confdefs.h" + +#include +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ + +#if defined(NCURSES_VERSION_PATCH) +#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) + make an error +#endif +#endif +#ifdef NCURSES_VERSION + cchar_t check; + int check2 = curs_set((int)sizeof(check)); +#endif + long x = winnstr(stdscr, "", 0); + int x1, y1; + getbegyx(stdscr, y1, x1) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:17100: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:17103: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:17106: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17109: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_need_xopen_extension=none +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR + do + cat >conftest.$ac_ext <<_ACEOF +#line 17119 "configure" +#include "confdefs.h" + +#define $cf_try_xopen_extension 1 +#include +#include <${cf_cv_ncurses_header:-curses.h}> +int +main () +{ + +#ifdef NCURSES_VERSION + cchar_t check; + int check2 = curs_set((int)sizeof(check)); +#endif + long x = winnstr(stdscr, "", 0); + int x1, y1; + getbegyx(stdscr, y1, x1) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:17141: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:17144: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:17147: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17150: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_need_xopen_extension=$cf_try_xopen_extension; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:17164: result: $cf_cv_need_xopen_extension" >&5 +echo "${ECHO_T}$cf_cv_need_xopen_extension" >&6 + +case $cf_cv_need_xopen_extension in +(*_*) + CPPFLAGS="$CPPFLAGS -D$cf_cv_need_xopen_extension" + ;; +esac + +echo "$as_me:17173: checking for term.h" >&5 +echo $ECHO_N "checking for term.h... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# If we found , look for , but always look +# for if we do not find the variant. + +cf_header_list="term.h ncurses/term.h ncursesw/term.h" + +case ${cf_cv_ncurses_header:-curses.h} in +(*/*) + cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h + cf_header_list="$cf_header_item $cf_header_list" + ;; +esac + +for cf_header in $cf_header_list +do + cat >conftest.$ac_ext <<_ACEOF +#line 17194 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +#include <${cf_header}> +int +main () +{ +WINDOW *x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:17208: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:17211: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:17214: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17217: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_term_header=$cf_header + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_term_header=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +case $cf_cv_term_header in +(no) + # If curses is ncurses, some packagers still mess it up by trying to make + # us use GNU termcap. This handles the most common case. + for cf_header in ncurses/term.h ncursesw/term.h + do + cat >conftest.$ac_ext <<_ACEOF +#line 17236 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +#ifdef NCURSES_VERSION +#include <${cf_header}> +#else +make an error +#endif +int +main () +{ +WINDOW *x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:17254: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:17257: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:17260: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17263: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_term_header=$cf_header + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_term_header=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done + ;; +esac + +fi +echo "$as_me:17278: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +case $cf_cv_term_header in +(term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +(ncurses/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +(ncursesw/term.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +echo "$as_me:17305: checking for unctrl.h" >&5 +echo $ECHO_N "checking for unctrl.h... $ECHO_C" >&6 +if test "${cf_cv_unctrl_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# If we found , look for , but always look +# for if we do not find the variant. + +cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" + +case ${cf_cv_ncurses_header:-curses.h} in +(*/*) + cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h + cf_header_list="$cf_header_item $cf_header_list" + ;; +esac + +for cf_header in $cf_header_list +do + cat >conftest.$ac_ext <<_ACEOF +#line 17326 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> +#include <${cf_header}> +int +main () +{ +WINDOW *x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:17340: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:17343: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:17346: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17349: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_unctrl_header=$cf_header + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_unctrl_header=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:17362: result: $cf_cv_unctrl_header" >&5 +echo "${ECHO_T}$cf_cv_unctrl_header" >&6 + +case $cf_cv_unctrl_header in +(no) + { echo "$as_me:17367: WARNING: unctrl.h header not found" >&5 +echo "$as_me: WARNING: unctrl.h header not found" >&2;} + ;; +esac + +case $cf_cv_unctrl_header in +(unctrl.h) + +cat >>confdefs.h <<\EOF +#define HAVE_UNCTRL_H 1 +EOF + + ;; +(ncurses/unctrl.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_UNCTRL_H 1 +EOF + + ;; +(ncursesw/unctrl.h) + +cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_UNCTRL_H 1 +EOF + + ;; +esac + +for cf_func in \ + Xinitscr\ + getbegx \ + getbegy \ + getmaxx \ + getmaxy \ + start_color \ + \ + +do + +cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + echo "$as_me:17409: checking for ${cf_func}" >&5 +echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 + +echo "${as_me:-configure}:17412: testing ${cf_func} ..." 1>&5 + + if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + eval cf_result='$ac_cv_func_'$cf_func + if test ".$cf_result" != ".no"; then + cat >conftest.$ac_ext <<_ACEOF +#line 17421 "configure" +#include "confdefs.h" + +#ifdef HAVE_XCURSES +#include +char * XCursesProgramName = "test"; +#else +#include <${cf_cv_ncurses_header:-curses.h}> +#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) +#include +#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) +#include +#elif defined(HAVE_TERM_H) +#include +#endif +#endif + +int +main () +{ + +#ifndef ${cf_func} +long foo = (long)(&${cf_func}); +fprintf(stderr, "testing linkage of $cf_func:%p\n", foo); +if (foo + 1234 > 5678) + ${cf_cv_main_return:-return}(foo); +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:17454: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:17457: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:17460: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17463: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi + eval 'cf_cv_func_'$cf_func'=$cf_result' + +fi + + # use the computed/retrieved cache-value: + eval 'cf_result=$cf_cv_func_'$cf_func + echo "$as_me:17479: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + if test $cf_result != no; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for nc_alloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_nc_alloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 17499 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:17503: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:17509: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_nc_alloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_nc_alloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:17528: result: $ac_cv_header_nc_alloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_nc_alloc_h" >&6 + +for ac_func in _nc_free_and_exit +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:17534: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 17540 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:17571: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:17574: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:17577: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17580: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:17590: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking how to define setbegyx... $ECHO_C" >&6 +cf_result=ERR +for cf_check in \ + '((win)->_begy = (y), (win)->_begx = (x), OK)' +do + cat >conftest.$ac_ext <<_ACEOF +#line 17611 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header:-curses.h}> + +int +main () +{ + +WINDOW *win = 0; +#define setbegyx(win,y,x) $cf_check +setbegyx(win, 2, 3); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:17629: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:17632: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:17635: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:17638: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=$cf_check; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +echo "$as_me:17647: result: \"$cf_result\"" >&5 +echo "${ECHO_T}\"$cf_result\"" >&6 + +cat >>confdefs.h <confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:17762: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:17938: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:17957: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52.20150926, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "cdk-config" ) CONFIG_FILES="$CONFIG_FILES cdk-config" ;; + "include/cdk_version.h" ) CONFIG_FILES="$CONFIG_FILES include/cdk_version.h:include/cdk_version.hin" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "cli/Makefile" ) CONFIG_FILES="$CONFIG_FILES cli/Makefile" ;; + "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "demos/Makefile" ) CONFIG_FILES="$CONFIG_FILES demos/Makefile" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "include/cdk_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/cdk_config.h:include/config.hin" ;; + *) { { echo "$as_me:18017: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datarootdir@,$datarootdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@VERSION@,$VERSION,;t t +s,@VERSION_MAJOR@,$VERSION_MAJOR,;t t +s,@VERSION_MINOR@,$VERSION_MINOR,;t t +s,@VERSION_PATCH@,$VERSION_PATCH,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@top_builddir@,$top_builddir,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t +s,@CPP@,$CPP,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@LN_S@,$LN_S,;t t +s,@LINT@,$LINT,;t t +s,@LINT_OPTS@,$LINT_OPTS,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@cf_cv_makeflags@,$cf_cv_makeflags,;t t +s,@CTAGS@,$CTAGS,;t t +s,@ETAGS@,$ETAGS,;t t +s,@MAKE_LOWER_TAGS@,$MAKE_LOWER_TAGS,;t t +s,@MAKE_UPPER_TAGS@,$MAKE_UPPER_TAGS,;t t +s,@ECHO_LT@,$ECHO_LT,;t t +s,@ECHO_LD@,$ECHO_LD,;t t +s,@RULE_CC@,$RULE_CC,;t t +s,@SHOW_CC@,$SHOW_CC,;t t +s,@ECHO_CC@,$ECHO_CC,;t t +s,@PROG_EXT@,$PROG_EXT,;t t +s,@LIB_PREFIX@,$LIB_PREFIX,;t t +s,@MAN_TAG@,$MAN_TAG,;t t +s,@MANSECT@,$MANSECT,;t t +s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t +s,@cf_ldd_prog@,$cf_ldd_prog,;t t +s,@EXTRA_LDFLAGS@,$EXTRA_LDFLAGS,;t t +s,@ABI_VERSION@,$ABI_VERSION,;t t +s,@REL_VERSION@,$REL_VERSION,;t t +s,@shlibdir@,$shlibdir,;t t +s,@LIBTOOL_VERSION@,$LIBTOOL_VERSION,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@ac_ct_LIBTOOL@,$ac_ct_LIBTOOL,;t t +s,@LT_UNDEF@,$LT_UNDEF,;t t +s,@LIBTOOL_CXX@,$LIBTOOL_CXX,;t t +s,@LIBTOOL_OPTS@,$LIBTOOL_OPTS,;t t +s,@LIB_CREATE@,$LIB_CREATE,;t t +s,@LIB_OBJECT@,$LIB_OBJECT,;t t +s,@LIB_SUFFIX@,$LIB_SUFFIX,;t t +s,@LIB_PREP@,$LIB_PREP,;t t +s,@LIB_CLEAN@,$LIB_CLEAN,;t t +s,@LIB_COMPILE@,$LIB_COMPILE,;t t +s,@LIB_LINK@,$LIB_LINK,;t t +s,@LIB_INSTALL@,$LIB_INSTALL,;t t +s,@LIB_UNINSTALL@,$LIB_UNINSTALL,;t t +s,@EXPORT_SYMS@,$EXPORT_SYMS,;t t +s,@MAKE_DLLS@,$MAKE_DLLS,;t t +s,@CC_SHARED_OPTS@,$CC_SHARED_OPTS,;t t +s,@LD_RPATH_OPT@,$LD_RPATH_OPT,;t t +s,@LD_SHARED_OPTS@,$LD_SHARED_OPTS,;t t +s,@MK_SHARED_LIB@,$MK_SHARED_LIB,;t t +s,@RM_SHARED_OPTS@,$RM_SHARED_OPTS,;t t +s,@LINK_PROGS@,$LINK_PROGS,;t t +s,@LINK_TESTS@,$LINK_TESTS,;t t +s,@LOCAL_LDFLAGS@,$LOCAL_LDFLAGS,;t t +s,@LOCAL_LDFLAGS2@,$LOCAL_LDFLAGS2,;t t +s,@INSTALL_LIB@,$INSTALL_LIB,;t t +s,@RPATH_LIST@,$RPATH_LIST,;t t +s,@RESULTING_SYMS@,$RESULTING_SYMS,;t t +s,@VERSIONED_SYMS@,$VERSIONED_SYMS,;t t +s,@WILDCARD_SYMS@,$WILDCARD_SYMS,;t t +s,@DFT_LWR_MODEL@,$DFT_LWR_MODEL,;t t +s,@DFT_LIB_SUFFIX@,$DFT_LIB_SUFFIX,;t t +s,@DFT_DEP_SUFFIX@,$DFT_DEP_SUFFIX,;t t +s,@LIB_MODEL@,$LIB_MODEL,;t t +s,@LIBTOOL_MAKE@,$LIBTOOL_MAKE,;t t +s,@MAKE_NORMAL@,$MAKE_NORMAL,;t t +s,@MAKE_SHARED@,$MAKE_SHARED,;t t +s,@MAKE_STATIC@,$MAKE_STATIC,;t t +s,@NCURSES_CONFIG@,$NCURSES_CONFIG,;t t +s,@ac_ct_NCURSES_CONFIG@,$ac_ct_NCURSES_CONFIG,;t t +s,@X_CFLAGS@,$X_CFLAGS,;t t +s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t +s,@X_LIBS@,$X_LIBS,;t t +s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t +s,@XCURSES_CONFIG@,$XCURSES_CONFIG,;t t +s,@ac_ct_XCURSES_CONFIG@,$ac_ct_XCURSES_CONFIG,;t t +s,@CFG_ROOTNAME@,$CFG_ROOTNAME,;t t +s,@HDR_SUBDIR@,$HDR_SUBDIR,;t t +s,@HDR_ROOTNAME@,$HDR_ROOTNAME,;t t +s,@LIB_ROOTNAME@,$LIB_ROOTNAME,;t t +s,@SET_SHLIB_VARS@,$SET_SHLIB_VARS,;t t +s,@LIB_TARGET@,$LIB_TARGET,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + # It is possible to make a multiline substitution using escaped newlines. + # Ensure that we do not split the substitution between script fragments. + ac_BEG=$ac_end + ac_END=`expr $ac_end + $ac_max_sed_lines` + sed "1,${ac_BEG}d; ${ac_END}p; q" $tmp/subs.sed >$tmp/subs.next + if test -s $tmp/subs.next; then + grep '^s,@[^@,][^@,]*@,.*\\$' $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + grep "^s,@[^@,][^@,]*@,.*,;t t$" $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + if test $ac_beg -gt 1; then + ac_end=`expr $ac_end - 1` + continue + fi + fi + fi + fi + + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:18341: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:18359: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:18372: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <<\EOF + ac_warn_datarootdir=no + if test x"$ac_file" != x-; then + for ac_item in $ac_file_inputs + do + ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item` + if test -n "$ac_seen"; then + ac_used=`grep '@datarootdir@' $ac_item` + if test -z "$ac_used"; then + { echo "$as_me:18388: WARNING: datarootdir was used implicitly but not set: +$ac_seen" >&5 +echo "$as_me: WARNING: datarootdir was used implicitly but not set: +$ac_seen" >&2;} + ac_warn_datarootdir=yes + fi + fi + ac_seen=`grep '${datarootdir}' $ac_item` + if test -n "$ac_seen"; then + { echo "$as_me:18397: WARNING: datarootdir was used explicitly but not set: +$ac_seen" >&5 +echo "$as_me: WARNING: datarootdir was used explicitly but not set: +$ac_seen" >&2;} + ac_warn_datarootdir=yes + fi + done + fi + +if test "x$ac_warn_datarootdir" = xyes; then + ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" +fi + +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + cp $tmp/out $ac_file + + for ac_name in prefix exec_prefix datarootdir + do + ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file` + if test -n "$ac_seen"; then + ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` + if test -z "$ac_init"; then + ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` + { echo "$as_me:18434: WARNING: Variable $ac_name is used but was not set: +$ac_seen" >&5 +echo "$as_me: WARNING: Variable $ac_name is used but was not set: +$ac_seen" >&2;} + fi + fi + done + egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out + egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out + if test -s $tmp/out; then + ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` + { echo "$as_me:18445: WARNING: Some variables may not be substituted: +$ac_seen" >&5 +echo "$as_me: WARNING: Some variables may not be substituted: +$ac_seen" >&2;} + fi + else + cat $tmp/out + fi + rm -f $tmp/out + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_iB='\([ ]\),\1#\2define\3' +ac_iC=' ' +ac_iD='\4,;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:18494: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:18505: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:18518: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into a list of #define's. We won't use it as a sed +# script, but as data to insert where we see @DEFS@. We expect AC_SAVE_DEFS to +# be either 'cat' or 'sort'. +sort confdefs.h | uniq >conftest.vals + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +echo ' rm -f conftest.frag' >> $CONFIG_STATUS +while grep . conftest.vals >/dev/null +do + # Write chunks of a limited-size here document to conftest.frag. + echo ' cat >> conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals | sed -e 's/#ifdef.*/#if 0/' >> $CONFIG_STATUS + echo 'CEOF' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +# Run sed to substitute the contents of conftest.frag into $tmp/in at the +# marker @DEFS@. +echo ' cat >> conftest.edit < $tmp/out +rm -f $tmp/in +mv $tmp/out $tmp/in +rm -f conftest.edit conftest.frag +' >> $CONFIG_STATUS + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:18576: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF +cat >>$CONFIG_STATUS <<\EOF +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + + case $ac_dest in + default ) + +cf_libname=\${LIB_BASENAME} +cf_liblink=$cf_libname +cf_libroot=$cf_libname + +if test "x$cf_cv_do_symlinks" = xyes +then + case "x$cf_cv_shlib_version" in + (xrel) + cf_liblink="\${LIB_ABI_NAME}" + cf_libname="\${LIB_REL_NAME}" + ;; + (xabi) + cf_liblink="\${LIB_REL_NAME}" + cf_libname="\${LIB_ABI_NAME}" + ;; + esac +fi +LIB_TARGET=$cf_libname + +case x$LIB_MODEL in +(xlibtool|xshared) + cf_libdeps="\${LIBS} \${LDFLAGS}" + ;; +(x*) + cf_libdeps= + ;; +esac + +cat >>Makefile <>Makefile <>Makefile <>Makefile <>Makefile <>Makefile <>Makefile <>Makefile <>Makefile <>Makefile <>Makefile <>Makefile <>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/deps/cdk-5.0-20161210/configure.in b/deps/cdk-5.0-20161210/configure.in new file mode 100644 index 0000000..429b982 --- /dev/null +++ b/deps/cdk-5.0-20161210/configure.in @@ -0,0 +1,225 @@ +dnl $Id: configure.in,v 1.75 2013/07/27 21:36:37 tom Exp $ +dnl Process this file with autoconf to produce a configure script for CDK. +dnl --------------------------------------------------------------------------- +dnl Copyright 1999-2012,2013 Thomas E. Dickey +dnl +dnl Permission is hereby granted, free of charge, to any person obtaining a +dnl copy of this software and associated documentation files (the "Software"), +dnl to deal in the Software without restriction, including without limitation +dnl the rights to use, copy, modify, merge, publish, distribute, distribute +dnl with modifications, sublicense, and/or sell copies of the Software, and to +dnl permit persons to whom the Software is furnished to do so, subject to the +dnl following conditions: +dnl +dnl The above copyright notice and this permission notice shall be included in +dnl all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +dnl THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +dnl DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name(s) of the above copyright +dnl holders shall not be used in advertising or otherwise to promote the sale, +dnl use or other dealings in this Software without prior written +dnl authorization. +dnl --------------------------------------------------------------------------- +AC_INIT(include/cdk.h) +AC_CONFIG_HEADER(include/cdk_config.h:include/config.hin) + +CF_CHECK_CACHE +CF_VERSION_INFO(cdk) +CF_TOP_BUILDDIR(.) + +dnl +dnl Checks for programs. +dnl +CF_PROG_CC +AC_PROG_CPP +AC_PROG_RANLIB +AC_PROG_INSTALL +CF_PROG_LN_S +CF_PROG_LINT + +dnl needed for CF_WITH_LIBTOOL +AC_CHECK_TOOL(AR, ar, ar) + +AC_PROG_MAKE_SET +CF_MAKEFLAGS +CF_MAKE_TAGS + +CF_XOPEN_SOURCE + +CF_DISABLE_ECHO +CF_PROG_EXT +CF_LIB_PREFIX + +AC_ARG_WITH(man-section, + [ --with-man-section=XXX change manpage section (default 3)], + [MANSECT=$with_man_section], + [MANSECT=3]) +case .$MANSECT in +.yes|.no) + MANSECT=3 + ;; +esac +MAN_TAG=`echo $MANSECT | sed -e 's/^\(.\).*/\1/'` +AC_SUBST(MAN_TAG) +AC_SUBST(MANSECT) + +CF_WITH_CURSES_DIR +CF_WITH_WARNINGS +CF_PKG_CONFIG + +CF_ENABLE_RPATH +CF_DISABLE_RPATH_HACK +CF_WITH_SHARED_OR_LIBTOOL(CDK,${VERSION_MAJOR}.${VERSION_MINOR},`echo "$VERSION" |sed -e 's/:/./g'`) + +dnl +dnl Checks for libraries. +dnl + +CF_DISABLE_LEAKS + +dnl +dnl Checks for header files. +dnl +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_CHECK_HEADERS(\ +limits.h \ +unistd.h \ +pwd.h \ +grp.h \ +) + +dnl +dnl Checks for typedefs, structures, and compiler characteristics. +dnl +AC_TYPE_MODE_T +AC_STRUCT_TM +CF_CURSES_CHTYPE +CF_GETOPT_HEADER + +dnl +dnl Checks for library functions. +dnl +AC_CHECK_FUNCS(\ +getcwd \ +mktime \ +strdup \ +strerror \ +getlogin \ +sleep \ +) + +CF_FUNC_LSTAT +CF_LOCALE([AC_DEFINE(HAVE_SETLOCALE,1,[Define to 1 if we have setlocale function])]) + +dnl Check for curses libraries last, since XCurses has dependencies which +dnl break the checks for other functions. +CF_WITH_NCURSES_ETC + +CFG_ROOTNAME=cdk +HDR_ROOTNAME=cdk +LIB_ROOTNAME=cdk + +case $cf_cv_screen in #(vi +ncurses) #(vi + ;; +ncursesw) + LIB_ROOTNAME=cdkw + ;; +pdcurses) #(vi + LIB_ROOTNAME=cdkX + ;; +esac + +AC_MSG_CHECKING(for XXX-config rootname) +AC_ARG_WITH(cfgname, + [ --with-cfgname=XXX override the XXX-config rootname], + [CFG_ROOTNAME=$withval]) +AC_MSG_RESULT($CFG_ROOTNAME) +AC_SUBST(CFG_ROOTNAME) + +AC_MSG_CHECKING(if cdk.h should be in header subdirectory) +AC_ARG_WITH(hdrname, + [ --enable-hdr-subdir install cdk.h in the header subdirectory], + [HDR_ROOTNAME=no]) +AC_MSG_RESULT($HDR_SUBDIR) +AC_SUBST(HDR_SUBDIR) + +if test "$HDR_SUBDIR" = yes +then + HDR_SUBDIR="#" +else + HDR_SUBDIR= +fi + +AC_MSG_CHECKING(for header subdirectory) +AC_ARG_WITH(hdrname, + [ --with-hdrname=XXX override the header subdirectory], + [HDR_ROOTNAME=$withval]) +AC_MSG_RESULT($HDR_ROOTNAME) +AC_SUBST(HDR_ROOTNAME) + +AC_MSG_CHECKING(for library name) +AC_ARG_WITH(libname, + [ --with-libname=XXX override the library name], + [LIB_ROOTNAME=$withval]) +AC_MSG_RESULT($LIB_ROOTNAME) +AC_SUBST(LIB_ROOTNAME) + +AC_MSG_CHECKING(if improved const-typing should be used) +AC_ARG_ENABLE(const, + [ --enable-const use improved const-typing], + [CDK_CONST=$enableval], + [CDK_CONST=no]) +AC_MSG_RESULT($CDK_CONST) +if test "$CDK_CONST" = yes +then + AC_DEFINE(CDK_CONST,const,[Define to const if improved const-typing should be used]) +else + AC_DEFINE(CDK_CONST,/*nothing*/) +fi + +# define these for casting convenience +AC_DEFINE(CDK_CSTRING,CDK_CONST char *,[Define to simplify casting CDK_CONST]) +AC_DEFINE(CDK_CSTRING2,CDK_CONST char * CDK_CONST *,[Define to simplify casting CDK_CONST]) + +CF_CURSES_FUNCS(\ + Xinitscr\ + getbegx \ + getbegy \ + getmaxx \ + getmaxy \ + start_color \ + \ +) + +CF_WITH_NC_ALLOC_H +CF_CURSES_SETBEGYX + +CF__DEFINE_SHLIB_VARS + +dnl +dnl Set pre-processor compile time variables. +dnl +AC_OUTPUT( + cdk-config + include/cdk_version.h:include/cdk_version.hin + Makefile + cli/Makefile + examples/Makefile + demos/Makefile,[ +CF__ADD_SHLIB_RULES( + Makefile, + $LIB_MODEL, + [\${LIB_OBJECT}], + [\${LIBS} \${LDFLAGS}]) +],[ +CF__INIT_SHLIB_RULES +],sort) diff --git a/deps/cdk-5.0-20161210/debug.c b/deps/cdk-5.0-20161210/debug.c new file mode 100644 index 0000000..0847ef2 --- /dev/null +++ b/deps/cdk-5.0-20161210/debug.c @@ -0,0 +1,53 @@ +#include + +/* + * $Author: tom $ + * $Date: 2012/03/20 21:58:33 $ + * $Revision: 1.11 $ + */ + +FILE *CDKDEBUG; + + +/* + * This starts debugging for CDK. + */ +FILE *startCDKDebug (const char *filename) +{ + const char *defFile = "cdkdebug.log"; + + /* Check if the filename is null. */ + if (filename == 0) + { + filename = defFile; + } + + /* Try to open the file. */ + return (fopen (filename, "w")); +} + +/* + * This writes a message to the debug file. + */ +void writeCDKDebugMessage (FILE * fd, + const char *filename, + const char *function, + int line, const char *message) +{ + /* Print the message as long as the file pointer is not null. */ + if (fd != 0) + { + fprintf (fd, "%s::%s (Line %d) %s\n", filename, function, line, message); + } +} + +/* + * This turns off the debugging for CDK. + */ +void stopCDKDebug (FILE * fd) +{ + if (fd != 0) + { + fclose (fd); + } +} diff --git a/deps/cdk-5.0-20161210/demos/Makefile.in b/deps/cdk-5.0-20161210/demos/Makefile.in new file mode 100644 index 0000000..4cf2e98 --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/Makefile.in @@ -0,0 +1,128 @@ +# $Id: Makefile.in,v 1.20 2013/07/19 23:55:03 tom Exp $ +# +# Makefile for the demos directory. +# +SHELL = /bin/sh + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +srcdir = @srcdir@ +VPATH = $(srcdir) + +CC = @CC@ +RM = rm -f +CTAGS = @CTAGS@ +ETAGS = @ETAGS@ +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ + +LIBS = -l@LIB_ROOTNAME@ @LIBS@ + +LIBTOOL = @LIBTOOL@ @ECHO_LT@ +LIBTOOL_CLEAN = @LIB_CLEAN@ +LIBTOOL_LINK = @LIB_LINK@ +LINK = $(LIBTOOL_LINK) + +x = @EXEEXT@ +o = .@OBJEXT@ +LOCAL_LIBDIR = @top_builddir@ + +CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@ +CPPFLAGS = @DEFS@ -I../include -I$(srcdir)/../include -I. @CPPFLAGS@ +LDFLAGS = -L.. @LDFLAGS@ @LOCAL_LDFLAGS@ + +BINS = \ + fileview$x \ + rolodex$x \ + command$x \ + clock$x \ + stopSign$x \ + appointment$x \ + vinstall$x + +# this needs configure-script work: +OTHER_BINS = \ + serial$x + +CDKSRC = \ + fileview.c \ + rolodex.c \ + command.c \ + clock.c \ + stopSign.c \ + appointment.c \ + vinstall.c \ + serial.c + +# If you have Sybase installed on your system, try making +# syb. It's a full screen interface to Sybase. +# +SYBROOT = $(SYBASE) +SYBINCDIR = -I$(SYBROOT)/include +SYBLIBDIR = -L$(SYBROOT)/devlib +SYBLIBS = -lnsl -lsybdb + +all : $(BINS) + +# +# Standard .c to .o compile line. +# +.c.o: + @RULE_CC@ + @ECHO_CC@$(CC) $(CFLAGS) $(CPPFLAGS) -c $< +# +# Most of the examples are built from a single .c file using the same libraries +# +LINKIT = @ECHO_LD@$(LINK) $(CFLAGS) $(CPPFLAGS) $? -o $@ $(LDFLAGS) $(LIBS) + +# fileview - Basic file selector/file viewer combination. +fileview$x : fileview.o ; $(LINKIT) + +# rolodex - A fairly robust rolodex. +rolodex$x : rolodex.o ; $(LINKIT) + +# command - A basic command interface with command history. +command$x : command.o ; $(LINKIT) + +# clock - A simple little clock. +clock$x : clock.o ; $(LINKIT) + +# stopSign - A simple demo I wrote after a couple of pints. :) +stopSign$x : stopSign.o ; $(LINKIT) + +# appointment - A basic appointment book/date keeper. +appointment$x : appointment.o ; $(LINKIT) + +# serial - This probes the serial port. +serial$x : serial.o ; $(LINKIT) + +# keycheck - This prints out the keys ASCII and Octal values. +keycheck$x : keycheck.o ; $(LINKIT) + +# vinstall - CDK based installer. +vinstall$x : vinstall.o ; $(LINKIT) + +# +# A Sybase interface. +# +syb$x : syb.c + $(CC) $(CFLAGS) -o $@ $? $(CPPFLAGS) $(SYBINCDIR) $(LDFLAGS) $(SYBLIBDIR) $(LIBS) $(SYBLIBS) + +# +# Standard clean directives. +# +clean:: + -$(LIBTOOL_CLEAN) $(RM) *.o core $(BINS) $(OTHER_BINS) + +distclean:: clean + -rm -f Makefile + +@MAKE_LOWER_TAGS@tags : +@MAKE_LOWER_TAGS@ $(CTAGS) *.[ch] */*.[ch] + +@MAKE_LOWER_TAGS@TAGS : +@MAKE_LOWER_TAGS@ $(ETAGS) *.[ch] */*.[ch] + +lint: $(CDKSRC) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(CDKSRC) diff --git a/deps/cdk-5.0-20161210/demos/appointment.c b/deps/cdk-5.0-20161210/demos/appointment.c new file mode 100644 index 0000000..72f30c6 --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/appointment.c @@ -0,0 +1,524 @@ +/* $Id: appointment.c,v 1.29 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "appointmentBook"; +#endif + +/* + * Create definitions. + */ +#define MAX_MARKERS 2000 + +/* + * + */ +static chtype GPAppointmentAttributes[] = +{ + A_BLINK, + A_BOLD, + A_REVERSE, + A_UNDERLINE +}; + +/* + * + */ +typedef enum +{ + vBirthday, vAnniversary, vAppointment, vOther +} +EAppointmentType; + +/* + * + */ +struct AppointmentMarker +{ + EAppointmentType type; + char *description; + int day; + int month; + int year; +}; + +/* + * + */ +struct AppointmentInfo +{ + struct AppointmentMarker appointment[MAX_MARKERS]; + int appointmentCount; +}; + +/* + * Declare local function prototypes. + */ +static BINDFN_PROTO (createCalendarMarkCB); +static BINDFN_PROTO (removeCalendarMarkCB); +static BINDFN_PROTO (displayCalendarMarkCB); +static BINDFN_PROTO (accelerateToDateCB); +void readAppointmentFile (char *filename, struct AppointmentInfo *appInfo); +void saveAppointmentFile (char *filename, struct AppointmentInfo *appInfo); + +/* + * This program demonstrates the Cdk calendar widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKCALENDAR *calendar = 0; + const char *title = "CDK Appointment Book\n<#HL(30)>\n"; + char *filename = 0; + struct tm *dateInfo = 0; + time_t clck = 0; + struct AppointmentInfo appointmentInfo; + int day, month, year, x; + + /* + * Get the current dates and set the default values for + * the day/month/year values for the calendar. + */ + /* *INDENT-EQLS* */ + time (&clck); + dateInfo = gmtime (&clck); + day = dateInfo->tm_mday; + month = dateInfo->tm_mon + 1; + year = dateInfo->tm_year + 1900; + + /* Check the command line for options. */ + while (1) + { + int ret; + + /* Are there any more command line options to parse. */ + if ((ret = getopt (argc, argv, "d:m:y:t:f:")) == -1) + { + break; + } + + switch (ret) + { + case 'd': + day = atoi (optarg); + break; + + case 'm': + month = atoi (optarg); + break; + + case 'y': + year = atoi (optarg); + break; + + case 't': + title = copyChar (optarg); + break; + + case 'f': + filename = copyChar (optarg); + break; + } + } + + /* Create the appointment book filename. */ + if (filename == 0) + { + char temp[1000]; + char *home = getenv ("HOME"); + if (home != 0) + { + sprintf (temp, "%.*s/.appointment", (int)sizeof (temp) - 20, home); + } + else + { + strcpy (temp, ".appointment"); + } + filename = copyChar (temp); + } + + /* Read the appointment book information. */ + readAppointmentFile (filename, &appointmentInfo); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the calendar widget. */ + calendar = newCDKCalendar (cdkscreen, CENTER, CENTER, + title, day, month, year, + A_NORMAL, A_NORMAL, + A_NORMAL, A_REVERSE, + TRUE, FALSE); + + /* Is the widget null? */ + if (calendar == 0) + { + /* Clean up the memory. */ + destroyCDKScreen (cdkscreen); + + /* End curses... */ + endCDK (); + + /* Spit out a message. */ + printf ("Cannot create the calendar. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Create a key binding to mark days on the calendar. */ + bindCDKObject (vCALENDAR, calendar, 'm', createCalendarMarkCB, &appointmentInfo); + bindCDKObject (vCALENDAR, calendar, 'M', createCalendarMarkCB, &appointmentInfo); + bindCDKObject (vCALENDAR, calendar, 'r', removeCalendarMarkCB, &appointmentInfo); + bindCDKObject (vCALENDAR, calendar, 'R', removeCalendarMarkCB, &appointmentInfo); + bindCDKObject (vCALENDAR, calendar, '?', displayCalendarMarkCB, &appointmentInfo); + bindCDKObject (vCALENDAR, calendar, 'j', accelerateToDateCB, &appointmentInfo); + bindCDKObject (vCALENDAR, calendar, 'J', accelerateToDateCB, &appointmentInfo); + + /* Set all the appointments read from the file. */ + for (x = 0; x < appointmentInfo.appointmentCount; x++) + { + chtype marker = GPAppointmentAttributes[appointmentInfo.appointment[x].type]; + + setCDKCalendarMarker (calendar, + appointmentInfo.appointment[x].day, + appointmentInfo.appointment[x].month, + appointmentInfo.appointment[x].year, + marker); + } + + /* Draw the calendar widget. */ + drawCDKCalendar (calendar, ObjOf (calendar)->box); + + /* Let the user play with the widget. */ + activateCDKCalendar (calendar, 0); + + /* Save the appointment information. */ + saveAppointmentFile (filename, &appointmentInfo); + + free (filename); + + /* Clean up and exit. */ + destroyCDKCalendar (calendar); + destroyCDKScreen (cdkscreen); + endCDK (); + + ExitProgram (EXIT_SUCCESS); +} + +/* + * This reads a given appointment file. + */ +void readAppointmentFile (char *filename, struct AppointmentInfo *appInfo) +{ + /* *INDENT-EQLS* */ + int appointments = 0; + int linesRead = 0; + char **lines = 0; + int x; + + /* Read the appointment file. */ + linesRead = CDKreadFile (filename, &lines); + if (linesRead == -1) + { + appInfo->appointmentCount = 0; + return; + } + + /* Split each line up and create an appointment. */ + for (x = 0; x < linesRead; x++) + { + char **temp = CDKsplitString (lines[x], CTRL ('V')); + int segments = (int)CDKcountStrings ((CDK_CSTRING2)temp); + + /* + * A valid line has 5 elements: + * Day, Month, Year, Type, Description. + */ + if (segments == 5) + { + int eType = atoi (temp[3]); + + /* *INDENT-EQLS* */ + appInfo->appointment[appointments].day = atoi (temp[0]); + appInfo->appointment[appointments].month = atoi (temp[1]); + appInfo->appointment[appointments].year = atoi (temp[2]); + appInfo->appointment[appointments].type = (EAppointmentType) eType; + appInfo->appointment[appointments].description = copyChar (temp[4]); + appointments++; + } + CDKfreeStrings (temp); + } + CDKfreeStrings (lines); + + /* Keep the amount of appointments read. */ + appInfo->appointmentCount = appointments; +} + +/* + * This saves a given appointment file. + */ +void saveAppointmentFile (char *filename, struct AppointmentInfo *appInfo) +{ + /* Declare local variables. */ + FILE *fd; + int x; + + /* Can we open the file? */ + if ((fd = fopen (filename, "w")) == 0) + { + return; + } + + /* Start writing. */ + for (x = 0; x < appInfo->appointmentCount; x++) + { + if (appInfo->appointment[x].description != 0) + { + fprintf (fd, "%d%c%d%c%d%c%d%c%s\n", + appInfo->appointment[x].day, CTRL ('V'), + appInfo->appointment[x].month, CTRL ('V'), + appInfo->appointment[x].year, CTRL ('V'), + (int)appInfo->appointment[x].type, CTRL ('V'), + appInfo->appointment[x].description); + + freeChar (appInfo->appointment[x].description); + } + } + fclose (fd); +} + +/* + * This adds a marker to the calendar. + */ +static int createCalendarMarkCB (EObjectType objectType GCC_UNUSED, void *object, + void *clientData, + chtype key GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + CDKENTRY *entry = 0; + CDKITEMLIST *itemlist = 0; + const char *items[] = + { + "Birthday", + "Anniversary", + "Appointment", + "Other" + }; + char *description = 0; + struct AppointmentInfo *appointmentInfo = (struct AppointmentInfo *)clientData; + int current = appointmentInfo->appointmentCount; + chtype marker; + int selection; + + /* Create the itemlist widget. */ + itemlist = newCDKItemlist (ScreenOf (calendar), + CENTER, CENTER, 0, + "Select Appointment Type: ", + (CDK_CSTRING2)items, 4, 0, + TRUE, FALSE); + + /* Get the appointment tye from the user. */ + selection = activateCDKItemlist (itemlist, 0); + + /* They hit escape, kill the itemlist widget and leave. */ + if (selection == -1) + { + destroyCDKItemlist (itemlist); + drawCDKCalendar (calendar, ObjOf (calendar)->box); + return (FALSE); + } + + /* Destroy the itemlist and set the marker. */ + destroyCDKItemlist (itemlist); + drawCDKCalendar (calendar, ObjOf (calendar)->box); + marker = GPAppointmentAttributes[selection]; + + /* Create the entry field for the description. */ + entry = newCDKEntry (ScreenOf (calendar), + CENTER, CENTER, + "Enter a description of the appointment.", + "Description: ", + A_NORMAL, (chtype)'.', + vMIXED, 40, 1, 512, + TRUE, FALSE); + + /* Get the description. */ + description = activateCDKEntry (entry, 0); + if (description == 0) + { + destroyCDKEntry (entry); + drawCDKCalendar (calendar, ObjOf (calendar)->box); + return (FALSE); + } + + /* Destroy the entry and set the marker. */ + description = copyChar (entry->info); + destroyCDKEntry (entry); + drawCDKCalendar (calendar, ObjOf (calendar)->box); + + /* Set the marker. */ + setCDKCalendarMarker (calendar, + calendar->day, + calendar->month, + calendar->year, + marker); + + /* Keep the marker. */ + appointmentInfo->appointment[current].day = calendar->day; + appointmentInfo->appointment[current].month = calendar->month; + appointmentInfo->appointment[current].year = calendar->year; + appointmentInfo->appointment[current].type = (EAppointmentType) selection; + appointmentInfo->appointment[current].description = description; + appointmentInfo->appointmentCount++; + + /* Redraw the calendar. */ + drawCDKCalendar (calendar, ObjOf (calendar)->box); + return (FALSE); +} + +/* + * This removes a marker from the calendar. + */ +static int removeCalendarMarkCB (EObjectType objectType GCC_UNUSED, void + *object, void *clientData, chtype key GCC_UNUSED) +{ + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + struct AppointmentInfo *appointmentInfo = (struct AppointmentInfo *)clientData; + int x; + + /* Look for the marker in the list. */ + for (x = 0; x < appointmentInfo->appointmentCount; x++) + { + if ((appointmentInfo->appointment[x].day == calendar->day) && + (appointmentInfo->appointment[x].month == calendar->month) && + (appointmentInfo->appointment[x].year == calendar->year)) + { + freeChar (appointmentInfo->appointment[x].description); + appointmentInfo->appointment[x].description = 0; + break; + } + } + + /* Remove the marker from the calendar. */ + removeCDKCalendarMarker (calendar, + calendar->day, + calendar->month, + calendar->year); + + /* Redraw the calendar. */ + drawCDKCalendar (calendar, ObjOf (calendar)->box); + return (FALSE); +} + +/* + * This displays the marker(s) on the given day. + */ +static int displayCalendarMarkCB (EObjectType objectType GCC_UNUSED, void + *object, void *clientData, chtype key GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + CDKLABEL *label = 0; + struct AppointmentInfo *appointmentInfo = (struct AppointmentInfo *)clientData; + int found = 0; + int mesgLines = 0; + const char *type = 0; + char *mesg[10], temp[256]; + int x; + + /* Look for the marker in the list. */ + for (x = 0; x < appointmentInfo->appointmentCount; x++) + { + /* Get the day month year. */ + /* *INDENT-EQLS* */ + int day = appointmentInfo->appointment[x].day; + int month = appointmentInfo->appointment[x].month; + int year = appointmentInfo->appointment[x].year; + + /* Determine the appointment type. */ + if (appointmentInfo->appointment[x].type == vBirthday) + { + type = "Birthday"; + } + else if (appointmentInfo->appointment[x].type == vAnniversary) + { + type = "Anniversary"; + } + else if (appointmentInfo->appointment[x].type == vAppointment) + { + type = "Appointment"; + } + else + { + type = "Other"; + } + + /* Find the marker by the day/month/year. */ + if ((day == calendar->day) && + (month == calendar->month) && + (year == calendar->year) && + (appointmentInfo->appointment[x].description != 0)) + { + /* Create the message for the label widget. */ + sprintf (temp, "Appointment Date: %02d/%02d/%d", day, month, year); + mesg[mesgLines++] = copyChar (temp); + mesg[mesgLines++] = copyChar (" "); + mesg[mesgLines++] = copyChar ("<#HL(35)>"); + + sprintf (temp, " Appointment Type: %s", type); + mesg[mesgLines++] = copyChar (temp); + + mesg[mesgLines++] = copyChar (" Description :"); + sprintf (temp, " %s", appointmentInfo->appointment[x].description); + mesg[mesgLines++] = copyChar (temp); + + mesg[mesgLines++] = copyChar ("<#HL(35)>"); + mesg[mesgLines++] = copyChar (" "); + mesg[mesgLines++] = copyChar ("Press space to continue."); + + found = 1; + break; + } + } + + /* If we didn't find the marker, create a different message. */ + if (found == 0) + { + sprintf (temp, "There is no appointment for %02d/%02d/%d", + calendar->day, calendar->month, calendar->year); + mesg[mesgLines++] = copyChar (temp); + mesg[mesgLines++] = copyChar ("<#HL(30)>"); + mesg[mesgLines++] = copyChar ("Press space to continue."); + } + + /* Create the label widget. */ + label = newCDKLabel (ScreenOf (calendar), CENTER, CENTER, + (CDK_CSTRING2)mesg, mesgLines, TRUE, FALSE); + drawCDKLabel (label, ObjOf (label)->box); + waitCDKLabel (label, ' '); + destroyCDKLabel (label); + + /* Clean up the memory used. */ + for (x = 0; x < mesgLines; x++) + { + freeChar (mesg[x]); + } + + /* Redraw the calendar widget. */ + drawCDKCalendar (calendar, ObjOf (calendar)->box); + return (FALSE); +} + +/* + * This allows the user to accelerate to a given date. + */ +static int accelerateToDateCB (EObjectType objectType GCC_UNUSED, void + *object GCC_UNUSED, void *clientData + GCC_UNUSED, chtype key GCC_UNUSED) +{ + return (FALSE); +} diff --git a/deps/cdk-5.0-20161210/demos/clock.c b/deps/cdk-5.0-20161210/demos/clock.c new file mode 100644 index 0000000..92f462a --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/clock.c @@ -0,0 +1,90 @@ +/* $Id: clock.c,v 1.11 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "label_ex"; +#endif + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKLABEL *demo = 0; + int boxLabel = 0; + const char *mesg[4]; + char temp[256]; + time_t clck; + int ret; + + /* Parse up the command line. */ + while ((ret = getopt (argc, argv, "b")) != -1) + { + switch (ret) + { + case 'b': + boxLabel = 1; + } + } + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors */ + initCDKColor (); + + /* Set the labels up. */ + mesg[0] = "HH:MM:SS"; + + /* Declare the labels. */ + demo = newCDKLabel (cdkscreen, CENTER, CENTER, + (CDK_CSTRING2)mesg, 1, + boxLabel, FALSE); + + /* Is the label null??? */ + if (demo == 0) + { + /* Clean up the memory. */ + destroyCDKScreen (cdkscreen); + + /* End curses... */ + endCDK (); + + printf ("Cannot create the label. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + curs_set (0); + wtimeout (WindowOf (demo), 50); + + /* Do this for-a-while... */ + do + { + struct tm *currentTime; + + /* Get the current time. */ + time (&clck); + currentTime = localtime (&clck); + + /* Put the current time in a string. */ + sprintf (temp, "%02d:%02d:%02d", + currentTime->tm_hour, + currentTime->tm_min, + currentTime->tm_sec); + mesg[0] = copyChar (temp); + + /* Set the label contents. */ + setCDKLabel (demo, (CDK_CSTRING2)mesg, 1, ObjOf (demo)->box); + + /* Draw the label, and sleep. */ + drawCDKLabel (demo, ObjOf (demo)->box); + napms (500); + } + while (wgetch (WindowOf (demo)) == ERR); + + /* Clean up */ + destroyCDKLabel (demo); + destroyCDKScreen (cdkscreen); + endCDK (); + + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/demos/command.c b/deps/cdk-5.0-20161210/demos/command.c new file mode 100644 index 0000000..d60b039 --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/command.c @@ -0,0 +1,446 @@ +/* $Id: command.c,v 1.22 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "command"; +#endif + +/* Define some global variables. */ +#define MAXHISTORY 5000 +static const char *introductionMessage[] = +{ + "Little Command Interface", "", + "Written by Mike Glover", "", + "Type help to get help."}; + +/* This structure is used for keeping command history. */ +struct history_st +{ + int count; + int current; + char *command[MAXHISTORY]; +}; + +/* Define some local prototypes. */ +char *uc (char *word); +void help (CDKENTRY *entry); +static BINDFN_PROTO (historyUpCB); +static BINDFN_PROTO (historyDownCB); +static BINDFN_PROTO (viewHistoryCB); +static BINDFN_PROTO (listHistoryCB); +static BINDFN_PROTO (jumpWindowCB); + +/* + * Written by: Mike Glover + * Purpose: + * This creates a very simple command interface. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKSWINDOW *commandOutput = 0; + CDKENTRY *commandEntry = 0; + chtype *convert = 0; + const char *prompt = "Command >"; + const char *title = "Command Output Window"; + int promptLen = 0; + int commandFieldWidth = 0; + struct history_st history; + char temp[600]; + int junk; + + /* Set up the history. */ + history.current = 0; + history.count = 0; + + /* Check the command line for options. */ + while (1) + { + int ret; + + /* Are there any more command line options to parse. */ + if ((ret = getopt (argc, argv, "t:p:")) == -1) + { + break; + } + switch (ret) + { + case 'p': + prompt = copyChar (optarg); + break; + + case 't': + title = copyChar (optarg); + break; + + default: + break; + } + } + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Create the scrolling window. */ + commandOutput = newCDKSwindow (cdkscreen, CENTER, TOP, -8, -2, + title, 1000, TRUE, FALSE); + + /* Convert the prompt to a chtype and determine its length. */ + convert = char2Chtype (prompt, &promptLen, &junk); + commandFieldWidth = COLS - promptLen - 4; + freeChtype (convert); + + /* Create the entry field. */ + commandEntry = newCDKEntry (cdkscreen, CENTER, BOTTOM, + 0, prompt, + A_BOLD | COLOR_PAIR (8), + COLOR_PAIR (24) | '_', + vMIXED, commandFieldWidth, 1, 512, FALSE, FALSE); + + /* Create the key bindings. */ + bindCDKObject (vENTRY, commandEntry, KEY_UP, historyUpCB, &history); + bindCDKObject (vENTRY, commandEntry, KEY_DOWN, historyDownCB, &history); + bindCDKObject (vENTRY, commandEntry, KEY_TAB, viewHistoryCB, commandOutput); + bindCDKObject (vENTRY, commandEntry, CTRL ('^'), listHistoryCB, &history); + bindCDKObject (vENTRY, commandEntry, CTRL ('G'), jumpWindowCB, commandOutput); + + /* Draw the screen. */ + refreshCDKScreen (cdkscreen); + + /* Show them who wrote this and how to get help. */ + popupLabel (cdkscreen, (CDK_CSTRING2)introductionMessage, 5); + eraseCDKEntry (commandEntry); + + /* Do this forever. */ + for (;;) + { + char *command = 0; + char *upper; + + /* Get the command. */ + drawCDKEntry (commandEntry, ObjOf (commandEntry)->box); + command = activateCDKEntry (commandEntry, 0); + upper = uc (command); + + /* Check the output of the command. */ + if (strcmp (upper, "QUIT") == 0 || + strcmp (upper, "EXIT") == 0 || + strcmp (upper, "Q") == 0 || + strcmp (upper, "E") == 0 || + commandEntry->exitType == vESCAPE_HIT) + { + /* All done. */ + freeChar (upper); + + while (history.count-- > 0) + free (history.command[history.count]); + + destroyCDKEntry (commandEntry); + destroyCDKSwindow (commandOutput); + destroyCDKScreen (cdkscreen); + + endCDK (); + + ExitProgram (EXIT_SUCCESS); + } + else if (strcmp (command, "clear") == 0) + { + /* Keep the history. */ + history.command[history.count] = copyChar (command); + history.count++; + history.current = history.count; + cleanCDKSwindow (commandOutput); + cleanCDKEntry (commandEntry); + } + else if (strcmp (command, "history") == 0) + { + /* Display the history list. */ + listHistoryCB (vENTRY, commandEntry, &history, 0); + + /* Keep the history. */ + history.command[history.count] = copyChar (command); + history.count++; + history.current = history.count; + } + else if (strcmp (command, "help") == 0) + { + /* Keep the history. */ + history.command[history.count] = copyChar (command); + history.count++; + history.current = history.count; + + /* Display the help. */ + help (commandEntry); + + /* Clean the entry field. */ + cleanCDKEntry (commandEntry); + eraseCDKEntry (commandEntry); + } + else + { + /* Keep the history. */ + history.command[history.count] = copyChar (command); + history.count++; + history.current = history.count; + + /* Jump to the bottom of the scrolling window. */ + jumpToLineCDKSwindow (commandOutput, BOTTOM); + + /* Insert a line providing the command. */ + sprintf (temp, "Command: %s", command); + addCDKSwindow (commandOutput, temp, BOTTOM); + + /* Run the command. */ + execCDKSwindow (commandOutput, command, BOTTOM); + + /* Clean out the entry field. */ + cleanCDKEntry (commandEntry); + } + + /* Clean up a little. */ + freeChar (upper); + } +} + +/* + * This is the callback for the down arrow. + */ +static int historyUpCB (EObjectType cdktype GCC_UNUSED, void *object, + void *clientData, + chtype key GCC_UNUSED) +{ + CDKENTRY *entry = (CDKENTRY *)object; + struct history_st *history = (struct history_st *)clientData; + + /* Make sure we don't go out of bounds. */ + if (history->current == 0) + { + Beep (); + return (FALSE); + } + + /* Decrement the counter. */ + history->current--; + + /* Display the command. */ + setCDKEntryValue (entry, history->command[history->current]); + drawCDKEntry (entry, ObjOf (entry)->box); + return (FALSE); +} + +/* + * This is the callback for the down arrow. + */ +static int historyDownCB (EObjectType cdktype GCC_UNUSED, void *object, + void *clientData, + chtype key GCC_UNUSED) +{ + CDKENTRY *entry = (CDKENTRY *)object; + struct history_st *history = (struct history_st *)clientData; + + /* Make sure we don't go out of bounds. */ + if (history->current == history->count) + { + Beep (); + return (FALSE); + } + + /* Increment the counter... */ + history->current++; + + /* If we are at the end, clear the entry field. */ + if (history->current == history->count) + { + cleanCDKEntry (entry); + drawCDKEntry (entry, ObjOf (entry)->box); + return (FALSE); + } + + /* Display the command. */ + setCDKEntryValue (entry, history->command[history->current]); + drawCDKEntry (entry, ObjOf (entry)->box); + return (FALSE); +} + +/* + * This callback allows the user to play with the scrolling window. + */ +static int viewHistoryCB (EObjectType cdktype GCC_UNUSED, void *object, + void *clientData, + chtype key GCC_UNUSED) +{ + CDKSWINDOW *swindow = (CDKSWINDOW *)clientData; + CDKENTRY *entry = (CDKENTRY *)object; + + /* Let them play... */ + activateCDKSwindow (swindow, 0); + + /* Redraw the entry field. */ + drawCDKEntry (entry, ObjOf (entry)->box); + return (FALSE); +} + +/* + * This callback jumps to a line in the scrolling window. + */ +static int jumpWindowCB (EObjectType cdktype GCC_UNUSED, void *object, + void *clientData, + chtype key GCC_UNUSED) +{ + CDKENTRY *entry = (CDKENTRY *)object; + CDKSWINDOW *swindow = (CDKSWINDOW *)clientData; + CDKSCALE *scale = 0; + int line; + + /* Ask them which line they want to jump to. */ + scale = newCDKScale (ScreenOf (entry), CENTER, CENTER, + "Jump To Which Line", + "Line", + A_NORMAL, 5, + 0, 0, swindow->listSize, 1, 2, TRUE, FALSE); + + /* Get the line. */ + line = activateCDKScale (scale, 0); + + /* Clean up. */ + destroyCDKScale (scale); + + /* Jump to the line. */ + jumpToLineCDKSwindow (swindow, line); + + /* Redraw the widgets. */ + drawCDKEntry (entry, ObjOf (entry)->box); + return (FALSE); +} + +/* + * This callback allows the user to pick from the history list from a + * scrolling list. + */ +static int listHistoryCB (EObjectType cdktype GCC_UNUSED, void *object, + void *clientData, + chtype key GCC_UNUSED) +{ + CDKENTRY *entry = (CDKENTRY *)object; + struct history_st *history = (struct history_st *)clientData; + CDKSCROLL *scrollList; + int height = (history->count < 10 ? history->count + 3 : 13); + int selection; + + /* No history, no list. */ + if (history->count == 0) + { + /* Popup a little window telling the user there are no commands. */ + const char *mesg[] = + { + "No Commands Entered", + "No History" + }; + popupLabel (ScreenOf (entry), (CDK_CSTRING2)mesg, 2); + + /* Redraw the screen. */ + eraseCDKEntry (entry); + drawCDKScreen (ScreenOf (entry)); + + /* And leave... */ + return (FALSE); + } + + /* Create the scrolling list of previous commands. */ + scrollList = newCDKScroll (ScreenOf (entry), CENTER, CENTER, RIGHT, + height, 20, "Command History", + (CDK_CSTRING2)history->command, + history->count, + NUMBERS, A_REVERSE, TRUE, FALSE); + + /* Get the command to execute. */ + selection = activateCDKScroll (scrollList, 0); + destroyCDKScroll (scrollList); + + /* Check the results of the selection. */ + if (selection >= 0) + { + /* Get the command and stick it back in the entry field. */ + setCDKEntryValue (entry, history->command[selection]); + } + + /* Redraw the screen. */ + eraseCDKEntry (entry); + drawCDKScreen (ScreenOf (entry)); + return (FALSE); +} + +/* + * This function displays help. + */ +void help (CDKENTRY *entry) +{ + const char *mesg[25]; + + /* Create the help message. */ + mesg[0] = "Help"; + mesg[1] = ""; + mesg[2] = "When in the command line."; + mesg[3] = " Displays the command history."; + mesg[4] = " Displays the command history."; + mesg[5] = " Scrolls back one command."; + mesg[6] = " Scrolls forward one command."; + mesg[7] = " Activates the scrolling window."; + mesg[8] = " Displays this help window."; + mesg[9] = ""; + mesg[10] = "When in the scrolling window."; + mesg[11] = " Loads a file into the window."; + mesg[12] = " Saves the contents of the window to a file."; + mesg[13] = " Scrolls up one line."; + mesg[14] = " Scrolls down one line."; + mesg[15] = " Scrolls back one page."; + mesg[16] = " Scrolls forward one page."; + mesg[17] = " Returns to the command line."; + mesg[18] = ""; + mesg[19] = " (Refer to the scrolling window online manual for more help.)"; + popupLabel (ScreenOf (entry), (CDK_CSTRING2)mesg, 20); +} + +/* + * This converts a word to upper case. + */ +char *uc (char *word) +{ + char *upper = 0; + int length = 0; + int x; + + /* Make sure the word is not null. */ + if (word == 0) + { + return 0; + } + length = (int)strlen (word); + + /* Get the memory for the new word. */ + upper = (char *)malloc (sizeof (char) * (size_t) (length + 2)); + if (upper == 0) + { + return (word); + } + + /* Start converting the case. */ + for (x = 0; x < length; x++) + { + int ch = (unsigned char)(word[x]); + if (isalpha (ch)) + { + upper[x] = (char)toupper (ch); + } + else + { + upper[x] = word[x]; + } + } + upper[length] = '\0'; + return upper; +} diff --git a/deps/cdk-5.0-20161210/demos/fileview.c b/deps/cdk-5.0-20161210/demos/fileview.c new file mode 100644 index 0000000..6b25bba --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/fileview.c @@ -0,0 +1,159 @@ +/* $Id: fileview.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "codeViewer"; +#endif + +/* + * This program demonstrates the file selector and the viewer widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKVIEWER *example = 0; + CDKFSELECT *fSelect = 0; + const char *directory = "."; + char *filename = 0; + char **info = 0; + const char *button[5]; + const char *mesg[4]; + char vtitle[256]; + char temp[256]; + int selected, lines; + + /* Parse up the command line. */ + while (1) + { + int ret = getopt (argc, argv, "d:f:"); + if (ret == -1) + { + break; + } + switch (ret) + { + case 'd': + directory = strdup (optarg); + break; + + case 'f': + filename = strdup (optarg); + break; + } + } + + /* Create the viewer buttons. */ + button[0] = ""; + button[1] = ""; + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Get the filename. */ + if (filename == 0) + { + const char *title = "Pick a file."; + const char *label = "File: "; + + fSelect = newCDKFselect (cdkscreen, CENTER, CENTER, 20, 65, + title, label, A_NORMAL, '_', A_REVERSE, + "", "", "", "", TRUE, FALSE); + + /* + * Set the starting directory. This is not neccessary because when + * the file selector starts it uses the present directory as a default. + */ + setCDKFselect (fSelect, directory, A_NORMAL, '.', A_REVERSE, + "", "", "", "", ObjOf (fSelect)->box); + + /* Activate the file selector. */ + filename = copyChar (activateCDKFselect (fSelect, 0)); + + /* Check how the person exited from the widget. */ + if (fSelect->exitType == vESCAPE_HIT) + { + /* Pop up a message for the user. */ + mesg[0] = "Escape hit. No file selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + + /* Destroy the file selector. */ + destroyCDKFselect (fSelect); + + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + ExitProgram (EXIT_SUCCESS); + } + } + + /* Destroy the file selector. */ + destroyCDKFselect (fSelect); + + /* Create the file viewer to view the file selected. */ + example = newCDKViewer (cdkscreen, CENTER, CENTER, 20, -2, + (CDK_CSTRING2)button, 2, + A_REVERSE, TRUE, FALSE); + + /* Could we create the viewer widget? */ + if (example == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + /* Print out a message and exit. */ + printf ("Cannot create viewer. Is the window too small?\n"); + ExitProgram (EXIT_SUCCESS); + } + + /* Open the file and read the contents. */ + lines = CDKreadFile (filename, &info); + if (lines == -1) + { + printf ("Could not open %s\n", filename); + ExitProgram (EXIT_FAILURE); + } + + /* Set up the viewer title, and the contents to the widget. */ + sprintf (vtitle, "%20s", filename); + setCDKViewer (example, vtitle, + (CDK_CSTRING2)info, lines, + A_REVERSE, TRUE, TRUE, TRUE); + + /* Activate the viewer widget. */ + selected = activateCDKViewer (example, 0); + + /* Check how the person exited from the widget. */ + if (example->exitType == vESCAPE_HIT) + { + mesg[0] = "Escape hit. No Button selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + else if (example->exitType == vNORMAL) + { + sprintf (temp, "You selected button %d", selected); + mesg[0] = temp; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + + /* Clean up. */ + destroyCDKViewer (example); + destroyCDKScreen (cdkscreen); + CDKfreeStrings (info); + freeChar (filename); + + endCDK (); + + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/demos/rolodex.c b/deps/cdk-5.0-20161210/demos/rolodex.c new file mode 100644 index 0000000..76b948b --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/rolodex.c @@ -0,0 +1,1937 @@ +/* $Id: rolodex.c,v 1.29 2016/12/04 15:22:16 tom Exp $ */ +#include "rolodex.h" + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "rolodex"; +#endif + +#define MYSIZE 256 +static void fmt1s (char *target, const char *format, const char *source) +{ + int limit = MYSIZE - (int)(strlen (format) + strlen (source)); + if (limit > 0) + sprintf (target, format, limit, source); + else + *target = '\0'; +} + +/* + * This is the main part of the loop. + */ +int main (void) +{ + /* Declare variables. */ + CDKSCREEN *cdkscreen; + CDKMENU *rolodexMenu; + CDKLABEL *rolodexTitle; + SRolodex groupList[MAXGROUPS]; + const char *menulist[MAX_MENU_ITEMS][MAX_SUB_ITEMS]; + const char *title[5]; + char *home, temp[MYSIZE]; + const char *mesg[15]; + int subMenuSize[10], menuLocations[10]; + int group, ret, x; + int groupCount = 0; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK color. */ + initCDKColor (); + + /* Create the menu lists. */ + menulist[0][0] = "File"; + menulist[0][1] = "Open "; + menulist[0][2] = "Save "; + menulist[0][3] = "Save As"; + menulist[0][4] = "Quit "; + + menulist[1][0] = "Groups"; + menulist[1][1] = "New "; + menulist[1][2] = "Open "; + menulist[1][3] = "Delete"; + + menulist[2][0] = "Print"; + menulist[2][1] = "Print Groups"; + + menulist[3][0] = "Help"; + menulist[3][1] = "About Rolodex "; + menulist[3][2] = "Rolodex Statistics"; + + /* Set up the sub-menu sizes and their locations. */ + subMenuSize[0] = 5; + menuLocations[0] = LEFT; + subMenuSize[1] = 4; + menuLocations[1] = LEFT; + subMenuSize[2] = 2; + menuLocations[2] = LEFT; + subMenuSize[3] = 3; + menuLocations[3] = RIGHT; + + /* Create the menu. */ + rolodexMenu = newCDKMenu (cdkscreen, menulist, 4, + subMenuSize, menuLocations, + TOP, A_BOLD | A_UNDERLINE, A_REVERSE); + + /* Create the title. */ + title[0] = "Cdk Rolodex"; + title[1] = "Written by Mike Glover"; + rolodexTitle = newCDKLabel (cdkscreen, CENTER, CENTER, + (CDK_CSTRING2)title, 2, + FALSE, FALSE); + + /* Define the help key binding. */ + bindCDKObject (vMENU, rolodexMenu, '?', helpCB, 0); + + /* Draw the CDK screen. */ + refreshCDKScreen (cdkscreen); + + /* Check the value of the HOME env var. */ + home = getenv ("HOME"); + if (home != 0) + { + /* Make sure the $HOME/.rolodex directory exists. */ + fmt1s (temp, "%.*s/.rolodex", home); + + /* Set the value of the global rolodex DBM directory. */ + GDBMDir = copyChar (temp); + + /* Set the value of the global RC filename. */ + fmt1s (temp, "%.*s/.rolorc", home); + GRCFile = copyChar (temp); + } + else + { + /* Set the value of the global rolodex DBM directory. */ + GDBMDir = copyChar (".rolodex"); + + /* Set the value of the global RC filename. */ + GRCFile = copyChar (".rolorc"); + } + + /* Make the rolodex directory. */ +#if defined (__MINGW32__) + mkdir (GDBMDir); +#else + mkdir (GDBMDir, 0755); +#endif + + /* Open the rolodex RC file. */ + groupCount = readRCFile (GRCFile, groupList); + + /* Check the value of groupCount. */ + if (groupCount < 0) + { + /* The RC file seems to be corrupt. */ + fmt1s (temp, "The RC file (%.*s) seems to be corrupt.", GRCFile); + mesg[0] = temp; + mesg[1] = "No rolodex groups were loaded."; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + groupCount = 0; + } + else if (groupCount == 0) + { + mesg[0] = "Empty rolodex RC file. No groups loaded."; + mesg[1] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 2); + } + else + { + if (groupCount == 1) + { + sprintf (temp, "There was 1 group loaded from the RC file."); + } + else + { + sprintf (temp, + "There were %d groups loaded from the RC file.", groupCount); + } + mesg[0] = temp; + mesg[1] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 2); + } + + /* Loop until we are done. */ + for (;;) + { + /* Activate the menu */ + int selection = activateCDKMenu (rolodexMenu, 0); + + /* Check the return value of the selection. */ + if (selection == 0) + { + /* Open the rolodex RC file. */ + groupCount = openNewRCFile (cdkscreen, groupList, groupCount); + } + else if (selection == 1) + { + /* Write out the RC file. */ + ret = writeRCFile (cdkscreen, GRCFile, groupList, groupCount); + + /* Reset the saved flag if the rc file saved ok. */ + if (ret != 0) + { + GGroupModified = 0; + } + } + else if (selection == 2) + { + /* Save as. */ + ret = writeRCFileAs (cdkscreen, groupList, groupCount); + + /* Reset the saved flag if the rc file saved ok. */ + if (ret != 0) + { + GGroupModified = 0; + } + } + else if (selection == 3) + { + /* Has anything changed??? */ + if (GGroupModified != 0) + { + /* Write out the RC file. */ + writeRCFile (cdkscreen, GRCFile, groupList, groupCount); + } + + /* Remove the CDK widget pointers. */ + destroyCDKMenu (rolodexMenu); + destroyCDKLabel (rolodexTitle); + destroyCDKScreen (cdkscreen); + + /* Free up other pointers. */ + freeChar (GCurrentGroup); + freeChar (GRCFile); + freeChar (GDBMDir); + + /* Clean up the group information. */ + for (x = 0; x < groupCount; x++) + { + freeChar (groupList[x].name); + freeChar (groupList[x].desc); + freeChar (groupList[x].dbm); + } + + /* Shutdown CDK. */ + endCDK (); + + /* Exit cleanly. */ + ExitProgram (EXIT_SUCCESS); + } + else if (selection == 100) + { + /* Add a new group to the list. */ + groupCount = addRolodexGroup (cdkscreen, groupList, groupCount); + } + else if (selection == 101) + { + /* If there are no groups, ask them if they want to create a new one. */ + if (groupCount == 0) + { + const char *buttons[] = + { + "", + "" + }; + mesg[0] = "There are no groups defined."; + mesg[1] = "Do you want to define a new group?"; + + /* Add the group if they said yes. */ + if (popupDialog (cdkscreen, + (CDK_CSTRING2)mesg, 2, + (CDK_CSTRING2)buttons, 2) == 0) + { + groupCount = addRolodexGroup (cdkscreen, groupList, groupCount); + } + } + else + { + /* Get the number of the group to open. */ + group = pickRolodexGroup (cdkscreen, + "Open Rolodex Group", + groupList, groupCount); + + /* Make sure a group was picked. */ + if (group >= 0) + { + /* Set the global variable GCurrentGroup */ + freeChar (GCurrentGroup); + GCurrentGroup = copyChar (groupList[group].name); + + /* Try to open the DBM file and read the contents. */ + useRolodexGroup (cdkscreen, + groupList[group].name, + groupList[group].desc, + groupList[group].dbm); + } + } + } + else if (selection == 102) + { + /* Delete the group chosen. */ + groupCount = deleteRolodexGroup (cdkscreen, groupList, groupCount); + } + else if (selection == 200) + { + /* Print Phone Number Group. */ + printGroupNumbers (cdkscreen, groupList, groupCount); + } + else if (selection == 300) + { + /* About Rolodex. */ + aboutCdkRolodex (cdkscreen); + } + else if (selection == 301) + { + displayRolodexStats (ScreenOf (rolodexMenu), groupCount); + } + } +} + +/* + * This writes out the new RC file. + */ +int writeRCFile (CDKSCREEN *screen, char *filename, SRolodex * groupList, int groupCount) +{ + char *mesg[5]; + char temp[MYSIZE]; + time_t clck; + FILE *fd; + int x; + + /* Can we open the file? */ + if ((fd = fopen (filename, "w")) == 0) + { + fmt1s (temp, "The file <%.*s> could not be opened.", filename); + mesg[0] = copyChar (temp); +#ifdef HAVE_STRERROR + fmt1s (temp, "%.*s", strerror (errno)); +#else + sprintf (temp, "Unknown reason."); +#endif + mesg[1] = copyChar (temp); + mesg[2] = copyChar ("Press any key to continue."); + + popupLabel (screen, (CDK_CSTRING2)mesg, 3); + + freeCharList (mesg, 3); + + return (0); + } + + /* Get the current time. */ + time (&clck); + + /* Put some comments at the top of the header. */ + fprintf (fd, "#\n"); + fprintf (fd, "# This file was automatically generated on %s", ctime (&clck)); + fprintf (fd, "#\n"); + + /* Start writing the RC file. */ + for (x = 0; x < groupCount; x++) + { + fprintf (fd, "%s%c%s%c%s\n", + groupList[x].name, CTRL ('V'), + groupList[x].desc, CTRL ('V'), + groupList[x].dbm); + } + fclose (fd); + + /* Pop up a message stating that it has been saved. */ + if (groupCount == 1) + { + sprintf (temp, "There was 1 group saved to file"); + mesg[0] = copyChar (temp); + } + else + { + sprintf (temp, "There were %d groups saved to file", groupCount); + mesg[0] = copyChar (temp); + } + + fmt1s (temp, "%.*s", filename); + mesg[1] = copyChar (temp); + mesg[2] = copyChar ("Press any key to continue."); + + popupLabel (screen, (CDK_CSTRING2)mesg, 3); + + freeCharList (mesg, 3); + return (1); +} + +/* + * This allows the user to pick a DBM file to open. + */ +int pickRolodexGroup (CDKSCREEN *screen, + const char *title, + SRolodex * groupList, + int groupCount) +{ + /* *INDENT-EQLS* */ + CDKSCROLL *roloList = 0; + int height = groupCount; + char *mesg[MAXGROUPS]; + char temp[MYSIZE]; + int selection, x; + + /* Determine the height of the scrolling list. */ + if (groupCount > 5) + { + height = 5; + } + height += 3; + + /* Copy the names of the scrolling list into an array. */ + for (x = 0; x < groupCount; x++) + { + fmt1s (temp, "%.*s", groupList[x].name); + mesg[x] = copyChar (temp); + } + + /* Create the scrolling list. */ + roloList = newCDKScroll (screen, CENTER, CENTER, NONE, + height, 50, title, + (CDK_CSTRING2)mesg, groupCount, + NONUMBERS, A_REVERSE, TRUE, FALSE); + + /* Create a callback to the scrolling list. */ + bindCDKObject (vSCROLL, roloList, '?', groupInfoCB, groupList); + + /* Activate the scrolling list. */ + selection = activateCDKScroll (roloList, 0); + + /* Destroy the scrolling list. */ + destroyCDKScroll (roloList); + freeCharList (mesg, (unsigned)groupCount); + + /* Return the item selected. */ + return selection; +} + +/* + * This allows the user to add a rolo group to the list. + */ +int addRolodexGroup (CDKSCREEN *screen, SRolodex * groupList, int groupCount) +{ + /* *INDENT-EQLS* */ + CDKENTRY *newName = 0; + CDKENTRY *newDesc = 0; + const char *mesg[4]; + char *desc; + char *newGroupName; + char temp[MYSIZE]; + int x; + + /* Create the name widget. */ + newName = newCDKEntry (screen, CENTER, 8, + "New Group Name", + " Name: ", + A_NORMAL, '_', vMIXED, + 20, 2, MYSIZE, TRUE, FALSE); + + + /* Get the name. */ + newGroupName = activateCDKEntry (newName, 0); + + /* Make sure they didn't hit escape. */ + if (newName->exitType == vESCAPE_HIT) + { + mesg[0] = "Add Group Canceled."; + destroyCDKEntry (newName); + popupLabel (screen, (CDK_CSTRING2)mesg, 1); + return groupCount; + } + + /* Make sure that group name does not already exist. */ + for (x = 0; x < groupCount; x++) + { + if (strcmp (newGroupName, groupList[x].name) == 0) + { + fmt1s (temp, "Sorry the group (%.*s) already exists.", newGroupName); + mesg[0] = temp; + popupLabel (screen, (CDK_CSTRING2)mesg, 1); + destroyCDKEntry (newName); + return groupCount; + } + } + + /* Keep the name. */ + groupList[groupCount].name = copyChar (newGroupName); + + /* Create the description widget. */ + newDesc = newCDKEntry (screen, CENTER, 13, + "Group Description", + "Descriprion: ", + A_NORMAL, '_', vMIXED, + 20, 2, MYSIZE, TRUE, FALSE); + + /* Get the description. */ + desc = activateCDKEntry (newDesc, 0); + + /* Check if they hit escape or not. */ + if (newDesc->exitType == vESCAPE_HIT) + { + groupList[groupCount].desc = copyChar ("No Description Provided."); + } + else + { + groupList[groupCount].desc = copyChar (desc); + } + + /* Create the DBM filename. */ + sprintf (temp, "%s/%s.phl", GDBMDir, groupList[groupCount].name); + groupList[groupCount].dbm = copyChar (temp); + + /* Inrement the group count. */ + groupCount++; + GGroupModified = 1; + + /* Destroy the widgets. */ + destroyCDKEntry (newName); + destroyCDKEntry (newDesc); + return groupCount; +} + +/* + * This displays rolodex information. + */ +void displayRolodexStats (CDKSCREEN *screen, int groupCount) +{ + /* Declare local variables. */ + char *mesg[6], temp[MYSIZE]; + + /* Create the information to display. */ + sprintf (temp, "Rolodex Statistics"); + mesg[0] = copyChar (temp); + fmt1s (temp, "Read Command Filename %.*s", GRCFile); + mesg[1] = copyChar (temp); + sprintf (temp, "Group Count %d", groupCount); + mesg[2] = copyChar (temp); + + /* Display the message. */ + popupLabel (screen, (CDK_CSTRING2)mesg, 3); + + freeCharList (mesg, 3); +} + +/* + * This function gets a new rc filename and saves the contents of the + * groups under that name. + */ +int writeRCFileAs (CDKSCREEN *screen, SRolodex * groupList, int groupCount) +{ + /* Declare local variables. */ + CDKENTRY *newRCFile; + char *newFilename; + int ret; + + /* Create the entry field. */ + newRCFile = newCDKEntry (screen, CENTER, CENTER, + "Save As", + "Filename: ", + A_NORMAL, '_', vMIXED, + 20, 2, MYSIZE, TRUE, FALSE); + + /* Add a pre-process function so no spaces are introduced. */ + setCDKEntryPreProcess (newRCFile, entryPreProcessCB, 0); + + /* Get the filename. */ + newFilename = activateCDKEntry (newRCFile, 0); + + /* Check if they hit escape or not. */ + if (newRCFile->exitType == vESCAPE_HIT) + { + destroyCDKEntry (newRCFile); + return 1; + } + + /* Call the function to save the RC file. */ + ret = writeRCFile (screen, newFilename, groupList, groupCount); + + /* Reset the saved flag if the rc file saved ok. */ + if (ret != 0) + { + /* Change the default filename. */ + freeChar (GRCFile); + GRCFile = copyChar (newFilename); + GGroupModified = 0; + } + + /* Clean up. */ + destroyCDKEntry (newRCFile); + return 1; +} + +/* + * This opens a new RC file. + */ +int openNewRCFile (CDKSCREEN *screen, SRolodex * groupList, int groupCount) +{ + /* Declare local variables. */ + CDKFSELECT *fileSelector; + char *filename, *mesg[10]; + int x; + + /* Get the filename. */ + fileSelector = newCDKFselect (screen, CENTER, CENTER, 20, 55, + "Open RC File", + "Filename: ", + A_NORMAL, '.', A_REVERSE, + "", "", "", "", + TRUE, FALSE); + + /* Activate the file selector. */ + filename = activateCDKFselect (fileSelector, 0); + + /* Check if the file selector left early. */ + if (fileSelector->exitType == vESCAPE_HIT) + { + destroyCDKFselect (fileSelector); + mesg[0] = copyChar ("Open New RC File Aborted."); + popupLabel (screen, (CDK_CSTRING2)mesg, 1); + freeCharList (mesg, 1); + return groupCount; + } + + /* Clean out the old information. */ + for (x = 0; x < groupCount; x++) + { + freeChar (groupList[x].name); + freeChar (groupList[x].desc); + freeChar (groupList[x].dbm); + } + + /* Open the RC file. */ + groupCount = readRCFile (filename, groupList); + + /* Check the return value. */ + if (groupCount < 0) + { + char temp[MYSIZE]; + + /* This file does not appear to be a rolodex file. */ + mesg[0] = copyChar ("The file"); + fmt1s (temp, "(%.*s)", filename); + mesg[1] = copyChar (temp); + mesg[2] = copyChar ("does not seem to be a rolodex RC file."); + mesg[3] = copyChar ("Press any key to continue."); + popupLabel (screen, (CDK_CSTRING2)mesg, 4); + freeCharList (mesg, 4); + groupCount = 0; + } + + /* Clean up. */ + destroyCDKFselect (fileSelector); + return groupCount; +} + +/* + * This reads the users rc file. + */ +int readRCFile (char *filename, SRolodex * groupList) +{ + /* *INDENT-EQLS* */ + int groupsFound = 0; + int errorsFound = 0; + char **lines = 0; + char **items; + int linesRead, chunks, x; + + /* Open the file and start reading. */ + linesRead = CDKreadFile (filename, &lines); + + /* Check the number of lines read. */ + if (linesRead == 0) + { + return (0); + } + + /* + * Cycle through what was given to us and save it. + */ + for (x = 0; x < linesRead; x++) + { + /* Strip white space from the line. */ + stripWhiteSpace (vBOTH, lines[x]); + + /* Only split lines which do not start with a # */ + if (strlen (lines[x]) != 0 && lines[x][0] != '#') + { + items = CDKsplitString (lines[x], CTRL ('V')); + chunks = (int)CDKcountStrings ((CDK_CSTRING2)items); + + /* Only take the ones which fit the format. */ + if (chunks == 3) + { + /* Clean off the name and DB name. */ + stripWhiteSpace (vBOTH, items[0]); + stripWhiteSpace (vBOTH, items[1]); + stripWhiteSpace (vBOTH, items[2]); + + /* Set the group name and DB name. */ + groupList[groupsFound].name = items[0]; + groupList[groupsFound].desc = items[1]; + groupList[groupsFound].dbm = items[2]; + groupsFound++; + free (items); + } + else + { + CDKfreeStrings (items); + errorsFound++; + } + } + } + + /* Clean up. */ + CDKfreeStrings (lines); + + /* Check the number of groups to the number of errors. */ + if (errorsFound > 0 && groupsFound == 0) + { + /* This does NOT look like the rolodex RC file. */ + return -1; + } + return groupsFound; +} + +/* + * This function allows the user to add/delete/modify/save the + * contents of a rolodex group. + */ +void useRolodexGroup (CDKSCREEN *screen, char *groupName, char *groupDesc + GCC_UNUSED, char *groupDBM) +{ + /* *INDENT-EQLS* */ + CDKSCROLL *nameList = 0; + CDKLABEL *helpWindow = 0; + SPhoneData phoneData; + char *Index[MAX_ITEMS]; + const char *title[3]; + const char *mesg[3]; + char temp[MYSIZE]; + int phoneCount, selection, height, x; + + /* Set up the help window at the bottom of the screen. */ + /* *INDENT-EQLS* */ + title[0] = "<#HL(30)>"; + title[1] = "Press ? to get detailed help."; + title[2] = "<#HL(30)>"; + helpWindow = newCDKLabel (screen, CENTER, BOTTOM, + (CDK_CSTRING2)title, 3, + FALSE, FALSE); + drawCDKLabel (helpWindow, FALSE); + + /* Open the DBM file and read in the contents of the file */ + phoneCount = readPhoneDataFile (groupDBM, &phoneData); + phoneData.recordCount = phoneCount; + + /* Check the number of entries returned. */ + if (phoneCount == 0) + { + /* + * They tried to open an empty group, maybe they want to + * add a new entry to this number. + */ + const char *buttons[] = + { + "", + "" + }; + mesg[0] = "There were no entries in this group."; + mesg[1] = "Do you want to add a new listng?"; + if (popupDialog (screen, + (CDK_CSTRING2)mesg, 2, + (CDK_CSTRING2)buttons, 2) == 1) + { + destroyCDKLabel (helpWindow); + return; + } + + /* Get the information for a new number. */ + if (addPhoneRecord (screen, &phoneData) != 0) + { + return; + } + } + else if (phoneCount < 0) + { + mesg[0] = "Could not open the database for this group."; + popupLabel (screen, (CDK_CSTRING2)mesg, 1); + destroyCDKLabel (helpWindow); + return; + } + + /* Set up the data needed for the scrolling list. */ + for (x = 0; x < phoneData.recordCount; x++) + { + SPhoneRecord *phoneRecord = &phoneData.record[x]; + sprintf (temp, "%s (%s)", phoneRecord->name, GLineType[phoneRecord->lineType]); + Index[x] = copyChar (temp); + } + fmt1s (temp, "Listing of Group %.*s", groupName); + height = (phoneData.recordCount > 5 ? 8 : phoneData.recordCount + 3); + + /* Create the scrolling list. */ + nameList = newCDKScroll (screen, CENTER, CENTER, RIGHT, + height, 50, temp, + (CDK_CSTRING2)Index, + phoneData.recordCount, + NUMBERS, A_REVERSE, TRUE, FALSE); + + /* Clean up. */ + for (x = 0; x < phoneData.recordCount; x++) + { + freeChar (Index[x]); + } + + /* Create key bindings. */ + bindCDKObject (vSCROLL, nameList, 'i', insertPhoneEntryCB, &phoneData); + bindCDKObject (vSCROLL, nameList, 'd', deletePhoneEntryCB, &phoneData); + bindCDKObject (vSCROLL, nameList, KEY_DC, deletePhoneEntryCB, &phoneData); + bindCDKObject (vSCROLL, nameList, '?', phoneEntryHelpCB, 0); + + /* Let them play. */ + selection = 0; + while (selection >= 0) + { + /* Get the information they want to view. */ + selection = activateCDKScroll (nameList, 0); + + /* Display the information. */ + if (selection >= 0) + { + /* Display the information. */ + displayPhoneInfo (screen, phoneData.record[selection]); + } + } + + /* Save the rolodex information to file. */ + if (savePhoneDataFile (groupDBM, &phoneData) == 0) + { + /* Something happened. */ + mesg[0] = "Could not save phone data to data file."; + mesg[1] = "All changes have been lost."; + popupLabel (screen, (CDK_CSTRING2)mesg, 2); + } + + /* Clean up. */ + for (x = 0; x < phoneData.recordCount; x++) + { + freeChar (phoneData.record[x].name); + freeChar (phoneData.record[x].phoneNumber); + freeChar (phoneData.record[x].address); + freeChar (phoneData.record[x].city); + freeChar (phoneData.record[x].province); + freeChar (phoneData.record[x].postalCode); + freeChar (phoneData.record[x].desc); + } + destroyCDKScroll (nameList); + destroyCDKLabel (helpWindow); +} + +/* + * This opens a phone data file and returns the number of elements read. + */ +int readPhoneDataFile (char *dataFile, SPhoneData * phoneData) +{ + /* *INDENT-EQLS* */ + char **lines = 0; + char **items; + int linesRead = 0; + int chunks = 0; + int linesFound = 0; + int x; + + /* Open the file and start reading. */ + linesRead = CDKreadFile (dataFile, &lines); + + /* Check the number of lines read. */ + if (linesRead <= 0) + { + return (0); + } + + /* + * Cycle through what was given to us and save it. + */ + for (x = 0; x < linesRead; x++) + { + if (lines[x][0] != '#') + { + /* Split the string. */ + items = CDKsplitString (lines[x], CTRL ('V')); + chunks = (int)CDKcountStrings ((CDK_CSTRING2)items); + + /* Copy the chunks. */ + if (chunks == 8) + { + int myType = atoi (items[1]); + /* *INDENT-EQLS* */ + phoneData->record[linesFound].name = items[0]; + phoneData->record[linesFound].lineType = (ELineType) myType; + phoneData->record[linesFound].phoneNumber = items[2]; + phoneData->record[linesFound].address = items[3]; + phoneData->record[linesFound].city = items[4]; + phoneData->record[linesFound].province = items[5]; + phoneData->record[linesFound].postalCode = items[6]; + phoneData->record[linesFound].desc = items[7]; + freeChar (items[1]); + free (items); + linesFound++; + } + else + { + /* Bad line in the file; recover the memory. */ + CDKfreeStrings (items); + } + } + } + + /* Clean up. */ + CDKfreeStrings (lines); + + /* Keep the record count and return. */ + phoneData->recordCount = linesFound; + return linesFound; +} + +/* + * This opens a phone data file and returns the number of elements read. + */ +int savePhoneDataFile (char *filename, SPhoneData * phoneData) +{ + time_t clck; + FILE *fd; + int x; + + /* Can we open the file? */ + if ((fd = fopen (filename, "w")) == 0) + { + return 0; + } + + /* Get the current time. */ + time (&clck); + + /* Add the header to the file. */ + fprintf (fd, "#\n"); + fprintf (fd, "# This file was automatically saved on %s", ctime (&clck)); + fprintf (fd, "# There should be %d phone numbers in this file.\n", phoneData->recordCount); + fprintf (fd, "#\n"); + + /* Cycle through the data and start writing it to the file. */ + for (x = 0; x < phoneData->recordCount; x++) + { + SPhoneRecord *phoneRecord = &phoneData->record[x]; + + /* Check the phone type. */ + if (phoneRecord->lineType == vCell || phoneRecord->lineType == vPager) + { + fprintf (fd, "%s%c%d%c%s%c-%c-%c-%c-%c%s\n", + phoneRecord->name, CTRL ('V'), + phoneRecord->lineType, CTRL ('V'), + phoneRecord->phoneNumber, CTRL ('V'), + CTRL ('V'), CTRL ('V'), CTRL ('V'), CTRL ('V'), + phoneRecord->desc); + } + else + { + fprintf (fd, "%s%c%d%c%s%c%s%c%s%c%s%c%s%c%s\n", + phoneRecord->name, CTRL ('V'), + phoneRecord->lineType, CTRL ('V'), + phoneRecord->phoneNumber, CTRL ('V'), + phoneRecord->address, CTRL ('V'), + phoneRecord->city, CTRL ('V'), + phoneRecord->province, CTRL ('V'), + phoneRecord->postalCode, CTRL ('V'), + phoneRecord->desc); + } + } + fclose (fd); + return 1; +} + +/* + * This displays the information about the phone record. + */ +void displayPhoneInfo (CDKSCREEN *screen, SPhoneRecord record) +{ + /* Declare local variables. */ + char *mesg[10], temp[MYSIZE]; + + /* Check the type of line it is. */ + if (record.lineType == vVoice || + record.lineType == vData1 || + record.lineType == vData2 || + record.lineType == vData3 || + record.lineType == vFAX1 || + record.lineType == vFAX2 || + record.lineType == vFAX3) + { + /* Create the information to display. */ + fmt1s (temp, "%.*s Phone Record", GLineType[record.lineType]); + mesg[0] = copyChar (temp); + + fmt1s (temp, "Name %.*s", record.name); + mesg[1] = copyChar (temp); + + fmt1s (temp, "Phone Number%.*s", record.phoneNumber); + mesg[2] = copyChar (temp); + + fmt1s (temp, "Address %.*s", record.address); + mesg[3] = copyChar (temp); + + fmt1s (temp, "City %.*s", record.city); + mesg[4] = copyChar (temp); + + fmt1s (temp, "Province %.*s", record.province); + mesg[5] = copyChar (temp); + + fmt1s (temp, "Postal Code %.*s", record.postalCode); + mesg[6] = copyChar (temp); + + fmt1s (temp, "Comment %.*s", record.desc); + mesg[7] = copyChar (temp); + + /* Pop the information up on the screen. */ + popupLabel (screen, (CDK_CSTRING2)mesg, 8); + + /* Clean up. */ + freeChar (mesg[0]); + freeChar (mesg[1]); + freeChar (mesg[2]); + freeChar (mesg[3]); + freeChar (mesg[4]); + freeChar (mesg[5]); + freeChar (mesg[6]); + freeChar (mesg[7]); + } + else if (record.lineType == vPager || record.lineType == vCell) + { + /* Create the information to display. */ + fmt1s (temp, "%.*s Phone Record", GLineType[record.lineType]); + mesg[0] = copyChar (temp); + + fmt1s (temp, "Name %.*s", record.name); + mesg[1] = copyChar (temp); + + fmt1s (temp, "Phone Number%.*s", record.phoneNumber); + mesg[2] = copyChar (temp); + + fmt1s (temp, "Comment %.*s", record.desc); + mesg[3] = copyChar (temp); + + /* Pop the information up on the screen. */ + popupLabel (screen, (CDK_CSTRING2)mesg, 4); + + freeCharList (mesg, 4); + } + else + { + mesg[0] = copyChar ("Error Unknown Phone Line Type"); + mesg[1] = copyChar ("Can not display information."); + popupLabel (screen, (CDK_CSTRING2)mesg, 2); + freeCharList (mesg, 2); + } +} + +/* + * This function displays a little pop up window discussing this demo. + */ +void aboutCdkRolodex (CDKSCREEN *screen) +{ + const char *mesg[15]; + + mesg[0] = "About Cdk Rolodex"; + mesg[1] = " "; + mesg[2] = "This demo was written to demonstrate the widgets"; + mesg[3] = "available with the Cdk library. Not all of the"; + mesg[4] = "Cdk widgets are used, but most of them have been."; + mesg[5] = "I hope this little demonstration helps give you an"; + mesg[6] = "understanding of what the Cdk library offers."; + mesg[7] = " "; + mesg[8] = "Have fun with it."; + mesg[9] = " "; + mesg[10] = "ttfn,"; + mesg[11] = "Mike"; + mesg[12] = "<#HL(35)>"; + mesg[13] = "March 1996"; + + popupLabel (screen, (CDK_CSTRING2)mesg, 14); +} + +/* + * This deletes a rolodex group. + */ +int deleteRolodexGroup (CDKSCREEN *screen, SRolodex * groupList, int groupCount) +{ + /* Declare local variables. */ + char *mesg[10]; + const char *buttons[5]; + char temp[MYSIZE]; + int selection, choice, x; + + /* If there are no groups, pop up a message telling them. */ + if (groupCount == 0) + { + mesg[0] = copyChar ("Error"); + mesg[1] = copyChar ("There as no groups defined."); + popupLabel (screen, (CDK_CSTRING2)mesg, 2); + freeCharList (mesg, 2); + + /* Return the current group count. */ + return groupCount; + } + + /* Get the number of the group to delete. */ + selection = pickRolodexGroup (screen, + "Delete Which Rolodex Group?", + groupList, groupCount); + + /* Check the results. */ + if (selection < 0) + { + mesg[0] = copyChar (" Delete Canceled "); + mesg[1] = copyChar ("No Group Deleted"); + popupLabel (screen, (CDK_CSTRING2)mesg, 2); + freeCharList (mesg, 2); + return groupCount; + } + + /* Let's make sure they want to delete the group. */ + mesg[0] = copyChar ("Confirm Delete"); + mesg[1] = copyChar ("Are you sure you want to delete the group"); + fmt1s (temp, "%.*s?", groupList[selection].name); + mesg[2] = copyChar (temp); + buttons[0] = ""; + buttons[1] = ""; + choice = popupDialog (screen, + (CDK_CSTRING2)mesg, 3, + (CDK_CSTRING2)buttons, 2); + freeCharList (mesg, 3); + + /* Check the results of the confirmation. */ + if (choice == 0) + { + mesg[0] = copyChar (" Delete Canceled "); + mesg[1] = copyChar ("No Group Deleted"); + popupLabel (screen, (CDK_CSTRING2)mesg, 2); + freeCharList (mesg, 2); + return groupCount; + } + + /* We need to delete the group file first. */ + unlink (groupList[selection].dbm); + + /* OK, lets delete the group. */ + freeChar (groupList[selection].name); + freeChar (groupList[selection].desc); + freeChar (groupList[selection].dbm); + for (x = selection; x < groupCount - 1; x++) + { + groupList[x].name = groupList[x + 1].name; + groupList[x].desc = groupList[x + 1].desc; + groupList[x].dbm = groupList[x + 1].dbm; + } + groupCount--; + GGroupModified = 1; + + /* Clean up. */ + return groupCount; +} + +/* + * This function gets information about a new phone number. + */ +int addPhoneRecord (CDKSCREEN *screen, SPhoneData * phoneData) +{ + /* Declare local variables. */ + CDKLABEL *title; + CDKITEMLIST *itemList; + SPhoneRecord *phoneRecord; + const char *titleMesg[3]; + char *types[GLINETYPECOUNT]; + char temp[MYSIZE]; + int ret, x; + int myType; + + /* Get the phone record pointer. */ + phoneRecord = &phoneData->record[phoneData->recordCount]; + + /* Create a title label to display. */ + titleMesg[0] = "Add New Phone Record"; + title = newCDKLabel (screen, CENTER, TOP, + (CDK_CSTRING2)titleMesg, 1, + FALSE, FALSE); + drawCDKLabel (title, FALSE); + + /* Create the phone line type list. */ + for (x = 0; x < GLINETYPECOUNT; x++) + { + fmt1s (temp, "%.*s", GLineType[x]); + types[x] = copyChar (temp); + } + + /* Get the phone line type. */ + itemList = newCDKItemlist (screen, CENTER, CENTER, + "What Type Of Line Is It?", + "Type: ", + (CDK_CSTRING2)types, GLINETYPECOUNT, 0, + TRUE, FALSE); + myType = activateCDKItemlist (itemList, 0); + phoneRecord->lineType = (ELineType) myType; + destroyCDKItemlist (itemList); + + /* Clean up. */ + for (x = 0; x < GLINETYPECOUNT; x++) + { + freeChar (types[x]); + } + + /* Check the return code of the line type question. */ + if (phoneRecord->lineType == -1) + { + phoneRecord->lineType = (ELineType) 0; + return 1; + } + else if (phoneRecord->lineType == vPager || phoneRecord->lineType == vCell) + { + ret = getSmallPhoneRecord (screen, phoneRecord); + } + else + { + ret = getLargePhoneRecord (screen, phoneRecord); + } + + /* Check the return value from the getXXXPhoneRecord function. */ + if (ret == 0) + { + phoneData->recordCount++; + } + + /* Clean up. */ + destroyCDKLabel (title); + + /* Return the new phone list count. */ + return ret; +} + +/* + * This gets a phone record with all of the details. + */ +int getLargePhoneRecord (CDKSCREEN *screen, SPhoneRecord * phoneRecord) +{ + /* Declare local variables. */ + CDKENTRY *nameEntry, *addressEntry, *cityEntry; + CDKENTRY *provEntry, *postalEntry, *descEntry; + CDKTEMPLATE *phoneTemplate; + const char *buttons[5]; + const char *mesg[15]; + + /* Define the widgets. */ + nameEntry = newCDKEntry (screen, LEFT, 5, + 0, "Name: ", + A_NORMAL, + '_', vMIXED, 20, 2, MYSIZE, + TRUE, FALSE); + addressEntry = newCDKEntry (screen, RIGHT, 5, + 0, "Address: ", + A_NORMAL, + '_', vMIXED, 40, 2, MYSIZE, + TRUE, FALSE); + cityEntry = newCDKEntry (screen, LEFT, 8, + 0, "City: ", + A_NORMAL, + '_', vMIXED, 20, 2, MYSIZE, + TRUE, FALSE); + provEntry = newCDKEntry (screen, 29, 8, + 0, "Province: ", + A_NORMAL, + '_', vMIXED, 15, 2, MYSIZE, + TRUE, FALSE); + postalEntry = newCDKEntry (screen, RIGHT, 8, + 0, "Postal Code: ", + A_NORMAL, + '_', vUMIXED, 8, 2, MYSIZE, + TRUE, FALSE); + phoneTemplate = newCDKTemplate (screen, LEFT, 11, + 0, + "Number: ", + "(###) ###-####", + "(___) ___-____", + TRUE, FALSE); + descEntry = newCDKEntry (screen, RIGHT, 11, + 0, + "Description: ", + A_NORMAL, + '_', vMIXED, 20, 2, MYSIZE, + TRUE, FALSE); + + /* Get the phone information. */ + for (;;) + { + int ret; + + /* Draw the widgets on the screen. */ + drawCDKEntry (nameEntry, ObjOf (nameEntry)->box); + drawCDKEntry (addressEntry, ObjOf (addressEntry)->box); + drawCDKEntry (cityEntry, ObjOf (cityEntry)->box); + drawCDKEntry (provEntry, ObjOf (provEntry)->box); + drawCDKEntry (postalEntry, ObjOf (postalEntry)->box); + drawCDKTemplate (phoneTemplate, ObjOf (phoneTemplate)->box); + drawCDKEntry (descEntry, ObjOf (descEntry)->box); + + /* Activate the entries to get the information. */ + /* *INDENT-EQLS* */ + phoneRecord->name = copyChar (activateCDKEntry (nameEntry, 0)); + phoneRecord->address = copyChar (activateCDKEntry (addressEntry, 0)); + phoneRecord->city = copyChar (activateCDKEntry (cityEntry, 0)); + phoneRecord->province = copyChar (activateCDKEntry (provEntry, 0)); + phoneRecord->postalCode = copyChar (activateCDKEntry (postalEntry, 0)); + activateCDKTemplate (phoneTemplate, 0); + phoneRecord->phoneNumber = mixCDKTemplate (phoneTemplate); + phoneRecord->desc = copyChar (activateCDKEntry (descEntry, 0)); + + /* Determine if the user wants to submit the info. */ + mesg[0] = "Confirm New Phone Entry"; + mesg[1] = "Do you want to add this phone number?"; + buttons[0] = ""; + buttons[1] = ""; + buttons[2] = ""; + ret = popupDialog (screen, + (CDK_CSTRING2)mesg, 2, + (CDK_CSTRING2)buttons, 3); + + /* Check the response of the popup dialog box. */ + if (ret == 0) + { + /* The user wants to submit the information. */ + destroyCDKEntry (nameEntry); + destroyCDKEntry (addressEntry); + destroyCDKEntry (cityEntry); + destroyCDKEntry (provEntry); + destroyCDKEntry (postalEntry); + destroyCDKEntry (descEntry); + destroyCDKTemplate (phoneTemplate); + return ret; + } + else if (ret == 1) + { + /* The user does not want to submit the information. */ + freeChar (phoneRecord->name); + freeChar (phoneRecord->address); + freeChar (phoneRecord->city); + freeChar (phoneRecord->province); + freeChar (phoneRecord->postalCode); + freeChar (phoneRecord->phoneNumber); + freeChar (phoneRecord->desc); + destroyCDKEntry (nameEntry); + destroyCDKEntry (addressEntry); + destroyCDKEntry (cityEntry); + destroyCDKEntry (provEntry); + destroyCDKEntry (postalEntry); + destroyCDKEntry (descEntry); + destroyCDKTemplate (phoneTemplate); + return ret; + } + else + { + /* The user wants to edit the information again. */ + freeChar (phoneRecord->name); + freeChar (phoneRecord->address); + freeChar (phoneRecord->city); + freeChar (phoneRecord->province); + freeChar (phoneRecord->postalCode); + freeChar (phoneRecord->phoneNumber); + freeChar (phoneRecord->desc); + } + } +} + +/* + * This gets a small phone record. + */ +int getSmallPhoneRecord (CDKSCREEN *screen, SPhoneRecord * phoneRecord) +{ + CDKENTRY *nameEntry, *descEntry; + CDKTEMPLATE *phoneTemplate; + const char *buttons[5]; + const char *mesg[15]; + + /* Define the widgets. */ + nameEntry = newCDKEntry (screen, CENTER, 8, + 0, "Name: ", + A_NORMAL, + '_', vMIXED, 20, 2, MYSIZE, + TRUE, FALSE); + phoneTemplate = newCDKTemplate (screen, CENTER, 11, + 0, "Number: ", + "(###) ###-####", + "(___) ___-____", + TRUE, FALSE); + descEntry = newCDKEntry (screen, CENTER, 14, + 0, "Description: ", + A_NORMAL, + '_', vMIXED, 20, 2, MYSIZE, + TRUE, FALSE); + + /* Get the phone information. */ + for (;;) + { + int ret; + + /* Draw the widgets on the screen. */ + drawCDKEntry (nameEntry, ObjOf (nameEntry)->box); + drawCDKTemplate (phoneTemplate, ObjOf (phoneTemplate)->box); + drawCDKEntry (descEntry, ObjOf (descEntry)->box); + + /* Activate the entries to get the information. */ + /* *INDENT-EQLS* */ + phoneRecord->name = copyChar (activateCDKEntry (nameEntry, 0)); + activateCDKTemplate (phoneTemplate, 0); + phoneRecord->phoneNumber = mixCDKTemplate (phoneTemplate); + phoneRecord->desc = copyChar (activateCDKEntry (descEntry, 0)); + phoneRecord->address = copyChar ("-"); + phoneRecord->city = copyChar ("-"); + phoneRecord->province = copyChar ("-"); + phoneRecord->postalCode = copyChar ("-"); + + /* Determine if the user wants to submit the info. */ + mesg[0] = "Confirm New Phone Entry"; + mesg[1] = "Do you want to add this phone number?"; + buttons[0] = ""; + buttons[1] = ""; + buttons[2] = ""; + ret = popupDialog (screen, + (CDK_CSTRING2)mesg, 2, + (CDK_CSTRING2)buttons, 3); + + /* Check the response of the popup dialog box. */ + if (ret == 0) + { + /* The user wants to submit the information. */ + destroyCDKEntry (nameEntry); + destroyCDKEntry (descEntry); + destroyCDKTemplate (phoneTemplate); + return ret; + } + else if (ret == 1) + { + /* The user does not want to submit the information. */ + freeChar (phoneRecord->name); + freeChar (phoneRecord->phoneNumber); + freeChar (phoneRecord->desc); + freeChar (phoneRecord->address); + freeChar (phoneRecord->city); + freeChar (phoneRecord->province); + freeChar (phoneRecord->postalCode); + + destroyCDKEntry (nameEntry); + destroyCDKEntry (descEntry); + destroyCDKTemplate (phoneTemplate); + return ret; + } + else + { + /* The user wants to edit the information again. */ + freeChar (phoneRecord->name); + freeChar (phoneRecord->phoneNumber); + freeChar (phoneRecord->desc); + freeChar (phoneRecord->address); + freeChar (phoneRecord->city); + freeChar (phoneRecord->province); + freeChar (phoneRecord->postalCode); + } + } +} + +/* + * This prints a groups phone numbers. + */ +void printGroupNumbers (CDKSCREEN *screen, SRolodex * groupList, int groupCount) +{ + /* Declare local variables. */ + CDKSELECTION *selectionList; + CDKENTRY *entry; + CDKLABEL *title; + char *itemList[MAX_ITEMS], *mesg[10], temp[MYSIZE]; + const char *choices[] = + { + "Print to Printer ", + "Print to File", + "Don't Print" + }; + char *filename = 0; + char *printer = 0; + char *defaultPrinter = 0; + int height = groupCount; + int x; + + /* Create the group list. */ + for (x = 0; x < groupCount; x++) + { + itemList[x] = copyChar (groupList[x].name); + } + + /* Set the height of the selection list. */ + if (groupCount > 5) + { + height = 5; + } + height += 3; + + /* Create the selection list. */ + selectionList = newCDKSelection (screen, CENTER, CENTER, RIGHT, + height, 40, + "Select Which Groups To Print", + (CDK_CSTRING2)itemList, groupCount, + (CDK_CSTRING2)choices, 3, + A_REVERSE, TRUE, FALSE); + + /* Activate the selection list. */ + if (activateCDKSelection (selectionList, 0) == -1) + { + /* Tell the user they exited early. */ + destroyCDKSelection (selectionList); + mesg[0] = copyChar ("Print Canceled."); + popupLabel (screen, (CDK_CSTRING2)mesg, 1); + + freeCharList (mesg, 1); + freeCharList (itemList, (unsigned)groupCount); + return; + } + eraseCDKSelection (selectionList); + + /* Determine which groups we want to print. */ + for (x = 0; x < groupCount; x++) + { + if (selectionList->selections[x] == 0) + { + /* Create a title. */ + fmt1s (temp, "Printing Group [%.*s] to Printer", + groupList[x].name); + mesg[0] = copyChar (temp); + title = newCDKLabel (screen, CENTER, TOP, + (CDK_CSTRING2)mesg, 1, + FALSE, FALSE); + drawCDKLabel (title, FALSE); + freeChar (mesg[0]); + + /* Get the printer name to print to. */ + entry = newCDKEntry (screen, CENTER, 8, + 0, "Printer Name: ", + A_NORMAL, + '_', vMIXED, 20, 2, MYSIZE, TRUE, FALSE); + + /* Set the printer name to the default printer. */ + defaultPrinter = getenv ("PRINTER"); + setCDKEntry (entry, defaultPrinter, 2, MYSIZE, TRUE); + printer = copyChar (activateCDKEntry (entry, 0)); + destroyCDKEntry (entry); + + /* Print the group. */ + if (printGroup (groupList[x], "/tmp/rolodex.tmp", printer) == 0) + { + /* The group could not be printed. */ + fmt1s (temp, "Sorry the group '%.*s' could not be printed.", + groupList[x].name); + mesg[0] = strdup (temp); + popupLabel (screen, (CDK_CSTRING2)mesg, 1); + freeChar (mesg[0]); + } + + /* Clean up. */ + destroyCDKLabel (title); + freeChar (printer); + unlink ("/tmp/rolodex.tmp"); + } + else if (selectionList->selections[x] == 1) + { + /* Create a title. */ + fmt1s (temp, "Printing Group [%.*s] to File", groupList[x].name); + mesg[0] = copyChar (temp); + title = newCDKLabel (screen, CENTER, TOP, + (CDK_CSTRING2)mesg, 1, + FALSE, FALSE); + drawCDKLabel (title, FALSE); + freeChar (mesg[0]); + + /* Get the filename to print to. */ + entry = newCDKEntry (screen, CENTER, 8, + 0, "Filename: ", + A_NORMAL, '_', vMIXED, + 20, 2, MYSIZE, TRUE, FALSE); + filename = copyChar (activateCDKEntry (entry, 0)); + destroyCDKEntry (entry); + + /* Print the group. */ + if (printGroup (groupList[x], filename, printer) == 0) + { + /* The group could not be printed. */ + fmt1s (temp, "Sorry the group '%.*s' could not be printed.", + groupList[x].name); + mesg[0] = strdup (temp); + popupLabel (screen, (CDK_CSTRING2)mesg, 1); + freeChar (mesg[0]); + } + + /* Clean up. */ + destroyCDKLabel (title); + freeChar (filename); + } + } + + /* Clean up. */ + destroyCDKSelection (selectionList); + for (x = 0; x < groupCount; x++) + { + freeChar (itemList[x]); + } +} + +/* + * This actually prints the phone record. + */ +int printGroup (SRolodex groupRecord, const char *filename, char *printer) +{ + /* Declare local variables. */ +#if defined (__MINGW32__) + int uid = 0; +#else + uid_t uid = getuid (); +#endif + char tempFilename[MYSIZE]; + SPhoneData phoneData; + int phoneCount, x; + FILE *fd; + + /* Read the data file. */ + phoneCount = readPhoneDataFile (groupRecord.dbm, &phoneData); + + /* Create the temporary filename. */ + if (filename != 0) + { + fmt1s (tempFilename, "%.*s", filename); + } + else + { + sprintf (tempFilename, "/tmp/rolodex.%d", (int)uid); + } + + /* Open the file. */ + if ((fd = fopen (tempFilename, "a+")) == 0) + { + /* Clean up. */ + for (x = 0; x < phoneCount; x++) + { + freeChar (phoneData.record[x].name); + freeChar (phoneData.record[x].phoneNumber); + freeChar (phoneData.record[x].address); + freeChar (phoneData.record[x].city); + freeChar (phoneData.record[x].province); + freeChar (phoneData.record[x].postalCode); + freeChar (phoneData.record[x].desc); + } + return 0; + } + + /* Start writing the group information to the temp file. */ + fprintf (fd, "Group Name: %40s\n", groupRecord.name); + fprintf (fd, + "==============================================================================\n"); + for (x = 0; x < phoneCount; x++) + { + SPhoneRecord *phoneRecord = &phoneData.record[x]; + fprintf (fd, "Name : %s\n", phoneRecord->name); + fprintf (fd, "Phone Number: %s (%s)\n", phoneRecord->phoneNumber, + GLineType[phoneRecord->lineType]); + if (phoneRecord->lineType != vPager && phoneRecord->lineType != vCell) + { + fprintf (fd, "Address : %-20s, %-20s\n", phoneRecord->address, phoneRecord->city); + fprintf (fd, " : %-10s, %-10s\n", phoneRecord->province, phoneRecord->postalCode); + } + fprintf (fd, "Description : %-30s\n", phoneRecord->desc); + fprintf (fd, + "------------------------------------------------------------------------------\n"); + } + + /* Determine if the information is going to a file or printer. */ + if (printer != 0) + { + char command[MYSIZE]; + /* Print the file to the given printer. */ + sprintf (command, "lpr -P%s %s", printer, tempFilename); + system (command); + + /* We have to unkink the temp file. */ + unlink (tempFilename); + } + + /* Clean up some memory. */ + for (x = 0; x < phoneCount; x++) + { + freeChar (phoneData.record[x].name); + freeChar (phoneData.record[x].phoneNumber); + freeChar (phoneData.record[x].address); + freeChar (phoneData.record[x].city); + freeChar (phoneData.record[x].province); + freeChar (phoneData.record[x].postalCode); + freeChar (phoneData.record[x].desc); + } + + /* Close the filename. */ + fclose (fd); + return 1; +} + +/* + **************************************************************** + * Start of callback functions. + **************************************************************** + */ +int entryPreProcessCB (EObjectType cdkType GCC_UNUSED, void *object + GCC_UNUSED, void *clientData GCC_UNUSED, chtype input) +{ + if (input == ' ') + { + Beep (); + return 0; + } + return 1; +} + +/* + * This allows the user to insert a new phone entry into the database. + */ +int insertPhoneEntryCB (EObjectType cdkType GCC_UNUSED, void *object, void + *clientData, chtype key GCC_UNUSED) +{ + /* Declare local variables. */ + CDKSCROLL *scrollp = (CDKSCROLL *)object; + SPhoneData *phoneData = (SPhoneData *) clientData; + SPhoneRecord *phoneRecord = &phoneData->record[phoneData->recordCount]; + char temp[MYSIZE]; + + /* Make the scrolling list disappear. */ + eraseCDKScroll (scrollp); + + /* Call the function which gets phone record information. */ + if (addPhoneRecord (ScreenOf (scrollp), phoneData) == 0) + { + sprintf (temp, "%s (%s)", phoneRecord->name, GLineType[phoneRecord->lineType]); + addCDKScrollItem (scrollp, temp); + } + + /* Redraw the scrolling list. */ + drawCDKScroll (scrollp, ObjOf (scrollp)->box); + return (FALSE); +} + +/* + * This allows the user to delete a phone entry from the database. + */ +int deletePhoneEntryCB (EObjectType cdkType GCC_UNUSED, void *object, void + *clientData, chtype key GCC_UNUSED) +{ + /* Declare local variables. */ + CDKSCROLL *scrollp = (CDKSCROLL *)object; + SPhoneData *phoneData = (SPhoneData *) clientData; + const char *mesg[3]; + char temp[MYSIZE], *hold; + const char *buttons[] = + { + "", + "" + }; + int position = scrollp->currentItem; + int x; + + /* Make the scrolling list disappear. */ + eraseCDKScroll (scrollp); + + /* Check the number of entries left in the list. */ + if (scrollp->listSize == 0) + { + mesg[0] = "There are no more numbers to delete."; + popupLabel (ScreenOf (scrollp), (CDK_CSTRING2)mesg, 1); + return (FALSE); + } + + /* Ask the user if they really want to delete the listing. */ + mesg[0] = "Do you really want to delete the phone entry"; + hold = chtype2Char (scrollp->item[scrollp->currentItem]); + fmt1s (temp, "%.*s", hold); + freeChar (hold); + mesg[1] = copyChar (temp); + if (popupDialog (ScreenOf (scrollp), + (CDK_CSTRING2)mesg, 2, + (CDK_CSTRING2)buttons, 2) == 1) + { + /* Remove the item from the phone data record. */ + for (x = position; x < phoneData->recordCount - 1; x++) + { + /* *INDENT-EQLS* */ + phoneData->record[x].name = phoneData->record[x + 1].name; + phoneData->record[x].lineType = phoneData->record[x + 1].lineType; + phoneData->record[x].phoneNumber = phoneData->record[x + 1].phoneNumber; + phoneData->record[x].address = phoneData->record[x + 1].address; + phoneData->record[x].city = phoneData->record[x + 1].city; + phoneData->record[x].province = phoneData->record[x + 1].province; + phoneData->record[x].postalCode = phoneData->record[x + 1].postalCode; + phoneData->record[x].desc = phoneData->record[x + 1].desc; + } + phoneData->recordCount--; + + /* Nuke the entry. */ + deleteCDKScrollItem (scrollp, position); + } + + /* Redraw the scrolling list. */ + drawCDKScroll (scrollp, ObjOf (scrollp)->box); + return (FALSE); +} + +/* + * This function provides help for the phone list editor. + */ +int phoneEntryHelpCB (EObjectType cdkType GCC_UNUSED, void *object, void + *clientData GCC_UNUSED, chtype key GCC_UNUSED) +{ + /* Declare local variables. */ + CDKSCROLL *scrollp = (CDKSCROLL *)object; + char *mesg[10], temp[100]; + + /* Create the help title. */ + sprintf (temp, "Rolodex Phone Editor"); + mesg[0] = copyChar (temp); + + sprintf (temp, " Inserts a new phone entry."); + mesg[1] = copyChar (temp); + + sprintf (temp, " Deletes the currently selected phone entry."); + mesg[2] = copyChar (temp); + + sprintf (temp, " Exits the scrolling list."); + mesg[3] = copyChar (temp); + + sprintf (temp, " Pops up this help window."); + mesg[4] = copyChar (temp); + + popupLabel (ScreenOf (scrollp), (CDK_CSTRING2)mesg, 5); + + freeCharList (mesg, 5); + return (FALSE); +} + +/* + * This is a callback to the menu widget. It allows the user to + * ask for help about any sub-menu item. + */ +int helpCB (EObjectType cdkType GCC_UNUSED, void *object, void *clientData + GCC_UNUSED, chtype key GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + CDKMENU *menu = (CDKMENU *)object; + int menuList = menu->currentTitle; + int submenuList = menu->currentSubtitle; + int selection = ((menuList * 100) + submenuList); + const char *mesg[20]; + char *msg_0; + char *name; + char temp[100]; + + /* Create the help title. */ + name = chtype2Char (menu->sublist[menuList][submenuList]); + stripWhiteSpace (vBOTH, name); + fmt1s (temp, "Help %.*s", name); + mesg[0] = msg_0 = copyChar (temp); + freeChar (name); + + /* Set the default value for the message. */ + mesg[1] = "No help defined for this menu."; + + /* Given the current menu item, create a message. */ + if (selection == 0) + { + mesg[1] = "This reads a new rolodex RC file."; + } + else if (selection == 1) + { + mesg[1] = "This saves the current group information in the default RC file."; + } + else if (selection == 2) + { + mesg[1] = "This saves the current group information in a new RC file."; + } + else if (selection == 3) + { + mesg[1] = "This exits this program."; + } + else if (selection == 100) + { + mesg[1] = "This creates a new rolodex group."; + } + else if (selection == 101) + { + mesg[1] = "This opens a rolodex group."; + } + else if (selection == 102) + { + mesg[1] = "This deletes a rolodex group."; + } + else if (selection == 200) + { + mesg[1] = "This prints out selected groups phone numbers."; + } + else if (selection == 300) + { + mesg[1] = "This gives a little history on this program."; + } + else if (selection == 301) + { + mesg[1] = "This provides information about the rolodex."; + } + + /* Pop up the message. */ + popupLabel (ScreenOf (menu), (CDK_CSTRING2)mesg, 2); + freeChar (msg_0); + + /* Redraw the submenu window. */ + drawCDKMenuSubwin (menu); + return (FALSE); +} + +/* + * This is a callback to the group list scrolling list. + */ +int groupInfoCB (EObjectType cdkType GCC_UNUSED, void *object, void + *clientData, chtype key GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + CDKSCROLL *scrollp = (CDKSCROLL *)object; + SRolodex *groupList = (SRolodex *) clientData; + int selection = scrollp->currentItem; + char *mesg[5]; + char temp[100]; + + /* Create the message to be displayed. */ + mesg[0] = copyChar ("Detailed Group Information."); + + fmt1s (temp, "Group Name %.*s", groupList[selection].name); + mesg[1] = copyChar (temp); + + fmt1s (temp, "Group Description %.*s", groupList[selection].desc); + mesg[2] = copyChar (temp); + + fmt1s (temp, "Group Database File %.*s", groupList[selection].dbm); + mesg[3] = copyChar (temp); + + /* Display the message. */ + popupLabel (ScreenOf (scrollp), (CDK_CSTRING2)mesg, 4); + freeCharList (mesg, 4); + + /* Redraw the scrolling list. */ + drawCDKScroll (scrollp, ObjOf (scrollp)->box); + return (FALSE); +} diff --git a/deps/cdk-5.0-20161210/demos/rolodex.h b/deps/cdk-5.0-20161210/demos/rolodex.h new file mode 100644 index 0000000..6cb5e7e --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/rolodex.h @@ -0,0 +1,113 @@ +/* $Id: rolodex.h,v 1.10 2012/03/21 00:59:17 tom Exp $ */ + +#include +#include +#include +#include + +#define MAXGROUPS 100 +#define GLINETYPECOUNT 9 + +/* + * Declare some global variables. + */ +static char *GCurrentGroup = 0; +static char *GRCFile = 0; +static char *GDBMDir = 0; +static int GGroupModified = FALSE; +static const char *GLineType[] = { + "Voice", + "Cell", + "Pager", + "First FAX", + "Second FAX", + "Third FAX", + "First Data Line", + "Second Data Line", + "Third Data Line" +}; + +/* + * Create some definitions. + */ +typedef enum {vUnknown = -1, vVoice = 0, vCell, vPager, vFAX1, vFAX2, vFAX3, vData1, vData2, vData3} ELineType; + +/* + * Define the group record structure. + */ +struct _group_st { + char *name; + char *desc; + char *dbm; +}; +typedef struct _group_st SRolodex; + +/* + * Define a phone record structure; + */ +struct _record_st { + char *name; + ELineType lineType; + char *phoneNumber; + char *address; + char *city; + char *province; + char *postalCode; + char *desc; +}; +typedef struct _record_st SPhoneRecord; + +struct _phone_data_st { + SPhoneRecord record[MAX_ITEMS]; + int recordCount; +}; +typedef struct _phone_data_st SPhoneData; + +/* + * Define the callback prototypes. + */ +BINDFN_PROTO(helpCB); +BINDFN_PROTO(groupInfoCB); +BINDFN_PROTO(insertPhoneEntryCB); +BINDFN_PROTO(deletePhoneEntryCB); +BINDFN_PROTO(phoneEntryHelpCB); +int entryPreProcessCB (EObjectType cdkType, void *object, void *clientData, chtype input); + +/* + * These functions use/modify the rolodex RC file. + */ +int readRCFile (char *filename, SRolodex *groupInfo); +int openNewRCFile (CDKSCREEN *screen, SRolodex *groups, int groupCount); +int writeRCFile (CDKSCREEN *screen, char *file, SRolodex *groups, int count); +int writeRCFileAs (CDKSCREEN *screen, SRolodex *groups, int count); + +/* + * These functions use/modify rolodex phone groups. + */ +int addRolodexGroup (CDKSCREEN *screen, SRolodex *groups, int count); +int deleteRolodexGroup (CDKSCREEN *screen, SRolodex *groups, int count); +int pickRolodexGroup (CDKSCREEN *screen, const char *title, SRolodex *groups, int count); +void useRolodexGroup (CDKSCREEN *screen, char *name, char *desc, char *dbm); + +/* + * These functions display misc information about the rolodex program. + */ +void displayRolodexStats (CDKSCREEN *screen, int groupCount); +void aboutCdkRolodex (CDKSCREEN *screen); +void displayPhoneInfo (CDKSCREEN *screen, SPhoneRecord record); + +/* + * These functions use/modify phone data lists. + */ +int readPhoneDataFile (char *filename, SPhoneData *record); +int savePhoneDataFile (char *filename, SPhoneData *record); +int addPhoneRecord (CDKSCREEN *screen, SPhoneData *phoneData); +int deletePhoneRecord (CDKSCREEN *screen, SPhoneData *phoneData); +int getLargePhoneRecord (CDKSCREEN *screen, SPhoneRecord *phoneRecord); +int getSmallPhoneRecord (CDKSCREEN *screen, SPhoneRecord *phoneRecord); + +/* + * These functions allow us to print out phone numbers. + */ +void printGroupNumbers (CDKSCREEN *screen, SRolodex *groups, int count); +int printGroup (SRolodex groupRecord, const char *filename, char *printer); diff --git a/deps/cdk-5.0-20161210/demos/serial.c b/deps/cdk-5.0-20161210/demos/serial.c new file mode 100644 index 0000000..4956175 --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/serial.c @@ -0,0 +1,264 @@ +/* $Id: serial.c,v 1.8 2016/12/04 15:22:16 tom Exp $ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "serial"; +#endif + +/* + * Create global definitions. + */ +#define DEFAULT_PORT "/dev/ttya" +#define DEFAULT_POLL_INTERVAL 1 /* milliseconds */ + +/* + * This is the working function which probes the serial port. + */ +boolean probeModem (void); + +/* + * Define some global variables. + */ +CDKLABEL *label = 0; +int LLastState = 0; +int LCurrentState = 0; +extern char *optarg; +char port[256]; +int LFD; + +/* + * + */ +int main (int argc, char **argv) +{ + CDKSCREEN *cdkScreen = 0; + int lines = 0; + char *info[256], temp[256]; + struct termios termInfo; + + /* Set the deault values. */ + strcpy (port, DEFAULT_PORT); + + /* Parse up the command line. */ + while (1) + { + int ret; + + if ((ret = getopt (argc, argv, "p:h")) == -1) + { + break; + } + + switch (ret) + { + case 'p': + strcpy (port, optarg); + break; + + case 'h': + printf + ("Usage: %s [-p Port] [-i Poll Interval] [-c Poll Count] [-v] [-h]\n", + argv[0]); + ExitProgram (EXIT_SUCCESS); + break; + } + } + + cdkScreen = initCDKScreen (NULL); + + /* Start CDK color. */ + initCDKColor (); + + /* + * Set the title of the main window. + */ + sprintf (temp, "Serial Port Monitor (%s)", port); + info[lines++] = copyChar (temp); + info[lines++] = copyChar ("<#HL(30)>"); + info[lines++] = copyChar (""); + info[lines++] = copyChar ("Line Enabled : -"); + info[lines++] = copyChar ("Data Terminal Ready: -"); + info[lines++] = copyChar ("Carrier Detect : -"); + info[lines++] = copyChar ("Request To Send : -"); + info[lines++] = copyChar ("Clear To Send : -"); + info[lines++] = copyChar ("Secondary Transmit : -"); + info[lines++] = copyChar ("Secondary Receive : -"); + info[lines++] = copyChar (""); + + /* Create the label widget. */ + label = newCDKLabel (cdkScreen, CENTER, CENTER, info, lines, TRUE, FALSE); + drawCDKLabel (label, TRUE); + + /* + * Open the serial port read only. + */ + if ((LFD = open (port, O_RDONLY | O_NDELAY, 0)) == -1) + { + /* Create a pop-up dialog box... */ + printf ("Error: Open of <%s> failed.\n", port); + ExitProgram (EXIT_FAILURE); + } + + termInfo.c_cflag = CRTSCTS | CLOCAL; + if (tcgetattr (LFD, &termInfo) != 0) + { + /* Really should create a pop-up dialog box... */ + printf ("Error: Could not get port attributes. Closing the port.\n"); + close (LFD); + ExitProgram (EXIT_FAILURE); + } + + for (;;) + { + /* Probe the modem. */ + probeModem (); + + /* + * Sleep for the given amount of time. We do this first so no + * weird refresh things happen. + */ + napms (DEFAULT_POLL_INTERVAL); + } +} + +/* + * This probes the modem and determines if we need to update + * the display. + */ +boolean probeModem (void) +{ + int lines = 0; + char *info[256], temp[256]; + + /* Start building the label. */ + sprintf (temp, "Serial Port Monitor (%s)", port); + info[lines++] = copyChar (temp); + info[lines++] = copyChar ("<#HL(30)>"); + info[lines++] = copyChar (""); + + /* + * Get the serial port info. + */ + ioctl (LFD, TIOCMGET, &LCurrentState); + + /* + * If the states are different, change the display. + */ + if (LLastState != LCurrentState) + { + /* + * Check for line enabled. + */ + if (LCurrentState & TIOCM_LE) + { + info[lines++] = copyChar ("Line Enabled : <#DI>"); + } + else + { + info[lines++] = copyChar ("Line Enabled : "); + } + + /* + * Check for data terminal ready. + */ + if (LCurrentState & TIOCM_DTR) + { + info[lines++] = copyChar ("Data Terminal Ready: <#DI>"); + } + else + { + info[lines++] = copyChar ("Data Terminal Ready: "); + } + + /* + * Check for carrier detect. + */ + if (LCurrentState & TIOCM_CAR) + { + info[lines++] = copyChar ("Carrier Detect : <#DI>"); + } + else + { + info[lines++] = copyChar ("Carrier Detect : "); + } + + /* + * Check for request to send. + */ + if (LCurrentState & TIOCM_RTS) + { + info[lines++] = copyChar ("Request To Send : <#DI>"); + } + else + { + info[lines++] = copyChar ("Request To Send : "); + } + + /* + * Check for clear to send. + */ + if (LCurrentState & TIOCM_CTS) + { + info[lines++] = copyChar ("Clear To Send : <#DI>"); + } + else + { + info[lines++] = copyChar ("Clear To Send : "); + } + + /* + * Check for secondary transmit. + */ + if (LCurrentState & TIOCM_ST) + { + info[lines++] = copyChar ("Secondary Transmit : <#DI>"); + } + else + { + info[lines++] = copyChar ("Secondary Transmit : "); + } + + /* + * Check for secondary receive. + */ + if (LCurrentState & TIOCM_SR) + { + info[lines++] = copyChar ("Secondary Receive : <#DI>"); + } + else + { + info[lines++] = copyChar ("Secondary Receive : "); + } + } + info[lines++] = copyChar (""); + + /* Only do this if things have changed. */ + if (LLastState != LCurrentState) + { + eraseCDKLabel (label); + setCDKLabel (label, info, lines, TRUE); + drawCDKLabel (label, TRUE); + } + + /* + * Keep the current state. + */ + LLastState = LCurrentState; + + /* + * Return False to tell X that we want this funtion to be + * run again. + */ + return FALSE; +} diff --git a/deps/cdk-5.0-20161210/demos/stopSign.c b/deps/cdk-5.0-20161210/demos/stopSign.c new file mode 100644 index 0000000..c946042 --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/stopSign.c @@ -0,0 +1,83 @@ +/* $Id: stopSign.c,v 1.13 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "sillyness_ex"; +#endif + +int main (void) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKLABEL *stopSign = 0; + CDKLABEL *title = 0; + const char *mesg[5]; + const char *sign[4]; + chtype key; + boolean functionKey; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Set the labels up. */ + mesg[0] = "<#HL(40)>"; + mesg[1] = "Press r for the red light"; + mesg[2] = "Press y for the yellow light"; + mesg[3] = "Press g for the green light"; + mesg[4] = "<#HL(40)>"; + sign[0] = " <#DI> "; + sign[1] = " <#DI> "; + sign[2] = " <#DI> "; + + /* Declare the labels. */ + title = newCDKLabel (cdkscreen, CENTER, TOP, + (CDK_CSTRING2) mesg, 5, + FALSE, FALSE); + stopSign = newCDKLabel (cdkscreen, CENTER, CENTER, + (CDK_CSTRING2) sign, 3, + TRUE, TRUE); + + /* Do this until they hit q or escape. */ + for (;;) + { + drawCDKLabel (title, FALSE); + drawCDKLabel (stopSign, TRUE); + + key = (chtype)getchCDKObject (ObjOf (stopSign), &functionKey); + if (key == KEY_ESC || key == 'q' || key == 'Q') + { + break; + } + else if (key == 'r' || key == 'R') + { + sign[0] = " <#DI> "; + sign[1] = " o "; + sign[2] = " o "; + } + else if (key == 'y' || key == 'Y') + { + sign[0] = " o "; + sign[1] = " <#DI> "; + sign[2] = " o "; + } + else if (key == 'g' || key == 'G') + { + sign[0] = " o "; + sign[1] = " o "; + sign[2] = " <#DI> "; + } + + /* Set the contents of the label and re-draw it. */ + setCDKLabel (stopSign, (CDK_CSTRING2) sign, 3, TRUE); + } + + /* Clean up. */ + destroyCDKLabel (title); + destroyCDKLabel (stopSign); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/demos/syb.c b/deps/cdk-5.0-20161210/demos/syb.c new file mode 100644 index 0000000..2e6dde2 --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/syb.c @@ -0,0 +1,1139 @@ +/* $Id: syb.c,v 1.13 2016/12/04 15:22:16 tom Exp $ */ + +#include +#include +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName="syb"; +#endif + +#define MAXWIDTH 5000 +#define MAXHISTORY 1000 + +/* + * This structure is used for keeping command history. + */ +struct history_st { + unsigned used; + int count; + int current; + char **cmd_history; +}; + +/* + * Define some global variables. + */ +char *GPUsage = "[-p Command Prompt] [-U User] [-P Password] [-S Server] [-h help]"; +char *GPCurrentDatabase = 0; +extern char *dberrstr; + +/* + * Because the error/message callback do not allow you to pass in + * data of your own, we have to make the screen pointer global. :( + */ +CDKSCREEN *GPCdkScreen = 0; + +/* + * Define function prototypes. + */ +DBPROCESS *loginToSybase (CDKSCREEN *screen, char *login, char *password); +DBPROCESS *sybaseLogin (CDKSCREEN *screen, char *login, char *password, int attempts); +char *assembleTitle (DBPROCESS *dbProcess); +char *assembleRow (DBPROCESS *dbProcess); +char *uc (char *word); +int getColWidth (DBPROCESS *dbProcess, int col); +void runIsqlCommand (CDKSCREEN *cdkscreen, CDKSWINDOW *swindow, DBPROCESS *process); +void useDatabase (CDKSWINDOW *swindow, DBPROCESS *dbProc, char *command); +void intro (CDKSCREEN *screen); +void help (CDKENTRY *entry); +void loadHistory (struct history_st *history); +void saveHistory (struct history_st *history, int count); + +/* + * Define callback prototypes. + */ +BINDFN_PROTO(viewHistoryCB); +BINDFN_PROTO(swindowHelpCB); +BINDFN_PROTO(historyUpCB); +BINDFN_PROTO(historyDownCB); +BINDFN_PROTO(listHistoryCB); + +/* + * Define Sybase error/message callbacks. This is required by DBLib. + */ +int err_handler (DBPROCESS *dbProcess, DBINT mesgNumber, int mesgState, + int severity, char *mesgText); +int msg_handler (DBPROCESS *dbProcess, DBINT mesgNumber, int mesgState, + int severity, char *mesgText); + +/* + * Written by: Mike Glover + * Purpose: + * This creates a very simple interface to Sybase. + */ +int main (int argc, char **argv) +{ + /* Declare variables. */ + CDKSWINDOW *commandOutput = 0; + CDKENTRY *commandEntry = 0; + DBPROCESS *dbProcess = 0; + char *dsquery = 0; + char *command = 0; + char *prompt = 0; + char *upper = 0; + char *login = 0; + char *password = 0; + char *server = 0; + int count = 0; + int width = 0; + int ret = 0; + struct history_st history; + char *mesg[5], temp[1000]; + + /* Set up the history. */ + GPCurrentDatabase = copyChar ("master"); + history.used = 0; + history.current = 0; + history.count = 0; + + /* Check the command line for options. */ + while (1) + { + /* Are there any more command line options to parse. */ + if ((ret = getopt (argc, argv, "p:U:P:S:h")) == -1) + { + break; + } + + switch (ret) + { + case 'p': + prompt = copyChar (optarg); + break; + + case 'U': + login = copyChar (optarg); + break; + + case 'P': + password = copyChar (optarg); + break; + + case 'S': + server = copyChar (optarg); + break; + + case 'h': + printf ("Usage: %s %s\n", argv[0], GPUsage); + ExitProgram (EXIT_SUCCESS); + break; + } + } + + /* Set up the command prompt. */ + if (prompt == 0) + { + if (server == 0) + { + if ((dsquery = getenv ("DSQUERY")) != 0) + { + sprintf (temp, "[%s] Command >", dsquery); + prompt = copyChar (temp); + } + else + { + prompt = copyChar ("Command >"); + } + } + else + { + sprintf (temp, "[%s] Command >", server); + prompt = copyChar (temp); + } + } + + GPCdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor(); + + /* Initialize DB-Library. */ + if (dbinit() == FAIL) + { + mesg[0] = "Fatal Error"; + mesg[1] = "Could not connect to the Sybase database."; + popupLabel (GPCdkScreen, mesg, 2); + ExitProgram (EXIT_FAILURE); + } + + /* Load the history. */ + loadHistory (&history); + + /* Create the scrolling window. */ + commandOutput = newCDKSwindow (GPCdkScreen, CENTER, TOP, -8, -2, + "Command Output Window", + MAXWIDTH, TRUE, FALSE); + + /* Create the entry field. */ + width = COLS - strlen (prompt) - 1; + commandEntry = newCDKEntry (GPCdkScreen, CENTER, BOTTOM, + 0, prompt, A_BOLD|COLOR_PAIR(8), + COLOR_PAIR(24)|'_', vMIXED, + width, 1, 512, FALSE, FALSE); + + /* Create the key bindings. */ + bindCDKObject (vENTRY, commandEntry, KEY_UP, &historyUpCB, &history); + bindCDKObject (vENTRY, commandEntry, KEY_DOWN, &historyDownCB, &history); + bindCDKObject (vENTRY, commandEntry, CTRL('^'), &listHistoryCB, &history); + bindCDKObject (vENTRY, commandEntry, KEY_TAB, &viewHistoryCB, commandOutput); + bindCDKObject (vSWINDOW, commandOutput, '?', swindowHelpCB, commandEntry); + + /* Draw the screen. */ + refreshCDKScreen (GPCdkScreen); + + /* Display the introduction window. */ + intro (GPCdkScreen); + + /* Make them login first. */ + dbProcess = sybaseLogin (GPCdkScreen, login, password, 3); + if (dbProcess == 0) + { + destroyCDKScreen (GPCdkScreen); + endCDK (); + ExitProgram (EXIT_FAILURE); + } + + /* Do this forever. */ + for (;;) + { + /* Get the command. */ + command = activateCDKEntry (commandEntry, 0); + + /* Strip off leading and trailing white space. */ + stripWhiteSpace (vBOTH, command); + + /* Upper case the command. */ + upper = uc (command); + + /* Check the output of the command. */ + if (strcmp (upper, "QUIT") == 0 || + strcmp (upper, "EXIT") == 0 || + strcmp (upper, "Q") == 0 || + strcmp (upper, "E") == 0 || + commandEntry->exitType == vESCAPE_HIT) + { + /* Save the history. */ + saveHistory (&history, 100); + + /* Exit. */ + dbclose (dbProcess); + dbexit(); + + /* All done. */ + destroyCDKEntry (commandEntry); + destroyCDKSwindow (commandOutput); + freeChar (upper); + endCDK(); + ExitProgram (EXIT_SUCCESS); + } + else if (strcmp (command, "login") == 0) + { + DBPROCESS *newLogin = sybaseLogin (GPCdkScreen, 0, 0, 3); + if (newLogin == 0) + { + addCDKSwindow (commandOutput, "Login Error: Could not switch to new user.", BOTTOM); + } + else + { + /* Close the old connection. */ + dbclose (dbProcess); + dbProcess = newLogin; + + /* Add a message to the scrolling window. */ + addCDKSwindow (commandOutput, + "Logged into database as new user.", + BOTTOM); + count = 0; + } + } + else if (strcmp (command, "logout") == 0) + { + /* Close the old connection. */ + dbclose (dbProcess); + dbProcess = 0; + + /* Add a message to the scrolling window. */ + addCDKSwindow (commandOutput, "Logged out.", BOTTOM); + count = 0; + } + else if (strcmp (command, "clear") == 0) + { + /* Clear the scrolling window. */ + cleanCDKSwindow (commandOutput); + } + else if (strcmp (command, "history") == 0) + { + listHistoryCB (vENTRY, (void *)commandEntry, (void *)&history, 0); + } + else if (strcmp (command, "tables") == 0) + { + /* Check if we are logged in. */ + if (dbProcess == 0) + { + addCDKSwindow (commandOutput, "You must login first.", BOTTOM); + } + else + { + sprintf (command, "select * from sysobjects where type = 'U'"); + + /* Put the command into the ISQL buffer. */ + dbcmd (dbProcess, command); + + /* Put the command into the scrolling window. */ + sprintf (temp, "%d> %s", count+1, command); + addCDKSwindow (commandOutput, temp, BOTTOM); + + /* Increment the counter. */ + count++; + } + } + else if (strcmp (command, "help") == 0) + { + /* Display the help. */ + help(commandEntry); + } + else if (command[0] == 'u' && command[1] == 's' && + command[2] == 'e' && command[3] == ' ') + { + /* They want to use a database. */ + useDatabase (commandOutput, dbProcess, command); + count = 0; + } + else if (strcmp (command, "go") == 0) + { + /* Check if we are logged in. */ + if (dbProcess == 0) + { + addCDKSwindow (commandOutput, "You must login first.", BOTTOM); + } + else + { + /* Put the command into the scrolling window. */ + sprintf (temp, "%d> %s", count+1, command); + addCDKSwindow (commandOutput, temp, BOTTOM); + count = 0; + + /* Run the command. */ + runIsqlCommand (GPCdkScreen, commandOutput, dbProcess); + } + } + else + { + /* Check if we are logged in. */ + if (dbProcess == 0) + { + addCDKSwindow (commandOutput, "You must login first.", BOTTOM); + } + else + { + /* Put the command into the ISQL buffer. */ + dbcmd (dbProcess, command); + + /* Put the command into the scrolling window. */ + sprintf (temp, "%d> %s", count+1, command); + addCDKSwindow (commandOutput, temp, BOTTOM); + + /* Increment the counter. */ + count++; + } + } + + /* Keep the history. */ + history.used = CDKallocStrings(&(history.cmd_history), command, history.count++, history.used); + history.current = history.count; + + /* Clear the entry field. */ + cleanCDKEntry (commandEntry); + + /* Free up the memory used by the upper pointer. */ + freeChar (upper); + } +} + +/* + * This lets a person 'use' a database. + */ +void useDatabase (CDKSWINDOW *swindow, DBPROCESS *dbProc, char *command) +{ + char *database = 0; + char temp[256]; + char **words; + int wordCount, x; + + /* Split the command line up and get the database name. */ + words = CDKsplitString (command, ' '); + wordCount = CDKcountStrings (words); + + /* Look for the name. */ + for (x=1; x < wordCount; x++) + { + if (strlen (words[x]) != 0) + { + database = copyChar (words[x]); + } + } + CDKfreeStrings(words); + + /* Try to actually use the database. */ + if (dbuse(dbProc, database) == FAIL) + { + /* We aren't allowed to use that database. */ + sprintf (temp, "Command: %s", command); + addCDKSwindow (swindow, temp, BOTTOM); + addCDKSwindow (swindow, "Error You are not allowed to use that database.", BOTTOM); + return; + } + + /* Set the global database name. */ + if (database == 0) + { + /* Put a syntax error in the scrolling window. */ + sprintf (temp, "Command: %s", command); + addCDKSwindow (swindow, temp, BOTTOM); + addCDKSwindow (swindow, "Error Syntax Error", BOTTOM); + return; + } + + /* Clear out the old database name and set the new one. */ + freeChar (GPCurrentDatabase); + GPCurrentDatabase = database; + + /* Add a message into the scrolling window. */ + sprintf (temp, "Command: %s", command); + addCDKSwindow (swindow, temp, BOTTOM); + sprintf (temp, "Default Database set to %s", GPCurrentDatabase); + addCDKSwindow (swindow, temp, BOTTOM); +} + +/* + * This does the requisite checking for failed login attempts. + */ +DBPROCESS *sybaseLogin (CDKSCREEN *screen, char *accountName, char *accountPassword, int attemptCount) +{ + DBPROCESS *dbProcess = 0; + char *login = accountName; + char *password = accountPassword; + int count = 0; + int lines = 0; + char *mesg[5]; + + /* Give them X attempts, then kick them out. */ + while (count < attemptCount) + { + /* Try to login. */ + dbProcess = loginToSybase (GPCdkScreen, login, password); + + /* + * If the dbprocess is null the account/password + * pair does not exist. + */ + if (dbProcess == 0) + { + /* + * If the login and account names were provided, + * set them to null and allow the user to enter + * the name and password by hand. + */ + login = 0; + password = 0; + + /* Spit out the login error message. */ + lines = 0; + mesg[lines++] = "Login Error"; + mesg[lines++] = " "; + mesg[lines++] = "The login/password pair does not exist."; + mesg[lines++] = " "; + mesg[lines++] = "Please try again."; + + popupLabel (GPCdkScreen, mesg, lines); + + eraseCDKScreen (GPCdkScreen); + refreshCDKScreen (GPCdkScreen); + count++; + } + else + { + break; + } + } + + /* Did we expire the login attempts? */ + if (count > attemptCount-1) + { + lines = 0; + mesg[lines++] = "Login Error"; + mesg[lines++] = " "; + mesg[lines++] = "Too many attempyts to login."; + mesg[lines++] = "Exiting."; + + popupLabel (GPCdkScreen, mesg, lines); + + return 0; + } + return dbProcess; +} + +/* + * Let the user login. + */ +DBPROCESS *loginToSybase (CDKSCREEN *screen, char *accountName, char *accountPassword) +{ + CDKENTRY *loginEntry = 0; + CDKENTRY *passwordEntry = 0; + LOGINREC *dbLogin = 0; + char *hostAccount = 0; + char *login = accountName; + char *password = accountPassword; + char *mesg[10], temp[256]; + + /* Draw the screen. */ + refreshCDKScreen (screen); + + /* Define the login entry field. */ + if (login == 0) + { + loginEntry = newCDKEntry (screen, CENTER, CENTER, + "\nSybase Login\n", + "Account Name: ", + A_BOLD|COLOR_PAIR(8), + COLOR_PAIR(24)|'_', vMIXED, + 20, 1, 20, TRUE, FALSE); + + /* Use the current account name as the default answer. */ + hostAccount = getlogin(); + setCDKEntryValue (loginEntry, hostAccount); + + /* Get the login. */ + while (1) + { + /* Redraw the screen. */ + eraseCDKScreen (ScreenOf(loginEntry)); + refreshCDKScreen (ScreenOf(loginEntry)); + + /* Get the login to the sybase account. */ + login = copyChar (activateCDKEntry (loginEntry, 0)); + + /* Check if they hit escape. */ + if (loginEntry->exitType == vESCAPE_HIT) + { + mesg[0] = "Error"; + mesg[1] = "A user name must be provided."; + popupLabel (screen, mesg, 2); + } + else + { + break; + } + } + + /* Destroy the widget. */ + destroyCDKEntry (loginEntry); + } + + /* Get the password if we need too. */ + if (password == 0) + { + sprintf (temp, "\n%s's Password\n", login); + passwordEntry = newCDKEntry (screen, CENTER, CENTER, + temp, "Account Password: ", + A_BOLD|COLOR_PAIR(8), + COLOR_PAIR(24)|'_', vHMIXED, + 20, 0, 20, TRUE, FALSE); + setCDKEntryHiddenChar (passwordEntry, '*'); + + /* Get the password. (the account may not have a password.) */ + password = copyChar (activateCDKEntry (passwordEntry, 0)); + if ((passwordEntry->exitType == vESCAPE_HIT) || + (strlen(password) == 0)) + { + password = ""; + } + + /* Destroy the widget. */ + destroyCDKEntry (passwordEntry); + } + + /* + * Try to connect to the database and get a LOGINREC structre. + */ + if ((dbLogin = dblogin()) == 0) + { + mesg[0] = "Fatal Error"; + mesg[1] = "Could not connect to the Sybase database."; + popupLabel (screen, mesg, 2); + refreshCDKScreen (screen); + ExitProgram (EXIT_FAILURE); + } + + /* + * Set the login and password and try to login to the database. + */ + DBSETLUSER (dbLogin, login); + DBSETLPWD (dbLogin, password); + DBSETLAPP (dbLogin, "cdk_syb"); + + /* Create a dbprocess structure to communicate with the database. */ + return dbopen (dbLogin, 0); +} + +/* + * This actually runs the command. + */ +void runIsqlCommand (CDKSCREEN *screen, CDKSWINDOW *swindow, DBPROCESS *dbProcess) +{ + /* Declare local variables. */ + RETCODE returnCode; + int rowCount; + + /* Add in a output seperation line. */ + addCDKSwindow (swindow, "<#HL(5)> Start of Output <#HL(5)>", BOTTOM); + + /* Run the command. */ + dbsqlexec (dbProcess); + + /* Check the return code of the commands. */ + while ((returnCode = dbresults (dbProcess)) != NO_MORE_RESULTS) + { + if (returnCode == FAIL) + { + /* Oops, the command bombed. */ + addCDKSwindow (swindow, "Command failed.", BOTTOM); + } + else + { + if (!(DBCMDROW (dbProcess))) + { + /* The command could not return any rows. */ + addCDKSwindow (swindow, "Command could not return rows.", BOTTOM); + } + else + { + /* + * The command returned some rows, print out the title. + */ + char *row = assembleTitle (dbProcess); + addCDKSwindow (swindow, row, BOTTOM); + freeChar (row); + + /* For each row returned, assemble the info. */ + rowCount = 0; + while (dbnextrow (dbProcess) != NO_MORE_ROWS) + { + row = assembleRow (dbProcess); + addCDKSwindow (swindow, row, BOTTOM); + freeChar (row); + } + } + } + } + + /* Add in a output seperation line. */ + addCDKSwindow (swindow, "<#HL(5)> End of Output <#HL(5)>", BOTTOM); + addCDKSwindow (swindow, "", BOTTOM); + + /* Can the query... */ + dbcanquery (dbProcess); +} + +/* + * This creates a single line from the column widths and values. + */ +char *assembleTitle (DBPROCESS *dbProc) +{ + char *colName = 0; + int colWidth = 0; + int colNameLen = 0; + int colCount = dbnumcols (dbProc); + int x = 0; + char temp[MAXWIDTH]; + char row[MAXWIDTH]; + + /* Clean the row out. */ + memset (row, '\0', MAXWIDTH); + + /* Start assembling the row. */ + for (x=1; x <= colCount; x++) + { + colName = dbcolname (dbProc, x); + colWidth = getColWidth (dbProc, x); + colNameLen = strlen (colName); + + /* If we need to pad, then pad. */ + if (colNameLen < colWidth) + { + /* Create a string the same length as the col width. */ + memset (temp, '\0', MAXWIDTH); + memset (temp, ' ', (colWidth-colNameLen)); + + /* Copy the name. */ + sprintf (row, "%s %s%s", row, colName, temp); + } + else + { + /* Copy the name. */ + sprintf (row, "%s %s", row, colName); + } + } + return copyChar (row); +} + +/* + * This assembles a single row. + */ +char *assembleRow (DBPROCESS *dbProcess) +{ + char *dataValue = 0; + int colCount = dbnumcols (dbProcess); + int columnType = 0; + int colWidth = 0; + int valueLen = 0; + char value[MAXWIDTH]; + char temp[MAXWIDTH]; + char row[MAXWIDTH]; + char format[20]; + int x; + + /* Clean out the row. */ + memset (row, '\0', MAXWIDTH); + + /* Start assembling the row. */ + for (x=1; x <= colCount; x++) + { + columnType = (int)dbcoltype (dbProcess, x); + colWidth = (int)getColWidth (dbProcess, x); + valueLen = (int)dbdatlen (dbProcess, x); + + /* Check the column type. */ + if (columnType == SYBINT1) + { + DBINT object_id = *((DBINT *)dbdata(dbProcess, x)); + sprintf (format, "%%-%dd", colWidth); + sprintf (value, format, (int)object_id); + } + else if (columnType == SYBINT2) + { + DBINT object_id = *((DBINT *)dbdata(dbProcess, x)); + sprintf (format, "%%-%dd", colWidth); + sprintf (value, format, (int)object_id); + } + else if (columnType == SYBINT4) + { + DBINT object_id = *((DBINT *)dbdata(dbProcess, x)); + sprintf (format, "%%-%dd", colWidth); + sprintf (value, format, (int)object_id); + } + else if (columnType == SYBREAL) + { + DBREAL object_id = *((DBREAL *)dbdata(dbProcess, x)); + sprintf (format, "%%-%d.2f", colWidth); + sprintf (value, format, object_id); + } + else if (columnType == SYBFLT8) + { + DBFLT8 object_id = *((DBFLT8 *)dbdata(dbProcess, x)); + sprintf (format, "%%-%d.2f", colWidth); + sprintf (value, format, object_id); + } + else + { + if (valueLen <= 0) + { + strcpy (value, " "); + } + else + { + memset (value, '\0', MAXWIDTH); + dataValue = (DBCHAR *)dbdata (dbProcess, x); + strncpy (value, dataValue, valueLen); + } + } + + /* If we need to pad, then pad. */ + if (valueLen < colWidth) + { + /* Copy the value into the string. */ + memset (temp, '\0', MAXWIDTH); + memset (temp, ' ', (colWidth-valueLen)); + sprintf (row, "%s %s%s", row, value, temp); + } + else + { + sprintf (row, "%s %s", row, value); + } + } + return copyChar (row); +} + +/* + * This function returns the correct width of a column, taking + * into account the width of the title, the width of the data + * element. + */ +int getColWidth (DBPROCESS *dbProcess, int col) +{ + char *colName = dbcolname (dbProcess, col); + int colNameLen = strlen(colName); + int colWidth = dbcollen (dbProcess, col); + int columnType = (int)dbcoltype (dbProcess, col); + + /* If the colType is int/real/float adjust accordingly. */ + if (columnType == SYBINT1 || columnType == SYBINT2 || + columnType == SYBINT4) + { + colWidth = 5; + } + else if (columnType == SYBREAL || columnType == SYBFLT8) + { + colWidth = 8; + } + + /* Is the name of the column wider than the col width? */ + if (colNameLen >= colWidth) + { + return (colNameLen+1); + } + return colWidth; +} + +/* + * This callback allows the user to play with the scrolling window. + */ +int viewHistoryCB (EObjectType cdktype, void *object, void *clientData, chtype key) +{ + CDKSWINDOW *swindow = (CDKSWINDOW *)clientData; + CDKENTRY *entry = (CDKENTRY *)object; + + /* Let them play... */ + activateCDKSwindow (swindow, 0); + + /* Redraw the entry field. */ + drawCDKEntry (entry, ObjOf(entry)->box); + return (TRUE); +} + +/* + * This displays a little introduction screen. + */ +void intro (CDKSCREEN *screen) +{ + int lines = 0; + char *mesg[10]; + + /* Create the message. */ + mesg[lines++] = ""; + mesg[lines++] = "Sybase Command Interface"; + mesg[lines++] = "Written by Mike Glover"; + mesg[lines++] = ""; + mesg[lines++] = "Type help to get help."; + + /* Display the message. */ + popupLabel (screen, mesg, lines); +} + +/* + * This function displays help. + */ +void help (CDKENTRY *entry) +{ + int lines = 0; + char *mesg[25]; + + /* Create the help message. */ + mesg[lines++] = "Help"; + mesg[lines++] = ""; + mesg[lines++] = "When in the command line."; + mesg[lines++] = " Scrolls back one command."; + mesg[lines++] = " Scrolls forward one command."; + mesg[lines++] = " Activates the scrolling window."; + mesg[lines++] = " Displays this help window."; + mesg[lines++] = ""; + mesg[lines++] = "When in the scrolling window."; + mesg[lines++] = " Loads a file into the window."; + mesg[lines++] = " Saves the contents of the window to a file."; + mesg[lines++] = " Scrolls up one line."; + mesg[lines++] = " Scrolls down one line."; + mesg[lines++] = " Scrolls back one page."; + mesg[lines++] = " Scrolls forward one page."; + mesg[lines++] = " Returns to the command line."; + mesg[lines++] = " Displays this help window."; + mesg[lines++] = ""; + mesg[lines++] = " (Refer to the scrolling window online manual for more help.)"; + + /* Pop up the help message. */ + popupLabel (ScreenOf(entry), mesg, lines); +} + +/* + * This converts a word to upper case. + */ +char *uc (char *word) +{ + int length = strlen (word); + char *upper = (char *)malloc (sizeof (char *) * (length+2)); + int x; + + /* Start converting the case. */ + for (x=0; x < length; x++) + { + int ch = (unsigned char)(word[x]); + if (isalpha (ch)) + { + upper[x] = toupper(ch); + } + else + { + upper[x] = word[x]; + } + } + upper[length] = '\0'; + return upper; +} + +/* + * The following two functions are the error and message handler callbacks. + * which will be called by Sybase when and error occurs. + */ +int err_handler (DBPROCESS *dbProcess, DBINT mesgNumber, int mesgState, int severity, char *mesgText) +{ + /* Declare local variables. */ + char *mesg[10], temp[256]; + int errorCount = 0; + + /* Check if the process is dead. */ + if ((dbProcess == 0) || (DBDEAD(dbProcess))) + { + mesg[0] = "Database Process Error"; + mesg[1] = "The database process seems to have died."; + mesg[2] = "Try logging in again with the login command"; + popupLabel (GPCdkScreen, mesg, 3); + return INT_EXIT; + } + else + { + mesg[0] = "DB-Library Error"; + sprintf (temp, "%s", dberrstr); + mesg[1] = copyChar (temp); + errorCount = 2; + } + + /* Display the message if we have an error. */ + if (errorCount > 0) + { + popupLabel (GPCdkScreen, mesg, --errorCount); + } + + /* Clean up. */ + if (errorCount == 2) + { + freeChar (mesg[1]); + } + return (1); +} +int mesg_handler (DBPROCESS *dbProcess, DBINT mesgNumber, int mesgState, int severity, char *mesgText) +{ + /* Declare local variables. */ + char *mesg[10], temp[256]; + + /* Create the message. */ + mesg[0] = "SQL Server Message"; + sprintf (temp, "Message Number %ld", mesgNumber); + mesg[1] = copyChar (temp); + sprintf (temp, "State %d", mesgState); + mesg[2] = copyChar (temp); + sprintf (temp, "Severity %d", severity); + mesg[3] = copyChar (temp); + sprintf (temp, "Message %s", mesgText); + mesg[4] = copyChar (temp); + popupLabel (GPCdkScreen, mesg, 5); + + /* Clean up. */ + freeChar (mesg[1]); freeChar (mesg[2]); + freeChar (mesg[3]); freeChar (mesg[4]); + return (1); +} + +/* + * This is for the scrolling window help callback. + */ +int swindowHelpCB (EObjectType cdktype, void *object, void *clientData, chtype key) +{ + CDKENTRY *entry = (CDKENTRY *)clientData; + help(entry); + return (TRUE); +} + +/* + * This is the callback for the down arrow. + */ +int historyUpCB (EObjectType cdktype, void *object, void *clientData, chtype key) +{ + CDKENTRY *entry = (CDKENTRY *)object; + struct history_st *history = (struct history_st *) clientData; + + /* Make sure we don't go out of bounds. */ + if (history->current == 0) + { + Beep(); + return (TRUE); + } + + /* Decrement the counter. */ + history->current--; + + /* Display the command. */ + setCDKEntryValue (entry, history->cmd_history[history->current]); + drawCDKEntry (entry, ObjOf(entry)->box); + return (TRUE); +} + +/* + * This is the callback for the down arrow. + */ +int historyDownCB (EObjectType cdktype, void *object, void *clientData, chtype key) +{ + CDKENTRY *entry = (CDKENTRY *)object; + struct history_st *history = (struct history_st *) clientData; + + /* Make sure we don't go out of bounds. */ + if (history->current == history->count) + { + Beep(); + return (TRUE); + } + + /* Increment the counter... */ + history->current++; + + /* If we are at the end, clear the entry field. */ + if (history->current == history->count) + { + cleanCDKEntry (entry); + drawCDKEntry (entry, ObjOf(entry)->box); + return (TRUE); + } + + /* Display the command. */ + setCDKEntryValue (entry, history->cmd_history[history->current]); + drawCDKEntry (entry, ObjOf(entry)->box); + return (TRUE); +} + +/* + * This callback allows the user to pick from the history list from a + * scrolling list. + */ +int listHistoryCB (EObjectType cdktype, void *object, void *clientData, chtype key) +{ + CDKSCROLL *scrollList = 0; + CDKENTRY *entry = (CDKENTRY *)object; + struct history_st *history = (struct history_st *) clientData; + int height = (history->count < 10 ? history->count+3 : 13); + int selection; + + /* No history, no list. */ + if (history->count == 0) + { + /* Popup a little window telling the user there are no commands. */ + char *mesg[] = {"No Commands Entered", "No History"}; + popupLabel (ScreenOf(entry), mesg, 2); + + /* Redraw the screen. */ + eraseCDKEntry (entry); + drawCDKScreen (ScreenOf(entry)); + + /* And leave... */ + return (TRUE); + } + + /* Create the scrolling list of previous commands. */ + scrollList = newCDKScroll (ScreenOf(entry), CENTER, CENTER, RIGHT, + height, -10, "Command History", + history->cmd_history, history->count, + NUMBERS, A_REVERSE, TRUE, FALSE); + + /* Get the command to execute. */ + selection = activateCDKScroll (scrollList, 0); + destroyCDKScroll (scrollList); + + /* Check the results of the selection. */ + if (selection >= 0) + { + /* Get the command and stick it back in the entry field. */ + setCDKEntryValue (entry, history->cmd_history[selection]); + } + + /* Redraw the screen. */ + eraseCDKEntry (entry); + drawCDKScreen (ScreenOf(entry)); + return (TRUE); +} + +/* + * This loads the history into the editor from the RC file. + */ +void loadHistory (struct history_st *history) +{ + char *home = 0; + char filename[1000]; + + /* Create the RC filename. */ + if ((home = getenv ("HOME")) == 0) + { + home = "."; + } + sprintf (filename, "%s/.sybrc", home); + + /* Set some variables. */ + history->current = 0; + history->count = 0; + + /* Read the file. */ + if ((history->count = CDKreadFile (filename, &(history->cmd_history))) != -1) + { + history->current = history->count; + } + return; +} + +/* + * This saves the history into RC file. + */ +void saveHistory (struct history_st *history, int count) +{ + FILE *fd = 0; + char *home = 0; + char filename[1000]; + int x; + + /* Create the RC filename. */ + if ((home = getenv ("HOME")) == 0) + { + home = "."; + } + sprintf (filename, "%s/.sybrc", home); + + /* Open the file for writing. */ + if ((fd = fopen (filename, "w")) == 0) + { + return; + } + + /* Start saving the history. */ + for (x=0; x < history->count; x++) + { + fprintf (fd, "%s\n", history->cmd_history[x]); + } + fclose (fd); + return; +} diff --git a/deps/cdk-5.0-20161210/demos/vinstall.c b/deps/cdk-5.0-20161210/demos/vinstall.c new file mode 100644 index 0000000..8b158ab --- /dev/null +++ b/deps/cdk-5.0-20161210/demos/vinstall.c @@ -0,0 +1,508 @@ +/* $Id: vinstall.c,v 1.21 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "vinstall"; +#endif + +/* + * Written by: Mike Glover + * Purpose: + * This is a fairly basic install interface. + */ + +/* Declare global types and prototypes. */ +static const char *FPUsage = "-f filename [-s source directory] [-d destination directory] [-t title] [-o Output file] [-q]"; + +typedef enum +{ + vCanNotOpenSource, + vCanNotOpenDest, + vOK +} +ECopyFile; + +static ECopyFile copyFile (CDKSCREEN *cdkScreen, char *src, char *dest); +static int verifyDirectory (CDKSCREEN *screen, char *directory); + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkScreen = 0; + CDKSWINDOW *installOutput = 0; + CDKENTRY *sourceEntry = 0; + CDKENTRY *destEntry = 0; + CDKLABEL *titleWin = 0; + CDKHISTOGRAM *progressBar = 0; + char *sourcePath = 0; + char *destPath = 0; + char *sourceDir = 0; + char *destDir = 0; + char *filename = 0; + char *title = 0; + char *output = 0; + int quiet = FALSE; + int errors = 0; + int sWindowHeight = 0; + char *titleMessage[10]; + char **fileList = 0; + const char *mesg[20]; + char oldPath[512], newPath[512], temp[2000]; + int count, ret, x; + + /* Parse up the command line. */ + while (1) + { + ret = getopt (argc, argv, "d:s:f:t:o:q"); + if (ret == -1) + { + break; + } + switch (ret) + { + case 's': + sourcePath = strdup (optarg); + break; + + case 'd': + destPath = strdup (optarg); + break; + + case 'f': + filename = strdup (optarg); + break; + + case 't': + title = strdup (optarg); + break; + + case 'o': + output = strdup (optarg); + break; + + case 'q': + quiet = TRUE; + break; + } + } + + /* Make sure have everything we need. */ + if (filename == 0) + { + fprintf (stderr, "Usage: %s %s\n", argv[0], FPUsage); + ExitProgram (EXIT_FAILURE); + } + + /* Open the file list file and read it in. */ + count = CDKreadFile (filename, &fileList); + if (count == 0) + { + fprintf (stderr, "%s: Input filename <%s> is empty.\n", argv[0], filename); + ExitProgram (EXIT_FAILURE); + } + + /* + * Cycle through what was given to us and save it. + */ + for (x = 0; x < count; x++) + { + /* Strip white space from the line. */ + stripWhiteSpace (vBOTH, fileList[x]); + } + + cdkScreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Create the title label. */ + titleMessage[0] = copyChar ("<#HL(30)>"); + if (title == 0) + { + sprintf (temp, "CDK Installer"); + } + else + { + sprintf (temp, "%.256s", title); + } + titleMessage[1] = copyChar (temp); + titleMessage[2] = copyChar ("<#HL(30)>"); + titleWin = newCDKLabel (cdkScreen, CENTER, TOP, + (CDK_CSTRING2)titleMessage, 3, + FALSE, FALSE); + freeCharList (titleMessage, 3); + + /* Allow them to change the install directory. */ + if (sourcePath == 0) + { + sourceEntry = newCDKEntry (cdkScreen, CENTER, 8, + 0, "Source Directory :", + A_NORMAL, '.', vMIXED, + 40, 0, 256, TRUE, FALSE); + } + if (destPath == 0) + { + destEntry = newCDKEntry (cdkScreen, CENTER, 11, + 0, "Destination Directory:", A_NORMAL, + '.', vMIXED, 40, 0, 256, TRUE, FALSE); + } + + /* Get the source install path. */ + if (sourceEntry != 0) + { + drawCDKScreen (cdkScreen); + sourceDir = copyChar (activateCDKEntry (sourceEntry, 0)); + } + else + { + sourceDir = copyChar (sourcePath); + } + + /* Get the destination install path. */ + if (destEntry != 0) + { + drawCDKScreen (cdkScreen); + destDir = copyChar (activateCDKEntry (destEntry, 0)); + } + else + { + destDir = copyChar (destPath); + } + + /* Destroy the path entry fields. */ + if (sourceEntry != 0) + { + destroyCDKEntry (sourceEntry); + } + if (destEntry != 0) + { + destroyCDKEntry (destEntry); + } + + /* + * Verify that the source directory is valid. + */ + if (verifyDirectory (cdkScreen, sourceDir) != 0) + { + /* Clean up and leave. */ + freeChar (destDir); + freeChar (sourceDir); + destroyCDKLabel (titleWin); + destroyCDKScreen (cdkScreen); + endCDK (); + ExitProgram (EXIT_FAILURE); + } + + /* + * Verify that the source directory is valid. + */ + if (verifyDirectory (cdkScreen, destDir) != 0) + { + /* Clean up and leave. */ + freeChar (destDir); + freeChar (sourceDir); + destroyCDKLabel (titleWin); + destroyCDKScreen (cdkScreen); + endCDK (); + ExitProgram (EXIT_FAILURE); + } + + /* Create the histogram. */ + progressBar = newCDKHistogram (cdkScreen, CENTER, 5, + 3, 0, HORIZONTAL, + "Install Progress", + TRUE, FALSE); + + /* Set the top left/right characters of the histogram. */ + setCDKHistogramLLChar (progressBar, ACS_LTEE); + setCDKHistogramLRChar (progressBar, ACS_RTEE); + + /* Set the initial value of the histogram. */ + setCDKHistogram (progressBar, vPERCENT, TOP, A_BOLD, + 1, count, 1, + COLOR_PAIR (24) | A_REVERSE | ' ', + TRUE); + + /* Determine the height of the scrolling window. */ + if (LINES >= 16) + { + sWindowHeight = LINES - 13; + } + else + { + sWindowHeight = 3; + } + + /* Create the scrolling window. */ + installOutput = newCDKSwindow (cdkScreen, CENTER, BOTTOM, + sWindowHeight, 0, + "Install Results", + 2000, TRUE, FALSE); + + /* Set the top left/right characters of the scrolling window. */ + setCDKSwindowULChar (installOutput, ACS_LTEE); + setCDKSwindowURChar (installOutput, ACS_RTEE); + + /* Draw the screen. */ + drawCDKScreen (cdkScreen); + + /* Start copying the files. */ + for (x = 0; x < count; x++) + { + char **files; + int chunks; + + /* + * If the 'file' list file has 2 columns, the first is + * the source filename, the second being the destination + * filename. + */ + files = CDKsplitString (fileList[x], ' '); + chunks = (int)CDKcountStrings ((CDK_CSTRING2)files); + if (chunks == 2) + { + /* Create the correct paths. */ + sprintf (oldPath, "%s/%s", sourceDir, files[0]); + sprintf (newPath, "%s/%s", destDir, files[1]); + } + else + { + /* Create the correct paths. */ + sprintf (oldPath, "%s/%s", sourceDir, fileList[x]); + sprintf (newPath, "%s/%s", destDir, fileList[x]); + } + CDKfreeStrings (files); + + /* Copy the file from the source to the destination. */ + ret = copyFile (cdkScreen, oldPath, newPath); + if (ret == vCanNotOpenSource) + { + sprintf (temp, + "Error: Can not open source file \"%.256s\"", oldPath); + errors++; + } + else if (ret == vCanNotOpenDest) + { + sprintf (temp, + "Error: Can not open destination file \"%.256s\"", newPath); + errors++; + } + else + { + sprintf (temp, "%.256s -> %.256s", oldPath, newPath); + } + + /* Add the message to the scrolling window. */ + addCDKSwindow (installOutput, temp, BOTTOM); + drawCDKSwindow (installOutput, ObjOf (installOutput)->box); + + /* Update the histogram. */ + setCDKHistogram (progressBar, vPERCENT, TOP, A_BOLD, + 1, count, x + 1, + COLOR_PAIR (24) | A_REVERSE | ' ', + TRUE); + + /* Update the screen. */ + drawCDKHistogram (progressBar, TRUE); + } + + /* + * If there were errors, inform the user and allow them to look at the + * errors in the scrolling window. + */ + if (errors != 0) + { + /* Create the information for the dialog box. */ + const char *buttons[] = + { + "Look At Errors Now", + "Save Output To A File", + "Ignore Errors" + }; + mesg[0] = "There were errors in the installation."; + mesg[1] = "If you want, you may scroll through the"; + mesg[2] = "messages of the scrolling window to see"; + mesg[3] = "what the errors were. If you want to save"; + mesg[4] = "the output of the window you may press s"; + mesg[5] = "while in the window, or you may save the output"; + mesg[6] = "of the install now and look at the install"; + mesg[7] = "history at a later date."; + + /* Popup the dialog box. */ + ret = popupDialog (cdkScreen, + (CDK_CSTRING2)mesg, 8, + (CDK_CSTRING2)buttons, 3); + if (ret == 0) + { + activateCDKSwindow (installOutput, 0); + } + else if (ret == 1) + { + (void)injectCDKSwindow (installOutput, 's'); + } + } + else + { + /* + * If they specified the name of an output file, then save the + * results of the installation to that file. + */ + if (output != 0) + { + dumpCDKSwindow (installOutput, output); + } + else + { + /* Ask them if they want to save the output of the scrolling window. */ + if (quiet == FALSE) + { + const char *buttons[] = + { + "No", + "Yes" + }; + mesg[0] = "Do you want to save the output of the"; + mesg[1] = "scrolling window to a file?"; + + if (popupDialog (cdkScreen, + (CDK_CSTRING2)mesg, 2, + (CDK_CSTRING2)buttons, 2) == 1) + { + (void)injectCDKSwindow (installOutput, 's'); + } + } + } + } + + /* Clean up. */ + destroyCDKLabel (titleWin); + destroyCDKHistogram (progressBar); + destroyCDKSwindow (installOutput); + destroyCDKScreen (cdkScreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} + +/* + * This copies a file from one place to another. (tried rename + * library call, but it is equivalent to mv) + */ +static ECopyFile copyFile (CDKSCREEN *cdkScreen GCC_UNUSED, char *src, char *dest) +{ + char command[2000]; + FILE *fd; + + /* Make sure we can open the source file. */ + if ((fd = fopen (src, "r")) == 0) + { + return vCanNotOpenSource; + } + fclose (fd); + + /* + * Remove the destination file first, just in case it already exists. + * This allows us to check if we can write to the desintation file. + */ + sprintf (command, "rm -f %s", dest); + system (command); + + /* Try to open the destination. */ + if ((fd = fopen (dest, "w")) == 0) + { + return vCanNotOpenDest; + } + fclose (fd); + + /* + * Copy the file. There has to be a better way to do this. I + * tried rename and link but they both have the same limitation + * as the 'mv' command that you can not move across partitions. + * Quite limiting in an install binary. + */ + sprintf (command, "rm -f %s; cp %s %s; chmod 444 %s", dest, src, dest, dest); + system (command); + return vOK; +} + +/* + * This makes sure that the directory given exists. If it + * doesn't then it will make it. + * THINK + */ +static int verifyDirectory (CDKSCREEN *cdkScreen, char *directory) +{ + int status = 0; +#if !defined (__MINGW32__) + mode_t dirMode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH; +#endif + struct stat fileStat; + char temp[512]; + + /* Stat the directory. */ + if (lstat (directory, &fileStat) != 0) + { + /* The directory does not exist. */ + if (errno == ENOENT) + { + const char *buttons[] = + { + "Yes", + "No" + }; + const char *mesg[10]; + char *error[10]; + + /* Create the question. */ + mesg[0] = "The directory "; + sprintf (temp, "%.256s", directory); + mesg[1] = temp; + mesg[2] = "Does not exist. Do you want to"; + mesg[3] = "create it?"; + + /* Ask them if they want to create the directory. */ + if (popupDialog (cdkScreen, + (CDK_CSTRING2)mesg, 4, + (CDK_CSTRING2)buttons, 2) == 0) + { + /* Create the directory. */ +#if defined (__MINGW32__) + if (mkdir (directory) != 0) +#else + if (mkdir (directory, dirMode) != 0) +#endif + { + /* Create the error message. */ + error[0] = copyChar ("Could not create the directory"); + sprintf (temp, "%.256s", directory); + error[1] = copyChar (temp); + +#ifdef HAVE_STRERROR + sprintf (temp, "%.256s", strerror (errno)); +#else + sprintf (temp, "Check the permissions and try again."); +#endif + error[2] = copyChar (temp); + + /* Pop up the error message. */ + popupLabel (cdkScreen, (CDK_CSTRING2)error, 3); + + freeCharList (error, 3); + status = -1; + } + } + else + { + /* Create the message. */ + error[0] = copyChar ("Installation aborted."); + + /* Pop up the error message. */ + popupLabel (cdkScreen, (CDK_CSTRING2)error, 1); + + freeCharList (error, 1); + status = -1; + } + } + } + return status; +} diff --git a/deps/cdk-5.0-20161210/dialog.c b/deps/cdk-5.0-20161210/dialog.c new file mode 100644 index 0000000..6153ba6 --- /dev/null +++ b/deps/cdk-5.0-20161210/dialog.c @@ -0,0 +1,563 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 19:02:55 $ + * $Revision: 1.102 $ + */ + +DeclareCDKObjects (DIALOG, Dialog, setCdk, Int); + +/* + * This function creates a dialog widget. + */ +CDKDIALOG *newCDKDialog (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + CDK_CSTRING2 mesg, + int rows, + CDK_CSTRING2 buttonLabel, + int buttonCount, + chtype highlight, + boolean separator, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKDIALOG *dialog = 0; + int boxHeight; + int boxWidth = MIN_DIALOG_WIDTH; + int maxmessagewidth = -1; + int buttonwidth = 0; + int xpos = xplace; + int ypos = yplace; + int temp = 0; + int buttonadj = 0; + int x = 0; + + if (rows <= 0 + || buttonCount <= 0 + || (dialog = newCDKObject (CDKDIALOG, &my_funcs)) == 0 + || (dialog->info = typeCallocN (chtype *, rows + 1)) == 0 + || (dialog->infoLen = typeCallocN (int, rows + 1)) == 0 + || (dialog->infoPos = typeCallocN (int, rows + 1)) == 0 + || (dialog->buttonLabel = typeCallocN (chtype *, buttonCount + 1)) == 0 + || (dialog->buttonLen = typeCallocN (int, buttonCount + 1)) == 0 + || (dialog->buttonPos = typeCallocN (int, buttonCount + 1)) == 0) + { + destroyCDKObject (dialog); + return (0); + } + + setCDKDialogBox (dialog, Box); + boxHeight = rows + 2 * BorderOf (dialog) + separator + 1; + + /* Translate the char * message to a chtype * */ + for (x = 0; x < rows; x++) + { + dialog->info[x] = char2Chtype (mesg[x], + &dialog->infoLen[x], + &dialog->infoPos[x]); + maxmessagewidth = MAXIMUM (maxmessagewidth, dialog->infoLen[x]); + } + + /* Translate the button label char * to a chtype * */ + for (x = 0; x < buttonCount; x++) + { + /* *INDENT-EQLS* */ + dialog->buttonLabel[x] = char2Chtype (buttonLabel[x], + &dialog->buttonLen[x], + &temp); + buttonwidth += dialog->buttonLen[x] + 1; + } + buttonwidth--; + + /* Determine the final dimensions of the box. */ + boxWidth = MAXIMUM (boxWidth, maxmessagewidth); + boxWidth = MAXIMUM (boxWidth, buttonwidth); + boxWidth = boxWidth + 2 + 2 * BorderOf (dialog); + + /* Now we have to readjust the x and y positions. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* *INDENT-EQLS* Set up the dialog box attributes. */ + ScreenOf (dialog) = cdkscreen; + dialog->parent = cdkscreen->window; + dialog->win = newwin (boxHeight, boxWidth, ypos, xpos); + dialog->shadowWin = 0; + dialog->buttonCount = buttonCount; + dialog->currentButton = 0; + dialog->messageRows = rows; + dialog->boxHeight = boxHeight; + dialog->boxWidth = boxWidth; + dialog->highlight = highlight; + dialog->separator = separator; + initExitType (dialog); + ObjOf (dialog)->acceptsFocus = TRUE; + ObjOf (dialog)->inputWindow = dialog->win; + dialog->shadow = shadow; + + /* If we couldn't create the window, we should return a null value. */ + if (dialog->win == 0) + { + destroyCDKObject (dialog); + return (0); + } + keypad (dialog->win, TRUE); + + /* Find the button positions. */ + buttonadj = ((int)((boxWidth - buttonwidth) / 2)); + for (x = 0; x < buttonCount; x++) + { + dialog->buttonPos[x] = buttonadj; + buttonadj = buttonadj + dialog->buttonLen[x] + BorderOf (dialog); + } + + /* Create the string alignments. */ + for (x = 0; x < rows; x++) + { + dialog->infoPos[x] = justifyString (boxWidth - 2 * BorderOf (dialog), + dialog->infoLen[x], + dialog->infoPos[x]); + } + + /* Was there a shadow? */ + if (shadow) + { + dialog->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Register this baby. */ + registerCDKObject (cdkscreen, vDIALOG, dialog); + + /* Return the dialog box pointer. */ + return (dialog); +} + +/* + * This lets the user select the button. + */ +int activateCDKDialog (CDKDIALOG *dialog, chtype *actions) +{ + chtype input = 0; + boolean functionKey; + int ret; + + /* Draw the dialog box. */ + drawCDKDialog (dialog, ObjOf (dialog)->box); + + /* Lets move to the first button. */ + writeChtypeAttrib (dialog->win, + dialog->buttonPos[dialog->currentButton], + dialog->boxHeight - 1 - BorderOf (dialog), + dialog->buttonLabel[dialog->currentButton], + dialog->highlight, + HORIZONTAL, + 0, dialog->buttonLen[dialog->currentButton]); + wrefresh (dialog->win); + + if (actions == 0) + { + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (dialog), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKDialog (dialog, input); + if (dialog->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKDialog (dialog, actions[x]); + if (dialog->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and exit. */ + setExitType (dialog, 0); + return -1; +} + +/* + * This injects a single character into the dialog widget. + */ +static int _injectCDKDialog (CDKOBJS *object, chtype input) +{ + /* *INDENT-EQLS* */ + CDKDIALOG *widget = (CDKDIALOG *)object; + int lastButton = widget->buttonCount - 1; + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + ppReturn = PreProcessFuncOf (widget) (vDIALOG, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a key binding. */ + if (checkCDKObjectBind (vDIALOG, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + int firstButton = 0; + + switch (input) + { + case KEY_LEFT: + case KEY_BTAB: + case KEY_BACKSPACE: + if (widget->currentButton == firstButton) + { + widget->currentButton = lastButton;; + } + else + { + widget->currentButton--; + } + break; + + case KEY_RIGHT: + case KEY_TAB: + case SPACE: + if (widget->currentButton == lastButton) + { + widget->currentButton = firstButton; + } + else + { + widget->currentButton++; + } + break; + + case KEY_UP: + case KEY_DOWN: + Beep (); + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ENTER: + setExitType (widget, input); + ret = widget->currentButton; + complete = TRUE; + break; + + default: + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vDIALOG, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKDialogButtons (widget); + wrefresh (widget->win); + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * This moves the dialog field to the given location. + */ +static void _moveCDKDialog (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKDIALOG *dialog = (CDKDIALOG *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (dialog->win); + int currentY = getbegy (dialog->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (dialog->win) + xplace; + ypos = getbegy (dialog->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (dialog), &xpos, &ypos, dialog->boxWidth, dialog->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (dialog->win, -xdiff, -ydiff); + moveCursesWindow (dialog->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (dialog)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKDialog (dialog, ObjOf (dialog)->box); + } +} + +/* + * This function draws the dialog widget. + */ +static void _drawCDKDialog (CDKOBJS *object, boolean Box) +{ + CDKDIALOG *dialog = (CDKDIALOG *)object; + int x = 0; + + /* Is there a shadow? */ + if (dialog->shadowWin != 0) + { + drawShadow (dialog->shadowWin); + } + + /* Box the widget if they asked. */ + if (Box) + { + drawObjBox (dialog->win, ObjOf (dialog)); + } + + /* Draw in the message. */ + for (x = 0; x < dialog->messageRows; x++) + { + writeChtype (dialog->win, + dialog->infoPos[x] + BorderOf (dialog), x + BorderOf (dialog), + dialog->info[x], + HORIZONTAL, 0, + dialog->infoLen[x]); + } + + /* Draw in the buttons. */ + drawCDKDialogButtons (dialog); + + wrefresh (dialog->win); +} + +/* + * This function destroys the dialog widget. + */ +static void _destroyCDKDialog (CDKOBJS *object) +{ + if (object != 0) + { + CDKDIALOG *dialog = (CDKDIALOG *)object; + + CDKfreeChtypes (dialog->info); + freeChecked (dialog->infoLen); + freeChecked (dialog->infoPos); + + CDKfreeChtypes (dialog->buttonLabel); + freeChecked (dialog->buttonLen); + freeChecked (dialog->buttonPos); + + /* Clean up the windows. */ + deleteCursesWindow (dialog->win); + deleteCursesWindow (dialog->shadowWin); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vDIALOG, dialog); + + /* Unregister this object. */ + unregisterCDKObject (vDIALOG, dialog); + } +} + +/* + * This function erases the dialog widget from the screen. + */ +static void _eraseCDKDialog (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKDIALOG *dialog = (CDKDIALOG *)object; + + eraseCursesWindow (dialog->win); + eraseCursesWindow (dialog->shadowWin); + } +} + +/* + * This sets attributes of the dialog box. + */ +void setCDKDialog (CDKDIALOG *dialog, chtype highlight, boolean separator, boolean Box) +{ + setCDKDialogHighlight (dialog, highlight); + setCDKDialogSeparator (dialog, separator); + setCDKDialogBox (dialog, Box); +} + +/* + * This sets the highlight attribute for the buttons. + */ +void setCDKDialogHighlight (CDKDIALOG *dialog, chtype highlight) +{ + dialog->highlight = highlight; +} +chtype getCDKDialogHighlight (CDKDIALOG *dialog) +{ + return dialog->highlight; +} + +/* + * This sets whether or not the dialog box will have a separator line. + */ +void setCDKDialogSeparator (CDKDIALOG *dialog, boolean separator) +{ + dialog->separator = separator; +} +boolean getCDKDialogSeparator (CDKDIALOG *dialog) +{ + return dialog->separator; +} + +/* + * This sets the box attribute of the widget. + */ +void setCDKDialogBox (CDKDIALOG *dialog, boolean Box) +{ + ObjOf (dialog)->box = Box; + ObjOf (dialog)->borderSize = Box ? 1 : 0; +} +boolean getCDKDialogBox (CDKDIALOG *dialog) +{ + return ObjOf (dialog)->box; +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrDialog (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKDIALOG *widget = (CDKDIALOG *)object; + + wbkgd (widget->win, attrib); + } +} + +/* + * This draws the dialog buttons and the separation line. + */ +void drawCDKDialogButtons (CDKDIALOG *dialog) +{ + int x; + + for (x = 0; x < dialog->buttonCount; x++) + { + writeChtype (dialog->win, + dialog->buttonPos[x], + dialog->boxHeight - 1 - BorderOf (dialog), + dialog->buttonLabel[x], + HORIZONTAL, 0, + dialog->buttonLen[x]); + } + + /* Draw the separation line. */ + if (dialog->separator) + { + chtype boxattr = BXAttrOf (dialog); + + for (x = 1; x < dialog->boxWidth - 1; x++) + { + (void)mvwaddch (dialog->win, + dialog->boxHeight - 2 - BorderOf (dialog), + x, + ACS_HLINE | boxattr); + } + (void)mvwaddch (dialog->win, + dialog->boxHeight - 2 - BorderOf (dialog), + 0, + ACS_LTEE | boxattr); + (void)mvwaddch (dialog->win, + dialog->boxHeight - 2 - BorderOf (dialog), + getmaxx (dialog->win) - 1, + ACS_RTEE | boxattr); + } + writeChtypeAttrib (dialog->win, + dialog->buttonPos[dialog->currentButton], + dialog->boxHeight - 1 - BorderOf (dialog), + dialog->buttonLabel[dialog->currentButton], + dialog->highlight, + HORIZONTAL, 0, + dialog->buttonLen[dialog->currentButton]); + +} + +static void _focusCDKDialog (CDKOBJS *object) +{ + CDKDIALOG *widget = (CDKDIALOG *)object; + + drawCDKDialog (widget, ObjOf (widget)->box); +} + +static void _unfocusCDKDialog (CDKOBJS *object) +{ + CDKDIALOG *widget = (CDKDIALOG *)object; + + drawCDKDialog (widget, ObjOf (widget)->box); +} + +dummyRefreshData (Dialog) + +dummySaveData (Dialog) diff --git a/deps/cdk-5.0-20161210/draw.c b/deps/cdk-5.0-20161210/draw.c new file mode 100644 index 0000000..2f156c8 --- /dev/null +++ b/deps/cdk-5.0-20161210/draw.c @@ -0,0 +1,360 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/12/04 19:43:46 $ + * $Revision: 1.62 $ + */ + +/* + * This sets up a basic set of color pairs. These can be redefined + * if wanted... + */ +void initCDKColor (void) +{ +#ifdef HAVE_START_COLOR + if (has_colors ()) + { + int color[] = + { + COLOR_WHITE, COLOR_RED, COLOR_GREEN, + COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, + COLOR_CYAN, COLOR_BLACK + }; + int pair = 1; + int fg, bg; + int limit; + + start_color (); + + limit = (COLORS < MAX_COLORS) ? COLORS : MAX_COLORS; + + /* Create the color pairs. */ + for (fg = 0; fg < limit; fg++) + { + for (bg = 0; bg < limit; bg++) + { + init_pair ((short)pair++, (short)color[fg], (short)color[bg]); + } + } + } +#endif +} + +/* + * This prints out a box around a window with attributes + */ +void boxWindow (WINDOW *window, chtype attr) +{ + /* *INDENT-EQLS* */ + int tlx = 0; + int tly = 0; + int brx = getmaxx (window) - 1; + int bry = getmaxy (window) - 1; + + /* Draw horizontal lines. */ + (void)mvwhline (window, tly, 0, ACS_HLINE | attr, getmaxx (window)); + (void)mvwhline (window, bry, 0, ACS_HLINE | attr, getmaxx (window)); + + /* Draw vertical lines. */ + (void)mvwvline (window, 0, tlx, ACS_VLINE | attr, getmaxy (window)); + (void)mvwvline (window, 0, brx, ACS_VLINE | attr, getmaxy (window)); + + /* Draw in the corners. */ + (void)mvwaddch (window, tly, tlx, ACS_ULCORNER | attr); + (void)mvwaddch (window, tly, brx, ACS_URCORNER | attr); + (void)mvwaddch (window, bry, tlx, ACS_LLCORNER | attr); + (void)mvwaddch (window, bry, brx, ACS_LRCORNER | attr); + (void)wrefresh (window); +} + +/* + * This draws a box with attributes and lets the user define + * each element of the box. + */ +void attrbox (WINDOW *win, + chtype tlc, + chtype trc, + chtype blc, + chtype brc, + chtype horz, + chtype vert, + chtype attr) +{ + /* *INDENT-EQLS* */ + int x1 = 0; + int y1 = 0; + int y2 = getmaxy (win) - 1; + int x2 = getmaxx (win) - 1; + int count = 0; + + /* Draw horizontal lines. */ + if (horz != 0) + { + (void)mvwhline (win, y1, 0, horz | attr, getmaxx (win)); + (void)mvwhline (win, y2, 0, horz | attr, getmaxx (win)); + count++; + } + + /* Draw vertical lines. */ + if (vert != 0) + { + (void)mvwvline (win, 0, x1, vert | attr, getmaxy (win)); + (void)mvwvline (win, 0, x2, vert | attr, getmaxy (win)); + count++; + } + + /* Draw in the corners. */ + if (tlc != 0) + { + (void)mvwaddch (win, y1, x1, tlc | attr); + count++; + } + if (trc != 0) + { + (void)mvwaddch (win, y1, x2, trc | attr); + count++; + } + if (blc != 0) + { + (void)mvwaddch (win, y2, x1, blc | attr); + count++; + } + if (brc != 0) + { + (void)mvwaddch (win, y2, x2, brc | attr); + count++; + } + if (count != 0) + { + wrefresh (win); + } +} + +/* + * Draw a box around the given window using the object's defined line-drawing + * characters. + */ +void drawObjBox (WINDOW *win, CDKOBJS *object) +{ + attrbox (win, + object->ULChar, + object->URChar, + object->LLChar, + object->LRChar, + object->HZChar, + object->VTChar, + object->BXAttr); +} + +/* + * This draws a line on the given window. (odd angle lines not working yet) + */ +void drawLine (WINDOW *window, int startx, int starty, int endx, int endy, chtype line) +{ + /* *INDENT-EQLS* */ + int xdiff = endx - startx; + int ydiff = endy - starty; + int x = 0; + int y = 0; + + /* Determine if we are drawing a horizontal or vertical line. */ + if (ydiff == 0) + { + if (xdiff > 0) + (void)mvwhline (window, starty, startx, line, xdiff); + } + else if (xdiff == 0) + { + if (ydiff > 0) + (void)mvwvline (window, starty, startx, line, ydiff); + } + else + { + /* We need to determine the angle of the line. */ + /* *INDENT-EQLS* */ + int height = xdiff; + int width = ydiff; + int xratio = (height > width ? 1 : (width / height)); + int yratio = (width > height ? (width / height) : 1); + int xadj = 0; + int yadj = 0; + + /* Set the vars. */ + x = startx; + y = starty; + while (x != endx && y != endy) + { + /* Add the char to the window. */ + (void)mvwaddch (window, y, x, line); + + /* Make the x and y adjustments. */ + if (xadj != xratio) + { + x = (xdiff < 0 ? x - 1 : x + 1); + xadj++; + } + else + { + xadj = 0; + } + if (yadj != yratio) + { + y = (ydiff < 0 ? y - 1 : y + 1); + yadj++; + } + else + { + yadj = 0; + } + } + } +} + +/* + * This draws a shadow around a window. + */ +void drawShadow (WINDOW *shadowWin) +{ + if (shadowWin != 0) + { + int x_hi = getmaxx (shadowWin) - 1; + int y_hi = getmaxy (shadowWin) - 1; + + /* Draw the line on the bottom. */ + (void)mvwhline (shadowWin, y_hi, 1, ACS_HLINE | A_DIM, x_hi); + + /* Draw the line on the right. */ + (void)mvwvline (shadowWin, 0, x_hi, ACS_VLINE | A_DIM, y_hi); + + (void)mvwaddch (shadowWin, 0, x_hi, ACS_URCORNER | A_DIM); + (void)mvwaddch (shadowWin, y_hi, 0, ACS_LLCORNER | A_DIM); + (void)mvwaddch (shadowWin, y_hi, x_hi, ACS_LRCORNER | A_DIM); + wrefresh (shadowWin); + } +} + +/* + * Write a string of blanks, using writeChar(). + */ +void writeBlanks (WINDOW *window, int xpos, int ypos, int align, int start, int end) +{ + if (start < end) + { + unsigned want = (unsigned)(end - start) + 1000; + char *blanks = (char *)malloc (want); + + if (blanks != 0) + { + cleanChar (blanks, (int)(want - 1), ' '); + writeChar (window, xpos, ypos, blanks, align, start, end); + freeChar (blanks); + } + } +} + +/* + * This writes out a char * string with no attributes. + */ +void writeChar (WINDOW *window, + int xpos, + int ypos, + char *string, + int align, + int start, + int end) +{ + writeCharAttrib (window, xpos, ypos, string, A_NORMAL, align, start, end); +} + +/* + * This writes out a char * string with attributes. + */ +void writeCharAttrib (WINDOW *window, + int xpos, + int ypos, + char *string, + chtype attr, + int align, + int start, + int end) +{ + int display = end - start; + int x; + + if (align == HORIZONTAL) + { + /* Draw the message on a horizontal axis. */ + display = MINIMUM (display, getmaxx (window) - 1); + for (x = 0; x < display; x++) + { + (void)mvwaddch (window, + ypos, + xpos + x, + CharOf (string[x + start]) | attr); + } + } + else + { + /* Draw the message on a vertical axis. */ + display = MINIMUM (display, getmaxy (window) - 1); + for (x = 0; x < display; x++) + { + (void)mvwaddch (window, + ypos + x, + xpos, + CharOf (string[x + start]) | attr); + } + } +} + +/* + * This writes out a chtype * string. + */ +void writeChtype (WINDOW *window, + int xpos, + int ypos, + chtype *string, + int align, + int start, + int end) +{ + writeChtypeAttrib (window, xpos, ypos, string, A_NORMAL, align, start, end); +} + +/* + * This writes out a chtype * string * with the given attributes added. + */ +void writeChtypeAttrib (WINDOW *window, + int xpos, + int ypos, + chtype *string, + chtype attr, + int align, + int start, + int end) +{ + /* *INDENT-EQLS* */ + int diff = end - start; + int display = 0; + int x = 0; + + if (align == HORIZONTAL) + { + /* Draw the message on a horizontal axis. */ + display = MINIMUM (diff, getmaxx (window) - xpos); + for (x = 0; x < display; x++) + { + (void)mvwaddch (window, ypos, xpos + x, string[x + start] | attr); + } + } + else + { + /* Draw the message on a vertical axis. */ + display = MINIMUM (diff, getmaxy (window) - ypos); + for (x = 0; x < display; x++) + { + (void)mvwaddch (window, ypos + x, xpos, string[x + start] | attr); + } + } +} diff --git a/deps/cdk-5.0-20161210/entry.c b/deps/cdk-5.0-20161210/entry.c new file mode 100644 index 0000000..9bfba76 --- /dev/null +++ b/deps/cdk-5.0-20161210/entry.c @@ -0,0 +1,961 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 19:04:57 $ + * $Revision: 1.224 $ + */ + +/* + * Declare file local prototypes. + */ +static void CDKEntryCallBack (CDKENTRY *entry, chtype character); +static void drawCDKEntryField (CDKENTRY *entry); + +DeclareCDKObjects (ENTRY, Entry, setCdk, String); + +/* + * This creates a pointer to an entry widget. + */ +CDKENTRY *newCDKEntry (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + const char *title, + const char *label, + chtype fieldAttr, + chtype filler, + EDisplayType dispType, + int fWidth, + int min, + int max, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKENTRY *entry = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int fieldWidth = fWidth; + int boxWidth = 0; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int junk = 0; + int horizontalAdjust, oldWidth; + + if ((entry = newCDKObject (CDKENTRY, &my_funcs)) == 0) + return (0); + + setCDKEntryBox (entry, Box); + boxHeight = (BorderOf (entry) * 2) + 1; + + /* + * If the fieldWidth is a negative value, the fieldWidth will + * be COLS-fieldWidth, otherwise, the fieldWidth will be the + * given width. + */ + fieldWidth = setWidgetDimension (parentWidth, fieldWidth, 0); + boxWidth = fieldWidth + 2 * BorderOf (entry); + + /* Set some basic values of the entry field. */ + entry->label = 0; + entry->labelLen = 0; + entry->labelWin = 0; + + /* Translate the label char *pointer to a chtype pointer. */ + if (label != 0) + { + entry->label = char2Chtype (label, &entry->labelLen, &junk); + boxWidth += entry->labelLen; + } + + oldWidth = boxWidth; + boxWidth = setCdkTitle (ObjOf (entry), title, boxWidth); + horizontalAdjust = (boxWidth - oldWidth) / 2; + + boxHeight += TitleLinesOf (entry); + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = MINIMUM (boxWidth, parentWidth); + boxHeight = MINIMUM (boxHeight, parentHeight); + fieldWidth = MINIMUM (fieldWidth, + boxWidth - entry->labelLen - 2 * BorderOf (entry)); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the label window. */ + entry->win = newwin (boxHeight, boxWidth, ypos, xpos); + if (entry->win == 0) + { + destroyCDKObject (entry); + return (0); + } + keypad (entry->win, TRUE); + + /* Make the field window. */ + entry->fieldWin = subwin (entry->win, 1, fieldWidth, + (ypos + TitleLinesOf (entry) + BorderOf (entry)), + (xpos + entry->labelLen + + horizontalAdjust + + BorderOf (entry))); + if (entry->fieldWin == 0) + { + destroyCDKObject (entry); + return (0); + } + keypad (entry->fieldWin, TRUE); + + /* Make the label win, if we need to. */ + if (label != 0) + { + entry->labelWin = subwin (entry->win, 1, entry->labelLen, + ypos + TitleLinesOf (entry) + BorderOf (entry), + xpos + horizontalAdjust + BorderOf (entry)); + } + + /* Make room for the info char * pointer. */ + entry->info = typeMallocN (char, max + 3); + if (entry->info == 0) + { + destroyCDKObject (entry); + return (0); + } + cleanChar (entry->info, max + 3, '\0'); + entry->infoWidth = max + 3; + + /* *INDENT-EQLS* Set up the rest of the structure. */ + ScreenOf (entry) = cdkscreen; + entry->parent = cdkscreen->window; + entry->shadowWin = 0; + entry->fieldAttr = fieldAttr; + entry->fieldWidth = fieldWidth; + entry->filler = filler; + entry->hidden = filler; + ObjOf (entry)->inputWindow = entry->fieldWin; + ObjOf (entry)->acceptsFocus = TRUE; + ReturnOf (entry) = NULL; + entry->shadow = shadow; + entry->screenCol = 0; + entry->leftChar = 0; + entry->min = min; + entry->max = max; + entry->boxWidth = boxWidth; + entry->boxHeight = boxHeight; + initExitType (entry); + entry->dispType = dispType; + entry->callbackfn = CDKEntryCallBack; + + /* Do we want a shadow? */ + if (shadow) + { + entry->shadowWin = newwin ( + boxHeight, + boxWidth, + ypos + 1, + xpos + 1); + } + + registerCDKObject (cdkscreen, vENTRY, entry); + + return (entry); +} + +/* + * This means you want to use the given entry field. It takes input + * from the keyboard, and when its done, it fills the entry info + * element of the structure with what was typed. + */ +char *activateCDKEntry (CDKENTRY *entry, chtype *actions) +{ + chtype input = 0; + boolean functionKey; + char *ret = 0; + + /* Draw the widget. */ + drawCDKEntry (entry, ObjOf (entry)->box); + + if (actions == 0) + { + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (entry), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKEntry (entry, input); + if (entry->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKEntry (entry, actions[x]); + if (entry->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Make sure we return the correct info. */ + if (entry->exitType == vNORMAL) + { + return entry->info; + } + else + { + return 0; + } +} + +static void setPositionToEnd (CDKENTRY *entry) +{ + int stringLen; + + stringLen = (int)strlen (entry->info); + if (stringLen >= entry->fieldWidth) + { + if (stringLen < entry->max) + { + int charCount = entry->fieldWidth - 1; + entry->leftChar = stringLen - charCount; + entry->screenCol = charCount; + } + else + { + entry->leftChar = stringLen - entry->fieldWidth; + entry->screenCol = stringLen - 1; + } + } + else + { + entry->leftChar = 0; + entry->screenCol = stringLen; + } +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKEntry (CDKOBJS *object, chtype input) +{ + CDKENTRY *widget = (CDKENTRY *)object; + int ppReturn = 1; + char *ret = unknownString; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Refresh the widget field. */ + drawCDKEntryField (widget); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + ppReturn = PreProcessFuncOf (widget) (vENTRY, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check a predefined binding... */ + if (checkCDKObjectBind (vENTRY, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + int infoLength = (int)strlen (widget->info); + int currPos = widget->screenCol + widget->leftChar; + + switch (input) + { + case KEY_UP: + case KEY_DOWN: + Beep (); + break; + + case KEY_HOME: + widget->leftChar = 0; + widget->screenCol = 0; + drawCDKEntryField (widget); + break; + + case CDK_TRANSPOSE: + if (currPos >= infoLength - 1) + { + Beep (); + } + else + { + char holder = widget->info[currPos]; + widget->info[currPos] = widget->info[currPos + 1]; + widget->info[currPos + 1] = holder; + drawCDKEntryField (widget); + } + break; + + case KEY_END: + setPositionToEnd (widget); + drawCDKEntryField (widget); + break; + + case KEY_LEFT: + if (currPos <= 0) + { + Beep (); + } + else if (widget->screenCol == 0) + { + /* Scroll left. */ + widget->leftChar--; + drawCDKEntryField (widget); + } + else + { + wmove (widget->fieldWin, 0, --widget->screenCol); + } + break; + + case KEY_RIGHT: + if (currPos >= infoLength) + { + Beep (); + } + else if (widget->screenCol == widget->fieldWidth - 1) + { + /* Scroll to the right. */ + widget->leftChar++; + drawCDKEntryField (widget); + } + else + { + /* Move right. */ + wmove (widget->fieldWin, 0, ++widget->screenCol); + } + break; + + case KEY_BACKSPACE: + case KEY_DC: + if (widget->dispType == vVIEWONLY) + { + Beep (); + } + else + { + bool success = FALSE; + + if (input == KEY_BACKSPACE) + --currPos; + + if (currPos >= 0 && infoLength > 0) + { + if (currPos < infoLength) + { + int x; + + for (x = currPos; x < infoLength; x++) + { + widget->info[x] = widget->info[x + 1]; + } + success = TRUE; + } + else if (input == KEY_BACKSPACE) + { + widget->info[infoLength - 1] = '\0'; + success = TRUE; + } + } + + if (success) + { + if (input == KEY_BACKSPACE) + { + if (widget->screenCol > 0) + widget->screenCol--; + else + widget->leftChar--; + } + + drawCDKEntryField (widget); + } + else + { + Beep (); + } + } + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_ERASE: + if (infoLength != 0) + { + cleanCDKEntry (widget); + drawCDKEntryField (widget); + } + break; + + case CDK_CUT: + if (infoLength != 0) + { + freeChar (GPasteBuffer); + GPasteBuffer = copyChar (widget->info); + cleanCDKEntry (widget); + drawCDKEntryField (widget); + } + else + { + Beep (); + } + break; + + case CDK_COPY: + if (infoLength != 0) + { + freeChar (GPasteBuffer); + GPasteBuffer = copyChar (widget->info); + } + else + { + Beep (); + } + break; + + case CDK_PASTE: + if (GPasteBuffer != 0) + { + setCDKEntryValue (widget, GPasteBuffer); + drawCDKEntryField (widget); + } + else + { + Beep (); + } + break; + + case KEY_TAB: + case KEY_ENTER: + if (infoLength >= widget->min) + { + setExitType (widget, input); + ret = (widget->info); + complete = TRUE; + } + else + { + Beep (); + } + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + (widget->callbackfn) (widget, input); + break; + } + } + + /* Should we do a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vENTRY, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + setExitType (widget, 0); + + ResultOf (widget).valueString = ret; + return (ret != unknownString); +} + +/* + * This moves the entry field to the given location. + */ +static void _moveCDKEntry (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + /* *INDENT-EQLS* */ + CDKENTRY *entry = (CDKENTRY *)object; + int currentX = getbegx (entry->win); + int currentY = getbegy (entry->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (entry->win) + xplace; + ypos = getbegy (entry->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (entry), &xpos, &ypos, entry->boxWidth, entry->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (entry->win, -xdiff, -ydiff); + moveCursesWindow (entry->fieldWin, -xdiff, -ydiff); + moveCursesWindow (entry->labelWin, -xdiff, -ydiff); + moveCursesWindow (entry->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (entry)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKEntry (entry, ObjOf (entry)->box); + } +} + +/* + * This is a generic character parser for the entry field. It is used as a + * callback function, so any personal modifications can be made by creating + * a new function and calling the activation with its name. + */ +static void CDKEntryCallBack (CDKENTRY *entry, chtype character) +{ + int plainchar = filterByDisplayType (entry->dispType, character); + + if (plainchar == ERR || + ((int)strlen (entry->info) >= entry->max)) + { + Beep (); + } + else + { + /* Update the screen and pointer. */ + if (entry->screenCol != entry->fieldWidth - 1) + { + int x; + + for (x = (int)strlen (entry->info); + x > (entry->screenCol + entry->leftChar); + x--) + { + entry->info[x] = entry->info[x - 1]; + } + entry->info[entry->screenCol + entry->leftChar] = (char)plainchar; + entry->screenCol++; + } + else + { + /* Update the character pointer. */ + size_t temp = strlen (entry->info); + entry->info[temp] = (char)plainchar; + entry->info[temp + 1] = '\0'; + /* Do not update the pointer if it's the last character */ + if ((int)(temp + 1) < entry->max) + entry->leftChar++; + } + + /* Update the entry field. */ + drawCDKEntryField (entry); + } +} + +/* + * This erases the information in the entry field + * and redraws a clean and empty entry field. + */ +void cleanCDKEntry (CDKENTRY *entry) +{ + int width = entry->fieldWidth; + + /* Erase the information in the character pointer. */ + cleanChar (entry->info, entry->infoWidth, '\0'); + + /* Clean the entry screen field. */ + (void)mvwhline (entry->fieldWin, 0, 0, entry->filler, width); + + /* Reset some variables. */ + entry->screenCol = 0; + entry->leftChar = 0; + + /* Refresh the entry field. */ + wrefresh (entry->fieldWin); +} + +/* + * This draws the entry field. + */ +static void _drawCDKEntry (CDKOBJS *object, boolean Box) +{ + CDKENTRY *entry = (CDKENTRY *)object; + + /* Did we ask for a shadow? */ + if (entry->shadowWin != 0) + { + drawShadow (entry->shadowWin); + } + + /* Box the widget if asked. */ + if (Box) + { + drawObjBox (entry->win, ObjOf (entry)); + } + + drawCdkTitle (entry->win, object); + + wrefresh (entry->win); + + /* Draw in the label to the widget. */ + if (entry->labelWin != 0) + { + writeChtype (entry->labelWin, 0, 0, entry->label, HORIZONTAL, 0, entry->labelLen); + wrefresh (entry->labelWin); + } + + drawCDKEntryField (entry); +} + +/* + * This redraws the entry field. + */ +static void drawCDKEntryField (CDKENTRY *entry) +{ + int x = 0; + + /* Set background color and attributes of the entry field */ + wbkgd (entry->fieldWin, entry->fieldAttr); + + /* Draw in the filler characters. */ + (void)mvwhline (entry->fieldWin, 0, x, entry->filler | entry->fieldAttr, entry->fieldWidth); + + /* If there is information in the field. Then draw it in. */ + if (entry->info != 0) + { + int infoLength = (int)strlen (entry->info); + + /* Redraw the field. */ + if (isHiddenDisplayType (entry->dispType)) + { + for (x = entry->leftChar; x < infoLength; x++) + { + (void)mvwaddch (entry->fieldWin, 0, x - entry->leftChar, + entry->hidden | entry->fieldAttr); + } + } + else + { + for (x = entry->leftChar; x < infoLength; x++) + { + (void)mvwaddch (entry->fieldWin, 0, x - entry->leftChar, + CharOf (entry->info[x]) | entry->fieldAttr); + } + } + wmove (entry->fieldWin, 0, entry->screenCol); + } + + wrefresh (entry->fieldWin); +} + +/* + * This erases an entry widget from the screen. + */ +static void _eraseCDKEntry (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKENTRY *entry = (CDKENTRY *)object; + + eraseCursesWindow (entry->fieldWin); + eraseCursesWindow (entry->labelWin); + eraseCursesWindow (entry->win); + eraseCursesWindow (entry->shadowWin); + } +} + +/* + * This destroys an entry widget. + */ +static void _destroyCDKEntry (CDKOBJS *object) +{ + if (object != 0) + { + CDKENTRY *entry = (CDKENTRY *)object; + + cleanCdkTitle (object); + freeChtype (entry->label); + freeChar (entry->info); + + /* Delete the windows. */ + deleteCursesWindow (entry->fieldWin); + deleteCursesWindow (entry->labelWin); + deleteCursesWindow (entry->shadowWin); + deleteCursesWindow (entry->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vENTRY, entry); + + /* Unregister this object. */ + unregisterCDKObject (vENTRY, entry); + } +} + +/* + * This sets specific attributes of the entry field. + */ +void setCDKEntry (CDKENTRY *entry, + const char *value, + int min, + int max, + boolean Box GCC_UNUSED) +{ + setCDKEntryValue (entry, value); + setCDKEntryMin (entry, min); + setCDKEntryMax (entry, max); +} + +/* + * This removes the old information in the entry field and keeps the + * new information given. + */ +void setCDKEntryValue (CDKENTRY *entry, const char *newValue) +{ + /* If the pointer sent in is the same pointer as before, do nothing. */ + if (entry->info != newValue) + { + /* Just to be sure, if lets make sure the new value isn't null. */ + if (newValue == 0) + { + /* Then we want to just erase the old value. */ + cleanChar (entry->info, entry->infoWidth, '\0'); + + /* Set the pointers back to zero. */ + entry->leftChar = 0; + entry->screenCol = 0; + } + else + { + /* Determine how many characters we need to copy. */ + int copychars = MINIMUM ((int)strlen (newValue), entry->max); + + /* OK, erase the old value, and copy in the new value. */ + cleanChar (entry->info, entry->max, '\0'); + strncpy (entry->info, newValue, (unsigned)copychars); + + setPositionToEnd (entry); + } + } +} +char *getCDKEntryValue (CDKENTRY *entry) +{ + return entry->info; +} + +/* + * This sets the maximum length of the string that will be accepted. + */ +void setCDKEntryMax (CDKENTRY *entry, int max) +{ + entry->max = max; +} +int getCDKEntryMax (CDKENTRY *entry) +{ + return entry->max; +} + +/* + * This sets the minimum length of the string that will + * be accepted. + */ +void setCDKEntryMin (CDKENTRY *entry, int min) +{ + entry->min = min; +} +int getCDKEntryMin (CDKENTRY *entry) +{ + return entry->min; +} + +/* + * This sets the filler character to be used in the entry field. + */ +void setCDKEntryFillerChar (CDKENTRY *entry, chtype fillerCharacter) +{ + entry->filler = fillerCharacter; +} +chtype getCDKEntryFillerChar (CDKENTRY *entry) +{ + return entry->filler; +} + +/* + * This sets the character to use when a hidden type is used. + */ +void setCDKEntryHiddenChar (CDKENTRY *entry, chtype hiddenCharacter) +{ + entry->hidden = hiddenCharacter; +} +chtype getCDKEntryHiddenChar (CDKENTRY *entry) +{ + return entry->hidden; +} + +/* + * This sets the widgets box attribute. + */ +void setCDKEntryBox (CDKENTRY *entry, boolean Box) +{ + ObjOf (entry)->box = Box; + ObjOf (entry)->borderSize = Box ? 1 : 0; +} +boolean getCDKEntryBox (CDKENTRY *entry) +{ + return ObjOf (entry)->box; +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrEntry (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKENTRY *widget = (CDKENTRY *)object; + + wbkgd (widget->win, attrib); + wbkgd (widget->fieldWin, attrib); + if (widget->labelWin != 0) + { + wbkgd (widget->labelWin, attrib); + } + } +} + +/* + * This sets the attribute of the entry field. + */ +void setCDKEntryHighlight (CDKENTRY *entry, chtype highlight, boolean cursor) +{ + wbkgd (entry->fieldWin, highlight); + entry->fieldAttr = highlight; + curs_set (cursor); + /* + * FIXME - if (cursor) { move the cursor to this widget } + */ +} + +/* + * This sets the entry field callback function. + */ +void setCDKEntryCB (CDKENTRY *entry, ENTRYCB callback) +{ + entry->callbackfn = callback; +} + +static void _focusCDKEntry (CDKOBJS *object) +{ + CDKENTRY *entry = (CDKENTRY *)object; + + wmove (entry->fieldWin, 0, entry->screenCol); + wrefresh (entry->fieldWin); +} + +static void _unfocusCDKEntry (CDKOBJS *object) +{ + CDKENTRY *entry = (CDKENTRY *)object; + + drawCDKEntry (entry, ObjOf (entry)->box); + wrefresh (entry->fieldWin); +} + +#if 0 +static void _refreshDataCDKEntry (CDKOBJS *object) +{ + CDKENTRY *entry = (CDKENTRY *)object; + + if (ReturnOf (entry)) + { + switch (DataTypeOf (entry)) + { + default: + case DataTypeString: + strcpy (entry->info, (char *)ReturnOf (entry)); + break; + case DataTypeInt: + sprintf (entry->info, "%d", *((int *)ReturnOf (entry))); + break; + case DataTypeFloat: + sprintf (entry->info, "%g", *((float *)ReturnOf (entry))); + break; + case DataTypeDouble: + sprintf (entry->info, "%g", *((double *)ReturnOf (entry))); + break; + } + entry->screenCol = strlen (entry->info); + drawCDKEntryField (entry); + } +} + +static void _saveDataCDKEntry (CDKOBJS *object) +{ + CDKENTRY *entry = (CDKENTRY *)object; + + if (ReturnOf (entry)) + { + switch (DataTypeOf (entry)) + { + default: + case DataTypeString: + strcpy ((char *)ReturnOf (entry), entry->info); + break; + case DataTypeInt: + *((int *)ReturnOf (entry)) = atoi (entry->info); + break; + case DataTypeFloat: + *((float *)ReturnOf (entry)) = atof (entry->info); + break; + case DataTypeDouble: + *((double *)ReturnOf (entry)) = atof (entry->info); + break; + } + } +} +#else +dummyRefreshData (Entry) +dummySaveData (Entry) +#endif diff --git a/deps/cdk-5.0-20161210/examples/Makefile.in b/deps/cdk-5.0-20161210/examples/Makefile.in new file mode 100644 index 0000000..993b6d8 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/Makefile.in @@ -0,0 +1,167 @@ +# $Id: Makefile.in,v 1.22 2016/11/20 19:41:20 tom Exp $ +# +# Makefile for the examples directory. +# +SHELL = /bin/sh + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +srcdir = @srcdir@ +VPATH = $(srcdir) + +CC = @CC@ +RM = rm -f +CTAGS = @CTAGS@ +ETAGS = @ETAGS@ +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ + +LIBS = -l@LIB_ROOTNAME@ @LIBS@ + +LIBTOOL = @LIBTOOL@ @ECHO_LT@ +LIBTOOL_CLEAN = @LIB_CLEAN@ +LIBTOOL_LINK = @LIB_LINK@ +LINK = $(LIBTOOL_LINK) + +x = @EXEEXT@ +o = .@OBJEXT@ +LOCAL_LIBDIR = @top_builddir@ + +CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@ +CPPFLAGS = @DEFS@ -I../include -I$(srcdir)/../include -I. @CPPFLAGS@ +LDFLAGS = -L.. @LDFLAGS@ @LOCAL_LDFLAGS@ + +BINS = \ + alphalist_ex$x \ + bind_ex$x \ + buttonbox_ex$x \ + calendar_ex$x \ + cdkscreen_ex$x \ + dialog_ex$x \ + entry_ex$x \ + fscale_ex$x \ + fselect_ex$x \ + fslider_ex$x \ + graph_ex$x \ + hello_ex$x \ + histogram_ex$x \ + itemlist_ex$x \ + label_ex$x \ + lowerCDKObject_ex$x \ + marquee_ex$x \ + matrix_ex$x \ + mentry_ex$x \ + menu_ex$x \ + position_ex$x \ + preprocess_ex$x \ + radio1_ex$x \ + radio_ex$x \ + raiseCDKObject_ex$x \ + scale_ex$x \ + scroll_ex$x \ + selection_ex$x \ + slider_ex$x \ + subwindow_ex$x \ + swindow_ex$x \ + template_ex$x \ + traverse_ex$x \ + uslider_ex$x \ + viewer_ex$x \ + viewer_ex2$x + +CDKSRC = \ + alphalist_ex.c \ + bind_ex.c \ + buttonbox_ex.c \ + calendar_ex.c \ + cdkscreen_ex.c \ + dialog_ex.c \ + entry_ex.c \ + fscale_ex.c \ + fselect_ex.c \ + fslider_ex.c \ + graph_ex.c \ + hello_ex.c \ + histogram_ex.c \ + itemlist_ex.c \ + label_ex.c \ + lowerCDKObject_ex.c \ + marquee_ex.c \ + matrix_ex.c \ + mentry_ex.c \ + menu_ex.c \ + position_ex.c \ + preprocess_ex.c \ + radio1_ex.c \ + radio_ex.c \ + raiseCDKObject_ex.c \ + scale_ex.c \ + scroll_ex.c \ + selection_ex.c \ + slider_ex.c \ + subwindow_ex.c \ + swindow_ex.c \ + template_ex.c \ + traverse_ex.c \ + uslider_ex.c \ + viewer_ex.c \ + viewer_ex2.c + +LINKIT = @ECHO_LD@$(LINK) $(CFLAGS) $(CPPFLAGS) $? -o $@ $(LDFLAGS) $(LIBS) + +all : $(BINS) + +alphalist_ex$x : alphalist_ex.c ; $(LINKIT) +bind_ex$x : bind_ex.c ; $(LINKIT) +buttonbox_ex$x : buttonbox_ex.c ; $(LINKIT) +calendar_ex$x : calendar_ex.c ; $(LINKIT) +cdkscreen_ex$x : cdkscreen_ex.c ; $(LINKIT) +dialog_ex$x : dialog_ex.c ; $(LINKIT) +entry_ex$x : entry_ex.c ; $(LINKIT) +fscale_ex$x : fscale_ex.c ; $(LINKIT) +fselect_ex$x : fselect_ex.c ; $(LINKIT) +fslider_ex$x : fslider_ex.c ; $(LINKIT) +graph_ex$x : graph_ex.c ; $(LINKIT) +hello_ex$x : hello_ex.c ; $(LINKIT) +histogram_ex$x : histogram_ex.c ; $(LINKIT) +itemlist_ex$x : itemlist_ex.c ; $(LINKIT) +label_ex$x : label_ex.c ; $(LINKIT) +lowerCDKObject_ex$x : lowerCDKObject_ex.c ; $(LINKIT) +marquee_ex$x : marquee_ex.c ; $(LINKIT) +matrix_ex$x : matrix_ex.c ; $(LINKIT) +mentry_ex$x : mentry_ex.c ; $(LINKIT) +menu_ex$x : menu_ex.c ; $(LINKIT) +position_ex$x : position_ex.c ; $(LINKIT) +preprocess_ex$x : preprocess_ex.c ; $(LINKIT) +radio1_ex$x : radio1_ex.c ; $(LINKIT) +radio_ex$x : radio_ex.c ; $(LINKIT) +raiseCDKObject_ex$x : raiseCDKObject_ex.c ; $(LINKIT) +scale_ex$x : scale_ex.c ; $(LINKIT) +scroll_ex$x : scroll_ex.c ; $(LINKIT) +selection_ex$x : selection_ex.c ; $(LINKIT) +slider_ex$x : slider_ex.c ; $(LINKIT) +subwindow_ex$x : subwindow_ex.c ; $(LINKIT) +swindow_ex$x : swindow_ex.c ; $(LINKIT) +template_ex$x : template_ex.c ; $(LINKIT) +traverse_ex$x : traverse_ex.c ; $(LINKIT) +uslider_ex$x : uslider_ex.c ; $(LINKIT) +viewer_ex$x : viewer_ex.c ; $(LINKIT) +viewer_ex2$x : viewer_ex2.c ; $(LINKIT) +# +# Standard clean directives. +# +clean:: + -$(LIBTOOL_CLEAN) $(RM) *.o core $(BINS) + +distclean:: clean + $(RM) Makefile + +@MAKE_LOWER_TAGS@tags : +@MAKE_LOWER_TAGS@ $(CTAGS) *.[ch] */*.[ch] + +@MAKE_LOWER_TAGS@TAGS : +@MAKE_LOWER_TAGS@ $(ETAGS) *.[ch] */*.[ch] + +lint: $(CDKSRC) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(CDKSRC) diff --git a/deps/cdk-5.0-20161210/examples/alphalist_ex.c b/deps/cdk-5.0-20161210/examples/alphalist_ex.c new file mode 100644 index 0000000..ff3db3a --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/alphalist_ex.c @@ -0,0 +1,293 @@ +/* $Id: alphalist_ex.c,v 1.30 2016/12/04 15:38:55 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "alphalist_ex"; +#endif + +/* + * This program demonstrates the Cdk alphalist widget. + * + * Options (in addition to normal CLI parameters): + * -c create the data after the widget + */ +static CDKSCREEN *cdkscreen = 0; +static char **myUserList = 0; +static int userSize; + +typedef struct +{ + int deleted; /* index in current list which is deleted */ + int original; /* index in myUserList[] of deleted item */ + int position; /* position before delete */ + int topline; /* top-line before delete */ +} UNDO; + +static UNDO *myUndoList; +static int undoSize; + +/* + * This reads the passwd file and retrieves user information. + */ +static int getUserList (char ***list) +{ +#if defined (HAVE_PWD_H) + struct passwd *ent; +#endif + int x = 0; + unsigned used = 0; + +#if defined (HAVE_PWD_H) + while ((ent = getpwent ()) != 0) + { + used = CDKallocStrings (list, ent->pw_name, (unsigned)x++, used); + } + endpwent (); +#endif + return x; +} + +#define CB_PARAMS EObjectType cdktype GCC_UNUSED, void* object GCC_UNUSED, void* clientdata GCC_UNUSED, chtype key GCC_UNUSED + +static void fill_undo (CDKALPHALIST *widget, int deleted, char *data) +{ + int top = getCDKScrollCurrentTop (widget->scrollField); + int item = getCDKAlphalistCurrentItem (widget); + int n; + + myUndoList[undoSize].deleted = deleted; + myUndoList[undoSize].topline = top; + myUndoList[undoSize].original = -1; + myUndoList[undoSize].position = item; + for (n = 0; n < userSize; ++n) + { + if (!strcmp (myUserList[n], data)) + { + myUndoList[undoSize].original = n; + break; + } + } + ++undoSize; +} + +static int do_delete (CB_PARAMS) +{ + CDKALPHALIST *widget = (CDKALPHALIST *)clientdata; + int size; + char **list = getCDKAlphalistContents (widget, &size); + int result = FALSE; + + if (size) + { + int save = getCDKScrollCurrentTop (widget->scrollField); + int first = getCDKAlphalistCurrentItem (widget); + int n; + + fill_undo (widget, first, list[first]); + for (n = first; n < size; ++n) + list[n] = list[n + 1]; + setCDKAlphalistContents (widget, (CDK_CSTRING *)list, size - 1); + setCDKScrollCurrentTop (widget->scrollField, save); + setCDKAlphalistCurrentItem (widget, first); + drawCDKAlphalist (widget, BorderOf (widget)); + result = TRUE; + } + return result; +} + +static int do_delete1 (CB_PARAMS) +{ + CDKALPHALIST *widget = (CDKALPHALIST *)clientdata; + int size; + char **list = getCDKAlphalistContents (widget, &size); + int result = FALSE; + + if (size) + { + int save = getCDKScrollCurrentTop (widget->scrollField); + int first = getCDKAlphalistCurrentItem (widget); + + if (first-- > 0) + { + int n; + + fill_undo (widget, first, list[first]); + for (n = first; n < size; ++n) + list[n] = list[n + 1]; + setCDKAlphalistContents (widget, (CDK_CSTRING *)list, size - 1); + setCDKScrollCurrentTop (widget->scrollField, save); + setCDKAlphalistCurrentItem (widget, first); + drawCDKAlphalist (widget, BorderOf (widget)); + result = TRUE; + } + } + return result; +} + +static int do_help (CB_PARAMS) +{ + static const char *message[] = + { + "Alpha List tests:", + "", + "F1 = help (this message)", + "F2 = delete current item", + "F3 = delete previous item", + "F4 = reload all items", + "F5 = undo deletion", + 0 + }; + popupLabel (cdkscreen, + (CDK_CSTRING2)message, + (int)CDKcountStrings ((CDK_CSTRING2)message)); + return TRUE; +} + +static int do_reload (CB_PARAMS) +{ + int result = FALSE; + + if (userSize) + { + CDKALPHALIST *widget = (CDKALPHALIST *)clientdata; + setCDKAlphalistContents (widget, (CDK_CSTRING *)myUserList, userSize); + setCDKAlphalistCurrentItem (widget, 0); + drawCDKAlphalist (widget, BorderOf (widget)); + result = TRUE; + } + return result; +} + +static int do_undo (CB_PARAMS) +{ + int result = FALSE; + + if (undoSize > 0) + { + CDKALPHALIST *widget = (CDKALPHALIST *)clientdata; + int size; + int n; + char **oldlist = getCDKAlphalistContents (widget, &size); + char **newlist = (char **)malloc ((size_t) (++size + 1) * sizeof (char *)); + + --undoSize; + newlist[size] = 0; + for (n = size - 1; n > myUndoList[undoSize].deleted; --n) + { + newlist[n] = copyChar (oldlist[n - 1]); + } + newlist[n--] = copyChar (myUserList[myUndoList[undoSize].original]); + while (n >= 0) + { + newlist[n] = copyChar (oldlist[n]); + --n; + } + setCDKAlphalistContents (widget, (CDK_CSTRING *)newlist, size); + setCDKScrollCurrentTop (widget->scrollField, myUndoList[undoSize].topline); + setCDKAlphalistCurrentItem (widget, myUndoList[undoSize].position); + drawCDKAlphalist (widget, BorderOf (widget)); + free (newlist); + result = TRUE; + } + return result; +} + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKALPHALIST *alphaList = 0; + const char *title = "Alpha List\nTitle"; + const char *label = "Account: "; + char *word = 0; + char **userList = 0; + const char *mesg[5]; + char temp[256]; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "c" CDK_CLI_PARAMS); + + /* Get the user list. */ + userSize = getUserList (&userList); + if (userSize <= 0) + { + fprintf (stderr, "Cannot get user list\n"); + ExitProgram (EXIT_FAILURE); + } + myUserList = copyCharList ((const char **)userList); + myUndoList = (UNDO *) malloc ((size_t) userSize * sizeof (UNDO)); + undoSize = 0; + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Create the alpha list widget. */ + alphaList = newCDKAlphalist (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparamValue (¶ms, 'H', 0), + CDKparamValue (¶ms, 'W', 0), + title, label, + (CDKparamNumber (¶ms, 'c') + ? 0 + : (CDK_CSTRING *)userList), + (CDKparamNumber (¶ms, 'c') + ? 0 + : userSize), + '_', A_REVERSE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + if (alphaList == 0) + { + destroyCDKScreen (cdkscreen); + endCDK (); + + fprintf (stderr, "Cannot create widget\n"); + ExitProgram (EXIT_FAILURE); + } + + bindCDKObject (vALPHALIST, alphaList, '?', do_help, NULL); + bindCDKObject (vALPHALIST, alphaList, KEY_F1, do_help, NULL); + bindCDKObject (vALPHALIST, alphaList, KEY_F2, do_delete, alphaList); + bindCDKObject (vALPHALIST, alphaList, KEY_F3, do_delete1, alphaList); + bindCDKObject (vALPHALIST, alphaList, KEY_F4, do_reload, alphaList); + bindCDKObject (vALPHALIST, alphaList, KEY_F5, do_undo, alphaList); + + if (CDKparamNumber (¶ms, 'c')) + { + setCDKAlphalistContents (alphaList, (CDK_CSTRING *)userList, userSize); + } + + /* Let them play with the alpha list. */ + word = activateCDKAlphalist (alphaList, 0); + + /* Determine what the user did. */ + if (alphaList->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No word was selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + else if (alphaList->exitType == vNORMAL) + { + mesg[0] = "You selected the following"; + sprintf (temp, "(%.*s)", (int)(sizeof (temp) - 10), word); + mesg[1] = temp; + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 4); + } + + freeCharList (myUserList, (unsigned)userSize); + free (myUserList); + + destroyCDKAlphalist (alphaList); + destroyCDKScreen (cdkscreen); + endCDK (); + + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/bind_ex.c b/deps/cdk-5.0-20161210/examples/bind_ex.c new file mode 100644 index 0000000..336c070 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/bind_ex.c @@ -0,0 +1,164 @@ +/* $Id: bind_ex.c,v 1.20 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "bind_ex"; +#endif + +static int dialogHelpCB (EObjectType cdktype GCC_UNUSED, + void *object, + void *clientData GCC_UNUSED, + chtype key GCC_UNUSED) +{ + CDKDIALOG *dialog = (CDKDIALOG *)object; + const char *mesg[5]; + + /* Check which button we are on. */ + if (dialog->currentButton == 0) + { + mesg[0] = "Help for Who."; + mesg[1] = "When this button is picked the name of the current"; + mesg[2] = "user is displayed on the screen in a popup window."; + popupLabel (ScreenOf (dialog), (CDK_CSTRING2) mesg, 3); + } + else if (dialog->currentButton == 1) + { + mesg[0] = "Help for Time."; + mesg[1] = "When this button is picked the current time is"; + mesg[2] = "displayed on the screen in a popup window."; + popupLabel (ScreenOf (dialog), (CDK_CSTRING2) mesg, 3); + } + else if (dialog->currentButton == 2) + { + mesg[0] = "Help for Date."; + mesg[1] = "When this button is picked the current date is"; + mesg[2] = "displayed on the screen in a popup window."; + popupLabel (ScreenOf (dialog), (CDK_CSTRING2) mesg, 3); + } + else if (dialog->currentButton == 3) + { + mesg[0] = "Help for Quit."; + mesg[1] = "When this button is picked the dialog box is exited."; + popupLabel (ScreenOf (dialog), (CDK_CSTRING2) mesg, 2); + } + return (FALSE); +} + +int main (int argc, char **argv) +{ + /* *INDENT-OFF* */ + CDKSCREEN *cdkscreen; + CDKDIALOG *question; + const char *buttons[40]; + const char *message[40]; + const char *info[5]; + char *loginName = 0; + char temp[256]; + int selection; + time_t clck; + struct tm *currentTime; + CDK_PARAMS params; + /* *INDENT-ON* */ + + CDKparseParams (argc, argv, ¶ms, CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Set up the dialog box. */ + message[0] = "Simple Command Interface"; + message[1] = "Pick the command you wish to run."; + message[2] = "Press ? for help."; + buttons[0] = "Who"; + buttons[1] = "Time"; + buttons[2] = "Date"; + buttons[3] = "Quit"; + + /* Create the dialog box. */ + question = newCDKDialog (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + (CDK_CSTRING2) message, 3, + (CDK_CSTRING2) buttons, 4, + A_REVERSE, + TRUE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Check if we got a null value back. */ + if (question == (CDKDIALOG *)0) + { + destroyCDKScreen (cdkscreen); + + /* End curses... */ + endCDK (); + + printf ("Cannot create the dialog box. "); + printf ("Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Create the key binding. */ + bindCDKObject (vDIALOG, question, '?', dialogHelpCB, 0); + + /* Activate the dialog box. */ + selection = 0; + while (selection != 3) + { + /* Get the users button selection. */ + selection = activateCDKDialog (question, (chtype *)0); + + /* Check the results. */ + if (selection == 0) + { + /* Get the users login name. */ + info[0] = " Login Name "; +#if defined (HAVE_GETLOGIN) + loginName = getlogin (); +#endif + if (loginName == (char *)0) + { + strcpy (temp, "Unknown"); + } + else + { + sprintf (temp, "<%.*s>", (int)(sizeof (temp) - 10), loginName); + } + info[1] = temp; + popupLabel (ScreenOf (question), (CDK_CSTRING2) info, 2); + } + else if (selection == 1) + { + time (&clck); + currentTime = localtime (&clck); + sprintf (temp, "%2d:%02d:%02d", + currentTime->tm_hour, + currentTime->tm_min, + currentTime->tm_sec); + info[0] = " Current Time "; + info[1] = temp; + popupLabel (ScreenOf (question), (CDK_CSTRING2) info, 2); + } + else if (selection == 2) + { + time (&clck); + currentTime = localtime (&clck); + sprintf (temp, "%d/%02d/%02d", + currentTime->tm_mday, + currentTime->tm_mon + 1, + currentTime->tm_year % 100); + info[0] = " Current Date "; + info[1] = temp; + popupLabel (ScreenOf (question), (CDK_CSTRING2) info, 2); + } + } + + /* Clean up. */ + destroyCDKDialog (question); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/buttonbox_ex.c b/deps/cdk-5.0-20161210/examples/buttonbox_ex.c new file mode 100644 index 0000000..f5df473 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/buttonbox_ex.c @@ -0,0 +1,102 @@ +/* $Id: buttonbox_ex.c,v 1.21 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "buttonbox_ex"; +#endif + +static BINDFN_PROTO (entryCB); + +/* + * This program demonstrates the Cdk buttonbox widget. + */ +int main (void) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKBUTTONBOX *buttonWidget = 0; + CDKENTRY *entry = 0; + const char *buttons[] = + { + " OK ", + " Cancel " + }; + char *info = 0; + int selection; + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Create the entry widget. */ + entry = newCDKEntry (cdkscreen, CENTER, CENTER, + "Enter a name", "Name ", A_NORMAL, '.', vMIXED, + 40, 0, 256, TRUE, FALSE); + if (entry == 0) + { + destroyCDKScreen (cdkscreen); + endCDK (); + + fprintf (stderr, "Cannot create entry-widget\n"); + ExitProgram (EXIT_FAILURE); + } + + + /* Create the button box widget. */ + buttonWidget = newCDKButtonbox (cdkscreen, + getbegx (entry->win), + getbegy (entry->win) + entry->boxHeight - 1, + 1, entry->boxWidth - 1, + 0, 1, 2, + (CDK_CSTRING2) buttons, 2, A_REVERSE, + TRUE, FALSE); + if (buttonWidget == 0) + { + destroyCDKScreen (cdkscreen); + endCDK (); + + fprintf (stderr, "Cannot create buttonbox-widget\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Set the lower left and right characters of the box. */ + setCDKEntryLLChar (entry, ACS_LTEE); + setCDKEntryLRChar (entry, ACS_RTEE); + setCDKButtonboxULChar (buttonWidget, ACS_LTEE); + setCDKButtonboxURChar (buttonWidget, ACS_RTEE); + + /* + * Bind the Tab key in the entry field to send a + * Tab key to the button box widget. + */ + bindCDKObject (vENTRY, entry, KEY_TAB, entryCB, buttonWidget); + + /* Activate the entry field. */ + drawCDKButtonbox (buttonWidget, TRUE); + info = copyChar (activateCDKEntry (entry, 0)); + selection = buttonWidget->currentButton; + + /* Clean up. */ + destroyCDKButtonbox (buttonWidget); + destroyCDKEntry (entry); + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("You typed in (%s) and selected button (%s)\n", + (info != 0) ? info : "", + buttons[selection]); + + freeChar (info); + ExitProgram (EXIT_SUCCESS); +} + +static int entryCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, chtype key) +{ + CDKBUTTONBOX *buttonbox = (CDKBUTTONBOX *)clientData; + (void)injectCDKButtonbox (buttonbox, key); + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/examples/calendar_ex.c b/deps/cdk-5.0-20161210/examples/calendar_ex.c new file mode 100644 index 0000000..721fe2f --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/calendar_ex.c @@ -0,0 +1,155 @@ +/* $Id: calendar_ex.c,v 1.17 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "calendar_ex"; +#endif + +static BINDFN_PROTO (createCalendarMarkCB); +static BINDFN_PROTO (removeCalendarMarkCB); + +/* + * This program demonstrates the Cdk calendar widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKCALENDAR *calendar = 0; + const char *mesg[5]; + char temp[256]; + struct tm *dateInfo; + time_t clck, retVal; + + CDK_PARAMS params; + char *title; + int day; + int month; + int year; + + /* + * Get the current dates and set the default values for + * the day/month/year values for the calendar. + */ + time (&clck); + dateInfo = gmtime (&clck); + + /* *INDENT-EQLS* */ + CDKparseParams (argc, argv, ¶ms, "d:m:y:t:w:" CDK_MIN_PARAMS); + day = CDKparamNumber2 (¶ms, 'd', dateInfo->tm_mday); + month = CDKparamNumber2 (¶ms, 'm', dateInfo->tm_mon + 1); + year = CDKparamNumber2 (¶ms, 'y', dateInfo->tm_year + 1900); + title = CDKparamString2 (¶ms, 't', "CDK Calendar Widget\nDemo"); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the calendar widget. */ + calendar = newCDKCalendar (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, day, month, year, + COLOR_PAIR (16) | A_BOLD, + COLOR_PAIR (24) | A_BOLD, + COLOR_PAIR (32) | A_BOLD, + COLOR_PAIR (40) | A_REVERSE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the widget null? */ + if (calendar == 0) + { + /* Clean up the memory. */ + destroyCDKScreen (cdkscreen); + + /* End curses... */ + endCDK (); + + printf ("Cannot create the calendar. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Create a key binding to mark days on the calendar. */ + bindCDKObject (vCALENDAR, calendar, 'm', createCalendarMarkCB, calendar); + bindCDKObject (vCALENDAR, calendar, 'M', createCalendarMarkCB, calendar); + bindCDKObject (vCALENDAR, calendar, 'r', removeCalendarMarkCB, calendar); + bindCDKObject (vCALENDAR, calendar, 'R', removeCalendarMarkCB, calendar); + + calendar->weekBase = CDKparamNumber (¶ms, 'w'); + + /* Draw the calendar widget. */ + drawCDKCalendar (calendar, ObjOf (calendar)->box); + + /* Let the user play with the widget. */ + retVal = activateCDKCalendar (calendar, 0); + + /* Check which day they selected. */ + if (calendar->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No date selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (calendar->exitType == vNORMAL) + { + mesg[0] = "You selected the following date"; + sprintf (temp, "%02d/%02d/%d (dd/mm/yyyy)", + calendar->day, + calendar->month, + calendar->year); + mesg[1] = temp; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up and exit. */ + destroyCDKCalendar (calendar); + destroyCDKScreen (cdkscreen); + endCDK (); + fflush (stdout); + printf ("Selected Time: %s\n", ctime (&retVal)); + ExitProgram (EXIT_SUCCESS); +} + +/* + * This adds a marker to the calendar. + */ +static int createCalendarMarkCB (EObjectType objectType GCC_UNUSED, + void *object, + void *clientData GCC_UNUSED, + chtype key GCC_UNUSED) +{ + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + + setCDKCalendarMarker (calendar, + calendar->day, + calendar->month, + calendar->year, + COLOR_PAIR (5) | A_REVERSE); + + drawCDKCalendar (calendar, ObjOf (calendar)->box); + return (FALSE); +} + +/* + * This removes a marker from the calendar. + */ +static int removeCalendarMarkCB (EObjectType objectType GCC_UNUSED, + void *object, + void *clientData GCC_UNUSED, + chtype key GCC_UNUSED) +{ + CDKCALENDAR *calendar = (CDKCALENDAR *)object; + + removeCDKCalendarMarker (calendar, + calendar->day, + calendar->month, + calendar->year); + + drawCDKCalendar (calendar, ObjOf (calendar)->box); + return (FALSE); +} diff --git a/deps/cdk-5.0-20161210/examples/cdkscreen_ex.c b/deps/cdk-5.0-20161210/examples/cdkscreen_ex.c new file mode 100644 index 0000000..34d0cad --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/cdkscreen_ex.c @@ -0,0 +1,134 @@ +/* $Id: cdkscreen_ex.c,v 1.9 2016/12/04 15:22:16 tom Exp $ */ + +#include + +/* + * This demonstrates how to create four different Cdk + * screens and flip between them. + */ + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "cdkscreen_ex"; +#endif + +int main (void) +{ + CDKSCREEN *cdkScreen1, *cdkScreen2; + CDKSCREEN *cdkScreen3, *cdkScreen4; + CDKSCREEN *cdkScreen5; + CDKLABEL *label1, *label2; + CDKLABEL *label3, *label4; + CDKDIALOG *dialog; + const char *title1Mesg[4]; + const char *title2Mesg[4]; + const char *title3Mesg[4]; + const char *title4Mesg[4]; + const char *dialogMesg[10]; + const char *buttons[] = + { + "Continue", + "Exit" + }; + + /* Create the screens. */ + cdkScreen1 = initCDKScreen (NULL); + cdkScreen2 = initCDKScreen (stdscr); + cdkScreen3 = initCDKScreen (stdscr); + cdkScreen4 = initCDKScreen (stdscr); + cdkScreen5 = initCDKScreen (stdscr); + + /* Create the first screen. */ + title1Mesg[0] = "<#HL(30)>"; + title1Mesg[1] = "This is the first screen."; + title1Mesg[2] = "Hit space to go to the next screen"; + title1Mesg[3] = "<#HL(30)>"; + label1 = newCDKLabel (cdkScreen1, CENTER, TOP, + (CDK_CSTRING2)title1Mesg, 4, + FALSE, FALSE); + + /* Create the second screen. */ + title2Mesg[0] = "<#HL(30)>"; + title2Mesg[1] = "This is the second screen."; + title2Mesg[2] = "Hit space to go to the next screen"; + title2Mesg[3] = "<#HL(30)>"; + label2 = newCDKLabel (cdkScreen2, RIGHT, CENTER, + (CDK_CSTRING2)title2Mesg, 4, + FALSE, FALSE); + + /* Create the third screen. */ + title3Mesg[0] = "<#HL(30)>"; + title3Mesg[1] = "This is the third screen."; + title3Mesg[2] = "Hit space to go to the next screen"; + title3Mesg[3] = "<#HL(30)>"; + label3 = newCDKLabel (cdkScreen3, CENTER, BOTTOM, + (CDK_CSTRING2)title3Mesg, 4, + FALSE, FALSE); + + /* Create the fourth screen. */ + title4Mesg[0] = "<#HL(30)>"; + title4Mesg[1] = "This is the fourth screen."; + title4Mesg[2] = "Hit space to go to the next screen"; + title4Mesg[3] = "<#HL(30)>"; + label4 = newCDKLabel (cdkScreen4, LEFT, CENTER, + (CDK_CSTRING2)title4Mesg, 4, + FALSE, FALSE); + + /* Create the fifth screen. */ + dialogMesg[0] = "<#HL(30)>"; + dialogMesg[1] = "Screen 5"; + dialogMesg[2] = "This is the last of 5 screens. If you want"; + dialogMesg[3] = "to continue press the 'Continue' button."; + dialogMesg[4] = "Otherwise press the 'Exit' button"; + dialogMesg[5] = "<#HL(30)>"; + dialog = newCDKDialog (cdkScreen5, CENTER, CENTER, + (CDK_CSTRING2)dialogMesg, 6, + (CDK_CSTRING2)buttons, 2, + A_REVERSE, TRUE, TRUE, FALSE); + + /* Do this for ever... (almost) */ + for (;;) + { + int answer; + + /* Draw the first screen. */ + drawCDKScreen (cdkScreen1); + waitCDKLabel (label1, ' '); + eraseCDKScreen (cdkScreen1); + + /* Draw the second screen. */ + drawCDKScreen (cdkScreen2); + waitCDKLabel (label2, ' '); + eraseCDKScreen (cdkScreen2); + + /* Draw the third screen. */ + drawCDKScreen (cdkScreen3); + waitCDKLabel (label3, ' '); + eraseCDKScreen (cdkScreen3); + + /* Draw the fourth screen. */ + drawCDKScreen (cdkScreen4); + waitCDKLabel (label4, ' '); + eraseCDKScreen (cdkScreen4); + + /* Draw the fourth screen. */ + drawCDKScreen (cdkScreen5); + answer = activateCDKDialog (dialog, 0); + + /* Check the users answer. */ + if (answer == 1) + { + destroyCDKLabel (label1); + destroyCDKLabel (label2); + destroyCDKLabel (label3); + destroyCDKLabel (label4); + destroyCDKDialog (dialog); + destroyCDKScreen (cdkScreen1); + destroyCDKScreen (cdkScreen2); + destroyCDKScreen (cdkScreen3); + destroyCDKScreen (cdkScreen4); + destroyCDKScreen (cdkScreen5); + endCDK (); + ExitProgram (EXIT_SUCCESS); + } + } +} diff --git a/deps/cdk-5.0-20161210/examples/dialog_ex.c b/deps/cdk-5.0-20161210/examples/dialog_ex.c new file mode 100644 index 0000000..c093f22 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/dialog_ex.c @@ -0,0 +1,89 @@ +/* $Id: dialog_ex.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "dialog_ex"; +#endif + +/* + * This program demonstrates the Cdk dialog widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKDIALOG *question = 0; + const char *buttons[] = + {"Ok", "Cancel"}; + const char *message[10]; + const char *mesg[3]; + char temp[100]; + int selection; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Create the message within the dialog box. */ + message[0] = "Dialog Widget Demo"; + message[1] = " "; + message[2] = "The dialog widget allows the programmer to create"; + message[3] = "a popup dialog box with buttons. The dialog box"; + message[4] = "can contain colours, character attributes"; + message[5] = "and even be right justified."; + message[6] = "and left."; + + /* Create the dialog box. */ + question = newCDKDialog (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + (CDK_CSTRING2) message, 7, + (CDK_CSTRING2) buttons, 2, + COLOR_PAIR (2) | A_REVERSE, + TRUE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Check if we got a null value back. */ + if (question == 0) + { + /* Shut down Cdk. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the dialog box. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the dialog box. */ + selection = activateCDKDialog (question, 0); + + /* Tell them what was selected. */ + if (question->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No button selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (question->exitType == vNORMAL) + { + sprintf (temp, "You selected button #%d", selection); + mesg[0] = temp; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up. */ + destroyCDKDialog (question); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/entry_ex.c b/deps/cdk-5.0-20161210/examples/entry_ex.c new file mode 100644 index 0000000..ce3bd9d --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/entry_ex.c @@ -0,0 +1,108 @@ +/* $Id: entry_ex.c,v 1.17 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "entry_ex"; +#endif + +static BINDFN_PROTO (XXXCB); + +/* + * This demonstrates the Cdk entry field widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKENTRY *directory = 0; + const char *title = "Enter a\ndirectory name."; + const char *label = "Directory:"; + char *info; + const char *mesg[10]; + char temp[256]; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK colors. */ + initCDKColor (); + + /* Create the entry field widget. */ + directory = newCDKEntry (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, label, A_NORMAL, '.', vMIXED, + 40, 0, 256, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + bindCDKObject (vENTRY, directory, '?', XXXCB, 0); + + /* Is the widget null? */ + if (directory == 0) + { + /* Clean up. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the entry box. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Draw the screen. */ + refreshCDKScreen (cdkscreen); + + /* + * Pass in whatever was given off of the command line. Notice we + * don't check if argv[1] is null or not. The function setCDKEntry + * already performs any needed checks. + */ + setCDKEntry (directory, argv[optind], 0, 256, TRUE); + + /* Activate the entry field. */ + info = activateCDKEntry (directory, 0); + + /* Tell them what they typed. */ + if (directory->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No information passed back."; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + + destroyCDKEntry (directory); + + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (directory->exitType == vNORMAL) + { + mesg[0] = "You typed in the following"; + sprintf (temp, "(%.*s)", (int)(sizeof (temp) - 10), info); + mesg[1] = temp; + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + + destroyCDKEntry (directory); + + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 4); + } + else + { + destroyCDKEntry (directory); + } + + /* Clean up and exit. */ + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} + +static int XXXCB (EObjectType cdktype GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData GCC_UNUSED, + chtype key GCC_UNUSED) +{ + return (TRUE); +} diff --git a/deps/cdk-5.0-20161210/examples/fscale_ex.c b/deps/cdk-5.0-20161210/examples/fscale_ex.c new file mode 100644 index 0000000..807eff2 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/fscale_ex.c @@ -0,0 +1,96 @@ +/* $Id: fscale_ex.c,v 1.9 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "fscale_ex"; +#endif + +static float myFloatParam (CDK_PARAMS * params, int code, double missing) +{ + char *opt = CDKparamString (params, code); + double result = missing; + + if (opt != 0) + result = atof (opt); + return (float)result; +} + +/* + * This program demonstrates the Cdk scale widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKFSCALE *scale = 0; + const char *title = "Select a value"; + const char *label = "Current value"; + char temp[256]; + const char *mesg[5]; + float selection; + + CDK_PARAMS params; + float high; + float inc; + float low; + + /* *INDENT-EQLS* */ + CDKparseParams (argc, argv, ¶ms, "h:i:l:w:" CDK_MIN_PARAMS); + high = myFloatParam (¶ms, 'h', 2.4); + inc = myFloatParam (¶ms, 'i', 0.2); + low = myFloatParam (¶ms, 'l', -1.2); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the scale. */ + scale = newCDKFScale (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, label, A_NORMAL, + CDKparamNumber2 (¶ms, 'w', 10), + low, low, high, + inc, (inc * (float)2.), 1, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the scale null? */ + if (scale == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Can't make the scale widget. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the scale. */ + selection = activateCDKFScale (scale, 0); + + /* Check the exit value of the scale widget. */ + if (scale->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No value selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (scale->exitType == vNORMAL) + { + sprintf (temp, "You selected %f", selection); + mesg[0] = temp; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up. */ + destroyCDKFScale (scale); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/fselect_ex.c b/deps/cdk-5.0-20161210/examples/fselect_ex.c new file mode 100644 index 0000000..0507c09 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/fselect_ex.c @@ -0,0 +1,326 @@ +/* $Id: fselect_ex.c,v 1.27 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "fselect_ex"; +#endif + +/* + * This program demonstrates the file selector and the viewer widget. + */ +static CDKSCREEN *cdkscreen = 0; +static char **myUserList = 0; +static int userSize; + +typedef struct +{ + int deleted; /* index in current list which is deleted */ + int original; /* index in myUserList[] of deleted item */ + int position; /* position before delete */ + int topline; /* top-line before delete */ +} UNDO; + +static UNDO *myUndoList; +static int undoSize; + +#define CB_PARAMS EObjectType cdktype GCC_UNUSED, void* object GCC_UNUSED, void* clientdata GCC_UNUSED, chtype key GCC_UNUSED + +static void fill_undo (CDKFSELECT *widget, int deleted, char *data) +{ + int top = getCDKScrollCurrentTop (widget->scrollField); + int item = getCDKFselectCurrentItem (widget); + int n; + + myUndoList[undoSize].deleted = deleted; + myUndoList[undoSize].topline = top; + myUndoList[undoSize].original = -1; + myUndoList[undoSize].position = item; + for (n = 0; n < userSize; ++n) + { + if (!strcmp (myUserList[n], data)) + { + myUndoList[undoSize].original = n; + break; + } + } + ++undoSize; +} + +static int do_delete (CB_PARAMS) +{ + CDKFSELECT *widget = (CDKFSELECT *)clientdata; + int size; + char **list = getCDKFselectContents (widget, &size); + int result = FALSE; + + if (size) + { + int save = getCDKScrollCurrentTop (widget->scrollField); + int first = getCDKFselectCurrentItem (widget); + int n; + + fill_undo (widget, first, list[first]); + for (n = first; n < size; ++n) + list[n] = list[n + 1]; + setCDKFselectContents (widget, (CDK_CSTRING2)list, size - 1); + setCDKScrollCurrentTop (widget->scrollField, save); + setCDKFselectCurrentItem (widget, first); + drawCDKFselect (widget, BorderOf (widget)); + result = TRUE; + } + return result; +} + +static int do_delete1 (CB_PARAMS) +{ + CDKFSELECT *widget = (CDKFSELECT *)clientdata; + int size; + char **list = getCDKFselectContents (widget, &size); + int result = FALSE; + + if (size) + { + int save = getCDKScrollCurrentTop (widget->scrollField); + int first = getCDKFselectCurrentItem (widget); + + if (first-- > 0) + { + int n; + + fill_undo (widget, first, list[first]); + for (n = first; n < size; ++n) + list[n] = list[n + 1]; + setCDKFselectContents (widget, (CDK_CSTRING2)list, size - 1); + setCDKScrollCurrentTop (widget->scrollField, save); + setCDKFselectCurrentItem (widget, first); + drawCDKFselect (widget, BorderOf (widget)); + result = TRUE; + } + } + return result; +} + +static int do_help (CB_PARAMS) +{ + static const char *message[] = + { + "File Selection tests:", + "", + "F1 = help (this message)", + "F2 = delete current item", + "F3 = delete previous item", + "F4 = reload all items", + "F5 = undo deletion", + 0 + }; + popupLabel (cdkscreen, + (CDK_CSTRING2)message, + (int)CDKcountStrings ((CDK_CSTRING2)message)); + return TRUE; +} + +static int do_reload (CB_PARAMS) +{ + int result = FALSE; + + if (userSize) + { + CDKFSELECT *widget = (CDKFSELECT *)clientdata; + setCDKFselectContents (widget, (CDK_CSTRING2)myUserList, userSize); + setCDKFselectCurrentItem (widget, 0); + drawCDKFselect (widget, BorderOf (widget)); + result = TRUE; + } + return result; +} + +static int do_undo (CB_PARAMS) +{ + int result = FALSE; + + if (undoSize > 0) + { + CDKFSELECT *widget = (CDKFSELECT *)clientdata; + int size; + int n; + char **oldlist = getCDKFselectContents (widget, &size); + char **newlist = (char **)malloc ((size_t) (++size + 1) * sizeof (char *)); + + --undoSize; + newlist[size] = 0; + for (n = size - 1; n > myUndoList[undoSize].deleted; --n) + { + newlist[n] = copyChar (oldlist[n - 1]); + } + newlist[n--] = copyChar (myUserList[myUndoList[undoSize].original]); + while (n >= 0) + { + newlist[n] = copyChar (oldlist[n]); + --n; + } + setCDKFselectContents (widget, (CDK_CSTRING2)newlist, size); + setCDKScrollCurrentTop (widget->scrollField, myUndoList[undoSize].topline); + setCDKFselectCurrentItem (widget, myUndoList[undoSize].position); + drawCDKFselect (widget, BorderOf (widget)); + free (newlist); + result = TRUE; + } + return result; +} + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKVIEWER *example = 0; + CDKFSELECT *fSelect = 0; + const char *title = "Pick\nA\nFile"; + const char *label = "File: "; + char **info = 0; + const char *button[5]; + const char *mesg[4]; + char *filename; + char vTitle[256]; + char temp[256]; + int selected, lines; + + CDK_PARAMS params; + char *directory; + + CDKparseParams (argc, argv, ¶ms, "d:" CDK_CLI_PARAMS); + directory = CDKparamString2 (¶ms, 'd', "."); + + /* Create the viewer buttons. */ + button[0] = ""; + button[1] = ""; + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Get the filename. */ + fSelect = newCDKFselect (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparamValue (¶ms, 'H', 20), + CDKparamValue (¶ms, 'W', 65), + title, label, A_NORMAL, '_', A_REVERSE, + "", "", "", "", + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + if (fSelect == 0) + { + destroyCDKScreen (cdkscreen); + endCDK (); + + fprintf (stderr, "Cannot create widget\n"); + ExitProgram (EXIT_FAILURE); + } + + bindCDKObject (vFSELECT, fSelect, '?', do_help, NULL); + bindCDKObject (vFSELECT, fSelect, KEY_F1, do_help, NULL); + bindCDKObject (vFSELECT, fSelect, KEY_F2, do_delete, fSelect); + bindCDKObject (vFSELECT, fSelect, KEY_F3, do_delete1, fSelect); + bindCDKObject (vFSELECT, fSelect, KEY_F4, do_reload, fSelect); + bindCDKObject (vFSELECT, fSelect, KEY_F5, do_undo, fSelect); + + /* + * Set the starting directory. This is not necessary because when + * the file selector starts it uses the present directory as a default. + */ + setCDKFselect (fSelect, directory, A_NORMAL, ' ', A_REVERSE, + "", "", "", "", ObjOf (fSelect)->box); + myUserList = copyCharList ((const char **)getCDKFselectContents (fSelect, &userSize)); + myUndoList = (UNDO *) malloc ((size_t) userSize * sizeof (UNDO)); + undoSize = 0; + + /* Activate the file selector. */ + filename = activateCDKFselect (fSelect, 0); + + /* Check how the person exited from the widget. */ + if (fSelect->exitType == vESCAPE_HIT) + { + /* Pop up a message for the user. */ + mesg[0] = "Escape hit. No file selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + + /* Exit CDK. */ + destroyCDKFselect (fSelect); + destroyCDKScreen (cdkscreen); + endCDK (); + + ExitProgram (EXIT_SUCCESS); + } + + /* Create the file viewer to view the file selected. */ + example = newCDKViewer (cdkscreen, CENTER, CENTER, 20, -2, + (CDK_CSTRING2)button, 2, A_REVERSE, TRUE, FALSE); + + /* Could we create the viewer widget? */ + if (example == 0) + { + /* Exit CDK. */ + destroyCDKFselect (fSelect); + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Can't seem to create viewer. Is the window too small?\n"); + ExitProgram (EXIT_SUCCESS); + } + + /* Open the file and read the contents. */ + lines = CDKreadFile (filename, &info); + if (lines == -1) + { + filename = copyChar (filename); + + destroyCDKFselect (fSelect); + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Could not open \"%s\"\n", filename); + + ExitProgram (EXIT_FAILURE); + } + + /* Set up the viewer title, and the contents to the widget. */ + sprintf (vTitle, "Filename:%20s", filename); + setCDKViewer (example, vTitle, + (CDK_CSTRING2)info, lines, + A_REVERSE, TRUE, TRUE, TRUE); + + CDKfreeStrings (info); + + /* Destroy the file selector widget. */ + destroyCDKFselect (fSelect); + + /* Activate the viewer widget. */ + selected = activateCDKViewer (example, 0); + + /* Check how the person exited from the widget. */ + if (example->exitType == vESCAPE_HIT) + { + mesg[0] = "Escape hit. No Button selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + else if (example->exitType == vNORMAL) + { + sprintf (temp, "You selected button %d", selected); + mesg[0] = temp; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + + /* Clean up. */ + destroyCDKViewer (example); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/fslider_ex.c b/deps/cdk-5.0-20161210/examples/fslider_ex.c new file mode 100644 index 0000000..739ce0e --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/fslider_ex.c @@ -0,0 +1,102 @@ +/* $Id: fslider_ex.c,v 1.4 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "slider_ex"; +#endif + +/* + * This program demonstrates the Cdk slider widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKFSLIDER *widget = 0; + const char *title = "Enter a value:"; + const char *label = "Current Value:"; + char temp[256]; + const char *mesg[5]; + float selection; + + CDK_PARAMS params; + double high; + double inc; + double low; + + double scale; + int n, digits; + + CDKparseParams (argc, argv, ¶ms, "h:i:l:w:p:" CDK_MIN_PARAMS); + digits = CDKparamNumber2 (¶ms, 'p', 0); + + scale = 1.0; + for (n = 0; n < digits; ++n) + { + scale = scale * 10.0; + } + + /* *INDENT-EQLS* */ + high = CDKparamNumber2 (¶ms, 'h', 100) / scale; + inc = CDKparamNumber2 (¶ms, 'i', 1) / scale; + low = CDKparamNumber2 (¶ms, 'l', 1) / scale; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the widget. */ + widget = newCDKFSlider (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, label, + A_REVERSE | COLOR_PAIR (29) | ' ', + CDKparamNumber2 (¶ms, 'w', 50), + (float)low, + (float)low, + (float)high, + (float)inc, + (float)(inc * 2), + digits, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the widget null? */ + if (widget == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make the widget. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the widget. */ + selection = activateCDKFSlider (widget, 0); + + /* Check the exit value of the widget. */ + if (widget->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No value selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (widget->exitType == vNORMAL) + { + sprintf (temp, "You selected %.*f", digits, selection); + mesg[0] = temp; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up. */ + destroyCDKFSlider (widget); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/graph_ex.c b/deps/cdk-5.0-20161210/examples/graph_ex.c new file mode 100644 index 0000000..2e55faf --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/graph_ex.c @@ -0,0 +1,104 @@ +/* $Id: graph_ex.c,v 1.15 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "graph_ex"; +#endif + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKGRAPH *graph = 0; + CDKLABEL *pausep = 0; + const char *title = 0; + const char *xtitle = 0; + const char *ytitle = 0; + const char *graphChars = 0; + const char *mesg[2]; + int values[20]; + int count; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_CLI_PARAMS); /* -N, -S unused */ + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the graph values. */ + /* *INDENT-EQLS* */ + values[0] = 10; + values[1] = 15; + values[2] = 20; + values[3] = 25; + values[4] = 30; + values[5] = 35; + values[6] = 40; + values[7] = 45; + values[8] = 50; + values[9] = 55; + count = 10; + title = "Test Graph"; + xtitle = "X AXIS TITLE"; + ytitle = "Y AXIS TITLE"; + graphChars = "0123456789"; + + /* Create the label values. */ + mesg[0] = "Press any key when done viewing the graph."; + + /* Create the graph widget. */ + graph = newCDKGraph (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparamValue (¶ms, 'H', 10), + CDKparamValue (¶ms, 'W', 20), + title, xtitle, ytitle); + + /* Is the graph null? */ + if (graph == 0) + { + /* Shut down CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make the graph widget. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Create the label widget. */ + pausep = newCDKLabel (cdkscreen, CENTER, BOTTOM, + (CDK_CSTRING2) mesg, 1, + TRUE, FALSE); + if (pausep == 0) + { + /* Shut down CDK. */ + destroyCDKGraph (graph); + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make the label widget. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Set the graph values. */ + setCDKGraph (graph, values, count, graphChars, FALSE, vPLOT); + + /* Draw the screen. */ + refreshCDKScreen (cdkscreen); + drawCDKGraph (graph, FALSE); + drawCDKLabel (pausep, TRUE); + + /* Pause until the user says so... */ + waitCDKLabel (pausep, 0); + + /* Clean up. */ + destroyCDKGraph (graph); + destroyCDKLabel (pausep); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/hello_ex.c b/deps/cdk-5.0-20161210/examples/hello_ex.c new file mode 100644 index 0000000..c509eb8 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/hello_ex.c @@ -0,0 +1,61 @@ +/* $Id: hello_ex.c,v 1.12 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "hello_ex"; +#endif + +int main (int argc, char **argv) +{ + CDKSCREEN *cdkscreen; + CDKLABEL *demo; + const char *mesg[4]; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Set the labels up. */ + mesg[0] = "<#UL><#HL(30)><#UR>"; + mesg[1] = "<#VL(10)>Hello World!<#VL(10)>"; + mesg[2] = "<#LL><#HL(30)><#LR>"; + + /* Declare the labels. */ + demo = newCDKLabel (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + (CDK_CSTRING2) mesg, 3, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', TRUE)); + + /* Is the label null? */ + if (demo == 0) + { + /* Clean up the memory. */ + destroyCDKScreen (cdkscreen); + + /* End curses... */ + endCDK (); + + printf ("Cannot create the label. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + setCDKLabelBackgroundAttrib (demo, COLOR_PAIR (2)); + + /* Draw the CDK screen. */ + refreshCDKScreen (cdkscreen); + waitCDKLabel (demo, ' '); + + /* Clean up. */ + destroyCDKLabel (demo); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/histogram_ex.c b/deps/cdk-5.0-20161210/examples/histogram_ex.c new file mode 100644 index 0000000..9c8150b --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/histogram_ex.c @@ -0,0 +1,144 @@ +/* $Id: histogram_ex.c,v 1.12 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "histogram_ex"; +#endif + +#if !defined (HAVE_SLEEP) && defined (_WIN32) /* Mingw */ +#define sleep(x) _sleep(x*1000) +#endif + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKHISTOGRAM *volume = 0; + CDKHISTOGRAM *bass = 0; + CDKHISTOGRAM *treble = 0; + const char *volumeTitle = "Volume"; + const char *bassTitle = "Bass "; + const char *trebleTitle = "Treble"; + + CDK_PARAMS params; + boolean Box; + + CDKparseParams (argc, argv, ¶ms, CDK_CLI_PARAMS); + Box = CDKparamValue (¶ms, 'N', TRUE); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Color. */ + initCDKColor (); + + /* Create the histogram objects. */ + volume = newCDKHistogram (cdkscreen, + CDKparamValue (¶ms, 'X', 10), + CDKparamValue (¶ms, 'Y', 10), + CDKparamValue (¶ms, 'H', 1), + CDKparamValue (¶ms, 'W', -2), + HORIZONTAL, volumeTitle, + Box, + CDKparamValue (¶ms, 'S', FALSE)); + if (volume == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make volume histogram. Is the window big enough??\n"); + ExitProgram (EXIT_FAILURE); + } + + bass = newCDKHistogram (cdkscreen, + CDKparamValue (¶ms, 'X', 10), + CDKparamValue (¶ms, 'Y', 14), + CDKparamValue (¶ms, 'H', 1), + CDKparamValue (¶ms, 'W', -2), + HORIZONTAL, bassTitle, + Box, + CDKparamValue (¶ms, 'S', FALSE)); + if (bass == 0) + { + /* Exit CDK. */ + destroyCDKHistogram (volume); + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make bass histogram. Is the window big enough??\n"); + ExitProgram (EXIT_FAILURE); + } + + treble = newCDKHistogram (cdkscreen, + CDKparamValue (¶ms, 'X', 10), + CDKparamValue (¶ms, 'Y', 18), + CDKparamValue (¶ms, 'H', 1), + CDKparamValue (¶ms, 'W', -2), + HORIZONTAL, trebleTitle, + Box, + CDKparamValue (¶ms, 'S', FALSE)); + if (treble == 0) + { + /* Exit CDK. */ + destroyCDKHistogram (volume); + destroyCDKHistogram (bass); + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make treble histogram. Is the window big enough??\n"); + ExitProgram (EXIT_FAILURE); + } + +#define BAR(a,b,c) A_BOLD, a, b, c, ' '|A_REVERSE|COLOR_PAIR(3), Box + + /* Set the histogram values. */ + setCDKHistogram (volume, vPERCENT, CENTER, BAR (0, 10, 6)); + setCDKHistogram (bass, vPERCENT, CENTER, BAR (0, 10, 3)); + setCDKHistogram (treble, vPERCENT, CENTER, BAR (0, 10, 7)); + refreshCDKScreen (cdkscreen); + sleep (4); + + /* Set the histogram values. */ + setCDKHistogram (volume, vPERCENT, CENTER, BAR (0, 10, 8)); + setCDKHistogram (bass, vPERCENT, CENTER, BAR (0, 10, 1)); + setCDKHistogram (treble, vPERCENT, CENTER, BAR (0, 10, 9)); + refreshCDKScreen (cdkscreen); + sleep (4); + + /* Set the histogram values. */ + setCDKHistogram (volume, vPERCENT, CENTER, BAR (0, 10, 10)); + setCDKHistogram (bass, vPERCENT, CENTER, BAR (0, 10, 7)); + setCDKHistogram (treble, vPERCENT, CENTER, BAR (0, 10, 10)); + refreshCDKScreen (cdkscreen); + sleep (4); + + /* Set the histogram values. */ + setCDKHistogram (volume, vPERCENT, CENTER, BAR (0, 10, 1)); + setCDKHistogram (bass, vPERCENT, CENTER, BAR (0, 10, 8)); + setCDKHistogram (treble, vPERCENT, CENTER, BAR (0, 10, 3)); + refreshCDKScreen (cdkscreen); + sleep (4); + + /* Set the histogram values. */ + setCDKHistogram (volume, vPERCENT, CENTER, BAR (0, 10, 3)); + setCDKHistogram (bass, vPERCENT, CENTER, BAR (0, 10, 3)); + setCDKHistogram (treble, vPERCENT, CENTER, BAR (0, 10, 3)); + refreshCDKScreen (cdkscreen); + sleep (4); + + /* Set the histogram values. */ + setCDKHistogram (volume, vPERCENT, CENTER, BAR (0, 10, 10)); + setCDKHistogram (bass, vPERCENT, CENTER, BAR (0, 10, 10)); + setCDKHistogram (treble, vPERCENT, CENTER, BAR (0, 10, 10)); + refreshCDKScreen (cdkscreen); + sleep (4); + + /* Clean up. */ + destroyCDKHistogram (volume); + destroyCDKHistogram (bass); + destroyCDKHistogram (treble); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/itemlist_ex.c b/deps/cdk-5.0-20161210/examples/itemlist_ex.c new file mode 100644 index 0000000..c58a5b5 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/itemlist_ex.c @@ -0,0 +1,121 @@ +/* $Id: itemlist_ex.c,v 1.15 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "itemlist_ex"; +#endif + +#define MONTHS 12 + +/* + * This program demonstrates the Cdk itemlist widget. + * + * Options (in addition to minimal CLI parameters): + * -c create the data after the widget + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKITEMLIST *monthlist = 0; + const char *title = "Pick A Month"; + const char *label = "Month:"; + const char *info[MONTHS]; + const char *mesg[10]; + char temp[256]; + int choice, startMonth; + struct tm *dateInfo; + time_t clck; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "c" CDK_MIN_PARAMS); + + /* + * Get the current date and set the default month to the + * current month. + */ + time (&clck); + dateInfo = localtime (&clck); + startMonth = dateInfo->tm_mon; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK colors. */ + initCDKColor (); + + /* Create the choice list. */ + /* *INDENT-EQLS* */ + info[0] = "January"; + info[1] = "February"; + info[2] = "March"; + info[3] = "April"; + info[4] = "May"; + info[5] = "June"; + info[6] = "July"; + info[7] = "August"; + info[8] = "September"; + info[9] = "October"; + info[10] = "November"; + info[11] = "December"; + + /* Create the itemlist widget. */ + monthlist = newCDKItemlist (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, + label, + (CDKparamNumber (¶ms, 'c') + ? 0 + : (CDK_CSTRING2) info), + (CDKparamNumber (¶ms, 'c') + ? 0 + : MONTHS), + startMonth, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the widget null? */ + if (monthlist == 0) + { + /* Clean up. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the itemlist box. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + if (CDKparamNumber (¶ms, 'c')) + { + setCDKItemlistValues (monthlist, (CDK_CSTRING2) info, MONTHS, 0); + } + + /* Activate the widget. */ + choice = activateCDKItemlist (monthlist, 0); + + /* Check how they exited from the widget. */ + if (monthlist->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No item selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (ScreenOf (monthlist), (CDK_CSTRING2) mesg, 3); + } + else if (monthlist->exitType == vNORMAL) + { + sprintf (temp, "You selected the %dth item which is", choice); + mesg[0] = temp; + mesg[1] = info[choice]; + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + popupLabel (ScreenOf (monthlist), (CDK_CSTRING2) mesg, 4); + } + + /* Clean up. */ + destroyCDKItemlist (monthlist); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/label_ex.c b/deps/cdk-5.0-20161210/examples/label_ex.c new file mode 100644 index 0000000..a70124d --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/label_ex.c @@ -0,0 +1,60 @@ +/* $Id: label_ex.c,v 1.11 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "label_ex"; +#endif + +int main (int argc, char **argv) +{ + CDKSCREEN *cdkscreen; + CDKLABEL *demo; + const char *mesg[10]; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Set the labels up. */ + mesg[0] = "This line should have a yellow foreground and a blue background."; + mesg[1] = "This line should have a white foreground and a blue background."; + mesg[2] = "This line should have a yellow foreground and a red background."; + mesg[3] = "This line should be set to whatever the screen default is."; + + /* Declare the labels. */ + demo = newCDKLabel (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + (CDK_CSTRING2) mesg, 4, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', TRUE)); + + /* Is the label null? */ + if (demo == 0) + { + /* Clean up the memory. */ + destroyCDKScreen (cdkscreen); + + /* End curses... */ + endCDK (); + + printf ("Cannot create the label. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Draw the CDK screen. */ + refreshCDKScreen (cdkscreen); + waitCDKLabel (demo, ' '); + + /* Clean up. */ + destroyCDKLabel (demo); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/lowerCDKObject_ex.c b/deps/cdk-5.0-20161210/examples/lowerCDKObject_ex.c new file mode 100644 index 0000000..66106af --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/lowerCDKObject_ex.c @@ -0,0 +1,83 @@ +/* $Id: lowerCDKObject_ex.c,v 1.10 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "lowerCDKObject_ex"; +#endif + +int main (int argc, char **argv) +{ + char ch; + + const char *mesg[1]; + const char *mesg1[10]; + const char *mesg2[10]; + + CDKSCREEN *cdkscreen; + CDKLABEL *label1, *label2, *instruct; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + mesg1[0] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[1] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[2] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[3] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[4] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[5] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[6] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[7] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[8] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[9] = "label1 label1 label1 label1 label1 label1 label1"; + label1 = newCDKLabel (cdkscreen, 8, 5, (CDK_CSTRING2) mesg1, 10, TRUE, FALSE); + + mesg2[0] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[1] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[2] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[3] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[4] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[5] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[6] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[7] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[8] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[9] = "label2 label2 label2 label2 label2 label2 label2"; + label2 = newCDKLabel (cdkscreen, 14, 9, (CDK_CSTRING2) mesg2, 10, TRUE, FALSE); + + mesg[0] = "1 - lower label1, 2 - lower label2, q - quit"; + instruct = newCDKLabel (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', BOTTOM), + (CDK_CSTRING2) mesg, 1, + CDKparamValue (¶ms, 'N', FALSE), + CDKparamValue (¶ms, 'S', FALSE)); + + refreshCDKScreen (cdkscreen); + + while ((ch = (char)getch ()) != 'q') + { + switch (ch) + { + case '1': + lowerCDKObject (vLABEL, label1); + break; + case '2': + lowerCDKObject (vLABEL, label2); + break; + default: + continue; + } + refreshCDKScreen (cdkscreen); + } + + /* Clean up. */ + destroyCDKLabel (label1); + destroyCDKLabel (label2); + destroyCDKLabel (instruct); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/marquee_ex.c b/deps/cdk-5.0-20161210/examples/marquee_ex.c new file mode 100644 index 0000000..b53802d --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/marquee_ex.c @@ -0,0 +1,162 @@ +/* $Id: marquee_ex.c,v 1.13 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "marquee_ex"; +#endif + +static char startAttr[100]; +static char endAttr[100]; + +/* + * This spits out help about this demo program. + */ +static void help (char *programName) +{ + const char *USAGE = "[-m Message] [-R repeat value] [-d delay value] [-b|r|u|k] [-h]"; + + printf ("Usage: %s %s\n", programName, USAGE); + printf (" -m TEXT Sets the message to display in the marquee\n"); + printf (" If no message is provided, one will be created.\n"); + printf (" -R COUNT Repeat the message the given COUNT.\n"); + printf (" A of -1 repeats the message forever.\n"); + printf (" -d COUNT number of milliseconds to delay between repeats.\n"); + printf (" -b display the message with the bold attribute.\n"); + printf (" -r display the message with a reversed attribute.\n"); + printf (" -u display the message with an underline attribute.\n"); + printf (" -k display the message with the blinking attribute.\n"); +} + +static void myParseAttr (CDK_PARAMS * params, int lower, int upper) +{ + if (CDKparamString (params, lower) != 0) + { + char starting[3]; + char ending[3]; + + if (startAttr[0] == '\0') + { + startAttr[0] = '<'; + endAttr[0] = '<'; + } + sprintf (starting, "/%c", upper); + sprintf (ending, "!%c", upper); + strcat (startAttr, starting); + strcat (endAttr, ending); + } +} + +int main (int argc, char **argv) +{ + /* *INDENT-OFF* */ + CDKSCREEN *cdkscreen; + CDKMARQUEE *scrollMessage; + char message[1024]; + time_t clck; + + CDK_PARAMS params; + char *mesg; + int delay; + int repeat; + /* *INDENT-ON* */ + + + CDKparseParams (argc, argv, ¶ms, "brkud:R:m:hw:" CDK_MIN_PARAMS); + myParseAttr (¶ms, 'b', 'B'); + myParseAttr (¶ms, 'r', 'R'); + myParseAttr (¶ms, 'k', 'K'); + myParseAttr (¶ms, 'u', 'U'); + repeat = CDKparamNumber2 (¶ms, 'R', 3); + delay = CDKparamNumber2 (¶ms, 'd', 5); + mesg = CDKparamString (¶ms, 'm'); + + if (CDKparamString (¶ms, 'h') != 0) + help (argv[0]); + + /* Clean up the strings. */ + cleanChar (message, sizeof (message), '\0'); + cleanChar (startAttr, sizeof (startAttr), '\0'); + cleanChar (endAttr, sizeof (endAttr), '\0'); + + /* Put the end of the attributes if they asked for then. */ + if (startAttr[0] == '<') + { + strcat (startAttr, ">"); + strcat (endAttr, ">"); + } + + cdkscreen = initCDKScreen (NULL); + curs_set (0); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the marquee. */ + scrollMessage = newCDKMarquee (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', TOP), + CDKparamValue (¶ms, 'w', 30), + CDKparamValue (¶ms, 'N', FALSE), + CDKparamValue (¶ms, 'S', TRUE)); + + /* Check if the marquee is null. */ + if (scrollMessage == 0) + { + /* Exit Cdk. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the marquee window. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Draw the CDK screen. */ + refreshCDKScreen (cdkscreen); + + /* Create the marquee message. */ + if (mesg == 0) + { + char *currentTime; + + /* Get the current time and chop off the newline. */ + time (&clck); + currentTime = ctime (&clck); + currentTime[strlen (currentTime) - 1] = 0; + + if (startAttr[0] != '\0') + { + currentTime[strlen (currentTime) - 1] = '\0'; + sprintf (message, "%s%s%s (This Space For Rent) ", + startAttr, + currentTime, + endAttr); + } + else + { + sprintf (message, "%s (This Space For Rent) ", currentTime); + } + } + else + { + if (startAttr[0] != '\0') + { + sprintf (message, "%s%s%s ", startAttr, mesg, endAttr); + } + else + { + sprintf (message, "%s ", mesg); + } + } + + /* Run the marquee. */ + activateCDKMarquee (scrollMessage, message, delay, repeat, TRUE); + activateCDKMarquee (scrollMessage, message, delay, repeat, FALSE); + activateCDKMarquee (scrollMessage, message, delay, repeat, TRUE); + + /* Clean up. */ + destroyCDKMarquee (scrollMessage); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/matrix_ex.c b/deps/cdk-5.0-20161210/examples/matrix_ex.c new file mode 100644 index 0000000..4ee39bb --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/matrix_ex.c @@ -0,0 +1,147 @@ +/* $Id: matrix_ex.c,v 1.19 2016/12/10 13:29:08 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "matrix_ex"; +#endif + +#define MY_COLS 10 + +/* + * This program demonstrates the Cdk matrix widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKMATRIX *courseList = 0; + const char *title = 0; + int rows = 8; + int cols = 5; + int vrows = 3; + int vcols = 5; + + bool use_coltitles; + bool use_rowtitles; + + const char *coltitle[MY_COLS]; + const char *rowtitle[MY_COLS]; + const char *mesg[MY_COLS]; + + int colwidth[MY_COLS]; + int colvalue[MY_COLS]; + + int col_spacing; + int row_spacing; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "trcT:C:R:" CDK_MIN_PARAMS); + + /* invert, so giving -S causes the shadow to turn off */ + params.Shadow = !params.Shadow; + + /* cancel the default title, or supply a new one */ + if (CDKparamValue (¶ms, 't', FALSE)) + { + title = 0; + } + else if ((title = CDKparamString (¶ms, 'T')) == 0) + { + title = "This is the CDK\nmatrix widget.\n<#LT><#HL(30)><#RT>"; + } + + /* allow cancelling of column and/or row titles with -c and/or -r */ + use_coltitles = !CDKparamValue (¶ms, 'c', FALSE); + use_rowtitles = !CDKparamValue (¶ms, 'r', FALSE); + col_spacing = CDKparamNumber2 (¶ms, 'C', -1); + row_spacing = CDKparamNumber2 (¶ms, 'R', -1); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the horizontal and vertical matrix labels. */ +#define set_col(n, width, string) \ + coltitle[n] = use_coltitles ? string : 0 ;\ + colwidth[n] = width ;\ + colvalue[n] = vUMIXED + + set_col (1, 7, "Course"); + set_col (2, 7, "Lec 1"); + set_col (3, 7, "Lec 2"); + set_col (4, 7, "Lec 3"); + set_col (5, 1, "Flag"); + +#define set_row(n, string) \ + rowtitle[n] = use_rowtitles ? "" string : 0 + + set_row (1, "Course 1"); + set_row (2, "Course 2"); + set_row (3, "Course 3"); + set_row (4, "Course 4"); + set_row (5, "Course 5"); + set_row (6, "Course 6"); + set_row (7, "Course 7"); + set_row (8, "Course 8"); + + /* Create the matrix object. */ + courseList = newCDKMatrix (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + rows, cols, vrows, vcols, + title, + (CDK_CSTRING2)rowtitle, + (CDK_CSTRING2)coltitle, + colwidth, colvalue, + col_spacing, row_spacing, '.', + COL, params.Box, + params.Box, + params.Shadow); + + /* Check to see if the matrix is null. */ + if (courseList == 0) + { + /* Clean up. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the matrix widget.\n"); + printf ("Is the window too small ?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the matrix. */ + activateCDKMatrix (courseList, 0); + + /* Check if the user hit escape or not. */ + if (courseList->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No information passed back."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + else if (courseList->exitType == vNORMAL) + { + char temp[80]; + + sprintf (temp, "Current cell (%d,%d)", courseList->crow, courseList->ccol); + mesg[0] = "You exited the matrix normally."; + mesg[1] = temp; + mesg[2] = "To get the contents of the matrix cell, you can"; + mesg[3] = "use getCDKMatrixCell():"; + mesg[4] = getCDKMatrixCell (courseList, courseList->crow, courseList->ccol); + mesg[5] = ""; + mesg[6] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 7); + } + + /* Clean up. */ + destroyCDKMatrix (courseList); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/mentry_ex.c b/deps/cdk-5.0-20161210/examples/mentry_ex.c new file mode 100644 index 0000000..5229f80 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/mentry_ex.c @@ -0,0 +1,69 @@ +/* $Id: mentry_ex.c,v 1.11 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "mentry_ex"; +#endif + +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKMENTRY *widget = 0; + char *info = 0; + const char *label = "Message"; + const char *title = "Enter a message."; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "w:h:l:" CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Set up the multi-line entry field. */ + widget = newCDKMentry (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, label, A_BOLD, '.', vMIXED, + CDKparamValue (¶ms, 'w', 20), + CDKparamValue (¶ms, 'h', 5), + CDKparamValue (¶ms, 'l', 20), + 0, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the object null? */ + if (widget == 0) + { + /* Shut down CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create CDK object. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Draw the CDK screen. */ + refreshCDKScreen (cdkscreen); + + /* Set what ever was given from the command line. */ + setCDKMentry (widget, argv[optind], 0, TRUE); + + /* Activate this thing. */ + activateCDKMentry (widget, 0); + info = strdup (widget->info); + + /* Clean up. */ + destroyCDKMentry (widget); + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("\n\n\n"); + printf ("Your message was : <%s>\n", info); + free (info); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/menu_ex.c b/deps/cdk-5.0-20161210/examples/menu_ex.c new file mode 100644 index 0000000..ecc0962 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/menu_ex.c @@ -0,0 +1,159 @@ +/* $Id: menu_ex.c,v 1.13 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "menu_ex"; +#endif + +static int displayCallback (EObjectType cdktype, void *object, + void *clientData, + chtype input); +static const char *menulist[MAX_MENU_ITEMS][MAX_SUB_ITEMS]; +static const char *menuInfo[3][4] = +{ + { + "", + "This saves the current info.", + "This exits the program.", + "" + }, + { + "", + "This cuts text", + "This copies text", + "This pastes text" + }, + { + "", + "Help for editing", + "Help for file management", + "Info about the program"} +}; + +/* + * This program demonstratres the Cdk menu widget. + */ +int main (void) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKLABEL *infoBox = 0; + CDKMENU *menu = 0; + int submenusize[3], menuloc[4]; + const char *mesg[5]; + char temp[256]; + int selection; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK color. */ + initCDKColor (); + + /* Set up the menu. */ + menulist[0][0] = "File"; + menulist[0][1] = "Save"; + menulist[0][2] = "Exit"; + + menulist[1][0] = "Edit"; + menulist[1][1] = "Cut "; + menulist[1][2] = "Copy"; + menulist[1][3] = "Paste"; + + menulist[2][0] = "Help"; + menulist[2][1] = "On Edit "; + menulist[2][2] = "On File "; + menulist[2][3] = "About..."; + + submenusize[0] = 3; + submenusize[1] = 4; + submenusize[2] = 4; + + menuloc[0] = LEFT; + menuloc[1] = LEFT; + menuloc[2] = RIGHT; + + /* Create the label window. */ + mesg[0] = " "; + mesg[1] = " "; + mesg[2] = " "; + mesg[3] = " "; + infoBox = newCDKLabel (cdkscreen, CENTER, CENTER, + (CDK_CSTRING2) mesg, 4, + TRUE, TRUE); + + /* Create the menu. */ + menu = newCDKMenu (cdkscreen, menulist, 3, submenusize, menuloc, + TOP, A_UNDERLINE, A_REVERSE); + + /* Create the post process function. */ + setCDKMenuPostProcess (menu, displayCallback, infoBox); + + /* Draw the CDK screen. */ + refreshCDKScreen (cdkscreen); + + /* Activate the menu. */ + selection = activateCDKMenu (menu, 0); + + /* Determine how the user exited from the widget. */ + if (menu->exitType == vEARLY_EXIT) + { + mesg[0] = "You hit escape. No menu item was selected."; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (menu->exitType == vNORMAL) + { + sprintf (temp, "You selected menu #%d, submenu #%d", + selection / 100, + selection % 100); + mesg[0] = temp; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up. */ + destroyCDKMenu (menu); + destroyCDKLabel (infoBox); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} + +/* + * This gets called after every movement. + */ +static int displayCallback (EObjectType cdktype GCC_UNUSED, void *object, + void *clientData, + chtype input GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + CDKMENU *menu = (CDKMENU *)object; + CDKLABEL *infoBox = (CDKLABEL *)clientData; + char *mesg[10]; + char temp[256]; + + /* Recreate the label message. */ + sprintf (temp, "Title: %.*s", + (int)(sizeof (temp) - 20), + menulist[menu->currentTitle][0]); + mesg[0] = strdup (temp); + sprintf (temp, "Sub-Title: %.*s", + (int)(sizeof (temp) - 20), + menulist[menu->currentTitle][menu->currentSubtitle + 1]); + mesg[1] = strdup (temp); + mesg[2] = strdup (""); + sprintf (temp, "%.*s", + (int)(sizeof (temp) - 20), + menuInfo[menu->currentTitle][menu->currentSubtitle + 1]); + mesg[3] = strdup (temp); + + /* Set the message of the label. */ + setCDKLabel (infoBox, (CDK_CSTRING2) mesg, 4, TRUE); + drawCDKLabel (infoBox, TRUE); + + freeCharList (mesg, 4); + return 0; +} diff --git a/deps/cdk-5.0-20161210/examples/position_ex.c b/deps/cdk-5.0-20161210/examples/position_ex.c new file mode 100644 index 0000000..65685f1 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/position_ex.c @@ -0,0 +1,82 @@ +/* $Id: position_ex.c,v 1.15 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "position_ex"; +#endif + +/* + * This demonstrates the positioning of a Cdk entry field widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKENTRY *directory = 0; + const char *label = "Directory: "; + char *info = 0; + const char *mesg[10]; + char temp[256]; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "w:" CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK colors. */ + initCDKColor (); + + /* Create the entry field widget. */ + directory = newCDKEntry (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + 0, label, A_NORMAL, '.', vMIXED, + CDKparamValue (¶ms, 'w', 40), + 0, 256, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the widget null? */ + if (directory == 0) + { + /* Clean up. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the entry box. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Let the user move the widget around the window. */ + drawCDKEntry (directory, ObjOf (directory)->box); + positionCDKEntry (directory); + + /* Activate the entry field. */ + info = activateCDKEntry (directory, 0); + + /* Tell them what they typed. */ + if (directory->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No information passed back."; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (directory->exitType == vNORMAL) + { + mesg[0] = "You typed in the following"; + sprintf (temp, "(%.*s)", (int)(sizeof (temp) - 20), info); + mesg[1] = temp; + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 4); + } + + /* Clean up and exit. */ + destroyCDKEntry (directory); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/preprocess_ex.c b/deps/cdk-5.0-20161210/examples/preprocess_ex.c new file mode 100644 index 0000000..32f350d --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/preprocess_ex.c @@ -0,0 +1,108 @@ +/* $Id: preprocess_ex.c,v 1.20 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "preprocess_ex"; +#endif + +static BINDFN_PROTO (entryPreProcessCB); + +/* + * This demonstrates the Cdk preprocess feature. + */ +int main (void) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKENTRY *widget = 0; + const char *title = "Type in anything you want\nbut the dreaded letter G!"; + char *info; + const char *mesg[10]; + char temp[256]; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK colors. */ + initCDKColor (); + + /* Create the entry field widget. */ + widget = newCDKEntry (cdkscreen, CENTER, CENTER, + title, 0, A_NORMAL, '.', vMIXED, + 40, 0, 256, TRUE, FALSE); + + /* Is the widget null? */ + if (widget == 0) + { + /* Clean up. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the entry box. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + setCDKEntryPreProcess (widget, entryPreProcessCB, 0); + + /* Activate the entry field. */ + info = activateCDKEntry (widget, 0); + + /* Tell them what they typed. */ + if (widget->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No information passed back."; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + else if (widget->exitType == vNORMAL) + { + mesg[0] = "You typed in the following"; + sprintf (temp, "(%.*s)", (int)(sizeof (temp) - 20), info); + mesg[1] = temp; + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 4); + } + + /* Clean up and exit. */ + destroyCDKEntry (widget); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} + +static int entryPreProcessCB (EObjectType cdkType GCC_UNUSED, void *object, + void *clientData GCC_UNUSED, + chtype input) +{ + CDKENTRY *entry = (CDKENTRY *)object; + + /* Check the input. */ + if ((input == 'g') || (input == 'G')) + { + /* *INDENT-EQLS* */ + CDKDIALOG *widget = 0; + int buttonCount = 1; + int lines = 0; + const char *buttons[] = + { + "OK" + }; + const char *mesg[5]; + + mesg[lines++] = "<#HL(30)>"; + mesg[lines++] = "I told you NOT to type G"; + mesg[lines++] = "<#HL(30)>"; + + widget = newCDKDialog (ScreenOf (entry), CENTER, CENTER, + (CDK_CSTRING2)mesg, lines, + (CDK_CSTRING2)buttons, buttonCount, + A_REVERSE, FALSE, TRUE, FALSE); + activateCDKDialog (widget, 0); + destroyCDKDialog (widget); + drawCDKEntry (entry, ObjOf (entry)->box); + return 0; + } + return 1; +} diff --git a/deps/cdk-5.0-20161210/examples/radio1_ex.c b/deps/cdk-5.0-20161210/examples/radio1_ex.c new file mode 100644 index 0000000..9d5d4d5 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/radio1_ex.c @@ -0,0 +1,87 @@ +/* $Id: radio1_ex.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "radio_ex"; +#endif + +/* + * This program demonstrates the Cdk radio widget. + */ +int main (int argc, char **argv) +{ + CDKSCREEN *cdkscreen; + CDKRADIO *radio; + const char *item[5] = + { + "Choice A", + "Choice B", + "Choice C" + }; + const char *mesg[5]; + char temp[100]; + int selection; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "s:t:" CDK_CLI_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Set up CDK Colors. */ + initCDKColor (); + + /* Create the radio list. */ + radio = newCDKRadio (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparsePosition (CDKparamString2 (¶ms, 's', + "NONE")), + CDKparamValue (¶ms, 'H', 5), + CDKparamValue (¶ms, 'W', 20), + CDKparamString (¶ms, 't'), + (CDK_CSTRING2)item, 3, + '#' | A_REVERSE, 1, + A_REVERSE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Check if the radio list is NULL. */ + if (radio == (CDKRADIO *)NULL) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the radio widget. "); + printf ("Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the radio list. */ + selection = activateCDKRadio (radio, (chtype *)NULL); + + /* Check the exit status of the widget. */ + if (radio->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No item selected."; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + else if (radio->exitType == vNORMAL) + { + mesg[0] = "You selected the filename"; + sprintf (temp, "%.*s", (int)(sizeof (temp) - 20), item[selection]); + mesg[1] = temp; + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 4); + } + + destroyCDKRadio (radio); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/radio_ex.c b/deps/cdk-5.0-20161210/examples/radio_ex.c new file mode 100644 index 0000000..8607cbb --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/radio_ex.c @@ -0,0 +1,137 @@ +/* $Id: radio_ex.c,v 1.20 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "radio_ex"; +#endif + +/* + * This program demonstrates the Cdk radio widget. + * + * Options (in addition to normal CLI parameters): + * -c create the data after the widget + * -s SPOS location for the scrollbar + * -t TEXT title for the widget + * + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKRADIO *radio = 0; + const char *title = "Select a filename"; + char **item = 0; + const char *mesg[5]; + char temp[256]; + int count; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "cs:t:" CDK_CLI_PARAMS); + + /* Use the current diretory list to fill the radio list. */ + count = CDKgetDirectoryContents (".", &item); + if (count <= 0) + { + fprintf (stderr, "Cannot get directory list\n"); + ExitProgram (EXIT_FAILURE); + } + + cdkscreen = initCDKScreen (NULL); + + /* Set up CDK Colors. */ + initCDKColor (); + + /* Create the radio list. */ + radio = newCDKRadio (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparsePosition (CDKparamString2 (¶ms, + 's', + "RIGHT")), + CDKparamValue (¶ms, 'H', 10), + CDKparamValue (¶ms, 'W', 40), + CDKparamString2 (¶ms, 't', title), + CDKparamNumber (¶ms, 'c') ? 0 : (CDK_CSTRING2)item, + CDKparamNumber (¶ms, 'c') ? 0 : count, + '#' | A_REVERSE, 1, + A_REVERSE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Check if the radio list is null. */ + if (radio == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the radio widget. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + if (CDKparamNumber (¶ms, 'c')) + { + setCDKRadioItems (radio, (CDK_CSTRING2)item, count); + } + + /* loop until user selects a file, or cancels */ + for (;;) + { + /* Activate the radio list. */ + int selection = activateCDKRadio (radio, 0); + + /* Check the exit status of the widget. */ + if (radio->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No item selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + break; + } + else if (radio->exitType == vNORMAL) + { + struct stat sb; + + if (stat (item[selection], &sb) == 0 + && (sb.st_mode & S_IFMT) == S_IFDIR) + { + char **nitem = 0; + + mesg[0] = "You selected a directory"; + sprintf (temp, "%.*s", (int)(sizeof (temp) - 20), item[selection]); + mesg[1] = temp; + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 4); + count = CDKgetDirectoryContents (item[selection], &nitem); + if (count > 0) + { + CDKfreeStrings (item); + item = nitem; + if (chdir (item[selection]) == 0) + setCDKRadioItems (radio, (CDK_CSTRING2)item, count); + } + } + else + { + mesg[0] = "You selected the filename"; + sprintf (temp, "%.*s", (int)(sizeof (temp) - 20), item[selection]); + mesg[1] = temp; + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 4); + break; + } + } + } + + /* Clean up. */ + CDKfreeStrings (item); + destroyCDKRadio (radio); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/raiseCDKObject_ex.c b/deps/cdk-5.0-20161210/examples/raiseCDKObject_ex.c new file mode 100644 index 0000000..b6e7e88 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/raiseCDKObject_ex.c @@ -0,0 +1,142 @@ +/* $Id: raiseCDKObject_ex.c,v 1.12 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "raiseCDKObject_ex"; +#endif + +#define MY_LABEL(p) ((chtype)ObjOf(p)->screenIndex | 0x30 | A_UNDERLINE | A_BOLD) + +int main (int argc, char **argv) +{ + char ch; + + const char *mesg[1]; + const char *mesg1[10]; + const char *mesg2[10]; + const char *mesg3[10]; + const char *mesg4[10]; + + CDKSCREEN *cdkscreen; + CDKLABEL *label1, *label2, *label3, *label4, *instruct; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + mesg1[0] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[1] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[2] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[3] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[4] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[5] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[6] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[7] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[8] = "label1 label1 label1 label1 label1 label1 label1"; + mesg1[9] = "label1 label1 label1 label1 label1 label1 label1"; + label1 = newCDKLabel (cdkscreen, 10, 4, (CDK_CSTRING2)mesg1, 10, TRUE, FALSE); + setCDKLabelULChar (label1, '1' | A_BOLD); + + mesg2[0] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[1] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[2] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[3] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[4] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[5] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[6] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[7] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[8] = "label2 label2 label2 label2 label2 label2 label2"; + mesg2[9] = "label2 label2 label2 label2 label2 label2 label2"; + label2 = newCDKLabel (cdkscreen, 8, 8, (CDK_CSTRING2)mesg2, 10, TRUE, FALSE); + setCDKLabelULChar (label2, '2' | A_BOLD); + + mesg3[0] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[1] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[2] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[3] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[4] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[5] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[6] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[7] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[8] = "label3 label3 label3 label3 label3 label3 label3"; + mesg3[9] = "label3 label3 label3 label3 label3 label3 label3"; + label3 = newCDKLabel (cdkscreen, 6, 12, (CDK_CSTRING2)mesg3, 10, TRUE, FALSE); + setCDKLabelULChar (label3, '3' | A_BOLD); + + mesg4[0] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[1] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[2] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[3] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[4] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[5] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[6] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[7] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[8] = "label4 label4 label4 label4 label4 label4 label4"; + mesg4[9] = "label4 label4 label4 label4 label4 label4 label4"; + label4 = newCDKLabel (cdkscreen, 4, 16, (CDK_CSTRING2)mesg4, 10, TRUE, FALSE); + setCDKLabelULChar (label4, '4' | A_BOLD); + + mesg[0] = "# - raise label#, r - redraw, q - quit"; + instruct = newCDKLabel (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', BOTTOM), + (CDK_CSTRING2)mesg, 1, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + setCDKLabelULChar (instruct, ' ' | A_NORMAL); + setCDKLabelURChar (instruct, ' ' | A_NORMAL); + setCDKLabelLLChar (instruct, ' ' | A_NORMAL); + setCDKLabelVerticalChar (instruct, ' ' | A_NORMAL); + setCDKLabelHorizontalChar (instruct, ' ' | A_NORMAL); + + setCDKLabelLRChar (label1, MY_LABEL (label1)); + setCDKLabelLRChar (label2, MY_LABEL (label2)); + setCDKLabelLRChar (label3, MY_LABEL (label3)); + setCDKLabelLRChar (label4, MY_LABEL (label4)); + setCDKLabelLRChar (instruct, MY_LABEL (instruct)); + refreshCDKScreen (cdkscreen); + + while ((ch = (char)getch ()) != 'q') + { + switch (ch) + { + case '1': + raiseCDKObject (vLABEL, label1); + break; + case '2': + raiseCDKObject (vLABEL, label2); + break; + case '3': + raiseCDKObject (vLABEL, label3); + break; + case '4': + raiseCDKObject (vLABEL, label4); + break; + case 'r': + refreshCDKScreen (cdkscreen); + break; + default: + continue; + } + + setCDKLabelLRChar (label1, MY_LABEL (label1)); + setCDKLabelLRChar (label2, MY_LABEL (label2)); + setCDKLabelLRChar (label3, MY_LABEL (label3)); + setCDKLabelLRChar (label4, MY_LABEL (label4)); + setCDKLabelLRChar (instruct, MY_LABEL (instruct)); + refreshCDKScreen (cdkscreen); + } + + /* Clean up. */ + destroyCDKLabel (label1); + destroyCDKLabel (label2); + destroyCDKLabel (label3); + destroyCDKLabel (label4); + destroyCDKLabel (instruct); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/scale_ex.c b/deps/cdk-5.0-20161210/examples/scale_ex.c new file mode 100644 index 0000000..cb333b3 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/scale_ex.c @@ -0,0 +1,86 @@ +/* $Id: scale_ex.c,v 1.11 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "scale_ex"; +#endif + +/* + * This program demonstrates the Cdk scale widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKSCALE *widget = 0; + const char *title = "Select a value"; + const char *label = "Current value"; + char temp[256]; + const char *mesg[5]; + int selection; + + CDK_PARAMS params; + int high; + int inc; + int low; + + CDKparseParams (argc, argv, ¶ms, "h:i:l:w:" CDK_MIN_PARAMS); + high = CDKparamNumber2 (¶ms, 'h', 100); + inc = CDKparamNumber2 (¶ms, 'i', 1); + low = CDKparamNumber2 (¶ms, 'l', 0); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the widget. */ + widget = newCDKScale (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, label, + A_NORMAL, + CDKparamNumber2 (¶ms, 'w', 5), + low, low, high, + inc, (inc * 2), + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the widget null? */ + if (widget == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make the widget. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the widget. */ + selection = activateCDKScale (widget, 0); + + /* Check the exit value of the widget. */ + if (widget->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No value selected."; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (widget->exitType == vNORMAL) + { + sprintf (temp, "You selected %d", selection); + mesg[0] = temp; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up. */ + destroyCDKScale (widget); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/scroll_ex.c b/deps/cdk-5.0-20161210/examples/scroll_ex.c new file mode 100644 index 0000000..e8b42e4 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/scroll_ex.c @@ -0,0 +1,178 @@ +/* $Id: scroll_ex.c,v 1.25 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "scroll_ex"; +#endif + +static char *newLabel (const char *prefix) +{ + static int count; + static char result[80]; + sprintf (result, "%s%d", prefix, ++count); + return result; +} + +static int addItemCB (EObjectType cdktype GCC_UNUSED, + void *object, + void *clientData GCC_UNUSED, + chtype input GCC_UNUSED) +{ + CDKSCROLL *s = (CDKSCROLL *)object; + + addCDKScrollItem (s, newLabel ("add")); + + refreshCDKScreen (ScreenOf (s)); + + return (TRUE); +} + +static int insItemCB (EObjectType cdktype GCC_UNUSED, + void *object, + void *clientData GCC_UNUSED, + chtype input GCC_UNUSED) +{ + CDKSCROLL *s = (CDKSCROLL *)object; + + insertCDKScrollItem (s, newLabel ("insert")); + + refreshCDKScreen (ScreenOf (s)); + + return (TRUE); +} + +static int delItemCB (EObjectType cdktype GCC_UNUSED, + void *object, + void *clientData GCC_UNUSED, + chtype input GCC_UNUSED) +{ + CDKSCROLL *s = (CDKSCROLL *)object; + + deleteCDKScrollItem (s, getCDKScrollCurrent (s)); + + refreshCDKScreen (ScreenOf (s)); + + return (TRUE); +} + +/* + * This program demonstrates the Cdk scrolling list widget. + * + * Options (in addition to normal CLI parameters): + * -c create the data after the widget + * -s SPOS location for the scrollbar + * -t TEXT title for the widget + */ +int main (int argc, char **argv) +{ + /* Declare variables. */ + CDKSCREEN *cdkscreen = 0; + CDKSCROLL *scrollList = 0; + const char *title = "Pick a file"; + char **item = 0; + const char *mesg[5]; + char temp[256]; + int selection, count; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "cs:t:" CDK_CLI_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Set up CDK Colors. */ + initCDKColor (); + + /* Use the current diretory list to fill the radio list. */ + count = CDKgetDirectoryContents (".", &item); + + /* Create the scrolling list. */ + scrollList = newCDKScroll (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparsePosition (CDKparamString2 (¶ms, + 's', + "RIGHT")), + CDKparamValue (¶ms, 'H', 10), + CDKparamValue (¶ms, 'W', 50), + CDKparamString2 (¶ms, 't', title), + (CDKparamNumber (¶ms, 'c') + ? 0 + : (CDK_CSTRING2) item), + (CDKparamNumber (¶ms, 'c') + ? 0 + : count), + TRUE, + A_REVERSE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the scrolling list null? */ + if (scrollList == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make scrolling list. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + if (CDKparamNumber (¶ms, 'c')) + { + setCDKScrollItems (scrollList, (CDK_CSTRING2) item, count, TRUE); + } +#if 0 + drawCDKScroll (scrollList, 1); + + setCDKScrollPosition (scrollList, 10); + drawCDKScroll (scrollList, 1); + sleep (3); + + setCDKScrollPosition (scrollList, 20); + drawCDKScroll (scrollList, 1); + sleep (3); + + setCDKScrollPosition (scrollList, 30); + drawCDKScroll (scrollList, 1); + sleep (3); + + setCDKScrollPosition (scrollList, 70); + drawCDKScroll (scrollList, 1); + sleep (3); +#endif + bindCDKObject (vSCROLL, scrollList, 'a', addItemCB, NULL); + bindCDKObject (vSCROLL, scrollList, 'i', insItemCB, NULL); + bindCDKObject (vSCROLL, scrollList, 'd', delItemCB, NULL); + + /* Activate the scrolling list. */ + + selection = activateCDKScroll (scrollList, 0); + + /* Determine how the widget was exited. */ + if (scrollList->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No file selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (scrollList->exitType == vNORMAL) + { + char *theItem = chtype2Char (scrollList->item[selection]); + mesg[0] = "You selected the following file"; + sprintf (temp, "%.*s", (int)(sizeof (temp) - 20), theItem); + mesg[1] = temp; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + freeChar (theItem); + } + + /* Clean up. */ + CDKfreeStrings (item); + destroyCDKScroll (scrollList); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/selection_ex.c b/deps/cdk-5.0-20161210/examples/selection_ex.c new file mode 100644 index 0000000..df868a6 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/selection_ex.c @@ -0,0 +1,164 @@ +/* $Id: selection_ex.c,v 1.21 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "selection_ex"; +#endif + +/* + * This program demonstrates the Cdk selection widget. + * + * Options (in addition to normal CLI parameters): + * -c create the data after the widget + * -f TEXT title for a footer label + * -h TEXT title for a header label + * -s SPOS location for the scrollbar + * -t TEXT title for the widget + * + */ +int main (int argc, char **argv) +{ + static const char *choices[] = + { + " ", + "-->" + }; + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKSELECTION *selection = 0; + const char *title = "Pick one or more accounts."; + char *title_string = 0; + char **item = 0; + char temp[256]; + const char *mesg[200]; +#if defined (HAVE_PWD_H) + struct passwd *ent; +#endif + unsigned x, y; + unsigned used = 0; + unsigned count = 0; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "cf:h:s:t:" CDK_CLI_PARAMS); + + /* Use the account names to create a list. */ + count = 0; +#if defined (HAVE_PWD_H) + while ((ent = getpwent ()) != 0) + { + used = CDKallocStrings (&item, ent->pw_name, count++, used); + } + endpwent (); +#endif + count--; + + cdkscreen = initCDKScreen (NULL); + + /* Set up CDK Colors. */ + initCDKColor (); + + if ((title_string = CDKparamString2 (¶ms, 'h', 0)) != 0) + { + const char *list[2]; + CDKLABEL *header; + + list[0] = title_string; + list[1] = 0; + header = newCDKLabel (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', TOP), + (CDK_CSTRING2)list, 1, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', TRUE)); + if (header != 0) + activateCDKLabel (header, 0); + } + + if ((title_string = CDKparamString2 (¶ms, 'f', 0)) != 0) + { + const char *list[2]; + CDKLABEL *footer; + + list[0] = title_string; + list[1] = 0; + footer = newCDKLabel (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', BOTTOM), + (CDK_CSTRING2)list, 1, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', TRUE)); + if (footer != 0) + activateCDKLabel (footer, 0); + } + /* Create the selection list. */ + selection = newCDKSelection (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparsePosition + (CDKparamString2 (¶ms, 's', "RIGHT")), + CDKparamValue (¶ms, 'H', 10), + CDKparamValue (¶ms, 'W', 50), + CDKparamString2 (¶ms, 't', title), + (CDKparamNumber (¶ms, 'c') + ? 0 + : (CDK_CSTRING2)item), + (CDKparamNumber (¶ms, 'c') + ? 0 + : (int)count), + (CDK_CSTRING2)choices, 2, + A_REVERSE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the selection list null? */ + if (selection == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot to create the selection list.\n"); + printf ("Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + if (CDKparamNumber (¶ms, 'c')) + { + setCDKSelectionItems (selection, (CDK_CSTRING2)item, (int)count); + } + + /* Activate the selection list. */ + activateCDKSelection (selection, 0); + + /* Check the exit status of the widget. */ + if (selection->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No items selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + else if (selection->exitType == vNORMAL) + { + mesg[0] = "Here are the accounts you selected."; + y = 1; + for (x = 0; x < count; x++) + { + if (selection->selections[x] == 1) + { + sprintf (temp, "%.*s", (int)(sizeof (temp) - 20), item[x]); + mesg[y++] = copyChar (temp); + } + } + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, (int)y); + } + + /* Clean up. */ + CDKfreeStrings (item); + destroyCDKSelection (selection); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/slider_ex.c b/deps/cdk-5.0-20161210/examples/slider_ex.c new file mode 100644 index 0000000..2696a3e --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/slider_ex.c @@ -0,0 +1,86 @@ +/* $Id: slider_ex.c,v 1.11 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "slider_ex"; +#endif + +/* + * This program demonstrates the Cdk slider widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKSLIDER *widget = 0; + const char *title = "Enter a value:"; + const char *label = "Current Value:"; + char temp[256]; + const char *mesg[5]; + int selection; + + CDK_PARAMS params; + int high; + int inc; + int low; + + CDKparseParams (argc, argv, ¶ms, "h:i:l:w:" CDK_MIN_PARAMS); + high = CDKparamNumber2 (¶ms, 'h', 100); + inc = CDKparamNumber2 (¶ms, 'i', 1); + low = CDKparamNumber2 (¶ms, 'l', 1); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the widget. */ + widget = newCDKSlider (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, label, + A_REVERSE | COLOR_PAIR (29) | ' ', + CDKparamNumber2 (¶ms, 'w', 50), + low, low, high, + inc, (inc * 2), + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the widget null? */ + if (widget == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make the widget. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the widget. */ + selection = activateCDKSlider (widget, 0); + + /* Check the exit value of the widget. */ + if (widget->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No value selected."; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (widget->exitType == vNORMAL) + { + sprintf (temp, "You selected %d", selection); + mesg[0] = temp; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up. */ + destroyCDKSlider (widget); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/subwindow_ex.c b/deps/cdk-5.0-20161210/examples/subwindow_ex.c new file mode 100644 index 0000000..a0bea4a --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/subwindow_ex.c @@ -0,0 +1,90 @@ +/* $Id: subwindow_ex.c,v 1.13 2016/12/04 16:20:33 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "subwindow_ex"; +#endif + +/* + * This demo displays the ability to put widgets within a curses subwindow. + */ +int main (int argc, char **argv) +{ + CDKSCREEN *cdkscreen; + CDKSCROLL *dowList; + CDKLABEL *title; + WINDOW *subWindow; + const char *dow[] = + { + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday" + }; + const char *mesg[5]; + int pick; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, "s:" CDK_CLI_PARAMS); + + /* Start curses. */ + (void) initCDKScreen (NULL); + curs_set (0); + + /* Create a basic window. */ + subWindow = newwin (LINES - 5, COLS - 10, 2, 5); + + /* Start Cdk. */ + cdkscreen = initCDKScreen (subWindow); + + /* Box our window. */ + box (subWindow, ACS_VLINE, ACS_HLINE); + wrefresh (subWindow); + + /* Create a basic scrolling list inside the window. */ + dowList = newCDKScroll (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparsePosition (CDKparamString2 (¶ms, + 's', + "RIGHT")), + CDKparamValue (¶ms, 'H', 10), + CDKparamValue (¶ms, 'W', 15), + "Pick a Day", + (CDK_CSTRING2) dow, 7, + NONUMBERS, + A_REVERSE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Put a title within the window. */ + mesg[0] = "<#HL(30)>"; + mesg[1] = "This is a Cdk scrolling list"; + mesg[2] = "inside a curses window."; + mesg[3] = "<#HL(30)>"; + title = newCDKLabel (cdkscreen, CENTER, 0, + (CDK_CSTRING2) mesg, 4, + FALSE, FALSE); + + /* Refresh the screen. */ + refreshCDKScreen (cdkscreen); + + /* Let the user play. */ + pick = activateCDKScroll (dowList, 0); + + /* Clean up. */ + destroyCDKScroll (dowList); + destroyCDKLabel (title); + eraseCursesWindow (subWindow); + destroyCDKScreen (cdkscreen); + endCDK (); + + /* Tell them what they picked. */ + printf ("You picked %s\n", dow[pick]); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/swindow_ex.c b/deps/cdk-5.0-20161210/examples/swindow_ex.c new file mode 100644 index 0000000..7d23dfd --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/swindow_ex.c @@ -0,0 +1,115 @@ +/* $Id: swindow_ex.c,v 1.14 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "swindow_ex"; +#endif + +#if !defined (HAVE_SLEEP) && defined (_WIN32) /* Mingw */ +#define sleep(x) _sleep(x*1000) +#endif + +/* + * Demonstrate a scrolling-window. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKSWINDOW *swindow = 0; + const char *title = "Error Log"; + const char *mesg[5]; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_CLI_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK colors. */ + initCDKColor (); + + /* Create the scrolling window. */ + swindow = newCDKSwindow (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparamValue (¶ms, 'H', 6), + CDKparamValue (¶ms, 'W', 65), + title, 100, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the window null. */ + if (swindow == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create the scrolling window. "); + printf ("Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Draw the scrolling window. */ + drawCDKSwindow (swindow, ObjOf (swindow)->box); + + /* Load up the scrolling window. */ + addCDKSwindow (swindow, "TOP: This is the first line.", BOTTOM); + addCDKSwindow (swindow, "Sleeping for 1 second.", BOTTOM); + sleep (1); + + addCDKSwindow (swindow, "1: This is another line.", BOTTOM); + addCDKSwindow (swindow, "Sleeping for 1 second.", BOTTOM); + sleep (1); + + addCDKSwindow (swindow, "2: This is another line.", BOTTOM); + addCDKSwindow (swindow, "Sleeping for 1 second.", BOTTOM); + sleep (1); + + addCDKSwindow (swindow, "3: This is another line.", BOTTOM); + addCDKSwindow (swindow, "Sleeping for 1 second.", BOTTOM); + sleep (1); + + addCDKSwindow (swindow, "4: This is another line.", BOTTOM); + addCDKSwindow (swindow, "Sleeping for 1 second.", BOTTOM); + sleep (1); + + addCDKSwindow (swindow, "5: This is another line.", BOTTOM); + addCDKSwindow (swindow, "Sleeping for 1 second.", BOTTOM); + sleep (1); + + addCDKSwindow (swindow, "6: This is another line.", BOTTOM); + addCDKSwindow (swindow, "Sleeping for 1 second.", BOTTOM); + sleep (1); + + addCDKSwindow (swindow, "Done. You can now play.", BOTTOM); + + addCDKSwindow (swindow, "This is being added to the top.", TOP); + + /* Activate the scrolling window. */ + activateCDKSwindow (swindow, 0); + + /* Check how the user exited this widget. */ + if (swindow->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape to leave this widget."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (swindow->exitType == vNORMAL) + { + mesg[0] = "You hit return to exit this widget."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up. */ + destroyCDKSwindow (swindow); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/template_ex.c b/deps/cdk-5.0-20161210/examples/template_ex.c new file mode 100644 index 0000000..8c9dd0e --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/template_ex.c @@ -0,0 +1,97 @@ +/* $Id: template_ex.c,v 1.13 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "template_ex"; +#endif + +/* + * This program demonstrates the Cdk template widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKTEMPLATE *phoneNumber = 0; + const char *title = "Title"; + const char *label = "Phone Number:"; + const char *Overlay = "(___) ___-____"; + const char *plate = "(###) ###-####"; + char *info; + char *mixed; + char temp[256]; + const char *mesg[5]; + + CDK_PARAMS params; + + CDKparseParams (argc, argv, ¶ms, CDK_MIN_PARAMS); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Declare the template. */ + phoneNumber = newCDKTemplate (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, label, + plate, Overlay, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the template pointer null? */ + if (phoneNumber == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create template. Is the window too small?"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the template. */ + info = activateCDKTemplate (phoneNumber, 0); + + /* Tell them what they typed. */ + if (phoneNumber->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No information typed in."; + mesg[1] = "", + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (phoneNumber->exitType == vNORMAL) + { + char *with_mix; + char *with_out; + + /* Mix the plate and the number. */ + mixed = mixCDKTemplate (phoneNumber); + + /* Create the message to display. */ + sprintf (temp, "Phone Number with out plate mixing : %.*s", + (int)(sizeof (temp) - 50), + info); + mesg[0] = with_out = copyChar (temp); + sprintf (temp, "Phone Number with the plate mixed in: %.*s", + (int)(sizeof (temp) - 50), + mixed); + mesg[1] = with_mix = copyChar (temp); + mesg[2] = ""; + mesg[3] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 4); + + freeChar (with_out); + freeChar (with_mix); + freeChar (mixed); + } + + /* Clean up. */ + destroyCDKTemplate (phoneNumber); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/traverse_ex.c b/deps/cdk-5.0-20161210/examples/traverse_ex.c new file mode 100644 index 0000000..d1b7b34 --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/traverse_ex.c @@ -0,0 +1,768 @@ +/* $Id: traverse_ex.c,v 1.25 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "entry_ex"; +#endif + +#define NumElements(a) ((sizeof a)/(sizeof a[0])) + +#define MY_MAX 3 + +static CDKOBJS *all_objects[MY_MAX]; + +static const char *yes_no[] = +{ + "Yes", "NO" +}; +static const char *months[] = +{ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" +}; +static const char *choices[] = +{ + "[ ]", "[*]" +}; + +/* + * Exercise all widgets except + * CDKMENU + * CDKTRAVERSE + * The names in parentheses do not accept input, so they will never have + * focus for traversal. The names with leading "*" have some limitation + * that makes them not useful in traversal. + */ +/* *INDENT-OFF* */ +static const struct +{ + const char *name; + EObjectType type; +} +menu_table[] = +{ + { "(CDKGRAPH)", vGRAPH }, /* no traversal (not active) */ + { "(CDKHISTOGRAM)", vHISTOGRAM }, /* no traversal (not active) */ + { "(CDKLABEL)", vLABEL }, /* no traversal (not active) */ + { "(CDKMARQUEE)", vMARQUEE }, /* hangs (leaves trash) */ + { "*CDKVIEWER", vVIEWER }, /* traversal out-only on OK */ + { "CDKALPHALIST", vALPHALIST }, + { "CDKBUTTON", vBUTTON }, + { "CDKBUTTONBOX", vBUTTONBOX }, + { "CDKCALENDAR", vCALENDAR }, + { "CDKDIALOG", vDIALOG }, + { "CDKDSCALE", vDSCALE }, + { "CDKENTRY", vENTRY }, + { "CDKFSCALE", vFSCALE }, + { "CDKFSELECT", vFSELECT }, + { "CDKFSLIDER", vFSLIDER }, + { "CDKITEMLIST", vITEMLIST }, + { "CDKMATRIX", vMATRIX }, + { "CDKMENTRY", vMENTRY }, + { "CDKRADIO", vRADIO }, + { "CDKSCALE", vSCALE }, + { "CDKSCROLL", vSCROLL }, + { "CDKSELECTION", vSELECTION }, + { "CDKSLIDER", vSLIDER }, + { "CDKSWINDOW", vSWINDOW }, + { "CDKTEMPLATE", vTEMPLATE }, + { "CDKUSCALE", vUSCALE }, + { "CDKUSLIDER", vUSLIDER }, +}; +/* *INDENT-ON* */ + +static CDKOBJS *make_alphalist (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKALPHALIST *widget = newCDKAlphalist (cdkscreen, + x, y, 10, 15, + "AlphaList", + "->", + (CDK_CSTRING *)months, + NumElements (months), + '_', A_REVERSE, + TRUE, FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_button (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKBUTTON *widget = newCDKButton (cdkscreen, x, y, + "A Button!", NULL, + TRUE, FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_buttonbox (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKBUTTONBOX *widget = newCDKButtonbox (cdkscreen, x, y, + 10, 16, + "ButtonBox", 6, 2, + months, + NumElements (months), + A_REVERSE, + TRUE, FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_calendar (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKCALENDAR *widget = newCDKCalendar (cdkscreen, x, y, + "Calendar", 25, 1, 2000, + COLOR_PAIR (16) | A_BOLD, + COLOR_PAIR (24) | A_BOLD, + COLOR_PAIR (32) | A_BOLD, + COLOR_PAIR (40) | A_REVERSE, + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_dialog (CDKSCREEN *cdkscreen, int x, int y) +{ + static const char *message[] = + { + "This is a simple dialog box" + ,"Is it simple enough?" + }; + + CDKDIALOG *widget = newCDKDialog (cdkscreen, x, y, + (CDK_CSTRING2)message, NumElements (message), + (CDK_CSTRING2)yes_no, NumElements (yes_no), + COLOR_PAIR (2) | A_REVERSE, + TRUE, + TRUE, FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_dscale (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKDSCALE *widget = newCDKDScale (cdkscreen, x, y, + "DScale", "Value", A_NORMAL, + 15, + 0.0, 0.0, 100.0, + 1.0, (1.0 * 2.), 1, + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_entry (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKENTRY *widget = newCDKEntry (cdkscreen, x, y, + NULL, "Entry: ", A_NORMAL, + '.', vMIXED, 40, 0, 256, TRUE, FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_fscale (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKFSCALE *widget = newCDKFScale (cdkscreen, x, y, + "FScale", "Value", A_NORMAL, + 15, + 0.0, 0.0, 100.0, + 1.0, (1.0 * 2.), 1, + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_fslider (CDKSCREEN *cdkscreen, int x, int y) +{ + float low = -32; + float high = 64; + float inc = (float)0.1; + CDKFSLIDER *widget = newCDKFSlider (cdkscreen, + x, + y, + "FSlider", "Label", + A_REVERSE | COLOR_PAIR (29) | ' ', + 20, + low, low, high, inc, (inc * 2), + 3, + TRUE, + FALSE); + /* selection = activateCDKSlider (widget, 0); */ + return ObjPtr (widget); +} + +static CDKOBJS *make_fselect (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKFSELECT *widget = newCDKFselect (cdkscreen, + x, + y, + 15, + 25, + "FSelect", "->", A_NORMAL, '_', A_REVERSE, + "", "", "", "", + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_graph (CDKSCREEN *cdkscreen, int x, int y) +{ + static int values[] = + { + 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 + }; + static const char *graphChars = "0123456789"; + CDKGRAPH *widget = newCDKGraph (cdkscreen, x, y, + 10, 25, + "title", "X-axis", "Y-axis"); + setCDKGraph (widget, values, NumElements (values), graphChars, TRUE, vPLOT); + return ObjPtr (widget); +} + +static CDKOBJS *make_histogram (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKHISTOGRAM *widget = newCDKHistogram (cdkscreen, + x, + y, + 1, + 20, + HORIZONTAL, "Histogram", + TRUE, + FALSE); + setCDKHistogram (widget, vPERCENT, CENTER, A_BOLD, 0, 10, 6, ' ' | + A_REVERSE, TRUE); + return ObjPtr (widget); +} + +static CDKOBJS *make_itemlist (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKITEMLIST *widget = newCDKItemlist (cdkscreen, x, y, + NULL, "Month ", + (CDK_CSTRING2)months, + NumElements (months), + 1, TRUE, FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_label (CDKSCREEN *cdkscreen, int x, int y) +{ + static const char *message[] = + { + "This is a simple label." + ,"Is it simple enough?" + }; + CDKLABEL *widget = newCDKLabel (cdkscreen, + x, + y, + (CDK_CSTRING2)message, NumElements (message), + TRUE, + TRUE); + return ObjPtr (widget); +} + +static CDKOBJS *make_marquee (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKMARQUEE *widget = newCDKMarquee (cdkscreen, + x, + y, + 30, + TRUE, + TRUE); + activateCDKMarquee (widget, "This is a message", 5, 3, TRUE); + destroyCDKMarquee (widget); + return 0; +} + +static CDKOBJS *make_matrix (CDKSCREEN *cdkscreen, int x, int y) +{ +#define NUMROWS 8 +#define NUMCOLS 5 + + CDKMATRIX *widget; + const char *coltitle[NUMCOLS + 1]; + const char *rowtitle[NUMROWS + 1]; + char temp[80]; + int cols = NUMCOLS; + int colwidth[NUMCOLS + 1]; + int coltypes[NUMCOLS + 1]; + int maxwidth = 0; + int n; + int rows = NUMROWS; + int vcols = 3; + int vrows = 3; + + for (n = 0; n <= NUMROWS; ++n) + { + sprintf (temp, "row%d", n); + rowtitle[n] = copyChar (temp); + } + for (n = 0; n <= NUMCOLS; ++n) + { + sprintf (temp, "col%d", n); + coltitle[n] = copyChar (temp); + colwidth[n] = (int)strlen (temp); + coltypes[n] = vUCHAR; + if (colwidth[n] > maxwidth) + maxwidth = colwidth[n]; + } + + widget = newCDKMatrix (cdkscreen, + x, + y, + rows, cols, vrows, vcols, + "Matrix", (CDK_CSTRING2)rowtitle, (CDK_CSTRING2)coltitle, + colwidth, coltypes, + -1, -1, '.', + COL, TRUE, + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_mentry (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKMENTRY *widget = newCDKMentry (cdkscreen, + x, + y, + "MEntry", "Label", A_BOLD, '.', vMIXED, + 20, + 5, + 20, + 0, + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_radio (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKRADIO *widget = newCDKRadio (cdkscreen, + x, + y, + RIGHT, + 10, + 20, + "Radio", + (CDK_CSTRING2)months, NumElements (months), + '#' | A_REVERSE, 1, + A_REVERSE, + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_scale (CDKSCREEN *cdkscreen, int x, int y) +{ + int low = 2; + int high = 25; + int inc = 1; + CDKSCALE *widget = newCDKScale (cdkscreen, + x, + y, + "Scale", "Label", A_NORMAL, + 5, + low, low, high, + inc, (inc * 2), + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_scroll (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKSCROLL *widget = newCDKScroll (cdkscreen, + x, + y, + RIGHT, + 10, + 20, + "Scroll", + (CDK_CSTRING2)months, NumElements (months), + TRUE, + A_REVERSE, + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_slider (CDKSCREEN *cdkscreen, int x, int y) +{ + int low = 2; + int high = 25; + int inc = 1; + CDKSLIDER *widget = newCDKSlider (cdkscreen, + x, + y, + "Slider", "Label", + A_REVERSE | COLOR_PAIR (29) | ' ', + 20, + low, low, high, inc, (inc * 2), + TRUE, + FALSE); + /* selection = activateCDKSlider (widget, 0); */ + return ObjPtr (widget); +} + +static CDKOBJS *make_selection (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKSELECTION *widget = newCDKSelection (cdkscreen, x, y, + NONE, 8, 20, "Selection", + (CDK_CSTRING2)months, + NumElements (months), + (CDK_CSTRING2)choices, + NumElements (choices), + A_REVERSE, TRUE, FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_swindow (CDKSCREEN *cdkscreen, int x, int y) +{ + CDKSWINDOW *widget = newCDKSwindow (cdkscreen, + x, + y, + 6, + 25, + "SWindow", 100, + TRUE, + FALSE); + int n; + for (n = 0; n < 30; ++n) + { + char temp[80]; + sprintf (temp, "Line %d", n); + addCDKSwindow (widget, temp, BOTTOM); + } + activateCDKSwindow (widget, 0); + return ObjPtr (widget); +} + +static CDKOBJS *make_template (CDKSCREEN *cdkscreen, int x, int y) +{ + const char *Overlay = "(___) ___-____"; + const char *plate = "(###) ###-####"; + CDKTEMPLATE *widget = newCDKTemplate (cdkscreen, + x, + y, + "Template", "Label", + plate, Overlay, + TRUE, + FALSE); + activateCDKTemplate (widget, 0); + return ObjPtr (widget); +} + +static CDKOBJS *make_uscale (CDKSCREEN *cdkscreen, int x, int y) +{ + unsigned low = 0; + unsigned high = 65535; + unsigned inc = 1; + CDKUSCALE *widget = newCDKUScale (cdkscreen, + x, + y, + "UScale", "Label", A_NORMAL, + 5, + low, low, high, + inc, (inc * 32), + TRUE, + FALSE); + return ObjPtr (widget); +} + +static CDKOBJS *make_uslider (CDKSCREEN *cdkscreen, int x, int y) +{ + unsigned low = 0; + unsigned high = 65535; + unsigned inc = 1; + CDKUSLIDER *widget = newCDKUSlider (cdkscreen, + x, + y, + "USlider", "Label", + A_REVERSE | COLOR_PAIR (29) | ' ', + 20, + low, low, high, inc, (inc * 32), + TRUE, + FALSE); + /* selection = activateCDKSlider (widget, 0); */ + return ObjPtr (widget); +} + +static CDKOBJS *make_viewer (CDKSCREEN *cdkscreen, int x, int y) +{ + static const char *button[1] = + { + "Ok" + }; + CDKVIEWER *widget = newCDKViewer (cdkscreen, + x, + y, + 10, + 20, + (CDK_CSTRING2)button, 1, A_REVERSE, + TRUE, + FALSE); + setCDKViewer (widget, "Viewer", + (CDK_CSTRING2)months, NumElements (months), + A_REVERSE, FALSE, TRUE, TRUE); + activateCDKViewer (widget, 0); + return ObjPtr (widget); +} + +static void rebind_esc (CDKOBJS *obj) +{ + bindCDKObject (ObjTypeOf (obj), obj, KEY_F (1), getcCDKBind, (void *)KEY_ESC); +} + +static void make_any (CDKSCREEN *cdkscreen, int menu, EObjectType type) +{ + CDKOBJS *(*func) (CDKSCREEN *, int, int) = 0; + CDKOBJS *prior = 0; + int x; + int y; + + /* setup positions, staggered a little */ + switch (menu) + { + case 0: + x = LEFT; + y = 2; + break; + case 1: + x = CENTER; + y = 4; + break; + case 2: + x = RIGHT; + y = 6; + break; + default: + beep (); + return; + } + + /* find the function to make a widget of the given type */ + switch (type) + { + case vALPHALIST: + func = make_alphalist; + break; + case vBUTTON: + func = make_button; + break; + case vBUTTONBOX: + func = make_buttonbox; + break; + case vCALENDAR: + func = make_calendar; + break; + case vDIALOG: + func = make_dialog; + break; + case vDSCALE: + func = make_dscale; + break; + case vENTRY: + func = make_entry; + break; + case vFSCALE: + func = make_fscale; + break; + case vFSELECT: + func = make_fselect; + break; + case vFSLIDER: + func = make_fslider; + break; + case vGRAPH: + func = make_graph; + break; + case vHISTOGRAM: + func = make_histogram; + break; + case vITEMLIST: + func = make_itemlist; + break; + case vLABEL: + func = make_label; + break; + case vMARQUEE: + func = make_marquee; + break; + case vMATRIX: + func = make_matrix; + break; + case vMENTRY: + func = make_mentry; + break; + case vRADIO: + func = make_radio; + break; + case vSCALE: + func = make_scale; + break; + case vSCROLL: + func = make_scroll; + break; + case vSELECTION: + func = make_selection; + break; + case vSLIDER: + func = make_slider; + break; + case vSWINDOW: + func = make_swindow; + break; + case vTEMPLATE: + func = make_template; + break; + case vUSCALE: + func = make_uscale; + break; + case vUSLIDER: + func = make_uslider; + break; + case vVIEWER: + func = make_viewer; + break; + case vMENU: + case vTRAVERSE: + case vNULL: + if (type > 0) + beep (); + return; + } + + /* erase the old widget */ + if ((prior = all_objects[menu]) != 0) + { + EraseObj (prior); + _destroyCDKObject (prior); + all_objects[menu] = 0; + } + + /* create the new widget */ + if (func != 0) + { + CDKOBJS *widget = func (cdkscreen, x, y); + if (widget != 0) + { + all_objects[menu] = widget; + rebind_esc (widget); + } + else + flash (); + } + else + { + beep (); + } +} + +/* + * Whenever we get a menu selection, create the selected widget. + */ +static int preHandler (EObjectType cdktype GCC_UNUSED, void *object, + void *clientData GCC_UNUSED, + chtype input GCC_UNUSED) +{ + int mp, sp; + CDKSCREEN *screen; + WINDOW *window; + + switch (input) + { + case KEY_ENTER: + getCDKMenuCurrentItem ((CDKMENU *)object, &mp, &sp); + + screen = ScreenOf ((CDKMENU *)object); + window = screen->window; + mvwprintw (window, getmaxy (window) - 1, 0, "selection %d/%d", mp, sp); + clrtoeol (); + refresh (); + if (sp >= 0 && sp < (int)NumElements (menu_table)) + make_any (screen, mp, menu_table[sp].type); + break; + } + return 1; +} + +/* + * This demonstrates the Cdk widget-traversal. + */ +int main (int argc GCC_UNUSED, char **argv GCC_UNUSED) +{ + unsigned j, k; + + /* Declare local variables. */ + CDKSCREEN *cdkscreen = NULL; + CDKMENU *menu = NULL; + const char *mesg[3]; + static const char *menulist[MAX_MENU_ITEMS][MAX_SUB_ITEMS] = + { + {"Left"}, + {"Center"}, + {"Right"}, + }; + static int submenusize[] = + { + NumElements (menu_table) + 1, + NumElements (menu_table) + 1, + NumElements (menu_table) + 1 + }; + static int menuloc[] = + {LEFT, LEFT, RIGHT}; + + for (j = 0; j < MY_MAX; ++j) + { + for (k = 0; k < NumElements (menu_table); ++k) + { + menulist[j][k + 1] = menu_table[k].name; + } + } + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK colors. */ + initCDKColor (); + + + menu = newCDKMenu (cdkscreen, menulist, MY_MAX, submenusize, menuloc, + TOP, A_UNDERLINE, A_REVERSE); + if (menu == 0) + { + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("? Cannot create menus\n"); + ExitProgram (EXIT_FAILURE); + } + rebind_esc (ObjOf (menu)); + + setCDKMenuPreProcess (menu, preHandler, 0); + + /* setup the initial display */ + make_any (cdkscreen, 0, vENTRY); +#if MY_MAX > 1 + make_any (cdkscreen, 1, vITEMLIST); +#if MY_MAX > 2 + make_any (cdkscreen, 2, vSELECTION); +#endif +#endif + + /* Draw the screen. */ + refreshCDKScreen (cdkscreen); + + /* Traverse the screen */ + traverseCDKScreen (cdkscreen); + + mesg[0] = "Done"; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + + /* Clean up and exit. */ + for (j = 0; j < MY_MAX; ++j) + { + if (all_objects[j] != 0) + _destroyCDKObject (all_objects[j]); + } + destroyCDKMenu (menu); + destroyCDKScreen (cdkscreen); + endCDK (); + + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/uslider_ex.c b/deps/cdk-5.0-20161210/examples/uslider_ex.c new file mode 100644 index 0000000..ad14ebd --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/uslider_ex.c @@ -0,0 +1,89 @@ +/* $Id: uslider_ex.c,v 1.5 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "uslider_ex"; +#endif + +/* + * This program demonstrates the Cdk unsigned-slider widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKUSLIDER *widget = 0; + char title[256]; + const char *label = "Current Value:"; + const char *mesg[5]; + char temp[256]; + unsigned selection; + + CDK_PARAMS params; + unsigned high; + unsigned inc; + unsigned low; + + /* *INDENT-EQLS* */ + CDKparseParams (argc, argv, ¶ms, "h:i:l:w:" CDK_MIN_PARAMS); + high = (unsigned)CDKparamNumber2 (¶ms, 'h', 100); + inc = (unsigned)CDKparamNumber2 (¶ms, 'i', 1); + low = (unsigned)CDKparamNumber2 (¶ms, 'l', 1); + + sprintf (title, "Enter a value:\nLow %#x\nHigh %#x", low, high); + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors. */ + initCDKColor (); + + /* Create the widget. */ + widget = newCDKUSlider (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + title, label, + A_REVERSE | COLOR_PAIR (29) | ' ', + CDKparamNumber2 (¶ms, 'w', 50), + low, low, high, + inc, (inc * 2), + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Is the widget null? */ + if (widget == 0) + { + /* Exit CDK. */ + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot make the widget. Is the window too small?\n"); + ExitProgram (EXIT_FAILURE); + } + + /* Activate the widget. */ + selection = activateCDKUSlider (widget, 0); + + /* Check the exit value of the widget. */ + if (widget->exitType == vESCAPE_HIT) + { + mesg[0] = "You hit escape. No value selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + else if (widget->exitType == vNORMAL) + { + sprintf (temp, "You selected %u", selection); + mesg[0] = temp; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3); + } + + /* Clean up. */ + destroyCDKUSlider (widget); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/viewer_ex.c b/deps/cdk-5.0-20161210/examples/viewer_ex.c new file mode 100644 index 0000000..5f87aba --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/viewer_ex.c @@ -0,0 +1,177 @@ +/* $Id: viewer_ex.c,v 1.22 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "viewer_ex"; +#endif + +/* + * This program demonstrates the file selector and the viewer widget. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKVIEWER *example = 0; + CDKFSELECT *fSelect = 0; + char **info = 0; + const char *button[5]; + char vTitle[256]; + const char *mesg[4]; + char temp[256]; + int selected, lines; + + CDK_PARAMS params; + char *filename; /* specify filename, bypassing fselect */ + char *directory; /* specify starting directory for fselect */ + int interp_it; /* interpret embedded markup */ + int link_it; /* load file via embedded link */ + + CDKparseParams (argc, argv, ¶ms, "f:d:il" CDK_CLI_PARAMS); + /* *INDENT-EQLS* */ + filename = CDKparamString (¶ms, 'f'); + directory = CDKparamString2 (¶ms, 'd', "."); + interp_it = CDKparamNumber2 (¶ms, 'i', FALSE); + link_it = CDKparamNumber2 (¶ms, 'l', FALSE); + + /* Create the viewer buttons. */ + button[0] = ""; + button[1] = ""; + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Get the filename. */ + if (filename == 0) + { + const char *title = "Pick\nA\nFile"; + const char *label = "File: "; + + fSelect = newCDKFselect (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparamValue (¶ms, 'H', 20), + CDKparamValue (¶ms, 'W', 65), + title, label, A_NORMAL, '_', A_REVERSE, + "", "", "", "", + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + if (fSelect == 0) + { + destroyCDKScreen (cdkscreen); + endCDK (); + + fprintf (stderr, "Cannot create fselect-widget\n"); + ExitProgram (EXIT_FAILURE); + } + + /* + * Set the starting directory. This is not necessary because when + * the file selector starts it uses the present directory as a default. + */ + setCDKFselect (fSelect, directory, A_NORMAL, '.', A_REVERSE, + "", "", "", "", ObjOf (fSelect)->box); + + /* Activate the file selector. */ + filename = activateCDKFselect (fSelect, 0); + + /* Check how the person exited from the widget. */ + if (fSelect->exitType == vESCAPE_HIT) + { + /* Pop up a message for the user. */ + mesg[0] = "Escape hit. No file selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + + /* Exit CDK. */ + destroyCDKFselect (fSelect); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); + } + } + + /* Create the file viewer to view the file selected. */ + example = newCDKViewer (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparamValue (¶ms, 'H', 20), + CDKparamValue (¶ms, 'W', -2), + (CDK_CSTRING2)button, 2, A_REVERSE, + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + + /* Could we create the viewer widget? */ + if (example == 0) + { + /* Exit CDK. */ + destroyCDKFselect (fSelect); + destroyCDKScreen (cdkscreen); + endCDK (); + + printf ("Cannot create viewer. Is the window too small?\n"); + ExitProgram (EXIT_SUCCESS); + } + + if (link_it) + { + info = (char **)calloc (2, sizeof (char *)); + info[0] = (char *)malloc (5 + strlen (filename)); + sprintf (info[0], "", filename); + lines = -1; + interp_it = TRUE; + } + else + { + setCDKViewer (example, "reading...", 0, 0, A_REVERSE, TRUE, TRUE, TRUE); + /* Open the file and read the contents. */ + lines = CDKreadFile (filename, &info); + if (lines == -1) + { + endCDK (); + printf ("Could not open \"%s\"\n", filename); + ExitProgram (EXIT_FAILURE); + } + } + + /* Set up the viewer title, and the contents to the widget. */ + sprintf (vTitle, "Filename:%20s", filename); + setCDKViewer (example, vTitle, + (CDK_CSTRING2)info, lines, + A_REVERSE, interp_it, TRUE, TRUE); + + CDKfreeStrings (info); + + /* Destroy the file selector widget. */ + destroyCDKFselect (fSelect); + + /* Activate the viewer widget. */ + selected = activateCDKViewer (example, 0); + + /* Check how the person exited from the widget. */ + if (example->exitType == vESCAPE_HIT) + { + mesg[0] = "Escape hit. No Button selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + else if (example->exitType == vNORMAL) + { + sprintf (temp, "You selected button %d", selected); + mesg[0] = temp; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + } + + /* Clean up. */ + destroyCDKViewer (example); + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/examples/viewer_ex2.c b/deps/cdk-5.0-20161210/examples/viewer_ex2.c new file mode 100644 index 0000000..44e00be --- /dev/null +++ b/deps/cdk-5.0-20161210/examples/viewer_ex2.c @@ -0,0 +1,114 @@ +/* $Id: viewer_ex2.c,v 1.8 2016/12/04 15:22:16 tom Exp $ */ + +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName = "viewer_ex"; +#endif + +/* + * This program demonstrates the viewFile() function. + */ +int main (int argc, char **argv) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = 0; + CDKFSELECT *fSelect = 0; + const char *button[5]; + char vTitle[256]; + const char *mesg[4]; + char temp[256]; + int selected; + + CDK_PARAMS params; + char *filename; /* specify filename, bypassing fselect */ + char *directory; /* specify starting directory for fselect */ + int interp_it; /* interpret embedded markup */ + + CDKparseParams (argc, argv, ¶ms, "f:d:i" CDK_CLI_PARAMS); + /* *INDENT-EQLS* */ + filename = CDKparamString (¶ms, 'f'); + directory = CDKparamString2 (¶ms, 'd', "."); + interp_it = CDKparamNumber2 (¶ms, 'i', FALSE); + + /* Create the viewer buttons. */ + button[0] = ""; + button[1] = ""; + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor (); + + /* Get the filename. */ + if (filename == 0) + { + const char *title = "Pick\nA\nFile"; + const char *label = "File: "; + + fSelect = newCDKFselect (cdkscreen, + CDKparamValue (¶ms, 'X', CENTER), + CDKparamValue (¶ms, 'Y', CENTER), + CDKparamValue (¶ms, 'H', 20), + CDKparamValue (¶ms, 'W', 65), + title, label, A_NORMAL, '_', A_REVERSE, + "", "", "", "", + CDKparamValue (¶ms, 'N', TRUE), + CDKparamValue (¶ms, 'S', FALSE)); + if (fSelect == 0) + { + destroyCDKScreen (cdkscreen); + endCDK (); + + fprintf (stderr, "Cannot create fselect-widget\n"); + ExitProgram (EXIT_FAILURE); + } + + /* + * Set the starting directory. This is not necessary because when + * the file selector starts it uses the present directory as a default. + */ + setCDKFselect (fSelect, directory, A_NORMAL, '.', A_REVERSE, + "", "", "", "", ObjOf (fSelect)->box); + + /* Activate the file selector. */ + filename = activateCDKFselect (fSelect, 0); + + /* Check how the person exited from the widget. */ + if (fSelect->exitType == vESCAPE_HIT) + { + /* Pop up a message for the user. */ + mesg[0] = "Escape hit. No file selected."; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + + /* Exit CDK. */ + destroyCDKFselect (fSelect); + destroyCDKScreen (cdkscreen); + endCDK (); + + ExitProgram (EXIT_SUCCESS); + } + } + + /* Set up the viewer title, and the contents to the widget. */ + sprintf (vTitle, "Filename:%20s", filename); + + selected = viewFile (cdkscreen, vTitle, filename, (CDK_CSTRING2)button, 2); + + /* Destroy the file selector widget (do not need filename anymore) */ + destroyCDKFselect (fSelect); + + /* Check how the person exited from the widget. */ + sprintf (temp, "You selected button %d", selected); + mesg[0] = temp; + mesg[1] = ""; + mesg[2] = "Press any key to continue."; + popupLabel (cdkscreen, (CDK_CSTRING2)mesg, 3); + + /* Clean up. */ + destroyCDKScreen (cdkscreen); + endCDK (); + ExitProgram (EXIT_SUCCESS); +} diff --git a/deps/cdk-5.0-20161210/fselect.c b/deps/cdk-5.0-20161210/fselect.c new file mode 100644 index 0000000..bdbc053 --- /dev/null +++ b/deps/cdk-5.0-20161210/fselect.c @@ -0,0 +1,1667 @@ +#define TRACE +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 20:12:18 $ + * $Revision: 1.85 $ + */ + +/* + * Declare file local prototypes. + */ +/* *INDENT-OFF* */ +static BINDFN_PROTO (completeFilenameCB); +static BINDFN_PROTO (displayFileInfoCB); +static BINDFN_PROTO (fselectAdjustScrollCB); +static char *contentToPath (CDKFSELECT *fselect, char *content); +static char *errorMessage (const char *format); +static char *expandTilde (const char *filename); +static char *format1Date (const char *format, time_t value); +static char *format1Number (const char *format, long value); +static char *format1String (const char *format, const char *string); +static char *format3String (const char *format, const char *s1, const char *s2, const char *s3); +static char *format1StrVal (const char *format, const char *string, int value); +static char *trim1Char (char *source); +static int createList (CDKFSELECT *widget, CDK_CSTRING2 list, int listSize); +static void setPWD (CDKFSELECT *fselect); +/* *INDENT-ON* */ + +DeclareSetXXchar (static, _setMy); +DeclareCDKObjects (FSELECT, Fselect, _setMy, String); + +/* + * This creates a file selection widget. + */ +CDKFSELECT *newCDKFselect (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int height, + int width, + const char *title, + const char *label, + chtype fieldAttribute, + chtype fillerChar, + chtype highlight, + const char *dAttribute, + const char *fAttribute, + const char *lAttribute, + const char *sAttribute, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKFSELECT *fselect = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int tempWidth = 0; + int tempHeight = 0; + int labelLen, junk; + chtype *chtypeString; + int x; + /* *INDENT-OFF* */ + static const struct + { + int from; + int to; + } bindings[] = + { + { CDK_BACKCHAR, KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + }; + /* *INDENT-ON* */ + + if ((fselect = newCDKObject (CDKFSELECT, &my_funcs)) == 0) + return (0); + + setCDKFselectBox (fselect, Box); + + /* + * If the height is a negative value, the height will + * be ROWS-height, otherwise, the height will be the + * given height. + */ + boxHeight = setWidgetDimension (parentHeight, height, 0); + + /* + * If the width is a negative value, the width will + * be COLS-width, otherwise, the width will be the + * given width. + */ + boxWidth = setWidgetDimension (parentWidth, width, 0); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make sure the box isn't too small. */ + boxWidth = (boxWidth < 15 ? 15 : boxWidth); + boxHeight = (boxHeight < 6 ? 6 : boxHeight); + + /* Make the file selector window. */ + fselect->win = newwin (boxHeight, boxWidth, ypos, xpos); + + /* Is the window null? */ + if (fselect->win == 0) + { + destroyCDKObject (fselect); + return (0); + } + keypad (fselect->win, TRUE); + + /* *INDENT-EQLS* Set some variables. */ + ScreenOf (fselect) = cdkscreen; + fselect->parent = cdkscreen->window; + fselect->dirAttribute = copyChar (dAttribute); + fselect->fileAttribute = copyChar (fAttribute); + fselect->linkAttribute = copyChar (lAttribute); + fselect->sockAttribute = copyChar (sAttribute); + fselect->highlight = highlight; + fselect->fillerCharacter = fillerChar; + fselect->fieldAttribute = fieldAttribute; + fselect->boxHeight = boxHeight; + fselect->boxWidth = boxWidth; + fselect->fileCounter = 0; + fselect->pwd = 0; + initExitType (fselect); + ObjOf (fselect)->inputWindow = fselect->win; + fselect->shadow = shadow; + fselect->shadowWin = 0; + + /* Get the present working directory. */ + setPWD (fselect); + + /* Get the contents of the current directory. */ + setCDKFselectDirContents (fselect); + + /* Create the entry field in the selector. */ + chtypeString = char2Chtype (label, &labelLen, &junk); + freeChtype (chtypeString); + tempWidth = (isFullWidth (width) + ? FULL + : boxWidth - 2 - labelLen); + fselect->entryField = newCDKEntry (cdkscreen, + getbegx (fselect->win), + getbegy (fselect->win), + title, label, + fieldAttribute, fillerChar, + vMIXED, tempWidth, 0, 512, + Box, FALSE); + + /* Make sure the widget was created. */ + if (fselect->entryField == 0) + { + destroyCDKObject (fselect); + return (0); + } + + /* Set the lower left/right characters of the entry field. */ + setCDKEntryLLChar (fselect->entryField, ACS_LTEE); + setCDKEntryLRChar (fselect->entryField, ACS_RTEE); + + /* Define the callbacks for the entry field. */ + bindCDKObject (vENTRY, + fselect->entryField, + KEY_UP, + fselectAdjustScrollCB, + fselect); + bindCDKObject (vENTRY, + fselect->entryField, + KEY_PPAGE, + fselectAdjustScrollCB, + fselect); + bindCDKObject (vENTRY, + fselect->entryField, + KEY_DOWN, + fselectAdjustScrollCB, + fselect); + bindCDKObject (vENTRY, + fselect->entryField, + KEY_NPAGE, + fselectAdjustScrollCB, + fselect); + bindCDKObject (vENTRY, + fselect->entryField, + KEY_TAB, + completeFilenameCB, + fselect); + bindCDKObject (vENTRY, + fselect->entryField, + CTRL ('^'), + displayFileInfoCB, + fselect); + + /* Put the current working directory in the entry field. */ + setCDKEntryValue (fselect->entryField, fselect->pwd); + + /* Create the scrolling list in the selector. */ + tempHeight = getmaxy (fselect->entryField->win) - BorderOf (fselect); + tempWidth = (isFullWidth (width) + ? FULL + : boxWidth - 1); + fselect->scrollField = newCDKScroll (cdkscreen, + getbegx (fselect->win), + getbegy (fselect->win) + tempHeight, + RIGHT, + boxHeight - tempHeight, + tempWidth, + 0, + (CDK_CSTRING2)fselect->dirContents, + fselect->fileCounter, + NONUMBERS, fselect->highlight, + Box, FALSE); + + /* Set the lower left/right characters of the entry field. */ + setCDKScrollULChar (fselect->scrollField, ACS_LTEE); + setCDKScrollURChar (fselect->scrollField, ACS_RTEE); + + /* Do we want a shadow? */ + if (shadow) + { + fselect->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Setup the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (vFSELECT, + fselect, + (chtype)bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + registerCDKObject (cdkscreen, vFSELECT, fselect); + + return (fselect); +} + +/* + * This erases the file selector from the screen. + */ +static void _eraseCDKFselect (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKFSELECT *fselect = (CDKFSELECT *)object; + + eraseCDKScroll (fselect->scrollField); + eraseCDKEntry (fselect->entryField); + eraseCursesWindow (fselect->win); + } +} + +/* + * This moves the fselect field to the given location. + */ +static void _moveCDKFselect (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (fselect->win); + int currentY = getbegy (fselect->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (fselect->win) + xplace; + ypos = getbegy (fselect->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (fselect), &xpos, &ypos, fselect->boxWidth, fselect->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (fselect->win, -xdiff, -ydiff); + moveCursesWindow (fselect->shadowWin, -xdiff, -ydiff); + + /* Move the sub-widgets. */ + moveCDKEntry (fselect->entryField, xplace, yplace, relative, FALSE); + moveCDKScroll (fselect->scrollField, xplace, yplace, relative, FALSE); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKFselect (fselect, ObjOf (fselect)->box); + } +} + +/* + * The fselect's focus resides in the entry widget. But the scroll widget + * will not draw items highlighted unless it has focus. Temporarily adjust the + * focus of the scroll widget when drawing on it to get the right highlighting. + */ +#define SaveFocus(widget) \ + boolean save = HasFocusObj (ObjOf (widget->scrollField)); \ + HasFocusObj (ObjOf (widget->scrollField)) = \ + HasFocusObj (ObjOf (widget->entryField)) + +#define RestoreFocus(widget) \ + HasFocusObj (ObjOf (widget->scrollField)) = save + +static void drawMyScroller (CDKFSELECT *widget) +{ + SaveFocus (widget); + drawCDKScroll (widget->scrollField, ObjOf (widget->scrollField)->box); + RestoreFocus (widget); +} + +static void injectMyScroller (CDKFSELECT *widget, chtype key) +{ + SaveFocus (widget); + (void)injectCDKScroll (widget->scrollField, key); + RestoreFocus (widget); +} + +/* + * This draws the file selector widget. + */ +static void _drawCDKFselect (CDKOBJS *object, boolean Box GCC_UNUSED) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + + /* Draw in the shadow if we need to. */ + if (fselect->shadowWin != 0) + { + drawShadow (fselect->shadowWin); + } + + /* Draw in the entry field. */ + drawCDKEntry (fselect->entryField, ObjOf (fselect->entryField)->box); + + /* Draw in the scroll field. */ + drawMyScroller (fselect); +} + +/* + * This means you want to use the given file selector. It takes input + * from the keyboard, and when it's done, it fills the entry info + * element of the structure with what was typed. + */ +char *activateCDKFselect (CDKFSELECT *fselect, chtype *actions) +{ + chtype input = 0; + boolean functionKey; + char *ret = 0; + + /* Draw the widget. */ + drawCDKFselect (fselect, ObjOf (fselect)->box); + + if (actions == 0) + { + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (fselect->entryField), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKFselect (fselect, input); + if (fselect->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKFselect (fselect, actions[x]); + if (fselect->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and exit. */ + setExitType (fselect, 0); + return 0; +} + +/* + * This injects a single character into the file selector. + */ +static int _injectCDKFselect (CDKOBJS *object, chtype input) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + char *filename; + boolean file; + char *ret = unknownString; + bool complete = FALSE; + + /* Let the user play. */ + filename = injectCDKEntry (fselect->entryField, input); + + /* Copy the entry field exitType to the fileselector. */ + copyExitType (fselect, fselect->entryField); + + /* If we exited early, make sure we don't interpret it as a file. */ + if (fselect->exitType == vEARLY_EXIT) + { + return 0; + } + + /* Can we change into the directory? */ + file = chdir (filename); + if (chdir (fselect->pwd) != 0) + { + return 0; + } + + /* If it's not a directory, return the filename. */ + if (file != 0) + { + /* It's a regular file, create the full path. */ + fselect->pathname = copyChar (filename); + + /* Return the complete pathname. */ + ret = (fselect->pathname); + complete = TRUE; + } + else + { + /* Set the file selector information. */ + setCDKFselect (fselect, filename, + fselect->fieldAttribute, fselect->fillerCharacter, + fselect->highlight, + fselect->dirAttribute, fselect->fileAttribute, + fselect->linkAttribute, fselect->sockAttribute, + ObjOf (fselect)->box); + + /* Redraw the scrolling list. */ + drawMyScroller (fselect); + } + + if (!complete) + setExitType (fselect, 0); + + ResultOf (fselect).valueString = ret; + return (ret != unknownString); +} + +/* + * This function sets the information inside the file selector. + */ +void setCDKFselect (CDKFSELECT *fselect, + const char *directory, + chtype fieldAttrib, + chtype filler, + chtype highlight, + const char *dirAttribute, + const char *fileAttribute, + const char *linkAttribute, + const char *sockAttribute, + boolean Box GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + CDKSCROLL *fscroll = fselect->scrollField; + CDKENTRY *fentry = fselect->entryField; + char *tempDir = 0; + + /* Keep the info sent to us. */ + fselect->fieldAttribute = fieldAttrib; + fselect->fillerCharacter = filler; + fselect->highlight = highlight; + + /* Set the attributes of the entry field/scrolling list. */ + setCDKEntryFillerChar (fentry, filler); + setCDKScrollHighlight (fscroll, highlight); + + /* Only do the directory stuff if the directory is not null. */ + if (directory != 0) + { + char *newDirectory; + + /* Try to expand the directory if it starts with a ~ */ + if ((tempDir = expandTilde (directory)) != 0) + { + newDirectory = tempDir; + } + else + { + newDirectory = copyChar (directory); + } + + /* Change directories. */ + if (chdir (newDirectory) != 0) + { + char *mesg[10]; + + Beep (); + + /* Could not get into the directory, pop up a little message. */ + mesg[0] = format1String ("Could not change into %s", newDirectory); + mesg[1] = errorMessage ("%s"); + mesg[2] = copyChar (" "); + mesg[3] = copyChar ("Press Any Key To Continue."); + + /* Pop Up a message. */ + popupLabel (ScreenOf (fselect), (CDK_CSTRING2)mesg, 4); + + /* Clean up some memory. */ + freeCharList (mesg, 4); + + /* Get out of here. */ + eraseCDKFselect (fselect); + drawCDKFselect (fselect, ObjOf (fselect)->box); + freeChar (newDirectory); + return; + } + freeChar (newDirectory); + } + + /* + * If the information coming in is the same as the information + * that is already there, there is no need to destroy it. + */ + if (fselect->pwd != directory) + { + setPWD (fselect); + } + if (fselect->fileAttribute != fileAttribute) + { + /* Remove the old pointer and set the new value. */ + freeChar (fselect->fileAttribute); + fselect->fileAttribute = copyChar (fileAttribute); + } + if (fselect->dirAttribute != dirAttribute) + { + /* Remove the old pointer and set the new value. */ + freeChar (fselect->dirAttribute); + fselect->dirAttribute = copyChar (dirAttribute); + } + if (fselect->linkAttribute != linkAttribute) + { + /* Remove the old pointer and set the new value. */ + freeChar (fselect->linkAttribute); + fselect->linkAttribute = copyChar (linkAttribute); + } + if (fselect->sockAttribute != sockAttribute) + { + /* Remove the old pointer and set the new value. */ + freeChar (fselect->sockAttribute); + fselect->sockAttribute = copyChar (sockAttribute); + } + + /* Set the contents of the entry field. */ + setCDKEntryValue (fentry, fselect->pwd); + drawCDKEntry (fentry, ObjOf (fentry)->box); + + /* Get the directory contents. */ + if (setCDKFselectDirContents (fselect) == 0) + { + Beep (); + return; + } + + /* Set the values in the scrolling list. */ + setCDKScrollItems (fscroll, + (CDK_CSTRING2)fselect->dirContents, + fselect->fileCounter, + FALSE); +} + +/* + * This creates a list of the files in the current directory. + */ +int setCDKFselectDirContents (CDKFSELECT *fselect) +{ + struct stat fileStat; + char **dirList = 0; + int fileCount; + int x = 0; + + /* Get the directory contents. */ + fileCount = CDKgetDirectoryContents (fselect->pwd, &dirList); + if (fileCount <= 0) + { + /* We couldn't read the directory. Return. */ + CDKfreeStrings (dirList); + return 0; + } + + /* Clean out the old directory list. */ + CDKfreeStrings (fselect->dirContents); + fselect->dirContents = dirList; + fselect->fileCounter = fileCount; + + /* Set the properties of the files. */ + for (x = 0; x < fselect->fileCounter; x++) + { + char *oldItem; + const char *attr = ""; + const char *mode = "?"; + + /* FIXME: access() would give a more correct answer */ + if (lstat (dirList[x], &fileStat) == 0) + { + mode = " "; + if ((fileStat.st_mode & S_IXUSR) != 0) + { + mode = "*"; + } +#if defined (S_IXGRP) && defined (S_IXOTH) + else if (((fileStat.st_mode & S_IXGRP) != 0) || + ((fileStat.st_mode & S_IXOTH) != 0)) + { + mode = "*"; + } +#endif + } + + switch (mode2Filetype (fileStat.st_mode)) + { + case 'l': + attr = fselect->linkAttribute; + mode = "@"; + break; + case '@': + attr = fselect->sockAttribute; + mode = "&"; + break; + case '-': + attr = fselect->fileAttribute; + break; + case 'd': + attr = fselect->dirAttribute; + mode = "/"; + break; + default: + break; + } + oldItem = dirList[x]; + fselect->dirContents[x] = format3String ("%s%s%s", attr, dirList[x], mode); + free (oldItem); + } + return 1; +} + +char **getCDKFselectDirContents (CDKFSELECT *fselect, int *count) +{ + (*count) = fselect->fileCounter; + return fselect->dirContents; +} + +/* + * This sets the current directory of the file selector. + */ +int setCDKFselectDirectory (CDKFSELECT *fselect, const char *directory) +{ + /* *INDENT-EQLS* */ + CDKENTRY *fentry = fselect->entryField; + CDKSCROLL *fscroll = fselect->scrollField; + int result = 1; + + /* + * If the directory supplied is the same as what is already + * there, return. + */ + if (fselect->pwd != directory) + { + /* Try to chdir into the given directory. */ + if (chdir (directory) != 0) + { + result = 0; + } + else + { + setPWD (fselect); + + /* Set the contents of the entry field. */ + setCDKEntryValue (fentry, fselect->pwd); + drawCDKEntry (fentry, ObjOf (fentry)->box); + + /* Get the directory contents. */ + if (setCDKFselectDirContents (fselect) == 0) + { + result = 0; + } + else + { + /* Set the values in the scrolling list. */ + setCDKScrollItems (fscroll, + (CDK_CSTRING2)fselect->dirContents, + fselect->fileCounter, + FALSE); + } + } + } + return result; +} +char *getCDKFselectDirectory (CDKFSELECT *fselect) +{ + return fselect->pwd; +} + +/* + * This sets the filler character of the entry field. + */ +void setCDKFselectFillerChar (CDKFSELECT *fselect, chtype filler) +{ + CDKENTRY *fentry = fselect->entryField; + fselect->fillerCharacter = filler; + setCDKEntryFillerChar (fentry, filler); +} +chtype getCDKFselectFillerChar (CDKFSELECT *fselect) +{ + return fselect->fillerCharacter; +} + +/* + * This sets the highlight bar of the scrolling list. + */ +void setCDKFselectHighlight (CDKFSELECT *fselect, chtype highlight) +{ + CDKSCROLL *fscroll = (CDKSCROLL *)fselect->scrollField; + fselect->highlight = highlight; + setCDKScrollHighlight (fscroll, highlight); + +} +chtype getCDKFselectHighlight (CDKFSELECT *fselect) +{ + return fselect->highlight; +} + +/* + * This sets the attribute of the directory attribute in the + * scrolling list. + */ +void setCDKFselectDirAttribute (CDKFSELECT *fselect, const char *attribute) +{ + /* Make sure they are not the same. */ + if (fselect->dirAttribute != attribute) + { + freeChar (fselect->dirAttribute); + fselect->dirAttribute = copyChar (attribute); + + setCDKFselectDirContents (fselect); + } +} +char *getCDKFselectDirAttribute (CDKFSELECT *fselect) +{ + return fselect->dirAttribute; +} + +/* + * This sets the attribute of the link attribute in the + * scrolling list. + */ +void setCDKFselectLinkAttribute (CDKFSELECT *fselect, const char *attribute) +{ + /* Make sure they are not the same. */ + if (fselect->linkAttribute != attribute) + { + freeChar (fselect->linkAttribute); + fselect->linkAttribute = copyChar (attribute); + + setCDKFselectDirContents (fselect); + } +} +char *getCDKFselectLinkAttribute (CDKFSELECT *fselect) +{ + return fselect->linkAttribute; +} + +/* + * This sets the attribute of the link attribute in the + * scrolling list. + */ +void setCDKFselectSocketAttribute (CDKFSELECT *fselect, const char *attribute) +{ + /* Make sure they are not the same. */ + if (fselect->sockAttribute != attribute) + { + freeChar (fselect->sockAttribute); + fselect->sockAttribute = copyChar (attribute); + + setCDKFselectDirContents (fselect); + } +} +char *getCDKFselectSocketAttribute (CDKFSELECT *fselect) +{ + return fselect->sockAttribute; +} + +/* + * This sets the attribute of the link attribute in the + * scrolling list. + */ +void setCDKFselectFileAttribute (CDKFSELECT *fselect, const char *attribute) +{ + /* Make sure they are not the same. */ + if (fselect->fileAttribute != attribute) + { + freeChar (fselect->fileAttribute); + fselect->fileAttribute = copyChar (attribute); + + setCDKFselectDirContents (fselect); + } +} +char *getCDKFselectFileAttribute (CDKFSELECT *fselect) +{ + return fselect->fileAttribute; +} + +/* + * This sets the box attribute of the widget. + */ +void setCDKFselectBox (CDKFSELECT *fselect, boolean Box) +{ + ObjOf (fselect)->box = Box; + ObjOf (fselect)->borderSize = Box ? 1 : 0; +} +boolean getCDKFselectBox (CDKFSELECT *fselect) +{ + return ObjOf (fselect)->box; +} + +/* + * This sets the contents of the widget + */ +void setCDKFselectContents (CDKFSELECT *widget, + CDK_CSTRING2 list, + int listSize) +{ + /* *INDENT-EQLS* */ + CDKSCROLL *scrollp = widget->scrollField; + CDKENTRY *entry = widget->entryField; + + if (!createList (widget, list, listSize)) + return; + + /* Set the information in the scrolling list. */ + setCDKScroll (scrollp, + (CDK_CSTRING2)widget->dirContents, + widget->fileCounter, + NONUMBERS, + scrollp->highlight, + ObjOf (scrollp)->box); + + /* Clean out the entry field. */ + setCDKFselectCurrentItem (widget, 0); + cleanCDKEntry (entry); + + /* Redraw the widget. */ + eraseCDKFselect (widget); + drawCDKFselect (widget, ObjOf (widget)->box); +} + +char **getCDKFselectContents (CDKFSELECT *widget, + int *size) +{ + (*size) = widget->fileCounter; + return widget->dirContents; +} + +/* + * Get/set the current position in the scroll-widget. + */ +int getCDKFselectCurrentItem (CDKFSELECT *widget) +{ + return getCDKScrollCurrent (widget->scrollField); +} + +void setCDKFselectCurrentItem (CDKFSELECT *widget, + int item) +{ + if (widget->fileCounter != 0) + { + char *data; + + setCDKScrollCurrent (widget->scrollField, item); + + data = contentToPath (widget, + widget->dirContents[getCDKScrollCurrentItem (widget->scrollField)]); + setCDKEntryValue (widget->entryField, data); + + free (data); + } +} + +/* + * These functions set the drawing characters of the widget. + */ +static void _setMyULchar (CDKOBJS *object, chtype character) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + + setCDKEntryULChar (fselect->entryField, character); +} +static void _setMyURchar (CDKOBJS *object, chtype character) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + + setCDKEntryURChar (fselect->entryField, character); +} +static void _setMyLLchar (CDKOBJS *object, chtype character) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + + setCDKScrollLLChar (fselect->scrollField, character); +} +static void _setMyLRchar (CDKOBJS *object, chtype character) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + + setCDKScrollLRChar (fselect->scrollField, character); +} +static void _setMyVTchar (CDKOBJS *object, chtype character) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + + setCDKEntryVerticalChar (fselect->entryField, character); + setCDKScrollVerticalChar (fselect->scrollField, character); +} +static void _setMyHZchar (CDKOBJS *object, chtype character) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + + setCDKEntryHorizontalChar (fselect->entryField, character); + setCDKScrollHorizontalChar (fselect->scrollField, character); +} +static void _setMyBXattr (CDKOBJS *object, chtype character) +{ + CDKFSELECT *fselect = (CDKFSELECT *)object; + + setCDKEntryBoxAttribute (fselect->entryField, character); + setCDKScrollBoxAttribute (fselect->scrollField, character); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrFselect (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKFSELECT *widget = (CDKFSELECT *)object; + + setCDKEntryBackgroundAttrib (widget->entryField, attrib); + setCDKScrollBackgroundAttrib (widget->scrollField, attrib); + } +} + +/* + * This destroys the file selector. + */ +static void _destroyCDKFselect (CDKOBJS *object) +{ + if (object != 0) + { + CDKFSELECT *fselect = (CDKFSELECT *)object; + + cleanCDKObjectBindings (vFSELECT, fselect); + + /* Free up the character pointers. */ + freeChar (fselect->pwd); + freeChar (fselect->pathname); + freeChar (fselect->dirAttribute); + freeChar (fselect->fileAttribute); + freeChar (fselect->linkAttribute); + freeChar (fselect->sockAttribute); + CDKfreeStrings (fselect->dirContents); + + /* Destroy the other Cdk objects. */ + destroyCDKScroll (fselect->scrollField); + destroyCDKEntry (fselect->entryField); + + /* Free up the window pointers. */ + deleteCursesWindow (fselect->shadowWin); + deleteCursesWindow (fselect->win); + + /* Clean the key bindings. */ + /* Unregister the object. */ + unregisterCDKObject (vFSELECT, fselect); + } +} + +/* + ******************************** + * Callback functions. + ******************************** + */ + +/* + * This is a callback to the scrolling list which displays information + * about the current file. (and the whole directory as well) + */ +static int displayFileInfoCB (EObjectType objectType GCC_UNUSED, + void *object, + void *clientData, + chtype key GCC_UNUSED) +{ + CDKENTRY *entry = (CDKENTRY *)object; + CDKFSELECT *fselect = (CDKFSELECT *)clientData; + CDKLABEL *infoLabel; + struct stat fileStat; +#ifdef HAVE_PWD_H + struct passwd *pwEnt; + struct group *grEnt; +#endif + char *filename; + const char *filetype; + char *mesg[10]; + char stringMode[15]; + int intMode; + boolean functionKey; + + filename = fselect->entryField->info; + + if (lstat (filename, &fileStat) == 0) + { + switch (mode2Filetype (fileStat.st_mode)) + { + case 'l': + filetype = "Symbolic Link"; + break; + case '@': + filetype = "Socket"; + break; + case '-': + filetype = "Regular File"; + break; + case 'd': + filetype = "Directory"; + break; + case 'c': + filetype = "Character Device"; + break; + case 'b': + filetype = "Block Device"; + break; + case '&': + filetype = "FIFO Device"; + break; + default: + filetype = "Unknown"; + break; + } + } + else + { + filetype = "Unknown"; + } + + /* Get the user name and group name. */ +#ifdef HAVE_PWD_H + pwEnt = getpwuid (fileStat.st_uid); + grEnt = getgrgid (fileStat.st_gid); +#endif + + /* Convert the mode_t type to both string and int. */ + intMode = mode2Char (stringMode, fileStat.st_mode); + + /* Create the message. */ + mesg[0] = format1String ("Directory : %s", fselect->pwd); + mesg[1] = format1String ("Filename : %s", filename); +#ifdef HAVE_PWD_H + mesg[2] = format1StrVal ("Owner : %s (%d)", + pwEnt->pw_name, + (int)fileStat.st_uid); + mesg[3] = format1StrVal ("Group : %s (%d)", + grEnt->gr_name, + (int)fileStat.st_gid); +#else + mesg[2] = format1Number ("Owner : (%ld)", (long)fileStat.st_uid); + mesg[3] = format1Number ("Group : (%ld)", (long)fileStat.st_gid); +#endif + mesg[4] = format1StrVal ("Permissions: %s (%o)", stringMode, intMode); + mesg[5] = format1Number ("Size : %ld bytes", (long)fileStat.st_size); + mesg[6] = format1Date ("Last Access: %s", fileStat.st_atime); + mesg[7] = format1Date ("Last Change: %s", fileStat.st_ctime); + mesg[8] = format1String ("File Type : %s", filetype); + + /* Create the pop up label. */ + infoLabel = newCDKLabel (entry->obj.screen, + CENTER, CENTER, + (CDK_CSTRING2)mesg, 9, + TRUE, FALSE); + drawCDKLabel (infoLabel, TRUE); + getchCDKObject (ObjOf (infoLabel), &functionKey); + + /* Clean up some memory. */ + destroyCDKLabel (infoLabel); + freeCharList (mesg, 9); + + /* Redraw the file selector. */ + drawCDKFselect (fselect, ObjOf (fselect)->box); + return (TRUE); +} + +static char *make_pathname (const char *directory, const char *filename) +{ + size_t need = strlen (filename) + 2; + bool root = (strcmp (directory, "/") == 0); + char *result; + + if (!root) + need += strlen (directory); + if ((result = (char *)malloc (need)) != 0) + { + if (root) + sprintf (result, "/%s", filename); + else + sprintf (result, "%s/%s", directory, filename); + } + return result; +} + +/* + * Return the plain string that corresponds to an item in dirContents[]. + */ +static char *contentToPath (CDKFSELECT *fselect, char *content) +{ + chtype *tempChtype; + char *tempChar; + char *result; + int j, j2; + + tempChtype = char2Chtype (content, &j, &j2); + tempChar = chtype2Char (tempChtype); + trim1Char (tempChar); /* trim the 'mode' stored on the end */ + + /* Create the pathname. */ + result = make_pathname (fselect->pwd, tempChar); + + /* Clean up. */ + freeChtype (tempChtype); + freeChar (tempChar); + return result; +} + +/* + * This tries to complete the filename. + */ +static int completeFilenameCB (EObjectType objectType GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + CDKFSELECT *fselect = (CDKFSELECT *)clientData; + CDKSCROLL *scrollp = fselect->scrollField; + CDKENTRY *entry = fselect->entryField; + char *filename = copyChar (entry->info); + char *mydirname = dirName (filename); + char *newFilename = 0; + size_t filenameLen = 0; + int isDirectory; + char **list; + + /* Make sure the filename is not null/empty. */ + if (filename == 0 || + (filenameLen = strlen (filename)) == 0) + { + Beep (); + freeChar (filename); + freeChar (mydirname); + return (TRUE); + } + + /* Try to expand the filename if it starts with a ~ */ + if ((newFilename = expandTilde (filename)) != 0) + { + freeChar (filename); + filename = newFilename; + setCDKEntryValue (entry, filename); + drawCDKEntry (entry, ObjOf (entry)->box); + } + + /* Make sure we can change into the directory. */ + isDirectory = chdir (filename); + if (chdir (fselect->pwd) != 0) + { + freeChar (filename); + freeChar (mydirname); + return FALSE; + } + + setCDKFselect (fselect, + isDirectory ? mydirname : filename, + fselect->fieldAttribute, + fselect->fillerCharacter, + fselect->highlight, + fselect->dirAttribute, + fselect->fileAttribute, + fselect->linkAttribute, + fselect->sockAttribute, + ObjOf (fselect)->box); + freeChar (mydirname); + + /* If we can, change into the directory. */ + if (isDirectory) + { + /* + * Set the entry field with the filename so the current + * filename selection shows up. + */ + setCDKEntryValue (entry, filename); + drawCDKEntry (entry, ObjOf (entry)->box); + } + + /* Create the file list. */ + if ((list = typeMallocN (char *, fselect->fileCounter)) != 0) + { + int Index, x; + + for (x = 0; x < fselect->fileCounter; x++) + { + list[x] = contentToPath (fselect, fselect->dirContents[x]); + } + + /* Look for a unique filename match. */ + Index = searchList ((CDK_CSTRING2)list, fselect->fileCounter, filename); + + /* If the index is less than zero, return we didn't find a match. */ + if (Index < 0) + { + Beep (); + } + else + { + /* Move to the current item in the scrolling list. */ + int difference = Index - scrollp->currentItem; + int absoluteDifference = abs (difference); + if (difference < 0) + { + for (x = 0; x < absoluteDifference; x++) + { + injectMyScroller (fselect, KEY_UP); + } + } + else if (difference > 0) + { + for (x = 0; x < absoluteDifference; x++) + { + injectMyScroller (fselect, KEY_DOWN); + } + } + drawMyScroller (fselect); + + /* Ok, we found a match, is the next item similar? */ + if (Index + 1 < fselect->fileCounter && + 0 != list[Index + 1] && + 0 == strncmp (list[Index + 1], filename, filenameLen)) + { + int currentIndex = Index; + int baseChars = (int)filenameLen; + int matches = 0; + + /* Determine the number of files which match. */ + while (currentIndex < fselect->fileCounter) + { + if (list[currentIndex] != 0) + { + if (strncmp (list[currentIndex], filename, filenameLen) == 0) + { + matches++; + } + } + currentIndex++; + } + + /* Start looking for the common base characters. */ + for (;;) + { + int secondaryMatches = 0; + for (x = Index; x < Index + matches; x++) + { + if (list[Index][baseChars] == list[x][baseChars]) + { + secondaryMatches++; + } + } + + if (secondaryMatches != matches) + { + Beep (); + break; + } + + /* Inject the character into the entry field. */ + (void)injectCDKEntry (fselect->entryField, + (chtype)list[Index][baseChars]); + baseChars++; + } + } + else + { + /* Set the entry field with the found item. */ + setCDKEntryValue (entry, list[Index]); + drawCDKEntry (entry, ObjOf (entry)->box); + } + } + freeCharList (list, (unsigned)fselect->fileCounter); + free (list); + } + freeChar (filename); + return (TRUE); +} + +/* + * This allows the user to delete a file. + */ +void deleteFileCB (EObjectType objectType GCC_UNUSED, void *object, void *clientData) +{ + CDKSCROLL *fscroll = (CDKSCROLL *)object; + CDKFSELECT *fselect = (CDKFSELECT *)clientData; + const char *buttons[] = + { + "No", + "Yes" + }; + CDKDIALOG *question; + char *mesg[10], *filename; + + /* Get the filename which is to be deleted. */ + filename = chtype2Char (fscroll->item[fscroll->currentItem]); + trim1Char (filename); + + /* Create the dialog message. */ + mesg[0] = copyChar ("Are you sure you want to delete the file:"); + mesg[1] = format1String ("\"%s\"?", filename); + + /* Create the dialog box. */ + question = newCDKDialog (ScreenOf (fselect), CENTER, CENTER, + (CDK_CSTRING2)mesg, 2, + (CDK_CSTRING2)buttons, 2, + A_REVERSE, TRUE, TRUE, FALSE); + freeCharList (mesg, 2); + + /* If the said yes then try to nuke it. */ + if (activateCDKDialog (question, 0) == 1) + { + /* If we were successful, reload the scrolling list. */ + if (unlink (filename) == 0) + { + /* Set the file selector information. */ + setCDKFselect (fselect, fselect->pwd, + fselect->fieldAttribute, + fselect->fillerCharacter, + fselect->highlight, + fselect->dirAttribute, + fselect->fileAttribute, + fselect->linkAttribute, + fselect->sockAttribute, + ObjOf (fselect)->box); + } + else + { + /* Pop up a message. */ + mesg[0] = copyChar (errorMessage ("Cannot delete file: %s")); + mesg[1] = copyChar (" "); + mesg[2] = copyChar ("Press any key to continue."); + popupLabel (ScreenOf (fselect), (CDK_CSTRING2)mesg, 3); + freeCharList (mesg, 3); + } + } + + /* Clean up. */ + destroyCDKDialog (question); + + /* Redraw the file selector. */ + drawCDKFselect (fselect, ObjOf (fselect)->box); +} + +/* + * This function sets the pre-process function. + */ +void setCDKFselectPreProcess (CDKFSELECT *fselect, PROCESSFN callback, void *data) +{ + setCDKEntryPreProcess (fselect->entryField, callback, data); + setCDKScrollPreProcess (fselect->scrollField, callback, data); +} + +/* + * This function sets the post-process function. + */ +void setCDKFselectPostProcess (CDKFSELECT *fselect, PROCESSFN callback, void *data) +{ + setCDKEntryPostProcess (fselect->entryField, callback, data); + setCDKScrollPostProcess (fselect->scrollField, callback, data); +} + +/* + * Start of callback functions. + */ +static int fselectAdjustScrollCB (EObjectType objectType GCC_UNUSED, + void *object GCC_UNUSED, + void *clientData, + chtype key) +{ + /* *INDENT-EQLS* */ + CDKFSELECT *fselect = (CDKFSELECT *)clientData; + CDKSCROLL *scrollp = (CDKSCROLL *)fselect->scrollField; + CDKENTRY *entry = (CDKENTRY *)fselect->entryField; + + if (scrollp->listSize > 0) + { + char *current; + char *temp; + + /* Move the scrolling list. */ + injectMyScroller (fselect, key); + + /* Get the currently highlighted filename. */ + current = chtype2Char (scrollp->item[scrollp->currentItem]); + trim1Char (current); + + temp = make_pathname (fselect->pwd, current); + + /* Set the value in the entry field. */ + setCDKEntryValue (entry, temp); + drawCDKEntry (entry, ObjOf (entry)->box); + + freeChar (current); + freeChar (temp); + return (TRUE); + } + Beep (); + return (FALSE); +} + +/* + * trim the 'mode' from a copy of a dirContents[] entry. + */ +static char *trim1Char (char *source) +{ + size_t len; + + if ((len = strlen (source)) != 0) + source[--len] = '\0'; + return source; +} + +static char *format1Date (const char *format, time_t value) +{ + char *result; + char *temp = ctime (&value); + + if ((result = (char *)malloc (strlen (format) + strlen (temp) + 1)) != 0) + { + sprintf (result, format, trim1Char (temp)); + } + return result; +} + +static char *format1Number (const char *format, long value) +{ + char *result; + + if ((result = (char *)malloc (strlen (format) + 20)) != 0) + sprintf (result, format, value); + return result; +} + +static char *format3String (const char *format, + const char *s1, + const char *s2, + const char *s3) +{ + char *result; + + if ((result = (char *)malloc (strlen (format) + + strlen (s1) + + strlen (s2) + + strlen (s3))) != 0) + sprintf (result, format, s1, s2, s3); + return result; +} + +static char *format1String (const char *format, const char *string) +{ + char *result; + + if ((result = (char *)malloc (strlen (format) + strlen (string))) != 0) + sprintf (result, format, string); + return result; +} + +static char *format1StrVal (const char *format, const char *string, int value) +{ + char *result; + + if ((result = (char *)malloc (strlen (format) + strlen (string) + 20)) != 0) + sprintf (result, format, string, value); + return result; +} + +static char *errorMessage (const char *format) +{ + char *message; +#ifdef HAVE_STRERROR + message = strerror (errno); +#else + message = "Unknown reason."; +#endif + return format1String (format, message); +} + +/* + * This takes a ~ type account name and returns the full pathname. + */ +static char *expandTilde (const char *filename) +{ + char *result = 0; + char *account; + char *pathname; + int len; + + /* Make sure the filename is not null/empty, and begins with a tilde */ + if ((filename != 0) && + (len = (int)strlen (filename)) != 0 && + filename[0] == '~' && + (account = copyChar (filename)) != 0 && + (pathname = copyChar (filename)) != 0) + { + bool slash = FALSE; + const char *home; + int x; + int len_a = 0; + int len_p = 0; + struct passwd *accountInfo; + + /* Find the account name in the filename. */ + for (x = 1; x < len; x++) + { + if (filename[x] == '/' && !slash) + { + slash = TRUE; + } + else if (slash) + { + pathname[len_p++] = filename[x]; + } + else + { + account[len_a++] = filename[x]; + } + } + account[len_a] = '\0'; + pathname[len_p] = '\0'; + + home = 0; +#ifdef HAVE_PWD_H + if (strlen (account) != 0 && + (accountInfo = getpwnam (account)) != 0) + { + home = accountInfo->pw_dir; + } +#endif + if (home == 0 || *home == '\0') + home = getenv ("HOME"); + if (home == 0 || *home == '\0') + home = "/"; + + /* + * Construct the full pathname. We do this because someone + * may have a pathname at the end of the account name + * and we want to keep it. + */ + result = make_pathname (home, pathname); + + freeChar (account); + freeChar (pathname); + } + return result; +} + +/* + * Store the name of the current working directory. + */ +static void setPWD (CDKFSELECT *fselect) +{ + char buffer[512]; + freeChar (fselect->pwd); + if (getcwd (buffer, sizeof (buffer)) == 0) + strcpy (buffer, "."); + fselect->pwd = copyChar (buffer); +} + +static void destroyInfo (CDKFSELECT *widget) +{ + CDKfreeStrings (widget->dirContents); + widget->dirContents = 0; + + widget->fileCounter = 0; +} + +static int createList (CDKFSELECT *widget, CDK_CSTRING2 list, int listSize) +{ + int status = 0; + + if (listSize >= 0) + { + char **newlist = typeCallocN (char *, listSize + 1); + + if (newlist != 0) + { + int x; + + /* Copy in the new information. */ + status = 1; + for (x = 0; x < listSize; x++) + { + if ((newlist[x] = copyChar (list[x])) == 0) + { + status = 0; + break; + } + } + if (status) + { + destroyInfo (widget); + widget->fileCounter = listSize; + widget->dirContents = newlist; + } + else + { + CDKfreeStrings (newlist); + } + } + } + else + { + destroyInfo (widget); + status = TRUE; + } + return status; +} + +static void _focusCDKFselect (CDKOBJS *object) +{ + CDKFSELECT *widget = (CDKFSELECT *)object; + + FocusObj (ObjOf (widget->entryField)); +} + +static void _unfocusCDKFselect (CDKOBJS *object) +{ + CDKFSELECT *widget = (CDKFSELECT *)object; + + UnfocusObj (ObjOf (widget->entryField)); +} + +dummyRefreshData (Fselect) + +dummySaveData (Fselect) diff --git a/deps/cdk-5.0-20161210/gen-scale.c b/deps/cdk-5.0-20161210/gen-scale.c new file mode 100644 index 0000000..968f51a --- /dev/null +++ b/deps/cdk-5.0-20161210/gen-scale.c @@ -0,0 +1,817 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 18:32:34 $ + * $Revision: 1.25 $ + */ + +/* + * Declare file local prototypes. + */ +static void drawCDKField (CDK * widget); + +DeclareCDKObjects (, , setCdk, ); + +/* + * This function creates a widget. + */ +CDK *newCDK (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + const char *title, + const char *label, + chtype fieldAttr, + int fieldWidth, + start, + low, + high, + inc, + fastInc, +#if + int digits, +#endif + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDK *widget = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxHeight; + int boxWidth; + int horizontalAdjust, oldWidth; + int xpos = xplace; + int ypos = yplace; + int x, junk; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { 'u', KEY_UP }, + { 'U', KEY_PPAGE }, + { CDK_BACKCHAR, KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + { 'g', KEY_HOME }, + { '^', KEY_HOME }, + { 'G', KEY_END }, + { '$', KEY_END }, + }; + /* *INDENT-ON* */ + + + if ((widget = newCDKObject (CDK, &my_funcs)) == 0) + return (0); + + setCDKBox (widget, Box); + + boxHeight = (BorderOf (widget) * 2) + 1; + + /* Set some basic values of the widget's data field. */ + widget->label = 0; + widget->labelLen = 0; + widget->labelWin = 0; + + /* + * If the fieldWidth is a negative value, the fieldWidth will + * be COLS-fieldWidth, otherwise, the fieldWidth will be the + * given width. + */ + fieldWidth = setWidgetDimension (parentWidth, fieldWidth, 0); + boxWidth = fieldWidth + 2 * BorderOf (widget); + + /* Translate the label char *pointer to a chtype pointer. */ + if (label != 0) + { + widget->label = char2Chtype (label, &widget->labelLen, &junk); + boxWidth = widget->labelLen + fieldWidth + 2; + } + + oldWidth = boxWidth; + boxWidth = setCdkTitle (ObjOf (widget), title, boxWidth); + horizontalAdjust = (boxWidth - oldWidth) / 2; + + boxHeight += TitleLinesOf (widget); + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + fieldWidth = (fieldWidth > (boxWidth - widget->labelLen - 2 * BorderOf (widget)) + ? (boxWidth - widget->labelLen - 2 * BorderOf (widget)) + : fieldWidth); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the widget's window. */ + widget->win = newwin (boxHeight, boxWidth, ypos, xpos); + + /* Is the main window null??? */ + if (widget->win == 0) + { + destroyCDKObject (widget); + return (0); + } + + /* Create the widget's label window. */ + if (widget->label != 0) + { + widget->labelWin = subwin (widget->win, + 1, widget->labelLen, + ypos + TitleLinesOf (widget) + BorderOf (widget), + xpos + horizontalAdjust + BorderOf (widget)); + if (widget->labelWin == 0) + { + destroyCDKObject (widget); + return (0); + } + } + + /* Create the widget's data field window. */ + widget->fieldWin = subwin (widget->win, + 1, fieldWidth, + (ypos + TitleLinesOf (widget) + BorderOf (widget)), + (xpos + + widget->labelLen + + horizontalAdjust + + BorderOf (widget))); + if (widget->fieldWin == 0) + { + destroyCDKObject (widget); + return (0); + } + keypad (widget->fieldWin, TRUE); + keypad (widget->win, TRUE); + + /* *INDENT-EQLS* Create the widget's data field. */ + ScreenOf (widget) = cdkscreen; + widget->parent = cdkscreen->window; + widget->shadowWin = 0; + widget->boxWidth = boxWidth; + widget->boxHeight = boxHeight; + widget->fieldWidth = fieldWidth; + widget->fieldAttr = (chtype)fieldAttr; + widget->current = low; + widget->low = low; + widget->high = high; + widget->current = start; + widget->inc = inc; + widget->fastinc = fastInc; +#if + widget->digits = digits; +#endif + initExitType (widget); + ObjOf (widget)->acceptsFocus = TRUE; + ObjOf (widget)->inputWindow = widget->win; + widget->shadow = shadow; + + /* Do we want a shadow??? */ + if (shadow) + { + widget->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + if (widget->shadowWin == 0) + { + destroyCDKObject (widget); + return (0); + } + } + + /* Setup the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (v, + widget, + (chtype) bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + registerCDKObject (cdkscreen, v, widget); + + return (widget); +} + +/* + * This allows the person to use the widget's data field. + */ + activateCDK (CDK * widget, chtype *actions) +{ + ret; + + /* Draw the widget. */ + drawCDK (widget, ObjOf (widget)->box); + + if (actions == 0) + { + chtype input = 0; + boolean functionKey; + + for (;;) + { + input = (chtype) getchCDKObject (ObjOf (widget), &functionKey); + + /* Inject the character into the widget. */ + ret = () injectCDK (widget, input); + if (widget->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = () injectCDK (widget, actions[x]); + if (widget->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and return. */ + setExitType (widget, 0); + return unknown; +} + +/* + * Check if the value lies outside the low/high range. If so, force it in. + */ +static void limitCurrentValue (CDK * widget) +{ + if (widget->current < widget->low) + { + widget->current = widget->low; + Beep (); + } + else if (widget->current > widget->high) + { + widget->current = widget->high; + Beep (); + } +} + +/* + * Move the cursor to the given edit-position. + */ +static int moveToEditPosition (CDK * widget, int newPosition) +{ + return wmove (widget->fieldWin, 0, widget->fieldWidth - newPosition - 1); +} + +/* + * Check if the cursor is on a valid edit-position. This must be one of + * the non-blank cells in the field. + */ +static int validEditPosition (CDK * widget, int newPosition) +{ + chtype ch; + if (newPosition <= 0 || newPosition >= widget->fieldWidth) + return FALSE; + if (moveToEditPosition (widget, newPosition) == ERR) + return FALSE; + ch = winch (widget->fieldWin); + if (CharOf (ch) != ' ') + return TRUE; + if (newPosition > 1) + { + /* don't use recursion - only one level is wanted */ + if (moveToEditPosition (widget, newPosition - 1) == ERR) + return FALSE; + ch = winch (widget->fieldWin); + return CharOf (ch) != ' '; + } + return FALSE; +} + +/* + * Set the edit position. Normally the cursor is one cell to the right of + * the editable field. Moving it left, over the field allows the user to + * modify cells by typing in replacement characters for the field's value. + */ +static void setEditPosition (CDK * widget, int newPosition) +{ + if (newPosition < 0) + { + Beep (); + } + else if (newPosition == 0) + { + widget->fieldEdit = newPosition; + } + else if (validEditPosition (widget, newPosition)) + { + widget->fieldEdit = newPosition; + } + else + { + Beep (); + } +} + +/* + * Remove the character from the string at the given column, if it is blank. + * Returns true if a change was made. + */ +static bool removeChar (char *string, int col) +{ + bool result = FALSE; + + if ((col >= 0) && (string[col] != ' ')) + { + while (string[col] != '\0') + { + string[col] = string[col + 1]; + ++col; + } + result = TRUE; + } + return result; +} + +/* + * Perform an editing function for the field. + */ +static bool performEdit (CDK * widget, chtype input) +{ + bool result = FALSE; + bool modify = TRUE; + int need = widget->fieldWidth; + char *temp = (char *)malloc ((size_t) need + 2); + char test; + int col = need - widget->fieldEdit - 1; +#if + double value; +#define SCANF_FMT "%lg%c" +#endif +#if + value; +#define SCANF_FMT "%%c" +#endif + + if (temp != 0) + { + int base = 0; + + wmove (widget->fieldWin, 0, base); + winnstr (widget->fieldWin, temp, need); + strcpy (temp + need, " "); + if (isChar (input)) /* replace the char at the cursor */ + { + temp[col] = (char) (input); + } + else if (input == KEY_BACKSPACE) /* delete the char before the cursor */ + { + modify = removeChar (temp, col - 1); + } + else if (input == KEY_DC) /* delete the char at the cursor */ + { + modify = removeChar (temp, col); + } + else + { + modify = FALSE; + } + if (modify + && sscanf (temp, SCANF_FMT, &value, &test) == 2 + && test == ' ' + && value >= widget->low + && value <= widget->high) + { + setCDKValue (widget, () value); + result = TRUE; + } + free (temp); + } + return result; +} + +#define Decrement(value,by) if (value - by < value) value -= by +#define Increment(value,by) if (value + by > value) value += by + +/* + * This function injects a single character into the widget. + */ +static int _injectCDK (CDKOBJS *object, chtype input) +{ + CDK *widget = (CDK *) object; + int ppReturn = 1; + ret = unknown; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Draw the field. */ + drawCDKField (widget); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (v, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a key binding. */ + if (checkCDKObjectBind (v, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_LEFT: + setEditPosition (widget, widget->fieldEdit + 1); + break; + + case KEY_RIGHT: + setEditPosition (widget, widget->fieldEdit - 1); + break; + + case KEY_DOWN: + Decrement (widget->current, widget->inc); + break; + + case KEY_UP: + Increment (widget->current, widget->inc); + break; + + case KEY_PPAGE: + Increment (widget->current, widget->fastinc); + break; + + case KEY_NPAGE: + Decrement (widget->current, widget->fastinc); + break; + + case KEY_HOME: + widget->current = widget->low; + break; + + case KEY_END: + widget->current = widget->high; + break; + + case KEY_TAB: + case KEY_ENTER: + setExitType (widget, input); + ret = (widget->current); + complete = TRUE; + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + if (widget->fieldEdit) + { + if (!performEdit (widget, input)) + Beep (); + } + else + { + /* + * The cursor is not within the editable text. Interpret + * input as commands. + */ + switch (input) + { + case 'd': + case '-': + return _injectCDK (object, KEY_DOWN); + case '+': + return _injectCDK (object, KEY_UP); + case 'D': + return _injectCDK (object, KEY_NPAGE); + case '0': + return _injectCDK (object, KEY_HOME); + default: + Beep (); + break; + } + } + break; + } + } + limitCurrentValue (widget); + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (v, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKField (widget); + setExitType (widget, 0); + } + + ResultOf (widget).value = ret; + return (ret != unknown); +} + +/* + * This moves the widget's data field to the given location. + */ +static void _moveCDK (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDK *widget = (CDK *) object; + int currentX = getbegx (widget->win); + int currentY = getbegy (widget->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (widget->win) + xplace; + ypos = getbegy (widget->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (widget), &xpos, &ypos, widget->boxWidth, widget->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (widget->win, -xdiff, -ydiff); + moveCursesWindow (widget->labelWin, -xdiff, -ydiff); + moveCursesWindow (widget->fieldWin, -xdiff, -ydiff); + moveCursesWindow (widget->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (widget)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDK (widget, ObjOf (widget)->box); + } +} + +/* + * This function draws the widget. + */ +static void _drawCDK (CDKOBJS *object, boolean Box) +{ + CDK *widget = (CDK *) object; + + /* Draw the shadow. */ + if (widget->shadowWin != 0) + { + drawShadow (widget->shadowWin); + } + + /* Box the widget if asked. */ + if (Box) + { + drawObjBox (widget->win, ObjOf (widget)); + } + + drawCdkTitle (widget->win, object); + + /* Draw the label. */ + if (widget->labelWin != 0) + { + writeChtype (widget->labelWin, 0, 0, + widget->label, + HORIZONTAL, 0, + widget->labelLen); + wrefresh (widget->labelWin); + } + wrefresh (widget->win); + + /* Draw the field window. */ + drawCDKField (widget); +} + +/* + * This draws the widget. + */ +static void drawCDKField (CDK * widget) +{ + char temp[256]; + + werase (widget->fieldWin); + + /* Draw the value in the field. */ +#if + { + char format[256]; + int digits = MINIMUM (widget->digits, 30); + sprintf (format, "%%.%i", digits); + sprintf (temp, format, widget->current); + } +#endif +#if + sprintf (temp, "%", widget->current); +#endif + writeCharAttrib (widget->fieldWin, + widget->fieldWidth - (int)strlen (temp) - 1, + 0, + temp, + widget->fieldAttr, + HORIZONTAL, + 0, + (int)strlen (temp)); + + moveToEditPosition (widget, widget->fieldEdit); + wrefresh (widget->fieldWin); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattr (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDK *widget = (CDK *) object; + + wbkgd (widget->win, attrib); + wbkgd (widget->fieldWin, attrib); + if (widget->labelWin != 0) + { + wbkgd (widget->labelWin, attrib); + } + } +} + +/* + * This function destroys the widget. + */ +static void _destroyCDK (CDKOBJS *object) +{ + if (object != 0) + { + CDK *widget = (CDK *) object; + + cleanCdkTitle (object); + freeChtype (widget->label); + + /* Clean up the windows. */ + deleteCursesWindow (widget->fieldWin); + deleteCursesWindow (widget->labelWin); + deleteCursesWindow (widget->shadowWin); + deleteCursesWindow (widget->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (v, widget); + + /* Unregister this object. */ + unregisterCDKObject (v, widget); + } +} + +/* + * This function erases the widget from the screen. + */ +static void _eraseCDK (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDK *widget = (CDK *) object; + + eraseCursesWindow (widget->labelWin); + eraseCursesWindow (widget->fieldWin); + eraseCursesWindow (widget->win); + eraseCursesWindow (widget->shadowWin); + } +} + +/* + * This function sets the low/high/current values of the widget. + */ +void setCDK (CDK * widget, low, high, value, boolean Box) +{ + setCDKLowHigh (widget, low, high); + setCDKValue (widget, value); + setCDKBox (widget, Box); +} + +/* + * This sets the digits. + */ +#if +void setCDKDigits (CDK * widget, int digits) +{ + widget->digits = MAXIMUM (0, digits); +} + +int getCDKDigits (CDK * widget) +{ + return widget->digits; +} +#endif + +/* + * This sets the widget's value. + */ +void setCDKValue (CDK * widget, value) +{ + widget->current = value; + limitCurrentValue (widget); +} + getCDKValue (CDK * widget) +{ + return widget->current; +} + +/* + * This function sets the low/high values of the widget. + */ +void setCDKLowHigh (CDK * widget, low, high) +{ + /* Make sure the values aren't out of bounds. */ + if (low <= high) + { + widget->low = low; + widget->high = high; + } + else + { + widget->low = high; + widget->high = low; + } + + /* Make sure the user hasn't done something silly. */ + limitCurrentValue (widget); +} + getCDKLowValue (CDK * widget) +{ + return widget->low; +} + getCDKHighValue (CDK * widget) +{ + return widget->high; +} + +/* + * This sets the widget's box attribute. + */ +void setCDKBox (CDK * widget, boolean Box) +{ + ObjOf (widget)->box = Box; + ObjOf (widget)->borderSize = Box ? 1 : 0; +} +boolean getCDKBox (CDK * widget) +{ + return ObjOf (widget)->box; +} + +static void _focusCDK (CDKOBJS *object) +{ + CDK *widget = (CDK *) object; + + drawCDK (widget, ObjOf (widget)->box); +} + +static void _unfocusCDK (CDKOBJS *object) +{ + CDK *widget = (CDK *) object; + + drawCDK (widget, ObjOf (widget)->box); +} + +dummyRefreshData () + +dummySaveData () diff --git a/deps/cdk-5.0-20161210/gen-scale.sh b/deps/cdk-5.0-20161210/gen-scale.sh new file mode 100755 index 0000000..8e3a594 --- /dev/null +++ b/deps/cdk-5.0-20161210/gen-scale.sh @@ -0,0 +1,70 @@ +#! /bin/sh +# $Id: gen-scale.sh,v 1.6 2005/12/28 22:51:52 tom Exp $ +# +# This script generates source variations from scale.c for different datatypes. + +UPPER="$1" +MIXED="$2" +DTYPE="$3" +CTYPE="$4" + +# The widget provides for setting the digits. Turn on/off the corresponding +# ifdef. +case $CTYPE in +float|*double) + float=1 + print=f + ;; +long*long) + float=0 + print=ll + ;; +unsigned*long) + float=0 + print=lu + ;; +unsigned) + float=0 + print=u + ;; +long) + float=0 + print=l + ;; +*) + float=0 + print=d + ;; +esac + +if test "$print" = "d" ; then + MODEL= +elif test $CTYPE = double; then + MODEL="d" +else + MODEL=$print +fi + +if test $float = 0 ; then +sed -e '/^#if /,/^#endif /d' \ + -e '/^#if /d' \ + -e '/^#endif /d' \ + -e 's//'"$UPPER"'/g' \ + -e 's//'"$MIXED"'/g' \ + -e 's//'"$DTYPE"'/g' \ + -e 's//'"$CTYPE"'/g' \ + -e 's//'"$MODEL"'/g' \ + -e 's//'"$print"'/g' \ + $5 +else +sed -e '/^#if /,/^#endif /d' \ + -e '/^#if /d' \ + -e '/^#endif /d' \ + -e 's//'"$UPPER"'/g' \ + -e 's//'"$MIXED"'/g' \ + -e 's//'"$DTYPE"'/g' \ + -e 's//'"$CTYPE"'/g' \ + -e 's//'"$MODEL"'/g' \ + -e 's//'"$print"'/g' \ + $5 +fi diff --git a/deps/cdk-5.0-20161210/gen-slider.c b/deps/cdk-5.0-20161210/gen-slider.c new file mode 100644 index 0000000..4ffe2e7 --- /dev/null +++ b/deps/cdk-5.0-20161210/gen-slider.c @@ -0,0 +1,872 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 18:29:20 $ + * $Revision: 1.28 $ + */ + +/* + * Declare file local prototypes. + */ +static void drawCDKField (CDK *widget); +static int formattedSize (CDK *widget, value); + +DeclareCDKObjects (, , setCdk, ); + +/* + * This function creates a widget. + */ +CDK *newCDK (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + const char *title, + const char *label, + chtype filler, + int fieldWidth, + start, + low, + high, + inc, + fastInc, +#if + int digits, +#endif + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDK *widget = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxHeight; + int boxWidth = 0; + int horizontalAdjust, oldWidth; + int xpos = xplace; + int ypos = yplace; + int highValueLen; + int x, junk; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { 'u', KEY_UP }, + { 'U', KEY_PPAGE }, + { CDK_BACKCHAR, KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + { 'g', KEY_HOME }, + { '^', KEY_HOME }, + { 'G', KEY_END }, + { '$', KEY_END }, + }; + /* *INDENT-ON* */ + + + if ((widget = newCDKObject (CDK, &my_funcs)) == 0) + return (0); + + setCDKBox (widget, Box); + boxHeight = (BorderOf (widget) * 2) + 1; + + /* *INDENT-EQLS* Set some basic values of the widget's data field. */ + widget->label = 0; + widget->labelLen = 0; + widget->labelWin = 0; +#if + widget->digits = digits; +#endif + highValueLen = MAXIMUM (formattedSize (widget, low), + formattedSize (widget, high)); + + /* + * If the fieldWidth is a negative value, the fieldWidth will + * be COLS-fieldWidth, otherwise, the fieldWidth will be the + * given width. + */ + fieldWidth = setWidgetDimension (parentWidth, fieldWidth, 0); + + /* Translate the label char *pointer to a chtype pointer. */ + if (label != 0) + { + widget->label = char2Chtype (label, &widget->labelLen, &junk); + boxWidth = widget->labelLen + fieldWidth + highValueLen + 2 * BorderOf (widget); + } + else + { + boxWidth = fieldWidth + highValueLen + 2 * BorderOf (widget); + } + + oldWidth = boxWidth; + boxWidth = setCdkTitle (ObjOf (widget), title, boxWidth); + horizontalAdjust = (boxWidth - oldWidth) / 2; + + boxHeight += TitleLinesOf (widget); + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + fieldWidth = (fieldWidth > (boxWidth - widget->labelLen - highValueLen - 1) + ? (boxWidth - widget->labelLen - highValueLen - 1) + : fieldWidth); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the widget's window. */ + widget->win = newwin (boxHeight, boxWidth, ypos, xpos); + + /* Is the main window null??? */ + if (widget->win == 0) + { + destroyCDKObject (widget); + return (0); + } + + /* Create the widget's label window. */ + if (widget->label != 0) + { + widget->labelWin = subwin (widget->win, + 1, widget->labelLen, + ypos + TitleLinesOf (widget) + BorderOf (widget), + xpos + horizontalAdjust + BorderOf (widget)); + if (widget->labelWin == 0) + { + destroyCDKObject (widget); + return (0); + } + } + + /* Create the widget's data field window. */ + widget->fieldWin = subwin (widget->win, + 1, fieldWidth + highValueLen - 1, + (ypos + TitleLinesOf (widget) + BorderOf (widget)), + (xpos + + widget->labelLen + + horizontalAdjust + + BorderOf (widget))); + if (widget->fieldWin == 0) + { + destroyCDKObject (widget); + return (0); + } + keypad (widget->fieldWin, TRUE); + keypad (widget->win, TRUE); + + /* *INDENT-EQLS* Create the widget's data field. */ + ScreenOf (widget) = cdkscreen; + widget->parent = cdkscreen->window; + widget->shadowWin = 0; + widget->boxWidth = boxWidth; + widget->boxHeight = boxHeight; + widget->fieldWidth = fieldWidth - 1; + widget->filler = filler; + widget->low = low; + widget->high = high; + widget->current = start; + widget->inc = inc; + widget->fastinc = fastInc; + initExitType (widget); + ObjOf (widget)->acceptsFocus = TRUE; + ObjOf (widget)->inputWindow = widget->win; + widget->shadow = shadow; + + /* Set the start value. */ + if (start < low) + { + widget->current = low; + } + + /* Do we want a shadow??? */ + if (shadow) + { + widget->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + if (widget->shadowWin == 0) + { + destroyCDKObject (widget); + return (0); + } + } + + /* Setup the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (v, + widget, + (chtype)bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + registerCDKObject (cdkscreen, v, widget); + + return (widget); +} + +/* + * This allows the person to use the widget's data field. + */ + activateCDK (CDK *widget, chtype *actions) +{ + ret; + + /* Draw the widget. */ + drawCDK (widget, ObjOf (widget)->box); + + if (actions == 0) + { + chtype input = 0; + boolean functionKey; + + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (widget), &functionKey); + + /* Inject the character into the widget. */ + ret = ()injectCDK (widget, input); + if (widget->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = ()injectCDK (widget, actions[x]); + if (widget->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and return. */ + setExitType (widget, 0); + return unknown; +} + +/* + * Check if the value lies outside the low/high range. If so, force it in. + */ +static void limitCurrentValue (CDK *widget) +{ + if (widget->current < widget->low) + { + widget->current = widget->low; + Beep (); + } + else if (widget->current > widget->high) + { + widget->current = widget->high; + Beep (); + } +} + +/* + * Move the cursor to the given edit-position. + */ +static int moveToEditPosition (CDK *widget, int newPosition) +{ + return wmove (widget->fieldWin, + 0, + widget->fieldWidth + + formattedSize (widget, widget->current) - + newPosition); +} + +/* + * Check if the cursor is on a valid edit-position. This must be one of + * the non-blank cells in the field. + */ +static int validEditPosition (CDK *widget, int newPosition) +{ + chtype ch; + if (newPosition <= 0 || newPosition >= widget->fieldWidth) + return FALSE; + if (moveToEditPosition (widget, newPosition) == ERR) + return FALSE; + ch = winch (widget->fieldWin); + if (CharOf (ch) != ' ') + return TRUE; + if (newPosition > 1) + { + /* don't use recursion - only one level is wanted */ + if (moveToEditPosition (widget, newPosition - 1) == ERR) + return FALSE; + ch = winch (widget->fieldWin); + return CharOf (ch) != ' '; + } + return FALSE; +} + +/* + * Set the edit position. Normally the cursor is one cell to the right of + * the editable field. Moving it left, over the field allows the user to + * modify cells by typing in replacement characters for the field's value. + */ +static void setEditPosition (CDK *widget, int newPosition) +{ + if (newPosition < 0) + { + Beep (); + } + else if (newPosition == 0) + { + widget->fieldEdit = newPosition; + } + else if (validEditPosition (widget, newPosition)) + { + widget->fieldEdit = newPosition; + } + else + { + Beep (); + } +} + +/* + * Remove the character from the string at the given column, if it is blank. + * Returns true if a change was made. + */ +static bool removeChar (char *string, int col) +{ + bool result = FALSE; + + if ((col >= 0) && (string[col] != ' ')) + { + while (string[col] != '\0') + { + string[col] = string[col + 1]; + ++col; + } + result = TRUE; + } + return result; +} + +/* + * Perform an editing function for the field. + */ +static bool performEdit (CDK *widget, chtype input) +{ + bool result = FALSE; + bool modify = TRUE; + int base = widget->fieldWidth; + int need = formattedSize (widget, widget->current); + char *temp = (char *)malloc ((size_t) need + 5); + char *data = temp; + char test; + int col = need - widget->fieldEdit; +#if + double value; +#define SCANF_FMT "%lg%c" +#endif +#if + value; +#define SCANF_FMT "%%c" +#endif + + if (temp != 0) + { + int adj = (col < 0) ? (-col) : 0; + if (adj) + { + memset (temp, ' ', (size_t) adj); + temp += adj; + } + wmove (widget->fieldWin, 0, base); + winnstr (widget->fieldWin, temp, need); + strcpy (temp + need, " "); + if (isChar (input)) /* replace the char at the cursor */ + { + temp[col] = (char)(input); + } + else if (input == KEY_BACKSPACE) /* delete the char before the cursor */ + { + modify = removeChar (temp, col - 1); + } + else if (input == KEY_DC) /* delete the char at the cursor */ + { + modify = removeChar (temp, col); + } + else + { + modify = FALSE; + } + if (modify + && sscanf (temp, SCANF_FMT, &value, &test) == 2 + && test == ' ' + && value >= widget->low + && value <= widget->high) + { + setCDKValue (widget, ()value); + result = TRUE; + } + free (data); + } + return result; +} + +#define Decrement(value,by) if (value - by < value) value -= by +#define Increment(value,by) if (value + by > value) value += by + +/* + * This function injects a single character into the widget. + */ +static int _injectCDK (CDKOBJS *object, chtype input) +{ + CDK *widget = (CDK *)object; + int ppReturn = 1; + ret = unknown; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Draw the field. */ + drawCDKField (widget); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (v, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a key binding. */ + if (checkCDKObjectBind (v, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_LEFT: + setEditPosition (widget, widget->fieldEdit + 1); + break; + + case KEY_RIGHT: + setEditPosition (widget, widget->fieldEdit - 1); + break; + + case KEY_DOWN: + Decrement (widget->current, widget->inc); + break; + + case KEY_UP: + Increment (widget->current, widget->inc); + break; + + case KEY_PPAGE: + Increment (widget->current, widget->fastinc); + break; + + case KEY_NPAGE: + Decrement (widget->current, widget->fastinc); + break; + + case KEY_HOME: + widget->current = widget->low; + break; + + case KEY_END: + widget->current = widget->high; + break; + + case KEY_TAB: + case KEY_ENTER: + setExitType (widget, input); + ret = (widget->current); + complete = TRUE; + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + if (widget->fieldEdit) + { + if (!performEdit (widget, input)) + Beep (); + } + else + { + /* + * The cursor is not within the editable text. Interpret + * input as commands. + */ + switch (input) + { + case 'd': + case '-': + return _injectCDK (object, KEY_DOWN); + case '+': + return _injectCDK (object, KEY_UP); + case 'D': + return _injectCDK (object, KEY_NPAGE); + case '0': + return _injectCDK (object, KEY_HOME); + default: + Beep (); + break; + } + } + break; + } + } + limitCurrentValue (widget); + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (v, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKField (widget); + setExitType (widget, 0); + } + + ResultOf (widget).value = ret; + return (ret != unknown); +} + +/* + * This moves the widget's data field to the given location. + */ +static void _moveCDK (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + /* *INDENT-EQLS* */ + CDK *widget = (CDK *)object; + int currentX = getbegx (widget->win); + int currentY = getbegy (widget->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (widget->win) + xplace; + ypos = getbegy (widget->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (widget), &xpos, &ypos, widget->boxWidth, widget->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (widget->win, -xdiff, -ydiff); + moveCursesWindow (widget->labelWin, -xdiff, -ydiff); + moveCursesWindow (widget->fieldWin, -xdiff, -ydiff); + moveCursesWindow (widget->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (widget)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDK (widget, ObjOf (widget)->box); + } +} + +/* + * This function draws the widget. + */ +static void _drawCDK (CDKOBJS *object, boolean Box) +{ + CDK *widget = (CDK *)object; + + /* Draw the shadow. */ + if (widget->shadowWin != 0) + { + drawShadow (widget->shadowWin); + } + + /* Box the widget if asked. */ + if (Box) + { + drawObjBox (widget->win, ObjOf (widget)); + } + + drawCdkTitle (widget->win, object); + + /* Draw the label. */ + if (widget->labelWin != 0) + { + writeChtype (widget->labelWin, 0, 0, + widget->label, + HORIZONTAL, 0, + widget->labelLen); + wrefresh (widget->labelWin); + } + wrefresh (widget->win); + + /* Draw the field window. */ + drawCDKField (widget); +} + +/* + * This draws the widget. + */ +static void drawCDKField (CDK *widget) +{ + int fillerCharacters, x; + char temp[256]; + double step = ((double)widget->fieldWidth / + (double)(widget->high - widget->low)); + + /* Determine how many filler characters need to be drawn. */ + fillerCharacters = (int)((widget->current - widget->low) * step); + + werase (widget->fieldWin); + + /* Add the character to the window. */ + for (x = 0; x < fillerCharacters; x++) + { + (void)mvwaddch (widget->fieldWin, 0, x, widget->filler); + } + + /* Draw the value in the field. */ +#if + { + char format[256]; + int digits = MINIMUM (widget->digits, 30); + sprintf (format, "%%.%i", digits); + sprintf (temp, format, widget->current); + } +#endif +#if + sprintf (temp, "%", widget->current); +#endif + writeCharAttrib (widget->fieldWin, + widget->fieldWidth, + 0, + temp, + A_NORMAL, + HORIZONTAL, + 0, + (int)strlen (temp)); + + moveToEditPosition (widget, widget->fieldEdit); + wrefresh (widget->fieldWin); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattr (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDK *widget = (CDK *)object; + + /* Set the widgets background attribute. */ + wbkgd (widget->win, attrib); + wbkgd (widget->fieldWin, attrib); + if (widget->labelWin != 0) + { + wbkgd (widget->labelWin, attrib); + } + } +} + +/* + * This function destroys the widget. + */ +static void _destroyCDK (CDKOBJS *object) +{ + if (object != 0) + { + CDK *widget = (CDK *)object; + + cleanCdkTitle (object); + freeChtype (widget->label); + + /* Clean up the windows. */ + deleteCursesWindow (widget->fieldWin); + deleteCursesWindow (widget->labelWin); + deleteCursesWindow (widget->shadowWin); + deleteCursesWindow (widget->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (v, widget); + + /* Unregister this object. */ + unregisterCDKObject (v, widget); + } +} + +/* + * This function erases the widget from the screen. + */ +static void _eraseCDK (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDK *widget = (CDK *)object; + + eraseCursesWindow (widget->labelWin); + eraseCursesWindow (widget->fieldWin); + eraseCursesWindow (widget->win); + eraseCursesWindow (widget->shadowWin); + } +} + +static int formattedSize (CDK *widget, value) +{ + char temp[256]; +#if + char format[256]; + int digits = MINIMUM (widget->digits, 30); + sprintf (format, "%%.%i", digits); + sprintf (temp, format, value); +#endif +#if + (void)widget; + sprintf (temp, "%", value); +#endif + return (int) strlen (temp); +} + +/* + * This function sets the low/high/current values of the widget. + */ +void setCDK (CDK *widget, + low, + high, + value, + boolean Box) +{ + setCDKLowHigh (widget, low, high); + setCDKValue (widget, value); + setCDKBox (widget, Box); +} + +/* + * This sets the digits. + */ +#if +void setCDKDigits (CDK *widget, int digits) +{ + widget->digits = MAXIMUM (0, digits); +} + +int getCDKDigits (CDK *widget) +{ + return widget->digits; +} +#endif + +/* + * This sets the widget's value. + */ +void setCDKValue (CDK *widget, value) +{ + widget->current = value; + limitCurrentValue (widget); +} + getCDKValue (CDK *widget) +{ + return widget->current; +} + +/* + * This function sets the low/high values of the widget. + */ +void setCDKLowHigh (CDK *widget, low, high) +{ + /* Make sure the values aren't out of bounds. */ + if (low <= high) + { + widget->low = low; + widget->high = high; + } + else + { + widget->low = high; + widget->high = low; + } + + /* Make sure the user hasn't done something silly. */ + limitCurrentValue (widget); +} + getCDKLowValue (CDK *widget) +{ + return widget->low; +} + getCDKHighValue (CDK *widget) +{ + return widget->high; +} + +/* + * This sets the widget's box attribute. + */ +void setCDKBox (CDK *widget, boolean Box) +{ + ObjOf (widget)->box = Box; + ObjOf (widget)->borderSize = Box ? 1 : 0; +} +boolean getCDKBox (CDK *widget) +{ + return ObjOf (widget)->box; +} + +static void _focusCDK (CDKOBJS *object) +{ + CDK *widget = (CDK *)object; + + drawCDK (widget, ObjOf (widget)->box); +} + +static void _unfocusCDK (CDKOBJS *object) +{ + CDK *widget = (CDK *)object; + + drawCDK (widget, ObjOf (widget)->box); +} + +dummyRefreshData () + +dummySaveData () diff --git a/deps/cdk-5.0-20161210/get_index.c b/deps/cdk-5.0-20161210/get_index.c new file mode 100644 index 0000000..375cbb7 --- /dev/null +++ b/deps/cdk-5.0-20161210/get_index.c @@ -0,0 +1,71 @@ +#include + +/* + * $Author: tom $ + * $Date: 2012/03/22 00:43:33 $ + * $Revision: 1.3 $ + */ + +/* + * This returns a selected value in a list. + */ +int getListIndex (CDKSCREEN *screen, + const char *title, + CDK_CSTRING2 list, + int listSize, + boolean numbers) +{ + /* *INDENT-EQLS* */ + CDKSCROLL *scrollp = 0; + int selected = -1; + int height = 10; + int width = -1; + int len = 0; + int x; + + /* Determine the height of the list. */ + if (listSize < 10) + { + height = listSize + (title == 0 ? 2 : 3); + } + + /* Determine the width of the list. */ + for (x = 0; x < listSize; x++) + { + int temp = (int)strlen (list[x]) + 10; + width = MAXIMUM (width, temp); + } + if (title != 0) + { + len = (int)strlen (title); + } + width = MAXIMUM (width, len); + width += 5; + + /* Create the scrolling list. */ + scrollp = newCDKScroll (screen, CENTER, CENTER, RIGHT, + height, width, title, + (CDK_CSTRING2) list, listSize, numbers, + A_REVERSE, TRUE, FALSE); + + /* Check if we made the list. */ + if (scrollp == 0) + { + refreshCDKScreen (screen); + return -1; + } + + /* Let the user play. */ + selected = activateCDKScroll (scrollp, 0); + + /* Check how they exited. */ + if (scrollp->exitType != vNORMAL) + { + selected = -1; + } + + /* Clean up. */ + destroyCDKScroll (scrollp); + refreshCDKScreen (screen); + return selected; +} diff --git a/deps/cdk-5.0-20161210/get_string.c b/deps/cdk-5.0-20161210/get_string.c new file mode 100644 index 0000000..b92e9b6 --- /dev/null +++ b/deps/cdk-5.0-20161210/get_string.c @@ -0,0 +1,43 @@ +#include + +/* + * $Author: tom $ + * $Date: 2013/06/16 15:07:05 $ + * $Revision: 1.3 $ + */ + +/* + * This gets information from a user. + */ +char *getString (CDKSCREEN *screen, + const char *title, + const char *label, + const char *initValue) +{ + /* *INDENT-EQLS* */ + CDKENTRY *widget = 0; + char *value = 0; + + /* Create the widget. */ + widget = newCDKEntry (screen, CENTER, CENTER, title, label, + A_NORMAL, '.', vMIXED, 40, 0, + 5000, TRUE, FALSE); + + /* Set the default value. */ + setCDKEntryValue (widget, initValue); + + /* Get the string. */ + (void)activateCDKEntry (widget, 0); + + /* Make sure they exited normally. */ + if (widget->exitType != vNORMAL) + { + destroyCDKEntry (widget); + return 0; + } + + /* Return a copy of the string typed in. */ + value = copyChar (getCDKEntryValue (widget)); + destroyCDKEntry (widget); + return value; +} diff --git a/deps/cdk-5.0-20161210/graph.c b/deps/cdk-5.0-20161210/graph.c new file mode 100644 index 0000000..4f1f352 --- /dev/null +++ b/deps/cdk-5.0-20161210/graph.c @@ -0,0 +1,595 @@ +#include + +/* + * $Author: tom $ + * $Date: 2013/06/16 15:05:27 $ + * $Revision: 1.86 $ + */ + +DeclareCDKObjects (GRAPH, Graph, setCdk, Unknown); + +#define TITLE_LM 3 + +/* + * Create a graph widget. + */ +CDKGRAPH *newCDKGraph (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int height, + int width, + const char *title, + const char *xtitle, + const char *ytitle) +{ + /* *INDENT-EQLS* */ + CDKGRAPH *widget = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + + if ((widget = newCDKObject (CDKGRAPH, &my_funcs)) == 0) + return (0); + + setCDKGraphBox (widget, FALSE); + + /* *INDENT-EQLS* */ + boxHeight = setWidgetDimension (parentHeight, height, 3); + boxWidth = setWidgetDimension (parentWidth, width, 0); + boxWidth = setCdkTitle (ObjOf (widget), title, boxWidth); + boxHeight += TitleLinesOf (widget); + boxWidth = MINIMUM (boxWidth, parentWidth); + boxHeight = MINIMUM (boxHeight, parentHeight); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* *INDENT-EQLS* Create the widget pointer. */ + ScreenOf (widget) = cdkscreen; + widget->parent = cdkscreen->window; + widget->win = newwin (boxHeight, boxWidth, ypos, xpos); + widget->boxHeight = boxHeight; + widget->boxWidth = boxWidth; + widget->minx = 0; + widget->maxx = 0; + widget->xscale = 0; + widget->yscale = 0; + widget->count = 0; + widget->displayType = vLINE; + + if (widget->win == 0) + { + destroyCDKObject (widget); + return (0); + } + keypad (widget->win, TRUE); + + /* Translate the X Axis title char * to a chtype * */ + if (xtitle != 0) + { + widget->xtitle = char2Chtype (xtitle, &widget->xtitleLen, &widget->xtitlePos); + widget->xtitlePos = justifyString (widget->boxHeight, + widget->xtitleLen, + widget->xtitlePos); + } + else + { + widget->xtitle = char2Chtype ("X Axis", &widget->xtitleLen, &widget->xtitlePos); + widget->xtitlePos = justifyString (widget->boxHeight, + widget->xtitleLen, + widget->xtitlePos); + } + + /* Translate the Y Axis title char * to a chtype * */ + if (ytitle != 0) + { + widget->ytitle = char2Chtype (ytitle, &widget->ytitleLen, &widget->ytitlePos); + widget->ytitlePos = justifyString (widget->boxWidth, + widget->ytitleLen, + widget->ytitlePos); + } + else + { + widget->ytitle = char2Chtype ("Y Axis", &widget->ytitleLen, &widget->ytitlePos); + widget->ytitlePos = justifyString (widget->boxWidth, + widget->ytitleLen, + widget->ytitlePos); + } + + widget->graphChar = 0; + + registerCDKObject (cdkscreen, vGRAPH, widget); + + return (widget); +} + +/* + * This was added for the builder. + */ +void activateCDKGraph (CDKGRAPH *widget, chtype *actions GCC_UNUSED) +{ + drawCDKGraph (widget, ObjOf (widget)->box); +} + +/* + * Set multiple attributes of the widget. + */ +int setCDKGraph (CDKGRAPH *widget, + int *values, + int count, + const char *graphChar, + boolean startAtZero, + EGraphDisplayType displayType) +{ + int ret; + + ret = setCDKGraphValues (widget, values, count, startAtZero); + setCDKGraphCharacters (widget, graphChar); + setCDKGraphDisplayType (widget, displayType); + return ret; +} + +/* + * Set the scale factors for the graph after we have loaded new values. + */ +static void setScales (CDKGRAPH *widget) +{ + widget->xscale = ((widget->maxx - widget->minx) + / MAXIMUM (1, (widget->boxHeight + - TitleLinesOf (widget) + - 5))); + if (widget->xscale <= 0) + widget->xscale = 1; + + widget->yscale = ((widget->boxWidth - 4) / MAXIMUM (1, widget->count)); + if (widget->yscale <= 0) + widget->yscale = 1; +} + +/* + * Set the values of the graph. + */ +int setCDKGraphValues (CDKGRAPH *widget, int *values, int count, boolean startAtZero) +{ + int min = INT_MAX; + int max = INT_MIN; + int x; + + /* Make sure everything is happy. */ + if (count < 0) + return (FALSE); + + if (widget->values != 0) + { + free (widget->values); + widget->values = 0; + widget->count = 0; + } + if ((widget->values = typeCallocN (int, count + 1)) == 0) + return FALSE; + + /* Copy the X values. */ + for (x = 0; x < count; x++) + { + /* Determine the min/max values of the graph. */ + min = MINIMUM (values[x], widget->minx); + max = MAXIMUM (values[x], widget->maxx); + + /* Copy the value. */ + widget->values[x] = values[x]; + } + + /* Keep the count and min/max values. */ + widget->count = count; + widget->minx = min; + widget->maxx = max; + + /* Check the start at zero status. */ + if (startAtZero) + { + widget->minx = 0; + } + + setScales (widget); + + return (TRUE); +} +int *getCDKGraphValues (CDKGRAPH *widget, int *size) +{ + (*size) = widget->count; + return widget->values; +} + +/* + * Set the value of the graph at the given index. + */ +int setCDKGraphValue (CDKGRAPH *widget, int Index, int value, boolean startAtZero) +{ + /* Make sure the index is within range. */ + if (Index < 0 || Index >= widget->count) + { + return (FALSE); + } + + /* Set the min, max, and value for the graph. */ + widget->minx = MINIMUM (value, widget->minx); + widget->maxx = MAXIMUM (value, widget->maxx); + widget->values[Index] = value; + + /* Check the start at zero status. */ + if (startAtZero) + { + widget->minx = 0; + } + + setScales (widget); + + return (TRUE); +} +int getCDKGraphValue (CDKGRAPH *widget, int Index) +{ + return Index >= 0 && Index < widget->count ? widget->values[Index] : 0; +} + +/* + * Set the characters of the graph widget. + */ +int setCDKGraphCharacters (CDKGRAPH *widget, const char *characters) +{ + chtype *newTokens = 0; + int charCount, junk; + + newTokens = char2Chtype (characters, &charCount, &junk); + + if (charCount != widget->count) + { + freeChtype (newTokens); + return (FALSE); + } + + freeChtype (widget->graphChar); + widget->graphChar = newTokens; + return (TRUE); +} +chtype *getCDKGraphCharacters (CDKGRAPH *widget) +{ + return widget->graphChar; +} + +/* + * Set the character of the graph widget of the given index. + */ +int setCDKGraphCharacter (CDKGRAPH *widget, int Index, const char *character) +{ + chtype *newTokens = 0; + int charCount, junk; + + /* Make sure the index is within range. */ + if (Index < 0 || Index > widget->count) + { + return (FALSE); + } + + /* Convert the string given to us. */ + newTokens = char2Chtype (character, &charCount, &junk); + + /* + * Check if the number of characters back is the same as the number + * of elements in the list. + */ + if (charCount != widget->count) + { + freeChtype (newTokens); + return (FALSE); + } + + /* Everything OK so far. Set the value of the array. */ + widget->graphChar[Index] = newTokens[0]; + freeChtype (newTokens); + return (TRUE); +} +chtype getCDKGraphCharacter (CDKGRAPH *widget, int Index) +{ + return widget->graphChar[Index]; +} + +/* + * Set the display type of the graph. + */ +void setCDKGraphDisplayType (CDKGRAPH *widget, EGraphDisplayType type) +{ + widget->displayType = type; +} +EGraphDisplayType getCDKGraphDisplayType (CDKGRAPH *widget) +{ + return widget->displayType; +} + +/* + * Set the background attribute of the widget. + */ +static void _setBKattrGraph (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKGRAPH *widget = (CDKGRAPH *)object; + + wbkgd (widget->win, attrib); + } +} + +/* + * Move the graph field to the given location. + */ +static void _moveCDKGraph (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKGRAPH *widget = (CDKGRAPH *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (widget->win); + int currentY = getbegy (widget->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (widget->win) + xplace; + ypos = getbegy (widget->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (widget), &xpos, &ypos, widget->boxWidth, widget->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (widget->win, -xdiff, -ydiff); + moveCursesWindow (widget->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (widget)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKGraph (widget, ObjOf (widget)->box); + } +} + +/* + * Set whether or not the graph will be boxed. + */ +void setCDKGraphBox (CDKGRAPH *widget, boolean Box) +{ + ObjOf (widget)->box = Box; + ObjOf (widget)->borderSize = Box ? 1 : 0; +} +boolean getCDKGraphBox (CDKGRAPH *widget) +{ + return ObjOf (widget)->box; +} + +/* + * Draw the graph widget. + */ +static void _drawCDKGraph (CDKOBJS *object, boolean Box) +{ + /* *INDENT-EQLS* */ + CDKGRAPH *widget = (CDKGRAPH *)object; + int adj = 2 + (widget->xtitle == 0 ? 0 : 1); + int spacing = 0; + chtype attrib = ' ' | A_REVERSE; + char temp[100]; + int x, y, xpos, ypos, len; + + /* Box it if needed. */ + if (Box) + { + drawObjBox (widget->win, ObjOf (widget)); + } + + /* Draw in the vertical axis. */ + drawLine (widget->win, + 2, + TitleLinesOf (widget) + 1, + 2, + widget->boxHeight - 3, + ACS_VLINE); + + /* Draw in the horizontal axis. */ + drawLine (widget->win, + 3, + widget->boxHeight - 3, + widget->boxWidth, + widget->boxHeight - 3, + ACS_HLINE); + + drawCdkTitle (widget->win, object); + + /* Draw in the X axis title. */ + if (widget->xtitle != 0) + { + writeChtype (widget->win, + 0, + widget->xtitlePos, + widget->xtitle, + VERTICAL, + 0, + widget->xtitleLen); + attrib = widget->xtitle[0] & A_ATTRIBUTES; + } + + /* Draw in the X axis high value. */ + sprintf (temp, "%d", widget->maxx); + len = (int)strlen (temp); + writeCharAttrib (widget->win, + 1, + TitleLinesOf (widget) + 1, + temp, + attrib, + VERTICAL, + 0, + len); + + /* Draw in the X axis low value. */ + sprintf (temp, "%d", widget->minx); + len = (int)strlen (temp); + writeCharAttrib (widget->win, + 1, + widget->boxHeight - 2 - len, + temp, + attrib, + VERTICAL, + 0, + len); + + /* Draw in the Y axis title. */ + if (widget->ytitle != 0) + { + writeChtype (widget->win, + widget->ytitlePos, + widget->boxHeight - 1, + widget->ytitle, + HORIZONTAL, + 0, + widget->ytitleLen); + attrib = widget->ytitle[0] & A_ATTRIBUTES; + } + + /* Draw in the Y axis high value. */ + sprintf (temp, "%d", widget->count); + len = (int)strlen (temp); + writeCharAttrib (widget->win, + widget->boxWidth - len - adj, + widget->boxHeight - 2, + temp, + attrib, + HORIZONTAL, + 0, + len); + + /* Draw in the Y axis low value. */ + sprintf (temp, "0"); + writeCharAttrib (widget->win, + 3, + widget->boxHeight - 2, + temp, + attrib, + HORIZONTAL, + 0, + (int)strlen (temp)); + + /* If the count is zero, then there aren't any points. */ + if (widget->count == 0) + { + wrefresh (widget->win); + return; + } + spacing = (widget->boxWidth - TITLE_LM) / widget->count; + + /* Draw in the graph line/plot points. */ + for (y = 0; y < widget->count; y++) + { + int colheight = (widget->values[y] / widget->xscale) - 1; + /* Add the marker on the Y axis. */ + (void)mvwaddch (widget->win, + widget->boxHeight - 3, + (y + 1) * spacing + adj, + ACS_TTEE); + + /* If this is a plot graph, all we do is draw a dot. */ + if (widget->displayType == vPLOT) + { + xpos = widget->boxHeight - 4 - colheight; + ypos = (y + 1) * spacing + adj; + (void)mvwaddch (widget->win, xpos, ypos, widget->graphChar[y]); + } + else + { + for (x = 0; x <= widget->yscale; x++) + { + xpos = widget->boxHeight - 3; + ypos = (y + 1) * spacing + adj; + drawLine (widget->win, + ypos, + xpos - colheight, + ypos, + xpos, + widget->graphChar[y]); + } + } + } + + /* Draw in the axis corners. */ + (void)mvwaddch (widget->win, TitleLinesOf (widget), 2, ACS_URCORNER); + (void)mvwaddch (widget->win, widget->boxHeight - 3, 2, ACS_LLCORNER); + (void)mvwaddch (widget->win, widget->boxHeight - 3, widget->boxWidth, ACS_URCORNER); + + /* Refresh and lets see 'er. */ + wrefresh (widget->win); +} + +/* + * Destroy the graph widget. + */ +static void _destroyCDKGraph (CDKOBJS *object) +{ + if (object != 0) + { + CDKGRAPH *widget = (CDKGRAPH *)object; + + cleanCdkTitle (object); + + freeChtype (widget->xtitle); + freeChtype (widget->ytitle); + freeChtype (widget->graphChar); + + freeChecked (widget->values); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vGRAPH, widget); + + /* Unregister this object. */ + unregisterCDKObject (vGRAPH, widget); + + /* Clean up the windows. */ + deleteCursesWindow (widget->win); + } +} + +/* + * Erase the graph widget from the screen. + */ +static void _eraseCDKGraph (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKGRAPH *widget = (CDKGRAPH *)object; + + eraseCursesWindow (widget->win); + } +} + +dummyInject (Graph) + +dummyFocus (Graph) + +dummyUnfocus (Graph) + +dummyRefreshData (Graph) + +dummySaveData (Graph) diff --git a/deps/cdk-5.0-20161210/headers.sh b/deps/cdk-5.0-20161210/headers.sh new file mode 100755 index 0000000..3576e71 --- /dev/null +++ b/deps/cdk-5.0-20161210/headers.sh @@ -0,0 +1,154 @@ +#! /bin/sh +# $Id: headers.sh,v 1.10 2012/03/20 08:45:21 tom Exp $ +# vi:ts=4 sw=4 +# +# Adjust includes for header files that reside in a subdirectory of +# /usr/include, etc. +# +# Options: +# -c CFG specify an alternate name for config.h +# -d DIR target directory +# -e FILE extra editing commands, e.g., for manpage references +# -h FILE install the given file in subdirectory DIR rather than parent +# -i create/update the headers.sed script +# -p PKG specify the package name +# -s DIR source directory +# -t TYPE renaming for manpage-sections +# -x PRG install-program (plus options, the whole value in quotes) +# +# Other parameters are assumed to be provided only for the install scenario. + +SCRIPT=headers.sed +MYFILE=headers.tmp + +OPT_C=config.h +OPT_D= +OPT_E= +OPT_H= +OPT_I=n +OPT_P= +OPT_S= +OPT_T= +OPT_X=install + +while test $# != 0 +do + case $1 in + -c) # CFG specify an alternate name for config.h + shift + OPT_C="$1" + ;; + -d) # DIR target directory + shift + OPT_D="$1" + ;; + -e) # FILE extra sed-commands + shift + OPT_E="$OPT_E -f $1" + ;; + -h) # FILE special-case of header in subdirectory + shift + OPT_H="$1" + ;; + -i) # create the headers.sed script + if test "$OPT_I" = n + then + rm -f $SCRIPT + fi + OPT_I=y + + if ( test -n "$OPT_D" ) + then + if ( test -n "$OPT_S" && test -d "$OPT_S" ) + then + LEAF=`basename $OPT_D` + case $OPT_D in + /*/include/$LEAF) + END=`basename $OPT_D` + for i in $OPT_S/*.h + do + NAME=`basename $i` + if test -z "$OPT_H" || test "$OPT_H" != "$NAME" + then + echo "s%<$NAME>%<$END/$NAME>%g" >> $SCRIPT + fi + done + ;; + *) + echo "" >> $SCRIPT + ;; + esac + OPT_S= + if test -f $SCRIPT ; then + sort -u $SCRIPT >$MYFILE + rm -f $SCRIPT + mv $MYFILE $SCRIPT + fi + fi + fi + + if test -n "$OPT_P" + then + for name in ` + egrep "#define[ ][ ]*[A-Z]" $OPT_C \ + | sed -e 's/^#define[ ][ ]*//' \ + -e 's/[ ].*//' \ + | fgrep -v GCC_ \ + | sort -u \ + | egrep -v "^${OPT_P}_"` + do + echo "s%\\<$name\\>%${OPT_P}_$name%g" >>$SCRIPT + done + if test -f $SCRIPT ; then + sort -u $SCRIPT >$MYFILE + rm -f $SCRIPT + mv $MYFILE $SCRIPT + fi + OPT_P= + fi + ;; + -p) # PKG specify the package name + shift + OPT_P="$1" + ;; + -s) # DIR source directory + shift + OPT_S="$1" + ;; + -t) # rename suffix of target + shift + OPT_T="$1" + ;; + -x) # PRG install-program (plus options, the whole value in quotes) + shift + OPT_X="$1" + ;; + *) + FILE=$1 + + SHOW=`basename $FILE` + TMPSRC=${TMPDIR-/tmp}/${SHOW}$$ + + echo " ... $SHOW" + test -f $OPT_S/$FILE && FILE="$OPT_S/$FILE" + + if test -f "$FILE" + then + rm -f $TMPSRC + sed -f $SCRIPT $OPT_E $FILE > $TMPSRC + NAME=`basename $FILE` + if test -n "$OPT_T" ; then + NAME=`echo "$NAME" | sed -e 's/\.[^.]*$//'`.$OPT_T + fi + + # Just in case someone gzip'd manpages, + # remove the conflicting copy. + test -f $OPT_D/$NAME.gz && rm -f $OPT_D/$NAME.gz + + eval $OPT_X $TMPSRC $OPT_D/$NAME + rm -f $TMPSRC + fi + ;; + esac + shift +done diff --git a/deps/cdk-5.0-20161210/histogram.c b/deps/cdk-5.0-20161210/histogram.c new file mode 100644 index 0000000..90481be --- /dev/null +++ b/deps/cdk-5.0-20161210/histogram.c @@ -0,0 +1,711 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 19:12:46 $ + * $Revision: 1.92 $ + */ + +DeclareCDKObjects (HISTOGRAM, Histogram, setCdk, Unknown); + +/* + * Create a histogram widget. + */ +CDKHISTOGRAM *newCDKHistogram (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int height, + int width, + int orient, + const char *title, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKHISTOGRAM *widget = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int oldWidth = 0; + int oldHeight = 0; + + if ((widget = newCDKObject (CDKHISTOGRAM, &my_funcs)) == 0) + return (0); + + setCDKHistogramBox (widget, Box); + + boxHeight = setWidgetDimension (parentHeight, height, 2); + oldHeight = boxHeight; + + boxWidth = setWidgetDimension (parentWidth, width, 0); + oldWidth = boxWidth; + + boxWidth = setCdkTitle (ObjOf (widget), title, -(boxWidth + 1)); + + /* Increment the height by the number of lines in the title. */ + boxHeight += TitleLinesOf (widget); + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = (boxWidth > parentWidth ? oldWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? oldHeight : boxHeight); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* *INDENT-EQLS* Create the histogram pointer. */ + ScreenOf (widget) = cdkscreen; + widget->parent = cdkscreen->window; + widget->win = newwin (boxHeight, boxWidth, ypos, xpos); + widget->shadowWin = 0; + widget->boxWidth = boxWidth; + widget->boxHeight = boxHeight; + widget->fieldWidth = boxWidth - 2 * BorderOf (widget); + widget->fieldHeight = boxHeight - TitleLinesOf (widget) - 2 * BorderOf (widget); + widget->orient = orient; + widget->shadow = shadow; + + /* Is the window null. */ + if (widget->win == 0) + { + destroyCDKObject (widget); + return (0); + } + keypad (widget->win, TRUE); + + /* *INDENT-EQLS* Set up some default values. */ + widget->filler = '#' | A_REVERSE; + widget->statsAttr = A_NORMAL; + widget->statsPos = TOP; + widget->viewType = vREAL; + widget->high = 0; + widget->low = 0; + widget->value = 0; + widget->lowx = 0; + widget->lowy = 0; + widget->highx = 0; + widget->highy = 0; + widget->curx = 0; + widget->cury = 0; + widget->lowString = 0; + widget->highString = 0; + widget->curString = 0; + + /* Do we want a shadow? */ + if (shadow) + { + widget->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + registerCDKObject (cdkscreen, vHISTOGRAM, widget); + + return (widget); +} + +/* + * This was added for the builder. + */ +void activateCDKHistogram (CDKHISTOGRAM *widget, chtype *actions GCC_UNUSED) +{ + drawCDKHistogram (widget, ObjOf (widget)->box); +} + +/* + * Set various widget attributes. + */ +void setCDKHistogram (CDKHISTOGRAM *widget, + EHistogramDisplayType viewType, + int statsPos, + chtype statsAttr, + int low, + int high, + int value, + chtype filler, + boolean Box) +{ + setCDKHistogramDisplayType (widget, viewType); + setCDKHistogramStatsPos (widget, statsPos); + setCDKHistogramValue (widget, low, high, value); + setCDKHistogramFillerChar (widget, filler); + setCDKHistogramStatsAttr (widget, statsAttr); + setCDKHistogramBox (widget, Box); +} + +/* + * Set the values for the widget. + */ +void setCDKHistogramValue (CDKHISTOGRAM *widget, int low, int high, int value) +{ + /* *INDENT-EQLS* We should error check the information we have. */ + widget->low = (low <= high ? low : 0); + widget->high = (low <= high ? high : 0); + widget->value = (low <= value && value <= high ? value : 0); + /* Determine the percentage of the given value. */ + widget->percent = ((widget->high == 0) + ? 0 + : ((float)widget->value / (float)widget->high)); + + /* Determine the size of the histogram bar. */ + if (widget->orient == VERTICAL) + { + widget->barSize = (int)(widget->percent * (float)widget->fieldHeight); + } + else + { + widget->barSize = (int)(widget->percent * (float)widget->fieldWidth); + } + + /* + * We have a number of variables which determine the personality of the + * histogram. We have to go through each one methodically, and set them + * correctly. This section does this. + */ + if (widget->viewType != vNONE) + { + char string[100]; + int len; + + if (widget->orient == VERTICAL) + { + if (widget->statsPos == LEFT || widget->statsPos == BOTTOM) + { + + /* Free the space used by the character strings. */ + freeChar (widget->lowString); + freeChar (widget->highString); + freeChar (widget->curString); + + /* *INDENT-EQLS* Set the low label attributes. */ + sprintf (string, "%d", widget->low); + len = (int)strlen (string); + widget->lowString = copyChar (string); + widget->lowx = 1; + widget->lowy = widget->boxHeight - len - 1; + + /* *INDENT-EQLS* Set the high label attributes. */ + sprintf (string, "%d", widget->high); + widget->highString = copyChar (string); + widget->highx = 1; + widget->highy = TitleLinesOf (widget) + 1; + + /* Set the current value attributes. */ + if (widget->viewType == vPERCENT) + { + sprintf (string, "%3.1f%%", (float)(widget->percent * 100)); + } + else if (widget->viewType == vFRACTION) + { + sprintf (string, "%d/%d", widget->value, widget->high); + } + else + { + sprintf (string, "%d", widget->value); + } + len = (int)strlen (string); + widget->curString = copyChar (string); + widget->curx = 1; + widget->cury = (((widget->fieldHeight - len) / 2) + + TitleLinesOf (widget) + 1); + } + else if (widget->statsPos == CENTER) + { + /* Set the character strings correctly. */ + freeChar (widget->lowString); + freeChar (widget->highString); + freeChar (widget->curString); + + /* *INDENT-EQLS* Set the low label attributes. */ + sprintf (string, "%d", widget->low); + len = (int)strlen (string); + widget->lowString = copyChar (string); + widget->lowx = (widget->fieldWidth / 2) + 1; + widget->lowy = widget->boxHeight - len - 1; + + /* *INDENT-EQLS* Set the high label attributes. */ + sprintf (string, "%d", widget->high); + widget->highString = copyChar (string); + widget->highx = (widget->fieldWidth / 2) + 1; + widget->highy = TitleLinesOf (widget) + 1; + + /* Set the stats label attributes. */ + if (widget->viewType == vPERCENT) + { + sprintf (string, "%3.2f%%", (float)(widget->percent * 100)); + } + else if (widget->viewType == vFRACTION) + { + sprintf (string, "%d/%d", widget->value, widget->high); + } + else + { + sprintf (string, "%d", widget->value); + } + /* *INDENT-EQLS* */ + len = (int)strlen (string); + widget->curString = copyChar (string); + widget->curx = (widget->fieldWidth / 2) + 1; + widget->cury = (((widget->fieldHeight - len) / 2) + + TitleLinesOf (widget) + + 1); + } + else if (widget->statsPos == RIGHT || widget->statsPos == TOP) + { + /* Set the character strings correctly. */ + freeChar (widget->lowString); + freeChar (widget->highString); + freeChar (widget->curString); + + /* *INDENT-EQLS* Set the low label attributes. */ + sprintf (string, "%d", widget->low); + len = (int)strlen (string); + widget->lowString = copyChar (string); + widget->lowx = widget->fieldWidth; + widget->lowy = widget->boxHeight - len - 1; + + /* *INDENT-EQLS* Set the high label attributes. */ + sprintf (string, "%d", widget->high); + widget->highString = copyChar (string); + widget->highx = widget->fieldWidth; + widget->highy = TitleLinesOf (widget) + 1; + + /* Set the stats label attributes. */ + if (widget->viewType == vPERCENT) + { + sprintf (string, "%3.2f%%", (float)(widget->percent * 100)); + } + else if (widget->viewType == vFRACTION) + { + sprintf (string, "%d/%d", widget->value, widget->high); + } + else + { + sprintf (string, "%d", widget->value); + } + /* *INDENT-EQLS* */ + len = (int)strlen (string); + widget->curString = copyChar (string); + widget->curx = widget->fieldWidth; + widget->cury = (((widget->fieldHeight - len) / 2) + + TitleLinesOf (widget) + + 1); + } + } + else + { + /* Alignment is HORIZONTAL. */ + if (widget->statsPos == TOP || widget->statsPos == RIGHT) + { + /* Set the character strings correctly. */ + freeChar (widget->lowString); + freeChar (widget->highString); + freeChar (widget->curString); + + /* *INDENT-EQLS* Set the low label attributes. */ + sprintf (string, "%d", widget->low); + widget->lowString = copyChar (string); + widget->lowx = 1; + widget->lowy = TitleLinesOf (widget) + 1; + + /* *INDENT-EQLS* Set the high label attributes. */ + sprintf (string, "%d", widget->high); + len = (int)strlen (string); + widget->highString = copyChar (string); + widget->highx = widget->boxWidth - len - 1; + widget->highy = TitleLinesOf (widget) + 1; + + /* Set the stats label attributes. */ + if (widget->viewType == vPERCENT) + { + sprintf (string, "%3.1f%%", (float)(widget->percent * 100)); + } + else if (widget->viewType == vFRACTION) + { + sprintf (string, "%d/%d", widget->value, widget->high); + } + else + { + sprintf (string, "%d", widget->value); + } + /* *INDENT-EQLS* */ + len = (int)strlen (string); + widget->curString = copyChar (string); + widget->curx = (widget->fieldWidth - len) / 2 + 1; + widget->cury = TitleLinesOf (widget) + 1; + } + else if (widget->statsPos == CENTER) + { + /* Set the character strings correctly. */ + freeChar (widget->lowString); + freeChar (widget->highString); + freeChar (widget->curString); + + /* *INDENT-EQLS* Set the low label attributes. */ + sprintf (string, "%d", widget->low); + widget->lowString = copyChar (string); + widget->lowx = 1; + widget->lowy = ((widget->fieldHeight / 2) + + TitleLinesOf (widget) + + 1); + + /* *INDENT-EQLS* Set the high label attributes. */ + sprintf (string, "%d", widget->high); + len = (int)strlen (string); + widget->highString = copyChar (string); + widget->highx = widget->boxWidth - len - 1; + widget->highy = ((widget->fieldHeight / 2) + + TitleLinesOf (widget) + + 1); + + /* Set the stats label attributes. */ + if (widget->viewType == vPERCENT) + { + sprintf (string, "%3.1f%%", (float)(widget->percent * 100)); + } + else if (widget->viewType == vFRACTION) + { + sprintf (string, "%d/%d", widget->value, widget->high); + } + else + { + sprintf (string, "%d", widget->value); + } + /* *INDENT-EQLS* */ + len = (int)strlen (string); + widget->curString = copyChar (string); + widget->curx = (widget->fieldWidth - len) / 2 + 1; + widget->cury = ((widget->fieldHeight / 2) + + TitleLinesOf (widget) + + 1); + } + else if (widget->statsPos == BOTTOM || widget->statsPos == LEFT) + { + /* Set the character strings correctly. */ + freeChar (widget->lowString); + freeChar (widget->highString); + freeChar (widget->curString); + + /* *INDENT-EQLS* Set the low label attributes. */ + sprintf (string, "%d", widget->low); + widget->lowString = copyChar (string); + widget->lowx = 1; + widget->lowy = widget->boxHeight - 2 * BorderOf (widget); + + /* *INDENT-EQLS* Set the high label attributes. */ + sprintf (string, "%d", widget->high); + len = (int)strlen (string); + widget->highString = copyChar (string); + widget->highx = widget->boxWidth - len - 1; + widget->highy = widget->boxHeight - 2 * BorderOf (widget); + + /* Set the stats label attributes. */ + if (widget->viewType == vPERCENT) + { + sprintf (string, "%3.1f%%", (float)(widget->percent * 100)); + } + else if (widget->viewType == vFRACTION) + { + sprintf (string, "%d/%d", widget->value, widget->high); + } + else + { + sprintf (string, "%d", widget->value); + } + /* *INDENT-EQLS* */ + widget->curString = copyChar (string); + widget->curx = (widget->fieldWidth - len) / 2 + 1; + widget->cury = widget->boxHeight - 2 * BorderOf (widget); + } + } + } +} +int getCDKHistogramValue (CDKHISTOGRAM *widget) +{ + return widget->value; +} +int getCDKHistogramLowValue (CDKHISTOGRAM *widget) +{ + return widget->low; +} +int getCDKHistogramHighValue (CDKHISTOGRAM *widget) +{ + return widget->high; +} + +/* + * Set the histogram display type. + */ +void setCDKHistogramDisplayType (CDKHISTOGRAM *widget, EHistogramDisplayType viewType) +{ + widget->viewType = viewType; +} +EHistogramDisplayType getCDKHistogramViewType (CDKHISTOGRAM *widget) +{ + return widget->viewType; +} + +/* + * Set the position of the statistics information. + */ +void setCDKHistogramStatsPos (CDKHISTOGRAM *widget, int statsPos) +{ + widget->statsPos = statsPos; +} +int getCDKHistogramStatsPos (CDKHISTOGRAM *widget) +{ + return widget->statsPos; +} + +/* + * Set the attribute of the statistics. + */ +void setCDKHistogramStatsAttr (CDKHISTOGRAM *widget, chtype statsAttr) +{ + widget->statsAttr = statsAttr; +} +chtype getCDKHistogramStatsAttr (CDKHISTOGRAM *widget) +{ + return widget->statsAttr; +} + +/* + * Set the character to use when drawing the widget. + */ +void setCDKHistogramFillerChar (CDKHISTOGRAM *widget, chtype character) +{ + widget->filler = character; +} +chtype getCDKHistogramFillerChar (CDKHISTOGRAM *widget) +{ + return widget->filler; +} + +/* + * Set the widget box attribute. + */ +void setCDKHistogramBox (CDKHISTOGRAM *widget, boolean Box) +{ + ObjOf (widget)->box = Box; + ObjOf (widget)->borderSize = Box ? 1 : 0; +} +boolean getCDKHistogramBox (CDKHISTOGRAM *widget) +{ + return ObjOf (widget)->box; +} + +/* + * Set the background attribute of the widget. + */ +static void _setBKattrHistogram (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKHISTOGRAM *widget = (CDKHISTOGRAM *)object; + wbkgd (widget->win, attrib); + } +} + +/* + * Move the histogram field to the given location. + */ +static void _moveCDKHistogram (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKHISTOGRAM *widget = (CDKHISTOGRAM *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (widget->win); + int currentY = getbegy (widget->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (widget->win) + xplace; + ypos = getbegy (widget->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (widget), &xpos, &ypos, widget->boxWidth, widget->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (widget->win, -xdiff, -ydiff); + moveCursesWindow (widget->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (widget)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKHistogram (widget, ObjOf (widget)->box); + } +} + +/* + * Draw the widget. + */ +static void _drawCDKHistogram (CDKOBJS *object, boolean Box) +{ + CDKHISTOGRAM *widget = (CDKHISTOGRAM *)object; + /* *INDENT-EQLS* */ + chtype battr = 0; + chtype bchar = 0; + chtype fattr = widget->filler & A_ATTRIBUTES; + int histX = TitleLinesOf (widget) + 1; + int histY = widget->barSize; + int x, y; + + /* Erase the window. */ + werase (widget->win); + + /* Box the widget if asked. */ + if (Box) + { + drawObjBox (widget->win, ObjOf (widget)); + } + + /* Do we have a shadow to draw? */ + if (widget->shadowWin != 0) + { + drawShadow (widget->shadowWin); + } + + drawCdkTitle (widget->win, object); + + /* If the user asked for labels, draw them in. */ + if (widget->viewType != vNONE) + { + /* Draw in the low label. */ + if (widget->lowString != 0) + { + int len = (int)strlen (widget->lowString); + writeCharAttrib (widget->win, + widget->lowx, + widget->lowy, + widget->lowString, + widget->statsAttr, + widget->orient, + 0, len); + } + + /* Draw in the current value label. */ + if (widget->curString != 0) + { + int len = (int)strlen (widget->curString); + writeCharAttrib (widget->win, + widget->curx, + widget->cury, + widget->curString, + widget->statsAttr, + widget->orient, + 0, len); + } + + /* Draw in the high label. */ + if (widget->highString != 0) + { + int len = (int)strlen (widget->highString); + writeCharAttrib (widget->win, + widget->highx, + widget->highy, + widget->highString, + widget->statsAttr, + widget->orient, + 0, len); + } + } + + if (widget->orient == VERTICAL) + { + histX = widget->boxHeight - widget->barSize - 1; + histY = widget->fieldWidth; + } + + /* Draw the histogram bar. */ + for (x = histX; x < widget->boxHeight - 1; x++) + { + for (y = 1; y <= histY; y++) + { + battr = mvwinch (widget->win, x, y); + bchar = CharOf (battr); + + if (bchar == ' ') + { + (void)mvwaddch (widget->win, x, y, widget->filler); + } + else + { + (void)mvwaddch (widget->win, x, y, battr | fattr); + } + } + } + + /* Refresh the window. */ + wrefresh (widget->win); +} + +/* + * Destroy the widget. + */ +static void _destroyCDKHistogram (CDKOBJS *object) +{ + if (object != 0) + { + CDKHISTOGRAM *widget = (CDKHISTOGRAM *)object; + + freeChar (widget->curString); + freeChar (widget->lowString); + freeChar (widget->highString); + cleanCdkTitle (object); + + /* Clean up the windows. */ + deleteCursesWindow (widget->shadowWin); + deleteCursesWindow (widget->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vHISTOGRAM, widget); + + /* Unregister this object. */ + unregisterCDKObject (vHISTOGRAM, widget); + } +} + +/* + * Erase the widget from the screen. + */ +static void _eraseCDKHistogram (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKHISTOGRAM *widget = (CDKHISTOGRAM *)object; + + eraseCursesWindow (widget->win); + eraseCursesWindow (widget->shadowWin); + } +} + +dummyInject (Histogram) + +dummyFocus (Histogram) + +dummyUnfocus (Histogram) + +dummyRefreshData (Histogram) + +dummySaveData (Histogram) diff --git a/deps/cdk-5.0-20161210/include/alphalist.h b/deps/cdk-5.0-20161210/include/alphalist.h new file mode 100644 index 0000000..ca4b531 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/alphalist.h @@ -0,0 +1,242 @@ +/* + * $Id: alphalist.h,v 1.25 2014/01/19 01:58:40 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKALPHALIST_H +#define CDKALPHALIST_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2012,2014 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Define the CDK alphalist widget structure. + */ +struct SAlphalist { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + CDKENTRY * entryField; + CDKSCROLL * scrollField; + char ** list; + int listSize; + int xpos; + int ypos; + int height; + int width; + int boxHeight; + int boxWidth; + chtype highlight; + chtype fillerChar; + boolean shadow; + EExitType exitType; +}; +typedef struct SAlphalist CDKALPHALIST; + +/* + * This creates a pointer to a new CDK alphalist widget. + */ +CDKALPHALIST *newCDKAlphalist ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* height */, + int /* width */, + const char * /* title */, + const char * /* label */, + CDK_CSTRING * /* list */, + int /* listSize */, + chtype /* fillerChar */, + chtype /* highlight */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This allows the user to interact with the widget. + */ +char *activateCDKAlphalist ( + CDKALPHALIST * /* alphalist */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKAlphalist(obj,input) injectCDKObject(obj,input,String) + +/* + * This sets multiple attributes of the alphalist widget. + */ +void setCDKAlphalist ( + CDKALPHALIST * /* alphalist */, + CDK_CSTRING * /* list */, + int /* listSize */, + chtype /* fillerChar */, + chtype /* highlight */, + boolean /* Box */); + +/* + * This sets the contents of the alpha list. + */ +void setCDKAlphalistContents ( + CDKALPHALIST * /* alphalist */, + CDK_CSTRING * /* list */, + int /* listSize */); + +char **getCDKAlphalistContents ( + CDKALPHALIST * /* alphalist */, + int * /* size */); + +/* + * Get/set the current position in the scroll-widget. + */ +int getCDKAlphalistCurrentItem( + CDKALPHALIST * /* widget */); + +void setCDKAlphalistCurrentItem( + CDKALPHALIST * /* widget */, + int /* item */); + +/* + * This sets the filler character of the entry field of the alphalist. + */ +void setCDKAlphalistFillerChar ( + CDKALPHALIST * /* alphalist */, + chtype /* fillerCharacter */); + +chtype getCDKAlphalistFillerChar ( + CDKALPHALIST * /* alphalist */); + +/* + * This sets the highlight bar attributes. + */ +void setCDKAlphalistHighlight ( + CDKALPHALIST * /* alphalist */, + chtype /* highlight */); + +chtype getCDKAlphalistHighlight ( + CDKALPHALIST * /* alphalist */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKAlphalistBox ( + CDKALPHALIST * /* alphalist */, + boolean /* Box */); + +boolean getCDKAlphalistBox ( + CDKALPHALIST * /* alphalist */); + +/* + * These functions set the drawing characters of the widget. + */ +#define setCDKAlphalistULChar(w,c) setULCharOf(w,c) +#define setCDKAlphalistURChar(w,c) setURCharOf(w,c) +#define setCDKAlphalistLLChar(w,c) setLLCharOf(w,c) +#define setCDKAlphalistLRChar(w,c) setLRCharOf(w,c) +#define setCDKAlphalistVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKAlphalistHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKAlphalistBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKAlphalistBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKAlphalistBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the widget on the screen. + */ +#define drawCDKAlphalist(obj,box) drawCDKObject(obj,box) + +/* + * This removes the widget from the screen. + */ +#define eraseCDKAlphalist(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the location specified. + */ +#define moveCDKAlphalist(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the widget. + */ +#define positionCDKAlphalist(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all the memory associated with it. + */ +#define destroyCDKAlphalist(obj) destroyCDKObject(obj) + +/* + * These functions set the pre and post process functions for the widget. + */ +void setCDKAlphalistPreProcess ( + CDKALPHALIST * /* alphalist */, + PROCESSFN /* callback */, + void * /* data */); + +void setCDKAlphalistPostProcess ( + CDKALPHALIST * /* alphalist */, + PROCESSFN /* callback */, + void * /* data */); + +#ifdef __cplusplus +} +#endif + +#endif /* CDKALPHALIST_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/binding.h b/deps/cdk-5.0-20161210/include/binding.h new file mode 100644 index 0000000..c438b0f --- /dev/null +++ b/deps/cdk-5.0-20161210/include/binding.h @@ -0,0 +1,132 @@ +/* + * $Id: binding.h,v 1.14 2005/03/08 23:44:25 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKBINDING_H +#define CDKBINDING_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#endif + +/* + * Changes 1999-2004,2005 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Create definitions for the key bindings. + */ + +/* + * This is the key binding prototype, typed for use with Perl. + */ +#define BINDFN_PROTO(func) \ + int (func) ( \ + EObjectType /* cdktype */, \ + void * /* object */, \ + void * /* clientData */, \ + chtype /* input */) + +typedef BINDFN_PROTO(*BINDFN); + +/* + * Bind to this function to simply translate keys without doing anything else, + * in getcCDKObject(). + */ +extern BINDFN_PROTO(getcCDKBind); + +/* + * This is the prototype for the process callback functions. + */ +typedef int (*PROCESSFN) ( + EObjectType /* cdktype */, + void * /* object */, + void * /* clientData */, + chtype /* input */); + +/* + * This binds the key to the event. + */ +void bindCDKObject ( + EObjectType /* cdktype */, + void * /* object */, + chtype /* key */, + BINDFN /* function */, + void * /* data */); + +/* + * This unbinds the key from the event. + */ +void unbindCDKObject ( + EObjectType /* cdktype */, + void * /* object */, + chtype /* key */); + +/* + * This checks if the given key has an event 'attached' to it, executes the + * bound function if so. + */ +int checkCDKObjectBind ( + EObjectType /* cdktype */, + void * /* object */, + chtype /* key */); + +/* + * This checks if the given key has an event 'attached' to it. + */ +bool isCDKObjectBind ( + EObjectType /* cdktype */, + void * /* object */, + chtype /* key */); + +/* + * This cleans out all of the key bindings. + */ +void cleanCDKObjectBindings ( + EObjectType /* cdktype */, + void * /* object */); + +#ifdef __cplusplus +} +#endif + +#endif /* CDKBINDING_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/button.h b/deps/cdk-5.0-20161210/include/button.h new file mode 100644 index 0000000..56dc22d --- /dev/null +++ b/deps/cdk-5.0-20161210/include/button.h @@ -0,0 +1,208 @@ +/* + * $Id: button.h,v 1.13 2016/01/31 21:08:37 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKBUTTON_H +#define CDKBUTTON_H 1 + +#include "cdk.h" + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 2002-2012,2016 copyright Thomas E. Dickey + * + * Copyright 1999, Grant Edwards + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Grant Edwards + * and contributors. + * 4. Neither the name of Grant Edwards, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY GRANT EDWARDS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL GRANT EDWARDS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare any definitions you need to make. + */ +typedef struct SButton CDKBUTTON; + +typedef void (*tButtonCallback)(struct SButton *button); + + +/* + * Declare the CDK label structure. + */ +struct SButton { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + chtype * info; + tButtonCallback callback; + int infoLen; + int infoPos; + int boxWidth; + int boxHeight; + int xpos; + int ypos; + int rows; + EExitType exitType; + boolean shadow; + chtype highlight; + void * callbackData; +}; + +/* + * This sets the callback function of the button's argument. + */ +#define setCDKButtonCBArgs(button, argPtr) \ + ((button)->callbackData = (void*)(argPtr)) + +#define getCDKButtonCBArgs(button, argType) \ + ((argType) ((button)->callbackData)) + + +/* + * This sets the button's highlight mode. + */ +#define CDKButtonHighlightOf(button) \ + ((button)->highlight) + +#define setCDKButtonHighlight(button, highlightMode) \ + (CDKButtonHighlightOf(button) = (highlightMode)) + +#define getCDKButtonHighlight(button) \ + CDKButtonHighlightOf(button) + +/* + * This creates a new CDK button widget. + */ +CDKBUTTON *newCDKButton ( + CDKSCREEN * /* screen */, + int /* xPos */, + int /* yPos */, + const char * /* button text */, + tButtonCallback /* callback function */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This was added to make the builder simpler. All this will + * do is call drawCDKLabel. + */ +int activateCDKButton ( + CDKBUTTON * /* button */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKButton(obj,input) injectCDKObject(obj,input,Int) + +/* + * This sets multiple attributes of the widget. + */ +void setCDKButton ( + CDKBUTTON * /* button */, + const char * /* text */, + boolean /* Box */); + +/* + * This sets the contents of the button. + */ +void setCDKButtonMessage ( + CDKBUTTON * /* button */, + const char * /* mesg */); + +chtype *getCDKButtonMessage ( + CDKBUTTON *); + +/* + * This sets the box attribute of the widget. + */ +void setCDKButtonBox ( + CDKBUTTON * /* button */, + boolean /* Box */); + +boolean getCDKButtonBox ( + CDKBUTTON * /* button */); + +/* + * This draws the button. + */ +#define drawCDKButton(obj,Box) drawCDKObject(obj,Box) + +/* + * These set the drawing characters of the widget. + */ +#define setCDKButtonULChar(w,c) setULCharOf(w,c) +#define setCDKButtonURChar(w,c) setURCharOf(w,c) +#define setCDKButtonLLChar(w,c) setLLCharOf(w,c) +#define setCDKButtonLRChar(w,c) setLRCharOf(w,c) +#define setCDKButtonVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKButtonHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKButtonBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKButtonBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKButtonBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This erases the button. + */ +#define eraseCDKButton(obj) eraseCDKObject(obj) + +/* + * This destroys the button and the memory used by it. + */ +#define destroyCDKButton(obj) destroyCDKObject(obj) + +/* + * This moves the button to a new screen location. + */ +#define moveCDKButton(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the button. + */ +void positionCDKButton (CDKBUTTON *); + +#endif /* CDKBUTTON_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/buttonbox.h b/deps/cdk-5.0-20161210/include/buttonbox.h new file mode 100644 index 0000000..204bd32 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/buttonbox.h @@ -0,0 +1,220 @@ +/* + * $Id: buttonbox.h,v 1.27 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKBUTTONBOX_H +#define CDKBUTTONBOX_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2005,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK buttonbox structure. + */ +struct SButtonBox { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + int titleAdj; + chtype ** button; + int * buttonLen; + int * buttonPos; + int * columnWidths; + int buttonCount; + int buttonWidth; + int currentButton; + int rows; + int cols; + int colAdjust; + int rowAdjust; + int boxWidth; + int boxHeight; + chtype ButtonAttrib; + EExitType exitType; + boolean shadow; + chtype highlight; +}; +typedef struct SButtonBox CDKBUTTONBOX; + +/* + * This returns a CDK buttonbox widget pointer. + */ +CDKBUTTONBOX *newCDKButtonbox ( + CDKSCREEN * /* cdkscreen */, + int /* xPos */, + int /* yPos */, + int /* height */, + int /* width */, + const char * /* title */, + int /* rows */, + int /* cols */, + CDK_CSTRING2 /* buttons */, + int /* buttonCount */, + chtype /* highlight */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the widget. + */ +int activateCDKButtonbox ( + CDKBUTTONBOX * /* buttonbox */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKButtonbox(obj,input) injectCDKObject(obj,input,Int) + +/* + * This sets multiple attributes of the widget. + */ +void setCDKButtonbox ( + CDKBUTTONBOX * /* buttonbox */, + chtype /* highlight */, + boolean /* Box */); + +void setCDKButtonboxCurrentButton ( + CDKBUTTONBOX * /* buttonbox */, + int /* button */); + +int getCDKButtonboxCurrentButton ( + CDKBUTTONBOX * /* buttonbox */); + +int getCDKButtonboxButtonCount ( + CDKBUTTONBOX * /* buttonbox */); + +/* + * This sets the highlight attribute for the buttonbox. + */ +void setCDKButtonboxHighlight ( + CDKBUTTONBOX * /* buttonbox */, + chtype /* highlight */); + +chtype getCDKButtonboxHighlight ( + CDKBUTTONBOX * /* buttonbox */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKButtonboxBox ( + CDKBUTTONBOX * /* buttonbox */, + boolean /* Box */); + +boolean getCDKButtonboxBox ( + CDKBUTTONBOX * /* buttonbox */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKButtonboxULChar(w,c) setULCharOf(w,c) +#define setCDKButtonboxURChar(w,c) setURCharOf(w,c) +#define setCDKButtonboxLLChar(w,c) setLLCharOf(w,c) +#define setCDKButtonboxLRChar(w,c) setLRCharOf(w,c) +#define setCDKButtonboxVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKButtonboxHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKButtonboxBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKButtonboxBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKButtonboxBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the buttonbox box widget. + */ +#define drawCDKButtonbox(obj,box) drawCDKObject(obj,box) + +void drawCDKButtonboxButtons ( + CDKBUTTONBOX * /* buttonbox */); + +/* + * This erases the buttonbox box from the screen. + */ +#define eraseCDKButtonbox(obj) eraseCDKObject(obj) + +/* + * This moves the buttonbox box to a new screen location. + */ +#define moveCDKButtonbox(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to position the widget on the screen interactively. + */ +#define positionCDKButtonbox(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all the memory associated with it. + */ +#define destroyCDKButtonbox(obj) destroyCDKObject(obj) + +/* + * This redraws the buttonbox box buttonboxs. + */ +void redrawCDKButtonboxButtonboxs ( + CDKBUTTONBOX * /* buttonbox */); + +/* + * These set the pre/post process functions of the buttonbox widget. + */ +#define setCDKButtonboxPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKButtonboxPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKBUTTONBOX_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/calendar.h b/deps/cdk-5.0-20161210/include/calendar.h new file mode 100644 index 0000000..867f516 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/calendar.h @@ -0,0 +1,310 @@ +/* + * $Id: calendar.h,v 1.31 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKCALENDAR_H +#define CDKCALENDAR_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 2000-2011,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare some definitions needed for this widget. + */ +#define MAX_DAYS 32 /* maximum number of days in any month */ +#define MAX_MONTHS 13 /* month[0] is unused */ +#define MAX_YEARS 140 /* years [1901..2140] */ + +#define CALENDAR_LIMIT (MAX_DAYS * MAX_MONTHS * MAX_YEARS) + +#define CALENDAR_INDEX(d,m,y) ((((y) * MAX_MONTHS) + (m)) * MAX_DAYS + (d)) +#define CALENDAR_CELL(c,d,m,y) ((c)->marker[CALENDAR_INDEX(d,m,y)]) + +/* + * Define the CDK calendar widget structure. + */ +struct SCalendar { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * labelWin; + WINDOW * fieldWin; + WINDOW * shadowWin; + int titleAdj; + int xpos; + int ypos; + int height; + int width; + int fieldWidth; + int labelLen; + chtype yearAttrib; + chtype monthAttrib; + chtype dayAttrib; + chtype highlight; + chtype * marker; + int day; + int month; + int year; + int weekDay; + int boxWidth; + int boxHeight; + int xOffset; + EExitType exitType; + boolean shadow; + char * DayName; + char * MonthName[MAX_MONTHS]; + int weekBase; /* starting day of week (Sunday=0, Monday=1) */ +}; +typedef struct SCalendar CDKCALENDAR; + +/* + * This creates a pointer to a new calendar widget. + */ +CDKCALENDAR *newCDKCalendar ( + CDKSCREEN * /* screen */, + int /* xPos */, + int /* yPos */, + const char * /* title */, + int /* day */, + int /* month */, + int /* year */, + chtype /* dayAttrib */, + chtype /* monthAttrib */, + chtype /* yearAttrib */, + chtype /* highlight */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the calendar widget. + */ +time_t activateCDKCalendar ( + CDKCALENDAR * /* calendar */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKCalendar(obj,input) injectCDKObject(obj,input,Int) + +/* + * This sets multiple attributes of the widget. + */ +void setCDKCalendar ( + CDKCALENDAR * /* calendar */, + int /* day */, + int /* month */, + int /* year */, + chtype /* dayAttrib */, + chtype /* monthAttrib */, + chtype /* yearAttrib */, + chtype /* highlight */, + boolean /* Box */); + +/* + * This sets the date of the calendar. + */ +void setCDKCalendarDate ( + CDKCALENDAR * /* calendar */, + int /* day */, + int /* month */, + int /* year */); + +void getCDKCalendarDate ( + CDKCALENDAR * /* calendar */, + int * /* day */, + int * /* month */, + int * /* year */); + +/* + * This sets the attribute of the days in the calendar. + */ +void setCDKCalendarDayAttribute ( + CDKCALENDAR * /* calendar */, + chtype /* attribute */); + +chtype getCDKCalendarDayAttribute ( + CDKCALENDAR * /* calendar */); + +/* + * This sets the attribute of the month names in the calendar. + */ +void setCDKCalendarMonthAttribute ( + CDKCALENDAR * /* calendar */, + chtype /* attribute */); + +chtype getCDKCalendarMonthAttribute ( + CDKCALENDAR * /* calendar */); + +/* + * This sets the attribute of the year in the calendar. + */ +void setCDKCalendarYearAttribute ( + CDKCALENDAR * /* calendar */, + chtype /* attribute */); + +chtype getCDKCalendarYearAttribute ( + CDKCALENDAR * /* calendar */); + +/* + * This sets the attribute of the highlight bar. + */ +void setCDKCalendarHighlight ( + CDKCALENDAR * /* calendar */, + chtype /* highlight */); + +chtype getCDKCalendarHighlight ( + CDKCALENDAR * /* calendar */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKCalendarBox ( + CDKCALENDAR * /* calendar */, + boolean /* Box */); + +boolean getCDKCalendarBox ( + CDKCALENDAR * /* calendar */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKCalendarULChar(w,c) setULCharOf(w,c) +#define setCDKCalendarURChar(w,c) setURCharOf(w,c) +#define setCDKCalendarLLChar(w,c) setLLCharOf(w,c) +#define setCDKCalendarLRChar(w,c) setLRCharOf(w,c) +#define setCDKCalendarVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKCalendarHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKCalendarBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKCalendarBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKCalendarBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This sets a marker on the calendar. + */ +void setCDKCalendarMarker ( + CDKCALENDAR * /* calendar */, + int /* day */, + int /* month */, + int /* year */, + chtype /* markerChar */); +/* + * Return the marker set on the calendar. + */ +chtype getCDKCalendarMarker ( + CDKCALENDAR * /* calendar */, + int /* day */, + int /* month */, + int /* year */); + +/* + * This removes a marker from the calendar. + */ +void removeCDKCalendarMarker ( + CDKCALENDAR * /* calendar */, + int /* day */, + int /* month */, + int /* year */); + +/* + * This draws the widget on the screen. + */ +#define drawCDKCalendar(obj,box) drawCDKObject(obj,box) + +/* + * This removes the widget from the screen. + */ +#define eraseCDKCalendar(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location. + */ +#define moveCDKCalendar(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This is an interactive method of moving the widget. + */ +#define positionCDKCalendar(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the calendar widget and all associated memory. + */ +#define destroyCDKCalendar(obj) destroyCDKObject(obj) + +/* + * This sets the pre and post process functions. + */ +#define setCDKCalendarPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKCalendarPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +/* + * This sets days and months names + */ +void setCDKCalendarMonthsNames ( + CDKCALENDAR * /* calendar */, + CDK_CSTRING2 /* months */); + +void setCDKCalendarDaysNames ( + CDKCALENDAR * /* calendar */, + const char * /* days - 1st is Sunday */); + +#ifdef __cplusplus +} +#endif + +#endif /* CDKCALENDAR_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/cdk.h b/deps/cdk-5.0-20161210/include/cdk.h new file mode 100644 index 0000000..1cf2e44 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdk.h @@ -0,0 +1,336 @@ +/* + * $Id: cdk.h,v 1.37 2012/03/20 22:01:57 tom Exp $ + */ + +#ifndef CDK_H +#define CDK_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Changes 2000-2009,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#ifdef CDK_PERL_EXT +#undef instr +#endif + +#ifdef HAVE_XCURSES +#include +#ifndef mvwhline +#define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n)) +#endif +#ifndef mvwvline +#define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n)) +#endif +#elif defined(HAVE_NCURSESW_NCURSES_H) +#include +#elif defined(HAVE_NCURSES_NCURSES_H) +#include +#elif defined(HAVE_NCURSES_H) +#include +#else +#include +#endif + +#include +#include + +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#include +#include +#ifdef HAVE_PWD_H +#include +#endif +#ifdef HAVE_GRP_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif + +#ifdef HAVE_GETOPT_HEADER +#ifdef HAVE_GETOPT_H +#include +#endif +#else +extern int optind; +extern char * optarg; +#endif + +/* + * Definitions that we do not want if term.h does + */ +#ifdef buttons +#undef buttons +#endif + +#ifdef lines +#undef lines +#endif + +#ifdef newline +#undef newline +#endif + +/* + * Values we normally get from limits.h (assume 32-bits) + */ +#ifndef INT_MIN +#define INT_MIN (-INT_MAX - 1) +#endif + +#ifndef INT_MAX +#define INT_MAX 2147483647 +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /*nothing*/ +#endif + +#ifdef HAVE_LIBDMALLOC +#include /* Gray Watson's library */ +#else +#undef HAVE_LIBDMALLOC +#define HAVE_LIBDMALLOC 0 +#endif + +#ifdef HAVE_LIBDBMALLOC +#include /* Conor Cahill's library */ +#else +#undef HAVE_LIBDBMALLOC +#define HAVE_LIBDBMALLOC 0 +#endif + +/* + * This enumerated typedef lists all of the CDK widget types. + */ +typedef enum { vNULL = 0 + ,vALPHALIST + ,vBUTTON + ,vBUTTONBOX + ,vCALENDAR + ,vDIALOG + ,vDSCALE + ,vENTRY + ,vFSCALE + ,vFSELECT + ,vFSLIDER + ,vGRAPH + ,vHISTOGRAM + ,vITEMLIST + ,vLABEL + ,vMARQUEE + ,vMATRIX + ,vMENTRY + ,vMENU + ,vRADIO + ,vSCALE + ,vSCROLL + ,vSELECTION + ,vSLIDER + ,vSWINDOW + ,vTEMPLATE + ,vTRAVERSE + ,vUSCALE + ,vUSLIDER + ,vVIEWER + } EObjectType; + +/* + * This enumerated typedef lists all the valid display types for + * the entry, mentry, and template widgets. + */ +typedef enum { vINVALID = 0 + ,vCHAR + ,vHCHAR + ,vINT + ,vHINT + ,vMIXED + ,vHMIXED + ,vUCHAR + ,vLCHAR + ,vUHCHAR + ,vLHCHAR + ,vUMIXED + ,vLMIXED + ,vUHMIXED + ,vLHMIXED + ,vVIEWONLY + } EDisplayType; + +/* + * This enumerated typedef lists all the display types for + * the histogram widget. + */ +typedef enum {vNONE, vPERCENT, vFRACTION, vREAL} EHistogramDisplayType; + +/* + * This enumerated typedef defines the display types for the graph. + */ +typedef enum {vPLOT, vLINE} EGraphDisplayType; + +/* + * This enumerated typedef defines where white space is to be + * stripped from in the function stripWhiteSpace. + */ +typedef enum {vFRONT, vBACK, vBOTH} EStripType; + +/* + * This enumerated typedef defines the type of exits the widgets + * recognize. + */ +typedef enum {vEARLY_EXIT, vESCAPE_HIT, vNORMAL, vNEVER_ACTIVATED, vERROR} EExitType; + +/* + * This defines a boolean type. + */ +typedef int boolean; + +/* + * Declare miscellaneous defines. + */ +#define LEFT 9000 +#define RIGHT 9001 +#define CENTER 9002 +#define TOP 9003 +#define BOTTOM 9004 +#define HORIZONTAL 9005 +#define VERTICAL 9006 +#define FULL 9007 + +#define NONE 0 +#define ROW 1 +#define COL 2 + +#define MAX_BINDINGS 300 /* unused by widgets */ +#define MAX_ITEMS 2000 /* unused by widgets */ +#define MAX_BUTTONS 200 /* unused by widgets */ + +#define MAXIMUM(a,b) ((a) > (b) ? (a) : (b)) +#define MINIMUM(a,b) ((a) < (b) ? (a) : (b)) +#define HALF(a) ((a) >> 1) + +#ifndef COLOR_PAIR +#define COLOR_PAIR(a) A_NORMAL +#endif + +#define CONTROL(c) ((c) & 0x1f) /* obsolete: use CTRL() */ + +/* Define the 'GLOBAL DEBUG FILEHANDLE' */ +extern FILE *CDKDEBUG; + +/* + * ========================================================= + * Declare Debugging Routines. + * ========================================================= + */ +#define START_DEBUG(a) (CDKDEBUG=startCDKDebug(a)) +#define WRITE_DEBUGMESG(a,b) (writeCDKDebugMessage (CDKDEBUG,__FILE__,a,__LINE__,b)) +#define END_DEBUG (stopCDKDebug(CDKDEBUG) +FILE *startCDKDebug(const char *filename); +void writeCDKDebugMessage (FILE *fd, const char *filename, const char *function, int line, const char *message); +void stopCDKDebug (FILE *fd); + +/* + * These header files define miscellaneous values and prototypes. + */ +#include +#include +#include +#include +#include +#include + +/* + * Include the CDK widget header files. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Generated headers: + */ +#include +#include +#include +#include + +#include +#include +#include + +/* + * Low-level object drawing + */ +#include + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_H */ diff --git a/deps/cdk-5.0-20161210/include/cdk_compat.h b/deps/cdk-5.0-20161210/include/cdk_compat.h new file mode 100644 index 0000000..b0dbb1c --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdk_compat.h @@ -0,0 +1,98 @@ +/* + * $Id: cdk_compat.h,v 1.2 2005/12/28 21:45:45 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDK_COMPAT_H +#define CDK_COMPAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Copyright 2004,2005 Thomas E. Dickey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas Dickey + * and contributors. + * 4. Neither the name of Thomas Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Renaming of struct members was done for consistency. Making old/new + * versions compatible with renaming is awkward (there may be inadvertant + * naming collisions), but this is mainly for demonstration purposes. + */ +#define info list +#define infoSize listSize +#define itemCount listSize +#define boxMatrix box + +/* + * Include the Cdk header file, which includes everything except for this file. + */ +#include + +/* + * This is defined via the new header file: + */ +#ifdef CDK_VERSION_PATCH + +/* + * If we included the new Cdk header file, provide definitions for things + * which have been made obsolete. + */ + +#define MAX_LINES 5000 + +#define WIN_WIDTH(a) getmaxx(a) +#define WIN_HEIGHT(a) getmaxy(a) +#define WIN_XPOS(a) getbegx(a) +#define WIN_YPOS(a) getbegy(a) + +extern int getDirectoryContents (char *directory, char **list, int maxListSize); +extern int readFile (char *filename, char **info, int maxlines); +extern int splitString (char *string, char **items, char splitChar); + +#else + +/* + * Provide definitions to allow the applications using the old header to + * compile using the new header's macros: + */ +#define ObjOf(a) (a) +#define ScreenOf(a) (a) + +#endif /* CDK_VERSION_PATCH */ + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_COMPAT_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/cdk_int.h b/deps/cdk-5.0-20161210/include/cdk_int.h new file mode 100644 index 0000000..8e1b54d --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdk_int.h @@ -0,0 +1,106 @@ +/* + * $Id: cdk_int.h,v 1.27 2016/12/04 19:43:43 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDK_INT_H +#define CDK_INT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Copyright 2003-2013,2016 Thomas E. Dickey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas Dickey + * and contributors. + * 4. Neither the name of Thomas Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define typeCallocN(type,n) (type*)calloc((size_t)(n), sizeof(type)) +#define typeCalloc(type) typeCallocN(type,1) + +#define typeReallocN(type,p,n) (type*)realloc(p, (size_t)(n) * sizeof(type)) + +#define typeMallocN(type,n) (type*)malloc((size_t)(n) * sizeof(type)) +#define typeMalloc(type) typeMallocN(type,1) + +#define freeChecked(p) if ((p) != 0) free (p) +#define freeAndNull(p) if ((p) != 0) { free (p); p = 0; } + +#define isChar(c) ((int)(c) >= 0 && (int)(c) < KEY_MIN) +#define CharOf(c) ((unsigned char)(c)) + +#define SIZEOF(v) (sizeof(v)/sizeof((v)[0])) + +#define MAX_COLORS 8 + +/* + * Macros to check if caller is attempting to make the widget as high (or wide) + * as the screen. + */ +#define isFullWidth(n) ((n) == FULL || (COLS != 0 && ((n) >= COLS))) +#define isFullHeight(n) ((n) == FULL || (LINES != 0 && ((n) >= LINES))) + +/* + * Hide details of modifying widget->exitType + */ +#define storeExitType(d) ObjOf(d)->exitType = (d)->exitType +#define initExitType(d) storeExitType(d) = vNEVER_ACTIVATED +#define setExitType(w,c) setCdkExitType(ObjOf(w), &((w)->exitType), c) +#define copyExitType(d,s) storeExitType(d) = ExitTypeOf(s) + +/* + * Use this if checkCDKObjectBind() returns true, use this function to + * decide if the exitType should be set as a side-effect. + */ +#define checkEarlyExit(w) if (EarlyExitOf(w) != vNEVER_ACTIVATED) \ + storeExitType(w) = EarlyExitOf(w) + +/* + * Position within the data area of a widget, accounting for border and title. + */ +#define SCREEN_XPOS(w,n) ((n) + BorderOf(w)) +#define SCREEN_YPOS(w,n) ((n) + BorderOf(w) + TitleLinesOf(w)) + +/* + * Miscellaneous definitions. + */ +#define CDK_PATHMAX 256 + +extern char *GPasteBuffer; + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_INT_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/cdk_objs.h b/deps/cdk-5.0-20161210/include/cdk_objs.h new file mode 100644 index 0000000..21671fb --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdk_objs.h @@ -0,0 +1,373 @@ +/* + * $Id: cdk_objs.h,v 1.40 2012/03/21 20:49:54 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDK_OBJS_H +#define CDK_OBJS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#endif + +/* + * Copyright 1999-2005,2012 Thomas E. Dickey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas Dickey + * and contributors. + * 4. Neither the name of Thomas Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +typedef struct CDKBINDING { + BINDFN bindFunction; + void * bindData; + PROCESSFN callbackfn; +} CDKBINDING; + +struct CDKOBJS; + +/* + * Types for CDKFUNCS.returnType + */ +typedef enum { + DataTypeUnknown = 0 + , DataTypeString + , DataTypeInt + , DataTypeFloat + , DataTypeDouble + , DataTypeUnsigned +} CDKDataType; + +typedef union { + char * valueString; + int valueInt; + float valueFloat; + double valueDouble; + unsigned valueUnsigned; +} CDKDataUnion; + +#define unknownString (char *)0 +#define unknownInt (-1) +#define unknownFloat (0.0) +#define unknownDouble (0.0) +#define unknownUnsigned (0) + +/* + * Methods common to all widgets. + */ +typedef struct CDKFUNCS { + EObjectType objectType; + CDKDataType returnType; + void (*drawObj) (struct CDKOBJS *, boolean); + void (*eraseObj) (struct CDKOBJS *); + void (*moveObj) (struct CDKOBJS *, int, int, boolean, boolean); + int (*injectObj) (struct CDKOBJS *, chtype); + void (*focusObj) (struct CDKOBJS *); + void (*unfocusObj) (struct CDKOBJS *); + void (*saveDataObj) (struct CDKOBJS *); + void (*refreshDataObj) (struct CDKOBJS *); + void (*destroyObj) (struct CDKOBJS *); + /* line-drawing */ + void (*setULcharObj) (struct CDKOBJS *, chtype); + void (*setURcharObj) (struct CDKOBJS *, chtype); + void (*setLLcharObj) (struct CDKOBJS *, chtype); + void (*setLRcharObj) (struct CDKOBJS *, chtype); + void (*setVTcharObj) (struct CDKOBJS *, chtype); + void (*setHZcharObj) (struct CDKOBJS *, chtype); + void (*setBXattrObj) (struct CDKOBJS *, chtype); + /* background attribute */ + void (*setBKattrObj) (struct CDKOBJS *, chtype); +} CDKFUNCS; + +/* The cast is needed because traverse.c wants to use CDKOBJS pointers */ +#define ObjPtr(p) ((CDKOBJS*)(p)) + +#define MethodPtr(p,m) ((ObjPtr(p))->fn->m) + +/* Use these when we're certain it is a CDKOBJS pointer */ +#define ObjTypeOf(p) MethodPtr(p,objectType) +#define DataTypeOf(p) MethodPtr(p,returnType) +#define DrawObj(p) MethodPtr(p,drawObj) (p,p->box) +#define EraseObj(p) MethodPtr(p,eraseObj) (p) +#define DestroyObj(p) MethodPtr(p,destroyObj) (p) +#define InjectObj(p,k) MethodPtr(p,injectObj) (p,(k)) +#define InputWindowObj(p) MethodPtr(p,inputWindowObj) (p) +#define FocusObj(p) MethodPtr(p,focusObj) (p) +#define UnfocusObj(p) MethodPtr(p,unfocusObj) (p) +#define SaveDataObj(p) MethodPtr(p,saveDataObj) (p) +#define RefreshDataObj(p) MethodPtr(p,refreshDataObj) (p) +#define SetBackAttrObj(p,c) MethodPtr(p,setBKattrObj) (p,c) + +#define AcceptsFocusObj(p) (ObjPtr(p)->acceptsFocus) +#define HasFocusObj(p) (ObjPtr(p)->hasFocus) +#define IsVisibleObj(p) (ObjPtr(p)->isVisible) +#define InputWindowOf(p) (ObjPtr(p)->inputWindow) + +/* + * Data common to all objects (widget instances). This appears first in + * each widget's struct to allow us to use generic functions in binding.c, + * cdkscreen.c, position.c, etc. + */ +typedef struct CDKOBJS { + int screenIndex; + CDKSCREEN * screen; + const CDKFUNCS * fn; + boolean box; + int borderSize; + boolean acceptsFocus; + boolean hasFocus; + boolean isVisible; + WINDOW * inputWindow; + void * dataPtr; + CDKDataUnion resultData; + unsigned bindingCount; + CDKBINDING * bindingList; + /* title-drawing */ + chtype ** title; + int * titlePos; + int * titleLen; + int titleLines; + /* line-drawing (see 'box') */ + chtype ULChar; /* lines: upper-left */ + chtype URChar; /* lines: upper-right */ + chtype LLChar; /* lines: lower-left */ + chtype LRChar; /* lines: lower-right */ + chtype VTChar; /* lines: vertical */ + chtype HZChar; /* lines: horizontal */ + chtype BXAttr; + /* events */ + EExitType exitType; + EExitType earlyExit; + /* pre/post-processing */ + PROCESSFN preProcessFunction; + void * preProcessData; + PROCESSFN postProcessFunction; + void * postProcessData; +} CDKOBJS; + +#define ObjOf(ptr) (&(ptr)->obj) +#define MethodOf(ptr) (ObjOf(ptr)->fn) +#define ScreenOf(ptr) (ObjOf(ptr)->screen) +#define WindowOf(ptr) (ScreenOf(ptr)->window) +#define BorderOf(p) (ObjOf(p)->borderSize) +#define ResultOf(p) (ObjOf(p)->resultData) +#define ExitTypeOf(p) (ObjOf(p)->exitType) +#define EarlyExitOf(p) (ObjOf(p)->earlyExit) + +/* titles */ +#define TitleOf(w) ObjOf(w)->title +#define TitlePosOf(w) ObjOf(w)->titlePos +#define TitleLenOf(w) ObjOf(w)->titleLen +#define TitleLinesOf(w) ObjOf(w)->titleLines + +/* line-drawing characters */ +#define ULCharOf(w) ObjOf(w)->ULChar +#define URCharOf(w) ObjOf(w)->URChar +#define LLCharOf(w) ObjOf(w)->LLChar +#define LRCharOf(w) ObjOf(w)->LRChar +#define VTCharOf(w) ObjOf(w)->VTChar +#define HZCharOf(w) ObjOf(w)->HZChar +#define BXAttrOf(w) ObjOf(w)->BXAttr + +#define setULCharOf(o,c) MethodOf(o)->setULcharObj(ObjOf(o),c) +#define setURCharOf(o,c) MethodOf(o)->setURcharObj(ObjOf(o),c) +#define setLLCharOf(o,c) MethodOf(o)->setLLcharObj(ObjOf(o),c) +#define setLRCharOf(o,c) MethodOf(o)->setLRcharObj(ObjOf(o),c) +#define setVTCharOf(o,c) MethodOf(o)->setVTcharObj(ObjOf(o),c) +#define setHZCharOf(o,c) MethodOf(o)->setHZcharObj(ObjOf(o),c) +#define setBXAttrOf(o,c) MethodOf(o)->setBXattrObj(ObjOf(o),c) +#define setBKAttrOf(o,c) MethodOf(o)->setBKattrObj(ObjOf(o),c) + + /* pre/post-processing */ +#define PreProcessFuncOf(w) (ObjOf(w)->preProcessFunction) +#define PreProcessDataOf(w) (ObjOf(w)->preProcessData) +#define PostProcessFuncOf(w) (ObjOf(w)->postProcessFunction) +#define PostProcessDataOf(w) (ObjOf(w)->postProcessData) + +/* FIXME - remove this */ +#define ReturnOf(p) (ObjPtr(p)->dataPtr) + +bool validCDKObject (CDKOBJS *); + +void * _newCDKObject(unsigned, const CDKFUNCS *); +#define newCDKObject(type,funcs) (type *)_newCDKObject(sizeof(type),funcs) + +void _destroyCDKObject (CDKOBJS *); +#define destroyCDKObject(o) _destroyCDKObject(ObjOf(o)) + +/* Use these for widgets that have an obj member which is a CDKOBJS struct */ +#define drawCDKObject(o,box) MethodOf(o)->drawObj (ObjOf(o),box) +#define eraseCDKObject(o) MethodOf(o)->eraseObj (ObjOf(o)) +#define moveCDKObject(o,x,y,rel,ref) MethodOf(o)->moveObj (ObjOf(o),x,y,rel,ref) +#define injectCDKObject(o,c,type) (MethodOf(o)->injectObj (ObjOf(o),c) ? ResultOf(o).value ## type : unknown ## type) + +/* functions to set line-drawing are bound to cdk_objs.c if the widget is + * simple, but are built into the widget for complex widgets. + */ +#define DeclareSetXXchar(storage,line) \ +storage void line ## ULchar(struct CDKOBJS *, chtype); \ +storage void line ## URchar(struct CDKOBJS *, chtype); \ +storage void line ## LLchar(struct CDKOBJS *, chtype); \ +storage void line ## LRchar(struct CDKOBJS *, chtype); \ +storage void line ## VTchar(struct CDKOBJS *, chtype); \ +storage void line ## HZchar(struct CDKOBJS *, chtype); \ +storage void line ## BXattr(struct CDKOBJS *, chtype) + +DeclareSetXXchar(extern,setCdk); + +#define DeclareCDKObjects(upper, mixed, line, type) \ +static int _injectCDK ## mixed (struct CDKOBJS *, chtype); \ +static void _destroyCDK ## mixed (struct CDKOBJS *); \ +static void _drawCDK ## mixed (struct CDKOBJS *, boolean); \ +static void _eraseCDK ## mixed (struct CDKOBJS *); \ +static void _focusCDK ## mixed (struct CDKOBJS *); \ +static void _moveCDK ## mixed (struct CDKOBJS *, int, int, boolean, boolean); \ +static void _refreshDataCDK ## mixed (struct CDKOBJS *); \ +static void _saveDataCDK ## mixed (struct CDKOBJS *); \ +static void _unfocusCDK ## mixed (struct CDKOBJS *); \ +static void _setBKattr ## mixed (struct CDKOBJS *, chtype); \ +static const CDKFUNCS my_funcs = { \ + v ## upper, \ + DataType ## type, \ + _drawCDK ## mixed, \ + _eraseCDK ## mixed, \ + _moveCDK ## mixed, \ + _injectCDK ## mixed, \ + _focusCDK ## mixed, \ + _unfocusCDK ## mixed, \ + _saveDataCDK ## mixed, \ + _refreshDataCDK ## mixed, \ + _destroyCDK ## mixed, \ + line ## ULchar, \ + line ## URchar, \ + line ## LLchar, \ + line ## LRchar, \ + line ## VTchar, \ + line ## HZchar, \ + line ## BXattr, \ + _setBKattr ## mixed, \ +} + +/* + * Some methods are unused. Define macros to represent dummy methods + * to make it simple to maintain them. + */ +#define dummyInject(mixed) \ +static int _injectCDK ## mixed (CDKOBJS * object GCC_UNUSED, chtype input GCC_UNUSED) \ +{ \ + return 0; \ +} + +#define dummyFocus(mixed) \ +static void _focusCDK ## mixed (CDKOBJS * object GCC_UNUSED) \ +{ \ +} + +#define dummyUnfocus(mixed) \ +static void _unfocusCDK ## mixed (CDKOBJS * object GCC_UNUSED) \ +{ \ +} + +#define dummySaveData(mixed) \ +static void _saveDataCDK ## mixed (CDKOBJS * object GCC_UNUSED) \ +{ \ +} + +#define dummyRefreshData(mixed) \ +static void _refreshDataCDK ## mixed (CDKOBJS * object GCC_UNUSED) \ +{ \ +} + +/* + * Read keycode from object, optionally translating bindings. + * Depcrecated: use getchCDKObject(). + */ +extern int getcCDKObject ( + CDKOBJS * /* object */); + +/* + * Read keycode from object, optionally translating bindings. Set a flag to + * tell if the keycode is a function key. + */ +extern int getchCDKObject ( + CDKOBJS * /* object */, + boolean * /* functionKey */); + +/* + * Interactively reposition an object within a window. + */ +extern void positionCDKObject ( + CDKOBJS * /* object */, + WINDOW * /* win */); + +/* + * Pre/postprocessing. + */ +extern void setCDKObjectPreProcess ( + CDKOBJS * /* object */, + PROCESSFN /* func */, + void * /* data */); + +extern void setCDKObjectPostProcess ( + CDKOBJS * /* object */, + PROCESSFN /* func */, + void * /* data */); + +/* + * Background color. + */ +extern void setCDKObjectBackgroundColor ( + CDKOBJS * /* object */, + const char * /* color */); + +/* title-storage is implemented identically with all widgets */ +extern int setCdkTitle (CDKOBJS *, const char *, int); +extern void drawCdkTitle (WINDOW *, CDKOBJS *); +extern void cleanCdkTitle (CDKOBJS *); + +#define setCdkEarlyExit(p,q) EarlyExitOf(p) = q + +extern void setCdkExitType( + CDKOBJS * /* obj */, + EExitType * /* type */, + chtype /* ch */); + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_OBJS_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/cdk_params.h b/deps/cdk-5.0-20161210/include/cdk_params.h new file mode 100644 index 0000000..67ff965 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdk_params.h @@ -0,0 +1,143 @@ +/* + * $Id: cdk_params.h,v 1.7 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDK_PARAMS_H +#define CDK_PARAMS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#endif + +/* + * Copyright 2003-2005,2012 Thomas E. Dickey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas Dickey + * and contributors. + * 4. Neither the name of Thomas Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define MAX_CDK_PARAMS 256 + +/* + * CDKparseParams() knows about these options and will decode them into + * the CDK_PARAMS struct. They are the most generally useful for positioning + * a widget. + */ +#define CDK_MIN_PARAMS "NSX:Y:" +#define CDK_CLI_PARAMS "NSX:Y:H:W:" + +/* + * Use this exit code rather than -1 for cli programs which have reported an + * error. Actually EXIT_FAILURE would be better, but the shell script samples + * all are written to assume that the exit code can be used to indicate a + * button number, etc. + */ +#define CLI_ERROR 255 + +/* + * This records the values that CDKparseParams() decodes using getopt(): + */ +typedef struct CDK_PARAMS { + char * allParams[MAX_CDK_PARAMS]; + bool Box; + bool Shadow; + int hValue; + int wValue; + int xValue; + int yValue; +} CDK_PARAMS; + +/* + * Parse the given argc/argv command-line, with the options passed to + * getopt()'s 3rd parameter. + */ +void CDKparseParams ( + int /* argc */, + char ** /* argv */, + CDK_PARAMS * /* params */, + const char * /* options */); + +/* + * Parse the string as one of CDK's positioning keywords, or an actual + * position. + */ +int CDKparsePosition ( + const char * /* string */); + +/* + * Retrieve an integer (or boolean) option value from the parsed command-line. + */ +int CDKparamNumber ( + CDK_PARAMS * /* params */, + int /* option */); + +/* + * Retrieve an optional integer (or boolean) value from the parsed command-line. + */ +int CDKparamNumber2 ( + CDK_PARAMS * /* params */, + int /* option */, + int /* missing */); + +/* + * Retrieve a string option value from the parsed command-line. + */ +char * CDKparamString ( + CDK_PARAMS * /* params */, + int /* option */); + +/* + * Retrieve an optional string option value from the parsed command-line. + */ +char * CDKparamString2 ( + CDK_PARAMS * /* params */, + int /* option */, + const char * /* missing */); + +/* + * Retrieve an integer (or boolean) option value from the parsed command-line. + */ +int CDKparamValue ( + CDK_PARAMS * /* params */, + int /* option */, + int /* missing */); + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_PARAMS_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/cdk_test.h b/deps/cdk-5.0-20161210/include/cdk_test.h new file mode 100644 index 0000000..0c9d18d --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdk_test.h @@ -0,0 +1,89 @@ +/* + * $Id: cdk_test.h,v 1.5 2008/11/01 17:07:37 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDK_TEST_H +#define CDK_TEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Copyright 2005,2008 Thomas E. Dickey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas Dickey + * and contributors. + * 4. Neither the name of Thomas Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The whole point of this header is to define ExitProgram(), which is used for + * leak-checking when ncurses's _nc_free_and_exit() function is available. + * Invoking that rather than 'exit()' tells ncurses to free all of the + * "permanent" memory leaks, making analysis much simpler. + */ +#ifdef HAVE_NC_ALLOC_H + +#ifndef HAVE_LIBDBMALLOC +#define HAVE_LIBDBMALLOC 0 +#endif + +#ifndef HAVE_LIBDMALLOC +#define HAVE_LIBDMALLOC 0 +#endif + +#ifndef HAVE_LIBMPATROL +#define HAVE_LIBMPATROL 0 +#endif + +#include + +#else + +#if defined(NCURSES_VERSION) && defined(HAVE__NC_FREE_AND_EXIT) +/* nc_alloc.h normally not installed */ +extern void _nc_free_and_exit(int) GCC_NORETURN; +#define ExitProgram(code) _nc_free_and_exit(code) +#endif + +#endif /* HAVE_NC_ALLOC_H */ + +#ifndef ExitProgram +#define ExitProgram(code) exit(code) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_TEST_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/cdk_util.h b/deps/cdk-5.0-20161210/include/cdk_util.h new file mode 100644 index 0000000..b7dbda4 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdk_util.h @@ -0,0 +1,442 @@ +/* + * $Id: cdk_util.h,v 1.35 2014/01/19 01:58:31 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKUTIL_H +#define CDKUTIL_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#endif + +/* + * Changes 1999-2012,2014 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This beeps at the user. The standard curses beep() does not + * flush the stream, so it will only beep until a force is made. + * This forces a flush after issuing the beep command. + */ +void Beep(void); + +/* + * This aligns a 'box' on the given window with the height and + * width given. + */ +void alignxy ( + WINDOW * /* window */, + int * /* xpos */, + int * /* ypos */, + int /* boxWidth */, + int /* boxHeight */); + +/* + * This takes a string, a field width and a justification type and returns the + * justification adjustment to make, to fill the justification requirement. + */ +int justifyString ( + int /* fieldWidth */, + int /* mesglen */, + int /* justify */); + +/* + * This is a quick little popup label widget. + */ +void popupLabel ( + CDKSCREEN * /* win */, + CDK_CSTRING2 /* mesg */, + int /* count */); + +/* + * This is a quick little popup label widget. + */ +void popupLabelAttrib ( + CDKSCREEN * /* win */, + CDK_CSTRING2 /* mesg */, + int /* count */, + chtype /* attribute */); + +/* + * This is a quick little popup dialog box. + */ +int popupDialog ( + CDKSCREEN * /* screen */, + CDK_CSTRING2 /* mesg */, + int /* mesgCount */, + CDK_CSTRING2 /* buttons */, + int /* buttonCount */); + +/* + * This pops up a scrolling list and returns the value selected. + */ +int getListIndex ( + CDKSCREEN * /* screen */, + const char * /* title */, + CDK_CSTRING2 /* list */, + int /* listSize */, + boolean /* numbers */); + +/* + * This gets a simple string value from a user. + */ +char *getString ( + CDKSCREEN * /* screen */, + const char * /* title */, + const char * /* label */, + const char * /* init */); + +/* + * This allows a user to view a file. + */ +int viewFile ( + CDKSCREEN * /* screen */, + const char * /* title */, + const char * /* filename */, + CDK_CSTRING2 /* buttons */, + int /* buttonCount */); + +/* + * This allows a person to select a file. + */ +char *selectFile ( + CDKSCREEN * /* screen */, + const char * /* title */); + +/* + * This allows people to view information in an array. + */ +int viewInfo ( + CDKSCREEN * /* screen */, + const char * /* title */, + CDK_CSTRING2 /* info */, + int /* size */, + CDK_CSTRING2 /* buttons */, + int /* buttonCount */, + boolean /* interpret */); + +/* + * This is a wrapper for qsort. + */ +void sortList ( + CDK_CSTRING * /* list */, + int /* length */); + +/* + * This reads a file, loads the contents into info and + * returns the number of lines read. + */ +int CDKreadFile ( + const char * /* filename */, + char *** /* info */); + +/* + * This strips white space from the front/back of the given + * string. The stripType is one of: vFRONT, vBACK, vBOTH. + */ +void stripWhiteSpace ( + EStripType /* stripType */, + char * /* string */); + +/* + * These functions are used to manage a string which is split into parts, e.g., + * a file which is read into memory. + */ +char **CDKsplitString( + const char * /* string */, + int /* separator */); + +unsigned CDKallocStrings( + char *** /* list */, + char * /* item */, + unsigned /* length */, + unsigned /* used */); + +unsigned CDKcountStrings( + CDK_CSTRING2 /* list */); + +void CDKfreeStrings( + char ** /* list */); + +/* + * Free a list of chtype-strings, terminated by a null pointer. + */ +void CDKfreeChtypes( + chtype ** /* list */); + +/* + * This returns the length of an integer. + */ +int intlen ( + int /* value */); + +/* + * This opens the given directory and reads in the contents. It stores + * the results in 'list' and returns the number of elements found. + */ +int CDKgetDirectoryContents ( + const char * /* directory */, + char *** /* list */); + +/* + * This looks for the given pattern in the given list. + */ +int searchList ( + CDK_CSTRING2 /* list */, + int /* listSize */, + const char * /* pattern */); + +/* + * This returns the basename of a file. + */ +char *baseName ( + char * /* filename */); + +/* + * This returns the directory name of a file. + */ +char *dirName ( + char * /* filename */); + +/* + * This frees the memory used by the given string. + */ +void freeChar ( + char * /* string */); + +/* + * This frees the memory used by the given string. + */ +void freeChtype ( + chtype * /* string */); + +/* + * This frees the memory used by the given list of strings. + */ +void freeCharList ( + char ** /* list */, + unsigned /* size */); + +/* + * This frees the memory used by the given list of strings. + */ +void freeChtypeList ( + chtype ** /* list */, + unsigned /* size */); + +/* + * This sets the elements of the given string to 'character' + */ +void cleanChar ( + char * /* string */, + int /* length */, + char /* character */); + +/* + * This sets the elements of the given string to 'character' + */ +void cleanChtype ( + chtype * /* string */, + int /* length */, + chtype /* character */); + +/* + * This takes a chtype pointer and returns a char pointer. + */ +char *chtype2Char ( + const chtype * /* string */); + +/* + * This takes a chtype pointer and returns a char pointer with embedded + * formatting information. + */ +char *chtype2String ( + const chtype * /* string */); + +/* + * This takes a char pointer and returns a chtype pointer. + */ +chtype *char2Chtype ( + const char * /* string */, + int * /* length */, + int * /* align */); + +/* + * Compare a char string to a chtype string + */ +int cmpStrChstr(const char * /* str */, + const chtype * /* chstr */); + +/* + * Copy from a chtype string to a char string + */ + +void chstrncpy(char * /* dest */, + const chtype * /* src */, + int /* maxcount */); + +/* + * Given a character pointer, returns the equivalent display type. + */ +EDisplayType char2DisplayType ( + const char * /* string */); + +/* + * Tell if a display type is "hidden" + */ +boolean isHiddenDisplayType ( + EDisplayType /* type */); + +/* + * Filter an input character according to the display type. + */ +int filterByDisplayType( + EDisplayType /* type */, + chtype /* input */); + +/* + * Copy the given string. + */ +chtype *copyChtype ( + const chtype * /* string */); + +/* + * Copy the given string. + */ +char *copyChar ( + const char * /* string */); + +/* + * Copy the given list. + */ +char **copyCharList ( + const char ** /* list */); + +/* + * Copy the given list. + */ +chtype **copyChtypeList ( + const chtype ** /* list */); + +/* + * Return the length of the given string. + */ +int chlen ( + const chtype * /* string */); + +/* + * Return the length of the given list. + */ +int lenCharList ( + const char ** /* list */); + +int lenChtypeList ( + const chtype ** /* list */); + +/* + * This takes a file mode and returns the first character of the file + * permissions string. + */ +int mode2Filetype ( + mode_t /* fileMode */); + +/* + * This takes a file mode and stores the character representation + * of the mode in 'string'. This also returns the octal value + * of the file mode. + */ +int mode2Char ( + char * /* string */, + mode_t /* fileMode */); + +/* + * This looks for a link. (used by the pattern) + */ +int checkForLink ( + const char * /* line */, + char * /* filename */); + +/* + * This function help set the height/width values of a widget. + */ +int setWidgetDimension ( + int /* parentDim */, + int /* proposedDim */, + int /* adjustment */); + +/* + * This safely erases a given window. + */ +void eraseCursesWindow ( + WINDOW * /* window */); + +/* + * This safely deletes a given window. + */ +void deleteCursesWindow ( + WINDOW * /* window */); + +/* + * This moves a given window + */ +void moveCursesWindow ( + WINDOW * /* window */, + int /* xdiff */, + int /* ydiff */); + +/* + * Return an integer like 'floor()', which returns a double. + */ +int floorCDK(double); + +/* + * Return an integer like 'ceil()', which returns a double. + */ +int ceilCDK(double); + +#ifdef __cplusplus +} +#endif + +#endif /* CDKUTIL_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/cdk_version.hin b/deps/cdk-5.0-20161210/include/cdk_version.hin new file mode 100644 index 0000000..2c4df72 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdk_version.hin @@ -0,0 +1,56 @@ +/* + * $Id: cdk_version.hin,v 1.2 2012/03/20 22:10:36 tom Exp $ + */ + +#ifndef CDK_VERSION_H +#define CDK_VERSION_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Copyright 2002,2012 Thomas E. Dickey + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas E. Dickey + * and contributors. + * 4. Neither the name of Thomas E. Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS E. DICKEY AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS E. DICKEY OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#define CDK_VERSION_MAJOR "@VERSION_MAJOR@" +#define CDK_VERSION_MINOR "@VERSION_MINOR@" +#define CDK_VERSION_PATCH "@VERSION_PATCH@" + +/* + * Runtime to return the same version information. + */ +const char *CDKVersion (void); + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_VERSION_H */ diff --git a/deps/cdk-5.0-20161210/include/cdkscreen.h b/deps/cdk-5.0-20161210/include/cdkscreen.h new file mode 100644 index 0000000..dcf1157 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/cdkscreen.h @@ -0,0 +1,188 @@ +/* + * $Id: cdkscreen.h,v 1.18 2016/11/20 14:42:21 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKSCREEN_H +#define CDKSCREEN_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#endif + +/* + * Changes 1999-2015,2016 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare and definitions needed for the widget. + */ +#define MAX_OBJECTS 1000 /* not used by widgets */ + +struct CDKOBJS; + +typedef enum { + CDKSCREEN_NOEXIT = 0 + , CDKSCREEN_EXITOK + , CDKSCREEN_EXITCANCEL +} EExitStatus; + +/* + * Define the CDK screen structure. + */ +struct SScreen { + WINDOW * window; + struct CDKOBJS ** object; + int objectCount; /* last-used index in object[] */ + int objectLimit; /* sizeof(object[]) */ + EExitStatus exitStatus; + int objectFocus; /* focus index in object[] */ +}; +typedef struct SScreen CDKSCREEN; + +/* + * This function creates a CDKSCREEN pointer. + */ +CDKSCREEN *initCDKScreen ( + WINDOW * /* window */); + +/* + * This sets which CDKSCREEN pointer will be the default screen + * in the list of managed screen. + */ +CDKSCREEN *setDefaultCDKScreen ( + int /* screenNumber */); + +/* + * This function registers a CDK widget with a given screen. + */ +void registerCDKObject ( + CDKSCREEN * /* screen */, + EObjectType /* cdktype */, + void * /* object */); + +/* + * This function registers a CDK widget with it's former screen. + */ +void reRegisterCDKObject ( + EObjectType /* cdktype */, + void * /* object */); + +/* + * This unregisters a CDK widget from a screen. + */ +void unregisterCDKObject ( + EObjectType /* cdktype */, + void * /* object */); + +/* + * This function raises a widget on a screen to the top of the widget + * stack of the screen the widget is associated with. The side effect + * of doing this is the widget will be on 'top' of all the other + * widgets on their screens. + */ +void raiseCDKObject ( + EObjectType /* cdktype */, + void * /* object */); + +/* + * This function lowers a widget on a screen to the bottom of the widget + * stack of the screen the widget is associated with. The side effect + * of doing this is that all the other widgets will be on 'top' of the + * widget on their screens. + */ +void lowerCDKObject ( + EObjectType /* cdktype */, + void * /* object */); + +/* + * This redraws a window, forcing it to the top of the stack. + */ +void refreshCDKWindow ( + WINDOW * /* win */); + +/* + * This redraws all the widgets associated with the given screen. + */ +void refreshCDKScreen ( + CDKSCREEN * /* screen */); + +/* + * This calls refreshCDKScreen. (it is here to try to be consistent + * with the drawCDKXXX functions associated with the widgets) + */ +void drawCDKScreen ( + CDKSCREEN * /* screen */); + +/* + * This removes all the widgets from the screen. + */ +void eraseCDKScreen ( + CDKSCREEN * /* screen */); + +/* + * Destroy all of the widgets on a screen + */ + +void destroyCDKScreenObjects (CDKSCREEN *cdkscreen); + +/* + * This frees up any memory the CDKSCREEN pointer used. + */ +void destroyCDKScreen ( + CDKSCREEN * /* screen */); + +/* + * This shuts down curses and everything else needed to + * exit cleanly. + */ +void endCDK(void); + +/* + * This creates all the color pairs. + */ +void initCDKColor(void); + +#ifdef __cplusplus +} +#endif + +#endif /* CDKSCREEN_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/config.hin b/deps/cdk-5.0-20161210/include/config.hin new file mode 100644 index 0000000..c91f2d3 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/config.hin @@ -0,0 +1,14 @@ +/* + * $Id: config.hin,v 1.2 2000/01/17 14:48:19 tom Exp $ + */ + +#ifndef CDK_CONFIG_H +#define CDK_CONFIG_H 1 + +@DEFS@ + +#if !defined(HAVE_LSTAT) && !defined(lstat) +#define lstat(f,b) stat(f,b) +#endif + +#endif /* CDK_CONFIG_H */ diff --git a/deps/cdk-5.0-20161210/include/curdefs.h b/deps/cdk-5.0-20161210/include/curdefs.h new file mode 100644 index 0000000..801ee5f --- /dev/null +++ b/deps/cdk-5.0-20161210/include/curdefs.h @@ -0,0 +1,152 @@ +#ifndef CDKINCLUDES +#ifndef CURDEF_H +#define CURDEF_H + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#endif + +/* + * $Id: curdefs.h,v 1.16 2009/02/16 00:33:50 tom Exp $ + * + * Changes 1999-2004,2009 copyright Thomas E. Dickey + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This header file adds some useful curses-style definitions. + */ + +#undef CTRL +#define CTRL(c) ((c)&0x1f) + +#undef CDK_REFRESH +#define CDK_REFRESH CTRL('L') +#undef CDK_PASTE +#define CDK_PASTE CTRL('V') +#undef CDK_COPY +#define CDK_COPY CTRL('Y') +#undef CDK_ERASE +#define CDK_ERASE CTRL('U') +#undef CDK_CUT +#define CDK_CUT CTRL('X') +#undef CDK_BEGOFLINE +#define CDK_BEGOFLINE CTRL('A') +#undef CDK_ENDOFLINE +#define CDK_ENDOFLINE CTRL('E') +#undef CDK_BACKCHAR +#define CDK_BACKCHAR CTRL('B') +#undef CDK_FORCHAR +#define CDK_FORCHAR CTRL('F') +#undef CDK_TRANSPOSE +#define CDK_TRANSPOSE CTRL('T') +#undef CDK_NEXT +#define CDK_NEXT CTRL('N') +#undef CDK_PREV +#define CDK_PREV CTRL('P') +#undef SPACE +#define SPACE ' ' +#undef DELETE +#define DELETE '\177' /* Delete key */ +#undef TAB +#define TAB '\t' /* Tab key. */ +#undef KEY_ESC +#define KEY_ESC '\033' /* Escape Key. */ +#undef KEY_RETURN +#define KEY_RETURN '\012' /* Return key */ +#undef KEY_TAB +#define KEY_TAB '\t' /* Tab key */ +#undef KEY_F1 +#define KEY_F1 KEY_F(1) +#undef KEY_F2 +#define KEY_F2 KEY_F(2) +#undef KEY_F3 +#define KEY_F3 KEY_F(3) +#undef KEY_F4 +#define KEY_F4 KEY_F(4) +#undef KEY_F5 +#define KEY_F5 KEY_F(5) +#undef KEY_F6 +#define KEY_F6 KEY_F(6) +#undef KEY_F7 +#define KEY_F7 KEY_F(7) +#undef KEY_F8 +#define KEY_F8 KEY_F(8) +#undef KEY_F9 +#define KEY_F9 KEY_F(9) +#undef KEY_F10 +#define KEY_F10 KEY_F(10) +#undef KEY_F11 +#define KEY_F11 KEY_F(11) +#undef KEY_F12 +#define KEY_F12 KEY_F(12) + +#define KEY_ERROR ((chtype)ERR) + +/* these definitions may work for antique versions of curses */ +#if !defined(HAVE_GETBEGYX) && !defined(getbegyx) +#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR) +#endif + +#if !defined(HAVE_GETMAXYX) && !defined(getmaxyx) +#define getmaxyx(win,y,x) (y = (win)?(win)->_maxy:ERR, x = (win)?(win)->_maxx:ERR) +#endif + +/* these definitions may be needed for bleeding-edge curses implementations */ +#if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY)) +#undef getbegx +#undef getbegy +#define getbegx(win) cdk_getbegx(win) +#define getbegy(win) cdk_getbegy(win) +extern int cdk_getbegx(WINDOW *); +extern int cdk_getbegy(WINDOW *); +#endif + +#if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY)) +#undef getmaxx +#undef getmaxy +#define getmaxx(win) cdk_getmaxx(win) +#define getmaxy(win) cdk_getmaxy(win) +extern int cdk_getmaxx(WINDOW *); +extern int cdk_getmaxy(WINDOW *); +#endif + +/* + * Derived macros + */ +#define getendx(a) (getbegx(a) + getmaxx(a)) +#define getendy(a) (getbegy(a) + getmaxy(a)) + +#endif /* CURDEF_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/dialog.h b/deps/cdk-5.0-20161210/include/dialog.h new file mode 100644 index 0000000..2294cba --- /dev/null +++ b/deps/cdk-5.0-20161210/include/dialog.h @@ -0,0 +1,220 @@ +/* + * $Id: dialog.h,v 1.26 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKDIALOG_H +#define CDKDIALOG_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2003,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare definitions the dialog box may need. + */ +#define MAX_DIALOG_ROWS 50 /* unused by widgets */ +#define MAX_DIALOG_BUTTONS 25 /* unused by widgets */ +#define MIN_DIALOG_WIDTH 10 + +/* + * Define the CDK dialog structure. + */ +struct SDialogBox { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + chtype ** info; + int * infoLen; + int * infoPos; + chtype ** buttonLabel; + int * buttonLen; + int * buttonPos; + int messageRows; + int buttonCount; + int currentButton; + int boxWidth; + int boxHeight; + EExitType exitType; + boolean separator; + boolean shadow; + chtype highlight; +}; +typedef struct SDialogBox CDKDIALOG; + +/* + * This returns a CDK dialog widget pointer. + */ +CDKDIALOG *newCDKDialog ( + CDKSCREEN * /* cdkscreen */, + int /* xPos */, + int /* yPos */, + CDK_CSTRING2 /* message */, + int /* Rows */, + CDK_CSTRING2 /* buttons */, + int /* buttonCount */, + chtype /* highlight */, + boolean /* separator */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the widget. + */ +int activateCDKDialog ( + CDKDIALOG * /* dialog */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKDialog(obj,input) injectCDKObject(obj,input,Int) + +/* + * This sets multiple attributes of the widget. + */ +void setCDKDialog ( + CDKDIALOG * /* dialog */, + chtype /* highlight */, + boolean /* separator */, + boolean /* Box */); + +/* + * This sets the highlight attribute for the buttons. + */ +void setCDKDialogHighlight ( + CDKDIALOG * /* dialog */, + chtype /* highlight */); + +chtype getCDKDialogHighlight ( + CDKDIALOG * /* dialog */); + +/* + * This sets whether or not the dialog box will have a separator line. + */ +void setCDKDialogSeparator ( + CDKDIALOG * /* dialog */, + boolean /* separator */); + +boolean getCDKDialogSeparator ( + CDKDIALOG * /* dialog */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKDialogBox ( + CDKDIALOG * /* dialog */, + boolean /* Box */); + +boolean getCDKDialogBox ( + CDKDIALOG * /* dialog */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKDialogULChar(w,c) setULCharOf(w,c) +#define setCDKDialogURChar(w,c) setURCharOf(w,c) +#define setCDKDialogLLChar(w,c) setLLCharOf(w,c) +#define setCDKDialogLRChar(w,c) setLRCharOf(w,c) +#define setCDKDialogVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKDialogHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKDialogBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKDialogBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKDialogBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the dialog box widget. + */ +#define drawCDKDialog(obj,box) drawCDKObject(obj,box) + +/* + * This erases the dialog box from the screen. + */ +#define eraseCDKDialog(obj) eraseCDKObject(obj) + +/* + * This moves the dialog box to a new screen location. + */ +#define moveCDKDialog(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to position the widget on the screen interactively. + */ +#define positionCDKDialog(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all the memory associated with it. + */ +#define destroyCDKDialog(obj) destroyCDKObject(obj) + +/* + * This draws the dialog box buttons. + */ +void drawCDKDialogButtons ( + CDKDIALOG * /* dialog */); + +/* + * These set the pre/post process functions of the dialog widget. + */ +#define setCDKDialogPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKDialogPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKDIALOG_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/draw.h b/deps/cdk-5.0-20161210/include/draw.h new file mode 100644 index 0000000..b3f5274 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/draw.h @@ -0,0 +1,167 @@ +/* + * $Id: draw.h,v 1.10 2004/10/05 00:05:32 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKDRAW_H +#define CDKDRAW_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2003,2004 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This boxes a window. + */ +void boxWindow ( + WINDOW * /* window */, + chtype /* attr */); + +/* + * This draws a single line with the character supplied by 'character' + */ +void drawLine ( + WINDOW * /* window */, + int /* startx */, + int /* starty */, + int /* endx */, + int /* endy */, + chtype /* character */); + +/* + * This writes a blank string segment on the given window. + */ +void writeBlanks ( + WINDOW * /* window */, + int /* xpos */, + int /* ypos */, + int /* align */, + int /* start */, + int /* end */); + +/* + * This writes a string segment on the given window. + */ +void writeChar ( + WINDOW * /* window */, + int /* xpos */, + int /* ypos */, + char * /* string */, + int /* align */, + int /* start */, + int /* end */); + +/* + * This writes a string segment on the given window. + */ +void writeCharAttrib ( + WINDOW * /* window */, + int /* xpos */, + int /* ypos */, + char * /* string */, + chtype /* attr */, + int /* align */, + int /* start */, + int /* end */); + +/* + * This writes a string segment on the given window. + */ +void writeChtype ( + WINDOW * /* window */, + int /* xpos */, + int /* ypos */, + chtype * /* string */, + int /* align */, + int /* start */, + int /* end */); + +/* + * This writes a string segment on the given window. + */ +void writeChtypeAttrib ( + WINDOW * /* window */, + int /* xpos */, + int /* ypos */, + chtype * /* string */, + chtype /* attr */, + int /* align */, + int /* start */, + int /* end */); + +/* + * This boxes a window using the given characters. + */ +void attrbox ( + WINDOW * /* window */, + chtype /* tlc */, + chtype /* trc */, + chtype /* blc */, + chtype /* brc */, + chtype /* hor */, + chtype /* vert */, + chtype /* type */); + +/* + * This boxes a window using the object's characters. + */ +void drawObjBox ( + WINDOW * /* win */, + CDKOBJS * /* object */); + +/* + * This draws the shadow window of the widget. + */ +void drawShadow ( + WINDOW * /* window */); + +#ifdef __cplusplus +} +#endif + +#endif /* CDKDRAW_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/entry.h b/deps/cdk-5.0-20161210/include/entry.h new file mode 100644 index 0000000..2290911 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/entry.h @@ -0,0 +1,273 @@ +/* + * $Id: entry.h,v 1.29 2016/11/20 14:41:44 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKENTRY_H +#define CDKENTRY_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2015,2016 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK entry widget structure. + */ +typedef struct SEntry CDKENTRY; +typedef void (*ENTRYCB) (struct SEntry *entry, chtype character); + +struct SEntry { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + WINDOW * labelWin; + WINDOW * fieldWin; + chtype * label; + int labelLen; + int titleAdj; + chtype fieldAttr; + int fieldWidth; + char * info; + int infoWidth; + int screenCol; + int leftChar; + int min; + int max; + int boxWidth; + int boxHeight; + EExitType exitType; + EDisplayType dispType; + boolean shadow; + chtype filler; + chtype hidden; + ENTRYCB callbackfn; + void *callbackData; +}; + +/* + * This sets the callback function of the button's argument. + */ +#define setCDKEntryCBArgs(entry, argPtr) ((entry)->callbackData = (void*)(argPtr)) + +#define getCDKEntryCBArgs(entry, argType) ((argType) ((entry)->callbackData)) + +/* + * This creates a pointer to a new CDK entry widget. + */ +CDKENTRY *newCDKEntry ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + const char * /* title */, + const char * /* label */, + chtype /* fieldAttrib */, + chtype /* filler */, + EDisplayType /* disptype */, + int /* fieldWidth */, + int /* min */, + int /* max */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the entry widget. + */ +char *activateCDKEntry ( + CDKENTRY * /* entry */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKEntry(obj,input) injectCDKObject(obj,input,String) + +/* + * This sets various attributes of the entry field. + */ +void setCDKEntry ( + CDKENTRY * /* entry */, + const char * /* value */, + int /* min */, + int /* max */, + boolean /* Box */); + +/* + * This sets the value of the entry field. + */ +void setCDKEntryValue ( + CDKENTRY * /* entry */, + const char * /* value */); +char *getCDKEntryValue ( + CDKENTRY * /* entry */); + +/* + * This sets the maximum length of a string allowable for + * the given widget. + */ +void setCDKEntryMax ( + CDKENTRY * /* entry */, + int /* max */); +int getCDKEntryMax ( + CDKENTRY * /* entry */); + +/* + * This sets the minimum length of a string allowable for + * the given widget. + */ +void setCDKEntryMin ( + CDKENTRY * /* entry */, + int /* min */); +int getCDKEntryMin ( + CDKENTRY * /* entry */); + +/* + * This sets the filler character of the entry field. + */ +void setCDKEntryFillerChar ( + CDKENTRY * /* entry */, + chtype /* fillerCharacter */); +chtype getCDKEntryFillerChar ( + CDKENTRY * /* entry */); + +/* + * This sets the character to use when a hidden type is used. + */ +void setCDKEntryHiddenChar ( + CDKENTRY * /* entry */, + chtype /* hiddenCharacter */); +chtype getCDKEntryHiddenChar ( + CDKENTRY * /* entry */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKEntryBox ( + CDKENTRY * /* entry */, + boolean /* Box */); +boolean getCDKEntryBox ( + CDKENTRY * /* entry */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKEntryULChar(w,c) setULCharOf(w,c) +#define setCDKEntryURChar(w,c) setURCharOf(w,c) +#define setCDKEntryLLChar(w,c) setLLCharOf(w,c) +#define setCDKEntryLRChar(w,c) setLRCharOf(w,c) +#define setCDKEntryVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKEntryHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKEntryBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKEntryBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKEntryBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This sets the attribute of the entry field. + */ +void setCDKEntryHighlight ( + CDKENTRY * /* entry */, + chtype /* highlight */, + boolean /* cursor */); + +/* + * This draws the entry field. + */ +#define drawCDKEntry(obj,box) drawCDKObject(obj,box) + +/* + * This erases the widget from the screen. + */ +#define eraseCDKEntry(obj) eraseCDKObject(obj) + +/* + * This cleans out the value of the entry field. + */ +void cleanCDKEntry ( + CDKENTRY * /* entry */); + +/* + * This moves the widget to the given location. + */ +#define moveCDKEntry(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This is an interactive method of moving the widget. + */ +#define positionCDKEntry(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all the memory associated with the widget. + */ +#define destroyCDKEntry(obj) destroyCDKObject(obj) + +/* + * This sets the callback to the entry fields main handler + */ +void setCDKEntryCB ( + CDKENTRY * /* entry */, + ENTRYCB /* callback */); + +/* + * These set the callbacks to the pre and post process functions. + */ +#define setCDKEntryPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKEntryPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKENTRY_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/fselect.h b/deps/cdk-5.0-20161210/include/fselect.h new file mode 100644 index 0000000..49a9ff0 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/fselect.h @@ -0,0 +1,324 @@ +/* + * $Id: fselect.h,v 1.25 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKFSELECT_H +#define CDKFSELECT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#include +#include +#endif + +/* + * Changes 1999-2006,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK file selector widget structure. + */ +struct SFileSelector { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + CDKENTRY * entryField; + CDKSCROLL * scrollField; + char ** dirContents; + int fileCounter; + char * pwd; + char * pathname; + int xpos; + int ypos; + int boxHeight; + int boxWidth; + chtype fieldAttribute; + chtype fillerCharacter; + chtype highlight; + char * dirAttribute; + char * fileAttribute; + char * linkAttribute; + char * sockAttribute; + EExitType exitType; + boolean shadow; +}; +typedef struct SFileSelector CDKFSELECT; + +/* + * This creates a new CDK file selector widget. + */ +CDKFSELECT *newCDKFselect ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* height */, + int /* width */, + const char * /* title */, + const char * /* label */, + chtype /* fieldAttribute */, + chtype /* fillerChar */, + chtype /* highlight */, + const char * /* dirAttributes */, + const char * /* fileAttributes */, + const char * /* linkAttribute */, + const char * /* sockAttribute */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the file selector. + */ +char *activateCDKFselect ( + CDKFSELECT * /* fselect */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKFselect(obj,input) injectCDKObject(obj,input,String) + +/* + * This sets various attributes of the file selector. + */ +void setCDKFselect ( + CDKFSELECT * /* fselect */, + const char * /* directory */, + chtype /* fieldAttrib */, + chtype /* filler */, + chtype /* highlight */, + const char * /* dirAttribute */, + const char * /* fileAttribute */, + const char * /* linkAttribute */, + const char * /* sockAttribute */, + boolean /* Box */); + +/* + * This sets the current directory of the file selector. + */ +int setCDKFselectDirectory ( + CDKFSELECT * /* fselect */, + const char * /* directory */); + +char *getCDKFselectDirectory ( + CDKFSELECT * /* fselect */); + +/* + * This sets the filler character of the entry field. + */ +void setCDKFselectFillerChar ( + CDKFSELECT * /* fselect */, + chtype /* fillerCharacter */); + +chtype getCDKFselectFillerChar ( + CDKFSELECT * /* fselect */); + +/* + * This sets the highlight bar of the scrolling list. + */ +void setCDKFselectHighlight ( + CDKFSELECT * /* fselect */, + chtype /* highlight */); + +chtype getCDKFselectHighlight ( + CDKFSELECT * /* fselect */); + +/* + * These functions set the attribute of the directories, links, + * files, and sockets in the scrolling list portion of the file + * selector widget. + */ +void setCDKFselectDirAttribute ( + CDKFSELECT * /* fselect */, + const char * /* attribute */); + +void setCDKFselectLinkAttribute ( + CDKFSELECT * /* fselect */, + const char * /* attribute */); + +void setCDKFselectFileAttribute ( + CDKFSELECT * /* fselect */, + const char * /* attribute */); + +void setCDKFselectSocketAttribute ( + CDKFSELECT * /* fselect */, + const char * /* attribute */); + +/* + * These functions return the attribute of the directories, links, + * files, and sockets in the scrolling list portion of the file + * selector widget. + */ +char *getCDKFselectDirAttribute ( + CDKFSELECT * /* fselect */); + +char *getCDKFselectLinkAttribute ( + CDKFSELECT * /* fselect */); + +char *getCDKFselectFileAttribute ( + CDKFSELECT * /* fselect */); + +char *getCDKFselectSocketAttribute ( + CDKFSELECT * /* fselect */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKFselectBox ( + CDKFSELECT * /* fselect */, + boolean /* Box */); + +boolean getCDKFselectBox ( + CDKFSELECT * /* fselect */); + +/* + * This sets the contents of the file selector. + */ +int setCDKFselectDirContents ( + CDKFSELECT * /* fselect */); + +char **getCDKFselectDirContents ( + CDKFSELECT * /* fselect */, + int * /* count */); + +/* + * This sets the contents of the file selector. + */ +void setCDKFselectContents ( + CDKFSELECT * /* fselect */, + CDK_CSTRING2 /* list */, + int /* listSize */); + +char **getCDKFselectContents ( + CDKFSELECT * /* fselect */, + int * /* size */); + +/* + * Get/set the current position in the scroll-widget. + */ +int getCDKFselectCurrentItem( + CDKFSELECT * /* widget */); + +void setCDKFselectCurrentItem( + CDKFSELECT * /* widget */, + int /* item */); + +/* + * These functions set the drawing characters of the widget. + */ +#define setCDKFselectULChar(w,c) setULCharOf(w,c) +#define setCDKFselectURChar(w,c) setURCharOf(w,c) +#define setCDKFselectLLChar(w,c) setLLCharOf(w,c) +#define setCDKFselectLRChar(w,c) setLRCharOf(w,c) +#define setCDKFselectVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKFselectHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKFselectBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKFselectBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKFselectBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the widget. + */ +#define drawCDKFselect(obj,Box) drawCDKObject(obj,Box) + +/* + * This erases the widget. + */ +#define eraseCDKFselect(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location. + */ +#define moveCDKFselect(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the widget. + */ +#define positionCDKFselect(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all the associated memory. + */ +#define destroyCDKFselect(obj) destroyCDKObject(obj) + +/* + * This is a callback which allows you to delete files from within the + * file selector. It is NOT an active default: it MUST be set by the + * user. + */ +void deleteFileCB ( + EObjectType /* objectType */, + void * /* object */, + void * /* clientData */); + +/* + * This function sets the pre-process function. + */ +void setCDKFselectPreProcess ( + CDKFSELECT * /* fselect */, + PROCESSFN /* callback */, + void * /* data */); + +/* + * This function sets the post-process function. + */ +void setCDKFselectPostProcess ( + CDKFSELECT * /* fselect */, + PROCESSFN /* callback */, + void * /* data */); + +#ifdef __cplusplus +} +#endif + +#endif /* CDKFSELECT_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/gen-scale.h b/deps/cdk-5.0-20161210/include/gen-scale.h new file mode 100644 index 0000000..5c2e351 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/gen-scale.h @@ -0,0 +1,233 @@ +/* + * $Id: gen-scale.h,v 1.8 2012/03/20 21:59:39 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDK_H +#define CDK_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Copyright 2004,2012 Thomas E. Dickey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas Dickey + * and contributors. + * 4. Neither the name of Thomas Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK widget structure. + */ +struct S { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + WINDOW * fieldWin; + WINDOW * labelWin; + int titleAdj; + chtype * label; + int labelLen; + int boxHeight; + int boxWidth; + int fieldWidth; + int fieldEdit; /* offset from right-margin of field */ + chtype fieldAttr; + low; + high; + inc; + fastinc; + current; +#if + int digits; +#endif + EExitType exitType; + boolean shadow; +}; +typedef struct S CDK; + +/* + * This creates a new pointer to a CDK - widget. + */ +CDK *newCDK ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + const char * /* title */, + const char * /* label */, + chtype /* fieldAttr */, + int /* fieldWidth */, + /* start */, + /* low */, + /* high */, + /* inc */, + /* fastInc */, +#if + int /* digits */, +#endif + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the widget. + */ + activateCDK ( + CDK * /* widget */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDK(obj,input) injectCDKObject(obj,input,) + +/* + * This sets various attributes of the widget. + */ +void setCDK ( + CDK * /* widget */, + /* low */, + /* high */, + /* value */, + boolean /* Box */); + +/* + * These set/get the low and high values. + */ +void setCDKLowHigh ( + CDK * /* widget */, + /* low */, + /* high */); + + getCDKLowValue ( + CDK * /* widget */); + + getCDKHighValue ( + CDK * /* widget */); + +/* + * These set/get the digits. + */ +#if +void setCDKDigits ( + CDK * /* widget */, + int /* digits */); + +int getCDKDigits ( + CDK * /* widget */); +#endif + +/* + * These set/get the current value. + */ +void setCDKValue ( + CDK * /* widget */, + /* value */); + + getCDKValue ( + CDK * /* widget */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKBox ( + CDK * /* widget */, + boolean /* Box */); + +boolean getCDKBox ( + CDK * /* widget */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKULChar(w,c) setULCharOf(w,c) +#define setCDKURChar(w,c) setURCharOf(w,c) +#define setCDKLLChar(w,c) setLLCharOf(w,c) +#define setCDKLRChar(w,c) setLRCharOf(w,c) +#define setCDKVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the widget on the screen. + */ +#define drawCDK(obj,Box) drawCDKObject(obj,Box) + +/* + * This erases the widget from the screen. + */ +#define eraseCDK(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location on the screen. + */ +#define moveCDK(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the widget on the screen. + */ +#define positionCDK(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and associated memory. + */ +#define destroyCDK(obj) destroyCDKObject(obj) + +/* + * These set the pre/post process callback functions. + */ +#define setCDKPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/gen-slider.h b/deps/cdk-5.0-20161210/include/gen-slider.h new file mode 100644 index 0000000..cc95d65 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/gen-slider.h @@ -0,0 +1,233 @@ +/* + * $Id: gen-slider.h,v 1.8 2012/03/20 21:59:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDK_H +#define CDK_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Copyright 2004,2012 Thomas E. Dickey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas Dickey + * and contributors. + * 4. Neither the name of Thomas Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK widget structure. + */ +struct S { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + WINDOW * fieldWin; + WINDOW * labelWin; + int titleAdj; + chtype * label; + int labelLen; + int boxHeight; + int boxWidth; + int fieldWidth; + int fieldEdit; /* offset from right-margin of field */ + chtype filler; + low; + high; + inc; + fastinc; + current; +#if + int digits; +#endif + EExitType exitType; + boolean shadow; +}; +typedef struct S CDK; + +/* + * This creates a new pointer to a CDK - widget. + */ +CDK *newCDK ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + const char * /* title */, + const char * /* label */, + chtype /* fieldAttr */, + int /* fieldWidth */, + /* start */, + /* low */, + /* high */, + /* inc */, + /* fastInc */, +#if + int /* digits */, +#endif + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the widget. + */ + activateCDK ( + CDK * /* widget */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDK(obj,input) injectCDKObject(obj,input,) + +/* + * This sets various attributes of the widget. + */ +void setCDK ( + CDK * /* widget */, + /* low */, + /* high */, + /* value */, + boolean /* Box */); + +/* + * These set/get the low and high values. + */ +void setCDKLowHigh ( + CDK * /* widget */, + /* low */, + /* high */); + + getCDKLowValue ( + CDK * /* widget */); + + getCDKHighValue ( + CDK * /* widget */); + +/* + * These set/get the digits. + */ +#if +void setCDKDigits ( + CDK * /* widget */, + int /* digits */); + +int getCDKDigits ( + CDK * /* widget */); +#endif + +/* + * These set/get the current value. + */ +void setCDKValue ( + CDK * /* widget */, + /* value */); + + getCDKValue ( + CDK * /* widget */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKBox ( + CDK * /* widget */, + boolean /* Box */); + +boolean getCDKBox ( + CDK * /* widget */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKULChar(w,c) setULCharOf(w,c) +#define setCDKURChar(w,c) setURCharOf(w,c) +#define setCDKLLChar(w,c) setLLCharOf(w,c) +#define setCDKLRChar(w,c) setLRCharOf(w,c) +#define setCDKVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the widget on the screen. + */ +#define drawCDK(obj,Box) drawCDKObject(obj,Box) + +/* + * This erases the widget from the screen. + */ +#define eraseCDK(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location on the screen. + */ +#define moveCDK(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the widget on the screen. + */ +#define positionCDK(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and associated memory. + */ +#define destroyCDK(obj) destroyCDKObject(obj) + +/* + * These set the pre/post process callback functions. + */ +#define setCDKPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDK_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/graph.h b/deps/cdk-5.0-20161210/include/graph.h new file mode 100644 index 0000000..171a0ba --- /dev/null +++ b/deps/cdk-5.0-20161210/include/graph.h @@ -0,0 +1,233 @@ +/* + * $Id: graph.h,v 1.22 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKGRAPH_H +#define CDKGRAPH_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 2000-2004,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK graph structure. + */ +struct SGraph { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + int titleAdj; + chtype * graphChar; + boolean shadow; + int boxHeight; + int boxWidth; + chtype * xtitle; + int xtitlePos; + int xtitleLen; + int * values; + int count; + int minx; + int maxx; + int xscale; + int txpos; + chtype * ytitle; + int ytitlePos; + int ytitleLen; + int yscale; + int typos; + EGraphDisplayType displayType; +}; +typedef struct SGraph CDKGRAPH; + +/* + * This creates a new CDK graph pointer. + */ +CDKGRAPH *newCDKGraph ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* height */, + int /* width */, + const char * /* title */, + const char * /* xtitle */, + const char * /* ytitle */); + +/* + * This was added to make the builder simpler. All this will + * do is call drawCDKGraph. + */ +void activateCDKGraph ( + CDKGRAPH * /* graph */, + chtype * /* actions */); + +/* + * This sets multiple attributes of the widget. + */ +int setCDKGraph ( + CDKGRAPH * /* graph */, + int * /* values */, + int /* count */, + const char * /* graphChar */, + boolean /* startAtZero */, + EGraphDisplayType /* displayType */); + +/* + * This sets the values of the graph widget. + */ +int setCDKGraphValues ( + CDKGRAPH * /* graph */, + int * /* values */, + int /* count */, + boolean /* startAtZero */); + +int setCDKGraphValue ( + CDKGRAPH * /* graph */, + int /* index */, + int /* value */, + boolean /* startAtZero */); + +int *getCDKGraphValues ( + CDKGRAPH * /* graph */, + int * /* size */); + +int getCDKGraphValue ( + CDKGRAPH * /* graph */, + int /* index */); + +/* + * This sets the characters of the graph widget. + */ +int setCDKGraphCharacters ( + CDKGRAPH * /* graph */, + const char * /* characters */); + +int setCDKGraphCharacter ( + CDKGRAPH * /* graph */, + int /* index */, + const char * /* character */); + +chtype *getCDKGraphCharacters ( + CDKGRAPH * /* graph */); + +chtype getCDKGraphCharacter ( + CDKGRAPH * /* graph */, + int /* index */); + +/* + * This sets the display type of the graph. + */ +void setCDKGraphDisplayType ( + CDKGRAPH * /* graph */, + EGraphDisplayType /* type */); + +EGraphDisplayType getCDKGraphDisplayType ( + CDKGRAPH * /* graph */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKGraphBox ( + CDKGRAPH * /* graph */, + boolean /* Box */); + +boolean getCDKGraphBox ( + CDKGRAPH * /* graph */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKGraphULChar(w,c) setULCharOf(w,c) +#define setCDKGraphURChar(w,c) setURCharOf(w,c) +#define setCDKGraphLLChar(w,c) setLLCharOf(w,c) +#define setCDKGraphLRChar(w,c) setLRCharOf(w,c) +#define setCDKGraphVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKGraphHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKGraphBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKGraphBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKGraphBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the graph on the screen. + */ +#define drawCDKGraph(obj,Box) drawCDKObject(obj,Box) + +/* + * This removes the graph from the screen. + */ +#define eraseCDKGraph(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location. + */ +#define moveCDKGraph(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively move the widget. + */ +#define positionCDKGraph(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the graph and all the associated memory. + */ +#define destroyCDKGraph(obj) destroyCDKObject(obj) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKGRAPH_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/histogram.h b/deps/cdk-5.0-20161210/include/histogram.h new file mode 100644 index 0000000..f90c0c5 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/histogram.h @@ -0,0 +1,248 @@ +/* + * $Id: histogram.h,v 1.19 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKHISTOGRAM_H +#define CDKHISTOGRAM_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2004,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare the histogram structure. + */ +struct SHistogram { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + int titleAdj; + char * curString; + char * lowString; + char * highString; + chtype filler; + float percent; + int fieldHeight; + int fieldWidth; + int barSize; + int orient; + int statsPos; + chtype statsAttr; + EHistogramDisplayType viewType; + int high; + int low; + int value; + int lowx; + int lowy; + int curx; + int cury; + int highx; + int highy; + int boxWidth; + int boxHeight; + boolean shadow; +}; +typedef struct SHistogram CDKHISTOGRAM; + +/* + * This returns a new pointer to a histogram pointer. + */ +CDKHISTOGRAM *newCDKHistogram ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* height */, + int /* width */, + int /* orient */, + const char * /* title */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This was added to make the build simpler. All this will + * do is call drawCDKHistogram. + */ +void activateCDKHistogram ( + CDKHISTOGRAM * /* histogram */, + chtype * /* actions */); + +/* + * These set specific attributes of the histogram. + */ +void setCDKHistogram ( + CDKHISTOGRAM * /* histogram */, + EHistogramDisplayType /* viewtype */, + int /* statsPos */, + chtype /* statsAttr */, + int /* low */, + int /* high */, + int /* value */, + chtype /* filler */, + boolean /* Box */); + +/* + * This sets the low/high/current value of the histogram. + */ +void setCDKHistogramValue ( + CDKHISTOGRAM * /* histogram */, + int /* low */, + int /* high */, + int /* value */); + +int getCDKHistogramValue ( + CDKHISTOGRAM * /* histogram */); + +int getCDKHistogramLowValue ( + CDKHISTOGRAM * /* histogram */); + +int getCDKHistogramHighValue ( + CDKHISTOGRAM * /* histogram */); + +/* + * This sets the view type of the histogram. + */ +void setCDKHistogramDisplayType ( + CDKHISTOGRAM * /* histogram */, + EHistogramDisplayType /* viewtype */); + +EHistogramDisplayType getCDKHistogramViewType ( + CDKHISTOGRAM * /* histogram */); + +/* + * This returns the filler character used to draw the histogram. + */ +void setCDKHistogramFillerChar ( + CDKHISTOGRAM * /* histogram */, + chtype /* character */); + +chtype getCDKHistogramFillerChar ( + CDKHISTOGRAM * /* histogram */); + +/* + * This states where the statistics value is to be located on the histogram. + */ +void setCDKHistogramStatsPos ( + CDKHISTOGRAM * /* histogram */, + int /* statsPos */); + +int getCDKHistogramStatsPos ( + CDKHISTOGRAM * /* histogram */); + +/* + * This sets the attribute of the statistics. + */ +void setCDKHistogramStatsAttr ( + CDKHISTOGRAM * /* histogram */, + chtype /* statsAttr */); + +chtype getCDKHistogramStatsAttr ( + CDKHISTOGRAM * /* histogram */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKHistogramBox ( + CDKHISTOGRAM * /* histogram */, + boolean /* Box */); + +boolean getCDKHistogramBox ( + CDKHISTOGRAM * /* histogram */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKHistogramULChar(w,c) setULCharOf(w,c) +#define setCDKHistogramURChar(w,c) setURCharOf(w,c) +#define setCDKHistogramLLChar(w,c) setLLCharOf(w,c) +#define setCDKHistogramLRChar(w,c) setLRCharOf(w,c) +#define setCDKHistogramVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKHistogramHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKHistogramBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKHistogramBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKHistogramBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the widget on the screen. + */ +#define drawCDKHistogram(obj,Box) drawCDKObject(obj,Box) + +/* + * This removes the widget from the screen. + */ +#define eraseCDKHistogram(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location. + */ +#define moveCDKHistogram(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the widget on the screen. + */ +#define positionCDKHistogram(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the histogram and all related pointers. + */ +#define destroyCDKHistogram(obj) destroyCDKObject(obj) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKHISTOGRAM_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/itemlist.h b/deps/cdk-5.0-20161210/include/itemlist.h new file mode 100644 index 0000000..81cf7e8 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/itemlist.h @@ -0,0 +1,228 @@ +/* + * $Id: itemlist.h,v 1.24 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKITEMLIST_H +#define CDKITEMLIST_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2004,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK itemlist widget structure. + */ +struct SItemList { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + WINDOW * labelWin; + WINDOW * fieldWin; + int titleAdj; + chtype * label; + int labelLen; + int fieldWidth; + chtype ** item; + int * itemPos; + int * itemLen; + int listSize; + int currentItem; + int defaultItem; + int boxWidth; + int boxHeight; + EExitType exitType; + boolean shadow; +}; +typedef struct SItemList CDKITEMLIST; + +/* + * This creates a pointer to a CDK itemlist widget. + */ +CDKITEMLIST *newCDKItemlist ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + const char * /* title */, + const char * /* label */, + CDK_CSTRING2 /* itemlist */, + int /* count */, + int /* defaultItem */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the itemlist widget. + */ +int activateCDKItemlist ( + CDKITEMLIST * /* itemlist */, + chtype * /* actions */); + +/* + * This injects a single character into the itemlist widget. + */ +#define injectCDKItemlist(obj,input) injectCDKObject(obj,input,Int) + +/* + * These functions set specific elements of the itemlist widget. + */ +void setCDKItemlist ( + CDKITEMLIST * /* itemlist */, + CDK_CSTRING2 /* list */, + int /* count */, + int /* current */, + boolean /* Box */); + +/* + * This function sets the values of the item list widget. + */ +void setCDKItemlistValues ( + CDKITEMLIST * /* itemlist */, + CDK_CSTRING2 /* list */, + int /* count */, + int /* defaultItem */); + +chtype **getCDKItemlistValues ( + CDKITEMLIST * /* itemlist */, + int * /* size */); + +/* + * This sets the default item in the list. + */ +void setCDKItemlistDefaultItem ( + CDKITEMLIST * /* itemlist */, + int /* defaultItem */); + +int getCDKItemlistDefaultItem ( + CDKITEMLIST * /* itemlist */); + +/* + * This returns an index to the current item in the list. + */ +void setCDKItemlistCurrentItem ( + CDKITEMLIST * /* itemlist */, + int /* currentItem */); + +int getCDKItemlistCurrentItem ( + CDKITEMLIST * /* itemlist */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKItemlistBox ( + CDKITEMLIST * /* itemlist */, + boolean /* Box */); + +boolean getCDKItemlistBox ( + CDKITEMLIST * /* itemlist */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKItemlistULChar(w,c) setULCharOf(w,c) +#define setCDKItemlistURChar(w,c) setURCharOf(w,c) +#define setCDKItemlistLLChar(w,c) setLLCharOf(w,c) +#define setCDKItemlistLRChar(w,c) setLRCharOf(w,c) +#define setCDKItemlistVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKItemlistHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKItemlistBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKItemlistBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKItemlistBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the itemlist widget. + */ +#define drawCDKItemlist(obj,Box) drawCDKObject(obj,Box) + +/* + * This draws the itemlist field. + */ +void drawCDKItemlistField ( + CDKITEMLIST * /* itemlist */, + boolean /* highlight */); + +/* + * This removes the widget from the screen. + */ +#define eraseCDKItemlist(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given position. + */ +#define moveCDKItemlist(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively move the widget. + */ +#define positionCDKItemlist(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all the associated memory. + */ +#define destroyCDKItemlist(obj) destroyCDKObject(obj) + +/* + * These functions set the pre/post process functions. + */ +#define setCDKItemlistPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKItemlistPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKITEMLIST_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/label.h b/deps/cdk-5.0-20161210/include/label.h new file mode 100644 index 0000000..ae629b3 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/label.h @@ -0,0 +1,190 @@ +/* + * $Id: label.h,v 1.20 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKLABEL_H +#define CDKLABEL_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 2000-2003,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare any definitions you need to make. + */ +#define MAX_LABEL_ROWS 300 /* unused by widgets */ + +/* + * Declare the CDK label structure. + */ +struct SLabel { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + chtype ** info; + int * infoLen; + int * infoPos; + int boxWidth; + int boxHeight; + int xpos; + int ypos; + int rows; + boolean shadow; +}; +typedef struct SLabel CDKLABEL; + +/* + * This creates a new CDK label widget. + */ +CDKLABEL *newCDKLabel ( + CDKSCREEN * /* screen */, + int /* xPos */, + int /* yPos */, + CDK_CSTRING2 /* mesg */, + int /* rows */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This was added to make the builder simpler. All this will + * do is call drawCDKLabel. + */ +void activateCDKLabel ( + CDKLABEL * /* label */, + chtype * /* actions */); + +/* + * This sets multiple attributes of the widget. + */ +void setCDKLabel ( + CDKLABEL * /* label */, + CDK_CSTRING2 /* message */, + int /* lines */, + boolean /* Box */); + +/* + * This sets the contents of the label. + */ +void setCDKLabelMessage ( + CDKLABEL * /* label */, + CDK_CSTRING2 /* mesg */, + int /* lines */); +chtype **getCDKLabelMessage ( + CDKLABEL * /* label */, + int * /* size */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKLabelBox ( + CDKLABEL * /* label */, + boolean /* Box */); +boolean getCDKLabelBox ( + CDKLABEL * /* label */); + +/* + * This draws the label. + */ +#define drawCDKLabel(obj,Box) drawCDKObject(obj,Box) + +/* + * These set the drawing characters of the widget. + */ +#define setCDKLabelULChar(w,c) setULCharOf(w,c) +#define setCDKLabelURChar(w,c) setURCharOf(w,c) +#define setCDKLabelLLChar(w,c) setLLCharOf(w,c) +#define setCDKLabelLRChar(w,c) setLRCharOf(w,c) +#define setCDKLabelVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKLabelHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKLabelBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKLabelBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKLabelBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This erases the label. + */ +#define eraseCDKLabel(obj) eraseCDKObject(obj) + +/* + * This destroys the label and the memory used by it. + */ +#define destroyCDKLabel(obj) destroyCDKObject(obj) + +/* + * This draws the label then waits for the user to press + * the key defined by the 'key' parameter. + */ +char waitCDKLabel ( + CDKLABEL * /* label */, + char /* key */); + +/* + * This moves the label. + */ +#define moveCDKLabel(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the label. + */ +#define positionCDKLabel(widget) positionCDKObject(ObjOf(widget),widget->win) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKLABEL_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/marquee.h b/deps/cdk-5.0-20161210/include/marquee.h new file mode 100644 index 0000000..52f51dd --- /dev/null +++ b/deps/cdk-5.0-20161210/include/marquee.h @@ -0,0 +1,161 @@ +/* + * $Id: marquee.h,v 1.19 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKMARQUEE_H +#define CDKMARQUEE_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2004,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK marquee widget structure. + */ +struct SMarquee { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + int active; + int width; + int boxWidth; + int boxHeight; + boolean shadow; +}; +typedef struct SMarquee CDKMARQUEE; + +/* + * This creates a new marquee widget pointer. + */ +CDKMARQUEE *newCDKMarquee ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* width */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This turns the marquee 'on'. + */ +int activateCDKMarquee ( + CDKMARQUEE * /* marquee */, + const char * /* message */, + int /* delay */, + int /* repeat */, + boolean /* Box */); + +/* + * This turns 'off' the marquee. + */ +void deactivateCDKMarquee ( + CDKMARQUEE * /* marquee */); + +/* + * This draws the marquee on the screen. + */ +#define drawCDKMarquee(obj,Box) drawCDKObject(obj,Box) + +/* + * This removes the widget from the screen. + */ +#define eraseCDKMarquee(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location. + */ +#define moveCDKMarquee(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This interactively positions the widget on the screen. + */ +#define positionCDKMarquee(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the marquee widget. + */ +#define destroyCDKMarquee(obj) destroyCDKObject(obj) + +/* + * These set the drawing characters of the widget. + */ +#define setCDKMarqueeULChar(w,c) setULCharOf(w,c) +#define setCDKMarqueeURChar(w,c) setURCharOf(w,c) +#define setCDKMarqueeLLChar(w,c) setLLCharOf(w,c) +#define setCDKMarqueeLRChar(w,c) setLRCharOf(w,c) +#define setCDKMarqueeVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKMarqueeHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKMarqueeBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the box attribute of the widget. + */ +void setCDKMarqueeBox ( + CDKMARQUEE * /* marquee */, + boolean /* Box */); + +boolean getCDKMarqueeBox ( + CDKMARQUEE * /* marquee */); + +/* + * This sets the background color of the widget. + */ +#define setCDKMarqueeBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKMarqueeBackgroundAttrib(w,c) setBKAttrOf(w,c) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKMARQUEE_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/matrix.h b/deps/cdk-5.0-20161210/include/matrix.h new file mode 100644 index 0000000..09feabd --- /dev/null +++ b/deps/cdk-5.0-20161210/include/matrix.h @@ -0,0 +1,317 @@ +/* + * $Id: matrix.h,v 1.30 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKMATRIX_H +#define CDKMATRIX_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2008,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare some matrix definitions. + */ +#define MAX_MATRIX_ROWS 1000 +#define MAX_MATRIX_COLS 1000 + +/* + * Define the CDK matrix widget structure. + */ +typedef struct SMatrix CDKMATRIX; +typedef void (*MATRIXCB) (CDKMATRIX *matrix, chtype input); + +#define CELL_LIMIT MAX_MATRIX_ROWS][MAX_MATRIX_COLS + +#define NEW_CDKMATRIX 1 + +#if NEW_CDKMATRIX +#define CELL_INDEX(matrix, row,col) (((row) * ((matrix)->cols + 1)) + (col)) +#else +#define CELL_INDEX(matrix, row,col) (row)][(col) +#endif + +#define MATRIX_CELL(matrix,row,col) ((matrix)->cell[CELL_INDEX(matrix, row, col)]) +#define MATRIX_INFO(matrix,row,col) ((matrix)->info[CELL_INDEX(matrix, row, col)]) + +struct SMatrix { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; +#if NEW_CDKMATRIX + WINDOW ** cell; + char ** info; +#else + WINDOW * cell[CELL_LIMIT]; + char * info[CELL_LIMIT]; +#endif + int titleAdj; + int rows; + int cols; + int vrows; + int vcols; + int * colwidths; + int * colvalues; + chtype ** coltitle; + int * coltitleLen; + int * coltitlePos; + int maxct; + chtype ** rowtitle; + int * rowtitleLen; + int * rowtitlePos; + int maxrt; + int boxHeight; + int boxWidth; + int rowSpace; + int colSpace; + int row; + int col; + int crow; /* current row */ + int ccol; /* current column */ + int trow; /* topmost row shown in screen */ + int lcol; /* leftmost column shown in screen */ + int oldcrow; + int oldccol; + int oldvrow; + int oldvcol; + EExitType exitType; + boolean boxCell; + boolean shadow; + chtype highlight; + int dominant; + chtype filler; + MATRIXCB callbackfn; +}; + +/* + * This creates a new pointer to a matrix widget. + */ +CDKMATRIX *newCDKMatrix ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* rows */, + int /* cols */, + int /* vrows */, + int /* vcols */, + const char * /* title */, + CDK_CSTRING2 /* rowtitles */, + CDK_CSTRING2 /* coltitles */, + int * /* colwidths */, + int * /* coltypes */, + int /* rowspace */, + int /* colspace */, + chtype /* filler */, + int /* dominantAttrib */, + boolean /* boxMatrix */, + boolean /* boxCell */, + boolean /* shadow */); + +/* + * This activates the matrix. + */ +int activateCDKMatrix ( + CDKMATRIX * /* matrix */, + chtype * /* actions */); + +/* + * This injects a single character into the matrix widget. + */ +#define injectCDKMatrix(obj,input) injectCDKObject(obj,input,Int) + +/* + * This sets the contents of the matrix widget from a fixed-size 2d array. + * The predefined array limits are very large. + * Use setCDKMatrixCells() instead. + */ +#define setCDKMatrix(matrix, info, rows, subSize) \ + setCDKMatrixCells(matrix, &info[0][0], rows, MAX_MATRIX_COLS, subSize) + +/* + * This sets the contents of the matrix widget from an array defined by the + * caller. It may be any size. For compatibility with setCDKMatrix(), the + * info[][] array's subscripts start at 1. + */ +void setCDKMatrixCells ( + CDKMATRIX * /* matrix */, + CDK_CSTRING2 /* info */, + int /* rows */, + int /* cols */, + int * /* subSize */); + +/* + * This sets the value of a given cell. + */ +int setCDKMatrixCell ( + CDKMATRIX * /* matrix */, + int /* row */, + int /* col */, + const char * /* value */); + +char *getCDKMatrixCell ( + CDKMATRIX * /* matrix */, + int /* row */, + int /* col */); + +/* + * This returns the row/col of the matrix. + */ +int getCDKMatrixCol ( + CDKMATRIX * /* matrix */); + +int getCDKMatrixRow ( + CDKMATRIX * /* matrix */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKMatrixULChar(w,c) setULCharOf(w,c) +#define setCDKMatrixURChar(w,c) setURCharOf(w,c) +#define setCDKMatrixLLChar(w,c) setLLCharOf(w,c) +#define setCDKMatrixLRChar(w,c) setLRCharOf(w,c) +#define setCDKMatrixVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKMatrixHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKMatrixBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKMatrixBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKMatrixBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the matrix on the screen. + */ +#define drawCDKMatrix(obj,Box) drawCDKObject(obj,Box) + +/* + * This removes the matrix from the screen. + */ +#define eraseCDKMatrix(obj) eraseCDKObject(obj) + +/* + * This cleans out all the cells from the matrix. + */ +void cleanCDKMatrix ( + CDKMATRIX * /* matrix */); + +/* + * This cleans one cell in the matrix. + */ +void cleanCDKMatrixCell ( + CDKMATRIX * /* matrix */, + int /* row */, + int /* col */); + +/* + * This sets the main callback in the matrix. + */ +void setCDKMatrixCB ( + CDKMATRIX * /* matrix */, + MATRIXCB /* callback */); + +/* + * This moves the matrix to the given cell. + */ +int moveToCDKMatrixCell ( + CDKMATRIX * /* matrix */, + int /* newrow */, + int /* newcol */); + +/* + * This sets the box attribute of the matrix widget. + */ +void setCDKMatrixBox ( + CDKMATRIX * /* matrix */, + boolean /* Box */); + +boolean getCDKMatrixBox ( + CDKMATRIX * /* matrix */); + +/* + * This moves the matrix on the screen to the given location. + */ +#define moveCDKMatrix(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the matrix. + */ +#define positionCDKMatrix(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the matrix widget and associated memory. + */ +#define destroyCDKMatrix(obj) destroyCDKObject(obj) + +/* + * This jumps to the given matrix cell. You can pass in + * -1 for both the row/col if you want to interactively + * pick the cell. + */ +int jumpToCell ( + CDKMATRIX * /* matrix */, + int /* row */, + int /* col */); + +/* + * These set the pre/post process callback functions. + */ +#define setCDKMatrixPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKMatrixPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKMATRIX_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/mentry.h b/deps/cdk-5.0-20161210/include/mentry.h new file mode 100644 index 0000000..9441f33 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/mentry.h @@ -0,0 +1,260 @@ +/* + * $Id: mentry.h,v 1.23 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKMENTRY_H +#define CDKMENTRY_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2004,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK multiple line entry field widget. + */ +typedef struct SMentry CDKMENTRY; +typedef void (*MENTRYCB) (CDKMENTRY *mentry, chtype character); + +struct SMentry { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + WINDOW * labelWin; + WINDOW * fieldWin; + int titleAdj; + chtype * label; + int labelLen; + int labelPos; + chtype fieldAttr; + int fieldWidth; + int boxHeight; + int boxWidth; + char * info; + int totalWidth; + int rows; + int currentRow; + int currentCol; + int topRow; + EDisplayType dispType; + int min; + int logicalRows; + EExitType exitType; + boolean shadow; + chtype filler; + chtype hidden; + MENTRYCB callbackfn; +}; + +/* + * This creates a new CDK mentry field pointer. + */ +CDKMENTRY *newCDKMentry ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + const char * /* title */, + const char * /* label */, + chtype /* fieldAttr */, + chtype /* filler */, + EDisplayType /* disptype */, + int /* fieldWidth */, + int /* fieldrows */, + int /* logicalRows */, + int /* min */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the widget. + */ +char *activateCDKMentry ( + CDKMENTRY * /* mentry */, + chtype * /* input */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKMentry(obj,input) injectCDKObject(obj,input,String) + +/* + * These set specific attributes of the widget. + */ +void setCDKMentry ( + CDKMENTRY * /* mentry */, + const char * /* value */, + int /* min */, + boolean /* Box */); + +/* + * This sets the value of the widget. + */ +void setCDKMentryValue ( + CDKMENTRY * /* mentry */, + const char * /* value */); + +char *getCDKMentryValue ( + CDKMENTRY * /* mentry */); + +/* + * This sets the minimum length of the value for the widget. + */ +void setCDKMentryMin ( + CDKMENTRY * /* mentry */, + int /* min */); + +int getCDKMentryMin ( + CDKMENTRY * /* mentry */); + +/* + * This sets the filler character to use when drawing the widget. + */ +void setCDKMentryFillerChar ( + CDKMENTRY * /* mentry */, + chtype /* filler */); + +chtype getCDKMentryFillerChar ( + CDKMENTRY * /* mentry */); + +/* + * This sets the character to use when a hidden character type is used. + */ +void setCDKMentryHiddenChar ( + CDKMENTRY * /* mentry */, + chtype /* character */); + +chtype getCDKMentryHiddenChar ( + CDKMENTRY * /* mentry */); + +/* + * This sets the box attribute of the mentry widget. + */ +void setCDKMentryBox ( + CDKMENTRY * /* mentry */, + boolean /* Box */); + +boolean getCDKMentryBox ( + CDKMENTRY * /* mentry */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKMentryULChar(w,c) setULCharOf(w,c) +#define setCDKMentryURChar(w,c) setURCharOf(w,c) +#define setCDKMentryLLChar(w,c) setLLCharOf(w,c) +#define setCDKMentryLRChar(w,c) setLRCharOf(w,c) +#define setCDKMentryVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKMentryHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKMentryBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKMentryBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKMentryBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the widget on the screen. + */ +#define drawCDKMentry(obj,Box) drawCDKObject(obj,Box) + +/* + * This erases the widget from the screen. + */ +#define eraseCDKMentry(obj) eraseCDKObject(obj) + +/* + * This cleans out the information in the widget. + */ +void cleanCDKMentry ( + CDKMENTRY * /* mentry */); + +/* + * This moves the widget to the given location. + */ +#define moveCDKMentry(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This interactively moves the widget on the screen. + */ +#define positionCDKMentry(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget pointer. + */ +#define destroyCDKMentry(obj) destroyCDKObject(obj) + +/* + * This draws the field of the widget. + */ +void drawCDKMentryField ( + CDKMENTRY * /* mentry */); + +/* + * This sets the widgets main callback. + */ +void setCDKMentryCB ( + CDKMENTRY * /* mentry */, + MENTRYCB /* callback */); + +/* + * These set the pre/post process callback functions. + */ +#define setCDKMentryPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKMentryPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKMENTRY_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/menu.h b/deps/cdk-5.0-20161210/include/menu.h new file mode 100644 index 0000000..f2a6a1b --- /dev/null +++ b/deps/cdk-5.0-20161210/include/menu.h @@ -0,0 +1,199 @@ +/* + * $Id: menu.h,v 1.22 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKMENU_H +#define CDKMENU_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2005,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define menu specific values. + */ +#define MAX_MENU_ITEMS 30 +#define MAX_SUB_ITEMS 98 + +/* + * Define the CDK menu widget structure. + */ +struct SMenu { + CDKOBJS obj; + WINDOW * parent; + WINDOW * pullWin[MAX_MENU_ITEMS]; + WINDOW * titleWin[MAX_MENU_ITEMS]; + chtype * title[MAX_MENU_ITEMS]; + int titleLen[MAX_MENU_ITEMS]; + chtype * sublist[MAX_MENU_ITEMS][MAX_SUB_ITEMS]; + int sublistLen[MAX_MENU_ITEMS][MAX_SUB_ITEMS]; + int subsize[MAX_MENU_ITEMS]; + int menuPos; + int menuItems; + chtype titleAttr; + chtype subtitleAttr; + int currentTitle; + int currentSubtitle; + int lastTitle; + int lastSubtitle; + EExitType exitType; + int lastSelection; +}; +typedef struct SMenu CDKMENU; + +/* + * This creates a new CDK menu widget pointer. + */ +CDKMENU *newCDKMenu ( + CDKSCREEN * /* cdkscreen */, + const char * /* menulist */ [MAX_MENU_ITEMS][MAX_SUB_ITEMS], + int /* menuitems */, + int * /* subsize */, + int * /* menuloc */, + int /* menuPos */, + chtype /* titleattr */, + chtype /* subtitleattr */); + +/* + * This activates the menu. + */ +int activateCDKMenu ( + CDKMENU * /* menu */, + chtype * /* actions */); + +/* + * This injects a single character into the menu widget. + */ +#define injectCDKMenu(obj,input) injectCDKObject(obj,input,Int) + +/* + * These set specific attributes of the menu. + */ +void setCDKMenu ( + CDKMENU * /* menu */, + int /* menuItem */, + int /* subMenuItem */, + chtype /* titleHighlight */, + chtype /* subTitleHighlight */); + +/* + * This returns the current item the menu is on. + */ +void setCDKMenuCurrentItem ( + CDKMENU * /* menu */, + int /* menuItem */, + int /* subMenuItem */); + +void getCDKMenuCurrentItem ( + CDKMENU * /* menu */, + int * /* menuItem */, + int * /* subMenuItem */); + +/* + * This sets the highlight of the title. + */ +void setCDKMenuTitleHighlight ( + CDKMENU * /* menu */, + chtype /* highlight */); + +chtype getCDKMenuTitleHighlight ( + CDKMENU * /* menu */); + +/* + * This sets the sub-menu title highlight. + */ +void setCDKMenuSubTitleHighlight ( + CDKMENU * /* menu */, + chtype /* highlight */); + +chtype getCDKMenuSubTitleHighlight ( + CDKMENU * /* menu */); + +/* + * This draws the menu on the screen. + */ +#define drawCDKMenu(obj,box) drawCDKObject(obj,box) + +void drawCDKMenuSubwin ( + CDKMENU * /* menu */); + +/* + * This erases the complere menu widget from the screen. + */ +#define eraseCDKMenu(obj) eraseCDKObject(obj) + +void eraseCDKMenuSubwin ( + CDKMENU * /* menu */); + +/* + * This sets the background color of the widget. + */ +#define setCDKMenuBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKMenuBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This destroys the menu widget. + */ +#define destroyCDKMenu(obj) destroyCDKObject(obj) + +/* + * These set the pre/post process callback functions. + */ +#define setCDKMenuPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKMenuPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKMENU_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/radio.h b/deps/cdk-5.0-20161210/include/radio.h new file mode 100644 index 0000000..dfa8a12 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/radio.h @@ -0,0 +1,253 @@ +/* + * $Id: radio.h,v 1.30 2013/09/01 18:06:41 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKRADIO_H +#define CDKRADIO_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +#include + +/* + * Changes 1999-2012,2013 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK radio list widget structure. + */ +struct SRadio { + /* This field must stay on top */ + SCROLLER_FIELDS; + + chtype choiceChar; + chtype leftBoxChar; + chtype rightBoxChar; + int widestItem; + int selectedItem; + int defItem; +}; +typedef struct SRadio CDKRADIO; + +/* + * This creates a new radio widget pointer. + */ +CDKRADIO *newCDKRadio ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* spos */, + int /* height */, + int /* width */, + const char * /* title */, + CDK_CSTRING2 /* mesg */, + int /* items */, + chtype /* choiceChar */, + int /* defItem */, + chtype /* highlight */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the widget. + */ +int activateCDKRadio ( + CDKRADIO * /* radio */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKRadio(obj,input) injectCDKObject(obj,input,Int) + +/* + * These set various attributes of the widget. + */ +void setCDKRadio ( + CDKRADIO * /* radio */, + chtype /* highlight */, + chtype /* character */, + boolean /* Box */); + +/* + * This sets the contents of the radio list. + */ +void setCDKRadioItems ( + CDKRADIO * /* radio */, + CDK_CSTRING2 /* list */, + int /* listSize */); + +int getCDKRadioItems ( + CDKRADIO * /* radio */, + char ** /* list */); + +/* + * This sets the highlight bar attribute. + */ +void setCDKRadioHighlight ( + CDKRADIO * /* radio */, + chtype /* highlight */); + +chtype getCDKRadioHighlight ( + CDKRADIO * /* radio */); + +/* + * This sets the 'selected' character. + */ +void setCDKRadioChoiceCharacter ( + CDKRADIO * /* radio */, + chtype /* character */); + +chtype getCDKRadioChoiceCharacter ( + CDKRADIO * /* radio */); + +/* + * This sets the character to draw on the left/right side of + * the choice box. + */ +void setCDKRadioLeftBrace ( + CDKRADIO * /* radio */, + chtype /* character */); + +chtype getCDKRadioLeftBrace ( + CDKRADIO * /* radio */); + +void setCDKRadioRightBrace ( + CDKRADIO * /* radio */, + chtype /* character */); + +chtype getCDKRadioRightBrace ( + CDKRADIO * /* radio */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKRadioBox ( + CDKRADIO * /* radio */, + boolean /* Box */); + +boolean getCDKRadioBox ( + CDKRADIO * /* radio */); + +/* + * This sets the current high lighted item of the widget + */ +void setCDKRadioCurrentItem ( + CDKRADIO * /* radio */, + int /* current item */); + +int getCDKRadioCurrentItem ( + CDKRADIO * /* radio */); + +/* + * This sets the current selected item of the widget + */ +void setCDKRadioSelectedItem ( + CDKRADIO * /* radio */, + int /* current item */); + +int getCDKRadioSelectedItem ( + CDKRADIO * /* radio */); + + +/* + * These set the drawing characters of the widget. + */ +#define setCDKRadioULChar(w,c) setULCharOf(w,c) +#define setCDKRadioURChar(w,c) setURCharOf(w,c) +#define setCDKRadioLLChar(w,c) setLLCharOf(w,c) +#define setCDKRadioLRChar(w,c) setLRCharOf(w,c) +#define setCDKRadioVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKRadioHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKRadioBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKRadioBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKRadioBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the widget on the screen. + */ +#define drawCDKRadio(obj,Box) drawCDKObject(obj,Box) + +/* + * This erases the widget from the screen. + */ +#define eraseCDKRadio(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given screen location. + */ +#define moveCDKRadio(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This interactively moves the widget to a new location on the screen. + */ +#define positionCDKRadio(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys a widget pointer. + */ +#define destroyCDKRadio(obj) destroyCDKObject(obj) + +/* + * These set the pre/post process callback functions. + */ +#define setCDKRadioPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKRadioPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKRADIO_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/scroll.h b/deps/cdk-5.0-20161210/include/scroll.h new file mode 100644 index 0000000..1e8164b --- /dev/null +++ b/deps/cdk-5.0-20161210/include/scroll.h @@ -0,0 +1,256 @@ +/* + * $Id: scroll.h,v 1.33 2013/09/01 18:06:41 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKSCROLL_H +#define CDKSCROLL_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +#include + +/* + * Changes 1999-2012,2013 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare scrolling list definitions. + */ +#define NUMBERS TRUE +#define NONUMBERS FALSE + +/* + * Declare scrolling list definitions. + */ +struct SScroll { + /* This field must stay on top */ + SCROLLER_FIELDS; + + boolean numbers; /* */ + chtype titlehighlight; /* */ + WINDOW *listWin; +}; +typedef struct SScroll CDKSCROLL; + +/* + * This creates a new CDK scrolling list pointer. + */ +CDKSCROLL *newCDKScroll ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* spos */, + int /* height */, + int /* width */, + const char * /* title */, + CDK_CSTRING2 /* itemList */, + int /* items */, + boolean /* numbers */, + chtype /* highlight */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the scrolling list. + */ +int activateCDKScroll ( + CDKSCROLL * /* scroll */, + chtype * /* actions */); + +/* + * This injects a single character into the scrolling list. + */ +#define injectCDKScroll(obj,input) injectCDKObject(obj,input,Int) + +/* + * This sets various attributes of the scrolling list. + */ +void setCDKScroll ( + CDKSCROLL * /* scroll */, + CDK_CSTRING2 /* itemList */, + int /* items */, + boolean /* numbers */, + chtype /* highlight */, + boolean /* Box */); + +void setCDKScrollPosition ( + CDKSCROLL * /* scroll */, + int /* item */); + +int getCDKScrollCurrent( + CDKSCROLL * /* scroll */); + +void setCDKScrollCurrent( + CDKSCROLL * /* scroll */, + int /* i */); + +int getCDKScrollCurrentTop( + CDKSCROLL * /* scroll */); + +void setCDKScrollCurrentTop( + CDKSCROLL * /* scroll */, + int /* i */); + +int getCDKScrollCurrentItem( + CDKSCROLL * /* scroll */); + +void setCDKScrollCurrentItem( + CDKSCROLL * /* scroll */, + int /* i */); + +/* + * This sets the contents of the scrolling list. + */ +void setCDKScrollItems ( + CDKSCROLL * /* scroll */, + CDK_CSTRING2 /* itemList */, + int /* items */, + boolean /* numbers */); + +int getCDKScrollItems ( + CDKSCROLL * /* scroll */, + char ** /* itemList */); + +/* + * This sets the highlight bar of the scrolling list. + */ +void setCDKScrollHighlight ( + CDKSCROLL * /* scroll */, + chtype /* highlight */); + +chtype getCDKScrollHighlight ( + CDKSCROLL * /* scroll */, + chtype /* highlight */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKScrollBox ( + CDKSCROLL * /* scroll */, + boolean /* Box */); + +boolean getCDKScrollBox ( + CDKSCROLL * /* scroll */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKScrollULChar(w,c) setULCharOf(w,c) +#define setCDKScrollURChar(w,c) setURCharOf(w,c) +#define setCDKScrollLLChar(w,c) setLLCharOf(w,c) +#define setCDKScrollLRChar(w,c) setLRCharOf(w,c) +#define setCDKScrollVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKScrollHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKScrollBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKScrollBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKScrollBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This adds a single item to the end of scrolling list. + */ +void addCDKScrollItem ( + CDKSCROLL * /* scroll */, + const char * /* item */); + +/* + * This adds a single item into the scrolling list. + */ +void insertCDKScrollItem ( + CDKSCROLL * /* scroll */, + const char * /* item */); + +/* + * This deletes a single item from the scrolling list. + */ +void deleteCDKScrollItem ( + CDKSCROLL * /* scroll */, + int /* position */); + +/* + * This draws the scrolling list on the screen. + */ +#define drawCDKScroll(obj,Box) drawCDKObject(obj,Box) + +/* + * This removes the scrolling list from the screen. + */ +#define eraseCDKScroll(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location. + */ +#define moveCDKScroll(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This allows the user to interactively position the widget on the screen. + */ +#define positionCDKScroll(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all associated memory. + */ +#define destroyCDKScroll(obj) destroyCDKObject(obj) + +/* + * These set the scrolling list pre/post process functions. + */ +#define setCDKScrollPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKScrollPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKSCROLL_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/scroller.h b/deps/cdk-5.0-20161210/include/scroller.h new file mode 100644 index 0000000..82835f1 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/scroller.h @@ -0,0 +1,117 @@ +/* + * $Id: scroller.h,v 1.3 2013/09/01 21:56:04 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef SCROLLER_H +#define SCROLLER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Copyright 2013 Thomas E.Dickey and Corentin Delorme + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas E. Dickey + * and contributors. + * 4. Neither the name of Thomas E. Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define SCROLLER_FIELDS \ + CDKOBJS obj; \ + WINDOW * parent; \ + WINDOW * win; \ + WINDOW * scrollbarWin; \ + WINDOW * shadowWin; \ + int titleAdj; /* unused */ \ + chtype ** item; \ + int * itemLen; \ + int * itemPos; \ +\ + int currentTop; \ + int currentItem; \ + int currentHigh; \ +\ + int maxTopItem; \ + int maxLeftChar; \ + int maxchoicelen; \ + int leftChar; \ + int lastItem; \ + int listSize; \ + int boxWidth; \ + int boxHeight; \ + int viewSize; \ +\ + int scrollbarPlacement; \ + boolean scrollbar; \ + int toggleSize; /* size of scrollbar thumb/toggle */ \ + int togglePos; /* position of scrollbar thumb/toggle */ \ + float step; /* increment for scrollbar */ \ +\ + EExitType exitType; \ + boolean shadow; \ + chtype highlight + +struct SScroller { + /* This field must stay on top */ + SCROLLER_FIELDS; +}; + +typedef struct SScroller CDKSCROLLER; + +void scroller_KEY_UP (CDKSCROLLER * /* scroller */); + +void scroller_KEY_DOWN (CDKSCROLLER * /* scroller */); + +void scroller_KEY_LEFT (CDKSCROLLER * /* scroller */); + +void scroller_KEY_RIGHT (CDKSCROLLER * /* scroller */); + +void scroller_KEY_PPAGE (CDKSCROLLER * /* scroller */); + +void scroller_KEY_NPAGE (CDKSCROLLER * /* scroller */); + +void scroller_KEY_HOME (CDKSCROLLER * /* scroller */); + +void scroller_KEY_END (CDKSCROLLER * /* scroller */); + +void scroller_FixCursorPosition (CDKSCROLLER * /* scroller */); + +void scroller_SetPosition (CDKSCROLLER * /* scroller */, int /* item */); + +int scroller_MaxViewSize (CDKSCROLLER * /* scroller */); + +void scroller_SetViewSize (CDKSCROLLER * /* scroller */, int /* size */); + +#ifdef __cplusplus +} +#endif + +#endif /* SCROLLER_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/selection.h b/deps/cdk-5.0-20161210/include/selection.h new file mode 100644 index 0000000..f94d788 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/selection.h @@ -0,0 +1,265 @@ +/* + * $Id: selection.h,v 1.28 2013/09/01 18:06:41 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKSELECTION_H +#define CDKSELECTION_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2012,2013 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Declare selection list definitions. + */ +#define MAX_CHOICES 100 /* unused by widgets */ + +/* + * Define the CDK selection widget structure. + */ +struct SSelection { + /* This field must stay on top */ + SCROLLER_FIELDS; + + chtype ** choice; + int * choicelen; + int choiceCount; + int * selections; + int * mode; +}; +typedef struct SSelection CDKSELECTION; + +/* + * This creates a new pointer to a selection widget. + */ +CDKSELECTION *newCDKSelection ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* spos */, + int /* height */, + int /* width */, + const char * /* title */, + CDK_CSTRING2 /* list */, + int /* listSize */, + CDK_CSTRING2 /* choices */, + int /* choiceSize */, + chtype /* highlight */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the selection widget. + */ +int activateCDKSelection ( + CDKSELECTION * /* selection */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKSelection(obj,input) injectCDKObject(obj,input,Int) + +/* + * This draws the selection widget. + */ +#define drawCDKSelection(obj,Box) drawCDKObject(obj,Box) + +/* + * This erases the selection widget from the screen. + */ +#define eraseCDKSelection(obj) eraseCDKObject(obj) + +/* + * This moves the widget to the given location. + */ +#define moveCDKSelection(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This interactively moves the widget on the screen. + */ +#define positionCDKSelection(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all associated memory. + */ +#define destroyCDKSelection(obj) destroyCDKObject(obj) + +/* + * This sets various attributes of the selection widget. + */ +void setCDKSelection ( + CDKSELECTION * /* selection */, + chtype /* highlight */, + int * /* defChoices */, + boolean /* Box */); + +/* + * This sets the contents of the selection list. + */ +void setCDKSelectionItems ( + CDKSELECTION * /* selection */, + CDK_CSTRING2 /* list */, + int /* listSize */); + +int getCDKSelectionItems ( + CDKSELECTION * /* selection */, + char ** /* list */); + +/* + * + */ +void setCDKSelectionTitle ( + CDKSELECTION * /* selection */, + const char * /* title */); + +char *getCDKSelectionTitle ( + CDKSELECTION * /* selection */); + +/* + * This sets the selection list highlight bar. + */ +void setCDKSelectionHighlight ( + CDKSELECTION * /* selection */, + chtype /* highlight */); + +chtype getCDKSelectionHighlight ( + CDKSELECTION * /* selection */); + +/* + * set/get the current item index + */ +void setCDKSelectionCurrent ( + CDKSELECTION * /* selection */, + int /* index */); + +int getCDKSelectionCurrent ( + CDKSELECTION * /* selection */); + +/* + * This sets the choices of the selection list. + */ +void setCDKSelectionChoices ( + CDKSELECTION * /* selection */, + int * /* choices */); + +int *getCDKSelectionChoices ( + CDKSELECTION * /* selection */); + +void setCDKSelectionChoice ( + CDKSELECTION * /* selection */, + int /* index */, + int /* choice */); + +int getCDKSelectionChoice ( + CDKSELECTION * /* selection */, + int /* index */); + +/* + * This sets the modes of the items in the selection list. Currently + * there are only two: editable=0 and read-only=1 + */ +void setCDKSelectionModes ( + CDKSELECTION * /* selection */, + int * /* modes */); + +int *getCDKSelectionModes ( + CDKSELECTION * /* selection */); + +void setCDKSelectionMode ( + CDKSELECTION * /* selection */, + int /* index */, + int /* mode */); + +int getCDKSelectionMode ( + CDKSELECTION * /* selection */, + int /* index */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKSelectionBox ( + CDKSELECTION * /* selection */, + boolean /* Box */); + +boolean getCDKSelectionBox ( + CDKSELECTION * /* selection */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKSelectionULChar(w,c) setULCharOf(w,c) +#define setCDKSelectionURChar(w,c) setURCharOf(w,c) +#define setCDKSelectionLLChar(w,c) setLLCharOf(w,c) +#define setCDKSelectionLRChar(w,c) setLRCharOf(w,c) +#define setCDKSelectionVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKSelectionHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKSelectionBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKSelectionBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKSelectionBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * These set the pre/post process callback functions. + */ +#define setCDKSelectionPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKSelectionPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKSELECTION_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/swindow.h b/deps/cdk-5.0-20161210/include/swindow.h new file mode 100644 index 0000000..3ea2485 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/swindow.h @@ -0,0 +1,259 @@ +/* + * $Id: swindow.h,v 1.24 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKSWINDOW_H +#define CDKSWINDOW_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2004,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK scrolling window widget structure. + */ +struct SSwindow { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * fieldWin; + WINDOW * shadowWin; + chtype ** list; + int * listPos; + int * listLen; + int titleAdj; + int listSize; + int boxHeight; + int boxWidth; + int viewSize; + int maxTopLine; + int currentTop; + int leftChar; + int maxLeftChar; + int widestLine; + int saveLines; + EExitType exitType; + boolean shadow; +}; +typedef struct SSwindow CDKSWINDOW; +typedef void (*SWINDOWCB) (CDKSWINDOW *swindow, chtype input); + +/* + * This creates a new pointer to a scrolling window widget. + */ +CDKSWINDOW *newCDKSwindow ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* height */, + int /* width */, + const char * /* title */, + int /* saveLines */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the scrolling window. + */ +void activateCDKSwindow ( + CDKSWINDOW * /* swindow */, + chtype * /* actions */); + +/* + * This injects a single character into the scrolling window. + */ +#define injectCDKSwindow(obj,input) injectCDKObject(obj,input,Int) + +/* + * This executes the given command and puts the output of the + * command into the scrolling window. + */ +int execCDKSwindow ( + CDKSWINDOW * /* swindow */, + const char * /* command */, + int /* insertPos */); + +/* + * This dumps the contents of the scrolling window to the given filename. + */ +int dumpCDKSwindow ( + CDKSWINDOW * /* swindow */, + const char * /* filename */); + +/* + * This jumps to the given line in the window. + */ +void jumpToLineCDKSwindow ( + CDKSWINDOW * /* swindow */, + int /* line */); + +/* + * This saves the contents of the scrolling window via an + * interactive window. + */ +void saveCDKSwindowInformation ( + CDKSWINDOW * /* swindow */); + +/* + * This loads the window up with information from a filename + * interactively provided. + */ +void loadCDKSwindowInformation ( + CDKSWINDOW * /* swindow */); + +/* + * These functions set the attributes of the scrolling window. + */ +void setCDKSwindow ( + CDKSWINDOW * /* swindow */, + CDK_CSTRING2 /* info */, + int /* lines */, + boolean /* Box */); + +/* + * This sets the contents of the scrolling window. + */ +void setCDKSwindowContents ( + CDKSWINDOW * /* swindow */, + CDK_CSTRING2 /* info */, + int /* lines */); + +chtype **getCDKSwindowContents ( + CDKSWINDOW * /* swindow */, + int * /* size */); + +/* + * This sets the box attribute of the scrolling window. + */ +void setCDKSwindowBox ( + CDKSWINDOW * /* swindow */, + boolean /* Box */); + +boolean getCDKSwindowBox ( + CDKSWINDOW * /* swindow */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKSwindowULChar(w,c) setULCharOf(w,c) +#define setCDKSwindowURChar(w,c) setURCharOf(w,c) +#define setCDKSwindowLLChar(w,c) setLLCharOf(w,c) +#define setCDKSwindowLRChar(w,c) setLRCharOf(w,c) +#define setCDKSwindowVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKSwindowHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKSwindowBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKSwindowBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKSwindowBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the scrolling window on the screen. + */ +#define drawCDKSwindow(obj,Box) drawCDKObject(obj,Box) + +/* + * This removes the widget from the screen. + */ +#define eraseCDKSwindow(obj) eraseCDKObject(obj) + +/* + * This cleans out all of the information from the window. + */ +void cleanCDKSwindow ( + CDKSWINDOW * /* swindow */); + +/* + * This adds a line to the window. + */ +void addCDKSwindow ( + CDKSWINDOW * /* swindow */, + const char * /* info */, + int /* insertPos */); + +/* + * This trims lines from the window. + */ +void trimCDKSwindow ( + CDKSWINDOW * /* swindow */, + int /* start */, + int /* finish */); + +/* + * This moves the window to the given location. + */ +#define moveCDKSwindow(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This interactively positions the widget on the screen. + */ +#define positionCDKSwindow(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all associated memory. + */ +#define destroyCDKSwindow(obj) destroyCDKObject(obj) + +/* + * These set the pre/post process callback functions. + */ +#define setCDKSwindowPreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKSwindowPostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKSWINDOW_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/template.h b/deps/cdk-5.0-20161210/include/template.h new file mode 100644 index 0000000..1a8da62 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/template.h @@ -0,0 +1,243 @@ +/* + * $Id: template.h,v 1.24 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKTEMPLATE_H +#define CDKTEMPLATE_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2004,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK cdktemplate widget structure. + */ +typedef struct STemplate CDKTEMPLATE; +typedef void (*TEMPLATECB) (CDKTEMPLATE *cdktemplate, chtype input); + +struct STemplate { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + WINDOW * labelWin; + WINDOW * fieldWin; + int titleAdj; + chtype * label; + chtype * overlay; + chtype overlayAttr; + char * plate; + char * info; + int labelLen; + int overlayLen; + int labelPos; + int fieldWidth; + int boxWidth; + int boxHeight; + int platePos; + int plateLen; + int screenPos; + int infoPos; + int min; + chtype labelAttr; + chtype fieldAttr; + EExitType exitType; + boolean shadow; + TEMPLATECB callbackfn; +}; + +/* + * This creates a pointer to a new CDK cdktemplate widget. + */ +CDKTEMPLATE *newCDKTemplate ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + const char * /* title */, + const char * /* label */, + const char * /* plate */, + const char * /* overlay */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the cdktemplate widget. + */ +char *activateCDKTemplate ( + CDKTEMPLATE * /* cdktemplate */, + chtype * /* actions */); + +/* + * This injects a single character into the widget. + */ +#define injectCDKTemplate(obj,input) injectCDKObject(obj,input,String) + +/* + * This sets various attributes of the widget. + */ +void setCDKTemplate ( + CDKTEMPLATE * /* cdktemplate */, + const char * /* value */, + boolean /* Box */); + +/* + * This sets the value in the cdktemplate widget. + */ +void setCDKTemplateValue ( + CDKTEMPLATE * /* cdktemplate */, + const char * /* value */); + +char *getCDKTemplateValue ( + CDKTEMPLATE * /* cdktemplate */); + +/* + * This sets the minimum number of characters to enter. + */ +void setCDKTemplateMin ( + CDKTEMPLATE * /* cdktemplate */, + int /* min */); + +int getCDKTemplateMin ( + CDKTEMPLATE * /* cdktemplate */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKTemplateBox ( + CDKTEMPLATE * /* cdktemplate */, + boolean /* Box */); + +boolean getCDKTemplateBox ( + CDKTEMPLATE * /* cdktemplate */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKTemplateULChar(w,c) setULCharOf(w,c) +#define setCDKTemplateURChar(w,c) setURCharOf(w,c) +#define setCDKTemplateLLChar(w,c) setLLCharOf(w,c) +#define setCDKTemplateLRChar(w,c) setLRCharOf(w,c) +#define setCDKTemplateVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKTemplateHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKTemplateBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKTemplateBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKTemplateBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the cdktemplate on the screen. + */ +#define drawCDKTemplate(obj,Box) drawCDKObject(obj,Box) + +/* + * This erases the widget from the screen. + */ +#define eraseCDKTemplate(obj) eraseCDKObject(obj) + +/* + * This erases the cdktemplates contents. + */ +void cleanCDKTemplate ( + CDKTEMPLATE * /* cdktemplate */); + +/* + * This moves the widget to the given location on the screen. + */ +#define moveCDKTemplate(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This interactively positions the widget on the screen. + */ +#define positionCDKTemplate(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all associated memory. + */ +#define destroyCDKTemplate(obj) destroyCDKObject(obj) + +/* + * This sets the main callback function. + */ +void setCDKTemplateCB ( + CDKTEMPLATE * /* cdktemplate */, + TEMPLATECB /* callback */); + +/* + * This returns a character pointer to the contents of the cdktemplate + * mixed with the plate. + */ +char *mixCDKTemplate ( + CDKTEMPLATE * /* cdktemplate */); + +/* + * This returns a character pointer to the cdktemplate with the plate + * stripped out. + */ +char *unmixCDKTemplate ( + CDKTEMPLATE * /* cdktemplate */, + const char * /* string */); + +/* + * These set the pre/post callback functions. + */ +#define setCDKTemplatePreProcess(w,f,d) setCDKObjectPreProcess(ObjOf(w),f,d) +#define setCDKTemplatePostProcess(w,f,d) setCDKObjectPostProcess(ObjOf(w),f,d) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKTEMPLATE_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/traverse.h b/deps/cdk-5.0-20161210/include/traverse.h new file mode 100644 index 0000000..2d5cad8 --- /dev/null +++ b/deps/cdk-5.0-20161210/include/traverse.h @@ -0,0 +1,73 @@ +/* + * $Id: traverse.h,v 1.9 2005/12/30 01:09:09 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKTRAVERSE_H +#define CDKTRAVERSE_H 1 + +#include "cdk.h" + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Copyright 1999-2004,2005 Thomas E. Dickey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Thomas Dickey + * and contributors. + * 4. Neither the name of Thomas Dickey, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +typedef boolean (*CHECK_KEYCODE)(int /* keyCode */, int /* functionKey */); + +extern CDKOBJS *getCDKFocusCurrent (CDKSCREEN * /* screen */); +extern CDKOBJS *setCDKFocusCurrent (CDKSCREEN * /*screen */, CDKOBJS * /* obj */); +extern CDKOBJS *setCDKFocusNext (CDKSCREEN * /* screen */); +extern CDKOBJS *setCDKFocusPrevious (CDKSCREEN * /* screen */); +extern CDKOBJS *setCDKFocusFirst (CDKSCREEN * /* screen */); +extern CDKOBJS *setCDKFocusLast (CDKSCREEN * /* screen */); + +extern int traverseCDKScreen (CDKSCREEN * /* screen */); + +extern void exitCancelCDKScreen (CDKSCREEN * /* screen */); +extern void exitCancelCDKScreenOf (CDKOBJS * /* obj */); +extern void exitOKCDKScreen (CDKSCREEN * /* screen */); +extern void exitOKCDKScreenOf (CDKOBJS * /* obj */); +extern void resetCDKScreen (CDKSCREEN * /* screen */); +extern void resetCDKScreenOf (CDKOBJS * /* obj */); +extern void traverseCDKOnce (CDKSCREEN * /*screen */, CDKOBJS * /*curobj */, int /* keyCode */, boolean /* functionKey */, CHECK_KEYCODE /*funcMenuKey */); + +#endif /* CDKTRAVERSE_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/include/viewer.h b/deps/cdk-5.0-20161210/include/viewer.h new file mode 100644 index 0000000..c9ee39b --- /dev/null +++ b/deps/cdk-5.0-20161210/include/viewer.h @@ -0,0 +1,240 @@ +/* + * $Id: viewer.h,v 1.22 2012/03/21 21:15:30 tom Exp $ + */ + +#ifndef CDKINCLUDES +#ifndef CDKVIEWER_H +#define CDKVIEWER_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CDK_H +#define CDKINCLUDES +#include +#undef CDKINCLUDES +#include +#include +#include +#endif + +/* + * Changes 1999-2004,2012 copyright Thomas E. Dickey + * + * Copyright 1999, Mike Glover + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Mike Glover + * and contributors. + * 4. Neither the name of Mike Glover, nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Define the CDK viewer widget structure. + */ +struct SViewer { + CDKOBJS obj; + WINDOW * parent; + WINDOW * win; + WINDOW * shadowWin; + chtype ** button; + int * buttonLen; + int * buttonPos; + int buttonCount; + chtype buttonHighlight; + chtype ** list; + int * listLen; + int * listPos; + int titleAdj; + int listSize; + int boxHeight; + int boxWidth; + int viewSize; + int currentTop; + int currentButton; + int leftChar; + int length; + int maxLeftChar; + int maxTopLine; + int widestLine; + long characters; + boolean inProgress; + boolean showLineInfo; + boolean interpret; + EExitType exitType; + boolean shadow; +}; +typedef struct SViewer CDKVIEWER; + +/* + * This creates a pointer to a new CDK viewer widget. + */ +CDKVIEWER *newCDKViewer ( + CDKSCREEN * /* cdkscreen */, + int /* xpos */, + int /* ypos */, + int /* height */, + int /* width */, + CDK_CSTRING2 /* buttons */, + int /* buttonCount */, + chtype /* buttonHighlight */, + boolean /* Box */, + boolean /* shadow */); + +/* + * This activates the viewer widget. + */ +int activateCDKViewer ( + CDKVIEWER * /* viewer */, + chtype * /* actions */); + +/* + * This sets various attributes of the viewer widget. + */ +int setCDKViewer ( + CDKVIEWER * /* viewer */, + const char * /* title */, + CDK_CSTRING2 /* info */, + int /* infoSize */, + chtype /* buttonHighlight */, + boolean /* interpret */, + boolean /* showLineInfo */, + boolean /* Box */); + +/* + * This sets the contents of the viewer widget. + */ +int setCDKViewerInfo ( + CDKVIEWER * /* viewer */, + CDK_CSTRING2 /* info */, + int /* infoSize */, + boolean /* interpret */); + +chtype **getCDKViewerInfo ( + CDKVIEWER * /* viewer */, + int * /* size */); + +/* + * This sets the title of the viewer widget. + */ +void setCDKViewerTitle ( + CDKVIEWER * /* viewer */, + const char * /* title */); + +chtype **getCDKViewerTitle ( + CDKVIEWER * /* viewer */); + +/* + * This sets the highlight bar attribute. + */ +void setCDKViewerHighlight ( + CDKVIEWER * /* viewer */, + chtype /* buttonHighlight */); + +chtype getCDKViewerHighlight ( + CDKVIEWER * /* viewer */); + +/* + * This sets the boolean flag dictating whether a information line + * will be displayed in the top left corner of the viewer. + */ +void setCDKViewerInfoLine ( + CDKVIEWER * /* viewer */, + boolean /* showLineInfo */); + +boolean getCDKViewerInfoLine ( + CDKVIEWER * /* viewer */); + +/* + * This sets the box attribute of the widget. + */ +void setCDKViewerBox ( + CDKVIEWER * /* viewer */, + boolean /* Box */); + +boolean getCDKViewerBox ( + CDKVIEWER * /* viewer */); + +/* + * These set the drawing characters of the widget. + */ +#define setCDKViewerULChar(w,c) setULCharOf(w,c) +#define setCDKViewerURChar(w,c) setURCharOf(w,c) +#define setCDKViewerLLChar(w,c) setLLCharOf(w,c) +#define setCDKViewerLRChar(w,c) setLRCharOf(w,c) +#define setCDKViewerVerticalChar(w,c) setVTCharOf(w,c) +#define setCDKViewerHorizontalChar(w,c) setHZCharOf(w,c) +#define setCDKViewerBoxAttribute(w,c) setBXAttrOf(w,c) + +/* + * This sets the background color of the widget. + */ +#define setCDKViewerBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) + +/* + * This sets the background attribute of the widget. + */ +#define setCDKViewerBackgroundAttrib(w,c) setBKAttrOf(w,c) + +/* + * This draws the viewer field on the screen. + */ +#define drawCDKViewer(obj,box) drawCDKObject(obj,box) + +/* + * This erases the widget from the screen. + */ +#define eraseCDKViewer(obj) eraseCDKObject(obj) + +/* + * This cleans out all of the information from the viewer. + */ +void cleanCDKViewer ( + CDKVIEWER * /* viewer */); + +/* + * This moves the widget to the given location. + */ +#define moveCDKViewer(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) + +/* + * This is an interactive method of moving the widget. + */ +#define positionCDKViewer(widget) positionCDKObject(ObjOf(widget),widget->win) + +/* + * This destroys the widget and all the memory associated with the widget. + */ +#define destroyCDKViewer(obj) destroyCDKObject(obj) + +#ifdef __cplusplus +} +#endif + +#endif /* CDKVIEWER_H */ +#endif /* CDKINCLUDES */ diff --git a/deps/cdk-5.0-20161210/install-sh b/deps/cdk-5.0-20161210/install-sh new file mode 100755 index 0000000..462fa9c --- /dev/null +++ b/deps/cdk-5.0-20161210/install-sh @@ -0,0 +1,294 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# 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, 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 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/#inst.$$# + rmtmp=$dstdir/#rm.$$# + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} diff --git a/deps/cdk-5.0-20161210/itemlist.c b/deps/cdk-5.0-20161210/itemlist.c new file mode 100644 index 0000000..f8f4223 --- /dev/null +++ b/deps/cdk-5.0-20161210/itemlist.c @@ -0,0 +1,821 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 20:16:56 $ + * $Revision: 1.86 $ + */ + +static int createList (CDKITEMLIST *itemlist, CDK_CSTRING2 item, int count); +static int createFieldWin (CDKITEMLIST *itemlist, int ypos, int xpos); +static int maximumFieldWidth (CDKITEMLIST *itemlist); +static void updateFieldWidth (CDKITEMLIST *itemlist); + +DeclareCDKObjects (ITEMLIST, Itemlist, setCdk, Int); + +/* + * This creates a pointer to an itemlist widget. + */ +CDKITEMLIST *newCDKItemlist (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + const char *title, + const char *label, + CDK_CSTRING2 item, + int count, + int defaultItem, + boolean Box, + boolean shadow) +{ + /* Set up some variables. */ + CDKITEMLIST *itemlist = 0; + /* *INDENT-EQLS* */ + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth = 0; + int boxHeight; + int fieldWidth = 0; + int xpos = xplace; + int ypos = yplace; + int junk; + + if ((itemlist = newCDKObject (CDKITEMLIST, &my_funcs)) == 0 + || !createList (itemlist, item, count)) + { + destroyCDKObject (itemlist); + return (0); + } + + setCDKItemlistBox (itemlist, Box); + boxHeight = (BorderOf (itemlist) * 2) + 1; + + /* *INDENT-EQLS* Set some basic values of the itemlist. */ + itemlist->label = 0; + itemlist->labelLen = 0; + itemlist->labelWin = 0; + + /* Translate the label char *pointer to a chtype pointer. */ + if (label != 0) + { + itemlist->label = char2Chtype (label, &itemlist->labelLen, &junk); + } + + /* + * *INDENT-EQLS* Set the box width. Allow an extra char in field width for cursor + */ + fieldWidth = maximumFieldWidth (itemlist) + 1; + boxWidth = fieldWidth + itemlist->labelLen + 2 * BorderOf (itemlist); + boxWidth = setCdkTitle (ObjOf (itemlist), title, boxWidth); + boxHeight += TitleLinesOf (itemlist); + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + itemlist->boxWidth = MINIMUM (boxWidth, parentWidth); + itemlist->boxHeight = MINIMUM (boxHeight, parentHeight); + updateFieldWidth (itemlist); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the window. */ + itemlist->win = newwin (boxHeight, boxWidth, ypos, xpos); + if (itemlist->win == 0) + { + destroyCDKObject (itemlist); + return (0); + } + + /* Make the label window if there was a label. */ + if (itemlist->label != 0) + { + itemlist->labelWin = subwin (itemlist->win, + 1, + itemlist->labelLen, + ypos + BorderOf (itemlist) + TitleLinesOf (itemlist), + xpos + BorderOf (itemlist)); + if (itemlist->labelWin == 0) + { + destroyCDKObject (itemlist); + return (0); + } + } + + keypad (itemlist->win, TRUE); + + /* Make the field window */ + if (!createFieldWin (itemlist, + ypos + BorderOf (itemlist) + TitleLinesOf (itemlist), + xpos + itemlist->labelLen + BorderOf (itemlist))) + { + destroyCDKObject (itemlist); + return (0); + } + + /* *INDENT-EQLS* Set up the rest of the structure. */ + ScreenOf (itemlist) = cdkscreen; + itemlist->parent = cdkscreen->window; + itemlist->shadowWin = 0; + initExitType (itemlist); + ObjOf (itemlist)->acceptsFocus = TRUE; + itemlist->shadow = shadow; + + setCDKItemlistBox (itemlist, Box); + + /* Set then default item. */ + if (defaultItem >= 0 && defaultItem < itemlist->listSize) + { + itemlist->currentItem = defaultItem; + itemlist->defaultItem = defaultItem; + } + else + { + itemlist->currentItem = 0; + itemlist->defaultItem = 0; + } + + /* Do we want a shadow??? */ + if (shadow) + { + itemlist->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + if (itemlist->shadowWin == 0) + { + destroyCDKObject (itemlist); + return (0); + } + } + + /* Register this baby. */ + registerCDKObject (cdkscreen, vITEMLIST, itemlist); + + /* Return the pointer to the structure */ + return (itemlist); +} + +/* + * This allows the user to play with the widget. + */ +int activateCDKItemlist (CDKITEMLIST *itemlist, chtype *actions) +{ + /* Declare local variables. */ + int ret = -1; + + /* Draw the widget. */ + drawCDKItemlist (itemlist, ObjOf (itemlist)->box); + drawCDKItemlistField (itemlist, TRUE); + + if (actions == 0) + { + chtype input = 0; + boolean functionKey; + + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (itemlist), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKItemlist (itemlist, input); + if (itemlist->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKItemlist (itemlist, actions[x]); + if (itemlist->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and exit. */ + setExitType (itemlist, 0); + return ret; +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKItemlist (CDKOBJS *object, chtype input) +{ + CDKITEMLIST *widget = (CDKITEMLIST *)object; + /* Declare local variables. */ + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Draw the widget field. */ + drawCDKItemlistField (widget, TRUE); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vITEMLIST, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check a predefined binding. */ + if (checkCDKObjectBind (vITEMLIST, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_UP: + case KEY_RIGHT: + case SPACE: + case '+': + case 'n': + if (widget->currentItem < widget->listSize - 1) + { + widget->currentItem++; + } + else + { + widget->currentItem = 0; + } + break; + + case KEY_DOWN: + case KEY_LEFT: + case '-': + case 'p': + if (widget->currentItem > 0) + { + widget->currentItem--; + } + else + { + widget->currentItem = widget->listSize - 1; + } + break; + + case 'd': + case 'D': + widget->currentItem = widget->defaultItem; + break; + + case '0': + widget->currentItem = 0; + break; + + case '$': + widget->currentItem = widget->listSize - 1; + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_TAB: + case KEY_ENTER: + setExitType (widget, input); + ret = widget->currentItem; + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + Beep (); + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vITEMLIST, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKItemlistField (widget, TRUE); + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * This moves the itemlist field to the given location. + */ +static void _moveCDKItemlist (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKITEMLIST *itemlist = (CDKITEMLIST *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (itemlist->win); + int currentY = getbegy (itemlist->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (itemlist->win) + xplace; + ypos = getbegy (itemlist->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (itemlist), &xpos, &ypos, itemlist->boxWidth, itemlist->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (itemlist->win, -xdiff, -ydiff); + moveCursesWindow (itemlist->fieldWin, -xdiff, -ydiff); + moveCursesWindow (itemlist->labelWin, -xdiff, -ydiff); + moveCursesWindow (itemlist->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (itemlist)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKItemlist (itemlist, ObjOf (itemlist)->box); + } +} + +/* + * This draws the widget on the screen. + */ +static void _drawCDKItemlist (CDKOBJS *object, int Box) +{ + CDKITEMLIST *itemlist = (CDKITEMLIST *)object; + + /* Did we ask for a shadow? */ + if (itemlist->shadowWin != 0) + { + drawShadow (itemlist->shadowWin); + } + + /* Box the widget if asked. */ + if (Box) + { + drawObjBox (itemlist->win, ObjOf (itemlist)); + } + + drawCdkTitle (itemlist->win, object); + + /* Draw in the label to the widget. */ + if (itemlist->labelWin != 0) + { + writeChtype (itemlist->labelWin, + 0, + 0, + itemlist->label, + HORIZONTAL, + 0, + chlen (itemlist->label)); + } + + wrefresh (itemlist->win); + + /* Draw in the field. */ + drawCDKItemlistField (itemlist, FALSE); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrItemlist (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKITEMLIST *widget = (CDKITEMLIST *)object; + + wbkgd (widget->win, attrib); + wbkgd (widget->fieldWin, attrib); + if (widget->labelWin != 0) + { + wbkgd (widget->labelWin, attrib); + } + } +} + +/* + * This function draws the contents of the field. + */ +void drawCDKItemlistField (CDKITEMLIST *itemlist, boolean highlight) +{ + /* Declare local vars. */ + int currentItem = itemlist->currentItem; + int len; + int x; + + /* Determine how much we have to draw. */ + len = MINIMUM (itemlist->itemLen[currentItem], itemlist->fieldWidth); + + /* Erase the field window. */ + werase (itemlist->fieldWin); + + /* Draw in the current item in the field. */ + for (x = 0; x < len; x++) + { + chtype c = itemlist->item[currentItem][x]; + + if (highlight) + { + c = CharOf (c) | A_REVERSE; + } + + (void)mvwaddch (itemlist->fieldWin, 0, + x + itemlist->itemPos[currentItem], + c); + } + + /* Redraw the field window. */ + wrefresh (itemlist->fieldWin); +} + +/* + * This function removes the widget from the screen. + */ +static void _eraseCDKItemlist (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKITEMLIST *itemlist = (CDKITEMLIST *)object; + + eraseCursesWindow (itemlist->fieldWin); + eraseCursesWindow (itemlist->labelWin); + eraseCursesWindow (itemlist->win); + eraseCursesWindow (itemlist->shadowWin); + } +} + +static void destroyInfo (CDKITEMLIST *widget) +{ + widget->listSize = 0; + + CDKfreeChtypes (widget->item); + widget->item = 0; + + freeAndNull (widget->itemPos); + freeAndNull (widget->itemLen); +} + +/* + * This function destroys the widget and all the memory it used. + */ +static void _destroyCDKItemlist (CDKOBJS *object) +{ + if (object != 0) + { + CDKITEMLIST *itemlist = (CDKITEMLIST *)object; + + cleanCdkTitle (object); + freeChtype (itemlist->label); + destroyInfo (itemlist); + + /* Delete the windows. */ + deleteCursesWindow (itemlist->fieldWin); + deleteCursesWindow (itemlist->labelWin); + deleteCursesWindow (itemlist->shadowWin); + deleteCursesWindow (itemlist->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vITEMLIST, itemlist); + + /* Unregister this object. */ + unregisterCDKObject (vITEMLIST, itemlist); + } +} + +/* + * This sets multiple attributes of the widget. + */ +void setCDKItemlist (CDKITEMLIST *itemlist, + CDK_CSTRING2 list, + int count, + int current, + boolean Box) +{ + setCDKItemlistValues (itemlist, list, count, current); + setCDKItemlistBox (itemlist, Box); +} + +/* + * This function sets the contents of the list. + */ +void setCDKItemlistValues (CDKITEMLIST *itemlist, CDK_CSTRING2 item, int + count, int defaultItem) +{ + if (createList (itemlist, item, count)) + { + int oldWidth = itemlist->fieldWidth; + + /* Set the default item. */ + if ((defaultItem >= 0) && (defaultItem < itemlist->listSize)) + { + itemlist->currentItem = defaultItem; + itemlist->defaultItem = defaultItem; + } + + /* + * This will not resize the outer windows but can still make a usable + * field width if the title made the outer window wide enough. + */ + updateFieldWidth (itemlist); + if (itemlist->fieldWidth > oldWidth) + { + createFieldWin (itemlist, + getbegy (itemlist->fieldWin), + getbegx (itemlist->fieldWin)); + } + + /* Draw the field. */ + eraseCDKItemlist (itemlist); + drawCDKItemlist (itemlist, ObjOf (itemlist)->box); + } +} +chtype **getCDKItemlistValues (CDKITEMLIST *itemlist, int *size) +{ + (*size) = itemlist->listSize; + return itemlist->item; +} + +/* + * This sets the default/current item of the itemlist. + */ +void setCDKItemlistCurrentItem (CDKITEMLIST *itemlist, int currentItem) +{ + /* Set the default item. */ + if ((currentItem >= 0) && (currentItem < itemlist->listSize)) + { + itemlist->currentItem = currentItem; + } +} +int getCDKItemlistCurrentItem (CDKITEMLIST *itemlist) +{ + return itemlist->currentItem; +} + +/* + * This sets the default item in the list. + */ +void setCDKItemlistDefaultItem (CDKITEMLIST *itemlist, int defaultItem) +{ + /* Make sure the item is in the correct range. */ + if (defaultItem < 0) + { + itemlist->defaultItem = 0; + } + else if (defaultItem >= itemlist->listSize) + { + itemlist->defaultItem = itemlist->listSize - 1; + } + else + { + itemlist->defaultItem = defaultItem; + } +} +int getCDKItemlistDefaultItem (CDKITEMLIST *itemlist) +{ + return itemlist->defaultItem; +} + +/* + * This sets the box attribute of the itemlist widget. + */ +void setCDKItemlistBox (CDKITEMLIST *itemlist, boolean Box) +{ + ObjOf (itemlist)->box = Box; + ObjOf (itemlist)->borderSize = Box ? 1 : 0; +} +boolean getCDKItemlistBox (CDKITEMLIST *itemlist) +{ + return ObjOf (itemlist)->box; +} + +static void _focusCDKItemlist (CDKOBJS *object) +{ + CDKITEMLIST *itemlist = (CDKITEMLIST *)object; + + drawCDKItemlistField (itemlist, TRUE); +} + +static void _unfocusCDKItemlist (CDKOBJS *object) +{ + CDKITEMLIST *itemlist = (CDKITEMLIST *)object; + + drawCDKItemlistField (itemlist, FALSE); +} + +#if 0 +static void _refreshDataCDKItemlist (CDKOBJS *object) +{ + CDKITEMLIST *itemlist = (CDKITEMLIST *)object; + + if (ReturnOf (itemlist)) + { + switch (DataTypeOf (itemlist)) + { + default: + case DataTypeInt: + itemlist->currentItem = *((int *)ReturnOf (itemlist)); + break; + case DataTypeDouble: + itemlist->currentItem = *((double *)ReturnOf (itemlist)); + break; + case DataTypeFloat: + itemlist->currentItem = *((float *)ReturnOf (itemlist)); + break; + case DataTypeString: + { + int i; + + for (i = 0; i < itemlist->listSize; ++i) + if (!cmpStrChstr ((char *)ReturnOf (itemlist), itemlist->item[i])) + { + itemlist->currentItem = i; + break; + } + itemlist->currentItem = itemlist->defaultItem; + break; + } + } + drawCDKItemlistField (itemlist, FALSE); + } +} + +static void _saveDataCDKItemlist (CDKOBJS *object) +{ + CDKITEMLIST *itemlist = (CDKITEMLIST *)object; + + if (ReturnOf (itemlist)) + { + switch (DataTypeOf (itemlist)) + { + default: + case DataTypeInt: + *((int *)ReturnOf (itemlist)) = itemlist->currentItem; + break; + case DataTypeFloat: + *((float *)ReturnOf (itemlist)) = itemlist->currentItem; + break; + case DataTypeDouble: + *((double *)ReturnOf (itemlist)) = itemlist->currentItem; + break; + case DataTypeString: + chstrncpy ((char *)ReturnOf (itemlist), + itemlist->item[itemlist->currentItem], + 9999); + break; + } + } +} +#else +dummyRefreshData (Itemlist) +dummySaveData (Itemlist) +#endif + +static int createList (CDKITEMLIST *itemlist, CDK_CSTRING2 item, int count) +{ + int status = 0; + + if (count >= 0) + { + chtype **newItems = typeCallocN (chtype *, count + 1); + int *newPos = typeCallocN (int, count + 1); + int *newLen = typeCallocN (int, count + 1); + + if (newItems != 0 + && newPos != 0 + && newLen != 0) + { + int fieldWidth = 0; + int x; + + /* Go through the list and determine the widest item. */ + status = 1; + for (x = 0; x < count; x++) + { + /* Copy the item to the list. */ + newItems[x] = char2Chtype (item[x], &newLen[x], &newPos[x]); + if (newItems[x] == 0) + { + status = 0; + break; + } + fieldWidth = MAXIMUM (fieldWidth, newLen[x]); + } + + /* Now we need to justify the strings. */ + for (x = 0; x < count; x++) + { + newPos[x] = justifyString (fieldWidth + 1, newLen[x], newPos[x]); + } + } + + if (status) + { + destroyInfo (itemlist); + + /* *INDENT-EQLS* Copy in the new information. */ + itemlist->listSize = count; + itemlist->item = newItems; + itemlist->itemPos = newPos; + itemlist->itemLen = newLen; + } + else + { + CDKfreeChtypes (newItems); + freeChecked (newPos); + freeChecked (newLen); + } + } + else + { + destroyInfo (itemlist); + status = TRUE; + } + + return status; +} + +/* Go through the list and determine the widest item. */ +static int maximumFieldWidth (CDKITEMLIST *itemlist) +{ + int x; + int maxWidth = INT_MIN; + + for (x = 0; x < itemlist->listSize; x++) + { + maxWidth = MAXIMUM (maxWidth, itemlist->itemLen[x]); + } + maxWidth = MAXIMUM (maxWidth, 0); + + return maxWidth; +} + +static void updateFieldWidth (CDKITEMLIST *itemlist) +{ + int want = maximumFieldWidth (itemlist) + 1; + int have = itemlist->boxWidth - itemlist->labelLen - 2 * BorderOf (itemlist); + itemlist->fieldWidth = MINIMUM (want, have); +} + +/* Make the field window */ +static int createFieldWin (CDKITEMLIST *itemlist, int ypos, int xpos) +{ + itemlist->fieldWin = subwin (itemlist->win, + 1, + itemlist->fieldWidth, + ypos, + xpos); + if (itemlist->fieldWin != 0) + { + keypad (itemlist->fieldWin, TRUE); + ObjOf (itemlist)->inputWindow = itemlist->fieldWin; + return 1; + } + return 0; +} diff --git a/deps/cdk-5.0-20161210/label.c b/deps/cdk-5.0-20161210/label.c new file mode 100644 index 0000000..d3a9f70 --- /dev/null +++ b/deps/cdk-5.0-20161210/label.c @@ -0,0 +1,355 @@ +#include + +/* + * $Author: tom $ + * $Date: 2014/11/06 10:06:46 $ + * $Revision: 1.91 $ + */ + +DeclareCDKObjects (LABEL, Label, setCdk, Unknown); + +/* + * This creates a label widget. + */ +CDKLABEL *newCDKLabel (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + CDK_CSTRING2 mesg, + int rows, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKLABEL *label = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth = INT_MIN; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int x = 0; + + if (rows <= 0 + || (label = newCDKObject (CDKLABEL, &my_funcs)) == 0 + || (label->info = typeCallocN (chtype *, rows + 1)) == 0 + || (label->infoLen = typeCallocN (int, rows + 1)) == 0 + || (label->infoPos = typeCallocN (int, rows + 1)) == 0) + { + destroyCDKObject (label); + return (0); + } + + setCDKLabelBox (label, Box); + boxHeight = rows + 2 * BorderOf (label); + + /* Determine the box width. */ + for (x = 0; x < rows; x++) + { + /* Translate the char * to a chtype. */ + label->info[x] = char2Chtype (mesg[x], + &label->infoLen[x], + &label->infoPos[x]); + boxWidth = MAXIMUM (boxWidth, label->infoLen[x]); + } + boxWidth += 2 * BorderOf (label); + + /* Create the string alignments. */ + for (x = 0; x < rows; x++) + { + label->infoPos[x] = justifyString (boxWidth - 2 * BorderOf (label), + label->infoLen[x], + label->infoPos[x]); + } + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* *INDENT-EQLS* Create the label. */ + ScreenOf (label) = cdkscreen; + label->parent = cdkscreen->window; + label->win = newwin (boxHeight, boxWidth, ypos, xpos); + label->shadowWin = 0; + label->xpos = xpos; + label->ypos = ypos; + label->rows = rows; + label->boxWidth = boxWidth; + label->boxHeight = boxHeight; + ObjOf (label)->inputWindow = label->win; + ObjOf (label)->hasFocus = FALSE; + label->shadow = shadow; + + /* Is the window null? */ + if (label->win == 0) + { + destroyCDKObject (label); + return (0); + } + keypad (label->win, TRUE); + + /* If a shadow was requested, then create the shadow window. */ + if (shadow) + { + label->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Register this baby. */ + registerCDKObject (cdkscreen, vLABEL, label); + + /* Return the label pointer. */ + return (label); +} + +/* + * This was added for the builder. + */ +void activateCDKLabel (CDKLABEL *label, chtype *actions GCC_UNUSED) +{ + drawCDKLabel (label, ObjOf (label)->box); +} + +/* + * This sets multiple attributes of the widget. + */ +void setCDKLabel (CDKLABEL *label, CDK_CSTRING2 mesg, int lines, boolean Box) +{ + setCDKLabelMessage (label, mesg, lines); + setCDKLabelBox (label, Box); +} + +/* + * This sets the information within the label. + */ +void setCDKLabelMessage (CDKLABEL *label, CDK_CSTRING2 info, int infoSize) +{ + int x; + int limit; + + /* Clean out the old message. */ + for (x = 0; x < label->rows; x++) + { + freeChtype (label->info[x]); + label->info[x] = 0; + label->infoPos[x] = 0; + label->infoLen[x] = 0; + } + + /* update the label's length - but taking into account its window size */ + limit = label->boxHeight - (2 * BorderOf (label)); + if (infoSize > limit) + infoSize = limit; + label->rows = infoSize; + + /* Copy in the new message. */ + for (x = 0; x < label->rows; x++) + { + label->info[x] = char2Chtype (info[x], + &label->infoLen[x], + &label->infoPos[x]); + label->infoPos[x] = justifyString (label->boxWidth - 2 * BorderOf (label), + label->infoLen[x], + label->infoPos[x]); + } + + /* Redraw the label widget. */ + eraseCDKLabel (label); + drawCDKLabel (label, ObjOf (label)->box); +} +chtype **getCDKLabelMessage (CDKLABEL *label, int *size) +{ + (*size) = label->rows; + return label->info; +} + +/* + * This sets the box flag for the label widget. + */ +void setCDKLabelBox (CDKLABEL *label, boolean Box) +{ + ObjOf (label)->box = Box; + ObjOf (label)->borderSize = Box ? 1 : 0; +} +boolean getCDKLabelBox (CDKLABEL *label) +{ + return ObjOf (label)->box; +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrLabel (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKLABEL *widget = (CDKLABEL *)object; + + wbkgd (widget->win, attrib); + } +} + +/* + * This draws the label widget. + */ +static void _drawCDKLabel (CDKOBJS *object, boolean Box GCC_UNUSED) +{ + CDKLABEL *label = (CDKLABEL *)object; + int x = 0; + + /* Is there a shadow? */ + if (label->shadowWin != 0) + { + drawShadow (label->shadowWin); + } + + /* Box the widget if asked. */ + if (ObjOf (label)->box) + { + drawObjBox (label->win, ObjOf (label)); + } + + /* Draw in the message. */ + for (x = 0; x < label->rows; x++) + { + writeChtype (label->win, + label->infoPos[x] + BorderOf (label), + x + BorderOf (label), + label->info[x], + HORIZONTAL, + 0, + label->infoLen[x]); + } + + /* Refresh the window. */ + wrefresh (label->win); +} + +/* + * This erases the label widget. + */ +static void _eraseCDKLabel (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKLABEL *label = (CDKLABEL *)object; + + eraseCursesWindow (label->win); + eraseCursesWindow (label->shadowWin); + } +} + +/* + * This moves the label field to the given location. + */ +static void _moveCDKLabel (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKLABEL *label = (CDKLABEL *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (label->win); + int currentY = getbegy (label->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (label->win) + xplace; + ypos = getbegy (label->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (label), &xpos, &ypos, label->boxWidth, label->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (label->win, -xdiff, -ydiff); + moveCursesWindow (label->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (label)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKLabel (label, ObjOf (label)->box); + } +} + +/* + * This destroys the label object pointer. + */ +static void _destroyCDKLabel (CDKOBJS *object) +{ + if (object != 0) + { + CDKLABEL *label = (CDKLABEL *)object; + + CDKfreeChtypes (label->info); + freeChecked (label->infoLen); + freeChecked (label->infoPos); + + /* Free up the window pointers. */ + deleteCursesWindow (label->shadowWin); + deleteCursesWindow (label->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vLABEL, label); + + /* Unregister the object. */ + unregisterCDKObject (vLABEL, label); + } +} + +/* + * This pauses until a user hits a key... + */ +char waitCDKLabel (CDKLABEL *label, char key) +{ + int code; + boolean functionKey; + + /* If the key is null, we'll accept anything. */ + if (key == 0) + { + code = getchCDKObject (ObjOf (label), &functionKey); + } + else + { + /* Only exit when a specific key is hit. */ + for (;;) + { + code = getchCDKObject (ObjOf (label), &functionKey); + if (code == key) + { + break; + } + } + } + return (char)(code); +} + +dummyInject (Label) + +dummyFocus (Label) + +dummyUnfocus (Label) + +dummyRefreshData (Label) + +dummySaveData (Label) diff --git a/deps/cdk-5.0-20161210/man/cdk.3 b/deps/cdk-5.0-20161210/man/cdk.3 new file mode 100644 index 0000000..e63f390 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk.3 @@ -0,0 +1,193 @@ +'\" t +.\" $Id: cdk.3,v 1.14 2012/03/23 11:39:19 tom Exp $ +.de It +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.TH Cdk 3 +.SH NAME +cdk - \fBCurses Development Kit\fR +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.LP +Cdk provides functions to use a large number of predefined curses widgets. +To use the Cdk widgets the header file \fIcdk.h\fR must be included in the source. +.LP +The widgets available from Cdk are listed below. +.LP +.TS +center tab(/); +l l +l l . +\fBWidget Type/Manual Page Name\fR += +Alphalist/cdk_alphalist (3) +Button/cdk_button (3) +Buttonbox/cdk_buttonbox (3) +Calendar/cdk_calendar (3) +Dialog/cdk_dialog (3) +DoubleFloat Scale/cdk_dscale (3) +Entry Field/cdk_entry (3) +File Selector/cdk_fselect (3) +File Viewer/cdk_viewer (3) +Floating Scale/cdk_fscale (3) +Floating Slider/cdk_fslider (3) +Graph/cdk_graph (3) +Histogram/cdk_histogram (3) +Integer Scale/cdk_scale (3) +Integer Slider/cdk_slider (3) +Item List/cdk_itemlist (3) +Label/cdk_label (3) +Marquee/cdk_marquee (3) +Matrix/cdk_matrix (3) +Multiple Line Entry Field/cdk_mentry (3) +Pulldown Menu/cdk_menu (3) +Radio List/cdk_radio (3) +Scrolling List/cdk_scroll (3) +Scrolling Selection List/cdk_selection (3) +Scrolling Window/cdk_swindow (3) +Template/cdk_template (3) +Unsigned Scale/cdk_uscale (3) +Unsigned Slider/cdk_uslider (3) +.TE +.LP +The rest of the manual pages describe supporting functions: +.LP +.TS +center tab(/); +l l +l l +lw18 lw35 . +\fBManual Page Name/Description\fR += +cdk_binding (3)/T{ +Outlines how to create user definable key bindings. +T} +cdk_display (3)/T{ +Shows how to add special display attributes, +colors, and justification into a widget. +T} +cdk_draw (3)/T{ +Outlines functions used for drawing text and lines. +T} +cdk_screen (3)/T{ +Demonstrates the use of screens within Cdk. +T} +cdk_misc (3)/T{ +Outlines miscellaneous functions provided with the Cdk library. +T} +cdk_process (3)/T{ +Demonstrates the use of the pre- and post-process function class. +T} +.TE +.SH DESCRIPTION +Cdk is a library of functions which allow a programmer to quickly create a +full screen interactive program with ease. +The Cdk widgets support the +following features: +.It "\(bu Ncurses library." 5 +Instead of using the standard curses library, Cdk can take advantage of the +colors that Ncurses provides. +To learn how to take advantage of Cdk's color +capabilities, see \fIcdk_display (3)\fR. +.PP +.It "\(bu Key Bindings." 5 +Individual keys can be overridden with a callback. +The callback is set up using +the \fBbindCDKObject\fR function. +To learn more about this see \fIcdk_binding (3)\fR. +.PP +.It "\(bu Pre and Post Processing." 5 +Certain widgets allow the user to trap a character before and after the +character has been applied to the widget. +This allows programmers to `filter' character input. +To learn more about this see \fIcdk_process (3)\fR. +.PP +.It "\(bu Self Test Widgets." 5 +With the use of the inject function class and the activate function, +programmers can have the widgets test themselves. +This allows the programmer +to perform automated tests on a final program. +.PP +.It "\(bu Special Display Formats" 5 +There are special character format commands that can be inserted into any +string in Cdk and the contents will get mapped to a \fIchtype\fR (see the +curses manual page) with character attributes. +This allows the programmer to +insert format types on each character if they wish. +.PP +.It "\(bu The Ability To Build Predefined Screens" 5 +Widgets can be associated to any given screen. +If there is more than one +screen defined, then Cdk has the ability to "flip" from one screen to another +with ease. +See the \fIcdk_screen\fR manual page for more details. +.PP +.SH STANDARD WIDGET BEHAVIOR +All of the widgets have a member of the structure called \fIexitType\fR. +This member states how the widget exited. +There are three values in which to check +for, they are as follows: +.LP +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBValue/Meaning\fR += +vNORMAL/T{ +This means the widget exited normally. +This value is set when the widget is given the characters TAB or RETURN. +T} +vEARLY_EXIT/T{ +This means the widget exited early. +This value is set when characters such as +TAB or RETURN are injected into the +widget via the injectCDKXXX function and the +character injected does not exit the widget. +T} +vERROR/T{ +This value states that an error was returned by curses, e.g., if the +terminal was disconnected. +T} +vESCAPE_HIT/T{ +This value states the user hit ESCAPE to leave the widget. +T} +vNEVER_ACTIVATED/T{ +This is the initial state of the value. +This means that the widget has not been activated. +T} +.TE +.SH SEE ALSO +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_draw (3), +.BR cdk_misc (3), +.BR cdk_process (3), +.BR cdk_screen (3) +. +.SH NOTES +.PP +The header file \fI\fR automatically includes the header files +\fI\fR, +\fI\fR, +\fI\fR, +\fI\fR, +\fI\fR, +\fI\fR, +\fI\fR, +\fI\fR, +\fI\fR, +\fI\fR, +\fI\fR, and +\fI\fR. +The \fI\fR header file includes \fI\fR and \fI\fR. diff --git a/deps/cdk-5.0-20161210/man/cdk_alphalist.3 b/deps/cdk-5.0-20161210/man/cdk_alphalist.3 new file mode 100644 index 0000000..658de79 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_alphalist.3 @@ -0,0 +1,515 @@ +'\" t +.\" $Id: cdk_alphalist.3,v 1.28 2016/12/11 01:59:33 tom Exp $" +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_alphalist 3 +.SH NAME +.XX activateCDKAlphalist +.XX destroyCDKAlphalist +.XX drawCDKAlphalist +.XX eraseCDKAlphalist +.XX getCDKAlphalistBox +.XX getCDKAlphalistContents +.XX getCDKAlphalistCurrentItem +.XX getCDKAlphalistFillerChar +.XX getCDKAlphalistHighlight +.XX injectCDKAlphalist +.XX moveCDKAlphalist +.XX newCDKAlphalist +.XX positionCDKAlphalist +.XX setCDKAlphalist +.XX setCDKAlphalistBackgroundAttrib +.XX setCDKAlphalistBackgroundColor +.XX setCDKAlphalistBox +.XX setCDKAlphalistBoxAttribute +.XX setCDKAlphalistContents +.XX setCDKAlphalistCurrentItem +.XX setCDKAlphalistFillerChar +.XX setCDKAlphalistHighlight +.XX setCDKAlphalistHorizontalChar +.XX setCDKAlphalistLLChar +.XX setCDKAlphalistLRChar +.XX setCDKAlphalistPostProcess +.XX setCDKAlphalistPreProcess +.XX setCDKAlphalistULChar +.XX setCDKAlphalistURChar +.XX setCDKAlphalistVerticalChar +cdk_alphalist \- curses sorted list widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "char *activateCDKAlphalist (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype *" "actions"); +.TP 15 +.B "void destroyCDKAlphalist (" +.BI "CDKALPHALIST *" "alphalist"); +.TP 15 +.B "void drawCDKAlphalist (" +.BI "CDKALPHALIST *" "alphalist", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKAlphalist (" +.BI "CDKALPHALIST *" "alphalist"); +.TP 15 +.B "boolean getCDKAlphalistBox (" +.BI "CDKALPHALIST *" "alphalist"); +.TP 15 +.B "char **getCDKAlphalistContents (" +.BI "CDKALPHALIST *" "alphalist", +.BI "int *" "size"); +.TP 15 +.B "int getCDKAlphalistCurrentItem (" +.BI "CDKALPHALIST *" "widget"); +.TP 15 +.B "chtype getCDKAlphalistFillerChar (" +.BI "CDKALPHALIST *" "alphalist"); +.TP 15 +.B "chtype getCDKAlphalistHighlight (" +.BI "CDKALPHALIST *" "alphalist"); +.TP 15 +.B "char *injectCDKAlphalist (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKAlphalist (" +.BI "CDKALPHALIST *" "alphalist", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKALPHALIST *newCDKAlphalist (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "height", +.BI "int " "width", +.BI "const char * " "title", +.BI "const char * " "label", +.BI "CDK_CONST char ** " "list", +.BI "int " "listSize", +.BI "chtype " "fillerCharacter", +.BI "chtype " "highlight", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKAlphalist (" +.BI "CDKALPHALIST *" "alphalist"); +.TP 15 +.B "void setCDKAlphalist (" +.BI "CDKALPHALIST *" "alphalist", +.BI "CDK_CONST char ** " "list", +.BI "int " "listSize", +.BI "chtype " "fillerCharacter", +.BI "chtype " "highlight", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKAlphalistBackgroundAttrib (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKAlphalistBackgroundColor (" +.BI "CDKALPHALIST *" "alphalist", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKAlphalistBox (" +.BI "CDKALPHALIST *" "alphalist", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKAlphalistBoxAttribute (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKAlphalistContents (" +.BI "CDKALPHALIST *" "alphalist", +.BI "CDK_CONST char ** " "list", +.BI "int " "listSize"); +.TP 15 +.B "void setCDKAlphalistCurrentItem (" +.BI "CDKALPHALIST *" "widget", +.BI "int " "item"); +.TP 15 +.B "void setCDKAlphalistFillerChar (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "fillerCharacter"); +.TP 15 +.B "void setCDKAlphalistHighlight (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKAlphalistHorizontalChar (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKAlphalistLLChar (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKAlphalistLRChar (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKAlphalistPostProcess (" +.BI "CDKALPHALIST *" "alphalist", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKAlphalistPreProcess (" +.BI "CDKALPHALIST *" "alphalist", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKAlphalistULChar (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKAlphalistURChar (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKAlphalistVerticalChar (" +.BI "CDKALPHALIST *" "alphalist", +.BI "chtype " "character"); +.SH DESCRIPTION +The Cdk alphalist allows a user to select from a list of alphabetically +sorted words. +The user can use the arrow keys to traverse through the +list or type in the beginning of the word and the list will automatically +adjust itself in the correct place in the scrolling list. +This widget, +like the file selector widget, is a compound widget of both the entry +field widget and the scrolling list widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKAlphalist +activates the alphalist widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBalphalist\fR is a pointer to a non-NULL alphalist widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the +characters in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR then this function will return a \fIchar *\fR +of the information which was typed in the field. +.IP +If the \fITAB\fR character is hit +then the widget will try to complete the word in the entry field. +.IP +If the widget +is exited with the \fIRETURN\fR character then the widget data \fIexitType\fR +will be set to \fIvNORMAL\fR. +.IP +If the widget was exited with the \fIESCAPE\fR key +then the widget data \fIexitType\fR will be set to \fIvESCAPE_HIT\fR and +the widget returns \fINULL\fR. +.TP 5 +.B destroyCDKAlphalist +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKAlphalist +draws the alphalist widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKAlphalist +removes the widget from the screen. +This does \fINOT\fR destroy +the widget. +.TP 5 +.B getCDKAlphalistBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKAlphalistContents +returns the contents of the alphalist. +.TP 5 +.B getCDKAlphalistCurrentItem +returns the current position in the scroll-widget. +.TP 5 +.B getCDKAlphalistFillerChar +returns the character being used as the filler character in the +entry field portion of the widget. +.TP 5 +.B getCDKAlphalistHighlight +returns the attribute of the highlight bar of the scrolling +list portion of the widget. +.TP 5 +.B injectCDKAlphalist +injects a single character into the widget (actually the entry widget). +.RS +.bP +The parameter \fBalphalist\fR is a pointer to a non-NULL alphalist widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +the information in the entry field. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKAlphalist +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +The final parameter \fBrefresh\fR is a boolean value +which states whether the widget will get refreshed after the move. +.TP 5 +.B newCDKAlphalist +creates a pointer to an alphalist widget. +Parameters: +.RS +.bP +\fBscreen\fR +is the screen you wish this widget to be placed in. +.bP +\fBxpos\fR +controls the placement of the object along the horizontal axis. +This parameter +can take an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +\fBypos\fR +controls the placement +of the object along the vertical axis. +This parameter may be an integer +value or one of the pre-defined values \fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +\fBheight\fR and +\fBwidth\fR +control the height and width of the widget. +If you provide a value of zero for either of the height +or the width, the widget will be created with the full width and height of the screen. +If you provide a negative value, the widget will be created the full height +or width minus the value provided. +.bP +\fBtitle\fR +is the string which will be displayed at the top of the scrolling list. +The title can be more than one +line; just provide a carriage return character at the line break. +.bP +\fBlabel\fR +is the string which will be displayed in the label of the entry field. +.bP +\fBlist\fR +is the list of words which will be displayed in the +scrolling list. +This list does not have to be sorted, this widget automatically +sorts the list +(note that it modifies the caller's copy of the list to do this). +.bP +\fBlistSize\fR +tells the widget how large the word list is. +.bP +\fBfillerCharacter\fR +is the character which is to be displayed in an empty space in the entry field. +.bP +\fBhighlight\fR +is the attribute of the highlight bar in the scrolling list. +.bP +\fBbox\fR +is true if the widget should be drawn with a box around it. +.bP +\fBshadow\fR +is true to turn the shadow on around this widget. +.RE +.IP +If the +widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKAlphalist +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKAlphalist +lets the programmer modify certain elements of an existing alphalist widget. +.IP +The parameter names correspond to the same parameter +names listed in the \fBnewCDKAlphalist\fR function. +.TP 5 +.B setCDKAlphalistBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKAlphalistBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKAlphalistBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKAlphalistBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKAlphalistContents +sets the contents of the alphalist widget +(note that it sorts the caller's copy of the list). +.TP 5 +.B setCDKAlphalistCurrentItem +set the current position in the scroll-widget. +.TP 5 +.B setCDKAlphalistFillerChar +sets the character to use when drawing the entry field portion of the widget. +.TP 5 +.B setCDKAlphalistHighlight +sets the attribute of the highlight bar of the scrolling +list portion of the widget. +.TP 5 +.B setCDKAlphalistHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKAlphalistLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKAlphalistLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKAlphalistPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKAlphalistPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKAlphalistULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKAlphalistURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKAlphalistVerticalChar +sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +Since this widget is +built from both the scrolling list widget and the entry field widget, the key +bindings are the same for the respective fields. +The extra key bindings are +listed below. +.LP +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +Up Arrow/T{ +Scrolls the scrolling list up one line. +T} +Down Arrow/T{ +Scrolls the scrolling list down one line. +T} +Page Up/T{ +Scrolls the scrolling list up one page. +T} +CTRL-B/T{ +Scrolls the scrolling list up one page. +Page Down/Scrolls the scrolling list down one page. +T} +CTRL-F/T{ +Scrolls the scrolling list down one page. +T} +Tab/T{ +Tries to complete the word in the entry field. +If the word segment is not unique then the +widget will beep and present a list of close matches. +T} +Return/T{ +Returns the word in the entry field. +It also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns a \fINULL\fR pointer. +It also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) +.SH NOTES +.PP +This widget is created from the scrolling list widget and the entry field widget. +This is a good example on how to build your own widgets using the +base widgets provided in this distribution. diff --git a/deps/cdk-5.0-20161210/man/cdk_binding.3 b/deps/cdk-5.0-20161210/man/cdk_binding.3 new file mode 100644 index 0000000..993e4a9 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_binding.3 @@ -0,0 +1,336 @@ +'\" t +.\" $Id: cdk_binding.3,v 1.25 2016/12/04 15:53:30 tom Exp $ +.de XX +.. +.TH cdk_binding 3 +.SH NAME +.XX bindCDKObject +.XX checkCDKObjectBind +.XX cleanCDKObjectBindings +.XX unbindCDKObject +.XX getcCDKObject +.XX getchCDKObject +cdk_binding - \fBCurses Development Kit\fR Character Binding Capabilities. +.LP +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +.nf +#include +.TP 15 +.B "void bindCDKObject (" +.BI "EObjectType " "cdkType", +.BI "void *" "object", +.BI "chtype " "key", +.BI "BINDFN " "function", +.BI "void *" "data"); +.TP 15 +.B "int checkCDKObjectBind (" +.BI "EObjectType " "cdkType", +.BI "void *" "object", +.BI "chtype " "key"); +.TP 15 +.B "void cleanCDKObjectBindings (" +.BI "EObjectType " "cdkType", +.BI "void *" "object"); +.TP 15 +.B "bool isCDKObjectBind (" +.BI "EObjectType " "cdkType", +.BI "void *" "object", +.BI "chtype " "key"); +.TP 15 +.B "void unbindCDKObject (" +.BI "EObjectType " "cdkType", +.BI "void *" "object", +.BI "chtype " "key"); +.TP 15 +.B "int getcCDKObject (" +.BI "CDKOBJS *" "object"); +.TP 15 +.B "int getchCDKObject (" +.BI "CDKOBJS *" "object", +.BI "boolean *" "functionKey"); +.fi +.SH DESCRIPTION +Cdk has the ability to create user definable key bindings. +This ability makes +Cdk more dynamic and usable for a wide variety of tasks. +The following section +outlines the binding functions, their use, and their purpose. +.TP 5 +.B bindCDKObject +creates a key binding between a specific Cdk widget (\fBobject\fR) +given key (\fBkey\fR). +The parameter \fBcdkType\fR is of type \fIEObjectType\fR +which is one of the following values. +.LP +.TS +center tab(/); +l +l l +lw10 lw20 lw 20 . +\fBEObjectType_Value/Corresponding_Widget/Widget_Manual_Page\fP += +vALPHALIST/Alphalist Widget/cdk_alphalist (3) +vBUTTON/Button Widget/cdk_button (3) +vBUTTONBOX/Buttonbox Widget/cdk_buttonbox (3) +vCALENDAR/Calendar Widget/cdk_calendar (3) +vDIALOG/Dialog Widget/cdk_dialog (3) +vDSCALE/DoubleFloat Widget/cdk_dscale (3) +vENTRY/Entry Widget/cdk_entry (3) +vFSCALE/Floating Scale Widget/cdk_fscale (3) +vFSELECT/File Selector Widget/cdk_fselect (3) +vFSLIDER/Floating Slider Widget/cdk_fslider (3) +vGRAPH/Graph Widget/cdk_graph (3) +vHISTOGRAM/Histogram Widget/cdk_histogram (3) +vITEMLIST/Item List Widget/cdk_itemlist (3) +vLABEL/Label Widget/cdk_label (3) +vMARQUEE/Marquee Widget/cdk_marquee (3) +vMATRIX/Matrix Widget/cdk_matrix (3) +vMENTRY/Multiple Line Entry Widget/cdk_mentry (3) +vMENU/Menu Widget/cdk_menu (3) +vRADIO/Radio List Widget/cdk_radio (3) +vSCALE/Integer Scale Widget/cdk_scale (3) +vSCROLL/Scrolling List Widget/cdk_scroll (3) +vSELECTION/Selection List Widget/cdk_selection (3) +vSLIDER/Slider Widget/cdk_slider (3) +vSWINDOW/Scrolling Window Widget/cdk_swindow (3) +vTEMPLATE/Template Entry Widget/cdk_template (3) +vUSCALE/Unsigned Scale Widget/cdk_uscale (3) +vUSLIDER/Unsigned Slider Widget/cdk_uslider (3) +vVIEWER/Viewer Widget/cdk_viewer (3) += +.TE +.RS 3 +The parameter \fBfunction\fR is the callback function. +The parameter \fBdata\fR points to data passed to the callback function. +The parameter \fBkey\fR is the key hit which triggered this callback. +.RE +.TP 5 +.B checkCDKObjectBind +check to see if a binding for the given \fBkey\fP exists. +If it does, +Cdk runs the associated command and returns its value, +normally TRUE. +If no binding exists, return FALSE. +.IP +The widgets which accept input, e.g., via "inject" methods, +use this to check if the injected character is bound to a function. +If that returns TRUE, the widget may update its \fIexitType\fP value: +if \fIearlyExit\fP value is set +(not equal to vNEVER_ACTIVATED), +the widget sets \fIexitType\fP to that value. +.TP 5 +.B cleanCDKObjectBindings +removes all user defined key bindings from the given widget. +.TP 5 +.B isCDKObjectBind +check to see if a binding for the given \fBkey\fP exists. +If it does return TRUE. +If no binding exists, return FALSE. +.TP 5 +.B unbindCDKObject +removes a specific binding to an object. +The parameter are +the same as for \fBbindCDKObject\fR. +.TP 5 +.B getcCDKObject +reads a keycode from the given widget. +This is depcrecated: use \fBgetchCDKObject\fP. +.TP 5 +.B getchCDKObject +reads a keycode from the given widget. +It sets a flag to indicate if the result is a function key. +If the keycode has been bound to the special function \fBgetcCDKBind\fP, +then it will be translated to the value which was given for the binding data. +Otherwise, a few special cases are performed: +.TS +center tab(/) box; +l l +lw25 lw25 . +\fBKey/Result\fR += +CTRL-A/KEY_HOME +CTRL-B/KEY_LEFT +CTRL-E/KEY_END +CTRL-F/KEY_RIGHT +CTRL-N/tab +CTRL-P/KEY_BTAB +DEL/KEY_DC +backspace/KEY_BACKSPACE +carriage return/KEY_ENTER +newline/KEY_ENTER +.TE +.PP +All of the widgets use \fBgetchCDKObject\fP internally for consistency. +.SH EXAMPLE +To help demonstrate how to use the key bindings I will demonstrate a simple +dialog box widget with help for each button. +The following code segment creates +a dialog box and a callback function named \fIdialogHelpCB\fR. +.LP +.nf +.ce +\fI________________________________________\fR +.LP +.ta 9 17 25 33 41 +#include + +#ifdef HAVE_XCURSES +char *XCursesProgramName="bind_ex"; +#endif + +static int dialogHelpCB (EObjectType cdktype GCC_UNUSED, void *object, void *clientData GCC_UNUSED, chtype key GCC_UNUSED) +{ + CDKDIALOG *dialog = (CDKDIALOG *)object; + char *mesg[5]; + + /* Check which button we are on. */ + if (dialog->currentButton == 0) + { + mesg[0] = "Help for Who."; + mesg[1] = "When this button is picked the name of the current"; + mesg[2] = "user is displayed on the screen in a popup window."; + popupLabel (ScreenOf(dialog), mesg, 3); + } + else if (dialog->currentButton == 1) + { + mesg[0] = "Help for Time."; + mesg[1] = "When this button is picked the current time is"; + mesg[2] = "displayed on the screen in a popup window."; + popupLabel (ScreenOf(dialog), mesg, 3); + } + else if (dialog->currentButton == 2) + { + mesg[0] = "Help for Date."; + mesg[1] = "When this button is picked the current date is"; + mesg[2] = "displayed on the screen in a popup window."; + popupLabel (ScreenOf(dialog), mesg, 3); + } + else if (dialog->currentButton == 3) + { + mesg[0] = "Help for Quit."; + mesg[1] = "When this button is picked the dialog box is exited."; + popupLabel (ScreenOf(dialog), mesg, 2); + } + return (FALSE); +} + +int main (void) +{ + /* Declare variables. */ + CDKSCREEN *cdkscreen; + CDKDIALOG *question; + char *buttons[40]; + char *message[40], *info[5], *loginName; + char temp[256]; + int selection; + time_t clck; + struct tm *currentTime; + + cdkscreen = initCDKScreen (NULL); + + /* Start color. */ + initCDKColor(); + + /* Set up the dialog box. */ + message[0] = "Simple Command Interface"; + message[1] = "Pick the command you wish to run."; + message[2] = "Press ? for help."; + buttons[0] = "Who"; + buttons[1] = "Time"; + buttons[2] = "Date"; + buttons[3] = "Quit"; + + /* Create the dialog box. */ + question = newCDKDialog (cdkscreen, CENTER, CENTER, + message, 3, buttons, 4, A_REVERSE, + TRUE, TRUE, FALSE); + + /* Check if we got a null value back. */ + if (question == (CDKDIALOG *)0) + { + destroyCDKScreen (cdkscreen); + + /* End curses... */ + endCDK(); + + /* Spit out a message. */ + printf ("Oops. Can't seem to create the dialog box. Is the window too small?\\n"); + exit (1); + } + + /* Create the key binding. */ + bindCDKObject (vDIALOG, question, '?', dialogHelpCB, 0); + + /* Activate the dialog box. */ + selection = 0; + while (selection != 3) + { + /* Get the users button selection. */ + selection = activateCDKDialog (question, (chtype *)0); + + /* Check the results. */ + if (selection == 0) + { + /* Get the users login name. */ + info[0] = " Login Name "; + loginName = getlogin(); + if (loginName == (char *)0) + { + strcpy (temp, "Unknown"); + } + else + { + sprintf (temp, "<%s>", loginName); + } + info[1] = copyChar (temp); + popupLabel (ScreenOf(question), info, 2); + freeChar (info[1]); + } + else if (selection == 1) + { + /* Print out the time. */ + time(&clck); + currentTime = localtime(&clck); + sprintf (temp, "%d:%d:%d", currentTime->tm_hour, + currentTime->tm_min, + currentTime->tm_sec); + info[0] = " Current Time "; + info[1] = copyChar (temp); + popupLabel (ScreenOf(question), info, 2); + freeChar (info[1]); + } + else if (selection == 2) + { + /* Print out the date. */ + time(&clck); + currentTime = localtime(&clck); + sprintf (temp, "%d/%d/%02d", currentTime->tm_mday, + currentTime->tm_mon, + currentTime->tm_year % 100); + info[0] = " Current Date "; + info[1] = copyChar (temp); + popupLabel (ScreenOf(question), info, 2); + freeChar (info[1]); + } + } + + /* Clean up. */ + destroyCDKDialog (question); + destroyCDKScreen (cdkscreen); + endCDK(); + exit (0); +} +.fi +.ce +\fI________________________________________\fR + +.SH SEE ALSO +.BR cdk (3), +.BR cdk_display (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_button.3 b/deps/cdk-5.0-20161210/man/cdk_button.3 new file mode 100644 index 0000000..578f0ff --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_button.3 @@ -0,0 +1,348 @@ +'\" t +.\" $Id: cdk_button.3,v 1.11 2016/12/11 01:52:43 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_button 3 +.SH NAME +.XX activateCDKButton +.XX destroyCDKButton +.XX drawCDKButton +.XX eraseCDKButton +.XX getCDKButtonBox +.XX getCDKButtonMessage +.XX injectCDKButton +.XX moveCDKButton +.XX newCDKButton +.XX positionCDKButton +.XX setCDKButton +.XX setCDKButtonBackgroundAttrib +.XX setCDKButtonBackgroundColor +.XX setCDKButtonBox +.XX setCDKButtonBoxAttribute +.XX setCDKButtonHorizontalChar +.XX setCDKButtonLLChar +.XX setCDKButtonLRChar +.XX setCDKButtonMessage +.XX setCDKButtonULChar +.XX setCDKButtonURChar +.XX setCDKButtonVerticalChar +cdk_button \- create and manage a curses button widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include + +typedef void (*tButtonCallback)(struct SButton *button); +.nf +.TP 15 +.B "int activateCDKButton (" +.BI "CDKBUTTON *" "button", +.BI "chtype * " "actions"); +.TP 15 +.BI "void destroyCDKButton (" +.BI "CDKBUTTON *" "button"); +.TP 15 +.BI "void drawCDKButton (" +.BI "CDKBUTTON *" "b", +.BI "boolean " "box"); +.TP 15 +.BI "void eraseCDKButton (" +.BI "CDKBUTTON *" "button"); +.TP 15 +.BI "boolean getCDKButtonBox (" +.BI "CDKBUTTON *" "b"); +.TP 15 +.BI "chtype *getCDKButtonMessage (" +.BI "CDKBUTTON *" "b"); +.TP 15 +.B "int injectCDKButtonbox (" +.BI "CDKBUTTON *" "buttonbox", +.BI "chtype " "input"); +.TP 15 +.BI "CDKBUTTON *newCDKButton(" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "const char *" "message", +.BI "tButtonCallback " "callback", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.BI "void setCDKButton(" +.BI "CDKBUTTON *" "b", +.BI "const char *" "message", +.BI "boolean " "box"); +.TP 15 +.BI "void setCDKButtonBackgroundAttrib (" +.BI "CDKBUTTON *" "b", +.BI "chtype " "attribute"); +.TP 15 +.BI "void setCDKButtonBackgroundColor (" +.BI "CDKBUTTON *" "b", +.BI "const char * " "color"); +.TP 15 +.BI "void setCDKButtonBox (" +.BI "CDKBUTTON *" "button", +.BI "boolean " "box"); +.TP 15 +.BI "void setCDKButtonBoxAttribute (" +.BI "CDKBUTTON *" "b", +.BI "chtype " "c"); +.TP 15 +.BI "void setCDKButtonHorizontalChar (" +.BI "CDKBUTTON *" "b", +.BI "chtype " "c"); +.TP 15 +.BI "void setCDKButtonLLChar (" +.BI "CDKBUTTON *" "b", +.BI "chtype " "c"); +.TP 15 +.BI "void setCDKButtonLRChar (" +.BI "CDKBUTTON *" "b", +.BI "chtype " "c"); +.TP 15 +.BI "void setCDKButtonMessage (" +.BI "CDKBUTTON *" "b", +.BI "const char *" "message"); +.TP 15 +.BI "void setCDKButtonULChar (" +.BI "CDKBUTTON *" "b", +.BI "chtype " "c"); +.TP 15 +.BI "void setCDKButtonURChar (" +.BI "CDKBUTTON *" "b", +.BI "chtype " "c"); +.TP 15 +.BI "void setCDKButtonVerticalChar (" +.BI "CDKBUTTON *" "b", +.BI "chtype " "c"); +.TP 15 +.BI "void moveCDKButton(" +.BI "CDKBUTTON *" "b", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.BI "void positionCDKButton (" +.BI "CDKBUTTON *" "b"); +.TP 15 +.BI "void waitCDKButton (" +.BI "CDKBUTTON *" "button", +.BI "char " "key"); +.fi +.SH DESCRIPTION +The Cdk button widget displays a message string and executes a callback when +the user presses enter or space. +As such, it is only useful on a screen +that is being managed by some external screen traversal engine such as +\fBtraverseCDKScreen()\fR. +The button will be highlighted when the widget has the focus. +The following functions create or manipulate the Cdk button widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKButton +activates the button widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBbutton\fR is a pointer to a non-NULL button widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return a +value from 0 to the number of buttons -1, representing the button selected. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the +character entered into this widget was \fIESCAPE\fR then the widget will return +a value of -1 and the widget data \fIexitType\fR will be set to +\fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDKButton +removes the widget from the screen and frees up any memory the +object used. +.TP 5 +.B drawCDKButton +draws the button widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKButton +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKButtonBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKButtonMessage +returns the contents of the button widget. +.TP 5 +.B injectCDKButton +injects a single character into the widget. +.RS +.bP +The parameter \fBbutton\fR is a pointer to a non-NULL button widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +this function returns 0, representing the button selected. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKButton +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.IP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which states +whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKButton +creates a pointer to a buttonbox widget. +Parameters: +.RS +.bP +The \fBscreen\fR parameter +is the screen you wish this widget to be placed in. +.bP +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.bP +\fBypos\fR +controls the placement of the object along the vertical axis. +It be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +\fBmessage\fR +is the message to display in the button window, +formatted as described in \fIcdk_display\fR. +.bP +\fBcallback\fR +is an optional pointer to a callback function +that will be executed when the user activates the button by pressing space +or enter. +.bP +\fBbox\fR +is true if the widget should be drawn with a box around it. +.bP +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR +pointer is returned. +.TP 5 +.B positionCDKButton +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKButton +lets the programmer modify certain elements of an existing +buttonbox widget. +.IP +The parameter names correspond to the same parameter names listed +in the \fBnewCDKButton\fR function. +.TP 5 +.B setCDKButtonBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKButtonBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +(See \fIcdk_display\fR). +.TP 5 +.B setCDKButtonBox +sets true if the widget will be drawn with a box around it. +.TP 5 +.B setCDKButtonBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKButtonHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKButtonLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKButtonLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKButtonMessage +This sets the contents of the label widget. +.TP 5 +.B setCDKButtonULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKButtonURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKButtonVerticalChar +sets the vertical drawing character for the box to the given character. +.SH BUGS +Changing the Box attribute after the widget has been created probably +does not work right. +None of the positioning/movement code has been tested. +.SH AUTHOR +Grant Edwards, Aspen Research Corporation +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_process (3), +.BR cdk_screen (3), +.BR cdk_traverse (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_buttonbox.3 b/deps/cdk-5.0-20161210/man/cdk_buttonbox.3 new file mode 100644 index 0000000..9f00c36 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_buttonbox.3 @@ -0,0 +1,450 @@ +'\" t +.\" $Id: cdk_buttonbox.3,v 1.23 2016/12/11 01:49:29 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_buttonbox 3 +.SH NAME +.XX activateCDKButtonbox +.XX destroyCDKButtonbox +.XX drawCDKButtonbox +.XX drawCDKButtonboxButtons +.XX eraseCDKButtonbox +.XX getCDKButtonboxBox +.XX getCDKButtonboxButtonCount +.XX getCDKButtonboxCurrentButton +.XX getCDKButtonboxHighlight +.XX injectCDKButtonbox +.XX moveCDKButtonbox +.XX newCDKButtonbox +.XX positionCDKButtonbox +.XX setCDKButtonbox +.XX setCDKButtonboxBackgroundAttrib +.XX setCDKButtonboxBackgroundColor +.XX setCDKButtonboxBox +.XX setCDKButtonboxBoxAttribute +.XX setCDKButtonboxCurrentButton +.XX setCDKButtonboxHighlight +.XX setCDKButtonboxHorizontalChar +.XX setCDKButtonboxLLChar +.XX setCDKButtonboxLRChar +.XX setCDKButtonboxPostProcess +.XX setCDKButtonboxPreProcess +.XX setCDKButtonboxULChar +.XX setCDKButtonboxURChar +.XX setCDKButtonboxVerticalChar +cdk_buttonbox \- Creates a managed curses buttonbox widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKButtonbox (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype * " "actions"); +.TP 15 +.B "void destroyCDKButtonbox (" +.BI "CDKBUTTONBOX *" "buttonbox"); +.TP 15 +.B "void drawCDKButtonbox (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "boolean " "box"); +.TP 15 +.B "void drawCDKButtonboxButtons (" +.BI "CDKBUTTONBOX *" "buttonbox"); +.TP 15 +.B "void eraseCDKButtonbox (" +.BI "CDKBUTTONBOX *" "buttonbox"); +.TP 15 +.B "boolean getCDKButtonboxBox (" +.BI "CDKBUTTONBOX *" "buttonbox"); +.TP 15 +.B "int getCDKButtonboxButtonCount (" +.BI "CDKBUTTONBOX *" "buttonbox"); +.TP 15 +.B "int getCDKButtonboxCurrentButton (" +.BI "CDKBUTTONBOX *" "buttonbox"); +.TP 15 +.B "chtype getCDKButtonboxHighlight (" +.BI "CDKBUTTONBOX *" "buttonbox"); +.TP 15 +.B "int injectCDKButtonbox (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKButtonbox (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKBUTTONBOX *newCDKButtonbox (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "height", +.BI "int " "width", +.BI "const char * " "title" , +.BI "int " "rows", +.BI "int " "cols", +.BI "CDK_CONST char ** " "buttons" , +.BI "int " "buttonCount", +.BI "chtype " "highlight" , +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKButtonbox (" +.BI "CDKBUTTONBOX *" "buttonbox"); +.TP 15 +.B "void setCDKButtonbox (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "highlight", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKButtonboxBackgroundAttrib (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKButtonboxBackgroundColor (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKButtonboxBox (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKButtonboxBoxAttribute (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKButtonboxCurrentButton (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "int " "button"); +.TP 15 +.B "void setCDKButtonboxHighlight (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKButtonboxHorizontalChar (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKButtonboxLLChar (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKButtonboxLRChar (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKButtonboxPostProcess (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKButtonboxPreProcess (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKButtonboxULChar (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKButtonboxURChar (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKButtonboxVerticalChar (" +.BI "CDKBUTTONBOX *" "buttonbox", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk buttonbox widget creates a buttonbox box with a message and a varied number of +buttons to choose from. +The following functions create or manipulate the Cdk buttonbox box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKButtonbox +activates the buttonbox widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBbuttonbox\fR is a pointer to a non-NULL buttonbox widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return a +value from 0 to the number of buttons -1, representing the button selected. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the +character entered into this widget was \fIESCAPE\fR then the widget will return +a value of -1 and the widget data \fIexitType\fR will be set to +\fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDKButtonbox +removes the widget from the screen and releases any memory the +object used. +.TP 5 +.B drawCDKButtonbox +draws the buttonbox widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B drawCDKButtonboxButtons +draws the buttons. +.TP 5 +.B eraseCDKButtonbox +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKButtonboxBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKButtonboxButtonCount +returns the number of buttons in the button box. +.TP 5 +.B getCDKButtonboxCurrentButton +returns the current button-number. +.TP 5 +.B getCDKButtonboxHighlight +returns the highlight attribute of the widget. +.TP 5 +.B injectCDKButtonbox +injects a single character into the widget. +.RS +.bP +The parameter \fBbuttonbox\fR is a pointer to a non-NULL buttonbox widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a value ranging from zero to one less than the number of buttons, +representing the button selected. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +\fIvESCAPE_HIT\fR. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKButtonbox +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which states +whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKButtonbox +creates a pointer to a buttonbox widget. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It be an integer value or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBheight\fR and +.TP 5 +\fBwidth\fR +control the height and width of the widget. +.TP 5 +\fBtitle\fR +is the title of the widget. +.TP 5 +\fBrows\fR +is the number of rows of buttons. +.TP 5 +\fBcols\fR +sets the number of columns. +.TP 5 +\fBbuttons\fR +is an array containing the button labels. +.TP 5 +\fBbuttonCount\fR +is the number of elements in the \fBbuttons\fR array. +.TP 5 +\fBhighlight\fR +is the attribute of the currently highlighted button. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR +pointer is returned. +.TP 5 +.B positionCDKButtonbox +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKButtonbox +lets the programmer modify certain elements of an existing +buttonbox widget. +.IP +The parameter names correspond to the same parameter names listed +in the \fBnewCDKButtonbox\fR function. +.TP 5 +.B setCDKButtonboxBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKButtonboxBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +(See \fIcdk_display\fR). +.TP 5 +.B setCDKButtonboxBox +sets true if the widget will be drawn with a box around it. +.TP 5 +.B setCDKButtonboxBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKButtonboxCurrentButton +sets the current button-number for the box. +.TP 5 +.B setCDKButtonboxHighlight +sets the highlight attribute of the selected button. +.TP 5 +.B setCDKButtonboxHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKButtonboxLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKButtonboxLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKButtonboxPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.IP +The parameter \fBfunction\fR is the callback function. +(See \fIcdk_process\fR). +.TP 5 +.B setCDKButtonboxPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.IP +The parameter \fBfunction\fR is the callback function. +(See \fIcdk_process\fR). +.TP 5 +.B setCDKButtonboxULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKButtonboxURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKButtonboxVerticalChar +sets the vertical drawing character for the box to the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBKey Action\fR += +Left Arrow/T{ +Selects the button to the left of the current button. +T} +Right Arrow/T{ +Selects the button to the right of the current button. +T} +Tab/T{ +Selects the button to the right of the current button. +T} +Space/T{ +Selects the button to the right of the current button. +T} +Return/T{ +Exits the widget and returns the index of the selected button. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exits the widget and returns the index of the selected button. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns -1. +This also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/T{ +Refreshes the screen. +T} +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_process (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_calendar.3 b/deps/cdk-5.0-20161210/man/cdk_calendar.3 new file mode 100644 index 0000000..5d0cc58 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_calendar.3 @@ -0,0 +1,580 @@ +'\" t +.\" $Id: cdk_calendar.3,v 1.26 2016/12/11 01:45:45 tom Exp $" +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_calendar 3 +.SH NAME +.XX activateCDKCalendar +.XX destroyCDKCalendar +.XX drawCDKCalendar +.XX eraseCDKCalendar +.XX getCDKCalendarBox +.XX getCDKCalendarDate +.XX getCDKCalendarDayAttribute +.XX getCDKCalendarHighlight +.XX getCDKCalendarMarker +.XX getCDKCalendarMonthAttribute +.XX getCDKCalendarYearAttribute +.XX injectCDKCalendar +.XX moveCDKCalendar +.XX newCDKCalendar +.XX positionCDKCalendar +.XX removeCDKCalendarMarker +.XX setCDKCalendar +.XX setCDKCalendarBackgroundAttrib +.XX setCDKCalendarBackgroundColor +.XX setCDKCalendarBox +.XX setCDKCalendarBoxAttribute +.XX setCDKCalendarDate +.XX setCDKCalendarDayAttribute +.XX setCDKCalendarDaysNames +.XX setCDKCalendarHighlight +.XX setCDKCalendarHorizontalChar +.XX setCDKCalendarLLChar +.XX setCDKCalendarLRChar +.XX setCDKCalendarMarker +.XX setCDKCalendarMonthAttribute +.XX setCDKCalendarMonthsNames +.XX setCDKCalendarPostProcess +.XX setCDKCalendarPreProcess +.XX setCDKCalendarULChar +.XX setCDKCalendarURChar +.XX setCDKCalendarVerticalChar +.XX setCDKCalendarYearAttribute +cdk_calendar \- curses calendar widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "time_t activateCDKCalendar (CDKCALENDAR *" "calendar", +.BI "chtype " "*actions"); +.TP 15 +.B "void destroyCDKCalendar (" +.BI "CDKCALENDAR *" "calendar"); +.TP 15 +.B "void drawCDKCalendar (CDKCALENDAR *" "calendar", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKCalendar (" +.BI "CDKCALENDAR *" "calendar"); +.TP 15 +.B "boolean getCDKCalendarBox (" +.BI "CDKCALENDAR *" "calendar"); +.TP 15 +.B "void getCDKCalendarDate (CDKCALENDAR *" "calendar", +.BI "int *" "day", +.BI "int *" "month", +.BI "int *" "year"); +.TP 15 +.B "chtype getCDKCalendarDayAttribute (" +.BI "CDKCALENDAR *" "calendar"); +.TP 15 +.B "chtype getCDKCalendarHighlight (" +.BI "CDKCALENDAR *" "calendar"); +.TP 15 +.B "chtype getCDKCalendarMarker (" +.BI "CDKCALENDAR *" "calendar", +.BI "int " "day", +.BI "int " "month", +.BI "int " "year"); +.TP 15 +.B "chtype getCDKCalendarMonthAttribute (" +.BI "CDKCALENDAR *" "calendar"); +.TP 15 +.B "chtype getCDKCalendarYearAttribute (" +.BI "CDKCALENDAR *" "calendar"); +.TP 15 +.B "time_t injectCDKCalendar (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKCalendar (" +.BI "CDKCALENDAR *" "calendar", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKCALENDAR *newCDKCalendar (CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "const char *" "title", +.BI "int " "day", +.BI "int " "month", +.BI "int " "year", +.BI "chtype " "dayAttrib", +.BI "chtype " "monthAttrib", +.BI "chtype " "yearAttrib", +.BI "chtype " "highlight", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKCalendar (" +.BI "CDKCALENDAR *" "calendar"); +.TP 15 +.B "void removeCDKCalendarMarker (" +.BI "CDKCALENDAR *" "calendar", +.BI "int " "day", +.BI "int " "month", +.BI "int " "year"); +.TP 15 +.B "void setCDKCalendar (" +.BI "CDKCALENDAR *" "calendar", +.BI "int " "day", +.BI "int " "month", +.BI "int " "year", +.BI "chtype " "dayAttrib", +.BI "chtype " "monthAttrib", +.BI "chtype " "yearAttrib", +.BI "chtype " "highlight", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKCalendarBackgroundAttrib (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKCalendarBackgroundColor (" +.BI "CDKCALENDAR *" "calendar", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKCalendarBox (" +.BI "CDKCALENDAR *" "calendar", +.BI "boolean " "box"); +.TP 15 +.B setCDKCalendarBoxAttribute (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "ch"); +.TP 15 +.B "void setCDKCalendarDate (" +.BI "CDKCALENDAR *" "calendar", +.BI "int " "day", +.BI "int " "month", +.BI "int " "year"); +.TP 15 +.B "void setCDKCalendarDayAttribute (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "attribute"); +.TP +.B "void setCDKCalendarDaysNames (" +.BI "CDKCALENDAR *" "calendar", +.BI "const char *" "days"); +.TP 15 +.B "void setCDKCalendarHighlight (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKCalendarHorizontalChar (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "ch"); +.TP 15 +.B "void setCDKCalendarLLChar (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "ch"); +.TP 15 +.B "void setCDKCalendarLRChar (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "ch"); +.TP 15 +.B "void setCDKCalendarMarker (" +.BI "CDKCALENDAR *" "calendar", +.BI "int " "day", +.BI "int " "month", +.BI "int " "year", +.BI "chtype " "marker"); +.TP 15 +.B "void setCDKCalendarMonthAttribute (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "attribute"); +.TP +.B "void setCDKCalendarMonthsNames (" +.BI "CDKCALENDAR *" "calendar", +.BI "CDK_CONST char **" "months"); +.TP 15 +.B "void setCDKCalendarPostProcess (" +.BI "CDKCALENDAR *" "calendar", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKCalendarPreProcess (" +.BI "CDKCALENDAR *" "calendar", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B setCDKCalendarULChar (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "ch"); +.TP 15 +.B setCDKCalendarURChar (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "ch"); +.TP 15 +.B setCDKCalendarVerticalChar (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "ch"); +.TP 15 +.B "void setCDKCalendarYearAttribute (" +.BI "CDKCALENDAR *" "calendar", +.BI "chtype " "attribute"); +.fi +.SH DESCRIPTION +The Cdk calendar widget creates a pop-up calendar. +The calendar widget allows the user to traverse through +months/years using the cursor keys. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKCalendar +activates the calendar widget and lets the user interact with the widget. +.RS +.bP +The \fBcalendar\fR widget is a pointer to a non-NULL calendar widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.IP +If the character +entered into this widget is \fIRETURN\fR then this function will return a type +of \fItime_t\fR. +.bP +The \fItime_t\fR type is used in the functions defined in the +time.h header file. +(see \fIlocaltime\fR or \fIctime\fR for more information). +.RE +.IP +If the character entered into this widget was \fIESCAPE\fR or +\fITAB\fR then this function will return a value of (time_t)-1 +and the widget data \fIexitType\fR will be set to \fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDKCalendar +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKCalendar +draws the label widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKCalendar +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKCalendarBox +returns whether the widget will be drawn with a box around it. +.TP 5 +.B getCDKCalendarDate +returns the current date the calendar is displaying. +.TP 5 +.B getCDKCalendarDayAttribute +returns the attribute of the day attribute of the calendar. +.TP 5 +.B getCDKCalendarHighlight +returns the attribute of the highlight bar of the scrolling +list portion of the widget. +.TP +.B getCDKCalendarMarker +returns the marker set on the calendar by \fBsetCDKCalendarMarker\fP. +.TP 5 +.B getCDKCalendarMonthAttribute +returns the attribute of the month attribute of the calendar. +.TP 5 +.B getCDKCalendarYearAttribute +returns the attribute of the year attribute of the calendar. +.TP 5 +.B injectCDKCalendar +injects a single character into the widget. +.RS +.bP +The parameter \fBcalendar\fR is a pointer to a non-NULL calendar widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a value of type \fItime_t\fR +(see \fIlocaltime\fR or \fIctime\fR for more information). +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +(time_t)-1. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +(time_t)-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKCalendar +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKCalendar +creates a calendar widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBtitle\fR +is the string which will be displayed at the top of the widget. +The title can be more than one line; just +provide a carriage return character at the line break. +.TP 5 +\fByear\fR, +.TP 5 +\fBmonth\fR and +.TP 5 +\fBday\fR +.br +set the initial date of the calendar. +.TP 5 +\fByearAttrib\fR, +.TP 5 +\fBmonthAttrib\fR and +.TP 5 +\fBdayAttrib\fR +represent the attributes of the year, month, and day respectively. +.TP 5 +\fBhighlight\fR +sets the highlight of the currently selected day. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created +then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKCalendar +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B removeCDKCalendarMarker +removes a marker from the calendar. +.TP 5 +.B setCDKCalendar +lets the programmer modify certain elements of an existing +calendar widget. +.RS +.bP +The \fBcalendar\fR parameter represents an existing calendar pointer. +.bP +The other parameter names correspond to the same parameter names listed +in the \fBnewCDKCalendar\fR function. +.RE +.TP 5 +.B setCDKCalendarBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKCalendarBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKCalendarBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKCalendarBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKCalendarDate +sets the calendar to the given date. +.IP +If the value of the \fBday\fR, +\fBmonth\fR, or \fByear\fR parameters is -1 then the current day, month, or year +is used to set the date. +.TP 5 +.B setCDKCalendarDayAttribute +sets the attribute of the day in the calendar. +.TP +.B setCDKCalendarDaysNames +sets the names of the days of the week. +.IP +The parameter is a string listing the 2-character abbreviations for the +days. +.IP +The default value is +.RS +"Su Mo Tu We Th Fr Sa" +.RE +.IP +"Su" (Sunday) is numbered zero internally, +making it by default the first day of the week. +Set the \fBweekBase\fP member of the widget to select a different day. +For example, Monday would be 1, Tuesday 2, etc. +.TP 5 +.B setCDKCalendarHighlight +sets the attribute of the highlight bar of the scrolling +list portion of the widget. +.TP 5 +.B setCDKCalendarHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKCalendarLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKCalendarLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKCalendarMarker +allows the user to set a marker which will be displayed when the month is drawn. +.IP +The \fBmarker\fR parameter is the attribute to use when drawing the marker. +If more than one marker is set on a single day, then the day will blink +with the original marker attribute. +.TP 5 +.B setCDKCalendarMonthAttribute +sets the attribute of the month in the calendar. +.TP +.B setCDKCalendarMonthsNames +sets the names of the months of the year. +.IP +The parameter is a 13-element array (since indexing starts with 1). +.IP +The default values are the English month names, e.g., "January". +.TP 5 +.B setCDKCalendarPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKCalendarPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKCalendarULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKCalendarURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKCalendarVerticalChar +sets the vertical drawing character for the box to +the given character. +.TP 5 +.B setCDKCalendarYearAttribute +sets the attribute of the year in the calendar. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +Left Arrow/Moves the cursor to the previous day. +Right Arrow/Moves the cursor to the next day. +Up Arrow/Moves the cursor to the next week. +Down Arrow/Moves the cursor to the previous week. +t/Sets the calendar to the current date. +T/Sets the calendar to the current date. +n/Advances the calendar one month ahead. +N/Advances the calendar six months ahead. +p/Advances the calendar one month back. +P/Advances the calendar six months back. +-/Advances the calendar one year ahead. ++/Advances the calendar one year back. +Return/T{ +Exits the widget and returns a value of \fItime_t\fR which represents the day selected at 1 second after midnight. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exits the widget and returns a value of \fItime_t\fR which represents the day selected at 1 second after midnight. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns (time_)-1. +This also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_compat.3 b/deps/cdk-5.0-20161210/man/cdk_compat.3 new file mode 100644 index 0000000..f35beb8 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_compat.3 @@ -0,0 +1,108 @@ +'\" t +.\" $Id: cdk_compat.3,v 1.4 2005/12/28 21:52:07 tom Exp $ +.de XX +.. +.TH cdk_compat 3 +.SH NAME +.XX getDirectoryContents +.XX readFile +.XX splitString +cdk_compat \- Cdk4 compatibility functions +.SH SYNOPSIS +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int getDirectoryContents (" +.BI "char *directory", +.BI "char **list", +.BI "int " "maxListSize"); +.TP 15 +.B "int readFile (" +.BI "char *" "filename", +.BI "char **" "info", +.BI "int " "maxlines"); +.TP 15 +.B "int splitString (" +.BI "char *" "string", +.BI "char **" "items", +.BI "char " "splitChar"); +.fi +.SH DESCRIPTION +These functions and macros make it simpler to port applications from +the older Cdk4 library to Cdk5. +.PP +A few functions are deprecated in Cdk5, +because they rely upon the caller to know in advance the size of +data which will be returned by the function. +.PP +Additionally, some macros are deprecated because they serve no +realistic purpose: they have direct (standard) equivalents in all modern +curses implementations. +.PP +Finally, a few macro definitions are added to iron out naming inconsistencies +across the Cdk4 header files. +. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B getDirectoryContents +This opens the current directory and reads the contents. +Use \fBCDKgetDirectoryContents()\fP in new code. +.TP 5 +.B readFile +This reads a file and sticks it into the \fBchar\ **\fP provided. +Use \fBCDKreadFile()\fP for new code. +.TP 5 +.B splitString +This splits a string into one or more parts given the split character. +Use \fBCDKsplitString()\fP for new code. +. +.SH EXAMPLE +Start the porting process by changing the \fB#include\fP's to use +.RS +#include +.RE +.PP +rather than +.RS +#include +.RE +Some adjustments of course are needed to make your compiler see the +compatibility header file. +A separate name was chosen so that it in turn can (by adjusting the +include path) include either the old Cdk4 \fBcdk.h\fP or the new. +If the old is included, you should link your program against the old library. +Likewise, including the new requires that you link against the new library. +.PP +That is the first step: making your program compile using the compatibility +header file using the old headers and library. +.PP +The next step is to get it to compile against the new headers and library. +Most of the changes will require modifying bare references to certain +pointers to wrap them with the \fBObjOf()\fP and \fBScreenOf()\fP macros. +New Cdk uses these to provide functions which are easily shared among +the different widget types. +Your compiler should be able to tell you where the changes should be made. +See the example programs which are included with Cdk as a guide. +.PP +That is the hard part of porting. But even for a large program, the +changes can be made simply: there are not that many types of change to make. +At the end of this step, you should still be able to build and run your +program against the old headers and library. +It is reasonably likely that you can do the same with the new headers and +library. +By using the same source for old/new versions of Cdk, you can test and +verify that your program still works properly after these modifications. +.PP +Finally, unless this is a purely academic exercise, you will want to +remove references to the deprecated functions and macros. +. +.SH SEE ALSO +cdk_objs (3), +cdk_util (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_dialog.3 b/deps/cdk-5.0-20161210/man/cdk_dialog.3 new file mode 100644 index 0000000..c1805d0 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_dialog.3 @@ -0,0 +1,468 @@ +'\" t +.\" $Id: cdk_dialog.3,v 1.21 2016/12/11 01:41:55 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_dialog 3 +.SH NAME +.XX activateCDKDialog +.XX destroyCDKDialog +.XX drawCDKDialog +.XX drawCDKDialogButtons +.XX eraseCDKDialog +.XX getCDKDialog +.XX getCDKDialogBox +.XX getCDKDialogHighlight +.XX getCDKDialogSeparator +.XX injectCDKDialog +.XX moveCDKDialog +.XX newCDKDialog +.XX positionCDKDialog +.XX setCDKDialog +.XX setCDKDialogBackgroundAttrib +.XX setCDKDialogBackgroundColor +.XX setCDKDialogBox +.XX setCDKDialogBox +.XX setCDKDialogBoxAttribute +.XX setCDKDialogHighlight +.XX setCDKDialogHorizontalChar +.XX setCDKDialogLLChar +.XX setCDKDialogLRChar +.XX setCDKDialogPostProcess +.XX setCDKDialogPreProcess +.XX setCDKDialogSeparator +.XX setCDKDialogULChar +.XX setCDKDialogURChar +.XX setCDKDialogVerticalChar +cdk_dialog \- curses dialog widget +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKDialog (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype * " "actions"); +.TP 15 +.B "void destroyCDKDialog (" +.BI "CDKDIALOG *" "dialog"); +.TP 15 +.B "void drawCDKDialog (" +.BI "CDKDIALOG *" "dialog", +.BI "boolean " "box"); +.TP 15 +.B "void drawCDKDialogButtons (" +.BI "CDKDIALOG *" "dialog"); +.TP 15 +.B "void eraseCDKDialog (" +.BI "CDKDIALOG *" "dialog"); +.TP 15 +.B "boolean getCDKDialog (" +.BI "CDKDIALOG *" "dialog"); +.TP 15 +.B "boolean getCDKDialogBox (" +.BI "CDKDIALOG *" "dialog"); +.TP 15 +.B "chtype getCDKDialogHighlight (" +.BI "CDKDIALOG *" "dialog"); +.TP 15 +.B "boolean getCDKDialogSeparator (" +.BI "CDKDIALOG *" "dialog"); +.TP 15 +.B "int injectCDKDialog (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKDialog (" +.BI "CDKDIALOG *" "dialog", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKDIALOG *newCDKDialog (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "CDK_CONST char ** " "message" , +.BI "int " "rows", +.BI "CDK_CONST char ** " "buttons" , +.BI "int " "buttonCount", +.BI "chtype " "highlight" , +.BI "boolean " "separator", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKDialog (" +.BI "CDKDIALOG *" "dialog"); +.TP 15 +.B "void setCDKDialogBox (" +.BI "CDKDIALOG *" "dialog", +.BI "boolean " "boxWidget"); +.TP 15 +.B "void setCDKDialog (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "highlight", +.BI "boolean " "separator", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKDialogBackgroundAttrib (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKDialogBackgroundColor (" +.BI "CDKDIALOG *" "dialog", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKDialogBox (" +.BI "CDKDIALOG *" "dialog", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKDialogBoxAttribute (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKDialogHighlight (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKDialogHorizontalChar (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKDialogLLChar (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKDialogLRChar (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKDialogPostProcess (" +.BI "CDKDIALOG *" "dialog", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKDialogPreProcess (" +.BI "CDKDIALOG *" "dialog", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKDialogSeparator (" +.BI "CDKDIALOG *" "dialog", +.BI "boolean " "separator"); +.TP 15 +.B "void setCDKDialogULChar (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKDialogURChar (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKDialogVerticalChar (" +.BI "CDKDIALOG *" "dialog", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk dialog widget creates a dialog box with a message and a varied number of +buttons to choose from. +The following functions create or manipulate the Cdk dialog box widget. +.PP +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKDialog +activates the dialog widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBdialog\fR is a pointer to a non-NULL dialog widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return a +value from 0 to the number of buttons -1, representing the button selected. +It also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the character entered into this widget was \fIESCAPE\fR then the widget returns +a value of -1 and the widget data \fIexitType\fR will be set to +\fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDKDialog +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKDialog +draws the dialog widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B drawCDKDialogButtons +draws the dialog buttons and the separation line. +.TP 5 +.B eraseCDKDialog +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKDialog +returns true if the list will be drawn with a box around it. +.TP 5 +.B getCDKDialogBox +returns true if the dialog will be drawn with a box around it. +.TP 5 +.B getCDKDialogHighlight +returns the highlight attribute of the widget. +.TP 5 +.B getCDKDialogSeparator +returns the state of the separator flag. +.TP 5 +.B injectCDKDialog +injects a single character into the widget. +.RS +.bP +The parameter \fBdialog\fR is a pointer to a non-NULL dialog widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a value from zero to one less than the number of buttons, +representing the button selected. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKDialog +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.IP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which states +whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKDialog +creates a dialog widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBmessage\fR +is the text to be displayed in the message region of the dialog box. +.TP 5 +\fBrows\fR +is the number of elements in the \fBmessage\fR list. +.TP 5 +\fBbuttons\fR +is an array containing the button labels +to be displayed on the bottom of the dialog box. +.TP 5 +\fBbuttonCount\fR +is the number of elements in the \fBbuttons\fR array. +.TP 5 +\fBhighlight\fR +is the attribute of the currently highlighted button. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBseparator\fR +is true if a separator line should be drawn between the message region and the buttons. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR +pointer is returned. +.TP 5 +.B positionCDKDialog +allows the user to move the widget around the screen via the +cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKDialogBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKDialog +lets the programmer modify certain elements of an existing +dialog widget. +.IP +The parameter names correspond to the same parameter names listed +in the \fBnewCDKDialog\fR function. +.TP 5 +.B setCDKDialogBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKDialogBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.B setCDKDialogBox +sets the box attribute of the dialog widget. +.TP 5 +.B setCDKDialogBoxAttribute +function sets the attribute of the box. +.TP 5 +.B setCDKDialogHighlight +sets the highlight attribute of the selected button. +.TP 5 +.B setCDKDialogHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKDialogLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKDialogLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKDialogPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR is a pointer to +\fIvoid\fR. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKDialogPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKDialogSeparator +sets the boolean flag whether the widget will be drawn with the +separator bar between the buttons and the message area. +.TP 5 +.B setCDKDialogULChar +function sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKDialogURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKDialogVerticalChar +sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +Left Arrow/T{ +Selects the button to the left of the current button. +T} +Right Arrow/T{ +Selects the button to the right of the current button. +T} +Tab/T{ +Selects the button to the right of the current button. +T} +Space/T{ +Selects the button to the right of the current button. +T} +Return/T{ +Exits the widget and returns the index of the selected button. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exits the widget and returns the index of the selected button. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns -1. +This also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_process (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_display.3 b/deps/cdk-5.0-20161210/man/cdk_display.3 new file mode 100644 index 0000000..769b4ef --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_display.3 @@ -0,0 +1,445 @@ +'\" t +.\" $Id: cdk_display.3,v 1.14 2016/12/04 19:57:27 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de It +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.TH cdk_display 3 +.SH NAME +cdk_display - \fBCurses Development Kit\fR Display Capabilities. +.SH SYNOPSIS +Cdk has a number of pre-defined display types. +The following are outlined in this manual page: +.It "\(bu How To Use Colors" 5 +.It "\(bu How To Use Different Character Attributes" 5 +.It "\(bu How To Justify Strings" 5 +.It "\(bu How To Use Special Drawing Characters" 5 +.It "\(bu Edit/Display Type Codes (EDisplayType)" 5 +.SH DESCRIPTION +Cdk has special formatting commands which can be included in any string which +add highlights, justification, or even colors to a basic string. +These attributes, once set, remain in effect until changed explicitly, +or until the end of the string. +.LP +This manual +page outlines and demonstrates how they work. +. +.SS How To Use Colors +Cdk has the capability to display colors in almost every string type displayed +in a Cdk widget. +.PP +Normally the color pairs are accessed via the COLOR_PAIR macro. +You can still do this, but creating a string with multiple colors is tedious. +That is why the color commands were created. +Use \fBinitCDKColor\fR to create up to 64 color pairs +which you can refer to by number in strings. +.LP +The color settings are stored directly in the string. +When the widget is created or activated, the string is converted +to take advantage of any color commands in the string. +.bP +To turn on a color pair +insert \fI\fP into the string; +where \fIXX\fR is a numeric value from 0 to the maximum color pair. +.IP +Color pair 0 is the standard default color pair for the screen. +.IP +If you used \fBinitCDKColor\fP, the maximum value for \fIXX\fR is 63 +for terminals supporting 8 ANSI colors. +.IP +If you created color pairs directly using \fBinit_pair\fP, +the maximum value for \fIXX\fR is implementation-dependent, +e.g., 63 (for Unix systems) and 255 for ncurses. +.IP +If the terminal does not support color, Cdk uses the \fBbold\fP attribute. +.bP +To turn off a +color pair use the format command where \fIXX\fR is a numeric value from +0 to the maximum color pair. +.LP +The following example demonstrates the use of the color commands. +.ne 10 +.sp 1 +.nf +.ce +\fI----------------------------------------\fR +#include + +void main() +{ + CDKSCREEN *cdkscreen; + CDKLABEL *demo; + char *mesg[4]; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors */ + initCDKColor(); + + /* Set the labels up. */ + mesg[0] = "This line should have a yellow foreground and a cyan background."; + mesg[1] = "This line should have a white foreground and a blue background."; + mesg[2] = "This line should have a yellow foreground and a red background."; + mesg[3] = "This line should be set to whatever the screen default is."; + + /* Declare the labels. */ + demo = newCDKLabel (cdkscreen, CENTER, CENTER, mesg, 4, TRUE, TRUE); + + /* Draw the label */ + drawCDKLabel (demo, TRUE); + waitCDKLabel (demo, ' '); + + /* Clean up */ + destroyCDKLabel (demo); + destroyCDKScreen (cdkscreen); + endCDK(); + exit (0); +} +.fi +.ce +\fI----------------------------------------\fR +.PP +. +.SS How To Use Different Character Attributes +Cdk also provides attribute commands which allow different character attributes +to be displayed in a Cdk widget. +To use a character attribute the format command +is \fI\fR where \fIX\fR is one of several command characters. +To turn a attribute off use the command \fI\fR. +The following table outlines the command characters: +.LP +.TS +center tab(/) box; +l l +l l +lw15 lw35 . +\fBCommand Character/Character Attribute\fR += +B/Bold +U/Underline +K/Blink +R/Reverse +S/Standout +D/Dim +N/Normal +.TE +.LP +The following example demonstrates the use of character display attributes. +.ne 10 +.sp 2 +.nf +.ce +\fI----------------------------------------\fR +#include + +void main() +{ + CDKSCREEN *cdkscreen; + CDKLABEL *demo; + char *mesg[4]; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors */ + initCDKColor(); + + /* Set the labels up. */ + mesg[0] = "Bold text yellow foreground / blue background."; + mesg[1] = "Underlined text white foreground / blue background."; + mesg[2] = "Blinking text yellow foreground / red background."; + mesg[3] = "This line uses the screen default colors."; + + /* Declare the labels. */ + demo = newCDKLabel (cdkscreen, CENTER, CENTER, mesg, 4, TRUE, TRUE); + + /* Draw the label */ + drawCDKLabel (demo, TRUE); + waitCDKLabel (demo, ' '); + + /* Clean up */ + destroyCDKLabel (demo); + destroyCDKScreen (cdkscreen); + endCDK(); + exit (0); +} +.ce +\fI----------------------------------------\fR +.fi +.LP +Note that color commands and format commands can be mixed inside the same +format marker. +The above example underlines the label marker, which also sets +color pair number 2. +. +.SS How To Justify Strings +Justification commands can left justify, right justify, or center a string of text. +To use a justification format in a string the command is used. +The following table lists the format commands: +.LP +.TS +center tab(/) box; +l l +l l +lw15 lw35 . +\fBCommand/Action.\fR += +/Left Justified. Default if not stated. +/Centered text. +/Right justified. +/Indent the line X characters. +/Bullet. X is the bullet string to use. +/T{ +Links in a file where X is the filename. +This works only with the viewer widget. +T} +.TE + +The following example demonstrates how to use the justification commands +in a Cdk widget. +.ce +\fI----------------------------------------\fR +.nf +#include + +void main() +{ + CDKSCREEN *cdkscreen; + CDKLABEL *demo; + char *mesg[5]; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors */ + initCDKColor(); + + /* Set the labels up. */ + mesg[0] = "This line should have a yellow foreground and a blue background."; + mesg[1] = "This line should have a white foreground and a blue background."; + mesg[2] = "This is a bullet."; + mesg[3] = "This is indented 10 characters."; + mesg[4] = "This line should be set to whatever the screen default is."; + + /* Declare the labels. */ + demo = newCDKLabel (cdkscreen, CENTER, CENTER, mesg, 5, TRUE, TRUE); + + /* Draw the label */ + drawCDKLabel (demo, TRUE); + waitCDKLabel (demo, ' '); + + /* Clean up */ + destroyCDKLabel (demo); + destroyCDKScreen (cdkscreen); + endCDK(); + exit (0); +} +.fi +.ce +\fI----------------------------------------\fR +.PP +The bullet format command can take either a single character or a string. +The bullet in the above example would look like +.RS 3 +\fI+\fR This is a bullet. +.RE +but if we were to use the following command instead +.RS 3 +This is a bullet. +.RE +it would look like +.RS 3 +\fI***\fR This is a bullet. +.RE +.PP +A format command must be at the beginning of the string. +. +.SS How To Use Special Drawing Characters +Cdk has a set of special drawing characters which can be inserted into any +ASCII file. +In order to use a special character the format command <#XXX> +is used. +The following table lists all of the special character commands available. +.TS +center tab(/) box; +l l +l l +lw15 lw35 . +\fBSpecial_Character/Character\fR += +<#UL>/Upper Left Corner +<#UR>/Upper Right Corner +<#LL>/Lower Left Corner +<#LR>/Lower Right Corner += +<#LT>/Left Tee +<#RT>/Right Tee +<#TT>/Top Tee +<#BT>/Bottom Tee += +<#HL>/Horizontal Line +<#VL>/Vertical Line += +<#PL>/Plus Sign +<#PM>/Plus or Minus Sign +<#DG>/Degree Sign +<#CB>/Checker Board +<#DI>/Diamond +<#BU>/Bullet +<#S1>/Scan line 1 +<#S9>/Scan line 9 += +<#LA>/Left Arrow +<#RA>/Right Arrow +<#TA>/Top Arrow +<#BA>/Bottom Arrow +.TE +.LP +The character formats can be repeated using an optional numeric repeat value. +To repeat a character add the repeat count within parentheses +to the end of the character format. +The following example draws 10 horizontal-line characters: +.LP +<#HL(10)> +.LP +The following example draws a box within a label window: +.ce +\fI----------------------------------------\fR +.nf +#include + +void main() +{ + /* Declare variables. */ + CDKSCREEN *cdkscreen; + CDKLABEL *demo; + char *mesg[4]; + + cdkscreen = initCDKScreen (NULL); + + /* Start CDK Colors */ + initCDKColor(); + + /* Set the labels up. */ + mesg[0] = "<#UL><#HL(26)><#UR>"; + mesg[1] = "<#VL>This text should be boxed.<#VL>"; + mesg[2] = "<#LL><#HL(26)><#LR>"; + mesg[3] = "While this is not."; + + /* Declare the labels. */ + demo = newCDKLabel (cdkscreen, CENTER, CENTER, mesg, 4, TRUE, TRUE); + + /* Is the label NULL??? */ + if (demo == (CDKLABEL *)NULL) + { + /* Clean up the memory. */ + destroyCDKScreen (cdkscreen); + + /* End curses... */ + endCDK(); + + /* Spit out a message. */ + printf ("Oops. Can't seem to create the label. Is the window too small?\\n"); + exit (1); + } + + /* Draw the CDK screen. */ + refreshCDKScreen (cdkscreen); + waitCDKLabel (demo, ' '); + + /* Clean up */ + destroyCDKLabel (demo); + destroyCDKScreen (cdkscreen); + endCDK(); + exit (0); +} +.fi +.ce +\fI----------------------------------------\fR +.LP +Notice that drawn text can also be justified. +.LP +. +.SS Edit/Display Type Codes (EDisplayType) +.TS +center tab(/) box; +l l +l l +lw15 lw45 . +\fBDisplay_Type/Result\fR += +vCHAR/Only accepts alphabetic characters. +vLCHAR/T{ +Only accepts alphabetic characters. +Maps the character to lower case +when a character has been accepted. +T} +vUCHAR/T{ +Only accepts alphabetic characters. +Maps the character to upper case +when a character has been accepted. +T} +vHCHAR/T{ +Only accepts alphabetic characters. +Displays a period (\fI.\fR) when a character +has been accepted. +T} +vUHCHAR/T{ +Only accepts alphabetic characters. +Displays a period (\fI.\fR) and maps the +character to upper case when a +character has been accepted. +T} +vLHCHAR/T{ +Only accepts alphabetic characters. +Displays a period (\fI.\fR) and maps the +character to lower case when a +character has been accepted. +T} +vINT/T{ +Only accepts numeric characters. +T} +vHINT/T{ +Only accepts numeric characters. +Displays a period (\fI.\fR) when a character +has been accepted. +T} +vMIXED/Accepts any character types. +vLMIXED/T{ +Accepts any character types. +Maps the character to lower case +when an alphabetic character has +been accepted. +T} +vUMIXED/T{ +Accepts any character types. +Maps the character to upper case +when an alphabetic character has +been accepted. +T} +vHMIXED/T{ +Accepts any character types. +Displays a period (\fI.\fR) when a character +has been accepted. +T} +vLHMIXED/T{ +Accepts any character types. +Displays a period (\fI.\fR) and maps the +character to lower case when a +character has been accepted. +T} +vUHMIXED/T{ +Accepts any character types. +Displays a period (\fI.\fR) and maps the +character to upper case when a +character has been accepted. +T} +vVIEWONLY/Uneditable field. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_draw.3 b/deps/cdk-5.0-20161210/man/cdk_draw.3 new file mode 100644 index 0000000..2ca7a8a --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_draw.3 @@ -0,0 +1,198 @@ +.\" $Id: cdk_draw.3,v 1.4 2009/02/15 17:10:04 tom Exp $ +.de XX +.. +.TH cdk_draw 3 +.XX boxWindow +.XX attrbox +.XX drawObjBox +.XX drawLine +.XX drawShadow +.XX writeBlanks +.XX writeChar +.XX writeCharAttrib +.XX writeChtype +.XX writeChtypeAttrib +.SH NAME +cdk_draw \- Cdk Drawing Functions +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "void boxWindow (" +.BI "WINDOW *" "window", +.BI "chtype " "attr"); +.TP 15 +.B "void attrbox (" +.BI "WINDOW *" "win", +.BI "chtype " "tlc", +.BI "chtype " "trc", +.BI "chtype " "blc", +.BI "chtype " "brc", +.BI "chtype " "horz", +.BI "chtype " "vert", +.BI "chtype " "attr"); +.TP 15 +.B "void drawObjBox (" +.BI "WINDOW *" "win", +.BI "CDKOBJS *" "object"); +.TP 15 +.B "void drawLine (" +.BI "WINDOW *" "window", +.BI "int " "startx", +.BI "int " "starty", +.BI "int " "endx", +.BI "int " "endy", +.BI "chtype " "line"); +.TP 15 +.B "void drawShadow (" +.BI "WINDOW *" "shadowWin"); +.TP 15 +.B "void writeBlanks (" +.BI "WINDOW *" "window", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "align", +.BI "int " "start", +.BI "int " "end"); +.TP 15 +.B "void writeChar (" +.BI "WINDOW *" "window", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "char *" "string", +.BI "int " "align", +.BI "int " "start", +.BI "int " "end"); +.TP 15 +.B "void writeCharAttrib (" +.BI "WINDOW *" "window", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "char *" "string", +.BI "chtype " "attr", +.BI "int " "align", +.BI "int " "start", +.BI "int " "end"); +.TP 15 +.B "void writeChtype (" +.BI "WINDOW *" "window", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "chtype *" "string", +.BI "int " "align", +.BI "int " "start", +.BI "int " "end"); +.TP 15 +.B "void writeChtypeAttrib (" +.BI "WINDOW *" "window", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "chtype *" "string", +.BI "chtype " "attr", +.BI "int " "align", +.BI "int " "start", +.BI "int " "end"); +.fi +.SH DESCRIPTION +These functions perform useful drawing and attribute operations. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B boxWindow +draw a box with on the window \fIwin\fP. +Like \fBattrbox\fP, +this function ORs \fIattr\fP with each character as it draws the box. +.TP 5 +.B attrbox +draw a box with on the window \fIwin\fP +letting the caller define each element of the box. +.IP +The parameters \fItlc\fP, \fItrc\fP, \fIblc\fP, \fIbrc\fP +are used for the +top-left, +top-right, +bottom-left and +bottom-right corners respectively. +The parameters +\fIhorz\fP and +\fIvert\fP +are used for the horizontal and vertical sides of the box. +Any of these parameters may be zero. +In that case, the function skips the corresponding element of the box. +.IP +The function ORs \fIattr\fP with each character as it draws the box. +.TP 5 +.B drawObjBox +Draw a box around the given window \fIwin\fP +using the \fIobject\fP's defined line-drawing characters. +.TP 5 +.B drawLine +draw a line on the given window. +.IP +The parameters \fIstarty\fP, \fIstartx\fP are the starting coordinates. +The parameters \fIendy\fP, \fIendx\fP are the ending coordinates. +The function writes the data in \fIline\fP to each coordinate in that +range including the start/end coordinates. +.IP +The function handles lines other than vertical or horizontal, +but normally it is used for that, e.g., with \fIline\fP set to +\fBACS_HLINE\fP or \fBACS_VLINE\fP. +.TP 5 +.B drawShadow +draw a shadow on the right and bottom edges of a window. +.TP 5 +.B writeBlanks +write a string of blanks, using \fBwriteChar\fP. +The parameters are passed to \fBwriteChar\fP as is. +There is no corresponding \fBwriteBlanksAttrib\fP function. +.TP 5 +.B writeChar +writes out a \fBchar\ *\fP string without adding attributes. +The parameters are passed to \fBwriteCharAttrib\fP as is. +.TP 5 +.B writeCharAttrib +writes out a \fBchar\ *\fP string with the given attributes added. +The string is written to the given \fIwindow\fP, +using its relative screen coordinates \fIypos\fP and \fIxpos\fP. +.IP +Compare with \fBwriteChtypeAttrib\fP, which writes a \fBchtype\ *\fP string. +.IP +The function ORs the attribute \fIattr\fP with each item from the string. +For instance, it may be \fBA_BOLD\fP. +The \fIalign\fP parameter controls whether it is written horizontally +(\fBHORIZONTAL\fP) or vertically (\fBVERTICAL\fP). +.IP +Finally, only a subset of the string is written. +The function starts with the data from the \fIstart\fP item of +\fIstring\fP, and ends before the \fIend\fP item. +If \fIstart\fP is greater than, or equal to \fIend\fP, no data is written. +.TP 5 +.B writeChtype +writes out a \fBchtype\ *\fP string without adding attributes. +The parameters are passed to \fBwriteChtypeAttrib\fP as is. +.TP 5 +.B writeChtypeAttrib +writes out a \fIchtype\ *\fP string with the given attributes added. +The string is written to the given \fIwindow\fP, +using its relative screen coordinates \fIypos\fP and \fIxpos\fP. +You would normally construct the string from a \fIchar\ *\fP string +using \fBchar2Chtype\fP (3). +.IP +The function ORs the attribute \fIattr\fP with each item from the string. +For instance, it may be \fBA_BOLD\fP. +The \fIalign\fP parameter controls whether it is written horizontally +(\fBHORIZONTAL\fP) or vertically (\fBVERTICAL\fP). +.IP +Finally, only a subset of the string is written. +The function starts with the data from the \fIstart\fP item of +\fIstring\fP, and ends before the \fIend\fP item. +If \fIstart\fP is greater than, or equal to \fIend\fP, no data is written. +. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_util (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_entry.3 b/deps/cdk-5.0-20161210/man/cdk_entry.3 new file mode 100644 index 0000000..99e5bba --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_entry.3 @@ -0,0 +1,550 @@ +'\" t +.\" $Id: cdk_entry.3,v 1.28 2016/12/11 02:04:55 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_entry 3 +.SH NAME +.XX activateCDKEntry +.XX cleanCDKEntry +.XX destroyCDKEntry +.XX drawCDKEntry +.XX eraseCDKEntry +.XX getCDKEntryBox +.XX getCDKEntryFillerChar +.XX getCDKEntryHiddenChar +.XX getCDKEntryMax +.XX getCDKEntryMin +.XX getCDKEntryValue +.XX injectCDKEntry +.XX moveCDKEntry +.XX newCDKEntry +.XX positionCDKEntry +.XX setCDKEntry +.XX setCDKEntryBackgroundAttrib +.XX setCDKEntryBackgroundColor +.XX setCDKEntryBox +.XX setCDKEntryBoxAttribute +.XX setCDKEntryCB +.XX setCDKEntryFillerChar +.XX setCDKEntryHiddenChar +.XX setCDKEntryHighlight +.XX setCDKEntryHorizontalChar +.XX setCDKEntryLLChar +.XX setCDKEntryLRChar +.XX setCDKEntryMax +.XX setCDKEntryMin +.XX setCDKEntryPostProcess +.XX setCDKEntryPreProcess +.XX setCDKEntryULChar +.XX setCDKEntryURChar +.XX setCDKEntryValue +.XX setCDKEntryVerticalChar +cdk_entry \- curses text-entry widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "char *activateCDKEntry (" +.BI "CDKENTRY *" "entry", +.BI "chtype *" "actions"); +.TP 15 +.B "void cleanCDKEntry (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "void destroyCDKEntry (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "void drawCDKEntry (" +.BI "CDKENTRY *" "entry", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKEntry (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "boolean getCDKEntryBox (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "chtype getCDKEntryFillerChar (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "chtype getCDKEntryHiddenChar (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "int getCDKEntryMax (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "int getCDKEntryMin (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "char *getCDKEntryValue (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "int injectCDKEntry (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKEntry (" +.BI "CDKENTRY *" "entry", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKENTRY *newCDKEntry (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "const char *" "title", +.BI "const char *" "label", +.BI "chtype " "fieldAttribute", +.BI "chtype " "fillerCharacter", +.BI "EDisplayType " "displayType", +.BI "int " "fieldWidth", +.BI "int " "minimumLength", +.BI "int " "maximumLength", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKEntry (" +.BI "CDKENTRY *" "entry"); +.TP 15 +.B "void setCDKEntry (" +.BI "CDKENTRY *" "entry", +.BI "const char *" "value", +.BI "int " "minimumLength", +.BI "int " "maximumLength", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKEntryBackgroundAttrib (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKEntryBackgroundColor (" +.BI "CDKENTRY *" "entry", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKEntryBox (" +.BI "CDKENTRY *" "entry", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKEntryBoxAttribute (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKEntryCB (" +.BI "CDKENTRY *" "entry", +.BI "ENTRYCB " "callBackFunction"); +.TP 15 +.B "void setCDKEntryFillerChar (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKEntryHiddenChar (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKEntryHighlight (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "highlight", +.BI "boolean " "cursor"); +.TP 15 +.B "void setCDKEntryHorizontalChar (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKEntryLLChar (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKEntryLRChar (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKEntryMax (" +.BI "CDKENTRY *" "entry", +.BI "int " "maximum"); +.TP 15 +.B "void setCDKEntryMin (" +.BI "CDKENTRY *" "entry", +.BI "int " "minimum"); +.TP 15 +.B "void setCDKEntryPostProcess (" +.BI "CDKENTRY *" "entry", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKEntryPreProcess (" +.BI "CDKENTRY *" "entry", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKEntryULChar (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKEntryURChar (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKEntryValue (" +.BI "CDKENTRY *" "entry", +.BI "const char *" "value"); +.TP 15 +.B "void setCDKEntryVerticalChar (" +.BI "CDKENTRY *" "entry", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk entry widget creates a text-entry box with a label and an entry field. +The following functions create or manipulate the Cdk entry box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKEntry +activates the entry widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBentry\fR is a pointer to a non-NULL entry widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return +a \fIchar *\fR representing the information typed into the widget and the +widget data \fIexitType\fR will be set to \fIvNORMAL\fR. +.IP +If the character +entered was \fIESCAPE\fR then the function will return \fINULL\fR pointer and +the widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP 5 +.B cleanCDKEntry +clears the information from the field. +.TP 5 +.B destroyCDKEntry +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKEntry +draws the entry widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKEntry +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKEntryBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKEntryFillerChar +returns the character being used to draw unused space in the widget. +.TP 5 +.B getCDKEntryHiddenChar +returns the character being used to draw the hidden character type. +.TP 5 +.B getCDKEntryMax +returns the maximum length of a string the widget will allow. +.TP 5 +.B getCDKEntryMin +returns the minimum length of a string the widget will allow. +.TP 5 +.B getCDKEntryValue +returns the current value of the widget. +.TP 5 +.B injectCDKEntry +injects a single character into the widget. +.RS +.bP +The parameter \fBentry\fR is a pointer to a non-NULL entry widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a \fIchar *\fR representing the information typed into the widget. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKEntry +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which states +whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKEntry +creates a pointer to an entry widget. +Parameters: +.RS +.bP +The \fBscreen\fR parameter +is the screen you wish this widget to be placed in. +.bP +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.bP +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +\fBtitle\fR +is the string which will be displayed at the top of the widget. +The title can be more than one line; just provide a carriage +return character at the line break. +.bP +\fBlabel\fR +is the string which will be displayed in the label of the entry field. +.bP +\fBfieldAttribute\fR +is the attribute of the characters which are typed in. +.bP +\fBfiller\fR +is the character which is to be displayed in an empty space in the entry field. +.bP +\fBdisplayType\fR +tells how the entry field will behave when a character is entered into the field. +See \fBcdk_display (3)\fR for valid values for this field. +.bP +\fBfieldWidth\fR +denotes the width of the field: +.RS +.bP +If a value +of zero is provided, the field will be made as wide as possible on the screen. +.bP +If a negative value is given, then the field width will be the +maximum width minus the value provided. +.RE +.bP +\fBminimumLength\fR +controls the number of characters +which must be entered before the user can exit the entry field. +.bP +\fBmaximumLength\fR +sets the maximum number of characters that can be entered. +.bP +\fBbox\fR +is true if the widget should be drawn with a box around it. +.bP +\fBshadow\fR +turns the shadow on around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKEntry +allows the user to move the widget around the screen via the +cursor/keypad keys. +The following key bindings can be used to move the +widget around the screen. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKEntry +lets the programmer modify certain elements of an existing +entry widget. +.RS +.bP +The \fBvalue\fR parameter sets the value of the contents of the +entry field. +.bP +The other parameter names correspond to the same parameter names +listed in the \fBnewCDKEntry\fR function. +.RE +.TP 5 +.B setCDKEntryBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKEntryBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKEntryBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKEntryBoxAttribute +function sets the attribute of the box. +.TP 5 +.B setCDKEntryCB +allows the programmer to set a different widget input handler. +.IP +The parameter \fBcallbackFunction\fR is of type \fIENTRYCB\fR. +.IP +The default function is \fICDKEntryCallBack\fR. +.TP 5 +.B setCDKEntryFillerChar +sets the character to use when drawing unused space in the field. +.TP 5 +.B setCDKEntryHiddenChar +sets the character to use when using a hidden character type. +.TP 5 +.B setCDKEntryHighlight +sets the attribute of the entry field. +.TP 5 +.B setCDKEntryHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKEntryLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKEntryLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKEntryMax +sets the maximum length of the string that the widget will allow. +.TP 5 +.B setCDKEntryMin +sets the minimum length of the string that the widget will allow. +.TP 5 +.B setCDKEntryPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKEntryPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKEntryULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKEntryURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKEntryValue +sets the current value of the widget. +.TP 5 +.B setCDKEntryVerticalChar +sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/); +l l +lw10 lw30 . +\fBKey/Action\fR += +Left Arrow/Moves the cursor to the left. +CTRL-B/Moves the cursor to the left. +Right Arrow/Moves the cursor to the right. +CTRL-F/Moves the cursor to the right. +Delete/Deletes the character at the cursor. +Backspace/Deletes the character before cursor, moves cursor left. +CTRL-V/T{ +Pastes whatever is in the paste buffer, into the widget. +T} +CTRL-X/T{ +Cuts the contents from the widget and saves a copy in the paste buffer. +T} +CTRL-Y/T{ +Copies the contents of the widget into the paste buffer. +T} +CTRL-U/Erases the contents of the widget. +CTRL-A/T{ +Moves the cursor to the beginning of the entry field. +T} +CTRL-E/T{ +Moves the cursor to the end of the entry field. +T} +CTRL-T/T{ +Transposes the character under the cursor with the character to the right. +T} +Return/T{ +Exits the widget and returns a \fIchar *\fR representing the information which was typed into the field. +It also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exits the widget and returns a \fIchar *\fR representing the information which was typed into the field. +It also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns a \fINULL\fR pointer. +It also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. += +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_process (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_fselect.3 b/deps/cdk-5.0-20161210/man/cdk_fselect.3 new file mode 100644 index 0000000..a56c6ff --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_fselect.3 @@ -0,0 +1,579 @@ +'\" t +.\" $Id: cdk_fselect.3,v 1.28 2016/12/10 16:47:53 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_fselect 3 +.SH NAME +.XX activateCDKFselect +.XX deleteFileCB +.XX destroyCDKFselect +.XX drawCDKFselect +.XX eraseCDKFselect +.XX getCDKFselectBox +.XX getCDKFselectContents +.XX getCDKFselectCurrentItem +.XX getCDKFselectDirAttribute +.XX getCDKFselectDirContents +.XX getCDKFselectDirectory +.XX getCDKFselectFileAttribute +.XX getCDKFselectFillerChar +.XX getCDKFselectHighlight +.XX getCDKFselectLinkAttribute +.XX getCDKFselectSocketAttribute +.XX injectCDKFselect +.XX moveCDKFselect +.XX newCDKFselect +.XX positionCDKFselect +.XX setCDKFselect +.XX setCDKFselectBackgroundAttrib +.XX setCDKFselectBackgroundColor +.XX setCDKFselectBox +.XX setCDKFselectBoxAttribute +.XX setCDKFselectContents +.XX setCDKFselectCurrentItem +.XX setCDKFselectDirAttribute +.XX setCDKFselectDirContents +.XX setCDKFselectDirectory +.XX setCDKFselectFileAttribute +.XX setCDKFselectFillerChar +.XX setCDKFselectHighlight +.XX setCDKFselectHorizontalChar +.XX setCDKFselectLLChar +.XX setCDKFselectLRChar +.XX setCDKFselectLinkAttribute +.XX setCDKFselectSocketAttribute +.XX setCDKFselectULChar +.XX setCDKFselectURChar +.XX setCDKFselectVerticalChar +cdk_fselect \- curses file selector widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "char *activateCDKFselect (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype *" "actions"); +.TP 15 +.B "void deleteFileCB (" +.BI "EObjectType " "objectType", +.BI "void *" "object", +.BI "void *" "clientData"); +.TP 15 +.B "void destroyCDKFselect (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "void drawCDKFselect (" +.BI "CDKFSELECT *" "fselect", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKFselect (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "boolean getCDKFselectBox (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "char **getCDKFselectContents (" +.BI "CDKFSELECT *" "widget", +.BI "int *" "size"); +.TP 15 +.B "int getCDKFselectCurrentItem (" +.BI "CDKFSELECT *" "widget"); +.TP 15 +.B "char *getCDKFselectDirAttribute (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "char **getCDKFselectDirContents (" +.BI "CDKFSELECT *" "fselect", +.BI "int *" "count"); +.TP 15 +.B "char *getCDKFselectDirectory (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "char *getCDKFselectFileAttribute (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "chtype getCDKFselectFillerChar (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "chtype getCDKFselectHighlight (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "char *getCDKFselectLinkAttribute (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "char *getCDKFselectSocketAttribute (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "char *injectCDKFselect (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKFselect (" +.BI "CDKFSELECT *" "fselect", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKFSELECT *newCDKFselect (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "height", +.BI "int " "width", +.BI "const char *" "title", +.BI "const char *" "label", +.BI "chtype " "fieldAttribute", +.BI "chtype " "fillerCharacter", +.BI "chtype " "highlight", +.BI "const char *" "dirAttribute", +.BI "const char *" "fileAttribute", +.BI "const char *" "linkAttribute", +.BI "const char *" "sockAttribute", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKFselect (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "void setCDKFselect (" +.BI "CDKFSELECT *" "fselect", +.BI "const char *" "directory", +.BI "chtype " "fieldAttribute", +.BI "chtype " "fillerCharacter", +.BI "chtype " "highlight", +.BI "const char *" "dirAttribute", +.BI "const char *" "fileAttribute", +.BI "const char *" "linkAttribute", +.BI "const char *" "sockAttribute", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKFselectBackgroundAttrib (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKFselectBackgroundColor (" +.BI "CDKFSELECT *" "fselect", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKFselectBox (" +.BI "CDKFSELECT *" "fselect", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKFselectBoxAttribute (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKFselectContents (" +.BI "CDKFSELECT *" "widget", +.BI "CDK_CONST char **" "list", +.BI "int " "listSize"); +.TP 15 +.B "void setCDKFselectCurrentItem (" +.BI "CDKFSELECT *" "widget", +.BI "int " "item"); +.TP 15 +.B "void setCDKFselectDirAttribute (" +.BI "CDKFSELECT *" "fselect", +.BI "const char *" "attribute"); +.TP 15 +.B "int setCDKFselectDirContents (" +.BI "CDKFSELECT *" "fselect"); +.TP 15 +.B "int setCDKFselectDirectory (" +.BI "CDKFSELECT *" "fselect", +.BI "const char *" "directory"); +.TP 15 +.B "void setCDKFselectFileAttribute (" +.BI "CDKFSELECT *" "fselect", +.BI "const char *" "attribute"); +.TP 15 +.B "void setCDKFselectFillerChar (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "filler"); +.TP 15 +.B "void setCDKFselectHighlight (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKFselectHorizontalChar (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKFselectLLChar (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKFselectLRChar (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKFselectLinkAttribute (" +.BI "CDKFSELECT *" "fselect", +.BI "const char *" "attribute"); +.TP 15 +.B "void setCDKFselectSocketAttribute (" +.BI "CDKFSELECT *" "fselect", +.BI "const char *" "attribute"); +.TP 15 +.B "void setCDKFselectULChar (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKFselectURChar (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKFselectVerticalChar (" +.BI "CDKFSELECT *" "fselect", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk file selector widget creates a widget which allows a user to interact +with the Unix file system. +This widget allows the user to traverse the file +system and even delete files. +(See \fINOTES\fR below for more information) +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKFselect +activates the file selector widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBfselect\fR is a pointer to a non-NULL file selector widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return +a \fIchar *\fR representing the information typed into the widget and the +widget data \fIexitType\fR will be set to \fIvNORMAL\fR. +.IP +If the character +entered was \fIESCAPE\fR then the function will return \fINULL\fR pointer and +the widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +void deleteFileCB (EObjectType objectType GCC_UNUSED, void *object, void *clientData) +.TP 5 +.B deleteFileCB +Prompts the user to confirm, +and deletes the current item in the file-list. +.TP 5 +.B destroyCDKFselect +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKFselect +draws the fselect widget on the screen. +If the \fBbox\fR option is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKFselect +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKFselectBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKFselectContents +returns the directory-contents (which are formatted), +and sets the number of entries via the \fIsize\fP parameter. +.TP 5 +.B getCDKFselectCurrentItem +returns the current position in the scroll-widget. +.TP 5 +.B getCDKFselectDirAttribute +returns the attribute that directories are drawn with in the +scrolling region of the widget. +.TP +.B getCDKFselectDirContents +returns the list of files and the corresponding count as a side-effect. +If no files are found, this function returns zero, otherwise one. +.TP 5 +.B getCDKFselectDirectory +returns the current directory of the widget. +.TP 5 +.B getCDKFselectFileAttribute +returns the attribute that plain files are drawn with in the +scrolling region of the widget. +.TP 5 +.B getCDKFselectFillerChar +returns the character being used as the filler character in the +entry field portion of the widget. +.TP 5 +.B getCDKFselectHighlight +returns the attribute of the highlight bar of the scrolling +list portion of the widget. +.TP 5 +.B getCDKFselectLinkAttribute +returns the attribute that symbolic links are drawn with in the +scrolling region of the widget. +.TP 5 +.B getCDKFselectSocketAttribute +returns the attribute that sockets are drawn with in the +scrolling region of the widget. +.TP 5 +.B injectCDKFselect +injects a single character into the widget. +The parameter \fBfselect\fR is a pointer to a non-NULL file selector widget. +The parameter \fBcharacter\fR is the character to inject into the widget. +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a \fIchar *\fR representing the information typed into the widget. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKFselect +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.bP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which states +whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKFselect +creates an fselect widget and returns a pointer to it. +Parameters: +.RS +.bP +The \fBscreen\fR parameter +is the screen you wish this widget to be placed in. +.bP +The parameter \fBxpos\fR +controls the placement of the object along the horizontal axis. +This parameter +may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer value or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +\fBheight\fR and \fBwidth\fR +control the height and width of the widget. +If you provide a value of zero for either of the height or the width, +the widget will be created with the full width and height of the screen. +If you provide a negative value, the widget will be created the full height or +width minus the value provided. +.bP +\fBtitle\fR +is the string which will be displayed at the top of the widget. +The title can be more than one +line; just provide a carriage return character at the line break. +.bP +\fBlabel\fR +is the text to use as the label of the file selector. +.bP +\fBfieldAttribute\fR +is the attribute of the entry field at the top of the widget; +.bP +\fBfillerCharacter\fR +is the filler character for the entry field. +.bP +\fBhighlight\fR +is the highlight attribute on the scrolling list. +.bP +\fBdirAttribute\fR, +\fBfileAttribute\fR, +\fBlinkAttribute\fR and +\fBsockAttribute\fR +are the attributes of directories, files, links, and +sockets found in the directory list. +.bP +\fBbox\fR +is true if the widget should be drawn with a box around it. +.bP +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKFselect +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKFselect +lets the programmer modify certain elements of an existing fselect widget. +The parameter names correspond to the same parameter +names listed in the \fBnewCDKFselect\fR function. +.TP 5 +.B setCDKFselectBackgroundAttrib +sets the background attribute of the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKFselectBackgroundColor +sets the background color of the widget. +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKFselectBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKFselectBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKFselectContents +sets the contents of the widget. +.TP 5 +.B setCDKFselectCurrentItem +set the current position in the scroll-widget. +.TP 5 +.B setCDKFselectDirAttribute +sets the attribute that directories will be drawn with in the scrolling +region of the widget. +.B +.B setCDKFselectDirContents +This creates a list of the files in the current directory. +See \fBgetCDKFselectDirContents\FP. +.TP 5 +.B setCDKFselectDirectory +sets the current directory of the widget. +.TP 5 +.B setCDKFselectFileAttribute +sets the attribute that plain files will be drawn with in the scrolling +region of the widget. +.TP 5 +.B setCDKFselectFillerChar +sets the character to use when drawing the entry field portion of the widget. +.TP 5 +.B setCDKFselectHighlight +sets the attribute of the highlight bar of the scrolling +list portion of the widget. +.TP 5 +.B setCDKFselectHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKFselectLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKFselectLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKFselectLinkAttribute +sets the attribute that symbolic links will be drawn with in the scrolling +region of the widget. +.TP 5 +.B setCDKFselectSocketAttribute +sets the attribute that sockets will be drawn with in the scrolling +region of the widget. +.TP 5 +.B setCDKFselectULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKFselectURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKFselectVerticalChar +sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +Since this widget is +built from both the scrolling list widget and the entry field widget, the key +bindings are the same for the respective fields. +The extra key bindings are +listed below. +.LP +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +CTRL-^/Displays statistics about the current filename. +Tab/Tries to complete the current filename. +Up Arrow/Scrolls the scrolling list up one line. +Down Arrow/Scrolls the scrolling list down one line. +Page Up/Scrolls the scrolling list up one page. +CTRL-B/Scrolls the scrolling list up one page. +Page Down/T{ +Scrolls the scrolling list down one page. +T} +CTRL-F/T{ +Scrolls the scrolling list down one page. +T} +Return/T{ +Returns the filename in the entry field of the file selector. +It also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns a \fINULL\fR pointer. +It also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) +.SH NOTES +.PP +This widget is created from the scrolling list widget and the entry field widget. +This is a good example on how to build your own widgets using the +base widgets provided in this distribution. +In order for you to delete +files using the file selector, you must add the following call +into your program. +(the character X is the character you wish to use to +tell the file selector you want to delete a file.) +.RS 5 +\fBbindCDKObject (vSCROLL, fselect->filelist, X, deleteFile, fselect);\fR +.RE +where \fBfselect\fR is a pointer to the object. +This was originally turned on, +but I thought it better to put the control of file deletion on an 'as-need' basis. diff --git a/deps/cdk-5.0-20161210/man/cdk_graph.3 b/deps/cdk-5.0-20161210/man/cdk_graph.3 new file mode 100644 index 0000000..f35ce0f --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_graph.3 @@ -0,0 +1,382 @@ +.\" $Id: cdk_graph.3,v 1.17 2016/12/10 16:51:56 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_graph 3 +.SH NAME +.XX activateCDKGraph +.XX destroyCDKGraph +.XX drawCDKGraph +.XX eraseCDKGraph +.XX getCDKGraphBox +.XX getCDKGraphCharacter +.XX getCDKGraphCharacters +.XX getCDKGraphDisplayType +.XX getCDKGraphValue +.XX getCDKGraphValues +.XX moveCDKGraph +.XX newCDKGraph +.XX positionCDKGraph +.XX setCDKGraph +.XX setCDKGraphBackgroundAttrib +.XX setCDKGraphBackgroundColor +.XX setCDKGraphBox +.XX setCDKGraphBoxAttribute +.XX setCDKGraphCharacter +.XX setCDKGraphCharacters +.XX setCDKGraphDisplayType +.XX setCDKGraphHorizontalChar +.XX setCDKGraphLLChar +.XX setCDKGraphLRChar +.XX setCDKGraphULChar +.XX setCDKGraphURChar +.XX setCDKGraphValue +.XX setCDKGraphValues +.XX setCDKGraphVerticalChar +cdk_graph \- curses graph widget +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "void activateCDKGraph (" +.BI "CDKGRAPH *" "graph", +.BI "chtype *" "unused"); +.TP 15 +.B "void destroyCDKGraph (" +.BI "CDKGRAPH *" "graph"); +.TP 15 +.B "void drawCDKGraph (" +.BI "CDKGRAPH *" "graph", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKGraph (" +.BI "CDKGRAPH *" "graph"); +.TP 15 +.B "boolean getCDKGraphBox (" +.BI "CDKGRAPH *" "graph"); +.TP 15 +.B "chtype getCDKGraphCharacter (" +.BI "CDKGRAPH *" "graph", +.BI "int " "index"); +.TP 15 +.B "chtype *getCDKGraphCharacters (" +.BI "CDKGRAPH *" "graph"); +.TP 15 +.B "EGraphDisplayType getCDKGraphDisplayType (" +.BI "CDKGRAPH *" "graph"); +.TP 15 +.B "int getCDKGraphValue (" +.BI "CDKGRAPH *" "graph", +.BI "int " "index"); +.TP 15 +.B "int *getCDKGraphValues (" +.BI "CDKGRAPH *" "graph", +.BI "int *" "size"); +.TP 15 +.B "void moveCDKGraph (" +.BI "CDKGRAPH *" "graph", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKGRAPH *newCDKGraph (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "height", +.BI "int " "width", +.BI "const char *" "title", +.BI "const char *" "xtitle", +.BI "const char *" "ytitle"); +.TP 15 +.B "void positionCDKGraph (" +.BI "CDKGRAPH *" "graph"); +.TP 15 +.B "int setCDKGraph (" +.BI "CDKGRAPH *" "graph", +.BI "int *" "values", +.BI "int " "valueCount", +.BI "const char *" "graphCharacters", +.BI "boolean " "startAtZero", +.BI "EGraphDisplayType " "displayType"); +.TP 15 +.B "void setCDKGraphBackgroundAttrib (" +.BI "CDKGRAPH *" "graph", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKGraphBackgroundColor (" +.BI "CDKGRAPH *" "graph", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKGraphBox (" +.BI "CDKGRAPH *" "graph", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKGraphBoxAttribute (" +.BI "CDKGRAPH *" "graph", +.BI "chtype " "character"); +.TP 15 +.B "int setCDKGraphCharacter (" +.BI "CDKGRAPH *" "graph", +.BI "int " "index", +.BI "const char *" "graphCharacter"); +.TP 15 +.B "int setCDKGraphCharacters (" +.BI "CDKGRAPH *" "graph", +.BI "const char *" "graphCharacters"); +.TP 15 +.B "void setCDKGraphDisplayType (" +.BI "CDKGRAPH *" "graph", +.BI "EGraphDisplayType " "type"); +.TP 15 +.B "void setCDKGraphHorizontalChar (" +.BI "CDKGRAPH *" "graph", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKGraphLLChar (" +.BI "CDKGRAPH *" "graph", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKGraphLRChar (" +.BI "CDKGRAPH *" "graph", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKGraphULChar (" +.BI "CDKGRAPH *" "graph", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKGraphURChar (" +.BI "CDKGRAPH *" "graph", +.BI "chtype " "character"); +.TP 15 +.B "int setCDKGraphValue (" +.BI "CDKGRAPH *" "graph", +.BI "int " "index", +.BI "int " "value", +.BI "boolean " "startAtZero"); +.TP 15 +.B "int setCDKGraphValues (" +.BI "CDKGRAPH *" "graph", +.BI "int *" "values", +.BI "int " "valueCount", +.BI "boolean " "startAtZero"); +.TP 15 +.B "void setCDKGraphVerticalChar (" +.BI "CDKGRAPH *" "graph", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk graph widget creates a graph in either X/Y plot or line mode. +The following functions create or manipulate the Cdk graph box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKGraph +this is an obsolete function that calls \fBdrawCDKGraph\fP. +.TP 5 +.B destroyCDKGraph +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKGraph +draws the graph widget on the screen. +The \fBbox\fR option tells whether to draw the widget with a box. +.TP 5 +.B eraseCDKGraph +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKGraphBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKGraphCharacter +returns the character in the graph at the given index. +.TP 5 +.B getCDKGraphCharacters +returns all the characters currently in the graph widget. +.TP 5 +.B getCDKGraphDisplayType +returns the current display type of the widget. +.TP 5 +.B getCDKGraphValue +returns the value in the graph at the given index. +.TP 5 +.B getCDKGraphValues +returns all the values currently in the graph widget. +.TP 5 +.B moveCDKGraph +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which states +whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKGraph +creates a pointer to a graph widget. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBheight\fR and +.TP 5 +\fBwidth\fR +control the height and width of the widget. +If you provide a zero for either of the height or the width, +the widget will be created with the full width and height of the screen. +If you provide a negative value, the widget will be created the full height or +width minus the value provided. +.TP 5 +\fBtitle\fR, +.TP 5 +\fBxtitle\fR and +.TP 5 +\fBytitle\fR +are the graph title, the X axis title, and the Y axis title respectively. +The graph title may be more than one line by providing a +carriage return character at the line break. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKGraph +allows the user to move the widget around the screen via the +cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKGraph +lets the programmer set the specific values of the graph widget. +.RS +.bP +The parameter \fBvalues\fR is an integer array of the values to display in the +widget; \fBvalueCount\fR is the number of values in the array. +.bP +The parameter \fBgraphCharacters\fR is an array of the characters to use for each graph point. +.bP +The parameter \fBstartAtZero\fR states whether you want the graph to start at +zero or the lowest values of the X and Y axis'. +.bP +The parameter \fBdisplayType\fR +may be \fIvPLOT\fR, to make the graph draw the values as a plot graph, +or \fIvLINE\fR to draw the values as a line graph. +.RE +.TP 5 +.B setCDKGraphBackgroundAttrib +sets the background attribute of the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKGraphBackgroundColor +sets the background color of the widget. +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKGraphBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKGraphBoxAttribute +function sets the attribute of the box. +.TP 5 +.B setCDKGraphCharacter +lets the programmer set a specific character of the graph widget. +The parameter \fBcharacter\fR is the new character, while \fBindex\fR is the +index where the new character will be stored. +.TP 5 +.B setCDKGraphCharacters +lets the programmer set the specific characters of the graph widget. +The parameter \fBcharacters\fR is a char pointer array of the characters to display +in the widget. +.TP 5 +.B setCDKGraphDisplayType +allows the programmer tochange the way the graph draws itself. +The parameter \fBdisplayType\fR may be \fIvPLOT\fR, to make the graph +draw the values as a plot graph, or \fIvLINE\fR to draw the values as a line graph. +.TP 5 +.B setCDKGraphHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKGraphLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKGraphLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKGraphULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKGraphURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKGraphValue +lets the programmer set a specific value of the graph widget. +.RS +.bP +The parameter \fBvalue\fR is the new value, while \fBindex\fR is the +index where the new value will be stored. +.bP +The parameter \fBstartAtZero\fR +states whether you want the graph to start at zero or the lowest values of +the X and Y axis. +.RE +.TP 5 +.B setCDKGraphValues +lets the programmer set the specific values of the graph widget. +.RS +.bP +The parameter \fBvalues\fR is an integer array of the values to display in the +widget. +.bP +\fBvalueCount\fR is the number of values in the array. +.bP +The parameter \fBstartAtZero\fR states whether you want the graph to start at +zero or the lowest values of the X and Y axis'. +.RE +.TP 5 +.B setCDKGraphVerticalChar +sets the vertical drawing character for the box to the given character. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_histogram.3 b/deps/cdk-5.0-20161210/man/cdk_histogram.3 new file mode 100644 index 0000000..14e7161 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_histogram.3 @@ -0,0 +1,417 @@ +'\" t +.\" $Id: cdk_histogram.3,v 1.17 2016/12/10 16:59:39 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_histogram 3 +.SH NAME +.XX activateCDKHistogram +.XX destroyCDKHistogram +.XX drawCDKHistogram +.XX eraseCDKHistogram +.XX getCDKHistogramBox +.XX getCDKHistogramFillerChar +.XX getCDKHistogramHighValue +.XX getCDKHistogramLowValue +.XX getCDKHistogramStatsAttr +.XX getCDKHistogramStatsPos +.XX getCDKHistogramValue +.XX getCDKHistogramViewType +.XX moveCDKHistogram +.XX newCDKHistogram +.XX positionCDKHistogram +.XX setCDKHistogram +.XX setCDKHistogramBackgroundAttrib +.XX setCDKHistogramBackgroundColor +.XX setCDKHistogramBox +.XX setCDKHistogramBoxAttribute +.XX setCDKHistogramDisplayType +.XX setCDKHistogramFillerChar +.XX setCDKHistogramHorizontalChar +.XX setCDKHistogramLLChar +.XX setCDKHistogramLRChar +.XX setCDKHistogramStatsAttr +.XX setCDKHistogramStatsPos +.XX setCDKHistogramULChar +.XX setCDKHistogramURChar +.XX setCDKHistogramValue +.XX setCDKHistogramVerticalChar +.XX setCDKHistogramViewType +cdk_histogram \- curses histogram widget +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "void activateCDKHistogram (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "unused"); +.TP 15 +.B "void destroyCDKHistogram (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "void drawCDKHistogram (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKHistogram (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "boolean getCDKHistogramBox (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "chtype getCDKHistogramFillerChar (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "int getCDKHistogramHighValue (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "int getCDKHistogramLowValue (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "chtype getCDKHistogramStatsAttr (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "int getCDKHistogramStatsPos (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "int getCDKHistogramValue (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "EHistogramDisplayType getCDKHistogramViewType (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "void moveCDKHistogram (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKHISTOGRAM *newCDKHistogram (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "height", +.BI "int " "width", +.BI "int " "orient", +.BI "const char *" "title", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKHistogram (" +.BI "CDKHISTOGRAM *" "histogram"); +.TP 15 +.B "void setCDKHistogram (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "EHistogramDisplayType " "viewType", +.BI "int " "statsPos", +.BI "chtype " "statsAttribute", +.BI "int " "lowValue", +.BI "int " "highValue", +.BI "int " "currentValue", +.BI "chtype " "fillerCharacter", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKHistogramBackgroundAttrib (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKHistogramBackgroundColor (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKHistogramBox (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKHistogramBoxAttribute (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKHistogramDisplayType (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "EHistogramDisplayType " "viewtype"); +.TP 15 +.B "void setCDKHistogramFillerChar (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "fillerCharacter"); +.TP 15 +.B "void setCDKHistogramHorizontalChar (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKHistogramLLChar (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKHistogramLRChar (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKHistogramStatsAttr (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "statsAttribute"); +.TP 15 +.B "void setCDKHistogramStatsPos (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "int " "statsPosition"); +.TP 15 +.B "void setCDKHistogramULChar (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKHistogramURChar (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKHistogramValue (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "int " "lowValue", +.BI "int " "highValue", +.BI "int " "currentValue"); +.TP 15 +.B "void setCDKHistogramVerticalChar (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKHistogramViewType (" +.BI "CDKHISTOGRAM *" "histogram", +.BI "EHistogramDisplayType " "viewType"); +.fi +.SH DESCRIPTION +The Cdk histogram widget creates a histogram widget. +This widget can draw a vertical or horizontal histogram. +The functions create or manipulate the Cdk histogram box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKHistogram +obsolete entrypoint which calls \fBdrawCDKHistogram\fP. +.TP 5 +.B destroyCDKHistogram +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKHistogram +draws the histogram widget on the screen. +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKHistogram +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKHistogramBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKHistogramFillerChar +returns the character being used to draw the histogram bar. +.TP 5 +.B getCDKHistogramHighValue +returns the high value of the histogram. +.TP 5 +.B getCDKHistogramLowValue +returns the low value of the histogram. +.TP 5 +.B getCDKHistogramStatsAttr +returns the attribute of the statistics of the histogram. +.TP 5 +.B getCDKHistogramStatsPos +returns where the histogram will draw the statistics. +.TP 5 +.B getCDKHistogramValue +returns the current value of the histogram. +.TP 5 +.B getCDKHistogramViewType +returns the view type of the histogram widget. +.TP 5 +.B moveCDKHistogram +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.bP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +The parameter \fBypos\fR can be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example +if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which states +whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKHistogram +creates a histogram widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBtitle\fR +is the string which will be displayed at the top of the widget. +The title can be more than one line; just provide a carriage return +character at the line break. +.TP 5 +\fBheight\fR and +.TP 5 +\fBwidth\fR +control the height and width of the widget. +If you provide a value of zero for either +of the height or the width, the widget will be created with the full width and +height of the screen. +If you provide a negative value, the widget will be created +the full height or width minus the value provided. +.TP 5 +\fBorient\fR +specifies the orientation of the histogram. +It is one of these pre-defined values: \fIVERTICAL\fR and \fIHORIZONTAL\fR. +.TP 5 +\fBlabel\fR +is the string to use as the label of the histogram. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKHistogram +allows the user to move the widget around the screen via the +cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKHistogram +lets the programmer set the specific values of the histogram widget. +.RS +.bP +The parameter \fBviewType\fR specifies the type of histogram to draw. +The following table lists the valid values and the results. +.LP +.TS +center tab(/) allbox; +l l +lw15 lw30 . +\fBDisplay_Type/Result\fR +vNONE/T{ +Displays no information about the current values. +T} +vPERCENT/T{ +Displays the current value as a percentage. +T} +vFRACTION/T{ +Displays the current value as a fraction. +T} +vREAL/Displays the current value. +.TE +.sp +.bP +The \fBstatsPosition\fR parameter states where the statistics will be displayed. +It accepts \fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +The parameter \fBstatsAttribute\fR sets the attributes of the statistics. +.bP +The parameters \fBlowValue\fR, \fBhighValue\fR, and \fBcurrentValue\fR are the low, high, +and current values respectively. +.bP +The \fBfiller\fR character is the character +to use in the unused space in the histogram. +.bP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.RE +.TP 5 +.B setCDKHistogramBackgroundAttrib +the background color attribute the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKHistogramBackgroundColor +the background color of the widget. +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKHistogramBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKHistogramBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKHistogramDisplayType +sets the display type (see \fBgetCDKHistogramViewType\fP). +.TP 5 +.B setCDKHistogramFillerChar +sets the character to use when drawing the histogram bar. +.TP 5 +.B setCDKHistogramHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKHistogramLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKHistogramLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKHistogramStatsAttr +sets the attribute to use when drawing the histogram statistics. +.TP 5 +.B setCDKHistogramStatsPos +sets where the statistics will be drawn on the widget. +See the \fBsetCDKHistogram\fR description for more details. +.TP 5 +.B setCDKHistogramULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKHistogramURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKHistogramValue +sets the low, high, and current value of the histogram. +.TP 5 +.B setCDKHistogramVerticalChar +sets the vertical drawing character for the box to +the given character. +.TP 5 +.B setCDKHistogramViewType +sets the view type of the histogram. +Look at the \fBsetCDKHistogram\fR description for more details. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_itemlist.3 b/deps/cdk-5.0-20161210/man/cdk_itemlist.3 new file mode 100644 index 0000000..a3763e2 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_itemlist.3 @@ -0,0 +1,463 @@ +'\" t +.\" $Id: cdk_itemlist.3,v 1.21 2016/12/10 17:03:49 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_itemlist 3 +.SH NAME +.XX activateCDKItemlist +.XX destroyCDKItemlist +.XX drawCDKItemlist +.XX drawCDKItemlistField +.XX eraseCDKItemlist +.XX getCDKItemlistBox +.XX getCDKItemlistCurrentItem +.XX getCDKItemlistDefaultItem +.XX getCDKItemlistValues +.XX injectCDKItemlist +.XX moveCDKItemlist +.XX newCDKItemlist +.XX positionCDKItemlist +.XX setCDKItemlist +.XX setCDKItemlistBackgroundAttrib +.XX setCDKItemlistBackgroundColor +.XX setCDKItemlistBox +.XX setCDKItemlistBoxAttribute +.XX setCDKItemlistCurrentItem +.XX setCDKItemlistDefaultItem +.XX setCDKItemlistHorizontalChar +.XX setCDKItemlistLLChar +.XX setCDKItemlistLRChar +.XX setCDKItemlistPostProcess +.XX setCDKItemlistPreProcess +.XX setCDKItemlistULChar +.XX setCDKItemlistURChar +.XX setCDKItemlistValues +.XX setCDKItemlistVerticalChar +cdk_itemlist \- curses itemlist widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKItemlist (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype *" "actions"); +.TP 15 +.B "void destroyCDKItemlist (" +.BI "CDKITEMLIST *" "itemlist"); +.TP 15 +.B "void drawCDKItemlist (" +.BI "CDKITEMLIST *" "itemlist", +.BI "boolean " "box"); +.TP 15 +.B "void drawCDKItemlistField (" +.BI "CDKITEMLIST *" "itemlist", +.BI "boolean " "highlight"); +.TP 15 +.B "void eraseCDKItemlist (" +.BI "CDKITEMLIST *" "itemlist"); +.TP 15 +.B "boolean getCDKItemlistBox (" +.BI "CDKITEMLIST *" "itemlist"); +.TP 15 +.B "int getCDKItemlistCurrentItem (" +.BI "CDKITEMLIST *" "itemlist"); +.TP 15 +.B "int getCDKItemlistDefaultItem (" +.BI "CDKITEMLIST *" "itemlist"); +.TP 15 +.B "chtype **getCDKItemlistValues (" +.BI "CDKITEMLIST *" "itemlist", +.BI "int *" "listSize"); +.TP 15 +.B "int injectCDKItemlist (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKItemlist (" +.BI "CDKITEMLIST *" "itemlist", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKITEMLIST *newCDKItemlist (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "const char *" "title", +.BI "const char *" "label", +.BI "CDK_CONST char **" "itemList", +.BI "int " "itemCount", +.BI "int " "defaultItem", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKItemlist (" +.BI "CDKITEMLIST *" "itemlist"); +.TP 15 +.B "void setCDKItemlist (" +.BI "CDKITEMLIST *" "itemlist", +.BI "CDK_CONST char **" "itemList", +.BI "int " "itemCount", +.BI "int " "currentSelection", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKItemlistBackgroundAttrib (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype" "attribute"); +.TP 15 +.B "void setCDKItemlistBackgroundColor (" +.BI "CDKITEMLIST *" "itemlist", +.BI "const char *" "color"); +.TP 15 +.B "void setCDKItemlistBox (" +.BI "CDKITEMLIST *" "itemlist", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKItemlistBoxAttribute (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKItemlistCurrentItem (" +.BI "CDKITEMLIST *" "itemlist", +.BI "int " "currentItem"); +.TP 15 +.B "void setCDKItemlistDefaultItem (" +.BI "CDKITEMLIST *" "itemlist", +.BI "int " "defaultItem"); +.TP 15 +.B "void setCDKItemlistHorizontalChar (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKItemlistLLChar (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKItemlistLRChar (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKItemlistPostProcess (" +.BI "CDKITEMLIST *" "itemlist", +.BI "PROCESSFN " "callback", +.BI "void *" "data"); +.TP 15 +.B "void setCDKItemlistPreProcess (" +.BI "CDKITEMLIST *" "itemlist", +.BI "PROCESSFN " "callback", +.BI "void *" "data"); +.TP 15 +.B "void setCDKItemlistULChar (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKItemlistURChar (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKItemlistValues (" +.BI "CDKITEMLIST *" "itemlist", +.BI "CDK_CONST char **" "itemList", +.BI "int " "itemCount"); +.TP 15 +.B "void setCDKItemlistVerticalChar (" +.BI "CDKITEMLIST *" "itemlist", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk itemlist widget creates a widget which allows a user to select from a +list of preset character strings such as +the days of the week or the months of the year. +The following functions create or manipulate the Cdk itemlist widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKItemlist +activates the itemlist widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBitemlist\fR is a pointer to a non-NULL itemlist widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return a +value from 0 to the number of buttons -1, representing the button selected. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the character entered into this widget was \fIESCAPE\fR +then the widget will return a -1 +and the widget data \fIexitType\fR will be set to +\fIvESCAPE_HIT\fR. +.RE +.TP 5 +.B destroyCDKItemlist +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKItemlist +draws the itemlist widget on the screen. +The \fBbox\fR option is true if the widget is drawn with a box. +.TP 5 +.B drawCDKItemlistField +draws the contents of the field. +.TP 5 +.B eraseCDKItemlist +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKItemlistBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKItemlistCurrentItem +returns the index of the currently displayed item in the widget. +.TP 5 +.B getCDKItemlistDefaultItem +returns the index of the default item in the widget. +.TP 5 +.B getCDKItemlistValues +returns the list of pointers to the items. +The parameter \fBsize\fR points to a location which receives the item count. +.TP 5 +.B injectCDKItemlist +injects a single character into the widget. +.RS +.bP +The parameter \fBitemlist\fR is a pointer to a non-NULL itemlist widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a value ranging from zero to one less than the number of buttons, +representing the button selected. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.RE +.TP 5 +.B moveCDKItemlist +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.bP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +The parameter \fBypos\fR may +be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKItemlist +creates a pointer to an itemlist widget. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBtitle\fR +is the string which will be displayed at the top of the widget. +The title can be more than one line; just provide a carriage return +character at the line break. +.TP 5 +\fBlabel\fR +is the string to use as the label of the itemlist field. +.TP 5 +\fBitemList\fR +is the list of the strings which will be displayed in the widget. +.TP 5 +\fBitemCount\fR +is the number of elements in the list. +.TP 5 +\fBdefaultItem\fR +is the index of the default item for the list. +.TP 5 +\fBbox\fR +is true if widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKItemlist +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKItemlist +lets the programmer modify certain elements of an existing itemlist widget. +The parameter names correspond to the same parameter names +listed in the \fBnewCDKItemlist\fR function. +.TP 5 +.B setCDKItemlistBackgroundAttrib +the background color attribute the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKItemlistBackgroundColor +sets the background color of the widget. +The parameter \fBcolor\fR is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKItemlistBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKItemlistBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKItemlistCurrentItem +sets the currently displayed item in the widget. +.TP 5 +.B setCDKItemlistDefaultItem +sets the default item in the widget. +.TP 5 +.B setCDKItemlistHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKItemlistLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKItemlistLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKItemlistPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.RE +.TP 5 +.B setCDKItemlistPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.RE +.TP 5 +.B setCDKItemlistULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKItemlistURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKItemlistValues +sets the contents of the list from an array of string pointers \fBitem\fR +whose final index is given by \fBcount\fR. +If \fBdefaultItem\fR is in the range 0..\fBcount\fR, that sets the +default item value for the list. +.TP 5 +.B setCDKItemlistVerticalChar +sets the vertical drawing character for the box to the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) box; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +Left Arrow +Down Arrow +- +p/Shift the list one column to the left. +_ +Right Arrow +Up Arrow +Space ++ +n/Shift the list one column to the right. +_ +d +D/Display the default item. +_ +0/Display the first item in the list. +$/Display the last item in the list. +_ +Return/T{ +Exit the widget and return an integer representing the current selection. +Also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exit the widget and return an integer representing the current selection. +Also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exit the widget and return -1. +Also set the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_process (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_label.3 b/deps/cdk-5.0-20161210/man/cdk_label.3 new file mode 100644 index 0000000..574204f --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_label.3 @@ -0,0 +1,281 @@ +.\" $Id: cdk_label.3,v 1.18 2016/12/10 17:08:28 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_label 3 +.SH NAME +.XX activateCDKLabel +.XX destroyCDKLabel +.XX drawCDKLabel +.XX eraseCDKLabel +.XX getCDKLabelBox +.XX getCDKLabelMessage +.XX moveCDKLabel +.XX newCDKLabel +.XX positionCDKLabel +.XX setCDKLabel +.XX setCDKLabelBackgroundAttrib +.XX setCDKLabelBackgroundColor +.XX setCDKLabelBox +.XX setCDKLabelBoxAttribute +.XX setCDKLabelHorizontalChar +.XX setCDKLabelLLChar +.XX setCDKLabelLRChar +.XX setCDKLabelMessage +.XX setCDKLabelULChar +.XX setCDKLabelURChar +.XX setCDKLabelVerticalChar +.XX waitCDKLabel +cdk_label \- Creates a managed curses label widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "void activateCDKLabel (" +.BI "CDKLABEL *" "label", +.BI "chtype " "unused"); +.TP 15 +.B "void destroyCDKLabel (" +.BI "CDKLABEL *" "label"); +.TP 15 +.B "void drawCDKLabel (" +.BI "CDKLABEL *" "label", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKLabel (" +.BI "CDKLABEL *" "label"); +.TP 15 +.B "boolean getCDKLabelBox (" +.BI "CDKLABEL *" "label"); +.TP 15 +.B "chtype **getCDKLabelMessage (" +.BI "CDKLABEL *" "label" +.BI "int *" "messageLines"); +.TP 15 +.B "void moveCDKLabel (" +.BI "CDKLABEL *" "label", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKLABEL *newCDKLabel (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "CDK_CONST char **" "message", +.BI "int " "messageLines", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKLabel (" +.BI "CDKLABEL *" "label"); +.TP 15 +.B "void setCDKLabel (" +.BI "CDKLABEL *" "label", +.BI "CDK_CONST char **" "message", +.BI "int " "messageLines", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKLabelBackgroundAttrib (" +.BI "CDKLABEL *" "label", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKLabelBackgroundColor (" +.BI "CDKLABEL *" "label", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKLabelBox (" +.BI "CDKLABEL *" "label", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKLabelBoxAttribute (" +.BI "CDKLABEL *" "label", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLabelHorizontalChar (" +.BI "CDKLABEL *" "label", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLabelLLChar (" +.BI "CDKLABEL *" "label", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLabelLRChar (" +.BI "CDKLABEL *" "label", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLabelMessage (" +.BI "CDKLABEL *" "label", +.BI "CDK_CONST char **" "message", +.BI "int " "messageLines"); +.TP 15 +.B "void setCDKLabelULChar (" +.BI "CDKLABEL *" "label", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLabelURChar (" +.BI "CDKLABEL *" "label", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLabelVerticalChar (" +.BI "CDKLABEL *" "label", +.BI "chtype " "character"); +.TP 15 +.B "char waitCDKLabel (" +.BI "CDKLABEL *" "label", +.BI "char " "key"); +.fi +.SH DESCRIPTION +The Cdk label widget creates a pop-up label window. +The following functions create or manipulate the Cdk label widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKLabel +obsolete entrypoint which calls \fBdrawCDKLabel\fP. +.TP 5 +.B destroyCDKLabel +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKLabel +draws the label widget on the screen. +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKLabel +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKLabelBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKLabelMessage +returns the contents of the label widget. +The parameter \fBmessageLines\fR points to the location +which will be given the number of message-lines. +.TP 5 +.B moveCDKLabel +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKLabel +creates a label widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBmessage\fR +is the message to be displayed in the window. +It may contain any of the standard Cdk display format commands. +To learn more about this see \fIcdk_display (3)\fR. +.TP 5 +\fBrows\fR +is the number of message rows that were passed in the \fBmessage\fR parameter. +.TP 5 +\fBbox\fR +is true if widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKLabel +allows the user to move the widget around the screen via the +cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKLabel +allows the user to change the contents of the label widget. +The parameters are the same as the \fBnewCDKLabel\fR. +.TP 5 +.B setCDKLabelBackgroundAttrib +sets the background attribute of the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKLabelBackgroundColor +sets the background color of the widget. +The parameter \fBcolor\fR is in the format of the Cdk format strings. +For more information see \fIcdk_display (3)\fR. +.TP 5 +.B setCDKLabelBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKLabelBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKLabelHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKLabelLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKLabelLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKLabelMessage +This sets the contents of the label widget. +.TP 5 +.B setCDKLabelULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKLabelURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKLabelVerticalChar +sets the vertical drawing character for the box to the given character. +.TP 5 +.B waitCDKLabel +waits for a user to press a key. +The \fBlabel\fR parameter is the pointer to a label widget, +and \fBkey\fR is the key to wait for. +If no specific key is desired, use \fI(char)0\fR. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_marquee.3 b/deps/cdk-5.0-20161210/man/cdk_marquee.3 new file mode 100644 index 0000000..3ee4769 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_marquee.3 @@ -0,0 +1,263 @@ +.\" $Id: cdk_marquee.3,v 1.18 2016/12/10 17:06:13 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_marquee 3 +.SH NAME +.XX activateCDKMarquee +.XX deactivateCDKMarquee +.XX destroyCDKMarquee +.XX drawCDKMarquee +.XX eraseCDKMarquee +.XX getCDKMarqueeBox +.XX moveCDKMarquee +.XX newCDKMarquee +.XX positionCDKMarquee +.XX setCDKMarqueeBackgroundAttrib +.XX setCDKMarqueeBackgroundColor +.XX setCDKMarqueeBox +.XX setCDKMarqueeBoxAttribute +.XX setCDKMarqueeHorizontalChar +.XX setCDKMarqueeLLChar +.XX setCDKMarqueeLRChar +.XX setCDKMarqueeULChar +.XX setCDKMarqueeURChar +.XX setCDKMarqueeVerticalChar +cdk_marquee \- curses marquee widget +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKMarquee (" +.BI "CDKMARQUEE *" "marquee", +.BI "const char *" "message", +.BI "int " "delay", +.BI "int " "repeat", +.BI "boolean " "box"); +.TP 15 +.B "void deactivateCDKMarquee (" +.BI "CDKMARQUEE *" "marquee"); +.TP 15 +.B "void destroyCDKMarquee (" +.BI "CDKMARQUEE *" "marquee"); +.TP 15 +.B "void drawCDKMarquee (" +.BI "CDKMARQUEE *" "marquee", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKMarquee (" +.BI "CDKMARQUEE *" "marquee"); +.TP 15 +.B "boolean getCDKMarqueeBox (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "void moveCDKMarquee (" +.BI "CDKMARQUEE *" "marquee", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKMARQUEE *newCDKMarquee (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "fieldWidth", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKMarquee (" +.BI "CDKMARQUEE *" "marquee"); +.TP 15 +.B "void setCDKMarqueeBackgroundAttrib (" +.BI "CDKMARQUEE *" "marquee", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKMarqueeBackgroundColor (" +.BI "CDKMARQUEE *" "marquee", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKMarqueeBox (" +.BI "CDKMENTRY *" "mentry", +.BI "boolean " "boxWidget"); +.TP 15 +.B "void setCDKMarqueeBoxAttribute (" +.BI "CDKMARQUEE *" "marquee", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMarqueeHorizontalChar (" +.BI "CDKMARQUEE *" "marquee", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMarqueeLLChar (" +.BI "CDKMARQUEE *" "marquee", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMarqueeLRChar (" +.BI "CDKMARQUEE *" "marquee", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMarqueeULChar (" +.BI "CDKMARQUEE *" "marquee", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMarqueeURChar (" +.BI "CDKMARQUEE *" "marquee", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMarqueeVerticalChar (" +.BI "CDKMARQUEE *" "marquee", +.BI "chtype " "character"); +.fi +.LP +.SH DESCRIPTION +The Cdk marquee widget creates a pop-up marquee window. +The following functions create or manipulate the Cdk marquee widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKMarquee +activates the marquee widget. +.RS +.bP +The \fBmarquee\fR parameter is a +pointer to a defined marquee widget. +.bP +The \fBdelay\fR parameter states how long +to wait between movements. +This value is highly dependent on each machine the +program runs on. +.bP +The \fBrepeat\fR value tells the marquee widget how many times +to display the given message. +.bP +The \fBbox\fR option draws the widget with or +without a box. +This function returns -1 if the message passed is \fINULL\fR, +0 otherwise. +.RE +.TP 5 +.B deactivateCDKMarquee +deactivates the marquee widget. +.TP 5 +.B destroyCDKMarquee +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKMarquee +draws the marquee widget on the screen. +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKMarquee +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKMarqueeBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B moveCDKMarquee +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.bP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKMarquee +creates a marquee widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBwidth\fR +controls the width of the field. +If you provide a value of zero for the width, +the widget uses the width of the screen. +If a negative value is provided, +then the widget uses the width of the screen less the value provided. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKMarquee +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKMarqueeBackgroundAttrib +sets the background attribute of the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKMarqueeBackgroundColor +sets the background color of the widget. +The parameter \fBcolor\fR is in the format of the Cdk format strings. +For more information see \fIcdk_display (3)\fR. +.TP 5 +.B setCDKMarqueeBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKMarqueeBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKMarqueeHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKMarqueeLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKMarqueeLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKMarqueeULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKMarqueeURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKMarqueeVerticalChar +sets the vertical drawing character for the box to the given character. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_matrix.3 b/deps/cdk-5.0-20161210/man/cdk_matrix.3 new file mode 100644 index 0000000..ac73167 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_matrix.3 @@ -0,0 +1,585 @@ +'\" t +.\" $Id: cdk_matrix.3,v 1.28 2016/12/11 02:26:07 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_matrix 3 +.SH NAME +.XX activateCDKMatrix +.XX cleanCDKMatrix +.XX cleanCDKMatrixCell +.XX destroyCDKMatrix +.XX drawCDKMatrix +.XX eraseCDKMatrix +.XX getCDKMatrixBox +.XX getCDKMatrixCell +.XX getCDKMatrixCol +.XX getCDKMatrixRow +.XX injectCDKMatrix +.XX jumpToCell +.XX moveToCDKMatrixCell +.XX newCDKMatrix +.XX setCDKMatrix +.XX setCDKMatrixBackgroundAttrib +.XX setCDKMatrixBackgroundColor +.XX setCDKMatrixBox +.XX setCDKMatrixBoxAttribute +.XX setCDKMatrixCB +.XX setCDKMatrixCell +.XX setCDKMatrixCells +.XX setCDKMatrixHorizontalChar +.XX setCDKMatrixLLChar +.XX setCDKMatrixLRChar +.XX setCDKMatrixPostProcess +.XX setCDKMatrixPreProcess +.XX setCDKMatrixULChar +.XX setCDKMatrixURChar +.XX setCDKMatrixVerticalChar +cdk_matrix \- curses matrix widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKMatrix (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype * " "actions"); +.TP 15 +.B "void cleanCDKMatrix (" +.BI "CDKMATRIX *" "matrix"); +.TP +.B "void cleanCDKMatrixCell (" +.BI "CDKMATRIX *" "matrix", +.BI "int " "row", +.BI "int " "col"); +.TP 15 +.B "void destroyCDKMatrix (" +.BI "CDKMATRIX *" "matrix"); +.TP 15 +.B "void drawCDKMatrix (" +.BI "CDKMATRIX *" "matrix", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKMatrix (" +.BI "CDKMATRIX *" "matrix"); +.TP 15 +.B "boolean getCDKMatrixBox (" +.BI "CDKMENTRY *" "matrix"); +.TP 15 +.B "char * getCDKMatrixCell (" +.BI "CDKMATRIX *" "matrix", +.BI "int " "row", +.BI "int " "col"); +.TP 15 +.B "int getCDKMatrixCol (" +.BI "CDKMENTRY *" "matrix"); +.TP 15 +.B "int getCDKMatrixRow (" +.BI "CDKMENTRY *" "matrix"); +.TP 15 +.B "int injectCDKMatrix (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "input"); +.TP 15 +.B "int jumpToCell (" +.BI "CDKMATRIX *" "matrix", +.BI "int " "row", +.BI "int " "col"); +.TP 15 +.B "void moveCDKMatrix (" +.BI "CDKMATRIX *" "matrix", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "int moveToCDKMatrixCell (" +.BI "CDKMATRIX *" "matrix", +.BI "int " "row", +.BI "int " "col"); +.TP 15 +.B "CDKMATRIX *newCDKMatrix (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "screenRows", +.BI "int " "screenCols", +.BI "int " "actualRows", +.BI "int " "actualCols", +.BI "const char *" "title", +.BI "CDK_CONST char **" "rowTitles", +.BI "CDK_CONST char **" "colTitles", +.BI "int *" "columnWidths", +.BI "int *" "columnTypes", +.BI "int " "rowSpace", +.BI "int " "colSpace", +.BI "chtype " "filler", +.BI "int " "dominantAttribute", +.BI "boolean " "boxMatrix", +.BI "boolean " "boxCell", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKMatrix (" +.BI "CDKMATRIX *" "matrix"); +.TP 15 +.B "void setCDKMatrix (" +.BI "CDKMATRIX *" "matrix", +.BI "char *" "info"[MAX_MATRIX_ROWS][MAX_MATRIX_COLS], +.BI "int " "rows", +.BI "int *" "columnLengths"); +.TP 15 +.B "void setCDKMatrixBackgroundAttrib (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKMatrixBackgroundColor (" +.BI "CDKMATRIX *" "matrix", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKMatrixBox (" +.BI "CDKMENTRY *" "matrix", +.BI "boolean " "boxWidget"); +.TP 15 +.B "void setCDKMatrixBoxAttribute (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMatrixCB (" +.BI "CDKMATRIX *" "matrix", +.BI "MATRIXCB " "callbackFunction"); +.TP 15 +.B "int setCDKMatrixCell (" +.BI "CDKMATRIX *" "matrix", +.BI "int " "row", +.BI "int " "col", +.BI "const char *" "value"); +.TP 15 +.B "void setCDKMatrixCells (" +.BI "CDKMATRIX *" "matrix", +.BI "CDK_CONST char **" "info", +.BI "int " "rows", +.BI "int " "cols", +.BI "int *" "columnLengths"); +.TP 15 +.B "void setCDKMatrixHorizontalChar (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMatrixLLChar (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMatrixLRChar (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMatrixPostProcess (" +.BI "CDKMATRIX *" "matrix", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKMatrixPreProcess (" +.BI "CDKMATRIX *" "matrix", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKMatrixULChar (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMatrixURChar (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMatrixVerticalChar (" +.BI "CDKMATRIX *" "matrix", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk matrix widget creates a matrix widget. +The following are functions which +create or manipulate the Cdk matrix box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKMatrix +activates the matrix widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBmatrix\fR is a pointer to a non-NULL matrix widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.IP +If the character +entered into this widget is \fIRETURN\fR then this function will return 1. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the character entered into this widget was \fIESCAPE\fR then the widget +will return a value of -1 and the widget data \fIexitType\fR will be +set to \fIvESCAPE_HIT\fR. +.bP +The matrix cell contents can be retrieved by using +the \fBinfo\fR array of the matrix widget. +.RE +.TP 5 +.B cleanCDKMatrix +clears the information from all cells of the matrix. +.TP +.B cleanCDKMatrixCell +clears the information from the specified cell of the matrix. +.TP 5 +.B destroyCDKMatrix +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKMatrix +draws the matrix widget on the screen. +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKMatrix +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKMatrixBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKMatrixCell +returns the contents of the cell located by the \fBrow\fR and \fBcol\fR pair. +.TP 5 +.B getCDKMatrixCol +returns the current column index. +.TP 5 +.B getCDKMatrixRow +returns the current row index. +.TP 5 +.B injectCDKMatrix +injects a single character into the widget. +.RS +.bP +The parameter \fBmatrix\fR is a pointer to a non-NULL matrix widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +1. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.bP +The matrix cell contents can be retrieved by +using the \fBinfo\fR array of the matrix widget. +.RE +.TP 5 +.B jumpToCell +provides an interactive method of moving to a cell. +It pops up a +scale widget and asks which cell the user wants to go to. +Then it performs the jump. +.TP 5 +.B moveCDKMatrix +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +.IP +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B moveToCDKMatrixCell +jumps to the given cells dictated by the parameters \fBrow\fR and \fBcol\fR. +It returns a value of \fITRUE\fR or \fIFALSE\fR depending if +the move was successful. +.TP 5 +.B newCDKMatrix +creates a matrix widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBscreenRows\fR and +.TP 5 +\fBscreenCols\fR +are the number of rows and +columns to be displayed on the screen respectively. +.TP 5 +\fBactualRows\fR and +.TP 5 +\fBactualCols\fR +are the number of actual rows and columns the matrix has. +.TP 5 +\fBtitle\fR +is the string which will be displayed at the top of the widget. +The title can be more than one line; just provide a carriage return +character at the line break. +.TP 5 +\fBrowTitles\fR and +.TP 5 +\fBcolTitles\fR +are the titles along the row and columns respectively. +.TP 5 +\fBcolumnWidths\fR +is an array of integers stating how wide the individual columns are to be. +.TP 5 +\fBcolumnTypes\fR +is an array of integers +which correspond to the individual column display types. +The values of the array should be assigned a value of type \fIEDisplayType\fR. +See \fBcdk_display (3)\fR for legal values of \fIEDisplayType\fR. +.TP 5 +\fBrowSpace\fR and +.TP 5 +\fBcolSpace\fR +dictate how much white space is to be between rows and columns respectively. +.TP 5 +\fBfiller\fR +is the character to use in empty space within a cell. +.TP 5 +\fBdominantAttribute\fR +states which (the rows or the columns) +will have the dominant character attributes. +This is stated when a cell has +both a row attribute and a column attribute. +.IP +If the value of the parameter +\fBdominantAttribute\fR is set to \fBROW\fR then the attribute of the row +will be displayed. +If it is set to \fBCOL\fR then the column's attributes +will be displayed instead. +.TP 5 +\fBboxMatrix\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBboxCell\fR +is true if the individual cells should have boxes drawn around them. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKMatrix +allows the user to move the widget around the screen via the +cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKMatrix +lets the programmer modify certain elements of an existing matrix widget. +.RS +.bP +The parameter \fBinfo\fR is an array of \fIchar *\fR which +contains the cell information. +.bP +The parameter \fBrows\fR has the number of rows +.bP +the parameter \fBinfo\fR contains, +.bP +\fBcolumnLengths\fR has the lengths of +the individual columns in \fBinfo\fR. +.RE +.IP +Do not use this function. +It is obsolete, provided only for compatibility with older versions of CDK. +Use \fBsetCDKMatrixCells\fP. +.TP 5 +.B setCDKMatrixBackgroundAttrib +sets the background attribute of the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKMatrixBackgroundColor +sets the background color of the widget. +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKMatrixBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKMatrixBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKMatrixCB +allows the programmer to set a different widget input handler. +The parameter \fBcallbackFunction\fR is of type \fIMATRIXCB\fR. +The default function is \fICDKMatrixCallBack\fR. +.TP 5 +.B setCDKMatrixCell +sets the contents of the cell located by the \fBrow\fR and \fBcol\fR pair. +The value of the cell will be set to \fBvalue\fR. +.TP +.B setCDKMatrixCells, +lets the programmer initialize elements of an existing matrix widget. +.bP +The parameter \fBinfo\fR is an array of \fIchar *\fR which +contains the cell information. +.RS +.bP +The parameter \fBrows\fR has the number of rows +.bP +The parameter \fBcols\fR has the number of columns +.bP +The parameter \fBinfo\fR contains, while \fBcolumnLengths\fR has the lengths of +the individual columns in \fBinfo\fR. +.RE +.TP 5 +.B setCDKMatrixHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKMatrixLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKMatrixLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKMatrixPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKMatrixPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKMatrixULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKMatrixURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKMatrixVerticalChar +sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.TS +center tab(/) box; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +Left Arrow/Moves one cell to the left. +Right Arrow/Moves the cell to the right. +Tab/Moves the cell to the right. +Up Arrow/Moves one cell up. +Down Arrow/Moves one cell down. +Next Page/Moves one page forward. +Ctrl-F/Moves one page forward. +Prev Page/Moves one page backward. +Ctrl-B/Moves one page backward. +Ctrl-G/T{ +Calls the function \fBjumpToCell\fR and requests which cell the user wishes to jump to. +T} +Ctrl-P/T{ +Pastes whatever is in the paste buffer, into the current cell. +T} +Ctrl-K/T{ +Cuts the contents from the current cell and saves a copy in the paste buffer. +T} +Ctrl-T/T{ +Copies the contents of the current cell into the paste buffer. +T} +Ctrl-E/Erases the contents of the current cell. +Delete/T{ +Deletes the character before the cursor, moves cursor left. +There is no function to delete the character at the cursor since there +are no functions for moving the cursor within the edited text. +T} +Backspace/T{ +Deletes the character before cursor, moves cursor left. +T} +Ctrl-H/Deletes the character before the cursor. +Return/T{ +Exits the widget and returns 1. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns -1. +This also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_mentry.3 b/deps/cdk-5.0-20161210/man/cdk_mentry.3 new file mode 100644 index 0000000..b7aea39 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_mentry.3 @@ -0,0 +1,611 @@ +'\" t +.\" $Id: cdk_mentry.3,v 1.28 2016/12/10 17:30:49 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_mentry 3 +.SH NAME +.XX activateCDKMentry +.XX cleanCDKMentry +.XX destroyCDKMentry +.XX drawCDKMentry +.XX drawCDKMentryField +.XX eraseCDKMentry +.XX getCDKMentryBox +.XX getCDKMentryFillerChar +.XX getCDKMentryHiddenChar +.XX getCDKMentryMin +.XX getCDKMentryValue +.XX injectCDKMentry +.XX moveCDKMentry +.XX newCDKMentry +.XX positionCDKMentry +.XX setCDKMentry +.XX setCDKMentryBackgroundAttrib +.XX setCDKMentryBackgroundColor +.XX setCDKMentryBox +.XX setCDKMentryBoxAttribute +.XX setCDKMentryCB +.XX setCDKMentryFillerChar +.XX setCDKMentryHiddenChar +.XX setCDKMentryHorizontalChar +.XX setCDKMentryLLChar +.XX setCDKMentryLRChar +.XX setCDKMentryMin +.XX setCDKMentryPostProcess +.XX setCDKMentryPreProcess +.XX setCDKMentryULChar +.XX setCDKMentryURChar +.XX setCDKMentryValue +.XX setCDKMentryVerticalChar +cdk_mentry \- curses multiple line entry widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "char *activateCDKMentry (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype *" "actions"); +.TP 15 +.B "void cleanCDKMentry (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "void destroyCDKMentry (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "void drawCDKMentry (" +.BI "CDKMENTRY *" "mentry", +.BI "boolean " "box"); +.TP 15 +.B "void drawCDKMentryField (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "void eraseCDKMentry (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "boolean getCDKMentryBox (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "chtype getCDKMentryFillerChar (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "chtype getCDKMentryHiddenChar (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "int getCDKMentryMin (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "char *getCDKMentryValue (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "char *injectCDKMentry (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKMentry (" +.BI "CDKMENTRY *" "mentry", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKMENTRY *newCDKMentry (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "const char *" "title", +.BI "const char *" "label", +.BI "chtype " "fieldAttribute", +.BI "chtype " "fillerCharacter", +.BI "EDisplayType " "displayType", +.BI "int " "fieldWidth", +.BI "int " "fieldRows", +.BI "int " "logicalRows", +.BI "int " "minimumLength", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKMentry (" +.BI "CDKMENTRY *" "mentry"); +.TP 15 +.B "void setCDKMentry (" +.BI "CDKMENTRY *" "mentry", +.BI "const char *" "value", +.BI "int " "minimumLength", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKMentryBackgroundAttrib (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKMentryBackgroundColor (" +.BI "CDKMENTRY *" "mentry", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKMentryBox (" +.BI "CDKMENTRY *" "mentry", +.BI "boolean " "boxWidget"); +.TP 15 +.B "void setCDKMentryBoxAttribute (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMentryCB (" +.BI "CDKMENTRY *" "mentry", +.BI "MENTRYCB " "callBackFunction"); +.TP 15 +.B "void setCDKMentryFillerChar (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "filler"); +.TP 15 +.B "void setCDKMentryHiddenChar (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMentryHorizontalChar (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMentryLLChar (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMentryLRChar (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMentryMin (" +.BI "CDKMENTRY *" "mentry", +.BI "int " "maximum"); +.TP 15 +.B "void setCDKMentryPostProcess (" +.BI "CDKMENTRY *" "mentry", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKMentryPreProcess (" +.BI "CDKMENTRY *" "mentry", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKMentryULChar (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMentryURChar (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKMentryValue (" +.BI "CDKMENTRY *" "mentry", +.BI "const char *" "value"); +.TP 15 +.B "void setCDKMentryVerticalChar (" +.BI "CDKMENTRY *" "mentry", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk mentry widget creates a multiple line entry box with a label and an +entry field. +The following are functions which create or manipulate the Cdk +mentry box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKMentry +activates the mentry widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBmentry\fR is a pointer to a non-NULL mentry widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return +a \fIchar *\fR representing the information typed into the widget and the +widget data \fIexitType\fR will be set to \fIvNORMAL\fR. +.IP +If the character +entered was \fIESCAPE\fR then the function will return \fINULL\fR pointer and +the widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP 5 +.B cleanCDKMentry +clears the information from the field. +.TP 5 +.B destroyCDKMentry +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKMentry +draws the widget on the screen. +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B drawCDKMentryField +redraws the multiple line entry field. +.TP 5 +.B eraseCDKMentry +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKMentryBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKMentryFillerChar +returns the character being used to draw unused space in the widget. +.TP 5 +.B getCDKMentryHiddenChar +returns the character being used to draw hidden characters in the widget (obsolete). +.TP 5 +.B getCDKMentryMin +returns the minimum length of a string the widget will allow. +.TP 5 +.B getCDKMentryValue +returns the current value of the widget. +.TP 5 +.B injectCDKMentry +injects a single character into the widget. +.RS +.bP +The parameter \fBmentry\fR is a pointer to a non-NULL mentry. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a \fIchar *\fR representing the information typed into the widget. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +a \fINULL\fR pointer. +.RE +.bP +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKMentry +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +.IP +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKMentry +creates a mentry widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBtitle\fR +is the string which will be displayed at the top of the widget. +The title can be more than one line; just provide a carriage return +character at the line break. +.TP 5 +\fBlabel\fR +is the string which will be displayed in the label of the mentry field. +.TP 5 +\fBfieldAttribute\fR +is the attribute of the characters to be displayed when they are typed in. +.TP 5 +\fBfiller\fR +is the character which is to display in an empty space in the mentry field. +.TP 5 +\fBdisplayType\fR +tells how the mentry field will behave when a character is entered into the field. +The following table +outlines valid values for this field and what they mean: +.LP +.TS +center tab(/); +l l +lw10 lw30 . +\fBDisplay_Type/Meaning\fR += +vCHAR/Only accepts alphabetic characters. +vLCHAR/T{ +Only accepts alphabetic characters. +Maps the character to lower case +when a character has been accepted. +T} +vUCHAR/T{ +Only accepts alphabetic characters. +Maps the character to upper case +when a character has been accepted. +T} +vHCHAR/T{ +Only accepts alphabetic characters. +Displays a \fI.\fR when a character +has been accepted. +T} +vUHCHAR/T{ +Only accepts alphabetic characters. +Displays a \fI.\fR and maps the +character to upper case when a +character has been accepted. +T} +vLHCHAR/T{ +Only accepts alphabetic characters. +Displays a \fI.\fR and maps the +character to lower case when a +character has been accepted. +T} +vINT/Only accepts numeric characters. +vHINT/T{ +Only accepts numeric characters. +Displays a \fI.\fR when a character +has been accepted. +T} +vMIXED/Accepts any character types. +vLMIXED/T{ +Accepts any character types. +Maps the character to lower case +when an alphabetic character has +been accepted. +T} +vUMIXED/T{ +Accepts any character types. +Maps the character to upper case +when an alphabetic character has +been accepted. +T} +vHMIXED/T{ +Accepts any character types. +Displays a \fI.\fR when a character +has been accepted. +T} +vLHMIXED/T{ +Accepts any character types. +Displays a \fI.\fR and maps the +character to lower case when a +character has been accepted. +T} +vUHMIXED/T{ +Accepts any character types. +Displays a \fI.\fR and maps the +character to upper case when a +character has been accepted. +T} +vVIEWONLY/Uneditable field. += +.TE +.TP 5 +\fBfieldRows\fR and +.TP 5 +\fBfieldWidth\fR +control the height and width of the field of the widget. +If you provide a value of zero for either of the values, +the field in the widget will be made as large as it can both in width and in height. +If you provide a negative value, the field will be created the full height or width +minus the value provided. +.TP 5 +\fBlogicalRows\fR +is the number of rows for the mentry field. +.TP 5 +\fBminimumLength\fR +is the number of characters which must +be entered before the use can exit the mentry field. +.TP 5 +\fBcallBackFunction\fR +allows the user to override the key processing element of the widget. +.TP 5 +\fBbox\fR +is true if widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.RE +.TP 5 +.B positionCDKMentry +allows the user to move the widget around the screen via the +cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKMentry +lets the programmer modify certain elements of an existing +entry widget. +The parameter names correspond to the same parameter names listed +in the \fBnewCDKMentry\fR function. +.TP 5 +.B setCDKMentryBackgroundAttrib +sets the background attribute of the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKMentryBackgroundColor +sets the background color of the widget. +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKMentryBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKMentryBoxAttribute +function sets the attribute of the box. +.TP 5 +.B setCDKMentryCB +function allows the programmer to set a different widget input handler. +The parameter \fBcallbackFunction\fR is of type \fIMENTRYCB\fR. +The default function is \fICDKMentryCallBack\fR. +.TP 5 +.B setCDKMentryFillerChar +sets the character to use when drawing unused space in the field. +.TP 5 +.B setCDKMentryHiddenChar +sets the character to use when a hidden character type is used (obsolete). +.TP 5 +.B setCDKMentryHorizontalChar +function sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKMentryLLChar +function sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKMentryLRChar +function sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKMentryMin +sets the minimum length of the string that the widget will allow. +.TP 5 +.B setCDKMentryPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKMentryPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKMentryULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKMentryURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKMentryValue +sets the current value of the widget. +.TP 5 +.B setCDKMentryVerticalChar +sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) box; +l l +lw(10) lw(30) . +\fBKey/Action\fR += +Left Arrow/Moves the cursor to the left. +CTRL-B/Moves the cursor to the left. +Right Arrow/Moves the cursor to the right. +CTRL-F/Moves the cursor to the right. +Up Arrow/Moves the cursor one row down. +Down Arrow/Moves the cursor one row up. +Delete/Deletes the character at the cursor. +Backspace/Deletes the character before cursor, moves cursor left. +CTRL-V/T{ +Pastes whatever is in the paste buffer, into the widget. +T} +CTRL-X/T{ +Cuts the contents from the widget and saves a copy in the paste buffer. +T} +CTRL-Y/T{ +Copies the contents of the widget into the paste buffer. +T} +CTRL-U/T{ +Erases the contents of the widget. +T} +CTRL-A/T{ +Moves the cursor to the beginning of the entry field. +T} +CTRL-E/T{ +Moves the cursor to the end of the entry field. +T} +CTRL-T/T{ +Transposes the character under the cursor with the character to the right. +T} +Return/T{ +Exits the widget and returns a \fIchar *\fR representing +the information which was typed into the field. +It also sets the widget data \fIexitType\fR in the widget +pointer to \fIvNORMAL\fR. +T} +Tab/T{ +Exits the widget and returns a \fIchar *\fR representing +the information which was typed into the field. +It also sets the widget data \fIexitType\fR in the widget +pointer to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns a \fINULL\fR pointer. +It also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.fi +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_menu.3 b/deps/cdk-5.0-20161210/man/cdk_menu.3 new file mode 100644 index 0000000..e97355a --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_menu.3 @@ -0,0 +1,343 @@ +'\" t +.\" $Id: cdk_menu.3,v 1.20 2016/12/11 01:00:45 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_menu 3 +.SH NAME +.XX activateCDKMenu +.XX destroyCDKMenu +.XX drawCDKMenu +.XX drawCDKMenuSubwin +.XX eraseCDKMenu +.XX eraseCDKMenuSubwin +.XX getCDKMenuCurrentItem +.XX getCDKMenuSubTitleHighlight +.XX getCDKMenuTitleHighlight +.XX injectCDKMenu +.XX newCDKMenu +.XX setCDKMenu +.XX setCDKMenuBackgroundAttrib +.XX setCDKMenuBackgroundColor +.XX setCDKMenuCurrentItem +.XX setCDKMenuPostProcess +.XX setCDKMenuPreProcess +.XX setCDKMenuSubTitleHighlight +.XX setCDKMenuTitleHighlight +cdk_menu \- curses menu widget +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKMenu (" +.BI "CDKMENU *" "menu", +.BI "chtype * " "actions"); +.TP 15 +.B "void destroyCDKMenu (" +.BI "CDKMENU *" "menu"); +.TP 15 +.B "void drawCDKMenu (" +.BI "CDKMENU *" "menu", +.BI "boolean " "box"); +.TP 15 +.BI "void drawCDKMenuSubwin (" +.BI "CDKMENU *" "menu"); +.TP 15 +.B "void eraseCDKMenu (" +.BI "CDKMENU *" "menu"); +.TP 15 +.BI "void eraseCDKMenuSubwin (" +.BI "CDKMENU *" "menu"); +.TP 15 +.B "void getCDKMenuCurrentItem (" +.BI "CDKMENU *" "menu", +.BI "int *" "menuItem", +.BI "int *" "submenuItem"); +.TP 15 +.B "chtype getCDKMenuSubTitleHighlight (" +.BI "CDKMENU *" "menu"); +.TP 15 +.B "chtype getCDKMenuTitleHighlight (" +.BI "CDKMENU *" "menu"); +.TP 15 +.B "int injectCDKMenu (" +.BI "CDKMENU *" "menu", +.BI "chtype " "input"); +.TP 15 +.B "CDKMENU *newCDKMenu (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "const char *" "menulist"[MAX_MENU_ITEMS][MAX_SUB_ITEMS], +.BI "int " "menuListLength", +.BI "int *" "submenuListLength", +.BI "int *" "menuLocation", +.BI "int " "menuPos", +.BI "chtype " "titleAttribute", +.BI "chtype " "subtitleAttribute"); +.TP 15 +.B "void setCDKMenu (" +.BI "CDKMENU *" "menu", +.BI "int " "menuItem", +.BI "int " "submenuItem", +.BI "chtype " "titleAttribute", +.BI "chtype " "subtitleAttribute"); +.TP 15 +.B "void setCDKMenuBackgroundAttrib (" +.BI "CDKMENU *" "menu", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKMenuBackgroundColor (" +.BI "CDKMENU *" "menu", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKMenuCurrentItem (" +.BI "CDKMENU *" "menu", +.BI "int " "menuItem", +.BI "int " "submenuItem"); +.TP 15 +.B "void setCDKMenuPostProcess (" +.BI "CDKMENU *" "menu", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKMenuPreProcess (" +.BI "CDKMENU *" "menu", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKMenuSubTitleHighlight (" +.BI "CDKMENU *" "menu", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKMenuTitleHighlight (" +.BI "CDKMENU *" "menu", +.BI "chtype " "highlight"); +.fi +.SH DESCRIPTION +The Cdk menu widget creates a pull-down menu list. +The following are functions +which create or manipulate the Cdk menu widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKMenu +activates the menu widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBmenu\fR is a pointer to a non-NULL menu widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR then this then this function returns an +integer which is a value of the current menu list * 100 + the sub-menu number. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the character entered into this widget was \fIESCAPE\fR then the widget +will return a value of -1 and the widget data \fIexitType\fR will be +set to \fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDKMenu +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKMenu +draws the menu widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B drawCDKMenuSubwin +draws the menu item subwindow. +.TP 5 +.B eraseCDKMenu +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B eraseCDKMenuSubwin +erases the menu item subwindow. +.TP 5 +.B getCDKMenuCurrentItem +returns the values \fBmenuItem\fR and \fBsubmenuItem\fR to the current +menu selection. +.TP 5 +.B getCDKMenuSubTitleHighlight +returns the highlight attribute of the sub-menu selection bar. +.TP 5 +.B getCDKMenuTitleHighlight +returns the highlight attributes of the menu title. +.TP 5 +.B injectCDKMenu +injects a single character into the widget. +.RS +.bP +The parameter \fBmenu\fR is a pointer to a non-NULL menu widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +the current menu list * 100 + the sub-menu number. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +to \fIvESCAPE_HIT\fR. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B newCDKMenu +creates a menu widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBmenuList\fR +is a list of the menu list titles. +.TP 5 +\fBmenuListLength\fR +is the number of pull down menus. +.TP 5 +\fBsubmenuListLength\fR +is the number of menu items under each menu list. +.TP 5 +\fBmenuLocation\fR +tells where each menu is to be located. +Valid values are \fILEFT\fR and \fIRIGHT\fR. +.TP 5 +\fBmenuPos\fR +tells whether the menu is to be on the top of the screen or the bottom. +Valid values are \fITOP\fR and \fIBOTTOM\fR. +.TP 5 +\fBtitleAttribute\fR and +.TP 5 +\fBsubtitleAttribute\fR +are the character attributes of the title and sub-titles respectively. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B setCDKMenu +lets the programmer modify certain elements of an existing menu widget. +.RS +.bP +The parameters \fBmenuItem\fR and \fBsubmenuItem\fR set which +menu list and sub-menu item are going to be highlighted when the widget is activated. +.bP +The other parameter names correspond to the same parameter names +listed in the \fBnewCDKMenu\fR function. +.RE +.TP 5 +.B setCDKMenuBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKMenuBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKMenuCurrentItem +sets the current item in the menu widget. +.TP 5 +.B setCDKMenuPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKMenuPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKMenuSubTitleHighlight +sets the highlight attribute of the sub-menu selection bar. +.TP 5 +.B setCDKMenuTitleHighlight +sets the highlight attributes of the menu title. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBKey/Action\fR +Left Arrow/T{ +Highlights the menu list to the left of the current menu. +T} +Right Arrow/T{ +Highlights the menu list to the right of the current menu. +T} +Up Arrow/T{ +Moves the current menu selection up one. +T} +Down Arrow/T{ +Moves the current menu selection down one. +T} +Space/T{ +Moves the current menu selection down one. +T} +Tab/T{ +Highlights the menu list to the right of the current menu. +T} +Return/T{ +Exits the widget and returns the index of the selected item. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns -1. +This also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_misc.3 b/deps/cdk-5.0-20161210/man/cdk_misc.3 new file mode 100644 index 0000000..4b51bb2 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_misc.3 @@ -0,0 +1,297 @@ +'\" t +.\" $Id: cdk_misc.3,v 1.21 2014/01/19 02:02:03 tom Exp $ +.de XX +.. +.TH cdk_misc 3 +.SH NAME +.XX Beep +.XX CDKallocStrings +.XX CDKcountStrings +.XX CDKfreeChtypes +.XX CDKfreeStrings +.XX CDKsplitString +.XX baseName +.XX ceilCDK +.XX chlen +.XX chstrncpy +.XX chtype2Char +.XX cleanChar +.XX cleanChtype +.XX cmpStrChstr +.XX copyChar +.XX copyCharList +.XX copyChtype +.XX copyChtypeList +.XX dirName +.XX floorCDK +.XX freeChar +.XX freeCharList +.XX freeChtype +.XX freeChtypeList +.XX intlen +.XX lenCharList +.XX lenChtypeList +.XX mode2Char +.XX searchList +.XX sortList +cdk_misc - \fBCurses Development Kit\fR Miscellaneous Routines +.LP +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "void Beep(void); +.TP 15 +.B "unsigned CDKallocStrings(" +.BI "char ***" "list"/, +.BI "char *" "item"/, +.BI "unsigned " "length"/, +.BI "unsigned " "used"/); +.TP 15 +.B "unsigned CDKcountStrings (" +.BI "CDK_CONST char **\fIlist"); +.TP 15 +.B "void CDKfreeChtypes(" +.BI "chtype **" "list"); +.TP 15 +.B "void CDKfreeStrings (" +.BI "char **" "list"); +.TP 15 +.B "char ** CDKsplitString (" +.BI "const char *" "string", +.BI "int " "splitChar); +.TP 15 +.B "char * baseName (" +.BI "char *" "string"); +.TP 15 +.B "int ceilCDK(" +.BI "double" "value"); +.TP 15 +.B "int chlen (" +.BI "const chtype *" "string"); +.TP 15 +.B "void chstrncpy( +.BI "char *" "dest", +.BI "const chtype *" "src", +.BI "int " "maxcount"); +.TP 15 +.BI "char *chtype2Char (" +.BI "const chtype *" "string"); +.TP 15 +.B "void cleanChar (" +.BI "char *" "string", +.BI "int " "length", +.BI "char " "character"); +.TP 15 +.B "void cleanChtype (" +.BI "chtype *" "string", +.BI "int " "length", +.BI "chtype " "character"); +.TP 15 +.B "int cmpStrChstr(" +.BI "const char *" "str", +.BI "const chtype *" "chstr"); +.TP 15 +.B "char *copyChar (" +.BI "const char *" "string"); +.TP 15 +.B "char **copyCharList (" +.BI "const char **" "list"); +.TP 15 +.B "chtype *copyChtype (" +.BI "const chtype *" "string"); +.TP 15 +.B "chtype **copyChtypeList (" +.BI "const chtype **" "list"); +.TP 15 +.B "char *dirName (" +.BI "char *" "filename"); +.TP 15 +.B "int floorCDK(" +.BI "double " "value"); +.TP 15 +.B "void freeChar (" +.BI "char *" "string"); +.TP 15 +.B "void freeCharList (" +.BI "char **" "list", +.BI "unsigned " "size"); +.TP 15 +.B "void freeChtype (" +.BI "chtype *" "string"); +.TP 15 +.B void freeChtypeList (" +.BI "chtype **" "list", +.BI "unsigned " "size"); +.TP 15 +.B "int intlen (" +.BI "int " "value"); +.TP 15 +.B "int lenCharList (" +.BI "const char **" "list"); +.TP 15 +.B "int lenChtypeList (" +.BI "const chtype **" "list"); +.TP 15 +.B "int mode2Char (" +.BI "char *" "string", +.BI "mode_t " "fileMode"); +.TP 15 +.B "int searchList (" +.BI "CDK_CONST char * CDK_CONST *" "list", +.BI "int " "listSize", +.BI "const char *" "pattern"); +.TP 15 +.B "void sortList (" +.BI "CDK_CONST char **" "list", +.BI "int " "length"); +.fi +.SH DESCRIPTION +These are miscellaneous functions +which may be useful with the Cdk widget set. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B Beep +makes an audible beep. +The standard curses beep() does not +flush the stream, so it will only beep until a force is made. +This forces a flush after issuing the beep command. +.TP 5 +.B CDKallocStrings +Add a new string \fIitem\fP to a \fIlist\fP. +Keep a null pointer on the end so one may use +\fBCDKfreeStrings()\fP to deallocate the whole list. +The caller is responsible for updating the \fIlength\fP of the list. +The return value is the updated number of chars \fIused\fP. +.TP 5 +.B CDKcountStrings +Count the number of items in a null-terminated \fIlist\fP of character strings. +Return the count. +.TP 5 +.B CDKfreeChtypes +Free a \fIlist\fP of chtype-strings which is terminated by a null pointer. +.TP 5 +.B CDKfreeStrings +Free a \fIlist\fP of character strings which is terminated by a null pointer. +Also free \fIlist\fR itself. +.TP 5 +.B CDKsplitString +split the \fIstring\fP at each occurrence of \fIseparator\fP, +returning a pointer to a dynamically allocated array of the pieces. +The original \fIstring\fP is unmodified. +The caller is responsible for freeing the result. +.TP 5 +.B baseName +returns a pointer to the first character of the filename in +the given pathname. +The result should be freed by the caller. +.TP 5 +.B ceilCDK +Return an integer like the math library \fBceil()\fP, which returns a double. +.TP 5 +.B chlen +returns the length of the (null-terminated) \fIstring\fP of chtype's. +.TP 5 +.B chstrncpy +Extract the characters from a null-terminated array of chtype's \fIsrc\fP. +The size of the destination \fIdest\fP is given in \fImaxcount\fP. +.TP 5 +.B chtype2Char +Extract the characters from a null-terminated array of chtype's \fIstring\fP. +A dynamically allocated string is returned. +The caller is responsible for freeing the result. +.TP 5 +.B cleanChar +is analogous to \fImemset\fR. +Set the characters in \fIstring\fP to the given \fIcharacter\fP. +The length of \fIstring\fP is given by \fIlength\fP. +character which will be written. +.TP 5 +.B cleanChtype +is analogous to \fImemset\fR. +Set the chtype's in \fIstring\fP to the given \fIcharacter\fP. +The length of \fIstring\fP is given by \fIlength\fP. +.TP 5 +.B cmpStrChstr +Compare a char string \fIstr\fP to a chtype string \fIchstr\fP. +Return -1, 0 or 1 according to whether \fIstr\fP is less than, equal to +to greater than \fIchstr\fP. +.TP 5 +.B copyChar +copies the string passed in. +Unlike \fIstrdup\fR this checks to see if the string is NULL before copying. +.TP 5 +.B copyCharList +copies the given list. +.TP 5 +.B copyChtype +function copies the string passed in, analogous to \fBcopyChar\fR, but +for chtype strings. +.TP 5 +.B copyChtypeList +copies the given list. +.TP 5 +.B dirName +Returns the directory for the given \fIfilename\fP, +i.e., the part before the * last slash. +The return value should be freed by the caller. +.TP 5 +.B floorCDK +Return an integer like the math function floor(), which returns a double. +.TP 5 +.B freeChar +is a wrapper for \fIfree\fR. +It checks to see if the string +is NULL before trying to free the string. +.TP 5 +.B freeCharList +Free the memory used by the given \fIlist\fP of strings. +The number of strings to free is given by \fIsize\fP. +.TP 5 +.B freeChtype +is a wrapper for \fIfree\fR, like \fIfreeChar\fR. +.TP 5 +.B freeChtypeList +Free the memory used by the given \fIlist\fP of chtype strings. +The number of strings to free is given by \fIsize\fP. +.TP 5 +.B intlen +returns the length of an integer, i.e., the number of characters +needed to represent it. +.TP 5 +.B lenCharList +returns the length of the given list. +.TP 5 +.B lenChtypeList +returns the length of the given list. +.TP 5 +.B mode2Char +Given a file protection mode \fIfileMode\fP, +store a printable version of the permissions in \fIstring\fP, +formatted as if by "ls -l"). +Return the corresponding permissions data, +i.e., ignoring the file-type bits. +.TP 5 +.B searchList +Search the given \fIlist\fP of \fIlistSize\fP strings +for a subset of a word \fIpattern\fP in the given list. +Return the index in the list if it is found, or -1 if not found. +.TP 5 +.B sortList +performs a quick sort of the given list. +This is a wrapper for qsort, +used to sort the \fIlist\fP of strings. +The number of strings in \fIlist\fP is given by \fIlength\fP. +The list is sorted alphabetically in increasing order. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_screen (3), +.BR cdk_display (3), +.BR cdk_binding (3), +.BR cdk_util (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_objs.3 b/deps/cdk-5.0-20161210/man/cdk_objs.3 new file mode 100644 index 0000000..88abbde --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_objs.3 @@ -0,0 +1,117 @@ +.\" $Id: cdk_objs.3,v 1.4 2012/03/22 00:50:06 tom Exp $ +.de XX +.. +.TH cdk_objs 3 +.SH NAME +.XX cleanCdkTitle +.XX drawCdkTitle +.XX positionCDKObject +.XX setCDKObjectBackgroundColor +.XX setCDKObjectPostProcess +.XX setCDKObjectPreProcess +.XX setCdkExitType +.XX setCdkTitle +.XX validCDKObject +cdk_objs \- Cdk object-support functions +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +.nf +.TP 15 +.B "void cleanCdkTitle (" +.BI "CDKOBJS *" "obj"); +.TP 15 +.B "void drawCdkTitle (" +.BI "WINDOW *" "window", +.BI "CDKOBJS *" "object"); +.TP 15 +.B "void positionCDKObject (" +.BI "CDKOBJS *" "object", +.BI "WINDOW *" "win"); +.TP 15 +.B "void setCDKObjectBackgroundColor (" +.BI "CDKOBJS *" "object", +.BI "const 3char *" "color"); +.TP 15 +.B "void setCDKObjectPostProcess (" +.BI "CDKOBJS *" "object", +.BI "PROCESSFN " "func", +.BI "void *" "data"); +.TP 15 +.B "void setCDKObjectPreProcess (" +.BI "CDKOBJS *" "object", +.BI "PROCESSFN " "func", +.BI "void *" "data"); +.TP 15 +.B "void setCdkExitType(" +.BI "CDKOBJS *" "obj", +.BI "EExitType *" "type", +.BI "chtyp " "ch"); +.TP 15 +.B "int setCdkTitle (" +.BI "CDKOBJS *" "obj", +.BI "const char *" "title", +.BI "int " "boxWidth"); +.TP 15 +.B "bool validCDKObject (" +.BI "CDKOBJS *" "obj"); +.fi +.SH DESCRIPTION +Cdk is written in ANSI C, which has "no" object support. +Most of the object support in Cdk is done using macros and a small number +of types which hold object information: +.RS 5 +.TP 5 +CDKFUNCS +contains the function pointers for common methods of the widgets. +It is separate from CDKOBJS because it is compiled into each widget's C code +(see the DeclareCDKObjects() and DeclareSetXXchar() macros. +The widget instances point to a single copy of CDKFUNCS for each widget. +.TP 5 +CDKOBJS +Holds data common to all objects (widget instances). +It appears first in each widget's struct to allow Cdk +to use generic functions in binding.c, cdkscreen.c, position.c, etc. +.RE + +.SH AVAILABLE FUNCTIONS +The functions declared in are used in situations where the +expressions are too complex for a macro. +.TP 5 +.B cleanCdkTitle +Remove storage for the widget's title. +.TP 5 +.B drawCdkTitle, +Draw the widget's title. +.TP 5 +.B positionCDKObject +This allows the user to use the cursor keys to adjust the +position of the widget. +.TP 5 +.B setCDKObjectBackgroundColor +Set the background color of the widget. +.TP 5 +.B setCDKObjectPostProcess +Set data for postprocessing. +.TP 5 +.B setCDKObjectPreProcess +Set data for preprocessing. +.TP 5 +.B setCdkExitType +Set the object's exit-type based on the input. +The \fB.exitType\fP field should have been part of the CDKOBJS struct, but it +is used too pervasively in Cdk4 applications to move. +.TP 5 +.B setCdkTitle +Set the widget's title. +.TP 5 +.B validCDKObject +Returns true if a "new" was done on the object but no "destroy". +. +.SH SEE ALSO +cdk_binding (3) +cdk_process (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_params.3 b/deps/cdk-5.0-20161210/man/cdk_params.3 new file mode 100644 index 0000000..f8623a0 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_params.3 @@ -0,0 +1,91 @@ +'\" t +.\" $Id: cdk_params.3,v 1.4 2012/03/22 01:11:47 tom Exp $ +.de XX +.. +.TH cdk_params 3 +.SH NAME +.XX CDKparamNumber +.XX CDKparamNumber2 +.XX CDKparamString +.XX CDKparamString2 +.XX CDKparseParams +.XX CDKparsePosition +.XX CDKparamValue +cdk_params \- Cdk command-line parsing +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int CDKparamNumber (" +.BI "CDK_PARAMS *" "params", +.BI "int " "option"); +.TP 15 +.B "int CDKparamNumber2 (" +.BI "CDK_PARAMS *" "params", +.BI "int " "option", +.BI "int " "missing"); +.TP 15 +.B "char * CDKparamString (" +.BI "CDK_PARAMS *" "params", +.BI "int " "option"); +.TP 15 +.B "char * CDKparamString2 (" +.BI "CDK_PARAMS *" "params", +.BI "int " "option", +.BI "const char *" "missing"); +.TP 15 +.B "void CDKparseParams (" +.BI "int " "argc", +.BI "char **" "argv", +.BI "CDK_PARAMS *" "params", +.BI "const char *" "options"); +.TP 15 +.B "int CDKparsePosition (" +.BI "char *" "string"); +.TP 15 +.B "int CDKparamValue (" +.BI "CDK_PARAMS * " "params", +.BI "int " "option", +.BI "int " "missing"); +.fi +.SH DESCRIPTION +These are a set of functions used to implement the command-line utilities and +demonstration programs for Cdk. +Rather than set the programs' options at initialization, +they construct a simple database which holds the common parameters +using \fBCDKparseParams()\fP. +. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B CDKparamNumber +Retrieves an integer (or boolean) option value from the parsed command-line. +.TP 5 +.B CDKparamNumber2 +Retrieves an optional integer (or boolean) value from the parsed command-line. +If the command line option is not present, the \fImissing\fP value is used. +.TP 5 +.B CDKparamString +Retrieves a string option value from the parsed command-line. +.TP 5 +.B CDKparamString2 +Retrieve an optional string option value from the parsed command-line. +.TP 5 +.B CDKparamValue +Retrieve an integer (or boolean) option value from the parsed command-line. +.TP 5 +.B CDKparseParams +Parse the given argc/argv command-line, with the options passed to +getopt()'s 3rd parameter. +.TP 5 +.B CDKparsePosition +Parse the string as one of CDK's positioning keywords, or an actual position. +. +.SH SEE ALSO +cdk_position (3), +getopt (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_position.3 b/deps/cdk-5.0-20161210/man/cdk_position.3 new file mode 100644 index 0000000..a27c446 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_position.3 @@ -0,0 +1,91 @@ +'\" t +.\" $Id: cdk_position.3,v 1.4 2002/08/09 22:15:50 tom Exp $ +.TH cdk_position 3 +.SH NAME +cdk_position \- curses widget positioning key-bindings +.SH SYNOPSIS +Position methods for the Cdk widgets +allow the user to move the widget around the screen via the +cursor/keypad keys. +.SH DESCRIPTION +The following key bindings can be used to move the +widget around the screen. +.LP +.TS +center tab(/) box; +l l +lw15 lw35 . +\fBKey/Action\fR += +Up Arrow/T{ +Moves the widget up one row. +T} +Down Arrow/T{ +Moves the widget down one row. +T} +Left Arrow/T{ +Moves the widget left one column +T} +Right Arrow/T{ +Moves the widget right one column +T} +1/T{ +Moves the widget down one row and left one column. +T} +2/T{ +Moves the widget down one row. +T} +3/T{ +Moves the widget down one row and right one column. +T} +4/T{ +Moves the widget left one column +T} +5/T{ +Centers the widget both vertically and horizontally. +T} +6/Moves the widget right one column +7/T{ +Moves the widget up one row and left one column. +T} +8/T{ +Moves the widget up one row. +T} +9/T{ +Moves the widget up one row and right one column. +T} +t/T{ +Moves the widget to the top of the screen. +T} +b/T{ +Moves the widget to the bottom of the screen. +T} +l/T{ +Moves the widget to the left of the screen. +T} +r/T{ +Moves the widget to the right of the screen. +T} +c/T{ +Centers the widget between the left and right of the window. +T} +C/T{ +Centers the widget between the top and bottom of the window. +T} +Escape/Returns the widget to its original position. +Return/T{ +Exits the function and leaves the widgetwhere it was. +T} += +.TE +.LP +The numbers 0-9 are chosen to correspond to the numeric keypad on your terminal. +Cdk does not handle the application mode keypad control sequences, +since those are not defined via terminfo. +To use the numeric keypad you should ensure that it is in normal (or NumLock) +mode. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_process.3 b/deps/cdk-5.0-20161210/man/cdk_process.3 new file mode 100644 index 0000000..9f39406 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_process.3 @@ -0,0 +1,30 @@ +'\" t +.\" $Id: cdk_process.3,v 1.3 2005/12/28 18:19:17 tom Exp $ +.de XX +.. +.TH cdk_process 3 +.SH NAME +cdk_process \- curses widget pre/post-processing +.SH SYNOPSIS +Perform pre- and post-processing of data which is injected into a widget. +.SH DESCRIPTION +Character input is handled by each widget by its injection function. +That is typically a large case-statement consisting of the actions to +be taken for editing and scrolling keys. +The calling application can modify the behavior of the injection function +by defining either or both preprocess and postprocess functions. +.PP +Preprocessing is performed before doing anything with the injected keystroke. +If the preprocess function returns zero, no further action is taken in +the injection function. +Note that the preprocess function may do more than filter out characters; +it can fill in logic to coordinate different widgets. +.PP +Postprocessing is performed after all other actions have been done in +the injection function. +Like the other actions, it is performed only if the preprocess function +returns a nonzero value. +Unlike the preprocess function, its return value is ignored. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3). diff --git a/deps/cdk-5.0-20161210/man/cdk_radio.3 b/deps/cdk-5.0-20161210/man/cdk_radio.3 new file mode 100644 index 0000000..34884e9 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_radio.3 @@ -0,0 +1,559 @@ +'\" t +.\" $Id: cdk_radio.3,v 1.31 2016/12/11 01:06:02 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_radio 3 +.SH NAME +.XX activateCDKRadio +.XX destroyCDKRadio +.XX drawCDKRadio +.XX eraseCDKRadio +.XX getCDKRadioBox +.XX getCDKRadioChoiceCharacter +.XX getCDKRadioCurrentItem +.XX getCDKRadioHighlight +.XX getCDKRadioItems +.XX getCDKRadioLeftBrace +.XX getCDKRadioRightBrace +.XX getCDKRadioSelectedItem +.XX injectCDKRadio +.XX moveCDKRadio +.XX newCDKRadio +.XX positionCDKRadio +.XX setCDKRadio +.XX setCDKRadioBackgroundAttrib +.XX setCDKRadioBackgroundColor +.XX setCDKRadioBox +.XX setCDKRadioBoxAttribute +.XX setCDKRadioChoiceCharacter +.XX setCDKRadioCurrentItem +.XX setCDKRadioHighlight +.XX setCDKRadioHorizontalChar +.XX setCDKRadioItems +.XX setCDKRadioLLChar +.XX setCDKRadioLRChar +.XX setCDKRadioLeftBrace +.XX setCDKRadioPostProcess +.XX setCDKRadioPreProcess +.XX setCDKRadioRightBrace +.XX setCDKRadioSelectedItem +.XX setCDKRadioULChar +.XX setCDKRadioURChar +.XX setCDKRadioVerticalChar +cdk_radio \- curses radio list widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKRadio (" +.BI "CDKRADIO *" "radio", +.BI "chtype *" "actions"); +.TP 15 +.B "void destroyCDKRadio (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "void drawCDKRadio (" +.BI "CDKRADIO *" "radio", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKRadio (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "boolean getCDKRadioBox (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "chtype getCDKRadioChoiceCharacter (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "int getCDKRadioCurrentItem (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "chtype getCDKRadioHighlight (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "int getCDKRadioItems (" +.BI "CDKRADIO *" "radio", +.BI "char **" "list"); +.TP 15 +.B "chtype getCDKRadioLeftBrace (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "chtype getCDKRadioRightBrace (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "int getCDKRadioSelectedItem (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "int injectCDKRadio (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKRadio (" +.BI "CDKRADIO *" "radio", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKRADIO *newCDKRadio (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "spos", +.BI "int " "height", +.BI "int " "width", +.BI "const char *" "title", +.BI "CDK_CONST char **" "radioList", +.BI "int " "radioListLength", +.BI "chtype " "choiceCharacter", +.BI "int " "defaultItem", +.BI "chtype " "highlight", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKRadio (" +.BI "CDKRADIO *" "radio"); +.TP 15 +.B "void setCDKRadio (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "highlight", +.BI "chtype " "choiceCharacter", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKRadioBackgroundAttrib (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKRadioBackgroundColor (" +.BI "CDKRADIO *" "radio", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKRadioBox (" +.BI "CDKRADIO *" "radio", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKRadioBoxAttribute (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioChoiceCharacter (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioCurrentItem (" +.BI "CDKRADIO *" "radio", +.BI "int" "index"); +.TP 15 +.B "void setCDKRadioHighlight (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKRadioHorizontalChar (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioItems (" +.BI "CDKRADIO *" "radio", +.BI "CDK_CONST char **" "list", +.BI "int " "listSize"); +.TP 15 +.B "void setCDKRadioLLChar (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioLRChar (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioLeftBrace (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioPostProcess (" +.BI "CDKRADIO *" "radio", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKRadioPreProcess (" +.BI "CDKRADIO *" "radio", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKRadioRightBrace (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioSelectedItem (" +.BI "CDKRADIO *" "radio", +.BI "int " "item"); +.TP 15 +.B "void setCDKRadioULChar (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioURChar (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKRadioVerticalChar (" +.BI "CDKRADIO *" "radio", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk radio widget creates a radio list. +The following are functions which +create or manipulate the Cdk radio box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKRadio +activates the radio widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBradio\fR is a pointer to a non-NULL radio widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return a +value from 0 to the number of items -1, representing the item selected. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the +character entered into this widget was \fIESCAPE\fR then the widget will return +a value of -1 and the widget data \fIexitType\fR will be set to +\fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDKRadio +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKRadio +draws the radio widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKRadio +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKRadioBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKRadioChoiceCharacter +returns the character being used to draw the selected element in the list. +.TP 5 +.B getCDKRadioCurrentItem +returns the index of the current item. +.TP 5 +.B getCDKRadioHighlight +returns the attribute of the highlight bar. +.TP 5 +.B getCDKRadioItems +copies the radio box items into the caller's list, +which must be large enough since this function does not allocate it. +It returns the list size. +.TP 5 +.B getCDKRadioLeftBrace +returns the character being used to draw the left brace of the selection box. +.TP 5 +.B getCDKRadioRightBrace +returns the character being used to draw the right brace of the selection box. +.TP 5 +.B getCDKRadioSelectedItem, +returns the selected item of the widget. +.TP 5 +.B injectCDKRadio +function injects a single character into the widget. +.RS +.bP +The parameter \fBradio\fR is a pointer to a non-NULL radio widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a value ranging from zero to one less than the number of items, +representing the items selected. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKRadio +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKRadio +creates a radio widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBspos\fR +tells where the scroll bar is to be placed. +This may be one of three values: +.RS +.TP 5 +\fILEFT\fR +puts the scroll bar on the left of the scrolling list. +.TP 5 +\fIRIGHT\fR +puts the scroll bar on the right side of the list, and +.TP 5 +\fINONE\fR +does not add a scroll bar. +.RE +.TP 5 +\fBheight\fR and +\fBwidth\fR +control the height and width of the widget. +If you +provide a value of zero for either of the height or the width, the widget will +be created with the full width and height of the screen. +If you provide a negative +value, the widget will be created the full height or width minus the value provided. +.TP 5 +\fBtitle\fR +is the string which will be displayed at the top of the widget. +The title can be more than one line; just provide a carriage return +character at the line break. +.TP 5 +\fBradioList\fR +is the list of items to display in the radio list. +.TP 5 +\fBradioListLength\fR +is the number of elements in the given list. +.TP 5 +\fBchoiceCharacter\fR +is the character to use to highlight the current selection. +.TP 5 +\fBhighlight\fR +specifies the display attribute of the currently selected item. +.TP 5 +\fBdefaultItem\fR +is the index in the list of the default selection. +.TP 5 +\fBbox\fR +is true if widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKRadio +allows the user to move the widget around the screen via the +cursor/keypad keys. +See \fRcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKRadio +lets the programmer modify certain elements of an existing radio widget. +.IP +The parameter names correspond to the same parameter names listed +in the \fBnewCDKRadio\fR function. +.TP 5 +.B setCDKRadioBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKRadioBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKRadioBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKRadioBoxAttribute +function sets the attribute of the box. +.TP 5 +.B setCDKRadioChoiceCharacter +sets the character to use to draw the selected element in the list. +.TP 5 +.B setCDKRadioCurrentItem +sets the current item by its index in the list. +.TP 5 +.B setCDKRadioHighlight +sets the attribute of the highlight bar. +.TP 5 +.B setCDKRadioHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKRadioItems +set the radio list items and display the result. +The current item is set to the beginning of the list. +.TP 5 +.B setCDKRadioLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKRadioLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKRadioLeftBrace +sets the character to use to draw the left brace of the selection box. +.TP 5 +.B setCDKRadioPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKRadioPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKRadioRightBrace +sets the character to use to draw the right brace of the selection box. +.TP 5 +.B setCDKRadioSelectedItem +sets the selected item. +.TP 5 +.B setCDKRadioULChar +function sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKRadioURChar +function sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKRadioVerticalChar +function sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) box; +l l +lw15 lw35 . +\fBKey/Action\fR += +Left Arrow/Shifts the whole list left one character. +Right Arrow/Shifts the whole list right one character. +Up Arrow/Selects the next item up in the list. +Down Arrow/Selects the next item down in the list. +_ +Prev Page +Ctrl-B/Scroll one page backward. +_ +Next Page +Ctrl-F/Scroll one page forward. +_ +1 +< +g +Home/Move to the first element in the list. +_ +> +G +End/Move to the last element in the list. +_ +$/Shifts the whole list to the far right. +|/Shifts the whole list to the far left. +_ +Space/Selects or deselects the current choice. +Return/T{ +Exits the widget and returns the index of the selected item. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exit the widget and return the index of the selected item. +Set the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exit the widget and return -1. +Set the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +_ +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_screen.3 b/deps/cdk-5.0-20161210/man/cdk_screen.3 new file mode 100644 index 0000000..7cfda81 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_screen.3 @@ -0,0 +1,150 @@ +.\" $Id: cdk_screen.3,v 1.9 2016/12/04 16:17:40 tom Exp $ +.\" Bulleted paragraph +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_screen 3 +.SH NAME +.XX destroyCDKScreen +.XX endCDK +.XX eraseCDKScreen +.XX initCDKColor +.XX initCDKScreen +.XX lowerCDKObject +.XX raiseCDKObject +.XX refreshCDKScreen +.XX registerCDKObject +.XX unregisterCDKObject +cdk_screen \- Cdk Screen and Widget Manipulation Functions +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "void destroyCDKScreen(" +.BI "CDKSCREEN *" "screen"); +.TP 15 +.B "void endCDK(void)"; +.TP 15 +.B "void eraseCDKScreen(" +.BI "CDKSCREEN *" "screen"); +.TP 15 +.B "void initCDKColor (void)"; +.TP 15 +.B "CDKSCREEN *initCDKScreen (" +.BI "WINDOW *" "cursesWindow"); +.TP 15 +.B "void lowerCDKObject(" +.BI "EObjectType " "widgetType", +.BI "void *" "object"); +.TP 15 +.B "void raiseCDKObject(" +.BI "EObjectType " "widgetType", +.BI "void *" "object"); +.TP 15 +.B "void refreshCDKScreen(" +.BI "CDKSCREEN *" "screen"); +.TP 15 +.B "void registerCDKObject (" +.BI "CDKSCREEN *" "screen", +.BI "EObjectType " "widgetType", +.BI "void *" "object"); +.TP 15 +.B "void unregisterCDKObject(" +.BI "EObjectType " "widgetType", +.BI "void *" "object"); +.fi +.SH DESCRIPTION +Cdk manages all of the widgets for you. +These functions perform some of the management of the widgets in a screen. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B destroyCDKScreen +frees any memory allocated by the Cdk screen pointer. +.TP 5 +.B endCDK +cleans up any memory created by starting Cdk and shuts down curses. +.TP 5 +.B eraseCDKScreen +erases all of the widgets which are currently associated to the +given screen. +This does \fBNOT\fR destroy the widgets. +.TP 5 +.B initCDKColor +starts the Cdk color capabilities. +It defines 64 color pairs each +of which is accessible using the COLOR_PAIR macro. +If you do not have color +support, this function call makes no difference. +.TP 5 +.B initCDKScreen +takes a \fBWINDOW*\fR parameter \fIcursesWindow\fR and returns a +pointer to a \fBCDKSCREEN\fR. +.IP +Since all of the widgets take a +\fBCDKSCREEN\fR pointer as a first argument, +this is one of the first calls made. +.IP +If the \fIcursesWindow\fP parameter is a null pointer, +\fBinitCDKScreen\fP initializes curses and +replaces the parameter with \fBstdscr\fP. +Otherwise, it assumes that your application has already +initialized the locale and then called \fBinitscr\fP +.IP +In either case, the (possibly updated) \fIcursesWindow\fP parameter is +used as the window for the \fBCDKSCREEN\fP result. +.TP 5 +.B lowerCDKObject +has the opposite effect of the \fBraiseCDKObject\fR function call. +.TP 5 +.B raiseCDKObject +raises the widget to the top of the screen. +If there are any +widgets which overlap the given object when a refresh is done, calling this +function has the effect of raiding the object so no other widgets obstruct it. +.RS +.bP +The \fIwidgetType\fR parameter states what Cdk widget type this object is. +.bP +The \fIobject\fR parameter is a void pointer to the object. +.RE +.TP 5 +.B refreshCDKScreen +redraws all of the widgets which are currently associated to the +given screen. +.TP 5 +.B registerCDKObject +is called automatically when a widget is created. +If for some +reason an object does get unregistered, by calling \fBunregisterCDKObject\fR, +the widget can be registered again by calling this function. +.RS +.bP +The \fIwidgetType\fR parameter states what Cdk widget type this object is. +.bP +The \fIobject\fR parameter is a void pointer to the object. +.RE +.TP 5 +.B unregisterCDKObject +removes the widget from the screen. +This does \fBNOT\fR destroy +the object, it removes the widget from any further refreshes by the function +\fBrefreshCDKScreen\fR. +.RS +.bP +The \fIwidgetType\fR parameter states what Cdk widget +type this object is. +.bP +The \fIobject\fR parameter is a void pointer to the object. +.RE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_scroll.3 b/deps/cdk-5.0-20161210/man/cdk_scroll.3 new file mode 100644 index 0000000..f6dfb35 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_scroll.3 @@ -0,0 +1,587 @@ +'\" t +.\" $Id: cdk_scroll.3,v 1.30 2016/12/11 01:16:47 tom Exp $" +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_scroll 3 +.SH NAME +.XX activateCDKScroll +.XX addCDKScrollItem +.XX deleteCDKScrollItem +.XX destroyCDKScroll +.XX drawCDKScroll +.XX eraseCDKScroll +.XX getCDKScrollBox +.XX getCDKScrollCurrent +.XX getCDKScrollCurrentItem +.XX getCDKScrollCurrentTop +.XX getCDKScrollHighlight +.XX getCDKScrollItems +.XX injectCDKScroll +.XX insertCDKScrollItem +.XX moveCDKScroll +.XX newCDKScroll +.XX positionCDKScroll +.XX setCDKScroll +.XX setCDKScrollBackgroundAttrib +.XX setCDKScrollBackgroundColor +.XX setCDKScrollBox +.XX setCDKScrollBoxAttribute +.XX setCDKScrollCurrent +.XX setCDKScrollCurrentItem +.XX setCDKScrollCurrentTop +.XX setCDKScrollHighlight +.XX setCDKScrollHorizontalChar +.XX setCDKScrollItems +.XX setCDKScrollLLChar +.XX setCDKScrollLRChar +.XX setCDKScrollPosition +.XX setCDKScrollPostProcess +.XX setCDKScrollPreProcess +.XX setCDKScrollULChar +.XX setCDKScrollURChar +.XX setCDKScrollVerticalChar +cdk_scroll \- curses scrolling list widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKScroll (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype * " "actions"); +.TP 15 +.B "void addCDKScrollItem (" +.BI "CDKSCROLL *" "scroll", +.BI "const char *" "item"); +.TP 15 +.B "void deleteCDKScrollItem (" +.BI "CDKSCROLL *" "scroll", +.BI "int " "position"); +.TP 15 +.B "void destroyCDKScroll (" +.BI "CDKSCROLL *" "scroll"); +.TP 15 +.B "void drawCDKScroll (" +.BI "CDKSCROLL *" "scroll", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKScroll (" +.BI "CDKSCROLL *" "scroll"); +.TP 15 +.B "boolean getCDKScrollBox (" +.BI "CDKSCROLL *" "scroll"); +.TP 15 +.B "int getCDKScrollCurrent(" +.BI "CDKSCROLL *" "scroll"); +.TP 15 +.B "int getCDKScrollCurrentItem (" +.BI "CDKSCROLL *" "widget"); +.TP 15 +.B "chtype getCDKScrollHighlight (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "highlight"); +.TP 15 +.B "int getCDKScrollCurrentTop (" +.BI "CDKSCROLL *" "widget"); +.TP 15 +.B "int getCDKScrollItems (" +.BI "CDKSCROLL *" "scroll", +.BI "char **" "itemList"); +.TP 15 +.B "int injectCDKScroll (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "input"); +.TP 15 +.B void insertCDKScrollItem ( +.BI "CDKSCROLL *" "scroll", +.BI "const char *" "item"); +.TP 15 +.B "void moveCDKScroll (" +.BI "CDKSCROLL *" "scroll", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKSCROLL *newCDKScroll (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "spos", +.BI "int " "height", +.BI "int " "width", +.BI "const char *" "title", +.BI "CDK_CONST char **" "itemList", +.BI "int " "items", +.BI "boolean " "numbers", +.BI "chtype " "highlight", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKScroll (" +.BI "CDKSCROLL *" "scroll"); +.TP 15 +.B "void setCDKScroll (" +.BI "CDKSCROLL *" "scroll", +.BI "CDK_CONST char **" "itemList", +.BI "int " "items", +.BI "boolean " "numbers", +.BI "chtype " "highlight", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKScrollBackgroundAttrib (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKScrollBackgroundColor (" +.BI "CDKSCROLL *" "scroll", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKScrollBox (" +.BI "CDKSCROLL *" "scroll", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKScrollBoxAttribute (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKScrollCurrent( +.BI "CDKSCROLL *" "scroll", +.BI "int" "item"); +.TP 15 +.B "void setCDKScrollCurrentItem (" +.BI "CDKSCROLL *" "widget", +.BI "int" "item"); +.TP 15 +.B "int getCDKScrollCurrentTop (" +.BI "CDKSCROLL *" "widget"); +.TP 15 +.B "void setCDKScrollHighlight (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKScrollHorizontalChar (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKScrollItems (" +.BI "CDKSCROLL *" "scroll", +.BI "CDK_CONST char **" "itemList", +.BI "int " "listSize", +.BI "boolean " "numbers"); +.TP 15 +.B "void setCDKScrollLLChar (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKScrollLRChar (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKScrollPosition (" +.BI "CDKSCROLL *" "scroll", +.BI "int" "item"); +.TP 15 +.B "void setCDKScrollPostProcess (" +.BI "CDKSCROLL *" "scroll", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKScrollPreProcess (" +.BI "CDKSCROLL *" "scroll", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKScrollULChar (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKScrollURChar (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKScrollVerticalChar (" +.BI "CDKSCROLL *" "scroll", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk scroll widget creates a scrolling list. +The following are functions +which create or manipulate the Cdk scrolling list widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKScroll +activates the scroll widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBscroll\fR points to a non-NULL scroll widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return a +value from 0 to the number of items-1, representing the item selected. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the +character entered into this widget was \fIESCAPE\fR then the widget will return +a value of -1 and the widget data \fIexitType\fR will be set to \fIvESCAPE_HIT\fR. +.TP 5 +.B addCDKScrollItem +allows the user to add an item into an existing scrolling list. +.RS +.bP +The \fBscroll\fR parameter points to the scrolling list to add the +item to. +.bP +The parameter \fBitem\fR is a \fIchar *\fR representing the new item +to add. +The item is always added to the end of the list. +.RE +.TP 5 +.B deleteCDKScrollItem +allows the user to add an item into an existing scrolling list. +.RS +.bP +The \fBscroll\fR parameter points to the scrolling list to add the +item to. +.bP +The parameter \fBf2position\fR is an \fIint\fR which specifies which +element to remove. +.RE +.TP 5 +.B destroyCDKScroll +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKScroll +draws the scroll widget on the screen. +If the \fBbox\fR option is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKScroll +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKScrollBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKScrollCurrent +returns the current item's index. +.TP 5 +.B getCDKScrollCurrentItem +returns the current item number in the scroller. +.TP 5 +.B getCDKScrollHighlight +returns the attribute of the highlight bar. +.TP 5 +.B getCDKScrollCurrentTop +returns the top line of the scroller, counting from zero. +.TP 5 +.B getCDKScrollItems +fills the parameter \fBitemList\fR with the contents of the scrolling list. +It returns the number of elements in the scrolling list. +.TP 5 +.B injectCDKScroll +injects a single character into the widget. +.RS +.bP +The parameter \fBscroll\fR points to a non-NULL scroll widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a value ranging from zero to one less than the number of items, +representing the item selected. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B insertCDKScrollItem +allows the user to add an item into an existing scrolling list. +.RS +.bP +The \fBscroll\fR parameter points to the scrolling list to add the item to. +.bP +The parameter \fBitem\fR is a \fIchar *\fR representing the new item to add. +.RE +.IP +The item is always added before the current item in the list. +.TP 5 +.B moveCDKScroll +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which states +whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKScroll +creates a scroll widget and returns a pointer to it. +Parameters: +.RS +.bP +The \fBscreen\fR parameter is the screen you wish this widget to be placed in. +.bP +The parameter \fBxpos\fR +controls the placement of the object along the horizontal axis. +This parameter +may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +\fBypos\fR +controls the placement +of the object along the vertical axis. +This parameter may be an integer +value or one of the pre-defined values \fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +\fBspos\fR +is where the scroll bar is to be placed. +This may be one of three values: +.RS +.TP 5 +\fILEFT\fR, +which puts the scroll bar on the left +of the scrolling list. +.TP 5 +\fIRIGHT\fR +which puts the scroll bar on the right side +of the list, and +.TP 5 +\fINONE\fR which does not add a scroll bar. +.RE +.bP +\fBheight\fR and +\fBwidth\fR +control the height and width of the widget. +.IP +If you provide a value of zero for either of the height or the width, the widget will +be created with the full width and height of the screen. +If you provide a negative +value, the widget will be created the full height or width minus the value provided. +.bP +\fBtitle\fR +is the string which will be displayed +at the top of the widget. +The title can be more than one line; just provide a +carriage return character at the line break. +.bP +\fBitemList\fR +is the list of items to be displayed in the scrolling list. +.bP +\fBitems\fR +is the number of elements in the given list. +.bP +\fBnumbers\fR +is true if you want the items in the list to have a number +attached to the front of the list items. +.bP +\fBhighlight\fR +specifies +the display attribute of the currently selected item. +.bP +\fBbox\fR +is true if the widget should be drawn with a box around it. +.bP +\fBshadow\fR +is true to turn the shadow on around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKScroll +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKScroll +lets the programmer modify certain elements of an existing +scroll widget. +.IP +The parameter names correspond to the same parameter names listed +in the \fBnewCDKScroll\fR function. +.TP 5 +.B setCDKScrollBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKScrollBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKScrollBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKScrollBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKScrollCurrent +sets the index for the current item. +.TP 5 +.B setCDKScrollCurrentItem +set the current item number in the scroller. +.TP 5 +.B setCDKScrollCurrentTop +set the top line number of the scroller. +.TP 5 +.B setCDKScrollHighlight +sets the attribute of the highlight bar. +.TP 5 +.B setCDKScrollHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKScrollItems +sets the contents of the scrolling list. +.TP 5 +.B setCDKScrollLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKScrollLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKScrollPosition +sets the current item in the widget to the given position. +.TP 5 +.B setCDKScrollPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKScrollPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKScrollULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKScrollURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKScrollVerticalChar +sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) box; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +Left Arrow/Shift the list left one column. +Right Arrow/Shift the list right one column. +Up Arrow/Select the previous item in the list. +Down Arrow/Select the next item in the list. +_ +Prev Page +Ctrl-B/Scroll one page backward. +Next Page +Ctrl-F/Scroll one page forward. +_ +1 +< +g +Home/Move to the first element in the list. +_ +> +G +End/Move to the last element in the list. +_ +$/Shift the list to the far right. +|/Shift the list to the far left. +_ +Return/T{ +Exit the widget and return the index of the selected item. +Also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exit the widget and return the index of the selected item. +Also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exit the widget and return -1. +Also set the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_selection.3 b/deps/cdk-5.0-20161210/man/cdk_selection.3 new file mode 100644 index 0000000..158fcd6 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_selection.3 @@ -0,0 +1,568 @@ +'\" t +.\" $Id: cdk_selection.3,v 1.25 2016/12/10 16:56:13 tom Exp $" +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_selection 3 +.SH NAME +.XX activateCDKSelection +.XX destroyCDKSelection +.XX drawCDKSelection +.XX eraseCDKSelection +.XX getCDKSelectionBox +.XX getCDKSelectionChoice +.XX getCDKSelectionChoices +.XX getCDKSelectionCurrent +.XX getCDKSelectionHighlight +.XX getCDKSelectionItems +.XX getCDKSelectionMode +.XX getCDKSelectionModes +.XX getCDKSelectionTitle +.XX injectCDKSelection +.XX moveCDKSelection +.XX newCDKSelection +.XX positionCDKSelection +.XX setCDKSelection +.XX setCDKSelectionBackgroundAttrib +.XX setCDKSelectionBackgroundColor +.XX setCDKSelectionBox +.XX setCDKSelectionBoxAttribute +.XX setCDKSelectionChoice +.XX setCDKSelectionChoices +.XX setCDKSelectionCurrent +.XX setCDKSelectionHighlight +.XX setCDKSelectionHorizontalChar +.XX setCDKSelectionItems +.XX setCDKSelectionLLChar +.XX setCDKSelectionLRChar +.XX setCDKSelectionMode +.XX setCDKSelectionModes +.XX setCDKSelectionPostProcess +.XX setCDKSelectionPreProcess +.XX setCDKSelectionTitle +.XX setCDKSelectionULChar +.XX setCDKSelectionURChar +.XX setCDKSelectionVerticalChar +cdk_selection \- curses selection list widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKSelection (" +.BI "CDKSELECTION *" "selection", +.BI "chtype * " "actions"); +.TP 15 +.B "void destroyCDKSelection (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "void drawCDKSelection (" +.BI "CDKSELECTION *" "selection", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKSelection (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "boolean getCDKSelectionBox (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "int getCDKSelectionChoice (" +.BI "CDKSELECTION *" "selection", +.BI "int " "index"); +.TP 15 +.B "int *getCDKSelectionChoices (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "int getCDKSelectionCurrent (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "chtype getCDKSelectionHighlight (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "int getCDKSelectionItems (" +.BI "CDKSELECTION *" "selection", +.BI "char **" "list"); +.TP 15 +.B "int getCDKSelectionMode (" +.BI "CDKSELECTION *" "selection", +.BI "int " "index"); +.TP 15 +.B "int *getCDKSelectionModes (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "char *getCDKSelectionTitle (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "int injectCDKSelection (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDKSelection (" +.BI "CDKSELECTION *" "selection", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKSELECTION *newCDKSelection (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "spos", +.BI "int " "height", +.BI "int " "width", +.BI "const char *" "title", +.BI "CDK_CONST char **" "selectionList", +.BI "int " "selectionListLength", +.BI "CDK_CONST char **" "choiceList", +.BI "int " "choiceListLength", +.BI "chtype " "highlight", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKSelection (" +.BI "CDKSELECTION *" "selection"); +.TP 15 +.B "void setCDKSelection (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "highlight", +.BI "int *" "defChoices", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKSelectionBackgroundAttrib (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKSelectionBackgroundColor (" +.BI "CDKSELECTION *" "selection", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKSelectionBox (" +.BI "CDKSELECTION *" "selection", +.BI "boolean " "boxWidget"); +.TP 15 +.B "void setCDKSelectionBoxAttribute (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSelectionChoice (" +.BI "CDKSELECTION *" "selection", +.BI "int " "index", +.BI "int " "choice"); +.TP 15 +.B "void setCDKSelectionChoices (" +.BI "CDKSELECTION *" "selection", +.BI "int *" "choices"); +.TP 15 +.B "void setCDKSelectionCurrent (" +.BI "CDKSELECTION *" "selection", +.BI "int" "index"); +.TP 15 +.B "void setCDKSelectionHighlight (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKSelectionHorizontalChar (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSelectionItems (" +.BI "CDKSELECTION *" "selection", +.BI "CDK_CONST char **" "list", +.BI "int " "listSize"); +.TP 15 +.B "void setCDKSelectionLLChar (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSelectionLRChar (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSelectionMode (" +.BI "CDKSELECTION *" "selection", +.BI "int " "index", +.BI "int " "mode"); +.TP 15 +.B "void setCDKSelectionModes (" +.BI "CDKSELECTION *" "selection", +.BI "int *" "modes"); +.TP 15 +.B "void setCDKSelectionPostProcess (" +.BI "CDKSELECTION *" "selection", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKSelectionPreProcess (" +.BI "CDKSELECTION *" "selection", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKSelectionTitle (" +.BI "CDKSELECTION *" "selection", +.BI "const char *" "title"); +.TP 15 +.B "void setCDKSelectionULChar (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSelectionURChar (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSelectionVerticalChar (" +.BI "CDKSELECTION *" "selection", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk selection widget creates a selection list. +The following functions create or manipulate the Cdk selection list widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKSelection +activates the selection widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBselection\fR is a pointer to a non-NULL selection widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return 1. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +If the +character entered into this widget was \fIESCAPE\fR then the widget will return +a value of -1 and the widget data \fIexitType\fR will be set to +\fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDKSelection +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKSelection +draws the selection widget on the screen. +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKSelection +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKSelectionBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKSelectionChoice +returns the selection choice at the given index. +.TP 5 +.B getCDKSelectionChoices +returns an array of the current selection choices for the widget. +.TP 5 +.B getCDKSelectionCurrent +returns the current selection index. +.TP 5 +.B getCDKSelectionHighlight +returns the attribute of the highlight bar. +.TP 5 +.B getCDKSelectionItems +copies the selection-list items into the caller's array +and returns the number of items in the list. +.TP 5 +.B getCDKSelectionMode +returns the selection mode at the given index. +.TP 5 +.B getCDKSelectionModes +returns an array of the current modes for the widget. +.TP 5 +.B getCDKSelectionTitle +returns the first line of the title of the selection widget. +The caller must free the returned value. +.TP 5 +.B injectCDKSelection +injects a single character into the widget. +.RS +.bP +The parameter \fBselection\fR is a pointer to a non-NULL selection widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +1. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +\fIvESCAPE_HIT\fR. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDKSelection +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.bP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.bP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKSelection +creates a selection widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBspos\fR +is where the scroll bar is to be placed. +It may be one of three values: +.RS +.TP 5 +\fILEFT\fR +puts the scroll bar on the left +of the scrolling list. +\fIRIGHT\fR +puts the scroll bar on the right side of the list, and +.TP 5 +\fINONE\fR +does not add a scroll bar. +.RE +.TP 5 +\fBheight\fR and +.TP 5 +\fBwidth\fR +control the height and width of the widget. +If you provide a value of zero for either of the height or the width, the widget +will be created with the full width and height of the screen. +If you provide a +negative value, the widget will be created the full height or width minus the +value provided. +.TP 5 +\fBtitle\fR +is the string which to display at the top of the widget. +The title can be more than one line; just +provide a carriage return character at the line break. +.TP 5 +\fBselectionList\fR +is the list of items to display in the selection list +.TP 5 +\fBselectionListLength\fR +is the number of elements in the given list. +.TP 5 +\fBchoiceList\fR +is the list of choices that will +be selected when the user presses the space bar. +.TP 5 +\fBchoiceListLength\fR +is the length of this list. +.TP 5 +\fBhighlight\fR +specifies the display attribute of the currently selected item. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKSelection +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKSelection +lets the programmer modify certain elements of an existing selection widget. +The parameter names correspond to the same +parameter names listed in the \fBnewCDKSelection\fR function. +.TP 5 +.B setCDKSelectionBackgroundAttrib +sets the background attribute of the widget. +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKSelectionBackgroundColor +sets the background color of the widget. +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKSelectionBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKSelectionBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKSelectionChoice +sets the selection choice value at the given index. +.TP 5 +.B setCDKSelectionChoices +sets the selection choice values of the widget. +.TP 5 +.B setCDKSelectionCurrent +sets the current selection index. +.TP 5 +.B setCDKSelectionHighlight +sets the attribute of the highlight bar. +.TP 5 +.B setCDKSelectionHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKSelectionItems +sets the selection list items. +.TP 5 +.B setCDKSelectionLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKSelectionLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKSelectionMode +sets the selection mode at the given index. +.TP 5 +.B setCDKSelectionModes +sets the selection mode of the elements of the widget. +There are two acceptable values for the modes: 0 which allows the user to change the +selection value at the given index; and 1 which sets the element to a read-only state. +.TP 5 +.B setCDKSelectionPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +The parameter \fBfunction\fR is the callback function. +The parameter \fBdata\fR points to data passed to the callback function. +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKSelectionPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +The parameter \fBfunction\fR is the callback function. +The parameter \fBdata\fR is a pointer to +\fIvoid\fR. +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKSelectionTitle +set the selection list's title. +.TP 5 +.B setCDKSelectionULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKSelectionURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKSelectionVerticalChar +sets the vertical drawing character for the box to the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which +help the user enter or manipulate the information quickly: +.LP +.TS +center tab(/) box; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +Left Arrow/T{ +Shift the whole list left one column. +T} +Right Arrow/T{ +Shift the whole list right one column. +T} +Up Arrow/T{ +Select the previous item in the list. +T} +Down Arrow/T{ +Select the next item in the list. +T} +_ +Prev Page +Ctrl-B/Scroll one page backward. +_ +Next Page +Ctrl-F/Scroll one page forward. +_ +1 +< +g +Home/Move to the first element in the list. +_ +> +G +End/Move to the last element in the list. +_ +$/Shift the whole list to the far right. +|/Shift the whole list to the far left. +_ +Space/T{ +Cycles to the next choice on the current item. +T} +Return/T{ +Exit the widget and return 1. +Also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exit the widget and return 1. +Also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exit the widget and return -1. +Also set the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_swindow.3 b/deps/cdk-5.0-20161210/man/cdk_swindow.3 new file mode 100644 index 0000000..1257a72 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_swindow.3 @@ -0,0 +1,553 @@ +'\" t +.\" $Id: cdk_swindow.3,v 1.25 2016/12/11 01:21:42 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_swindow 3 +.SH NAME +.XX activateCDKSwindow +.XX addCDKSwindow +.XX cleanCDKSwindow +.XX destroyCDKSwindow +.XX drawCDKSwindow +.XX dumpCDKSwindow +.XX eraseCDKSwindow +.XX execCDKSwindow +.XX getCDKSwindowBox +.XX getCDKSwindowContents +.XX injectCDKSwindow +.XX jumpToLineCDKSwindow +.XX loadCDKSwindowInformation +.XX moveCDKSwindow +.XX newCDKSwindow +.XX positionCDKSwindow +.XX saveCDKSwindowInformation +.XX setCDKSwindow +.XX setCDKSwindowBackgroundAttrib +.XX setCDKSwindowBackgroundColor +.XX setCDKSwindowBox +.XX setCDKSwindowBoxAttribute +.XX setCDKSwindowContents +.XX setCDKSwindowHorizontalChar +.XX setCDKSwindowLLChar +.XX setCDKSwindowLRChar +.XX setCDKSwindowPostProcess +.XX setCDKSwindowPreProcess +.XX setCDKSwindowULChar +.XX setCDKSwindowURChar +.XX setCDKSwindowVerticalChar +.XX trimCDKSwindow +cdk_swindow \- a curses scrolling window widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "void activateCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype * " "actions"); +.TP 15 +.B "void addCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "const char *" "info", +.BI "int " "insertPosition"); +.TP 15 +.B "void cleanCDKSwindow (" +.BI "CDKSWINDOW *" "swindow"); +.TP 15 +.B "int execCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "const char * " "command", +.BI "int " "insertPosition"); +.TP 15 +.B "void destroyCDKSwindow (" +.BI "CDKSWINDOW *" "swindow"); +.TP 15 +.B "void drawCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "boolean " "box"); +.TP 15 +.B "void dumpCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "const char *" "filename"); +.TP 15 +.B "void eraseCDKSwindow (" +.BI "CDKSWINDOW *" "swindow"); +.B "void execCDKSwindow (" +.BI "CDKSWINDOW *" "swindow," +.BI "char *" "command," +.BI "int " "insertPosition);" +.B "boolean getCDKSwindowBox (" +.BI "CDKSWINDOW *" "swindow);" +.TP 15 +.B "chtype **getCDKSwindowContents (" +.BI "CDKSWINDOW *" "swindow"); +.TP 15 +.B "int injectCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "input"); +.TP 15 +.B "void jumpToLineCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "int " "line"); +.TP 15 +.B "void loadCDKSwindowInformation (" +.BI "CDKSWINDOW *" "swindow"); +.TP 15 +.B "void moveCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKSWINDOW *newCDKSwindow (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "height", +.BI "int " "width", +.BI "const char *" "title", +.BI "int " "saveLines", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKSwindow (" +.BI "CDKSWINDOW *" "swindow"); +.TP 15 +.B "void saveCDKSwindowInformation (" +.BI "CDKSWINDOW *" "swindow"); +.TP 15 +.B "void setCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "CDK_CONST char **" "info", +.BI "int " "lines", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKSwindowBackgroundAttrib (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKSwindowBackgroundColor (" +.BI "CDKSWINDOW *" "swindow", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKSwindowBox (" +.BI "CDKSWINDOW *" "swindow," +.BI "boolean " "boxWidget);" +.TP 15 +.B "void setCDKSwindowBoxAttribute (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSwindowContents (" +.BI "CDKSWINDOW *" "swindow", +.BI "char **" "info", +.BI "int " "lines"); +.TP 15 +.B "void setCDKSwindowHorizontalChar (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSwindowLLChar (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSwindowLRChar (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSwindowPostProcess (" +.BI "CDKSWINDOW *" "swindow", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKSwindowPreProcess (" +.BI "CDKSWINDOW *" "swindow", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKSwindowULChar (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSwindowURChar (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKSwindowVerticalChar (" +.BI "CDKSWINDOW *" "swindow", +.BI "chtype " "character"); +.TP 15 +.B "void trimCDKSwindow (" +.BI "CDKSWINDOW *" "swindow", +.BI "int " "start", +.BI "int " "finish"); +.fi +.SH DESCRIPTION +The Cdk scrolling window (swindow) widget can be used to display messages. +The following functions create or manipulate the Cdk swindow box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKSwindow +function activates the swindow widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBswindow\fR is a pointer to a non-NULL swindow widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character +entered into this widget is \fIRETURN\fR or \fITAB\fR then this function will +return 1. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the character entered into this widget was \fIESCAPE\fR then the widget will +return a value of -1 and the widget data \fIexitType\fR will be set to +\fIvESCAPE_HIT\fR. +.TP 5 +.B addCDKSwindow +adds information to a scrolling window. +.RS +.bP +The information +is supplied by the \fBinfo\fR parameter. +The information is immediately added +to the scrolling window. +.bP +The position of the new information is governed by +the value of the parameter \fBinsertPosition\fR. +This parameter may be +two values: \fITOP\fR or \fIBOTTOM\fR. +.RE +.TP 5 +.B cleanCDKSwindow +clears the information from the window. +.TP 5 +.B destroyCDKSwindow +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKSwindow +draws the swindow widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B dumpCDKSwindow +saves the contents of the scrolling window into the file +specified by the \fBfilename\fR parameter. +It returns -1 on failure, +and the number of lines saved if the dump was successful. +.TP 5 +.B eraseCDKSwindow +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B execCDKSwindow +allows the user to execute a shell command and have the output +of the shell command direct itself to the scrolling window. +.RS +.bP +The \fBcommand\fR parameter is the command to execute. +.bP +The \fBinsertPosition\fR parameter tells where the +output will be inserted within the scrolling window. +.RE +.TP 5 +.B getCDKSwindowBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKSwindowContents +returns the contents of the scrolling window. +.IP +The parameter \fBlines\fR will be +set to the number of lines returned. +.TP 5 +.B injectCDKSwindow +injects a single character into the widget. +.RS +.bP +The parameter \fBswindow\fR is a pointer to a non-NULL swindow widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +1. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +-1. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B jumpToLineCDKSwindow +moves the scrolling window to the given line. +.IP +The parameter \fBline\fR may be an integer or one of the two predefined values +\fITOP\fR and \fIBOTTOM\fR. +.TP 5 +.B loadCDKSwindowInformation +allows the user to load the contents of a file into the scrolling window. +This function is interactive, and will ask for a filename. +.TP 5 +.B moveCDKSwindow +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, +if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDKSwindow +creates a swindow widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBheight\fR and +.TP 5 +\fBwidth\fR +control the height and width of the widget. +If you provide a value of zero for either of the height or the width, the +widget will be created with the full width and height of the screen. +If you provide +a negative value, the widget will be created the full height or width minus the +value provided. +.TP 5 +\fBtitle\fR +is the string to display at the top of the widget. +The title can be more than one line; just provide a carriage +return character at the line break. +.TP 5 +\fBsaveLines\fR +is the number of lines to save before throwing information away. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +The \fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKSwindow +allows the user to move the widget around the screen via the +cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B saveCDKSwindowInformation +allows the user to save the contents of the scrolling window into a file. +This function is interactive, and will ask for a filename. +.TP 5 +.B setCDKSwindow +lets the programmer modify certain elements of an existing +swindow widget. +.RS +.bP +The parameter \fBinfo\fR is a \fIchar **\fR of the information +to set in the scrolling window; \fBlines\fR is the number of lines being added. +.bP +The other parameter names correspond to the same parameter names listed in the +\fBnewCDKSwindow\fR function. +.RE +.TP 5 +.B setCDKSwindowBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKSwindowBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKSwindowBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKSwindowBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKSwindowContents +lets the programmer modify certain elements of an existing swindow widget. +.RS +.bP +The parameter \fBinfo\fR is a \fIchar **\fR of the information +to set in the scrolling window. +.bP +\fBlines\fR is the number of lines being added. +.RE +.TP 5 +.B setCDKSwindowHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKSwindowLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKSwindowLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKSwindowPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKSwindowPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKSwindowULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKSwindowURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKSwindowVerticalChar +sets the vertical drawing character for the box to the given character. +.TP 5 +.B trimCDKSwindow +removes information from a scrolling window. +.IP +The parameters \fBstart\fR and \fBend\fR state where to start cutting from and where to stop. +.IP +The first element in the scrolling window starts at index 0. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) box; +l l +lw(15) lw(45) . +\fBKey/Action\fR += +Left Arrow/Scrolls the window left one column. +Right Arrow/Scrolls the window right one column. +Up Arrow/Scrolls the window up one row. +Down Arrow/Scrolls the window down one row. +_ +Prev Page +Ctrl-B +b +B/Scroll the window backward one page. +_ +Next Page +Ctrl-F +Space +f +F/Scroll the window forward one page. +_ +Home +|/Scroll the list to the left margin. +_ +End +$/Scroll the list to the right margin. +_ +1 +< +g/Move to the top of the scrolling window. +> +G/Move to the bottom of the scrolling window. +_ +l +L/Load a file into the scrolling window. +_ +s +S/T{ +Save the contents of the scrolling window into a file. +T} +_ +Return/T{ +Set the widget's \fIexitType\fR to \fIvNORMAL\fR, exit the widget and return 1. +T} +Tab/T{ +Set the widget's \fIexitType\fR to \fIvNORMAL\fR, exit the widget and return 1. +T} +Escape/T{ +Set the widget's \fIexitType\fR to \fIvESCAPE_HIT\fR, exit the widget and return -1. +T} +Ctrl-L/Refreshes the screen. += +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_template.3 b/deps/cdk-5.0-20161210/man/cdk_template.3 new file mode 100644 index 0000000..1c56fb1 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_template.3 @@ -0,0 +1,504 @@ +.\" $Id: cdk_template.3,v 1.28 2016/12/11 01:26:36 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_template 3 +.SH NAME +.XX activateCDKTemplate +.XX cleanCDKTemplate +.XX destroyCDKTemplate +.XX drawCDKTemplate +.XX eraseCDKTemplate +.XX getCDKTemplateBox +.XX getCDKTemplateMin +.XX getCDKTemplateValue +.XX injectCDKTemplate +.XX mixCDKTemplate +.XX newCDKTemplate +.XX setCDKTemplate +.XX setCDKTemplateBackgroundAttrib +.XX setCDKTemplateBackgroundColor +.XX setCDKTemplateBox +.XX setCDKTemplateBoxAttribute +.XX setCDKTemplateCB +.XX setCDKTemplateHorizontalChar +.XX setCDKTemplateLLChar +.XX setCDKTemplateLRChar +.XX setCDKTemplateMin +.XX setCDKTemplatePostProcess +.XX setCDKTemplatePreProcess +.XX setCDKTemplateULChar +.XX setCDKTemplateURChar +.XX setCDKTemplateValue +.XX setCDKTemplateVerticalChar +.XX unmixCDKTemplate +cdk_template \- a curses template widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "char *activateCDKTemplate (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype * " "actions"); +.TP 15 +.B "void cleanCDKTemplate (" +.BI "CDKTEMPLATE *" "template"); +.TP 15 +.B "void destroyCDKTemplate (" +.BI "CDKTEMPLATE *" "template"); +.TP 15 +.B "void drawCDKTemplate (" +.BI "CDKTEMPLATE *" "template", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKTemplate (" +.BI "CDKTEMPLATE *" "template"); +.TP 15 +.B "boolean getCDKTemplateBox (" +.BI "CDKTEMPLATE *" "template"); +.TP 15 +.B "int getCDKTemplateMin (" +.BI "CDKTEMPLATE *" "template"); +.TP 15 +.B "char *getCDKTemplateValue (" +.BI "CDKTEMPLATE *" "template"); +.TP 15 +.B "char *injectCDKTemplate (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "input"); +.TP 15 +.B "char *mixCDKTemplate (" +.BI "CDKTEMPLATE *" "template"); +.TP 15 +.B "void moveCDKTemplate (" +.BI "CDKTEMPLATE *" "template", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKTEMPLATE *newCDKTemplate (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "const char *" "title", +.BI "const char *" "label", +.BI "const char *" "plate", +.BI "const char *" "overlay", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKTemplate (" +.BI "CDKTEMPLATE *" "template"); +.TP 15 +.B "void setCDKTemplate (" +.BI "CDKTEMPLATE *" "template", +.BI "const char *" "value", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKTemplateBackgroundAttrib (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKTemplateBackgroundColor (" +.BI "CDKTEMPLATE *" "template", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKTemplateBox (" +.BI "CDKTEMPLATE *" "template", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKTemplateBoxAttribute (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKTemplateCB (" +.BI "CDKTEMPLATE *" "template", +.BI "TEMPLATECB " "callbackFunction"); +.TP 15 +.B "void setCDKTemplateHorizontalChar (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKTemplateLLChar (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKTemplateLRChar (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKTemplateMin (" +.BI "CDKTEMPLATE *" "template", +.BI "int " "minimum"); +.TP 15 +.B "void setCDKTemplatePostProcess (" +.BI "CDKTEMPLATE *" "template", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKTemplatePreProcess (" +.BI "CDKTEMPLATE *" "template", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKTemplateULChar (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKTemplateURChar (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKTemplateValue (" +.BI "CDKTEMPLATE *" "template", +.BI "const char *" "value"); +.TP 15 +.B "void setCDKTemplateVerticalChar (" +.BI "CDKTEMPLATE *" "template", +.BI "chtype " "character"); +.TP 15 +.B "char *unmixCDKTemplate (" +.BI "CDKTEMPLATE *" "template", +.BI "const char *" "string"); +.fi +.SH DESCRIPTION +The Cdk template widget creates a template widget which allows a user to type +information into an entry field with a pre-set field format. +Typical uses for +this widget would be a date field or a time field. +The following are functions +which create or manipulate the Cdk template box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKTemplate +activates the template widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBtemplate\fR is a pointer to a non-NULL template widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return +a \fIchar\ *\fR representing the information typed into the widget and the +widget data \fIexitType\fR will be set to \fIvNORMAL\fR. +.IP +If the character +entered was \fIESCAPE\fR then the function will return \fINULL\fR pointer and +the widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP 5 +.B cleanCDKTemplate +clears the information from the field. +.TP 5 +.B destroyCDKTemplate +removes the widget from the screen and frees any memory the object used. +.TP 5 +.B drawCDKTemplate +draws the template widget on the screen. +If \fBbox\fR is true, +the widget is drawn with a box. +.TP 5 +.B eraseCDKTemplate +removes the widget from the screen. +This does \fBNOT\fR destroy the widget. +.TP 5 +.B getCDKTemplateBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKTemplateMin +returns the minimum characters that must be entered before the +widget will exit. +.TP 5 +.B getCDKTemplateValue +returns the current value of the widget. +.TP 5 +.B injectCDKTemplate +injects a single character into the widget. +.RS +.bP +The parameter \fBtemplate\fR is a pointer to a non-NULL template widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a \fIchar\ *\fR representing the information typed into the widget. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +a \fINULL\fR pointer. +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B mixCDKTemplate +returns a \fIchar*\fR pointer to the field value and the plate. +.TP 5 +.B moveCDKTemplate +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR is an integer or one of the predefined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR +may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, +if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will be repainted after the move. +.RE +.TP 5 +.B newCDKTemplate +creates a template widget, returning a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBtitle\fR +is the string to display at the top of the widget. +The title can be more than one line; just provide a carriage return +character at the line break. +.TP 5 +\fBlabel\fR +is the string to display in the label of the template field. +.TP 5 +\fBplate\fR +defines the character to allow at each position in the template field. +This is done by creating a character plate by using +special format character to tell the template widget what type of character +is allowed where in the template widget. +The following table lists the format types. +.LP +.TS +center tab(/); +l +l l +lw15 lw35 . +\fBPlate_Character/Effect\fR += +#/Accepts an integer. +A/Accepts an alphabetic value. +C/T{ +Accepts an alphabetic value. +Automatically converts the character to upper case. +T} +c/T{ +Accepts an alphabetic value. +Automatically converts the character to lower case. +T} +M/T{ +Accepts alphanumeric characters. +T} +X/T{ +Accepts alphanumeric characters. +Automatically converts the character to upper case. +T} +x/T{ +Accepts alphanumeric characters. +Automatically converts the character to upper case. +T} +Anything else/T{ +Ignored and assumed a non-editable position. +T} += +.TE +.TP 5 +\fBoverlay\fR +is the overlay of the template field. +If the field +needs some sort of overlay, this parameter supplies this. +A date field could +have YY/MM/DD, the overlay parameter would display YY/MM/DD on an empty template field. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKTemplate +allows the user to move the widget around the screen via the +single keystroke commands. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKTemplate +lets the programmer modify certain elements of an existing +template widget. +.IP +The parameter names correspond to the same parameter names +listed in the \fBnewCDKTemplate\fR function. +.TP 5 +.B setCDKTemplateBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKTemplateBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +For more information, see the \fIcdk_display (3)\fR. +.TP 5 +.B setCDKTemplateBox +sets a flag, true if the widget will be drawn with a box around it. +.TP 5 +.B setCDKTemplateBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKTemplateCB +allows the programmer to set a different widget input handler. +.IP +The parameter \fBcallbackFunction\fR is of type \fITEMPLATECB\fR. +.IP +The default input handler is \fICDKTemplateCallBack\fR. +.TP 5 +.B setCDKTemplateHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKTemplateLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKTemplateLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKTemplateMin +sets the minimum number of characters that must be entered +before the widget will exit. +.TP 5 +.B setCDKTemplatePostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +To learn more about post-processing see \fIcdk_process\fR (3). +.TP 5 +.B setCDKTemplatePreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +To learn more about preprocessing see \fIcdk_process\fR (3). +.TP 5 +.B setCDKTemplateULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKTemplateURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKTemplateValue +sets a value in the widget. +.TP 5 +.B setCDKTemplateVerticalChar +sets the vertical drawing character for the box to +the given character. +.TP 5 +.B unmixCDKTemplate +returns a \fIchar*\fR pointer to the field value without any +plate characters. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBKey/Action\fR += +Delete/T{ +Deletes the character at the cursor. +T} +Backspace/T{ +Deletes the character before cursor, moves cursor left. +T} +Ctrl-P/T{ +Pastes whatever is in the paste buffer, into the widget. +T} +Ctrl-K/T{ +Cuts the contents from the widget and saves a copy in the paste buffer. +T} +Ctrl-T/T{ +Copies the contents of the widget into the paste buffer. +T} +Ctrl-E/T{ +Erases the contents of the widget. +T} +Return/T{ +Exits the widget and returns a \fIchar*\fR representing the information which was typed into the field. +It also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exits the widget and returns a \fIchar*\fR representing the information which was typed into the field. +It also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns a \fINULL\fR pointer. +It also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L/Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_traverse.3 b/deps/cdk-5.0-20161210/man/cdk_traverse.3 new file mode 100644 index 0000000..6229b74 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_traverse.3 @@ -0,0 +1,226 @@ +.\" $Id: cdk_traverse.3,v 1.8 2016/12/11 01:27:58 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_traverse 3 +.SH NAME +.XX exitCancelCDKScreen +.XX exitCancelCDKScreenOf +.XX exitOKCDKScreen +.XX exitOKCDKScreenOf +.XX getCDKFocusCurrent +.XX resetCDKScreen +.XX resetCDKScreenOf +.XX setCDKFocusCurrent +.XX setCDKFocusFirst +.XX setCDKFocusLast +.XX setCDKFocusNext +.XX setCDKFocusPrevious +.XX traverseCDKOnce +.XX traverseCDKScreen +cdk_traverse - functions to support keyboard traversal +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +.nf +#include +.LP +.BI "CDKOBJS *getCDKFocusCurrent (CDKSCREEN *" "screen"); +.LP +.BI "CDKOBJS *setCDKFocusCurrent (CDKSCREEN *" "screen\fB, CDKOBJS *\fPobj"); +.LP +.BI "CDKOBJS *setCDKFocusFirst (CDKSCREEN *" "screen"); +.LP +.BI "CDKOBJS *setCDKFocusLast (CDKSCREEN *" "screen"); +.LP +.BI "CDKOBJS *setCDKFocusNext (CDKSCREEN *" "screen"); +.LP +.BI "CDKOBJS *setCDKFocusPrevious (CDKSCREEN *" "screen"); +.LP +.BI "int traverseCDKScreen (CDKSCREEN *" "screen"); +.LP +.BI "void exitOKCDKScreen (CDKSCREEN *" "screen"); +.LP +.BI "void exitCancelCDKScreen (CDKSCREEN *" "screen"); +.LP +.BI "void resetCDKScreen (CDKSCREEN *" "screen"); +.LP +.BI "void exitOKCDKScreenOf(CDKOBJS *" "obj"); +.LP +.BI "void exitCancelCDKScreenOf (CDKOBJS *" "obj"); +.LP +.BI "void resetCDKScreenOf (CDKOBJS *" "obj"); +.TP 15 +.BI "void traverseCDKOnce (" +.BI "CDKSCREEN *\fIscreen\fP," +.BI "CDKOBJS *\fIcurobj\fP," +.BI "int \fIkeyCode\fP," +.BI "boolean \fIfunctionKey\fP," +.BI "CHECK_KEYCODE \fIfuncMenuKey\fP); +.fi +. +.SH DESCRIPTION +The functions above handle the traversal of a screen populated with various +widgets. +Once the screen has been created and populated with widgets, a +single call to \fBtraverseCDKScreen()\fP will allow the user to move between +widgets and enter data (or otherwise manipulate widgets). +Other functions are provided for use as callbacks by the widgets on +the screen. +Finally, there are several functions which allow the caller to manipulate +the state of the traversal, i.e., the object which has focus. +.LP +In order for widgets to be used on a screen which is to be handled by +\fBtraverseCDKScreen()\fP, it must have the following methods available: +.nf +.ft C + injectCharObj + inputWindowObj + focusObj + unfocusObj + saveDataObj + refreshDataObj +.ft R +.fi +.LP +In addition, the following object properties must be properly handled: +.nf +.ft C + acceptsFocus + hasFocus + inputWindow + dataPtr + dataType +.ft R +.fi +.LP +At the time of this writing, not all widgets have been modified to work with +the screen-traversal facility. +.SH AVAILABLE FUNCTIONS +.B int traverseCDKScreen (CDKSCREEN *\fIscreen\fP); +.RS 3 +This function contains the main screen traversal engine. +It does the following: +.TP 4 + 1. +Calls the refreshData method on each of the widgets to tell them to +update their appearance to match the data which are referenced by their +respective data pointers. +.TP 4 + 2. +Calls the focusObject method on the first widget. +.TP 4 + 3. +Repeats the following until one of the exit functions listed above has been +called: +.RS 4 +.bP +Read a keystroke from the keyboard. +.bP +If the keystroke is ESCAPE and a menu widget is present, activate the +menu and traverse it until the user selects an entry or hits TAB. +.bP +If the keystroke is TAB/BACKTAB then call the unfocusObject method on the +current widget, and move focus to the next/previous widget (not counting +menu widgets). +Call the focusObject method on the newly current widget. +.bP +If the keystroke is the EXIT-SAVE keystroke, then call the saveData method +on each widget and return 1. +.bP +If the keystroke is the EXIT-CANCEL keystroke, return 0 without saving +changes made by the user. +.bP +If the keystroke is the RESET-DATA keystroke, then call the refreshData +method on each of the widgets to reset their appearance to match the data +values that were present upon entry. +.bP +Otherwise, pass the keystroke to the current widget. +.RE +.RE +.TP 5 +.B CDKOBJS *getCDKFocusCurrent (CDKSCREEN *\fIscreen\fP); +Return a pointer to the object which currently has focus in the given screen. +.TP 5 +.B CDKOBJS *setCDKFocusCurrent (CDKSCREEN *\fIscreen\fP, CDKOBJS *\fIobj\fP); +Set the focus to the given object, if the screen contains that object. +If the screen does not contain the object, return null. +Otherwise, return the object. +.TP 5 +.B CDKOBJS *setCDKFocusFirst (CDKSCREEN *\fIscreen\fP); +Set focus on the first object in the given screen. +.TP 5 +.B CDKOBJS *setCDKFocusLast (CDKSCREEN *\fIscreen\fP); +Set focus on the last object in the given screen. +.TP 5 +.B CDKOBJS *setCDKFocusNext (CDKSCREEN *\fIscreen\fP); +Set focus on the next object in the given screen. +.TP 5 +.B CDKOBJS *setCDKFocusPrevious (CDKSCREEN *\fIscreen\fP); +Set focus on the previous object in the given screen. +.TP 5 +.B exitOKCDKScreen +.RS 3 +Causes the traversal engine to exit after calling the saveData +method for each of the widgets. +.RE +.TP 5 +.B exitOKCDKScreenOf +.RS 3 +Calls \fBexitOKCDKScreen()\fP on the screen associated with widget +\fIobj\fP. +This function was designed to be used as a callback routine +for a button widget used as an OK button on a data-entry screen. +.RE +.TP 5 +.B exitCancelCDKScreen +.RS 3 +Causes the traversal engine to exit without saving +user modified data. +.RE +.TP 5 +.B exitCancelCDKScreenOf +.RS 3 +Calls \fBexitCancelCDKScreen()\fP on the screen associated with widget +\fIobj\fP. +This function was designed to be used as a callback routine +for a button widget used as a Cancel button on a data-entry screen. +.RE +.TP 5 +.B resetCDKScreen +.RS 3 +Causes the traversal engine to call the refreshData method for each widget. +This will cause any unsaved changes to be discarded +and the widget states will be restored to their initial values. +.RE +.TP 5 +.B resetCDKScreenOf +.RS 3 +Calls \fBresetCDKScreen()\fP on the screen associated with widget \fIobj\fP. +This function was designed to be used as a callback routine +for a button widget used as a Reset button on a data-entry screen. +.RE +.TP 5 +.B traverseCDKOnce +.RS 3 +This is a utility function, one of the pieces from which you can +construct a customized version of \fBtraverseCDKScreen\fP. +.RE +.SH BUGS +Not all widgets have had the extra methods added so that they work with +the screen traversal engine. +.SH AUTHOR +Grant Edwards, Aspen Research Corporation +.br +Thomas Dickey and contributors. +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/cdk_util.3 b/deps/cdk-5.0-20161210/man/cdk_util.3 new file mode 100644 index 0000000..14e008a --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_util.3 @@ -0,0 +1,374 @@ +'\" t +.\" $Id: cdk_util.3,v 1.10 2016/12/11 01:32:30 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_util 3 +.SH NAME +.XX CDKgetDirectoryContents +.XX CDKreadFile +.XX alignxy +.XX char2Chtype +.XX char2DisplayType +.XX checkForLink +.XX chtype2String +.XX deleteCursesWindow +.XX eraseCursesWindow +.XX getListIndex +.XX getString +.XX justifyString +.XX mode2Filetype +.XX moveCursesWindow +.XX popupDialog +.XX popupLabel +.XX popupLabelAttrib +.XX selectFile +.XX setWidgetDimension +.XX stripWhiteSpace +.XX viewFile +.XX viewInfo +cdk_util \- Cdk utility functions +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int CDKgetDirectoryContents (" +.BI "const char *" "directory", +.BI "char ***" "list"); +.TP 15 +.B "int CDKreadFile (" +.BI "const char *" "filename", +.BI "char ***" "info"); +.TP 15 +.B "void alignxy (" +.BI "WINDOW *" "window", +.BI "int *" "xpos", +.BI "int *" "ypos", +.BI "int " "boxWidth", +.BI "int " "boxHeight"); +.TP 15 +.B "chtype *char2Chtype (" +.BI "const char *" "string", +.BI "int *" "length", +.BI "int *" "align"); +.TP 15 +.B "EDisplayType char2DisplayType (" +.BI "const char *" "string"); +.TP 15 +.B "int checkForLink (" +.BI "const char *" "line", +.BI "char *" "filename"); +.TP 15 +.B "char *chtype2String ( +.BI "const chtype *" "string"); +.TP 15 +.B "void deleteCursesWindow (" +.BI "WINDOW *" "window"); +.TP 15 +.B "void eraseCursesWindow (" +.BI "WINDOW *" "window"); +.TP 15 +.B "int getListIndex (" +.BI "CDKSCREEN *" "screen", +.BI "const char *" "title", +.BI "CDK_CONST char **" "list", +.BI "int " "listSize", +.BI "boolean " "numbers"); +.TP 15 +.B char *getString (" +.BI "CDKSCREEN *" "screen", +.BI "const char *" "title", +.BI "const char *" "label", +.BI "const char *" "init"); +.TP 15 +.B "int justifyString (" +.BI "int " "fieldWidth", +.BI "int " "mesglen", +.BI "int " "justify"); +.TP 15 +.B "int mode2Filetype (" +.BI "mode_t " "fileMode"); +.TP 15 +.B "void moveCursesWindow (" +.BI "WINDOW *" "window", +.BI "int " "xdiff", +.BI "int " "ydiff"); +.TP 15 +.B "int popupDialog (" +.BI "CDKSCREEN *" "screen", +.BI "CDK_CONST char **" "mesg", +.BI "int " "mesgCount", +.BI "CDK_CONST char **" "buttons", +.BI "int " "buttonCount"); +.TP 15 +.B "void popupLabel (" +.BI "CDKSCREEN *" "win", +.BI "CDK_CONST char **" "mesg", +.BI "int " "count"); +.TP 15 +.B "void popupLabelAttrib (" +.BI "CDKSCREEN *" "win", +.BI "CDK_CONST char **" "mesg", +.BI "int " "count", +.BI "chtype " "attribute"); +.TP 15 +.B "char *selectFile (" +.BI "CDKSCREEN *" "screen", +.BI "const char *" "title"); +.TP 15 +.B "int setWidgetDimension (" +.BI "int " "parentDim", +.BI "int " "proposedDim", +.BI "int " "adjustment"); +.TP 15 +.B "void stripWhiteSpace (" +.BI "EStripType " "stripType", +.BI "char *" "string"); +.TP 15 +.B "int viewFile (" +.BI "CDKSCREEN *" "screen", +.BI "const char *" "title", +.BI "const char *" "filename", +.BI "CDK_CONST char **" "buttons", +.BI "int " "buttonCount"); +.TP 15 +.B "int viewInfo (" +.BI "CDKSCREEN *" "screen", +.BI "const char *" "title", +.BI "CDK_CONST char **" "info", +.BI "int " "size", +.BI "CDK_CONST char **" "buttons", +.BI "int " "buttonCount", +.BI "boolean " "interpret"); +.fi +.SH DESCRIPTION +These are utility functions that one may use to initialize, +build or customize widgets. +. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B CDKgetDirectoryContents +opens and reads the contents of the given directory, filling +the array \fBlist\fR with the sorted contents of the directory. +If the directory cannot be opened then it returns a value of -1. +.TP 5 +.B CDKreadFile +Read the file \fIfilename\fP, +load the contents into a dynamically allocated array, +storing its address via \fIinfo\fP. +It returns the number of lines +read if the file could be opened, -1 otherwise. +.TP 5 +.B alignxy +Aligns a box on the given \fIwindow\fP with the height and width given. +See cdk_position (3) for the interpretation of the +\fIxpos\fP, +\fIypos\fP, +\fIboxWidth\fP and +\fIboxHeight\fP, +parameters. +.TP 5 +.B char2Chtype +Translate a character \fIstring\fP with embedded format markers +(e.g., "Blah Blah") +to a null-terminated array of chtype's. +.RS +.bP +The length of the array is stored via the \fIlength\fP parameter. +.bP +The \fBalign\fR parameter contains justification information +(LEFT, CENTER, RIGHT). +.IP +The caller is responsible for freeing the result. +.RE +.TP 5 +.B char2DisplayType +Lookup the given name in \fIstring\fP and return the equivalent display type. +See also cdk_display (3). +.TP 5 +.B checkForLink +Check if the given \fIline\fP is of the form +.RS + +.RE +.IP +If so, extract the filename from the line, storing it in the \fIfilename\fP +buffer (which must hold at least CDK_PATHMAX characters). +Return nonzero if a filename is extracted. +.TP 5 +.B chtype2String +Extract the characters and formatting information +from a null-terminated array of chtype's \fIstring\fP. +A dynamically allocated string is returned. +.TP 5 +.B deleteCursesWindow +Safely delete a given window, +i.e., first check if the \fIwindow\fP parameter is nonnull. +.TP 5 +.B eraseCursesWindow +Safely erase a given window, +i.e., first check if the \fIwindow\fP parameter is nonnull. +.TP 5 +.B getListIndex +Display a scrollable list of strings in a dialog, +allow the user to select one. +Return the index in the list of the value selected. +.RS +.bP +The \fIlist\fP parameter contains the strings to display; +there are \fIlistSize\fP strings in the list. +.bP +If \fInumbers\fP is true, the displayed list items will be numbered. +.RE +.TP 5 +.B getString +pops up an entry widget with +.RS +.bP +a title supplied by the value +of the \fBtitle\fR parameter, +.bP +a label supplied by the \fBlabel\fR parameter, +and +.bP +an initial value supplied by the \fBinitialValue\fR parameter. +.RE +.IP +It returns +a pointer to the value typed in or NULL if the widget was exited early. +.TP 5 +.B justifyString +Given a string length \fImesglen\fP, +the available field width \fIfieldWidth\fP +and a justification type \fIjustify\fP, +return the number of characters by which to shift the string. +.TP 5 +.B mode2Filetype +Given a file protection mode \fIfileMode\fP, +return ignoring the file-type bits, +i.e., ignoring the corresponding permissions data. +.TP 5 +.B moveCursesWindow +Move a given \fIwindow\fP by the amounts in \fIxdiff\fP and \fIydiff\fP. +.TP 5 +.B popupDialog +creates a quick pop-up dialog box. +Pass in +.RS +.bP +the message in the \fBmesg\fR parameter, +.bP +the size of the message in the \fBmesgCount\fR parameter, +.bP +the button labels in the \fBbuttons\fR parameter and +.bP +the number of buttons in the \fBbuttonCount\fR parameter. +.RE +.IP +The dialog box will be centered on the screen. +.TP 5 +.B popupLabel +creates a quick pop-up label widget. +.IP +The message and the size of +the message are passed in via the \fBmesg\fR and \fBcount\fR parameters respectively. +.IP +The label widget waits until the user hits a character and is centered +on the screen. +.TP 5 +.B popupLabelAttrib +Display a simple dialog with +a list of \fIcount\fP message strings \fImesg\fP. +Use the given \fIattribute\fP for the background of the dialog. +.TP 5 +.B selectFile +Display a file-selection dialog. +Return the selected filename, or null if none is selected. +The caller should free the return-value. +.TP 5 +.B setWidgetDimension +This is a helper function used to set the height/width of a widget: +.RS +.bP +If the proposed dimension \fIproposedDim\fP is FULL or zero, +the return value will be \fIparentDim\fP. +.bP +If the proposed dimension \fIproposedDim\fP is positive, +.RS +.bP +and it is larger than \fIparentDim\fP, return \fIproposedDim\fP, +.bP +otherwise return \fIproposedDim\fP plus \fIadjustment\fP. +.RE +.bP +If the proposed dimension \fIproposedDim\fP is negative, +the return value will be \fIparentDim\fP plus \fIproposedDim\fP. +.bP +Otherwise, the return value will be \fIproposedDim\fP. +.RE +.TP 5 +.B stripWhiteSpace +Strip whitespace from the front and/or back of the given \fIstring\fP. +.IP +The \fIstripType\fP parameter controls the type of stripping done: +vFRONT, vBACK or vBOTH. +.TP 5 +.B viewFile +Read the file specified by \fIfilename\fP and display it in a CDKVIEWER window. +The \fItitle\fP, \fIbuttons\fP and \fIbuttonCount\fP are applied to the +CDKVIEWER window. +.RS +.bP +The viewer shows +the contents of the file supplied by the \fBfilename\fR value. +.bP +The buttons on +the file viewer are supplied by the \fBbuttons\fR parameter. +.RE +.IP +It returns the index of the button selected, +or -1 if the file does not exist or if the widget was exited early. +.LP +.TS +center tab(/) allbox; +l l +l l +lw15 lw35 . +\fBStrip_Type/Result\fR += +vFRONT/T{ +This tells the function to remove +all of the white space from the +front of the given string. +T} +vBACK/T{ +This tells the function to remove +all of the white space from the +back of the given string. +T} +vBOTH/T{ +This tells the function to remove +all of the white space from both +the front and the back of the given string. +T} +.TE +.TP 5 +.B viewInfo +Display the list of strings in \fIinfo\fP in a CDKVIEWER window. +The number of strings is given by \fIsize\fP. +The \fItitle\fP, \fIbuttons\fP and \fIbuttonCount\fP are applied to the +CDKVIEWER window. +. +.SH SEE ALSO +cdk_dialog (3), +cdk_display (3), +cdk_position (3), +cdk_misc (3). diff --git a/deps/cdk-5.0-20161210/man/cdk_viewer.3 b/deps/cdk-5.0-20161210/man/cdk_viewer.3 new file mode 100644 index 0000000..7bff8db --- /dev/null +++ b/deps/cdk-5.0-20161210/man/cdk_viewer.3 @@ -0,0 +1,460 @@ +'\" t +.\" $Id: cdk_viewer.3,v 1.28 2016/12/11 01:35:22 tom Exp $ +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_viewer 3 +.SH NAME +.XX activateCDKViewer +.XX cleanCDKViewer +.XX destroyCDKViewer +.XX drawCDKViewer +.XX eraseCDKViewer +.XX getCDKViewerBox +.XX getCDKViewerHighlight +.XX getCDKViewerInfo +.XX getCDKViewerInfoLine +.XX getCDKViewerTitle +.XX moveCDKViewer +.XX newCDKViewer +.XX positionCDKViewer +.XX setCDKViewer +.XX setCDKViewerBackgroundAttrib +.XX setCDKViewerBackgroundColor +.XX setCDKViewerBox +.XX setCDKViewerBoxAttribute +.XX setCDKViewerHighlight +.XX setCDKViewerHorizontalChar +.XX setCDKViewerInfo +.XX setCDKViewerInfoLine +.XX setCDKViewerLLChar +.XX setCDKViewerLRChar +.XX setCDKViewerTitle +.XX setCDKViewerULChar +.XX setCDKViewerURChar +.XX setCDKViewerVerticalChar +cdk_viewer \- curses viewer list widget. +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDKViewer (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "void cleanCDKViewer (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "void destroyCDKViewer (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "void drawCDKViewer (" +.BI "CDKVIEWER *" "viewer", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDKViewer (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "boolean getCDKViewerBox (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "chtype getCDKViewerHighlight (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "chtype **getCDKViewerInfo (" +.BI "CDKVIEWER *" "viewer", +.BI "char **" "itemList"); +.TP 15 +.B "boolean getCDKViewerInfoLine (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "chtype **getCDKViewerTitle (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "void moveCDKViewer (" +.BI "CDKVIEWEE *" "viewer", +.BI "int " "box", +.BI "int " "box", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDKVIEWER *newCDKViewer (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "int " "height", +.BI "int " "width", +.BI "CDK_CONST char **" "buttonList", +.BI "int " "buttonCount", +.BI "chtype " "buttonHighlight", +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDKViewer (" +.BI "CDKVIEWER *" "viewer"); +.TP 15 +.B "void setCDKViewer (" +.BI "CDKVIEWER *" "viewer", +.BI "const char *" "title", +.BI "CDK_CONST char **" "list", +.BI "int " "listSize", +.BI "chtype " "buttonAttribute", +.BI "boolean " "interpret", +.BI "boolean " "showLineInfo", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKViewerBackgroundAttrib (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKViewerBackgroundColor (" +.BI "CDKVIEWER *" "viewer", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKViewerBox (" +.BI "CDKVIEWER *" "viewer", +.BI "boolean " "Box"); +.TP 15 +.B "void setCDKViewerBoxAttribute (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKViewerHighlight (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "highlight"); +.TP 15 +.B "void setCDKViewerHorizontalChar (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKViewerInfo (" +.BI "CDKVIEWER *" "viewer", +.BI "CDK_CONST char **" "list", +.BI "int " "listSize", +.BI "boolean " "interpret"); +.TP 15 +.B "void setCDKViewerInfoLine (" +.BI "CDKVIEWER *" "viewer", +.BI "boolean " "showInfoLine"); +.TP 15 +.B "void setCDKViewerLLChar (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKViewerLRChar (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKViewerTitle (" +.BI "CDKVIEWER *" "viewer", +.BI "const char *" "title"); +.TP 15 +.B "void setCDKViewerULChar (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKViewerURChar (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKViewerVerticalChar (" +.BI "CDKVIEWER *" "viewer", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk viewer widget creates a file viewer widget. +This widget allows a user +to interact with a file. +It does \fINOT\fR allow editing, this is view only. +The following are functions which create or manipulate the Cdk viewer list widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDKViewer +activates the viewer widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBviewer\fR is a pointer to a non-NULL viewer widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR then this function will return a value from +0 to the number of buttons -1, representing the button selected. +It will also +set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the character +entered into this widget was \fIESCAPE\fR then the widget will return +a value of -1 and the widget data \fIexitType\fR will be set to \fIvESCAPE_HIT\fR. +.TP 5 +.B cleanCDKViewer +clears the information from the window. +.TP 5 +.B destroyCDKViewer +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDKViewer +draws the viewer widget on the screen. +If the \fBbox\fR option is true, the widget is drawn with a box. +.TP 5 +.B eraseCDKViewer +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKViewerBox +returns true if the widget will be drawn with a box around it. +.TP 5 +.B getCDKViewerHighlight +returns the attribute of the buttons. +.TP 5 +.B getCDKViewerInfo +returns the contents of the viewer widget. +.TP 5 +.B getCDKViewerInfoLine +returns true if the information line is on. +.TP 5 +.B getCDKViewerTitle +returns the title of the widget. +.TP 5 +.B moveCDKViewer +function moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B *newCDKViewer +function creates a viewer widget and returns a pointer to it. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBheight\fR and +.TP 5 +\fBwidth\fR +are the height and width of the viewer window. +.TP 5 +\fBbuttons\fR +is an array of the button labels which are +to be attached to the viewer on the bottom. +.TP 5 +\fBbuttonCount\fR +is the number of buttons in \fBbuttons\fP. +.TP 5 +\fBbuttonHighlight\fR +is the highlight attribute of the currently selected button. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDKViewer +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDKViewer +lets the programmer modify several elements of an existing +viewer widget. +.RS +.bP +\fBtitle\fR is the title to be displayed on +the top of the viewer. +.bP +\fBlist\fR is the information to display, +.bP +\fBlistSize\fR states how many rows there are in the \fBlist\fR array. +If \fBlistSize\fR is negative, \fBlist\fR is scanned to find its +length, including files which will be included via embedded links. +.bP +\fBbuttonAttribute\fR states the attribute of the current +highlighted button. +.bP +The boolean parameter \fBinterpret\fR tells the viewer to +interpret the contents of \fBlist\fR for Cdk display command. +.bP +The \fBshowLineInfo\fR boolean flag tells the viewer to show to show the +line number and percentage in the top left corner of the viewer window. +.bP +The parameters \fBbox\fR and \fBshadow\fR are the same as in the function +description of \fBnewCDKViewer\fR. +.RE +.TP 5 +.B setCDKViewerBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKViewerBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKViewerBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKViewerBoxAttribute +sets the attribute of the box. +.TP 5 +.B setCDKViewerHighlight +sets the highlight attribute of the buttons on the widget. +.TP 5 +.B setCDKViewerHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKViewerInfo +sets the contents of the viewer widget. +.IP +See \fBsetCDKViewer\fP for parameter descriptions. +.TP 5 +.B setCDKViewerInfoLine +turns on/off the information line in the top left hand corner of +the widget. +If the value of \fBshowInfoLine\fR is \fITRUE\fR, the information +line will be displayed. +If it is \fIFALSE\fR it won't. +.TP 5 +.B setCDKViewerLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKViewerLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKViewerTitle +sets the title of the widget. +.TP 5 +.B setCDKViewerULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKViewerURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKViewerVerticalChar +sets the vertical drawing character for the box to the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center box; +l l +l l +lw15 lw35 . +\fBKey Action\fR += +Left Arrow Shifts the viewport one column left. +Right Arrow Shifts the viewport one column left +Up Arrow Scrolls the viewport one line up. +Down Arrow Scrolls the viewport one line down. +_ +Prev Page +Ctrl-B +B +b Scroll one page backward. +_ +Next Page +Ctrl-F +Space +F +f Scroll one page forward. +_ +Home +| Shift the whole list to the far left. +_ +End +$ Shift the whole list to the far right. +_ +1 +< +g Moves to the first line in the viewer. +_ +> +G Moves to the last line in the viewer. +_ +L T{ +Moves half the distance to the end of the viewer. +T} +l T{ +Moves half the distance to the top of the viewer. +T} +_ +? Searches up for a pattern. +/ Searches down for a pattern. +n Repeats last search. +N Repeats last search, reversed direction. +: Jumps to a given line. +_ +i Displays file statistics. +s Displays file statistics. +_ +Tab Switches buttons. +Return T{ +Exit the widget and return the index of the selected button. +Set the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape T{ +Exit the widget and return -1. +Set the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-L Refreshes the screen. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/gen-scale.3 b/deps/cdk-5.0-20161210/man/gen-scale.3 new file mode 100644 index 0000000..b39cc8f --- /dev/null +++ b/deps/cdk-5.0-20161210/man/gen-scale.3 @@ -0,0 +1,524 @@ +'\" t +.\" $Id: gen-scale.3,v 1.9 2016/12/11 01:37:52 tom Exp $" +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_scale 3 +.SH NAME +.XX activateCDK +.XX destroyCDK +.XX drawCDK +.XX eraseCDK +.XX getCDKBox +#if +.XX getCDKDigits +#endif +.XX getCDKHighValue +.XX getCDKLowValue +.XX getCDKValue +.XX injectCDK +.XX moveCDK +.XX newCDK +.XX positionCDK +.XX setCDK +.XX setCDKBackgroundAttrib +.XX setCDKBackgroundColor +.XX setCDKBox +.XX setCDKBoxAttribute +#if +.XX setCDKDigits +#endif +.XX setCDKHorizontalChar +.XX setCDKLLChar +.XX setCDKLRChar +.XX setCDKLowHigh +.XX setCDKPostProcess +.XX setCDKPreProcess +.XX setCDKULChar +.XX setCDKURChar +.XX setCDKValue +.XX setCDKVerticalChar +cdk_scale \- curses scale widget (type ). +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B " activateCDK (" +.BI "CDK *" "scale", +.BI "chtype *" "actions"); +.TP 15 +.B "void destroyCDK (" +.BI "CDK *" "scale"); +.TP 15 +.B "void drawCDK (" +.BI "CDK *" "scale", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDK (" +.BI "CDK *" "scale"); +.TP 15 +.B "boolean getCDKBox (" +.BI "CDK *" "scale"); +#if +.TP 15 +.B "int getCDKDigits (" +.BI "CDK *" "scale"); +#endif +.TP 15 +.B " getCDKHighValue (" +.BI "CDK *" "scale"); +.TP 15 +.B " getCDKLowValue (" +.BI "CDK *" "scale"); +.TP 15 +.B " getCDKValue (" +.BI "CDK *" "scale"); +.TP 15 +.B "int injectCDK (" +.BI "CDK *" "scale", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDK (" +.BI "CDK *" "scale", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDK *newCDK (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "const char *" "title", +.BI "const char *" "label", +.BI "chtype " "fieldAttribute", +.BI "int " "fieldWidth", +.BI " " "currentValue", +.BI " " "lowValue", +.BI " " "highValue", +.BI " " "increment", +.BI " " "fastIncrement", +#if +.BI "int " "digits", +#endif +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDK (" +.BI "CDK *" "scale"); +.TP 15 +.B "void setCDK (" +.BI "CDK *" "scale", +.BI " " "lowValue", +.BI " " "highValue", +.BI " " "currentValue", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKBackgroundAttrib (" +.BI "CDK *" "scale", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKBackgroundColor (" +.BI "CDK *" "scale", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKBox (" +.BI "CDK *" "scale", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKBoxAttribute (" +.BI "CDK *" "scale", +.BI "chtype " "character"); +#if +.TP 15 +.B "void setCDKDigits (" +.BI "CDK *" "scale", +.BI "int " "digits"); +#endif +.TP 15 +.B "void setCDKHorizontalChar (" +.BI "CDK *" "scale", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLLChar (" +.BI "CDK *" "scale", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLRChar (" +.BI "CDK *" "scale", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLowHigh (" +.BI "CDK *" "scale", +.BI " " "low", +.BI " " "high"); +.TP 15 +.B "void setCDKPostProcess (" +.BI "CDK *" "scale", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKPreProcess (" +.BI "CDK *" "scale", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKULChar (" +.BI "CDK *" "scale", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKURChar (" +.BI "CDK *" "scale", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKValue (" +.BI "CDK *" "scale", +.BI " " "value"); +.TP 15 +.B "void setCDKVerticalChar (" +.BI "CDK *" "scale", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk scale widget creates a scale box with a label and a scale field. +The following functions create or manipulate the Cdk scale box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDK +activates the scale widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBscale\fR is a pointer to a non-NULL scale widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return a +value from the low value to the high value. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the character entered into this +widget was \fIESCAPE\fR then the widget will return +the unknown value (see the cdk_objs.h header file). +.RE +.IP +The widget data \fIexitType\fR will be set to \fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDK +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDK +draws the scale widget on the screen. +.IP +If the \fBbox\fR parameter is true, the widget is drawn with a box. +.TP 5 +.B eraseCDK +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKBox +returns whether the widget will be drawn with a box around it. +#if +.TP 5 +.B getCDKDigits +returns the number of digits shown after the decimal point for the box value. +#endif +.TP 5 +.B getCDKHighValue +returns the high value of the scale widget. +.TP 5 +.B getCDKLowValue +returns the low value of the scale widget. +.TP 5 +.B getCDKValue +returns the current value of the widget. +.TP 5 +.B injectCDK +injects a single character into the widget. +.RS +.bP +The parameter \fBscale\fR is a pointer to a non-NULL scale widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.RE +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a value ranging from the scale's low value to the scale's high value. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +the unknown value (see the cdk_objs.h header file). +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +the unknown value (see the cdk_objs.h header file). +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.RE +.TP 5 +.B moveCDK +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDK +creates a pointer to a scale widget. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBtitle\fR +is the string to display at the top of the widget. +The title can be more than one line; just provide a carriage return +character at the line break. +.TP 5 +\fBlabel\fR +is the string to display in the label of the scale field. +.TP 5 +\fBfieldAttribute\fR +is the attribute of the characters displayed in the field. +.TP 5 +\fBfieldWidth\fR +controls the width of the widget. +If you +provide a value of zero the widget will be created with the full width of +the screen. +If you provide a negative value, the widget will be created +the full width minus the value provided. +.TP 5 +\fBcurrentValue\fR +is the value of the scale field when the widget is activated. +.TP 5 +\fBlowValue\fR and +.TP 5 +\fBhighValue\fR +are the low and high values of the widget respectively. +.TP 5 +\fBincrement\fR +is the regular increment value +.TP 5 +\fBfastIncrement\fR +is the accelerated increment value. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR +pointer is returned. +.TP 5 +.B positionCDK +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDK +lets the programmer modify certain elements of an existing scale widget. +.IP +The parameter names correspond to the same parameter +names listed in the \fInewCDK\fR function. +.TP 5 +.B setCDKBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR +is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKBoxAttribute +sets the attribute of the box. +#if +.TP 5 +.B setCDKDigits +sets the number of digits shown after the decimal point for the box value. +#endif +.TP 5 +.B setCDKHorizontalChar +sets the horizontal drawing character for the box to +the given character. +.TP 5 +.B setCDKLLChar +sets the lower left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKLRChar +sets the lower right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKLowHigh +sets the low and high values of the widget. +.TP 5 +.B setCDKPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKULChar +sets the upper left hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKURChar +sets the upper right hand corner of the widget's box to +the given character. +.TP 5 +.B setCDKValue +sets the current value of the widget. +.TP 5 +.B setCDKVerticalChar +sets the vertical drawing character for the box to +the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) box; +l l +l l +lw15 lw50 . +\fBKey/Action\fR += +Down Arrow/T{ +Decrements the scale by the normal value. +T} +Up Arrow/Increments the scale by the normal value. +u/Increments the scale by the normal value. +Prev Page/Decrements the scale by the accelerated value. +U/Decrements the scale by the accelerated value. +Ctrl-B/Decrements the scale by the accelerated value. +Next Page/Increments the scale by the accelerated value. +Ctrl-F/Increments the scale by the accelerated value. +Home/Sets the scale to the low value. +g/Sets the scale to the low value. +^/Sets the scale to the low value. +End/Sets the scale to the high value. +G/Sets the scale to the high value. +$/Sets the scale to the high value. +Return/T{ +Exits the widget and returns the index of the selected value. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exits the widget and returns the index of the selected value. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns +the unknown value (see the cdk_objs.h header file). +This also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-R/Refreshes the screen. +.TE +.LP +If the cursor is not pointing to the field's value, the following +key bindings apply. You may use the left/right arrows to move the +cursor onto the field's value and modify it by typing characters to +replace the digits and sign. +.TS +center tab(/) box; +l l +l l +lw15 lw50 . +\fBKey/Action\fR += +Left Arrow/T{ +Decrements the scale by the normal value. +T} +Right Arrow/Increments the scale by the normal value. += +d/Decrements the scale by the normal value. +D/Increments the scale by the accelerated value. +-/Decrements the scale by the normal value. ++/Increments the scale by the normal value. +0/Sets the scale to the low value. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/gen-slider.3 b/deps/cdk-5.0-20161210/man/gen-slider.3 new file mode 100644 index 0000000..2a6492d --- /dev/null +++ b/deps/cdk-5.0-20161210/man/gen-slider.3 @@ -0,0 +1,531 @@ +'\" t +.\" $Id: gen-slider.3,v 1.7 2016/12/11 00:57:12 tom Exp $" +.de bP +.IP \(bu 4 +.. +.de XX +.. +.TH cdk_slider 3 +.SH NAME +.XX activateCDK +.XX destroyCDK +.XX drawCDK +.XX eraseCDK +.XX getCDKBox +#if +.XX getCDKDigits +#endif +.XX getCDKHighValue +.XX getCDKLowValue +.XX getCDKValue +.XX injectCDK +.XX moveCDK +.XX newCDK +.XX positionCDK +.XX setCDK +.XX setCDKBackgroundAttrib +.XX setCDKBackgroundColor +.XX setCDKBox +.XX setCDKBoxAttribute +#if +.XX setCDKDigits +#endif +.XX setCDKHorizontalChar +.XX setCDKLLChar +.XX setCDKLRChar +.XX setCDKLowHigh +.XX setCDKPostProcess +.XX setCDKPreProcess +.XX setCDKULChar +.XX setCDKURChar +.XX setCDKValue +.XX setCDKVerticalChar +cdk_slider \- curses slider widget (type ) +.SH SYNOPSIS +.LP +.B cc +.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." +.B \-lcdk +.RI "[ " "library" " \|.\|.\|. ]" +.LP +#include +.nf +.TP 15 +.B "int activateCDK (" +.BI "CDK *" "slider", +.BI "chtype *" "actions"); +.TP 15 +.B "void destroyCDK (" +.BI "CDK *" "slider"); +.TP 15 +.B "void drawCDK (" +.BI "CDK *" "slider", +.BI "boolean " "box"); +.TP 15 +.B "void eraseCDK (" +.BI "CDK *" "slider"); +.TP 15 +.B "boolean getCDKBox (" +.BI "CDK *" "slider"); +#if +.TP 15 +.B "int getCDKDigits (" +.BI "CDK *" "scale"); +#endif +.TP 15 +.B " getCDKHighValue (" +.BI "CDK *" "slider"); +.TP 15 +.B " getCDKLowValue (" +.BI "CDK *" "slider"); +.TP 15 +.B " getCDKValue (" +.BI "CDK *" "slider"); +.TP 15 +.B " injectCDK (" +.BI "CDK *" "slider", +.BI "chtype " "input"); +.TP 15 +.B "void moveCDK (" +.BI "CDK *" "slider", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "boolean " "relative", +.BI "boolean " "refresh"); +.TP 15 +.B "CDK *newCDK (" +.BI "CDKSCREEN *" "cdkscreen", +.BI "int " "xpos", +.BI "int " "ypos", +.BI "const char *" "title", +.BI "const char *" "label", +.BI "chtype " "fillerCharacter", +.BI "int " "fieldWidth", +.BI "int " "currentValue", +.BI " " "lowValue", +.BI " " "highValue", +.BI " " "increment", +.BI " " "fastIncrement", +#if +.BI "int " "digits", +#endif +.BI "boolean " "box", +.BI "boolean " "shadow"); +.TP 15 +.B "void positionCDK (" +.BI "CDK *" "slider"); +.TP 15 +.B "void setCDK (" +.BI "CDK *" "slider", +.BI " " "lowValue", +.BI " " "highValue", +.BI " " "currentValue", +.BI "boolean " "box"); +.TP 15 +.B "void setCDKBackgroundAttrib (" +.BI "CDK *" "slider", +.BI "chtype " "attribute"); +.TP 15 +.B "void setCDKBackgroundColor (" +.BI "CDK *" "slider", +.BI "const char * " "color"); +.TP 15 +.B "void setCDKBox (" +.BI "CDK *" "slider", +.BI "boolean " "boxWidget"); +.TP 15 +.B "void setCDKBoxAttribute (" +.BI "CDK *" "slider", +.BI "chtype " "character"); +#if +.TP 15 +.B "void setCDKDigits (" +.BI "CDK *" "scale", +.BI "int " "digits"); +#endif +.TP 15 +.B "void setCDKHorizontalChar (" +.BI "CDK *" "slider", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLLChar (" +.BI "CDK *" "slider", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLRChar (" +.BI "CDK *" "slider", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKLowHigh (" +.BI "CDK *" "slider", +.BI " " "lowValue", +.BI " " "highValue"); +.TP 15 +.B "void setCDKPostProcess (" +.BI "CDK *" "slider", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKPreProcess (" +.BI "CDK *" "slider", +.BI "PROCESSFN " "callback", +.BI "void * " "data"); +.TP 15 +.B "void setCDKULChar (" +.BI "CDK *" "slider", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKURChar (" +.BI "CDK *" "slider", +.BI "chtype " "character"); +.TP 15 +.B "void setCDKValue (" +.BI "CDK *" "slider", +.BI " " "value"); +.TP 15 +.B "void setCDKVerticalChar (" +.BI "CDK *" "slider", +.BI "chtype " "character"); +.fi +.SH DESCRIPTION +The Cdk slider widget creates a visual slider box with a label and a slider field. +The following are functions which create or manipulate the Cdk slider +box widget. +.SH AVAILABLE FUNCTIONS +.TP 5 +.B activateCDK +activates the slider widget and lets the user interact with the widget. +.RS +.bP +The parameter \fBslider\fR is a pointer to a non-NULL slider widget. +.bP +If the \fBactions\fR parameter is passed with a non-NULL value, the characters +in the array will be injected into the widget. +.IP +To activate the widget +interactively pass in a \fINULL\fR pointer for \fBactions\fR. +.RE +.IP +If the character entered +into this widget is \fIRETURN\fR or \fITAB\fR then this function will return a +value from the low value to the high value. +It will also set the widget data \fIexitType\fR to \fIvNORMAL\fR. +.IP +If the character entered into this +widget was \fIESCAPE\fR then the widget returns +the unknown value (see the cdk_objs.h header file). +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.TP 5 +.B destroyCDK +removes the widget from the screen and frees memory the object used. +.TP 5 +.B drawCDK +draws the slider widget on the screen. +If the \fBbox\fR option is true, the widget is drawn with a box. +.TP 5 +.B eraseCDK +removes the widget from the screen. +This does \fINOT\fR destroy the widget. +.TP 5 +.B getCDKBox +returns true if the widget will be drawn with a box around it. +#if +.TP 5 +.B getCDKDigits +returns the number of digits shown after the decimal point for the box value. +#endif +.TP 5 +.B getCDKHighValue +returns the high value of the slider widget. +.TP 5 +.B getCDKLowValue +returns the low value of the slider widget. +.TP 5 +.B getCDKValue +returns the current value of the widget. +.TP 5 +.B injectCDK +injects a single character into the widget. +.RS +.bP +The parameter \fBslider\fR is a pointer to a non-NULL slider widget. +.bP +The parameter \fBcharacter\fR is the character to inject into the widget. +.IP +The return value and side-effect (setting the widget data \fIexitType\fP) +depend upon the injected character: +.RS +.TP +\fIRETURN\fP or \fITAB\fR +the function returns +a value ranging from the slider's low value to the slider's high value. +The widget data \fIexitType\fR is set to \fIvNORMAL\fR. +.TP +\fIESCAPE\fP +the function returns +the unknown value (see the cdk_objs.h header file). +The widget data \fIexitType\fR is set to \fIvESCAPE_HIT\fR. +.RE +.RE +.IP +Otherwise +unless modified by preprocessing, postprocessing or key bindings, +the function returns +the unknown value (see the cdk_objs.h header file). +The widget data \fIexitType\fR is set to \fIvEARLY_EXIT\fR. +.TP 5 +.B moveCDK +moves the given widget to the given position. +.RS +.bP +The parameters \fBxpos\fR and \fBypos\fR are the new position of the widget. +.IP +The parameter \fBxpos\fR may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.IP +The parameter \fBypos\fR may be an integer or one of the pre-defined values \fILEFT\fR, +\fIRIGHT\fR, and \fICENTER\fR. +.bP +The parameter \fBrelative\fR states whether +the \fBxpos\fR/\fBypos\fR pair is a relative move or an absolute move. +.IP +For example, if \fBxpos\fR = 1 and \fBypos\fR = 2 and \fBrelative\fR = \fBTRUE\fR, +then the widget would move one row down and two columns right. +If the value of \fBrelative\fR was \fBFALSE\fR then the widget would move to the position (1,2). +.IP +Do not use the values \fITOP\fR, \fIBOTTOM\fR, \fILEFT\fR, +\fIRIGHT\fR, or \fICENTER\fR when \fBrelative\fR = \fITRUE\fR. +(weird things may happen). +.bP +The final parameter \fBrefresh\fR is a boolean value which +states whether the widget will get refreshed after the move. +.RE +.TP 5 +.B newCDK +function creates a slider widget and returns a pointer to it.. +Parameters: +.RS +.TP 5 +\fBscreen\fR +is the screen you wish this widget to be placed in. +.TP 5 +\fBxpos\fR +controls the placement of the object along the horizontal axis. +It may be an integer or one of the pre-defined values +\fILEFT\fR, \fIRIGHT\fR, and \fICENTER\fR. +.TP 5 +\fBypos\fR +controls the placement of the object along the vertical axis. +It may be an integer or one of the pre-defined values +\fITOP\fR, \fIBOTTOM\fR, and \fICENTER\fR. +.TP 5 +\fBtitle\fR +is the string to display at the top of the widget. +The title can be more than one line; just provide a carriage return +character at the line break. +.TP 5 +\fBlabel\fR +is the string to display in the label of the slider field. +.TP 5 +\fBfillerCharacter\fR +is the character to be used to draw the slider bar in the field. +.TP 5 +\fBfieldWidth\fR +controls the width of the widget. +If you provide a value +of zero the widget will be created with the full width of the screen. +If you provide a negative value, the widget will be created the full width +minus the value provided. +.TP 5 +\fBcurrentValue\fR +is the value of the slider field when the widget is activated. +.TP 5 +\fBlowValue\fR and +.TP 5 +\fBhighValue\fR +are the low and high values of the widget respectively. +.TP 5 +\fBincrement\fR +is the regular increment value +.TP 5 +\fBfastIncrement\fR +is the accelerated increment value. +.TP 5 +\fBbox\fR +is true if the widget should be drawn with a box around it. +.TP 5 +\fBshadow\fR +turns the shadow on or off around this widget. +.RE +.IP +If the widget could not be created then a \fINULL\fR pointer is returned. +.TP 5 +.B positionCDK +allows the user to move the widget around the screen via the cursor/keypad keys. +See \fBcdk_position (3)\fR for key bindings. +.TP 5 +.B setCDK +lets the programmer modify certain elements of an existing slider widget. +The parameter names correspond to the same parameter +names listed in the \fInewCDK\fR function. +.TP 5 +.B setCDKBackgroundAttrib +sets the background attribute of the widget. +.IP +The parameter \fBattribute\fR is a curses attribute, e.g., A_BOLD. +.TP 5 +.B setCDKBackgroundColor +sets the background color of the widget. +.IP +The parameter \fBcolor\fR is in the format of the Cdk format strings. +.IP +See \fBcdk_display (3)\fR. +.TP 5 +.B setCDKBox +sets whether the widget will be drawn with a box around it. +.TP 5 +.B setCDKBoxAttribute +function sets the attribute of the box. +#if +.TP 5 +.B setCDKDigits +sets the number of digits shown after the decimal point for the box value. +#endif +.TP 5 +.B setCDKHorizontalChar +sets the horizontal drawing character for the box to the given character. +.TP 5 +.B setCDKLLChar +sets the lower left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKLRChar +sets the lower right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKLowHigh +sets the low and high values of the widget. +.TP 5 +.B setCDKPostProcess +allows the user to have the widget call a function after the +key has been applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about post-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKPreProcess +allows the user to have the widget call a function after a key +is hit and before the key is applied to the widget. +.RS +.bP +The parameter \fBfunction\fR is the callback function. +.bP +The parameter \fBdata\fR points to data passed to the callback function. +.RE +.IP +To learn more about pre-processing see \fIcdk_process (3)\fR. +.TP 5 +.B setCDKULChar +sets the upper left hand corner of the widget's box to the given character. +.TP 5 +.B setCDKURChar +sets the upper right hand corner of the widget's box to the given character. +.TP 5 +.B setCDKValue +sets the current value of the widget. +.TP 5 +.B setCDKVerticalChar +sets the vertical drawing character for the box to the given character. +.SH KEY BINDINGS +When the widget is activated there are several default key bindings which will +help the user enter or manipulate the information quickly. +The following table +outlines the keys and their actions for this widget. +.LP +.TS +center tab(/) box; +l l +l l +lw15 lw50 . +\fBKey/Action\fR += +Down Arrow/T{ +Decrements the field by the normal decrement value. +T} +Up Arrow/T{ +Increments the field by the normal increment value. +T} +u/T{ +Increments the field by the normal increment value. +T} +Prev Page/T{ +Decrements the field by the accelerated decrement value. +T} +U/T{ +Decrements the field by the accelerated decrement value. +T} +Ctrl-B/T{ +Decrements the field by the accelerated decrement value. +T} +Next Page/T{ +Increments the field by the accelerated increment value. +T} +D/T{ +Increments the field by the accelerated increment value. +T} +Ctrl-F/T{ +Increments the field by the accelerated increment value. +T} +Home/Sets the value to the low value. +g/Sets the value to the low value. +End/Sets the value to the high value. +G/Sets the value to the high value. +$/Sets the value to the high value. +Return/T{ +Exits the widget and returns the +current value. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Tab/T{ +Exits the widget and returns the current value. +This also sets the widget data \fIexitType\fR to \fIvNORMAL\fR. +T} +Escape/T{ +Exits the widget and returns +the unknown value (see the cdk_objs.h header file). +This also sets the widget data \fIexitType\fR to \fIvESCAPE_HIT\fR. +T} +Ctrl-R/Refreshes the screen. +.TE +.LP +If the cursor is not pointing to the field's value, the following +key bindings apply. You may use the left/right arrows to move the +cursor onto the field's value and modify it by typing characters to +replace the digits and sign. +.TS +center tab(/) box; +l l +l l +lw15 lw50 . +\fBKey/Action\fR += +Left Arrow/T{ +Decrements the scale by the normal value. +T} +Right Arrow/Increments the scale by the normal value. += +d/Decrements the scale by the normal value. +D/Increments the scale by the accelerated value. +-/Decrements the scale by the normal value. ++/Increments the scale by the normal value. +0/Sets the scale to the low value. +.TE +.SH SEE ALSO +.BR cdk (3), +.BR cdk_binding (3), +.BR cdk_display (3), +.BR cdk_position (3), +.BR cdk_screen (3) diff --git a/deps/cdk-5.0-20161210/man/man2html.ignore b/deps/cdk-5.0-20161210/man/man2html.ignore new file mode 100644 index 0000000..b252986 --- /dev/null +++ b/deps/cdk-5.0-20161210/man/man2html.ignore @@ -0,0 +1,2 @@ +HL(10) +HL(26) diff --git a/deps/cdk-5.0-20161210/manlinks.sed b/deps/cdk-5.0-20161210/manlinks.sed new file mode 100644 index 0000000..9df85a1 --- /dev/null +++ b/deps/cdk-5.0-20161210/manlinks.sed @@ -0,0 +1,75 @@ +# $Id: manlinks.sed,v 1.6 2005/12/31 01:34:26 tom Exp $ +############################################################################## +# Copyright 2000-2002,2005 Thomas E. Dickey # +# # +# 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. # +############################################################################## +# Given a manpage (nroff) as input, writes a list of the names that are +# listed in the "NAME" section, i.e., the names that we would like to use +# as aliases for the manpage -T.Dickey +/^'\\"/d +/\.\\"/d +/^\.br/d +/^\.sp/d +/^\.It/d +s/^\.XX[ ]\+\([^ ]\+\).*$/\1,/ +s/\\f.//g +s/[:,]/ /g +s/^[ ][ ]*// +s/[ ][ ]*$// +s/[ ][ ]*/ /g +s/\.SH[ ][ ]*/.SH_(/ +# +/^\.SH_(NAME/,/^\.SH_(SYNOPSIS/{ +s/\\-.*/ -/ +/ -/{ + s/ -.*// + s/ /\ +/g +} +/^-/{ + d +} +s/ /\ +/g +s/^\.XX// +} +/^\.SH_(SYNOPSIS/,/^\.SH_(DESCRIPTION/{ + /^\.TS/,/^\.TE/{ + d + } + /^#/d + /^[^(]*$/d + s/^\([^ (]* [^ (]* [*]*\)//g + s/^\([^ (]* [*]*\)//g + s/\.SH_(/.SH_/ + s/(.*// + s/\.SH_/.SH_(/ +} +/^\.SH_(DESCRIPTION/,${ + d +} +/^\./d +/^$/d diff --git a/deps/cdk-5.0-20161210/manlinks.sh b/deps/cdk-5.0-20161210/manlinks.sh new file mode 100755 index 0000000..58011b4 --- /dev/null +++ b/deps/cdk-5.0-20161210/manlinks.sh @@ -0,0 +1,115 @@ +#! /bin/sh +# $Id: manlinks.sh,v 1.5 2005/12/29 00:22:00 tom Exp $ +# install/uninstall aliases for one or more manpages, +# +# Copyright 2002,2005 Thomas Dickey +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgment: +# This product includes software developed by Thomas Dickey +# and contributors. +# 4. Neither the name of Thomas Dickey, nor the names of contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THOMAS DICKEY AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THOMAS DICKEY OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +CDPATH= + +verb=$1 +shift + +srcdir=$1 +shift + +mandir=$1 +shift + +mansect=$1 +shift + +parent=`pwd` +script=$srcdir/manlinks.sed + +for source in $* ; do +case $source in #(vi +*.orig|*.rej) ;; #(vi +*.[0-9]*) + cd $parent + section=`expr "$source" : '.*\.\([0-9]\)[xm]*'`; + aliases= + inalias=$source + test ! -f $inalias && inalias="$srcdir/$inalias" + if test ! -f $inalias ; then + echo " .. skipped $source" + continue + fi + aliases=`sed -f $script $inalias | sort -u` + + suffix=`basename $source | sed -e 's/^[^.]*//'` + cd $mandir || exit 1 + if test $verb = installing ; then + test -n "$aliases" && ( + if test "$suffix" = ".$mansect" ; then + target=`basename $source` + else + target=`basename $source $suffix`.$mansect + suffix=".$mansect" + fi + for cf_alias in $aliases + do + cf_doit=no + if test -f $cf_alias${suffix} ; then + if ( cmp -s $target $cf_alias${suffix} ) + then + : + else + cf_doit=yes + fi + else + cf_doit=yes + fi + if test $cf_doit = yes ; then + echo " ... alias $cf_alias${suffix}" + rm -f $cf_alias${suffix} + if (ln -s $target $cf_alias${suffix}) ; then + : + else + echo ".so $target" > $cf_alias${suffix} + fi + fi + done + ) + elif test $verb = removing ; then + suffix=".$mansect" + test -n "$aliases" && ( + for cf_alias in $aliases + do + echo " ... alias $cf_alias${suffix}" + rm -f $cf_alias${suffix} + done + ) + fi + ;; +esac +done +exit 0 diff --git a/deps/cdk-5.0-20161210/marquee.c b/deps/cdk-5.0-20161210/marquee.c new file mode 100644 index 0000000..ff332b9 --- /dev/null +++ b/deps/cdk-5.0-20161210/marquee.c @@ -0,0 +1,399 @@ +#define NCURSES_NOMACROS +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 19:14:46 $ + * $Revision: 1.82 $ + */ + +DeclareCDKObjects (MARQUEE, Marquee, setCdk, Unknown); + +static void discardWin (WINDOW **winp) +{ + if (*winp != 0) + { + werase (*winp); + wrefresh (*winp); + delwin (*winp); + *winp = 0; + } +} + +static void layoutWidget (CDKMARQUEE *widget, + int xpos, + int ypos) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *cdkscreen = ScreenOf (widget); + int parentWidth = getmaxx (cdkscreen->window); + WINDOW *window; + int boxHeight; + int boxWidth; + + discardWin (&(widget->win)); + discardWin (&(widget->shadowWin)); + + boxWidth = setWidgetDimension (parentWidth, widget->width, 0); + boxHeight = (BorderOf (widget) * 2) + 1; + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + window = newwin (boxHeight, boxWidth, ypos, xpos); + + if (window != 0) + { + /* *INDENT-EQLS* */ + widget->win = window; + widget->boxHeight = boxHeight; + widget->boxWidth = boxWidth; + + keypad (widget->win, TRUE); + + /* Do we want a shadow? */ + if (widget->shadow) + { + widget->shadowWin = subwin (cdkscreen->window, + boxHeight, boxWidth, + ypos + 1, xpos + 1); + } + } +} + +/* + * This creates a marquee widget. + */ +CDKMARQUEE *newCDKMarquee (CDKSCREEN *cdkscreen, + int xpos, + int ypos, + int width, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKMARQUEE *widget = 0; + + if ((widget = newCDKObject (CDKMARQUEE, &my_funcs)) == 0) + return (0); + + /* *INDENT-EQLS* Create the widget pointer. */ + ScreenOf (widget) = cdkscreen; + widget->parent = cdkscreen->window; + widget->win = newwin (1, 1, ypos, xpos); + widget->active = TRUE; + widget->width = width; + widget->shadow = shadow; + + setCDKMarqueeBox (widget, Box); + + /* Is the window null??? */ + if (widget->win == 0) + { + destroyCDKObject (widget); + return (0); + } + + registerCDKObject (cdkscreen, vMARQUEE, widget); + + return (widget); +} + +/* + * This activates the widget. + */ +int activateCDKMarquee (CDKMARQUEE *widget, + const char *mesg, + int delay, + int repeat, + boolean Box) +{ + /* *INDENT-EQLS* */ + int mesgLength = 0; + int startPos = 0; + int firstChar = 0; + int lastChar = 1; + int repeatCount = 0; + int viewSize = 0; + int viewLimit; + int padding; + chtype *message; + int x, junk, oldcurs; + bool firstTime = TRUE; + + /* Make sure the message has some content. */ + if (mesg == 0 || *mesg == '\0') + { + return (-1); + } + + /* Keep the box info, setting BorderOf () */ + setCDKMarqueeBox (widget, Box); + + padding = (mesg[strlen (mesg) - 1] == ' ') ? 0 : 1; + + /* Translate the char * to a chtype * */ + message = char2Chtype (mesg, &mesgLength, &junk); + + /* Draw in the widget. */ + drawCDKMarquee (widget, ObjOf (widget)->box); + viewLimit = widget->width - (2 * BorderOf (widget)); + + /* Start doing the marquee thing... */ + oldcurs = curs_set (0); + while (widget->active) + { + int y; + + if (firstTime) + { + firstChar = 0; + lastChar = 1; + viewSize = lastChar - firstChar; + startPos = widget->width - viewSize - BorderOf (widget); + + firstTime = FALSE; + } + + /* Draw in the characters. */ + y = firstChar; + for (x = startPos; x < (startPos + viewSize); x++) + { + chtype ch = (y < mesgLength) ? message[y] : ' '; + mvwaddch (widget->win, BorderOf (widget), x, ch); + y++; + } + wrefresh (widget->win); + + /* Set my variables. */ + if (mesgLength < viewLimit) + { + if (lastChar < (mesgLength + padding)) + { + lastChar++; + viewSize++; + startPos = widget->width - viewSize - BorderOf (widget); + } + else if (startPos > BorderOf (widget)) + { + /* This means the whole string is visible. */ + startPos--; + viewSize = mesgLength + padding; + } + else + { + /* We have to start chopping the viewSize */ + startPos = BorderOf (widget); + firstChar++; + viewSize--; + } + } + else + { + if (startPos > BorderOf (widget)) + { + lastChar++; + viewSize++; + startPos--; + } + else if (lastChar < (mesgLength + padding)) + { + firstChar++; + lastChar++; + startPos = BorderOf (widget); + viewSize = viewLimit; + } + else + { + startPos = BorderOf (widget); + firstChar++; + viewSize--; + } + } + + /* OK, lets check if we have to start over. */ + if (viewSize <= 0 && firstChar == mesgLength + padding) + { + /* Check if we repeat a specified number, or loop indefinitely. */ + if ((repeat > 0) && (++repeatCount >= repeat)) + { + break; + } + + /* Time to start over. */ + mvwaddch (widget->win, BorderOf (widget), BorderOf (widget), ' '); + wrefresh (widget->win); + firstTime = TRUE; + } + + /* Now sleep */ + napms (delay * 10); + } + if (oldcurs < 0) + oldcurs = 1; + curs_set (oldcurs); + freeChtype (message); + return (0); +} + +/* + * This de-activates a marquee widget. + */ +void deactivateCDKMarquee (CDKMARQUEE *widget) +{ + widget->active = FALSE; +} + +/* + * This moves the marquee field to the given location. + */ +static void _moveCDKMarquee (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKMARQUEE *widget = (CDKMARQUEE *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (widget->win); + int currentY = getbegy (widget->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (widget->win) + xplace; + ypos = getbegy (widget->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (widget), &xpos, &ypos, widget->boxWidth, widget->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (widget->win, -xdiff, -ydiff); + moveCursesWindow (widget->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (widget)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKMarquee (widget, ObjOf (widget)->box); + } +} + +/* + * This draws the marquee widget on the screen. + */ +static void _drawCDKMarquee (CDKOBJS *object, boolean Box) +{ + CDKMARQUEE *widget = (CDKMARQUEE *)object; + + /* Keep the box information. */ + ObjOf (widget)->box = Box; + + /* Do we need to draw a shadow??? */ + if (widget->shadowWin != 0) + { + drawShadow (widget->shadowWin); + } + + /* Box it if needed. */ + if (Box) + { + drawObjBox (widget->win, ObjOf (widget)); + } + else + { + touchwin (widget->win); + } + + /* Refresh the window. */ + wrefresh (widget->win); +} + +/* + * This destroys the widget. + */ +static void _destroyCDKMarquee (CDKOBJS *object) +{ + if (object != 0) + { + CDKMARQUEE *widget = (CDKMARQUEE *)object; + + /* Clean up the windows. */ + deleteCursesWindow (widget->shadowWin); + deleteCursesWindow (widget->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vMARQUEE, widget); + + /* Unregister this object. */ + unregisterCDKObject (vMARQUEE, widget); + } +} + +/* + * This erases the widget. + */ +static void _eraseCDKMarquee (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKMARQUEE *widget = (CDKMARQUEE *)object; + + eraseCursesWindow (widget->win); + eraseCursesWindow (widget->shadowWin); + } +} + +/* + * This sets the widgets box attribute. + */ +void setCDKMarqueeBox (CDKMARQUEE *widget, boolean Box) +{ + int xpos = widget->win ? getbegx (widget->win) : 0; + int ypos = widget->win ? getbegy (widget->win) : 0; + + ObjOf (widget)->box = Box; + ObjOf (widget)->borderSize = Box ? 1 : 0; + + layoutWidget (widget, xpos, ypos); +} +boolean getCDKMarqueeBox (CDKMARQUEE *widget) +{ + return ObjOf (widget)->box; +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrMarquee (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKMARQUEE *widget = (CDKMARQUEE *)object; + + wbkgd (widget->win, attrib); + } +} + +dummyInject (Marquee) + +dummyFocus (Marquee) + +dummyUnfocus (Marquee) + +dummyRefreshData (Marquee) + +dummySaveData (Marquee) diff --git a/deps/cdk-5.0-20161210/matrix.c b/deps/cdk-5.0-20161210/matrix.c new file mode 100644 index 0000000..abe3839 --- /dev/null +++ b/deps/cdk-5.0-20161210/matrix.c @@ -0,0 +1,1785 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/12/10 15:18:01 $ + * $Revision: 1.198 $ + */ + +/* + * Declare file local prototypes. + */ +static void highlightCDKMatrixCell (CDKMATRIX *matrix); +static void CDKMatrixCallBack (CDKMATRIX *matrix, chtype input); +static void drawCDKMatrixCell (CDKMATRIX *matrix, + int srow, int scol, + int vrow, int vcol, + boolean Box); +static void drawCurCDKMatrixCell (CDKMATRIX *matrix); +static void drawEachCDKMatrixCell (CDKMATRIX *matrix); +static void drawEachColTitle (CDKMATRIX *matrix); +static void drawEachRowTitle (CDKMATRIX *matrix); +static void drawOldCDKMatrixCell (CDKMATRIX *matrix); +static void redrawTitles (CDKMATRIX *matrix, int row, int col); + +#define emptyString(s) ((s) == 0 || *(s) == '\0') + +#define CurMatrixCell(matrix) \ + MATRIX_CELL (matrix, matrix->crow, matrix->ccol) + +#define CurMatrixInfo(matrix) \ + MATRIX_INFO (matrix, \ + matrix->trow + matrix->crow - 1, \ + matrix->lcol + matrix->ccol - 1) + +DeclareCDKObjects (MATRIX, Matrix, setCdk, Int); + +#define WHOLE_BOX ACS_ULCORNER, ACS_URCORNER, ACS_LLCORNER, ACS_LRCORNER + +#define TOP_C_BOX ACS_ULCORNER, ACS_URCORNER, ACS_LTEE, ACS_RTEE +#define MID_C_BOX ACS_LTEE, ACS_RTEE, ACS_LTEE, ACS_RTEE +#define BOT_C_BOX ACS_LTEE, ACS_RTEE, ACS_LLCORNER, ACS_LRCORNER + +#define LFT_R_BOX ACS_ULCORNER, ACS_TTEE, ACS_LLCORNER, ACS_BTEE +#define MID_R_BOX ACS_TTEE, ACS_TTEE, ACS_BTEE, ACS_BTEE +#define RGT_R_BOX ACS_TTEE, ACS_URCORNER, ACS_BTEE, ACS_LRCORNER + +#define LFT_T_BOX ACS_ULCORNER, ACS_TTEE, ACS_LTEE, ACS_PLUS +#define MID_T_BOX ACS_TTEE, ACS_TTEE, ACS_PLUS, ACS_PLUS +#define RGT_T_BOX ACS_TTEE, ACS_URCORNER, ACS_PLUS, ACS_RTEE + +#define LFT_M_BOX ACS_LTEE, ACS_PLUS, ACS_LTEE, ACS_PLUS +#define MID_M_BOX ACS_PLUS, ACS_PLUS, ACS_PLUS, ACS_PLUS +#define RGT_M_BOX ACS_PLUS, ACS_RTEE, ACS_PLUS, ACS_RTEE + +#define LFT_B_BOX ACS_LTEE, ACS_PLUS, ACS_LLCORNER, ACS_BTEE +#define MID_B_BOX ACS_PLUS, ACS_PLUS, ACS_BTEE, ACS_BTEE +#define RGT_B_BOX ACS_PLUS, ACS_RTEE, ACS_BTEE, ACS_LRCORNER + +#define MyBox(cell,what,attr) attrbox(cell, what, ACS_HLINE, ACS_VLINE, attr) + +/* + * This function creates the matrix widget. + */ +CDKMATRIX *newCDKMatrix (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int rows, + int cols, + int vrows, + int vcols, + const char *title, + CDK_CSTRING2 rowtitles, + CDK_CSTRING2 coltitles, + int *colwidths, + int *colvalues, + int rspace, + int cspace, + chtype filler, + int dominant, + boolean Box, + boolean boxCell, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKMATRIX *matrix = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxHeight = 0; + int boxWidth = 0; + int xpos = xplace; + int ypos = yplace; + int maxWidth; + int maxRowTitleWidth = 0; + int rowSpace = MAXIMUM (0, rspace); + int colSpace = MAXIMUM (0, cspace); + int begx = 0; + int begy = 0; + int cellWidth = 0; + char **temp = 0; + int x, y; + int borderw = 0; + bool have_rowtitles = FALSE; + bool have_coltitles = FALSE; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { CDK_FORCHAR, KEY_NPAGE }, + { CDK_BACKCHAR, KEY_PPAGE }, + }; + /* *INDENT-ON* */ + + if ((matrix = newCDKObject (CDKMATRIX, &my_funcs)) == 0) + { + return (0); + } + + setCDKMatrixBox (matrix, Box); + borderw = (ObjOf (matrix)->box) ? 1 : 0; + + /* Make sure that the number of rows/cols/vrows/vcols is not zero. */ + if (rows <= 0 || cols <= 0 || vrows <= 0 || vcols <= 0) + { + destroyCDKObject (matrix); + return (0); + } +#if NEW_CDKMATRIX + matrix->cell = typeCallocN (WINDOW *, (rows + 1) * (cols + 1)); + matrix->info = typeCallocN (char *, (rows + 1) * (cols + 1)); +#endif + + /* + * Make sure the number of virtual cells is not larger than + * the physical size. + */ + vrows = (vrows > rows ? rows : vrows); + vcols = (vcols > cols ? cols : vcols); + + /* Set these early, since they are used in matrix index computations */ + /* *INDENT-EQLS* */ + matrix->rows = rows; + matrix->cols = cols; + /* columns */ + matrix->colwidths = typeCallocN (int, cols + 1); + matrix->colvalues = typeCallocN (int, cols + 1); + matrix->coltitle = typeCallocN (chtype *, cols + 1); + matrix->coltitleLen = typeCallocN (int, cols + 1); + matrix->coltitlePos = typeCallocN (int, cols + 1); + /* titles */ + matrix->rowtitle = typeCallocN (chtype *, rows + 1); + matrix->rowtitleLen = typeCallocN (int, rows + 1); + matrix->rowtitlePos = typeCallocN (int, rows + 1); + + /* + * Count the number of lines in the title (see setCdkTitle). + */ + temp = CDKsplitString (title, '\n'); + TitleLinesOf (matrix) = (int)CDKcountStrings ((CDK_CSTRING2)temp); + CDKfreeStrings (temp); + + /* Determine the height of the box. */ + if (vrows == 1) + { + boxHeight = 6 + TitleLinesOf (matrix); + } + else + { + if (rowSpace == 0) + { + boxHeight = (6 + TitleLinesOf (matrix) + + ((vrows - 1) * 2)); + } + else + { + boxHeight = (3 + TitleLinesOf (matrix) + + (vrows * 3) + ((vrows - 1) * (rowSpace - 1))); + } + } + + /* Determine the maximum row title width */ + for (x = 1; x <= rows; x++) + { + if (rowtitles && !emptyString (rowtitles[x])) /*VR */ + have_rowtitles = TRUE; + matrix->rowtitle[x] = char2Chtype (rowtitles ? rowtitles[x] : 0, /*VR */ + &matrix->rowtitleLen[x], + &matrix->rowtitlePos[x]); + maxRowTitleWidth = MAXIMUM (maxRowTitleWidth, matrix->rowtitleLen[x]); + } + + if (have_rowtitles) + { + matrix->maxrt = maxRowTitleWidth + 2; + + /* We need to rejustify the row title cell info. */ + for (x = 1; x <= rows; x++) + { + matrix->rowtitlePos[x] = justifyString (matrix->maxrt, + matrix->rowtitleLen[x], + matrix->rowtitlePos[x]); + } + } + else + { + matrix->maxrt = 0; + } + + /* Determine the width of the matrix. */ + maxWidth = 2 + matrix->maxrt; + for (x = 1; x <= vcols; x++) + { + maxWidth += colwidths[x] + 2 + colSpace; + } + maxWidth -= (colSpace - 1); + boxWidth = MAXIMUM (maxWidth, boxWidth); + + boxWidth = setCdkTitle (ObjOf (matrix), title, boxWidth); + + /* + * Make sure the dimensions of the window didn't + * extend beyond the dimensions of the parent window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the pop-up window. */ + matrix->win = newwin (boxHeight, boxWidth, ypos, xpos); + + if (matrix->win == 0) + { + destroyCDKObject (matrix); + return (0); + } + + /* Make the subwindows in the pop-up. */ + begx = xpos; + begy = ypos + borderw + TitleLinesOf (matrix); + + /* Make the 'empty' 0x0 cell. */ + MATRIX_CELL (matrix, 0, 0) = subwin (matrix->win, 3, matrix->maxrt, begy, begx); + begx += matrix->maxrt + 1; + + /* Copy the titles into the structure. */ + for (x = 1; x <= cols; x++) + { + if (coltitles && !emptyString (coltitles[x])) /*VR */ + have_coltitles = TRUE; + matrix->coltitle[x] = char2Chtype (coltitles ? coltitles[x] : 0, /*VR */ + &matrix->coltitleLen[x], + &matrix->coltitlePos[x]); + matrix->coltitlePos[x] = (BorderOf (matrix) + + justifyString (colwidths[x], + matrix->coltitleLen[x], + matrix->coltitlePos[x])); + matrix->colwidths[x] = colwidths[x]; + } + + if (have_coltitles) + { + /* Make the column titles. */ + for (x = 1; x <= vcols; x++) + { + cellWidth = colwidths[x] + 3; + MATRIX_CELL (matrix, 0, x) = subwin (matrix->win, + borderw, + cellWidth, + begy, + begx); + + if (MATRIX_CELL (matrix, 0, x) == 0) + { + destroyCDKObject (matrix); + return (0); + } + begx += cellWidth + colSpace - 1; + } + begy++; + } + + /* Make the main cell body */ + for (x = 1; x <= vrows; x++) + { + if (have_rowtitles) + { + /* Make the row titles */ + MATRIX_CELL (matrix, x, 0) = subwin (matrix->win, + 3, matrix->maxrt, + begy, xpos + borderw); + + if (MATRIX_CELL (matrix, x, 0) == 0) + { + destroyCDKObject (matrix); + return (0); + } + } + + /* Set the start of the x position. */ + begx = xpos + matrix->maxrt + borderw; + + /* Make the cells */ + for (y = 1; y <= vcols; y++) + { + cellWidth = colwidths[y] + 3; + MATRIX_CELL (matrix, x, y) = subwin (matrix->win, + 3, cellWidth, + begy, begx); + + if (MATRIX_CELL (matrix, x, y) == 0) + { + destroyCDKObject (matrix); + return (0); + } + begx += cellWidth + colSpace - 1; + keypad (MATRIX_CELL (matrix, x, y), TRUE); + } + begy += rowSpace + 2; + } + keypad (matrix->win, TRUE); + + /* *INDENT-EQLS* Keep the rest of the info. */ + ScreenOf (matrix) = cdkscreen; + ObjOf (matrix)->acceptsFocus = TRUE; + ObjOf (matrix)->inputWindow = matrix->win; + matrix->parent = cdkscreen->window; + matrix->vrows = vrows; + matrix->vcols = vcols; + matrix->boxWidth = boxWidth; + matrix->boxHeight = boxHeight; + matrix->rowSpace = rowSpace; + matrix->colSpace = colSpace; + matrix->filler = filler; + matrix->dominant = dominant; + matrix->row = 1; + matrix->col = 1; + matrix->crow = 1; + matrix->ccol = 1; + matrix->trow = 1; + matrix->lcol = 1; + matrix->oldcrow = 1; + matrix->oldccol = 1; + matrix->oldvrow = 1; + matrix->oldvcol = 1; + initExitType (matrix); + matrix->boxCell = boxCell; + matrix->shadow = shadow; + matrix->highlight = A_REVERSE; + matrix->callbackfn = CDKMatrixCallBack; + + /* Make room for the cell information. */ + for (x = 1; x <= rows; x++) + { + for (y = 1; y <= cols; y++) + { + MATRIX_INFO (matrix, x, y) = typeCallocN (char, (colwidths[y] + 1)); + matrix->colvalues[y] = colvalues[y]; + matrix->colwidths[y] = colwidths[y]; + } + } + + /* Do we want a shadow??? */ + if (shadow) + { + matrix->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Setup the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (vMATRIX, matrix, + (chtype)bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + /* Register this baby. */ + registerCDKObject (cdkscreen, vMATRIX, matrix); + + /* Return the matrix pointer */ + return (matrix); +} + +/* + * This activates the matrix. + */ +int activateCDKMatrix (CDKMATRIX *matrix, chtype *actions) +{ + int ret; + + /* Draw the matrix */ + drawCDKMatrix (matrix, ObjOf (matrix)->box); + + if (actions == 0) + { + chtype input = 0; + boolean functionKey; + + for (;;) + { + ObjOf (matrix)->inputWindow = CurMatrixCell (matrix); + keypad (ObjOf (matrix)->inputWindow, TRUE); + input = (chtype)getchCDKObject (ObjOf (matrix), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKMatrix (matrix, input); + if (matrix->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKMatrix (matrix, actions[x]); + if (matrix->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and exit. */ + setExitType (matrix, 0); + return -1; +} + +/* + * This injects a single character into the matrix widget. + */ +static int _injectCDKMatrix (CDKOBJS *object, chtype input) +{ + /* *INDENT-EQLS* */ + CDKMATRIX *widget = (CDKMATRIX *)object; + int refreshCells = FALSE; + int movedCell = FALSE; + int charcount = (int)strlen (MATRIX_INFO (widget, widget->row, widget->col)); + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Move the cursor to the correct position within the cell. */ + if (widget->colwidths[widget->ccol] == 1) + { + wmove (CurMatrixCell (widget), 1, 1); + } + else + { + wmove (CurMatrixCell (widget), + 1, + (int)strlen (MATRIX_INFO (widget, widget->row, widget->col)) + 1); + } + + /* Put the focus on the current cell */ + MyBox (CurMatrixCell (widget), WHOLE_BOX, A_BOLD); + wrefresh (CurMatrixCell (widget)); + highlightCDKMatrixCell (widget); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vMATRIX, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check the key bindings. */ + if (checkCDKObjectBind (vMATRIX, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case CDK_TRANSPOSE: + break; + + case KEY_HOME: + break; + + case KEY_END: + break; + + case KEY_BACKSPACE: + case KEY_DC: + if (widget->colvalues[widget->col] == vVIEWONLY || charcount <= 0) + { + Beep (); + } + else + { + charcount--; + (void)mvwdelch (CurMatrixCell (widget), 1, charcount + 1); + (void)mvwinsch (CurMatrixCell (widget), 1, charcount + 1, widget->filler); + wrefresh (CurMatrixCell (widget)); + MATRIX_INFO (widget, widget->row, widget->col)[charcount] = '\0'; + } + break; + + case KEY_RIGHT: + case KEY_TAB: + if (widget->ccol != widget->vcols) + { + /* We are moving to the right... */ + widget->col++; + widget->ccol++; + movedCell = TRUE; + } + else + { + /* We have to shift the columns to the right. */ + if (widget->col != widget->cols) + { + widget->lcol++; + widget->col++; + + /* Redraw the column titles. */ + if (widget->rows > widget->vrows) + { + redrawTitles (widget, FALSE, TRUE); + } + refreshCells = TRUE; + movedCell = TRUE; + } + else + { + /* We are at the far right column, we need */ + /* shift down one row, if we can. */ + if (widget->row == widget->rows) + { + Beep (); + } + else + { + /* Set up the columns info. */ + widget->col = 1; + widget->lcol = 1; + widget->ccol = 1; + + /* Shift the rows... */ + if (widget->crow != widget->vrows) + { + widget->row++; + widget->crow++; + } + else + { + widget->row++; + widget->trow++; + } + redrawTitles (widget, TRUE, TRUE); + refreshCells = TRUE; + movedCell = TRUE; + } + } + } + break; + + case KEY_LEFT: + case KEY_BTAB: + if (widget->ccol != 1) + { + /* We are moving to the left... */ + widget->col--; + widget->ccol--; + movedCell = TRUE; + } + else + { + /* Are we at the far left??? */ + if (widget->lcol != 1) + { + widget->lcol--; + widget->col--; + + /* Redraw the column titles. */ + if (widget->cols > widget->vcols) + { + redrawTitles (widget, FALSE, TRUE); + } + refreshCells = TRUE; + movedCell = TRUE; + } + else + { + /* Shift up one line if we can... */ + if (widget->row == 1) + { + Beep (); + } + else + { + /* Set up the columns info. */ + widget->col = widget->cols; + widget->lcol = widget->cols - widget->vcols + 1; + widget->ccol = widget->vcols; + + /* Shift the rows... */ + if (widget->crow != 1) + { + widget->row--; + widget->crow--; + } + else + { + widget->row--; + widget->trow--; + } + redrawTitles (widget, TRUE, TRUE); + refreshCells = TRUE; + movedCell = TRUE; + } + } + } + break; + + case KEY_UP: + if (widget->crow != 1) + { + widget->row--; + widget->crow--; + movedCell = TRUE; + } + else + { + if (widget->trow != 1) + { + widget->trow--; + widget->row--; + + /* Redraw the row titles. */ + if (widget->rows > widget->vrows) + { + redrawTitles (widget, TRUE, FALSE); + } + refreshCells = TRUE; + movedCell = TRUE; + } + else + { + Beep (); + } + } + break; + + case KEY_DOWN: + if (widget->crow != widget->vrows) + { + widget->row++; + widget->crow++; + movedCell = TRUE; + } + else + { + if ((widget->trow + widget->vrows - 1) != widget->rows) + { + widget->trow++; + widget->row++; + + /* Redraw the titles. */ + if (widget->rows > widget->vrows) + { + redrawTitles (widget, TRUE, FALSE); + } + refreshCells = TRUE; + movedCell = TRUE; + } + else + { + Beep (); + } + } + break; + + case KEY_NPAGE: + if (widget->rows > widget->vrows) + { + if ((widget->trow + ((widget->vrows - 1) * 2)) <= widget->rows) + { + widget->trow += widget->vrows - 1; + widget->row += widget->vrows - 1; + redrawTitles (widget, TRUE, FALSE); + refreshCells = TRUE; + movedCell = TRUE; + } + else + { + Beep (); + } + } + else + { + Beep (); + } + break; + + case KEY_PPAGE: + if (widget->rows > widget->vrows) + { + if ((widget->trow - ((widget->vrows - 1) * 2)) >= 1) + { + widget->trow -= widget->vrows - 1; + widget->row -= widget->vrows - 1; + redrawTitles (widget, TRUE, FALSE); + refreshCells = TRUE; + movedCell = TRUE; + } + else + { + Beep (); + } + } + else + { + Beep (); + } + break; + + case CTRL ('G'): + jumpToCell (widget, -1, -1); + drawCDKMatrix (widget, ObjOf (widget)->box); + break; + + case CDK_PASTE: + if (GPasteBuffer == 0 || + (int)strlen (GPasteBuffer) > widget->colwidths[widget->ccol]) + { + Beep (); + } + else + { + strcpy (CurMatrixInfo (widget), GPasteBuffer); + drawCurCDKMatrixCell (widget); + } + break; + + case CDK_COPY: + freeChar (GPasteBuffer); + GPasteBuffer = copyChar (CurMatrixInfo (widget)); + break; + + case CDK_CUT: + freeChar (GPasteBuffer); + GPasteBuffer = copyChar (CurMatrixInfo (widget)); + cleanCDKMatrixCell (widget, + widget->trow + widget->crow - 1, + widget->lcol + widget->ccol - 1); + drawCurCDKMatrixCell (widget); + break; + + case CDK_ERASE: + cleanCDKMatrixCell (widget, + widget->trow + widget->crow - 1, + widget->lcol + widget->ccol - 1); + drawCurCDKMatrixCell (widget); + break; + + case KEY_ENTER: + if (!widget->boxCell) + { + attrbox (MATRIX_CELL (widget, widget->oldcrow, widget->oldccol), + ' ', ' ', + ' ', ' ', + ' ', ' ', + A_NORMAL); + } + else + { + drawOldCDKMatrixCell (widget); + } + wrefresh (CurMatrixCell (widget)); + setExitType (widget, input); + ret = 1; + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ESC: + if (!widget->boxCell) + { + attrbox (MATRIX_CELL (widget, widget->oldcrow, widget->oldccol), + ' ', ' ', + ' ', ' ', + ' ', ' ', + A_NORMAL); + } + else + { + drawOldCDKMatrixCell (widget); + } + wrefresh (CurMatrixCell (widget)); + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + (widget->callbackfn) (widget, input); + break; + } + } + + if (!complete) + { + /* Did we change cells? */ + if (movedCell) + { + /* un-highlight the old box */ + if (!widget->boxCell) + { + attrbox (MATRIX_CELL (widget, widget->oldcrow, widget->oldccol), + ' ', ' ', + ' ', ' ', + ' ', ' ', + A_NORMAL); + } + else + { + drawOldCDKMatrixCell (widget); + } + wrefresh (MATRIX_CELL (widget, widget->oldcrow, widget->oldccol)); + + /* Highlight the new cell. */ + MyBox (CurMatrixCell (widget), WHOLE_BOX, A_BOLD); + wrefresh (CurMatrixCell (widget)); + highlightCDKMatrixCell (widget); + } + + /* Redraw each cell. */ + if (refreshCells) + { + drawEachCDKMatrixCell (widget); + + /* Highlight the current cell. */ + MyBox (CurMatrixCell (widget), WHOLE_BOX, A_BOLD); + wrefresh (CurMatrixCell (widget)); + highlightCDKMatrixCell (widget); + } + + /* Move to the correct position in the cell. */ + if (refreshCells || movedCell) + { + if (widget->colwidths[widget->ccol] == 1) + { + wmove (CurMatrixCell (widget), 1, 1); + } + else + { + int infolen = (int)strlen (CurMatrixInfo (widget)); + wmove (CurMatrixCell (widget), 1, infolen + 1); + } + wrefresh (CurMatrixCell (widget)); + } + + /* Should we call a post-process? */ + if (PostProcessFuncOf (widget) != 0) + { + PostProcessFuncOf (widget) (vMATRIX, + widget, + PostProcessDataOf (widget), + input); + } + } + } + + if (!complete) + { + /* Set the variables we need. */ + widget->oldcrow = widget->crow; + widget->oldccol = widget->ccol; + widget->oldvrow = widget->row; + widget->oldvcol = widget->col; + + /* Set the exit type and exit. */ + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * This allows the programmer to define their own key mappings. + */ +static void CDKMatrixCallBack (CDKMATRIX *matrix, chtype input) +{ + EDisplayType disptype = (EDisplayType) matrix->colvalues[matrix->col]; + int plainchar = filterByDisplayType (disptype, input); + int charcount = (int)strlen (MATRIX_INFO (matrix, matrix->row, matrix->col)); + + if (plainchar == ERR) + { + Beep (); + } + else if (charcount == matrix->colwidths[matrix->col]) + { + Beep (); + } + else + { + /* Update the screen. */ + wmove (CurMatrixCell (matrix), + 1, + (int)strlen (MATRIX_INFO (matrix, matrix->row, matrix->col)) + 1); + waddch (CurMatrixCell (matrix), + (chtype)((isHiddenDisplayType (disptype)) + ? (int)matrix->filler + : plainchar)); + wrefresh (CurMatrixCell (matrix)); + + /* Update the character pointer. */ + MATRIX_INFO (matrix, matrix->row, matrix->col)[charcount++] = (char)plainchar; + MATRIX_INFO (matrix, matrix->row, matrix->col)[charcount] = '\0'; + } +} + +/* + * Highlight the new field. + */ +static void highlightCDKMatrixCell (CDKMATRIX *matrix) +{ + /* *INDENT-EQLS* */ + EDisplayType disptype = (EDisplayType) matrix->colvalues[matrix->col]; + chtype highlight = matrix->highlight; + int x = 0; + int infolen = (int)strlen (MATRIX_INFO (matrix, matrix->row, matrix->col)); + + /* + * Given the dominance of the colors/attributes, we need to set the + * current cell attribute. + */ + if (matrix->dominant == ROW) + { + highlight = matrix->rowtitle[matrix->crow][0] & A_ATTRIBUTES; + } + else if (matrix->dominant == COL) + { + highlight = matrix->coltitle[matrix->ccol][0] & A_ATTRIBUTES; + } + + /* If the column is only one char. */ + for (x = 1; x <= matrix->colwidths[matrix->ccol]; x++) + { + chtype ch = (((x <= infolen) && !isHiddenDisplayType (disptype)) + ? CharOf (MATRIX_INFO (matrix, + matrix->row, + matrix->col)[x - 1]) + : matrix->filler); + + (void)mvwaddch (CurMatrixCell (matrix), 1, x, ch | highlight); + } + wmove (CurMatrixCell (matrix), 1, infolen + 1); + wrefresh (CurMatrixCell (matrix)); +} + +/* + * This moves the matrix field to the given location. + */ +static void _moveCDKMatrix (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + /* *INDENT-EQLS* */ + CDKMATRIX *matrix = (CDKMATRIX *)object; + int currentX = getbegx (matrix->win); + int currentY = getbegy (matrix->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + int x, y; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (matrix->win) + xplace; + ypos = getbegy (matrix->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (matrix), &xpos, &ypos, matrix->boxWidth, matrix->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (matrix->win, -xdiff, -ydiff); + + for (x = 0; x <= matrix->vrows; x++) + { + for (y = 0; y <= matrix->vcols; y++) + { + moveCursesWindow (MATRIX_CELL (matrix, x, y), -xdiff, -ydiff); + } + } + + moveCursesWindow (matrix->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (matrix)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKMatrix (matrix, ObjOf (matrix)->box); + } +} + +/* + * This draws a cell within a matrix. + */ +static void drawCDKMatrixCell (CDKMATRIX *matrix, + int row, + int col, + int vrow, + int vcol, + boolean Box) +{ + /* *INDENT-EQLS* */ + WINDOW *cell = MATRIX_CELL (matrix, row, col); + EDisplayType disptype = (EDisplayType) matrix->colvalues[matrix->col]; + chtype highlight = matrix->filler & A_ATTRIBUTES; + int rows = matrix->vrows; + int cols = matrix->vcols; + int infolen = (int)strlen (MATRIX_INFO (matrix, vrow, vcol)); + chtype attr = A_NORMAL; + int x; + + /* + * Given the dominance of the colors/attributes, we need to set the + * current cell attribute. + */ + if (matrix->dominant == ROW) + { + highlight = matrix->rowtitle[row][0] & A_ATTRIBUTES; + } + else if (matrix->dominant == COL) + { + highlight = matrix->coltitle[col][0] & A_ATTRIBUTES; + } + + /* Draw in the cell info. */ + for (x = 1; x <= matrix->colwidths[col]; x++) + { + chtype ch = (((x <= infolen) && !isHiddenDisplayType (disptype)) + ? (CharOf (MATRIX_INFO (matrix, vrow, vcol)[x - 1]) | highlight) + : matrix->filler); + + (void)mvwaddch (cell, 1, x, ch | highlight); + } + wmove (cell, 1, infolen + 1); + wrefresh (cell); + + /* Only draw the box iff the user asked for a box. */ + if (!Box) + { + return; + } + + /* + * If the value of the column spacing is greater than 0 then these + * are independent boxes. + */ + if (matrix->colSpace != 0) + { + if (matrix->rowSpace != 0) + { + MyBox (cell, WHOLE_BOX, attr); + } + else + { + if (row == 1) + { + MyBox (cell, TOP_C_BOX, attr); + } + else if (row > 1 && row < rows) + { + MyBox (cell, MID_C_BOX, attr); + } + else if (row == rows) + { + MyBox (cell, BOT_C_BOX, attr); + } + } + } + else if (matrix->rowSpace != 0) + { + if (col == 1) + { + MyBox (cell, LFT_R_BOX, attr); + } + else if (col > 1 && col < cols) + { + MyBox (cell, MID_R_BOX, attr); + } + else if (col == cols) + { + MyBox (cell, RGT_R_BOX, attr); + } + } + else + { + if (row == 1) + { + if (col == 1) + { + MyBox (cell, LFT_T_BOX, attr); /* top left corner */ + } + else if (col > 1 && col < cols) + { + MyBox (cell, MID_T_BOX, attr); /* top middle */ + } + else if (col == cols) + { + MyBox (cell, RGT_T_BOX, attr); /* top right corner */ + } + } + else if (row > 1 && row < rows) + { + if (col == 1) + { + MyBox (cell, LFT_M_BOX, attr); /* middle left */ + } + else if (col > 1 && col < cols) + { + MyBox (cell, MID_M_BOX, attr); /* middle */ + } + else if (col == cols) + { + MyBox (cell, RGT_M_BOX, attr); /* middle right */ + } + } + else if (row == rows) + { + if (col == 1) + { + MyBox (cell, LFT_B_BOX, attr); /* bottom left corner */ + } + else if (col > 1 && col < cols) + { + MyBox (cell, MID_B_BOX, attr); /* bottom middle */ + } + else if (col == cols) + { + MyBox (cell, RGT_B_BOX, attr); /* bottom right corner */ + } + } + } + + /* Highlight the current cell. */ + MyBox (CurMatrixCell (matrix), WHOLE_BOX, A_BOLD); + wrefresh (CurMatrixCell (matrix)); + highlightCDKMatrixCell (matrix); +} + +static void drawEachColTitle (CDKMATRIX *matrix) +{ + int x; + + for (x = 1; x <= matrix->vcols; x++) + { + if (MATRIX_CELL (matrix, 0, x)) + { + werase (MATRIX_CELL (matrix, 0, x)); /*VR */ + writeChtype (MATRIX_CELL (matrix, 0, x), + matrix->coltitlePos[matrix->lcol + x - 1], 0, + matrix->coltitle[matrix->lcol + x - 1], + HORIZONTAL, + 0, matrix->coltitleLen[matrix->lcol + x - 1]); + wrefresh (MATRIX_CELL (matrix, 0, x)); + } + } +} + +static void drawEachRowTitle (CDKMATRIX *matrix) +{ + int x; + + for (x = 1; x <= matrix->vrows; x++) + { + if (MATRIX_CELL (matrix, x, 0)) + { + werase (MATRIX_CELL (matrix, x, 0)); + writeChtype (MATRIX_CELL (matrix, x, 0), + matrix->rowtitlePos[matrix->trow + x - 1], 1, + matrix->rowtitle[matrix->trow + x - 1], + HORIZONTAL, + 0, matrix->rowtitleLen[matrix->trow + x - 1]); + wrefresh (MATRIX_CELL (matrix, x, 0)); + } + } +} + +static void drawEachCDKMatrixCell (CDKMATRIX *matrix) +{ + int y, x; + + /* Fill in the cells. */ + for (x = 1; x <= matrix->vrows; x++) + { + for (y = 1; y <= matrix->vcols; y++) + { + drawCDKMatrixCell (matrix, x, y, + matrix->trow + x - 1, + matrix->lcol + y - 1, + matrix->boxCell); + } + } +} + +static void drawCurCDKMatrixCell (CDKMATRIX *matrix) +{ + drawCDKMatrixCell (matrix, + matrix->crow, + matrix->ccol, + matrix->row, + matrix->col, + matrix->boxCell); +} + +static void drawOldCDKMatrixCell (CDKMATRIX *matrix) +{ + drawCDKMatrixCell (matrix, + matrix->oldcrow, + matrix->oldccol, + matrix->oldvrow, + matrix->oldvcol, + matrix->boxCell); +} + +/* + * This function draws the matrix widget. + */ +static void _drawCDKMatrix (CDKOBJS *object, boolean Box) +{ + CDKMATRIX *matrix = (CDKMATRIX *)object; + + /* Did we ask for a shadow??? */ + if (matrix->shadowWin != 0) + { + drawShadow (matrix->shadowWin); + } + + /* Should we box the matrix??? */ + if (Box) + { + drawObjBox (matrix->win, ObjOf (matrix)); + } + + drawCdkTitle (matrix->win, object); + + wrefresh (matrix->win); + + drawEachColTitle (matrix); + drawEachRowTitle (matrix); + drawEachCDKMatrixCell (matrix); + + /* Highlight the current cell. */ + MyBox (CurMatrixCell (matrix), WHOLE_BOX, A_BOLD); + wrefresh (CurMatrixCell (matrix)); + highlightCDKMatrixCell (matrix); +} + +/* + * This function destroys the matrix widget. + */ +static void _destroyCDKMatrix (CDKOBJS *object) +{ + if (object != 0) + { + CDKMATRIX *matrix = (CDKMATRIX *)object; + int x = 0; + int y = 0; + + cleanCdkTitle (object); + + /* Clear out the col titles. */ + for (x = 1; x <= matrix->cols; x++) + { + freeChtype (matrix->coltitle[x]); + } + + /* Clear out the row titles. */ + for (x = 1; x <= matrix->rows; x++) + { + freeChtype (matrix->rowtitle[x]); + } + + /* Clear out the matrix cells. */ + for (x = 1; x <= matrix->rows; x++) + { + for (y = 1; y <= matrix->cols; y++) + { + freeChar (MATRIX_INFO (matrix, x, y)); + } + } + + /* Clear the matrix windows. */ + deleteCursesWindow (MATRIX_CELL (matrix, 0, 0)); + for (x = 1; x <= matrix->vrows; x++) + { + deleteCursesWindow (MATRIX_CELL (matrix, x, 0)); + } + for (x = 1; x <= matrix->vcols; x++) + { + deleteCursesWindow (MATRIX_CELL (matrix, 0, x)); + } + for (x = 1; x <= matrix->vrows; x++) + { + for (y = 1; y <= matrix->vcols; y++) + { + deleteCursesWindow (MATRIX_CELL (matrix, x, y)); + } + } + +#if NEW_CDKMATRIX + freeChecked (matrix->cell); + freeChecked (matrix->info); +#endif + + freeChecked (matrix->colwidths); + freeChecked (matrix->colvalues); + + freeChecked (matrix->coltitle); + freeChecked (matrix->coltitleLen); + freeChecked (matrix->coltitlePos); + + freeChecked (matrix->rowtitle); + freeChecked (matrix->rowtitleLen); + freeChecked (matrix->rowtitlePos); + + deleteCursesWindow (matrix->shadowWin); + deleteCursesWindow (matrix->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vMATRIX, matrix); + + /* Unregister this object. */ + unregisterCDKObject (vMATRIX, matrix); + } +} + +/* + * This function erases the matrix widget from the screen. + */ +static void _eraseCDKMatrix (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKMATRIX *matrix = (CDKMATRIX *)object; + int x = 0; + int y = 0; + + /* Clear the matrix cells. */ + eraseCursesWindow (MATRIX_CELL (matrix, 0, 0)); + for (x = 1; x <= matrix->vrows; x++) + { + eraseCursesWindow (MATRIX_CELL (matrix, x, 0)); + } + for (x = 1; x <= matrix->vcols; x++) + { + eraseCursesWindow (MATRIX_CELL (matrix, 0, x)); + } + for (x = 1; x <= matrix->vrows; x++) + { + for (y = 1; y <= matrix->vcols; y++) + { + eraseCursesWindow (MATRIX_CELL (matrix, x, y)); + } + } + eraseCursesWindow (matrix->shadowWin); + eraseCursesWindow (matrix->win); + } +} + +/* + * Set the callback-function. + */ +void setCDKMatrixCB (CDKMATRIX *widget, MATRIXCB callback) +{ + widget->callbackfn = callback; +} + +/* + * This function sets the values of the matrix widget. + */ +void setCDKMatrixCells (CDKMATRIX *matrix, + CDK_CSTRING2 info, + int rows, + int maxcols, + int *subSize) +{ + int x = 0; + int y = 0; + + if (rows > matrix->rows) + rows = matrix->rows; + + /* Copy in the new info. */ + for (x = 1; x <= rows; x++) + { + for (y = 1; y <= matrix->cols; y++) + { + if (x <= rows && y <= subSize[x]) + { + const char *source = info[(x * maxcols) + y]; + + /* Copy in the new information. */ + if (source != 0) + { + char *target = MATRIX_INFO (matrix, x, y); + + if (target == 0) /* this should not happen... */ + { + target = typeCallocN (char, matrix->colwidths[y] + 1); + MATRIX_INFO (matrix, x, y) = target; + } + strncpy (MATRIX_INFO (matrix, x, y), + source, + (size_t) matrix->colwidths[y]); + } + } + else + cleanCDKMatrixCell (matrix, x, y); + } + } +} + +/* + * This sets the widget's box attribute. + */ +void setCDKMatrixBox (CDKMATRIX *matrix, boolean Box) +{ + ObjOf (matrix)->box = Box; + ObjOf (matrix)->borderSize = Box ? 1 : 0; +} +boolean getCDKMatrixBox (CDKMATRIX *matrix) +{ + return ObjOf (matrix)->box; +} + +/* + * This cleans out the information cells in the matrix widget. + */ +void cleanCDKMatrix (CDKMATRIX *matrix) +{ + int x = 0; + int y = 0; + + for (x = 1; x <= matrix->rows; x++) + { + for (y = 1; y <= matrix->cols; y++) + { + cleanCDKMatrixCell (matrix, x, y); + } + } +} + +/* + * This cleans one cell in the matrix widget. + */ +void cleanCDKMatrixCell (CDKMATRIX *matrix, int row, int col) +{ + if (row > 0 && row <= matrix->rows && + col > 0 && col <= matrix->cols) + cleanChar (MATRIX_INFO (matrix, row, col), matrix->colwidths[col], '\0'); +} + +/* + * This allows us to hyper-warp to a cell. + */ +int jumpToCell (CDKMATRIX *matrix, int row, int col) +{ + CDKSCALE *scale = 0; + int newRow = row; + int newCol = col; + + /* + * Only create the row scale if needed. + */ + if ((row == -1) || (row > matrix->rows)) + { + /* Create the row scale widget. */ + scale = newCDKScale (ScreenOf (matrix), + CENTER, CENTER, + "Jump to which row.", + "Row: ", A_NORMAL, 5, + 1, 1, matrix->rows, 1, 1, TRUE, FALSE); + + /* Activate the scale and get the row. */ + newRow = activateCDKScale (scale, 0); + destroyCDKScale (scale); + } + + /* + * Only create the column scale if needed. + */ + if ((col == -1) || (col > matrix->cols)) + { + /* Create the column scale widget. */ + scale = newCDKScale (ScreenOf (matrix), + CENTER, CENTER, + "Jump to which column", + "Col: ", A_NORMAL, 5, + 1, 1, matrix->cols, 1, 1, TRUE, FALSE); + + /* Activate the scale and get the column. */ + newCol = activateCDKScale (scale, 0); + destroyCDKScale (scale); + } + + /* Hyper-warp.... */ + if (newRow != matrix->row || newCol != matrix->col) + { + return (moveToCDKMatrixCell (matrix, newRow, newCol)); + } + else + { + return 1; + } +} + +/* + * This allows us to move to a given cell. + */ +int moveToCDKMatrixCell (CDKMATRIX *matrix, int newrow, int newcol) +{ + int rowShift = newrow - matrix->row; + int colShift = newcol - matrix->col; + + /* Make sure we arent asking to move out of the matrix. */ + if (newrow > matrix->rows || + newcol > matrix->cols || + newrow <= 0 || + newcol <= 0) + { + return 0; + } + + /* Did we move up/down???? */ + if (rowShift > 0) + { + /* We are moving down. */ + if (matrix->vrows == matrix->cols) + { + matrix->trow = 1; + matrix->crow = newrow; + matrix->row = newrow; + } + else + { + if ((rowShift + matrix->vrows) < matrix->rows) + { + /* Just shift down by rowShift... */ + matrix->trow += rowShift; + matrix->crow = 1; + matrix->row += rowShift; + } + else + { + /* We need to munge with the values... */ + matrix->trow = matrix->rows - matrix->vrows + 1; + matrix->crow = ((rowShift + matrix->vrows) - matrix->rows) + 1; + matrix->row = newrow; + } + } + } + else if (rowShift < 0) + { + /* We are moving up. */ + if (matrix->vrows == matrix->rows) + { + matrix->trow = 1; + matrix->row = newrow; + matrix->crow = newrow; + } + else + { + if ((rowShift + matrix->vrows) > 1) + { + /* Just shift up by rowShift... */ + matrix->trow += rowShift; + matrix->row += rowShift; + matrix->crow = 1; + } + else + { + /* We need to munge with the values... */ + matrix->trow = 1; + matrix->crow = 1; + matrix->row = 1; + } + } + } + + /* Did we move left/right ???? */ + if (colShift > 0) + { + /* We are moving right. */ + if (matrix->vcols == matrix->cols) + { + matrix->lcol = 1; + matrix->ccol = newcol; + matrix->col = newcol; + } + else + { + if ((colShift + matrix->vcols) < matrix->cols) + { + matrix->lcol += colShift; + matrix->ccol = 1; + matrix->col += colShift; + } + else + { + /* We need to munge with the values... */ + matrix->lcol = matrix->cols - matrix->vcols + 1; + matrix->ccol = ((colShift + matrix->vcols) - matrix->cols) + 1; + matrix->col = newcol; + } + } + } + else if (colShift < 0) + { + /* We are moving left. */ + if (matrix->vcols == matrix->cols) + { + matrix->lcol = 1; + matrix->col = newcol; + matrix->ccol = newcol; + } + else + { + if ((colShift + matrix->vcols) > 1) + { + /* Just shift left by colShift... */ + matrix->lcol += colShift; + matrix->col += colShift; + matrix->ccol = 1; + } + else + { + matrix->lcol = 1; + matrix->col = 1; + matrix->ccol = 1; + } + } + } + + /* Keep the 'old' values around for redrawing sake. */ + matrix->oldcrow = matrix->crow; + matrix->oldccol = matrix->ccol; + matrix->oldvrow = matrix->row; + matrix->oldvcol = matrix->col; + + /* Lets ... */ + return 1; +} + +/* + * This redraws the titles indicated... + */ +static void redrawTitles (CDKMATRIX *matrix, int rowTitles, int colTitles) +{ + /* Redraw the row titles. */ + if (rowTitles) + { + drawEachRowTitle (matrix); + } + + /* Redraw the column titles. */ + if (colTitles) + { + drawEachColTitle (matrix); + } +} + +/* + * This sets the value of a matrix cell. + */ +int setCDKMatrixCell (CDKMATRIX *matrix, int row, int col, const char *value) +{ + /* Make sure the row/col combination is within the matrix. */ + if (row > matrix->rows || col > matrix->cols || row <= 0 || col <= 0) + { + return -1; + } + + cleanCDKMatrixCell (matrix, row, col); + strncpy (MATRIX_INFO (matrix, row, col), + value, + (size_t) matrix->colwidths[col]); + return 1; +} + +/* + * This gets the value of a matrix cell. + */ +char *getCDKMatrixCell (CDKMATRIX *matrix, int row, int col) +{ + /* Make sure the row/col combination is within the matrix. */ + if (row > matrix->rows || col > matrix->cols || row <= 0 || col <= 0) + { + return 0; + } + return MATRIX_INFO (matrix, row, col); +} + +/* + * This returns the current row/col cell. + */ +int getCDKMatrixCol (CDKMATRIX *matrix) +{ + return matrix->col; +} +int getCDKMatrixRow (CDKMATRIX *matrix) +{ + return matrix->row; +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrMatrix (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKMATRIX *widget = (CDKMATRIX *)object; + int x, y; + + wbkgd (widget->win, attrib); + for (x = 0; x <= widget->vrows; x++) + { + for (y = 0; y <= widget->vcols; y++) + { + wbkgd (MATRIX_CELL (widget, x, y), attrib); + } + } + } +} + +static void _focusCDKMatrix (CDKOBJS *object) +{ + CDKMATRIX *widget = (CDKMATRIX *)object; + + drawCDKMatrix (widget, ObjOf (widget)->box); +} + +static void _unfocusCDKMatrix (CDKOBJS *object) +{ + CDKMATRIX *widget = (CDKMATRIX *)object; + + drawCDKMatrix (widget, ObjOf (widget)->box); +} + +dummyRefreshData (Matrix) + +dummySaveData (Matrix) diff --git a/deps/cdk-5.0-20161210/mentry.c b/deps/cdk-5.0-20161210/mentry.c new file mode 100644 index 0000000..b1e737d --- /dev/null +++ b/deps/cdk-5.0-20161210/mentry.c @@ -0,0 +1,988 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 20:55:23 $ + * $Revision: 1.169 $ + */ + +/* + * Declare file local prototypes. + */ +static void CDKMentryCallBack (CDKMENTRY *mentry, chtype character); + +DeclareCDKObjects (MENTRY, Mentry, setCdk, String); + +/* + * This creates a pointer to a multiple line entry widget. + */ +CDKMENTRY *newCDKMentry (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + const char *title, + const char *label, + chtype fieldAttr, + chtype filler, + EDisplayType dispType, + int fWidth, + int fRows, + int logicalRows, + int min, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKMENTRY *mentry = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int fieldWidth = fWidth; + int fieldRows = fRows; + int boxWidth = 0; + int boxHeight = 0; + int horizontalAdjust, oldWidth; + int xpos = xplace; + int ypos = yplace; + int junk; + + if ((mentry = newCDKObject (CDKMENTRY, &my_funcs)) == 0) + return (0); + + setCDKMentryBox (mentry, Box); + + /* + * If the fieldWidth is a negative value, the fieldWidth will + * be COLS-fieldWidth, otherwise, the fieldWidth will be the + * given width. + */ + fieldWidth = setWidgetDimension (parentWidth, fieldWidth, 0); + + /* + * If the fieldRows is a negative value, the fieldRows will + * be ROWS-fieldRows, otherwise, the fieldRows will be the + * given height. + */ + fieldRows = setWidgetDimension (parentWidth, fieldRows, 0); + boxHeight = fieldRows + 2; + + /* *INDENT-EQLS* Set some basic values of the mentry field. */ + mentry->label = 0; + mentry->labelLen = 0; + mentry->labelWin = 0; + + /* We need to translate the char * label to a chtype * */ + if (label != 0) + { + mentry->label = char2Chtype (label, &mentry->labelLen, &junk); + } + boxWidth = mentry->labelLen + fieldWidth + 2; + + oldWidth = boxWidth; + boxWidth = setCdkTitle (ObjOf (mentry), title, boxWidth); + horizontalAdjust = (boxWidth - oldWidth) / 2; + + boxHeight += TitleLinesOf (mentry); + + /* + * Make sure we didn't extend beyond the parent window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + fieldWidth = (fieldWidth > (boxWidth - mentry->labelLen - 2) + ? (boxWidth - mentry->labelLen - 2) + : fieldWidth); + fieldRows = (fieldRows > (boxHeight - TitleLinesOf (mentry) - 2) + ? (boxHeight - TitleLinesOf (mentry) - 2) + : fieldRows); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the label window. */ + mentry->win = newwin (boxHeight, boxWidth, ypos, xpos); + + /* Is the window null??? */ + if (mentry->win == 0) + { + destroyCDKObject (mentry); + return (0); + } + + /* Create the label window. */ + if (mentry->label != 0) + { + mentry->labelWin = subwin (mentry->win, fieldRows, + mentry->labelLen + 2, + ypos + TitleLinesOf (mentry) + 1, + xpos + horizontalAdjust + 1); + } + + /* Make the field window. */ + mentry->fieldWin = subwin (mentry->win, fieldRows, fieldWidth, + ypos + TitleLinesOf (mentry) + 1, + xpos + mentry->labelLen + horizontalAdjust + 1); + + /* Turn on the keypad. */ + keypad (mentry->fieldWin, TRUE); + keypad (mentry->win, TRUE); + + /* *INDENT-EQLS* Set up the rest of the structure. */ + mentry->parent = cdkscreen->window; + mentry->totalWidth = (fieldWidth * logicalRows) + 1; + + /* Create the info char * pointer. */ + mentry->info = typeMallocN (char, mentry->totalWidth + 3); + cleanChar (mentry->info, mentry->totalWidth + 3, '\0'); + + /* *INDENT-EQLS* Set up the rest of the widget information. */ + ScreenOf (mentry) = cdkscreen; + mentry->shadowWin = 0; + mentry->fieldAttr = fieldAttr; + mentry->fieldWidth = fieldWidth; + mentry->rows = fieldRows; + mentry->boxHeight = boxHeight; + mentry->boxWidth = boxWidth; + mentry->filler = filler; + mentry->hidden = filler; + ObjOf (mentry)->inputWindow = mentry->win; + ObjOf (mentry)->acceptsFocus = TRUE; + mentry->currentRow = 0; + mentry->currentCol = 0; + mentry->topRow = 0; + mentry->shadow = shadow; + mentry->dispType = dispType; + mentry->min = min; + mentry->logicalRows = logicalRows; + initExitType (mentry); + mentry->callbackfn = CDKMentryCallBack; + + /* Do we need to create a shadow. */ + if (shadow) + { + mentry->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Register this baby. */ + registerCDKObject (cdkscreen, vMENTRY, mentry); + + /* Return the pointer to the structure. */ + return (mentry); +} + +/* + * This actually manages the mentry widget... + */ +char *activateCDKMentry (CDKMENTRY *mentry, chtype *actions) +{ + chtype input = 0; + boolean functionKey; + char *ret = 0; + + /* Draw the mentry widget. */ + drawCDKMentry (mentry, ObjOf (mentry)->box); + + if (actions == 0) + { + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (mentry), &functionKey); + + /* Inject this character into the widget. */ + ret = injectCDKMentry (mentry, input); + if (mentry->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKMentry (mentry, actions[x]); + if (mentry->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and exit. */ + setExitType (mentry, 0); + return 0; +} + +static bool setTopRow (CDKMENTRY *widget, int row) +{ + if (widget->topRow != row) + { + widget->topRow = row; + return TRUE; + } + return FALSE; +} + +static bool setCurPos (CDKMENTRY *widget, int row, int col) +{ + if (widget->currentRow != row || + widget->currentCol != col) + { + widget->currentRow = row; + widget->currentCol = col; + return TRUE; + } + return FALSE; +} + +static bool handle_KEY_LEFT (CDKMENTRY *mentry, bool *moved, bool *redraw) +{ + bool result = TRUE; + + if (mentry->currentCol != 0) + { + *moved = setCurPos (mentry, + mentry->currentRow, + mentry->currentCol - 1); + } + else if (mentry->currentRow == 0) + { + if (mentry->topRow != 0) + { + *moved = setCurPos (mentry, + mentry->currentRow, + mentry->fieldWidth - 1); + *redraw = setTopRow (mentry, mentry->topRow - 1); + } + } + else + { + *moved = setCurPos (mentry, + mentry->currentRow - 1, + mentry->fieldWidth - 1); + } + + if (!*moved && !*redraw) + { + Beep (); + result = FALSE; + } + return result; +} + +static int getCursorPos (CDKMENTRY *mentry) +{ + return (((mentry->currentRow + mentry->topRow) * mentry->fieldWidth) + + mentry->currentCol); +} + +/* + * This injects a character into the widget. + */ +static int _injectCDKMentry (CDKOBJS *object, chtype input) +{ + CDKMENTRY *widget = (CDKMENTRY *)object; + /* *INDENT-EQLS */ + int cursorPos = getCursorPos (widget); + int ppReturn = 1; + char *ret = unknownString; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Refresh the field. */ + drawCDKMentryField (widget); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vMENTRY, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a key binding... */ + if (checkCDKObjectBind (vMENTRY, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + bool moved = FALSE; + bool redraw = FALSE; + int infoLength = (int)strlen (widget->info); + int fieldCharacters; + + switch (input) + { + case KEY_HOME: + moved = setCurPos (widget, 0, 0); + redraw = setTopRow (widget, 0); + break; + + case KEY_END: + fieldCharacters = widget->rows * widget->fieldWidth; + if (infoLength < fieldCharacters) + { + redraw = setTopRow (widget, 0); + moved = setCurPos (widget, + infoLength / widget->fieldWidth, + infoLength % widget->fieldWidth); + } + else + { + redraw = setTopRow (widget, + (infoLength / widget->fieldWidth) - + widget->rows + 1); + moved = setCurPos (widget, + widget->rows - 1, + infoLength % widget->fieldWidth); + } + break; + + case KEY_LEFT: + handle_KEY_LEFT (widget, &moved, &redraw); + break; + + case KEY_RIGHT: + if (widget->currentCol < (widget->fieldWidth - 1)) + { + if ((getCursorPos (widget) + 1) <= infoLength) + { + moved = setCurPos (widget, + widget->currentRow, + widget->currentCol + 1); + } + } + else if (widget->currentRow == widget->rows - 1) + { + if ((widget->topRow + widget->currentRow + 1) <= widget->logicalRows) + { + moved = setCurPos (widget, widget->currentRow, 0); + redraw = setTopRow (widget, widget->topRow + 1); + } + } + else + { + moved = setCurPos (widget, widget->currentRow + 1, 0); + } + if (!moved && !redraw) + Beep (); + break; + + case KEY_DOWN: + if (widget->currentRow != (widget->rows - 1)) + { + if ((getCursorPos (widget) + widget->fieldWidth + 1) + <= infoLength) + { + moved = setCurPos (widget, widget->currentRow + 1, widget->currentCol); + } + } + else if (widget->topRow < widget->logicalRows - widget->rows) + { + if (((widget->topRow + widget->currentRow + 1) * + widget->fieldWidth) <= infoLength) + { + redraw = setTopRow (widget, widget->topRow + 1); + } + } + if (!moved && !redraw) + Beep (); + break; + + case KEY_UP: + if (widget->currentRow != 0) + { + moved = setCurPos (widget, widget->currentRow - 1, widget->currentCol); + } + else if (widget->topRow != 0) + { + redraw = setTopRow (widget, widget->topRow - 1); + } + if (!moved && !redraw) + Beep (); + break; + + case KEY_BACKSPACE: + case KEY_DC: + if (widget->dispType == vVIEWONLY) + { + Beep (); + } + else if (infoLength == 0) + { + Beep (); + } + else if (input == KEY_DC + || handle_KEY_LEFT (widget, &moved, &redraw)) + { + cursorPos = getCursorPos (widget); + if (widget->info[cursorPos] != '\0') + { + int x; + + for (x = cursorPos; x < infoLength; x++) + { + widget->info[x] = widget->info[x + 1]; + } + widget->info[--infoLength] = '\0'; + + drawCDKMentryField (widget); + } + else + { + Beep (); + } + } + break; + + case CDK_TRANSPOSE: + if (cursorPos >= infoLength - 1) + { + Beep (); + } + else + { + char holder = widget->info[cursorPos]; + widget->info[cursorPos] = widget->info[cursorPos + 1]; + widget->info[cursorPos + 1] = holder; + drawCDKMentryField (widget); + } + break; + + case CDK_ERASE: + if (infoLength != 0) + { + cleanCDKMentry (widget); + drawCDKMentryField (widget); + } + break; + + case CDK_CUT: + if (infoLength == 0) + { + Beep (); + } + else + { + freeChar (GPasteBuffer); + GPasteBuffer = copyChar (widget->info); + cleanCDKMentry (widget); + drawCDKMentryField (widget); + } + break; + + case CDK_COPY: + if (infoLength == 0) + { + Beep (); + } + else + { + freeChar (GPasteBuffer); + GPasteBuffer = copyChar (widget->info); + } + break; + + case CDK_PASTE: + if (GPasteBuffer == 0) + { + Beep (); + } + else + { + setCDKMentryValue (widget, GPasteBuffer); + drawCDKMentry (widget, ObjOf (widget)->box); + } + break; + + case KEY_TAB: + case KEY_ENTER: + if (infoLength < widget->min + 1) + { + Beep (); + } + else + { + setExitType (widget, input); + ret = (widget->info); + complete = TRUE; + } + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + if (widget->dispType == vVIEWONLY + || infoLength >= widget->totalWidth) + { + Beep (); + } + else + { + (widget->callbackfn) (widget, input); + } + break; + } + + if (redraw) + { + drawCDKMentryField (widget); + } + else if (moved) + { + wmove (widget->fieldWin, widget->currentRow, widget->currentCol); + wrefresh (widget->fieldWin); + } + } + + /* Should we do a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vMENTRY, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + setExitType (widget, 0); + } + + ResultOf (widget).valueString = ret; + return (ret != unknownString); +} + +/* + * This moves the mentry field to the given location. + */ +static void _moveCDKMentry (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKMENTRY *mentry = (CDKMENTRY *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (mentry->win); + int currentY = getbegy (mentry->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (mentry->win) + xplace; + ypos = getbegy (mentry->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (mentry), &xpos, &ypos, mentry->boxWidth, mentry->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (mentry->win, -xdiff, -ydiff); + moveCursesWindow (mentry->fieldWin, -xdiff, -ydiff); + moveCursesWindow (mentry->labelWin, -xdiff, -ydiff); + moveCursesWindow (mentry->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (mentry)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKMentry (mentry, ObjOf (mentry)->box); + } +} + +/* + * This function redraws the multiple line entry field. + */ +void drawCDKMentryField (CDKMENTRY *mentry) +{ + /* *INDENT-EQLS* */ + int currchar = (mentry->fieldWidth * mentry->topRow); + int length = 0; + int lastpos = 0; + int x, y; + + /* Check the value of info. */ + if (mentry->info == 0) + { + return; + } + + drawCdkTitle (mentry->win, ObjOf (mentry)); + + wrefresh (mentry->win); + + /* The information isn't null, redraw the field. */ + length = (int)strlen (mentry->info); + lastpos = ((chtype)mentry->info[length] == (chtype)mentry->filler + ? length - 1 + : length); + + /* Set background color and attributes of the entry field */ + wbkgd (mentry->fieldWin, mentry->fieldAttr); + + /* Start redrawing the fields. */ + for (x = 0; x < mentry->rows; x++) + { + for (y = 0; y < mentry->fieldWidth; y++) + { + if (currchar < lastpos) + { + if (isHiddenDisplayType (mentry->dispType)) + { + (void)mvwaddch (mentry->fieldWin, x, y, mentry->hidden | mentry->fieldAttr); + } + else + { + (void)mvwaddch (mentry->fieldWin, x, y, + CharOf (mentry->info[currchar++]) | mentry->fieldAttr); + } + } + else + { + (void)mvwhline (mentry->fieldWin, x, y, mentry->filler | + mentry->fieldAttr, mentry->fieldWidth - y); + break; + } + } + } + + /* Refresh the screen. */ + wmove (mentry->fieldWin, mentry->currentRow, mentry->currentCol); + wrefresh (mentry->fieldWin); +} + +/* + * This is a generic character parser for the mentry field. It is used as a + * callback function, so any personal modifications can be made by creating + * a new function and calling that one the mentry activation. + */ +static void CDKMentryCallBack (CDKMENTRY *mentry, chtype character) +{ + /* *INDENT-EQLS* */ + int cursorPos = getCursorPos (mentry); + int infoLength = (int)strlen (mentry->info); + char newchar = (char)filterByDisplayType (mentry->dispType, character); + + if (newchar == ERR) + { + Beep (); + } + else + { + int x; + + for (x = infoLength + 1; x > cursorPos; x--) + { + mentry->info[x] = mentry->info[x - 1]; + } + mentry->info[cursorPos] = newchar; + mentry->currentCol++; + + drawCDKMentryField (mentry); + + /* Have we gone out of bounds. */ + if (mentry->currentCol >= mentry->fieldWidth) + { + /* Update the row and col values. */ + mentry->currentCol = 0; + mentry->currentRow++; + + /* + * If we have gone outside of the visual boundaries, we + * need to scroll the window. + */ + if (mentry->currentRow == mentry->rows) + { + /* We have to redraw the screen. */ + mentry->currentRow--; + mentry->topRow++; + drawCDKMentryField (mentry); + } + wmove (mentry->fieldWin, mentry->currentRow, mentry->currentCol); + wrefresh (mentry->fieldWin); + } + } +} + +/* + * This function draws the multiple line entry field. + */ +static void _drawCDKMentry (CDKOBJS *object, boolean Box) +{ + CDKMENTRY *mentry = (CDKMENTRY *)object; + + /* Box the widget if asked. */ + if (Box) + { + drawObjBox (mentry->win, ObjOf (mentry)); + wrefresh (mentry->win); + } + + /* Do we need to draw in the shadow??? */ + if (mentry->shadowWin != 0) + { + drawShadow (mentry->shadowWin); + } + + /* Draw in the label to the widget. */ + if (mentry->labelWin != 0) + { + writeChtype (mentry->labelWin, 0, 0, + mentry->label, + HORIZONTAL, 0, + mentry->labelLen); + wrefresh (mentry->labelWin); + } + + /* Draw the mentry field. */ + drawCDKMentryField (mentry); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrMentry (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKMENTRY *widget = (CDKMENTRY *)object; + + wbkgd (widget->win, attrib); + wbkgd (widget->fieldWin, attrib); + if (widget->labelWin != 0) + { + wbkgd (widget->labelWin, attrib); + } + } +} + +/* + * This function erases the multiple line entry field from the screen. + */ +static void _eraseCDKMentry (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKMENTRY *mentry = (CDKMENTRY *)object; + + eraseCursesWindow (mentry->fieldWin); + eraseCursesWindow (mentry->labelWin); + eraseCursesWindow (mentry->win); + eraseCursesWindow (mentry->shadowWin); + } +} + +/* + * This function destroys a multiple line entry field widget. + */ +static void _destroyCDKMentry (CDKOBJS *object) +{ + if (object != 0) + { + CDKMENTRY *mentry = (CDKMENTRY *)object; + + cleanCdkTitle (object); + freeChtype (mentry->label); + freeChar (mentry->info); + + /* Clean up the windows. */ + deleteCursesWindow (mentry->fieldWin); + deleteCursesWindow (mentry->labelWin); + deleteCursesWindow (mentry->shadowWin); + deleteCursesWindow (mentry->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vMENTRY, mentry); + + /* Unregister this object. */ + unregisterCDKObject (vMENTRY, mentry); + } +} + +/* + * This sets multiple attributes of the widget. + */ +void setCDKMentry (CDKMENTRY *mentry, const char *value, int min, boolean Box) +{ + setCDKMentryValue (mentry, value); + setCDKMentryMin (mentry, min); + setCDKMentryBox (mentry, Box); +} + +/* + * This removes the old information in the entry field and keeps the + * new information given. + */ +void setCDKMentryValue (CDKMENTRY *mentry, const char *newValue) +{ + /* *INDENT-EQLS* */ + int fieldCharacters = mentry->rows * mentry->fieldWidth; + int len = 0; + int copychars = 0; + + /* Just to be sure, if lets make sure the new value isn't null. */ + if (newValue == 0) + { + /* Then we want to just erase the old value. */ + cleanChar (mentry->info, mentry->totalWidth, '\0'); + return; + } + + /* Determine how many characters we need to copy. */ + len = (int)strlen (newValue); + copychars = (len < mentry->totalWidth ? len : mentry->totalWidth); + + /* OK, erase the old value, and copy in the new value. */ + cleanChar (mentry->info, mentry->totalWidth, '\0'); + strncpy (mentry->info, newValue, (size_t) copychars); + + /* Set the cursor/row info. */ + if (len < fieldCharacters) + { + mentry->topRow = 0; + mentry->currentRow = len / mentry->fieldWidth; + mentry->currentCol = len % mentry->fieldWidth; + } + else + { + /* *INDENT-EQLS* */ + int rowsUsed = len / mentry->fieldWidth; + mentry->topRow = rowsUsed - mentry->rows + 1; + mentry->currentRow = mentry->rows - 1; + mentry->currentCol = len % mentry->fieldWidth; + } + + /* Redraw the widget. */ + drawCDKMentryField (mentry); +} +char *getCDKMentryValue (CDKMENTRY *mentry) +{ + return mentry->info; +} + +/* + * This sets the filler character to use when drawing the widget. + */ +void setCDKMentryFillerChar (CDKMENTRY *mentry, chtype filler) +{ + mentry->filler = filler; +} +chtype getCDKMentryFillerChar (CDKMENTRY *mentry) +{ + return mentry->filler; +} + +/* + * This sets the character to use when a hidden character type is used. + */ +void setCDKMentryHiddenChar (CDKMENTRY *mentry, chtype character) +{ + mentry->hidden = character; +} +chtype getCDKMentryHiddenChar (CDKMENTRY *mentry) +{ + return mentry->hidden; +} + +/* + * This sets the minimum length of the widget. + */ +void setCDKMentryMin (CDKMENTRY *mentry, int min) +{ + mentry->min = min; +} +int getCDKMentryMin (CDKMENTRY *mentry) +{ + return mentry->min; +} + +/* + * This sets the widgets box attribute. + */ +void setCDKMentryBox (CDKMENTRY *mentry, boolean Box) +{ + ObjOf (mentry)->box = Box; + ObjOf (mentry)->borderSize = Box ? 1 : 0; +} +boolean getCDKMentryBox (CDKMENTRY *mentry) +{ + return ObjOf (mentry)->box; +} + +/* + * This erases the information in the multiple line entry widget. + */ +void cleanCDKMentry (CDKMENTRY *mentry) +{ + cleanChar (mentry->info, mentry->totalWidth, '\0'); + /* *INDENT-EQLS* */ + mentry->currentRow = 0; + mentry->currentCol = 0; + mentry->topRow = 0; +} + +/* + * This sets the callback function. + */ +void setCDKMentryCB (CDKMENTRY *mentry, MENTRYCB callback) +{ + mentry->callbackfn = callback; +} + +static void _focusCDKMentry (CDKOBJS *object) +{ + CDKMENTRY *mentry = (CDKMENTRY *)object; + + wmove (mentry->fieldWin, 0, mentry->currentCol); + wrefresh (mentry->fieldWin); +} + +static void _unfocusCDKMentry (CDKOBJS *object) +{ + CDKMENTRY *mentry = (CDKMENTRY *)object; + + wrefresh (mentry->fieldWin); +} + +dummyRefreshData (Mentry) + +dummySaveData (Mentry) diff --git a/deps/cdk-5.0-20161210/menu.c b/deps/cdk-5.0-20161210/menu.c new file mode 100644 index 0000000..4bb7e1b --- /dev/null +++ b/deps/cdk-5.0-20161210/menu.c @@ -0,0 +1,665 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 18:56:05 $ + * $Revision: 1.105 $ + */ + +#define TITLELINES 1 + +/* + * Declare file local prototypes. + */ +static void cleanUpMenu (CDKMENU *menu); + +DeclareCDKObjects (MENU, Menu, setCdk, Int); + +/* + * This creates a new menu widget. + */ +CDKMENU *newCDKMenu (CDKSCREEN *cdkscreen, + const char *menulist[MAX_MENU_ITEMS][MAX_SUB_ITEMS], + int menuItems, + int *subsize, + int *menuLocation, + int menuPos, + chtype titleAttr, + chtype subtitleAttr) +{ + /* *INDENT-EQLS* */ + CDKMENU *menu = 0; + int rightcount; + int rightloc = getmaxx (cdkscreen->window); + int leftloc = 0; + int x, y, junk; + int xpos = getbegx (cdkscreen->window); + int ypos = getbegy (cdkscreen->window); + int ymax = getmaxy (cdkscreen->window); + + if ((menu = newCDKObject (CDKMENU, &my_funcs)) == 0) + return (0); + + /* *INDENT-EQLS* Start making a copy of the information. */ + ScreenOf (menu) = cdkscreen; + ObjOf (menu)->box = FALSE; + ObjOf (menu)->acceptsFocus = FALSE; + rightcount = menuItems - 1; + menu->parent = cdkscreen->window; + menu->menuItems = menuItems; + menu->titleAttr = titleAttr; + menu->subtitleAttr = subtitleAttr; + menu->currentTitle = 0; + menu->currentSubtitle = 0; + menu->lastSelection = -1; + menu->menuPos = menuPos; + initExitType (menu); + + /* Create the pull down menus. */ + for (x = 0; x < menuItems; x++) + { + /* *INDENT-EQLS* */ + int x1 = (menuLocation[x] == LEFT) ? x : rightcount--; + int x2; + int y1 = (menuPos == BOTTOM) ? (ymax - 1) : 0; + int y2 = (menuPos == BOTTOM) ? (ymax - subsize[x] - 2) : TITLELINES; + int high = subsize[x] + TITLELINES; + int max = -1; + + /* + * Limit the menu height to fit on the screen. + */ + if (high + y2 > ymax) + { + high = ymax - TITLELINES; + } + + max = -1; + for (y = TITLELINES; y < subsize[x]; y++) + { + int y0 = y - TITLELINES; + + menu->sublist[x1][y0] = char2Chtype (menulist[x][y], + &menu->sublistLen[x1][y0], + &junk); + max = MAXIMUM (max, menu->sublistLen[x1][y0]); + } + + if (menuLocation[x] == LEFT) + { + x2 = leftloc; + } + else + { + x2 = (rightloc -= max + 2); + } + /* *INDENT-EQLS* */ + menu->title[x1] = char2Chtype (menulist[x][0], &menu->titleLen[x1], &junk); + menu->subsize[x1] = subsize[x] - TITLELINES; + menu->titleWin[x1] = subwin (cdkscreen->window, + TITLELINES, + menu->titleLen[x1] + 2, + ypos + y1, + xpos + x2); + menu->pullWin[x1] = subwin (cdkscreen->window, + high, + max + 2, + ypos + y2, + xpos + x2); + if (menu->titleWin[x1] == 0 || menu->pullWin[x1] == 0) + { + destroyCDKMenu (menu); + return (0); + } + + leftloc += menu->titleLen[x] + 1; + + keypad (menu->titleWin[x1], TRUE); + keypad (menu->pullWin[x1], TRUE); + } + ObjOf (menu)->inputWindow = menu->titleWin[menu->currentTitle]; + + /* Register this baby. */ + registerCDKObject (cdkscreen, vMENU, menu); + + /* Return the menu object. */ + return (menu); +} + +/* + * This activates the CDK Menu. + */ +int activateCDKMenu (CDKMENU *menu, chtype *actions) +{ + chtype input; + boolean functionKey; + int ret; + + /* Draw in the screen. */ + refreshCDKScreen (ScreenOf (menu)); + + /* Display the menu titles. */ + drawCDKMenu (menu, ObjOf (menu)->box); + + /* Highlight the current title and window. */ + drawCDKMenuSubwin (menu); + + /* If the input string is null, this is an interactive activate. */ + if (actions == 0) + { + ObjOf (menu)->inputWindow = menu->titleWin[menu->currentTitle]; + + /* Start taking input from the keyboard. */ + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (menu), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKMenu (menu, input); + if (menu->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int count = chlen (actions); + int x = 0; + + for (x = 0; x < count; x++) + { + ret = injectCDKMenu (menu, actions[x]); + if (menu->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and return. */ + setExitType (menu, 0); + return -1; +} + +/* + * The "%" operator is simpler but does not handle negative values. + */ +static int wrapped (int within, int limit) +{ + if (within < 0) + within = limit - 1; + else if (within >= limit) + within = 0; + return within; +} + +static void drawTitle (CDKMENU *menu, int item) +{ + writeChtype (menu->titleWin[item], + 0, 0, menu->title[item], + HORIZONTAL, + 0, menu->titleLen[item]); +} + +static void drawItem (CDKMENU *menu, int item, int offset) +{ + writeChtype (menu->pullWin[menu->currentTitle], + 1, item + TITLELINES - offset, + menu->sublist[menu->currentTitle][item], + HORIZONTAL, + 0, menu->sublistLen[menu->currentTitle][item]); +} + +/* Highlight the current sub-menu item. */ +static void selectItem (CDKMENU *menu, int item, int offset) +{ + writeChtypeAttrib (menu->pullWin[menu->currentTitle], + 1, item + TITLELINES - offset, + menu->sublist[menu->currentTitle][item], + menu->subtitleAttr, + HORIZONTAL, + 0, menu->sublistLen[menu->currentTitle][item]); +} + +static void withinSubmenu (CDKMENU *menu, int step) +{ + int next = wrapped (menu->currentSubtitle + step, menu->subsize[menu->currentTitle]); + + if (next != menu->currentSubtitle) + { + CDKSCREEN *screen = ScreenOf (menu); + int ymax = getmaxy (screen->window); + + if ((1 + + getbegy (menu->pullWin[menu->currentTitle]) + + menu->subsize[menu->currentTitle]) >= ymax) + { + menu->currentSubtitle = next; + drawCDKMenuSubwin (menu); + } + else + { + /* Erase the old subtitle. */ + drawItem (menu, menu->currentSubtitle, 0); + + /* Set the values. */ + menu->currentSubtitle = next; + + /* Draw the new sub-title. */ + selectItem (menu, menu->currentSubtitle, 0); + + wrefresh (menu->pullWin[menu->currentTitle]); + } + + ObjOf (menu)->inputWindow = menu->titleWin[menu->currentTitle]; + } +} + +static void acrossSubmenus (CDKMENU *menu, int step) +{ + int next = wrapped (menu->currentTitle + step, menu->menuItems); + + if (next != menu->currentTitle) + { + /* Erase the menu sub-window. */ + eraseCDKMenuSubwin (menu); + refreshCDKScreen (ScreenOf (menu)); + + /* Set the values. */ + menu->currentTitle = next; + menu->currentSubtitle = 0; + + /* Draw the new menu sub-window. */ + drawCDKMenuSubwin (menu); + ObjOf (menu)->inputWindow = menu->titleWin[menu->currentTitle]; + } +} + +/* + * Inject a character into the menu widget. + */ +static int _injectCDKMenu (CDKOBJS *object, chtype input) +{ + CDKMENU *widget = (CDKMENU *)object; + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vMENU, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for key bindings. */ + if (checkCDKObjectBind (vMENU, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_LEFT: + acrossSubmenus (widget, -1); + break; + + case KEY_RIGHT: + case KEY_TAB: + acrossSubmenus (widget, 1); + break; + + case KEY_UP: + withinSubmenu (widget, -1); + break; + + case KEY_DOWN: + case SPACE: + withinSubmenu (widget, 1); + break; + + case KEY_ENTER: + cleanUpMenu (widget); + setExitType (widget, input); + widget->lastSelection = ((widget->currentTitle * 100) + widget->currentSubtitle); + ret = widget->lastSelection; + complete = TRUE; + break; + + case KEY_ESC: + cleanUpMenu (widget); + setExitType (widget, input); + widget->lastSelection = -1; + ret = widget->lastSelection; + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vMENU, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * Draw a menu item subwindow. + */ +void drawCDKMenuSubwin (CDKMENU *menu) +{ + int x; + int high = getmaxy (menu->pullWin[menu->currentTitle]) - 2; + int x0 = 0; + int x1 = menu->subsize[menu->currentTitle]; + + if (x1 > high) + x1 = high; + + if (menu->currentSubtitle >= x1) + { + x0 = (menu->currentSubtitle - x1) + 1; + x1 += x0; + } + + /* Box the window. */ + werase (menu->pullWin[menu->currentTitle]); + box (menu->pullWin[menu->currentTitle], ACS_VLINE, ACS_HLINE); + + if (menu->menuPos == BOTTOM) + { + (void)mvwaddch (menu->pullWin[menu->currentTitle], + menu->subsize[menu->currentTitle] + 1, 0, ACS_LTEE); + } + else + { + (void)mvwaddch (menu->pullWin[menu->currentTitle], 0, 0, ACS_LTEE); + } + + /* Draw the items. */ + for (x = x0; x < x1; x++) + { + drawItem (menu, x, x0); + } + + selectItem (menu, menu->currentSubtitle, x0); + wrefresh (menu->pullWin[menu->currentTitle]); + + /* Highlight the title. */ + writeChtypeAttrib (menu->titleWin[menu->currentTitle], + 0, 0, menu->title[menu->currentTitle], + menu->titleAttr, HORIZONTAL, 0, + menu->titleLen[menu->currentTitle]); + wrefresh (menu->titleWin[menu->currentTitle]); +} + +/* + * Erase a menu item subwindow. + */ +void eraseCDKMenuSubwin (CDKMENU *menu) +{ + eraseCursesWindow (menu->pullWin[menu->currentTitle]); + + /* Redraw the sub-menu title. */ + drawTitle (menu, menu->currentTitle); + wrefresh (menu->titleWin[menu->currentTitle]); +} + +/* + * Draw the menu. + */ +static void _drawCDKMenu (CDKOBJS *object, boolean Box GCC_UNUSED) +{ + CDKMENU *menu = (CDKMENU *)object; + int x; + + /* Draw in the menu titles. */ + for (x = 0; x < menu->menuItems; x++) + { + drawTitle (menu, x); + wrefresh (menu->titleWin[x]); + } +} + +/* + * Move the menu to the given location. + */ +static void _moveCDKMenu (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKMENU *menu = (CDKMENU *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (WindowOf (menu)); + int currentY = getbegy (WindowOf (menu)); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + int x; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (WindowOf (menu)) + xplace; + ypos = getbegy (WindowOf (menu)) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (menu), + &xpos, + &ypos, + getmaxx (WindowOf (menu)), + getmaxy (WindowOf (menu))); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the windows to the new location. */ + moveCursesWindow (WindowOf (menu), -xdiff, -ydiff); + for (x = 0; x < menu->menuItems; x++) + { + moveCursesWindow (menu->titleWin[x], -xdiff, -ydiff); + } + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (menu)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKMenu (menu, ObjOf (menu)->box); + } +} + +/* + * Set the background attribute of the widget. + */ +static void _setBKattrMenu (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKMENU *widget = (CDKMENU *)object; + int x; + + for (x = 0; x < widget->menuItems; x++) + { + wbkgd (widget->titleWin[x], attrib); + wbkgd (widget->pullWin[x], attrib); + } + } +} + +/* + * Destroy a menu widget. + */ +static void _destroyCDKMenu (CDKOBJS *object) +{ + if (object != 0) + { + CDKMENU *menu = (CDKMENU *)object; + int x, y; + + /* Clean up both the winodws and the char pointers. */ + for (x = 0; x < menu->menuItems; x++) + { + /* Clean the windows. */ + deleteCursesWindow (menu->titleWin[x]); + deleteCursesWindow (menu->pullWin[x]); + + /* Delete the character pointers. */ + freeChtype (menu->title[x]); + for (y = 0; y < menu->subsize[x]; y++) + { + freeChtype (menu->sublist[x][y]); + } + } + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vMENU, menu); + + /* Unregister this object. */ + unregisterCDKObject (vMENU, menu); + } +} + +/* + * Erase the menu widget from the screen. + */ +static void _eraseCDKMenu (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKMENU *menu = (CDKMENU *)object; + int x = 0; + + for (x = 0; x < menu->menuItems; x++) + { + werase (menu->titleWin[x]); + wrefresh (menu->titleWin[x]); + werase (menu->pullWin[x]); + wrefresh (menu->pullWin[x]); + } + } +} + +/* + * Set multiple features of the menu. + */ +void setCDKMenu (CDKMENU *menu, + int menuItem, + int subMenuItem, + chtype titleHighlight, + chtype subTitleHighlight) +{ + setCDKMenuCurrentItem (menu, menuItem, subMenuItem); + setCDKMenuTitleHighlight (menu, titleHighlight); + setCDKMenuSubTitleHighlight (menu, subTitleHighlight); +} + +/* + * Set the current menu item to highlight. + */ +void setCDKMenuCurrentItem (CDKMENU *menu, int menuitem, int submenuitem) +{ + /* *INDENT-EQLS* */ + menu->currentTitle = wrapped (menuitem, menu->menuItems); + menu->currentSubtitle = wrapped (submenuitem, menu->subsize[menu->currentTitle]); +} +void getCDKMenuCurrentItem (CDKMENU *menu, int *menuItem, int *subMenuItem) +{ + /* *INDENT-EQLS* */ + (*menuItem) = menu->currentTitle; + (*subMenuItem) = menu->currentSubtitle; +} + +/* + * Set the attribute of the menu titles. + */ +void setCDKMenuTitleHighlight (CDKMENU *menu, chtype highlight) +{ + menu->titleAttr = highlight; +} +chtype getCDKMenuTitleHighlight (CDKMENU *menu) +{ + return menu->titleAttr; +} + +/* + * Set the attribute of the sub-title. + */ +void setCDKMenuSubTitleHighlight (CDKMENU *menu, chtype highlight) +{ + menu->subtitleAttr = highlight; +} +chtype getCDKMenuSubTitleHighlight (CDKMENU *menu) +{ + return menu->subtitleAttr; +} + +/* + * Exit the menu. + */ +static void cleanUpMenu (CDKMENU *menu) +{ + /* Erase the sub-menu. */ + eraseCDKMenuSubwin (menu); + wrefresh (menu->pullWin[menu->currentTitle]); + + /* Refresh the screen. */ + refreshCDKScreen (ScreenOf (menu)); +} + +static void _focusCDKMenu (CDKOBJS *object) +{ + CDKMENU *menu = (CDKMENU *)object; + + drawCDKMenuSubwin (menu); + ObjOf (menu)->inputWindow = menu->titleWin[menu->currentTitle]; +} + +dummyUnfocus (Menu) + +dummyRefreshData (Menu) + +dummySaveData (Menu) diff --git a/deps/cdk-5.0-20161210/package/cdk.map b/deps/cdk-5.0-20161210/package/cdk.map new file mode 100644 index 0000000..39115b1 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/cdk.map @@ -0,0 +1,566 @@ +/* + * $Id: cdk.map,v 1.3 2014/11/02 23:08:51 tom Exp $ + * script for shared library versioning + */ + +/* 2004/10/04 */ +CDK_2.0.0 { + global: + Beep; + CDKDEBUG; + CDKVersion; + CDKallocStrings; + CDKcountStrings; + CDKfreeChtypes; + CDKfreeStrings; + CDKgetDirectoryContents; + CDKparamNumber; + CDKparamNumber2; + CDKparamString; + CDKparamString2; + CDKparamValue; + CDKparseParams; + CDKparsePosition; + CDKreadFile; + CDKsplitString; + GPasteBuffer; + _destroyCDKObject; + _newCDKObject; + activateCDKAlphalist; + activateCDKButton; + activateCDKButtonbox; + activateCDKCalendar; + activateCDKDScale; + activateCDKDialog; + activateCDKEntry; + activateCDKFScale; + activateCDKFSlider; + activateCDKFselect; + activateCDKGraph; + activateCDKHistogram; + activateCDKItemlist; + activateCDKLabel; + activateCDKMarquee; + activateCDKMatrix; + activateCDKMentry; + activateCDKMenu; + activateCDKRadio; + activateCDKScale; + activateCDKScroll; + activateCDKSelection; + activateCDKSlider; + activateCDKSwindow; + activateCDKTemplate; + activateCDKUScale; + activateCDKUSlider; + activateCDKViewer; + addCDKScrollItem; + addCDKSwindow; + alignxy; + attrbox; + baseName; + bindCDKObject; + boxWindow; + ceilCDK; + char2Chtype; + char2DisplayType; + checkCDKObjectBind; + checkForLink; + chlen; + chstrncpy; + chtype2Char; + chtype2String; + cleanCDKEntry; + cleanCDKMatrix; + cleanCDKMatrixCell; + cleanCDKMentry; + cleanCDKObjectBindings; + cleanCDKSwindow; + cleanCDKTemplate; + cleanCDKViewer; + cleanCdkTitle; + cleanChar; + cleanChtype; + cmpStrChstr; + copyChar; + copyChtype; + deactivateCDKMarquee; + deleteCDKScrollItem; + deleteCursesWindow; + deleteFileCB; + destroyCDKScreen; + destroyCDKScreenObjects; + dirName; + drawCDKButtonboxButtons; + drawCDKDialogButtons; + drawCDKItemlistField; + drawCDKMentryField; + drawCDKMenuSubwin; + drawCDKScreen; + drawCdkTitle; + drawLine; + drawObjBox; + drawShadow; + dumpCDKSwindow; + endCDK; + eraseCDKMenuSubwin; + eraseCDKScreen; + eraseCursesWindow; + execCDKSwindow; + exitCancelCDKScreen; + exitCancelCDKScreenOf; + exitOKCDKScreen; + exitOKCDKScreenOf; + floorCDK; + freeChar; + freeCharList; + freeChtype; + freeChtypeList; + getCDKAlphalistBox; + getCDKAlphalistContents; + getCDKAlphalistFillerChar; + getCDKAlphalistHighlight; + getCDKButtonBox; + getCDKButtonMessage; + getCDKButtonboxBox; + getCDKButtonboxButtonCount; + getCDKButtonboxCurrentButton; + getCDKButtonboxHighlight; + getCDKCalendarBox; + getCDKCalendarDate; + getCDKCalendarDayAttribute; + getCDKCalendarHighlight; + getCDKCalendarMarker; + getCDKCalendarMonthAttribute; + getCDKCalendarYearAttribute; + getCDKDScaleBox; + getCDKDScaleDigits; + getCDKDScaleHighValue; + getCDKDScaleLowValue; + getCDKDScaleValue; + getCDKDialogBox; + getCDKDialogHighlight; + getCDKDialogSeparator; + getCDKEntryBox; + getCDKEntryFillerChar; + getCDKEntryHiddenChar; + getCDKEntryMax; + getCDKEntryMin; + getCDKEntryValue; + getCDKFScaleBox; + getCDKFScaleDigits; + getCDKFScaleHighValue; + getCDKFScaleLowValue; + getCDKFScaleValue; + getCDKFSliderBox; + getCDKFSliderDigits; + getCDKFSliderHighValue; + getCDKFSliderLowValue; + getCDKFSliderValue; + getCDKFocusCurrent; + getCDKFselectBox; + getCDKFselectDirAttribute; + getCDKFselectDirContents; + getCDKFselectDirectory; + getCDKFselectFileAttribute; + getCDKFselectFillerChar; + getCDKFselectHighlight; + getCDKFselectLinkAttribute; + getCDKFselectSocketAttribute; + getCDKGraphBox; + getCDKGraphCharacter; + getCDKGraphCharacters; + getCDKGraphDisplayType; + getCDKGraphValue; + getCDKGraphValues; + getCDKHistogramBox; + getCDKHistogramFillerChar; + getCDKHistogramHighValue; + getCDKHistogramLowValue; + getCDKHistogramStatsAttr; + getCDKHistogramStatsPos; + getCDKHistogramValue; + getCDKHistogramViewType; + getCDKItemlistBox; + getCDKItemlistCurrentItem; + getCDKItemlistDefaultItem; + getCDKItemlistValues; + getCDKLabelBox; + getCDKLabelMessage; + getCDKMarqueeBox; + getCDKMatrixBox; + getCDKMatrixCell; + getCDKMatrixCol; + getCDKMatrixRow; + getCDKMentryBox; + getCDKMentryFillerChar; + getCDKMentryHiddenChar; + getCDKMentryMin; + getCDKMentryValue; + getCDKMenuCurrentItem; + getCDKMenuSubTitleHighlight; + getCDKMenuTitleHighlight; + getCDKRadioBox; + getCDKRadioChoiceCharacter; + getCDKRadioCurrentItem; + getCDKRadioHighlight; + getCDKRadioItems; + getCDKRadioLeftBrace; + getCDKRadioRightBrace; + getCDKScaleBox; + getCDKScaleHighValue; + getCDKScaleLowValue; + getCDKScaleValue; + getCDKScrollBox; + getCDKScrollCurrent; + getCDKScrollHighlight; + getCDKScrollItems; + getCDKSelectionBox; + getCDKSelectionChoice; + getCDKSelectionChoices; + getCDKSelectionCurrent; + getCDKSelectionHighlight; + getCDKSelectionItems; + getCDKSelectionMode; + getCDKSelectionModes; + getCDKSelectionTitle; + getCDKSliderBox; + getCDKSliderHighValue; + getCDKSliderLowValue; + getCDKSliderValue; + getCDKSwindowBox; + getCDKSwindowContents; + getCDKTemplateBox; + getCDKTemplateMin; + getCDKTemplateValue; + getCDKUScaleBox; + getCDKUScaleHighValue; + getCDKUScaleLowValue; + getCDKUScaleValue; + getCDKUSliderBox; + getCDKUSliderHighValue; + getCDKUSliderLowValue; + getCDKUSliderValue; + getCDKViewerBox; + getCDKViewerHighlight; + getCDKViewerInfo; + getCDKViewerInfoLine; + getCDKViewerTitle; + getDirectoryContents; + getListIndex; + getString; + getcCDKBind; + getcCDKObject; + initCDKColor; + initCDKScreen; + intlen; + jumpToCell; + jumpToLineCDKSwindow; + justifyString; + loadCDKSwindowInformation; + lowerCDKObject; + mixCDKTemplate; + mode2Char; + mode2Filetype; + moveCursesWindow; + moveToCDKMatrixCell; + newCDKAlphalist; + newCDKButton; + newCDKButtonbox; + newCDKCalendar; + newCDKDScale; + newCDKDialog; + newCDKEntry; + newCDKFScale; + newCDKFSlider; + newCDKFselect; + newCDKGraph; + newCDKHistogram; + newCDKItemlist; + newCDKLabel; + newCDKMarquee; + newCDKMatrix; + newCDKMentry; + newCDKMenu; + newCDKRadio; + newCDKScale; + newCDKScroll; + newCDKSelection; + newCDKSlider; + newCDKSwindow; + newCDKTemplate; + newCDKUScale; + newCDKUSlider; + newCDKViewer; + popupDialog; + popupLabel; + popupLabelAttrib; + positionCDKButton; + positionCDKObject; + raiseCDKObject; + readFile; + refreshCDKScreen; + refreshCDKWindow; + registerCDKObject; + removeCDKCalendarMarker; + resetCDKScreen; + resetCDKScreenOf; + saveCDKSwindowInformation; + searchList; + selectFile; + setCDKAlphalist; + setCDKAlphalistBox; + setCDKAlphalistContents; + setCDKAlphalistFillerChar; + setCDKAlphalistHighlight; + setCDKAlphalistPostProcess; + setCDKAlphalistPreProcess; + setCDKButton; + setCDKButtonBox; + setCDKButtonMessage; + setCDKButtonbox; + setCDKButtonboxBox; + setCDKButtonboxCurrentButton; + setCDKButtonboxHighlight; + setCDKCalendar; + setCDKCalendarBox; + setCDKCalendarDate; + setCDKCalendarDayAttribute; + setCDKCalendarDaysNames; + setCDKCalendarHighlight; + setCDKCalendarMarker; + setCDKCalendarMonthAttribute; + setCDKCalendarMonthsNames; + setCDKCalendarYearAttribute; + setCDKDScale; + setCDKDScaleBox; + setCDKDScaleDigits; + setCDKDScaleLowHigh; + setCDKDScaleValue; + setCDKDialog; + setCDKDialogBox; + setCDKDialogHighlight; + setCDKDialogSeparator; + setCDKEntry; + setCDKEntryBox; + setCDKEntryCB; + setCDKEntryFillerChar; + setCDKEntryHiddenChar; + setCDKEntryHighlight; + setCDKEntryMax; + setCDKEntryMin; + setCDKEntryValue; + setCDKFScale; + setCDKFScaleBox; + setCDKFScaleDigits; + setCDKFScaleLowHigh; + setCDKFScaleValue; + setCDKFSlider; + setCDKFSliderBox; + setCDKFSliderDigits; + setCDKFSliderLowHigh; + setCDKFSliderValue; + setCDKFocusNext; + setCDKFocusPrevious; + setCDKFselect; + setCDKFselectBox; + setCDKFselectDirAttribute; + setCDKFselectDirContents; + setCDKFselectDirectory; + setCDKFselectFileAttribute; + setCDKFselectFillerChar; + setCDKFselectHighlight; + setCDKFselectLinkAttribute; + setCDKFselectPostProcess; + setCDKFselectPreProcess; + setCDKFselectSocketAttribute; + setCDKGraph; + setCDKGraphBox; + setCDKGraphCharacter; + setCDKGraphCharacters; + setCDKGraphDisplayType; + setCDKGraphValue; + setCDKGraphValues; + setCDKHistogram; + setCDKHistogramBox; + setCDKHistogramDisplayType; + setCDKHistogramFillerChar; + setCDKHistogramStatsAttr; + setCDKHistogramStatsPos; + setCDKHistogramValue; + setCDKItemlist; + setCDKItemlistBox; + setCDKItemlistCurrentItem; + setCDKItemlistDefaultItem; + setCDKItemlistValues; + setCDKLabel; + setCDKLabelBox; + setCDKLabelMessage; + setCDKMarqueeBox; + setCDKMatrixBox; + setCDKMatrixCell; + setCDKMatrixCells; + setCDKMentry; + setCDKMentryBox; + setCDKMentryCB; + setCDKMentryFillerChar; + setCDKMentryHiddenChar; + setCDKMentryMin; + setCDKMentryValue; + setCDKMenu; + setCDKMenuCurrentItem; + setCDKMenuSubTitleHighlight; + setCDKMenuTitleHighlight; + setCDKObjectBackgroundColor; + setCDKObjectPostProcess; + setCDKObjectPreProcess; + setCDKRadio; + setCDKRadioBox; + setCDKRadioChoiceCharacter; + setCDKRadioCurrentItem; + setCDKRadioHighlight; + setCDKRadioItems; + setCDKRadioLeftBrace; + setCDKRadioRightBrace; + setCDKScale; + setCDKScaleBox; + setCDKScaleLowHigh; + setCDKScaleValue; + setCDKScroll; + setCDKScrollBox; + setCDKScrollCurrent; + setCDKScrollHighlight; + setCDKScrollItems; + setCDKScrollPosition; + setCDKSelection; + setCDKSelectionBox; + setCDKSelectionChoice; + setCDKSelectionChoices; + setCDKSelectionCurrent; + setCDKSelectionHighlight; + setCDKSelectionItems; + setCDKSelectionMode; + setCDKSelectionModes; + setCDKSelectionTitle; + setCDKSlider; + setCDKSliderBox; + setCDKSliderLowHigh; + setCDKSliderValue; + setCDKSwindow; + setCDKSwindowBox; + setCDKSwindowContents; + setCDKTemplate; + setCDKTemplateBox; + setCDKTemplateCB; + setCDKTemplateMin; + setCDKTemplateValue; + setCDKUScale; + setCDKUScaleBox; + setCDKUScaleLowHigh; + setCDKUScaleValue; + setCDKUSlider; + setCDKUSliderBox; + setCDKUSliderLowHigh; + setCDKUSliderValue; + setCDKViewer; + setCDKViewerBox; + setCDKViewerHighlight; + setCDKViewerInfo; + setCDKViewerInfoLine; + setCDKViewerTitle; + setCdkBXattr; + setCdkExitType; + setCdkHZchar; + setCdkLLchar; + setCdkLRchar; + setCdkTitle; + setCdkULchar; + setCdkURchar; + setCdkVTchar; + setWidgetDimension; + sortList; + splitString; + startCDKDebug; + stopCDKDebug; + stripWhiteSpace; + traverseCDKScreen; + trimCDKSwindow; + unbindCDKObject; + unmixCDKTemplate; + unregisterCDKObject; + validCDKObject; + viewFile; + viewInfo; + waitCDKLabel; + writeBlanks; + writeCDKDebugMessage; + writeChar; + writeCharAttrib; + writeChtype; + writeChtypeAttrib; + local: _*; +}; + +/* 2005/03/08 */ +CDK_2.3.1 { + global: + isCDKObjectBind; +} CDK_2.0.0; + +/* 2005/03/23 */ +CDK_2.4.1 { + global: + insertCDKScrollItem; +} CDK_2.3.1; + +/* 2006/02/20 */ +CDK_3.1.2 { + global: + getCDKRadioSelectedItem; + getchCDKObject; + setCDKFocusCurrent; + setCDKFocusFirst; + setCDKFocusLast; + setCDKMatrixCB; + setCDKRadioSelectedItem; + traverseCDKOnce; +} CDK_2.4.1; + +/* 2006/05/07 */ +CDK_4.0.3 { + global: + copyCharList; + copyChtypeList; + filterByDisplayType; + getCDKAlphalistCurrentItem; + getCDKFselectContents; + getCDKFselectCurrentItem; + getCDKScrollCurrentItem; + getCDKScrollCurrentTop; + isHiddenDisplayType; + lenCharList; + lenChtypeList; + setCDKAlphalistCurrentItem; + setCDKFselectContents; + setCDKFselectCurrentItem; + setCDKScrollCurrentItem; + setCDKScrollCurrentTop; +} CDK_3.1.2; + +/* 2013/09/01 */ +CDK_5.0.4 { + global: + scroller_FixCursorPosition; + scroller_KEY_DOWN; + scroller_KEY_END; + scroller_KEY_HOME; + scroller_KEY_LEFT; + scroller_KEY_NPAGE; + scroller_KEY_PPAGE; + scroller_KEY_RIGHT; + scroller_KEY_UP; + scroller_MaxViewSize; + scroller_SetPosition; + scroller_SetViewSize; +} CDK_4.0.3; + diff --git a/deps/cdk-5.0-20161210/package/cdk.spec b/deps/cdk-5.0-20161210/package/cdk.spec new file mode 100644 index 0000000..b5e4121 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/cdk.spec @@ -0,0 +1,90 @@ +# $Id: cdk.spec,v 1.43 2016/12/10 13:04:19 tom Exp $ +Summary: Curses Development Kit +%define AppProgram cdk +%define AppVersion 5.0 +%define AppRelease 20161210 +Name: %{AppProgram} +Version: %{AppVersion} +Release: %{AppRelease} +License: BSD (4-clause) +Group: Development/Libraries +URL: http://invisible-island.net/%{name}/ +Source0: %{name}-%{version}-%{release}.tgz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# BuildRequires: ncurses-devel + +%description +Cdk stands for "Curses Development Kit". It contains a large number of ready +to use widgets which facilitate the speedy development of full screen curses +programs. + +%package devel +Summary: Curses Development Kit +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Development headers for cdk (Curses Development Kit) + +%prep +%define debug_package %{nil} +%setup -q -n %{name}-%{version}-%{release} + +%build +%configure +make all +find . -name '*.o' -exec rm -f {} \; + +%configure --with-shared --with-versioned-syms +#make %{?_smp_mflags} cdkshlib +make all + +%install +rm -rf $RPM_BUILD_ROOT +make install.libs install \ + DESTDIR=$RPM_BUILD_ROOT \ + DOCUMENT_DIR=$RPM_BUILD_ROOT%{_defaultdocdir}/%{name} +ls -l $RPM_BUILD_ROOT%{_libdir} +chmod +x $RPM_BUILD_ROOT%{_libdir}/*.so # fixes rpmlint unstripped-binary-or-object +install -m 644 libcdk.a $RPM_BUILD_ROOT%{_libdir} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%doc CHANGES COPYING INSTALL NOTES README VERSION +%{_libdir}/*.so.* +%exclude %{_libdir}/*.a +%exclude %{_mandir}/man3/* +%{_defaultdocdir}/%{name}/* + +%files devel +%defattr(-,root,root,-) +%doc EXPANDING TODO examples demos +%{_libdir}/*.a +%{_libdir}/*.so +%{_bindir}/cdk5-config +%{_mandir}/man3/* +%{_includedir}/%{name}.h +%{_includedir}/%{name} + +%changelog + +* Wed Nov 05 2014 Thomas E. Dickey +- move manpages to -devel package + +* Sun Nov 02 2014 Thomas E. Dickey +- change shared library configuration to use --with-shared option + +* Tue Mar 20 2012 Thomas E. Dickey +- install cdk.h in normal location + +* Fri May 13 2011 Thomas E. Dickey +- parameterize/adapt to building from unpatched sources as part of test builds + +* Sun Jan 4 2009 Marek Mahut - 5.0.20081105-1 +- Initial build diff --git a/deps/cdk-5.0-20161210/package/cdk.sym b/deps/cdk-5.0-20161210/package/cdk.sym new file mode 100644 index 0000000..2d66ca9 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/cdk.sym @@ -0,0 +1,531 @@ +# $Id: cdk.sym,v 1.1 2014/11/02 19:57:43 tom Exp $ +Beep +CDKDEBUG +CDKVersion +CDKallocStrings +CDKcountStrings +CDKfreeChtypes +CDKfreeStrings +CDKgetDirectoryContents +CDKparamNumber +CDKparamNumber2 +CDKparamString +CDKparamString2 +CDKparamValue +CDKparseParams +CDKparsePosition +CDKreadFile +CDKsplitString +GPasteBuffer +_destroyCDKObject +_newCDKObject +activateCDKAlphalist +activateCDKButton +activateCDKButtonbox +activateCDKCalendar +activateCDKDScale +activateCDKDialog +activateCDKEntry +activateCDKFScale +activateCDKFSlider +activateCDKFselect +activateCDKGraph +activateCDKHistogram +activateCDKItemlist +activateCDKLabel +activateCDKMarquee +activateCDKMatrix +activateCDKMentry +activateCDKMenu +activateCDKRadio +activateCDKScale +activateCDKScroll +activateCDKSelection +activateCDKSlider +activateCDKSwindow +activateCDKTemplate +activateCDKUScale +activateCDKUSlider +activateCDKViewer +addCDKScrollItem +addCDKSwindow +alignxy +attrbox +baseName +bindCDKObject +boxWindow +ceilCDK +char2Chtype +char2DisplayType +checkCDKObjectBind +checkForLink +chlen +chstrncpy +chtype2Char +chtype2String +cleanCDKEntry +cleanCDKMatrix +cleanCDKMatrixCell +cleanCDKMentry +cleanCDKObjectBindings +cleanCDKSwindow +cleanCDKTemplate +cleanCDKViewer +cleanCdkTitle +cleanChar +cleanChtype +cmpStrChstr +copyChar +copyCharList +copyChtype +copyChtypeList +deactivateCDKMarquee +deleteCDKScrollItem +deleteCursesWindow +deleteFileCB +destroyCDKScreen +destroyCDKScreenObjects +dirName +drawCDKButtonboxButtons +drawCDKDialogButtons +drawCDKItemlistField +drawCDKMentryField +drawCDKMenuSubwin +drawCDKScreen +drawCdkTitle +drawLine +drawObjBox +drawShadow +dumpCDKSwindow +endCDK +eraseCDKMenuSubwin +eraseCDKScreen +eraseCursesWindow +execCDKSwindow +exitCancelCDKScreen +exitCancelCDKScreenOf +exitOKCDKScreen +exitOKCDKScreenOf +filterByDisplayType +floorCDK +freeChar +freeCharList +freeChtype +freeChtypeList +getCDKAlphalistBox +getCDKAlphalistContents +getCDKAlphalistCurrentItem +getCDKAlphalistFillerChar +getCDKAlphalistHighlight +getCDKButtonBox +getCDKButtonMessage +getCDKButtonboxBox +getCDKButtonboxButtonCount +getCDKButtonboxCurrentButton +getCDKButtonboxHighlight +getCDKCalendarBox +getCDKCalendarDate +getCDKCalendarDayAttribute +getCDKCalendarHighlight +getCDKCalendarMarker +getCDKCalendarMonthAttribute +getCDKCalendarYearAttribute +getCDKDScaleBox +getCDKDScaleDigits +getCDKDScaleHighValue +getCDKDScaleLowValue +getCDKDScaleValue +getCDKDialogBox +getCDKDialogHighlight +getCDKDialogSeparator +getCDKEntryBox +getCDKEntryFillerChar +getCDKEntryHiddenChar +getCDKEntryMax +getCDKEntryMin +getCDKEntryValue +getCDKFScaleBox +getCDKFScaleDigits +getCDKFScaleHighValue +getCDKFScaleLowValue +getCDKFScaleValue +getCDKFSliderBox +getCDKFSliderDigits +getCDKFSliderHighValue +getCDKFSliderLowValue +getCDKFSliderValue +getCDKFocusCurrent +getCDKFselectBox +getCDKFselectContents +getCDKFselectCurrentItem +getCDKFselectDirAttribute +getCDKFselectDirContents +getCDKFselectDirectory +getCDKFselectFileAttribute +getCDKFselectFillerChar +getCDKFselectHighlight +getCDKFselectLinkAttribute +getCDKFselectSocketAttribute +getCDKGraphBox +getCDKGraphCharacter +getCDKGraphCharacters +getCDKGraphDisplayType +getCDKGraphValue +getCDKGraphValues +getCDKHistogramBox +getCDKHistogramFillerChar +getCDKHistogramHighValue +getCDKHistogramLowValue +getCDKHistogramStatsAttr +getCDKHistogramStatsPos +getCDKHistogramValue +getCDKHistogramViewType +getCDKItemlistBox +getCDKItemlistCurrentItem +getCDKItemlistDefaultItem +getCDKItemlistValues +getCDKLabelBox +getCDKLabelMessage +getCDKMarqueeBox +getCDKMatrixBox +getCDKMatrixCell +getCDKMatrixCol +getCDKMatrixRow +getCDKMentryBox +getCDKMentryFillerChar +getCDKMentryHiddenChar +getCDKMentryMin +getCDKMentryValue +getCDKMenuCurrentItem +getCDKMenuSubTitleHighlight +getCDKMenuTitleHighlight +getCDKRadioBox +getCDKRadioChoiceCharacter +getCDKRadioCurrentItem +getCDKRadioHighlight +getCDKRadioItems +getCDKRadioLeftBrace +getCDKRadioRightBrace +getCDKRadioSelectedItem +getCDKScaleBox +getCDKScaleHighValue +getCDKScaleLowValue +getCDKScaleValue +getCDKScrollBox +getCDKScrollCurrent +getCDKScrollCurrentItem +getCDKScrollCurrentTop +getCDKScrollHighlight +getCDKScrollItems +getCDKSelectionBox +getCDKSelectionChoice +getCDKSelectionChoices +getCDKSelectionCurrent +getCDKSelectionHighlight +getCDKSelectionItems +getCDKSelectionMode +getCDKSelectionModes +getCDKSelectionTitle +getCDKSliderBox +getCDKSliderHighValue +getCDKSliderLowValue +getCDKSliderValue +getCDKSwindowBox +getCDKSwindowContents +getCDKTemplateBox +getCDKTemplateMin +getCDKTemplateValue +getCDKUScaleBox +getCDKUScaleHighValue +getCDKUScaleLowValue +getCDKUScaleValue +getCDKUSliderBox +getCDKUSliderHighValue +getCDKUSliderLowValue +getCDKUSliderValue +getCDKViewerBox +getCDKViewerHighlight +getCDKViewerInfo +getCDKViewerInfoLine +getCDKViewerTitle +getDirectoryContents +getListIndex +getString +getcCDKBind +getcCDKObject +getchCDKObject +initCDKColor +initCDKScreen +insertCDKScrollItem +intlen +isCDKObjectBind +isHiddenDisplayType +jumpToCell +jumpToLineCDKSwindow +justifyString +lenCharList +lenChtypeList +loadCDKSwindowInformation +lowerCDKObject +mixCDKTemplate +mode2Char +mode2Filetype +moveCursesWindow +moveToCDKMatrixCell +newCDKAlphalist +newCDKButton +newCDKButtonbox +newCDKCalendar +newCDKDScale +newCDKDialog +newCDKEntry +newCDKFScale +newCDKFSlider +newCDKFselect +newCDKGraph +newCDKHistogram +newCDKItemlist +newCDKLabel +newCDKMarquee +newCDKMatrix +newCDKMentry +newCDKMenu +newCDKRadio +newCDKScale +newCDKScroll +newCDKSelection +newCDKSlider +newCDKSwindow +newCDKTemplate +newCDKUScale +newCDKUSlider +newCDKViewer +popupDialog +popupLabel +popupLabelAttrib +positionCDKButton +positionCDKObject +raiseCDKObject +readFile +refreshCDKScreen +refreshCDKWindow +registerCDKObject +removeCDKCalendarMarker +resetCDKScreen +resetCDKScreenOf +saveCDKSwindowInformation +scroller_FixCursorPosition +scroller_KEY_DOWN +scroller_KEY_END +scroller_KEY_HOME +scroller_KEY_LEFT +scroller_KEY_NPAGE +scroller_KEY_PPAGE +scroller_KEY_RIGHT +scroller_KEY_UP +scroller_MaxViewSize +scroller_SetPosition +scroller_SetViewSize +searchList +selectFile +setCDKAlphalist +setCDKAlphalistBox +setCDKAlphalistContents +setCDKAlphalistCurrentItem +setCDKAlphalistFillerChar +setCDKAlphalistHighlight +setCDKAlphalistPostProcess +setCDKAlphalistPreProcess +setCDKButton +setCDKButtonBox +setCDKButtonMessage +setCDKButtonbox +setCDKButtonboxBox +setCDKButtonboxCurrentButton +setCDKButtonboxHighlight +setCDKCalendar +setCDKCalendarBox +setCDKCalendarDate +setCDKCalendarDayAttribute +setCDKCalendarDaysNames +setCDKCalendarHighlight +setCDKCalendarMarker +setCDKCalendarMonthAttribute +setCDKCalendarMonthsNames +setCDKCalendarYearAttribute +setCDKDScale +setCDKDScaleBox +setCDKDScaleDigits +setCDKDScaleLowHigh +setCDKDScaleValue +setCDKDialog +setCDKDialogBox +setCDKDialogHighlight +setCDKDialogSeparator +setCDKEntry +setCDKEntryBox +setCDKEntryCB +setCDKEntryFillerChar +setCDKEntryHiddenChar +setCDKEntryHighlight +setCDKEntryMax +setCDKEntryMin +setCDKEntryValue +setCDKFScale +setCDKFScaleBox +setCDKFScaleDigits +setCDKFScaleLowHigh +setCDKFScaleValue +setCDKFSlider +setCDKFSliderBox +setCDKFSliderDigits +setCDKFSliderLowHigh +setCDKFSliderValue +setCDKFocusCurrent +setCDKFocusFirst +setCDKFocusLast +setCDKFocusNext +setCDKFocusPrevious +setCDKFselect +setCDKFselectBox +setCDKFselectContents +setCDKFselectCurrentItem +setCDKFselectDirAttribute +setCDKFselectDirContents +setCDKFselectDirectory +setCDKFselectFileAttribute +setCDKFselectFillerChar +setCDKFselectHighlight +setCDKFselectLinkAttribute +setCDKFselectPostProcess +setCDKFselectPreProcess +setCDKFselectSocketAttribute +setCDKGraph +setCDKGraphBox +setCDKGraphCharacter +setCDKGraphCharacters +setCDKGraphDisplayType +setCDKGraphValue +setCDKGraphValues +setCDKHistogram +setCDKHistogramBox +setCDKHistogramDisplayType +setCDKHistogramFillerChar +setCDKHistogramStatsAttr +setCDKHistogramStatsPos +setCDKHistogramValue +setCDKItemlist +setCDKItemlistBox +setCDKItemlistCurrentItem +setCDKItemlistDefaultItem +setCDKItemlistValues +setCDKLabel +setCDKLabelBox +setCDKLabelMessage +setCDKMarqueeBox +setCDKMatrixBox +setCDKMatrixCB +setCDKMatrixCell +setCDKMatrixCells +setCDKMentry +setCDKMentryBox +setCDKMentryCB +setCDKMentryFillerChar +setCDKMentryHiddenChar +setCDKMentryMin +setCDKMentryValue +setCDKMenu +setCDKMenuCurrentItem +setCDKMenuSubTitleHighlight +setCDKMenuTitleHighlight +setCDKObjectBackgroundColor +setCDKObjectPostProcess +setCDKObjectPreProcess +setCDKRadio +setCDKRadioBox +setCDKRadioChoiceCharacter +setCDKRadioCurrentItem +setCDKRadioHighlight +setCDKRadioItems +setCDKRadioLeftBrace +setCDKRadioRightBrace +setCDKRadioSelectedItem +setCDKScale +setCDKScaleBox +setCDKScaleLowHigh +setCDKScaleValue +setCDKScroll +setCDKScrollBox +setCDKScrollCurrent +setCDKScrollCurrentItem +setCDKScrollCurrentTop +setCDKScrollHighlight +setCDKScrollItems +setCDKScrollPosition +setCDKSelection +setCDKSelectionBox +setCDKSelectionChoice +setCDKSelectionChoices +setCDKSelectionCurrent +setCDKSelectionHighlight +setCDKSelectionItems +setCDKSelectionMode +setCDKSelectionModes +setCDKSelectionTitle +setCDKSlider +setCDKSliderBox +setCDKSliderLowHigh +setCDKSliderValue +setCDKSwindow +setCDKSwindowBox +setCDKSwindowContents +setCDKTemplate +setCDKTemplateBox +setCDKTemplateCB +setCDKTemplateMin +setCDKTemplateValue +setCDKUScale +setCDKUScaleBox +setCDKUScaleLowHigh +setCDKUScaleValue +setCDKUSlider +setCDKUSliderBox +setCDKUSliderLowHigh +setCDKUSliderValue +setCDKViewer +setCDKViewerBox +setCDKViewerHighlight +setCDKViewerInfo +setCDKViewerInfoLine +setCDKViewerTitle +setCdkBXattr +setCdkExitType +setCdkHZchar +setCdkLLchar +setCdkLRchar +setCdkTitle +setCdkULchar +setCdkURchar +setCdkVTchar +setWidgetDimension +sortList +splitString +startCDKDebug +stopCDKDebug +stripWhiteSpace +traverseCDKOnce +traverseCDKScreen +trimCDKSwindow +unbindCDKObject +unmixCDKTemplate +unregisterCDKObject +validCDKObject +viewFile +viewInfo +waitCDKLabel +writeBlanks +writeCDKDebugMessage +writeChar +writeCharAttrib +writeChtype +writeChtypeAttrib diff --git a/deps/cdk-5.0-20161210/package/debian-mingw/changelog b/deps/cdk-5.0-20161210/package/debian-mingw/changelog new file mode 100644 index 0000000..1c87819 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw/changelog @@ -0,0 +1,71 @@ +cdk (5.0.20161210) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 10 Dec 2016 08:04:19 -0500 + +cdk (5.0.20161204) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 04 Dec 2016 06:57:51 -0500 + +cdk (5.0.20161120) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 20 Nov 2016 08:43:48 -0500 + +cdk (5.0.20161119) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 19 Nov 2016 08:24:00 -0500 + +cdk (5.0.20160131) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 31 Jan 2016 14:34:10 -0500 + +cdk (5.0.20150928) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Fri, 25 Sep 2015 07:58:10 -0400 + +cdk (5.0.20150103) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 03 Jan 2015 20:43:29 -0500 + +cdk (5.0.20141106) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 02 Nov 2014 08:42:09 -0500 + +cdk (5.0.20140118) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 18 Jan 2014 09:01:14 -0500 + +cdk (5.0.20140101) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Wed, 01 Jan 2014 17:15:01 -0500 + +cdk (5.0.20131117) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 17 Nov 2013 09:10:09 -0500 + +cdk (5.0.20131107) unstable; urgency=low + + * initial release + + -- Thomas E. Dickey Sat, 02 Nov 2013 21:16:50 -0400 diff --git a/deps/cdk-5.0-20161210/package/debian-mingw/compat b/deps/cdk-5.0-20161210/package/debian-mingw/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw/compat @@ -0,0 +1 @@ +5 diff --git a/deps/cdk-5.0-20161210/package/debian-mingw/control b/deps/cdk-5.0-20161210/package/debian-mingw/control new file mode 100644 index 0000000..9d84d51 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw/control @@ -0,0 +1,33 @@ +Source: cdk +Maintainer: Thomas E. Dickey +Section: misc +Priority: optional +Standards-Version: 3.8.4 +Build-Depends: debhelper (>= 5), mingw32-ncurses6 (>= 5.9), groff-base +Homepage: http://invisible-island.net/cdk/ + +Package: mingw32-libcdk5 +Architecture: any +Depends: mingw32-ncurses6 (>= 5.9) +Description: Cdk - Curses Development Kit + Cdk stands for "Curses Development Kit". It contains a large number of ready + to use widgets which facilitate the speedy development of full-screen curses + programs. + . + This package contains the runtime library. + . + This package is used for testing the MinGW 32-bit port. + +Package: mingw32-libcdk5-dev +Architecture: any +Depends: mingw32-ncurses6 (>= 5.9), mingw32-libcdk5 +Suggests: libcdk-doc +Description: Cdk - Curses Development Kit + Cdk stands for "Curses Development Kit". It contains a large number of ready + to use widgets which facilitate the speedy development of full-screen curses + programs. + . + This package contains the header-files and development libraries for + libcdk5. + . + This package is used for testing the MinGW 32-bit port. diff --git a/deps/cdk-5.0-20161210/package/debian-mingw/copyright b/deps/cdk-5.0-20161210/package/debian-mingw/copyright new file mode 100644 index 0000000..959f3da --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw/copyright @@ -0,0 +1,134 @@ +Upstream source http://invisible-island.net/cdk/cdk.html + +Current cdk upstream maintainer: Thomas Dickey + +------------------------------------------------------------------------------- +Files: *.c *.h + +There are two cases: + + a) Some were originally authored by Mike Glover, and revised by Thomas E. + Dickey. Mike Glover's changes stopped in 1999. + b) others are solely the work of Thomas E. Dickey, starting in 1999. + +Here is an sample copyright for the first case (permissions for the latter +are identical, though the copyright owner differs of course): + + Changes 1999-2015,2016 copyright Thomas E. Dickey + + Copyright 1999, Mike Glover + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgment: + This product includes software developed by Mike Glover + and contributors. + 4. Neither the name of Mike Glover, nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +------------------------------------------------------------------------------- + +Files: aclocal.m4 +Licence: other-BSD +Copyright: 1999-2015,2016 by Thomas E. Dickey + 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 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. + +Files: install-sh +Copyright: 1994 X Consortium +Licence: other-BSD + 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, 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 + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- + TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not + be used in advertising or otherwise to promote the sale, use or other deal- + ings in this Software without prior written authorization from the X Consor- + tium. + + FSF changes to this file are in the public domain. + + Calling this script install-sh is preferred over install.sh, to prevent + `make' implicit rules from creating a file called install from it + when there is no Makefile. + + This script is compatible with the BSD install script, but was written + from scratch. It can only install one file at a time, a restriction + shared with many OS's install programs. + +Files: debian/* +Copyright: 2011-2015,2016 Thomas E. Dickey +Licence: other-BSD + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of the above listed + copyright holder(s) not be used in advertising or publicity pertaining + to distribution of the software without specific, written prior + permission. + + THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD + TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +On Debian systems, the complete text of the GNU General +Public License can be found in '/usr/share/common-licenses/GPL-2' diff --git a/deps/cdk-5.0-20161210/package/debian-mingw/rules b/deps/cdk-5.0-20161210/package/debian-mingw/rules new file mode 100755 index 0000000..e1c05b9 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw/rules @@ -0,0 +1,110 @@ +#!/usr/bin/make -f +# Made with the aid of dh_make, by Craig Small +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +# Some lines taken from debmake, by Cristoph Lameter. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +BUILD_CC = gcc + +CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion +CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic + +TARGET = i686-w64-mingw32 +MINGW_TOP = /usr/$(TARGET) +MINGW_TMP = $(CURDIR)/debian/mingw32-libcdk5 +MINGW_DEV = $(CURDIR)/debian/mingw32-libcdk5-dev + +CFLAGS = $(CC_NORMAL) + +CONFIG_OPTIONS = \ + --disable-echo \ + --verbose \ + --with-shared + +verbose = # -v + +export CFLAGS BUILD_CC + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + + CC=$(TARGET)-gcc \ + CFLAGS="$(CFLAGS)" \ + ./configure \ + --host=$(TARGET) \ + --target=$(TARGET) \ + --prefix=$(MINGW_TOP) \ + --with-build-cc=$(BUILD_CC) \ + $(CONFIG_OPTIONS) + + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + + [ ! -f makefile ] || $(MAKE) distclean + + rm -f configure-stamp build-stamp install-stamp + + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k $(verbose) + dh_installdirs $(verbose) + + $(MAKE) installCDKLibrary DESTDIR=$(MINGW_TMP) + rm -f $(MINGW_TMP)/$(MINGW_TOP)/bin/cdk5-config + $(MAKE) installImportLibrary DESTDIR=$(MINGW_DEV) + $(MAKE) installCDKHeaderFiles DESTDIR=$(MINGW_DEV) + + touch install-stamp + +# Build architecture-independent files here. +binary-indep: build install +# No binary-indep target. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs $(verbose) + # dh_strip + dh_compress $(verbose) + dh_fixperms $(verbose) + dh_installdeb $(verbose) + dh_shlibdeps $(verbose) + dh_gencontrol $(verbose) + dh_md5sums $(verbose) + dh_builddeb $(verbose) + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install install-stamp diff --git a/deps/cdk-5.0-20161210/package/debian-mingw/source/format b/deps/cdk-5.0-20161210/package/debian-mingw/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/deps/cdk-5.0-20161210/package/debian-mingw/watch b/deps/cdk-5.0-20161210/package/debian-mingw/watch new file mode 100644 index 0000000..6e9a47c --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw/watch @@ -0,0 +1,4 @@ +version=3 + +opts=passive ftp://invisible-island.net/cdk/cdk\.tar.gz \ + debian uupdate diff --git a/deps/cdk-5.0-20161210/package/debian-mingw64/changelog b/deps/cdk-5.0-20161210/package/debian-mingw64/changelog new file mode 100644 index 0000000..1c87819 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw64/changelog @@ -0,0 +1,71 @@ +cdk (5.0.20161210) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 10 Dec 2016 08:04:19 -0500 + +cdk (5.0.20161204) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 04 Dec 2016 06:57:51 -0500 + +cdk (5.0.20161120) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 20 Nov 2016 08:43:48 -0500 + +cdk (5.0.20161119) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 19 Nov 2016 08:24:00 -0500 + +cdk (5.0.20160131) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 31 Jan 2016 14:34:10 -0500 + +cdk (5.0.20150928) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Fri, 25 Sep 2015 07:58:10 -0400 + +cdk (5.0.20150103) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 03 Jan 2015 20:43:29 -0500 + +cdk (5.0.20141106) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 02 Nov 2014 08:42:09 -0500 + +cdk (5.0.20140118) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 18 Jan 2014 09:01:14 -0500 + +cdk (5.0.20140101) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Wed, 01 Jan 2014 17:15:01 -0500 + +cdk (5.0.20131117) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 17 Nov 2013 09:10:09 -0500 + +cdk (5.0.20131107) unstable; urgency=low + + * initial release + + -- Thomas E. Dickey Sat, 02 Nov 2013 21:16:50 -0400 diff --git a/deps/cdk-5.0-20161210/package/debian-mingw64/compat b/deps/cdk-5.0-20161210/package/debian-mingw64/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw64/compat @@ -0,0 +1 @@ +5 diff --git a/deps/cdk-5.0-20161210/package/debian-mingw64/control b/deps/cdk-5.0-20161210/package/debian-mingw64/control new file mode 100644 index 0000000..286d27f --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw64/control @@ -0,0 +1,33 @@ +Source: cdk +Maintainer: Thomas E. Dickey +Section: misc +Priority: optional +Standards-Version: 3.8.4 +Build-Depends: debhelper (>= 5), mingw64-ncurses6 (>= 5.9), groff-base +Homepage: http://invisible-island.net/cdk/ + +Package: mingw64-libcdk5 +Architecture: any +Depends: mingw64-ncurses6 (>= 5.9) +Description: Cdk - Curses Development Kit + Cdk stands for "Curses Development Kit". It contains a large number of ready + to use widgets which facilitate the speedy development of full-screen curses + programs. + . + This package contains the runtime library. + . + This package is used for testing the MinGW 64-bit port. + +Package: mingw64-libcdk5-dev +Architecture: any +Depends: mingw64-ncurses6 (>= 5.9), mingw64-libcdk5 +Suggests: libcdk-doc +Description: Cdk - Curses Development Kit + Cdk stands for "Curses Development Kit". It contains a large number of ready + to use widgets which facilitate the speedy development of full-screen curses + programs. + . + This package contains the header-files and development libraries for + libcdk5. + . + This package is used for testing the MinGW 64-bit port. diff --git a/deps/cdk-5.0-20161210/package/debian-mingw64/copyright b/deps/cdk-5.0-20161210/package/debian-mingw64/copyright new file mode 100644 index 0000000..959f3da --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw64/copyright @@ -0,0 +1,134 @@ +Upstream source http://invisible-island.net/cdk/cdk.html + +Current cdk upstream maintainer: Thomas Dickey + +------------------------------------------------------------------------------- +Files: *.c *.h + +There are two cases: + + a) Some were originally authored by Mike Glover, and revised by Thomas E. + Dickey. Mike Glover's changes stopped in 1999. + b) others are solely the work of Thomas E. Dickey, starting in 1999. + +Here is an sample copyright for the first case (permissions for the latter +are identical, though the copyright owner differs of course): + + Changes 1999-2015,2016 copyright Thomas E. Dickey + + Copyright 1999, Mike Glover + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgment: + This product includes software developed by Mike Glover + and contributors. + 4. Neither the name of Mike Glover, nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +------------------------------------------------------------------------------- + +Files: aclocal.m4 +Licence: other-BSD +Copyright: 1999-2015,2016 by Thomas E. Dickey + 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 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. + +Files: install-sh +Copyright: 1994 X Consortium +Licence: other-BSD + 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, 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 + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- + TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not + be used in advertising or otherwise to promote the sale, use or other deal- + ings in this Software without prior written authorization from the X Consor- + tium. + + FSF changes to this file are in the public domain. + + Calling this script install-sh is preferred over install.sh, to prevent + `make' implicit rules from creating a file called install from it + when there is no Makefile. + + This script is compatible with the BSD install script, but was written + from scratch. It can only install one file at a time, a restriction + shared with many OS's install programs. + +Files: debian/* +Copyright: 2011-2015,2016 Thomas E. Dickey +Licence: other-BSD + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of the above listed + copyright holder(s) not be used in advertising or publicity pertaining + to distribution of the software without specific, written prior + permission. + + THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD + TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +On Debian systems, the complete text of the GNU General +Public License can be found in '/usr/share/common-licenses/GPL-2' diff --git a/deps/cdk-5.0-20161210/package/debian-mingw64/rules b/deps/cdk-5.0-20161210/package/debian-mingw64/rules new file mode 100755 index 0000000..cf02b20 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw64/rules @@ -0,0 +1,110 @@ +#!/usr/bin/make -f +# Made with the aid of dh_make, by Craig Small +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +# Some lines taken from debmake, by Cristoph Lameter. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +BUILD_CC = gcc + +CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion +CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic + +TARGET = amd64-mingw32msvc +MINGW_TOP = /usr/$(TARGET) +MINGW_TMP = $(CURDIR)/debian/mingw64-libcdk5 +MINGW_DEV = $(CURDIR)/debian/mingw64-libcdk5-dev + +CFLAGS = $(CC_NORMAL) + +CONFIG_OPTIONS = \ + --disable-echo \ + --verbose \ + --with-shared + +verbose = # -v + +export CFLAGS BUILD_CC + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + + CC=$(TARGET)-gcc \ + CFLAGS="$(CFLAGS)" \ + ./configure \ + --host=$(TARGET) \ + --target=$(TARGET) \ + --prefix=$(MINGW_TOP) \ + --with-build-cc=$(BUILD_CC) \ + $(CONFIG_OPTIONS) + + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + + [ ! -f makefile ] || $(MAKE) distclean + + rm -f configure-stamp build-stamp install-stamp + + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k $(verbose) + dh_installdirs $(verbose) + + $(MAKE) installCDKLibrary DESTDIR=$(MINGW_TMP) + rm -f $(MINGW_TMP)/$(MINGW_TOP)/bin/cdk5-config + $(MAKE) installImportLibrary DESTDIR=$(MINGW_DEV) + $(MAKE) installCDKHeaderFiles DESTDIR=$(MINGW_DEV) + + touch install-stamp + +# Build architecture-independent files here. +binary-indep: build install +# No binary-indep target. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs $(verbose) + # dh_strip + dh_compress $(verbose) + dh_fixperms $(verbose) + dh_installdeb $(verbose) + dh_shlibdeps $(verbose) + dh_gencontrol $(verbose) + dh_md5sums $(verbose) + dh_builddeb $(verbose) + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install install-stamp diff --git a/deps/cdk-5.0-20161210/package/debian-mingw64/source/format b/deps/cdk-5.0-20161210/package/debian-mingw64/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw64/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/deps/cdk-5.0-20161210/package/debian-mingw64/watch b/deps/cdk-5.0-20161210/package/debian-mingw64/watch new file mode 100644 index 0000000..6e9a47c --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian-mingw64/watch @@ -0,0 +1,4 @@ +version=3 + +opts=passive ftp://invisible-island.net/cdk/cdk\.tar.gz \ + debian uupdate diff --git a/deps/cdk-5.0-20161210/package/debian/changelog b/deps/cdk-5.0-20161210/package/debian/changelog new file mode 100644 index 0000000..77b4b21 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian/changelog @@ -0,0 +1,92 @@ +cdk (5.0.20161210) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 10 Dec 2016 08:04:19 -0500 + +cdk (5.0.20161204) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 04 Dec 2016 06:57:51 -0500 + +cdk (5.0.20161120) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 20 Nov 2016 08:43:47 -0500 + +cdk (5.0.20161119) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 19 Nov 2016 08:24:00 -0500 + +cdk (5.0.20160131) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 31 Jan 2016 14:34:10 -0500 + +cdk (5.0.20150928) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Fri, 25 Sep 2015 07:58:10 -0400 + +cdk (5.0.20150103) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 03 Jan 2015 20:43:29 -0500 + +cdk (5.0.20141106) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 02 Nov 2014 08:42:09 -0500 + +cdk (5.0.20140118) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 18 Jan 2014 09:01:14 -0500 + +cdk (5.0.20140101) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Wed, 01 Jan 2014 17:15:01 -0500 + +cdk (5.0.20131117) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 17 Nov 2013 09:10:09 -0500 + +cdk (5.0.20131107) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sat, 02 Nov 2013 11:36:50 -0400 + +cdk (5.0-20130901) unstable; urgency=low + + * improvements to configure script + * minor fixes + + -- Thomas E. Dickey Sat, 15 Jun 2013 10:55:30 -0400 + +cdk (5.0-20120323) unstable; urgency=low + + * bug-report for gmtime/localtime usage. + * Fixes for package scripts. + * Debian #500161 + + -- Thomas E. Dickey Sun, 18 Mar 2012 19:38:57 -0400 + +cdk (5.0-20110517) unstable; urgency=high + + * Initial package release + + -- Thomas E. Dickey Sat, 14 May 2011 08:15:31 -0400 diff --git a/deps/cdk-5.0-20161210/package/debian/compat b/deps/cdk-5.0-20161210/package/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian/compat @@ -0,0 +1 @@ +5 diff --git a/deps/cdk-5.0-20161210/package/debian/control b/deps/cdk-5.0-20161210/package/debian/control new file mode 100644 index 0000000..5041fe8 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian/control @@ -0,0 +1,39 @@ +Source: cdk +Maintainer: Thomas E. Dickey +Section: misc +Priority: optional +Standards-Version: 3.8.4 +Build-Depends: debhelper (>= 5), libncursesw5-dev (>= 5.3), groff-base +Homepage: http://invisible-island.net/cdk/ + +Package: libcdk5 +Architecture: any +Depends: libncursesw5 (>= 5.3), libc6 +Description: Cdk - Curses Development Kit + Cdk stands for "Curses Development Kit". It contains a large number of ready + to use widgets which facilitate the speedy development of full-screen curses + programs. + +Package: libcdk5-dev +Section: libdevel +Architecture: any +Depends: libncursesw5 (>= 5.3), libcdk5, libc6-dev +Suggests: libcdk-doc +Description: Cdk - Curses Development Kit + Cdk stands for "Curses Development Kit". It contains a large number of ready + to use widgets which facilitate the speedy development of full-screen curses + programs. + . + This package contains the header-files and development libraries for + libcdk5. + +Package: libcdk5-doc +Section: doc +Architecture: all +Depends: groff-base +Description: Cdk - Curses Development Kit + Cdk stands for "Curses Development Kit". It contains a large number of ready + to use widgets which facilitate the speedy development of full-screen curses + programs. + . + This package contains the manpages for libcdk5 and libcdkw5. diff --git a/deps/cdk-5.0-20161210/package/debian/copyright b/deps/cdk-5.0-20161210/package/debian/copyright new file mode 100644 index 0000000..959f3da --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian/copyright @@ -0,0 +1,134 @@ +Upstream source http://invisible-island.net/cdk/cdk.html + +Current cdk upstream maintainer: Thomas Dickey + +------------------------------------------------------------------------------- +Files: *.c *.h + +There are two cases: + + a) Some were originally authored by Mike Glover, and revised by Thomas E. + Dickey. Mike Glover's changes stopped in 1999. + b) others are solely the work of Thomas E. Dickey, starting in 1999. + +Here is an sample copyright for the first case (permissions for the latter +are identical, though the copyright owner differs of course): + + Changes 1999-2015,2016 copyright Thomas E. Dickey + + Copyright 1999, Mike Glover + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgment: + This product includes software developed by Mike Glover + and contributors. + 4. Neither the name of Mike Glover, nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +------------------------------------------------------------------------------- + +Files: aclocal.m4 +Licence: other-BSD +Copyright: 1999-2015,2016 by Thomas E. Dickey + 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 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. + +Files: install-sh +Copyright: 1994 X Consortium +Licence: other-BSD + 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, 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 + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- + TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not + be used in advertising or otherwise to promote the sale, use or other deal- + ings in this Software without prior written authorization from the X Consor- + tium. + + FSF changes to this file are in the public domain. + + Calling this script install-sh is preferred over install.sh, to prevent + `make' implicit rules from creating a file called install from it + when there is no Makefile. + + This script is compatible with the BSD install script, but was written + from scratch. It can only install one file at a time, a restriction + shared with many OS's install programs. + +Files: debian/* +Copyright: 2011-2015,2016 Thomas E. Dickey +Licence: other-BSD + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of the above listed + copyright holder(s) not be used in advertising or publicity pertaining + to distribution of the software without specific, written prior + permission. + + THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD + TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +On Debian systems, the complete text of the GNU General +Public License can be found in '/usr/share/common-licenses/GPL-2' diff --git a/deps/cdk-5.0-20161210/package/debian/docs b/deps/cdk-5.0-20161210/package/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian/docs @@ -0,0 +1 @@ +README diff --git a/deps/cdk-5.0-20161210/package/debian/rules b/deps/cdk-5.0-20161210/package/debian/rules new file mode 100755 index 0000000..2cc83f1 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian/rules @@ -0,0 +1,191 @@ +#!/usr/bin/make -f +# $Id: rules,v 1.21 2016/02/01 00:45:45 tom Exp $ + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +# packages +PACKAGES.indep = libcdk5-doc +PACKAGES.arch = libcdk5-dev libcdk5 + +CFLAGS = + +TARGET = $(CURDIR)/debian +P_SHARED = $(CURDIR)/t/shared +P_STATIC = $(CURDIR)/t/static + +verbose = # -v + +LOG = @echo "**" + +configure = ../../configure \ + --disable-echo \ + --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --with-screen=ncursesw6 \ + --with-versioned-syms \ + --with-libname=cdk \ + --disable-rpath-hack + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +.PHONY: all config build install binary clean config-indep config-arch \ + build-indep build-arch install-indep install-arch binary-indep \ + binary-arch + +all: build + +config: config-indep config-arch +build: build-indep build-arch +install: install-indep install-arch +binary: binary-indep binary-arch +clean: + dh_testdir + dh_testroot + dh_clean $(verbose) + rm -rf t + +config-indep: $(PACKAGES.indep:%=config-%-stamp) +config-arch: $(PACKAGES.arch:%=config-%-stamp) + +build-indep: $(PACKAGES.indep:%=build-%-stamp) +build-arch: $(PACKAGES.arch:%=build-%-stamp) + +install-indep: $(PACKAGES.indep:%=install-%-stamp) +install-arch: $(PACKAGES.arch:%=install-%-stamp) + +binary-indep: install-indep +ifneq ($(PACKAGES.indep),) + rm -f $(PACKAGES.indep:%=install-%-stamp) + dh_testdir + dh_testroot + dh_installdocs $(verbose) $(PACKAGES.indep:%=-p%) + dh_installman $(verbose) $(PACKAGES.indep:%=-p%) + dh_installexamples $(verbose) $(PACKAGES.indep:%=-p%) + dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) -k CHANGES + dh_compress $(verbose) $(PACKAGES.indep:%=-p%) + dh_fixperms $(verbose) $(PACKAGES.indep:%=-p%) + dh_installdeb $(verbose) $(PACKAGES.indep:%=-p%) + dh_gencontrol $(verbose) $(PACKAGES.indep:%=-p%) + dh_md5sums $(verbose) $(PACKAGES.indep:%=-p%) + dh_builddeb $(verbose) $(PACKAGES.indep:%=-p%) +endif + +binary-arch: install-arch +ifneq ($(PACKAGES.arch),) + rm -f $(PACKAGES.arch:%=install-%-stamp) + dh_testdir + dh_testroot + dh_link $(verbose) $(PACKAGES.arch:%=-p%) + dh_installdocs $(verbose) $(PACKAGES.arch:%=-p%) + dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) -k CHANGES + dh_installmenu $(verbose) $(PACKAGES.arch:%=-p%) + dh_strip $(verbose) $(PACKAGES.arch:%=-p%) + dh_compress $(verbose) $(PACKAGES.arch:%=-p%) + dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%) + dh_makeshlibs $(verbose) $(PACKAGES.arch:%=-p%) + dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%) + dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%) + dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%) + dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%) + dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%) +endif + +#------------------------------------------------------------------------------ +config-libcdk5-stamp : + $(LOG) "configuring libcdk5" + dh_testdir + + rm -rf $(P_SHARED) + mkdir -p $(P_SHARED) + + cd $(P_SHARED); CFLAGS="$(CFLAGS)" \ + $(configure) --with-shared --with-versioned-syms + + rm -rf $(P_STATIC) + mkdir -p $(P_STATIC) + + cd $(P_STATIC); CFLAGS="$(CFLAGS)" \ + $(configure) + + touch $@ + +build-libcdk5-stamp : config-libcdk5-stamp + $(LOG) "building libcdk5" + dh_testdir + + $(MAKE) -C $(P_SHARED) all + $(MAKE) -C $(P_STATIC) all + + touch $@ + +install-libcdk5-stamp : build-libcdk5-stamp + $(LOG) "installing libcdk5" + dh_testdir + dh_testroot + dh_prep $(verbose) -plibcdk5 + dh_installdirs $(verbose) -plibcdk5 + + $(MAKE) -C $(P_SHARED) DESTDIR=$(TARGET)/libcdk5 installCDKLibrary + + # remove -config file also in -dev package + rm -rf $(TARGET)/libcdk5/usr/bin + + touch $@ + +#------------------------------------------------------------------------------ +config-libcdk5-dev-stamp : config-libcdk5-stamp + touch $@ + +build-libcdk5-dev-stamp : build-libcdk5-stamp + touch $@ + +install-libcdk5-dev-stamp : install-libcdk5-stamp + $(LOG) "installing libcdk5-dev" + dh_testdir + dh_testroot + dh_prep $(verbose) -plibcdk5-dev + dh_installdirs $(verbose) -plibcdk5-dev + + $(MAKE) -C $(P_SHARED) DESTDIR=$(TARGET)/libcdk5-dev installCDKHeaderFiles + $(MAKE) -C $(P_STATIC) DESTDIR=$(TARGET)/libcdk5-dev install.libs + + # get the symbolic link, but not the actual file + $(MAKE) -C $(P_SHARED) DESTDIR=$(TARGET)/libcdk5-dev install.libs + find $(TARGET)/libcdk5-dev/usr/lib -type f -name '*.so*' -exec rm -f {} \; + + touch $@ + +#------------------------------------------------------------------------------ +config-libcdk5-doc-stamp : config-libcdk5-stamp + touch $@ + +build-libcdk5-doc-stamp : build-libcdk5-stamp + touch $@ + +install-libcdk5-doc-stamp : install-libcdk5-stamp + $(LOG) "installing libcdk5-doc" + dh_testdir + dh_testroot + dh_prep $(verbose) -plibcdk5-doc + dh_installdirs $(verbose) -plibcdk5-doc + + $(MAKE) -C $(P_SHARED) DESTDIR=$(TARGET)/libcdk5-doc installCDKManPages + dh_installexamples $(verbose) -plibcdk5-doc examples demos + + touch $@ + diff --git a/deps/cdk-5.0-20161210/package/debian/source/format b/deps/cdk-5.0-20161210/package/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/deps/cdk-5.0-20161210/package/debian/watch b/deps/cdk-5.0-20161210/package/debian/watch new file mode 100644 index 0000000..29fab82 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/debian/watch @@ -0,0 +1,4 @@ +version=3 + +opts=passive ftp://invisible-island.net/cdk/cdk-([\d.-]+)\.tgz \ + debian uupdate diff --git a/deps/cdk-5.0-20161210/package/freebsd/Makefile b/deps/cdk-5.0-20161210/package/freebsd/Makefile new file mode 100644 index 0000000..9f5293d --- /dev/null +++ b/deps/cdk-5.0-20161210/package/freebsd/Makefile @@ -0,0 +1,60 @@ +# Created by: Andrey Zakhvatov +# $FreeBSD: devel/cdk/Makefile 315072 2013-03-23 19:19:55Z bapt $ + +PORTNAME= cdk +PORTVERSION= 5.0.20161210 + +PORTREVISION= 2 +PORTEPOCH= 1 +CATEGORIES= devel +MASTER_SITES= ftp://invisible-island.net/cdk/ \ + http://fossies.org/linux/misc/ +DISTNAME= ${PORTNAME}-${PORTVERSION:R}-${PORTVERSION:E} +EXTRACT_SUFX= .tgz + +MAINTAINER= bapt@FreeBSD.org +COMMENT= Curses Development Kit for speedy development of full screen programs + +LICENSE= BSD + +USE_GMAKE= yes +USE_NCURSES= yes +GNU_CONFIGURE= yes +PORTDOCS= COPYING EXPANDING INSTALL NOTES README TODO +MAKE_JOBS_UNSAFE= yes + +.include + +CONFIGURE_ARGS+=--with-ncurses --verbose +ALL_TARGET= default examples demos cli cdkshlib +INSTALL_TARGET= install installCDKSHLibrary +USE_LDCONFIG= yes + +.include "${.CURDIR}/maninfo.mk" + +post-extract: +.if ! ${PORT_OPTIONS:MDOCS} +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-Makefile.in +.endif + +post-patch: + @${REINPLACE_CMD} -e 's|/doc/cdk|/share/doc/cdk| ; s|VERSION)|VERSION_MAJOR)|' \ + -e 's|gcc|${CC}|g' ${WRKSRC}/Makefile.in + @${REINPLACE_CMD} -e 's|$$(INSTALL_DATA) cdk-config|$(INSTALL_SCRIPT) cdk-config|g' \ + ${WRKSRC}/Makefile.in + +post-install: +.if ${PORT_OPTIONS:MEXAMPLES} + ${INSTALL} -d ${EXAMPLESDIR} + ${INSTALL} -d ${EXAMPLESDIR}/cli + cd ${WRKSRC}/cli; \ + ${FIND} . | ${CPIO} -pdm -R ${LIBOWN}:${LIBGRP} ${EXAMPLESDIR}/cli + ${INSTALL} -d ${EXAMPLESDIR}/demos + cd ${WRKSRC}/demos; \ + ${FIND} . | ${CPIO} -pdm -R ${LIBOWN}:${LIBGRP} ${EXAMPLESDIR}/demos + ${INSTALL} -d ${EXAMPLESDIR}/examples + cd ${WRKSRC}/examples; \ + ${FIND} . | ${CPIO} -pdm -R ${LIBOWN}:${LIBGRP} ${EXAMPLESDIR}/examples +.endif + +.include diff --git a/deps/cdk-5.0-20161210/package/freebsd/distinfo b/deps/cdk-5.0-20161210/package/freebsd/distinfo new file mode 100644 index 0000000..b939d29 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/freebsd/distinfo @@ -0,0 +1,2 @@ +SHA256 (cdk-5.0-20120323.tgz) = a7a8210a85b1505f3f9e794cd11afad1c66f42306e6387b197bd006b24534c74 +SIZE (cdk-5.0-20120323.tgz) = 466993 diff --git a/deps/cdk-5.0-20161210/package/freebsd/files/extra-patch-Makefile.in b/deps/cdk-5.0-20161210/package/freebsd/files/extra-patch-Makefile.in new file mode 100644 index 0000000..fb0d2e1 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/freebsd/files/extra-patch-Makefile.in @@ -0,0 +1,23 @@ +--- Makefile.in.orig 2005-04-24 15:06:20.000000000 -0800 ++++ Makefile.in 2008-09-02 21:52:52.000000000 -0800 +@@ -301,13 +301,13 @@ + # + # This installs the informational readme files. + # +-install \ +-installCDKReadme :: $(DOCUMENT_DIR) +- @echo "Installing CDK Readme files in $(DOCUMENT_DIR)..." +- @for i in $(CDKREADME); do \ +- echo " ... $$i"; \ +- $(INSTALL_DATA) $(srcdir)/$$i $(DOCUMENT_DIR)/$$i; \ +- done ++#install \ ++#installCDKReadme :: $(DOCUMENT_DIR) ++# @echo "Installing CDK Readme files in $(DOCUMENT_DIR)..." ++# @for i in $(CDKREADME); do \ ++# echo " ... $$i"; \ ++# $(INSTALL_DATA) $(srcdir)/$$i $(DOCUMENT_DIR)/$$i; \ ++# done + + uninstall \ + uninstallCDKReadme :: diff --git a/deps/cdk-5.0-20161210/package/freebsd/maninfo.mk b/deps/cdk-5.0-20161210/package/freebsd/maninfo.mk new file mode 100644 index 0000000..fefbf9d --- /dev/null +++ b/deps/cdk-5.0-20161210/package/freebsd/maninfo.mk @@ -0,0 +1,970 @@ +MAN3+= cdk.3 \ + cdk_alphalist.3 \ + cdk_binding.3 \ + cdk_button.3 \ + cdk_buttonbox.3 \ + cdk_calendar.3 \ + cdk_compat.3 \ + cdk_dialog.3 \ + cdk_display.3 \ + cdk_dscale.3 \ + cdk_draw.3 \ + cdk_entry.3 \ + cdk_fscale.3 \ + cdk_fselect.3 \ + cdk_fslider.3 \ + cdk_graph.3 \ + cdk_histogram.3 \ + cdk_itemlist.3 \ + cdk_label.3 \ + cdk_marquee.3 \ + cdk_menu.3 \ + cdk_matrix.3 \ + cdk_mentry.3 \ + cdk_misc.3 \ + cdk_objs.3 \ + cdk_params.3 \ + cdk_position.3 \ + cdk_process.3 \ + cdk_radio.3 \ + cdk_scale.3 \ + cdk_screen.3 \ + cdk_scroll.3 \ + cdk_selection.3 \ + cdk_slider.3 \ + cdk_swindow.3 \ + cdk_template.3 \ + cdk_traverse.3 \ + cdk_uscale.3 \ + cdk_uslider.3 \ + cdk_util.3 \ + cdk_viewer.3 +MLINKS+=cdk_alphalist.3 activateCDKAlphalist.3 \ + cdk_alphalist.3 destroyCDKAlphalist.3 \ + cdk_alphalist.3 drawCDKAlphalist.3 \ + cdk_alphalist.3 eraseCDKAlphalist.3 \ + cdk_alphalist.3 getCDKAlphalistBox.3 \ + cdk_alphalist.3 getCDKAlphalistContents.3 \ + cdk_alphalist.3 getCDKAlphalistFillerChar.3 \ + cdk_alphalist.3 getCDKAlphalistCurrentItem.3 \ + cdk_alphalist.3 getCDKAlphalistHighlight.3 \ + cdk_alphalist.3 injectCDKAlphalist.3 \ + cdk_alphalist.3 moveCDKAlphalist.3 \ + cdk_alphalist.3 newCDKAlphalist.3 \ + cdk_alphalist.3 positionCDKAlphalist.3 \ + cdk_alphalist.3 setCDKAlphalist.3 \ + cdk_alphalist.3 setCDKAlphalistBackgroundAttrib.3 \ + cdk_alphalist.3 setCDKAlphalistBox.3 \ + cdk_alphalist.3 setCDKAlphalistBackgroundColor.3 \ + cdk_alphalist.3 setCDKAlphalistBoxAttribute.3 \ + cdk_alphalist.3 setCDKAlphalistContents.3 \ + cdk_alphalist.3 setCDKAlphalistCurrentItem.3 \ + cdk_alphalist.3 setCDKAlphalistFillerChar.3 \ + cdk_alphalist.3 setCDKAlphalistHighlight.3 \ + cdk_alphalist.3 setCDKAlphalistHorizontalChar.3 \ + cdk_alphalist.3 setCDKAlphalistLLChar.3 \ + cdk_alphalist.3 setCDKAlphalistLRChar.3 \ + cdk_alphalist.3 setCDKAlphalistPostProcess.3 \ + cdk_alphalist.3 setCDKAlphalistPreProcess.3 \ + cdk_alphalist.3 setCDKAlphalistULChar.3 \ + cdk_alphalist.3 setCDKAlphalistURChar.3 \ + cdk_alphalist.3 setCDKAlphalistVerticalChar.3 \ + cdk_binding.3 bindCDKObject.3 \ + cdk_binding.3 checkCDKObjectBind.3 \ + cdk_binding.3 cleanCDKObjectBindings.3 \ + cdk_binding.3 getcCDKObject.3 \ + cdk_binding.3 getchCDKObject.3 \ + cdk_binding.3 unbindCDKObject.3 \ + cdk_button.3 activateCDKButton.3 \ + cdk_button.3 destroyCDKButton.3 \ + cdk_button.3 drawCDKButton.3 \ + cdk_button.3 eraseCDKButton.3 \ + cdk_button.3 getCDKButtonBox.3 \ + cdk_button.3 getCDKButtonMessage.3 \ + cdk_button.3 injectCDKButton.3 \ + cdk_button.3 moveCDKButton.3 \ + cdk_button.3 newCDKButton.3 \ + cdk_button.3 positionCDKButton.3 \ + cdk_button.3 setCDKButton.3 \ + cdk_button.3 setCDKButtonBackgroundAttrib.3 \ + cdk_button.3 setCDKButtonBackgroundColor.3 \ + cdk_button.3 setCDKButtonboxBackgroundAttrib.3 \ + cdk_button.3 setCDKButtonBox.3 \ + cdk_button.3 setCDKButtonBoxAttribute.3 \ + cdk_button.3 setCDKButtonHorizontalChar.3 \ + cdk_button.3 setCDKButtonLLChar.3 \ + cdk_button.3 setCDKButtonLRChar.3 \ + cdk_button.3 setCDKButtonMessage.3 \ + cdk_button.3 setCDKButtonULChar.3 \ + cdk_button.3 setCDKButtonURChar.3 \ + cdk_button.3 setCDKButtonVerticalChar.3 \ + cdk_buttonbox.3 activateCDKButtonbox.3 \ + cdk_buttonbox.3 destroyCDKButtonbox.3 \ + cdk_buttonbox.3 drawCDKButtonbox.3 \ + cdk_buttonbox.3 drawCDKButtonboxButtons.3 \ + cdk_buttonbox.3 eraseCDKButtonbox.3 \ + cdk_buttonbox.3 getCDKButtonboxBox.3 \ + cdk_buttonbox.3 getCDKButtonboxButtonCount.3 \ + cdk_buttonbox.3 getCDKButtonboxCurrentButton.3 \ + cdk_buttonbox.3 getCDKButtonboxHighlight.3 \ + cdk_buttonbox.3 moveCDKButtonbox.3 \ + cdk_buttonbox.3 injectCDKButtonbox.3 \ + cdk_buttonbox.3 newCDKButtonbox.3 \ + cdk_buttonbox.3 positionCDKButtonbox.3 \ + cdk_buttonbox.3 setCDKButtonbox.3 \ + cdk_buttonbox.3 setCDKButtonboxBackgroundColor.3 \ + cdk_buttonbox.3 setCDKButtonboxBox.3 \ + cdk_buttonbox.3 setCDKButtonboxBoxAttribute.3 \ + cdk_buttonbox.3 setCDKButtonboxCurrentButton.3 \ + cdk_buttonbox.3 setCDKButtonboxHighlight.3 \ + cdk_buttonbox.3 setCDKButtonboxHorizontalChar.3 \ + cdk_buttonbox.3 setCDKButtonboxLLChar.3 \ + cdk_buttonbox.3 setCDKButtonboxLRChar.3 \ + cdk_buttonbox.3 setCDKButtonboxPostProcess.3 \ + cdk_buttonbox.3 setCDKButtonboxPreProcess.3 \ + cdk_buttonbox.3 setCDKButtonboxULChar.3 \ + cdk_buttonbox.3 setCDKButtonboxURChar.3 \ + cdk_buttonbox.3 setCDKButtonboxVerticalChar.3 \ + cdk_calendar.3 activateCDKCalendar.3 \ + cdk_calendar.3 destroyCDKCalendar.3 \ + cdk_calendar.3 drawCDKCalendar.3 \ + cdk_calendar.3 eraseCDKCalendar.3 \ + cdk_calendar.3 getCDKCalendarBox.3 \ + cdk_calendar.3 getCDKCalendarDate.3 \ + cdk_calendar.3 getCDKCalendarDayAttribute.3 \ + cdk_calendar.3 getCDKCalendarHighlight.3 \ + cdk_calendar.3 getCDKCalendarMarker.3 \ + cdk_calendar.3 getCDKCalendarMonthAttribute.3 \ + cdk_calendar.3 getCDKCalendarYearAttribute.3 \ + cdk_calendar.3 injectCDKCalendar.3 \ + cdk_calendar.3 moveCDKCalendar.3 \ + cdk_calendar.3 newCDKCalendar.3 \ + cdk_calendar.3 positionCDKCalendar.3 \ + cdk_calendar.3 removeCDKCalendarMarker.3 \ + cdk_calendar.3 setCDKCalendar.3 \ + cdk_calendar.3 setCDKCalendarBackgroundAttrib.3 \ + cdk_calendar.3 setCDKCalendarBackgroundColor.3 \ + cdk_calendar.3 setCDKCalendarBox.3 \ + cdk_calendar.3 setCDKCalendarBoxAttribute.3 \ + cdk_calendar.3 setCDKCalendarDate.3 \ + cdk_calendar.3 setCDKCalendarDaysNames.3 \ + cdk_calendar.3 setCDKCalendarDayAttribute.3 \ + cdk_calendar.3 setCDKCalendarHighlight.3 \ + cdk_calendar.3 setCDKCalendarHorizontalChar.3 \ + cdk_calendar.3 setCDKCalendarMarker.3 \ + cdk_calendar.3 setCDKCalendarLLChar.3 \ + cdk_calendar.3 setCDKCalendarLRChar.3 \ + cdk_calendar.3 setCDKCalendarMonthAttribute.3 \ + cdk_calendar.3 setCDKCalendarMonthsNames.3 \ + cdk_calendar.3 setCDKCalendarPostProcess.3 \ + cdk_calendar.3 setCDKCalendarPreProcess.3 \ + cdk_calendar.3 setCDKCalendarURChar.3 \ + cdk_calendar.3 setCDKCalendarULChar.3 \ + cdk_calendar.3 setCDKCalendarVerticalChar.3 \ + cdk_calendar.3 setCDKCalendarYearAttribute.3 \ + cdk_compat.3 getDirectoryContents.3 \ + cdk_compat.3 readFile.3 \ + cdk_compat.3 splitString.3 \ + cdk_dialog.3 activateCDKDialog.3 \ + cdk_dialog.3 destroyCDKDialog.3 \ + cdk_dialog.3 drawCDKDialog.3 \ + cdk_dialog.3 drawCDKDialogButtons.3 \ + cdk_dialog.3 eraseCDKDialog.3 \ + cdk_dialog.3 getCDKDialog.3 \ + cdk_dialog.3 getCDKDialogBox.3 \ + cdk_dialog.3 getCDKDialogHighlight.3 \ + cdk_dialog.3 getCDKDialogSeparator.3 \ + cdk_dialog.3 injectCDKDialog.3 \ + cdk_dialog.3 moveCDKDialog.3 \ + cdk_dialog.3 newCDKDialog.3 \ + cdk_dialog.3 positionCDKDialog.3 \ + cdk_dialog.3 setCDKDialog.3 \ + cdk_dialog.3 setCDKDialogBackgroundAttrib.3 \ + cdk_dialog.3 setCDKDialogBackgroundColor.3 \ + cdk_dialog.3 setCDKDialogBox.3 \ + cdk_dialog.3 setCDKDialogBoxAttribute.3 \ + cdk_dialog.3 setCDKDialogHighlight.3 \ + cdk_dialog.3 setCDKDialogHorizontalChar.3 \ + cdk_dialog.3 setCDKDialogLLChar.3 \ + cdk_dialog.3 setCDKDialogLRChar.3 \ + cdk_dialog.3 setCDKDialogPostProcess.3 \ + cdk_dialog.3 setCDKDialogPreProcess.3 \ + cdk_dialog.3 setCDKDialogSeparator.3 \ + cdk_dialog.3 setCDKDialogULChar.3 \ + cdk_dialog.3 setCDKDialogURChar.3 \ + cdk_dialog.3 setCDKDialogVerticalChar.3 \ + cdk_dscale.3 activateCDKDScale.3 \ + cdk_dscale.3 destroyCDKDScale.3 \ + cdk_dscale.3 drawCDKDScale.3 \ + cdk_dscale.3 eraseCDKDScale.3 \ + cdk_dscale.3 getCDKDScaleBox.3 \ + cdk_dscale.3 getCDKDScaleDigits.3 \ + cdk_dscale.3 getCDKDScaleHighValue.3 \ + cdk_dscale.3 getCDKDScaleLowValue.3 \ + cdk_dscale.3 getCDKDScaleValue.3 \ + cdk_dscale.3 injectCDKDScale.3 \ + cdk_dscale.3 moveCDKDScale.3 \ + cdk_dscale.3 newCDKDScale.3 \ + cdk_dscale.3 positionCDKDScale.3 \ + cdk_dscale.3 setCDKDScale.3 \ + cdk_dscale.3 setCDKDScaleBackgroundAttrib.3 \ + cdk_dscale.3 setCDKDScaleBackgroundColor.3 \ + cdk_dscale.3 setCDKDScaleBox.3 \ + cdk_dscale.3 setCDKDScaleBoxAttribute.3 \ + cdk_dscale.3 setCDKDScaleDigits.3 \ + cdk_dscale.3 setCDKDScaleHorizontalChar.3 \ + cdk_dscale.3 setCDKDScaleLLChar.3 \ + cdk_dscale.3 setCDKDScaleLRChar.3 \ + cdk_dscale.3 setCDKDScaleLowHigh.3 \ + cdk_dscale.3 setCDKDScalePostProcess.3 \ + cdk_dscale.3 setCDKDScalePreProcess.3 \ + cdk_dscale.3 setCDKDScaleULChar.3 \ + cdk_dscale.3 setCDKDScaleURChar.3 \ + cdk_dscale.3 setCDKDScaleValue.3 \ + cdk_dscale.3 setCDKDScaleVerticalChar.3 \ + cdk_entry.3 activateCDKEntry.3 \ + cdk_entry.3 cleanCDKEntry.3 \ + cdk_entry.3 destroyCDKEntry.3 \ + cdk_entry.3 drawCDKEntry.3 \ + cdk_entry.3 eraseCDKEntry.3 \ + cdk_entry.3 getCDKEntryBox.3 \ + cdk_entry.3 getCDKEntryFillerChar.3 \ + cdk_entry.3 getCDKEntryHiddenChar.3 \ + cdk_entry.3 getCDKEntryMax.3 \ + cdk_entry.3 getCDKEntryMin.3 \ + cdk_entry.3 getCDKEntryValue.3 \ + cdk_entry.3 injectCDKEntry.3 \ + cdk_entry.3 moveCDKEntry.3 \ + cdk_entry.3 newCDKEntry.3 \ + cdk_entry.3 positionCDKEntry.3 \ + cdk_entry.3 setCDKEntry.3 \ + cdk_entry.3 setCDKEntryBackgroundAttrib.3 \ + cdk_entry.3 setCDKEntryBackgroundColor.3 \ + cdk_entry.3 setCDKEntryBox.3 \ + cdk_entry.3 setCDKEntryBoxAttribute.3 \ + cdk_entry.3 setCDKEntryCB.3 \ + cdk_entry.3 setCDKEntryFillerChar.3 \ + cdk_entry.3 setCDKEntryHiddenChar.3 \ + cdk_entry.3 setCDKEntryHighlight.3 \ + cdk_entry.3 setCDKEntryHorizontalChar.3 \ + cdk_entry.3 setCDKEntryLLChar.3 \ + cdk_entry.3 setCDKEntryLRChar.3 \ + cdk_entry.3 setCDKEntryMax.3 \ + cdk_entry.3 setCDKEntryMin.3 \ + cdk_entry.3 setCDKEntryPostProcess.3 \ + cdk_entry.3 setCDKEntryPreProcess.3 \ + cdk_entry.3 setCDKEntryULChar.3 \ + cdk_entry.3 setCDKEntryURChar.3 \ + cdk_entry.3 setCDKEntryValue.3 \ + cdk_entry.3 setCDKEntryVerticalChar.3 \ + cdk_fscale.3 activateCDKFScale.3 \ + cdk_fscale.3 destroyCDKFScale.3 \ + cdk_fscale.3 drawCDKFScale.3 \ + cdk_fscale.3 eraseCDKFScale.3 \ + cdk_fscale.3 getCDKFScaleBox.3 \ + cdk_fscale.3 getCDKFScaleDigits.3 \ + cdk_fscale.3 getCDKFScaleHighValue.3 \ + cdk_fscale.3 getCDKFScaleLowValue.3 \ + cdk_fscale.3 getCDKFScaleValue.3 \ + cdk_fscale.3 injectCDKFScale.3 \ + cdk_fscale.3 moveCDKFScale.3 \ + cdk_fscale.3 newCDKFScale.3 \ + cdk_fscale.3 positionCDKFScale.3 \ + cdk_fscale.3 setCDKFScale.3 \ + cdk_fscale.3 setCDKFScaleBackgroundColor.3 \ + cdk_fscale.3 setCDKFScaleBox.3 \ + cdk_fscale.3 setCDKFScaleBoxAttribute.3 \ + cdk_fscale.3 setCDKFScaleDigits.3 \ + cdk_fscale.3 setCDKFScaleHorizontalChar.3 \ + cdk_fscale.3 setCDKFScaleLLChar.3 \ + cdk_fscale.3 setCDKFScaleLRChar.3 \ + cdk_fscale.3 setCDKFScaleLowHigh.3 \ + cdk_fscale.3 setCDKFScalePostProcess.3 \ + cdk_fscale.3 setCDKFScalePreProcess.3 \ + cdk_fscale.3 setCDKFScaleULChar.3 \ + cdk_fscale.3 setCDKFScaleURChar.3 \ + cdk_fscale.3 setCDKFScaleValue.3 \ + cdk_fscale.3 setCDKFScaleVerticalChar.3 \ + cdk_fselect.3 activateCDKFselect.3 \ + cdk_fselect.3 deleteFileCB.3 \ + cdk_fselect.3 destroyCDKFselect.3 \ + cdk_fselect.3 drawCDKFselect.3 \ + cdk_fselect.3 eraseCDKFselect.3 \ + cdk_fselect.3 getCDKFselectBox.3 \ + cdk_fselect.3 getCDKFselectContents.3 \ + cdk_fselect.3 getCDKFselectCurrentItem.3 \ + cdk_fselect.3 getCDKFselectDirAttribute.3 \ + cdk_fselect.3 getCDKFselectDirContents.3 \ + cdk_fselect.3 getCDKFselectDirectory.3 \ + cdk_fselect.3 getCDKFselectFileAttribute.3 \ + cdk_fselect.3 getCDKFselectFillerChar.3 \ + cdk_fselect.3 getCDKFselectHighlight.3 \ + cdk_fselect.3 getCDKFselectLinkAttribute.3 \ + cdk_fselect.3 getCDKFselectSocketAttribute.3 \ + cdk_fselect.3 injectCDKFselect.3 \ + cdk_fselect.3 moveCDKFselect.3 \ + cdk_fselect.3 newCDKFselect.3 \ + cdk_fselect.3 positionCDKFselect.3 \ + cdk_fselect.3 setCDKFselect.3 \ + cdk_fselect.3 setCDKFselectBackgroundColor.3 \ + cdk_fselect.3 setCDKFselectBackgroundAttrib.3 \ + cdk_fselect.3 setCDKFselectBox.3 \ + cdk_fselect.3 setCDKFselectBoxAttribute.3 \ + cdk_fselect.3 setCDKFselectContents.3 \ + cdk_fselect.3 setCDKFselectCurrentItem.3 \ + cdk_fselect.3 setCDKFselectDirAttribute.3 \ + cdk_fselect.3 setCDKFselectDirContents.3 \ + cdk_fselect.3 setCDKFselectDirectory.3 \ + cdk_fselect.3 setCDKFselectFileAttribute.3 \ + cdk_fselect.3 setCDKFselectFillerChar.3 \ + cdk_fselect.3 setCDKFselectHighlight.3 \ + cdk_fselect.3 setCDKFselectHorizontalChar.3 \ + cdk_fselect.3 setCDKFselectLLChar.3 \ + cdk_fselect.3 setCDKFselectLRChar.3 \ + cdk_fselect.3 setCDKFselectLinkAttribute.3 \ + cdk_fselect.3 setCDKFselectSocketAttribute.3 \ + cdk_fselect.3 setCDKFselectULChar.3 \ + cdk_fselect.3 setCDKFselectURChar.3 \ + cdk_fselect.3 setCDKFselectVerticalChar.3 \ + cdk_fslider.3 activateCDKFSlider.3 \ + cdk_fslider.3 destroyCDKFSlider.3 \ + cdk_fslider.3 drawCDKFSlider.3 \ + cdk_fslider.3 eraseCDKFSlider.3 \ + cdk_fslider.3 getCDKFSliderBox.3 \ + cdk_fslider.3 getCDKFSliderDigits.3 \ + cdk_fslider.3 getCDKFSliderHighValue.3 \ + cdk_fslider.3 getCDKFSliderLowValue.3 \ + cdk_fslider.3 getCDKFSliderValue.3 \ + cdk_fslider.3 injectCDKFSlider.3 \ + cdk_fslider.3 moveCDKFSlider.3 \ + cdk_fslider.3 newCDKFSlider.3 \ + cdk_fslider.3 positionCDKFSlider.3 \ + cdk_fslider.3 setCDKFSlider.3 \ + cdk_fslider.3 setCDKFSliderBackgroundAttrib.3 \ + cdk_fslider.3 setCDKFSliderBackgroundColor.3 \ + cdk_fslider.3 setCDKFSliderBox.3 \ + cdk_fslider.3 setCDKFSliderBoxAttribute.3 \ + cdk_fslider.3 setCDKFSliderDigits.3 \ + cdk_fslider.3 setCDKFSliderHorizontalChar.3 \ + cdk_fslider.3 setCDKFSliderLLChar.3 \ + cdk_fslider.3 setCDKFSliderLRChar.3 \ + cdk_fslider.3 setCDKFSliderLowHigh.3 \ + cdk_fslider.3 setCDKFSliderPostProcess.3 \ + cdk_fslider.3 setCDKFSliderPreProcess.3 \ + cdk_fslider.3 setCDKFSliderULChar.3 \ + cdk_fslider.3 setCDKFSliderURChar.3 \ + cdk_fslider.3 setCDKFSliderValue.3 \ + cdk_fslider.3 setCDKFSliderVerticalChar.3 \ + cdk_graph.3 activateCDKGraph.3 \ + cdk_graph.3 destroyCDKGraph.3 \ + cdk_graph.3 drawCDKGraph.3 \ + cdk_graph.3 eraseCDKGraph.3 \ + cdk_graph.3 getCDKGraphBox.3 \ + cdk_graph.3 getCDKGraphCharacter.3 \ + cdk_graph.3 getCDKGraphCharacters.3 \ + cdk_graph.3 getCDKGraphDisplayType.3 \ + cdk_graph.3 getCDKGraphValue.3 \ + cdk_graph.3 getCDKGraphValues.3 \ + cdk_graph.3 moveCDKGraph.3 \ + cdk_graph.3 newCDKGraph.3 \ + cdk_graph.3 positionCDKGraph.3 \ + cdk_graph.3 setCDKGraph.3 \ + cdk_graph.3 setCDKGraphBackgroundAttrib.3 \ + cdk_graph.3 setCDKGraphBackgroundColor.3 \ + cdk_graph.3 setCDKGraphBox.3 \ + cdk_graph.3 setCDKGraphBoxAttribute.3 \ + cdk_graph.3 setCDKGraphCharacter.3 \ + cdk_graph.3 setCDKGraphCharacters.3 \ + cdk_graph.3 setCDKGraphDisplayType.3 \ + cdk_graph.3 setCDKGraphHorizontalChar.3 \ + cdk_graph.3 setCDKGraphLLChar.3 \ + cdk_graph.3 setCDKGraphLRChar.3 \ + cdk_graph.3 setCDKGraphULChar.3 \ + cdk_graph.3 setCDKGraphURChar.3 \ + cdk_graph.3 setCDKGraphValue.3 \ + cdk_graph.3 setCDKGraphValues.3 \ + cdk_graph.3 setCDKGraphVerticalChar.3 \ + cdk_histogram.3 activateCDKHistogram.3 \ + cdk_histogram.3 destroyCDKHistogram.3 \ + cdk_histogram.3 drawCDKHistogram.3 \ + cdk_histogram.3 eraseCDKHistogram.3 \ + cdk_histogram.3 getCDKHistogramBox.3 \ + cdk_histogram.3 getCDKHistogramFillerChar.3 \ + cdk_histogram.3 getCDKHistogramHighValue.3 \ + cdk_histogram.3 getCDKHistogramLowValue.3 \ + cdk_histogram.3 getCDKHistogramStatsAttr.3 \ + cdk_histogram.3 getCDKHistogramStatsPos.3 \ + cdk_histogram.3 getCDKHistogramValue.3 \ + cdk_histogram.3 getCDKHistogramViewType.3 \ + cdk_histogram.3 moveCDKHistogram.3 \ + cdk_histogram.3 newCDKHistogram.3 \ + cdk_histogram.3 setCDKHistogram.3 \ + cdk_histogram.3 positionCDKHistogram.3 \ + cdk_histogram.3 setCDKHistogramBackgroundAttrib.3 \ + cdk_histogram.3 setCDKHistogramBackgroundColor.3 \ + cdk_histogram.3 setCDKHistogramBox.3 \ + cdk_histogram.3 setCDKHistogramBoxAttribute.3 \ + cdk_histogram.3 setCDKHistogramDisplayType.3 \ + cdk_histogram.3 setCDKHistogramFillerChar.3 \ + cdk_histogram.3 setCDKHistogramHorizontalChar.3 \ + cdk_histogram.3 setCDKHistogramLLChar.3 \ + cdk_histogram.3 setCDKHistogramLRChar.3 \ + cdk_histogram.3 setCDKHistogramStatsAttr.3 \ + cdk_histogram.3 setCDKHistogramStatsPos.3 \ + cdk_histogram.3 setCDKHistogramULChar.3 \ + cdk_histogram.3 setCDKHistogramURChar.3 \ + cdk_histogram.3 setCDKHistogramValue.3 \ + cdk_histogram.3 setCDKHistogramVerticalChar.3 \ + cdk_histogram.3 setCDKHistogramViewType.3 \ + cdk_itemlist.3 activateCDKItemlist.3 \ + cdk_itemlist.3 destroyCDKItemlist.3 \ + cdk_itemlist.3 drawCDKItemlist.3 \ + cdk_itemlist.3 drawCDKItemlistField.3 \ + cdk_itemlist.3 eraseCDKItemlist.3 \ + cdk_itemlist.3 getCDKItemlistBox.3 \ + cdk_itemlist.3 getCDKItemlistCurrentItem.3 \ + cdk_itemlist.3 getCDKItemlistDefaultItem.3 \ + cdk_itemlist.3 getCDKItemlistValues.3 \ + cdk_itemlist.3 injectCDKItemlist.3 \ + cdk_itemlist.3 moveCDKItemlist.3 \ + cdk_itemlist.3 newCDKItemlist.3 \ + cdk_itemlist.3 positionCDKItemlist.3 \ + cdk_itemlist.3 setCDKItemlist.3 \ + cdk_itemlist.3 setCDKItemlistBackgroundAttrib.3 \ + cdk_itemlist.3 setCDKItemlistBackgroundColor.3 \ + cdk_itemlist.3 setCDKItemlistBox.3 \ + cdk_itemlist.3 setCDKItemlistBoxAttribute.3 \ + cdk_itemlist.3 setCDKItemlistCurrentItem.3 \ + cdk_itemlist.3 setCDKItemlistDefaultItem.3 \ + cdk_itemlist.3 setCDKItemlistHorizontalChar.3 \ + cdk_itemlist.3 setCDKItemlistLLChar.3 \ + cdk_itemlist.3 setCDKItemlistLRChar.3 \ + cdk_itemlist.3 setCDKItemlistPostProcess.3 \ + cdk_itemlist.3 setCDKItemlistPreProcess.3 \ + cdk_itemlist.3 setCDKItemlistULChar.3 \ + cdk_itemlist.3 setCDKItemlistURChar.3 \ + cdk_itemlist.3 setCDKItemlistValues.3 \ + cdk_itemlist.3 setCDKItemlistVerticalChar.3 \ + cdk_label.3 activateCDKLabel.3 \ + cdk_label.3 destroyCDKLabel.3 \ + cdk_label.3 drawCDKLabel.3 \ + cdk_label.3 eraseCDKLabel.3 \ + cdk_label.3 getCDKLabelBox.3 \ + cdk_label.3 getCDKLabelMessage.3 \ + cdk_label.3 moveCDKLabel.3 \ + cdk_label.3 newCDKLabel.3 \ + cdk_label.3 positionCDKLabel.3 \ + cdk_label.3 setCDKLabel.3 \ + cdk_label.3 setCDKLabelBackgroundAttrib.3 \ + cdk_label.3 setCDKLabelBackgroundColor.3 \ + cdk_label.3 setCDKLabelBox.3 \ + cdk_label.3 setCDKLabelBoxAttribute.3 \ + cdk_label.3 setCDKLabelHorizontalChar.3 \ + cdk_label.3 setCDKLabelLLChar.3 \ + cdk_label.3 setCDKLabelLRChar.3 \ + cdk_label.3 setCDKLabelMessage.3 \ + cdk_label.3 setCDKLabelULChar.3 \ + cdk_label.3 setCDKLabelURChar.3 \ + cdk_label.3 setCDKLabelVerticalChar.3 \ + cdk_label.3 waitCDKLabel.3 \ + cdk_marquee.3 activateCDKMarquee.3 \ + cdk_marquee.3 destroyCDKMarquee.3 \ + cdk_marquee.3 deactivateCDKMarquee.3 \ + cdk_marquee.3 drawCDKMarquee.3 \ + cdk_marquee.3 getCDKMarqueeBox.3 \ + cdk_marquee.3 eraseCDKMarquee.3 \ + cdk_marquee.3 moveCDKMarquee.3 \ + cdk_marquee.3 newCDKMarquee.3 \ + cdk_marquee.3 positionCDKMarquee.3 \ + cdk_marquee.3 setCDKMarqueeBackgroundAttrib.3 \ + cdk_marquee.3 setCDKMarqueeBackgroundColor.3 \ + cdk_marquee.3 setCDKMarqueeBox.3 \ + cdk_marquee.3 setCDKMarqueeBoxAttribute.3 \ + cdk_marquee.3 setCDKMarqueeHorizontalChar.3 \ + cdk_marquee.3 setCDKMarqueeLLChar.3 \ + cdk_marquee.3 setCDKMarqueeLRChar.3 \ + cdk_marquee.3 setCDKMarqueeULChar.3 \ + cdk_marquee.3 setCDKMarqueeURChar.3 \ + cdk_marquee.3 setCDKMarqueeVerticalChar.3 \ + cdk_matrix.3 activateCDKMatrix.3 \ + cdk_matrix.3 cleanCDKMatrix.3 \ + cdk_matrix.3 cleanCDKMatrixCell.3 \ + cdk_matrix.3 destroyCDKMatrix.3 \ + cdk_matrix.3 drawCDKMatrix.3 \ + cdk_matrix.3 eraseCDKMatrix.3 \ + cdk_matrix.3 getCDKMatrixBox.3 \ + cdk_matrix.3 getCDKMatrixCell.3 \ + cdk_matrix.3 getCDKMatrixCol.3 \ + cdk_matrix.3 getCDKMatrixRow.3 \ + cdk_matrix.3 injectCDKMatrix.3 \ + cdk_matrix.3 jumpToCell.3 \ + cdk_matrix.3 moveToCDKMatrixCell.3 \ + cdk_matrix.3 newCDKMatrix.3 \ + cdk_matrix.3 setCDKMatrix.3 \ + cdk_matrix.3 setCDKMatrixBackgroundAttrib.3 \ + cdk_matrix.3 setCDKMatrixBackgroundColor.3 \ + cdk_matrix.3 setCDKMatrixBox.3 \ + cdk_matrix.3 setCDKMatrixBoxAttribute.3 \ + cdk_matrix.3 setCDKMatrixCB.3 \ + cdk_matrix.3 setCDKMatrixCell.3 \ + cdk_matrix.3 setCDKMatrixCells.3 \ + cdk_matrix.3 setCDKMatrixHorizontalChar.3 \ + cdk_matrix.3 setCDKMatrixLLChar.3 \ + cdk_matrix.3 setCDKMatrixLRChar.3 \ + cdk_matrix.3 setCDKMatrixPostProcess.3 \ + cdk_matrix.3 setCDKMatrixPreProcess.3 \ + cdk_matrix.3 setCDKMatrixULChar.3 \ + cdk_matrix.3 setCDKMatrixURChar.3 \ + cdk_matrix.3 setCDKMatrixVerticalChar.3 \ + cdk_mentry.3 activateCDKMentry.3 \ + cdk_mentry.3 cleanCDKMentry.3 \ + cdk_mentry.3 destroyCDKMentry.3 \ + cdk_mentry.3 drawCDKMentry.3 \ + cdk_mentry.3 drawCDKMentryField.3 \ + cdk_mentry.3 eraseCDKMentry.3 \ + cdk_mentry.3 getCDKMentryBox.3 \ + cdk_mentry.3 getCDKMentryFillerChar.3 \ + cdk_mentry.3 getCDKMentryHiddenChar.3 \ + cdk_mentry.3 getCDKMentryMin.3 \ + cdk_mentry.3 getCDKMentryValue.3 \ + cdk_mentry.3 injectCDKMentry.3 \ + cdk_mentry.3 moveCDKMentry.3 \ + cdk_mentry.3 newCDKMentry.3 \ + cdk_mentry.3 positionCDKMentry.3 \ + cdk_mentry.3 setCDKMentry.3 \ + cdk_mentry.3 setCDKMentryBackgroundAttrib.3 \ + cdk_mentry.3 setCDKMentryBackgroundColor.3 \ + cdk_mentry.3 setCDKMentryBox.3 \ + cdk_mentry.3 setCDKMentryBoxAttribute.3 \ + cdk_mentry.3 setCDKMentryCB.3 \ + cdk_mentry.3 setCDKMentryFillerChar.3 \ + cdk_mentry.3 setCDKMentryHiddenChar.3 \ + cdk_mentry.3 setCDKMentryHorizontalChar.3 \ + cdk_mentry.3 setCDKMentryLLChar.3 \ + cdk_mentry.3 setCDKMentryLRChar.3 \ + cdk_mentry.3 setCDKMentryMin.3 \ + cdk_mentry.3 setCDKMentryPostProcess.3 \ + cdk_mentry.3 setCDKMentryPreProcess.3 \ + cdk_mentry.3 setCDKMentryULChar.3 \ + cdk_mentry.3 setCDKMentryURChar.3 \ + cdk_mentry.3 setCDKMentryValue.3 \ + cdk_mentry.3 setCDKMentryVerticalChar.3 \ + cdk_menu.3 activateCDKMenu.3 \ + cdk_menu.3 destroyCDKMenu.3 \ + cdk_menu.3 drawCDKMenu.3 \ + cdk_menu.3 drawCDKMenuSubwin.3 \ + cdk_menu.3 eraseCDKMenu.3 \ + cdk_menu.3 eraseCDKMenuSubwin.3 \ + cdk_menu.3 getCDKMenuCurrentItem.3 \ + cdk_menu.3 getCDKMenuSubTitleHighlight.3 \ + cdk_menu.3 getCDKMenuTitleHighlight.3 \ + cdk_menu.3 injectCDKMenu.3 \ + cdk_menu.3 newCDKMenu.3 \ + cdk_menu.3 setCDKMenu.3 \ + cdk_menu.3 setCDKMenuBackgroundAttrib.3 \ + cdk_menu.3 setCDKMenuBackgroundColor.3 \ + cdk_menu.3 setCDKMenuCurrentItem.3 \ + cdk_menu.3 setCDKMenuPostProcess.3 \ + cdk_menu.3 setCDKMenuPreProcess.3 \ + cdk_menu.3 setCDKMenuSubTitleHighlight.3 \ + cdk_menu.3 setCDKMenuTitleHighlight.3 \ + cdk_misc.3 Beep.3 \ + cdk_misc.3 CDKcountStrings.3 \ + cdk_misc.3 CDKfreeStrings.3 \ + cdk_misc.3 CDKgetDirectoryContents.3 \ + cdk_misc.3 CDKreadFile.3 \ + cdk_misc.3 CDKsplitString.3 \ + cdk_misc.3 baseName.3 \ + cdk_misc.3 char2Chtype.3 \ + cdk_misc.3 chlen.3 \ + cdk_misc.3 chtype2Char.3 \ + cdk_misc.3 cleanChar.3 \ + cdk_misc.3 cleanChtype.3 \ + cdk_misc.3 copyChar.3 \ + cdk_misc.3 copyCharList.3 \ + cdk_misc.3 copyChtypeList.3 \ + cdk_misc.3 copyChtype.3 \ + cdk_misc.3 freeChar.3 \ + cdk_misc.3 freeChtype.3 \ + cdk_misc.3 getListIndex.3 \ + cdk_misc.3 getString.3 \ + cdk_misc.3 intlen.3 \ + cdk_misc.3 lenCharList.3 \ + cdk_misc.3 lenChtypeList.3 \ + cdk_misc.3 mode2Char.3 \ + cdk_misc.3 popupDialog.3 \ + cdk_misc.3 popupLabel.3 \ + cdk_misc.3 searchList.3 \ + cdk_misc.3 sortList.3 \ + cdk_misc.3 stripWhiteSpace.3 \ + cdk_misc.3 viewFile.3 \ + cdk_objs.3 cleanCdkTitle.3 \ + cdk_objs.3 drawCdkTitle.3 \ + cdk_objs.3 positionCDKObject.3 \ + cdk_objs.3 setCdkExitType.3 \ + cdk_objs.3 setCDKObjectBackgroundColor.3 \ + cdk_objs.3 setCDKObjectPostProcess.3 \ + cdk_objs.3 setCDKObjectPreProcess.3 \ + cdk_objs.3 setCdkTitle.3 \ + cdk_objs.3 validCDKObject.3 \ + cdk_params.3 CDKparamNumber.3 \ + cdk_params.3 CDKparamNumber2.3 \ + cdk_params.3 CDKparamString.3 \ + cdk_params.3 CDKparamString2.3 \ + cdk_params.3 CDKparamValue.3 \ + cdk_params.3 CDKparseParams.3 \ + cdk_params.3 CDKparsePosition.3 \ + cdk_radio.3 activateCDKRadio.3 \ + cdk_radio.3 destroyCDKRadio.3 \ + cdk_radio.3 drawCDKRadio.3 \ + cdk_radio.3 eraseCDKRadio.3 \ + cdk_radio.3 getCDKRadioBox.3 \ + cdk_radio.3 getCDKRadioChoiceCharacter.3 \ + cdk_radio.3 getCDKRadioCurrentItem.3 \ + cdk_radio.3 getCDKRadioHighlight.3 \ + cdk_radio.3 getCDKRadioItems.3 \ + cdk_radio.3 getCDKRadioLeftBrace.3 \ + cdk_radio.3 getCDKRadioSelectedItem.3 \ + cdk_radio.3 injectCDKRadio.3 \ + cdk_radio.3 getCDKRadioRightBrace.3 \ + cdk_radio.3 moveCDKRadio.3 \ + cdk_radio.3 newCDKRadio.3 \ + cdk_radio.3 positionCDKRadio.3 \ + cdk_radio.3 setCDKRadio.3 \ + cdk_radio.3 setCDKRadioBackgroundAttrib.3 \ + cdk_radio.3 setCDKRadioBackgroundColor.3 \ + cdk_radio.3 setCDKRadioBox.3 \ + cdk_radio.3 setCDKRadioBoxAttribute.3 \ + cdk_radio.3 setCDKRadioChoiceCharacter.3 \ + cdk_radio.3 setCDKRadioCurrentItem.3 \ + cdk_radio.3 setCDKRadioHighlight.3 \ + cdk_radio.3 setCDKRadioHorizontalChar.3 \ + cdk_radio.3 setCDKRadioItems.3 \ + cdk_radio.3 setCDKRadioLLChar.3 \ + cdk_radio.3 setCDKRadioLRChar.3 \ + cdk_radio.3 setCDKRadioLeftBrace.3 \ + cdk_radio.3 setCDKRadioPostProcess.3 \ + cdk_radio.3 setCDKRadioPreProcess.3 \ + cdk_radio.3 setCDKRadioRightBrace.3 \ + cdk_radio.3 setCDKRadioSelectedItem.3 \ + cdk_radio.3 setCDKRadioULChar.3 \ + cdk_radio.3 setCDKRadioURChar.3 \ + cdk_radio.3 setCDKRadioVerticalChar.3 \ + cdk_scale.3 activateCDKScale.3 \ + cdk_scale.3 destroyCDKScale.3 \ + cdk_scale.3 drawCDKScale.3 \ + cdk_scale.3 eraseCDKScale.3 \ + cdk_scale.3 getCDKScaleBox.3 \ + cdk_scale.3 getCDKScaleHighValue.3 \ + cdk_scale.3 getCDKScaleLowValue.3 \ + cdk_scale.3 getCDKScaleValue.3 \ + cdk_scale.3 injectCDKScale.3 \ + cdk_scale.3 moveCDKScale.3 \ + cdk_scale.3 newCDKScale.3 \ + cdk_scale.3 positionCDKScale.3 \ + cdk_scale.3 setCDKScale.3 \ + cdk_scale.3 setCDKScaleBackgroundAttrib.3 \ + cdk_scale.3 setCDKFScaleBackgroundAttrib.3 \ + cdk_scale.3 setCDKScaleBackgroundColor.3 \ + cdk_scale.3 setCDKScaleBox.3 \ + cdk_scale.3 setCDKScaleBoxAttribute.3 \ + cdk_scale.3 setCDKScaleHorizontalChar.3 \ + cdk_scale.3 setCDKScaleLLChar.3 \ + cdk_scale.3 setCDKScaleLRChar.3 \ + cdk_scale.3 setCDKScaleLowHigh.3 \ + cdk_scale.3 setCDKScalePostProcess.3 \ + cdk_scale.3 setCDKScalePreProcess.3 \ + cdk_scale.3 setCDKScaleULChar.3 \ + cdk_scale.3 setCDKScaleURChar.3 \ + cdk_scale.3 setCDKScaleValue.3 \ + cdk_scale.3 setCDKScaleVerticalChar.3 \ + cdk_screen.3 destroyCDKScreen.3 \ + cdk_screen.3 endCDK.3 \ + cdk_screen.3 initCDKColor.3 \ + cdk_screen.3 eraseCDKScreen.3 \ + cdk_screen.3 initCDKScreen.3 \ + cdk_screen.3 lowerCDKObject.3 \ + cdk_screen.3 raiseCDKObject.3 \ + cdk_screen.3 refreshCDKScreen.3 \ + cdk_screen.3 registerCDKObject.3 \ + cdk_screen.3 unregisterCDKObject.3 \ + cdk_scroll.3 activateCDKScroll.3 \ + cdk_scroll.3 addCDKScrollItem.3 \ + cdk_scroll.3 deleteCDKScrollItem.3 \ + cdk_scroll.3 destroyCDKScroll.3 \ + cdk_scroll.3 drawCDKScroll.3 \ + cdk_scroll.3 eraseCDKScroll.3 \ + cdk_scroll.3 getCDKScrollBox.3 \ + cdk_scroll.3 getCDKScrollCurrent.3 \ + cdk_scroll.3 getCDKScrollCurrentItem.3 \ + cdk_scroll.3 getCDKScrollCurrentTop.3 \ + cdk_scroll.3 getCDKScrollHighlight.3 \ + cdk_scroll.3 getCDKScrollItems.3 \ + cdk_scroll.3 injectCDKScroll.3 \ + cdk_scroll.3 insertCDKScrollItem.3 \ + cdk_scroll.3 moveCDKScroll.3 \ + cdk_scroll.3 newCDKScroll.3 \ + cdk_scroll.3 positionCDKScroll.3 \ + cdk_scroll.3 setCDKScroll.3 \ + cdk_scroll.3 setCDKScrollBackgroundAttrib.3 \ + cdk_scroll.3 setCDKScrollBackgroundColor.3 \ + cdk_scroll.3 setCDKScrollBox.3 \ + cdk_scroll.3 setCDKScrollBoxAttribute.3 \ + cdk_scroll.3 setCDKScrollCurrent.3 \ + cdk_scroll.3 setCDKScrollCurrentItem.3 \ + cdk_scroll.3 setCDKScrollCurrentTop.3 \ + cdk_scroll.3 setCDKScrollHighlight.3 \ + cdk_scroll.3 setCDKScrollHorizontalChar.3 \ + cdk_scroll.3 setCDKScrollItems.3 \ + cdk_scroll.3 setCDKScrollLLChar.3 \ + cdk_scroll.3 setCDKScrollLRChar.3 \ + cdk_scroll.3 setCDKScrollPosition.3 \ + cdk_scroll.3 setCDKScrollPostProcess.3 \ + cdk_scroll.3 setCDKScrollPreProcess.3 \ + cdk_scroll.3 setCDKScrollULChar.3 \ + cdk_scroll.3 setCDKScrollURChar.3 \ + cdk_scroll.3 setCDKScrollVerticalChar.3 \ + cdk_selection.3 activateCDKSelection.3 \ + cdk_selection.3 destroyCDKSelection.3 \ + cdk_selection.3 drawCDKSelection.3 \ + cdk_selection.3 eraseCDKSelection.3 \ + cdk_selection.3 getCDKSelectionBox.3 \ + cdk_selection.3 getCDKSelectionChoice.3 \ + cdk_selection.3 getCDKSelectionChoices.3 \ + cdk_selection.3 getCDKSelectionCurrent.3 \ + cdk_selection.3 getCDKSelectionHighlight.3 \ + cdk_selection.3 getCDKSelectionItems.3 \ + cdk_selection.3 getCDKSelectionMode.3 \ + cdk_selection.3 getCDKSelectionModes.3 \ + cdk_selection.3 getCDKSelectionTitle.3 \ + cdk_selection.3 injectCDKSelection.3 \ + cdk_selection.3 moveCDKSelection.3 \ + cdk_selection.3 newCDKSelection.3 \ + cdk_selection.3 positionCDKSelection.3 \ + cdk_selection.3 setCDKSelection.3 \ + cdk_selection.3 setCDKSelectionBackgroundAttrib.3 \ + cdk_selection.3 setCDKSelectionBackgroundColor.3 \ + cdk_selection.3 setCDKSelectionBox.3 \ + cdk_selection.3 setCDKSelectionBoxAttribute.3 \ + cdk_selection.3 setCDKSelectionChoice.3 \ + cdk_selection.3 setCDKSelectionChoices.3 \ + cdk_selection.3 setCDKSelectionCurrent.3 \ + cdk_selection.3 setCDKSelectionHighlight.3 \ + cdk_selection.3 setCDKSelectionHorizontalChar.3 \ + cdk_selection.3 setCDKSelectionItems.3 \ + cdk_selection.3 setCDKSelectionLLChar.3 \ + cdk_selection.3 setCDKSelectionLRChar.3 \ + cdk_selection.3 setCDKSelectionMode.3 \ + cdk_selection.3 setCDKSelectionModes.3 \ + cdk_selection.3 setCDKSelectionPostProcess.3 \ + cdk_selection.3 setCDKSelectionPreProcess.3 \ + cdk_selection.3 setCDKSelectionTitle.3 \ + cdk_selection.3 setCDKSelectionULChar.3 \ + cdk_selection.3 setCDKSelectionURChar.3 \ + cdk_selection.3 setCDKSelectionVerticalChar.3 \ + cdk_slider.3 activateCDKSlider.3 \ + cdk_slider.3 destroyCDKSlider.3 \ + cdk_slider.3 drawCDKSlider.3 \ + cdk_slider.3 eraseCDKSlider.3 \ + cdk_slider.3 getCDKSliderBox.3 \ + cdk_slider.3 getCDKSliderHighValue.3 \ + cdk_slider.3 getCDKSliderLowValue.3 \ + cdk_slider.3 getCDKSliderValue.3 \ + cdk_slider.3 injectCDKSlider.3 \ + cdk_slider.3 moveCDKSlider.3 \ + cdk_slider.3 newCDKSlider.3 \ + cdk_slider.3 positionCDKSlider.3 \ + cdk_slider.3 setCDKSlider.3 \ + cdk_slider.3 setCDKSliderBox.3 \ + cdk_slider.3 setCDKSliderBackgroundAttrib.3 \ + cdk_slider.3 setCDKSliderBackgroundColor.3 \ + cdk_slider.3 setCDKSliderBoxAttribute.3 \ + cdk_slider.3 setCDKSliderHorizontalChar.3 \ + cdk_slider.3 setCDKSliderLLChar.3 \ + cdk_slider.3 setCDKSliderLRChar.3 \ + cdk_slider.3 setCDKSliderLowHigh.3 \ + cdk_slider.3 setCDKSliderPostProcess.3 \ + cdk_slider.3 setCDKSliderPreProcess.3 \ + cdk_slider.3 setCDKSliderULChar.3 \ + cdk_slider.3 setCDKSliderURChar.3 \ + cdk_slider.3 setCDKSliderValue.3 \ + cdk_slider.3 setCDKSliderVerticalChar.3 \ + cdk_swindow.3 activateCDKSwindow.3 \ + cdk_swindow.3 addCDKSwindow.3 \ + cdk_swindow.3 cleanCDKSwindow.3 \ + cdk_swindow.3 destroyCDKSwindow.3 \ + cdk_swindow.3 drawCDKSwindow.3 \ + cdk_swindow.3 dumpCDKSwindow.3 \ + cdk_swindow.3 dumpCDKSwindowInformation.3 \ + cdk_swindow.3 eraseCDKSwindow.3 \ + cdk_swindow.3 execCDKSwindow.3 \ + cdk_swindow.3 getCDKSwindowBox.3 \ + cdk_swindow.3 getCDKSwindowContents.3 \ + cdk_swindow.3 injectCDKSwindow.3 \ + cdk_swindow.3 jumpToLineCDKSwindow.3 \ + cdk_swindow.3 loadCDKSwindowInformation.3 \ + cdk_swindow.3 moveCDKSwindow.3 \ + cdk_swindow.3 newCDKSwindow.3 \ + cdk_swindow.3 positionCDKSwindow.3 \ + cdk_swindow.3 saveCDKSwindowInformation.3 \ + cdk_swindow.3 setCDKSwindow.3 \ + cdk_swindow.3 setCDKSwindowBackgroundAttrib.3 \ + cdk_swindow.3 setCDKSwindowBackgroundColor.3 \ + cdk_swindow.3 setCDKSwindowBox.3 \ + cdk_swindow.3 setCDKSwindowBoxAttribute.3 \ + cdk_swindow.3 setCDKSwindowContents.3 \ + cdk_swindow.3 setCDKSwindowHorizontalChar.3 \ + cdk_swindow.3 setCDKSwindowLLChar.3 \ + cdk_swindow.3 setCDKSwindowLRChar.3 \ + cdk_swindow.3 setCDKSwindowPostProcess.3 \ + cdk_swindow.3 setCDKSwindowPreProcess.3 \ + cdk_swindow.3 setCDKSwindowULChar.3 \ + cdk_swindow.3 setCDKSwindowURChar.3 \ + cdk_swindow.3 setCDKSwindowVerticalChar.3 \ + cdk_swindow.3 trimCDKSwindow.3 \ + cdk_template.3 activateCDKTemplate.3 \ + cdk_template.3 cleanCDKTemplate.3 \ + cdk_template.3 destroyCDKTemplate.3 \ + cdk_template.3 drawCDKTemplate.3 \ + cdk_template.3 eraseCDKTemplate.3 \ + cdk_template.3 getCDKTemplateBox.3 \ + cdk_template.3 getCDKTemplateMin.3 \ + cdk_template.3 getCDKTemplateValue.3 \ + cdk_template.3 injectCDKTemplate.3 \ + cdk_template.3 mixCDKTemplate.3 \ + cdk_template.3 newCDKTemplate.3 \ + cdk_template.3 setCDKTemplate.3 \ + cdk_template.3 setCDKTemplateBackgroundAttrib.3 \ + cdk_template.3 setCDKTemplateBackgroundColor.3 \ + cdk_template.3 setCDKTemplateBox.3 \ + cdk_template.3 setCDKTemplateBoxAttribute.3 \ + cdk_template.3 setCDKTemplateCB.3 \ + cdk_template.3 setCDKTemplateHorizontalChar.3 \ + cdk_template.3 setCDKTemplateLLChar.3 \ + cdk_template.3 setCDKTemplateLRChar.3 \ + cdk_template.3 setCDKTemplateMin.3 \ + cdk_template.3 setCDKTemplatePostProcess.3 \ + cdk_template.3 setCDKTemplatePreProcess.3 \ + cdk_template.3 setCDKTemplateULChar.3 \ + cdk_template.3 setCDKTemplateURChar.3 \ + cdk_template.3 setCDKTemplateValue.3 \ + cdk_template.3 setCDKTemplateVerticalChar.3 \ + cdk_template.3 unmixCDKTemplate.3 \ + cdk_traverse.3 exitCancelCDKScreen.3 \ + cdk_traverse.3 exitCancelCDKScreenOf.3 \ + cdk_traverse.3 exitOKCDKScreen.3 \ + cdk_traverse.3 exitOKCDKScreenOf.3 \ + cdk_traverse.3 getCDKFocusCurrent.3 \ + cdk_traverse.3 resetCDKScreen.3 \ + cdk_traverse.3 resetCDKScreenOf.3 \ + cdk_traverse.3 setCDKFocusCurrent.3 \ + cdk_traverse.3 setCDKFocusFirst.3 \ + cdk_traverse.3 setCDKFocusLast.3 \ + cdk_traverse.3 setCDKFocusNext.3 \ + cdk_traverse.3 setCDKFocusPrevious.3 \ + cdk_traverse.3 traverseCDKOnce.3 \ + cdk_traverse.3 traverseCDKScreen.3 \ + cdk_viewer.3 activateCDKViewer.3 \ + cdk_viewer.3 cleanCDKViewer.3 \ + cdk_viewer.3 destroyCDKViewer.3 \ + cdk_viewer.3 drawCDKViewer.3 \ + cdk_viewer.3 eraseCDKViewer.3 \ + cdk_viewer.3 getCDKViewerBox.3 \ + cdk_viewer.3 getCDKViewerHighlight.3 \ + cdk_viewer.3 getCDKViewerInfo.3 \ + cdk_viewer.3 getCDKViewerInfoLine.3 \ + cdk_viewer.3 getCDKViewerTitle.3 \ + cdk_viewer.3 moveCDKViewer.3 \ + cdk_viewer.3 newCDKViewer.3 \ + cdk_viewer.3 positionCDKViewer.3 \ + cdk_viewer.3 setCDKViewer.3 \ + cdk_viewer.3 setCDKViewerBackgroundAttrib.3 \ + cdk_viewer.3 setCDKViewerBackgroundColor.3 \ + cdk_viewer.3 setCDKViewerBox.3 \ + cdk_viewer.3 setCDKViewerBoxAttribute.3 \ + cdk_viewer.3 setCDKViewerHighlight.3 \ + cdk_viewer.3 setCDKViewerHorizontalChar.3 \ + cdk_viewer.3 setCDKViewerInfo.3 \ + cdk_viewer.3 setCDKViewerInfoLine.3 \ + cdk_viewer.3 setCDKViewerLLChar.3 \ + cdk_viewer.3 setCDKViewerLRChar.3 \ + cdk_viewer.3 setCDKViewerTitle.3 \ + cdk_viewer.3 setCDKViewerULChar.3 \ + cdk_viewer.3 setCDKViewerURChar.3 \ + cdk_viewer.3 setCDKViewerVerticalChar.3 \ + cdk_uscale.3 activateCDKUScale.3 \ + cdk_uscale.3 destroyCDKUScale.3 \ + cdk_uscale.3 drawCDKUScale.3 \ + cdk_uscale.3 eraseCDKUScale.3 \ + cdk_uscale.3 getCDKUScaleBox.3 \ + cdk_uscale.3 getCDKUScaleHighValue.3 \ + cdk_uscale.3 getCDKUScaleLowValue.3 \ + cdk_uscale.3 getCDKUScaleValue.3 \ + cdk_uscale.3 injectCDKUScale.3 \ + cdk_uscale.3 moveCDKUScale.3 \ + cdk_uscale.3 newCDKUScale.3 \ + cdk_uscale.3 positionCDKUScale.3 \ + cdk_uscale.3 setCDKUScale.3 \ + cdk_uscale.3 setCDKUScaleBackgroundAttrib.3 \ + cdk_uscale.3 setCDKUScaleBackgroundColor.3 \ + cdk_uscale.3 setCDKUScaleBox.3 \ + cdk_uscale.3 setCDKUScaleBoxAttribute.3 \ + cdk_uscale.3 setCDKUScaleHorizontalChar.3 \ + cdk_uscale.3 setCDKUScaleLLChar.3 \ + cdk_uscale.3 setCDKUScaleLRChar.3 \ + cdk_uscale.3 setCDKUScaleLowHigh.3 \ + cdk_uscale.3 setCDKUScalePostProcess.3 \ + cdk_uscale.3 setCDKUScalePreProcess.3 \ + cdk_uscale.3 setCDKUScaleULChar.3 \ + cdk_uscale.3 setCDKUScaleURChar.3 \ + cdk_uscale.3 setCDKUScaleValue.3 \ + cdk_uscale.3 setCDKUScaleVerticalChar.3 \ + cdk_uslider.3 activateCDKUSlider.3 \ + cdk_uslider.3 destroyCDKUSlider.3 \ + cdk_uslider.3 drawCDKUSlider.3 \ + cdk_uslider.3 eraseCDKUSlider.3 \ + cdk_uslider.3 getCDKUSliderBox.3 \ + cdk_uslider.3 getCDKUSliderHighValue.3 \ + cdk_uslider.3 getCDKUSliderLowValue.3 \ + cdk_uslider.3 getCDKUSliderValue.3 \ + cdk_uslider.3 injectCDKUSlider.3 \ + cdk_uslider.3 moveCDKUSlider.3 \ + cdk_uslider.3 newCDKUSlider.3 \ + cdk_uslider.3 positionCDKUSlider.3 \ + cdk_uslider.3 setCDKUSlider.3 \ + cdk_uslider.3 setCDKUSliderBackgroundAttrib.3 \ + cdk_uslider.3 setCDKUSliderBackgroundColor.3 \ + cdk_uslider.3 setCDKUSliderBox.3 \ + cdk_uslider.3 setCDKUSliderBoxAttribute.3 \ + cdk_uslider.3 setCDKUSliderHorizontalChar.3 \ + cdk_uslider.3 setCDKUSliderLLChar.3 \ + cdk_uslider.3 setCDKUSliderLRChar.3 \ + cdk_uslider.3 setCDKUSliderLowHigh.3 \ + cdk_uslider.3 setCDKUSliderPostProcess.3 \ + cdk_uslider.3 setCDKUSliderPreProcess.3 \ + cdk_uslider.3 setCDKUSliderULChar.3 \ + cdk_uslider.3 setCDKUSliderURChar.3 \ + cdk_uslider.3 setCDKUSliderValue.3 \ + cdk_uslider.3 setCDKUSliderVerticalChar.3 \ + cdk_util.3 alignxy.3 \ + cdk_util.3 CDKallocStrings.3 \ + cdk_util.3 CDKfreeChtypes.3 \ + cdk_util.3 ceilCDK.3 \ + cdk_util.3 cmpStrChstr.3 \ + cdk_util.3 deleteCursesWindow.3 \ + cdk_util.3 dirName.3 \ + cdk_util.3 eraseCursesWindow.3 \ + cdk_util.3 floorCDK.3 \ + cdk_util.3 freeCharList.3 \ + cdk_util.3 freeChtypeList.3 \ + cdk_util.3 char2DisplayType.3 \ + cdk_util.3 checkForLink.3 \ + cdk_util.3 chstrncpy.3 \ + cdk_util.3 chtype2String.3 \ + cdk_util.3 justifyString.3 \ + cdk_util.3 mode2Filetype.3 \ + cdk_util.3 moveCursesWindow.3 \ + cdk_util.3 popupLabelAttrib.3 \ + cdk_util.3 selectFile.3 \ + cdk_util.3 setWidgetDimension.3 \ + cdk_util.3 viewInfo.3 diff --git a/deps/cdk-5.0-20161210/package/freebsd/pkg-descr b/deps/cdk-5.0-20161210/package/freebsd/pkg-descr new file mode 100644 index 0000000..3684b01 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/freebsd/pkg-descr @@ -0,0 +1,9 @@ +Cdk stands for 'Curses Development Kit' and it currently contains a large +number of ready to use widgets which facilitate the speedy development of full +screen curses programs. + +Each widget has the ability to display color, or other character attributes. +Cdk comes with a attribute/color format command set which allows a programmer +to add colors and characters attributes simply. + +WWW: http://invisible-island.net/cdk/ diff --git a/deps/cdk-5.0-20161210/package/freebsd/pkg-plist b/deps/cdk-5.0-20161210/package/freebsd/pkg-plist new file mode 100644 index 0000000..de96bed --- /dev/null +++ b/deps/cdk-5.0-20161210/package/freebsd/pkg-plist @@ -0,0 +1,204 @@ +bin/cdk5-config +include/cdk/alphalist.h +include/cdk/binding.h +include/cdk/button.h +include/cdk/buttonbox.h +include/cdk/calendar.h +include/cdk.h +include/cdk/cdk_compat.h +include/cdk/cdk_config.h +include/cdk/cdk_objs.h +include/cdk/cdk_params.h +include/cdk/cdk_test.h +include/cdk/cdk_util.h +include/cdk/cdk_version.h +include/cdk/cdkscreen.h +include/cdk/curdefs.h +include/cdk/dialog.h +include/cdk/draw.h +include/cdk/dscale.h +include/cdk/entry.h +include/cdk/fscale.h +include/cdk/fselect.h +include/cdk/fslider.h +include/cdk/graph.h +include/cdk/histogram.h +include/cdk/itemlist.h +include/cdk/label.h +include/cdk/marquee.h +include/cdk/matrix.h +include/cdk/mentry.h +include/cdk/menu.h +include/cdk/radio.h +include/cdk/scale.h +include/cdk/scroll.h +include/cdk/selection.h +include/cdk/slider.h +include/cdk/swindow.h +include/cdk/template.h +include/cdk/traverse.h +include/cdk/uscale.h +include/cdk/uslider.h +include/cdk/viewer.h +lib/libcdk.a +lib/libcdk.so +lib/libcdk.so.5 +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/Makefile +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/Makefile.in +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkalphalist +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkalphalist.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkcalendar +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkcalendar.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkdialog +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkdialog.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkentry +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkentry.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkfselect +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkfselect.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkitemlist +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkitemlist.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdklabel +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdklabel.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkmatrix +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkmatrix.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkmentry +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkmentry.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkradio +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkradio.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkscale +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkscale.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkscroll +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkscroll.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkselection +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkselection.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkslider +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkslider.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdktemplate +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdktemplate.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkviewer +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/cdkviewer.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/alphalist.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/calendar.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/dialog.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/entry.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/fselect.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/itemlist.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/label.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/matrix.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/mentry.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/radio.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/scale.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/scroll.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/selection.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/slider.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/template.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/samples/viewer.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/utils/adduser +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cli/utils/netconfig +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/Makefile +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/Makefile.in +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/appointment +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/appointment.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/appointment.o +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/clock +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/clock.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/clock.o +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/command +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/command.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/command.o +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/fileview +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/fileview.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/fileview.o +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/rolodex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/rolodex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/rolodex.h +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/rolodex.o +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/serial.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/stopSign +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/stopSign.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/stopSign.o +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/syb.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/vinstall +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/vinstall.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/demos/vinstall.o +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/Makefile +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/Makefile.in +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/alphalist_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/alphalist_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/bind_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/bind_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/buttonbox_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/buttonbox_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/calendar_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/calendar_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/cdkscreen_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/cdkscreen_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/dialog_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/dialog_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/entry_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/entry_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/fscale_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/fscale_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/fselect_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/fselect_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/fslider_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/fslider_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/graph_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/graph_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/hello_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/hello_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/histogram_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/histogram_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/itemlist_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/itemlist_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/label_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/label_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/lowerCDKObject_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/lowerCDKObject_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/marquee_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/marquee_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/matrix_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/matrix_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/mentry_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/mentry_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/menu_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/menu_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/position_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/position_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/preprocess_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/preprocess_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/radio1_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/radio1_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/radio_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/radio_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/raiseCDKObject_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/raiseCDKObject_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/scale_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/scale_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/scroll_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/scroll_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/selection_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/selection_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/slider_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/slider_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/subwindow_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/subwindow_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/swindow_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/swindow_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/template_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/template_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/traverse_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/traverse_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/uslider_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/uslider_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/viewer_ex +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/viewer_ex.c +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/viewer_ex2 +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/examples/viewer_ex2.c +%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%/examples +%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%/demos +%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%/cli/utils +%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%/cli/samples +%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%/cli +%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%% +@dirrm include/cdk diff --git a/deps/cdk-5.0-20161210/package/mingw-cdk.nsi b/deps/cdk-5.0-20161210/package/mingw-cdk.nsi new file mode 100644 index 0000000..8d9cc88 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/mingw-cdk.nsi @@ -0,0 +1,175 @@ +; $Id: mingw-cdk.nsi,v 1.19 2016/12/10 13:04:19 tom Exp $ + +; TODO add examples + +; Define the application name +!define APPNAME "libcdk5" +!define EXENAME "libcdk5.exe" + +!define VERSION_MAJOR "5" +!define VERSION_MINOR "0" +!define VERSION_YYYY "2016" +!define VERSION_MMDD "1210" +!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} + +!define SUBKEY "libcdk5" + +!define INSTALL "${APPNAME} (Console)" +!define VERSION ${VERSION_MAJOR}.${VERSION_MINOR} +!define VERSION_FULL ${VERSION}-${VERSION_PATCH} + +; Main Install settings +Name "${INSTALL}" +InstallDir "c:\mingw" +InstallDirRegKey HKLM "Software\${SUBKEY}" "$INSTDIR\bin" +OutFile "NSIS-Output\${APPNAME}-${VERSION_FULL}-setup.exe" + +CRCCheck on +SetCompressor /SOLID lzma + +VIAddVersionKey ProductName "${SUBKEY}" +VIAddVersionKey CompanyName "http://invisible-island.net" +VIAddVersionKey LegalCopyright "© 1999-2012,2013, Thomas E. Dickey" +VIAddVersionKey FileDescription "Cdk Installer (MinGW)" +VIAddVersionKey FileVersion ${VERSION_FULL} +VIAddVersionKey ProductVersion ${VERSION_FULL} +VIAddVersionKey Comments "This installer was built with NSIS and cross-compiling to MinGW." +VIAddVersionKey InternalName "${APPNAME}-${VERSION_FULL}-setup.exe" +; This is a dotted set of numbers limited to 16-bits each +VIProductVersion "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_YYYY}.${VERSION_MMDD}" + +; Modern interface settings +!include "MUI.nsh" + +!define MUI_ABORTWARNING +;!define MUI_FINISHPAGE_RUN +;"$INSTDIR\bin\${EXENAME}" + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "..\COPYING" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +; Set languages (first is default language) +!insertmacro MUI_LANGUAGE "English" +!insertmacro MUI_RESERVEFILE_LANGDLL + +InstType "Full" ; SectionIn 1 +InstType "Typical" ; SectionIn 2 +InstType "Minimal" ; SectionIn 3 + +Section "${APPNAME}" Section1 + + SectionIn 1 2 3 + + ; Set Section properties + SetOverwrite on + + ; Set Section Files and Shortcuts + SetOutPath "$INSTDIR\bin" + + File ".\bin\*.dll" + + SetOutPath "$INSTDIR\share\${APPNAME}" + File /oname=README.txt ".\share\doc\cdk\README" + + CreateDirectory "$SMPROGRAMS\${INSTALL}" + CreateShortCut "$SMPROGRAMS\${INSTALL}\${APPNAME}.lnk" "$INSTDIR\bin\${EXENAME}" + CreateShortCut "$SMPROGRAMS\${INSTALL}\Uninstall.lnk" "$INSTDIR\uninstall.exe" + +SectionEnd + +Section "development" Section2 + + SectionIn 1 2 + + ; Set Section properties + SetOverwrite on + + ; Set Section Files and Shortcuts + SetOutPath "$INSTDIR\share\${APPNAME}" + + SetOutPath "$INSTDIR\include\cdk" + + File ".\include\cdk\*.h" + + SetOutPath "$INSTDIR\lib" + + File ".\lib\*.dll" + File ".\lib\*.a" + +SectionEnd + +Section "examples" Section3 + + SectionIn 1 + + ; Set Section properties + SetOverwrite on + + ; Set Section Files and Shortcuts + SetOutPath "$INSTDIR\lib\${APPNAME}" + +SectionEnd + +Section -FinishSection + + WriteRegStr HKLM "Software\${SUBKEY}" "" "$INSTDIR" + WriteRegStr HKLM "Software\${SUBKEY}" "Environment" "" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" "DisplayName" "${APPNAME} ${VERSION_FULL} (Console)" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" "UninstallString" "$INSTDIR\uninstall.exe" + WriteUninstaller "$INSTDIR\uninstall.exe" + +SectionEnd + +; Modern install component descriptions +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${Section1} "${SUBKEY} runtime" + !insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Development headers and libraries" + !insertmacro MUI_DESCRIPTION_TEXT ${Section3} "Examples" +!insertmacro MUI_FUNCTION_DESCRIPTION_END + +;Uninstall section +Section Uninstall + + ;Remove from registry... + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" + DeleteRegKey HKLM "SOFTWARE\${SUBKEY}" + + ; Delete self + Delete "$INSTDIR\uninstall.exe" + + ; Delete Shortcuts + Delete "$SMPROGRAMS\${INSTALL}\${APPNAME}.lnk" + Delete "$SMPROGRAMS\${INSTALL}\Uninstall.lnk" + + ; Clean up application + Delete "$INSTDIR\bin\libcdk5.dll" + + Delete "$INSTDIR\include\${APPNAME}\*.h" + + Delete "$INSTDIR\lib\libcdk5.a" + + Delete "$INSTDIR\lib\libcdk5.dll.a" + + Delete "$INSTDIR\lib\${APPNAME}\*.exe" + + Delete "$INSTDIR\share\${APPNAME}\*.*" + + ; Remove remaining directories + RMDir "$SMPROGRAMS\${INSTALL}" + RMDir "$INSTDIR\share\${APPNAME}" + RMDir "$INSTDIR\share" + RMDir "$INSTDIR\lib\${APPNAME}" + RMDir "$INSTDIR\lib" + RMDir "$INSTDIR\include\${APPNAME}" + RMDir "$INSTDIR\include" + RMDir "$INSTDIR\bin" + RMDir "$INSTDIR\" + +SectionEnd \ No newline at end of file diff --git a/deps/cdk-5.0-20161210/package/mingw-cdk.spec b/deps/cdk-5.0-20161210/package/mingw-cdk.spec new file mode 100644 index 0000000..83d1c36 --- /dev/null +++ b/deps/cdk-5.0-20161210/package/mingw-cdk.spec @@ -0,0 +1,100 @@ +%?mingw_package_header + +# $Id: mingw-cdk.spec,v 1.20 2016/12/10 13:04:19 tom Exp $ +Summary: Curses Development Kit +%define AppProgram mingw32-cdk +%define AppVersion 5.0 +%define AppRelease 20161210 +Name: %{AppProgram} +Version: %{AppVersion} +Release: %{AppRelease} +License: BSD (4-clause) +Group: Development/Libraries +Source: cdk-%{version}-%{release}.tgz +URL: http://invisible-island.net/cdk/ + +BuildRequires: mingw32-filesystem >= 95 +BuildRequires: mingw32-gcc +BuildRequires: mingw32-binutils +BuildRequires: mingw32-ncurses6 + +BuildRequires: mingw64-filesystem >= 95 +BuildRequires: mingw64-gcc +BuildRequires: mingw64-binutils +BuildRequires: mingw64-ncurses6 + +%define CC_NORMAL -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion +%define CC_STRICT %{CC_NORMAL} -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic + +%description -n mingw32-cdk +Cdk stands for "Curses Development Kit". It contains a large number of ready +to use widgets which facilitate the speedy development of full screen curses +programs. + +%package -n mingw64-cdk +Summary: Curses library for MinGW64 + +%description -n mingw64-cdk +Cdk stands for "Curses Development Kit". It contains a large number of ready +to use widgets which facilitate the speedy development of full screen curses +programs. + +%prep +%define debug_package %{nil} + +%define CFG_OPTS \\\ + --disable-echo \\\ + --verbose \\\ + --with-shared + +%define debug_package %{nil} +%setup -q -n cdk-%{version}-%{release} + +%build +mkdir BUILD-W32 +pushd BUILD-W32 +CFLAGS="%{CC_NORMAL}" \ +CC=%{mingw32_cc} \ +%mingw32_configure %{CFG_OPTS} +make +popd + +mkdir BUILD-W64 +pushd BUILD-W64 +CFLAGS="%{CC_NORMAL}" \ +CC=%{mingw64_cc} \ +%mingw64_configure %{CFG_OPTS} +make +popd + +%install +rm -rf $RPM_BUILD_ROOT + +pushd BUILD-W32 +%{mingw32_make} installCDKLibrary installImportLibrary installCDKHeaderFiles DESTDIR=$RPM_BUILD_ROOT +popd + +pushd BUILD-W64 +%{mingw64_make} installCDKLibrary installImportLibrary installCDKHeaderFiles DESTDIR=$RPM_BUILD_ROOT +popd + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) + +%files -n mingw32-cdk +%{mingw32_bindir}/* +%{mingw32_includedir}/* +%{mingw32_libdir}/* + +%files -n mingw64-cdk +%{mingw64_bindir}/* +%{mingw64_includedir}/* +%{mingw64_libdir}/* + +%changelog + +* Sat Nov 02 2013 Thomas E. Dickey +- initial version diff --git a/deps/cdk-5.0-20161210/popup_dialog.c b/deps/cdk-5.0-20161210/popup_dialog.c new file mode 100644 index 0000000..544b58b --- /dev/null +++ b/deps/cdk-5.0-20161210/popup_dialog.c @@ -0,0 +1,40 @@ +#include + +/* + * $Author: tom $ + * $Date: 2012/03/21 08:45:41 $ + * $Revision: 1.3 $ + */ + +/* + * This pops up a dialog box. + */ +int popupDialog (CDKSCREEN *screen, CDK_CSTRING2 mesg, int mesgCount, CDK_CSTRING2 buttons, int buttonCount) +{ + /* Declare local variables. */ + CDKDIALOG *popup = 0; + int choice; + + /* Create the dialog box. */ + popup = newCDKDialog (screen, CENTER, CENTER, + mesg, mesgCount, + buttons, buttonCount, + A_REVERSE, TRUE, + TRUE, FALSE); + + /* Activate the dialog box */ + drawCDKDialog (popup, TRUE); + + /* Get the choice. */ + choice = activateCDKDialog (popup, 0); + + /* Destroy the dialog box. */ + destroyCDKDialog (popup); + + /* Clean the screen. */ + eraseCDKScreen (screen); + refreshCDKScreen (screen); + + /* Return the choice. */ + return choice; +} diff --git a/deps/cdk-5.0-20161210/popup_label.c b/deps/cdk-5.0-20161210/popup_label.c new file mode 100644 index 0000000..2518a63 --- /dev/null +++ b/deps/cdk-5.0-20161210/popup_label.c @@ -0,0 +1,66 @@ +#include + +/* + * $Author: tom $ + * $Date: 2012/03/21 08:44:22 $ + * $Revision: 1.4 $ + */ + +/* + * This pops up a message. + */ +void popupLabel (CDKSCREEN *screen, CDK_CSTRING2 mesg, int count) +{ + CDKLABEL *popup = 0; + int oldCursState; + boolean functionKey; + + /* Create the label. */ + popup = newCDKLabel (screen, CENTER, CENTER, mesg, count, TRUE, FALSE); + + oldCursState = curs_set (0); + /* Draw it on the screen. */ + drawCDKLabel (popup, TRUE); + + /* Wait for some input. */ + keypad (popup->win, TRUE); + getchCDKObject (ObjOf (popup), &functionKey); + + /* Kill it. */ + destroyCDKLabel (popup); + + /* Clean the screen. */ + curs_set (oldCursState); + eraseCDKScreen (screen); + refreshCDKScreen (screen); +} + +/* + * This pops up a message. + */ +void popupLabelAttrib (CDKSCREEN *screen, CDK_CSTRING2 mesg, int count, chtype attrib) +{ + CDKLABEL *popup = 0; + int oldCursState; + boolean functionKey; + + /* Create the label. */ + popup = newCDKLabel (screen, CENTER, CENTER, mesg, count, TRUE, FALSE); + setCDKLabelBackgroundAttrib (popup, attrib); + + oldCursState = curs_set (0); + /* Draw it on the screen. */ + drawCDKLabel (popup, TRUE); + + /* Wait for some input. */ + keypad (popup->win, TRUE); + getchCDKObject (ObjOf (popup), &functionKey); + + /* Kill it. */ + destroyCDKLabel (popup); + + /* Clean the screen. */ + curs_set (oldCursState); + eraseCDKScreen (screen); + refreshCDKScreen (screen); +} diff --git a/deps/cdk-5.0-20161210/position.c b/deps/cdk-5.0-20161210/position.c new file mode 100644 index 0000000..4d6c8b0 --- /dev/null +++ b/deps/cdk-5.0-20161210/position.c @@ -0,0 +1,153 @@ +#include + +/* + * $Author: tom $ + * $Date: 2011/05/15 19:43:38 $ + * $Revision: 1.13 $ + */ + +#undef ObjOf +#define ObjOf(ptr) (ptr) + +/* + * This allows the user to use the cursor keys to adjust the + * position of the widget. + */ +void positionCDKObject (CDKOBJS *obj, WINDOW *win) +{ + /* *INDENT-EQLS* */ + CDKSCREEN *screen = ScreenOf (obj); + WINDOW *parent = screen->window; + int origX = getbegx (win); + int origY = getbegy (win); + int begX = getbegx (parent); + int begY = getbegy (parent); + int endX = begX + getmaxx (WindowOf (obj)); + int endY = begY + getmaxy (WindowOf (obj)); + + chtype key; + boolean functionKey; + + /* Let them move the widget around until they hit return. */ + while ((key = (chtype)getchCDKObject (obj, &functionKey)) != KEY_ENTER) + { + switch (key) + { + case KEY_UP: + case '8': + if (getbegy (win) > begY) + { + moveCDKObject (obj, 0, -1, TRUE, TRUE); + } + else + { + Beep (); + } + break; + case KEY_DOWN: + case '2': + if (getendy (win) < endY) + { + moveCDKObject (obj, 0, 1, TRUE, TRUE); + } + else + { + Beep (); + } + break; + case KEY_LEFT: + case '4': + if (getbegx (win) > begX) + { + moveCDKObject (obj, -1, 0, TRUE, TRUE); + } + else + { + Beep (); + } + break; + case KEY_RIGHT: + case '6': + if (getendx (win) < endX) + { + moveCDKObject (obj, 1, 0, TRUE, TRUE); + } + else + { + Beep (); + } + break; + case '7': + if (getbegy (win) > begY && getbegx (win) > begX) + { + moveCDKObject (obj, -1, -1, TRUE, TRUE); + } + else + { + Beep (); + } + break; + case '9': + if (getendx (win) < endX && getbegy (win) > begY) + { + moveCDKObject (obj, 1, -1, TRUE, TRUE); + } + else + { + Beep (); + } + break; + case '1': + if (getbegx (win) > begX && getendy (win) < endY) + { + moveCDKObject (obj, -1, 1, TRUE, TRUE); + } + else + { + Beep (); + } + break; + case '3': + if (getendx (win) < endX && getendy (win) < endY) + { + moveCDKObject (obj, 1, 1, TRUE, TRUE); + } + else + { + Beep (); + } + break; + case '5': + moveCDKObject (obj, CENTER, CENTER, FALSE, TRUE); + break; + case 't': + moveCDKObject (obj, getbegx (win), TOP, FALSE, TRUE); + break; + case 'b': + moveCDKObject (obj, getbegx (win), BOTTOM, FALSE, TRUE); + break; + case 'l': + moveCDKObject (obj, LEFT, getbegy (win), FALSE, TRUE); + break; + case 'r': + moveCDKObject (obj, RIGHT, getbegy (win), FALSE, TRUE); + break; + case 'c': + moveCDKObject (obj, CENTER, getbegy (win), FALSE, TRUE); + break; + case 'C': + moveCDKObject (obj, getbegx (win), CENTER, FALSE, TRUE); + break; + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (obj)); + refreshCDKScreen (ScreenOf (obj)); + break; + case KEY_ESC: + moveCDKObject (obj, origX, origY, FALSE, TRUE); + break; + default: + Beep (); + break; + } + } +} diff --git a/deps/cdk-5.0-20161210/radio.c b/deps/cdk-5.0-20161210/radio.c new file mode 100644 index 0000000..3546d98 --- /dev/null +++ b/deps/cdk-5.0-20161210/radio.c @@ -0,0 +1,859 @@ +#include +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 20:14:41 $ + * $Revision: 1.146 $ + */ + +/* + * Declare file local prototypes. + */ +static int createList (CDKRADIO *radio, CDK_CSTRING2 list, int listSize, int width); +static void drawCDKRadioList (CDKRADIO *radio, boolean Box); +static void setViewSize (CDKRADIO *scrollp, int listSize); +static int maxViewSize (CDKRADIO *scrollp); + +/* Determine how many characters we can shift to the right */ +/* before all the items have been scrolled off the screen. */ +#define AvailableWidth(w) ((w)->boxWidth - 2*BorderOf(w) - 3) +#define updateViewWidth(w, widest) \ + (w)->maxLeftChar = (((w)->boxWidth > widest) \ + ? 0 \ + : (widest - AvailableWidth(w))) +#define WidestItem(w) ((w)->maxLeftChar + AvailableWidth(w)) + +#define SCREENPOS(w,n) (w)->itemPos[n] - (w)->leftChar + scrollbarAdj + BorderOf(w) + +DeclareCDKObjects (RADIO, Radio, setCdk, Int); + +/* + * This function creates the radio widget. + */ +CDKRADIO *newCDKRadio (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int splace, + int height, + int width, + const char *title, + CDK_CSTRING2 list, + int listSize, + chtype choiceChar, + int defItem, + chtype highlight, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKRADIO *radio = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int widestItem = 0; + int j; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { CDK_BACKCHAR, KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + { 'g', KEY_HOME }, + { '1', KEY_HOME }, + { 'G', KEY_END }, + { '<', KEY_HOME }, + { '>', KEY_END }, + }; + /* *INDENT-ON* */ + + if ((radio = newCDKObject (CDKRADIO, &my_funcs)) == 0) + { + return (0); + } + + setCDKRadioBox (radio, Box); + + /* + * If the height is a negative value, the height will + * be ROWS-height, otherwise, the height will be the + * given height. + */ + boxHeight = setWidgetDimension (parentHeight, height, 0); + + /* + * If the width is a negative value, the width will + * be COLS-width, otherwise, the width will be the + * given width. + */ + boxWidth = setWidgetDimension (parentWidth, width, 5); + + boxWidth = setCdkTitle (ObjOf (radio), title, boxWidth); + + /* Set the box height. */ + if (TitleLinesOf (radio) > boxHeight) + { + boxHeight = TitleLinesOf (radio) + + MINIMUM (listSize, 8) + + 2 * BorderOf (radio); + } + + /* Adjust the box width if there is a scroll bar. */ + if (splace == LEFT || splace == RIGHT) + { + boxWidth++; + radio->scrollbar = TRUE; + } + else + { + radio->scrollbar = FALSE; + } + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + radio->boxWidth = MINIMUM (boxWidth, parentWidth); + radio->boxHeight = MINIMUM (boxHeight, parentHeight); + + setViewSize (radio, listSize); + + /* Each item in the needs to be converted to chtype * */ + widestItem = createList (radio, list, listSize, radio->boxWidth); + if (widestItem > 0) + { + updateViewWidth (radio, widestItem); + } + else if (listSize) + { + destroyCDKObject (radio); + return (0); + } + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, radio->boxWidth, radio->boxHeight); + + /* Make the radio window */ + radio->win = newwin (radio->boxHeight, radio->boxWidth, ypos, xpos); + + /* Is the window null??? */ + if (radio->win == 0) + { + destroyCDKObject (radio); + return (0); + } + + /* Turn on the keypad. */ + keypad (radio->win, TRUE); + + /* Create the scrollbar window. */ + if (splace == RIGHT) + { + radio->scrollbarWin = subwin (radio->win, + maxViewSize (radio), 1, + SCREEN_YPOS (radio, ypos), + (xpos + + radio->boxWidth + - BorderOf (radio) + - 1)); + } + else if (splace == LEFT) + { + radio->scrollbarWin = subwin (radio->win, + maxViewSize (radio), 1, + SCREEN_YPOS (radio, ypos), + SCREEN_XPOS (radio, xpos)); + } + else + { + radio->scrollbarWin = 0; + } + + /* *INDENT-EQLS* Set the rest of the variables */ + ScreenOf (radio) = cdkscreen; + radio->parent = cdkscreen->window; + radio->scrollbarPlacement = splace; + radio->widestItem = widestItem; + radio->leftChar = 0; + radio->selectedItem = 0; + radio->highlight = highlight; + radio->choiceChar = choiceChar; + radio->leftBoxChar = (chtype)'['; + radio->rightBoxChar = (chtype)']'; + radio->defItem = defItem; + initExitType (radio); + ObjOf (radio)->inputWindow = radio->win; + ObjOf (radio)->acceptsFocus = TRUE; + radio->shadow = shadow; + + setCDKRadioCurrentItem (radio, 0); + + /* Do we need to create the shadow??? */ + if (shadow) + { + radio->shadowWin = newwin (boxHeight, boxWidth + 1, ypos + 1, xpos + 1); + } + + /* Setup the key bindings. */ + for (j = 0; j < (int)SIZEOF (bindings); ++j) + bindCDKObject (vRADIO, + radio, + (chtype)bindings[j].from, + getcCDKBind, + (void *)(long)bindings[j].to); + + /* Register this baby. */ + registerCDKObject (cdkscreen, vRADIO, radio); + + /* Return the radio list */ + return (radio); +} + +/* + * Put the cursor on the currently-selected item. + */ +static void fixCursorPosition (CDKRADIO *widget) +{ + scroller_FixCursorPosition ((CDKSCROLLER *)widget); +} + +/* + * This actually manages the radio widget. + */ +int activateCDKRadio (CDKRADIO *radio, chtype *actions) +{ + /* Draw the radio list. */ + drawCDKRadio (radio, ObjOf (radio)->box); + + if (actions == 0) + { + chtype input; + boolean functionKey; + + for (;;) + { + int ret; + + fixCursorPosition (radio); + input = (chtype)getchCDKObject (ObjOf (radio), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKRadio (radio, input); + if (radio->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int j; + + /* Inject each character one at a time. */ + for (j = 0; j < length; j++) + { + int ret = injectCDKRadio (radio, actions[j]); + if (radio->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and return. */ + setExitType (radio, 0); + return -1; +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKRadio (CDKOBJS *object, chtype input) +{ + CDKRADIO *radio = (CDKRADIO *)object; + CDKSCROLLER *widget = (CDKSCROLLER *)object; + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Draw the widget list */ + drawCDKRadioList (radio, ObjOf (widget)->box); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vRADIO, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a predefined key binding. */ + if (checkCDKObjectBind (vRADIO, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_UP: + scroller_KEY_UP (widget); + break; + + case KEY_DOWN: + scroller_KEY_DOWN (widget); + break; + + case KEY_RIGHT: + scroller_KEY_RIGHT (widget); + break; + + case KEY_LEFT: + scroller_KEY_LEFT (widget); + break; + + case KEY_PPAGE: + scroller_KEY_PPAGE (widget); + break; + + case KEY_NPAGE: + scroller_KEY_NPAGE (widget); + break; + + case KEY_HOME: + scroller_KEY_HOME (widget); + break; + + case KEY_END: + scroller_KEY_END (widget); + break; + + case '$': + widget->leftChar = widget->maxLeftChar; + break; + + case '|': + widget->leftChar = 0; + break; + + case SPACE: + radio->selectedItem = widget->currentItem; + break; + + case KEY_ESC: + setExitType (widget, input); + ret = -1; + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_TAB: + case KEY_ENTER: + setExitType (widget, input); + ret = radio->selectedItem; + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vRADIO, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKRadioList (radio, ObjOf (widget)->box); + setExitType (widget, 0); + } + + fixCursorPosition (radio); + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * This moves the radio field to the given location. + */ +static void _moveCDKRadio (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKRADIO *radio = (CDKRADIO *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (radio->win); + int currentY = getbegy (radio->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (radio->win) + xplace; + ypos = getbegy (radio->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (radio), &xpos, &ypos, radio->boxWidth, radio->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (radio->win, -xdiff, -ydiff); + moveCursesWindow (radio->scrollbarWin, -xdiff, -ydiff); + moveCursesWindow (radio->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (radio)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKRadio (radio, ObjOf (radio)->box); + } +} + +static int maxViewSize (CDKRADIO *widget) +{ + return scroller_MaxViewSize ((CDKSCROLLER *)widget); +} + +/* + * Set variables that depend upon the list-size. + */ +static void setViewSize (CDKRADIO *widget, int listSize) +{ + scroller_SetViewSize ((CDKSCROLLER *)widget, listSize); +} + +/* + * This function draws the radio widget. + */ +static void _drawCDKRadio (CDKOBJS *object, boolean Box GCC_UNUSED) +{ + CDKRADIO *radio = (CDKRADIO *)object; + + /* Do we need to draw in the shadow??? */ + if (radio->shadowWin != 0) + { + drawShadow (radio->shadowWin); + } + + drawCdkTitle (radio->win, object); + + /* Draw in the radio list. */ + drawCDKRadioList (radio, ObjOf (radio)->box); +} + +/* + * This redraws the radio list. + */ +static void drawCDKRadioList (CDKRADIO *radio, boolean Box) +{ + int scrollbarAdj = (radio->scrollbarPlacement == LEFT) ? 1 : 0; + int j, k; + + /* draw the list */ + for (j = 0; j < radio->viewSize; j++) + { + int xpos = SCREEN_XPOS (radio, 0); + int ypos = SCREEN_YPOS (radio, j); + + /* Draw the empty string. */ + writeBlanks (radio->win, xpos, ypos, + HORIZONTAL, 0, radio->boxWidth - BorderOf (radio)); + + k = j + radio->currentTop; + + /* Draw the element in the radio list. */ + if (k < radio->listSize) + { + int screenPos = SCREENPOS (radio, k); + + /* Draw the line. */ + writeChtype (radio->win, + (screenPos >= 0) ? screenPos : 1, + ypos, + radio->item[k], + HORIZONTAL, + (screenPos >= 0) ? 0 : (1 - screenPos), + radio->itemLen[k]); + + /* Draw the selected choice... */ + xpos += scrollbarAdj; + (void)mvwaddch (radio->win, ypos, xpos++, radio->leftBoxChar); + (void)mvwaddch (radio->win, ypos, xpos++, ((k == radio->selectedItem) + ? radio->choiceChar + : ' ')); + (void)mvwaddch (radio->win, ypos, xpos++, radio->rightBoxChar); + } + } + + /* Highlight the current item. */ + if (ObjPtr (radio)->hasFocus) + { + k = radio->currentItem; + if (k < radio->listSize) + { + int screenPos = SCREENPOS (radio, k); + int ypos = SCREEN_YPOS (radio, radio->currentHigh); + + writeChtypeAttrib (radio->win, + (screenPos >= 0) ? screenPos : (1 + scrollbarAdj), + ypos, + radio->item[k], + radio->highlight, + HORIZONTAL, + (screenPos >= 0) ? 0 : (1 - screenPos), + radio->itemLen[k]); + } + } + + if (radio->scrollbar) + { + radio->togglePos = floorCDK (radio->currentItem * (double)radio->step); + radio->togglePos = MINIMUM (radio->togglePos, + getmaxy (radio->scrollbarWin) - 1); + + (void)mvwvline (radio->scrollbarWin, 0, 0, + ACS_CKBOARD, getmaxy (radio->scrollbarWin)); + (void)mvwvline (radio->scrollbarWin, radio->togglePos, 0, + ' ' | A_REVERSE, radio->toggleSize); + } + + /* Box it if needed. */ + if (Box) + { + drawObjBox (radio->win, ObjOf (radio)); + } + else + { + touchwin (radio->win); + } + + fixCursorPosition (radio); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrRadio (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKRADIO *widget = (CDKRADIO *)object; + + wbkgd (widget->win, attrib); + if (widget->scrollbarWin != 0) + { + wbkgd (widget->scrollbarWin, attrib); + } + } +} + +static void destroyInfo (CDKRADIO *widget) +{ + CDKfreeChtypes (widget->item); + widget->item = 0; + + freeAndNull (widget->itemLen); + freeAndNull (widget->itemPos); +} + +/* + * This function destroys the radio widget. + */ +static void _destroyCDKRadio (CDKOBJS *object) +{ + if (object != 0) + { + CDKRADIO *radio = (CDKRADIO *)object; + + cleanCdkTitle (object); + destroyInfo (radio); + + /* Clean up the windows. */ + deleteCursesWindow (radio->scrollbarWin); + deleteCursesWindow (radio->shadowWin); + deleteCursesWindow (radio->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vRADIO, radio); + + /* Unregister this object. */ + unregisterCDKObject (vRADIO, radio); + } +} + +/* + * This function erases the radio widget. + */ +static void _eraseCDKRadio (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKRADIO *radio = (CDKRADIO *)object; + + eraseCursesWindow (radio->win); + eraseCursesWindow (radio->shadowWin); + } +} + +/* + * This set various attributes of the radio list. + */ +void setCDKRadio (CDKRADIO *radio, chtype highlight, chtype choiceChar, int Box) +{ + setCDKRadioHighlight (radio, highlight); + setCDKRadioChoiceCharacter (radio, choiceChar); + setCDKRadioBox (radio, Box); +} + +/* + * This sets the radio list items. + */ +void setCDKRadioItems (CDKRADIO *radio, CDK_CSTRING2 list, int listSize) +{ + int widestItem; + int j = 0; + + widestItem = createList (radio, list, listSize, radio->boxWidth); + if (widestItem <= 0) + return; + + /* Clean up the display. */ + for (j = 0; j < radio->viewSize; j++) + { + writeBlanks (radio->win, + SCREEN_XPOS (radio, 0), + SCREEN_YPOS (radio, j), + HORIZONTAL, + 0, + radio->boxWidth - BorderOf (radio)); + } + + setViewSize (radio, listSize); + + setCDKRadioCurrentItem (radio, 0); + radio->leftChar = 0; + radio->selectedItem = 0; + + updateViewWidth (radio, widestItem); +} +int getCDKRadioItems (CDKRADIO *radio, char **list) +{ + if (list != 0) + { + int j; + + for (j = 0; j < radio->listSize; j++) + { + list[j] = chtype2Char (radio->item[j]); + } + } + return radio->listSize; +} + +/* + * This sets the highlight bar of the radio list. + */ +void setCDKRadioHighlight (CDKRADIO *radio, chtype highlight) +{ + radio->highlight = highlight; +} +chtype getCDKRadioHighlight (CDKRADIO *radio) +{ + return radio->highlight; +} + +/* + * This sets the character to use when selecting an item in the list. + */ +void setCDKRadioChoiceCharacter (CDKRADIO *radio, chtype character) +{ + radio->choiceChar = character; +} +chtype getCDKRadioChoiceCharacter (CDKRADIO *radio) +{ + return radio->choiceChar; +} + +/* + * This sets the character to use to draw the left side of the + * choice box on the list. + */ +void setCDKRadioLeftBrace (CDKRADIO *radio, chtype character) +{ + radio->leftBoxChar = character; +} +chtype getCDKRadioLeftBrace (CDKRADIO *radio) +{ + return radio->leftBoxChar; +} + +/* + * This sets the character to use to draw the right side of the + * choice box on the list. + */ +void setCDKRadioRightBrace (CDKRADIO *radio, chtype character) +{ + radio->rightBoxChar = character; +} +chtype getCDKRadioRightBrace (CDKRADIO *radio) +{ + return radio->rightBoxChar; +} + +/* + * This sets the box attribute of the widget. + */ +void setCDKRadioBox (CDKRADIO *radio, boolean Box) +{ + ObjOf (radio)->box = Box; + ObjOf (radio)->borderSize = Box ? 1 : 0; +} +boolean getCDKRadioBox (CDKRADIO *radio) +{ + return ObjOf (radio)->box; +} + +/* + * This sets the current high lighted item of the widget + */ +void setCDKRadioCurrentItem (CDKRADIO *radio, int item) +{ + scroller_SetPosition ((CDKSCROLLER *)radio, item); + radio->selectedItem = item; +} +int getCDKRadioCurrentItem (CDKRADIO *radio) +{ + return radio->currentItem; +} + +/* + * This sets the selected item of the widget + */ +void setCDKRadioSelectedItem (CDKRADIO *radio, int item) +{ + radio->selectedItem = item; +} +int getCDKRadioSelectedItem (CDKRADIO *radio) +{ + return radio->selectedItem; +} + +static void _focusCDKRadio (CDKOBJS *object) +{ + CDKRADIO *radio = (CDKRADIO *)object; + + drawCDKRadioList (radio, ObjOf (radio)->box); +} + +static void _unfocusCDKRadio (CDKOBJS *object) +{ + CDKRADIO *radio = (CDKRADIO *)object; + + drawCDKRadioList (radio, ObjOf (radio)->box); +} + +static int createList (CDKRADIO *radio, CDK_CSTRING2 list, int listSize, int boxWidth) +{ + int status = 0; + int widestItem = 0; + + if (listSize >= 0) + { + /* *INDENT-EQLS* */ + chtype **newList = typeCallocN (chtype *, listSize + 1); + int *newLen = typeCallocN (int, listSize + 1); + int *newPos = typeCallocN (int, listSize + 1); + + if (newList != 0 + && newLen != 0 + && newPos != 0) + { + int j; + + /* Each item in the needs to be converted to chtype * */ + status = 1; + boxWidth -= (2 + BorderOf (radio)); + for (j = 0; j < listSize; j++) + { + newList[j] = char2Chtype (list[j], &newLen[j], &newPos[j]); + if (newList[j] == 0) + { + status = 0; + break; + } + newPos[j] = justifyString (boxWidth, newLen[j], newPos[j]) + 3; + widestItem = MAXIMUM (widestItem, newLen[j]); + } + if (status) + { + destroyInfo (radio); + + radio->item = newList; + radio->itemLen = newLen; + radio->itemPos = newPos; + } + else + { + CDKfreeChtypes (newList); + freeChecked (newLen); + freeChecked (newPos); + } + } + else + { + CDKfreeChtypes (newList); + freeChecked (newLen); + freeChecked (newPos); + } + } + else + { + destroyInfo (radio); + } + + return status ? widestItem : 0; +} + +dummyRefreshData (Radio) + +dummySaveData (Radio) diff --git a/deps/cdk-5.0-20161210/scroll.c b/deps/cdk-5.0-20161210/scroll.c new file mode 100644 index 0000000..d7f2847 --- /dev/null +++ b/deps/cdk-5.0-20161210/scroll.c @@ -0,0 +1,1059 @@ +#include +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 19:24:26 $ + * $Revision: 1.161 $ + */ + +/* + * Declare file local prototypes. + */ +static void drawCDKScrollList (CDKSCROLL *scrollp, boolean Box); +static int createCDKScrollItemList (CDKSCROLL *scrollp, boolean numbers, + CDK_CSTRING2 list, int listSize); +static void fixCursorPosition (CDKSCROLL *widget); +static void setViewSize (CDKSCROLL *scrollp, int listSize); +static int maxViewSize (CDKSCROLL *scrollp); + +#define NUMBER_FMT "%4d. %s" +#define NUMBER_LEN(s) (8 + strlen (s)) + +/* Determine how many characters we can shift to the right */ +/* before all the items have been scrolled off the screen. */ +#define AvailableWidth(w) ((w)->boxWidth - 2 * BorderOf (w)) +#define updateViewWidth(w, widest) \ + (w)->maxLeftChar = (((w)->boxWidth > widest) \ + ? 0 \ + : (widest - AvailableWidth (w))) +#define WidestItem(w) ((w)->maxLeftChar + AvailableWidth (w)) + +#define SCREENPOS(w,n) (w)->itemPos[n] - (w)->leftChar /* + scrollbarAdj + BorderOf(w) */ + +DeclareCDKObjects (SCROLL, Scroll, setCdk, Int); + +/* + * This function creates a new scrolling list widget. + */ +CDKSCROLL *newCDKScroll (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int splace, + int height, + int width, + const char *title, + CDK_CSTRING2 list, + int listSize, + boolean numbers, + chtype highlight, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKSCROLL *scrollp = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int scrollAdjust = 0; + int x; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { CDK_BACKCHAR, KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + { 'g', KEY_HOME }, + { '1', KEY_HOME }, + { 'G', KEY_END }, + { '<', KEY_HOME }, + { '>', KEY_END }, + }; + /* *INDENT-ON* */ + + if ((scrollp = newCDKObject (CDKSCROLL, &my_funcs)) == 0) + { + destroyCDKObject (scrollp); + return (0); + } + + setCDKScrollBox (scrollp, Box); + + /* + * If the height is a negative value, the height will + * be ROWS-height, otherwise, the height will be the + * given height. + */ + boxHeight = setWidgetDimension (parentHeight, height, 0); + + /* + * If the width is a negative value, the width will + * be COLS-width, otherwise, the width will be the + * given width. + */ + boxWidth = setWidgetDimension (parentWidth, width, 0); + + boxWidth = setCdkTitle (ObjOf (scrollp), title, boxWidth); + + /* Set the box height. */ + if (TitleLinesOf (scrollp) > boxHeight) + { + boxHeight = (TitleLinesOf (scrollp) + + MINIMUM (listSize, 8) + + 2 * BorderOf (scrollp)); + } + + /* Adjust the box width if there is a scrollp bar. */ + if ((splace == LEFT) || (splace == RIGHT)) + { + scrollp->scrollbar = TRUE; + boxWidth += 1; + } + else + { + scrollp->scrollbar = FALSE; + } + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + scrollp->boxWidth = (boxWidth > parentWidth + ? (parentWidth - scrollAdjust) + : boxWidth); + scrollp->boxHeight = (boxHeight > parentHeight + ? parentHeight + : boxHeight); + + setViewSize (scrollp, listSize); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, scrollp->boxWidth, scrollp->boxHeight); + + /* Make the scrolling window */ + scrollp->win = newwin (scrollp->boxHeight, scrollp->boxWidth, ypos, xpos); + + /* Is the scrolling window null?? */ + if (scrollp->win == 0) + { + destroyCDKObject (scrollp); + return (0); + } + + /* Turn the keypad on for the window. */ + keypad (scrollp->win, TRUE); + + /* Create the scrollbar window. */ + if (splace == RIGHT) + { + scrollp->scrollbarWin = subwin (scrollp->win, + maxViewSize (scrollp), 1, + SCREEN_YPOS (scrollp, ypos), + xpos + scrollp->boxWidth + - BorderOf (scrollp) - 1); + } + else if (splace == LEFT) + { + scrollp->scrollbarWin = subwin (scrollp->win, + maxViewSize (scrollp), 1, + SCREEN_YPOS (scrollp, ypos), + SCREEN_XPOS (scrollp, xpos)); + } + else + { + scrollp->scrollbarWin = 0; + } + + /* create the list window */ + + scrollp->listWin = subwin (scrollp->win, + maxViewSize (scrollp), + scrollp->boxWidth + - 2 * BorderOf (scrollp) - scrollAdjust, + SCREEN_YPOS (scrollp, ypos), + SCREEN_XPOS (scrollp, xpos) + + (splace == LEFT ? 1 : 0)); + + /* *INDENT-EQLS* Set the rest of the variables */ + ScreenOf (scrollp) = cdkscreen; + scrollp->parent = cdkscreen->window; + scrollp->shadowWin = 0; + scrollp->scrollbarPlacement = splace; + scrollp->maxLeftChar = 0; + scrollp->leftChar = 0; + scrollp->highlight = highlight; + initExitType (scrollp); + ObjOf (scrollp)->acceptsFocus = TRUE; + ObjOf (scrollp)->inputWindow = scrollp->win; + scrollp->shadow = shadow; + + setCDKScrollPosition (scrollp, 0); + + /* Create the scrolling list item list and needed variables. */ + if (createCDKScrollItemList (scrollp, numbers, list, listSize) <= 0) + { + destroyCDKObject (scrollp); + return (0); + } + + /* Do we need to create a shadow? */ + if (shadow) + { + scrollp->shadowWin = newwin (scrollp->boxHeight, + boxWidth, + ypos + 1, + xpos + 1); + } + + /* Setup the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (vSCROLL, + scrollp, + (chtype)bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + registerCDKObject (cdkscreen, vSCROLL, scrollp); + + /* Return the scrolling list */ + return scrollp; +} + +/* + * Put the cursor on the currently-selected item's row. + */ +static void fixCursorPosition (CDKSCROLL *widget) +{ + scroller_FixCursorPosition ((CDKSCROLLER *)widget); +} + +/* + * This actually does all the 'real' work of managing the scrolling list. + */ +int activateCDKScroll (CDKSCROLL *scrollp, chtype *actions) +{ + /* Draw the scrolling list */ + drawCDKScroll (scrollp, ObjOf (scrollp)->box); + + if (actions == 0) + { + chtype input; + boolean functionKey; + + for (;;) + { + int ret; + + fixCursorPosition (scrollp); + input = (chtype)getchCDKObject (ObjOf (scrollp), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKScroll (scrollp, input); + if (scrollp->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int i = 0; + + /* Inject each character one at a time. */ + for (i = 0; i < length; i++) + { + int ret = injectCDKScroll (scrollp, actions[i]); + if (scrollp->exitType != vEARLY_EXIT) + return ret; + } + } + + /* Set the exit type for the widget and return. */ + setExitType (scrollp, 0); + return -1; +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKScroll (CDKOBJS *object, chtype input) +{ + CDKSCROLL *myself = (CDKSCROLL *)object; + CDKSCROLLER *widget = (CDKSCROLLER *)object; + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type for the widget. */ + setExitType (widget, 0); + + /* Draw the scrolling list */ + drawCDKScrollList (myself, ObjOf (widget)->box); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vSCROLL, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a predefined key binding. */ + if (checkCDKObjectBind (vSCROLL, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_UP: + scroller_KEY_UP (widget); + break; + + case KEY_DOWN: + scroller_KEY_DOWN (widget); + break; + + case KEY_RIGHT: + scroller_KEY_RIGHT (widget); + break; + + case KEY_LEFT: + scroller_KEY_LEFT (widget); + break; + + case KEY_PPAGE: + scroller_KEY_PPAGE (widget); + break; + + case KEY_NPAGE: + scroller_KEY_NPAGE (widget); + break; + + case KEY_HOME: + scroller_KEY_HOME (widget); + break; + + case KEY_END: + scroller_KEY_END (widget); + break; + + case '$': + widget->leftChar = widget->maxLeftChar; + break; + + case '|': + widget->leftChar = 0; + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + case KEY_TAB: + case KEY_ENTER: + setExitType (widget, input); + ret = widget->currentItem; + complete = TRUE; + break; + + default: + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vSCROLL, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKScrollList (myself, ObjOf (widget)->box); + setExitType (widget, 0); + } + + fixCursorPosition (myself); + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * This allows the user to accelerate to a position in the scrolling list. + */ +void setCDKScrollPosition (CDKSCROLL *scrollp, int item) +{ + scroller_SetPosition ((CDKSCROLLER *)scrollp, item); +} + +/* obsolete (because the name is inconsistent) */ +int getCDKScrollCurrent (CDKSCROLL *scrollp) +{ + return scrollp->currentItem; +} + +void setCDKScrollCurrent (CDKSCROLL *scrollp, int item) +{ + scroller_SetPosition ((CDKSCROLLER *)scrollp, item); +} + +/* + * Get/Set the current item number of the scroller. + */ +int getCDKScrollCurrentItem (CDKSCROLL *widget) +{ + return widget->currentItem; +} + +void setCDKScrollCurrentItem (CDKSCROLL *widget, int item) +{ + scroller_SetPosition ((CDKSCROLLER *)widget, item); +} + +/* + * Get/Set the top line of the scroller. + */ +int getCDKScrollCurrentTop (CDKSCROLL *widget) +{ + return widget->currentTop; +} + +void setCDKScrollCurrentTop (CDKSCROLL *widget, int item) +{ + if (item < 0) + item = 0; + else if (item > widget->maxTopItem) + item = widget->maxTopItem; + widget->currentTop = item; + + scroller_SetPosition ((CDKSCROLLER *)widget, item); +} + +/* + * This moves the scroll field to the given location. + */ +static void _moveCDKScroll (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + /* *INDENT-EQLS* */ + CDKSCROLL *scrollp = (CDKSCROLL *)object; + int currentX = getbegx (scrollp->win); + int currentY = getbegy (scrollp->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (scrollp->win) + xplace; + ypos = getbegy (scrollp->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (scrollp), &xpos, &ypos, scrollp->boxWidth, scrollp->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (scrollp->win, -xdiff, -ydiff); + moveCursesWindow (scrollp->listWin, -xdiff, -ydiff); + moveCursesWindow (scrollp->shadowWin, -xdiff, -ydiff); + moveCursesWindow (scrollp->scrollbarWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (scrollp)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKScroll (scrollp, ObjOf (scrollp)->box); + } +} + +/* + * This function draws the scrolling list widget. + */ +static void _drawCDKScroll (CDKOBJS *object, boolean Box) +{ + CDKSCROLL *scrollp = (CDKSCROLL *)object; + + /* Draw in the shadow if we need to. */ + if (scrollp->shadowWin != 0) + drawShadow (scrollp->shadowWin); + + drawCdkTitle (scrollp->win, object); + + /* Draw in the scolling list items. */ + drawCDKScrollList (scrollp, Box); +} + +static void drawCDKScrollCurrent (CDKSCROLL *s) +{ + /* Rehighlight the current menu item. */ + int screenPos = s->itemPos[s->currentItem] - s->leftChar; + chtype highlight = HasFocusObj (s) ? s->highlight : A_NORMAL; + + writeChtypeAttrib (s->listWin, + (screenPos >= 0) ? screenPos : 0, + s->currentHigh, + s->item[s->currentItem], + highlight, + HORIZONTAL, + (screenPos >= 0) ? 0 : (1 - screenPos), + s->itemLen[s->currentItem]); +} + +static int maxViewSize (CDKSCROLL *scrollp) +{ + return scroller_MaxViewSize ((CDKSCROLLER *)scrollp); +} + +/* + * Set variables that depend upon the list-size. + */ +static void setViewSize (CDKSCROLL *scrollp, int listSize) +{ + scroller_SetViewSize ((CDKSCROLLER *)scrollp, listSize); +} + +#undef SCREEN_YPOS /* because listWin is separate */ +#define SCREEN_YPOS(w,n) (n) + +/* + * This redraws the scrolling list. + */ +static void drawCDKScrollList (CDKSCROLL *scrollp, boolean Box) +{ + /* If the list is empty, don't draw anything. */ + if (scrollp->listSize > 0) + { + int j; + + /* Redraw the list */ + for (j = 0; j < scrollp->viewSize; j++) + { + int k; + int xpos = SCREEN_YPOS (scrollp, 0); + int ypos = SCREEN_YPOS (scrollp, j); + + writeBlanks (scrollp->listWin, xpos, ypos, + HORIZONTAL, 0, scrollp->boxWidth - 2 * BorderOf (scrollp)); + + k = j + scrollp->currentTop; + + /* Draw the elements in the scroll list. */ + if (k < scrollp->listSize) + { + int screenPos = SCREENPOS (scrollp, k); + + /* Write in the correct line. */ + writeChtype (scrollp->listWin, + (screenPos >= 0) ? screenPos : 1, + ypos, + scrollp->item[k], + HORIZONTAL, + (screenPos >= 0) ? 0 : (1 - screenPos), + scrollp->itemLen[k]); + } + } + + drawCDKScrollCurrent (scrollp); + + /* Determine where the toggle is supposed to be. */ + if (scrollp->scrollbarWin != 0) + { + scrollp->togglePos = floorCDK (scrollp->currentItem * (double)scrollp->step); + + /* Make sure the toggle button doesn't go out of bounds. */ + + if (scrollp->togglePos >= getmaxy (scrollp->scrollbarWin)) + scrollp->togglePos = getmaxy (scrollp->scrollbarWin) - 1; + + /* Draw the scrollbar. */ + (void)mvwvline (scrollp->scrollbarWin, + 0, 0, + ACS_CKBOARD, + getmaxy (scrollp->scrollbarWin)); + (void)mvwvline (scrollp->scrollbarWin, + scrollp->togglePos, 0, + ' ' | A_REVERSE, + scrollp->toggleSize); + } + } + + /* Box it if needed. */ + if (Box) + { + drawObjBox (scrollp->win, ObjOf (scrollp)); + } + else + { + touchwin (scrollp->win); + } + wrefresh (scrollp->win); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrScroll (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKSCROLL *widget = (CDKSCROLL *)object; + + wbkgd (widget->win, attrib); + wbkgd (widget->listWin, attrib); + if (widget->scrollbarWin != 0) + { + wbkgd (widget->scrollbarWin, attrib); + } + } +} + +/* + * This function destroys + */ +static void _destroyCDKScroll (CDKOBJS *object) +{ + if (object != 0) + { + CDKSCROLL *scrollp = (CDKSCROLL *)object; + + cleanCdkTitle (object); + CDKfreeChtypes (scrollp->item); + freeChecked (scrollp->itemPos); + freeChecked (scrollp->itemLen); + + /* Clean up the windows. */ + deleteCursesWindow (scrollp->scrollbarWin); + deleteCursesWindow (scrollp->shadowWin); + deleteCursesWindow (scrollp->listWin); + deleteCursesWindow (scrollp->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vSCROLL, scrollp); + + /* Unregister this object. */ + unregisterCDKObject (vSCROLL, scrollp); + } +} + +/* + * This function erases the scrolling list from the screen. + */ +static void _eraseCDKScroll (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKSCROLL *scrollp = (CDKSCROLL *)object; + + eraseCursesWindow (scrollp->win); + eraseCursesWindow (scrollp->shadowWin); + } +} + +static boolean allocListArrays (CDKSCROLL *scrollp, + int oldSize, + int newSize) +{ + /* *INDENT-EQLS* */ + boolean result; + int nchunk = ((newSize + 1) | 31) + 1; + chtype **newList = typeCallocN (chtype *, nchunk); + int *newLen = typeCallocN (int, nchunk); + int *newPos = typeCallocN (int, nchunk); + + if (newList != 0 && + newLen != 0 && + newPos != 0) + { + int n; + + for (n = 0; n < oldSize; ++n) + { + newList[n] = scrollp->item[n]; + newLen[n] = scrollp->itemLen[n]; + newPos[n] = scrollp->itemPos[n]; + } + + freeChecked (scrollp->item); + freeChecked (scrollp->itemPos); + freeChecked (scrollp->itemLen); + + scrollp->item = newList; + scrollp->itemLen = newLen; + scrollp->itemPos = newPos; + result = TRUE; + } + else + { + freeChecked (newList); + freeChecked (newLen); + freeChecked (newPos); + result = FALSE; + } + return result; +} + +static boolean allocListItem (CDKSCROLL *scrollp, + int which, + char **work, + size_t * used, + int number, + const char *value) +{ + if (number > 0) + { + size_t need = NUMBER_LEN (value); + if (need > *used) + { + *used = ((need + 2) * 2); + if (*work == 0) + { + if ((*work = (char *)malloc (*used)) == 0) + return FALSE; + } + else + { + if ((*work = (char *)realloc (*work, *used)) == 0) + return FALSE; + } + } + sprintf (*work, NUMBER_FMT, number, value); + value = *work; + } + + if ((scrollp->item[which] = char2Chtype (value, + &(scrollp->itemLen[which]), + &(scrollp->itemPos[which]))) == 0) + return FALSE; + + scrollp->itemPos[which] = justifyString (scrollp->boxWidth, + scrollp->itemLen[which], + scrollp->itemPos[which]); + + return TRUE; +} + +/* + * This function creates the scrolling list information and sets up the needed + * variables for the scrolling list to work correctly. + */ +static int createCDKScrollItemList (CDKSCROLL *scrollp, + boolean numbers, + CDK_CSTRING2 list, + int listSize) +{ + int status = 0; + + if (listSize > 0) + { + /* *INDENT-EQLS* */ + size_t have = 0; + char *temp = 0; + + if (allocListArrays (scrollp, 0, listSize)) + { + int widestItem = 0; + int x = 0; + + /* Create the items in the scrolling list. */ + status = 1; + for (x = 0; x < listSize; x++) + { + if (!allocListItem (scrollp, + x, + &temp, + &have, + numbers ? (x + 1) : 0, + list[x])) + { + status = 0; + break; + } + + widestItem = MAXIMUM (scrollp->itemLen[x], widestItem); + } + freeChecked (temp); + + if (status) + { + updateViewWidth (scrollp, widestItem); + + /* Keep the boolean flag 'numbers' */ + scrollp->numbers = numbers; + } + } + } + else + { + status = 1; /* null list is ok - for a while */ + } + + return status; +} + +/* + * This sets certain attributes of the scrolling list. + */ +void setCDKScroll (CDKSCROLL *scrollp, + CDK_CSTRING2 list, + int listSize, + boolean numbers, + chtype highlight, + boolean Box) +{ + setCDKScrollItems (scrollp, list, listSize, numbers); + setCDKScrollHighlight (scrollp, highlight); + setCDKScrollBox (scrollp, Box); +} + +/* + * This sets the scrolling list items. + */ +void setCDKScrollItems (CDKSCROLL *scrollp, CDK_CSTRING2 list, int listSize, boolean numbers) +{ + int x = 0; + + if (createCDKScrollItemList (scrollp, numbers, list, listSize) <= 0) + return; + + /* Clean up the display. */ + for (x = 0; x < scrollp->viewSize; x++) + { + writeBlanks (scrollp->win, 1, SCREEN_YPOS (scrollp, x), + HORIZONTAL, 0, scrollp->boxWidth - 2); + } + + setViewSize (scrollp, listSize); + setCDKScrollPosition (scrollp, 0); + scrollp->leftChar = 0; +} +int getCDKScrollItems (CDKSCROLL *scrollp, char **list) +{ + if (list != 0) + { + int x; + + for (x = 0; x < scrollp->listSize; x++) + { + list[x] = chtype2Char (scrollp->item[x]); + } + } + return scrollp->listSize; +} + +/* + * This sets the highlight of the scrolling list. + */ +void setCDKScrollHighlight (CDKSCROLL *scrollp, chtype highlight) +{ + scrollp->highlight = highlight; +} +chtype getCDKScrollHighlight (CDKSCROLL *scrollp, chtype highlight GCC_UNUSED) +{ + return scrollp->highlight; +} + +/* + * This sets the box attribute of the scrolling list. + */ +void setCDKScrollBox (CDKSCROLL *scrollp, boolean Box) +{ + ObjOf (scrollp)->box = Box; + ObjOf (scrollp)->borderSize = Box ? 1 : 0; +} +boolean getCDKScrollBox (CDKSCROLL *scrollp) +{ + return ObjOf (scrollp)->box; +} + +/* + * Resequence the numbers after a insertion/deletion. + */ +static void resequence (CDKSCROLL *scrollp) +{ + if (scrollp->numbers) + { + int j, k; + for (j = 0; j < scrollp->listSize; ++j) + { + char source[80]; + chtype *target = scrollp->item[j]; + + sprintf (source, NUMBER_FMT, j + 1, ""); + + for (k = 0; source[k] != 0; ++k) + { + /* handle deletions that change the length of number */ + if (source[k] == '.' && CharOf (target[k]) != '.') + { + int k2 = k; + while ((target[k2] = target[k2 + 1]) != 0) + ++k2; + scrollp->itemLen[j] -= 1; + } + target[k] &= A_ATTRIBUTES; + target[k] |= (chtype)(unsigned char)source[k]; + } + } + } +} + +static boolean insertListItem (CDKSCROLL *scrollp, int item) +{ + int x; + for (x = scrollp->listSize; x > item; --x) + { + scrollp->item[x] = scrollp->item[x - 1]; + scrollp->itemLen[x] = scrollp->itemLen[x - 1]; + scrollp->itemPos[x] = scrollp->itemPos[x - 1]; + } + return TRUE; +} + +/* + * This adds a single item to a scrolling list, at the end of the list. + */ +void addCDKScrollItem (CDKSCROLL *scrollp, const char *item) +{ + int itemNumber = scrollp->listSize; + int widestItem = WidestItem (scrollp); + char *temp = 0; + size_t have = 0; + + if (allocListArrays (scrollp, scrollp->listSize, scrollp->listSize + 1) && + allocListItem (scrollp, + itemNumber, + &temp, + &have, + scrollp->numbers ? (itemNumber + 1) : 0, + item)) + { + /* Determine the size of the widest item. */ + widestItem = MAXIMUM (scrollp->itemLen[itemNumber], widestItem); + + updateViewWidth (scrollp, widestItem); + + setViewSize (scrollp, scrollp->listSize + 1); + } + + freeChecked (temp); +} + +/* + * This adds a single item to a scrolling list, before the current item. + */ +void insertCDKScrollItem (CDKSCROLL *scrollp, const char *item) +{ + int widestItem = WidestItem (scrollp); + char *temp = 0; + size_t have = 0; + + if (allocListArrays (scrollp, scrollp->listSize, scrollp->listSize + 1) && + insertListItem (scrollp, scrollp->currentItem) && + allocListItem (scrollp, + scrollp->currentItem, + &temp, + &have, + scrollp->numbers ? (scrollp->currentItem + 1) : 0, + item)) + { + /* Determine the size of the widest item. */ + widestItem = MAXIMUM (scrollp->itemLen[scrollp->currentItem], widestItem); + + updateViewWidth (scrollp, widestItem); + + setViewSize (scrollp, scrollp->listSize + 1); + + resequence (scrollp); + } + + freeChecked (temp); +} + +/* + * This removes a single item from a scrolling list. + */ +void deleteCDKScrollItem (CDKSCROLL *scrollp, int position) +{ + if (position >= 0 && position < scrollp->listSize) + { + int x; + + freeChtype (scrollp->item[position]); + + /* Adjust the list. */ + for (x = position; x < scrollp->listSize; x++) + { + scrollp->item[x] = scrollp->item[x + 1]; + scrollp->itemLen[x] = scrollp->itemLen[x + 1]; + scrollp->itemPos[x] = scrollp->itemPos[x + 1]; + } + setViewSize (scrollp, scrollp->listSize - 1); + + if (scrollp->listSize > 0) + resequence (scrollp); + + if (scrollp->listSize < maxViewSize (scrollp)) + werase (scrollp->win); /* force the next redraw to be complete */ + + /* do this to update the view size, etc. */ + setCDKScrollPosition (scrollp, scrollp->currentItem); + } +} + +static void _focusCDKScroll (CDKOBJS *object) +{ + CDKSCROLL *scrollp = (CDKSCROLL *)object; + + drawCDKScrollCurrent (scrollp); + wrefresh (scrollp->listWin); +} + +static void _unfocusCDKScroll (CDKOBJS *object) +{ + CDKSCROLL *scrollp = (CDKSCROLL *)object; + + drawCDKScrollCurrent (scrollp); + wrefresh (scrollp->listWin); +} + +dummyRefreshData (Scroll) + +dummySaveData (Scroll) diff --git a/deps/cdk-5.0-20161210/scroller.c b/deps/cdk-5.0-20161210/scroller.c new file mode 100644 index 0000000..7a39789 --- /dev/null +++ b/deps/cdk-5.0-20161210/scroller.c @@ -0,0 +1,211 @@ +#include +#include +#include + +/* + * $Author: aleahmad $ + * $Date: 2016/11/20 13:57:20 $ + * $Revision: 1.3 $ + */ + +void scroller_KEY_UP (CDKSCROLLER *scroller) +{ + if (scroller->listSize <= 0 || scroller->currentItem <= 0) + { + Beep (); + return; + } + + scroller->currentItem--; + + if (scroller->currentHigh) + { + scroller->currentHigh--; + } + + if (scroller->currentTop && scroller->currentItem < scroller->currentTop) + { + scroller->currentTop--; + } +} + +void scroller_KEY_DOWN (CDKSCROLLER *scroller) +{ + if (scroller->listSize <= 0 || scroller->currentItem >= scroller->lastItem) + { + Beep (); + return; + } + + scroller->currentItem++; + + if (scroller->currentHigh < scroller->viewSize - 1) + { + scroller->currentHigh++; + } + + if (scroller->currentTop < scroller->maxTopItem + && scroller->currentItem > (scroller->currentTop + scroller->viewSize + - 1)) + { + scroller->currentTop++; + } +} + +void scroller_KEY_LEFT (CDKSCROLLER *scroller) +{ + if (scroller->listSize <= 0 || scroller->leftChar <= 0) + { + Beep (); + return; + } + + scroller->leftChar--; +} + +void scroller_KEY_RIGHT (CDKSCROLLER *scroller) +{ + if (scroller->listSize <= 0 || scroller->leftChar >= scroller->maxLeftChar) + { + Beep (); + return; + } + + scroller->leftChar++; +} + +void scroller_KEY_PPAGE (CDKSCROLLER *scroller) +{ + int viewSize = scroller->viewSize - 1; + + if (scroller->listSize <= 0 || scroller->currentTop <= 0) + { + Beep (); + return; + } + + if (scroller->currentTop < viewSize) + { + scroller_KEY_HOME (scroller); + } + else + { + scroller->currentTop -= viewSize; + scroller->currentItem -= viewSize; + } +} + +void scroller_KEY_NPAGE (CDKSCROLLER *scroller) +{ + int viewSize = scroller->viewSize - 1; + + if (scroller->listSize <= 0 || scroller->currentTop >= scroller->maxTopItem) + { + Beep (); + return; + } + + if ((scroller->currentTop + viewSize) <= scroller->maxTopItem) + { + scroller->currentTop += viewSize; + scroller->currentItem += viewSize; + } + else + { + scroller_KEY_END (scroller); + } +} + +void scroller_KEY_HOME (CDKSCROLLER *scroller) +{ + scroller->currentTop = 0; + scroller->currentItem = 0; + scroller->currentHigh = 0; +} + +void scroller_KEY_END (CDKSCROLLER *scroller) +{ + scroller->currentTop = scroller->maxTopItem; + scroller->currentItem = scroller->lastItem; + scroller->currentHigh = scroller->viewSize - 1; +} + +void scroller_FixCursorPosition (CDKSCROLLER *scroller) +{ + int scrollbarAdj = (scroller->scrollbarPlacement == LEFT) ? 1 : 0; + int ypos = SCREEN_YPOS (scroller, scroller->currentItem - scroller->currentTop); + int xpos = SCREEN_XPOS (scroller, 0) + scrollbarAdj; + + wmove (InputWindowOf (scroller), ypos, xpos); + wrefresh (InputWindowOf (scroller)); +} + +void scroller_SetPosition (CDKSCROLLER *scroller, int item) +{ + /* item out of band */ + if (item <= 0) + { + scroller_KEY_HOME (scroller); + return; + } + + /* item out of band */ + if (item >= scroller->lastItem) + { + scroller_KEY_END (scroller); + return; + } + + /* item in first view port */ + if (item < scroller->viewSize) + { + scroller->currentTop = 0; + } + /* item in last view port */ + else if (item >= scroller->lastItem - scroller->viewSize) + { + scroller->currentTop = scroller->maxTopItem; + } + /* item not in visible view port */ + else if (item < scroller->currentTop || item >= scroller->currentTop + scroller->viewSize) + { + scroller->currentTop = item; + } + + scroller->currentItem = item; + scroller->currentHigh = scroller->currentItem - scroller->currentTop; +} + +int scroller_MaxViewSize (CDKSCROLLER *scroller) +{ + return (scroller->boxHeight - (2 * BorderOf (scroller) + TitleLinesOf (scroller))); +} + +void scroller_SetViewSize (CDKSCROLLER *scroller, int size) +{ + int max_view_size = scroller_MaxViewSize (scroller); + + scroller->viewSize = max_view_size; + scroller->listSize = size; + scroller->lastItem = size - 1; + scroller->maxTopItem = size - scroller->viewSize; + + if (size < scroller->viewSize) + { + scroller->viewSize = size; + scroller->maxTopItem = 0; + } + + if (scroller->listSize > 0 && max_view_size > 0) + { + scroller->step = (float)(max_view_size / (double)scroller->listSize); + scroller->toggleSize = ((scroller->listSize > max_view_size) + ? 1 + : ceilCDK (scroller->step)); + } + else + { + scroller->step = 1; + scroller->toggleSize = 1; + } +} diff --git a/deps/cdk-5.0-20161210/select_file.c b/deps/cdk-5.0-20161210/select_file.c new file mode 100644 index 0000000..86c19a0 --- /dev/null +++ b/deps/cdk-5.0-20161210/select_file.c @@ -0,0 +1,42 @@ +#include + +/* + * $Author: tom $ + * $Date: 2012/03/22 00:38:13 $ + * $Revision: 1.2 $ + */ + +/* + * This allows a person to select a file. + */ +char *selectFile (CDKSCREEN *screen, const char *title) +{ + /* *INDENT-EQLS* */ + CDKFSELECT *fselect = 0; + char *filename = 0; + char *holder = 0; + + /* Create the file selector. */ + fselect = newCDKFselect (screen, CENTER, CENTER, -4, -20, + title, "File: ", + A_NORMAL, '_', A_REVERSE, + "", "", "", "", + TRUE, FALSE); + + /* Let the user play. */ + holder = activateCDKFselect (fselect, 0); + + /* Check the way the user exited the selector. */ + if (fselect->exitType != vNORMAL) + { + destroyCDKFselect (fselect); + refreshCDKScreen (screen); + return (0); + } + + /* Otherwise... */ + filename = copyChar (holder); + destroyCDKFselect (fselect); + refreshCDKScreen (screen); + return (filename); +} diff --git a/deps/cdk-5.0-20161210/selection.c b/deps/cdk-5.0-20161210/selection.c new file mode 100644 index 0000000..89f8704 --- /dev/null +++ b/deps/cdk-5.0-20161210/selection.c @@ -0,0 +1,1007 @@ +#include +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 19:25:35 $ + * $Revision: 1.156 $ + */ + +/* + * Declare file local prototypes. + */ +static int createList (CDKSELECTION *selection, CDK_CSTRING2 list, int listSize); +static void drawCDKSelectionList (CDKSELECTION *selection, boolean Box); +static void setViewSize (CDKSELECTION *scrollp, int listSize); +static int maxViewSize (CDKSELECTION *scrollp); + +/* Determine how many characters we can shift to the right */ +/* before all the items have been scrolled off the screen. */ +#define AvailableWidth(w) ((w)->boxWidth - 2*BorderOf(w) - (w)->maxchoicelen) +#define updateViewWidth(w, widest) \ + (w)->maxLeftChar = (((w)->boxWidth > widest) \ + ? 0 \ + : (widest - AvailableWidth(w))) +#define WidestItem(w) ((w)->maxLeftChar + AvailableWidth(w)) + +#define SCREENPOS(w,n) (w)->itemPos[n] - (w)->leftChar + scrollbarAdj /* + BorderOf(w) */ + +DeclareCDKObjects (SELECTION, Selection, setCdk, Int); + +/* + * This function creates a selection widget. + */ +CDKSELECTION *newCDKSelection (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int splace, + int height, + int width, + const char *title, + CDK_CSTRING2 list, + int listSize, + CDK_CSTRING2 choices, + int choiceCount, + chtype highlight, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKSELECTION *selection = 0; + int widestItem = -1; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int j = 0; + int junk2; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { CDK_BACKCHAR, KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + { 'g', KEY_HOME }, + { '1', KEY_HOME }, + { 'G', KEY_END }, + { '<', KEY_HOME }, + { '>', KEY_END }, + }; + /* *INDENT-ON* */ + + if (choiceCount <= 0 + || (selection = newCDKObject (CDKSELECTION, &my_funcs)) == 0 + || (selection->choice = typeCallocN (chtype *, choiceCount + 1)) == 0 + || (selection->choicelen = typeCallocN (int, choiceCount + 1)) == 0) + { + destroyCDKObject (selection); + return (0); + } + + setCDKSelectionBox (selection, Box); + + /* + * If the height is a negative value, the height will + * be ROWS-height, otherwise, the height will be the + * given height. + */ + boxHeight = setWidgetDimension (parentHeight, height, 0); + + /* + * If the width is a negative value, the width will + * be COLS-width, otherwise, the width will be the + * given width. + */ + boxWidth = setWidgetDimension (parentWidth, width, 0); + + boxWidth = setCdkTitle (ObjOf (selection), title, boxWidth); + + /* Set the box height. */ + if (TitleLinesOf (selection) > boxHeight) + { + boxHeight = TitleLinesOf (selection) + + MINIMUM (listSize, 8) + + 2 * BorderOf (selection); + } + + selection->maxchoicelen = 0; + + /* Adjust the box width if there is a scroll bar. */ + if (splace == LEFT || splace == RIGHT) + { + boxWidth++; + selection->scrollbar = TRUE; + } + else + { + selection->scrollbar = FALSE; + } + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + selection->boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + selection->boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + + setViewSize (selection, listSize); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, selection->boxWidth, selection->boxHeight); + + /* Make the selection window */ + selection->win = newwin (selection->boxHeight, selection->boxWidth, ypos, xpos); + + /* Is the window null?? */ + if (selection->win == 0) + { + destroyCDKObject (selection); + return (0); + } + + /* Turn the keypad on for this window. */ + keypad (selection->win, TRUE); + + /* Create the scrollbar window. */ + if (splace == RIGHT) + { + selection->scrollbarWin = subwin (selection->win, + maxViewSize (selection), 1, + SCREEN_YPOS (selection, ypos), + (xpos + + selection->boxWidth + - BorderOf (selection) + - 1)); + } + else if (splace == LEFT) + { + selection->scrollbarWin = subwin (selection->win, + maxViewSize (selection), 1, + SCREEN_YPOS (selection, ypos), + SCREEN_XPOS (selection, xpos)); + } + else + { + selection->scrollbarWin = 0; + } + + /* *INDENT-EQLS* Set the rest of the variables */ + ScreenOf (selection) = cdkscreen; + selection->parent = cdkscreen->window; + selection->scrollbarPlacement = splace; + selection->maxLeftChar = 0; + selection->leftChar = 0; + selection->highlight = highlight; + selection->choiceCount = choiceCount; + initExitType (selection); + ObjOf (selection)->acceptsFocus = TRUE; + ObjOf (selection)->inputWindow = selection->win; + selection->shadow = shadow; + + setCDKSelectionCurrent (selection, 0); + + /* Each choice has to be converted from char * to chtype * */ + for (j = 0; j < choiceCount; j++) + { + selection->choice[j] = char2Chtype (choices[j], + &selection->choicelen[j], + &junk2); + selection->maxchoicelen = MAXIMUM (selection->maxchoicelen, + selection->choicelen[j]); + } + + /* Each item in the needs to be converted to chtype * */ + widestItem = createList (selection, list, listSize); + if (widestItem > 0) + { + updateViewWidth (selection, widestItem); + } + else if (listSize) + { + destroyCDKObject (selection); + return (0); + } + + /* Do we need to create a shadow. */ + if (shadow) + { + selection->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Setup the key bindings. */ + for (j = 0; j < (int)SIZEOF (bindings); ++j) + bindCDKObject (vSELECTION, + selection, + (chtype)bindings[j].from, + getcCDKBind, + (void *)(long)bindings[j].to); + + /* Register this baby. */ + registerCDKObject (cdkscreen, vSELECTION, selection); + + /* Return the selection list */ + return (selection); +} + +/* + * Put the cursor on the currently-selected item. + */ +static void fixCursorPosition (CDKSELECTION *selection) +{ + scroller_FixCursorPosition ((CDKSCROLLER *)selection); +} + +/* + * This actually manages the selection widget... + */ +int activateCDKSelection (CDKSELECTION *selection, chtype *actions) +{ + /* Draw the selection list */ + drawCDKSelection (selection, ObjOf (selection)->box); + + if (actions == 0) + { + chtype input; + boolean functionKey; + + for (;;) + { + int ret; + + fixCursorPosition (selection); + input = (chtype)getchCDKObject (ObjOf (selection), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKSelection (selection, input); + if (selection->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int j = 0; + + /* Inject each character one at a time. */ + for (j = 0; j < length; j++) + { + int ret = injectCDKSelection (selection, actions[j]); + if (selection->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and return. */ + setExitType (selection, 0); + return 0; +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKSelection (CDKOBJS *object, chtype input) +{ + CDKSELECTION *selection = (CDKSELECTION *)object; + CDKSCROLLER *widget = (CDKSCROLLER *)object; + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Draw the widget list */ + drawCDKSelectionList (selection, ObjOf (widget)->box); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vSELECTION, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a predefined binding. */ + if (checkCDKObjectBind (vSELECTION, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_UP: + scroller_KEY_UP (widget); + break; + + case KEY_DOWN: + scroller_KEY_DOWN (widget); + break; + + case KEY_RIGHT: + scroller_KEY_RIGHT (widget); + break; + + case KEY_LEFT: + scroller_KEY_LEFT (widget); + break; + + case KEY_PPAGE: + scroller_KEY_PPAGE (widget); + break; + + case KEY_NPAGE: + scroller_KEY_NPAGE (widget); + break; + + case KEY_HOME: + scroller_KEY_HOME (widget); + break; + + case KEY_END: + scroller_KEY_END (widget); + break; + + case '$': + widget->leftChar = widget->maxLeftChar; + break; + + case '|': + widget->leftChar = 0; + break; + + case SPACE: + if (selection->mode[widget->currentItem] == 0) + { + if (selection->selections[widget->currentItem] + == (selection->choiceCount - 1)) + { + selection->selections[widget->currentItem] = 0; + } + else + { + selection->selections[widget->currentItem]++; + } + } + else + { + Beep (); + } + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_TAB: + case KEY_ENTER: + setExitType (widget, input); + ret = 1; + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vSELECTION, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKSelectionList (selection, ObjOf (widget)->box); + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + fixCursorPosition (selection); + return (ret != unknownInt); +} + +/* + * This moves the selection field to the given location. + */ +static void _moveCDKSelection (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKSELECTION *selection = (CDKSELECTION *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (selection->win); + int currentY = getbegy (selection->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (selection->win) + xplace; + ypos = getbegy (selection->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (selection), &xpos, &ypos, selection->boxWidth, selection->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (selection->win, -xdiff, -ydiff); + moveCursesWindow (selection->scrollbarWin, -xdiff, -ydiff); + moveCursesWindow (selection->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (selection)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKSelection (selection, ObjOf (selection)->box); + } +} + +/* + * This function draws the selection list. + */ +static void _drawCDKSelection (CDKOBJS *object, boolean Box) +{ + CDKSELECTION *selection = (CDKSELECTION *)object; + + /* Draw in the shadow if we need to. */ + if (selection->shadowWin != 0) + { + drawShadow (selection->shadowWin); + } + + drawCdkTitle (selection->win, object); + + /* Redraw the list */ + drawCDKSelectionList (selection, Box); +} + +static int maxViewSize (CDKSELECTION *widget) +{ + return scroller_MaxViewSize ((CDKSCROLLER *)widget); +} + +/* + * Set variables that depend upon the list-size. + */ +static void setViewSize (CDKSELECTION *widget, int listSize) +{ + scroller_SetViewSize ((CDKSCROLLER *)widget, listSize); +} + +/* + * This function draws the selection list window. + */ +static void drawCDKSelectionList (CDKSELECTION *selection, boolean Box GCC_UNUSED) +{ + /* *INDENT-EQLS* */ + int scrollbarAdj = (selection->scrollbarPlacement == LEFT) ? 1 : 0; + int screenPos = 0; + int j; + int selItem = -1; + + /* If there is to be a highlight, assign it now */ + if (ObjOf (selection)->hasFocus) + selItem = selection->currentItem; + + /* draw the list... */ + for (j = 0; j < selection->viewSize; j++) + { + int xpos = SCREEN_XPOS (selection, 0); + int ypos = SCREEN_YPOS (selection, j); + int k; + + /* Draw the empty line. */ + writeBlanks (selection->win, xpos, ypos, + HORIZONTAL, 0, getmaxx (selection->win)); + + k = j + selection->currentTop; + + /* Draw the element in the selection list. */ + if (k < selection->listSize) + { + screenPos = SCREENPOS (selection, k); + + /* Draw the selection item. */ + writeChtypeAttrib (selection->win, + (screenPos >= 0) ? screenPos : 1, + ypos, + selection->item[k], + ((k == selItem) + ? selection->highlight + : A_NORMAL), + HORIZONTAL, + (screenPos >= 0) ? 0 : (1 - screenPos), + selection->itemLen[k]); + + /* Draw the choice value. */ + writeChtype (selection->win, + xpos + scrollbarAdj, + ypos, + selection->choice[selection->selections[k]], + HORIZONTAL, + 0, + selection->choicelen[selection->selections[k]]); + } + } + + /* Determine where the toggle is supposed to be. */ + if (selection->scrollbar) + { + selection->togglePos = floorCDK (selection->currentItem * (double)selection->step); + selection->togglePos = MINIMUM (selection->togglePos, + (getmaxy (selection->scrollbarWin) - 1)); + + (void)mvwvline (selection->scrollbarWin, 0, 0, ACS_CKBOARD, getmaxy (selection->scrollbarWin)); + (void)mvwvline (selection->scrollbarWin, + selection->togglePos, + 0, + ' ' | A_REVERSE, selection->toggleSize); + } + + /* Box it if needed */ + if (ObjOf (selection)->box) + { + drawObjBox (selection->win, ObjOf (selection)); + } + + fixCursorPosition (selection); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrSelection (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKSELECTION *widget = (CDKSELECTION *)object; + + wbkgd (widget->win, attrib); + if (widget->scrollbarWin != 0) + { + wbkgd (widget->scrollbarWin, attrib); + } + } +} + +static void destroyInfo (CDKSELECTION *widget) +{ + CDKfreeChtypes (widget->item); + widget->item = 0; + + freeAndNull (widget->itemPos); + freeAndNull (widget->itemLen); + freeAndNull (widget->selections); + freeAndNull (widget->mode); +} + +/* + * This function destroys the selection list. + */ +static void _destroyCDKSelection (CDKOBJS *object) +{ + if (object != 0) + { + CDKSELECTION *selection = (CDKSELECTION *)object; + + cleanCdkTitle (object); + CDKfreeChtypes (selection->choice); + freeChecked (selection->choicelen); + destroyInfo (selection); + + /* Clean up the windows. */ + deleteCursesWindow (selection->scrollbarWin); + deleteCursesWindow (selection->shadowWin); + deleteCursesWindow (selection->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vSELECTION, selection); + + /* Unregister this object. */ + unregisterCDKObject (vSELECTION, selection); + } +} + +/* + * This function erases the selection list from the screen. + */ +static void _eraseCDKSelection (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKSELECTION *selection = (CDKSELECTION *)object; + + eraseCursesWindow (selection->win); + eraseCursesWindow (selection->shadowWin); + } +} + +/* + * This function sets a couple of the selection list attributes. + */ +void setCDKSelection (CDKSELECTION *selection, + chtype highlight, + int *choices, + boolean Box) +{ + setCDKSelectionChoices (selection, choices); + setCDKSelectionHighlight (selection, highlight); + setCDKSelectionBox (selection, Box); +} + +/* + * This sets the selection list items. + */ +void setCDKSelectionItems (CDKSELECTION *selection, CDK_CSTRING2 list, int listSize) +{ + int widestItem; + int j = 0; + + widestItem = createList (selection, list, listSize); + if (widestItem <= 0) + return; + + /* Clean up the display. */ + for (j = 0; j < selection->viewSize; j++) + { + writeBlanks (selection->win, + SCREEN_XPOS (selection, 0), + SCREEN_YPOS (selection, j), + HORIZONTAL, 0, getmaxx (selection->win)); + } + + setViewSize (selection, listSize); + setCDKSelectionCurrent (selection, 0); + + updateViewWidth (selection, widestItem); +} +int getCDKSelectionItems (CDKSELECTION *selection, char **list) +{ + if (list != 0) + { + int j; + + for (j = 0; j < selection->listSize; j++) + { + list[j] = chtype2Char (selection->item[j]); + } + } + return selection->listSize; +} + +/* + * + */ +void setCDKSelectionTitle (CDKSELECTION *selection, const char *title) +{ + /* Make sure the title isn't null. */ + if (title == 0) + { + return; + } + + (void)setCdkTitle (ObjOf (selection), title, -(selection->boxWidth + 1)); + + setViewSize (selection, selection->listSize); +} +char *getCDKSelectionTitle (CDKSELECTION *selection GCC_UNUSED) +{ + return chtype2Char (*TitleOf (selection)); +} + +/* + * This sets the highlight bar. + */ +void setCDKSelectionHighlight (CDKSELECTION *selection, chtype highlight) +{ + selection->highlight = highlight; +} +chtype getCDKSelectionHighlight (CDKSELECTION *selection) +{ + return selection->highlight; +} + +/* + * This sets the default choices for the selection list. + */ +void setCDKSelectionChoices (CDKSELECTION *selection, int *choices) +{ + int j; + + /* Set the choice values in the selection list. */ + for (j = 0; j < selection->listSize; j++) + { + if (choices[j] < 0) + { + selection->selections[j] = 0; + } + else if (choices[j] > selection->choiceCount) + { + selection->selections[j] = selection->choiceCount - 1; + } + else + { + selection->selections[j] = choices[j]; + } + } +} +int *getCDKSelectionChoices (CDKSELECTION *selection) +{ + return selection->selections; +} + +/* + * This sets a single item's choice value. + */ +void setCDKSelectionChoice (CDKSELECTION *selection, int Index, int choice) +{ + int correctChoice = choice; + int correctIndex = Index; + + /* Verify that the choice value is in range. */ + if (choice < 0) + { + correctChoice = 0; + } + else if (choice > selection->choiceCount) + { + correctChoice = selection->choiceCount - 1; + } + + /* Make sure the index isn't out of range. */ + if (correctIndex < 0) + { + correctIndex = 0; + } + else if (correctIndex > selection->listSize) + { + correctIndex = selection->listSize - 1; + } + + /* Set the choice value. */ + selection->selections[correctIndex] = correctChoice; +} +int getCDKSelectionChoice (CDKSELECTION *selection, int Index) +{ + /* Make sure the index isn't out of range. */ + if (Index < 0) + { + return selection->selections[0]; + } + else if (Index > selection->listSize) + { + return selection->selections[selection->listSize - 1]; + } + else + { + return selection->selections[Index]; + } +} + +/* + * This sets the modes of the items in the selection list. Currently + * there are only two: editable=0 and read-only=1 + */ +void setCDKSelectionModes (CDKSELECTION *selection, int *modes) +{ + int j; + + /* Make sure the widget pointer is not null. */ + if (selection == 0) + { + return; + } + + /* Set the modes. */ + for (j = 0; j < selection->listSize; j++) + { + selection->mode[j] = modes[j]; + } +} +int *getCDKSelectionModes (CDKSELECTION *selection) +{ + return selection->mode; +} + +/* + * This sets a single mode of an item in the selection list. + */ +void setCDKSelectionMode (CDKSELECTION *selection, int Index, int mode) +{ + /* Make sure the widget pointer is not null. */ + if (selection == 0) + { + return; + } + + /* Make sure the index isn't out of range. */ + if (Index < 0) + { + selection->mode[0] = mode; + } + else if (Index > selection->listSize) + { + selection->mode[selection->listSize - 1] = mode; + } + else + { + selection->mode[Index] = mode; + } +} +int getCDKSelectionMode (CDKSELECTION *selection, int Index) +{ + /* Make sure the index isn't out of range. */ + if (Index < 0) + { + return selection->mode[0]; + } + else if (Index > selection->listSize) + { + return selection->mode[selection->listSize - 1]; + } + else + { + return selection->mode[Index]; + } +} + +/* + * This sets the box attribute of the widget. + */ +void setCDKSelectionBox (CDKSELECTION *selection, boolean Box) +{ + ObjOf (selection)->box = Box; + ObjOf (selection)->borderSize = Box ? 1 : 0; +} +boolean getCDKSelectionBox (CDKSELECTION *selection) +{ + return ObjOf (selection)->box; +} + +/* + * set/get the current item index + */ +void setCDKSelectionCurrent (CDKSELECTION *selection, int item) +{ + scroller_SetPosition ((CDKSCROLLER *)selection, item); +} + +int getCDKSelectionCurrent (CDKSELECTION *selection) +{ + return selection->currentItem; +} + +/* + * methods for generic type methods + */ +static void _focusCDKSelection (CDKOBJS *object) +{ + CDKSELECTION *selection = (CDKSELECTION *)object; + + drawCDKSelectionList (selection, ObjOf (selection)->box); +} + +static void _unfocusCDKSelection (CDKOBJS *object) +{ + CDKSELECTION *selection = (CDKSELECTION *)object; + + drawCDKSelectionList (selection, ObjOf (selection)->box); +} + +static int createList (CDKSELECTION *selection, CDK_CSTRING2 list, int listSize) +{ + int status = 0; + int widestItem = 0; + + if (listSize >= 0) + { + /* *INDENT-EQLS* */ + chtype **newList = typeCallocN (chtype *, listSize + 1); + int *newLen = typeCallocN (int, listSize + 1); + int *newPos = typeCallocN (int, listSize + 1); + int *newSel = typeCallocN (int, listSize + 1); + int *newMode = typeCallocN (int, listSize + 1); + + if (newList != 0 + && newLen != 0 + && newPos != 0 + && newSel != 0 + && newMode != 0) + { + int boxWidth = AvailableWidth (selection); + int adjust = selection->maxchoicelen + BorderOf (selection); + int j; + + status = 1; + for (j = 0; j < listSize; j++) + { + newList[j] = char2Chtype (list[j], &newLen[j], &newPos[j]); + if (newList[j] == 0) + { + status = 0; + break; + } + newPos[j] = justifyString (boxWidth, newLen[j], newPos[j]) + adjust; + widestItem = MAXIMUM (widestItem, newLen[j]); + } + + if (status) + { + destroyInfo (selection); + + /* *INDENT-EQLS* */ + selection->item = newList; + selection->itemPos = newPos; + selection->itemLen = newLen; + selection->selections = newSel; + selection->mode = newMode; + } + else + { + CDKfreeChtypes (newList); + freeChecked (newPos); + freeChecked (newLen); + freeChecked (newSel); + freeChecked (newMode); + } + } + else + { + CDKfreeChtypes (newList); + freeChecked (newPos); + freeChecked (newLen); + freeChecked (newSel); + freeChecked (newMode); + } + } + else + { + destroyInfo (selection); + } + + return status ? widestItem : 0; +} + +dummyRefreshData (Selection) + +dummySaveData (Selection) diff --git a/deps/cdk-5.0-20161210/swindow.c b/deps/cdk-5.0-20161210/swindow.c new file mode 100644 index 0000000..9bca38f --- /dev/null +++ b/deps/cdk-5.0-20161210/swindow.c @@ -0,0 +1,1217 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 20:11:20 $ + * $Revision: 1.126 $ + */ + +/* + * Declare file local prototypes. + */ +static int createList (CDKSWINDOW *swindow, int listSize); +static void drawCDKSwindowList (CDKSWINDOW *swindow, boolean Box); + +DeclareCDKObjects (SWINDOW, Swindow, setCdk, Int); + +/* + * This function creates a scrolling window widget. + */ +CDKSWINDOW *newCDKSwindow (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int height, + int width, + const char *title, + int saveLines, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKSWINDOW *swindow = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int x; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { CDK_BACKCHAR, KEY_PPAGE }, + { 'b', KEY_PPAGE }, + { 'B', KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + { SPACE, KEY_NPAGE }, + { 'f', KEY_NPAGE }, + { 'F', KEY_NPAGE }, + { '|', KEY_HOME }, + { '$', KEY_END }, + }; + /* *INDENT-ON* */ + + + if ((swindow = newCDKObject (CDKSWINDOW, &my_funcs)) == 0) + return (0); + + setCDKSwindowBox (swindow, Box); + + /* + * If the height is a negative value, the height will + * be ROWS-height, otherwise, the height will be the + * given height. + */ + boxHeight = setWidgetDimension (parentHeight, height, 0); + + /* + * If the width is a negative value, the width will + * be COLS-width, otherwise, the width will be the + * given width. + */ + boxWidth = setWidgetDimension (parentWidth, width, 0); + + boxWidth = setCdkTitle (ObjOf (swindow), title, boxWidth); + + /* Set the box height. */ + boxHeight += TitleLinesOf (swindow) + 1; + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); + boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); + + /* Set the rest of the variables. */ + swindow->titleAdj = TitleLinesOf (swindow) + 1; + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the scrolling window */ + swindow->win = newwin (boxHeight, boxWidth, ypos, xpos); + if (swindow->win == 0) + { + destroyCDKObject (swindow); + return (0); + } + keypad (swindow->win, TRUE); + + /* Make the field window. */ + swindow->fieldWin = subwin (swindow->win, + (boxHeight - TitleLinesOf (swindow) - 2), + boxWidth - 2, + ypos + TitleLinesOf (swindow) + 1, + xpos + 1); + keypad (swindow->fieldWin, TRUE); + + /* *INDENT-EQLS* Set the rest of the variables */ + ScreenOf (swindow) = cdkscreen; + swindow->parent = cdkscreen->window; + swindow->shadowWin = 0; + swindow->boxHeight = boxHeight; + swindow->boxWidth = boxWidth; + swindow->viewSize = boxHeight - TitleLinesOf (swindow) - 2; + swindow->currentTop = 0; + swindow->maxTopLine = 0; + swindow->leftChar = 0; + swindow->maxLeftChar = 0; + swindow->listSize = 0; + swindow->widestLine = -1; + swindow->saveLines = saveLines; + initExitType (swindow); + ObjOf (swindow)->acceptsFocus = TRUE; + ObjOf (swindow)->inputWindow = swindow->win; + swindow->shadow = shadow; + + if (!createList (swindow, saveLines)) + { + destroyCDKObject (swindow); + return (0); + } + + /* Do we need to create a shadow??? */ + if (shadow) + { + swindow->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + /* Clean the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (vSWINDOW, + swindow, + (chtype)bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + /* Register this baby. */ + registerCDKObject (cdkscreen, vSWINDOW, swindow); + + /* Return the scrolling window */ + return (swindow); +} + +/* + * This sets the lines and the box attribute of the scrolling window. + */ +void setCDKSwindow (CDKSWINDOW *swindow, CDK_CSTRING2 list, int lines, boolean Box) +{ + setCDKSwindowContents (swindow, list, lines); + setCDKSwindowBox (swindow, Box); +} + +static void setupLine (CDKSWINDOW *swindow, const char *list, int x) +{ + /* *INDENT-EQLS* */ + swindow->list[x] = char2Chtype (list, + &swindow->listLen[x], + &swindow->listPos[x]); + swindow->listPos[x] = justifyString (swindow->boxWidth, + swindow->listLen[x], + swindow->listPos[x]); + swindow->widestLine = MAXIMUM (swindow->widestLine, swindow->listLen[x]); +} + +/* + * This sets all the lines inside the scrolling window. + */ +void setCDKSwindowContents (CDKSWINDOW *swindow, CDK_CSTRING2 list, int listSize) +{ + int x = 0; + + /* First lets clean all the lines in the window. */ + cleanCDKSwindow (swindow); + createList (swindow, listSize); + + /* Now lets set all the lines inside the window. */ + for (x = 0; x < listSize; x++) + { + setupLine (swindow, list[x], x); + } + + /* *INDENT-EQLS* Set some of the more important members of the scrolling window. */ + swindow->listSize = listSize; + swindow->maxTopLine = swindow->listSize - swindow->viewSize; + swindow->maxTopLine = (swindow->maxTopLine < 0 ? 0 : swindow->maxTopLine); + swindow->maxLeftChar = swindow->widestLine - (swindow->boxWidth - 2); + swindow->currentTop = 0; + swindow->leftChar = 0; +} +chtype **getCDKSwindowContents (CDKSWINDOW *swindow, int *size) +{ + (*size) = swindow->listSize; + return swindow->list; +} + +/* + * This sets the box attribute for the widget. + */ +void setCDKSwindowBox (CDKSWINDOW *swindow, boolean Box) +{ + ObjOf (swindow)->box = Box; + ObjOf (swindow)->borderSize = Box ? 1 : 0; +} +boolean getCDKSwindowBox (CDKSWINDOW *swindow) +{ + return ObjOf (swindow)->box; +} + +static void freeLine (CDKSWINDOW *swindow, int x) +{ + if (x < swindow->listSize) + { + freeChtype (swindow->list[x]); + swindow->list[x] = 0; + } +} + +/* + * This adds a line to the scrolling window. + */ +void addCDKSwindow (CDKSWINDOW *swindow, const char *list, int insertPos) +{ + int x = 0; + + /* + * If we are at the maximum number of save lines. Erase + * the first position and bump everything up one spot. + */ + if (swindow->listSize == swindow->saveLines) + { + /* Free up the memory. */ + freeLine (swindow, 0); + + /* Bump everything up one spot. */ + for (x = 0; x < swindow->listSize; x++) + { + /* *INDENT-EQLS* */ + swindow->list[x] = swindow->list[x + 1]; + swindow->listPos[x] = swindow->listPos[x + 1]; + swindow->listLen[x] = swindow->listLen[x + 1]; + } + + /* *INDENT-EQLS* Clean out the last position. */ + swindow->list[swindow->listSize] = 0; + swindow->listLen[swindow->listSize] = 0; + swindow->listPos[swindow->listSize] = 0; + swindow->listSize--; + } + + /* Determine where the line is being added. */ + if (insertPos == TOP) + { + /* We need to 'bump' everything down one line... */ + for (x = swindow->listSize; x > 0; x--) + { + /* *INDENT-EQLS* Copy in the new row. */ + swindow->list[x] = swindow->list[x - 1]; + swindow->listPos[x] = swindow->listPos[x - 1]; + swindow->listLen[x] = swindow->listLen[x - 1]; + } + + /* Add it into the scrolling window. */ + setupLine (swindow, list, 0); + + /* Set some variables. */ + swindow->currentTop = 0; + if (swindow->listSize < swindow->saveLines) + { + swindow->listSize++; + } + + /* Set the maximum top line. */ + swindow->maxTopLine = swindow->listSize - swindow->viewSize; + swindow->maxTopLine = (swindow->maxTopLine < 0 ? 0 : swindow->maxTopLine); + + swindow->maxLeftChar = swindow->widestLine - (swindow->boxWidth - 2); + } + else + { + /* Add to the bottom. */ + setupLine (swindow, list, swindow->listSize); + + swindow->maxLeftChar = swindow->widestLine - (swindow->boxWidth - 2); + + /* Increment the item count and zero out the next row. */ + if (swindow->listSize < swindow->saveLines) + { + swindow->listSize++; + freeLine (swindow, swindow->listSize); + } + + /* Set the maximum top line. */ + if (swindow->listSize <= swindow->viewSize) + { + swindow->maxTopLine = 0; + swindow->currentTop = 0; + } + else + { + swindow->maxTopLine = (swindow->listSize - swindow->viewSize); + swindow->currentTop = swindow->maxTopLine; + } + } + + /* Draw in the list. */ + drawCDKSwindowList (swindow, ObjOf (swindow)->box); +} + +/* + * This jumps to a given line. + */ +void jumpToLineCDKSwindow (CDKSWINDOW *swindow, int line) +{ + /* + * Make sure the line is in bounds. + */ + if (line == BOTTOM || line >= swindow->listSize) + { + /* We are moving to the last page. */ + swindow->currentTop = swindow->listSize - swindow->viewSize; + } + else if (line == TOP || line <= 0) + { + /* We are moving to the top of the page. */ + swindow->currentTop = 0; + } + else + { + /* We are moving in the middle somewhere. */ + if ((swindow->viewSize + line) < swindow->listSize) + { + swindow->currentTop = line; + } + else + { + swindow->currentTop = swindow->listSize - swindow->viewSize; + } + } + + /* A little sanity check to make we don't something silly. */ + if (swindow->currentTop < 0) + { + swindow->currentTop = 0; + } + + /* Redraw the window. */ + drawCDKSwindow (swindow, ObjOf (swindow)->box); +} + +/* + * This removes all the lines inside the scrolling window. + */ +void cleanCDKSwindow (CDKSWINDOW *swindow) +{ + int x; + + /* Clean up the memory used ... */ + for (x = 0; x < swindow->listSize; x++) + { + freeLine (swindow, x); + } + + /* *INDENT-EQLS* Reset some variables. */ + swindow->listSize = 0; + swindow->maxLeftChar = 0; + swindow->widestLine = 0; + swindow->currentTop = 0; + swindow->maxTopLine = 0; + + /* Redraw the window. */ + drawCDKSwindow (swindow, ObjOf (swindow)->box); +} + +/* + * This trims lines from the scrolling window. + */ +void trimCDKSwindow (CDKSWINDOW *swindow, int begin, int end) +{ + int start, finish, lines, x; + + /* + * Do nothing if the list is empty, the interval is empty, + * or the entire interval lies outside of the list. + */ + if ((swindow->listSize == 0) || + (begin > end) || + (begin < 0 && end < 0) || + (begin >= swindow->listSize && end >= swindow->listSize)) + { + return; + } + + /* Check the value of begin. */ + if (begin < 0) + { + start = 0; + } + else if (begin >= swindow->listSize) + { + start = swindow->listSize - 1; + } + else + { + start = begin; + } + + /* Check the value of end. */ + if (end < 0) + { + finish = 0; + } + else if (end >= swindow->listSize) + { + finish = swindow->listSize - 1; + } + else + { + finish = end; + } + + lines = finish - start + 1; + + /* Start nuking elements from the window. */ + for (x = start; x <= finish; x++) + { + freeLine (swindow, x); + } + + /* Move the lines after the trimmed lines up. */ + for (x = start; x < swindow->listSize - lines; x++) + { + /* Move the line up. */ + swindow->list[x] = swindow->list[x + lines]; + swindow->listPos[x] = swindow->listPos[x + lines]; + swindow->listLen[x] = swindow->listLen[x + lines]; + + /* Zero out the moved line's original entries. */ + swindow->list[x + lines] = 0; + swindow->listPos[x + lines] = 0; + swindow->listLen[x + lines] = 0; + } + + /* Adjust the item count correctly. */ + swindow->listSize = swindow->listSize - lines; + + /* Set the maximum top line. */ + if (swindow->listSize <= swindow->viewSize) + { + swindow->maxTopLine = 0; + } + else + { + swindow->maxTopLine = (swindow->listSize - swindow->viewSize); + } + + /* Set the current top line, but only if it is no longer valid. */ + if (swindow->currentTop > swindow->maxTopLine) + { + swindow->currentTop = swindow->maxTopLine; + } + + /* Redraw the list. */ + drawCDKSwindowList (swindow, ObjOf (swindow)->box); +} + +/* + * This allows the user to play inside the scrolling window. + */ +void activateCDKSwindow (CDKSWINDOW *swindow, chtype *actions) +{ + /* Draw the scrolling list */ + drawCDKSwindow (swindow, ObjOf (swindow)->box); + + if (actions == 0) + { + chtype input; + boolean functionKey; + + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (swindow), &functionKey); + + /* Inject the character into the widget. */ + (void)injectCDKSwindow (swindow, input); + if (swindow->exitType != vEARLY_EXIT) + { + return; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + (void)injectCDKSwindow (swindow, actions[x]); + if (swindow->exitType != vEARLY_EXIT) + { + return; + } + } + } + + /* Set the exit type and return. */ + setExitType (swindow, 0); + return; +} + +/* + * This injects a single character into the widget. + */ +static int _injectCDKSwindow (CDKOBJS *object, chtype input) +{ + /* *INDENT-EQLS* */ + CDKSWINDOW *widget = (CDKSWINDOW *)object; + int ppReturn = 1; + int ret = unknownInt; + bool complete = FALSE; + + /* Set the exit type. */ + setExitType (widget, 0); + + /* Draw the window.... */ + drawCDKSwindow (widget, ObjOf (widget)->box); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + /* Call the pre-process function. */ + ppReturn = PreProcessFuncOf (widget) (vSWINDOW, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check for a key binding. */ + if (checkCDKObjectBind (vSWINDOW, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case KEY_UP: + if (widget->currentTop > 0) + { + widget->currentTop--; + } + else + { + Beep (); + } + break; + + case KEY_DOWN: + if (widget->currentTop >= 0 && widget->currentTop < widget->maxTopLine) + { + widget->currentTop++; + } + else + { + Beep (); + } + break; + + case KEY_RIGHT: + if (widget->leftChar < widget->maxLeftChar) + { + widget->leftChar++; + } + else + { + Beep (); + } + break; + + case KEY_LEFT: + if (widget->leftChar > 0) + { + widget->leftChar--; + } + else + { + Beep (); + } + break; + + case KEY_PPAGE: + if (widget->currentTop != 0) + { + if (widget->currentTop >= widget->viewSize) + { + widget->currentTop = (widget->currentTop + - (widget->viewSize - 1)); + } + else + { + widget->currentTop = 0; + } + } + else + { + Beep (); + } + break; + + case KEY_NPAGE: + if (widget->currentTop != widget->maxTopLine) + { + if ((widget->currentTop + widget->viewSize) < widget->maxTopLine) + { + widget->currentTop = (widget->currentTop + + (widget->viewSize - 1)); + } + else + { + widget->currentTop = widget->maxTopLine; + } + } + else + { + Beep (); + } + break; + + case KEY_HOME: + widget->leftChar = 0; + break; + + case KEY_END: + widget->leftChar = widget->maxLeftChar + 1; + break; + + case 'g': + case '1': + case '<': + widget->currentTop = 0; + break; + + case 'G': + case '>': + widget->currentTop = widget->maxTopLine; + break; + + case 'l': + case 'L': + loadCDKSwindowInformation (widget); + break; + + case 's': + case 'S': + saveCDKSwindowInformation (widget); + break; + + case KEY_TAB: + case KEY_ENTER: + setExitType (widget, input); + ret = 1; + complete = TRUE; + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vSWINDOW, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + drawCDKSwindowList (widget, ObjOf (widget)->box); + setExitType (widget, 0); + } + + ResultOf (widget).valueInt = ret; + return (ret != unknownInt); +} + +/* + * This moves the swindow field to the given location. + */ +static void _moveCDKSwindow (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKSWINDOW *swindow = (CDKSWINDOW *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (swindow->win); + int currentY = getbegy (swindow->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (swindow->win) + xplace; + ypos = getbegy (swindow->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (swindow), &xpos, &ypos, swindow->boxWidth, swindow->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (swindow->win, -xdiff, -ydiff); + moveCursesWindow (swindow->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (swindow)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKSwindow (swindow, ObjOf (swindow)->box); + } +} + +/* + * This function draws the swindow window widget. + */ +static void _drawCDKSwindow (CDKOBJS *object, boolean Box) +{ + CDKSWINDOW *swindow = (CDKSWINDOW *)object; + + /* Do we need to draw in the shadow. */ + if (swindow->shadowWin != 0) + { + drawShadow (swindow->shadowWin); + } + + /* Box the widget if needed */ + if (Box) + { + drawObjBox (swindow->win, ObjOf (swindow)); + } + + drawCdkTitle (swindow->win, object); + + wrefresh (swindow->win); + + /* Draw in the list. */ + drawCDKSwindowList (swindow, Box); +} + +/* + * This draws in the contents of the scrolling window. + */ +static void drawCDKSwindowList (CDKSWINDOW *swindow, boolean Box GCC_UNUSED) +{ + int lastLine, x; + + /* Determine the last line to draw. */ + if (swindow->listSize < swindow->viewSize) + { + lastLine = swindow->listSize; + } + else + { + lastLine = swindow->viewSize; + } + + /* Erase the scrolling window. */ + werase (swindow->fieldWin); + + /* Start drawing in each line. */ + for (x = 0; x < lastLine; x++) + { + int screenPos; + + if ((x + swindow->currentTop) >= swindow->listSize) + break; + + screenPos = swindow->listPos[x + swindow->currentTop] - swindow->leftChar; + + /* Write in the correct line. */ + if (screenPos >= 0) + { + writeChtype (swindow->fieldWin, screenPos, x, + swindow->list[x + swindow->currentTop], + HORIZONTAL, 0, + swindow->listLen[x + swindow->currentTop]); + } + else + { + writeChtype (swindow->fieldWin, 0, x, + swindow->list[x + swindow->currentTop], + HORIZONTAL, + swindow->leftChar - swindow->listPos[x + swindow->currentTop], + swindow->listLen[x + swindow->currentTop]); + } + } + + wrefresh (swindow->fieldWin); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrSwindow (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKSWINDOW *widget = (CDKSWINDOW *)object; + + wbkgd (widget->win, attrib); + wbkgd (widget->fieldWin, attrib); + } +} + +/* + * Free any storage associated with the info-list. + */ +static void destroyInfo (CDKSWINDOW *swindow) +{ + CDKfreeChtypes (swindow->list); + freeChecked (swindow->listPos); + freeChecked (swindow->listLen); + + swindow->list = 0; + swindow->listPos = 0; + swindow->listLen = 0; +} + +/* + * This function destroys the scrolling window widget. + */ +static void _destroyCDKSwindow (CDKOBJS *object) +{ + if (object != 0) + { + CDKSWINDOW *swindow = (CDKSWINDOW *)object; + + destroyInfo (swindow); + + cleanCdkTitle (object); + + /* Delete the windows. */ + deleteCursesWindow (swindow->shadowWin); + deleteCursesWindow (swindow->fieldWin); + deleteCursesWindow (swindow->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vSWINDOW, swindow); + + /* Unregister this object. */ + unregisterCDKObject (vSWINDOW, swindow); + } +} + +/* + * This function erases the scrolling window widget. + */ +static void _eraseCDKSwindow (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKSWINDOW *swindow = (CDKSWINDOW *)object; + + eraseCursesWindow (swindow->win); + eraseCursesWindow (swindow->shadowWin); + } +} + +/* + * This exec's a command and redirects the output to the scrolling window. + */ +int execCDKSwindow (CDKSWINDOW *swindow, const char *command, int insertPos) +{ + FILE *ps; + int count = -1; + + endwin (); + /* Try to open the command. */ + if ((ps = popen (command, "r")) != 0) + { + char temp[BUFSIZ]; + + /* Start reading. */ + while (fgets (temp, sizeof (temp), ps) != 0) + { + size_t len = strlen (temp); + if (len != 0 && temp[len - 1] == '\n') + temp[--len] = '\0'; + /* Add the line to the scrolling window. */ + addCDKSwindow (swindow, temp, insertPos); + count++; + } + + /* Close the pipe. */ + pclose (ps); + } + return count; +} + +static void showMessage2 (CDKSWINDOW *swindow, + const char *msg, + const char *msg2, + const char *filename) +{ + char *mesg[10]; + char *temp = (char *)malloc (80 + strlen (filename)); + int n = 0; + + mesg[n++] = copyChar (msg); + mesg[n++] = copyChar (msg2); + sprintf (temp, "(%s)", filename); + mesg[n++] = copyChar (temp); + mesg[n++] = copyChar (" "); + mesg[n++] = copyChar ("Press any key to continue."); + popupLabel (ScreenOf (swindow), (CDK_CSTRING2)mesg, n); + freeCharList (mesg, (unsigned)n); + free (temp); +} + +/* + * This function allows the user to dump the information from the + * scrolling window to a file. + */ +void saveCDKSwindowInformation (CDKSWINDOW *swindow) +{ + CDKENTRY *entry = 0; + char *filename = 0; + int linesSaved; + + /* Create the entry field to get the filename. */ + entry = newCDKEntry (ScreenOf (swindow), CENTER, CENTER, + "Enter the filename of the save file.", + "Filename: ", + A_NORMAL, '_', vMIXED, + 20, 1, 256, + TRUE, FALSE); + + /* Get the filename. */ + filename = activateCDKEntry (entry, 0); + + /* Did they hit escape? */ + if (entry->exitType == vESCAPE_HIT) + { + const char *mesg[10]; + + /* Popup a message. */ + mesg[0] = "Save Canceled."; + mesg[1] = "Escape hit. Scrolling window information not saved."; + mesg[2] = " "; + mesg[3] = "Press any key to continue."; + popupLabel (ScreenOf (swindow), (CDK_CSTRING2)mesg, 4); + + /* Clean up and exit. */ + destroyCDKEntry (entry); + return; + } + + /* Write the contents of the scrolling window to the file. */ + linesSaved = dumpCDKSwindow (swindow, filename); + + /* Was the save successful? */ + if (linesSaved == -1) + { + /* Nope, tell 'em. */ + showMessage2 (swindow, + "Error", + "Could not save to the file.", + filename); + } + else + { + char temp[256]; + + /* Yep, let them know how many lines were saved. */ + sprintf (temp, "There were %d lines saved to the file", linesSaved); + showMessage2 (swindow, + "Save Successful", + temp, + filename); + } + + /* Clean up and exit. */ + destroyCDKEntry (entry); + eraseCDKScreen (ScreenOf (swindow)); + drawCDKScreen (ScreenOf (swindow)); +} + +/* + * This function allows the user to load new information into the scrolling + * window. + */ +void loadCDKSwindowInformation (CDKSWINDOW *swindow) +{ + /* *INDENT-EQLS* */ + CDKFSELECT *fselect = 0; + char *filename = 0; + const char *mesg[15]; + char **fileInfo = 0; + int lines; + + /* Create the file selector to choose the file. */ + fselect = newCDKFselect (ScreenOf (swindow), CENTER, CENTER, 20, 55, + "Load Which File", + "Filename", + A_NORMAL, '.', + A_REVERSE, + "", "", "", "", + TRUE, FALSE); + + /* Get the filename to load. */ + (void)activateCDKFselect (fselect, 0); + + /* Make sure they selected a file. */ + if (fselect->exitType == vESCAPE_HIT) + { + /* Popup a message. */ + mesg[0] = "Load Canceled."; + mesg[1] = " "; + mesg[2] = "Press any key to continue."; + popupLabel (ScreenOf (swindow), (CDK_CSTRING2)mesg, 3); + + /* Clean up and exit. */ + destroyCDKFselect (fselect); + return; + } + + /* Copy the filename and destroy the file selector. */ + filename = copyChar (fselect->pathname); + destroyCDKFselect (fselect); + + /* + * Maye we should check before nuking all the information + * in the scrolling window... + */ + if (swindow->listSize > 0) + { + CDKDIALOG *dialog = 0; + const char *button[5]; + int answer; + + /* Create the dialog message. */ + mesg[0] = "Save Information First"; + mesg[1] = "There is information in the scrolling window."; + mesg[2] = "Do you want to save it to a file first?"; + button[0] = "(Yes)"; + button[1] = "(No)"; + + /* Create the dialog widget. */ + dialog = newCDKDialog (ScreenOf (swindow), CENTER, CENTER, + (CDK_CSTRING2)mesg, 3, + (CDK_CSTRING2)button, 2, + COLOR_PAIR (2) | A_REVERSE, + TRUE, TRUE, FALSE); + + /* Activate the widget. */ + answer = activateCDKDialog (dialog, 0); + destroyCDKDialog (dialog); + + /* Check the answer. */ + if (answer == -1 || answer == 0) + { + /* Save the information. */ + saveCDKSwindowInformation (swindow); + } + } + + /* Open the file and read it in. */ + lines = CDKreadFile (filename, &fileInfo); + if (lines == -1) + { + /* The file read didn't work. */ + showMessage2 (swindow, + "Error", + "Could not read the file", + filename); + freeChar (filename); + return; + } + + /* Clean out the scrolling window. */ + cleanCDKSwindow (swindow); + + /* Set the new information in the scrolling window. */ + setCDKSwindow (swindow, (CDK_CSTRING2)fileInfo, lines, ObjOf (swindow)->box); + + /* Clean up. */ + CDKfreeStrings (fileInfo); + freeChar (filename); +} + +/* + * This actually dumps the information from the scrolling window to a + * file. + */ +int dumpCDKSwindow (CDKSWINDOW *swindow, const char *filename) +{ + FILE *outputFile = 0; + int x; + + /* Try to open the file. */ + if ((outputFile = fopen (filename, "w")) == 0) + { + return -1; + } + + /* Start writing out the file. */ + for (x = 0; x < swindow->listSize; x++) + { + char *rawLine = chtype2Char (swindow->list[x]); + fprintf (outputFile, "%s\n", rawLine); + freeChar (rawLine); + } + + /* Close the file and return the number of lines written. */ + fclose (outputFile); + return swindow->listSize; +} + +static void _focusCDKSwindow (CDKOBJS *object) +{ + CDKSWINDOW *widget = (CDKSWINDOW *)object; + + drawCDKSwindow (widget, ObjOf (widget)->box); +} + +static void _unfocusCDKSwindow (CDKOBJS *object) +{ + CDKSWINDOW *widget = (CDKSWINDOW *)object; + + drawCDKSwindow (widget, ObjOf (widget)->box); +} + +static int createList (CDKSWINDOW *swindow, int listSize) +{ + int status = 0; + + if (listSize >= 0) + { + chtype **newList = typeCallocN (chtype *, listSize + 1); + int *newPos = typeCallocN (int, listSize + 1); + int *newLen = typeCallocN (int, listSize + 1); + + if (newList != 0 + && newPos != 0 + && newLen != 0) + { + status = 1; + destroyInfo (swindow); + + /* *INDENT-EQLS* */ + swindow->list = newList; + swindow->listPos = newPos; + swindow->listLen = newLen; + } + if (!status) + { + CDKfreeChtypes (newList); + freeChecked (newPos); + freeChecked (newLen); + } + } + else + { + destroyInfo (swindow); + status = 1; + } + return status; +} + +dummyRefreshData (Swindow) + +dummySaveData (Swindow) diff --git a/deps/cdk-5.0-20161210/template.c b/deps/cdk-5.0-20161210/template.c new file mode 100644 index 0000000..b051b42 --- /dev/null +++ b/deps/cdk-5.0-20161210/template.c @@ -0,0 +1,919 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 20:13:16 $ + * $Revision: 1.142 $ + */ + +/* + * Declare file local prototypes. + */ +static void CDKTemplateCallBack (CDKTEMPLATE *widget, chtype input); +static void drawCDKTemplateField (CDKTEMPLATE *widget); +static void adjustCDKTemplateCursor (CDKTEMPLATE *widget, int direction); + +#define isPlateChar(c) ((c) != 0 && strchr ("#ACcMXz", c) != 0) + +DeclareCDKObjects (TEMPLATE, Template, setCdk, String); + +/* + * This creates a cdktemplate widget. + */ +CDKTEMPLATE *newCDKTemplate (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + const char *title, + const char *label, + const char *plate, + const char *Overlay, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKTEMPLATE *cdktemplate = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth = 0; + int boxHeight = Box ? 3 : 1; + int xpos = xplace; + int ypos = yplace; + int horizontalAdjust, oldWidth; + int fieldWidth = 0; + int plateLen = 0; + int junk = 0; + + if (plate == 0 + || (cdktemplate = newCDKObject (CDKTEMPLATE, &my_funcs)) == 0) + return (0); + + setCDKTemplateBox (cdktemplate, Box); + + fieldWidth = (int)strlen (plate) + 2 * BorderOf (cdktemplate); + + /* *INDENT-EQLS* Set some basic values of the cdktemplate field. */ + cdktemplate->label = 0; + cdktemplate->labelLen = 0; + cdktemplate->labelWin = 0; + + /* Translate the char * label to a chtype * */ + if (label != 0) + { + cdktemplate->label = char2Chtype (label, &cdktemplate->labelLen, &junk); + } + + /* Translate the char * Overlay to a chtype * */ + if (Overlay != 0) + { + cdktemplate->overlay = char2Chtype (Overlay, &cdktemplate->overlayLen, &junk); + cdktemplate->fieldAttr = cdktemplate->overlay[0] & A_ATTRIBUTES; + } + else + { + /* *INDENT-EQLS* */ + cdktemplate->overlay = 0; + cdktemplate->overlayLen = 0; + cdktemplate->fieldAttr = A_NORMAL; + } + + /* Set the box width. */ + boxWidth = fieldWidth + cdktemplate->labelLen + 2 * BorderOf (cdktemplate); + + oldWidth = boxWidth; + boxWidth = setCdkTitle (ObjOf (cdktemplate), title, boxWidth); + horizontalAdjust = (boxWidth - oldWidth) / 2; + + boxHeight += TitleLinesOf (cdktemplate); + + /* + * Make sure we didn't extend beyond the dimensions of the window. + */ + /* *INDENT-EQLS* */ + boxWidth = MINIMUM (boxWidth, parentWidth); + boxHeight = MINIMUM (boxHeight, parentHeight); + fieldWidth = MINIMUM (fieldWidth, + boxWidth - cdktemplate->labelLen - 2 * BorderOf (cdktemplate)); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the cdktemplate window */ + cdktemplate->win = newwin (boxHeight, boxWidth, ypos, xpos); + + /* Is the cdktemplate window null?? */ + if (cdktemplate->win == 0) + { + destroyCDKObject (cdktemplate); + return (0); + } + keypad (cdktemplate->win, TRUE); + + /* Make the label window. */ + if (cdktemplate->label != 0) + { + cdktemplate->labelWin = subwin (cdktemplate->win, + 1, cdktemplate->labelLen, + (ypos + + TitleLinesOf (cdktemplate) + + BorderOf (cdktemplate)), + (xpos + + horizontalAdjust + + BorderOf (cdktemplate))); + } + + /* Make the field window. */ + cdktemplate->fieldWin = subwin (cdktemplate->win, + 1, fieldWidth, + (ypos + + TitleLinesOf (cdktemplate) + + BorderOf (cdktemplate)), + (xpos + + cdktemplate->labelLen + + horizontalAdjust + + BorderOf (cdktemplate))); + keypad (cdktemplate->fieldWin, TRUE); + + /* Set up the info field. */ + cdktemplate->plateLen = (int)strlen (plate); + cdktemplate->info = typeCallocN (char, cdktemplate->plateLen + 2); + if (cdktemplate->info == 0) + { + destroyCDKObject (cdktemplate); + return (0); + } + + /* Copy the plate to the cdktemplate. */ + plateLen = (int)strlen (plate); + cdktemplate->plate = typeMallocN (char, plateLen + 3); + if (cdktemplate->plate == 0) + { + destroyCDKObject (cdktemplate); + return (0); + } + strcpy (cdktemplate->plate, plate); + + /* *INDENT-EQLS* Set up the rest of the structure */ + ScreenOf (cdktemplate) = cdkscreen; + cdktemplate->parent = cdkscreen->window; + cdktemplate->shadowWin = 0; + cdktemplate->fieldWidth = fieldWidth; + cdktemplate->boxHeight = boxHeight; + cdktemplate->boxWidth = boxWidth; + cdktemplate->platePos = 0; + cdktemplate->screenPos = 0; + cdktemplate->infoPos = 0; + initExitType (cdktemplate); + cdktemplate->min = 0; + ObjOf (cdktemplate)->inputWindow = cdktemplate->win; + ObjOf (cdktemplate)->acceptsFocus = TRUE; + cdktemplate->shadow = shadow; + cdktemplate->callbackfn = CDKTemplateCallBack; + + /* Do we need to create a shadow??? */ + if (shadow) + { + cdktemplate->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); + } + + registerCDKObject (cdkscreen, vTEMPLATE, cdktemplate); + + return cdktemplate; +} + +/* + * This actually manages the cdktemplate widget... + */ +char *activateCDKTemplate (CDKTEMPLATE *cdktemplate, chtype *actions) +{ + chtype input = 0; + boolean functionKey; + char *ret = 0; + + /* Draw the object. */ + drawCDKTemplate (cdktemplate, ObjOf (cdktemplate)->box); + + if (actions == 0) + { + for (;;) + { + input = (chtype)getchCDKObject (ObjOf (cdktemplate), &functionKey); + + /* Inject the character into the widget. */ + ret = injectCDKTemplate (cdktemplate, input); + if (cdktemplate->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + else + { + int length = chlen (actions); + int x = 0; + + /* Inject each character one at a time. */ + for (x = 0; x < length; x++) + { + ret = injectCDKTemplate (cdktemplate, actions[x]); + if (cdktemplate->exitType != vEARLY_EXIT) + { + return ret; + } + } + } + + /* Set the exit type and return. */ + setExitType (cdktemplate, 0); + return ret; +} + +/* + * This injects a character into the widget. + */ +static int _injectCDKTemplate (CDKOBJS *object, chtype input) +{ + CDKTEMPLATE *widget = (CDKTEMPLATE *)object; + int ppReturn = 1; + char *ret = unknownString; + bool complete = FALSE; + + /* Set the exit type and return. */ + setExitType (widget, 0); + + /* Move the cursor. */ + drawCDKTemplateField (widget); + + /* Check if there is a pre-process function to be called. */ + if (PreProcessFuncOf (widget) != 0) + { + ppReturn = PreProcessFuncOf (widget) (vTEMPLATE, + widget, + PreProcessDataOf (widget), + input); + } + + /* Should we continue? */ + if (ppReturn != 0) + { + /* Check a predefined binding... */ + if (checkCDKObjectBind (vTEMPLATE, widget, input) != 0) + { + checkEarlyExit (widget); + complete = TRUE; + } + else + { + switch (input) + { + case CDK_ERASE: + if (strlen (widget->info) != 0) + { + cleanCDKTemplate (widget); + drawCDKTemplateField (widget); + } + break; + + case CDK_CUT: + if ((int)strlen (widget->info) != 0) + { + freeChar (GPasteBuffer); + GPasteBuffer = copyChar (widget->info); + cleanCDKTemplate (widget); + drawCDKTemplateField (widget); + } + else + { + Beep (); + } + break; + + case CDK_COPY: + if ((int)strlen (widget->info) != 0) + { + freeChar (GPasteBuffer); + GPasteBuffer = copyChar (widget->info); + } + else + { + Beep (); + } + break; + + case CDK_PASTE: + if (GPasteBuffer != 0) + { + int length, x; + + cleanCDKTemplate (widget); + + /* Start inserting each character one at a time. */ + length = (int)strlen (GPasteBuffer); + for (x = 0; x < length; x++) + { + (widget->callbackfn) (widget, (chtype)GPasteBuffer[x]); + } + drawCDKTemplateField (widget); + } + else + { + Beep (); + } + break; + + case KEY_TAB: + case KEY_ENTER: + if ((int)strlen (widget->info) < (int)widget->min) + { + Beep (); + } + else + { + setExitType (widget, input); + ret = widget->info; + complete = TRUE; + } + break; + + case KEY_ESC: + setExitType (widget, input); + complete = TRUE; + break; + + case KEY_ERROR: + setExitType (widget, input); + complete = TRUE; + break; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + (widget->callbackfn) (widget, input); + break; + } + } + + /* Should we call a post-process? */ + if (!complete && (PostProcessFuncOf (widget) != 0)) + { + PostProcessFuncOf (widget) (vTEMPLATE, + widget, + PostProcessDataOf (widget), + input); + } + } + + if (!complete) + { + setExitType (widget, 0); + } + + ResultOf (widget).valueString = ret; + return (ret != unknownString); +} + +/* + * Return true if the given string matches the template (may be incomplete). + */ +static boolean validTemplate (CDKTEMPLATE *cdktemplate, char *input) +{ + int pp, ip; + const char *plate = cdktemplate->plate; + + for (pp = 0, ip = 0; input[ip] != '\0' && plate[pp] != '\0'; ++ip, ++pp) + { + int newchar = input[ip]; + + while (plate[pp] != '\0' && !isPlateChar (plate[pp])) + { + ++pp; + } + if (plate[pp] == 0) + { + return FALSE; + } + + /* check if the input matches the plate */ + if (isdigit (CharOf (newchar)) && + (plate[pp] == 'A' || + plate[pp] == 'C' || + plate[pp] == 'c')) + { + return FALSE; + } + if (!isdigit (CharOf (newchar)) && + plate[pp] == '#') + { + return FALSE; + } + + /* Do we need to convert the case??? */ + if (plate[pp] == 'C' || + plate[pp] == 'X') + { + newchar = toupper (newchar); + } + else if (plate[pp] == 'c' || + plate[pp] == 'x') + { + newchar = tolower (newchar); + } + input[ip] = (char)newchar; + } + return TRUE; +} + +/* + * This is the standard callback proc for the cdktemplate. + */ +static void CDKTemplateCallBack (CDKTEMPLATE *cdktemplate, chtype input) +{ + boolean failed = FALSE; + boolean change = FALSE; + boolean moveby = FALSE; + int amount = 0; + size_t mark = (size_t) cdktemplate->infoPos; + size_t have = strlen (cdktemplate->info); + + if (input == KEY_LEFT) + { + if (mark != 0) + { + moveby = TRUE; + amount = -1; + } + else + { + failed = TRUE; + } + } + else if (input == KEY_RIGHT) + { + if (cdktemplate->info[mark] != '\0') + { + moveby = TRUE; + amount = 1; + } + else + { + failed = TRUE; + } + } + else + { + char *test = (char *)malloc (have + 2); + + if (test != 0) + { + strcpy (test, cdktemplate->info); + + if (input == KEY_BACKSPACE) + { + if (mark != 0) + { + strcpy (test + mark - 1, cdktemplate->info + mark); + change = TRUE; + amount = -1; + } + else + { + failed = TRUE; + } + } + else if (input == KEY_DC) + { + if (test[mark] != '\0') + { + strcpy (test + mark, cdktemplate->info + mark + 1); + change = TRUE; + amount = 0; + } + else + { + failed = TRUE; + } + } + else if (isChar (input) && + cdktemplate->platePos < cdktemplate->fieldWidth) + { + test[mark] = (char)(input); + strcpy (test + mark + 1, cdktemplate->info + mark + 1); + change = TRUE; + amount = 1; + } + else + { + failed = TRUE; + } + + if (change) + { + if (validTemplate (cdktemplate, test)) + { + strcpy (cdktemplate->info, test); + drawCDKTemplateField (cdktemplate); + } + else + { + failed = TRUE; + } + } + + free (test); + } + } + + if (failed) + { + Beep (); + } + else if (change || moveby) + { + cdktemplate->infoPos += amount; + cdktemplate->platePos += amount; + cdktemplate->screenPos += amount; + + adjustCDKTemplateCursor (cdktemplate, amount); + } +} + +/* + * Return a mixture of the plate-overlay and field-info. + */ +char *mixCDKTemplate (CDKTEMPLATE *cdktemplate) +{ + char *mixedString = 0; + + if (cdktemplate->info != 0 && cdktemplate->info[0] != '\0') + { + mixedString = typeCallocN (char, cdktemplate->plateLen + 3); + + if (mixedString != 0) + { + int infoPos = 0; + int platePos = 0; + + while (platePos < cdktemplate->plateLen) + { + mixedString[platePos] = (char)(isPlateChar (cdktemplate->plate[platePos]) + ? cdktemplate->info[infoPos++] + : cdktemplate->plate[platePos]); + platePos++; + } + } + } + + return mixedString; +} + +/* + * Return the field-info from the mixed string. + */ +char *unmixCDKTemplate (CDKTEMPLATE *cdktemplate, const char *info) +{ + /* *INDENT-EQLS* */ + int infolen = (int)strlen (info); + char *unmixedString = typeCallocN (char, infolen + 2); + + if (unmixedString != 0) + { + int pos = 0; + int x = 0; + + while (pos < infolen) + { + if (isPlateChar (cdktemplate->plate[pos])) + { + unmixedString[x++] = info[pos++]; + } + else + { + pos++; + } + } + } + + return unmixedString; +} + +/* + * Move the cdktemplate field to the given location. + */ +static void _moveCDKTemplate (CDKOBJS *object, + int xplace, + int yplace, + boolean relative, + boolean refresh_flag) +{ + CDKTEMPLATE *cdktemplate = (CDKTEMPLATE *)object; + /* *INDENT-EQLS* */ + int currentX = getbegx (cdktemplate->win); + int currentY = getbegy (cdktemplate->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (cdktemplate->win) + xplace; + ypos = getbegy (cdktemplate->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (cdktemplate), &xpos, &ypos, cdktemplate->boxWidth, cdktemplate->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (cdktemplate->win, -xdiff, -ydiff); + moveCursesWindow (cdktemplate->labelWin, -xdiff, -ydiff); + moveCursesWindow (cdktemplate->fieldWin, -xdiff, -ydiff); + moveCursesWindow (cdktemplate->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (cdktemplate)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKTemplate (cdktemplate, ObjOf (cdktemplate)->box); + } +} + +/* + * Draw the template widget. + */ +static void _drawCDKTemplate (CDKOBJS *object, boolean Box) +{ + CDKTEMPLATE *cdktemplate = (CDKTEMPLATE *)object; + + /* Do we need to draw the shadow. */ + if (cdktemplate->shadowWin != 0) + { + drawShadow (cdktemplate->shadowWin); + } + + /* Box it if needed */ + if (Box) + { + drawObjBox (cdktemplate->win, ObjOf (cdktemplate)); + } + + drawCdkTitle (cdktemplate->win, object); + + wrefresh (cdktemplate->win); + + drawCDKTemplateField (cdktemplate); +} + +/* + * Draw the cdktemplate field. + */ +static void drawCDKTemplateField (CDKTEMPLATE *cdktemplate) +{ + /* *INDENT-EQLS* */ + chtype fieldColor = 0; + int infolen = (int)strlen (cdktemplate->info); + + /* Draw in the label and the cdktemplate object. */ + if (cdktemplate->labelWin != 0) + { + writeChtype (cdktemplate->labelWin, 0, 0, + cdktemplate->label, + HORIZONTAL, 0, + cdktemplate->labelLen); + wrefresh (cdktemplate->labelWin); + } + + /* Draw in the cdktemplate... */ + if (cdktemplate->overlay != 0) + { + writeChtype (cdktemplate->fieldWin, 0, 0, + cdktemplate->overlay, + HORIZONTAL, 0, + cdktemplate->overlayLen); + + /* Adjust the cursor. */ + if (infolen != 0) + { + int pos = 0; + int x = 0; + for (x = 0; x < cdktemplate->fieldWidth; x++) + { + if (isPlateChar (cdktemplate->plate[x]) && pos < infolen) + { + fieldColor = cdktemplate->overlay[x] & A_ATTRIBUTES; + (void)mvwaddch (cdktemplate->fieldWin, + 0, x, + CharOf (cdktemplate->info[pos++]) | fieldColor); + } + } + wmove (cdktemplate->fieldWin, 0, cdktemplate->screenPos); + } + else + { + adjustCDKTemplateCursor (cdktemplate, +1); + } + wrefresh (cdktemplate->fieldWin); + } +} + +/* + * Adjust the cursor for the cdktemplate. + */ +static void adjustCDKTemplateCursor (CDKTEMPLATE *cdktemplate, int direction) +{ + while (!isPlateChar (cdktemplate->plate[cdktemplate->platePos]) + && cdktemplate->platePos < cdktemplate->fieldWidth) + { + cdktemplate->platePos += direction; + cdktemplate->screenPos += direction; + } + wmove (cdktemplate->fieldWin, 0, cdktemplate->screenPos); + wrefresh (cdktemplate->fieldWin); +} + +/* + * Set the background attribute of the widget. + */ +static void _setBKattrTemplate (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKTEMPLATE *widget = (CDKTEMPLATE *)object; + + wbkgd (widget->win, attrib); + wbkgd (widget->fieldWin, attrib); + if (widget->labelWin != 0) + { + wbkgd (widget->labelWin, attrib); + } + } +} + +/* + * Destroy this widget. + */ +static void _destroyCDKTemplate (CDKOBJS *object) +{ + if (object != 0) + { + CDKTEMPLATE *cdktemplate = (CDKTEMPLATE *)object; + + cleanCdkTitle (object); + freeChtype (cdktemplate->label); + freeChtype (cdktemplate->overlay); + freeChar (cdktemplate->plate); + freeChar (cdktemplate->info); + + /* Delete the windows. */ + deleteCursesWindow (cdktemplate->fieldWin); + deleteCursesWindow (cdktemplate->labelWin); + deleteCursesWindow (cdktemplate->shadowWin); + deleteCursesWindow (cdktemplate->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vTEMPLATE, cdktemplate); + + unregisterCDKObject (vTEMPLATE, cdktemplate); + } +} + +/* + * Erase the widget. + */ +static void _eraseCDKTemplate (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKTEMPLATE *cdktemplate = (CDKTEMPLATE *)object; + + eraseCursesWindow (cdktemplate->fieldWin); + eraseCursesWindow (cdktemplate->labelWin); + eraseCursesWindow (cdktemplate->win); + eraseCursesWindow (cdktemplate->shadowWin); + } +} + +/* + * Set the value given to the cdktemplate. + */ +void setCDKTemplate (CDKTEMPLATE *cdktemplate, const char *newValue, boolean Box) +{ + setCDKTemplateValue (cdktemplate, newValue); + setCDKTemplateBox (cdktemplate, Box); +} + +/* + * Set the value given to the cdktemplate. + */ +void setCDKTemplateValue (CDKTEMPLATE *cdktemplate, const char *newValue) +{ + /* *INDENT-EQLS* */ + int len = 0; + int copychars = 0; + int x; + + cleanCDKTemplate (cdktemplate); + + /* Just to be sure, if let's make sure the new value isn't null. */ + if (newValue == 0) + { + return; + } + + /* Determine how many characters we need to copy. */ + len = (int)strlen (newValue); + copychars = MINIMUM (len, cdktemplate->fieldWidth); + + /* OK, erase the old value, and copy in the new value. */ + cdktemplate->info[0] = '\0'; + strncpy (cdktemplate->info, newValue, (size_t) copychars); + + /* Use the function which handles the input of the characters. */ + for (x = 0; x < len; x++) + { + (cdktemplate->callbackfn) (cdktemplate, (chtype)newValue[x]); + } +} +char *getCDKTemplateValue (CDKTEMPLATE *cdktemplate) +{ + return cdktemplate->info; +} + +/* + * Set the minimum number of characters to enter into the widget. + */ +void setCDKTemplateMin (CDKTEMPLATE *cdktemplate, int min) +{ + if (min >= 0) + { + cdktemplate->min = min; + } +} +int getCDKTemplateMin (CDKTEMPLATE *cdktemplate) +{ + return cdktemplate->min; +} + +/* + * Set the box attribute of the cdktemplate widget. + */ +void setCDKTemplateBox (CDKTEMPLATE *cdktemplate, boolean Box) +{ + ObjOf (cdktemplate)->box = Box; + ObjOf (cdktemplate)->borderSize = Box ? 1 : 0; +} +boolean getCDKTemplateBox (CDKTEMPLATE *cdktemplate) +{ + return ObjOf (cdktemplate)->box; +} + +/* + * Erase the information in the cdktemplate widget. + */ +void cleanCDKTemplate (CDKTEMPLATE *cdktemplate) +{ + if (cdktemplate->fieldWidth > 0) + memset (cdktemplate->info, 0, (size_t) cdktemplate->fieldWidth); + + /* *INDENT-EQLS* */ + cdktemplate->screenPos = 0; + cdktemplate->infoPos = 0; + cdktemplate->platePos = 0; +} + +/* + * Set the callback function for the widget. + */ +void setCDKTemplateCB (CDKTEMPLATE *cdktemplate, TEMPLATECB callback) +{ + cdktemplate->callbackfn = callback; +} + +static void _focusCDKTemplate (CDKOBJS *object) +{ + CDKTEMPLATE *widget = (CDKTEMPLATE *)object; + + drawCDKTemplate (widget, ObjOf (widget)->box); +} + +static void _unfocusCDKTemplate (CDKOBJS *object) +{ + CDKTEMPLATE *widget = (CDKTEMPLATE *)object; + + drawCDKTemplate (widget, ObjOf (widget)->box); +} + +dummyRefreshData (Template) + +dummySaveData (Template) diff --git a/deps/cdk-5.0-20161210/traverse.c b/deps/cdk-5.0-20161210/traverse.c new file mode 100644 index 0000000..4f9d71b --- /dev/null +++ b/deps/cdk-5.0-20161210/traverse.c @@ -0,0 +1,375 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 18:28:30 $ + * $Revision: 1.24 $ + */ + +#define limitFocusIndex(screen, value) \ + (((value) >= (screen)->objectCount || (value) < 0) \ + ? 0 \ + : (value)) + +static int getFocusIndex (CDKSCREEN *screen) +{ + int result = limitFocusIndex (screen, screen->objectFocus); + + return result; +} + +static void setFocusIndex (CDKSCREEN *screen, int value) +{ + screen->objectFocus = limitFocusIndex (screen, value); +} + +static void unsetFocus (CDKOBJS *obj) +{ + curs_set (0); + if (obj != 0) + { + HasFocusObj (obj) = FALSE; + UnfocusObj (obj); + } +} + +static void setFocus (CDKOBJS *obj) +{ + if (obj != 0) + { + HasFocusObj (obj) = TRUE; + FocusObj (obj); + } + curs_set (1); +} + +static CDKOBJS *switchFocus (CDKOBJS *newobj, CDKOBJS *oldobj) +{ + if (oldobj != newobj) + { + unsetFocus (oldobj); + setFocus (newobj); + } + return newobj; +} + +static boolean checkMenuKey (int keyCode, int functionKey) +{ + int result; + + result = (keyCode == KEY_ESC && !functionKey); + + return result; +} + +static CDKOBJS *handleMenu (CDKSCREEN *screen, CDKOBJS *menu, CDKOBJS *oldobj) +{ + bool done = FALSE; + CDKOBJS *newobj; + + switchFocus (menu, oldobj); + while (!done) + { + boolean functionKey; + int key = getchCDKObject (menu, &functionKey); + + switch (key) + { + case KEY_TAB: + done = TRUE; + break; + + case KEY_ESC: + /* cleanup the menu */ + (void)injectCDKMenu ((CDKMENU *)menu, (chtype)key); + done = TRUE; + break; + + default: + done = (injectCDKMenu ((CDKMENU *)menu, (chtype)key) >= 0); + break; + } + } + + if ((newobj = getCDKFocusCurrent (screen)) == 0) + newobj = setCDKFocusNext (screen); + + return switchFocus (newobj, menu); +} + +/* + * Save data in widgets on a screen + */ +static void saveDataCDKScreen (CDKSCREEN *screen) +{ + int i; + + for (i = 0; i < screen->objectCount; ++i) + SaveDataObj (screen->object[i]); +} + +/* + * Refresh data in widgets on a screen + */ +static void refreshDataCDKScreen (CDKSCREEN *screen) +{ + int i; + + for (i = 0; i < screen->objectCount; ++i) + RefreshDataObj (screen->object[i]); +} + + +/* + * ====================================================================== + * Public Interface + */ + +void resetCDKScreen (CDKSCREEN *screen) +{ + refreshDataCDKScreen (screen); +} + +void exitOKCDKScreen (CDKSCREEN *screen) +{ + screen->exitStatus = CDKSCREEN_EXITOK; +} + +void exitCancelCDKScreen (CDKSCREEN *screen) +{ + screen->exitStatus = CDKSCREEN_EXITCANCEL; +} + +void exitOKCDKScreenOf (CDKOBJS *obj) +{ + exitOKCDKScreen (obj->screen); +} + +void exitCancelCDKScreenOf (CDKOBJS *obj) +{ + exitCancelCDKScreen (obj->screen); +} + +void resetCDKScreenOf (CDKOBJS *obj) +{ + resetCDKScreen (obj->screen); +} + +/* + * Returns the object on which the focus lies. + */ +CDKOBJS *getCDKFocusCurrent (CDKSCREEN *screen) +{ + CDKOBJS *result = 0; + int n = screen->objectFocus; + + if (n >= 0 && n < screen->objectCount) + result = screen->object[n]; + return result; +} + +/* + * Set focus to the next object, returning it. + */ +CDKOBJS *setCDKFocusNext (CDKSCREEN *screen) +{ + CDKOBJS *result = 0; + CDKOBJS *curobj; + int n = getFocusIndex (screen); + int first = n; + + for (;;) + { + if (++n >= screen->objectCount) + n = 0; + curobj = screen->object[n]; + if (curobj != 0 && AcceptsFocusObj (curobj)) + { + result = curobj; + break; + } + else + { + if (n == first) + { + break; + } + } + } + + setFocusIndex (screen, (result != 0) ? n : -1); + return result; +} + +/* + * Set focus to the previous object, returning it. + */ +CDKOBJS *setCDKFocusPrevious (CDKSCREEN *screen) +{ + CDKOBJS *result = 0; + CDKOBJS *curobj; + int n = getFocusIndex (screen); + int first = n; + + for (;;) + { + if (--n < 0) + n = screen->objectCount - 1; + curobj = screen->object[n]; + if (curobj != 0 && AcceptsFocusObj (curobj)) + { + result = curobj; + break; + } + else if (n == first) + { + break; + } + } + + setFocusIndex (screen, (result != 0) ? n : -1); + return result; +} + +/* + * Set focus to a specific object, returning it. + * If the object cannot be found, return null. + */ +CDKOBJS *setCDKFocusCurrent (CDKSCREEN *screen, CDKOBJS *newobj) +{ + CDKOBJS *result = 0; + CDKOBJS *curobj; + int n = getFocusIndex (screen); + int first = n; + + for (;;) + { + if (++n >= screen->objectCount) + n = 0; + + curobj = screen->object[n]; + if (curobj == newobj) + { + result = curobj; + break; + } + else if (n == first) + { + break; + } + } + + setFocusIndex (screen, (result != 0) ? n : -1); + return result; +} + +/* + * Set focus to the first object in the screen. + */ +CDKOBJS *setCDKFocusFirst (CDKSCREEN *screen) +{ + setFocusIndex (screen, screen->objectCount - 1); + return switchFocus (setCDKFocusNext (screen), 0); +} + +/* + * Set focus to the last object in the screen. + */ +CDKOBJS *setCDKFocusLast (CDKSCREEN *screen) +{ + setFocusIndex (screen, 0); + return switchFocus (setCDKFocusPrevious (screen), 0); +} + +void traverseCDKOnce (CDKSCREEN *screen, + CDKOBJS *curobj, + int keyCode, + boolean functionKey, + CHECK_KEYCODE funcMenuKey) +{ + switch (keyCode) + { + case KEY_BTAB: + switchFocus (setCDKFocusPrevious (screen), curobj); + break; + + case KEY_TAB: + switchFocus (setCDKFocusNext (screen), curobj); + break; + + case KEY_F (10): + /* save data and exit */ + exitOKCDKScreen (screen); + break; + + case CTRL ('X'): + exitCancelCDKScreen (screen); + break; + + case CTRL ('R'): + /* reset data to defaults */ + resetCDKScreen (screen); + setFocus (curobj); + break; + + case CDK_REFRESH: + /* redraw screen */ + refreshCDKScreen (screen); + setFocus (curobj); + break; + + default: + /* not everyone wants menus, so we make them optional here */ + if (funcMenuKey != 0 && funcMenuKey (keyCode, functionKey)) + { + /* find and enable drop down menu */ + int j; + + for (j = 0; j < screen->objectCount; ++j) + if (ObjTypeOf (screen->object[j]) == vMENU) + { + handleMenu (screen, screen->object[j], curobj); + break; + } + } + else + { + InjectObj (curobj, (chtype)keyCode); + } + break; + } +} + +/* + * Traverse the widgets on a screen. + */ +int traverseCDKScreen (CDKSCREEN *screen) +{ + int result = 0; + CDKOBJS *curobj = setCDKFocusFirst (screen); + + if (curobj != 0) + { + refreshDataCDKScreen (screen); + + screen->exitStatus = CDKSCREEN_NOEXIT; + + while (((curobj = getCDKFocusCurrent (screen)) != 0) + && (screen->exitStatus == CDKSCREEN_NOEXIT)) + { + int key; + boolean function; + + key = getchCDKObject (curobj, &function); + + traverseCDKOnce (screen, curobj, key, function, checkMenuKey); + } + + if (screen->exitStatus == CDKSCREEN_EXITOK) + { + saveDataCDKScreen (screen); + result = 1; + } + } + return result; +} diff --git a/deps/cdk-5.0-20161210/version.c b/deps/cdk-5.0-20161210/version.c new file mode 100644 index 0000000..52e5b6c --- /dev/null +++ b/deps/cdk-5.0-20161210/version.c @@ -0,0 +1,11 @@ +#include + +/* + * $Author: tom $ + * $Date: 2012/03/20 22:06:08 $ + * $Revision: 1.2 $ + */ +const char *CDKVersion (void) +{ + return CDK_VERSION_MAJOR "." CDK_VERSION_MINOR " - " CDK_VERSION_PATCH; +} diff --git a/deps/cdk-5.0-20161210/view_file.c b/deps/cdk-5.0-20161210/view_file.c new file mode 100644 index 0000000..5d18be0 --- /dev/null +++ b/deps/cdk-5.0-20161210/view_file.c @@ -0,0 +1,41 @@ +#include + +/* + * $Author: tom $ + * $Date: 2012/03/22 00:39:54 $ + * $Revision: 1.4 $ + */ + +/* + * This allows the user to view a file. + */ +int viewFile (CDKSCREEN *screen, + const char *title, + const char *filename, + CDK_CSTRING2 buttons, + int buttonCount) +{ + /* *INDENT-EQLS* */ + int lines = 0; + char **info = 0; + int result; + + /* Open the file and read the contents. */ + lines = CDKreadFile (filename, &info); + + /* If we couldn't read the file, return an error. */ + if (lines == -1) + { + result = lines; + } + else + { + + result = viewInfo (screen, title, + (CDK_CSTRING2) info, lines, + buttons, buttonCount, + TRUE); + CDKfreeStrings (info); + } + return result; +} diff --git a/deps/cdk-5.0-20161210/view_info.c b/deps/cdk-5.0-20161210/view_info.c new file mode 100644 index 0000000..fff430d --- /dev/null +++ b/deps/cdk-5.0-20161210/view_info.c @@ -0,0 +1,44 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 18:35:56 $ + * $Revision: 1.3 $ + */ + +/* + * This allows the user to view information. + */ +int viewInfo (CDKSCREEN *screen, + const char *title, + CDK_CSTRING2 info, + int count, + CDK_CSTRING2 buttons, + int buttonCount, + boolean interpret) +{ + CDKVIEWER *viewer = 0; + int selected; + + /* Create the file viewer to view the file selected. */ + viewer = newCDKViewer (screen, CENTER, CENTER, -6, -16, + buttons, buttonCount, + A_REVERSE, TRUE, TRUE); + + /* Set up the viewer title, and the contents to the widget. */ + setCDKViewer (viewer, title, info, count, A_REVERSE, interpret, TRUE, TRUE); + + /* Activate the viewer widget. */ + selected = activateCDKViewer (viewer, 0); + + /* Make sure they exited normally. */ + if (viewer->exitType != vNORMAL) + { + destroyCDKViewer (viewer); + return (-1); + } + + /* Clean up and return the button index selected. */ + destroyCDKViewer (viewer); + return selected; +} diff --git a/deps/cdk-5.0-20161210/viewer.c b/deps/cdk-5.0-20161210/viewer.c new file mode 100644 index 0000000..2d55862 --- /dev/null +++ b/deps/cdk-5.0-20161210/viewer.c @@ -0,0 +1,1299 @@ +#include + +/* + * $Author: tom $ + * $Date: 2016/11/20 20:15:53 $ + * $Revision: 1.165 $ + */ + +/* + * Declare some local definitions. + */ +#define DOWN 0 +#define UP 1 + +/* + * Declare file local prototypes. + */ +static int createList (CDKVIEWER *swindow, int listSize); +static int searchForWord (CDKVIEWER *viewer, char *pattern, int direction); +static int jumpToLine (CDKVIEWER *viewer); +static void popUpLabel (CDKVIEWER *viewer, CDK_CSTRING2 mesg); +static void getAndStorePattern (CDKSCREEN *screen); +static void drawCDKViewerButtons (CDKVIEWER *viewer); +static void drawCDKViewerInfo (CDKVIEWER *viewer); + +/* + * Declare file local variables. + */ +static char *SearchPattern = 0; +static int SearchDirection = DOWN; + +DeclareCDKObjects (VIEWER, Viewer, setCdk, Unknown); + +/* + * This function creates a new viewer object. + */ +CDKVIEWER *newCDKViewer (CDKSCREEN *cdkscreen, + int xplace, + int yplace, + int height, + int width, + CDK_CSTRING2 buttons, + int buttonCount, + chtype buttonHighlight, + boolean Box, + boolean shadow) +{ + /* *INDENT-EQLS* */ + CDKVIEWER *viewer = 0; + int parentWidth = getmaxx (cdkscreen->window); + int parentHeight = getmaxy (cdkscreen->window); + int boxWidth; + int boxHeight; + int xpos = xplace; + int ypos = yplace; + int buttonAdj = 0; + int x = 0; + /* *INDENT-OFF* */ + static const struct { int from; int to; } bindings[] = { + { CDK_BACKCHAR, KEY_PPAGE }, + { 'b', KEY_PPAGE }, + { 'B', KEY_PPAGE }, + { CDK_FORCHAR, KEY_NPAGE }, + { SPACE, KEY_NPAGE }, + { 'f', KEY_NPAGE }, + { 'F', KEY_NPAGE }, + { '|', KEY_HOME }, + { '$', KEY_END }, + }; + /* *INDENT-ON* */ + + if ((viewer = newCDKObject (CDKVIEWER, &my_funcs)) == 0) + return (0); + + setCDKViewerBox (viewer, Box); + + boxHeight = setWidgetDimension (parentHeight, height, 0); + boxWidth = setWidgetDimension (parentWidth, width, 0); + + /* Rejustify the x and y positions if we need to. */ + alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); + + /* Make the viewer window. */ + viewer->win = newwin (boxHeight, boxWidth, ypos, xpos); + if (viewer->win == 0) + { + destroyCDKObject (viewer); + return (0); + } + + /* Turn the keypad on for the viewer. */ + keypad (viewer->win, TRUE); + + /* Create the buttons. */ + viewer->buttonCount = buttonCount; + if (buttonCount > 0) + { + int buttonWidth = 0; + int buttonPos = 1; + + if ((viewer->button = typeCallocN (chtype *, buttonCount + 1)) == 0 + || (viewer->buttonLen = typeCallocN (int, buttonCount + 1)) == 0 + || (viewer->buttonPos = typeCallocN (int, buttonCount + 1)) == 0) + { + destroyCDKObject (viewer); + return (0); + } + for (x = 0; x < buttonCount; x++) + { + viewer->button[x] = char2Chtype (buttons[x], &viewer->buttonLen[x], &buttonAdj); + buttonWidth += viewer->buttonLen[x] + 1; + } + buttonAdj = (int)((boxWidth - buttonWidth) / (buttonCount + 1)); + buttonPos = 1 + buttonAdj; + for (x = 0; x < buttonCount; x++) + { + viewer->buttonPos[x] = buttonPos; + buttonPos += buttonAdj + viewer->buttonLen[x]; + } + } + + /* *INDENT-EQLS* Set the rest of the variables */ + ScreenOf (viewer) = cdkscreen; + viewer->parent = cdkscreen->window; + viewer->shadowWin = 0; + viewer->buttonHighlight = buttonHighlight; + viewer->boxHeight = boxHeight; + viewer->boxWidth = boxWidth - 2; + viewer->viewSize = height - 2; + ObjOf (viewer)->inputWindow = viewer->win; + initExitType (viewer); + viewer->shadow = shadow; + viewer->currentButton = 0; + viewer->currentTop = 0; + viewer->length = 0; + viewer->leftChar = 0; + viewer->maxLeftChar = 0; + viewer->maxTopLine = 0; + viewer->characters = 0; + viewer->listSize = -1; + viewer->showLineInfo = 1; + viewer->exitType = vEARLY_EXIT; + + /* Do we need to create a shadow??? */ + if (shadow) + { + viewer->shadowWin = newwin (boxHeight, boxWidth + 1, ypos + 1, xpos + 1); + if (viewer->shadowWin == 0) + { + destroyCDKObject (viewer); + return (0); + } + } + + /* Setup the key bindings. */ + for (x = 0; x < (int)SIZEOF (bindings); ++x) + bindCDKObject (vVIEWER, + viewer, + (chtype)bindings[x].from, + getcCDKBind, + (void *)(long)bindings[x].to); + + registerCDKObject (cdkscreen, vVIEWER, viewer); + + return (viewer); +} + +/* + * This function sets various attributes of the widget. + */ +int setCDKViewer (CDKVIEWER *viewer, + const char *title, + CDK_CSTRING2 list, + int listSize, + chtype buttonHighlight, + boolean attrInterp, + boolean showLineInfo, + boolean Box) +{ + setCDKViewerTitle (viewer, title); + setCDKViewerHighlight (viewer, buttonHighlight); + setCDKViewerInfoLine (viewer, showLineInfo); + setCDKViewerBox (viewer, Box); + return setCDKViewerInfo (viewer, list, listSize, attrInterp); +} + +/* + * This sets the title of the viewer. (A null title is allowed. + * It just means that the viewer will not have a title when drawn.) + */ +void setCDKViewerTitle (CDKVIEWER *viewer, const char *title) +{ + (void)setCdkTitle (ObjOf (viewer), title, -(viewer->boxWidth + 1)); + viewer->titleAdj = TitleLinesOf (viewer); + + /* Need to set viewer->viewSize. */ + viewer->viewSize = viewer->boxHeight - (TitleLinesOf (viewer) + 1) - 2; +} +chtype **getCDKViewerTitle (CDKVIEWER *viewer) +{ + return TitleOf (viewer); +} + +static void setupLine (CDKVIEWER *viewer, boolean interpret, const char + *list, int x) +{ + /* Did they ask for attribute interpretation? */ + if (interpret) + { + viewer->list[x] = char2Chtype (list, &viewer->listLen[x], + &viewer->listPos[x]); + viewer->listPos[x] = justifyString (viewer->boxWidth, + viewer->listLen[x], + viewer->listPos[x]); + } + else + { + int len = (int)strlen (list); + int pass; + int y; + chtype *t = 0; + + /* + * We must convert tabs and other nonprinting characters. The curses + * library normally does this, but we are bypassing it by writing + * chtype's directly. + */ + for (pass = 0; pass < 2; ++pass) + { + len = 0; + for (y = 0; list[y] != '\0'; ++y) + { + if (list[y] == '\t') + { + do + { + if (pass) + t[len] = ' '; + ++len; + } + while (len & 7); + } + else if (isprint (CharOf (list[y]))) + { + if (pass) + t[len] = CharOf (list[y]); + ++len; + } + else + { + const char *s = unctrl ((chtype)list[y]); + while (*s != 0) + { + if (pass) + t[len] = CharOf (*s); + ++len; + ++s; + } + } + } + if (!pass) + { + viewer->list[x] = t = typeCallocN (chtype, len + 3); + if (t == 0) + { + len = 0; + break; + } + } + } + viewer->listLen[x] = len; + viewer->listPos[x] = 0; + } + viewer->widestLine = MAXIMUM (viewer->widestLine, viewer->listLen[x]); +} + +static void freeLine (CDKVIEWER *viewer, int x) +{ + if (x < viewer->listSize) + { + freeChtype (viewer->list[x]); + viewer->list[x] = 0; + } +} + +/* + * This function sets the contents of the viewer. + */ +int setCDKViewerInfo (CDKVIEWER *viewer, CDK_CSTRING2 list, int listSize, boolean interpret) +{ + /* *INDENT-EQLS* */ + char filename[CDK_PATHMAX + 2]; + int currentLine = 0; + int x = 0; + int viewerSize; + + /* + * If the list-size is negative, count the length of the null-terminated + * list of strings. + */ + if (listSize < 0) + { + listSize = (int)CDKcountStrings (list); + } + + /* compute the size of the resulting display */ + viewerSize = listSize; + if (list != 0 && interpret) + { + for (x = 0; x < listSize; ++x) + { + if (list[x] == 0) + { + viewerSize = x; /* oops - caller gave the wrong length */ + break; + } + if (checkForLink (list[x], filename) == 1) + { + char **fileContents = 0; + int fileLen = CDKreadFile (filename, &fileContents); + + if (fileLen >= 0) + viewerSize += (fileLen - 1); + CDKfreeStrings (fileContents); + } + } + } + + /* Clean out the old viewer info. (if there is any) */ + viewer->inProgress = TRUE; + cleanCDKViewer (viewer); + createList (viewer, viewerSize); + + /* Keep some semi-permanent info. */ + viewer->interpret = interpret; + + /* Copy the information given. */ + for (x = currentLine = 0; x < listSize && currentLine < viewerSize; x++) + { + if (list[x] == 0) + { + viewer->list[currentLine] = 0; + viewer->listLen[currentLine] = 0; + viewer->listPos[currentLine] = 0; + currentLine++; + } + else + { + /* Check if we have a file link in this line. */ + if (checkForLink (list[x], filename) == 1) + { + /* We have a link, open the file. */ + char **fileContents = 0; + int fileLen = 0; + + /* Open the file and put it into the viewer. */ + fileLen = CDKreadFile (filename, &fileContents); + if (fileLen == -1) + { +#ifdef HAVE_START_COLOR +#define FOPEN_FMT "Link Failed: Could not open the file %s" +#else +#define FOPEN_FMT "Link Failed: Could not open the file %s" +#endif + char *temp = (char *)malloc (80 + strlen (filename)); + sprintf (temp, FOPEN_FMT, filename); + setupLine (viewer, TRUE, temp, currentLine++); + free (temp); + } + else + { + int fileLine; + + /* For each line read, copy it into the viewer. */ + fileLen = MINIMUM (fileLen, (viewerSize - currentLine)); + for (fileLine = 0; fileLine < fileLen; fileLine++) + { + if (currentLine >= viewerSize) + break; + setupLine (viewer, FALSE, fileContents[fileLine], currentLine); + viewer->characters += viewer->listLen[currentLine]; + currentLine++; + } + CDKfreeStrings (fileContents); + } + } + else if (currentLine < viewerSize) + { + setupLine (viewer, viewer->interpret, list[x], currentLine); + viewer->characters += viewer->listLen[currentLine]; + currentLine++; + } + } + } + + /* + * Determine how many characters we can shift to the right + * before all the items have been viewer off the screen. + */ + if (viewer->widestLine > viewer->boxWidth) + { + viewer->maxLeftChar = (viewer->widestLine - viewer->boxWidth) + 1; + } + else + { + viewer->maxLeftChar = 0; + } + + /* Set up the needed vars for the viewer list. */ + viewer->inProgress = FALSE; + viewer->listSize = viewerSize; + if (viewer->listSize <= viewer->viewSize) + { + viewer->maxTopLine = 0; + } + else + { + viewer->maxTopLine = viewer->listSize - 1; + } + return viewer->listSize; +} +chtype **getCDKViewerInfo (CDKVIEWER *viewer, int *size) +{ + (*size) = viewer->listSize; + return viewer->list; +} + +/* + * This function sets the highlight type of the buttons. + */ +void setCDKViewerHighlight (CDKVIEWER *viewer, chtype buttonHighlight) +{ + viewer->buttonHighlight = buttonHighlight; +} +chtype getCDKViewerHighlight (CDKVIEWER *viewer) +{ + return viewer->buttonHighlight; +} + +/* + * This sets whether or not you want to set the viewer info line. + */ +void setCDKViewerInfoLine (CDKVIEWER *viewer, boolean showLineInfo) +{ + viewer->showLineInfo = showLineInfo; +} +boolean getCDKViewerInfoLine (CDKVIEWER *viewer) +{ + return viewer->showLineInfo; +} + +/* + * This sets the widgets box attribute. + */ +void setCDKViewerBox (CDKVIEWER *viewer, boolean Box) +{ + ObjOf (viewer)->box = Box; + ObjOf (viewer)->borderSize = Box ? 1 : 0; +} +boolean getCDKViewerBox (CDKVIEWER *viewer) +{ + return ObjOf (viewer)->box; +} + +/* + * This removes all the lines inside the scrolling window. + */ +void cleanCDKViewer (CDKVIEWER *viewer) +{ + int x; + + /* Clean up the memory used ... */ + for (x = 0; x < viewer->listSize; x++) + { + freeLine (viewer, x); + } + + /* *INDENT-EQLS* Reset some variables. */ + viewer->listSize = 0; + viewer->maxLeftChar = 0; + viewer->widestLine = 0; + viewer->currentTop = 0; + viewer->maxTopLine = 0; + + /* Redraw the window. */ + drawCDKViewer (viewer, ObjOf (viewer)->box); +} + +static void PatternNotFound (CDKVIEWER *viewer, char *pattern) +{ + CDK_CSTRING tempInfo[2]; + char *temp = (char *)malloc (80 + strlen (pattern)); + tempInfo[0] = temp; + tempInfo[1] = 0; + sprintf (temp, "Pattern '%s' not found.", pattern); + popUpLabel (viewer, tempInfo); + free (temp); +} + +/* + * This function actually controls the viewer... + */ +int activateCDKViewer (CDKVIEWER *widget, chtype *actions GCC_UNUSED) +{ + char *fileInfo[10]; + CDK_CSTRING tempInfo[2]; + char temp[500]; + chtype input; + boolean functionKey; + int x; + + /* Create the information about the file stats. */ + sprintf (temp, " File Statistics "); + fileInfo[0] = copyChar (temp); + sprintf (temp, " "); + fileInfo[1] = copyChar (temp); + sprintf (temp, "Character Count: %-4ld ", widget->characters); + fileInfo[2] = copyChar (temp); + sprintf (temp, "Line Count : %-4d ", widget->listSize); + fileInfo[3] = copyChar (temp); + sprintf (temp, " "); + fileInfo[4] = copyChar (temp); + sprintf (temp, "Press Any Key To Continue."); + fileInfo[5] = copyChar (temp); + fileInfo[6] = 0; + + tempInfo[0] = temp; + tempInfo[1] = 0; + + /* Set the current button. */ + widget->currentButton = 0; + + /* Draw the widget list. */ + drawCDKViewer (widget, ObjOf (widget)->box); + + /* Do this until KEY_ENTER is hit. */ + for (;;) + { + /* Reset the refresh flag. */ + int REFRESH = FALSE; + + input = (chtype)getchCDKObject (ObjOf (widget), &functionKey); + if (!checkCDKObjectBind (vVIEWER, widget, input)) + { + switch (input) + { + case KEY_TAB: + if (widget->buttonCount > 1) + { + if (widget->currentButton == (widget->buttonCount - 1)) + { + widget->currentButton = 0; + } + else + { + widget->currentButton++; + } + + /* Redraw the buttons. */ + drawCDKViewerButtons (widget); + } + break; + + case CDK_PREV: + if (widget->buttonCount > 1) + { + if (widget->currentButton == 0) + { + widget->currentButton = widget->buttonCount - 1; + } + else + { + widget->currentButton--; + } + + /* Redraw the buttons. */ + drawCDKViewerButtons (widget); + } + break; + + case KEY_UP: + if (widget->currentTop > 0) + { + widget->currentTop--; + REFRESH = TRUE; + } + else + { + Beep (); + } + break; + + case KEY_DOWN: + if (widget->currentTop < widget->maxTopLine) + { + widget->currentTop++; + REFRESH = TRUE; + } + else + { + Beep (); + } + break; + + case KEY_RIGHT: + if (widget->leftChar < widget->maxLeftChar) + { + widget->leftChar++; + REFRESH = TRUE; + } + else + { + Beep (); + } + break; + + case KEY_LEFT: + if (widget->leftChar > 0) + { + widget->leftChar--; + REFRESH = TRUE; + } + else + { + Beep (); + } + break; + + case KEY_PPAGE: + if (widget->currentTop > 0) + { + if ((widget->currentTop - (widget->viewSize - 1)) > 0) + { + widget->currentTop = (widget->currentTop + - (widget->viewSize - 1)); + } + else + { + widget->currentTop = 0; + } + REFRESH = TRUE; + } + else + { + Beep (); + } + break; + + case KEY_NPAGE: + if (widget->currentTop < widget->maxTopLine) + { + if ((widget->currentTop + widget->viewSize) < widget->maxTopLine) + { + widget->currentTop = widget->currentTop + + (widget->viewSize + - 1); + } + else + { + widget->currentTop = widget->maxTopLine; + } + REFRESH = TRUE; + } + else + { + Beep (); + } + break; + + case KEY_HOME: + widget->leftChar = 0; + REFRESH = TRUE; + break; + + case KEY_END: + widget->leftChar = widget->maxLeftChar; + REFRESH = TRUE; + break; + + case 'g': + case '1': + case '<': + widget->currentTop = 0; + REFRESH = TRUE; + break; + + case 'G': + case '>': + widget->currentTop = widget->maxTopLine; + REFRESH = TRUE; + break; + + case 'L': + x = (int)((widget->listSize + widget->currentTop) / 2); + if (x < widget->maxTopLine) + { + widget->currentTop = x; + REFRESH = TRUE; + } + else + { + Beep (); + } + break; + + case 'l': + x = (int)(widget->currentTop / 2); + if (x >= 0) + { + widget->currentTop = x; + REFRESH = TRUE; + } + else + { + Beep (); + } + break; + + case '?': + SearchDirection = UP; + getAndStorePattern (ScreenOf (widget)); + if (!searchForWord (widget, SearchPattern, SearchDirection)) + { + PatternNotFound (widget, SearchPattern); + } + REFRESH = TRUE; + break; + + case '/': + SearchDirection = DOWN; + getAndStorePattern (ScreenOf (widget)); + if (!searchForWord (widget, SearchPattern, SearchDirection)) + { + PatternNotFound (widget, SearchPattern); + } + REFRESH = TRUE; + break; + + case 'N': + case 'n': + if (SearchPattern == 0) + { + sprintf (temp, "There is no pattern in the buffer."); + popUpLabel (widget, tempInfo); + } + else if (!searchForWord (widget, + SearchPattern, + ((input == 'n') + ? SearchDirection + : !SearchDirection))) + { + PatternNotFound (widget, SearchPattern); + } + REFRESH = TRUE; + break; + + case ':': + widget->currentTop = jumpToLine (widget); + REFRESH = TRUE; + break; + + case 'i': + case 's': + case 'S': + popUpLabel (widget, (CDK_CSTRING2)fileInfo); + REFRESH = TRUE; + break; + + case KEY_ESC: + freeCharList (fileInfo, 6); + setExitType (widget, input); + return -1; + + case KEY_ERROR: + freeCharList (fileInfo, 6); + setExitType (widget, input); + return -1; + + case KEY_ENTER: + freeCharList (fileInfo, 6); + setExitType (widget, input); + return widget->currentButton; + + case CDK_REFRESH: + eraseCDKScreen (ScreenOf (widget)); + refreshCDKScreen (ScreenOf (widget)); + break; + + default: + Beep (); + break; + } + } + + /* Do we need to redraw the screen??? */ + if (REFRESH) + { + drawCDKViewerInfo (widget); + } + } +} + +/* + * This searches the document looking for the given word. + */ +static void getAndStorePattern (CDKSCREEN *screen) +{ + /* *INDENT-EQLS* */ + CDKENTRY *getPattern = 0; + const char *temp = 0; + char *list = 0; + + /* Check the direction. */ + if (SearchDirection == UP) + { + temp = "Search Up : "; + } + else + { + temp = "Search Down: "; + } + + /* Pop up the entry field. */ + getPattern = newCDKEntry (screen, CENTER, CENTER, + 0, temp, + COLOR_PAIR (5) | A_BOLD, + '.' | COLOR_PAIR (5) | A_BOLD, + vMIXED, 10, 0, 256, TRUE, FALSE); + + /* Is there an old search pattern? */ + if (SearchPattern != 0) + { + setCDKEntry (getPattern, SearchPattern, getPattern->min, + getPattern->max, ObjOf (getPattern)->box); + } + freeChar (SearchPattern); + + /* Activate this baby. */ + list = activateCDKEntry (getPattern, 0); + + /* Save the list. */ + if ((list != 0) && (strlen (list) != 0)) + { + SearchPattern = copyChar (list); + } + + /* Clean up. */ + destroyCDKEntry (getPattern); +} + +/* + * This searches for a line containing the word and realigns the value on the + * screen. + */ +static int searchForWord (CDKVIEWER *viewer, char *pattern, int direction) +{ + int found = 0; + int plen; + + /* If the pattern is empty then return. */ + if (pattern != 0 && (plen = (int)strlen (pattern)) != 0) + { + int x, y, pos, len; + + if (direction == DOWN) + { + /* Start looking from 'here' down. */ + for (x = viewer->currentTop + 1; !found && (x < viewer->listSize); + x++) + { + len = chlen (viewer->list[x]); + for (y = pos = 0; y < len; y++) + { + int plainChar = CharOf (viewer->list[x][y]); + + if (CharOf (pattern[pos]) != plainChar) + { + y -= pos; + pos = 0; + } + else if (++pos == plen) + { + viewer->currentTop = (x < viewer->maxTopLine ? x : viewer->maxTopLine); + viewer->leftChar = (y < viewer->boxWidth ? 0 : viewer->maxLeftChar); + found = 1; + break; + } + + } + } + } + else + { + /* Start looking from 'here' up. */ + for (x = viewer->currentTop - 1; !found && (x >= 0); x--) + { + len = chlen (viewer->list[x]); + for (y = pos = 0; y < len; y++) + { + int plainChar = CharOf (viewer->list[x][y]); + + if (CharOf (pattern[pos]) != plainChar) + { + y -= pos; + pos = 0; + } + else if (++pos == plen) + { + viewer->currentTop = x; + viewer->leftChar = (y < viewer->boxWidth ? 0 : viewer->maxLeftChar); + found = 1; + break; + } + + } + } + } + } + return (found); +} + +/* + * This allows us to 'jump' to a given line in the file. + */ +static int jumpToLine (CDKVIEWER *viewer) +{ + /* *INDENT-EQLS* */ + int line = 0; + CDKSCALE *newline = newCDKScale (ScreenOf (viewer), CENTER, CENTER, + "Jump To Line", "Line :", A_BOLD, + intlen (viewer->listSize) + 1, + viewer->currentTop + 1, + 0, viewer->maxTopLine + 1, + 1, 10, TRUE, TRUE); + + line = activateCDKScale (newline, 0); + destroyCDKScale (newline); + return ((line - 1)); +} + +/* + * This pops a little message up on the screen. + */ +static void popUpLabel (CDKVIEWER *viewer, CDK_CSTRING2 mesg) +{ + CDKLABEL *label; + boolean functionKey; + + /* Set up variables. */ + label = newCDKLabel (ScreenOf (viewer), CENTER, CENTER, + (CDK_CSTRING2)mesg, + (int)CDKcountStrings (mesg), + TRUE, FALSE); + + /* Draw the label and wait. */ + drawCDKLabel (label, TRUE); + getchCDKObject (ObjOf (label), &functionKey); + + /* Clean up. */ + destroyCDKLabel (label); +} + +/* + * This moves the viewer field to the given location. + */ +static void _moveCDKViewer (CDKOBJS *object, int xplace, int yplace, boolean + relative, boolean refresh_flag) +{ + /* *INDENT-EQLS* */ + CDKVIEWER *viewer = (CDKVIEWER *)object; + int currentX = getbegx (viewer->win); + int currentY = getbegy (viewer->win); + int xpos = xplace; + int ypos = yplace; + int xdiff = 0; + int ydiff = 0; + + /* + * If this is a relative move, then we will adjust where we want + * to move to. + */ + if (relative) + { + xpos = getbegx (viewer->win) + xplace; + ypos = getbegy (viewer->win) + yplace; + } + + /* Adjust the window if we need to. */ + alignxy (WindowOf (viewer), &xpos, &ypos, viewer->boxWidth, viewer->boxHeight); + + /* Get the difference. */ + xdiff = currentX - xpos; + ydiff = currentY - ypos; + + /* Move the window to the new location. */ + moveCursesWindow (viewer->win, -xdiff, -ydiff); + moveCursesWindow (viewer->shadowWin, -xdiff, -ydiff); + + /* Touch the windows so they 'move'. */ + refreshCDKWindow (WindowOf (viewer)); + + /* Redraw the window, if they asked for it. */ + if (refresh_flag) + { + drawCDKViewer (viewer, ObjOf (viewer)->box); + } +} + +/* + * This function draws the viewer widget. + */ +static void _drawCDKViewer (CDKOBJS *object, boolean Box) +{ + CDKVIEWER *viewer = (CDKVIEWER *)object; + + /* Do we need to draw in the shadow??? */ + if (viewer->shadowWin != 0) + { + drawShadow (viewer->shadowWin); + } + + /* Box it if it was asked for. */ + if (Box) + { + drawObjBox (viewer->win, ObjOf (viewer)); + wrefresh (viewer->win); + } + + /* Draw the info in the viewer. */ + drawCDKViewerInfo (viewer); +} + +/* + * This redraws the viewer buttons. + */ +static void drawCDKViewerButtons (CDKVIEWER *viewer) +{ + chtype character; + int x; + + /* No buttons, no drawing. */ + if (viewer->buttonCount == 0) + { + return; + } + + /* Redraw the buttons. */ + for (x = 0; x < viewer->buttonCount; x++) + { + writeChtype (viewer->win, + viewer->buttonPos[x], + viewer->boxHeight - 2, + viewer->button[x], + HORIZONTAL, + 0, + viewer->buttonLen[x]); + } + + /* Highlight the current button. */ + for (x = 0; x < viewer->buttonLen[viewer->currentButton]; x++) + { + /* Strip the character of any extra attributes. */ + character = CharOf (viewer->button[viewer->currentButton][x]); + + /* Add the character into the window. */ + (void)mvwaddch (viewer->win, + viewer->boxHeight - 2, + viewer->buttonPos[viewer->currentButton] + x, + character | viewer->buttonHighlight); + } + + /* Refresh the window. */ + wrefresh (viewer->win); +} + +/* + * This sets the background attribute of the widget. + */ +static void _setBKattrViewer (CDKOBJS *object, chtype attrib) +{ + if (object != 0) + { + CDKVIEWER *widget = (CDKVIEWER *)object; + + wbkgd (widget->win, attrib); + } +} + +/* + * Free any storage associated with the info-list. + */ +static void destroyInfo (CDKVIEWER *viewer) +{ + CDKfreeChtypes (viewer->list); + freeChecked (viewer->listPos); + freeChecked (viewer->listLen); + + viewer->list = 0; + viewer->listPos = 0; + viewer->listLen = 0; +} + +/* + * This function destroys the viewer widget. + */ +static void _destroyCDKViewer (CDKOBJS *object) +{ + if (object != 0) + { + CDKVIEWER *viewer = (CDKVIEWER *)object; + + destroyInfo (viewer); + + cleanCdkTitle (object); + CDKfreeChtypes (viewer->button); + freeChecked (viewer->buttonLen); + freeChecked (viewer->buttonPos); + + /* Clean up the windows. */ + deleteCursesWindow (viewer->shadowWin); + deleteCursesWindow (viewer->win); + + /* Clean the key bindings. */ + cleanCDKObjectBindings (vVIEWER, viewer); + + /* Unregister this object. */ + unregisterCDKObject (vVIEWER, viewer); + } +} + +/* + * This function erases the viewer widget from the screen. + */ +static void _eraseCDKViewer (CDKOBJS *object) +{ + if (validCDKObject (object)) + { + CDKVIEWER *viewer = (CDKVIEWER *)object; + + eraseCursesWindow (viewer->win); + eraseCursesWindow (viewer->shadowWin); + } +} + +/* + * This draws the viewer info lines. + */ +static void drawCDKViewerInfo (CDKVIEWER *viewer) +{ + int listAdjust = 0; + int lastLine = 0; + int x; + + /* Clear the window. */ + werase (viewer->win); + + drawCdkTitle (viewer->win, ObjOf (viewer)); + + /* Draw in the current line at the top. */ + if (viewer->showLineInfo == TRUE) + { + char temp[256]; + + /* Set up the info line and draw it. */ + if (viewer->inProgress) + { + strcpy (temp, "processing..."); + } + else if (viewer->listSize != 0) + { + sprintf (temp, "%d/%d %2.0f%%", + (viewer->currentTop + 1), + viewer->listSize, + ((float)(viewer->currentTop + 1) + / (float)viewer->listSize) * 100); + } + else + { + sprintf (temp, "%d/%d %2.0f%%", 0, 0, 0.0); + } + + /* + * The listAdjust variable tells us if we have to shift down one line + * because the person asked for the line X of Y line at the top of the + * screen. We only want to set this to 1 if they asked for the info line + * and there is no title, or if the two items overlap. + */ + if (TitleLinesOf (viewer) == 0 + || TitlePosOf (viewer)[0] < ((int)strlen (temp) + 2)) + { + listAdjust = 1; + } + writeChar (viewer->win, 1, (listAdjust ? TitleLinesOf (viewer) : 0) + 1, + temp, HORIZONTAL, 0, (int)strlen (temp)); + } + + /* Determine the last line to draw. */ + lastLine = ((viewer->listSize <= viewer->viewSize) + ? viewer->listSize + : viewer->viewSize); + lastLine -= listAdjust; + + /* Redraw the list. */ + for (x = 0; x < lastLine; x++) + { + if (viewer->currentTop + x < viewer->listSize) + { + int screenPos = viewer->listPos[viewer->currentTop + x] + 1 - viewer->leftChar; + + writeChtype (viewer->win, + ((screenPos >= 0) + ? screenPos + : 1), + x + TitleLinesOf (viewer) + listAdjust + 1, + viewer->list[x + viewer->currentTop], + HORIZONTAL, + ((screenPos >= 0) + ? 0 + : (viewer->leftChar + - viewer->listPos[viewer->currentTop + x])), + viewer->listLen[x + viewer->currentTop]); + } + } + + /* Box it if we have to. */ + if (ObjOf (viewer)->box) + { + drawObjBox (viewer->win, ObjOf (viewer)); + wrefresh (viewer->win); + } + + /* Draw the separation line. */ + if (viewer->buttonCount > 0) + { + chtype boxattr = BXAttrOf (viewer); + + for (x = 1; x <= viewer->boxWidth; x++) + { + (void)mvwaddch (viewer->win, viewer->boxHeight - 3, x, + HZCharOf (viewer) | boxattr); + } + (void)mvwaddch (viewer->win, viewer->boxHeight - 3, 0, + ACS_LTEE | boxattr); + (void)mvwaddch (viewer->win, viewer->boxHeight - 3, + getmaxx (viewer->win) - 1, + ACS_RTEE | boxattr); + } + + /* Draw the buttons. This will call refresh on the viewer win. */ + drawCDKViewerButtons (viewer); +} + +/* + * The listSize may be negative, to assign no definite limit. + */ +static int createList (CDKVIEWER *swindow, int listSize) +{ + int status = 0; + + if (listSize >= 0) + { + chtype **newList = typeCallocN (chtype *, listSize + 1); + int *newPos = typeCallocN (int, listSize + 1); + int *newLen = typeCallocN (int, listSize + 1); + + if (newList != 0 + && newPos != 0 + && newLen != 0) + { + status = 1; + destroyInfo (swindow); + + swindow->list = newList; + swindow->listPos = newPos; + swindow->listLen = newLen; + } + if (!status) + { + CDKfreeChtypes (newList); + freeChecked (newPos); + freeChecked (newLen); + } + } + else + { + destroyInfo (swindow); + } + return status; +} + +dummyInject (Viewer) + +dummyFocus (Viewer) + +dummyUnfocus (Viewer) + +dummyRefreshData (Viewer) + +dummySaveData (Viewer) diff --git a/utils/fileapprove/Makefile b/utils/fileapprove/Makefile index 1d7b292..0662e2d 100644 --- a/utils/fileapprove/Makefile +++ b/utils/fileapprove/Makefile @@ -1,13 +1,37 @@ +OS := $(shell uname -s) + +ifeq ($(OS), FreeBSD) + CC=cc + CFLAGS=-I/usr/local/include + LDFLAGS=-L/usr/local/lib +endif +ifeq ($(OS), NetBSD) + CC=cc + CFLAGS=-I/usr/pkg/include + LDFLAGS=-L/usr/pkg/lib +endif +ifeq ($(OS), Linux) + CC=gcc + CFLAGS= + LDFLAGS= +endif +ifeq ($(OS), Darwin) + CC=cc + CFLAGS= + LDFLAGS= +endif + + CC=cc CFLAGS=-I/usr/local/include DEPS = fileapprove.c OBJ = fileapprove.o %.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -I../../deps/cdk-5.0-20161210/include/ fileapprove: $(OBJ) - $(CC) -o fileapprove -o $@ $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lncurses -lcdk + $(CC) -o fileapprove -o $@ $^ ../../deps/cdk-5.0-20161210/libcdk.a $(CFLAGS) $(LDFLAGS) -lsqlite3 -lncurses .PHONY: clean