mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 17:23:03 +01:00
More changes to straighten out compile, fix up makefiles to build
into GEN_ROOT directory
This commit is contained in:
parent
5dc9d07e52
commit
73591b7d17
16
configure
vendored
16
configure
vendored
@ -2204,23 +2204,23 @@ EOF
|
||||
esac
|
||||
|
||||
case "$target" in
|
||||
*-*-darwin*) MAKEFILE_PREFIX=prefix.darwin ; PLATFORM=DARWIN ; cat >> confdefs.h <<\EOF
|
||||
*-*-darwin*) MAKEFILE_PREFIX=darwin ; PLATFORM=DARWIN ; cat >> confdefs.h <<\EOF
|
||||
#define DARWIN 1
|
||||
EOF
|
||||
;;
|
||||
*-*-freebsd*) MAKEFILE_PREFIX=prefix.freebsd ; PLATFORM=FREEBSD ; cat >> confdefs.h <<\EOF
|
||||
*-*-freebsd*) MAKEFILE_PREFIX=freebsd ; PLATFORM=FREEBSD ; cat >> confdefs.h <<\EOF
|
||||
#define FREEBSD 1
|
||||
EOF
|
||||
;;
|
||||
*-*-linux*) MAKEFILE_PREFIX=prefix.linux ; PLATFORM=LINUX ; cat >> confdefs.h <<\EOF
|
||||
*-*-linux*) MAKEFILE_PREFIX=linux ; PLATFORM=LINUX ; cat >> confdefs.h <<\EOF
|
||||
#define LINUX 1
|
||||
EOF
|
||||
;;
|
||||
*-*-netbsd*) MAKEFILE_PREFIX=prefix.netbsd ; PLATFORM=NETBSD ; cat >> confdefs.h <<\EOF
|
||||
*-*-netbsd*) MAKEFILE_PREFIX=netbsd ; PLATFORM=NETBSD ; cat >> confdefs.h <<\EOF
|
||||
#define NETBSD 1
|
||||
EOF
|
||||
;;
|
||||
*-*-hpux*) MAKEFILE_PREFIX=prefix.hpux ; PLATFORM=hpux ; cat >> confdefs.h <<\EOF
|
||||
*-*-hpux*) MAKEFILE_PREFIX=hpux ; PLATFORM=hpux ; cat >> confdefs.h <<\EOF
|
||||
#define hpux 1
|
||||
EOF
|
||||
;;
|
||||
@ -2363,7 +2363,7 @@ ac_given_srcdir=$srcdir
|
||||
trap 'rm -fr `echo "\
|
||||
src/make.rules:src/make.new/make.rules \
|
||||
src/make.defaults:src/make.new/make.defaults \
|
||||
src/make.platform:src/make.new/${MAKEFILE_PREFIX} \
|
||||
src/make.platform:src/make.new/prefix.${MAKEFILE_PREFIX} \
|
||||
src/make.shared.variables:src/make.new/make.shared.variables \
|
||||
src/fbutil/Makefile:src/make.new/Makefile.in.fbutil \
|
||||
src/alice/Makefile:src/make.new/Makefile.in.alice \
|
||||
@ -2386,6 +2386,7 @@ src/qli/Makefile:src/make.new/Makefile.in.qli \
|
||||
src/remote/Makefile:src/make.new/Makefile.in.remote \
|
||||
src/utilities/Makefile:src/make.new/Makefile.in.utilities \
|
||||
src/wal/Makefile:src/make.new/Makefile.in.wal \
|
||||
src/install/Makefile:src/install/Makefile.in:src/install/arch-specific/${MAKEFILE_PREFIX}/Makefile.in \
|
||||
src/Makefile:src/make.new/Makefile.in.firebird \
|
||||
Makefile:Makefile.in \
|
||||
src/include/gen/autoconfig.h:src/make.new/config/config.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
@ -2490,7 +2491,7 @@ cat >> $CONFIG_STATUS <<EOF
|
||||
CONFIG_FILES=\${CONFIG_FILES-"\
|
||||
src/make.rules:src/make.new/make.rules \
|
||||
src/make.defaults:src/make.new/make.defaults \
|
||||
src/make.platform:src/make.new/${MAKEFILE_PREFIX} \
|
||||
src/make.platform:src/make.new/prefix.${MAKEFILE_PREFIX} \
|
||||
src/make.shared.variables:src/make.new/make.shared.variables \
|
||||
src/fbutil/Makefile:src/make.new/Makefile.in.fbutil \
|
||||
src/alice/Makefile:src/make.new/Makefile.in.alice \
|
||||
@ -2513,6 +2514,7 @@ src/qli/Makefile:src/make.new/Makefile.in.qli \
|
||||
src/remote/Makefile:src/make.new/Makefile.in.remote \
|
||||
src/utilities/Makefile:src/make.new/Makefile.in.utilities \
|
||||
src/wal/Makefile:src/make.new/Makefile.in.wal \
|
||||
src/install/Makefile:src/install/Makefile.in:src/install/arch-specific/${MAKEFILE_PREFIX}/Makefile.in \
|
||||
src/Makefile:src/make.new/Makefile.in.firebird \
|
||||
Makefile:Makefile.in \
|
||||
"}
|
||||
|
13
configure.in
13
configure.in
@ -41,11 +41,11 @@ powerpc) AC_DEFINE(PowerPC) ;;
|
||||
esac
|
||||
|
||||
case "$target" in
|
||||
*-*-darwin*) MAKEFILE_PREFIX=prefix.darwin ; PLATFORM=DARWIN ; AC_DEFINE(DARWIN);;
|
||||
*-*-freebsd*) MAKEFILE_PREFIX=prefix.freebsd ; PLATFORM=FREEBSD ; AC_DEFINE(FREEBSD);;
|
||||
*-*-linux*) MAKEFILE_PREFIX=prefix.linux ; PLATFORM=LINUX ; AC_DEFINE(LINUX) ;;
|
||||
*-*-netbsd*) MAKEFILE_PREFIX=prefix.netbsd ; PLATFORM=NETBSD ; AC_DEFINE(NETBSD) ;;
|
||||
*-*-hpux*) MAKEFILE_PREFIX=prefix.hpux ; PLATFORM=hpux ; AC_DEFINE(hpux) ;;
|
||||
*-*-darwin*) MAKEFILE_PREFIX=darwin ; PLATFORM=DARWIN ; AC_DEFINE(DARWIN);;
|
||||
*-*-freebsd*) MAKEFILE_PREFIX=freebsd ; PLATFORM=FREEBSD ; AC_DEFINE(FREEBSD);;
|
||||
*-*-linux*) MAKEFILE_PREFIX=linux ; PLATFORM=LINUX ; AC_DEFINE(LINUX) ;;
|
||||
*-*-netbsd*) MAKEFILE_PREFIX=netbsd ; PLATFORM=NETBSD ; AC_DEFINE(NETBSD) ;;
|
||||
*-*-hpux*) MAKEFILE_PREFIX=hpux ; PLATFORM=hpux ; AC_DEFINE(hpux) ;;
|
||||
esac
|
||||
|
||||
AC_SUBST(PLATFORM)
|
||||
@ -85,7 +85,7 @@ AC_OUTPUT_COMMANDS([mkdir -p gen/firebird/help])
|
||||
AC_OUTPUT( \
|
||||
src/make.rules:src/make.new/make.rules \
|
||||
src/make.defaults:src/make.new/make.defaults \
|
||||
src/make.platform:src/make.new/${MAKEFILE_PREFIX} \
|
||||
src/make.platform:src/make.new/prefix.${MAKEFILE_PREFIX} \
|
||||
src/make.shared.variables:src/make.new/make.shared.variables \
|
||||
src/fbutil/Makefile:src/make.new/Makefile.in.fbutil \
|
||||
src/alice/Makefile:src/make.new/Makefile.in.alice \
|
||||
@ -108,6 +108,7 @@ src/qli/Makefile:src/make.new/Makefile.in.qli \
|
||||
src/remote/Makefile:src/make.new/Makefile.in.remote \
|
||||
src/utilities/Makefile:src/make.new/Makefile.in.utilities \
|
||||
src/wal/Makefile:src/make.new/Makefile.in.wal \
|
||||
src/install/Makefile:src/install/Makefile.in:src/install/arch-specific/${MAKEFILE_PREFIX}/Makefile.in \
|
||||
src/Makefile:src/make.new/Makefile.in.firebird \
|
||||
Makefile:Makefile.in \
|
||||
)
|
||||
|
@ -87,84 +87,84 @@
|
||||
|
||||
static struct in_sw_tab_t burp_in_sw_table [] =
|
||||
{
|
||||
IN_SW_BURP_B, 0, "BACKUP_DATABASE", 0, 0, 0, FALSE, 60, 0, NULL,
|
||||
{IN_SW_BURP_B, 0, "BACKUP_DATABASE", 0, 0, 0, FALSE, 60, 0, NULL},
|
||||
/* msg 60: %sBACKUP_DATABASE backup database to file */
|
||||
IN_SW_BURP_BU, isc_spb_res_buffers, "BUFFERS", 0, 0, 0, FALSE, 257, 0, NULL,
|
||||
{IN_SW_BURP_BU, isc_spb_res_buffers, "BUFFERS", 0, 0, 0, FALSE, 257, 0, NULL},
|
||||
/* msg 257: %sBU(FFERS) override default page buffers */
|
||||
IN_SW_BURP_C, isc_spb_res_create, "CREATE_DATABASE", 0, 0, 0, FALSE, 73, 0, NULL,
|
||||
{IN_SW_BURP_C, isc_spb_res_create, "CREATE_DATABASE", 0, 0, 0, FALSE, 73, 0, NULL},
|
||||
/* msg 73: %sCREATE_DATABASE create database from backup file */
|
||||
IN_SW_BURP_CO, isc_spb_bkp_convert, "CONVERT", 0, 0, 0, FALSE, 254, 0, NULL,
|
||||
{IN_SW_BURP_CO, isc_spb_bkp_convert, "CONVERT", 0, 0, 0, FALSE, 254, 0, NULL},
|
||||
/* msg 254: %sCO(NVERT) backup external files as tables */
|
||||
IN_SW_BURP_E, isc_spb_bkp_expand, "EXPAND", 0, 0, 0, FALSE, 97, 0, NULL,
|
||||
{IN_SW_BURP_E, isc_spb_bkp_expand, "EXPAND", 0, 0, 0, FALSE, 97, 0, NULL},
|
||||
/* msg 97: %sEXPAND no data compression */
|
||||
IN_SW_BURP_F, 0, "FILE_NAMES", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_BURP_FA, isc_spb_bkp_factor, "FACTOR", 0, 0, 0, FALSE, 181, 0, NULL,
|
||||
{IN_SW_BURP_F, 0, "FILE_NAMES", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
{IN_SW_BURP_FA, isc_spb_bkp_factor, "FACTOR", 0, 0, 0, FALSE, 181, 0, NULL},
|
||||
/* msg 181; %sFACTOR blocking factor */
|
||||
IN_SW_BURP_G, isc_spb_bkp_no_garbage_collect, "GARBAGE_COLLECT", 0, 0, 0, FALSE, 177, 0, NULL,
|
||||
{IN_SW_BURP_G, isc_spb_bkp_no_garbage_collect, "GARBAGE_COLLECT", 0, 0, 0, FALSE, 177, 0, NULL},
|
||||
/* msg 177:%sGARBAGE_COLLECT inhibit garbage collection */
|
||||
IN_SW_BURP_I, isc_spb_res_deactivate_idx, "INACTIVE", 0, 0, 0, FALSE, 78, 0, NULL,
|
||||
{IN_SW_BURP_I, isc_spb_res_deactivate_idx, "INACTIVE", 0, 0, 0, FALSE, 78, 0, NULL},
|
||||
/* msg 78:%sINACTIVE deactivate indexes during restore */
|
||||
IN_SW_BURP_IG, isc_spb_bkp_ignore_checksums, "IGNORE", 0, 0, 0, FALSE, 178, 0, NULL,
|
||||
{IN_SW_BURP_IG, isc_spb_bkp_ignore_checksums, "IGNORE", 0, 0, 0, FALSE, 178, 0, NULL},
|
||||
/* msg 178:%sIGNORE ignore bad checksums */
|
||||
IN_SW_BURP_K, isc_spb_res_no_shadow, "KILL", 0, 0, 0, FALSE, 172, 0, NULL,
|
||||
{IN_SW_BURP_K, isc_spb_res_no_shadow, "KILL", 0, 0, 0, FALSE, 172, 0, NULL},
|
||||
/* msg 172:%sKILL restore without creating shadows */
|
||||
IN_SW_BURP_L, isc_spb_bkp_ignore_limbo, "LIMBO", 0, 0, 0, FALSE, 98, 0, NULL,
|
||||
{IN_SW_BURP_L, isc_spb_bkp_ignore_limbo, "LIMBO", 0, 0, 0, FALSE, 98, 0, NULL},
|
||||
/* msg 98 ignore transactions in limbo */
|
||||
IN_SW_BURP_M, isc_spb_bkp_metadata_only, "METADATA", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_BURP_M, 0, "META_DATA", 0, 0, 0, FALSE, 63, 0, NULL,
|
||||
{IN_SW_BURP_M, isc_spb_bkp_metadata_only, "METADATA", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
{IN_SW_BURP_M, 0, "META_DATA", 0, 0, 0, FALSE, 63, 0, NULL},
|
||||
/* msg 63: %sMETA_DATA backup metadata only */
|
||||
IN_SW_BURP_MODE, 0, "MODE", 0, 0, 0, FALSE, 278, 0, NULL,
|
||||
{IN_SW_BURP_MODE, 0, "MODE", 0, 0, 0, FALSE, 278, 0, NULL},
|
||||
/* msg 278: %sMODE read_only or read_write access */
|
||||
IN_SW_BURP_N, isc_spb_res_no_validity, "NO_VALIDITY", 0, 0, 0, FALSE, 187, 0, NULL,
|
||||
{IN_SW_BURP_N, isc_spb_res_no_validity, "NO_VALIDITY", 0, 0, 0, FALSE, 187, 0, NULL},
|
||||
/* msg 187: %sN(O_VALIDITY) do not restore database validity conditions */
|
||||
IN_SW_BURP_NT, isc_spb_bkp_non_transportable, "NT", 0, 0, 0, FALSE, 239, 0, NULL,
|
||||
{IN_SW_BURP_NT, isc_spb_bkp_non_transportable, "NT", 0, 0, 0, FALSE, 239, 0, NULL},
|
||||
/* msg 239: %sNT Non-Transportable backup file format */
|
||||
IN_SW_BURP_O, isc_spb_res_one_at_a_time, "ONE_AT_A_TIME", 0, 0, 0, FALSE, 99, 0, NULL,
|
||||
{IN_SW_BURP_O, isc_spb_res_one_at_a_time, "ONE_AT_A_TIME", 0, 0, 0, FALSE, 99, 0, NULL},
|
||||
/* msg 99: %sONE_AT_A_TIME restore one relation at a time */
|
||||
IN_SW_BURP_OL, isc_spb_bkp_old_descriptions, "OLD_DESCRIPTIONS", 0, 0, 0, FALSE, 186, 0, NULL,
|
||||
{IN_SW_BURP_OL, isc_spb_bkp_old_descriptions, "OLD_DESCRIPTIONS", 0, 0, 0, FALSE, 186, 0, NULL},
|
||||
/* msg 186: %sOLD_DESCRIPTIONS save old style metadata descriptions */
|
||||
IN_SW_BURP_P, isc_spb_res_page_size, "PAGE_SIZE", 0, 0, 0, FALSE, 101, 0, NULL,
|
||||
{IN_SW_BURP_P, isc_spb_res_page_size, "PAGE_SIZE", 0, 0, 0, FALSE, 101, 0, NULL},
|
||||
/* msg 101: %sPAGE_SIZE override default page size */
|
||||
IN_SW_BURP_PASS, 0, "PASSWORD", 0, 0, 0, FALSE, 190, 0, NULL,
|
||||
{IN_SW_BURP_PASS, 0, "PASSWORD", 0, 0, 0, FALSE, 190, 0, NULL},
|
||||
/* msg 190: %sPA(SSWORD) InterBase password */
|
||||
IN_SW_BURP_R, isc_spb_res_replace, "REPLACE_DATABASE", 0, 0, 0, FALSE, 112, 0, NULL,
|
||||
{IN_SW_BURP_R, isc_spb_res_replace, "REPLACE_DATABASE", 0, 0, 0, FALSE, 112, 0, NULL},
|
||||
/* msg 112: %sREPLACE_DATABASE replace database from backup file */
|
||||
/**************************************************************
|
||||
** msg 252: %sRO(LE) InterBase SQL role
|
||||
***************************************************************/
|
||||
IN_SW_BURP_ROLE, isc_spb_sql_role_name, "ROLE", 0, 0, 0, FALSE, 252, 0, NULL,
|
||||
IN_SW_BURP_S, 0, "SKIP_BAD_DATA", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_BURP_SE, 0, "SERVICE", 0, 0, 0, FALSE, 277, 0, NULL,
|
||||
{IN_SW_BURP_ROLE, isc_spb_sql_role_name, "ROLE", 0, 0, 0, FALSE, 252, 0, NULL},
|
||||
{IN_SW_BURP_S, 0, "SKIP_BAD_DATA", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
{IN_SW_BURP_SE, 0, "SERVICE", 0, 0, 0, FALSE, 277, 0, NULL},
|
||||
/* msg 277: %sSE(RVICE) use services manager */
|
||||
IN_SW_BURP_T, 0, "TRANSPORTABLE", 0, 0, 0, FALSE, 175, 0, NULL,
|
||||
{IN_SW_BURP_T, 0, "TRANSPORTABLE", 0, 0, 0, FALSE, 175, 0, NULL},
|
||||
/* msg 175: %sTRANSPORTABLE transportable backup -- data in XDR format */
|
||||
/*
|
||||
IN_SW_BURP_U, 0, "UNPROTECTED", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
{IN_SW_BURP_U, 0, "UNPROTECTED", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
*/
|
||||
IN_SW_BURP_US, isc_spb_res_use_all_space, "USE_ALL_SPACE", 0, 0, 0, FALSE, 276, 0, NULL,
|
||||
{IN_SW_BURP_US, isc_spb_res_use_all_space, "USE_ALL_SPACE", 0, 0, 0, FALSE, 276, 0, NULL},
|
||||
/* msg 276: %sUSE_(ALL_SPACE) do not reserve space for record versions */
|
||||
IN_SW_BURP_USER, 0, "USER", 0, 0, 0, FALSE, 191, 0, NULL,
|
||||
{IN_SW_BURP_USER, 0, "USER", 0, 0, 0, FALSE, 191, 0, NULL},
|
||||
/* msg 191: %sUSER InterBase user name */
|
||||
IN_SW_BURP_V, isc_spb_verbose, "VERBOSE", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_BURP_V, 0, "VERIFY", 0, 0, 0, FALSE, 113, 0, NULL,
|
||||
{IN_SW_BURP_V, isc_spb_verbose, "VERBOSE", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
{IN_SW_BURP_V, 0, "VERIFY", 0, 0, 0, FALSE, 113, 0, NULL},
|
||||
/* msg 113: %sVERIFY report each action taken */
|
||||
IN_SW_BURP_Y, 0, "Y", 0, 0, 0, FALSE, 109, 0, NULL,
|
||||
{IN_SW_BURP_Y, 0, "Y", 0, 0, 0, FALSE, 109, 0, NULL},
|
||||
/* msg 109: %sY redirect/suppress output (file path or OUTPUT_SUPPRESS) */
|
||||
IN_SW_BURP_Z, 0, "Z", 0, 0, 0, FALSE, 104, 0, NULL,
|
||||
{IN_SW_BURP_Z, 0, "Z", 0, 0, 0, FALSE, 104, 0, NULL},
|
||||
/* msg 104: %sZ print version number */
|
||||
#ifdef DEV_BUILD
|
||||
IN_SW_BURP_7, 0, "7", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
{IN_SW_BURP_7, 0, "7", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
#endif
|
||||
/* next switch is a hidden option in case of bug_no 8183 */
|
||||
IN_SW_BURP_BUG8183, 0, "BUG_8183", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
{IN_SW_BURP_BUG8183, 0, "BUG_8183", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
/**************************************************************************/
|
||||
/* The next two 'virtual' switches are hidden from user and are needed */
|
||||
/* for services API */
|
||||
/**************************************************************************/
|
||||
IN_SW_BURP_HIDDEN_RDONLY, isc_spb_res_am_readonly, "mode read_only", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_BURP_HIDDEN_RDWRITE, isc_spb_res_am_readwrite, "mode read_write", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
{IN_SW_BURP_HIDDEN_RDONLY, isc_spb_res_am_readonly, "mode read_only", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
{IN_SW_BURP_HIDDEN_RDWRITE, isc_spb_res_am_readwrite, "mode read_write", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
/**************************************************************************/
|
||||
IN_SW_BURP_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL
|
||||
{IN_SW_BURP_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@ -176,9 +176,10 @@ static struct in_sw_tab_t burp_in_sw_table [] =
|
||||
|
||||
static struct in_sw_tab_t spit_in_sw_table [] =
|
||||
{
|
||||
IN_SW_SPIT_SP, 0, "SPLIT_BK_FILE", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_SPIT_JT, 0, "JOIN_BK_FILE", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_SPIT_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL
|
||||
{IN_SW_SPIT_SP, 0, "SPLIT_BK_FILE", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
{IN_SW_SPIT_JT, 0, "JOIN_BK_FILE", 0, 0, 0, FALSE, 0, 0, NULL},
|
||||
{IN_SW_SPIT_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL}
|
||||
};
|
||||
|
||||
#endif /* _BURP_BURP_H_ */
|
||||
#endif /* _BURP_BURP_H_ */
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: Makefile.in.burp,v 1.1 2001-07-29 23:43:23 skywalker Exp $
|
||||
# $Id: Makefile.in.burp,v 1.2 2001-08-01 08:11:52 skywalker Exp $
|
||||
#
|
||||
|
||||
ROOT=../..
|
||||
@ -42,22 +42,31 @@ unexport ISC_USER
|
||||
unexport ISC_PASSWORD
|
||||
|
||||
|
||||
BURP_OBJECTS= backup.o burp.o canonical.o misc.o mvol.o restore.o
|
||||
SPIT_OBJECTS= spit.o
|
||||
BURP_Sources= backup.cpp burp.cpp canonical.cpp misc.cpp mvol.cpp restore.cpp
|
||||
SPIT_Sources= spit.cpp
|
||||
|
||||
BURP_Objects = $(BURP_Sources:%.cpp=$(OBJ)/%.o)
|
||||
SPIT_Objects = $(SPIT_Sources:%.cpp=$(OBJ)/%.o)
|
||||
|
||||
|
||||
.PHONY: gbak_static
|
||||
AllObjects = $(BURP_Objects) $(SPIT_Objects)
|
||||
|
||||
Dependencies = $(AllObjects:.o=.d)
|
||||
|
||||
|
||||
|
||||
.PHONY: gbak_static gbak gsplit
|
||||
|
||||
|
||||
all: gbak_static gbak gsplit
|
||||
|
||||
gbak_static : $(BIN)/gbak_static
|
||||
|
||||
$(BIN)/gbak_static : $(BURP_OBJECTS) $(LIB)/jrd_static.a
|
||||
$(BIN)/gbak_static : $(BURP_Objects) $(LIB)/jrd_static.a
|
||||
$(CXX) $(LINK_OPTS) $^ -o $@ $(COREFOUNDATION_LINK) $(LINK_LIBS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# On a PC environment it also originally had a way of includeing
|
||||
# ../remote/xdr.o which would be needed to talk across the network.
|
||||
# Was called BURP_REMOTE_LINK=source/remote/xdr.o in prefix.win_nt
|
||||
@ -66,159 +75,29 @@ $(BIN)/gbak_static : $(BURP_OBJECTS) $(LIB)/jrd_static.a
|
||||
|
||||
gbak: $(BIN)/gbak
|
||||
|
||||
$(BIN)/gbak: $(BURP_OBJECTS) $(LIBGDS_LA)
|
||||
$(BIN)/gbak: $(BURP_Objects) $(LIBGDS_LA)
|
||||
$(CXX) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
gsplit : $(BIN)/gsplit
|
||||
|
||||
# be careful of split vs spit here the public name is gsplit the internal
|
||||
# one is spit, so be careful the macros have the right name.
|
||||
|
||||
$(BIN)/gsplit: $(SPIT_OBJECTS) $(LIBGDS_LA)
|
||||
$(BIN)/gsplit: $(SPIT_Objects) $(LIBGDS_LA)
|
||||
$(CXX) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
|
||||
# These should be changed to GEN_SRC at some point in time.
|
||||
|
||||
$(SRC)/restore.cpp $(SRC)/backup.cpp : yachts.lnk
|
||||
|
||||
|
||||
yachts.lnk:
|
||||
ln -fs ../refDatabases/empty.gdb yachts.lnk
|
||||
ln -fs $(SRC_ROOT)/refDatabases/empty.gdb yachts.lnk
|
||||
|
||||
|
||||
# don't forget spit...
|
||||
|
||||
|
||||
all: burp$(EXEC_EXT) spit$(EXEC_EXT)
|
||||
|
||||
# JMB $(JRD_LINK) already in shared library
|
||||
burp: burplib.a $(BURP_REMOTE_LINK) $(GDSSHR)
|
||||
-$(RM) burp
|
||||
$(CXX) $(LINK_OPTS) $(BURP_OBJECTS) $(T_SWITCH) \
|
||||
$(BURP_REMOTE_LINK) -o burp $(GDSSHR_LINK) $(SO_NETWORK_LIB)
|
||||
$(CHMOD_7) burp
|
||||
$(MV) burp $(BURP)
|
||||
$(TOUCH) burp
|
||||
$(CHMOD_6) burp
|
||||
|
||||
#burp/gbak_static gbak_static $(OBJS)/firebird/bin/gbak_static: \
|
||||
# $(OBJS)/jrd/jrd_static.a burplib.a
|
||||
# $(CXX) burplib.a $(OBJS)/jrd/jrd_static.a -o gbak_static \
|
||||
# $(COREFOUNDATION_LINK) $(GPRE_STATIC_LINK_OPTS) $(DROP_LINK)
|
||||
# $(MV) gbak_static $(OBJS)/firebird/bin/gbak_static
|
||||
|
||||
burp.exe: burplib.lib $(JRD_LINK) $(BURP_REMOTE_LINK)
|
||||
-$(RM) burp.exe
|
||||
$(CC) $(LINK_OPTS) $(O_EXE_SWITCH)burp \
|
||||
$(BURP_OBJECTS) $(JRD_LINK) $(BURP_REMOTE_LINK) $(GDSSHR_LINK) $(WSOCKLIB)
|
||||
$(MV) burp.exe $(BURP)
|
||||
$(RM) burp.exe
|
||||
$(TOUCH) burp.exe
|
||||
|
||||
burplib.a: $(BURP_OBJECTS) $(JRD_LINK)
|
||||
-$(RM) burplib.a
|
||||
$(AR) burplib.a $(BURP_OBJECTS) $(SCO_OBJS_BURPLIB)
|
||||
-ranlib burplib.a
|
||||
$(CHMOD_6) burplib.a
|
||||
|
||||
libgbaklib.a: burplib.a
|
||||
-$(RM) libgbaklib.a
|
||||
$(CP) burplib.a $(OBJS)/firebird/lib/gbaklib.a
|
||||
$(TOUCH) libgbaklib.a
|
||||
$(CHMOD_6) libgbaklib.a
|
||||
|
||||
burplib.lib: $(BURP_OBJECTS)
|
||||
-$(RM) burplib.lib
|
||||
$(IMPLIB) -out:burplib.lib $(BURP_OBJECTS)
|
||||
$(TOUCH) burplib.lib
|
||||
|
||||
#spit: $(SPIT_OBJECTS)
|
||||
# -$(RM) spit
|
||||
# $(CC) $(LINK_OPTS) $(SPIT_OBJECTS) $(STDIO) -o spit
|
||||
# $(CHMOD_7) spit
|
||||
# $(MV) spit $(SPIT)
|
||||
# $(TOUCH) spit
|
||||
# $(CHMOD_6) spit
|
||||
|
||||
spit.exe: $(SPIT_OBJECTS)
|
||||
-$(RM) spit.exe
|
||||
$(CC) $(LINK_OPTS) $(O_EXE_SWITCH)spit \
|
||||
$(SPIT_OBJECTS) $(GDSSHR_LINK)
|
||||
$(MV) spit.exe $(SPIT)
|
||||
$(RM) spit.exe
|
||||
$(TOUCH) spit.exe
|
||||
|
||||
|
||||
#$(OBJS)/dbs/empty.gdb.dummy: force
|
||||
# $(CD) $(OBJS)/dbs && $(MAKE) empty.gdb.dummy
|
||||
|
||||
debug: $(BURP_OBJECTS) $(GDSLIB_BACKEND)
|
||||
$(CXX) $(LINK_OPTS) $(CXX_INCLUDE_DIRS) -g $(BURP_OBJECTS) -o burp_dbg $(GDSLIB_LINK)
|
||||
|
||||
debug_nt: $(BURP_OBJECTS)
|
||||
$(CXX) $(DEBUG_LINK_OPTS) $(CXX_INCLUDE_DIRS) $(O_EXE_SWITCH)burp_dbg $(BURP_OBJECTS) $(GDSLIB_LINK)
|
||||
|
||||
$(OBJS)/jrd/jrd_static.a:
|
||||
$(CD) $(OBJS)/jrd && $(MAKE) $@
|
||||
|
||||
all.o: all.cpp $(QLI_HEADERS)
|
||||
backup.cpp: yachts.lnk backup.epp
|
||||
backup.o: backup.cpp burp.h \
|
||||
backu_proto.h burp_proto.h canon_proto.h mvol_proto.h \
|
||||
$(SOURCE)/remote/protocol.h \
|
||||
$(SOURCE)/jrd/align.h
|
||||
burp.h: $(SOURCE)/jrd/dsc.h
|
||||
# $(TOUCH) burp.h
|
||||
burp.o: burp.cpp burp.h \
|
||||
burp_proto.h backu_proto.h mvol_proto.h resto_proto.h \
|
||||
$(SOURCE)/jrd/license.h $(SOURCE)/jrd/why_proto.h
|
||||
canonical.o: canonical.cpp burp.h \
|
||||
canon_proto.h \
|
||||
$(SOURCE)/remote/remote.h $(SOURCE)/jrd/sdl.h $(SOURCE)/jrd/align.h
|
||||
spit.o: spit.cpp spit.h
|
||||
misc.o: misc.cpp burp.h \
|
||||
burp_proto.h misc_proto.h
|
||||
mvol.o: mvol.cpp burp.h \
|
||||
burp_proto.h mvol_proto.h \
|
||||
$(SOURCE)/jrd/gds_proto.h
|
||||
restore.cpp: yachts.lnk restore.epp
|
||||
restore.o: restore.cpp burp.h \
|
||||
burp_proto.h canon_proto.h misc_proto.h mvol_proto.h \
|
||||
resto_proto.h \
|
||||
$(SOURCE)/jrd/align.h $(SOURCE)/jrd/flags.h \
|
||||
$(SOURCE)/jrd/obj.h $(SOURCE)/remote/protocol.h
|
||||
|
||||
$(GDSSHR) $(GDSLIB_BACKEND) $(JRD_LINK):
|
||||
$(CD) $(OBJS)/jrd && $(MAKE) ALT_O="alt.o.ps1" ALT_BIN="alt.bin.ps1" SECURITY_MISC="" SECURITY_P_MISC="" CFLAGS="$(CFLAGS)" SYSTEM="$(SYSTEM)" $(@F)
|
||||
$(REMOTE_LINK) remote_dummy:
|
||||
$(CD) $(OBJS)/remote && $(MAKE) CFLAGS="$(CFLAGS)" SYSTEM="$(SYSTEM)" $(@F)
|
||||
|
||||
force:
|
||||
|
||||
# This entry is used to programatically update the include file dependencies
|
||||
# for all *.c files in the current directory.
|
||||
#
|
||||
# Note that it is specific to Solaris by using the -xM1 compiler option.
|
||||
# This option has CC generate dependency lines for the makefile - but
|
||||
# does not generate object files.
|
||||
# It is likely that a similar option exists on other platforms.
|
||||
#
|
||||
# It is recommended that depends.mak be created on a platform
|
||||
# that supports such an option. depends.mak is not platform dependent, it uses
|
||||
# the standard makefile output format, as can be copied to platforms
|
||||
# that don't have a -xM1 feature in the c compiler.
|
||||
#
|
||||
depends.mak:
|
||||
-$(RM) depends.out
|
||||
-$(CC) $(CFLAGS) -xM1 *.c 1>&2 > depends.out
|
||||
-$(RM) depends.mak
|
||||
$(ECHO) "# depends.mak - burp" > depends.mak
|
||||
$(ECHO) "# Created by 'make depends.mak'" >> depends.mak
|
||||
date "+# Created on %Y-%m-%d" >> depends.mak
|
||||
sed -e "s:source/[a-z/]*/source:source:g" -e "s:source/burp/::g"\
|
||||
depends.out |sort|uniq >> depends.mak
|
||||
-$(RM) depends.out
|
||||
|
||||
# In the event that a platform does not support the make directive "include" -
|
||||
# concatenate "depends.mak" with the makefile.
|
||||
#
|
||||
#include depends.mak
|
||||
|
||||
-include $(Dependencies)
|
||||
|
@ -26,7 +26,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: Makefile.in.dudley,v 1.1 2001-07-29 23:43:23 skywalker Exp $
|
||||
# $Id: Makefile.in.dudley,v 1.2 2001-08-01 08:11:52 skywalker Exp $
|
||||
#
|
||||
|
||||
ROOT=../..
|
||||
@ -42,168 +42,30 @@ unexport ISC_USER
|
||||
unexport ISC_PASSWORD
|
||||
|
||||
|
||||
DUDLEY_OBJECTS= ddl.o exe.o expand.o expr.o extract.o generate.o \
|
||||
hsh.o lex.o parse.o trn.o
|
||||
DUDLEY_Sources= ddl.cpp exe.cpp expand.cpp expr.cpp extract.cpp generate.cpp \
|
||||
hsh.cpp lex.cpp parse.cpp trn.cpp
|
||||
|
||||
# Ok this ones a hack, but it's late...
|
||||
#OTHER_OBJECTS=../gpre/pretty.o
|
||||
DUDLEY_Objects = $(DUDLEY_Sources:%.cpp=$(OBJ)/%.o)
|
||||
|
||||
AllObjects = $(DUDLEY_Objects)
|
||||
|
||||
Dependencies = $(AllObjects:.o=.d)
|
||||
|
||||
|
||||
all: gdef
|
||||
|
||||
gdef: $(BIN)/gdef
|
||||
|
||||
$(BIN)/gdef: $(DUDLEY_OBJECTS) $(LIBGDS_LA)
|
||||
$(BIN)/gdef: $(DUDLEY_Objects) $(LIBGDS_LA)
|
||||
$(CXX) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
exe.cpp: yachts.lnk exe.epp
|
||||
|
||||
$(SRC)/exe.cpp $(SRC)/extract.epp: yachts.lnk
|
||||
|
||||
yachts.lnk:
|
||||
ln -fs ../refDatabases/empty.gdb yachts.lnk
|
||||
ln -fs (SRC_ROOT)/refDatabases/empty.gdb yachts.lnk
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# If you add any more Objects from other components in this makefile,
|
||||
# please create an action rule for the object below.
|
||||
# For eg: see the rule for $(JRD_LINK)
|
||||
ISC_LINK= $(OBJS)/jrd/isc.o
|
||||
JRD_LINK= $(OBJS)/jrd/isc_file.o $(OBJS)/jrd/llio.o $(OBJS)/jrd/misc.o $(OBJS)/jrd/iberr.o
|
||||
GPRE_LINK= $(OBJS)/gpre/pretty.o
|
||||
WALF_LINK= $(OBJS)/wal/walf.o
|
||||
|
||||
|
||||
DDL_LINK_OBJECTS= $(DUDLEY_OBJECTS) $(ISC_LINK) $(JRD_LINK) $(GPRE_LINK) \
|
||||
$(WALF_LINK)
|
||||
|
||||
all: dudley$(EXEC_EXT)
|
||||
|
||||
# JMB $(ISC_LINK) already in shared library
|
||||
# JMB $(JRD_LINK) already in shared library
|
||||
# JMB $(WALF_LINK) already in shared library
|
||||
dudley: ddllib.a $(DDL_LINK_OBJECTS) $(GDSSHR)
|
||||
-$(RM) dudley
|
||||
$(CXX) $(LINK_OPTS) $(DUDLEY_OBJECTS) \
|
||||
$(GPRE_LINK) -o dudley $(GDSSHR_LINK)
|
||||
$(CHMOD_7) dudley
|
||||
$(MV) dudley $(DUDLEY)
|
||||
$(TOUCH) dudley
|
||||
$(CHMOD_6) dudley
|
||||
|
||||
dudley.exe: ddllib.lib $(DDL_LINK_OBJECTS)
|
||||
-$(RM) dudley.exe dudley.rsp
|
||||
$(ECHO) $(DUDLEY_OBJECTS) > dudley.rsp
|
||||
$(ECHO) $(JRD_LINK) $(GPRE_LINK) $(WALF_LINK) \
|
||||
>> dudley.rsp
|
||||
$(CXX) $(LINK_OPTS) $(O_EXE_SWITCH)dudley \
|
||||
@dudley.rsp $(GDSSHR_LINK) $(ADVAPILIB) $(MPRLIB)
|
||||
$(MV) dudley.exe $(DUDLEY)
|
||||
$(RM) dudley.exe dudley.rsp
|
||||
$(TOUCH) dudley.exe
|
||||
|
||||
ddllib.a: $(DUDLEY_OBJECTS)
|
||||
-rm -f ddllib.a
|
||||
$(AR) ddllib.a $(DUDLEY_OBJECTS)
|
||||
-ranlib ddllib.a
|
||||
|
||||
ddllib.lib: $(DUDLEY_OBJECTS)
|
||||
-$(RM) ddllib.lib
|
||||
$(IMPLIB) -out:ddllib.lib $(DUDLEY_OBJECTS)
|
||||
$(TOUCH) ddllib.lib
|
||||
|
||||
debug: $(DUDLEY_OBJECTS) $(GPRE_LINK) $(GDSLIB)
|
||||
$(CXX) $(LINK_OPTS) -g $(DUDLEY_OBJECTS) $(GPRE_LINK) -o dudley_dbg $(GDSLIB_LINK)
|
||||
|
||||
debug_nt: $(DUDLEY_OBJECTS) $(GPRE_LINK)
|
||||
$(CXX) $(DEBUG_LINK_OPTS) $(O_EXE_SWITCH)dudley_dbg $(DUDLEY_OBJECTS) $(GPRE_LINK) $(GDSLIB_LINK)
|
||||
|
||||
ddl.h: $(SOURCE)/jrd/dsc.h
|
||||
# $(TOUCH) ddl.h
|
||||
ddl.o: ddl.cpp ddl.h \
|
||||
ddl_proto.h exe_proto.h expan_proto.h extra_proto.h \
|
||||
hsh_proto.h lex_proto.h parse_proto.h trn_proto.h \
|
||||
$(SOURCE)/jrd/license.h $(SOURCE)/jrd/gds_proto.h
|
||||
exe.o: exe.cpp ddl.h \
|
||||
ddl_proto.h exe_proto.h gener_proto.h hsh_proto.h \
|
||||
lex_proto.h \
|
||||
$(SOURCE)/jrd/license.h $(SOURCE)/jrd/flags.h \
|
||||
$(SOURCE)/jrd/acl.h $(SOURCE)/jrd/intl.h $(SOURCE)/jrd/obj.h \
|
||||
$(SOURCE)/jrd/gds_proto.h $(SOURCE)/jrd/isc_f_proto.h \
|
||||
$(SOURCE)/wal/walf_proto.h
|
||||
$(CXX) -c $(CFLAGS) $(CXX_INCLUDE_DIRS) $(VERSION_FLAG) $<
|
||||
expand.o: expand.cpp ddl.h parse.h \
|
||||
expan_proto.h ddl_proto.h hsh_proto.h parse_proto.h \
|
||||
$(SOURCE)/jrd/gds_proto.h
|
||||
expr.o: expr.cpp ddl.h parse.h $(SOURCE)/jrd/acl.h $(SOURCE)/jrd/intl.h \
|
||||
ddl_proto.h expr_proto.h lex_proto.h parse_proto.h
|
||||
extract.cpp: yachts.lnk extract.epp
|
||||
extract.o: extract.cpp ddl.h \
|
||||
ddl_proto.h extra_proto.h \
|
||||
$(SOURCE)/jrd/acl.h $(SOURCE)/jrd/flags.h \
|
||||
$(SOURCE)/jrd/obj.h $(SOURCE)/jrd/gds_proto.h $(SOURCE)/wal/wal.h
|
||||
generate.o: generate.cpp ddl.h \
|
||||
ddl_proto.h gener_proto.h trn_proto.h \
|
||||
$(SOURCE)/jrd/acl.h $(SOURCE)/jrd/gds_proto.h
|
||||
hsh.o: hsh.cpp ddl.h parse.h \
|
||||
ddl_proto.h hsh_proto.h
|
||||
lex.o: lex.cpp ddl.h parse.h \
|
||||
ddl_proto.h hsh_proto.h lex_proto.h \
|
||||
$(SOURCE)/jrd/gds_proto.h
|
||||
parse.o: parse.cpp ddl.h parse.h \
|
||||
exe_proto.h expr_proto.h hsh_proto.h lex_proto.h \
|
||||
parse_proto.h \
|
||||
$(SOURCE)/jrd/acl.h $(SOURCE)/jrd/flags.h \
|
||||
$(SOURCE)/wal/wal.h $(SOURCE)/jrd/isc_f_proto.h
|
||||
$(CXX) -c $(CFLAGS) $(CXX_INCLUDE_DIRS) $(VERSION_FLAG) $<
|
||||
trn.o: trn.cpp ddl.h \
|
||||
gener_proto.h lex_proto.h trn_proto.h \
|
||||
$(SOURCE)/jrd/license.h $(SOURCE)/jrd/gds_proto.h \
|
||||
$(SOURCE)/jrd/gdsassert.h \
|
||||
$(SOURCE)/gpre/prett_proto.h
|
||||
|
||||
|
||||
$(OBJS)/dbs/empty.gdb: force
|
||||
$(CD) $(OBJS)/dbs && $(MAKE) empty.gdb
|
||||
|
||||
$(GDSSHR) $(GDSLIB) $(JRD_LINK) $(ISC_LINK):
|
||||
$(CD) $(OBJS)/jrd && $(MAKE) ALT_O="alt.o.ps1" ALT_BIN="alt.bin.ps1" SECURITY_MISC="" SECURITY_P_MISC="" $(@F)
|
||||
|
||||
$(GPRE_LINK):
|
||||
$(CD) $(OBJS)/gpre && $(MAKE) $(@F)
|
||||
|
||||
$(WALF_LINK):
|
||||
$(CD) $(OBJS)/wal && $(MAKE) $(@F)
|
||||
|
||||
force:
|
||||
|
||||
# This entry is used to programatically update the include file dependencies
|
||||
# for all *.c files in the current directory.
|
||||
#
|
||||
# Note that it is specific to Solaris by using the -xM1 compiler option.
|
||||
# This option has CC generate dependency lines for the makefile - but
|
||||
# does not generate object files.
|
||||
# It is likely that a similar option exists on other platforms.
|
||||
#
|
||||
# It is recommended that depends.mak be created on a platform
|
||||
# that supports such an option. depends.mak is not platform dependent, it uses
|
||||
# the standard makefile output format, as can be copied to platforms
|
||||
# that don't have a -xM1 feature in the c compiler.
|
||||
#
|
||||
depends.mak:
|
||||
-$(RM) depends.out
|
||||
-$(CC) $(CFLAGS) -xM1 *.c 1>&2 > depends.out
|
||||
-$(RM) depends.mak
|
||||
$(ECHO) "# depends.mak - dudley" > depends.mak
|
||||
$(ECHO) "# Created by 'make depends.mak'" >> depends.mak
|
||||
date "+# Created on %Y-%m-%d" >> depends.mak
|
||||
sed -e "s:source/[a-z/]*/source:source:g" -e "s:source/dudley/::g"\
|
||||
depends.out |sort|uniq >> depends.mak
|
||||
-$(RM) depends.out
|
||||
|
||||
# In the event that a platform does not support the make directive "include" -
|
||||
# concatenate "depends.mak" with the makefile.
|
||||
#
|
||||
#include depends.mak
|
||||
|
||||
-include $(Dependencies)
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
@ -27,7 +26,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: Makefile.in.intl,v 1.1 2001-07-29 23:43:23 skywalker Exp $
|
||||
# $Id: Makefile.in.intl,v 1.2 2001-08-01 08:11:52 skywalker Exp $
|
||||
#
|
||||
|
||||
ROOT=../..
|
||||
@ -39,32 +38,36 @@ include $(ROOT)/src/make.shared.variables
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
INTL_OBJECTS1= ld.o cv_narrow.o \
|
||||
cs_narrow.o lc_ascii.o lc_narrow.o lc_latin1.o lc_dos.o \
|
||||
cs_unicode.o lc_unicode.o \
|
||||
cs_utffss.o \
|
||||
cs_big5.o cv_big5.o lc_big5.o \
|
||||
cs_gb2312.o cv_gb2312.o lc_gb2312.o \
|
||||
cs_jis.o cv_jis.o lc_jis.o \
|
||||
cs_ksc.o cv_ksc.o lc_ksc.o
|
||||
INTL_Sources1= ld.c cv_narrow.c \
|
||||
cs_narrow.c lc_ascii.c lc_narrow.c lc_latin1.c lc_dos.c \
|
||||
cs_unicode.c lc_unicode.c \
|
||||
cs_utffss.c \
|
||||
cs_big5.c cv_big5.c lc_big5.c \
|
||||
cs_gb2312.c cv_gb2312.c lc_gb2312.c \
|
||||
cs_jis.c cv_jis.c lc_jis.c \
|
||||
cs_ksc.c cv_ksc.c lc_ksc.c
|
||||
|
||||
INTL_OBJECTS2= ld2.o
|
||||
INTL_OBJECTS= $(INTL_OBJECTS1) $(INTL_OBJECTS2)
|
||||
INTL_Sources2= ld2.c
|
||||
|
||||
INTL_Objects1 = $(INTL_Sources1:%.c=$(OBJ)/%.o)
|
||||
INTL_Objects2 = $(INTL_Sources2:%.c=$(OBJ)/%.o)
|
||||
|
||||
# ld2.cpp contains the lookup that is used if the objects are in the same
|
||||
# library as the libgds.a (or .so).
|
||||
|
||||
|
||||
|
||||
#
|
||||
INTL_P_OBJECTS1=$(INTL_OBJECTS1:%.o=%.lo)
|
||||
AllObjects= $(INTL_Objects1) $(INTL_Objects2)
|
||||
|
||||
Dependencies = $(AllObjects:.o=.d)
|
||||
|
||||
|
||||
INTL_DIR = $(FIREBIRD)/intl
|
||||
|
||||
INTL_DIR = $(INTERBASE)/intl
|
||||
|
||||
intl: $(LIBGDSINTL_LA)
|
||||
|
||||
$(LIBGDSINTL_LA) : $(INTL_OBJECTS1)
|
||||
$(LIBGDSINTL_LA) : $(INTL_Objects1)
|
||||
$(LIB_LINK) $(LIB_LINK_OPTIONS) -o$(LIBGDSINTL_LA) $(^:.o=.lo)
|
||||
|
||||
|
||||
@ -75,3 +78,4 @@ $(LIBGDSINTL_LA) : $(INTL_OBJECTS1)
|
||||
# MOD 26-July-2001
|
||||
|
||||
|
||||
-include $(Dependencies)
|
||||
|
@ -26,7 +26,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: Makefile.in.isql,v 1.1 2001-07-29 23:43:23 skywalker Exp $
|
||||
# $Id: Makefile.in.isql,v 1.2 2001-08-01 08:11:52 skywalker Exp $
|
||||
#
|
||||
|
||||
ROOT=../..
|
||||
@ -50,44 +50,58 @@ unexport ISC_PASSWORD
|
||||
all: isql
|
||||
|
||||
|
||||
ISQL_Sources= extract.cpp isql.cpp show.cpp
|
||||
|
||||
ISQL_OBJECTS= extract.o isql.o show.o
|
||||
ISQL_Objects = $(ISQL_Sources:%.cpp=$(OBJ)/%.o)
|
||||
|
||||
|
||||
isql: $(BIN)/isql
|
||||
AllObjects = $(ISQL_Objects)
|
||||
|
||||
Dependencies = $(AllObjects:.o=.d)
|
||||
|
||||
|
||||
#$(BIN)/isql: $(ISQL_OBJECTS) $(LIBGDS_LA)
|
||||
# $(LIBTOOL) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
# $(CXX) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
# $(CHMOD_7) $@
|
||||
all: isql # muisql
|
||||
|
||||
$(BIN)/isql: $(ISQL_OBJECTS) $(LIBGDS_LA)
|
||||
isql: $(ISQL)
|
||||
|
||||
|
||||
|
||||
$(ISQL): $(ISQL_Objects) $(LIBGDS_LA)
|
||||
$(EXE_LINK) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
extract.cpp: yachts.lnk extract.epp
|
||||
|
||||
# muisql - is a special compile mode for tcs system.
|
||||
# it needs special mu library and special compile of isql
|
||||
# I have left all this here in case anyone want it.
|
||||
# but it's not part of the main build
|
||||
|
||||
muisql: $(MUISQL)
|
||||
|
||||
$(MUISQL): $(ISQL_Objects) $(LIBGDS_LA)
|
||||
$(EXE_LINK) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
# Again this wants to change to $(GEN_SRC) directory
|
||||
|
||||
$(SRC)/extract.cpp $(SRC)/isql.cpp $(SRC)/show.cpp : yachts.lnk
|
||||
|
||||
yachts.lnk:
|
||||
ln -sf ../refDatabases/empty.gdb yachts.lnk
|
||||
ln -sf $(SRC_ROOT)/refDatabases/empty.gdb yachts.lnk
|
||||
|
||||
|
||||
|
||||
|
||||
ISQL_LINK_OBJS= $(ISQL_OBJECTS)
|
||||
JRD_LINK=
|
||||
|
||||
MUISQL_LINK_OBJS= extract.o muisql.o show.o
|
||||
|
||||
|
||||
#isql: isqllib.a $(ISQL_OBJECTS) $(GDSSHR)
|
||||
# -$(RM) isql
|
||||
# $(CXX) $(LINK_OPTS) $(ISQL_LINK_OBJS) -o isql $(GDSSHR_LINK) -lm
|
||||
# $(CHMOD_7) isql
|
||||
# $(MV) isql $(ISQL)
|
||||
# $(TOUCH) isql
|
||||
# $(CHMOD_6) isql
|
||||
#muisql.o: isql.cpp
|
||||
# $(CXX) -c $(CFLAGS) $(CXX_INCLUDE_DIRS) $(VERSION_FLAG) -DMU_ISQL $< -o $@
|
||||
#
|
||||
#
|
||||
#ISQL_LINK_OBJS= $(ISQL_OBJECTS)
|
||||
#JRD_LINK=
|
||||
#
|
||||
#MUISQL_LINK_OBJS= extract.o muisql.o show.o
|
||||
#
|
||||
#
|
||||
|
||||
muisql: isql muisql.o
|
||||
-$(RM) muisql
|
||||
@ -97,11 +111,6 @@ muisql: isql muisql.o
|
||||
-$(TOUCH) muisql
|
||||
-$(CHMOD_6) muisql
|
||||
|
||||
isql.cpp: yachts.lnk isql.epp
|
||||
show.cpp: yachts.lnk show.epp
|
||||
|
||||
|
||||
muisql.o: isql.cpp
|
||||
$(CXX) -c $(CFLAGS) $(CXX_INCLUDE_DIRS) $(VERSION_FLAG) -DMU_ISQL $< -o $@
|
||||
|
||||
|
||||
-include $(Dependencies)
|
||||
|
@ -26,7 +26,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: Makefile.in.msgs,v 1.1 2001-07-29 23:43:23 skywalker Exp $
|
||||
# $Id: Makefile.in.msgs,v 1.2 2001-08-01 08:11:52 skywalker Exp $
|
||||
#
|
||||
|
||||
ROOT=../..
|
||||
@ -45,143 +45,105 @@ unexport ISC_PASSWORD
|
||||
.PHONY: msgs
|
||||
|
||||
|
||||
CHECK_OBJECTS = check_msgs.o
|
||||
BUILD_OBJECTS = build_file.o
|
||||
ENTER_OBJECTS = enter_msgs.o
|
||||
MODIFY_OBJECTS = modify_msgs.o
|
||||
CHANGE_OBJECTS = change_msgs.o
|
||||
|
||||
|
||||
AllObjects = $(CHECK_OBJECTS) $(BUILD_OBJECTS) $(ENTER_OBJECTS) \
|
||||
$(MODIFY_OBJECTS) $(CHANGE_OBJECTS)
|
||||
|
||||
Dependencies = $(AllObjects:.o=.d)
|
||||
|
||||
|
||||
all: $(Programs)
|
||||
|
||||
Programs = $(BUILD_FILE) $(CHECK_MESSAGES) $(ENTER_MESSAGES) \
|
||||
$(CHECK_MESSAGES) $(MODIFY_MESSAGES) $(CHANGE_MESSAGES)
|
||||
|
||||
msgs: msg.gdb $(Programs) do_check message_file
|
||||
|
||||
|
||||
Programs = $(BIN)/check_messages $(BIN)/build_file
|
||||
|
||||
|
||||
do_check: $(Programs)
|
||||
$(BIN)/check_messages -d $(MSGSDIR)master_msg_db -l
|
||||
do_check: $(CHECK_MESSAGES) $(BUILD_FILE)
|
||||
$(CHECK_MESSAGES) -d $(MSGSDIR)master_msg_db -l
|
||||
|
||||
|
||||
|
||||
CHECK_OBJECTS= check_msgs.o
|
||||
|
||||
$(BIN)/check_messages: $(CHECK_OBJECTS) $(LIBGDS_LA)
|
||||
$(EXE_LINK) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
BUILD_OBJECTS=build_file.o
|
||||
|
||||
$(BIN)/build_file: $(BUILD_OBJECTS) $(LIBGDS_LA)
|
||||
$(CHECK_MESSAGES): $(CHECK_OBJECTS) $(LIBGDS_LA)
|
||||
$(EXE_LINK) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
|
||||
message_file : $(INTERBASE)/interbase.msg
|
||||
|
||||
$(FIREBIRD)/interbase.msg : $(Programs) indicator.msg
|
||||
$(BIN)/build_file -d $(MSGSDIR)master_msg_db -f $(INTERBASE)/interbase.msg
|
||||
$(CHMOD_6) $(INTERBASE)/interbase.msg
|
||||
$(BUILD_FILE): $(BUILD_OBJECTS) $(LIBGDS_LA)
|
||||
$(EXE_LINK) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
$(ENTER_MESSAGES): $(ENTER_OBJECTS) $(LIBGDS_LA)
|
||||
$(EXE_LINK) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
$(MODIFY_MESSAGES): $(MODIFY_OBJECTS) $(LIBGDS_LA)
|
||||
$(EXE_LINK) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
$(CHANGE_MESSAGES): $(CHANGE_OBJECTS) $(LIBGDS_LA)
|
||||
$(EXE_LINK) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_7) $@
|
||||
|
||||
|
||||
|
||||
message_file : $(FIREBIRD)/interbase.msg
|
||||
|
||||
$(INTERBASE_MSG) : $(BUILD_FILE) indicator.msg
|
||||
$(BIN)/build_file -d $(MSGSDIR)master_msg_db -f $@
|
||||
$(CHMOD_6) $@
|
||||
|
||||
|
||||
indicator.msg indicator.incl:
|
||||
$(BIN)/check_messages -d $(MSGSDIR)master_msg_db
|
||||
$(CHECK_MESSAGES) -d $(MSGSDIR)master_msg_db
|
||||
|
||||
indicator.loc:
|
||||
$(BIN)/check_messages -d $(MSGSDIR)master_msg_db -l
|
||||
|
||||
#build_file: build_file.o
|
||||
# -$(RM) build_file
|
||||
# $(CXX) $(LINK_OPTS) build_file.o -o build_file $(GDSSHR_LINK)
|
||||
# $(CHMOD_7) build_file
|
||||
|
||||
|
||||
$(CHECK_MESSAGES) -d $(MSGSDIR)master_msg_db -l
|
||||
|
||||
|
||||
msg.gdb:
|
||||
ln -fs ../refDatabases/msg.gdb msg.gdb
|
||||
ln -fs ../refDatabases/msg.gdb master_msg_db
|
||||
ln -fs $(SRC_ROOT)/refDatabases/msg.gdb msg.gdb
|
||||
ln -fs $(SRC_ROOT)/refDatabases/msg.gdb master_msg_db
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
all: build_file$(EXEC_EXT) check_messages$(EXEC_EXT) \
|
||||
enter_messages$(EXEC_EXT) modify_messages$(EXEC_EXT) \
|
||||
change_messages$(EXEC_EXT)
|
||||
|
||||
|
||||
LOCALES=
|
||||
|
||||
|
||||
# I know nother about these other than the default being set to none. I
|
||||
# assume that as we get into it someone will want to use them and fix the
|
||||
# following.
|
||||
|
||||
# potential locals are $(fr_FR_MSG) $(de_DE_MSG) $(ja_JA_MSG)
|
||||
|
||||
LOCALES=
|
||||
|
||||
msgs_intl locales.msg: $(LOCALES)
|
||||
|
||||
|
||||
fr_FR.msg: build_file$(EXEC_EXT) indicator.msg indicator.loc
|
||||
-$(RM) fr_FR.msg $(OBJS)/ifirebird/intl/fr_FR.msg
|
||||
./build_file -d $(MSGSDIR)master_msg_db \
|
||||
-l fr_FR \
|
||||
-p $(OBJS)/firebird/intl
|
||||
$(TOUCH) fr_FR.msg
|
||||
$(CHMOD_6) fr_FR.msg $(OBJS)/firebird/intl/fr_FR.msg
|
||||
$(fr_FR_MSG) : $(BUILD_FILE) indicator.msg
|
||||
$(BIN)/build_file -d $(MSGSDIR)master_msg_db -l fr_FR -f $@
|
||||
$(CHMOD_6) $@
|
||||
|
||||
de_DE.msg: build_file$(EXEC_EXT) indicator.msg indicator.loc
|
||||
-$(RM) de_DE.msg source/interbase/intl/de_DE.msg
|
||||
./build_file -d $(MSGSDIR)master_msg_db \
|
||||
-l de_DE \
|
||||
-p source/interbase/intl
|
||||
$(TOUCH) de_DE.msg
|
||||
$(CHMOD_6) de_DE.msg source/interbase/intl/de_DE.msg
|
||||
|
||||
ja_JP_EUC.msg: build_file$(EXEC_EXT) indicator.msg indicator.loc
|
||||
-$(RM) ja_JP_EUC.msg source/interbase/intl/ja_JP_EUC.msg
|
||||
./build_file -d $(MSGSDIR)master_msg_db \
|
||||
-l ja_JP.EUC \
|
||||
-p source/interbase/intl
|
||||
$(TOUCH) ja_JP_EUC.msg
|
||||
$(CHMOD_6) ja_JP_EUC.msg source/interbase/intl/ja_JP_EUC.msg
|
||||
$(de_DE_MSG) : $(BUILD_FILE) indicator.msg
|
||||
$(BIN)/build_file -d $(MSGSDIR)master_msg_db -l de_DE -f $@
|
||||
$(CHMOD_6) $@
|
||||
|
||||
|
||||
|
||||
enter_messages: enter_msgs.o $(GDSSHR)
|
||||
-$(RM) enter_messages
|
||||
$(CC) $(LINK_OPTS) enter_msgs.o -o enter_messages $(GDSSHR_LINK)
|
||||
$(CHMOD_7) enter_messages
|
||||
|
||||
modify_messages: modify_msgs.o $(GDSSHR)
|
||||
-$(RM) modify_messages
|
||||
$(CC) $(LINK_OPTS) modify_msgs.o -o modify_messages $(GDSSHR_LINK)
|
||||
$(CHMOD_7) modify_messages
|
||||
|
||||
change_messages: change_msgs.o $(GDSSHR)
|
||||
-$(RM) change_messages
|
||||
$(CC) $(LINK_OPTS) change_msgs.o -o change_messages $(GDSSHR_LINK)
|
||||
$(CHMOD_7) change_messages
|
||||
|
||||
build_file.exe: build_file.o
|
||||
-$(RM) build_file.exe
|
||||
$(CC) $(LINK_OPTS) $(O_EXE_SWITCH)build_file build_file.o $(GDSSHR_LINK)
|
||||
$(CHMOD_7) build_file.exe
|
||||
|
||||
check_messages.exe: check_msgs.o
|
||||
-$(RM) check_messages.exe
|
||||
$(CC) $(LINK_OPTS) $(O_EXE_SWITCH)check_messages check_msgs.o $(GDSSHR_LINK)
|
||||
$(CHMOD_7) check_messages.exe
|
||||
|
||||
enter_messages.exe: enter_msgs.o
|
||||
-$(RM) enter_messages.exe
|
||||
$(CC) $(LINK_OPTS) $(O_EXE_SWITCH)enter_messages enter_msgs.o $(GDSSHR_LINK)
|
||||
$(CHMOD_7) enter_messages.exe
|
||||
|
||||
modify_messages.exe: modify_msgs.o
|
||||
-$(RM) modify_messages.exe
|
||||
$(CC) $(LINK_OPTS) $(O_EXE_SWITCH)modify_messages modify_msgs.o $(GDSSHR_LINK)
|
||||
$(CHMOD_7) modify_messages.exe
|
||||
|
||||
change_messages.exe: change_msgs.o
|
||||
-$(RM) change_messages.exe
|
||||
$(CC) $(LINK_OPTS) $(O_EXE_SWITCH)change_messages change_msgs.o $(GDSSHR_LINK)
|
||||
$(CHMOD_7) change_messages.exe
|
||||
$(ja_JA_MSG) : $(BUILD_FILE) indicator.msg
|
||||
$(BIN)/build_file -d $(MSGSDIR)master_msg_db -l ja_JA -f $@
|
||||
$(CHMOD_6) $@
|
||||
|
||||
|
||||
-include $(Dependencies)
|
||||
|
@ -26,7 +26,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: Makefile.in.qli,v 1.1 2001-07-29 23:43:23 skywalker Exp $
|
||||
# $Id: Makefile.in.qli,v 1.2 2001-08-01 08:11:52 skywalker Exp $
|
||||
#
|
||||
|
||||
ROOT=../..
|
||||
@ -38,6 +38,20 @@ include $(ROOT)/src/make.shared.variables
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
QLI_Sources= all.cpp command.cpp compile.cpp dtr.cpp err.cpp eval.cpp \
|
||||
expand.cpp exe.cpp noform.cpp format.cpp gener.cpp help.cpp \
|
||||
hsh.cpp lex.cpp meta.cpp mov.cpp parse.cpp picstr.cpp proc.cpp \
|
||||
report.cpp show.cpp
|
||||
|
||||
QLI_Objects = $(QLI_Sources:%.cpp=$(OBJ)/%.o)
|
||||
|
||||
AllObjects = $(QLI_Objects)
|
||||
|
||||
Dependencies = $(AllObjects:.o=.d)
|
||||
|
||||
|
||||
|
||||
.PHONY: allx qli
|
||||
|
||||
|
||||
@ -47,14 +61,9 @@ allx: qli # allx is used since there is a local all.cpp file.
|
||||
# qli
|
||||
#
|
||||
#
|
||||
|
||||
QLI_OBJECTS= all.o command.o compile.o dtr.o err.o eval.o expand.o exe.o \
|
||||
noform.o format.o gener.o help.o hsh.o lex.o meta.o \
|
||||
mov.o parse.o picstr.o proc.o report.o show.o
|
||||
|
||||
qli : $(QLI)
|
||||
|
||||
$(QLI): $(QLI_OBJECTS) $(LIBGDS_LA)
|
||||
$(QLI): $(QLI_Objects) $(LIBGDS_LA)
|
||||
$(CXX) $(LINK_OPTS) $^ -o $@ $(LINK_LIBS)
|
||||
$(CHMOD_S7) $@
|
||||
|
||||
@ -66,10 +75,9 @@ $(QLI): $(QLI_OBJECTS) $(LIBGDS_LA)
|
||||
# need to be rebuilt here.
|
||||
|
||||
|
||||
meta.cpp: yachts.lnk meta.epp
|
||||
proc.cpp: yachts.lnk proc.epp
|
||||
show.cpp: yachts.lnk show.epp
|
||||
help.cpp: help.gdb help.epp
|
||||
# These need to change to $(GEN_SRC) at some stage
|
||||
$(SRC)/meta.cpp $(SRC)/proc.cpp $(SRC)/show.cpp: yachts.lnk
|
||||
$(SRC)/help.cpp: help.gdb
|
||||
|
||||
|
||||
yachts.lnk:
|
||||
@ -79,5 +87,5 @@ help.gdb:
|
||||
ln -fs $(SRC_ROOT)/refDatabases/help.gdb help.gdb
|
||||
|
||||
|
||||
|
||||
-include $(Dependencies)
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: Makefile.in.utilities,v 1.3 2001-08-01 04:18:37 skywalker Exp $
|
||||
# $Id: Makefile.in.utilities,v 1.4 2001-08-01 08:11:52 skywalker Exp $
|
||||
#
|
||||
|
||||
ROOT=../..
|
||||
|
@ -26,7 +26,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
#
|
||||
# $Id: make.defaults,v 1.2 2001-08-01 04:18:37 skywalker Exp $
|
||||
# $Id: make.defaults,v 1.3 2001-08-01 08:11:52 skywalker Exp $
|
||||
#
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ EXEC_EXT=
|
||||
|
||||
# Final targets
|
||||
|
||||
|
||||
INSTALLDIR=@prefix@
|
||||
|
||||
|
||||
# From jrd
|
||||
@ -113,6 +113,7 @@ QLI = $(BIN)/qli$(EXEC_EXT)
|
||||
|
||||
# From isql
|
||||
ISQL = $(BIN)/isql$(EXEC_EXT)
|
||||
MUISQL = $(BIN)/muisql$(EXEC_EXT)
|
||||
|
||||
# From burp
|
||||
GBAK_STATIC = $(BIN)/gbak_static$(EXEC_EXT)
|
||||
@ -125,6 +126,21 @@ GPRE_STATIC = $(BIN)/gpre_static$(EXEC_EXT)
|
||||
GPRE = $(BIN)/gpre$(EXEC_EXT)
|
||||
GPRE_CURRENT = $(BIN)/gpre_current$(EXEC_EXT)
|
||||
|
||||
|
||||
# From msgs
|
||||
CHECK_MESSAGES = $(BIN)/check_messages$(EXEC_EXT)
|
||||
BUILD_FILE = $(BIN)/build_file$(EXEC_EXT)
|
||||
INTERBASE_MSG = $(FIREBIRD)/interbase.msg
|
||||
|
||||
ENTER_MESSAGES = $(BIN)/enter_messages$(EXEC_EXT)
|
||||
MODIFY_MESSAGES = $(BIN)/modify_messages$(EXEC_EXT)
|
||||
CHANGE_MESSAGES = $(BIN)/change_messages$(EXEC_EXT)
|
||||
|
||||
fr_FR_MSG = $(FIREBIRD)/fr_FR.msg
|
||||
de_DE_MSG = $(FIREBIRD)/de_DE.msg
|
||||
ja_JA_MSG = $(FIREBIRD)/ja_JA.msg
|
||||
|
||||
|
||||
# From intl
|
||||
LIBGDSINTL_LA = $(FIREBIRD)/intl/libgdsintl.so
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
DATABASE DB = "msg.gdb";
|
||||
|
||||
#define FAC_SQL_POSITIVE 14
|
||||
|
@ -1,901 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: adm.c
|
||||
* DESCRIPTION: Apollo Display Manager
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/scr.h"
|
||||
|
||||
#include <apollo/base.h>
|
||||
#include <apollo/gpr.h>
|
||||
#include <apollo/pad.h>
|
||||
#include <apollo/kbd.h>
|
||||
#include <apollo/error.h>
|
||||
#include "/sys/ins/smdu.ins.c"
|
||||
#include "/sys/ins/streams.ins.c"
|
||||
|
||||
#define KEYSET(keyset, key) keyset [7 - key / 32] |= 1 << (key % 32)
|
||||
#define CHECK_STATUS if (status.all) dsply_error (status)
|
||||
|
||||
static stream_$id_t stream;
|
||||
static status_$t status;
|
||||
static gpr_$bitmap_desc_t bitmap, fill_bitmap;
|
||||
static gpr_$attribute_desc_t fill_attributes;
|
||||
static gpr_$event_t locator_event = gpr_$locator;
|
||||
static boolean gpr_true = -1, gpr_false = 0;
|
||||
|
||||
static SCHAR beep[] = { 7 };
|
||||
static UCHAR special_keys[] = {
|
||||
KBD_$BS,
|
||||
KBD_$CR,
|
||||
KBD_$F1,
|
||||
KBD_$F2,
|
||||
KBD_$F3,
|
||||
KBD_$F4,
|
||||
KBD_$F5,
|
||||
KBD_$F6,
|
||||
KBD_$F7,
|
||||
KBD_$F1S, /* maps to C_PF8 */
|
||||
KBD_$F2S, /* maps to C_PF9 */
|
||||
KBD_$F9, /* ditto */
|
||||
KBD_$F8, /* maps to C_ENTER */
|
||||
KBD_$TAB,
|
||||
KBD_$RIGHT_ARROW,
|
||||
KBD_$LEFT_ARROW, /* cursor keys */
|
||||
KBD_$UP_ARROW,
|
||||
KBD_$DOWN_ARROW,
|
||||
KBD_$DOWN_BOX_ARROW2, /* maps to SCROLL_BOTTOM */
|
||||
KBD_$UP_BOX_ARROW2, /* maps to SCROLL_TOP */
|
||||
KBD_$NUMERIC_KEYPAD,
|
||||
KBD_$LINE_DEL, /* field editing */
|
||||
KBD_$CHAR_DEL, /* field editing */
|
||||
KBD_$INS_MODE1, /* field editing */
|
||||
KBD_$INS_MODE2, /* field editing */
|
||||
KBD_$L_BAR_ARROW, /* field editing */
|
||||
KBD_$R_BAR_ARROW, /* field editing */
|
||||
KBD_$EDIT, /* field editing */
|
||||
0
|
||||
};
|
||||
|
||||
static struct knm keyname_table[] = {
|
||||
{C_PF1, "<F1>"},
|
||||
{C_PF2, "<F2>"},
|
||||
{C_PF3, "<F3>"},
|
||||
{C_PF4, "<F4>"},
|
||||
{C_PF5, "<F5>"},
|
||||
{C_PF6, "<F6>"},
|
||||
{C_PF7, "<F7>"},
|
||||
{C_PF8, "<shift-F1>"},
|
||||
{C_PF9, "<F9> or <shift-F2>"},
|
||||
{C_ENTER, "<ENTER> or <F8>"},
|
||||
{C_LEFT, "<left arrow>"},
|
||||
{C_RIGHT, "<right arrow>"},
|
||||
{C_UP, "<up arrow>"},
|
||||
{C_DOWN, "<down arrow>"},
|
||||
{C_DELETE, "<BACKSPACE>"},
|
||||
{C_SCROLL_TOP, "<boxed up arrow> or <control-T>"},
|
||||
{C_SCROLL_BOTTOM, "<boxed down arrow> or <control-B>"},
|
||||
{C_ERASE, "<LINE DEL>"},
|
||||
{C_DELETE_NEXT, "<CHAR DEL>"},
|
||||
{C_INSERT_OVERSTRIKE, "<INS>"},
|
||||
{C_GOTO_START, "<left bar arrow>"},
|
||||
{C_GOTO_END, "<right bar arrow>"},
|
||||
{C_EDIT, "<EDIT>"},
|
||||
{(UCHAR) 0, "<unknown key>"},
|
||||
};
|
||||
|
||||
static int clear_window(), disable(), fini(), get_char(), text(),
|
||||
update_window();
|
||||
|
||||
static SCHAR pending_keystroke;
|
||||
static SSHORT button1_down = 0, button2_down = 0, button3_down = 0;
|
||||
static SSHORT text_reverse;
|
||||
static SSHORT char_width, char_height, char_offset, disabled;
|
||||
static SSHORT mouse_delta_width, mouse_delta_height;
|
||||
static gpr_$raster_op_t current_raster_op;
|
||||
|
||||
#define COND_ACQUIRE() acquire()
|
||||
#define COND_RELEASE() release()
|
||||
|
||||
|
||||
|
||||
ADM_create_window(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* A D M _ c r e a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create a new display window.
|
||||
*
|
||||
**************************************/
|
||||
gpr_$offset_t size;
|
||||
gpr_$position_t position;
|
||||
pad_$string_t font_name;
|
||||
pad_$window_desc_t window_desc;
|
||||
gpr_$event_t event;
|
||||
gpr_$keyset_t keyset;
|
||||
gpr_$display_config_t config;
|
||||
SSHORT font_name_length, font_id, n, x_size, y_size;
|
||||
SCHAR event_data;
|
||||
|
||||
window->win_keyname_table = keyname_table;
|
||||
|
||||
/* Populate window with action routines */
|
||||
|
||||
window->win_clear = clear_window;
|
||||
window->win_disable = disable;
|
||||
window->win_fini = fini;
|
||||
window->win_getchar = get_char;
|
||||
window->win_text = text;
|
||||
window->win_update = update_window;
|
||||
|
||||
/* Find the current font and character size */
|
||||
|
||||
pad_$inq_font(stream_$stdout, &char_width, &char_height,
|
||||
font_name, (SSHORT) sizeof(font_name), &font_name_length,
|
||||
&status);
|
||||
if (status.all) {
|
||||
strcpy(font_name, "/sys/dm/fonts/f7x13");
|
||||
font_name_length = strlen(font_name);
|
||||
char_width = 9;
|
||||
char_height = 19;
|
||||
}
|
||||
|
||||
/* Adjust mouse sensitivity based on character size. */
|
||||
|
||||
mouse_delta_width = 3 * char_width;
|
||||
mouse_delta_height = 2 * char_height;
|
||||
|
||||
pad_$inq_windows(stream_$stdout, &window_desc, (SSHORT) 1, &n, &status);
|
||||
if (status.all)
|
||||
return status.all;
|
||||
|
||||
/* Adjust window size to reality */
|
||||
|
||||
gpr_$inq_config(&config, &status);
|
||||
CHECK_STATUS;
|
||||
|
||||
switch (config) {
|
||||
case gpr_$bw_800x1024:
|
||||
x_size = 800;
|
||||
y_size = 1024;
|
||||
break;
|
||||
|
||||
case gpr_$bw_1280x1024:
|
||||
case gpr_$color_1280x1024x8:
|
||||
case gpr_$color2_1280x1024x8:
|
||||
x_size = 1280;
|
||||
y_size = 1024;
|
||||
break;
|
||||
|
||||
case gpr_$color_1024x1024x4:
|
||||
case gpr_$color_1024x1024x8:
|
||||
x_size = 1024;
|
||||
y_size = 1024;
|
||||
break;
|
||||
|
||||
default:
|
||||
x_size = 1024;
|
||||
y_size = 800;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Create a window of the correct size, allowing for the legend and border. */
|
||||
|
||||
x_size = (x_size / char_width) - 1;
|
||||
y_size = (y_size / char_height) - 3;
|
||||
|
||||
if (!window->win_width || x_size < window->win_width)
|
||||
window->win_width = x_size;
|
||||
|
||||
if (!window->win_height || y_size < window->win_height)
|
||||
window->win_height = y_size;
|
||||
|
||||
window_desc.top = 0;
|
||||
window_desc.left = 0;
|
||||
window_desc.width = (window->win_width + 1) * char_width;
|
||||
window_desc.height = (window->win_height + 3) * char_height;
|
||||
pad_$create_window((SCHAR *) NULL, (SSHORT) 0, pad_$transcript,
|
||||
(SSHORT) 1, window_desc, &stream, &status);
|
||||
|
||||
if (status.all)
|
||||
return status.all;
|
||||
|
||||
/* don't check status for these two commands, we will continue
|
||||
if they fail, anyway */
|
||||
pad_$dm_cmd(stream, "TN", (SSHORT) 2, &status);
|
||||
pad_$set_auto_close(stream, (SSHORT) 1, gpr_true, &status);
|
||||
|
||||
size.x_size = window->win_width * char_width;
|
||||
size.y_size = window->win_height * char_height;
|
||||
|
||||
/* Initialize the graphics primitives on the window */
|
||||
|
||||
gpr_$init(gpr_$direct, stream, size, (unsigned short) 0, &bitmap,
|
||||
&status);
|
||||
CHECK_STATUS;
|
||||
gpr_$set_bitmap(bitmap, &status);
|
||||
|
||||
/* Find the current font and character size */
|
||||
|
||||
gpr_$load_font_file(font_name, font_name_length, &font_id, &status);
|
||||
gpr_$set_text_font(font_id, &status);
|
||||
gpr_$set_raster_op(0, 0, &status);
|
||||
gpr_$set_text_value((gpr_$pixel_value_t) 1, &status);
|
||||
gpr_$set_text_background_value((gpr_$pixel_value_t) - 1, &status);
|
||||
gpr_$inq_text_offset("M", 1, &size, &n, &status);
|
||||
char_offset = size.y_size;
|
||||
text_reverse = FALSE;
|
||||
|
||||
/* Turn on "pop if obscured" and "auto-refresh" to save work */
|
||||
|
||||
gpr_$set_obscured_opt(gpr_$block_if_obs, &status);
|
||||
gpr_$set_auto_refresh(gpr_true, &status);
|
||||
|
||||
/* Enable the events of interest (i.e. left button up) */
|
||||
|
||||
enable_events();
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static clear_window(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c l e a r _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Zap a window clean.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
acquire(window);
|
||||
gpr_$clear((gpr_$pixel_value_t) - 2, &status);
|
||||
release();
|
||||
}
|
||||
|
||||
|
||||
static disable(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d i s a b l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Make window disappear.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
clear_window(window);
|
||||
|
||||
if (stream != stream_$stdout) {
|
||||
disabled = TRUE;
|
||||
pad_$make_invisible(stream, (SSHORT) 1, &status);
|
||||
CHECK_STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static fini(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* f i n i
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Sign off the screen package.
|
||||
*
|
||||
**************************************/
|
||||
gpr_$position_t position;
|
||||
UCHAR event_data;
|
||||
gpr_$event_t event;
|
||||
SSHORT count;
|
||||
|
||||
/* Gobble any pending events to avoid gross confusion when the window
|
||||
disappears and the context changes. */
|
||||
|
||||
COND_ACQUIRE();
|
||||
|
||||
do
|
||||
gpr_$cond_event_wait(&event, &event_data, &position, &status);
|
||||
while (!status.all && event != gpr_$no_event);
|
||||
|
||||
force_release();
|
||||
|
||||
if (stream != stream_$stdout) {
|
||||
gpr_$terminate(gpr_true, &status);
|
||||
stream_$delete(stream, status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static get_char(window, x, y)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ c h a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a character from the user.
|
||||
*
|
||||
**************************************/
|
||||
gpr_$position_t position, current_position;
|
||||
gpr_$event_t event;
|
||||
unsigned char event_data, keypad_flag;
|
||||
status_$t temp;
|
||||
int delta_x, delta_y, abs_delta_x, abs_delta_y;
|
||||
int delta_width, delta_height;
|
||||
|
||||
position.x_coord = x * char_width;
|
||||
position.y_coord = y * char_height + char_offset;
|
||||
|
||||
window->win_flags &= ~WIN_synthesized;
|
||||
keypad_flag = FALSE;
|
||||
|
||||
COND_ACQUIRE();
|
||||
gpr_$set_cursor_position(position, &status);
|
||||
|
||||
for (;;) {
|
||||
gpr_$set_cursor_active(gpr_true, &temp);
|
||||
gpr_$event_wait(&event, &event_data, ¤t_position, &status);
|
||||
gpr_$set_cursor_active(gpr_false, &temp);
|
||||
if (status.all) {
|
||||
if ((status.all & 0xffffff) == smd_$wait_quit)
|
||||
continue;
|
||||
dsply_error(status);
|
||||
}
|
||||
if (event == gpr_$keystroke)
|
||||
if (event_data == KBD_$NUMERIC_KEYPAD)
|
||||
keypad_flag = TRUE;
|
||||
else
|
||||
break;
|
||||
if (event == gpr_$locator_stop) {
|
||||
gpr_$set_cursor_position(position, &status);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Synthesize enter and return on the mouse. */
|
||||
|
||||
if (event == gpr_$buttons) {
|
||||
if (event_data == KBD_$M1U)
|
||||
keypad_flag = TRUE;
|
||||
else if (event_data == KBD_$M3U)
|
||||
keypad_flag = FALSE;
|
||||
else
|
||||
continue;
|
||||
event_data = KBD_$CR;
|
||||
window->win_flags |= WIN_synthesized;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Synthesize cursor keys for mouse movement. Make mouse sensitivity depend on
|
||||
* the window sensitivity flag. */
|
||||
|
||||
if (event == gpr_$locator) {
|
||||
abs_delta_x = delta_x =
|
||||
current_position.x_coord - position.x_coord;
|
||||
if (abs_delta_x < 0)
|
||||
abs_delta_x = -abs_delta_x;
|
||||
abs_delta_y = delta_y =
|
||||
current_position.y_coord - position.y_coord;
|
||||
if (abs_delta_y < 0)
|
||||
abs_delta_y = -abs_delta_y;
|
||||
if (window->win_flags & WIN_sensitive) {
|
||||
delta_width = 4;
|
||||
delta_height = 8;
|
||||
}
|
||||
else {
|
||||
delta_width = mouse_delta_width;
|
||||
delta_height = mouse_delta_height;
|
||||
}
|
||||
|
||||
/* If a diagonal movement is called for, move horizontally and cache the
|
||||
* vertical move for the next input. */
|
||||
|
||||
if (abs_delta_x >= delta_width) {
|
||||
if (delta_x > 0)
|
||||
event_data = KBD_$RIGHT_ARROW;
|
||||
else
|
||||
event_data = KBD_$LEFT_ARROW;
|
||||
window->win_flags |= WIN_synthesized;
|
||||
}
|
||||
if (abs_delta_y >= delta_height) {
|
||||
if (delta_y > 0)
|
||||
if (window->win_flags & WIN_synthesized)
|
||||
window->win_pending_char = C_DOWN;
|
||||
else
|
||||
event_data = KBD_$DOWN_ARROW;
|
||||
else if (window->win_flags & WIN_synthesized)
|
||||
window->win_pending_char = C_UP;
|
||||
else
|
||||
event_data = KBD_$UP_ARROW;
|
||||
window->win_flags |= WIN_synthesized;
|
||||
}
|
||||
if (window->win_flags & WIN_synthesized)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
COND_RELEASE();
|
||||
|
||||
switch (event_data) {
|
||||
case KBD_$CR:
|
||||
return (keypad_flag) ? C_ENTER : '\n';
|
||||
case KBD_$TAB:
|
||||
return '\t';
|
||||
case KBD_$BS:
|
||||
return C_DELETE;
|
||||
case KBD_$F1:
|
||||
return C_PF1;
|
||||
case KBD_$F2:
|
||||
return C_PF2;
|
||||
case KBD_$F3:
|
||||
return C_PF3;
|
||||
case KBD_$F4:
|
||||
return C_PF4;
|
||||
case KBD_$F5:
|
||||
return C_PF5;
|
||||
case KBD_$F6:
|
||||
return C_PF6;
|
||||
case KBD_$F7:
|
||||
return C_PF7;
|
||||
case KBD_$F1S:
|
||||
return C_PF8;
|
||||
case KBD_$F9:
|
||||
case KBD_$F2S:
|
||||
return C_PF9;
|
||||
case KBD_$F8:
|
||||
return C_ENTER;
|
||||
case KBD_$RIGHT_ARROW:
|
||||
return C_RIGHT;
|
||||
case KBD_$LEFT_ARROW:
|
||||
return C_LEFT;
|
||||
case KBD_$UP_ARROW:
|
||||
return C_UP;
|
||||
case KBD_$DOWN_ARROW:
|
||||
return C_DOWN;
|
||||
case KBD_$UP_BOX_ARROW2:
|
||||
case 'T' - 0100:
|
||||
return C_SCROLL_TOP;
|
||||
case KBD_$DOWN_BOX_ARROW2:
|
||||
case 'B' - 0100:
|
||||
return C_SCROLL_BOTTOM;
|
||||
|
||||
/* field editing keys */
|
||||
|
||||
case KBD_$LINE_DEL:
|
||||
return C_ERASE;
|
||||
case KBD_$CHAR_DEL:
|
||||
return C_DELETE_NEXT;
|
||||
case KBD_$INS_MODE1:
|
||||
case KBD_$INS_MODE2:
|
||||
return C_INSERT_OVERSTRIKE;
|
||||
case KBD_$L_BAR_ARROW:
|
||||
return C_GOTO_START;
|
||||
case KBD_$R_BAR_ARROW:
|
||||
return C_GOTO_END;
|
||||
case KBD_$EDIT:
|
||||
return C_EDIT;
|
||||
}
|
||||
|
||||
return event_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static text(window, string, length, x, y, mode)
|
||||
WIN window;
|
||||
UCHAR *string;
|
||||
SSHORT length, x, y;
|
||||
USHORT mode;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* t e x t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Insert text in a given location.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR *p, *end;
|
||||
TEXT buffer[512];
|
||||
USHORT special, bottom, side, op;
|
||||
SSHORT y_char, x1, x2, y1, y2, box_x, box_y;
|
||||
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
special = FALSE;
|
||||
|
||||
for (p = (UCHAR *) buffer, end = string + length; string < end;
|
||||
string++, p++)
|
||||
switch (*p = *string) {
|
||||
case C_UL_CORNER:
|
||||
case C_UR_CORNER:
|
||||
case C_LL_CORNER:
|
||||
case C_LR_CORNER:
|
||||
case C_HORZ_BAR:
|
||||
case C_VERT_BAR:
|
||||
*p = ' ';
|
||||
special = TRUE;
|
||||
}
|
||||
|
||||
string -= length;
|
||||
x *= char_width;
|
||||
y = y * char_height;
|
||||
acquire(window);
|
||||
op = 0;
|
||||
|
||||
if (mode & SCR_reverse) {
|
||||
op = 15;
|
||||
if (!text_reverse) {
|
||||
gpr_$set_text_value((gpr_$pixel_value_t) 0, &status);
|
||||
text_reverse = TRUE;
|
||||
}
|
||||
}
|
||||
else if (text_reverse) {
|
||||
gpr_$set_text_value((gpr_$pixel_value_t) 1, &status);
|
||||
text_reverse = FALSE;
|
||||
}
|
||||
|
||||
raster_op(op, x - 1, y - 1, length * char_width + 1, char_height);
|
||||
y_char = y + char_offset;
|
||||
gpr_$move(x, y_char, &status);
|
||||
CHECK_STATUS;
|
||||
gpr_$text(buffer, length, &status);
|
||||
CHECK_STATUS;
|
||||
|
||||
/* If no special drawing stuff, we're done */
|
||||
|
||||
if (!special) {
|
||||
release();
|
||||
return;
|
||||
}
|
||||
|
||||
current_raster_op = 3;
|
||||
gpr_$set_raster_op(0, current_raster_op, &status);
|
||||
box_x = x + char_width / 2;
|
||||
box_y = y + char_height / 2;
|
||||
bottom = y + char_height - 2;
|
||||
|
||||
for (p = string; p < end; p++, x += char_width, box_x += char_width) {
|
||||
side = x + char_width;
|
||||
switch (*p) {
|
||||
case C_UL_CORNER:
|
||||
x1 = box_x;
|
||||
y1 = bottom;
|
||||
x2 = side;
|
||||
y2 = box_y;
|
||||
break;
|
||||
|
||||
case C_LL_CORNER:
|
||||
x1 = box_x;
|
||||
y1 = y - 2;
|
||||
x2 = side;
|
||||
y2 = box_y;
|
||||
break;
|
||||
|
||||
case C_UR_CORNER:
|
||||
x1 = x;
|
||||
y1 = box_y;
|
||||
x2 = box_x;
|
||||
y2 = bottom;
|
||||
break;
|
||||
|
||||
case C_LR_CORNER:
|
||||
x1 = x;
|
||||
y1 = box_y;
|
||||
x2 = box_x;
|
||||
y2 = y - 2;
|
||||
break;
|
||||
|
||||
case C_HORZ_BAR:
|
||||
x1 = x;
|
||||
y1 = box_y;
|
||||
x2 = side;
|
||||
y2 = box_y;
|
||||
break;
|
||||
|
||||
case C_VERT_BAR:
|
||||
x1 = box_x;
|
||||
y1 = y - 2;
|
||||
x2 = box_x;
|
||||
y2 = bottom;
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
gpr_$move(x1, y1, &status);
|
||||
if (x1 != x2 && y1 != y2)
|
||||
gpr_$line(box_x, box_y, &status);
|
||||
gpr_$line(x2, y2, &status);
|
||||
}
|
||||
|
||||
release();
|
||||
}
|
||||
|
||||
|
||||
static update_window(window, x, y)
|
||||
WIN window;
|
||||
int x, y;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* u p d a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Update a window leaving the cursor at a given object location.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
dsply_restore_cursor(x * char_width, y * char_height);
|
||||
}
|
||||
|
||||
|
||||
static dsply_error(status)
|
||||
status_$t status;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d s p l y _ e r r o r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Complain about system errors.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
error_$print(status);
|
||||
}
|
||||
|
||||
|
||||
static dsply_restore_cursor(x, y)
|
||||
SSHORT x, y;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d s p l y _ r e s t o r e _ c u r s o r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Cursor has gotton lost or something. Move it to an agreeable
|
||||
* spot and re-enable it.
|
||||
*
|
||||
**************************************/
|
||||
gpr_$position_t position;
|
||||
|
||||
pad_$select_window(stream, 1, &status);
|
||||
position.x_coord = x;
|
||||
position.y_coord = y + char_offset;
|
||||
gpr_$set_cursor_position(position, &status);
|
||||
}
|
||||
|
||||
|
||||
#ifdef UNDEFINED
|
||||
static dsply_window(file_name, x, y, characters, lines)
|
||||
SCHAR *file_name;
|
||||
SSHORT x, y, characters, lines;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d s p l y _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create a window at position (x, y) "characters" wide to display
|
||||
* a file "lines" SLONG. It it doesn't fit, do something appropriate.
|
||||
*
|
||||
* 5/31/90 - jas - routine not referenced, conditionalize out
|
||||
*
|
||||
**************************************/
|
||||
pad_$window_desc_t window;
|
||||
stream_$id_t stream_id;
|
||||
SCHAR *p, *q, buffer[256];
|
||||
SSHORT left, right;
|
||||
USHORT length;
|
||||
|
||||
length = characters * 7;
|
||||
left = MAX(10, x - length / 2);
|
||||
right = MIN(990, x + length / 2);
|
||||
window.top = y + 20;
|
||||
window.left = left;
|
||||
window.width = right - left;
|
||||
window.height = MIN(lines * 15, (770 - y));
|
||||
|
||||
for (p = file_name, length = 0, q = buffer; *p;) {
|
||||
length++;
|
||||
*q++ = *p++;
|
||||
}
|
||||
|
||||
pad_$create_window(buffer, length, pad_$read_edit, (SSHORT) 1, window,
|
||||
&stream_id, &status);
|
||||
CHECK_STATUS;
|
||||
stream_$close(stream_id, status);
|
||||
CHECK_STATUS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static acquire(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* a c q u i r e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Acquire the display.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (disabled) {
|
||||
pad_$select_window(stream, (SSHORT) 1, &status);
|
||||
disabled = FALSE;
|
||||
}
|
||||
|
||||
gpr_$acquire_display(&status);
|
||||
CHECK_STATUS;
|
||||
}
|
||||
|
||||
|
||||
static enable_events()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e n a b l e _ e v e n t s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
gpr_$keyset_t keyset;
|
||||
SSHORT i, key;
|
||||
UCHAR *string;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
keyset[i] = 0;
|
||||
|
||||
/* Grab mouse buttons 1 and 3. */
|
||||
|
||||
KEYSET(keyset, KBD_$M1D);
|
||||
KEYSET(keyset, KBD_$M1U);
|
||||
KEYSET(keyset, KBD_$M3D);
|
||||
KEYSET(keyset, KBD_$M3U);
|
||||
|
||||
gpr_$enable_input(gpr_$buttons, keyset, &status);
|
||||
CHECK_STATUS;
|
||||
gpr_$enable_input(gpr_$locator_stop, keyset, &status);
|
||||
CHECK_STATUS;
|
||||
gpr_$enable_input(gpr_$locator, keyset, &status);
|
||||
CHECK_STATUS;
|
||||
|
||||
for (i = 0; i < 127; i++)
|
||||
KEYSET(keyset, i);
|
||||
|
||||
string = special_keys;
|
||||
|
||||
while (key = *string++)
|
||||
KEYSET(keyset, key);
|
||||
|
||||
gpr_$enable_input(gpr_$keystroke, keyset, &status);
|
||||
CHECK_STATUS;
|
||||
}
|
||||
|
||||
|
||||
static force_release()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* f o r c e _ r e l e a s e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Release display.
|
||||
*
|
||||
**************************************/
|
||||
SSHORT count;
|
||||
|
||||
gpr_$force_release(&count, &status);
|
||||
}
|
||||
|
||||
|
||||
static raster_op(op, x, y, x_size, y_size)
|
||||
USHORT op;
|
||||
SSHORT x, y, x_size, y_size;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* r a s t e r _ o p
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Perform a raster operation on a rectangular region.
|
||||
*
|
||||
**************************************/
|
||||
gpr_$window_t window;
|
||||
gpr_$position_t destination;
|
||||
SSHORT unit;
|
||||
|
||||
if (op != current_raster_op) {
|
||||
gpr_$set_raster_op(0, op, &status);
|
||||
current_raster_op = op;
|
||||
}
|
||||
|
||||
window.window_base.x_coord = x;
|
||||
window.window_base.y_coord = y;
|
||||
window.window_size.x_size = x_size;
|
||||
window.window_size.y_size = y_size;
|
||||
destination.x_coord = x;
|
||||
destination.y_coord = y;
|
||||
gpr_$pixel_blt(bitmap, window, destination, &status);
|
||||
CHECK_STATUS;
|
||||
}
|
||||
|
||||
|
||||
static release()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* r e l e a s e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Release display.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
gpr_$release_display(&status);
|
||||
CHECK_STATUS;
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: JRD Access Method
|
||||
* MODULE: all.h
|
||||
* DESCRIPTION: Block allocator blocks
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _PYXIS_ALL_H_
|
||||
#define _PYXIS_ALL_H_
|
||||
|
||||
#define MIN_ALLOCATION 1024 /* Minimin allocation from operating system */
|
||||
|
||||
/* Free block */
|
||||
|
||||
typedef struct frb {
|
||||
struct blk frb_header;
|
||||
struct frb *frb_next; /* Next free block in pool */
|
||||
} *FRB;
|
||||
|
||||
/* Pool block */
|
||||
|
||||
typedef struct plb {
|
||||
struct blk plb_header;
|
||||
USHORT plb_pool_id; /* pool id */
|
||||
struct frb *plb_free; /* first free block */
|
||||
struct hnk *plb_hunks; /* first hunk block */
|
||||
struct lls *plb_lls; /* avaiable linked list stack nodes */
|
||||
} *PLB;
|
||||
|
||||
/* Hunk blocks */
|
||||
|
||||
typedef struct hnk {
|
||||
struct blk hnk_header;
|
||||
SCHAR *hnk_address; /* start of memory hunk */
|
||||
int hnk_length; /* length of memory hunk */
|
||||
struct hnk *hnk_next; /* next memory hunk in structure */
|
||||
} *HNK;
|
||||
|
||||
int PYXIS_free(SCHAR *memory);
|
||||
int PYXIS_release(register FRB block);
|
||||
|
||||
|
||||
#endif /* _PYXIS_ALL_H_ */
|
@ -1,502 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: all.c
|
||||
* DESCRIPTION: Internal block allocator
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
/*
|
||||
$Id: allp.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $
|
||||
*/
|
||||
|
||||
#include "../pyxis/everything.h"
|
||||
#include "../jrd/gds_proto.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
|
||||
extern UCHAR *gds__alloc();
|
||||
static int extend_pool(PLB pool, int size);
|
||||
|
||||
PLB PYXIS_pool();
|
||||
UCHAR *PYXIS_malloc();
|
||||
|
||||
static VEC pools;
|
||||
|
||||
#define BLKDEF(type, root, tail) sizeof (struct root), tail,
|
||||
|
||||
static struct {
|
||||
SSHORT typ_root_length;
|
||||
SSHORT typ_tail_length;
|
||||
} block_sizes[] = {
|
||||
0, 0,
|
||||
#include "../pyxis/blk.h"
|
||||
0};
|
||||
|
||||
#undef BLKDEF
|
||||
|
||||
|
||||
BLK PYXIS_alloc(PLB pool, UCHAR type, int count)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ a l l o c
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Allocate a block from a given pool and initialize the block.
|
||||
* This is the primary block allocation routine.
|
||||
*
|
||||
**************************************/
|
||||
register BLK block;
|
||||
FRB free, *best, *ptr;
|
||||
HNK hunk;
|
||||
register USHORT size, *p;
|
||||
USHORT best_tail, tail;
|
||||
|
||||
if (type <= (SCHAR) type_MIN || type >= (SCHAR) type_MAX)
|
||||
BUGCHECK("bad block type");
|
||||
|
||||
/* Compute block length */
|
||||
|
||||
size = block_sizes[type].typ_root_length;
|
||||
|
||||
if ((tail = block_sizes[type].typ_tail_length) && count >= 1)
|
||||
size += (count - 1) * tail;
|
||||
|
||||
#ifndef VMS
|
||||
size = FB_ALIGN(size, ALIGNMENT);
|
||||
#else
|
||||
size = ((size + ALIGNMENT - 1) & ~(ALIGNMENT - 1));
|
||||
#endif
|
||||
|
||||
if (size <= 4 || size > 32768)
|
||||
BUGCHECK("bad block size");
|
||||
|
||||
/* Find best fit. Best fit is defined to be the free block of shortest
|
||||
tail. If there isn't a fit, extend the pool and try, try again. */
|
||||
|
||||
while (TRUE) {
|
||||
best = NULL;
|
||||
best_tail = 32767;
|
||||
for (ptr = &pool->plb_free; (free = *ptr); ptr = &free->frb_next)
|
||||
if ((SCHAR HUGE_PTR *) free == (SCHAR HUGE_PTR *) free->frb_next)
|
||||
BUGCHECK("corrupt pool");
|
||||
else if ((tail = free->frb_header.blk_length - size) >= 0
|
||||
&& tail < best_tail) {
|
||||
best = ptr;
|
||||
best_tail = tail;
|
||||
if (tail == 0)
|
||||
break;
|
||||
}
|
||||
if (best)
|
||||
break;
|
||||
extend_pool(pool, size);
|
||||
}
|
||||
|
||||
/* We've got our free block. If there's enough left of the free block
|
||||
after taking out our block, chop out our block. If not, allocate
|
||||
the entire free block as our block (a little extra won't hurt). */
|
||||
|
||||
free = *best;
|
||||
if (best_tail > sizeof(struct frb)) {
|
||||
block = (BLK) ((SCHAR *) free + free->frb_header.blk_length - size);
|
||||
free->frb_header.blk_length -= size;
|
||||
}
|
||||
else {
|
||||
*best = free->frb_next;
|
||||
size += best_tail;
|
||||
block = (BLK) free;
|
||||
}
|
||||
|
||||
block->blk_type = type;
|
||||
block->blk_pool_id = pool->plb_pool_id;
|
||||
block->blk_length = size;
|
||||
|
||||
if (size -= sizeof(struct blk))
|
||||
memset((SCHAR *) block + sizeof(struct blk), 0, size);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
BLK PYXIS_extend(BLK *pointer, int size)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ e x t e n d
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Extend a repeating block, copying the constant part.
|
||||
*
|
||||
**************************************/
|
||||
BLK block, new_blk;
|
||||
register int length, l;
|
||||
register SLONG *p1, *p2;
|
||||
register SCHAR *c1, *c2;
|
||||
|
||||
block = *pointer;
|
||||
new_blk = (BLK) PYXIS_alloc((PLB) pools->vec_object[block->blk_pool_id],
|
||||
block->blk_type, size);
|
||||
length = MIN(block->blk_length, new_blk->blk_length) - sizeof(struct blk);
|
||||
p1 = (SLONG *) ((SCHAR *) new_blk + sizeof(struct blk));
|
||||
p2 = (SLONG *) ((SCHAR *) block + sizeof(struct blk));
|
||||
|
||||
if (l = length >> SHIFTLONG)
|
||||
do
|
||||
*p1++ = *p2++;
|
||||
while (--l);
|
||||
|
||||
if (length &= 3) {
|
||||
c1 = (SCHAR *) p1;
|
||||
c2 = (SCHAR *) p2;
|
||||
do
|
||||
*c1++ = *c2++;
|
||||
while (--length);
|
||||
}
|
||||
|
||||
PYXIS_release((FRB) block);
|
||||
|
||||
if (new_blk->blk_type == (SCHAR) type_vec)
|
||||
((VEC) new_blk)->vec_count = size;
|
||||
|
||||
*pointer = new_blk;
|
||||
return new_blk;
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_alloc_fini()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ a l l o c _ f i n i
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get rid of everything.
|
||||
*
|
||||
**************************************/
|
||||
BLK *vector, *until;
|
||||
register PLB pool;
|
||||
register HNK hunks, hunk;
|
||||
|
||||
for (vector = pools->vec_object + pools->vec_count,
|
||||
until = pools->vec_object; --vector >= until;)
|
||||
if (pool = (PLB) * vector)
|
||||
for (hunks = pool->plb_hunks; hunk = hunks;) {
|
||||
hunks = hunk->hnk_next;
|
||||
PYXIS_free(hunk->hnk_address);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_free(SCHAR *memory)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ f r e e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Give space back to system.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
gds__free(memory);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_alloc_init()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ a l l o c _ i n i t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Initialize the pool system.
|
||||
*
|
||||
**************************************/
|
||||
SLONG temp_vector[20];
|
||||
PLB pool;
|
||||
|
||||
pools = (VEC) temp_vector;
|
||||
pools->vec_count = 1;
|
||||
pools->vec_object[0] = NULL;
|
||||
|
||||
PYXIS_default_pool = PYXIS_permanent_pool = pool = PYXIS_pool();
|
||||
pools = (VEC) PYXIS_alloc(pool, type_vec, 10);
|
||||
pools->vec_count = 10;
|
||||
pools->vec_object[0] = (BLK) pool;
|
||||
}
|
||||
|
||||
|
||||
UCHAR *PYXIS_malloc(SLONG size)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ m a l l o c
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get memory from system.
|
||||
*
|
||||
**************************************/
|
||||
register UCHAR *memory;
|
||||
|
||||
if (memory = (UCHAR *) gds__alloc(size))
|
||||
return memory;
|
||||
|
||||
IBERROR("memory gonzo");
|
||||
}
|
||||
|
||||
|
||||
PLB PYXIS_pool()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ p o o l
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Allocate a new pool. This is done by creating a tempory
|
||||
* pool block on the stack, then allocating a real pool block.
|
||||
* In short, by mirrors.
|
||||
*
|
||||
**************************************/
|
||||
struct plb temp_pool;
|
||||
register PLB pool;
|
||||
register int pool_id;
|
||||
|
||||
/* Start by assigning a pool id */
|
||||
|
||||
for (pool_id = 0; pool_id < pools->vec_count; pool_id++)
|
||||
if (!(pools->vec_object[pool_id]))
|
||||
break;
|
||||
|
||||
if (pool_id >= pools->vec_count)
|
||||
PYXIS_extend((BLK*) &pools, pool_id + 10);
|
||||
|
||||
pools->vec_object[pool_id] = (BLK) & temp_pool;
|
||||
temp_pool.plb_free = NULL;
|
||||
temp_pool.plb_hunks = NULL;
|
||||
temp_pool.plb_pool_id = pool_id;
|
||||
if (pool_id == 0)
|
||||
PYXIS_permanent_pool = &temp_pool;
|
||||
|
||||
pool = (PLB) PYXIS_alloc(&temp_pool, type_plb, sizeof(struct plb));
|
||||
pool->plb_pool_id = pool_id;
|
||||
pool->plb_free = temp_pool.plb_free;
|
||||
pool->plb_hunks = temp_pool.plb_hunks;
|
||||
pools->vec_object[pool_id] = (BLK) pool;
|
||||
|
||||
if (pool_id == 0)
|
||||
PYXIS_permanent_pool = pool;
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_push(BLK object, register LLS *stack)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ p u s h
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Push an object on an LLS stack.
|
||||
*
|
||||
**************************************/
|
||||
register LLS node;
|
||||
PLB pool;
|
||||
|
||||
pool = PYXIS_default_pool;
|
||||
|
||||
if (node = pool->plb_lls)
|
||||
pool->plb_lls = node->lls_next;
|
||||
else
|
||||
node = (LLS) PYXIS_alloc(pool, type_lls, sizeof(struct lls));
|
||||
|
||||
node->lls_object = object;
|
||||
node->lls_next = *stack;
|
||||
*stack = node;
|
||||
}
|
||||
|
||||
|
||||
BLK PYXIS_pop(register LLS *stack)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ p o p
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Pop an object off a linked list stack. Save the node for
|
||||
* further use.
|
||||
*
|
||||
**************************************/
|
||||
register LLS node;
|
||||
register PLB pool;
|
||||
|
||||
node = *stack;
|
||||
pool = (PLB) pools->vec_object[node->lls_header.blk_pool_id];
|
||||
*stack = node->lls_next;
|
||||
node->lls_next = pool->plb_lls;
|
||||
pool->plb_lls = node;
|
||||
|
||||
return node->lls_object;
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_release(register FRB block)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ r e l e a s e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Release a block to its pool. If it is contiguous to
|
||||
* another free block, combine them. Otherwise link it
|
||||
* into the free block linked list (kept in ascending order
|
||||
* of addresses).
|
||||
*
|
||||
**************************************/
|
||||
register FRB prior, free;
|
||||
FRB *ptr;
|
||||
PLB pool;
|
||||
int pool_id;
|
||||
|
||||
block->frb_header.blk_type = (SCHAR) type_frb;
|
||||
pool_id = block->frb_header.blk_pool_id;
|
||||
|
||||
if (pool_id >= pools->vec_count ||
|
||||
!(pool = (PLB) pools->vec_object[pool_id])) BUGCHECK("bad pool id");
|
||||
|
||||
prior = NULL;
|
||||
for (ptr = &pool->plb_free; free = *ptr;
|
||||
prior = free, ptr =
|
||||
&free->frb_next) if ((SCHAR HUGE_PTR *) block <=
|
||||
(SCHAR HUGE_PTR *) free) break;
|
||||
|
||||
if ((SCHAR HUGE_PTR *) block == (SCHAR HUGE_PTR *) free)
|
||||
BUGCHECK("block released twice");
|
||||
|
||||
/* Merge block into list first, then try to combine blocks */
|
||||
|
||||
block->frb_next = free;
|
||||
*ptr = block;
|
||||
|
||||
/* Try to merge the free block with the next one down. */
|
||||
|
||||
if (free) {
|
||||
if ((SCHAR HUGE_PTR *) block + block->frb_header.blk_length ==
|
||||
(SCHAR HUGE_PTR *) free) {
|
||||
block->frb_header.blk_length += free->frb_header.blk_length;
|
||||
block->frb_next = free->frb_next;
|
||||
}
|
||||
else if ((SCHAR HUGE_PTR *) block + block->frb_header.blk_length >
|
||||
(SCHAR HUGE_PTR *) free)
|
||||
BUGCHECK("released block overlaps following free block");
|
||||
}
|
||||
|
||||
/* Try to merge the block with the prior free block */
|
||||
|
||||
if (prior) {
|
||||
if ((SCHAR HUGE_PTR *) prior + prior->frb_header.blk_length ==
|
||||
(SCHAR HUGE_PTR *) block) {
|
||||
prior->frb_header.blk_length += block->frb_header.blk_length;
|
||||
prior->frb_next = block->frb_next;
|
||||
}
|
||||
else if ((SCHAR HUGE_PTR *) prior + prior->frb_header.blk_length ==
|
||||
(SCHAR HUGE_PTR *) block)
|
||||
BUGCHECK("released block overlaps prior free block");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_rlpool(PLB pool)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ r l p o o l
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Release a storage pool. This involves nothing more than returning
|
||||
* hunks to the free hunk list.
|
||||
*
|
||||
**************************************/
|
||||
register HNK hunk, hunks;
|
||||
|
||||
pools->vec_object[pool->plb_pool_id] = NULL;
|
||||
|
||||
for (hunks = pool->plb_hunks; hunk = hunks;) {
|
||||
hunks = hunk->hnk_next;
|
||||
gds__free(hunk->hnk_address);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int extend_pool(PLB pool, int size)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e x t e n d _ p o o l
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Extend a pool by at least enough to accomodate a block
|
||||
* of given size.
|
||||
*
|
||||
**************************************/
|
||||
register HNK hunk, *ptr;
|
||||
register BLK block;
|
||||
|
||||
size =
|
||||
(size + sizeof(struct hnk) + MIN_ALLOCATION - 1) & ~(MIN_ALLOCATION -
|
||||
1);
|
||||
block = (BLK) PYXIS_malloc((SLONG) size);
|
||||
block->blk_length = size;
|
||||
block->blk_type = (SCHAR) type_frb;
|
||||
block->blk_pool_id = pool->plb_pool_id;
|
||||
PYXIS_release((FRB) block);
|
||||
|
||||
hunk = (HNK) PYXIS_alloc(pool, type_hnk, sizeof(hnk) );
|
||||
hunk->hnk_address = (SCHAR *) block;
|
||||
hunk->hnk_length = size;
|
||||
hunk->hnk_next = pool->plb_hunks;
|
||||
pool->plb_hunks = hunk;
|
||||
}
|
@ -1,227 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: JRD Access Method
|
||||
* MODULE: altp.c
|
||||
* DESCRIPTION: Alternative entrypoints
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include "../jrd/common.h"
|
||||
#include "../include/jrd/gds.h"
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/phase3.h"
|
||||
|
||||
STATUS isc_compile_map(STATUS * status_vector,
|
||||
void **form_handle,
|
||||
void **map_handle, SSHORT * length, SCHAR * map)
|
||||
{
|
||||
return pyxis__compile_map(status_vector,
|
||||
(p_obj**)form_handle, (MAP*) map_handle, (USHORT*) length, map);
|
||||
}
|
||||
|
||||
STATUS isc_compile_menu(STATUS * status_vector,
|
||||
void **win_handle,
|
||||
void **menu_handle, SSHORT * length, SCHAR * menu)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__compile_menu((WIN*) win_handle, (MENU*) menu_handle, (USHORT*) length, menu);
|
||||
}
|
||||
|
||||
STATUS isc_compile_sub_map(STATUS * status_vector,
|
||||
void **map_handle,
|
||||
void **submap_handle, SSHORT * length, SCHAR * map)
|
||||
{
|
||||
return pyxis__compile_sub_map(status_vector,
|
||||
(MAP*) map_handle, (MAP*) submap_handle, (USHORT*) length, map);
|
||||
}
|
||||
|
||||
STATUS isc_create_window(STATUS * status_vector,
|
||||
void **win_handle,
|
||||
SSHORT * filename_length,
|
||||
SCHAR * filename, SSHORT * width, SSHORT * height)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__create_window((WIN*) win_handle,
|
||||
(USHORT*) filename_length, (TEXT*) filename,
|
||||
(USHORT*) width, (USHORT*) height);
|
||||
}
|
||||
|
||||
STATUS isc_delete_window(STATUS * status_vector, void **win_handle)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__delete_window((SLONG*) win_handle);
|
||||
}
|
||||
|
||||
STATUS isc_drive_form(STATUS * status_vector,
|
||||
void **db_handle,
|
||||
void **tra_handle,
|
||||
void **win_handle,
|
||||
void **map_handle, UCHAR * input, UCHAR * output)
|
||||
{
|
||||
return pyxis__drive_form(status_vector,
|
||||
(SLONG**) db_handle,
|
||||
(SLONG*) tra_handle,
|
||||
(WIN*) win_handle, (MAP*)map_handle,
|
||||
input, output);
|
||||
}
|
||||
|
||||
STATUS isc_drive_menu(STATUS * status_vector,
|
||||
void **win_handle,
|
||||
void **menu_handle,
|
||||
SSHORT * blr_length,
|
||||
SCHAR * blr,
|
||||
SSHORT * title_length,
|
||||
SCHAR * title,
|
||||
SSHORT * terminator,
|
||||
SSHORT * entree_length,
|
||||
SCHAR * entree, SLONG * entree_value)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__drive_menu((WIN*) win_handle,
|
||||
(MENU*) menu_handle,
|
||||
(USHORT*) blr_length,
|
||||
blr,
|
||||
(USHORT*) title_length,
|
||||
(TEXT*) title,
|
||||
(USHORT*) terminator,
|
||||
(USHORT*) entree_length, (TEXT*)entree,
|
||||
entree_value);
|
||||
}
|
||||
|
||||
STATUS isc_form_delete(STATUS * status_vector, void **map_handle)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__delete((p_obj**) map_handle);
|
||||
}
|
||||
|
||||
STATUS isc_form_fetch(STATUS * status_vector,
|
||||
void **db_handle,
|
||||
void **tra_handle, void **map_handle, UCHAR * output)
|
||||
{
|
||||
return pyxis__fetch(status_vector,
|
||||
(SLONG**) db_handle,
|
||||
(SLONG*) tra_handle,
|
||||
(MAP*) map_handle, output);
|
||||
}
|
||||
|
||||
STATUS isc_form_insert(STATUS * status_vector,
|
||||
void **db_handle,
|
||||
void **tra_handle, void **map_handle, UCHAR * input)
|
||||
{
|
||||
return pyxis__insert(status_vector,
|
||||
(SLONG**) db_handle, (SLONG*) tra_handle,
|
||||
(MAP*) map_handle, input);
|
||||
}
|
||||
|
||||
STATUS isc_get_entree(STATUS * status_vector,
|
||||
void **menu_handle,
|
||||
SSHORT * entree_length,
|
||||
SCHAR * entree,
|
||||
SLONG * entree_value, SSHORT * entree_end)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__get_entree((MENU*) menu_handle,
|
||||
(USHORT*) entree_length, (TEXT*) entree,
|
||||
entree_value, (USHORT*) entree_end);
|
||||
}
|
||||
|
||||
STATUS isc_initialize_menu(STATUS * status_vector, void **menu_handle)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__initialize_menu((MENU*) menu_handle);
|
||||
}
|
||||
|
||||
STATUS isc_load_form(STATUS * status_vector,
|
||||
void **db_handle,
|
||||
void **tra_handle,
|
||||
void **form_handle, SSHORT * length, SCHAR * name)
|
||||
{
|
||||
return pyxis__load_form(status_vector,
|
||||
(SLONG*) db_handle, (SLONG*) tra_handle,
|
||||
(SLONG*) form_handle, length, name);
|
||||
}
|
||||
|
||||
STATUS isc_menu(STATUS * status_vector,
|
||||
void **win_handle,
|
||||
void **menu_handle, SSHORT * length, SCHAR * source)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return (long int) pyxis__menu((WIN*) win_handle, (MENU*) menu_handle,
|
||||
(USHORT*) length, (TEXT*) source);
|
||||
}
|
||||
|
||||
STATUS isc_pop_window(STATUS * status_vector, void **win_handle)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__pop_window((WIN*) win_handle);
|
||||
}
|
||||
|
||||
STATUS isc_put_entree(STATUS * status_vector,
|
||||
void **menu_handle,
|
||||
SSHORT * entree_length,
|
||||
SCHAR * entree, SLONG * entree_value)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__put_entree((MENU*) menu_handle,
|
||||
(USHORT*) entree_length, (TEXT*) entree,
|
||||
entree_value);
|
||||
}
|
||||
|
||||
STATUS isc_reset_form(STATUS * status_vector, void **map_handle)
|
||||
{
|
||||
return pyxis__reset_form(status_vector, (MAP*) map_handle);
|
||||
}
|
||||
|
||||
STATUS isc_suspend_window(STATUS * status_vector, void **win_handle)
|
||||
{
|
||||
if (status_vector) {
|
||||
status_vector[0] = 1;
|
||||
status_vector[1] = 0;
|
||||
}
|
||||
return pyxis__suspend_window((SLONG*) win_handle);
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: attributes.h
|
||||
* DESCRIPTION: Attribute names
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
|
||||
/* Attributes that directly affect display */
|
||||
|
||||
ATT (att_inactive)
|
||||
ATT (att_display_x)
|
||||
ATT (att_display_y)
|
||||
ATT (att_height)
|
||||
ATT (att_width)
|
||||
ATT (att_reverse_video)
|
||||
ATT (att_bold)
|
||||
ATT (att_underline)
|
||||
ATT (att_blank)
|
||||
ATT (att_box)
|
||||
ATT (att_end_display)
|
||||
|
||||
/* Attributes that don't change display unless
|
||||
display attribute */
|
||||
|
||||
ATT (att_data)
|
||||
ATT (att_field_name)
|
||||
ATT (att_field_id)
|
||||
ATT (att_relation_name)
|
||||
ATT (att_relation_id)
|
||||
ATT (att_rse)
|
||||
ATT (att_literal_string)
|
||||
ATT (att_value_string)
|
||||
ATT (att_fill_string)
|
||||
ATT (att_dtype)
|
||||
ATT (att_scale)
|
||||
ATT (att_length)
|
||||
ATT (att_label)
|
||||
ATT (att_field)
|
||||
ATT (att_entree)
|
||||
ATT (att_entree_value)
|
||||
ATT (att_menu)
|
||||
ATT (att_form)
|
||||
ATT (att_temp_data)
|
||||
ATT (att_insert_right)
|
||||
ATT (att_tag)
|
||||
ATT (att_picture)
|
||||
ATT (att_parameter_offset)
|
||||
ATT (att_edit_string)
|
||||
ATT (att_parameter_number)
|
||||
ATT (att_update_data)
|
||||
ATT (att_view)
|
||||
ATT (att_wakeup_flag)
|
||||
ATT (att_wakeup_string)
|
||||
ATT (att_updatable_flag)
|
||||
ATT (att_terminator)
|
||||
ATT (att_must_fill)
|
||||
ATT (att_upcase)
|
||||
ATT (att_temp)
|
||||
ATT (att_scroll_x)
|
||||
ATT (att_scroll_y)
|
||||
ATT (att_border)
|
||||
ATT (att_index)
|
||||
ATT (att_segment_length)
|
||||
ATT (att_prototype)
|
||||
ATT (att_reverse_for_update)
|
||||
ATT (att_enumeration)
|
||||
ATT (att_default_data)
|
||||
ATT (att_datatype)
|
||||
ATT (att_current_index)
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: blk.c
|
||||
* DESCRIPTION: Block size tables
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#include "../pyxis/everything.h"
|
||||
|
||||
#define BLKDEF(type, root, tail) sizeof (struct root), tail,
|
||||
struct {
|
||||
SSHORT typ_root_length;
|
||||
SSHORT typ_tail_length;
|
||||
} PYXIS_block_sizes[] = {
|
||||
0, 0,
|
||||
#include "../pyxis/blk.h"
|
||||
0};
|
||||
|
||||
#undef BLKDEF
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: blk.h
|
||||
* DESCRIPTION: Block type definitions
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
BLKDEF (type_lls, lls, 0)
|
||||
BLKDEF (type_frb, frb, 0)
|
||||
BLKDEF (type_hnk, hnk, 0)
|
||||
BLKDEF (type_plb, plb, 0)
|
||||
BLKDEF (type_vec, vec, sizeof (((VEC) 0)->vec_object[0]))
|
||||
|
||||
BLKDEF (type_att, att, 1)
|
||||
BLKDEF (type_obj, p_obj, 0)
|
||||
BLKDEF (type_scr, scr, sizeof (((SCR) 0)->scr_screen [0]))
|
||||
BLKDEF (type_win, win, 0)
|
||||
BLKDEF (type_str, str, 1)
|
||||
BLKDEF (type_pic, pic, 0)
|
||||
BLKDEF (type_map, map, sizeof (((MAP) 0)->map_rpt [0]))
|
||||
BLKDEF (type_menu, menu, 0)
|
@ -1,743 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: cdm.c
|
||||
* DESCRIPTION: Curses Display Manager
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include <curses.h>
|
||||
#undef DEBUG_CURSES
|
||||
#ifdef DEBUG_CURSES
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#endif
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/scr.h"
|
||||
|
||||
/*
|
||||
Unfortunately, curses tends to be a very buggy system, so we have to provide
|
||||
what workarounds we can. Two categories of problems have been encountered:
|
||||
1. requiring initscr/endwin when all we want to do is temporarily stop using forms.
|
||||
this is triggered by defining DISABLE_BUG
|
||||
2. requiring that after endwin we explicitly return stdin to nonbuffered mode.
|
||||
this is triggered by define BUFF_MODE_BUG & DISABLE_BUG
|
||||
*/
|
||||
|
||||
#ifdef hpux
|
||||
#define DISABLE_BUG
|
||||
#endif
|
||||
|
||||
#ifdef sun
|
||||
#define DISABLE_BUG
|
||||
#endif
|
||||
|
||||
#ifdef sgi
|
||||
#define DISABLE_BUG
|
||||
#define BUFF_MODE_BUG
|
||||
#endif
|
||||
|
||||
#ifdef DELTA
|
||||
#define DISABLE_BUG
|
||||
#define BUFF_MODE_BUG
|
||||
#endif
|
||||
|
||||
#ifdef IMP
|
||||
#define DISABLE_BUG
|
||||
#define BUFF_MODE_BUG
|
||||
#endif
|
||||
|
||||
#ifdef DGUX
|
||||
#define DISABLE_BUG
|
||||
#define BUFF_MODE_BUG
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_CURSES
|
||||
static FILE *log_file;
|
||||
#endif
|
||||
|
||||
#ifdef DARWIN
|
||||
#define getmaxx(s) ((s)->maxx)
|
||||
#define getmaxy(s) ((s)->maxy)
|
||||
#else
|
||||
#ifndef NETBSD
|
||||
#define getmaxx(s) ((s)->_maxx)
|
||||
#define getmaxy(s) ((s)->_maxy)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static USHORT disabled = 1;
|
||||
static USHORT debug_curses = 0;
|
||||
|
||||
static int clear_window(WIN);
|
||||
static int enable(WIN);
|
||||
static int disable(WIN);
|
||||
static int fini(WIN);
|
||||
static int get_char(WIN, int, int);
|
||||
static int text(WIN , UCHAR *, SSHORT , SSHORT , SSHORT , USHORT);
|
||||
static int update_window(WIN, int, int);
|
||||
static int get_input(WIN, UCHAR *);
|
||||
static int read_char(WIN);
|
||||
|
||||
|
||||
|
||||
typedef struct seq {
|
||||
UCHAR seq_key;
|
||||
UCHAR *seq_sequence;
|
||||
} SEQ;
|
||||
|
||||
static SEQ escape_sequences[] = {
|
||||
(UCHAR) C_UP, (UCHAR *) "[A",
|
||||
(UCHAR) C_DOWN, (UCHAR *) "[B",
|
||||
(UCHAR) C_RIGHT, (UCHAR *) "[C",
|
||||
(UCHAR) C_LEFT, (UCHAR *) "[D",
|
||||
(UCHAR) C_ENTER, (UCHAR *) "[222z", /* R15 */
|
||||
(UCHAR) C_PF1, (UCHAR *) "[208z", /* R1 */
|
||||
(UCHAR) C_PF2, (UCHAR *) "[209z", /* R2 */
|
||||
(UCHAR) C_PF3, (UCHAR *) "[210z", /* R3 */
|
||||
(UCHAR) C_PF4, (UCHAR *) "[211z", /* R4 */
|
||||
(UCHAR) C_PF5, (UCHAR *) "[212z", /* R5 */
|
||||
(UCHAR) C_PF6, (UCHAR *) "[213z", /* R6 */
|
||||
(UCHAR) C_PF7, (UCHAR *) "[214z", /* R7 */
|
||||
(UCHAR) C_UP, (UCHAR *) "[215z", /* R8 - up arrow */
|
||||
(UCHAR) C_PF8, (UCHAR *) "[216z", /* R9 */
|
||||
(UCHAR) C_LEFT, (UCHAR *) "[217z", /* R10- left arrow */
|
||||
(UCHAR) C_PF9, (UCHAR *) "[218z", /* R11 */
|
||||
(UCHAR) C_RIGHT, (UCHAR *) "[219z", /* R12 - right arrow */
|
||||
(UCHAR) C_DOWN, (UCHAR *) "[221z", /* R14 - down arrow */
|
||||
(UCHAR) C_ENTER, (UCHAR *) "[250z", /* ENTER */
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
#ifdef CURSES_KEYPAD
|
||||
typedef struct kpd {
|
||||
UCHAR kpd_key;
|
||||
int kpd_value;
|
||||
} KPD;
|
||||
|
||||
static KPD keypad_values[] = {
|
||||
(UCHAR) C_UP, KEY_UP,
|
||||
(UCHAR) C_DOWN, KEY_DOWN,
|
||||
(UCHAR) C_RIGHT, KEY_RIGHT,
|
||||
(UCHAR) C_LEFT, KEY_LEFT,
|
||||
(UCHAR) C_PF1, KEY_F(1),
|
||||
(UCHAR) C_PF2, KEY_F(2),
|
||||
(UCHAR) C_PF3, KEY_F(3),
|
||||
(UCHAR) C_PF4, KEY_F(4),
|
||||
(UCHAR) C_PF5, KEY_F(5),
|
||||
(UCHAR) C_PF6, KEY_F(6),
|
||||
(UCHAR) C_PF7, KEY_F(7),
|
||||
(UCHAR) C_PF8, KEY_F(8),
|
||||
(UCHAR) C_PF9, KEY_F(9),
|
||||
(UCHAR) C_SCROLL_TOP, KEY_SR,
|
||||
(UCHAR) C_SCROLL_BOTTOM, KEY_SF,
|
||||
(UCHAR) C_ENTER, KEY_HOME,
|
||||
(UCHAR) C_DELETE, KEY_DC,
|
||||
NULL, NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CURSES_KEYPAD
|
||||
static struct knm keyname_table[] = {
|
||||
{C_PF1, "<F1>"},
|
||||
{C_PF2, "<F2>"},
|
||||
{C_PF3, "<F3>"},
|
||||
{C_PF4, "<F4>"},
|
||||
{C_PF5, "<F5>"},
|
||||
{C_PF6, "<F6>"},
|
||||
{C_PF7, "<F7>"},
|
||||
{C_PF8, "<F8>"},
|
||||
{C_PF9, "<R11>"},
|
||||
{C_ENTER, "<HOME>"},
|
||||
{C_LEFT, "<left arrow>"},
|
||||
{C_RIGHT, "<right arrow>"},
|
||||
{C_UP, "<up arrow>"},
|
||||
{C_DOWN, "<down arrow>"},
|
||||
{C_DELETE, "<DELETE>"},
|
||||
{C_SCROLL_TOP, "<control-T>"},
|
||||
{C_SCROLL_BOTTOM, "<control-B>"},
|
||||
{C_ERASE, "<control-U>"},
|
||||
{C_DELETE_NEXT, "<control-F>"},
|
||||
{C_INSERT_OVERSTRIKE, "<control-A>"},
|
||||
{C_GOTO_START, "<control-H>"},
|
||||
{C_GOTO_END, "<control-E>"},
|
||||
{C_EDIT, "<control-G>"},
|
||||
{(UCHAR) 0, "<unknown key>"},
|
||||
};
|
||||
|
||||
#else
|
||||
static struct knm keyname_table[] = {
|
||||
{C_PF1, "<R1>"},
|
||||
{C_PF2, "<R2>"},
|
||||
{C_PF3, "<R3>"},
|
||||
{C_PF4, "<R4>"},
|
||||
{C_PF5, "<R5>"},
|
||||
{C_PF6, "<R6>"},
|
||||
{C_PF7, "<R7>"},
|
||||
{C_PF8, "<R9>"},
|
||||
{C_PF9, "<R11>"},
|
||||
{C_ENTER, "<ENTER> or <R15>"},
|
||||
{C_LEFT, "<R10>"},
|
||||
{C_RIGHT, "<R12>"},
|
||||
{C_UP, "<R8>"},
|
||||
{C_DOWN, "<R14>"},
|
||||
{C_DELETE, "<DELETE>"},
|
||||
{C_SCROLL_TOP, "<control-T>"},
|
||||
{C_SCROLL_BOTTOM, "<control-B>"},
|
||||
{C_ERASE, "<control-U>"},
|
||||
{C_DELETE_NEXT, "<control-F>"},
|
||||
{C_INSERT_OVERSTRIKE, "<control-A>"},
|
||||
{C_GOTO_START, "<control-H>"},
|
||||
{C_GOTO_END, "<control-E>"},
|
||||
{C_EDIT, "<control-G>"},
|
||||
{(UCHAR) 0, "<unknown key>"},
|
||||
};
|
||||
#endif
|
||||
|
||||
static UCHAR key_pad[256], keypad_equiv[] = {
|
||||
C_ENTER, 'M',
|
||||
C_PF1, 'P',
|
||||
C_PF2, 'Q',
|
||||
C_PF3, 'R',
|
||||
C_PF4, 'S',
|
||||
'-', 'm',
|
||||
',', 'l',
|
||||
'.', 'n',
|
||||
'0', 'p',
|
||||
'1', 'q',
|
||||
'2', 'r',
|
||||
'3', 's',
|
||||
'4', 't',
|
||||
'5', 'u',
|
||||
'6', 'v',
|
||||
'7', 'w',
|
||||
'8', 'x',
|
||||
'9', 'y',
|
||||
0, 0
|
||||
};
|
||||
|
||||
|
||||
int CDM_create_window(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* C D M _ c r e a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create a new display window.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR *p;
|
||||
|
||||
window->win_keyname_table = keyname_table;
|
||||
|
||||
/* Populate window with action routines */
|
||||
|
||||
window->win_clear = (int (*)()) clear_window;
|
||||
window->win_disable = (int (*)()) disable;
|
||||
window->win_fini = (int (*)()) fini;
|
||||
window->win_getchar = (int (*)()) get_char;
|
||||
window->win_text = text;
|
||||
window->win_update = (int (*)()) update_window;
|
||||
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
if (!(log_file = fopen("pyxis.log", "w")))
|
||||
printf("ERROR opening log file!\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
work around bugs in HP & SUN curses by having enable/disable do
|
||||
initscr/endwin.
|
||||
*/
|
||||
#ifndef DISABLE_BUG
|
||||
initscr();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "initscr\n");
|
||||
#endif
|
||||
#ifdef CURSES_TERM
|
||||
saveterm();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "saveterm\n");
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
enable(window);
|
||||
|
||||
window->win_width = (window->win_width) ?
|
||||
MIN(getmaxx(stdscr), window->win_width) : getmaxx(stdscr);
|
||||
|
||||
window->win_height = (window->win_height) ?
|
||||
MIN(getmaxy(stdscr), window->win_height) : getmaxy(stdscr);
|
||||
|
||||
for (p = keypad_equiv; *p; p += 2)
|
||||
key_pad[p[1]] = p[0];
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int clear_window(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c l e a r _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Clear out a window.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
enable(window);
|
||||
clear();
|
||||
wrefresh(stdscr);
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses) {
|
||||
fprintf(log_file, "clear\n");
|
||||
fprintf(log_file, "wrefresh\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int disable(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d i s a b l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Make window disappear.
|
||||
*
|
||||
**************************************/
|
||||
#ifdef BUFF_MODE_BUG
|
||||
SCHAR buf[BUFSIZ];
|
||||
#endif
|
||||
|
||||
if (disabled)
|
||||
return 0;
|
||||
|
||||
wmove(stdscr, getmaxy(stdscr) - 1, 0);
|
||||
clear();
|
||||
wrefresh(stdscr);
|
||||
wstandend(stdscr);
|
||||
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses) {
|
||||
fprintf(log_file, "wmove %d %d\n", stdscr->_maxy - 1, 0);
|
||||
fprintf(log_file, "clear\n");
|
||||
fprintf(log_file, "wrefresh\n");
|
||||
fprintf(log_file, "wstandend\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CURSES_TERM
|
||||
|
||||
resetterm();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "resetterm\n");
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
echo();
|
||||
nocrmode();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses) {
|
||||
fprintf(log_file, "echo\n");
|
||||
fprintf(log_file, "nocrmode\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef CURSES_KEYPAD
|
||||
keypad(stdscr, FALSE);
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "keypad FALSE\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_BUG
|
||||
/*
|
||||
work around bugs in curses by having enable/disable do
|
||||
initscr/endwin.
|
||||
*/
|
||||
endwin();
|
||||
#ifdef BUFF_MODE_BUG
|
||||
setvbuf(stdout, buf, _IOLBF, BUFSIZ);
|
||||
#endif
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "endwin\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
disabled = TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int enable(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e n a b l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Enable forms package.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (!disabled)
|
||||
return 0;
|
||||
|
||||
#ifdef DISABLE_BUG
|
||||
/*
|
||||
work around bugs in curses by having enable/disable do
|
||||
initscr/endwin.
|
||||
*/
|
||||
initscr();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "initscr\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CURSES_TERM
|
||||
|
||||
fixterm();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "fixterm\n");
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
noecho();
|
||||
crmode();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses) {
|
||||
fprintf(log_file, "noecho\n");
|
||||
fprintf(log_file, "crmode\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CURSES_KEYPAD
|
||||
keypad(stdscr, TRUE);
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "keypad TRUE\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
clear();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "clear\n");
|
||||
#endif
|
||||
disabled = FALSE;
|
||||
}
|
||||
|
||||
|
||||
static int fini(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* f i n i
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Sign off the screen package.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
disable(window);
|
||||
endwin();
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "endwin\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int get_char(WIN window, int x, int y)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ c h a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a character from the user.
|
||||
*
|
||||
**************************************/
|
||||
int n;
|
||||
SEQ *sequence;
|
||||
UCHAR buffer[16], *p, *q, c;
|
||||
|
||||
/***
|
||||
position (window, x, y);
|
||||
fflush (window->win_output);
|
||||
***/
|
||||
|
||||
for (;;) {
|
||||
if (!(n = get_input(window, buffer)))
|
||||
fprintf(stderr, "read failed\n");
|
||||
if (n == 1)
|
||||
switch (buffer[0]) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
return '\n';
|
||||
case 'T' - 0100:
|
||||
return C_SCROLL_TOP;
|
||||
case 'B' - 0100:
|
||||
return C_SCROLL_BOTTOM;
|
||||
case 'Z' - 0100:
|
||||
return C_EOF;
|
||||
|
||||
/* Edit mode */
|
||||
|
||||
case 'F' - 0100:
|
||||
return C_DELETE_NEXT;
|
||||
case 'G' - 0100:
|
||||
return C_EDIT;
|
||||
case 'H' - 0100:
|
||||
return C_GOTO_START;
|
||||
case 'E' - 0100:
|
||||
return C_GOTO_END;
|
||||
case 'A' - 0100:
|
||||
return C_INSERT_OVERSTRIKE;
|
||||
case 'U' - 0100:
|
||||
return C_ERASE;
|
||||
default:
|
||||
return buffer[0];
|
||||
}
|
||||
buffer[n] = 0;
|
||||
for (sequence = escape_sequences; q = sequence->seq_sequence;
|
||||
sequence++)
|
||||
for (p = buffer + 1; *p == *q; p++, q++)
|
||||
if (!*p)
|
||||
return sequence->seq_key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int get_input(WIN window, UCHAR *buffer)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ i n p u t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a single character or escape sequence from terminal.
|
||||
* Return number of characters read.
|
||||
*
|
||||
**************************************/
|
||||
#ifdef CURSES_KEYPAD
|
||||
KPD *kv;
|
||||
#endif
|
||||
UCHAR *p;
|
||||
int c;
|
||||
|
||||
p = buffer;
|
||||
c = read_char(window);
|
||||
|
||||
if (!c)
|
||||
return 0;
|
||||
|
||||
#ifdef CURSES_KEYPAD
|
||||
if (c > 0400) {
|
||||
for (kv = keypad_values; kv->kpd_value; kv++)
|
||||
if (kv->kpd_value == c) {
|
||||
*p = kv->kpd_key;
|
||||
return 1;
|
||||
}
|
||||
/* treat everything else as a tab */
|
||||
*p = '\t';
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (c != 033) {
|
||||
*p = c;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Escape or control sequence coming in */
|
||||
|
||||
*p++ = c;
|
||||
*p++ = c = read_char(window);
|
||||
|
||||
/* If this a keypad character, handling it specially */
|
||||
|
||||
if (c == 'O') {
|
||||
c = read_char(window);
|
||||
buffer[0] = key_pad[c];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Handle escape sequences and control sequences slightly differently */
|
||||
|
||||
if (c >= ' ' && c < '/')
|
||||
for (;;) {
|
||||
*p++ = c = read_char(window);
|
||||
if (c >= '0')
|
||||
break;
|
||||
}
|
||||
else
|
||||
for (;;) {
|
||||
*p++ = c = read_char(window);
|
||||
if (c >= '@')
|
||||
break;
|
||||
}
|
||||
|
||||
return p - buffer;
|
||||
}
|
||||
|
||||
|
||||
static int read_char(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* r e a d _ c h a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a character from the user.
|
||||
*
|
||||
**************************************/
|
||||
int c;
|
||||
|
||||
if (disabled)
|
||||
enable(window);
|
||||
|
||||
c = wgetch(stdscr);
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "read %d\n", c);
|
||||
#endif
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
static int text(WIN window, UCHAR *string, SSHORT length, SSHORT x,
|
||||
SSHORT y, USHORT mode)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* t e x t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Display some text in a given rendition.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR *p, *end;
|
||||
|
||||
for (p = string, end = p + length; p < end; p++)
|
||||
switch (*p) {
|
||||
case C_UL_CORNER:
|
||||
case C_UR_CORNER:
|
||||
case C_LL_CORNER:
|
||||
case C_LR_CORNER:
|
||||
*p = '+';
|
||||
break;
|
||||
|
||||
case C_HORZ_BAR:
|
||||
*p = '-';
|
||||
break;
|
||||
|
||||
case C_VERT_BAR:
|
||||
*p = '|';
|
||||
break;
|
||||
}
|
||||
|
||||
if (disabled)
|
||||
enable(window);
|
||||
|
||||
string[length] = 0;
|
||||
|
||||
if (mode & SCR_reverse) {
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "wstandout\n");
|
||||
#endif
|
||||
wstandout(stdscr);
|
||||
}
|
||||
|
||||
mvwaddstr(stdscr, y, x, (char*)string);
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "mvwaddstr %d %d %s\n", y, x, string);
|
||||
#endif
|
||||
|
||||
if (mode & SCR_reverse) {
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses)
|
||||
fprintf(log_file, "wstandend\n");
|
||||
#endif
|
||||
wstandend(stdscr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int update_window(WIN window, int x, int y)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* u p d a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Update a window leaving the cursor at a given object location.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (disabled)
|
||||
enable(window);
|
||||
|
||||
wmove(stdscr, y, x);
|
||||
wrefresh(stdscr);
|
||||
#ifdef DEBUG_CURSES
|
||||
if (debug_curses) {
|
||||
fprintf(log_file, "wrefresh\n");
|
||||
fprintf(log_file, "wmove %d %d\n", y, x);
|
||||
}
|
||||
#endif
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
#include <curses.h>
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#include <string.h>
|
||||
|
||||
SCHAR get_line();
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
SCHAR *argv[];
|
||||
{
|
||||
int i;
|
||||
SSHORT x, y, sw_read;
|
||||
FILE *log_file;
|
||||
SCHAR log_file_name[128], line[128], *command, *s;
|
||||
|
||||
sw_read = 0;
|
||||
if (argc > 1)
|
||||
strcpy(log_file_name, argv[1]);
|
||||
else {
|
||||
fprintf(stderr, "Must give log file name.\n");
|
||||
exit(1);
|
||||
}
|
||||
if (argc > 2) {
|
||||
s = argv[2];
|
||||
if ((*s++ == '-') && ((*s == 'r') || (*s == 'R')))
|
||||
sw_read = 1;
|
||||
else {
|
||||
fprintf(stderr, "unrecognized switch");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (!(log_file = fopen(log_file_name, "r"))) {
|
||||
fprintf(stderr, "Error opening log file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (get_line(log_file, line) != EOF) {
|
||||
command = strtok(line, " ");
|
||||
if (!strcmp(command, "initscr"))
|
||||
initscr();
|
||||
else if (!strcmp(command, "endwin"))
|
||||
endwin();
|
||||
else if (!strcmp(command, "saveterm")) {
|
||||
saveterm();
|
||||
}
|
||||
else if (!strcmp(command, "resetterm")) {
|
||||
resetterm();
|
||||
}
|
||||
else if (!strcmp(command, "fixterm")) {
|
||||
fixterm();
|
||||
}
|
||||
else if (!strcmp(command, "clear"))
|
||||
clear();
|
||||
else if (!strcmp(command, "echo"))
|
||||
echo();
|
||||
else if (!strcmp(command, "noecho"))
|
||||
noecho();
|
||||
else if (!strcmp(command, "crmode"))
|
||||
crmode();
|
||||
else if (!strcmp(command, "nocrmode"))
|
||||
nocrmode();
|
||||
else if (!strcmp(command, "keypad")) {
|
||||
if (!strcmp(strtok(NULL, " "), "TRUE"))
|
||||
keypad(stdscr, TRUE);
|
||||
else
|
||||
keypad(stdscr, FALSE);
|
||||
}
|
||||
else if (!strcmp(command, "wrefresh"))
|
||||
wrefresh(stdscr);
|
||||
else if (!strcmp(command, "wstandend"))
|
||||
wstandend(stdscr);
|
||||
else if (!strcmp(command, "wstandout"))
|
||||
wstandout(stdscr);
|
||||
else if (!strcmp(command, "wmove")) {
|
||||
y = atoi(strtok(NULL, " "));
|
||||
x = atoi(strtok(NULL, " "));
|
||||
wmove(stdscr, y, x);
|
||||
}
|
||||
else if (!strcmp(command, "mvwaddstr")) {
|
||||
command = strtok(NULL, " ");
|
||||
y = atoi(command);
|
||||
command = strtok(NULL, " ");
|
||||
x = atoi(command);
|
||||
command += strlen(command) + 1;
|
||||
mvwaddstr(stdscr, y, x, command);
|
||||
}
|
||||
else if (!strcmp(command, "input")) {
|
||||
printf("enter something: ");
|
||||
get_line(stdin, line);
|
||||
}
|
||||
else if (!strcmp(command, "read")) {
|
||||
if (sw_read) {
|
||||
i = wgetch(stdscr);
|
||||
printf("read %d\n", i);
|
||||
}
|
||||
else
|
||||
sleep(5);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "unknown command %s\n", command);
|
||||
}
|
||||
fclose(log_file);
|
||||
}
|
||||
|
||||
SCHAR get_line(f, s)
|
||||
FILE *f;
|
||||
SCHAR *s;
|
||||
{
|
||||
SCHAR c;
|
||||
|
||||
while (((c = getc(f)) != '\n') && (c != EOF))
|
||||
*s++ = c;
|
||||
|
||||
*s = 0;
|
||||
|
||||
return c;
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: debug.c
|
||||
* DESCRIPTION: Form debugging stuff
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* $Id: debug.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $
|
||||
* Revision 1.2 2000/11/24 17:23:02 fsg
|
||||
* Another little fix in pyxis/debug.c that nobody
|
||||
* ever will notice :-)
|
||||
* Will print correct names for this forms stuff now.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/scr.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define INDENT 2
|
||||
|
||||
extern OBJ PYXIS_get_attribute_value();
|
||||
|
||||
/* changed "name" to #name to get what was intended
|
||||
FSG 24.Nov.2000
|
||||
*/
|
||||
#define ATT(name) #name,
|
||||
static SCHAR *attribute_names[] = {
|
||||
"att_any = 0",
|
||||
#include "../pyxis/attributes.h"
|
||||
"****"
|
||||
};
|
||||
#undef ATT
|
||||
|
||||
static ATT_N special_attributes[] = {
|
||||
att_display_x,
|
||||
att_display_y,
|
||||
att_scroll_x,
|
||||
att_scroll_y,
|
||||
att_width,
|
||||
att_height,
|
||||
att_border,
|
||||
att_index,
|
||||
att_inactive,
|
||||
att_reverse_video,
|
||||
att_bold,
|
||||
att_underline,
|
||||
att_box,
|
||||
att_blank,
|
||||
att_insert_right,
|
||||
att_updatable_flag,
|
||||
att_wakeup_flag,
|
||||
att_reverse_for_update,
|
||||
att_any
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
int PYXIS_print(OBJ object, USHORT level)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ p r i n t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
SSHORT l;
|
||||
int value;
|
||||
ATT_N *ptr;
|
||||
ATT attribute;
|
||||
|
||||
for (l = level; l; --l)
|
||||
putchar(' ');
|
||||
|
||||
printf("%x object (%x)\n", object, object->obj_flags);
|
||||
level += INDENT;
|
||||
|
||||
for (ptr = special_attributes; *ptr != att_any; ptr++)
|
||||
if (value = GET_VALUE(object, *ptr)) {
|
||||
for (l = level; l; --l)
|
||||
putchar(' ');
|
||||
printf("[ %s = %d ]\n", attribute_names[(int) *ptr], value);
|
||||
}
|
||||
|
||||
for (attribute = object->obj_attributes; attribute;
|
||||
attribute = attribute->att_next) {
|
||||
for (l = level; l; --l)
|
||||
putchar(' ');
|
||||
printf(attribute_names[(int) attribute->att_name]);
|
||||
switch (attribute->att_type) {
|
||||
case attype_numeric:
|
||||
printf(" = %d\n", attribute->att_value);
|
||||
break;
|
||||
|
||||
case attype_string:
|
||||
printf(" = \"%s\"\n", attribute->att_value);
|
||||
break;
|
||||
|
||||
case attype_other:
|
||||
printf(" = %x\n", attribute->att_value);
|
||||
break;
|
||||
|
||||
case attype_object:
|
||||
printf("\n");
|
||||
PYXIS_print(attribute->att_value, level + INDENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_print_screen(SCR screen, UCHAR *text)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ p r i n t _ s c r e e n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Print a logical screen for debugging purposes.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR buffer[1024], *p, *last;
|
||||
USHORT x, y, *data, *end;
|
||||
|
||||
printf("%s\n++++++++++\n", text);
|
||||
|
||||
for (y = 0; y < screen->scr_height; y++) {
|
||||
data = screen->scr_screen + y * screen->scr_line_length + 1;
|
||||
end = data + screen->scr_width;
|
||||
p = last = buffer;
|
||||
while (data < end) {
|
||||
*p = *data++;
|
||||
if (*p++ != ' ')
|
||||
last = p;
|
||||
}
|
||||
*last = 0;
|
||||
printf("%s\n", buffer);
|
||||
}
|
||||
|
||||
printf("----------\n");
|
||||
}
|
1894
src/pyxis/edit.cpp
1894
src/pyxis/edit.cpp
File diff suppressed because it is too large
Load Diff
1455
src/pyxis/edit.e
1455
src/pyxis/edit.e
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
"24O18D`VALUES`2N23.3N1.5N6.E25O13D`VALUES`50N40.21N10.23N8.\
|
||||
52N1.51O5N40.E2N6.3N2.5N42.4N16.48N1.10N1.9N1.E5N55.4N22.48N\
|
||||
1.10N1.9N1.E"
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/all.h"
|
||||
#include "../pyxis/scr.h"
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
"24O18D`FIELD_NAME`2N2.3N1.5N11.E24O18D`F`2N2.3N1.5N1.E24O18\
|
||||
D`F`2N2.3N1.5N1.E25O13S`FIELD_NAME`21N1.23N31.35S`X(31)`20D`\
|
||||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`44N1.2N14.3N1.5N31.52N1.E24O\
|
||||
18D`EDIT_STRING`2N1.3N2.5N12.E25O13S`EDIT_STRING`21N1.23N31.\
|
||||
35S`X(31)`44N1.20D`XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`2N14.3N2.\
|
||||
5N31.52N1.E24O18D`FILL_STRING`2N1.3N3.5N12.E25O13S`FILL_STRI\
|
||||
NG`21N1.23N255.35S`X(255)`20D`XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\
|
||||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\
|
||||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\
|
||||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\
|
||||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`2N14.3N3.5N255\
|
||||
.52N1.E24O18D`UPCASE`2N6.3N5.5N7.E25O13S`UPCASE`21N1.23N1.35\
|
||||
S`X(1)`20D`X`44N1.53S`N`53S`Y`2N14.3N5.5N1.52N1.E24O18D`WIDT\
|
||||
H`2N7.3N6.5N6.E25O13S`WIDTH`21N4.23N2.35S`zz9`20D`999`2N14.3\
|
||||
N6.5N3.31N1.52N1.E24O18D`DATATYPE`2N27.3N5.5N9.E25O13S`DATAT\
|
||||
YPE`21N1.23N8.35S`x(8)`20D`XXXXXXXX`44N1.53S`CHAR`53S`VARYIN\
|
||||
G`53S`SHORT`53S`LONG`53S`FLOAT`53S`DOUBLE`53S`DATE`53S`BLOB`\
|
||||
2N37.3N5.5N8.52N1.E24O18D`SCALE`2N27.3N6.5N6.E25O13S`SCALE`2\
|
||||
1N4.23N2.35S`--9`20D` `2N37.3N6.5N3.31N1.52N1.E25O13S`ALIG\
|
||||
N_RIGHT`35S`X`20D`X`44N1.21N1.23N1.53S`N`53S`Y`2N14.3N7.5N1.\
|
||||
52N1.E24O18D`LENGTH`2N27.3N7.5N7.E25O13S`LENGTH`21N4.23N2.35\
|
||||
S`ZZ9`20D`999`2N37.3N7.5N3.31N1.52N1.E24O18D`ALIGN_RIGHT`2N1\
|
||||
.3N7.5N11.E5N48.4N11.48N1.10N1.9N1.E"
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
"24O18D`Field name:`5N11.E25O21N1.23N31.35S`x(31)`20D`xxxxxx\
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxx`44N1.13S`FIELD_NAME`2N12.5N31.6N1.\
|
||||
EE"
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
"24O18D`File name:`3N1.5N10.E25O21N1.23N63.13S`FILE_NAME`35S\
|
||||
`X(63)`20D`XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\
|
||||
XXXXXXXXXXXXXX`2N12.3N1.5N63.6N1.E5N78.4N3.E"
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
gds_dyn_version_1,
|
||||
gds_dyn_begin,
|
||||
gds_dyn_def_global_fld, 10,0, 'P','Y','X','I','S','$','F','O','R','M',
|
||||
gds_dyn_system_flag, 2,0, 2,0,
|
||||
gds_dyn_fld_type, 2,0, 5,1,
|
||||
gds_dyn_fld_length, 2,0, 8,0,
|
||||
gds_dyn_fld_scale, 2,0, 0,0,
|
||||
gds_dyn_fld_sub_type, 2,0, 0,0,
|
||||
gds_dyn_fld_segment_length, 2,0, 'P',0,
|
||||
gds_dyn_end,
|
||||
gds_dyn_def_global_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E',
|
||||
gds_dyn_system_flag, 2,0, 2,0,
|
||||
gds_dyn_fld_type, 2,0, 14,0,
|
||||
gds_dyn_fld_length, 2,0, 31,0,
|
||||
gds_dyn_fld_scale, 2,0, 0,0,
|
||||
gds_dyn_fld_sub_type, 2,0, 0,0,
|
||||
gds_dyn_end,
|
||||
gds_dyn_def_global_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','T','Y','P','E',
|
||||
gds_dyn_system_flag, 2,0, 2,0,
|
||||
gds_dyn_fld_type, 2,0, 14,0,
|
||||
gds_dyn_fld_length, 2,0, 16,0,
|
||||
gds_dyn_fld_scale, 2,0, 0,0,
|
||||
gds_dyn_fld_sub_type, 2,0, 0,0,
|
||||
gds_dyn_end,
|
||||
gds_dyn_def_rel, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S',
|
||||
gds_dyn_system_flag, 2,0, 2,0,
|
||||
gds_dyn_end,
|
||||
gds_dyn_def_local_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E',
|
||||
gds_dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S',
|
||||
gds_dyn_system_flag, 2,0, 2,0,
|
||||
gds_dyn_fld_position, 2,0, 1,0,
|
||||
gds_dyn_end,
|
||||
gds_dyn_def_local_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','T','Y','P','E',
|
||||
gds_dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S',
|
||||
gds_dyn_system_flag, 2,0, 2,0,
|
||||
gds_dyn_fld_position, 2,0, 2,0,
|
||||
gds_dyn_end,
|
||||
gds_dyn_def_local_fld, 10,0, 'P','Y','X','I','S','$','F','O','R','M',
|
||||
gds_dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S',
|
||||
gds_dyn_system_flag, 2,0, 2,0,
|
||||
gds_dyn_fld_position, 2,0, 3,0,
|
||||
gds_dyn_end,
|
||||
gds_dyn_def_idx, 11,0, 'P','Y','X','I','S','$','I','N','D','E','X',
|
||||
gds_dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S',
|
||||
gds_dyn_idx_unique, 2,0, 1,0,
|
||||
gds_dyn_idx_inactive, 2,0, 0,0,
|
||||
gds_dyn_fld_name, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E',
|
||||
gds_dyn_end,
|
||||
gds_dyn_end,
|
||||
gds_dyn_eoc
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
"24O5N10.2N0.3N0.6N0.18D`Form name:`E25O21N1.23N31.13S`FORM_\
|
||||
NAME`5N31.35S`x(31)`20D`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`2N11\
|
||||
.3N0.6N1.44N1.E1N0.E"
|
Binary file not shown.
@ -1,818 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: fred.e
|
||||
* DESCRIPTION: Forms editor
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* $Id: fred.epp,v 1.1 2001-07-12 06:32:04 bellardo Exp $
|
||||
* Revision 1.2 2000/11/28 15:09:01 fsg
|
||||
* Changed fred.e to go through 6.0 gpre
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../jrd/common.h"
|
||||
#include "../jrd/gds.h"
|
||||
#include "../jrd/license.h"
|
||||
#define FRED_SOURCE 1
|
||||
#include "../pyxis/pyxis.h"
|
||||
|
||||
DATABASE db = STATIC "forms.gdb";
|
||||
|
||||
static OBJ form_names(), relations();
|
||||
static OBJ form_menu, relation_menu, name_prompt, file_prompt,
|
||||
help_prompt, resize_form;
|
||||
static OBJ get_form(), get_relation();
|
||||
|
||||
|
||||
extern SCHAR *gds__alloc(), *PYXIS_get_keyname();
|
||||
extern OBJ PYXIS_relation_form(), PYXIS_create_object(),
|
||||
PYXIS_get_attribute_value(), PYXIS_menu(),
|
||||
PYXIS_relation_fields(), PYXIS_load();
|
||||
extern ATT PYXIS_find_object(), PYXIS_find_attribute();
|
||||
|
||||
|
||||
typedef enum opt_t {
|
||||
e_none = 0,
|
||||
e_exit,
|
||||
e_help,
|
||||
e_change,
|
||||
e_create,
|
||||
e_edit,
|
||||
e_delete,
|
||||
e_automatic,
|
||||
e_replace,
|
||||
e_resize,
|
||||
e_store,
|
||||
e_write,
|
||||
e_print,
|
||||
e_trash
|
||||
} OPT_T;
|
||||
|
||||
static TEXT form_resize[] =
|
||||
#include "../pyxis/size_form.h"
|
||||
, form_file_name[] =
|
||||
#include "../pyxis/file_name.h"
|
||||
, form_form_name[] =
|
||||
#include "../pyxis/form_name.h"
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
TEXT *argv[];
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* m a i n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Top level function for form editor.
|
||||
*
|
||||
**************************************/
|
||||
TEXT *filename, *inputfile, *logfile, *p, **end, sw_version;
|
||||
WIN window;
|
||||
|
||||
/* Setting defaults and processing switches */
|
||||
|
||||
gds__width = 0;
|
||||
gds__height = 40;
|
||||
filename = inputfile = logfile = NULL;
|
||||
sw_version = FALSE;
|
||||
|
||||
#ifdef VMS
|
||||
argc = VMS_parse(&argv, argc);
|
||||
#endif
|
||||
|
||||
for (end = argv + argc, argv++; argv < end;) {
|
||||
p = *argv++;
|
||||
if (*p == '-')
|
||||
switch (UPPER(p[1])) {
|
||||
case 'H':
|
||||
gds__height = atoi(*argv++);
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
gds__width = atoi(*argv++);
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
if (!sw_version)
|
||||
printf("fred version %s\n", GDS_VERSION);
|
||||
sw_version = TRUE;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
if (argv < end) {
|
||||
logfile = *argv++;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,
|
||||
"Please retry, supplying a log file name /n");
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
case 'F':
|
||||
if (argv < end) {
|
||||
inputfile = *argv++;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,
|
||||
"Please retry, supplying an input file name /n");
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
default:
|
||||
fprintf(stderr, "unknown switch %s\n", p);
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
else
|
||||
filename = p;
|
||||
}
|
||||
|
||||
if (!filename) {
|
||||
fprintf(stderr, "fred: database file name is required\n");
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
/* Initialize the forms package, fire up the database, create a window
|
||||
and generally get ready to roll. */
|
||||
|
||||
READY GDS_VAL(filename) AS db;
|
||||
|
||||
if (sw_version) {
|
||||
printf(" Version(s) for database \"%s\"\n", filename);
|
||||
gds__version(&db, NULL_PTR, NULL_PTR);
|
||||
}
|
||||
|
||||
START_TRANSACTION;
|
||||
CREATE_WINDOW;
|
||||
|
||||
PYXIS_define_forms_relation(&db);
|
||||
window = (WIN) gds__window;
|
||||
|
||||
if ((inputfile && !PYXIS_trace_in(gds__window, inputfile)) ||
|
||||
(logfile && !PYXIS_trace_out(gds__window, logfile)))
|
||||
fprintf(stderr, "fred: can't open inputfile/logfile\n");
|
||||
else
|
||||
while (top_menu(window));
|
||||
|
||||
DELETE_WINDOW;
|
||||
COMMIT;
|
||||
FINISH;
|
||||
exit(FINI_OK);
|
||||
}
|
||||
|
||||
|
||||
static center_menu(menu, offset)
|
||||
OBJ menu;
|
||||
USHORT offset;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c e n t e r _ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Format a nice, center, externally visible menu.
|
||||
*
|
||||
**************************************/
|
||||
USHORT x;
|
||||
|
||||
x = (gds__width - GET_VALUE(menu, att_width)) / 2 + offset;
|
||||
PYXIS_position(menu, x, 1);
|
||||
}
|
||||
|
||||
|
||||
static create_form(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c r e a t e _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create a new form.
|
||||
*
|
||||
**************************************/
|
||||
OBJ form, relation;
|
||||
|
||||
if (relation = get_relation(window))
|
||||
form = PYXIS_relation_form(window, relation);
|
||||
else
|
||||
form = PYXIS_create_object(NULL_PTR, 0);
|
||||
|
||||
edit_form(window, form, NULL_PTR);
|
||||
}
|
||||
|
||||
|
||||
static delete_form(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d e l e t e _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Delete an existing form from the database.
|
||||
*
|
||||
**************************************/
|
||||
TEXT form_name[32];
|
||||
OBJ form;
|
||||
|
||||
/* Get form. If this returns a null string, something was
|
||||
wrong with the form. Since we want to delete it, this
|
||||
is ok. Then delete the form */
|
||||
|
||||
get_form(window, form_name);
|
||||
|
||||
FOR X IN PYXIS$FORMS WITH X.PYXIS$FORM_NAME EQ form_name
|
||||
ERASE X;
|
||||
END_FOR;
|
||||
|
||||
pyxis__delete(&form_menu);
|
||||
form_menu = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static edit_form(window, form, form_name)
|
||||
WIN window;
|
||||
OBJ form;
|
||||
TEXT *form_name;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e d i t _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Edit an form. Start with the existing forms.
|
||||
*
|
||||
**************************************/
|
||||
TEXT *p;
|
||||
STATUS status[20];
|
||||
USHORT change;
|
||||
|
||||
/* Eat up options until exit */
|
||||
|
||||
PYXIS_push_form(window, form, TRUE);
|
||||
change = FALSE;
|
||||
|
||||
for (;;)
|
||||
CASE_MENU(HORIZONTAL) 'Edit type:'
|
||||
MENU_ENTREE 'EDIT':
|
||||
change |= PYXIS_edit(window, form, &db, &gds__trans);
|
||||
|
||||
MENU_ENTREE 'REFORMAT':
|
||||
PYXIS_format_form(form, gds__width, gds__height);
|
||||
change = TRUE;
|
||||
|
||||
MENU_ENTREE 'SIZE':
|
||||
size_form(window, form);
|
||||
|
||||
MENU_ENTREE 'Exit':
|
||||
save_form(window, form, form_name);
|
||||
pyxis__pop_window(&window);
|
||||
return;
|
||||
END_MENU;
|
||||
}
|
||||
|
||||
|
||||
static OBJ form_names()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* f o r m _ n a m e s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get menu of all forms, etc.
|
||||
*
|
||||
**************************************/
|
||||
OBJ menu;
|
||||
|
||||
menu = PYXIS_create_object(NULL_PTR, 0);
|
||||
|
||||
FOR X IN PYXIS$FORMS SORTED BY X.PYXIS$FORM_NAME
|
||||
zap_string(X.PYXIS$FORM_NAME);
|
||||
PYXIS_create_entree(menu, X.PYXIS$FORM_NAME, 0, 0);
|
||||
END_FOR;
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
static OBJ get_form(window, form_buffer)
|
||||
WIN window;
|
||||
UCHAR *form_buffer;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a form off the form menu.
|
||||
*
|
||||
**************************************/
|
||||
OBJ entree, form;
|
||||
ATT attribute;
|
||||
STATUS status[20];
|
||||
TEXT *form_name;
|
||||
|
||||
*form_buffer = 0;
|
||||
|
||||
if (!form_menu) {
|
||||
form_menu = form_names();
|
||||
PYXIS_reference(form_menu);
|
||||
PYXIS_create_entree(form_menu, "Exit", attype_numeric, e_exit);
|
||||
PYXIS_format_menu(form_menu, "Select Form for Operation", FALSE);
|
||||
center_menu(form_menu, 0);
|
||||
}
|
||||
|
||||
/* Before we start, mark all forms as inactive */
|
||||
|
||||
for (attribute = NULL;
|
||||
attribute = PYXIS_find_object(form_menu, attribute, att_entree, TRUE);)
|
||||
if ((form = GET_OBJECT(attribute->att_value, att_entree_value))
|
||||
&& (SLONG) form != (SLONG) e_exit)
|
||||
REPLACE_ATTRIBUTE(form, att_inactive, attype_numeric, TRUE);
|
||||
|
||||
PYXIS_push_form(window, form_menu, TRUE);
|
||||
entree = PYXIS_menu(window, form_menu);
|
||||
pyxis__pop_window(&window);
|
||||
|
||||
if (!entree)
|
||||
return NULL;
|
||||
|
||||
if ((OPT_T) GET_VALUE(entree, att_entree_value) == e_exit)
|
||||
return NULL;
|
||||
|
||||
form_name = GET_STRING(entree, att_literal_string);
|
||||
strcpy(form_buffer, form_name);
|
||||
|
||||
if (form = GET_OBJECT(entree, att_entree_value)) {
|
||||
REPLACE_ATTRIBUTE(form, att_inactive, attype_numeric, FALSE);
|
||||
return form;
|
||||
}
|
||||
|
||||
pyxis__load_form(status, &db, &gds__trans, &form, NULL_PTR, form_name);
|
||||
|
||||
if (!form)
|
||||
return NULL;
|
||||
|
||||
REPLACE_ATTRIBUTE(entree, att_entree_value, attype_object, form);
|
||||
REPLACE_ATTRIBUTE(form, att_inactive, attype_numeric, FALSE);
|
||||
|
||||
return form;
|
||||
}
|
||||
|
||||
|
||||
static OBJ get_relation(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ r e l a t i o n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Pick a relation off a menu.
|
||||
*
|
||||
**************************************/
|
||||
OBJ entree, relation;
|
||||
ATT attribute;
|
||||
TEXT *relation_name;
|
||||
|
||||
if (!relation_menu) {
|
||||
relation_menu = relations();
|
||||
PYXIS_reference(relation_menu);
|
||||
PYXIS_create_entree(relation_menu, "None of the above",
|
||||
attype_numeric, e_exit);
|
||||
PYXIS_format_menu(relation_menu, "Select Relation", FALSE);
|
||||
center_menu(relation_menu, 0);
|
||||
}
|
||||
|
||||
/* Before we start, mark all relations as inactive */
|
||||
|
||||
for (attribute = NULL;
|
||||
attribute = PYXIS_find_object(relation_menu, attribute, att_entree, TRUE);)
|
||||
if ((relation = GET_OBJECT(attribute->att_value, att_entree_value))
|
||||
&& (SLONG) relation != (SLONG) e_exit)
|
||||
REPLACE_ATTRIBUTE(relation, att_inactive, attype_numeric, TRUE);
|
||||
|
||||
PYXIS_push_form(window, relation_menu, TRUE);
|
||||
entree = PYXIS_menu(window, relation_menu);
|
||||
pyxis__pop_window(&window);
|
||||
|
||||
if (!entree ||
|
||||
(SLONG) (relation = GET_OBJECT(entree, att_entree_value)) == (SLONG) e_exit)
|
||||
return NULL;
|
||||
|
||||
/* Get the relation from either the selected entree or from the database */
|
||||
|
||||
if (relation)
|
||||
REPLACE_ATTRIBUTE(relation, att_inactive, attype_numeric, FALSE);
|
||||
else {
|
||||
relation_name = GET_STRING(entree, att_literal_string);
|
||||
relation = PYXIS_relation_fields(&db, &gds__trans, relation_name);
|
||||
PYXIS_format_menu(relation, "Select Field(s)", FALSE);
|
||||
PYXIS_box(relation);
|
||||
PUT_ATTRIBUTE(entree, att_entree_value, attype_object, relation);
|
||||
PUT_ATTRIBUTE(relation, att_display_x, attype_numeric,
|
||||
strlen(relation_name));
|
||||
}
|
||||
|
||||
return relation;
|
||||
}
|
||||
|
||||
|
||||
static manual_load(handle, def)
|
||||
OBJ *handle;
|
||||
TEXT *def;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* m a n u a l _ l o a d
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Manually load a form from a literal, unless it is
|
||||
* already loaded.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (!*handle)
|
||||
*handle = PYXIS_load(&def);
|
||||
}
|
||||
|
||||
|
||||
static OBJ relations()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* r e l a t i o n s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get menu of all relations, etc.
|
||||
*
|
||||
**************************************/
|
||||
OBJ menu, entree;
|
||||
|
||||
menu = PYXIS_create_object(NULL_PTR, 0);
|
||||
|
||||
FOR X IN RDB$RELATIONS WITH X.RDB$SYSTEM_FLAG == 0 SORTED BY X.RDB$RELATION_NAME
|
||||
zap_string(X.RDB$RELATION_NAME);
|
||||
PYXIS_create_entree(menu, X.RDB$RELATION_NAME, 0, NULL_PTR);
|
||||
END_FOR;
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
static size_form(window, form)
|
||||
WIN window;
|
||||
OBJ form;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s i z e _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Change size or outline of form.
|
||||
*
|
||||
**************************************/
|
||||
USHORT c, width, height, x, y, box;
|
||||
|
||||
manual_load(&resize_form, form_resize);
|
||||
PYXIS_compute_size(resize_form, &x, &y);
|
||||
x = (gds__width - x) / 2;
|
||||
y = (gds__height - y) / 2;
|
||||
PYXIS_position(resize_form, x, y);
|
||||
|
||||
/* Compute "current" size of form */
|
||||
|
||||
box = GET_VALUE(form, att_box);
|
||||
width = GET_VALUE(form, att_width);
|
||||
height = GET_VALUE(form, att_height);
|
||||
PYXIS_compute_size(form, &x, &y);
|
||||
|
||||
if (!width)
|
||||
width = x + 2;
|
||||
if (!height)
|
||||
height = y + 2;
|
||||
|
||||
FOR FORM(FORM_HANDLE resize_form TRANSPARENT) X IN SIZE_FORM
|
||||
X.WIDTH = width;
|
||||
X.HEIGHT = height;
|
||||
strcpy(X.OUTLINE_FORM, (box) ? "Y" : "N");
|
||||
DISPLAY X DISPLAYING *ACCEPTING *;
|
||||
if (X.TERMINATOR != PYXIS__KEY_ENTER) {
|
||||
pyxis__pop_window(&gds__window);
|
||||
return;
|
||||
}
|
||||
if (X.WIDTH.STATE == PYXIS__OPT_USER_DATA)
|
||||
REPLACE_ATTRIBUTE(form, att_width, attype_numeric, X.WIDTH);
|
||||
if (X.HEIGHT.STATE == PYXIS__OPT_USER_DATA)
|
||||
REPLACE_ATTRIBUTE(form, att_height, attype_numeric, X.HEIGHT);
|
||||
if (X.OUTLINE_FORM.STATE == PYXIS__OPT_USER_DATA)
|
||||
if (X.OUTLINE_FORM[0] == 'Y') {
|
||||
REPLACE_ATTRIBUTE(form, att_box, attype_numeric, TRUE);
|
||||
REPLACE_ATTRIBUTE(form, att_blank, attype_numeric, TRUE);
|
||||
REPLACE_ATTRIBUTE(form, att_border, attype_numeric, TRUE);
|
||||
REPLACE_ATTRIBUTE(form, att_width, attype_numeric, X.WIDTH);
|
||||
REPLACE_ATTRIBUTE(form, att_height, attype_numeric, X.HEIGHT);
|
||||
}
|
||||
else {
|
||||
PYXIS_delete_named_attribute(form, att_box);
|
||||
PYXIS_delete_named_attribute(form, att_blank);
|
||||
PYXIS_delete_named_attribute(form, att_border);
|
||||
}
|
||||
END_FORM;
|
||||
}
|
||||
|
||||
|
||||
static save_form(window, form, form_name)
|
||||
WIN window;
|
||||
OBJ form;
|
||||
TEXT *form_name;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s a v e _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Save, rename, or junk a form.
|
||||
*
|
||||
**************************************/
|
||||
OBJ entree;
|
||||
ATT attribute;
|
||||
OPT_T option;
|
||||
TEXT *p, *file_name;
|
||||
|
||||
if (form_name) {
|
||||
CASE_MENU(HORIZONTAL) 'Retention options:'
|
||||
MENU_ENTREE 'SAVE':
|
||||
option = e_replace;
|
||||
MENU_ENTREE 'RENAME':
|
||||
option = e_store;
|
||||
MENU_ENTREE 'DISCARD':
|
||||
option = e_trash;
|
||||
MENU_ENTREE 'EXTERNAL FILE':
|
||||
option = e_write;
|
||||
END_MENU
|
||||
}
|
||||
else {
|
||||
CASE_MENU(HORIZONTAL) 'Retention options:'
|
||||
MENU_ENTREE 'SAVE':
|
||||
option = e_store;
|
||||
MENU_ENTREE 'DISCARD':
|
||||
option = e_trash;
|
||||
MENU_ENTREE 'EXTERNAL FILE':
|
||||
option = e_write;
|
||||
END_MENU;
|
||||
}
|
||||
switch (option) {
|
||||
case e_trash:
|
||||
pyxis__delete(&form);
|
||||
return;
|
||||
|
||||
case e_replace:
|
||||
break;
|
||||
|
||||
case e_store:
|
||||
manual_load(&name_prompt, form_form_name);
|
||||
FOR FORM(TAG FORM_HANDLE name_prompt) F IN FORM_NAME
|
||||
for (;;) {
|
||||
DISPLAY F ACCEPTING FORM_NAME WAKING ON FORM_NAME;
|
||||
if (F.FORM_NAME.STATE != PYXIS__OPT_USER_DATA)
|
||||
return;
|
||||
if (validate_name(F.FORM_NAME))
|
||||
break;
|
||||
}
|
||||
form_name = F.FORM_NAME;
|
||||
END_FORM;
|
||||
break;
|
||||
|
||||
case e_write:
|
||||
if (!file_prompt) {
|
||||
p = form_file_name;
|
||||
file_prompt = PYXIS_load(&p);
|
||||
}
|
||||
FOR FORM(TAG FORM_HANDLE file_prompt) F IN FILE_NAME
|
||||
DISPLAY F ACCEPTING FILE_NAME WAKING ON FILE_NAME;
|
||||
if (F.FILE_NAME.STATE == PYXIS__OPT_USER_DATA)
|
||||
write_file(form, F.FILE_NAME);
|
||||
END_FORM;
|
||||
return;
|
||||
}
|
||||
|
||||
/* The form is either replacing or stored new. In either case,
|
||||
handle it. */
|
||||
|
||||
PYXIS_store_form(&db, &gds__trans, form_name, form);
|
||||
|
||||
/* If a form by that name already exists, replace it. Otherwise rebuild
|
||||
the form menu */
|
||||
|
||||
if (form_menu) {
|
||||
for (attribute = NULL;
|
||||
attribute =
|
||||
PYXIS_find_object(form_menu, attribute, att_entree, TRUE);) {
|
||||
entree = (OBJ) attribute->att_value;
|
||||
if ((p = GET_STRING(entree, att_literal_string)) &&
|
||||
!strcmp(p, form_name)) {
|
||||
REPLACE_ATTRIBUTE(entree, att_entree_value, attype_object,
|
||||
form);
|
||||
return;
|
||||
}
|
||||
}
|
||||
pyxis__delete(&form_menu);
|
||||
form_menu = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static top_menu(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* t o p _ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Main menu for forms editor.
|
||||
*
|
||||
**************************************/
|
||||
OBJ form;
|
||||
TEXT name_buffer[32];
|
||||
|
||||
CASE_MENU(VERTICAL) 'Pick one, please'
|
||||
MENU_ENTREE 'EDIT FORM':
|
||||
if (form = get_form(window, name_buffer))
|
||||
edit_form(window, PYXIS_clone(form), name_buffer);
|
||||
|
||||
MENU_ENTREE 'CREATE FORM':
|
||||
create_form(window);
|
||||
|
||||
MENU_ENTREE 'DELETE FORM':
|
||||
delete_form(window);
|
||||
|
||||
MENU_ENTREE 'COMMIT':
|
||||
COMMIT;
|
||||
START_TRANSACTION;
|
||||
|
||||
MENU_ENTREE 'ROLLBACK':
|
||||
ROLLBACK;
|
||||
START_TRANSACTION;
|
||||
|
||||
MENU_ENTREE 'Exit Form Editor':
|
||||
return FALSE;
|
||||
|
||||
END_MENU;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static write_file(form, file_name)
|
||||
OBJ form;
|
||||
TEXT *file_name;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* w r i t e _ f i l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Write a raw form image to a file.
|
||||
*
|
||||
**************************************/
|
||||
FILE *file;
|
||||
TEXT *buffer, *ptr, static_buffer[1024];
|
||||
USHORT length, l;
|
||||
|
||||
/* Open output file */
|
||||
|
||||
if (!(file = fopen(file_name, "w")))
|
||||
return FAILURE;
|
||||
|
||||
/* Get a buffer large enough to hold form representation */
|
||||
|
||||
length = PYXIS_dump_length(form);
|
||||
if (length < sizeof(static_buffer))
|
||||
buffer = static_buffer;
|
||||
else
|
||||
buffer = gds__alloc(length + 4);
|
||||
|
||||
/* Dump form to memory */
|
||||
|
||||
ptr = buffer;
|
||||
PYXIS_dump(form, &ptr);
|
||||
|
||||
/* Dump form to file */
|
||||
|
||||
fputs("\"", file);
|
||||
|
||||
for (ptr = buffer, l = 2; length; --length, l++, ptr++) {
|
||||
putc(*ptr, file);
|
||||
if (l == 60) {
|
||||
fputs("\\\n", file);
|
||||
l = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fputs("\"\n", file);
|
||||
fclose(file);
|
||||
|
||||
if (buffer != static_buffer)
|
||||
gds__free(buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static validate_name(string)
|
||||
TEXT *string;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* v a l i d a t e _ n a m e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Validate a file and/or form name.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
for (; *string; string++)
|
||||
if (*string == ' ' || *string == '\t')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static zap_string(string)
|
||||
TEXT *string;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* z a p _ s t r i n g
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Zap trailing blanks in a string.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
while (*string && *string != ' ')
|
||||
string++;
|
||||
|
||||
*string = 0;
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: keys.h
|
||||
* DESCRIPTION: logical key definitions
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _PYXIS_KEYS_H_
|
||||
#define _PYXIS_KEYS_H_
|
||||
|
||||
/* Special Characters */
|
||||
|
||||
#define C_EOF 26
|
||||
|
||||
#define C_DELETE 127
|
||||
#define C_UP 128
|
||||
#define C_DOWN 129
|
||||
#define C_RIGHT 130
|
||||
#define C_LEFT 131
|
||||
#define C_PF1 132
|
||||
#define C_PF2 133
|
||||
#define C_PF3 134
|
||||
#define C_PF4 135
|
||||
#define C_PF5 136
|
||||
#define C_PF6 137
|
||||
#define C_PF7 138
|
||||
#define C_PF8 139
|
||||
#define C_PF9 140
|
||||
#define C_ENTER 141
|
||||
#define C_SCROLL_TOP 146
|
||||
#define C_SCROLL_BOTTOM 147
|
||||
|
||||
#define C_VERT_BAR 148
|
||||
#define C_HORZ_BAR 149
|
||||
#define C_UL_CORNER 150
|
||||
#define C_UR_CORNER 151
|
||||
#define C_LL_CORNER 152
|
||||
#define C_LR_CORNER 153
|
||||
|
||||
/* Field editing keys. */
|
||||
|
||||
#define C_EDIT 160
|
||||
#define C_INSERT_OVERSTRIKE 161
|
||||
#define C_DELETE_NEXT 162
|
||||
#define C_GOTO_START 163
|
||||
#define C_GOTO_END 164
|
||||
#define C_ERASE 165
|
||||
|
||||
#endif /* _PYXIS_KEYS_H_ */
|
@ -1,397 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: menu.c
|
||||
* DESCRIPTION: Menu manipulation routines
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../pyxis/pyxis.h"
|
||||
|
||||
|
||||
static ATT lookup_entree(OBJ , ATT , TEXT *);
|
||||
|
||||
|
||||
|
||||
|
||||
int PYXIS_box(int object)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ b o x
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Box a complete object.
|
||||
*
|
||||
**************************************/
|
||||
USHORT width, height;
|
||||
|
||||
width = GET_VALUE((OBJ) object, att_width);
|
||||
height = GET_VALUE((OBJ) object, att_height);
|
||||
|
||||
if (!width || !height) {
|
||||
PYXIS_compute_size((OBJ) object, &width, &height);
|
||||
width += 3;
|
||||
height += 3;
|
||||
}
|
||||
|
||||
REPLACE_ATTRIBUTE(object, att_width, attype_numeric, width);
|
||||
REPLACE_ATTRIBUTE(object, att_height, attype_numeric, height);
|
||||
REPLACE_ATTRIBUTE(object, att_box, attype_numeric, TRUE);
|
||||
REPLACE_ATTRIBUTE(object, att_blank, attype_numeric, TRUE);
|
||||
REPLACE_ATTRIBUTE(object, att_border, attype_numeric, 1);
|
||||
}
|
||||
|
||||
|
||||
ATT PYXIS_create_entree(OBJ menu, TEXT *string, int type, BLK value)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ c r e a t e _ e n t r e e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Add another entree to a menu.
|
||||
*
|
||||
**************************************/
|
||||
OBJ object;
|
||||
|
||||
object = PYXIS_create_object(string, att_literal_string);
|
||||
|
||||
if (type)
|
||||
PUT_ATTRIBUTE(object, att_entree_value,(enum att_t)type, (OBJ) value);
|
||||
|
||||
return PUT_ATTRIBUTE(menu, att_entree, attype_object, object);
|
||||
}
|
||||
|
||||
|
||||
OBJ PYXIS_drive_menu(WIN window, OBJ menu, USHORT *terminator)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ d r i v e _ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Drive a menu, return selected object and terminator.
|
||||
*
|
||||
**************************************/
|
||||
ATT attribute, prior;
|
||||
OBJ entree;
|
||||
TEXT string[32], *p;
|
||||
USHORT c, direction, horizontal;
|
||||
|
||||
*terminator = 0;
|
||||
PYXIS_scroll_reset(menu);
|
||||
|
||||
/* Reset all bolding */
|
||||
|
||||
attribute = NULL;
|
||||
|
||||
while (attribute = PYXIS_find_object(menu, attribute, att_entree, TRUE))
|
||||
REPLACE_ATTRIBUTE(attribute->att_value, att_reverse_video,
|
||||
attype_numeric, 0);
|
||||
|
||||
p = string;
|
||||
|
||||
/* If there is an initial character that uniquely identifies the entree,
|
||||
just return it immediately. */
|
||||
|
||||
if (!attribute &&
|
||||
!(attribute = PYXIS_find_object(menu, 0, att_entree, TRUE)))
|
||||
return NULL;
|
||||
|
||||
horizontal = (menu->obj_flags & OBJ_menu_horizontal);
|
||||
|
||||
prior = NULL;
|
||||
|
||||
for (;;) {
|
||||
entree = (OBJ) attribute->att_value;
|
||||
if (prior != attribute) {
|
||||
if (prior)
|
||||
REPLACE_ATTRIBUTE(prior->att_value, att_reverse_video,
|
||||
attype_numeric, 0);
|
||||
REPLACE_ATTRIBUTE(entree, att_reverse_video, attype_numeric, 1);
|
||||
}
|
||||
c = PYXIS_get_char(window, entree, -1, 0);
|
||||
prior = attribute;
|
||||
|
||||
switch (c) {
|
||||
case C_ENTER:
|
||||
case '\n':
|
||||
*terminator = c;
|
||||
return entree;
|
||||
|
||||
case C_UP:
|
||||
case C_LEFT:
|
||||
case C_DOWN:
|
||||
case C_RIGHT:
|
||||
p = string;
|
||||
if (attribute = PYXIS_navigate(menu, attribute, att_entree, c))
|
||||
break;
|
||||
|
||||
direction = (c == C_UP || c == C_LEFT) ? FALSE : TRUE;
|
||||
|
||||
if (!(window->win_flags & WIN_synthesized)
|
||||
|| (horizontal && (c == C_RIGHT || c == C_LEFT))
|
||||
|| (!horizontal && (c == C_UP || c == C_DOWN)))
|
||||
attribute = PYXIS_find_object(menu, 0, att_entree, direction);
|
||||
else
|
||||
attribute = prior;
|
||||
|
||||
break;
|
||||
|
||||
case C_SCROLL_TOP:
|
||||
attribute = PYXIS_find_object(menu, 0, att_entree, TRUE);
|
||||
break;
|
||||
|
||||
case C_SCROLL_BOTTOM:
|
||||
attribute = PYXIS_find_object(menu, 0, att_entree, FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!isprint(c)) {
|
||||
*terminator = c;
|
||||
return entree;
|
||||
}
|
||||
|
||||
*p++ = c;
|
||||
*p = 0;
|
||||
if (attribute = lookup_entree(menu, 0, string))
|
||||
break;
|
||||
p = string;
|
||||
*p++ = c;
|
||||
*p = 0;
|
||||
if (attribute = lookup_entree(menu, 0, string))
|
||||
break;
|
||||
p = string;
|
||||
attribute = prior;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int PYXIS_format_menu(OBJ menu, TEXT *string, int horizontal)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ f o r m a t _ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
ATT attribute;
|
||||
OBJ object, label;
|
||||
USHORT count, x, y, length, delta_y, max_width, string_length;
|
||||
|
||||
/* Clear out any previous formatting. */
|
||||
|
||||
REPLACE_ATTRIBUTE(menu, att_width, attype_numeric, 0);
|
||||
REPLACE_ATTRIBUTE(menu, att_height, attype_numeric, 0);
|
||||
REPLACE_ATTRIBUTE(menu, att_box, attype_numeric, FALSE);
|
||||
REPLACE_ATTRIBUTE(menu, att_blank, attype_numeric, FALSE);
|
||||
REPLACE_ATTRIBUTE(menu, att_border, attype_numeric, 0);
|
||||
|
||||
|
||||
string_length = max_width = 0;
|
||||
label = NULL;
|
||||
|
||||
/* If there is a title, make up an object to display it */
|
||||
|
||||
if (string) {
|
||||
label = PYXIS_create_object(string, att_literal_string);
|
||||
REPLACE_ATTRIBUTE(menu, att_label, attype_object, label);
|
||||
string_length = max_width = strlen(string);
|
||||
}
|
||||
|
||||
/* Count objects and pick up length of the various entrees */
|
||||
|
||||
attribute = NULL;
|
||||
count = 0;
|
||||
|
||||
while (attribute = PYXIS_find_object(menu, attribute, att_entree, TRUE)) {
|
||||
++count;
|
||||
object = (OBJ) attribute->att_value;
|
||||
length = GET_VALUE(object, att_width);
|
||||
max_width = MAX(max_width, length);
|
||||
}
|
||||
|
||||
max_width += 2;
|
||||
delta_y = (count < 10) ? 2 : 1;
|
||||
|
||||
/* Initial things for either vertical or horizontal formatting */
|
||||
|
||||
x = y = 0;
|
||||
|
||||
if (!horizontal)
|
||||
x = (max_width - string_length) / 2;
|
||||
|
||||
/* Position menu title */
|
||||
|
||||
if (label) {
|
||||
REPLACE_ATTRIBUTE(label, att_display_x, attype_numeric, x);
|
||||
REPLACE_ATTRIBUTE(label, att_display_y, attype_numeric, y);
|
||||
if (horizontal)
|
||||
x += 2 + string_length;
|
||||
else
|
||||
y += 2;
|
||||
}
|
||||
|
||||
/* Format entrees */
|
||||
|
||||
while (attribute = PYXIS_find_object(menu, attribute, att_entree, TRUE)) {
|
||||
object = (OBJ) attribute->att_value;
|
||||
length = GET_VALUE(object, att_width);
|
||||
if (!horizontal)
|
||||
x = (max_width - length) / 2;
|
||||
REPLACE_ATTRIBUTE(object, att_display_x, attype_numeric, x);
|
||||
REPLACE_ATTRIBUTE(object, att_display_y, attype_numeric, y);
|
||||
if (horizontal)
|
||||
x += 2 + length;
|
||||
else
|
||||
y += delta_y;
|
||||
}
|
||||
|
||||
if (!horizontal)
|
||||
PYXIS_box((int) menu);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
OBJ PYXIS_menu(WIN window, OBJ menu)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Drive a menu, return selected object.
|
||||
*
|
||||
**************************************/
|
||||
USHORT c;
|
||||
|
||||
return PYXIS_drive_menu(window, menu, &c);
|
||||
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int PYXIS_select(WIN window, OBJ menu, ATT_N attribute_name, ATT start)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ s e l e c t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Drive a menu, but allow selection of multiple items. Selection
|
||||
* for an entree is visually indicated by toggling reverse video.
|
||||
* For now, the reverse video attribute also indicates selection.
|
||||
*
|
||||
**************************************/
|
||||
ATT attribute, prior;
|
||||
OBJ entree;
|
||||
TEXT string[32], *p;
|
||||
UCHAR c;
|
||||
|
||||
if (!(attribute = start) &&
|
||||
!(attribute = PYXIS_find_object(menu, 0, attribute_name, TRUE)))
|
||||
return NULL;
|
||||
|
||||
p = string;
|
||||
|
||||
for (;;) {
|
||||
entree = (OBJ) attribute->att_value;
|
||||
c = PYXIS_get_char(window, entree, -1, 0);
|
||||
if (c == C_ENTER)
|
||||
return NULL;
|
||||
prior = attribute;
|
||||
switch (c) {
|
||||
case '\n':
|
||||
REPLACE_ATTRIBUTE(entree, att_reverse_video, attype_numeric,
|
||||
!GET_VALUE(entree, att_reverse_video));
|
||||
break;
|
||||
|
||||
case C_DOWN:
|
||||
case C_RIGHT:
|
||||
case C_UP:
|
||||
case C_LEFT:
|
||||
p = string;
|
||||
if (!
|
||||
(attribute =
|
||||
PYXIS_navigate(menu, attribute, attribute_name,
|
||||
c))) attribute = prior;
|
||||
break;
|
||||
|
||||
default:
|
||||
*p++ = c;
|
||||
*p = 0;
|
||||
if (attribute = lookup_entree(menu, 0, string))
|
||||
break;
|
||||
p = string;
|
||||
*p++ = c;
|
||||
*p = 0;
|
||||
if (attribute = lookup_entree(menu, 0, string))
|
||||
break;
|
||||
p = string;
|
||||
attribute = prior;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ATT lookup_entree(OBJ menu, ATT attribute, TEXT *string)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* l o o k u p _ e n t r e e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Lookup the next entree that matches a string.
|
||||
*
|
||||
**************************************/
|
||||
OBJ entree;
|
||||
TEXT *p, *q;
|
||||
|
||||
while (attribute = PYXIS_find_object(menu, attribute, att_entree, TRUE)) {
|
||||
entree = (OBJ) attribute->att_value;
|
||||
if (!(p = GET_STRING(entree, att_literal_string)))
|
||||
continue;
|
||||
for (q = string; *p && *q; p++, q++)
|
||||
if (UPPER(*p) != UPPER(*q))
|
||||
break;
|
||||
if (!*q)
|
||||
return attribute;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: phase1.h
|
||||
* DESCRIPTION: General header module
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _PYXIS_PHASE1_H_
|
||||
#define _PYXIS_PHASE1_H_
|
||||
|
||||
/* Reset levels */
|
||||
|
||||
#define PYXIS_reset_update 4
|
||||
#define PYXIS_reset_data 2
|
||||
#define PYXIS_reset_control 1
|
||||
|
||||
/* Define attributes */
|
||||
|
||||
#define ATT(name) name,
|
||||
typedef enum att_n {
|
||||
att_any = 0,
|
||||
#include "../pyxis/attributes.h"
|
||||
att_max
|
||||
} ATT_N;
|
||||
#undef ATT
|
||||
|
||||
typedef enum att_t {
|
||||
attype_numeric = 1, /* numeric value */
|
||||
attype_string, /* string address */
|
||||
attype_object, /* an object */
|
||||
attype_other /* used for att_picture */
|
||||
} ATT_T;
|
||||
|
||||
#endif /* _PYXIS_PHASE1_H_ */
|
@ -1,835 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: phase2.c
|
||||
* DESCRIPTION: High level form oriented primitives
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include <setjmp.h>
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/phase2.h"
|
||||
|
||||
#include "../jrd/val.h"
|
||||
|
||||
static OBJ walk_repeating(WIN , OBJ , LLS *, USHORT *);
|
||||
static OBJ walk_form(WIN , OBJ , LLS *, USHORT *);
|
||||
static ATT find_starting(OBJ , USHORT , USHORT , LLS *);
|
||||
static int set_fld_options(OBJ , SLONG , SLONG );
|
||||
|
||||
extern int MOVP_get_string( DSC *, TEXT **, VARY *, USHORT );
|
||||
extern BLK PYXIS_pop(register LLS *);
|
||||
extern int PYXIS_push(BLK , register LLS *);
|
||||
|
||||
|
||||
extern PIC PICSTR_analyze(TEXT*, DSC*);
|
||||
extern int PICSTR_edit ( DSC*, PIC, TEXT**,USHORT);
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
OBJ PYXIS_find_field(OBJ form, TEXT *field_name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ f i n d _ f i e l d
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Lookup a field in a form definition. If the field doesn't
|
||||
* exist, return NULL. If the field name is NULL, assume that
|
||||
* a field handle was supplied in lieu of form handle/field name.
|
||||
*
|
||||
**************************************/
|
||||
ATT attribute;
|
||||
OBJ field;
|
||||
TEXT *name;
|
||||
|
||||
if (!field_name)
|
||||
return form;
|
||||
|
||||
for (attribute = NULL;
|
||||
attribute = PYXIS_find_object(form, attribute, att_field, TRUE);) {
|
||||
field = attribute->att_value;
|
||||
if (name = GET_STRING(field, att_field_name))
|
||||
if (!strcmp(name, field_name))
|
||||
return field;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
OBJ PYXIS_find_index(OBJ form, USHORT index)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ f i n d _ i n d e x
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Find a field by index in a repeating form.
|
||||
*
|
||||
**************************************/
|
||||
OBJ field;
|
||||
ATT attribute;
|
||||
|
||||
for (attribute = NULL;
|
||||
attribute = PYXIS_find_object(form, attribute, att_field, TRUE);) {
|
||||
field = attribute->att_value;
|
||||
if (GET_VALUE(field, att_index) == index)
|
||||
return field;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
TEXT *PYXIS_format_field(OBJ field, DSC *desc, TEXT *buffer)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ f o r m a t _ f i e l d
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Given a field and a value, try to edit the value. If there is
|
||||
* an edit string specified, edit value and return the running
|
||||
* output address. If there isn't an edit string, return NULL.
|
||||
*
|
||||
**************************************/
|
||||
ATT attribute;
|
||||
DSC desc2;
|
||||
PIC picture;
|
||||
TEXT *edit_string;
|
||||
|
||||
/* Find processed "picture" attribute. If it exists, look for
|
||||
a raw picture string; it this exists, pre-process it. If, in
|
||||
the end, a picture string is found, edit the value using it */
|
||||
|
||||
if (!(picture = (PIC) GET_STRING(field, att_picture))) {
|
||||
if (!(edit_string = GET_STRING(field, att_edit_string)))
|
||||
return NULL;
|
||||
picture = PICSTR_analyze(edit_string, &desc2);
|
||||
PUT_ATTRIBUTE(field, att_picture, attype_other, (OBJ)picture);
|
||||
}
|
||||
|
||||
PICSTR_edit(desc, picture, &buffer, 32000);
|
||||
*buffer = 0;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
TEXT *PYXIS_get_string(OBJ form, TEXT *field_name, USHORT type)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ g e t _ s t r i n g
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a string, any string.
|
||||
* The latest, of course, the better.
|
||||
* NOTE: This routine obsolete;
|
||||
* left in for compatibility during dev't.
|
||||
*
|
||||
**************************************/
|
||||
TEXT *string;
|
||||
OBJ field;
|
||||
|
||||
if (!(field = PYXIS_find_field(form, field_name))) /* 0))) */
|
||||
return NULL;
|
||||
|
||||
switch (type) {
|
||||
case PYXIS_user_data:
|
||||
return GET_STRING(field, att_update_data);
|
||||
case PYXIS_any_data:
|
||||
if (string = GET_STRING(field, att_update_data))
|
||||
return string;
|
||||
case PYXIS_prog_data:
|
||||
return GET_STRING(field, att_data);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*if (string = (GET_STRING (field, att_update_data))
|
||||
return string;
|
||||
|
||||
return GET_STRING (field, att_data);*/
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int PYXIS_get_updated(OBJ form, TEXT *field_name, TEXT **p)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ g e t _ u p d a t e d
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* (This routine is a replacement for PYXIS_gget_string (sic).
|
||||
* PYXIS_gget_string is left in for compatibilitiy during dev't.)
|
||||
* Determine what data is out there and return it.
|
||||
*
|
||||
**************************************/
|
||||
OBJ field;
|
||||
|
||||
*p = NULL;
|
||||
|
||||
if (!(field = PYXIS_find_field(form, field_name)))
|
||||
return PYXIS_no_field;
|
||||
|
||||
if (*p = GET_STRING(field, att_update_data))
|
||||
return PYXIS_user_data;
|
||||
|
||||
if (GET_VALUE(field, att_data))
|
||||
return PYXIS_prog_data;
|
||||
|
||||
return PYXIS_missing_data;
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
int PYXIS_purge_segments(OBJ field, int index)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ p u r g e _ s e g m e n t s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Purge trailing segments from a blob.
|
||||
*
|
||||
**************************************/
|
||||
ATT attribute, attr;
|
||||
OBJ segment;
|
||||
|
||||
/* Look for field object already created */
|
||||
|
||||
for (attribute = field->obj_attributes; attr = attribute;) {
|
||||
attribute = attribute->att_next;
|
||||
if (attr->att_name != att_field)
|
||||
continue;
|
||||
segment = attr->att_value;
|
||||
if (segment->obj_index >= index)
|
||||
PYXIS_delete_attribute(field, attr);
|
||||
}
|
||||
|
||||
if (index <= 1 && (segment = GET_OBJECT(field, att_prototype)))
|
||||
REPLACE_ATTRIBUTE(segment, att_inactive, attype_numeric, FALSE);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_put_desc(OBJ field, DSC *desc)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ p u t _ d e s c
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Establish a value for a field.
|
||||
*
|
||||
**************************************/
|
||||
TEXT *edit_string, *p, edit_buffer[256];
|
||||
USHORT l;
|
||||
ATT attribute;
|
||||
|
||||
if (!PYXIS_format_field(field, desc, edit_buffer)) {
|
||||
p = edit_buffer;
|
||||
if (l =
|
||||
MOVP_get_string(desc, &edit_string, (VARY*)edit_buffer,
|
||||
sizeof(edit_buffer)))
|
||||
do
|
||||
*p++ = *edit_string++;
|
||||
while (--l);
|
||||
}
|
||||
|
||||
/* Replace the old data attribute */
|
||||
|
||||
attribute =
|
||||
REPLACE_ATTRIBUTE(field, att_data, attype_string, edit_buffer);
|
||||
PYXIS_set_display_attribute(field, attribute);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
int PYXIS_put_segment(OBJ field, TEXT *string, int index)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ p u t _ s e g m e n t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Add a segment to a blob.
|
||||
*
|
||||
**************************************/
|
||||
ATT attribute;
|
||||
OBJ segment;
|
||||
|
||||
if ((segment = PYXIS_find_index(field, index)) &&
|
||||
segment->obj_rel_y == index) {
|
||||
REPLACE_ATTRIBUTE(segment, att_width, attype_numeric, strlen(string));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (segment = GET_OBJECT(field, att_prototype)) {
|
||||
segment = PYXIS_clone(segment);
|
||||
attribute =
|
||||
REPLACE_ATTRIBUTE(segment, att_data, attype_string, string);
|
||||
PYXIS_set_display_attribute(segment, attribute);
|
||||
}
|
||||
else
|
||||
segment = PYXIS_create_object(string, att_data);
|
||||
|
||||
REPLACE_ATTRIBUTE(segment, att_index, attype_numeric, index);
|
||||
REPLACE_ATTRIBUTE(segment, att_display_y, attype_numeric, index - 1);
|
||||
PUT_ATTRIBUTE(field, att_field, attype_object, segment);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
ATT PYXIS_replicate_prototype(OBJ form, OBJ prototype, USHORT index)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ r e p l i c a t e _ p r o t o t y p e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Replicate prototype sub-object,
|
||||
* clearing away extraneous stuff..
|
||||
*
|
||||
**************************************/
|
||||
OBJ clone;
|
||||
USHORT height;
|
||||
|
||||
if (!(height = GET_VALUE(prototype, att_height)))
|
||||
height = 1;
|
||||
|
||||
PYXIS_scroll_reset(form);
|
||||
clone = PYXIS_clone(prototype);
|
||||
|
||||
REPLACE_ATTRIBUTE(clone, att_index, attype_numeric, index);
|
||||
REPLACE_ATTRIBUTE(clone, att_display_y, attype_numeric,
|
||||
height * (index - 1));
|
||||
|
||||
REPLACE_ATTRIBUTE(clone, att_updatable_flag, attype_numeric, TRUE);
|
||||
REPLACE_ATTRIBUTE(clone, att_inactive, attype_numeric, FALSE);
|
||||
|
||||
return PUT_ATTRIBUTE(form, att_field, attype_object, clone);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_set_field_options(OBJ form, TEXT *field_name, SLONG options, SLONG mask)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ s e t _ f i e l d _ o p t i o n s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Lookup field on form and update field options. If the field
|
||||
* name is given as "all", update all fields on form.
|
||||
*
|
||||
**************************************/
|
||||
ATT attribute;
|
||||
OBJ field;
|
||||
|
||||
/* Handle the simple version first */
|
||||
|
||||
if (field_name && !strcmp(field_name, "all")) {
|
||||
for (attribute = NULL;
|
||||
attribute = PYXIS_find_object(form, attribute, att_field, TRUE);)
|
||||
set_fld_options(attribute->att_value, options, mask);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!(field = PYXIS_find_field(form, field_name)))
|
||||
return FALSE;
|
||||
|
||||
set_fld_options(field, options, mask);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
OBJ PYXIS_update(WIN window, OBJ form, LLS *context_stack, USHORT *terminator)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* P Y X I S _ u p d a t e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Update stuff.
|
||||
*
|
||||
**************************************/
|
||||
LLS *context, temp;
|
||||
OBJ field;
|
||||
|
||||
/* If no stack given, make a temp one. */
|
||||
|
||||
if (!(context = context_stack)) {
|
||||
temp = NULL;
|
||||
context = &temp;
|
||||
}
|
||||
|
||||
/* If no context, try to stack the first updatable field.
|
||||
If we don't find one, walk_form will find a first. */
|
||||
|
||||
if (!*context)
|
||||
find_starting(form, TRUE, FALSE, context);
|
||||
|
||||
for (;;) {
|
||||
*terminator = 0;
|
||||
if ((field = walk_form(window, form, context, terminator)) ||
|
||||
!*terminator || (*terminator >= C_PF1 && *terminator <= C_ENTER))
|
||||
break;
|
||||
}
|
||||
|
||||
if ((LLS) context == temp)
|
||||
while (temp)
|
||||
LLS_POP(&temp);
|
||||
|
||||
return field;
|
||||
}
|
||||
|
||||
|
||||
static ATT find_starting(OBJ form, USHORT direction, USHORT any, LLS *out_stack)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* f i n d _ s t a r t i n g
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Find a starting field for form navigation
|
||||
* and stack the fields leading to it.
|
||||
* ASSUME AT LEAST ONE OBJECT (LABEL, FLD) IN A SUBFORM!!
|
||||
*
|
||||
**************************************/
|
||||
ATT attr, start, real_start;
|
||||
OBJ field;
|
||||
|
||||
/* For forms with say, all text that expect a TERMINATOR, position on first label? */
|
||||
|
||||
start = NULL;
|
||||
attr = NULL;
|
||||
|
||||
/* During a search for updatables, if a proto has an updatable field but
|
||||
no instantiations, return field but don't stack it. */
|
||||
|
||||
if (!any) {
|
||||
while (attr = start =
|
||||
PYXIS_find_object(form, attr, att_field, direction)) {
|
||||
field = attr->att_value;
|
||||
if (GET_VALUE(field, att_updatable_flag))
|
||||
break;
|
||||
if ((field = GET_OBJECT(field, att_prototype)) &&
|
||||
(start = find_starting(field, direction, FALSE, out_stack))) {
|
||||
/* Hmmm... for recursion, may have to send in a loc stack ,
|
||||
then pop from one to the other */
|
||||
LLS_POP(out_stack);
|
||||
if ((field = GET_OBJECT(field, att_field)) &&
|
||||
(real_start =
|
||||
find_starting(field, direction, FALSE,
|
||||
out_stack))) start = real_start;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (attr)
|
||||
LLS_PUSH((BLK)attr, out_stack);
|
||||
return start;
|
||||
}
|
||||
|
||||
while (attr = start = PYXIS_find_object(form, attr, att_field, direction)) {
|
||||
field = attr->att_value;
|
||||
if (!(field = GET_OBJECT(field, att_prototype)))
|
||||
break;
|
||||
if (!PYXIS_find_object(field, 0, att_any, direction))
|
||||
break;
|
||||
if (start = find_starting(field, direction, TRUE, out_stack))
|
||||
break;
|
||||
}
|
||||
if (attr)
|
||||
LLS_PUSH((BLK)attr, out_stack);
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
static int set_fld_options(OBJ field, SLONG options, SLONG mask)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s e t _ f l d _ o p t i o n s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Set various field masks.
|
||||
*
|
||||
**************************************/
|
||||
ATT_N display_attribute;
|
||||
ATT attribute;
|
||||
USHORT flag;
|
||||
|
||||
/* Handle field wake up & updatability flags */
|
||||
|
||||
if (options & PYXIS_wakeup)
|
||||
REPLACE_ATTRIBUTE(field, att_wakeup_flag, attype_numeric,
|
||||
(mask & PYXIS_wakeup) ? TRUE : FALSE);
|
||||
|
||||
if (options & PYXIS_updatable) {
|
||||
flag = (mask & PYXIS_updatable) ? TRUE : FALSE;
|
||||
REPLACE_ATTRIBUTE(field, att_updatable_flag, attype_numeric, flag);
|
||||
if (GET_VALUE(field, att_reverse_for_update))
|
||||
REPLACE_ATTRIBUTE(field, att_reverse_video, attype_numeric, flag);
|
||||
}
|
||||
/*
|
||||
/* Handle automatic upcase flag
|
||||
if (options & PYXIS_upcase)
|
||||
REPLACE_ATTRIBUTE (field, att_upcase, attype_numeric,
|
||||
(mask & PYXIS_upcase) ? TRUE : FALSE);
|
||||
/* Handle wakeup string option
|
||||
if (options & PYXIS_wakeup_string & ~mask)
|
||||
PYXIS_delete_named_attribute (field, att_wakeup_string);
|
||||
*/
|
||||
/* Handle update data option & program data option */
|
||||
|
||||
if (options & PYXIS_update_present & ~mask)
|
||||
PYXIS_delete_named_attribute(field, att_update_data);
|
||||
|
||||
if (options & PYXIS_data_present & ~mask)
|
||||
PYXIS_delete_named_attribute(field, att_data);
|
||||
|
||||
/* Handle repeating sub-items */
|
||||
|
||||
if (options & PYXIS_repeating_items & ~mask)
|
||||
PYXIS_purge_segments(field, 1);
|
||||
|
||||
/* Handle various display masks */
|
||||
|
||||
display_attribute = att_any;
|
||||
|
||||
if (options & PYXIS_update_displayed) {
|
||||
attribute = NULL;
|
||||
if (mask & PYXIS_update_displayed)
|
||||
attribute = GET_ATTRIBUTE(field, att_update_data);
|
||||
if (!attribute)
|
||||
display_attribute = att_data;
|
||||
PYXIS_set_display_attribute(field, attribute);
|
||||
}
|
||||
|
||||
if (options & PYXIS_data_displayed) {
|
||||
attribute = NULL;
|
||||
if (mask & PYXIS_data_displayed)
|
||||
attribute = GET_ATTRIBUTE(field, att_data);
|
||||
if (!attribute)
|
||||
display_attribute = att_fill_string;
|
||||
PYXIS_set_display_attribute(field, attribute);
|
||||
}
|
||||
|
||||
if (options & PYXIS_fill_displayed) {
|
||||
attribute = (mask & PYXIS_fill_displayed) ?
|
||||
GET_ATTRIBUTE(field, att_fill_string) : NULL;
|
||||
if (!attribute)
|
||||
display_attribute = att_any;
|
||||
PYXIS_set_display_attribute(field, attribute);
|
||||
}
|
||||
|
||||
if (display_attribute != att_any &&
|
||||
(attribute = GET_ATTRIBUTE(field, display_attribute)))
|
||||
PYXIS_set_display_attribute(field, attribute);
|
||||
|
||||
/* Recurse where appropriate */
|
||||
|
||||
for (attribute = NULL;
|
||||
attribute = PYXIS_find_object(field, attribute, att_field, TRUE);)
|
||||
set_fld_options(attribute->att_value, options, mask);
|
||||
|
||||
for (attribute = NULL;
|
||||
attribute =
|
||||
PYXIS_find_object(field, attribute, att_prototype,
|
||||
TRUE);) set_fld_options(attribute->att_value,
|
||||
options, mask);
|
||||
}
|
||||
|
||||
|
||||
static OBJ walk_form(WIN window, OBJ form, LLS *context, USHORT *terminator)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* w a l k _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Walk around form, updating things updatable.
|
||||
* If the user tries to move "off" the form, return.
|
||||
*
|
||||
**************************************/
|
||||
ATT field, new_field;
|
||||
OBJ field_object, woken_field;
|
||||
USHORT lc, direction;
|
||||
|
||||
new_field = NULL;
|
||||
direction = TRUE;
|
||||
|
||||
/* If there is no first field on the context stack, find one */
|
||||
|
||||
if (*context || find_starting(form, direction, TRUE, context))
|
||||
field = (ATT) LLS_POP(context);
|
||||
else
|
||||
BUGCHECK("Forms sans fields not implemented");;
|
||||
|
||||
for (;;) {
|
||||
switch (lc = *terminator) {
|
||||
case C_SCROLL_TOP:
|
||||
new_field = PYXIS_find_object(form, 0, att_field, TRUE);
|
||||
if (new_field == field)
|
||||
new_field = NULL;
|
||||
break;
|
||||
case C_SCROLL_BOTTOM:
|
||||
new_field = PYXIS_find_object(form, 0, att_field, FALSE);
|
||||
if (new_field == field)
|
||||
new_field = NULL;
|
||||
break;
|
||||
case C_UP:
|
||||
case C_DOWN:
|
||||
case C_LEFT:
|
||||
case C_RIGHT:
|
||||
case '\n':
|
||||
case '\t':
|
||||
case C_DELETE:
|
||||
new_field = PYXIS_navigate(form, field, att_field, lc); /*context, */
|
||||
break;
|
||||
case C_EOF: /* should this be same as case n&t ? */
|
||||
case C_ENTER:
|
||||
case C_PF1:
|
||||
case C_PF2:
|
||||
case C_PF3:
|
||||
case C_PF4:
|
||||
case C_PF5:
|
||||
case C_PF6:
|
||||
case C_PF7:
|
||||
case C_PF8:
|
||||
case C_PF9:
|
||||
new_field = NULL;
|
||||
break;
|
||||
default:
|
||||
new_field = field;
|
||||
}
|
||||
|
||||
if (!new_field) {
|
||||
LLS_PUSH((BLK) field, context);
|
||||
return NULL;
|
||||
}
|
||||
field = new_field;
|
||||
field_object = field->att_value;
|
||||
|
||||
if (GET_ATTRIBUTE(field_object, att_prototype)) {
|
||||
if (woken_field =
|
||||
walk_repeating(window, field_object, context,
|
||||
terminator)) return woken_field;
|
||||
}
|
||||
else if (GET_VALUE(field_object, att_updatable_flag)) {
|
||||
if (PYXIS_get_data
|
||||
(window, field_object, att_update_data, form, terminator)
|
||||
&& GET_VALUE(field_object, att_wakeup_flag))
|
||||
return field_object;
|
||||
}
|
||||
else
|
||||
*terminator = PYXIS_get_char(window, field_object, 0, 0);
|
||||
} /* end for */
|
||||
}
|
||||
|
||||
|
||||
|
||||
static OBJ walk_repeating(WIN window, OBJ form, LLS *context, USHORT *terminator)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* w a l k _ r e p e a t i n g
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Walk around a repeating group. Replicate new
|
||||
* elements as required. If we try to step out of
|
||||
* the group, return. This is very hairy since if
|
||||
* we're walking a subform we mostly just need to
|
||||
* choose a repeating group & pass the info cleanly
|
||||
* to WALK_FORM, but if we're dealing with a blob,
|
||||
* we have to process characters here & so on...
|
||||
*
|
||||
**************************************/
|
||||
ATT attr;
|
||||
OBJ object, proto, woken_field;
|
||||
USHORT index, max_index, n, replicable, c;
|
||||
|
||||
proto = GET_OBJECT(form, att_prototype);
|
||||
replicable = FALSE;
|
||||
max_index = 0;
|
||||
c = 0;
|
||||
|
||||
/* Compute max index & determine replicability */
|
||||
|
||||
for (attr = NULL; attr = PYXIS_find_object(form, attr, att_field, FALSE);) {
|
||||
object = attr->att_value;
|
||||
n = GET_VALUE(object, att_index);
|
||||
max_index = MAX(n, max_index);
|
||||
}
|
||||
|
||||
if (GET_VALUE(form, att_updatable_flag))
|
||||
replicable = TRUE;
|
||||
else
|
||||
for (attr = NULL;
|
||||
attr = PYXIS_find_object(proto, attr, att_field, TRUE);) {
|
||||
object = attr->att_value;
|
||||
if (GET_VALUE(object, att_updatable_flag)) {
|
||||
replicable = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find starting index */
|
||||
|
||||
if (!(index = GET_VALUE(form, att_current_index)) && max_index)
|
||||
index = 1;
|
||||
|
||||
for (;;) {
|
||||
switch (c) {
|
||||
case C_SCROLL_TOP:
|
||||
if (index > 1) {
|
||||
index = 1;
|
||||
break;
|
||||
}
|
||||
REPLACE_ATTRIBUTE(form, att_current_index, attype_numeric, 0);
|
||||
*terminator = c;
|
||||
return NULL;
|
||||
case C_SCROLL_BOTTOM:
|
||||
if (index < max_index) {
|
||||
index = max_index;
|
||||
break;
|
||||
}
|
||||
REPLACE_ATTRIBUTE(form, att_current_index, attype_numeric,
|
||||
max_index);
|
||||
*terminator = c;
|
||||
return NULL;
|
||||
case C_UP:
|
||||
case C_DELETE:
|
||||
if (--index > 0)
|
||||
break;
|
||||
REPLACE_ATTRIBUTE(form, att_current_index, attype_numeric, 0);
|
||||
*terminator = c;
|
||||
return NULL;
|
||||
case C_DOWN:
|
||||
if (++index <= max_index)
|
||||
break;
|
||||
REPLACE_ATTRIBUTE(form, att_current_index, attype_numeric,
|
||||
max_index);
|
||||
*terminator = c;
|
||||
return NULL;
|
||||
case '\n':
|
||||
case '\t':
|
||||
++index;
|
||||
break;
|
||||
case C_EOF:
|
||||
PYXIS_purge_segments(form, index);
|
||||
REPLACE_ATTRIBUTE(form, att_current_index, attype_numeric, index);
|
||||
*terminator = 0;
|
||||
return NULL;
|
||||
case C_LEFT:
|
||||
case C_RIGHT:
|
||||
case C_ENTER:
|
||||
case C_PF1:
|
||||
case C_PF2:
|
||||
case C_PF3:
|
||||
case C_PF4:
|
||||
case C_PF5:
|
||||
case C_PF6:
|
||||
case C_PF7:
|
||||
case C_PF8:
|
||||
case C_PF9:
|
||||
REPLACE_ATTRIBUTE(form, att_current_index, attype_numeric, index);
|
||||
*terminator = c;
|
||||
return NULL;
|
||||
default:;
|
||||
}
|
||||
|
||||
if (!index) {
|
||||
if (!replicable)
|
||||
object = proto;
|
||||
else {
|
||||
REPLACE_ATTRIBUTE(proto, att_inactive, attype_numeric, TRUE);
|
||||
attr =
|
||||
PYXIS_replicate_prototype(form, proto,
|
||||
(max_index = ++index));
|
||||
object = attr->att_value;
|
||||
}
|
||||
}
|
||||
else if (index > max_index) {
|
||||
if (!replicable) {
|
||||
REPLACE_ATTRIBUTE(form, att_current_index, attype_numeric,
|
||||
max_index);
|
||||
*terminator = c;
|
||||
return NULL;
|
||||
}
|
||||
attr =
|
||||
PYXIS_replicate_prototype(form, proto, (max_index = index));
|
||||
object = attr->att_value;
|
||||
}
|
||||
else
|
||||
object = PYXIS_find_index(form, index);
|
||||
|
||||
/* Special case for a subform, then a blob */
|
||||
|
||||
if (PYXIS_find_object(object, 0, att_field, TRUE)) {
|
||||
if (woken_field = walk_form(window, object, context, &c)) {
|
||||
REPLACE_ATTRIBUTE(form, att_current_index, attype_numeric,
|
||||
index);
|
||||
*terminator = c;
|
||||
return woken_field;
|
||||
}
|
||||
}
|
||||
else if (replicable)
|
||||
PYXIS_get_data(window, object, att_update_data, form, &c);
|
||||
/* what does it mean to say "waking on" on a blob field? */
|
||||
else
|
||||
c = PYXIS_get_char(window, object, 0, 0);
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: phase2.h
|
||||
* DESCRIPTION: Form/field level interface definitions
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _PYXIS_PHASE2_H_
|
||||
#define _PYXIS_PHASE2_H_
|
||||
|
||||
/* Attribute identification */
|
||||
|
||||
#define PYXIS_no_field 0 /* Field not found */
|
||||
#define PYXIS_prog_data 1 /* Program supplied data */
|
||||
#define PYXIS_user_data 2 /* User supplied data */
|
||||
#define PYXIS_missing_data 3 /* Neither user nor program supplied data */
|
||||
#define PYXIS_any_data 3 /* OBSOLETE: left in for compatibility */
|
||||
|
||||
/* Options for field attribute calls */
|
||||
|
||||
#define PYXIS_clear 0
|
||||
|
||||
#define PYXIS_fill_displayed 1
|
||||
#define PYXIS_data_displayed 2
|
||||
#define PYXIS_update_displayed 4
|
||||
|
||||
#define PYXIS_data_present 8
|
||||
#define PYXIS_update_present 16
|
||||
|
||||
#define PYXIS_repeating_items 32
|
||||
|
||||
#define PYXIS_wakeup 64
|
||||
#define PYXIS_updatable 256
|
||||
|
||||
/*
|
||||
#define PYXIS_wakeup_string 128
|
||||
#define PYXIS_upcase 512
|
||||
#define PYXIS_must_fill 1024
|
||||
#define PYXIS_reset_scroll 2048
|
||||
*/
|
||||
|
||||
/* Convenient attribute group mask */
|
||||
|
||||
#define PYXIS_reset (-1 &~ PYXIS_fill_displayed)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern OBJ PYXIS_find_field(OBJ , TEXT *);
|
||||
extern OBJ PYXIS_update(WIN , OBJ , LLS *, USHORT *);
|
||||
extern OBJ PYXIS_find_index(OBJ , USHORT );
|
||||
extern ATT PYXIS_replicate_prototype(OBJ , OBJ , USHORT );
|
||||
extern int PYXIS_put_desc(OBJ , DSC *);
|
||||
extern int PYXIS_set_field_options(OBJ , TEXT *, SLONG , SLONG );
|
||||
extern int PYXIS_purge_segments(OBJ , int );
|
||||
int PYXIS_get_updated(OBJ , TEXT *, TEXT **);
|
||||
int PYXIS_put_segment(OBJ , TEXT *, int );
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _PYXIS_PHASE2_H_ */
|
1551
src/pyxis/phase3.cpp
1551
src/pyxis/phase3.cpp
File diff suppressed because it is too large
Load Diff
@ -1,32 +0,0 @@
|
||||
#ifndef _PYXIS_PHASE3_H_
|
||||
#define _PYXIS_PHASE3_H_
|
||||
|
||||
extern int pyxis__compile_map(STATUS *, OBJ *, MAP *, USHORT *, SCHAR *);
|
||||
extern int pyxis__compile_menu(WIN *, MENU *, USHORT *, TEXT *);
|
||||
extern int pyxis__compile_sub_map(STATUS *, MAP *, MAP *, USHORT *, SCHAR *);
|
||||
extern int pyxis__create_window(WIN *, USHORT *, TEXT *, USHORT *, USHORT *);
|
||||
extern int pyxis__delete(OBJ *);
|
||||
extern int pyxis__delete_window(SLONG *);
|
||||
extern int pyxis__drive_form(STATUS *, SLONG **, SLONG *, WIN *, MAP *,
|
||||
UCHAR *, UCHAR *);
|
||||
extern int pyxis__drive_menu(WIN *, MENU *, USHORT *, SCHAR *, USHORT *,
|
||||
TEXT *, USHORT *, USHORT *, TEXT *, SLONG *);
|
||||
extern int pyxis__fetch(STATUS *, SLONG **, SLONG *, MAP *, UCHAR *);
|
||||
extern int pyxis__get_entree(MENU *, USHORT *, TEXT *, SLONG *, USHORT *);
|
||||
extern int pyxis__initialize_menu(MENU *);
|
||||
extern int pyxis__insert(STATUS *, SLONG **, SLONG *, MAP *, UCHAR *);
|
||||
extern int pyxis__load_form(STATUS *, SLONG *, SLONG *, SLONG *, SSHORT *,
|
||||
SCHAR *);
|
||||
extern OBJ pyxis__menu(WIN *, MENU *, USHORT *, TEXT *);
|
||||
extern int pyxis__menu_d(WIN *, MENU *, USHORT *, TEXT *, OBJ *);
|
||||
#ifdef __cplusplus
|
||||
extern "C" int pyxis__pop_window(WIN *);
|
||||
#else
|
||||
extern int pyxis__pop_window(WIN *);
|
||||
#endif
|
||||
extern int pyxis__put_entree(MENU *, USHORT *, TEXT *, SLONG *);
|
||||
extern int pyxis__reset_form(STATUS *, MAP *);
|
||||
extern int pyxis__suspend_window(SLONG *);
|
||||
|
||||
|
||||
#endif
|
1444
src/pyxis/picstr.cpp
1444
src/pyxis/picstr.cpp
File diff suppressed because it is too large
Load Diff
2192
src/pyxis/pyxis.cpp
2192
src/pyxis/pyxis.cpp
File diff suppressed because it is too large
Load Diff
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: pyxis.h
|
||||
* DESCRIPTION: General header module
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _PYXIS_PYXIS_H_
|
||||
#define _PYXIS_PYXIS_H_
|
||||
|
||||
#include "../jrd/common.h"
|
||||
#include "../pyxis/keys.h"
|
||||
#include "../pyxis/phase1.h"
|
||||
|
||||
#define ALLOCD(type) PYXIS_alloc (PYXIS_default_pool, type, 1)
|
||||
#define ALLOCDV(type,repeat) PYXIS_alloc (PYXIS_default_pool, type, repeat)
|
||||
#define ALLOCP(type) PYXIS_alloc (PYXIS_permanent_pool, type, 1)
|
||||
#define ALLOCPV(type,repeat) PYXIS_alloc (PYXIS_permanent_pool, type, repeat)
|
||||
#define IBERROR(string) PYXIS_error (string)
|
||||
#define BUGCHECK(string) PYXIS_bugcheck (string)
|
||||
|
||||
#define GET_VALUE(obj, att) (SLONG) PYXIS_get_attribute_value (obj, att)
|
||||
#define GET_STRING(obj, att) (TEXT*) PYXIS_get_attribute_value (obj, att)
|
||||
#define GET_OBJECT(obj, att) PYXIS_get_attribute_value (obj, att)
|
||||
#define GET_ATTRIBUTE(obj, att) PYXIS_get_attribute (obj, att)
|
||||
#define REPLACE_ATTRIBUTE(a,b,c,d) PYXIS_replace_attribute((OBJ)(a),b,c,(OBJ)(d))
|
||||
#define PUT_ATTRIBUTE PYXIS_put_attribute
|
||||
#define SET_DISPLAY PYXIS_set_display
|
||||
|
||||
/**
|
||||
**#define DEBUG 1
|
||||
**/
|
||||
|
||||
#define BLKDEF(type, root, tail) type,
|
||||
enum blk_t
|
||||
{
|
||||
type_MIN = 0,
|
||||
#include "../pyxis/blk.h"
|
||||
type_MAX
|
||||
};
|
||||
#undef BLKDEF
|
||||
|
||||
/* Block types */
|
||||
|
||||
#ifndef INCLUDE_FB_BLK
|
||||
#include "../include/fb_blk.h"
|
||||
#endif
|
||||
|
||||
typedef struct vec {
|
||||
struct blk vec_header;
|
||||
ULONG vec_count;
|
||||
struct blk *vec_object[1];
|
||||
} *VEC;
|
||||
|
||||
#define LLS_PUSH(object, stack) PYXIS_push (object, stack)
|
||||
#define LLS_POP(stack) PYXIS_pop (stack)
|
||||
|
||||
typedef struct lls {
|
||||
struct blk lls_header;
|
||||
struct blk *lls_object;
|
||||
struct lls *lls_next;
|
||||
} *LLS;
|
||||
|
||||
/* Grab all our function prototypes */
|
||||
#include "../pyxis/pyxis_proto.h"
|
||||
|
||||
typedef struct map {
|
||||
struct blk map_header;
|
||||
WIN map_window; /* Active window */
|
||||
OBJ map_form; /* Associated form */
|
||||
OBJ map_parent; /* Repeating group parent object */
|
||||
OBJ map_prototype; /* Prototype for sub-form */
|
||||
USHORT map_count; /* Number of items */
|
||||
USHORT map_flags; /* Misc flags */
|
||||
USHORT map_terminator; /* Field to receive terminator */
|
||||
USHORT map_terminating_field; /* Field to receive field name */
|
||||
USHORT map_item_index; /* Field to receive item index */
|
||||
LLS map_context; /* Context to restart operation */
|
||||
USHORT map_wakeup_char; /* Wakeup character */
|
||||
struct map_repeat
|
||||
{
|
||||
DSC map_desc; /* Descriptor */
|
||||
OBJ map_field; /* Corresponding form field */
|
||||
TEXT *map_name; /* Field name */
|
||||
USHORT map_option; /* Slot for options (if any) */
|
||||
USHORT map_field_flags; /* Misc crud */
|
||||
} map_rpt [1];
|
||||
} *MAP;
|
||||
|
||||
#define MAP_options 1
|
||||
#define MAP_display 2
|
||||
#define MAP_update 4
|
||||
#define MAP_transparent 8
|
||||
#define MAP_tag 16
|
||||
|
||||
/* Random string block -- jack of all kludges */
|
||||
|
||||
typedef struct str {
|
||||
struct blk str_header;
|
||||
USHORT str_length;
|
||||
SCHAR str_data[2];
|
||||
} *STR;
|
||||
|
||||
|
||||
#endif /* _PYXIS_PYXIS_H_ */
|
@ -1,211 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: pyxis.h
|
||||
* DESCRIPTION: General header module
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _PYXIS_PYXIS_PROTO_H_
|
||||
#define _PYXIS_PYXIS_PROTO_H_
|
||||
|
||||
/* Attribute block names, types, and block */
|
||||
|
||||
typedef struct att {
|
||||
struct blk att_header;
|
||||
struct att *att_next; /* next attribute in object */
|
||||
struct att *att_prior; /* prior attribute in object */
|
||||
ATT_T att_type; /* attribute type */
|
||||
ATT_N att_name; /* attribute name */
|
||||
struct p_obj *att_value;
|
||||
USHORT att_length; /* Allocated length for string */
|
||||
UCHAR att_data[2]; /* room for data */
|
||||
} *ATT;
|
||||
|
||||
/* Menus */
|
||||
|
||||
typedef struct menx {
|
||||
UCHAR *menx_string;
|
||||
USHORT menx_entree;
|
||||
} *MENX;
|
||||
|
||||
typedef struct p_obj {
|
||||
struct blk obj_header;
|
||||
struct p_obj *obj_parent;
|
||||
USHORT obj_reference_count;
|
||||
ATT obj_attributes; /* list of attributes */
|
||||
ATT obj_end_attributes; /* end of attribute list */
|
||||
ATT obj_display_attribute; /* attribute for display (if any) */
|
||||
USHORT obj_flags; /* misc stuff */
|
||||
SSHORT obj_x; /* absolute position */
|
||||
SSHORT obj_y; /* absoute position */
|
||||
SSHORT obj_scroll_x; /* scrolled delta */
|
||||
SSHORT obj_scroll_y; /* scrolled delta */
|
||||
SSHORT obj_rel_x; /* relative position */
|
||||
SSHORT obj_rel_y; /* relative position */
|
||||
USHORT obj_width; /* displayed width */
|
||||
USHORT obj_height; /* displayed height */
|
||||
USHORT obj_occluded;
|
||||
USHORT *obj_display_address;
|
||||
USHORT obj_display_length;
|
||||
USHORT obj_display_height;
|
||||
USHORT obj_border; /* Size of border, if any */
|
||||
USHORT obj_index; /* Index in repeating group */
|
||||
} *OBJ;
|
||||
|
||||
#define OBJ_changed 1 /* object has been updated */
|
||||
#define OBJ_displayed 2 /* object is currently displayed */
|
||||
#define OBJ_inactive 4 /* don't display object */
|
||||
#define OBJ_reverse_video 8 /* reverse video */
|
||||
#define OBJ_insert_right 16 /* (10) insert from right (numeric) */
|
||||
#define OBJ_bold 32 /* (20) field is bold */
|
||||
#define OBJ_underline 64 /* (40) field is underlined */
|
||||
#define OBJ_box 128 /* (80) draw box around object */
|
||||
#define OBJ_blank 256 /* (100) blank fill before drawing */
|
||||
#define OBJ_updatable_flag 512 /* (200) object may be updated*/
|
||||
#define OBJ_wakeup_flag 1024 /* (400) object will trigger wakeup*/
|
||||
#define OBJ_reverse_for_update 2048 /* (800) when updatable, set reverse video*/
|
||||
#define OBJ_menu_horizontal 4096 /* (1000) menu is horizontal*/
|
||||
|
||||
|
||||
/* Window definition */
|
||||
|
||||
/* Key names for special keys. */
|
||||
|
||||
typedef struct knm {
|
||||
UCHAR knm_keycode;
|
||||
SCHAR *knm_keyname;
|
||||
} *KNM;
|
||||
|
||||
typedef struct win {
|
||||
struct blk win_header; /* Block header */
|
||||
struct win *win_parent; /* Parent window */
|
||||
struct win *win_sibling; /* Next sibling window */
|
||||
struct scr *win_logical; /* Logical screen */
|
||||
struct scr *win_physical; /* Physical screen */
|
||||
USHORT win_flags;
|
||||
USHORT win_x;
|
||||
USHORT win_y;
|
||||
USHORT win_width;
|
||||
USHORT win_height;
|
||||
USHORT win_pending_char; /* "returned" character */
|
||||
OBJ win_form;
|
||||
int *win_input;
|
||||
int *win_output;
|
||||
int *win_trace_in;
|
||||
int *win_trace_out;
|
||||
int win_current_x;
|
||||
int win_current_y;
|
||||
int win_current_mode;
|
||||
int (*win_clear)();
|
||||
int (*win_disable)();
|
||||
int (*win_fini)();
|
||||
int (*win_getchar)();
|
||||
int (*win_text)(struct win*,UCHAR*, SSHORT, SSHORT, SSHORT, USHORT);
|
||||
int (*win_update)();
|
||||
KNM win_keyname_table;
|
||||
} *WIN;
|
||||
|
||||
#define WIN_disabled 1 /* Forms are diabled */
|
||||
#define WIN_reset_80 2 /* Reset 80 column mode at end */
|
||||
#define WIN_synthesized 4 /* Input char was synthesized from mouse movement */
|
||||
#define WIN_sensitive 8 /* Mouse movement is sensitive */
|
||||
|
||||
/* Program wide globals */
|
||||
|
||||
#ifdef PYXIS_SOURCE
|
||||
struct plb *PYXIS_default_pool = 0;
|
||||
struct plb *PYXIS_permanent_pool = 0;
|
||||
#else
|
||||
#ifndef FRED_SOURCE
|
||||
extern struct plb *PYXIS_default_pool;
|
||||
extern struct plb *PYXIS_permanent_pool;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Descriptor format */
|
||||
|
||||
#include "../jrd/dsc.h"
|
||||
|
||||
/* Picture string handling block */
|
||||
|
||||
#include "../qli/format.h"
|
||||
|
||||
/* Phase 3 record <-> form map */
|
||||
|
||||
/* Menu block */
|
||||
|
||||
typedef struct menu {
|
||||
struct blk menu_header;
|
||||
OBJ menu_object;
|
||||
USHORT menu_flags;
|
||||
ATT menu_current_entree; /* current entree in dynamic menu */
|
||||
} *MENU;
|
||||
|
||||
/* #define MENU_horizontal 1 moved to object block */
|
||||
#define MENU_transparent 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int PYXIS_bugcheck(TEXT *);
|
||||
extern int PYXIS_error(TEXT *);
|
||||
extern OBJ PYXIS_get_attribute_value(OBJ , ATT_N );
|
||||
extern ATT PYXIS_replace_attribute(OBJ , ATT_N , ATT_T , OBJ );
|
||||
extern ATT PYXIS_put_attribute(OBJ , ATT_N , ATT_T , OBJ );
|
||||
extern ATT PYXIS_find_object(OBJ , ATT , ATT_N , USHORT );
|
||||
extern ATT PYXIS_navigate(OBJ , ATT , ATT_N , USHORT);
|
||||
extern OBJ PYXIS_create_object(TEXT *, ATT_N );
|
||||
extern int PYXIS_compute_size(OBJ , USHORT *, USHORT *);
|
||||
extern int PYXIS_scroll_reset(OBJ );
|
||||
extern int PYXIS_get_char(WIN, OBJ, int, int);
|
||||
extern int PYXIS_delete_attribute(OBJ , ATT );
|
||||
extern int PYXIS_set_display_attribute(OBJ , ATT );
|
||||
extern OBJ PYXIS_clone(OBJ );
|
||||
extern int PYXIS_delete_named_attribute(OBJ , ATT_N );
|
||||
extern ATT PYXIS_get_attribute(OBJ , ATT_N );
|
||||
extern int PYXIS_get_data(WIN , OBJ , ATT_N , OBJ , USHORT *);
|
||||
extern WIN PYXIS_create_window(USHORT , USHORT );
|
||||
extern int PYXIS_delete_object(OBJ );
|
||||
extern int PYXIS_delete_window(WIN );
|
||||
extern int PYXIS_push_tag(WIN , OBJ );
|
||||
extern int PYXIS_push_form(WIN , OBJ , USHORT );
|
||||
extern int PYXIS_update_window(WIN , OBJ , int , int );
|
||||
extern int PYXIS_position(OBJ , USHORT , USHORT );
|
||||
extern int PYXIS_pop_form(WIN );
|
||||
extern int PYXIS_init();
|
||||
extern int PYXIS_disable_window(WIN );
|
||||
extern int PYXIS_push_handler( int (*)() );
|
||||
extern int PYXIS_pop_handler( int (*)() );
|
||||
extern int PYXIS_return_char(WIN , USHORT );
|
||||
extern int PYXIS_top_form(WIN );
|
||||
extern int PYXIS_reference(OBJ );
|
||||
extern ATT PYXIS_find_enumeration(OBJ , ATT , USHORT );
|
||||
extern SCHAR *PYXIS_get_keyname(WIN , UCHAR );
|
||||
extern int PYXIS_move(OBJ , OBJ );
|
||||
extern int PYXIS_pop_handler( int (*handler)() );
|
||||
extern int PYXIS_push_handler( int (*handler)() );
|
||||
extern OBJ PYXIS_get_value(ATT );
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _PYXIS_PYXIS_H_ */
|
1008
src/pyxis/save.epp
1008
src/pyxis/save.epp
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
#ifndef _PYXIS_SAVE_H_
|
||||
#define _PYXIS_SAVE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
OBJ PYXIS_load_form(int *, SLONG **, SLONG **, OBJ *, USHORT * , TEXT *);
|
||||
OBJ PYXIS_relation_fields(SLONG **, SLONG **, TEXT *);
|
||||
int PYXIS_store_form(SLONG **, SLONG **, TEXT *, OBJ);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@ -1,18 +0,0 @@
|
||||
#ifndef _PYXIS_SAVE_PROTO_H
|
||||
#define _PYXIS_SAVE_PROTO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
OBJ PYXIS_relation_fields(SLONG **, SLONG **, TEXT *);
|
||||
OBJ PYXIS_relation_form(WIN , OBJ );
|
||||
int PYXIS_store_form(SLONG **, SLONG **, TEXT *, OBJ );
|
||||
int PYXIS_define_forms_relation(SLONG **);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@ -1,699 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: scr.c
|
||||
* DESCRIPTION: Logical Screen Handler
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/scr.h"
|
||||
#include "../pyxis/all.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
extern int CDM_create_window(WIN );
|
||||
extern int VT100_create_window(WIN );
|
||||
extern BLK PYXIS_alloc(PLB , UCHAR , int );
|
||||
|
||||
typedef struct {
|
||||
SSHORT min_x;
|
||||
SSHORT min_y;
|
||||
SSHORT max_x;
|
||||
SSHORT max_y;
|
||||
} REGION;
|
||||
|
||||
static SCR create_screen();
|
||||
static int clear_object(SCR, OBJ);
|
||||
static SCR create_screen(USHORT , USHORT );
|
||||
static int display(SCR , REGION , OBJ , OBJ , USHORT );
|
||||
static int update_line(WIN , USHORT , USHORT *, USHORT *);
|
||||
static int set_point(USHORT , USHORT , REGION , SCR , USHORT );
|
||||
static int display_box(SCR , REGION , OBJ );
|
||||
static int clear_screen(SCR );
|
||||
|
||||
static int windows;
|
||||
|
||||
#ifdef DEBUG
|
||||
static debug;
|
||||
#endif
|
||||
|
||||
|
||||
int SCR_clear_object(WIN window, OBJ object)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S C R _ c l e a r _ o b j e c t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Clear the image of an object to blanks.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
clear_object(window->win_logical, object);
|
||||
}
|
||||
|
||||
|
||||
int SCR_clear_window(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S C R _ c l e a r _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Clear a complete screen.
|
||||
*
|
||||
**************************************/
|
||||
SCR logical;
|
||||
|
||||
logical = window->win_logical;
|
||||
logical->scr_flags |= SCR_clear;
|
||||
clear_screen(logical);
|
||||
}
|
||||
|
||||
|
||||
int SCR_create_window(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S C R _ c r e a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Set up a window.
|
||||
*
|
||||
**************************************/
|
||||
int status;
|
||||
|
||||
++windows;
|
||||
|
||||
#ifdef VMS
|
||||
#define WINDOW_CREATION
|
||||
status = VDM_create_window(window);
|
||||
#endif
|
||||
|
||||
#ifndef WINDOW_CREATION
|
||||
#ifndef sgi
|
||||
#define WINDOW_CREATION
|
||||
if ((strcmp(getenv("TERM"), "vt100")) &&
|
||||
(strcmp(getenv("TERM"), "vt200")) &&
|
||||
(strcmp(getenv("TERM"), "vt300"))) status = CDM_create_window(window);
|
||||
else
|
||||
status = VT100_create_window(window);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef WINDOW_CREATION
|
||||
status = CDM_create_window(window);
|
||||
#endif
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
window->win_logical =
|
||||
create_screen(window->win_width, window->win_height);
|
||||
window->win_physical =
|
||||
create_screen(window->win_width, window->win_height);
|
||||
(*(int (*)(WIN))window->win_clear) (window);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int SCR_disable(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S C R _ d i s a b l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Disable window. Like make it disappear, go
|
||||
* inactive, or just get out of the way.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
(*(int (*)(WIN)) window->win_disable) (window);
|
||||
clear_screen(window->win_physical);
|
||||
}
|
||||
|
||||
|
||||
int SCR_fini(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S C R _ f i n i
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get rid of a screen.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
--windows;
|
||||
(*(int (*)(WIN)) window->win_fini) (window);
|
||||
PYXIS_release((FRB) window->win_logical);
|
||||
PYXIS_release((FRB) window->win_physical);
|
||||
}
|
||||
|
||||
|
||||
int SCR_getchar(WIN window, OBJ object, int x_offset, int y_offset)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S C R _ g e t c h a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Update the physical screen based on the logical screen.
|
||||
*
|
||||
**************************************/
|
||||
SSHORT c, x, y;
|
||||
|
||||
if (c = window->win_pending_char) {
|
||||
window->win_pending_char = 0;
|
||||
return c;
|
||||
}
|
||||
|
||||
if (!object)
|
||||
return (*(int (*)(WIN, int, int)) window->win_getchar) (window, x_offset, y_offset);
|
||||
|
||||
x = object->obj_x + x_offset;
|
||||
y = object->obj_y + y_offset;
|
||||
|
||||
return (*(int (*)(WIN, int, int)) window->win_getchar) (window, x, y);
|
||||
}
|
||||
|
||||
|
||||
int SCR_refresh_window(WIN window, OBJ object, int x_offset, int y_offset)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S C R _ r e f r e s h
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Refresh the display, presumable because of extern interference.
|
||||
*
|
||||
**************************************/
|
||||
OBJ form;
|
||||
|
||||
(*(int (*)(WIN)) window->win_clear) (window);
|
||||
clear_screen(window->win_physical);
|
||||
form = window->win_form;
|
||||
form->obj_flags |= OBJ_changed;
|
||||
SCR_update_window(window, object, x_offset, y_offset);
|
||||
}
|
||||
|
||||
|
||||
int SCR_update_window(WIN window, OBJ object, int x_offset, int y_offset)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S C R _ u p d a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Update the physical screen based on the logical screen.
|
||||
*
|
||||
**************************************/
|
||||
SCR logical, physical;
|
||||
USHORT *lline, *pline, x, y, start, force;
|
||||
ATT attribute;
|
||||
REGION clip;
|
||||
|
||||
/* Start by updating logical screen */
|
||||
|
||||
logical = window->win_logical;
|
||||
physical = window->win_physical;
|
||||
clip.min_x = 0;
|
||||
clip.min_y = 0;
|
||||
clip.max_x = window->win_width;
|
||||
clip.max_y = window->win_height;
|
||||
display(logical, clip, window->win_form, 0, FALSE);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
PYXIS_print_screen(logical, "Logical");
|
||||
PYXIS_print_screen(physical, "Physical");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If there has been a clear since the last update, zap the whole
|
||||
thing now. */
|
||||
|
||||
if (logical->scr_flags & SCR_clear) {
|
||||
(*(int (*)(WIN)) window->win_clear) (window);
|
||||
clear_screen(physical);
|
||||
logical->scr_flags &= ~SCR_clear;
|
||||
}
|
||||
|
||||
/* Look for differences between physical and logical screens. Update
|
||||
physical screen */
|
||||
|
||||
lline = logical->scr_screen;
|
||||
pline = physical->scr_screen;
|
||||
|
||||
for (y = 0; y < logical->scr_height; y++,
|
||||
pline += physical->scr_line_length, lline +=
|
||||
logical->scr_line_length) if (*lline >> 8) {
|
||||
*lline = FALSE;
|
||||
update_line(window, y, lline + 1, pline + 1);
|
||||
}
|
||||
|
||||
if (object) {
|
||||
x = object->obj_x + object->obj_border + x_offset;
|
||||
y = object->obj_y + object->obj_border + y_offset;
|
||||
}
|
||||
else {
|
||||
x = window->win_width;
|
||||
y = window->win_height;
|
||||
}
|
||||
|
||||
(*(int(*)(WIN, int, int)) window->win_update) (window, x, y);
|
||||
}
|
||||
|
||||
|
||||
static int clear_box(SCR screen, OBJ object)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c l e a r _ b o x
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Display a box, possible outlined.
|
||||
*
|
||||
**************************************/
|
||||
USHORT *start, *p, *end, n, *line, l;
|
||||
|
||||
start = object->obj_display_address;
|
||||
l = screen->scr_line_length;
|
||||
n = (start - screen->scr_screen) / l;
|
||||
line = screen->scr_screen + n * l;
|
||||
|
||||
for (n = 0; n < object->obj_display_height; n++, line += l, start += l) {
|
||||
*line = -1;
|
||||
p = start;
|
||||
end = p + object->obj_display_length;
|
||||
while (p < end)
|
||||
*p++ = ' ';
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int clear_object(SCR screen, OBJ object)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c l e a r _ o b j e c t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Clear the image of an object to blanks.
|
||||
*
|
||||
**************************************/
|
||||
USHORT *line, *p;
|
||||
ATT attribute;
|
||||
SSHORT l;
|
||||
|
||||
if (object->obj_occluded || (object->obj_flags & OBJ_inactive))
|
||||
return 0;
|
||||
|
||||
object->obj_flags &= ~OBJ_displayed;
|
||||
|
||||
if (object->obj_flags & OBJ_blank)
|
||||
clear_box(screen, object);
|
||||
|
||||
/* Check for, any display, and sub-objects */
|
||||
|
||||
for (attribute = object->obj_attributes; attribute;
|
||||
attribute = attribute->att_next)
|
||||
if (attribute->att_type == attype_object)
|
||||
clear_object(screen, attribute->att_value);
|
||||
|
||||
/* Next, clear this object, assuming it has an associated string */
|
||||
|
||||
if (object->obj_display_attribute && (l = object->obj_display_length)) {
|
||||
line = screen->scr_screen + screen->scr_line_length * object->obj_y;
|
||||
*line = -1;
|
||||
p = object->obj_display_address;
|
||||
do
|
||||
*p++ = ' ';
|
||||
while (--l);
|
||||
object->obj_display_length = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int clear_screen(SCR screen)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c l e a r _ s c r e e n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Clear a complete screen.
|
||||
*
|
||||
**************************************/
|
||||
USHORT *p, *end;
|
||||
|
||||
p = screen->scr_screen;
|
||||
end = p + screen->scr_length;
|
||||
|
||||
while (p < end)
|
||||
*p++ = ' ';
|
||||
}
|
||||
|
||||
|
||||
static SCR create_screen(USHORT width, USHORT height)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c r e a t e _ s c r e e n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create a screen block of given dimension, and zero/blank
|
||||
* same.
|
||||
*
|
||||
**************************************/
|
||||
USHORT length, line_length;
|
||||
SCR screen;
|
||||
|
||||
line_length = width + 1;
|
||||
length = line_length * height;
|
||||
screen = (SCR) ALLOCDV(type_scr, length);
|
||||
screen->scr_width = width;
|
||||
screen->scr_height = height;
|
||||
screen->scr_length = length;
|
||||
screen->scr_line_length = line_length;
|
||||
clear_screen(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
|
||||
static int display(SCR screen, REGION clip, OBJ object, OBJ parent, USHORT force)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d i s p l a y
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Walk an object updating a screen.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR *string;
|
||||
USHORT mode, *line, *p, *end, *min, *max;
|
||||
SSHORT l, n;
|
||||
ATT attribute;
|
||||
|
||||
if (object->obj_occluded || (object->obj_flags & OBJ_inactive))
|
||||
return 0;
|
||||
|
||||
if (object->obj_flags & OBJ_changed)
|
||||
force = TRUE;
|
||||
|
||||
object->obj_x = object->obj_rel_x + object->obj_scroll_x;
|
||||
object->obj_y = object->obj_rel_y + object->obj_scroll_y;
|
||||
|
||||
if (parent) {
|
||||
object->obj_x += parent->obj_x + parent->obj_border;
|
||||
object->obj_y += parent->obj_y + parent->obj_border;
|
||||
}
|
||||
|
||||
/* If object is box, clear it */
|
||||
|
||||
|
||||
if (force) {
|
||||
object->obj_display_length = 0;
|
||||
if (object->obj_flags & OBJ_blank)
|
||||
display_box(screen, clip, object);
|
||||
}
|
||||
|
||||
/* Compute clipping region */
|
||||
|
||||
n = object->obj_x + object->obj_border;
|
||||
if (n > clip.min_x)
|
||||
clip.min_x = n;
|
||||
|
||||
n = object->obj_y + object->obj_border;
|
||||
if (n > clip.min_y)
|
||||
clip.min_y = n;
|
||||
|
||||
if (l = object->obj_width) {
|
||||
l += object->obj_x - object->obj_border;
|
||||
clip.max_x = MIN(clip.max_x, l);
|
||||
}
|
||||
|
||||
if (l = object->obj_height) {
|
||||
l += object->obj_y - object->obj_border;
|
||||
clip.max_y = MIN(clip.max_y, l);
|
||||
}
|
||||
|
||||
/* Reset flags to indicate state */
|
||||
|
||||
object->obj_flags |= OBJ_displayed;
|
||||
object->obj_flags &= ~OBJ_changed;
|
||||
|
||||
if (force &&
|
||||
(attribute = object->obj_display_attribute) &&
|
||||
(string = (UCHAR *) attribute->att_value) &&
|
||||
object->obj_y >= clip.min_y &&
|
||||
object->obj_y < clip.max_y && clip.min_x < clip.max_x) {
|
||||
mode = 0;
|
||||
if (object->obj_flags & OBJ_reverse_video)
|
||||
mode |= SCR_reverse << 8;
|
||||
if (object->obj_flags & OBJ_bold)
|
||||
mode |= SCR_bold << 8;
|
||||
if (object->obj_flags & OBJ_underline)
|
||||
mode |= SCR_underline << 8;
|
||||
|
||||
object->obj_width = MAX(attribute->att_length, object->obj_width);
|
||||
line = screen->scr_screen + screen->scr_line_length * object->obj_y;
|
||||
*line++ = -1;
|
||||
min = line + clip.min_x;
|
||||
max = line + clip.max_x;
|
||||
p = line + object->obj_x;
|
||||
object->obj_display_address = MAX(p, min);
|
||||
|
||||
/* Handle leading blanks first */
|
||||
|
||||
l = object->obj_width - attribute->att_length;
|
||||
|
||||
if (l && (object->obj_flags & OBJ_insert_right))
|
||||
for (; l && p < max; --l, ++p)
|
||||
if (p >= min)
|
||||
*p = mode + ' ';
|
||||
|
||||
/* Handle main string */
|
||||
|
||||
for (; *string && p < max; p++, string++)
|
||||
if (p >= min)
|
||||
*p = mode + *string;
|
||||
|
||||
/* Finish up with any trailing blanks */
|
||||
|
||||
for (; l && p < max; --l, ++p)
|
||||
if (p >= min)
|
||||
*p = mode + ' ';
|
||||
|
||||
p = MIN(p, max);
|
||||
l = p - object->obj_display_address;
|
||||
object->obj_display_length = (l >= 0) ? l : 0;
|
||||
}
|
||||
|
||||
/* Check for, any display, and sub-objects */
|
||||
|
||||
for (attribute = object->obj_attributes; attribute;
|
||||
attribute = attribute->att_next)
|
||||
if (attribute->att_type == attype_object)
|
||||
display(screen, clip, attribute->att_value, object, force);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int display_box(SCR screen, REGION clip, OBJ object)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d i s p l a y _ b o x
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Display a box, possible outlined.
|
||||
*
|
||||
**************************************/
|
||||
SSHORT min_x, min_y, max_x, max_y, x, y, right, bottom,
|
||||
mode, *p, *end, c, top, side, fill, box;
|
||||
|
||||
box = (object->obj_flags & OBJ_box) ? TRUE : FALSE;
|
||||
right = object->obj_x + object->obj_width;
|
||||
bottom = object->obj_y + object->obj_height;
|
||||
min_x = MAX(object->obj_x, clip.min_x);
|
||||
min_y = MAX(object->obj_y, clip.min_y);
|
||||
max_x = MIN(right, clip.max_x);
|
||||
max_y = MIN(bottom, clip.max_y);
|
||||
|
||||
if (min_x >= max_x || min_y >= max_y)
|
||||
return 0;
|
||||
|
||||
object->obj_display_length = max_x - min_x;
|
||||
object->obj_display_height = max_y - min_y;
|
||||
object->obj_display_address = screen->scr_screen +
|
||||
screen->scr_line_length * min_y + 1 + min_x;
|
||||
|
||||
mode = (object->obj_flags & OBJ_reverse_video) ? SCR_reverse << 8 : 0;
|
||||
fill = ' ' | mode;
|
||||
side = C_VERT_BAR | mode;
|
||||
top = C_HORZ_BAR | mode;
|
||||
--bottom;
|
||||
|
||||
/* Start by blanking the box */
|
||||
|
||||
for (y = min_y; y < max_y; y++) {
|
||||
c = fill;
|
||||
if (box && (y == object->obj_y || y == bottom))
|
||||
c = top;
|
||||
p = (SSHORT *) screen->scr_screen + screen->scr_line_length * y;
|
||||
*p++ = -1;
|
||||
p += min_x;
|
||||
end = p + object->obj_display_length;
|
||||
if (box && min_x == object->obj_x)
|
||||
*p++ = side;
|
||||
while (p < end)
|
||||
*p++ = c;
|
||||
if (box && max_x == right)
|
||||
p[-1] = side;
|
||||
}
|
||||
|
||||
/* Unless the object is explicitly outlined, we're done */
|
||||
|
||||
if (!(object->obj_flags & OBJ_box))
|
||||
return 0;
|
||||
|
||||
/* Groan -- fill in the corners */
|
||||
|
||||
set_point(object->obj_x, object->obj_y, clip, screen, C_UL_CORNER | mode);
|
||||
set_point(object->obj_x + object->obj_width - 1, object->obj_y,
|
||||
clip, screen, C_UR_CORNER | mode);
|
||||
set_point(object->obj_x, object->obj_y + object->obj_height - 1,
|
||||
clip, screen, C_LL_CORNER | mode);
|
||||
set_point(object->obj_x + object->obj_width - 1,
|
||||
object->obj_y + object->obj_height - 1, clip,
|
||||
screen, C_LR_CORNER | mode);
|
||||
}
|
||||
|
||||
|
||||
static int set_point(USHORT x, USHORT y, REGION clip, SCR screen, USHORT value)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s e t _ p o i n t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Set a single cell on a screen if it falls within a region.
|
||||
*
|
||||
**************************************/
|
||||
USHORT *p;
|
||||
|
||||
if (x < clip.min_x ||
|
||||
x >= clip.max_x || y < clip.min_y || y >= clip.max_y) return FALSE;
|
||||
|
||||
p = screen->scr_screen + screen->scr_line_length * y + 1 + x;
|
||||
*p = value;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int update_line(WIN window, USHORT y, USHORT *logical, USHORT *physical)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* u p d a t e _ l i n e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Compare a logical line to the physical screen image and make
|
||||
* any appropriate screen calls.
|
||||
*
|
||||
**************************************/
|
||||
USHORT *end, c, mode, x, start, width;
|
||||
UCHAR buffer[1024], *p;
|
||||
|
||||
width = window->win_logical->scr_width;
|
||||
p = buffer;
|
||||
|
||||
for (x = 0; x < width; x++, physical++) {
|
||||
c = *logical++;
|
||||
if (c == *physical) {
|
||||
if (p == buffer)
|
||||
continue;
|
||||
if (c != ' ' || *logical == physical[1]) {
|
||||
(*window->win_text) (window, buffer, p - buffer, start, y, mode);
|
||||
p = buffer;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (p == buffer) {
|
||||
start = x;
|
||||
mode = c >> 8;
|
||||
}
|
||||
else if (c >> 8 != mode) {
|
||||
(*window->win_text) (window, buffer, p - buffer, start, y, mode);
|
||||
p = buffer;
|
||||
start = x;
|
||||
mode = c >> 8;
|
||||
}
|
||||
*p++ = c;
|
||||
*physical = c;
|
||||
}
|
||||
|
||||
if (p != buffer) {
|
||||
(*window->win_text) (window, buffer, p - buffer, start, y, mode);
|
||||
p = buffer;
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: scr.h
|
||||
* DESCRIPTION: Logical screen handler definitions
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _PYXIS_SCR_H_
|
||||
#define _PYXIS_SCR_H_
|
||||
|
||||
/* Screen block. The "screen" image consists of alternating bytes
|
||||
of video mask and character data. */
|
||||
|
||||
typedef struct scr {
|
||||
USHORT scr_x; /* Current x location */
|
||||
USHORT scr_y; /* Current y location */
|
||||
USHORT scr_width; /* Screen width */
|
||||
USHORT scr_height; /* Screen height */
|
||||
USHORT scr_length; /* Bytes in screen image */
|
||||
USHORT scr_line_length; /* Bytes in line image */
|
||||
USHORT scr_flags; /* Misc stuff */
|
||||
UCHAR scr_mask; /* Video options mask */
|
||||
USHORT scr_screen[1]; /* Screen image */
|
||||
} *SCR;
|
||||
|
||||
/* Flags */
|
||||
|
||||
#define SCR_clear 1
|
||||
|
||||
/* Display attributes */
|
||||
|
||||
#define SCR_reverse 1 /* Reverse video */
|
||||
#define SCR_bold 2 /* Bold characters */
|
||||
#define SCR_underline 4 /* Underlined text */
|
||||
|
||||
extern int SCR_create_window(WIN );
|
||||
extern int SCR_fini(WIN );
|
||||
extern int SCR_disable(WIN );
|
||||
extern int SCR_getchar(WIN , OBJ , int , int );
|
||||
extern int SCR_refresh_window(WIN , OBJ , int , int );
|
||||
extern int SCR_clear_window(WIN );
|
||||
extern int SCR_update_window(WIN , OBJ , int , int );
|
||||
extern int SCR_clear_object(WIN , OBJ );
|
||||
|
||||
#endif /* _PYXIS_SCR_H_ */
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
"24O18D`F o r m S i z e`2N8.5N17.E24O18D`WIDTH`2N5.3N2.5N5\
|
||||
.E25O13S`WIDTH`35S`zz9`21N5.23N4.20D`999`2N11.3N2.5N3.6N1.31\
|
||||
N1.E24O18D`HEIGHT`2N17.3N2.5N6.E25O13S`HEIGHT`35S`zz9`21N5.2\
|
||||
3N4.20D`999`2N24.3N2.5N3.6N1.31N1.E24O18D`OUTLINE_FORM`2N9.3\
|
||||
N4.5N12.E25O13S`OUTLINE_FORM`35S`X`21N1.23N1.20D`X`44N1.53S`\
|
||||
N`53S`Y`2N22.3N4.5N1.6N1.E5N33.4N8.48N1.10N1.9N1.E"
|
@ -1,380 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: sun_ftn_pyxis.c
|
||||
* DESCRIPTION: "Wrapper" module which compensates for the
|
||||
* Sun Fortran compiler appending an underscore
|
||||
* to external entrypoints. (Each function in
|
||||
* this module is an InterBase entrypoint with
|
||||
* an underscore appended to it which calls the
|
||||
* real InterBase function).
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include <varargs.h>
|
||||
#include "../jrd/common.h"
|
||||
#include "../include/jrd/gds.h"
|
||||
#include "../pyxis/everything.h"
|
||||
#undef GDS_VAL
|
||||
#define GDS_VAL(val) (*val)
|
||||
|
||||
typedef STATUS(*PTR) ();
|
||||
|
||||
typedef struct handle {
|
||||
struct handle **user_handle;
|
||||
} *HANDLE, *REQ, *DBB, *TRA, *BLB, *ATT, *OBJ, *BLK, *MAP, *WIN, *MENU;
|
||||
|
||||
#define PYXIS_COMPILE_MAP pyxis__compile_map_
|
||||
#define PYXIS_COMPILE_MENU pyxis__compile_menu_
|
||||
#define PYXIS_COMPILE_SUB_MAP pyxis__compile_sub_map_
|
||||
#define PYXIS_CREATE_WINDOW pyxis__create_window_
|
||||
#define PYXIS_DELETE pyxis__delete_
|
||||
#define PYXIS_DELETE_WINDOW pyxis__delete_window_
|
||||
#define PYXIS_DRIVE_FORM pyxis__drive_form_
|
||||
#define PYXIS_DRIVE_MENU pyxis__drive_menu_
|
||||
#define PYXIS_FETCH pyxis__fetch_
|
||||
#define PYXIS_GET_ENTREE pyxis__get_entree_
|
||||
#define PYXIS_INITIALIZE_MENU pyxis__initialize_menu_
|
||||
#define PYXIS_INSERT pyxis__insert_
|
||||
#define PYXIS_LOAD_FORM pyxis__load_form_
|
||||
#define PYXIS_MENU pyxis__menu_
|
||||
#define PYXIS_POP_WINDOW pyxis__pop_window_
|
||||
#define PYXIS_PUT_ENTREE pyxis__put_entree_
|
||||
#define PYXIS_RESET_FORM pyxis__reset_form_
|
||||
#define PYXIS_SUSPEND_WINDOW pyxis__suspend_window_
|
||||
|
||||
|
||||
int PYXIS_COMPILE_MAP(STATUS *status, OBJ *form_handle, MAP *map_handle, ULONG *length, TEXT *source)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ c o m p i l e _ m a p
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Compile a form map.
|
||||
*
|
||||
**************************************/
|
||||
USHORT len;
|
||||
|
||||
len = *length;
|
||||
|
||||
return pyxis__compile_map(status, form_handle, map_handle, &len, source);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_COMPILE_MENU(WIN *window_handle, MENU *menu_handle, USHORT *length, TEXT *source)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ c o m p i l e _ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Compile a menu.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
pyxis__compile_menu(window_handle, menu_handle, length, source);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int PYXIS_COMPILE_SUB_MAP(STATUS *status, MAP *parent_handle, MAP *map_handle, ULONG *length, TEXT *source)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ c o m p i l e _ s u b _ m a p
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Compile a subform map.
|
||||
*
|
||||
**************************************/
|
||||
USHORT len;
|
||||
|
||||
len = *length;
|
||||
return pyxis__compile_sub_map(status, parent_handle,
|
||||
map_handle, &len, source);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int PYXIS_CREATE_WINDOW(WIN *window_handle, ULONG *file_name_length, TEXT *file_name, USHORT *width, USHORT *height)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ c r e a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Sun fortran callable version
|
||||
* Create a new window.
|
||||
*
|
||||
**************************************/
|
||||
USHORT name_length;
|
||||
|
||||
name_length = *file_name_length;
|
||||
pyxis__create_window(window_handle, &name_length, file_name, width,
|
||||
height);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_DELETE(OBJ *object)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ d e l e t e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Delete an object.
|
||||
*
|
||||
**************************************/
|
||||
pyxis__delete(object);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_DELETE_WINDOW(SLONG *window_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ d e l e t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Delete a window.
|
||||
*
|
||||
**************************************/
|
||||
pyxis__delete_window(window_handle);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_DRIVE_FORM(STATUS *status, SLONG **db_handle, SLONG **tra_handle, WIN *window_handle, MAP *map_handle,
|
||||
UCHAR *input, UCHAR *output)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ d r i v e _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Copy data from a form (or subform).
|
||||
*
|
||||
**************************************/
|
||||
pyxis__drive_form(status, db_handle, tra_handle, window_handle,
|
||||
map_handle, input, output);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_DRIVE_MENU(WIN *window_handle, MENU *menu_handle, SLONG *blr_length,
|
||||
TEXT *blr_source, USHORT *title_length, TEXT *title, USHORT *terminator,
|
||||
USHORT *entree_length, TEXT *entree_text, SLONG *entree_value)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ d r i v e _ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Build then drive a dynamic menu.
|
||||
*
|
||||
**************************************/
|
||||
USHORT i;
|
||||
|
||||
i = *blr_length;
|
||||
pyxis__drive_menu(window_handle, menu_handle, &i,
|
||||
blr_source, title_length, title, terminator,
|
||||
entree_length, entree_text, entree_value);
|
||||
}
|
||||
|
||||
int
|
||||
PYXIS_FETCH(STATUS *status, SLONG **db_handle, SLONG *tra_handle, MAP *map_handle, UCHAR *output)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ f e t c h
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Copy data from a form (or subform).
|
||||
*
|
||||
**************************************/
|
||||
pyxis__fetch(status, db_handle, tra_handle, map_handle, output);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_GET_ENTREE(MENU *menu_handle, USHORT *entree_length,
|
||||
TEXT *entree_text, SLONG *entree_value, USHORT *entree_end)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ g e t _ e n t r e e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get the next entree in a dynamic menu
|
||||
*
|
||||
**************************************/
|
||||
pyxis__get_entree(menu_handle, entree_length,
|
||||
entree_text, entree_value, entree_end);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_INITIALIZE_MENU(MENU *menu_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ i n i t i a l i z e _ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create or reinitialize a menu object
|
||||
*
|
||||
**************************************/
|
||||
pyxis__initialize_menu(menu_handle);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_INSERT(STATUS *status, SLONG **db_handle, SLONG *tra_handle, MAP *map_handle, UCHAR *input)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ i n s e r t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Copy data to a form (or sub-form).
|
||||
*
|
||||
**************************************/
|
||||
pyxis__insert(status, db_handle, tra_handle, map_handle, input);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_LOAD_FORM(STATUS *status_vector, SLONG *dbb, SLONG *transaction,
|
||||
OBJ *form_handle, ULONG *form_name_length, TEXT *form_name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ l o a d _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Load a form given an attach database
|
||||
* and outstanding transaction.
|
||||
*
|
||||
**************************************/
|
||||
USHORT length;
|
||||
|
||||
length = *form_name_length;
|
||||
pyxis__load_form(status_vector, dbb, transaction,
|
||||
form_handle, &length, form_name);
|
||||
}
|
||||
|
||||
|
||||
OBJ PYXIS_MENU(WIN *window_handle, MENU *menu_handle, USHORT *length, TEXT *source)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ m e n u
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Build then drive a menu.
|
||||
*
|
||||
**************************************/
|
||||
return (OBJ) pyxis__menu(window_handle, menu_handle, length, source);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_POP_WINDOW(WIN *window_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ p o p _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Pop a form off the window stack.
|
||||
*
|
||||
**************************************/
|
||||
pyxis__pop_window(window_handle);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_PUT_ENTREE(MENU *menu_handle, USHORT *entree_length, TEXT *entree_text, SLONG *entree_value)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ p u t _ e n t r e e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Add an entree to a dynamic menu
|
||||
*
|
||||
**************************************/
|
||||
pyxis__put_entree(menu_handle, entree_length, entree_text, entree_value);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_RESET_FORM(STATUS *status, MAP *map_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ r e s e t _ f o r m
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Reset a compiled form to a known state.
|
||||
*
|
||||
**************************************/
|
||||
pyxis__reset_form(status, map_handle);
|
||||
}
|
||||
|
||||
|
||||
int PYXIS_SUSPEND_WINDOW(SLONG *window_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p y x i s _ $ s u s p e n d _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Temporarily suspend a window.
|
||||
*
|
||||
**************************************/
|
||||
pyxis__suspend_window(window_handle);
|
||||
}
|
@ -1,607 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: vdm.c
|
||||
* DESCRIPTION: VMS Display Manager
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include descrip
|
||||
#include iodef
|
||||
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/scr.h"
|
||||
|
||||
#define DISABLE "\33[0m\33>\33(B\n"
|
||||
#define ENABLE "\33[0m\33="
|
||||
#define CSI 0x9b
|
||||
|
||||
static int clear_window(), disable(), fini(), get_char(), text(),
|
||||
update_window();
|
||||
static SSHORT graphics_mode;
|
||||
|
||||
typedef struct seq {
|
||||
UCHAR seq_key;
|
||||
UCHAR *seq_sequence;
|
||||
} SEQ;
|
||||
|
||||
static SEQ escape_sequences[] = {
|
||||
C_UP, "\33[A",
|
||||
C_DOWN, "\33[B",
|
||||
C_RIGHT, "\33[C",
|
||||
C_LEFT, "\33[D",
|
||||
C_UP, "\233A",
|
||||
C_DOWN, "\233B",
|
||||
C_RIGHT, "\233C",
|
||||
C_LEFT, "\233D",
|
||||
C_PF5, "\33[31~", /* F17 function key */
|
||||
C_PF6, "\33[18~", /* F7 function key */
|
||||
C_PF7, "\33[19~", /* F8 function key */
|
||||
C_PF8, "\33[20~", /* F9 function key */
|
||||
C_PF9, "\33[21~", /* F10 function key */
|
||||
C_SCROLL_TOP, "\33[5~", /* Prev Scrn */
|
||||
C_SCROLL_BOTTOM, "\33[6~", /* Next Scrn */
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
static struct knm keyname_table[] = {
|
||||
{C_PF1, "<PF1>"},
|
||||
{C_PF2, "<PF2>"},
|
||||
{C_PF3, "<PF3>"},
|
||||
{C_PF4, "<PF4>"},
|
||||
{C_PF5, "<F17>"},
|
||||
{C_PF6, "<F7>"},
|
||||
{C_PF7, "<F8>"},
|
||||
{C_PF8, "<F9>"},
|
||||
{C_PF9, "<F10>"},
|
||||
{C_ENTER, "<ENTER>"},
|
||||
{C_LEFT, "<left arrow>"},
|
||||
{C_RIGHT, "<right arrow>"},
|
||||
{C_UP, "<up arrow>"},
|
||||
{C_DOWN, "<down arrow>"},
|
||||
{C_DELETE, "<DELETE>"},
|
||||
{C_SCROLL_TOP, "<PREV SCREEN> or <control-T>"},
|
||||
{C_SCROLL_BOTTOM, "<NEXT SCREEN> of <control-B>"},
|
||||
{C_ERASE, "<control-U>"},
|
||||
{C_DELETE_NEXT, "<control-F>"},
|
||||
{C_INSERT_OVERSTRIKE, "<control-A>"},
|
||||
{C_GOTO_START, "<control-H>"},
|
||||
{C_GOTO_END, "<control-E>"},
|
||||
{C_EDIT, "<control-G>"},
|
||||
{(UCHAR) 0, "<unknown key>"},
|
||||
};
|
||||
|
||||
static UCHAR keypad[256], keypad_equiv[] = {
|
||||
C_ENTER, 'M',
|
||||
C_PF1, 'P',
|
||||
C_PF2, 'Q',
|
||||
C_PF3, 'R',
|
||||
C_PF4, 'S',
|
||||
'-', 'm',
|
||||
',', 'l',
|
||||
'.', 'n',
|
||||
'0', 'p',
|
||||
'1', 'q',
|
||||
'2', 'r',
|
||||
'3', 's',
|
||||
'4', 't',
|
||||
'5', 'u',
|
||||
'6', 'v',
|
||||
'7', 'w',
|
||||
'8', 'x',
|
||||
'9', 'y',
|
||||
0, 0
|
||||
};
|
||||
|
||||
|
||||
VDM_create_window(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* V D M _ c r e a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create a new display window.
|
||||
*
|
||||
**************************************/
|
||||
struct dsc$descriptor sysinput, locdev_dsc;
|
||||
UCHAR *p, buffer[32];
|
||||
SCHAR locdev[64];
|
||||
SLONG l, status, width, height;
|
||||
|
||||
window->win_keyname_table = keyname_table;
|
||||
|
||||
/* Populate window with action routines */
|
||||
|
||||
window->win_clear = &clear_window;
|
||||
window->win_disable = &disable;
|
||||
window->win_fini = &fini;
|
||||
window->win_getchar = &get_char;
|
||||
window->win_text = &text;
|
||||
window->win_update = &update_window;
|
||||
|
||||
sysinput.dsc$w_length = sizeof("SYS$INPUT") - 1;
|
||||
sysinput.dsc$b_class = DSC$K_CLASS_S;
|
||||
sysinput.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
sysinput.dsc$a_pointer = "SYS$INPUT";
|
||||
|
||||
locdev_dsc.dsc$w_length = 63;
|
||||
locdev_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
locdev_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
locdev_dsc.dsc$a_pointer = &locdev[0];
|
||||
|
||||
/*
|
||||
status = sys$trnlog(&sysinput, &l, &locdev_dsc, 0, 0, 0);
|
||||
locdev[l] = 0;
|
||||
strcpy (locdev, &locdev[4]);
|
||||
locdev_dsc.dsc$w_length = sizeof (locdev);
|
||||
status = sys$assign (&locdev_dsc, &trm_channel, 0, 0);
|
||||
*/
|
||||
|
||||
status = sys$assign(&sysinput, &window->win_input, 0, 0);
|
||||
enable_forms(window);
|
||||
|
||||
for (p = keypad_equiv; *p; p += 2)
|
||||
keypad[p[1]] = p[0];
|
||||
|
||||
if (get_size(window, &width, &height)) {
|
||||
if (window->win_width && window->win_width > width) {
|
||||
put_line(window, "\33[?3h", 5, 0);
|
||||
window->win_flags |= WIN_reset_80;
|
||||
get_size(window, &width, &height);
|
||||
}
|
||||
window->win_height = (window->win_height) ?
|
||||
MIN(window->win_height, height) : height;
|
||||
window->win_width = (window->win_width) ?
|
||||
MIN(window->win_width, width) : width;
|
||||
}
|
||||
else {
|
||||
window->win_width = 79;
|
||||
window->win_height = 23;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static clear_window(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c l e a r _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Clear out a window.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
/* Set normal characters, keypad application mode */
|
||||
|
||||
put_line(window, ENABLE, sizeof(ENABLE) - 1, 0);
|
||||
|
||||
lib$set_cursor(&(1), &(1));
|
||||
lib$erase_page();
|
||||
}
|
||||
|
||||
|
||||
static disable(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d i s a b l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Make window disappear.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
/* Set normal characters, numeric keypad, non-graphics */
|
||||
|
||||
put_line(window, DISABLE, sizeof(DISABLE) - 1, 0);
|
||||
position(window, 0, window->win_height);
|
||||
window->win_flags |= WIN_disabled;
|
||||
}
|
||||
|
||||
|
||||
static enable_forms(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e n a b l e _ f o r m s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Put terminal in forms mode.
|
||||
*
|
||||
**************************************/
|
||||
int n;
|
||||
|
||||
window->win_current_mode = 0;
|
||||
window->win_flags &= ~WIN_disabled;
|
||||
clear_window(window);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static fini(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* f i n i
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Sign off the screen package.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (window->win_flags & WIN_reset_80)
|
||||
put_line(window, "\33[?3l", 5, 0);
|
||||
|
||||
disable(window);
|
||||
}
|
||||
|
||||
|
||||
static get_char(window, x, y)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ c h a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a character from the user.
|
||||
*
|
||||
**************************************/
|
||||
int n;
|
||||
SEQ *sequence;
|
||||
UCHAR buffer[16], *p, *q;
|
||||
|
||||
position(window, x, y);
|
||||
|
||||
for (;;) {
|
||||
if (!(n = get_input(window, buffer)))
|
||||
return 0;
|
||||
if (n == 1)
|
||||
switch (buffer[0]) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
return '\n';
|
||||
case 'T' - 0100:
|
||||
return C_SCROLL_TOP;
|
||||
case 'B' - 0100:
|
||||
return C_SCROLL_BOTTOM;
|
||||
case 'Z' - 0100:
|
||||
return C_EOF;
|
||||
|
||||
/* Edit mode */
|
||||
|
||||
case 'F' - 0100:
|
||||
return C_DELETE_NEXT;
|
||||
case 'G' - 0100:
|
||||
return C_EDIT;
|
||||
case 'H' - 0100:
|
||||
return C_GOTO_START;
|
||||
case 'E' - 0100:
|
||||
return C_GOTO_END;
|
||||
case 'A' - 0100:
|
||||
return C_INSERT_OVERSTRIKE;
|
||||
case 'U' - 0100:
|
||||
return C_ERASE;
|
||||
default:
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
buffer[n] = 0;
|
||||
for (sequence = escape_sequences; q = sequence->seq_sequence;
|
||||
sequence++)
|
||||
for (p = buffer; *p == *q; p++, q++)
|
||||
if (!*p)
|
||||
return sequence->seq_key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static get_input(window, buffer)
|
||||
WIN window;
|
||||
UCHAR *buffer;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ i n p u t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a single character or escape sequence from terminal.
|
||||
* Return number of characters read.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR *p, c;
|
||||
|
||||
p = buffer;
|
||||
*p++ = c = read_char(window);
|
||||
|
||||
if (!c)
|
||||
return 0;
|
||||
|
||||
if (c == 0217) {
|
||||
c = read_char(window);
|
||||
buffer[0] = keypad[c];
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (c == 0233) {
|
||||
*p++ = read_char(window);
|
||||
return 2;
|
||||
}
|
||||
else if (c != 033)
|
||||
return 1;
|
||||
|
||||
/* Escape or control sequence sequence coming in */
|
||||
|
||||
*p++ = c = read_char(window);
|
||||
|
||||
/* If this a keypad character, handling it specially */
|
||||
|
||||
if (c == 'O') {
|
||||
c = read_char(window);
|
||||
buffer[0] = keypad[c];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Handle escape sequences and control sequences slightly differently */
|
||||
|
||||
if (c >= ' ' && c < '/')
|
||||
for (;;) {
|
||||
*p++ = c = read_char(window);
|
||||
if (c >= '0')
|
||||
break;
|
||||
}
|
||||
else
|
||||
for (;;) {
|
||||
*p++ = c = read_char(window);
|
||||
if (c >= '@')
|
||||
break;
|
||||
}
|
||||
|
||||
return p - buffer;
|
||||
}
|
||||
|
||||
|
||||
static get_size(window, width, height)
|
||||
WIN window;
|
||||
int *width, *height;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ s i z e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Try to get size of terminal.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR buffer[32];
|
||||
int n;
|
||||
|
||||
/* Position cursor to lower right and request report */
|
||||
|
||||
position(window, 999, 999);
|
||||
put_line(window, "\33[6n", 4, 0);
|
||||
n = get_input(window, buffer);
|
||||
buffer[n] = 0;
|
||||
n = sscanf(buffer, "\33[%d;%dR", height, width);
|
||||
|
||||
return (n == 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static position(window, x, y)
|
||||
WIN window;
|
||||
USHORT x, y;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p o s i t i o n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Position cursor.
|
||||
*
|
||||
**************************************/
|
||||
SSHORT flag, x1, y1;
|
||||
|
||||
if (window->win_flags & WIN_disabled)
|
||||
enable_forms(window);
|
||||
|
||||
x1 = x + 1;
|
||||
y1 = y + 1;
|
||||
lib$set_cursor(&y1, &x1);
|
||||
}
|
||||
|
||||
|
||||
static put_line(window, string, length, flags)
|
||||
WIN window;
|
||||
UCHAR *string;
|
||||
USHORT length;
|
||||
USHORT flags;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p u t _ l i n e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Write out a bunch of stuff.
|
||||
*
|
||||
**************************************/
|
||||
struct dsc$descriptor text;
|
||||
|
||||
text.dsc$w_length = length;
|
||||
text.dsc$b_class = DSC$K_CLASS_S;
|
||||
text.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
text.dsc$a_pointer = string;
|
||||
|
||||
scr$put_line(&text, 0, flags);
|
||||
}
|
||||
|
||||
|
||||
static read_char(window)
|
||||
WIN window;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* r e a d _ c h a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a character from the user.
|
||||
*
|
||||
**************************************/
|
||||
SCHAR c;
|
||||
SSHORT iosb[4];
|
||||
int status;
|
||||
|
||||
#define FUNCTION IO$_READVBLK | IO$M_NOECHO | IO$M_NOFILTR
|
||||
|
||||
status = sys$qiow(15, /* Event flag */
|
||||
window->win_input, /* Channel */
|
||||
FUNCTION, /* Function */
|
||||
iosb, /* IO status block */
|
||||
NULL, /* AST address */
|
||||
NULL, /* AST parameter */
|
||||
&c, /* P1 (buffer) */
|
||||
1, /* P2 (length) */
|
||||
NULL, NULL, NULL, NULL); /* P3 - P6 */
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
static text(window, string, length, x, y, mode)
|
||||
WIN window;
|
||||
UCHAR *string;
|
||||
USHORT length, x, y;
|
||||
USHORT mode;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* t e x t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Display some text in a given rendition.
|
||||
*
|
||||
**************************************/
|
||||
SSHORT flag, sw;
|
||||
UCHAR c, *p, *end, buffer[1024];
|
||||
|
||||
p = buffer;
|
||||
|
||||
for (end = string + length; string < end; string++) {
|
||||
sw = TRUE;
|
||||
switch (c = *string) {
|
||||
case C_UL_CORNER:
|
||||
c = 'l';
|
||||
break;
|
||||
|
||||
case C_UR_CORNER:
|
||||
c = 'k';
|
||||
break;
|
||||
|
||||
case C_LL_CORNER:
|
||||
c = 'm';
|
||||
break;
|
||||
|
||||
case C_LR_CORNER:
|
||||
c = 'j';
|
||||
break;
|
||||
|
||||
case C_HORZ_BAR:
|
||||
c = 'q';
|
||||
break;
|
||||
|
||||
case C_VERT_BAR:
|
||||
c = 'x';
|
||||
break;
|
||||
|
||||
default:
|
||||
sw = FALSE;
|
||||
}
|
||||
if (sw != graphics_mode) {
|
||||
*p++ = 033;
|
||||
*p++ = '(';
|
||||
*p++ = (sw) ? '0' : 'B';
|
||||
graphics_mode = sw;
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
|
||||
position(window, x, y);
|
||||
|
||||
if (mode & SCR_reverse)
|
||||
flag = 2;
|
||||
else
|
||||
flag = 0;
|
||||
|
||||
put_line(window, buffer, p - buffer, flag);
|
||||
}
|
||||
|
||||
|
||||
static update_window(window, x_offset, y_offset)
|
||||
WIN window;
|
||||
int x_offset, y_offset;
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* u p d a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Update a window leaving the cursor at a given object location.
|
||||
*
|
||||
**************************************/
|
||||
USHORT x, y;
|
||||
|
||||
x = x_offset + 1;
|
||||
y = y_offset + 1;
|
||||
lib$set_cursor(&y, &x);
|
||||
}
|
@ -1,654 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: PYXIS Form Package
|
||||
* MODULE: vt100.c
|
||||
* DESCRIPTION: VT100 Terminal Manager (more like vt220)
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef VMS
|
||||
#include <file.h>
|
||||
#include <types.h>
|
||||
#include <stat.h>
|
||||
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sgtty.h>
|
||||
#endif
|
||||
|
||||
#include "../pyxis/pyxis.h"
|
||||
#include "../pyxis/scr.h"
|
||||
|
||||
#ifndef O_RDWR
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
static USHORT width, height, graphics_mode;
|
||||
|
||||
static int text(WIN , UCHAR*, SSHORT , SSHORT , SSHORT , USHORT);
|
||||
static int clear_window(WIN );
|
||||
static int disable(WIN );
|
||||
static int disable_forms(WIN);
|
||||
static int enable_forms(WIN );
|
||||
static int get_char(WIN , int , int );
|
||||
static int get_input(WIN , UCHAR *);
|
||||
static int get_size(WIN , int *, int *);
|
||||
static int position(WIN , SSHORT , SSHORT );
|
||||
static int read_char(WIN );
|
||||
static int update_window(WIN , int , int );
|
||||
static int fini(WIN );
|
||||
|
||||
typedef struct seq {
|
||||
UCHAR seq_key;
|
||||
UCHAR *seq_sequence;
|
||||
} SEQ;
|
||||
|
||||
static SEQ escape_sequences[] = {
|
||||
(UCHAR) C_UP, (UCHAR *) "[A",
|
||||
(UCHAR) C_DOWN, (UCHAR *) "[B", /* cursor keys */
|
||||
(UCHAR) C_RIGHT, (UCHAR *) "[C",
|
||||
(UCHAR) C_LEFT, (UCHAR *) "[D",
|
||||
(UCHAR) C_PF5, (UCHAR *) "[31~", /* F17 function key */
|
||||
(UCHAR) C_PF6, (UCHAR *) "[18~", /* F7 function key */
|
||||
(UCHAR) C_PF7, (UCHAR *) "[19~", /* F8 function key */
|
||||
(UCHAR) C_PF8, (UCHAR *) "[20~", /* F9 function key */
|
||||
(UCHAR) C_PF9, (UCHAR *) "[21~", /* F10 function key */
|
||||
(UCHAR) C_SCROLL_TOP, (UCHAR *) "[5~", /* Prev Scrn */
|
||||
(UCHAR) C_SCROLL_BOTTOM, (UCHAR *) "[6~", /* Next Scrn */
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
static struct knm keyname_table[] = {
|
||||
{C_PF1, "<PF1>"},
|
||||
{C_PF2, "<PF2>"},
|
||||
{C_PF3, "<PF3>"},
|
||||
{C_PF4, "<PF4>"},
|
||||
{C_PF5, "<F17>"},
|
||||
{C_PF6, "<F7>"},
|
||||
{C_PF7, "<F8>"},
|
||||
{C_PF8, "<F9>"},
|
||||
{C_PF9, "<F10>"},
|
||||
{C_ENTER, "<ENTER>"},
|
||||
{C_LEFT, "<left arrow>"},
|
||||
{C_RIGHT, "<right arrow>"},
|
||||
{C_UP, "<up arrow>"},
|
||||
{C_DOWN, "<down arrow>"},
|
||||
{C_DELETE, "<DELETE>"},
|
||||
{C_SCROLL_TOP, "<PREV SCREEN> or <control-T>"},
|
||||
{C_SCROLL_BOTTOM, "<NEXT SCREEN> of <control-B>"},
|
||||
{C_ERASE, "<control-U>"},
|
||||
{C_DELETE_NEXT, "<control-F>"},
|
||||
{C_INSERT_OVERSTRIKE, "<control-A>"},
|
||||
{C_GOTO_START, "<control-H>"},
|
||||
{C_GOTO_END, "<control-E>"},
|
||||
{C_EDIT, "<control-G>"},
|
||||
{(UCHAR) 0, "<unknown key>"},
|
||||
};
|
||||
|
||||
static UCHAR keypad[256], keypad_equiv[] = {
|
||||
C_ENTER, 'M',
|
||||
C_PF1, 'P',
|
||||
C_PF2, 'Q',
|
||||
C_PF3, 'R',
|
||||
C_PF4, 'S',
|
||||
'-', 'm',
|
||||
',', 'l',
|
||||
'.', 'n',
|
||||
'0', 'p',
|
||||
'1', 'q',
|
||||
'2', 'r',
|
||||
'3', 's',
|
||||
'4', 't',
|
||||
'5', 'u',
|
||||
'6', 'v',
|
||||
'7', 'w',
|
||||
'8', 'x',
|
||||
'9', 'y',
|
||||
0, 0
|
||||
};
|
||||
|
||||
|
||||
int VT100_create_window(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* V T 1 0 0 _ c r e a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create a new display window.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR *p;
|
||||
int width, height;
|
||||
|
||||
window->win_keyname_table = keyname_table;
|
||||
|
||||
/* Populate window with action routines */
|
||||
|
||||
window->win_clear = (int (*)()) clear_window;
|
||||
window->win_disable = (int (*)()) disable;
|
||||
window->win_fini = (int (*)()) fini;
|
||||
window->win_getchar = (int (*)()) get_char;
|
||||
window->win_text = text;
|
||||
window->win_update = (int (*)()) update_window;
|
||||
|
||||
if ((int) (window->win_input = (int *) open("/dev/tty", O_RDWR, 0660)) <
|
||||
0)
|
||||
return FAILURE;
|
||||
else
|
||||
if (!
|
||||
(window->win_output =
|
||||
(int *) fdopen((int) window->win_input, "w"))) return FAILURE;
|
||||
|
||||
enable_forms(window);
|
||||
|
||||
for (p = keypad_equiv; *p; p += 2)
|
||||
keypad[p[1]] = p[0];
|
||||
|
||||
/* If we can get the screen size, check if adjustment is
|
||||
necessary */
|
||||
|
||||
if (get_size(window, &width, &height)) {
|
||||
if (window->win_width && window->win_width > width) {
|
||||
fputs("\33[?3h", (FILE *) window->win_output);
|
||||
window->win_flags |= WIN_reset_80;
|
||||
get_size(window, &width, &height);
|
||||
}
|
||||
window->win_height = (window->win_height) ?
|
||||
MIN(window->win_height, height) : height;
|
||||
window->win_width = (window->win_width) ?
|
||||
MIN(window->win_width, width) : width;
|
||||
}
|
||||
else {
|
||||
window->win_width = 80;
|
||||
window->win_height = 24;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int clear_window(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c l e a r _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Zap a window clean.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
/* Set normal characters, keypad application mode */
|
||||
|
||||
fputs("\33[0m\33=", (FILE *) window->win_output);
|
||||
|
||||
/* Clear screen */
|
||||
|
||||
fprintf((FILE *) window->win_output, "\33[2J");
|
||||
}
|
||||
|
||||
|
||||
static int disable(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d i s a b l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Make window disappear.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
disable_forms(window);
|
||||
window->win_flags |= WIN_disabled;
|
||||
}
|
||||
|
||||
|
||||
#ifndef LINUX
|
||||
static int disable_forms(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d i s a b l e _ f o r m s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Undo forms more for terminal.
|
||||
*
|
||||
**************************************/
|
||||
int n;
|
||||
|
||||
#ifndef VMS
|
||||
struct sgttyb cruft;
|
||||
|
||||
n = ioctl((int) window->win_input, TIOCGETP, &cruft);
|
||||
|
||||
/* If CBREAK is not supported by ioctl, use RAW. (for HP) */
|
||||
|
||||
#ifndef CBREAK
|
||||
cruft.sg_flags &= ~RAW; /* RAW off */
|
||||
#else
|
||||
cruft.sg_flags &= ~CBREAK; /* CBREAK off */
|
||||
#endif
|
||||
|
||||
cruft.sg_flags |= ECHO; /* ECHO on */
|
||||
n = ioctl((int) window->win_input, TIOCSETP, &cruft);
|
||||
#endif
|
||||
|
||||
/* Set normal characters, numeric keypad, non-graphics */
|
||||
|
||||
fputs("\33[0m\33>\33(B\n", (FILE *) window->win_output);
|
||||
clear_window(window);
|
||||
fflush((FILE *) window->win_output);
|
||||
window->win_current_mode = 0;
|
||||
}
|
||||
#else /** Linux Stub **/
|
||||
static int disable_forms(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d i s a b l e _ f o r m s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* stub for linux
|
||||
*
|
||||
**************************************/
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef LINUX
|
||||
static int enable_forms(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e n a b l e _ f o r m s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Put terminal in forms mode.
|
||||
*
|
||||
**************************************/
|
||||
int n;
|
||||
|
||||
#ifndef VMS
|
||||
struct sgttyb cruft;
|
||||
|
||||
n = ioctl((int) window->win_input, TIOCGETP, &cruft);
|
||||
|
||||
/* If CBREAK is not supported by ioctl, use RAW. (for HP) */
|
||||
|
||||
#ifndef CBREAK
|
||||
cruft.sg_flags |= RAW; /* RAW on */
|
||||
#else
|
||||
cruft.sg_flags |= CBREAK; /* CBREAK on */
|
||||
#endif
|
||||
|
||||
cruft.sg_flags &= ~ECHO; /* ECHO off */
|
||||
n = ioctl((int) window->win_input, TIOCSETP, &cruft);
|
||||
#endif
|
||||
|
||||
window->win_current_mode = 0;
|
||||
window->win_flags &= ~WIN_disabled;
|
||||
clear_window(window);
|
||||
}
|
||||
#else /** stub function for LINUX **/
|
||||
static int enable_forms(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e n a b l e _ f o r m s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Stubb for LINUX
|
||||
*
|
||||
**************************************/
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int fini(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* f i n i
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Sign off the screen package.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (window->win_flags & WIN_reset_80)
|
||||
fputs("\33[?3l", (FILE *) window->win_output);
|
||||
|
||||
disable_forms(window);
|
||||
fclose((FILE *) window->win_output);
|
||||
}
|
||||
|
||||
|
||||
static int get_char(WIN window, int x, int y)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ c h a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a character from the user.
|
||||
*
|
||||
**************************************/
|
||||
int n;
|
||||
SEQ *sequence;
|
||||
UCHAR buffer[16], *p, *q, c;
|
||||
|
||||
position(window, x, y);
|
||||
fflush((FILE *) window->win_output);
|
||||
|
||||
for (;;) {
|
||||
if (!(n = get_input(window, buffer)))
|
||||
fprintf(stderr, "read failed\n");
|
||||
if (n == 1)
|
||||
switch (buffer[0]) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
return '\n';
|
||||
|
||||
case 'T' - 0100:
|
||||
return C_SCROLL_TOP;
|
||||
case 'B' - 0100:
|
||||
return C_SCROLL_BOTTOM;
|
||||
case 'Z' - 0100:
|
||||
return C_EOF;
|
||||
|
||||
/* Edit mode */
|
||||
|
||||
case 'F' - 0100:
|
||||
return C_DELETE_NEXT;
|
||||
case 'G' - 0100:
|
||||
return C_EDIT;
|
||||
case 'H' - 0100:
|
||||
return C_GOTO_START;
|
||||
case 'E' - 0100:
|
||||
return C_GOTO_END;
|
||||
case 'A' - 0100:
|
||||
return C_INSERT_OVERSTRIKE;
|
||||
case 'U' - 0100:
|
||||
return C_ERASE;
|
||||
default:
|
||||
return buffer[0];
|
||||
}
|
||||
buffer[n] = 0;
|
||||
for (sequence = escape_sequences; q = sequence->seq_sequence;
|
||||
sequence++)
|
||||
for (p = buffer + 1; *p == *q; p++, q++)
|
||||
if (!*p)
|
||||
return sequence->seq_key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int get_input(WIN window, UCHAR *buffer)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ i n p u t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a single character or escape sequence from terminal.
|
||||
* Return number of characters read.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR *p, c;
|
||||
|
||||
p = buffer;
|
||||
*p++ = c = read_char(window);
|
||||
|
||||
if (!c)
|
||||
return 0;
|
||||
|
||||
if (c != 033)
|
||||
return 1;
|
||||
|
||||
/* Escape or control sequence sequence coming in */
|
||||
|
||||
*p++ = c = read_char(window);
|
||||
|
||||
/* If this a keypad character, handling it specially */
|
||||
|
||||
if (c == 'O') {
|
||||
c = read_char(window);
|
||||
buffer[0] = keypad[c];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Handle escape sequences and control sequences slightly differently */
|
||||
|
||||
if (c >= ' ' && c < '/')
|
||||
for (;;) {
|
||||
*p++ = c = read_char(window);
|
||||
if (c >= '0')
|
||||
break;
|
||||
}
|
||||
else
|
||||
for (;;) {
|
||||
*p++ = c = read_char(window);
|
||||
if (c >= '@')
|
||||
break;
|
||||
}
|
||||
|
||||
return p - buffer;
|
||||
}
|
||||
|
||||
|
||||
static int get_size(WIN window, int *width, int *height)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ s i z e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Try to get size of terminal.
|
||||
*
|
||||
**************************************/
|
||||
TEXT buffer[32];
|
||||
int n;
|
||||
|
||||
/* Position cursor to lower right and request report */
|
||||
|
||||
position(window, 999, 999);
|
||||
fputs("\33[6n", (FILE *) window->win_output);
|
||||
fflush((FILE *) window->win_output);
|
||||
n = get_input(window, (UCHAR*) buffer);
|
||||
buffer[n] = 0;
|
||||
n = sscanf(buffer, "\33[%d;%dR", height, width);
|
||||
|
||||
return (n == 2);
|
||||
}
|
||||
|
||||
|
||||
static int position(WIN window, SSHORT x, SSHORT y)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p o s i t i o n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Position cursor to given location.
|
||||
*
|
||||
**************************************/
|
||||
FILE *file;
|
||||
USHORT temp;
|
||||
UCHAR c;
|
||||
|
||||
if (window->win_flags & WIN_disabled)
|
||||
enable_forms(window);
|
||||
|
||||
file = (FILE *) window->win_output;
|
||||
fprintf(file, "\33[%d;%dH", y + 1, x + 1);
|
||||
}
|
||||
|
||||
|
||||
static int read_char(WIN window)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* r e a d _ c h a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a character from the user.
|
||||
*
|
||||
**************************************/
|
||||
SCHAR c;
|
||||
|
||||
if (read((int) window->win_input, &c, 1) <= 0)
|
||||
return 0;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int text(WIN window, UCHAR*string, SSHORT length, SSHORT x, SSHORT y, USHORT mode)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* t e x t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Insert text in a given location.
|
||||
*
|
||||
**************************************/
|
||||
FILE *file;
|
||||
USHORT temp, sw;
|
||||
UCHAR *end, c;
|
||||
|
||||
position(window, x, y);
|
||||
file = (FILE *) window->win_output;
|
||||
|
||||
if (mode != window->win_current_mode) {
|
||||
fputs("\33[0", file);
|
||||
if (mode & SCR_reverse)
|
||||
fputs(";7", file);
|
||||
if (mode & SCR_bold)
|
||||
fputs(";1", file);
|
||||
if (mode & SCR_underline)
|
||||
fputs(";4", file);
|
||||
fputs("m", file);
|
||||
window->win_current_mode = mode;
|
||||
}
|
||||
|
||||
for (end = string + length; string < end; string++) {
|
||||
sw = TRUE;
|
||||
switch (c = *string) {
|
||||
case C_UL_CORNER:
|
||||
c = 'l';
|
||||
break;
|
||||
|
||||
case C_UR_CORNER:
|
||||
c = 'k';
|
||||
break;
|
||||
|
||||
case C_LL_CORNER:
|
||||
c = 'm';
|
||||
break;
|
||||
|
||||
case C_LR_CORNER:
|
||||
c = 'j';
|
||||
break;
|
||||
|
||||
case C_HORZ_BAR:
|
||||
c = 'q';
|
||||
break;
|
||||
|
||||
case C_VERT_BAR:
|
||||
c = 'x';
|
||||
break;
|
||||
|
||||
default:
|
||||
sw = FALSE;
|
||||
}
|
||||
if (sw != graphics_mode) {
|
||||
fputs((sw) ? "\33(0" : "\33(B", file);
|
||||
graphics_mode = sw;
|
||||
}
|
||||
putc(c, file);
|
||||
}
|
||||
|
||||
/*fflush (file);*/
|
||||
}
|
||||
|
||||
|
||||
static int update_window(WIN window, int x, int y)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* u p d a t e _ w i n d o w
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Update a window leaving the cursor at a given object location.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
position(window, x, y);
|
||||
}
|
@ -44,17 +44,17 @@
|
||||
#define IN_SW_DBA_RELATION 11 /* analyze specific relations */
|
||||
|
||||
static struct in_sw_tab_t dba_in_sw_table [] = {
|
||||
IN_SW_DBA_DATAIDX, 0, "ALL", 0,0,0, FALSE, 22, 0, NULL, /* msg 22: -a analyze data and index pages */
|
||||
IN_SW_DBA_DATA, isc_spb_sts_data_pages, "DATA", 0,0,0, FALSE, 23, 0, NULL, /* msg 23: -d analyze data pages*/
|
||||
IN_SW_DBA_HEADER, isc_spb_sts_hdr_pages, "HEADER", 0,0,0, FALSE, 24, 0, NULL, /* msg 24: -h analyze header page */
|
||||
IN_SW_DBA_INDEX, isc_spb_sts_idx_pages, "INDEX", 0,0,0, FALSE, 25, 0, NULL, /* msg 25: -i analyze index leaf pages */
|
||||
IN_SW_DBA_LOG, isc_spb_sts_db_log, "LOG", 0,0,0, FALSE, 26, 0, NULL, /* msg 26: -l analyze log page */
|
||||
IN_SW_DBA_SYSTEM, isc_spb_sts_sys_relations, "SYSTEM", 0,0,0, FALSE, 27, 0, NULL, /* msg 27: -s analyze system relations */
|
||||
IN_SW_DBA_USERNAME, 0, "USERNAME", 0,0,0, FALSE, 32, 0, NULL, /* msg 32: -u username */
|
||||
IN_SW_DBA_PASSWORD, 0, "PASSWORD", 0,0,0, FALSE, 33, 0, NULL, /* msg 33: -p password */
|
||||
IN_SW_DBA_RECORD, 0, "RECORD", 0,0,0, FALSE, 0, 0, NULL, /* undocumented */
|
||||
IN_SW_DBA_RELATION, 0, "TABLE", 0,0,0, FALSE, 0, 0, NULL, /* undocumented */
|
||||
IN_SW_DBA_VERSION, 0, "Z", 0,0,0, FALSE, 28, 0, NULL, /* msg 28: -z display version number */
|
||||
IN_SW_DBA_0, 0, NULL, 0,0,0, FALSE, 0, 0, NULL /* End of List */
|
||||
{IN_SW_DBA_DATAIDX, 0, "ALL", 0,0,0, FALSE, 22, 0, NULL}, /* msg 22: -a analyze data and index pages */
|
||||
{IN_SW_DBA_DATA, isc_spb_sts_data_pages, "DATA", 0,0,0, FALSE, 23, 0, NULL}, /* msg 23: -d analyze data pages*/
|
||||
{IN_SW_DBA_HEADER, isc_spb_sts_hdr_pages, "HEADER", 0,0,0, FALSE, 24, 0, NULL}, /* msg 24: -h analyze header page */
|
||||
{IN_SW_DBA_INDEX, isc_spb_sts_idx_pages, "INDEX", 0,0,0, FALSE, 25, 0, NULL}, /* msg 25: -i analyze index leaf pages */
|
||||
{IN_SW_DBA_LOG, isc_spb_sts_db_log, "LOG", 0,0,0, FALSE, 26, 0, NULL}, /* msg 26: -l analyze log page */
|
||||
{IN_SW_DBA_SYSTEM, isc_spb_sts_sys_relations, "SYSTEM", 0,0,0, FALSE, 27, 0, NULL}, /* msg 27: -s analyze system relations */
|
||||
{IN_SW_DBA_USERNAME, 0, "USERNAME", 0,0,0, FALSE, 32, 0, NULL}, /* msg 32: -u username */
|
||||
{IN_SW_DBA_PASSWORD, 0, "PASSWORD", 0,0,0, FALSE, 33, 0, NULL}, /* msg 33: -p password */
|
||||
{IN_SW_DBA_RECORD, 0, "RECORD", 0,0,0, FALSE, 0, 0, NULL}, /* undocumented */
|
||||
{IN_SW_DBA_RELATION, 0, "TABLE", 0,0,0, FALSE, 0, 0, NULL}, /* undocumented */
|
||||
{IN_SW_DBA_VERSION, 0, "Z", 0,0,0, FALSE, 28, 0, NULL}, /* msg 28: -z display version number */
|
||||
{IN_SW_DBA_0, 0, NULL, 0,0,0, FALSE, 0, 0, NULL} /* End of List */
|
||||
};
|
||||
#endif /* _DBA_DBASWI_H_ */
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* $Id: ibmgrswi.h,v 1.1.1.1 2001-05-23 13:26:41 tamlin Exp $
|
||||
* $Id: ibmgrswi.h,v 1.2 2001-08-01 08:11:52 skywalker Exp $
|
||||
*/
|
||||
|
||||
#ifndef _IBMGR_IBMGRSWI_H_
|
||||
@ -59,38 +59,38 @@
|
||||
#define IN_SW_IBMGR_AMBIG 99 /* ambiguous switch */
|
||||
|
||||
static struct in_sw_tab_t ibmgr_in_sw_table [] = {
|
||||
IN_SW_IBMGR_START, 0, "START", 0, 0, 0, FALSE, 0, 2, NULL, /* start server */
|
||||
IN_SW_IBMGR_ONCE, 0, "ONCE", 0, 0, 0, FALSE, 0, 1, NULL, /* start server once */
|
||||
IN_SW_IBMGR_FOREVER, 0, "FOREVER", 0, 0, 0, FALSE, 0, 1, NULL, /* restart when server dies */
|
||||
IN_SW_IBMGR_SIGNORE, 0, "SIGNORE", 0, 0, 0, FALSE, 0, 1, NULL, /* dito, ignore start up error */
|
||||
IN_SW_IBMGR_SHUT, 0, "SHUT", 0, 0, 0, FALSE, 0, 3, NULL, /* shutdown server */
|
||||
IN_SW_IBMGR_NOW, 0, "NOW", 0, 0, 0, FALSE, 0, 3, NULL, /* immidiate shutdown */
|
||||
{IN_SW_IBMGR_START, 0, "START", 0, 0, 0, FALSE, 0, 2, NULL}, /* start server */
|
||||
{IN_SW_IBMGR_ONCE, 0, "ONCE", 0, 0, 0, FALSE, 0, 1, NULL}, /* start server once */
|
||||
{IN_SW_IBMGR_FOREVER, 0, "FOREVER", 0, 0, 0, FALSE, 0, 1, NULL}, /* restart when server dies */
|
||||
{IN_SW_IBMGR_SIGNORE, 0, "SIGNORE", 0, 0, 0, FALSE, 0, 1, NULL}, /* dito, ignore start up error */
|
||||
{IN_SW_IBMGR_SHUT, 0, "SHUT", 0, 0, 0, FALSE, 0, 3, NULL}, /* shutdown server */
|
||||
{IN_SW_IBMGR_NOW, 0, "NOW", 0, 0, 0, FALSE, 0, 3, NULL}, /* immidiate shutdown */
|
||||
|
||||
/* The following switches should be activated when
|
||||
appropriate functionality is implemented
|
||||
*/
|
||||
/* IN_SW_IBMGR_NOAT, 0, "NOAT", 0, 0, 0, FALSE, 0, 3, NULL, *//* no new attachments */
|
||||
/* IN_SW_IBMGR_NOTR, 0, "NOTR", 0, 0, 0, FALSE, 0, 3, NULL, *//* no new transaction */
|
||||
/* IN_SW_IBMGR_IGNORE, 0, "IGN", 0, 0, 0, FALSE, 0, 1, NULL, *//* do not shutdown */
|
||||
IN_SW_IBMGR_PASSWORD, 0, "PASSWORD", 0, 0, 0, FALSE, 0, 2, NULL, /* DB admin's password */
|
||||
IN_SW_IBMGR_USER, 0, "USER", 0, 0, 0, FALSE, 0, 1, NULL, /* user's name */
|
||||
/* {IN_SW_IBMGR_NOAT, 0, "NOAT", 0, 0, 0, FALSE, 0, 3, NULL}, *//* no new attachments */
|
||||
/* {IN_SW_IBMGR_NOTR, 0, "NOTR", 0, 0, 0, FALSE, 0, 3, NULL}, *//* no new transaction */
|
||||
/* {IN_SW_IBMGR_IGNORE, 0, "IGN", 0, 0, 0, FALSE, 0, 1, NULL}, *//* do not shutdown */
|
||||
{IN_SW_IBMGR_PASSWORD, 0, "PASSWORD", 0, 0, 0, FALSE, 0, 2, NULL}, /* DB admin's password */
|
||||
{IN_SW_IBMGR_USER, 0, "USER", 0, 0, 0, FALSE, 0, 1, NULL}, /* user's name */
|
||||
|
||||
/* We can shutdown any server, but can start only local
|
||||
thus we do not allow to change host for time being
|
||||
*/
|
||||
/* IN_SW_IBMGR_HOST, 0, "HOST", 0, 0, 0, FALSE, 0, 2, NULL, *//* where server's running */
|
||||
/* {IN_SW_IBMGR_HOST, 0, "HOST", 0, 0, 0, FALSE, 0, 2, NULL}, *//* where server's running */
|
||||
|
||||
/* SET is an internal operation and should not be activated
|
||||
(unless we want a user to use it
|
||||
*/
|
||||
/* IN_SW_IBMGR_SET, 0, "SET", 0, 0, 0, FALSE, 0, 2, NULL, *//* sets host/user/password */
|
||||
IN_SW_IBMGR_SHOW, 0, "SHOW", 0, 0, 0, FALSE, 0, 3, NULL, /* shows host/user/password */
|
||||
IN_SW_IBMGR_QUIT, 0, "QUIT", 0, 0, 0, FALSE, 0, 1, NULL, /* exit command line */
|
||||
IN_SW_IBMGR_HELP, 0, "HELP", 0, 0, 0, FALSE, 0, 2, NULL, /* print help */
|
||||
IN_SW_IBMGR_Z, 0, "Z", 0, 0, 0, FALSE, 0, 1, NULL, /* version */
|
||||
IN_SW_IBMGR_PRINT, 0, "PRINT", 0, 0, 0, FALSE, 0, 2, NULL, /* Print stats */
|
||||
IN_SW_IBMGR_POOL, 0, "POOL", 0, 0, 0, FALSE, 0, 2, NULL, /* Print pool */
|
||||
IN_SW_IBMGR_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL /* End of List */
|
||||
/* {IN_SW_IBMGR_SET, 0, "SET", 0, 0, 0, FALSE, 0, 2, NULL}, *//* sets host/user/password */
|
||||
{IN_SW_IBMGR_SHOW, 0, "SHOW", 0, 0, 0, FALSE, 0, 3, NULL}, /* shows host/user/password */
|
||||
{IN_SW_IBMGR_QUIT, 0, "QUIT", 0, 0, 0, FALSE, 0, 1, NULL}, /* exit command line */
|
||||
{IN_SW_IBMGR_HELP, 0, "HELP", 0, 0, 0, FALSE, 0, 2, NULL}, /* print help */
|
||||
{IN_SW_IBMGR_Z, 0, "Z", 0, 0, 0, FALSE, 0, 1, NULL}, /* version */
|
||||
{IN_SW_IBMGR_PRINT, 0, "PRINT", 0, 0, 0, FALSE, 0, 2, NULL}, /* Print stats */
|
||||
{IN_SW_IBMGR_POOL, 0, "POOL", 0, 0, 0, FALSE, 0, 2, NULL}, /* Print pool */
|
||||
{IN_SW_IBMGR_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL} /* End of List */
|
||||
};
|
||||
|
||||
#endif /* _IBMGR_IBMGRSWI_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user