mirror of
https://github.com/ThomasDickey/ncurses-snapshots.git
synced 2026-01-26 11:04:35 +00:00
snapshot of project "ncurses", label v1_9_3_p4
This commit is contained in:
parent
761b726bec
commit
9a752b447b
11
CHANGES
11
CHANGES
@ -431,4 +431,13 @@ traceon(); in your code and link with -ldcurses.
|
||||
* systematically gave non-API public functions and data an _nc_ prefix.
|
||||
* integrated Juergen Pfeifer's menu code into the distribution.
|
||||
* totally rewrote the knight test game's interface
|
||||
|
||||
* split lib_traceatr.c, lib_tracechr.c, lib_tracedmp.c from lib_trace.c to
|
||||
avoid spurious use in applications.
|
||||
* moved _nc_outch() from lib_doupdate to lib_tputs.c
|
||||
* split lib_isendwin.c from lib_endwin.c
|
||||
* made new module lib_data.c
|
||||
* include curses.h within tic.h to avoid duplicate definitions of OK/ERR, bool.
|
||||
* modified autoconf script to check for broken linker (e.g., NeXT) which cannot
|
||||
pull in data-only modules; added macros to accommodate this case.
|
||||
* replaced 'isascii()' macro with 'is7bits()'.
|
||||
* check for null-SP in delay_output(), which could happen in 'clear'.
|
||||
|
||||
5
MANIFEST
5
MANIFEST
@ -164,6 +164,7 @@
|
||||
./ncurses/lib_clrbot.c
|
||||
./ncurses/lib_clreol.c
|
||||
./ncurses/lib_color.c
|
||||
./ncurses/lib_data.c
|
||||
./ncurses/lib_delch.c
|
||||
./ncurses/lib_delwin.c
|
||||
./ncurses/lib_doupdate.c
|
||||
@ -177,6 +178,7 @@
|
||||
./ncurses/lib_insdel.c
|
||||
./ncurses/lib_insstr.c
|
||||
./ncurses/lib_instr.c
|
||||
./ncurses/lib_isendwin.c
|
||||
./ncurses/lib_kernel.c
|
||||
./ncurses/lib_longname.c
|
||||
./ncurses/lib_move.c
|
||||
@ -203,6 +205,9 @@
|
||||
./ncurses/lib_tparm.c
|
||||
./ncurses/lib_tputs.c
|
||||
./ncurses/lib_trace.c
|
||||
./ncurses/lib_traceatr.c
|
||||
./ncurses/lib_tracechr.c
|
||||
./ncurses/lib_tracedmp.c
|
||||
./ncurses/lib_tstp.c
|
||||
./ncurses/lib_twait.c
|
||||
./ncurses/lib_unctrl.c
|
||||
|
||||
56
aclocal.m4
vendored
56
aclocal.m4
vendored
@ -184,6 +184,62 @@ AC_DEFUN([NC_LIB_TYPE],
|
||||
esac
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
|
||||
dnl only data (i.e., no functions), for example NeXT. On those systems we'll
|
||||
dnl have to provide wrappers for global tables to ensure they're linked
|
||||
dnl properly.
|
||||
AC_DEFUN([NC_LINK_DATAONLY],
|
||||
[
|
||||
AC_MSG_CHECKING([if data-only library module links])
|
||||
AC_CACHE_VAL(nc_cv_link_dataonly,[
|
||||
rm -f conftest.a
|
||||
changequote(,)dnl
|
||||
cat >conftest.$ac_ext <<EOF
|
||||
#line __oline__ "configure"
|
||||
int testdata[3] = { 123, 456, 789 };
|
||||
EOF
|
||||
changequote([,])dnl
|
||||
if eval $ac_compile; then
|
||||
mv conftest.o data.o
|
||||
ar cr conftest.a data.o
|
||||
fi
|
||||
rm -f conftest.$ac_ext data.o
|
||||
changequote(,)dnl
|
||||
cat >conftest.$ac_ext <<EOF
|
||||
#line __oline__ "configure"
|
||||
int testfunc()
|
||||
{
|
||||
extern int testdata[3];
|
||||
return testdata[0] == 123
|
||||
&& testdata[1] == 456
|
||||
&& testdata[2] == 789;
|
||||
}
|
||||
EOF
|
||||
changequote([,])dnl
|
||||
if eval $ac_compile; then
|
||||
mv conftest.o func.o
|
||||
ar cr conftest.a func.o
|
||||
fi
|
||||
rm -f conftest.$ac_ext func.o
|
||||
eval $ac_cv_prog_RANLIB conftest.a 2>&1 >/dev/null
|
||||
nc_saveLIBS="$LIBS"
|
||||
LIBS="conftest.a $LIBS"
|
||||
AC_TRY_RUN([
|
||||
int main()
|
||||
{
|
||||
extern int testfunc();
|
||||
exit (!testfunc());
|
||||
}
|
||||
],
|
||||
[nc_cv_link_dataonly=yes],
|
||||
[nc_cv_link_dataonly=no],
|
||||
[nc_cv_link_dataonly=unknown])
|
||||
LIBS="$nc_saveLIBS"
|
||||
])
|
||||
AC_MSG_RESULT($nc_cv_link_dataonly)
|
||||
test $nc_cv_link_dataonly = no && AC_DEFINE(BROKEN_LINKER)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
|
||||
dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
|
||||
dnl (GNU 'make' does both :-)
|
||||
|
||||
@ -117,6 +117,7 @@ AC_C_INLINE
|
||||
### Checks for external-data
|
||||
NC_ERRNO
|
||||
NC_SYS_ERRLIST
|
||||
NC_LINK_DATAONLY
|
||||
|
||||
### Checks for library functions.
|
||||
AC_CHECK_FUNCS(sigaction usleep strerror setvbuf setbuffer vsscanf)
|
||||
|
||||
@ -31,15 +31,15 @@ BEGIN {
|
||||
print "#define NCURSES_VERSION \"1.9.3\""
|
||||
print ""
|
||||
print "/* Make this file self-contained by providing defaults for the HAVE_TERMIOS_H"
|
||||
print " * and UNIX definition (based on the system for which this was configured)."
|
||||
print " * and BROKEN_LINKER definition (based on the system for which this was configured)."
|
||||
print " */"
|
||||
print ""
|
||||
print "#ifndef HAVE_TERMIOS_H"
|
||||
print "#define HAVE_TERMIOS_H 1/*default*/"
|
||||
print "#endif"
|
||||
print ""
|
||||
print "#ifndef UNIX"
|
||||
print "#define UNIX 1"
|
||||
print "#ifndef BROKEN_LINKER"
|
||||
print "#define BROKEN_LINKER 0"
|
||||
print "#endif"
|
||||
print ""
|
||||
print ""
|
||||
@ -108,12 +108,25 @@ END {
|
||||
print " TTY Ottyb, /* original state of the terminal */"
|
||||
print " Nttyb; /* current state of the terminal */"
|
||||
print "} TERMINAL;"
|
||||
print ""
|
||||
print "extern TERMINAL *cur_term;"
|
||||
print ""
|
||||
print "extern char *boolnames[], *boolcodes[], *boolfnames[],"
|
||||
print " *numnames[], *numcodes[], *numfnames[],"
|
||||
print " *strnames[], *strcodes[], *strfnames[];"
|
||||
print ""
|
||||
print "extern TERMINAL *cur_term;"
|
||||
print ""
|
||||
print ""
|
||||
print "#if BROKEN_LINKER"
|
||||
print "#define boolnames _nc_boolnames()"
|
||||
print "#define boolcodes _nc_boolcodes()"
|
||||
print "#define boolfnames _nc_boolfnames()"
|
||||
print "#define numnames _nc_numnames()"
|
||||
print "#define numcodes _nc_numcodes()"
|
||||
print "#define numfnames _nc_numfnames()"
|
||||
print "#define strnames _nc_strnames()"
|
||||
print "#define strcodes _nc_strcodes()"
|
||||
print "#define strfnames _nc_strfnames()"
|
||||
print "#endif"
|
||||
print ""
|
||||
print "extern char **boolnames, **boolcodes, **boolfnames,"
|
||||
print " **numnames, **numcodes, **numfnames,"
|
||||
print " **strnames, **strcodes, **strfnames;"
|
||||
print ""
|
||||
print "/* internals */"
|
||||
print "extern int _nc_read_entry(const char *, TERMTYPE *);"
|
||||
|
||||
@ -31,15 +31,15 @@ BEGIN {
|
||||
print "#define NCURSES_VERSION \"@VERSION@\""
|
||||
print ""
|
||||
print "/* Make this file self-contained by providing defaults for the HAVE_TERMIOS_H"
|
||||
print " * and UNIX definition (based on the system for which this was configured)."
|
||||
print " * and BROKEN_LINKER definition (based on the system for which this was configured)."
|
||||
print " */"
|
||||
print ""
|
||||
print "#ifndef HAVE_TERMIOS_H"
|
||||
print "#define HAVE_TERMIOS_H 1/*default*/"
|
||||
print "#endif"
|
||||
print ""
|
||||
print "#ifndef UNIX"
|
||||
print "#define UNIX 1"
|
||||
print "#ifndef BROKEN_LINKER"
|
||||
print "#define BROKEN_LINKER 0"
|
||||
print "#endif"
|
||||
print ""
|
||||
print ""
|
||||
@ -108,12 +108,25 @@ END {
|
||||
print " TTY Ottyb, /* original state of the terminal */"
|
||||
print " Nttyb; /* current state of the terminal */"
|
||||
print "} TERMINAL;"
|
||||
print ""
|
||||
print "extern TERMINAL *cur_term;"
|
||||
print ""
|
||||
print "extern char *boolnames[], *boolcodes[], *boolfnames[],"
|
||||
print " *numnames[], *numcodes[], *numfnames[],"
|
||||
print " *strnames[], *strcodes[], *strfnames[];"
|
||||
print ""
|
||||
print "extern TERMINAL *cur_term;"
|
||||
print ""
|
||||
print ""
|
||||
print "#if BROKEN_LINKER"
|
||||
print "#define boolnames _nc_boolnames()"
|
||||
print "#define boolcodes _nc_boolcodes()"
|
||||
print "#define boolfnames _nc_boolfnames()"
|
||||
print "#define numnames _nc_numnames()"
|
||||
print "#define numcodes _nc_numcodes()"
|
||||
print "#define numfnames _nc_numfnames()"
|
||||
print "#define strnames _nc_strnames()"
|
||||
print "#define strcodes _nc_strcodes()"
|
||||
print "#define strfnames _nc_strfnames()"
|
||||
print "#endif"
|
||||
print ""
|
||||
print "extern char **boolnames, **boolcodes, **boolfnames,"
|
||||
print " **numnames, **numcodes, **numfnames,"
|
||||
print " **strnames, **strcodes, **strfnames;"
|
||||
print ""
|
||||
print "/* internals */"
|
||||
print "extern int _nc_read_entry(const char *, TERMTYPE *);"
|
||||
|
||||
@ -153,8 +153,13 @@ extern chtype acs_map[];
|
||||
#define ACS_LANTERN (acs_map['I']) /* lantern symbol */
|
||||
#define ACS_BLOCK (acs_map['0']) /* solid square block */
|
||||
|
||||
#if !defined(ERR) || ((ERR) != -1)
|
||||
#define ERR (-1)
|
||||
#endif
|
||||
|
||||
#if !defined(OK) || ((OK) != 0)
|
||||
#define OK (0)
|
||||
#endif
|
||||
|
||||
/* values for the _flags member */
|
||||
#define _SUBWIN 0x01 /* is this a sub-window? */
|
||||
|
||||
@ -153,8 +153,13 @@ extern chtype acs_map[];
|
||||
#define ACS_LANTERN (acs_map['I']) /* lantern symbol */
|
||||
#define ACS_BLOCK (acs_map['0']) /* solid square block */
|
||||
|
||||
#if !defined(ERR) || ((ERR) != -1)
|
||||
#define ERR (-1)
|
||||
#endif
|
||||
|
||||
#if !defined(OK) || ((OK) != 0)
|
||||
#define OK (0)
|
||||
#endif
|
||||
|
||||
/* values for the _flags member */
|
||||
#define _SUBWIN 0x01 /* is this a sub-window? */
|
||||
|
||||
@ -5,13 +5,23 @@
|
||||
# $1 = config.h
|
||||
# $2 = term.h
|
||||
#
|
||||
# FIXME: for now, this only has to fix the value of HAVE_TERMIOS_H
|
||||
if ( grep -w HAVE_TERMIOS_H $1 2>&1 >/dev/null )
|
||||
then
|
||||
echo >/dev/null
|
||||
else
|
||||
echo '** edit'
|
||||
for name in \
|
||||
HAVE_TERMIOS_H \
|
||||
BROKEN_LINKER
|
||||
do
|
||||
mv $2 $2.bak
|
||||
sed -e 's/define HAVE_TERMIOS_H.*$/define HAVE_TERMIOS_H 0/' $2.bak >$2
|
||||
rm -f $2.bak
|
||||
fi
|
||||
if ( grep "[ ]$name[ ]" $1 2>&1 >/dev/null )
|
||||
then
|
||||
sed -e 's/define '$name'.*$/define '$name' 1/' $2.bak >$2
|
||||
else
|
||||
sed -e 's/define '$name'.*$/define '$name' 0/' $2.bak >$2
|
||||
fi
|
||||
if (cmp -s $2 $2.bak)
|
||||
then
|
||||
echo '** same: '$name
|
||||
mv $2.bak $2
|
||||
else
|
||||
echo '** edit: '$name
|
||||
rm -f $2.bak
|
||||
fi
|
||||
done
|
||||
|
||||
@ -19,28 +19,16 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* tic.h - Global variables and structures for the terminfo
|
||||
* compiler.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef __TIC_H
|
||||
#define __TIC_H
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef bool
|
||||
#define bool unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef OK
|
||||
#define OK (0)
|
||||
#define ERR (-1)
|
||||
#endif
|
||||
#include <curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */
|
||||
|
||||
#define DEBUG(n, a) if (_nc_tracing & (1 << (n - 1))) _tracef a
|
||||
extern int _nc_tracing;
|
||||
@ -100,12 +88,12 @@ struct alias
|
||||
};
|
||||
|
||||
|
||||
extern struct name_table_entry _nc_info_table[];
|
||||
extern struct name_table_entry *_nc_info_hash_table[];
|
||||
extern struct name_table_entry _nc_cap_table[];
|
||||
extern struct name_table_entry *_nc_cap_hash_table[];
|
||||
extern struct alias _nc_alias_table[];
|
||||
|
||||
extern struct name_table_entry *_nc_get_table(bool);
|
||||
|
||||
#define NOTFOUND ((struct name_table_entry *) 0)
|
||||
|
||||
/* out-of-band values for representing absent capabilities */
|
||||
@ -141,7 +129,7 @@ extern void _nc_panic_mode(char);
|
||||
extern int _nc_curr_line;
|
||||
extern long _nc_curr_file_pos;
|
||||
extern long _nc_comment_start, _nc_comment_end;
|
||||
extern int _nc_syntax;
|
||||
extern bool _nc_syntax;
|
||||
#define SYN_TERMINFO 0
|
||||
#define SYN_TERMCAP 1
|
||||
|
||||
@ -153,8 +141,10 @@ extern void _nc_err_abort(const char *,...);
|
||||
extern void _nc_warning(const char *,...);
|
||||
|
||||
/* captoinfo.c: capability conversion */
|
||||
extern char *_nc_captoinfo(char *, char *, int);
|
||||
extern char *_nc_infotocap(char *, char *, int);
|
||||
extern char *_nc_captoinfo(char *, char *, bool);
|
||||
extern char *_nc_infotocap(char *, char *, bool);
|
||||
|
||||
/* comp_main.c: compiler main */
|
||||
extern char *_nc_progname;
|
||||
|
||||
#endif /* __TIC_H */
|
||||
|
||||
@ -24,9 +24,15 @@
|
||||
* Top level private header file for all libnmenu modules *
|
||||
***************************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef HAVE_EXTERN_ERRNO
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "menu.h"
|
||||
|
||||
/* Backspace code */
|
||||
|
||||
@ -76,7 +76,7 @@ chtype menu_ ## name (\
|
||||
| E_BAD_ARGUMENT - an invalid value has been passed
|
||||
|
|
||||
+--------------------------------------------------------------------------*/
|
||||
GEN_MENU_ATTR_SET_FCT( fore );
|
||||
GEN_MENU_ATTR_SET_FCT( fore )
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
| Facility : libnmenu
|
||||
@ -89,7 +89,7 @@ GEN_MENU_ATTR_SET_FCT( fore );
|
||||
| Return Values : Attribute value
|
||||
|
|
||||
+--------------------------------------------------------------------------*/
|
||||
GEN_MENU_ATTR_GET_FCT( fore );
|
||||
GEN_MENU_ATTR_GET_FCT( fore )
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
| Facility : libnmenu
|
||||
|
||||
@ -13,7 +13,7 @@ cat <<'EOF'
|
||||
#include "term.h"
|
||||
#include "hashsize.h"
|
||||
|
||||
struct name_table_entry _nc_info_table[] =
|
||||
static struct name_table_entry _nc_info_table[] =
|
||||
{
|
||||
EOF
|
||||
|
||||
@ -55,7 +55,7 @@ cat <<'EOF'
|
||||
{(char *)NULL, (char *)NULL}
|
||||
};
|
||||
|
||||
struct name_table_entry _nc_cap_table[] =
|
||||
static struct name_table_entry _nc_cap_table[] =
|
||||
{
|
||||
EOF
|
||||
|
||||
@ -94,5 +94,10 @@ END {
|
||||
print "#error --> term.h and comp_captab.c disagree about the <--"
|
||||
print "#error --> numbers of booleans, numbers and/or strings <--"
|
||||
print "#endif"
|
||||
print ""
|
||||
print "struct name_table_entry *_nc_get_table(bool termcap)"
|
||||
print "{"
|
||||
print " return termcap ? _nc_cap_table: _nc_info_table ;"
|
||||
print "}"
|
||||
}
|
||||
'
|
||||
|
||||
@ -1,21 +1,31 @@
|
||||
|
||||
BEGIN {
|
||||
print "/*" > "boolnames"
|
||||
print "/* This file was generated by MKnames.awk */" > "boolnames"
|
||||
print "" > "boolnames"
|
||||
print "#include \"curses.priv.h\"" > "boolnames"
|
||||
print "" > "boolnames"
|
||||
print "#define IT const char * const" > "boolnames"
|
||||
print "" > "boolnames"
|
||||
print "#if BROKEN_LINKER" > "boolnames"
|
||||
print "#define DCL(it) static IT data##it[]" > "boolnames"
|
||||
print "#else" > "boolnames"
|
||||
print "#define DCL(it) IT it[]" > "boolnames"
|
||||
print "#endif" > "boolnames"
|
||||
print "" > "boolnames"
|
||||
print "/*" > "boolnames"
|
||||
print " * names.c - Arrays of capability names and codes" > "boolnames"
|
||||
print " *" > "boolnames"
|
||||
print " */" > "boolnames"
|
||||
print "" > "boolnames"
|
||||
print "#define NULL (char *)0" > "boolnames"
|
||||
print "" > "boolnames"
|
||||
print "const char * const boolnames[] = {" > "boolnames"
|
||||
print "const char * const boolfnames[] = {" > "boolfnames"
|
||||
print "const char * const boolcodes[] = {" > "boolcodes"
|
||||
print "const char * const numnames[] = {" > "numnames"
|
||||
print "const char * const numfnames[] = {" > "numfnames"
|
||||
print "const char * const numcodes[] = {" > "numcodes"
|
||||
print "const char * const strnames[] = {" > "strnames"
|
||||
print "const char * const strfnames[] = {" > "strfnames"
|
||||
print "const char * const strcodes[] = {" > "strcodes"
|
||||
print " *" > "boolnames"
|
||||
print " */" > "boolnames"
|
||||
print "" > "boolnames"
|
||||
print "DCL(boolnames) = {" > "boolnames"
|
||||
print "DCL(boolfnames) = {" > "boolfnames"
|
||||
print "DCL(boolcodes) = {" > "boolcodes"
|
||||
print "DCL(numnames) = {" > "numnames"
|
||||
print "DCL(numfnames) = {" > "numfnames"
|
||||
print "DCL(numcodes) = {" > "numcodes"
|
||||
print "DCL(strnames) = {" > "strnames"
|
||||
print "DCL(strfnames) = {" > "strfnames"
|
||||
print "DCL(strcodes) = {" > "strcodes"
|
||||
}
|
||||
|
||||
$3 == "bool" {
|
||||
@ -37,30 +47,43 @@ $3 == "str" {
|
||||
}
|
||||
|
||||
END {
|
||||
print "\t\tNULL," > "boolnames"
|
||||
print "\t\t(char *)0," > "boolnames"
|
||||
print "};" > "boolnames"
|
||||
print "" > "boolnames"
|
||||
print "\t\tNULL," > "boolfnames"
|
||||
print "\t\t(char *)0," > "boolfnames"
|
||||
print "};" > "boolfnames"
|
||||
print "" > "boolfnames"
|
||||
print "\t\tNULL," > "boolcodes"
|
||||
print "\t\t(char *)0," > "boolcodes"
|
||||
print "};" > "boolcodes"
|
||||
print "" > "boolcodes"
|
||||
print "\t\tNULL," > "numnames"
|
||||
print "\t\t(char *)0," > "numnames"
|
||||
print "};" > "numnames"
|
||||
print "" > "numnames"
|
||||
print "\t\tNULL," > "numfnames"
|
||||
print "\t\t(char *)0," > "numfnames"
|
||||
print "};" > "numfnames"
|
||||
print "" > "numfnames"
|
||||
print "\t\tNULL," > "numcodes"
|
||||
print "\t\t(char *)0," > "numcodes"
|
||||
print "};" > "numcodes"
|
||||
print "" > "numcodes"
|
||||
print "\t\tNULL," > "strnames"
|
||||
print "\t\t(char *)0," > "strnames"
|
||||
print "};" > "strnames"
|
||||
print "" > "strnames"
|
||||
print "\t\tNULL," > "strfnames"
|
||||
print "\t\t(char *)0," > "strfnames"
|
||||
print "};" > "strfnames"
|
||||
print "" > "strfnames"
|
||||
print "\t\tNULL," > "strcodes"
|
||||
print "};" > "strcodes"
|
||||
print "\t\t(char *)0," > "strcodes"
|
||||
print "};" > "strcodes"
|
||||
print "" > "strcodes"
|
||||
print "#if BROKEN_LINKER" > "strcodes"
|
||||
print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "strcodes"
|
||||
print "FIX(boolnames)" > "strcodes"
|
||||
print "FIX(boolfnames)" > "strcodes"
|
||||
print "FIX(boolcodes)" > "strcodes"
|
||||
print "FIX(numnames)" > "strcodes"
|
||||
print "FIX(numfnames)" > "strcodes"
|
||||
print "FIX(numcodes)" > "strcodes"
|
||||
print "FIX(strnames)" > "strcodes"
|
||||
print "FIX(strfnames)" > "strcodes"
|
||||
print "FIX(strcodes)" > "strcodes"
|
||||
print "#endif /* BROKEN_LINKER */" > "strcodes"
|
||||
}
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <curses.h> /* solely for the _tracef() prototype */
|
||||
#include "tic.h"
|
||||
#include "term.h"
|
||||
#include "term_entry.h"
|
||||
|
||||
@ -60,12 +60,12 @@
|
||||
* is translated.
|
||||
*/
|
||||
|
||||
#include "curses.priv.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <unctrl.h>
|
||||
#include <curses.h>
|
||||
#include "tic.h"
|
||||
|
||||
#ifndef MAX_PUSHED
|
||||
@ -211,7 +211,7 @@ char *_nc_captoinfo(
|
||||
/* convert a termcap string to terminfo format */
|
||||
register char *cap, /* relevant terminfo capability index */
|
||||
register char *s, /* string value of the capability */
|
||||
int parametrized) /* do % translations? */
|
||||
bool parametrized) /* do % translations? */
|
||||
{
|
||||
static char line[MAX_ENTRY];
|
||||
char *capstart;
|
||||
@ -495,7 +495,7 @@ char *_nc_infotocap(
|
||||
/* convert a terminfo string to termcap format */
|
||||
register char *cap, /* relevant termcap capability index */
|
||||
register char *str, /* string value of the capability */
|
||||
int parametrized) /* do % translations? */
|
||||
bool parametrized) /* do % translations? */
|
||||
{
|
||||
int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0;
|
||||
char *padding, ch1 = 0, ch2 = 0;
|
||||
@ -583,7 +583,7 @@ int parametrized) /* do % translations? */
|
||||
|
||||
if (ch1)
|
||||
c1 = ch1;
|
||||
if (isascii(c1) && isprint(c1))
|
||||
if (is7bits(c1) && isprint(c1))
|
||||
*bufptr++ = c1;
|
||||
else
|
||||
{
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <curses.h> /* solely for the _tracef() prototype */
|
||||
#include "tic.h"
|
||||
#include "term.h"
|
||||
#include "hashsize.h"
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <curses.h> /* solely for the _tracef() prototype */
|
||||
#include "tic.h"
|
||||
#include "term.h"
|
||||
#include "term_entry.h"
|
||||
|
||||
@ -27,11 +27,11 @@
|
||||
* int _nc_syntax;
|
||||
*/
|
||||
|
||||
#include "curses.priv.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <curses.h> /* solely for the _tracef() prototype */
|
||||
#include "tic.h"
|
||||
|
||||
/*
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
#define iswhite(ch) (ch == ' ' || ch == '\t')
|
||||
|
||||
int _nc_syntax; /* termcap or terminfo? */
|
||||
bool _nc_syntax; /* termcap or terminfo? */
|
||||
int _nc_curr_line; /* current line # in input */
|
||||
long _nc_curr_file_pos; /* file offset of current line */
|
||||
long _nc_comment_start; /* start of comment range before name */
|
||||
@ -487,31 +487,31 @@ char *ptr;
|
||||
{
|
||||
int count = 0;
|
||||
int number;
|
||||
int i;
|
||||
int i, c;
|
||||
chtype ch, last_ch = '\0';
|
||||
|
||||
while ((ch = next_char()) != separator && ch != EOF) {
|
||||
while ((ch = c = next_char()) != separator && c != EOF) {
|
||||
if (ch == '^' && last_ch != '%') {
|
||||
ch = next_char();
|
||||
if (ch == EOF)
|
||||
ch = c = next_char();
|
||||
if (c == EOF)
|
||||
_nc_err_abort("Premature EOF");
|
||||
|
||||
if (! (isascii(ch) && isprint(ch))) {
|
||||
if (! (is7bits(ch) && isprint(ch))) {
|
||||
_nc_warning("Illegal ^ character - %s",
|
||||
_tracechar((unsigned char)ch));
|
||||
}
|
||||
*(ptr++) = ch & 037;
|
||||
}
|
||||
else if (ch == '\\') {
|
||||
ch = next_char();
|
||||
if (ch == EOF)
|
||||
ch = c = next_char();
|
||||
if (c == EOF)
|
||||
_nc_err_abort("Premature EOF");
|
||||
|
||||
if (ch >= '0' && ch <= '7') {
|
||||
number = ch - '0';
|
||||
for (i=0; i < 2; i++) {
|
||||
ch = next_char();
|
||||
if (ch == EOF)
|
||||
ch = c = next_char();
|
||||
if (c == EOF)
|
||||
_nc_err_abort("Premature EOF");
|
||||
|
||||
if (ch < '0' || ch > '7') {
|
||||
|
||||
@ -46,6 +46,9 @@
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
/* The terminfo source is assumed to be 7-bit ASCII */
|
||||
#define is7bits(c) ((unsigned)(c) < 128)
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) ((a) > (b) ? (b) : (a))
|
||||
#endif
|
||||
@ -54,9 +57,6 @@
|
||||
#define max(a,b) ((a) < (b) ? (b) : (a))
|
||||
#endif
|
||||
|
||||
#define FG(n) ((n) & 0x0f)
|
||||
#define BG(n) (((n) & 0xf0) >> 4)
|
||||
|
||||
#define BLANK (' '|A_NORMAL)
|
||||
|
||||
#define CHANGED -1
|
||||
@ -182,6 +182,23 @@ struct screen {
|
||||
int _vpa_cost; /* cost of (row_address) */
|
||||
};
|
||||
|
||||
/*
|
||||
* On systems with a broken linker, define 'SP' as a function to force the
|
||||
* linker to pull in the data-only module with 'SP'.
|
||||
*/
|
||||
#ifndef BROKEN_LINKER
|
||||
#define BROKEN_LINKER 0
|
||||
#endif
|
||||
|
||||
#if BROKEN_LINKER
|
||||
#define SP _nc_screen()
|
||||
extern int _nc_alloc_screen(void);
|
||||
extern void _nc_set_screen(SCREEN *);
|
||||
#else
|
||||
#define _nc_alloc_screen() ((SP = (SCREEN *) calloc(sizeof(*SP), 1)) != NULL)
|
||||
#define _nc_set_screen(sp) SP = sp
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We don't want to use the lines or columns capabilities internally,
|
||||
* because if the application is running multiple screens under
|
||||
@ -191,7 +208,7 @@ struct screen {
|
||||
#define screen_lines SP->_lines
|
||||
#define screen_columns SP->_columns
|
||||
|
||||
extern struct screen *SP;
|
||||
extern SCREEN *SP;
|
||||
|
||||
extern int _slk_init; /* TRUE if slk_init() called */
|
||||
extern int slk_initialize(WINDOW *, int);
|
||||
|
||||
@ -140,7 +140,7 @@ chtype ch = c;
|
||||
x = 0;
|
||||
break;
|
||||
default:
|
||||
if (isascii(ch & A_CHARTEXT) && iscntrl(ch & A_CHARTEXT))
|
||||
if (is7bits(ch & A_CHARTEXT) && iscntrl(ch & A_CHARTEXT))
|
||||
return(waddstr(win, unctrl((unsigned char)ch)));
|
||||
|
||||
/* FALL THROUGH */
|
||||
@ -160,7 +160,7 @@ chtype ch = c;
|
||||
win->_line[y].text[x++] = ch;
|
||||
TR(TRACE_VIRTPUT, ("(%d, %d) = %s | %s",
|
||||
y, x,
|
||||
_tracechar(ch & A_CHARTEXT),
|
||||
_tracechar((unsigned char)(ch & A_CHARTEXT)),
|
||||
_traceattr((ch & (chtype)A_ATTRIBUTES))));
|
||||
if (x > win->_maxx) {
|
||||
x = 0;
|
||||
@ -187,7 +187,7 @@ do_newline:
|
||||
int waddch(WINDOW *win, const chtype ch)
|
||||
{
|
||||
TR(TRACE_VIRTPUT, ("waddch(%p, %s | %s) called", win,
|
||||
_tracechar(ch & A_CHARTEXT),
|
||||
_tracechar((unsigned char)(ch & A_CHARTEXT)),
|
||||
_traceattr((ch & (chtype)A_ATTRIBUTES))));
|
||||
return wladdch(win, ch, FALSE);
|
||||
}
|
||||
@ -195,7 +195,7 @@ int waddch(WINDOW *win, const chtype ch)
|
||||
int wechochar(WINDOW *win, chtype ch)
|
||||
{
|
||||
TR(TRACE_VIRTPUT, ("wechochar(%p,%s (%s)) called", win,
|
||||
_tracechar(ch & A_CHARTEXT),
|
||||
_tracechar((unsigned char)(ch & A_CHARTEXT)),
|
||||
_traceattr((ch & (chtype)A_ATTRIBUTES))));
|
||||
|
||||
return wladdch(win, ch, TRUE);
|
||||
|
||||
62
ncurses/lib_data.c
Normal file
62
ncurses/lib_data.c
Normal file
@ -0,0 +1,62 @@
|
||||
|
||||
/***************************************************************************
|
||||
* COPYRIGHT NOTICE *
|
||||
****************************************************************************
|
||||
* ncurses is copyright (C) 1992-1995 *
|
||||
* Zeyd M. Ben-Halim *
|
||||
* zmbenhal@netcom.com *
|
||||
* Eric S. Raymond *
|
||||
* esr@snark.thyrsus.com *
|
||||
* *
|
||||
* Permission is hereby granted to reproduce and distribute ncurses *
|
||||
* by any means and for any fee, whether alone or as part of a *
|
||||
* larger distribution, in source or in binary form, PROVIDED *
|
||||
* this notice is included with any such distribution, and is not *
|
||||
* removed from any of its header files. Mention of ncurses in any *
|
||||
* applications linked with it is highly appreciated. *
|
||||
* *
|
||||
* ncurses comes AS IS with no warranty, implied or expressed. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
** lib_data.c
|
||||
**
|
||||
** Common data that may/may not be allocated, but is referenced globally
|
||||
**
|
||||
*/
|
||||
|
||||
#include "curses.priv.h"
|
||||
|
||||
WINDOW *stdscr, *curscr, *newscr;
|
||||
|
||||
/*
|
||||
* The variable 'SP' will be defined as a function on systems that cannot link
|
||||
* data-only modules, since it is used in a lot of places within ncurses and we
|
||||
* cannot guarantee that any application will use any particular function. We
|
||||
* put the WINDOW variables in this module, because it appears that any
|
||||
* application that uses them will also use 'SP'.
|
||||
*
|
||||
* This module intentionally does not reference other ncurses modules, to avoid
|
||||
* module coupling that increases the size of the executable.
|
||||
*/
|
||||
#if BROKEN_LINKER
|
||||
static SCREEN *my_screen;
|
||||
|
||||
SCREEN *_nc_screen(void)
|
||||
{
|
||||
return my_screen;
|
||||
}
|
||||
|
||||
int _nc_alloc_screen(void)
|
||||
{
|
||||
return ((my_screen = (SCREEN *) calloc(sizeof(*SP), 1)) != NULL);
|
||||
}
|
||||
|
||||
void _nc_set_screen(SCREEN *sp)
|
||||
{
|
||||
my_screen = sp;
|
||||
}
|
||||
#else
|
||||
SCREEN *SP;
|
||||
#endif
|
||||
@ -131,7 +131,7 @@ static inline void PutAttrChar(chtype ch)
|
||||
ch = ('`' | (ch & A_ATTRIBUTES));
|
||||
|
||||
TR(TRACE_CHARPUT, ("PutAttrChar(%s, %s) at (%d, %d)",
|
||||
_tracechar((ch & (chtype)A_CHARTEXT)),
|
||||
_tracechar((unsigned char)(ch & A_CHARTEXT)),
|
||||
_traceattr((ch & (chtype)A_ATTRIBUTES)),
|
||||
SP->_cursrow, SP->_curscol));
|
||||
if (curscr->_attrs != (ch & (chtype)A_ATTRIBUTES)) {
|
||||
@ -219,15 +219,6 @@ static inline void PutChar(chtype ch)
|
||||
#endif /* POSITION_DEBUG */
|
||||
}
|
||||
|
||||
int _nc_outch(int ch)
|
||||
{
|
||||
if (SP != NULL)
|
||||
putc(ch, SP->_ofp);
|
||||
else
|
||||
putc(ch, stdout);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int doupdate(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -29,15 +29,8 @@
|
||||
|
||||
#include "curses.priv.h"
|
||||
|
||||
int isendwin()
|
||||
{
|
||||
if (SP == NULL)
|
||||
return FALSE;
|
||||
return SP->_endwin;
|
||||
}
|
||||
|
||||
int
|
||||
endwin()
|
||||
endwin(void)
|
||||
{
|
||||
T(("endwin() called"));
|
||||
|
||||
|
||||
@ -30,9 +30,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
WINDOW *stdscr, *curscr, *newscr;
|
||||
SCREEN *SP;
|
||||
|
||||
WINDOW *initscr(void)
|
||||
{
|
||||
char *name = getenv("TERM");
|
||||
@ -42,11 +39,10 @@ char *name = getenv("TERM");
|
||||
if (newterm(name, stdout, stdin) == NULL) {
|
||||
fprintf(stderr, "Error opening terminal: %s.\n", name);
|
||||
exit(1);
|
||||
} else {
|
||||
def_shell_mode();
|
||||
def_prog_mode();
|
||||
return(stdscr);
|
||||
}
|
||||
def_shell_mode();
|
||||
def_prog_mode();
|
||||
return(stdscr);
|
||||
}
|
||||
|
||||
char *termname(void)
|
||||
|
||||
@ -42,7 +42,7 @@ char *cp;
|
||||
for (cp = (char *)str; *cp && (n > 0 || (cp - str) >= n); cp++) {
|
||||
if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b')
|
||||
addch((chtype)(*cp));
|
||||
else if (isascii(*cp) && iscntrl(*cp)) {
|
||||
else if (is7bits(*cp) && iscntrl(*cp)) {
|
||||
winsch(win, ' ' + (chtype)(*cp));
|
||||
winsch(win, '^');
|
||||
win->_curx += 2;
|
||||
|
||||
37
ncurses/lib_isendwin.c
Normal file
37
ncurses/lib_isendwin.c
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
/***************************************************************************
|
||||
* COPYRIGHT NOTICE *
|
||||
****************************************************************************
|
||||
* ncurses is copyright (C) 1992-1995 *
|
||||
* Zeyd M. Ben-Halim *
|
||||
* zmbenhal@netcom.com *
|
||||
* Eric S. Raymond *
|
||||
* esr@snark.thyrsus.com *
|
||||
* *
|
||||
* Permission is hereby granted to reproduce and distribute ncurses *
|
||||
* by any means and for any fee, whether alone or as part of a *
|
||||
* larger distribution, in source or in binary form, PROVIDED *
|
||||
* this notice is included with any such distribution, and is not *
|
||||
* removed from any of its header files. Mention of ncurses in any *
|
||||
* applications linked with it is highly appreciated. *
|
||||
* *
|
||||
* ncurses comes AS IS with no warranty, implied or expressed. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
** lib_endwin.c
|
||||
**
|
||||
** The routine endwin().
|
||||
**
|
||||
*/
|
||||
|
||||
#include "curses.priv.h"
|
||||
|
||||
int isendwin(void)
|
||||
{
|
||||
if (SP == NULL)
|
||||
return FALSE;
|
||||
return SP->_endwin;
|
||||
}
|
||||
@ -82,7 +82,7 @@ int delay_output(float ms)
|
||||
{
|
||||
T(("delay_output(%f) called", ms));
|
||||
|
||||
if (SP->_baudrate == ERR)
|
||||
if (SP == 0 || SP->_baudrate == ERR)
|
||||
return(ERR);
|
||||
#ifdef no_pad_char
|
||||
else if (no_pad_char)
|
||||
|
||||
@ -1106,7 +1106,7 @@ int main(int argc, char *argv[])
|
||||
(void) strcpy(tname, getenv("TERM"));
|
||||
load_term();
|
||||
_nc_setupscreen(lines, columns);
|
||||
_nc_make_hash_table(_nc_info_table, _nc_info_hash_table);
|
||||
_nc_make_hash_table(_nc_get_table(FALSE), _nc_info_hash_table);
|
||||
|
||||
(void) puts("The mvcur tester. Type ? for help");
|
||||
|
||||
|
||||
@ -116,7 +116,6 @@ int scr_restore(const char *file)
|
||||
(void) fclose(fp);
|
||||
return OK;
|
||||
}
|
||||
return ERR;
|
||||
}
|
||||
|
||||
int scr_dump(const char *file)
|
||||
@ -155,8 +154,6 @@ int scr_init(const char *file)
|
||||
(void) fclose(fp);
|
||||
return OK;
|
||||
}
|
||||
|
||||
return ERR;
|
||||
}
|
||||
|
||||
int scr_set(const char *file)
|
||||
|
||||
@ -39,7 +39,7 @@ struct screen *oldSP;
|
||||
T(("set_term(%p) called", screen));
|
||||
|
||||
oldSP = SP;
|
||||
SP = screen;
|
||||
_nc_set_screen(screen);
|
||||
|
||||
cur_term = SP->_term;
|
||||
curscr = SP->_curscr;
|
||||
@ -66,7 +66,7 @@ int _nc_setupscreen(int slines, int scolumns)
|
||||
{
|
||||
int stolen, topstolen;
|
||||
|
||||
if ((SP = (SCREEN *) calloc(sizeof(*SP), 1)) == NULL)
|
||||
if (!_nc_alloc_screen())
|
||||
return ERR;
|
||||
|
||||
SP->_term = cur_term;
|
||||
|
||||
@ -30,6 +30,15 @@
|
||||
#include <ctype.h>
|
||||
#include "term.h" /* padding_baud_rate, xon_xoff */
|
||||
|
||||
int _nc_outch(int ch)
|
||||
{
|
||||
if (SP != NULL)
|
||||
putc(ch, SP->_ofp);
|
||||
else
|
||||
putc(ch, stdout);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int putp(char *string)
|
||||
{
|
||||
return tputs(string, 1, _nc_outch);
|
||||
|
||||
@ -52,10 +52,10 @@ static int tracefd = 2; /* default to writing to stderr */
|
||||
|
||||
void trace(const unsigned int tracelevel)
|
||||
{
|
||||
static int been_here = 0;
|
||||
static bool been_here = FALSE;
|
||||
|
||||
if (! been_here) {
|
||||
been_here = 1;
|
||||
been_here = TRUE;
|
||||
|
||||
if ((tracefd = creat("trace", 0644)) < 0) {
|
||||
write(2, "curses: Can't open 'trace' file: ", 33);
|
||||
@ -69,66 +69,6 @@ static int been_here = 0;
|
||||
_nc_tracing = tracelevel;
|
||||
}
|
||||
|
||||
|
||||
char *_traceattr(attr_t newmode)
|
||||
{
|
||||
static char buf[BUFSIZ];
|
||||
struct {unsigned int val; char *name;}
|
||||
names[] =
|
||||
{
|
||||
{A_STANDOUT, "A_STANDOUT, ",},
|
||||
{A_UNDERLINE, "A_UNDERLINE, ",},
|
||||
{A_REVERSE, "A_REVERSE, ",},
|
||||
{A_BLINK, "A_BLINK, ",},
|
||||
{A_DIM, "A_DIM, ",},
|
||||
{A_BOLD, "A_BOLD, ",},
|
||||
{A_ALTCHARSET, "A_ALTCHARSET, ",},
|
||||
#ifdef A_PCCHARSET
|
||||
{A_PCCHARSET, "A_PCCHARSET, ",},
|
||||
#endif /* A_PCCHARSET */
|
||||
{A_INVIS, "A_INVIS, ",},
|
||||
{A_PROTECT, "A_PROTECT, ",},
|
||||
{A_CHARTEXT, "A_CHARTEXT, ",},
|
||||
{A_NORMAL, "A_NORMAL, ",},
|
||||
},
|
||||
colors[] =
|
||||
{
|
||||
{COLOR_BLACK, "COLOR_BLACK",},
|
||||
{COLOR_RED, "COLOR_RED",},
|
||||
{COLOR_GREEN, "COLOR_GREEN",},
|
||||
{COLOR_YELLOW, "COLOR_YELLOW",},
|
||||
{COLOR_BLUE, "COLOR_BLUE",},
|
||||
{COLOR_MAGENTA, "COLOR_MAGENTA",},
|
||||
{COLOR_CYAN, "COLOR_CYAN",},
|
||||
{COLOR_WHITE, "COLOR_WHITE",},
|
||||
},
|
||||
*sp;
|
||||
|
||||
strcpy(buf, "{");
|
||||
for (sp = names; sp->val; sp++)
|
||||
if (newmode & sp->val)
|
||||
strcat(buf, sp->name);
|
||||
if (newmode & A_COLOR)
|
||||
{
|
||||
int pairnum = PAIR_NUMBER(newmode);
|
||||
|
||||
if (color_pairs)
|
||||
(void) sprintf(buf + strlen(buf),
|
||||
"COLOR_PAIR(%d) = (%s, %s), ",
|
||||
pairnum,
|
||||
colors[FG(color_pairs[pairnum])].name,
|
||||
colors[BG(color_pairs[pairnum])].name
|
||||
);
|
||||
else
|
||||
(void) sprintf(buf + strlen(buf), "COLOR_PAIR(%d) ", pairnum);
|
||||
}
|
||||
if ((newmode & A_ATTRIBUTES) == 0)
|
||||
strcat(buf,"A_NORMAL, ");
|
||||
if (buf[strlen(buf) - 2] == ',')
|
||||
buf[strlen(buf) - 2] = '\0';
|
||||
return(strcat(buf,"}"));
|
||||
}
|
||||
|
||||
char *_nc_visbuf(const char *buf)
|
||||
/* visibilize a given string */
|
||||
{
|
||||
@ -139,7 +79,7 @@ char *tp = vbuf;
|
||||
return("(null)");
|
||||
|
||||
while (*buf) {
|
||||
if (isascii(*buf) && isgraph(*buf))
|
||||
if (is7bits(*buf) && isgraph(*buf))
|
||||
*tp++ = *buf++;
|
||||
else if (*buf == '\n') {
|
||||
*tp++ = '\\'; *tp++ = 'n';
|
||||
@ -154,7 +94,7 @@ char *tp = vbuf;
|
||||
} else if (*buf == '\033') {
|
||||
*tp++ = '\\'; *tp++ = 'e';
|
||||
buf++;
|
||||
} else if (isascii(*buf) && iscntrl(*buf)) {
|
||||
} else if (is7bits(*buf) && iscntrl(*buf)) {
|
||||
*tp++ = '\\'; *tp++ = '^'; *tp++ = '@' + *buf;
|
||||
buf++;
|
||||
} else {
|
||||
@ -166,87 +106,6 @@ char *tp = vbuf;
|
||||
return(vbuf);
|
||||
}
|
||||
|
||||
char *_tracechar(const unsigned char ch)
|
||||
{
|
||||
static char crep[20];
|
||||
/*
|
||||
* We can show the actual character if it's either an ordinary printable
|
||||
* or one of the high-half characters.
|
||||
*/
|
||||
if (isprint(ch) || (ch & 0x80))
|
||||
{
|
||||
crep[0] = '\'';
|
||||
crep[1] = ch; /* necessary; printf tries too hard on metachars */
|
||||
(void) sprintf(crep + 2, "' = 0x%02x", (unsigned)ch);
|
||||
}
|
||||
else
|
||||
(void) sprintf(crep, "0x%02x", (unsigned)ch);
|
||||
return(crep);
|
||||
}
|
||||
|
||||
void _tracedump(char *name, WINDOW *win)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
for (n = 0; n <= win->_maxy; n++)
|
||||
{
|
||||
char buf[BUFSIZ], *ep;
|
||||
int j, haveattrs, havecolors;
|
||||
|
||||
/* dump A_CHARTEXT part */
|
||||
(void) sprintf(buf, "%s[%2d]='", name, n);
|
||||
ep = buf + strlen(buf);
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
ep[j] = win->_line[n].text[j] & A_CHARTEXT;
|
||||
ep[j] = '\'';
|
||||
ep[j+1] = '\0';
|
||||
_tracef(buf);
|
||||
|
||||
/* dump A_COLOR part, will screw up if there are more than 96 */
|
||||
havecolors = 0;
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
if (win->_line[n].text[j] & A_COLOR)
|
||||
{
|
||||
havecolors = 1;
|
||||
break;
|
||||
}
|
||||
if (havecolors)
|
||||
{
|
||||
(void) sprintf(buf, "%*s[%2d]='", (int)strlen(name), "colors", n);
|
||||
ep = buf + strlen(buf);
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
ep[j] = ((win->_line[n].text[j] >> 8) & 0xff) + ' ';
|
||||
ep[j] = '\'';
|
||||
ep[j+1] = '\0';
|
||||
_tracef(buf);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
const char *hex = " 123456789ABCDEF";
|
||||
chtype mask = (0xf << ((i + 4) * 4));
|
||||
|
||||
haveattrs = 0;
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
if (win->_line[n].text[j] & mask)
|
||||
{
|
||||
haveattrs = 1;
|
||||
break;
|
||||
}
|
||||
if (haveattrs)
|
||||
{
|
||||
(void) sprintf(buf, "%*s%d[%2d]='", (int)strlen(name)-1, "attrs", i, n);
|
||||
ep = buf + strlen(buf);
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)];
|
||||
ep[j] = '\'';
|
||||
ep[j+1] = '\0';
|
||||
_tracef(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_tracef(char *fmt, ...)
|
||||
{
|
||||
|
||||
94
ncurses/lib_traceatr.c
Normal file
94
ncurses/lib_traceatr.c
Normal file
@ -0,0 +1,94 @@
|
||||
|
||||
/***************************************************************************
|
||||
* COPYRIGHT NOTICE *
|
||||
****************************************************************************
|
||||
* ncurses is copyright (C) 1992-1995 *
|
||||
* Zeyd M. Ben-Halim *
|
||||
* zmbenhal@netcom.com *
|
||||
* Eric S. Raymond *
|
||||
* esr@snark.thyrsus.com *
|
||||
* *
|
||||
* Permission is hereby granted to reproduce and distribute ncurses *
|
||||
* by any means and for any fee, whether alone or as part of a *
|
||||
* larger distribution, in source or in binary form, PROVIDED *
|
||||
* this notice is included with any such distribution, and is not *
|
||||
* removed from any of its header files. Mention of ncurses in any *
|
||||
* applications linked with it is highly appreciated. *
|
||||
* *
|
||||
* ncurses comes AS IS with no warranty, implied or expressed. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* lib_traceatr.c - Tracing/Debugging routines (attributes)
|
||||
*/
|
||||
|
||||
#ifndef TRACE
|
||||
#define TRACE /* turn on internal defs for this module */
|
||||
#endif
|
||||
|
||||
#include "curses.priv.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
char *_traceattr(attr_t newmode)
|
||||
{
|
||||
static char buf[BUFSIZ];
|
||||
struct {unsigned int val; char *name;}
|
||||
names[] =
|
||||
{
|
||||
{A_STANDOUT, "A_STANDOUT, ",},
|
||||
{A_UNDERLINE, "A_UNDERLINE, ",},
|
||||
{A_REVERSE, "A_REVERSE, ",},
|
||||
{A_BLINK, "A_BLINK, ",},
|
||||
{A_DIM, "A_DIM, ",},
|
||||
{A_BOLD, "A_BOLD, ",},
|
||||
{A_ALTCHARSET, "A_ALTCHARSET, ",},
|
||||
#ifdef A_PCCHARSET
|
||||
{A_PCCHARSET, "A_PCCHARSET, ",},
|
||||
#endif /* A_PCCHARSET */
|
||||
{A_INVIS, "A_INVIS, ",},
|
||||
{A_PROTECT, "A_PROTECT, ",},
|
||||
{A_CHARTEXT, "A_CHARTEXT, ",},
|
||||
{A_NORMAL, "A_NORMAL, ",},
|
||||
},
|
||||
colors[] =
|
||||
{
|
||||
{COLOR_BLACK, "COLOR_BLACK",},
|
||||
{COLOR_RED, "COLOR_RED",},
|
||||
{COLOR_GREEN, "COLOR_GREEN",},
|
||||
{COLOR_YELLOW, "COLOR_YELLOW",},
|
||||
{COLOR_BLUE, "COLOR_BLUE",},
|
||||
{COLOR_MAGENTA, "COLOR_MAGENTA",},
|
||||
{COLOR_CYAN, "COLOR_CYAN",},
|
||||
{COLOR_WHITE, "COLOR_WHITE",},
|
||||
},
|
||||
*sp;
|
||||
|
||||
strcpy(buf, "{");
|
||||
for (sp = names; sp->val; sp++)
|
||||
if (newmode & sp->val)
|
||||
strcat(buf, sp->name);
|
||||
if (newmode & A_COLOR)
|
||||
{
|
||||
short pairnum = PAIR_NUMBER(newmode);
|
||||
short fg, bg;
|
||||
|
||||
if (pair_content(pairnum, &fg, &bg) == OK)
|
||||
(void) sprintf(buf + strlen(buf),
|
||||
"COLOR_PAIR(%d) = (%s, %s), ",
|
||||
pairnum,
|
||||
colors[fg].name,
|
||||
colors[bg].name
|
||||
);
|
||||
else
|
||||
(void) sprintf(buf + strlen(buf), "COLOR_PAIR(%d) ", pairnum);
|
||||
}
|
||||
if ((newmode & A_ATTRIBUTES) == 0)
|
||||
strcat(buf,"A_NORMAL, ");
|
||||
if (buf[strlen(buf) - 2] == ',')
|
||||
buf[strlen(buf) - 2] = '\0';
|
||||
return(strcat(buf,"}"));
|
||||
}
|
||||
53
ncurses/lib_tracechr.c
Normal file
53
ncurses/lib_tracechr.c
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
/***************************************************************************
|
||||
* COPYRIGHT NOTICE *
|
||||
****************************************************************************
|
||||
* ncurses is copyright (C) 1992-1995 *
|
||||
* Zeyd M. Ben-Halim *
|
||||
* zmbenhal@netcom.com *
|
||||
* Eric S. Raymond *
|
||||
* esr@snark.thyrsus.com *
|
||||
* *
|
||||
* Permission is hereby granted to reproduce and distribute ncurses *
|
||||
* by any means and for any fee, whether alone or as part of a *
|
||||
* larger distribution, in source or in binary form, PROVIDED *
|
||||
* this notice is included with any such distribution, and is not *
|
||||
* removed from any of its header files. Mention of ncurses in any *
|
||||
* applications linked with it is highly appreciated. *
|
||||
* *
|
||||
* ncurses comes AS IS with no warranty, implied or expressed. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* lib_trace.c - Tracing/Debugging routines
|
||||
*/
|
||||
|
||||
#ifndef TRACE
|
||||
#define TRACE /* turn on internal defs for this module */
|
||||
#endif
|
||||
|
||||
#include "curses.priv.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
char *_tracechar(const unsigned char ch)
|
||||
{
|
||||
static char crep[20];
|
||||
/*
|
||||
* We can show the actual character if it's either an ordinary printable
|
||||
* or one of the high-half characters.
|
||||
*/
|
||||
if (isprint(ch) || (ch & 0x80))
|
||||
{
|
||||
crep[0] = '\'';
|
||||
crep[1] = ch; /* necessary; printf tries too hard on metachars */
|
||||
(void) sprintf(crep + 2, "' = 0x%02x", (unsigned)ch);
|
||||
}
|
||||
else
|
||||
(void) sprintf(crep, "0x%02x", (unsigned)ch);
|
||||
return(crep);
|
||||
}
|
||||
96
ncurses/lib_tracedmp.c
Normal file
96
ncurses/lib_tracedmp.c
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
/***************************************************************************
|
||||
* COPYRIGHT NOTICE *
|
||||
****************************************************************************
|
||||
* ncurses is copyright (C) 1992-1995 *
|
||||
* Zeyd M. Ben-Halim *
|
||||
* zmbenhal@netcom.com *
|
||||
* Eric S. Raymond *
|
||||
* esr@snark.thyrsus.com *
|
||||
* *
|
||||
* Permission is hereby granted to reproduce and distribute ncurses *
|
||||
* by any means and for any fee, whether alone or as part of a *
|
||||
* larger distribution, in source or in binary form, PROVIDED *
|
||||
* this notice is included with any such distribution, and is not *
|
||||
* removed from any of its header files. Mention of ncurses in any *
|
||||
* applications linked with it is highly appreciated. *
|
||||
* *
|
||||
* ncurses comes AS IS with no warranty, implied or expressed. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* lib_tracedmp.c - Tracing/Debugging routines
|
||||
*/
|
||||
|
||||
#ifndef TRACE
|
||||
#define TRACE /* turn on internal defs for this module */
|
||||
#endif
|
||||
|
||||
#include "curses.priv.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void _tracedump(char *name, WINDOW *win)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
for (n = 0; n <= win->_maxy; n++)
|
||||
{
|
||||
char buf[BUFSIZ], *ep;
|
||||
int j;
|
||||
bool haveattrs, havecolors;
|
||||
|
||||
/* dump A_CHARTEXT part */
|
||||
(void) sprintf(buf, "%s[%2d]='", name, n);
|
||||
ep = buf + strlen(buf);
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
ep[j] = win->_line[n].text[j] & A_CHARTEXT;
|
||||
ep[j] = '\'';
|
||||
ep[j+1] = '\0';
|
||||
_tracef(buf);
|
||||
|
||||
/* dump A_COLOR part, will screw up if there are more than 96 */
|
||||
havecolors = FALSE;
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
if (win->_line[n].text[j] & A_COLOR)
|
||||
{
|
||||
havecolors = TRUE;
|
||||
break;
|
||||
}
|
||||
if (havecolors)
|
||||
{
|
||||
(void) sprintf(buf, "%*s[%2d]='", (int)strlen(name), "colors", n);
|
||||
ep = buf + strlen(buf);
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
ep[j] = ((win->_line[n].text[j] >> 8) & 0xff) + ' ';
|
||||
ep[j] = '\'';
|
||||
ep[j+1] = '\0';
|
||||
_tracef(buf);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
const char *hex = " 123456789ABCDEF";
|
||||
chtype mask = (0xf << ((i + 4) * 4));
|
||||
|
||||
haveattrs = FALSE;
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
if (win->_line[n].text[j] & mask)
|
||||
{
|
||||
haveattrs = TRUE;
|
||||
break;
|
||||
}
|
||||
if (haveattrs)
|
||||
{
|
||||
(void) sprintf(buf, "%*s%d[%2d]='", (int)strlen(name)-1, "attrs", i, n);
|
||||
ep = buf + strlen(buf);
|
||||
for (j = 0; j <= win->_maxx; j++)
|
||||
ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)];
|
||||
ep[j] = '\'';
|
||||
ep[j+1] = '\0';
|
||||
_tracef(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,8 @@ char *unctrl(register unsigned char uch)
|
||||
* It is a control character. DEL is handled specially (^?). All others
|
||||
* use ^x notation, where x is the character code for the control character
|
||||
* with 0x40 ORed in. (Control-A becomes ^A etc.).
|
||||
*/ buffer[1] = (uch == 0x7F ? '?' : (uch | 0x40));
|
||||
*/
|
||||
buffer[1] = (uch == 0x7F ? '?' : (uch | 0x40));
|
||||
|
||||
return buffer;
|
||||
|
||||
|
||||
@ -59,14 +59,13 @@
|
||||
|
||||
static void do_color(int pair, int (*outc)(int))
|
||||
{
|
||||
int fg, bg;
|
||||
short fg, bg;
|
||||
|
||||
if ( pair == 0 ) {
|
||||
TPUTS_TRACE("orig_pair");
|
||||
tputs(orig_pair, 1, outc);
|
||||
} else {
|
||||
fg = FG(color_pairs[pair]);
|
||||
bg = BG(color_pairs[pair]);
|
||||
pair_content(pair, &fg, &bg);
|
||||
|
||||
T(("setting colors: pair = %d, fg = %d, bg = %d\n", pair, fg, bg));
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ lib_clear lib $(srcdir)
|
||||
lib_clrbot lib $(srcdir)
|
||||
lib_clreol lib $(srcdir)
|
||||
lib_color lib $(srcdir) ../include/term.h
|
||||
lib_data lib $(srcdir)
|
||||
lib_delch lib $(srcdir)
|
||||
lib_delwin lib $(srcdir)
|
||||
lib_doupdate lib $(srcdir) ../include/term.h
|
||||
@ -22,6 +23,7 @@ lib_insch lib $(srcdir)
|
||||
lib_insdel lib $(srcdir)
|
||||
lib_insstr lib $(srcdir)
|
||||
lib_instr lib $(srcdir)
|
||||
lib_isendwin lib $(srcdir)
|
||||
lib_kernel lib $(srcdir) ../include/term.h
|
||||
lib_keyname lib . ../include/term.h
|
||||
lib_longname lib $(srcdir)
|
||||
@ -49,6 +51,9 @@ lib_touch lib $(srcdir)
|
||||
lib_tparm lib $(srcdir) ../include/term.h
|
||||
lib_tputs lib $(srcdir) ../include/term.h
|
||||
lib_trace lib $(srcdir)
|
||||
lib_traceatr lib $(srcdir)
|
||||
lib_tracechr lib $(srcdir)
|
||||
lib_tracedmp lib $(srcdir)
|
||||
lib_tstp lib $(srcdir)
|
||||
lib_twait lib $(srcdir)
|
||||
lib_unctrl lib $(srcdir)
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <curses.h> /* solely for the _tracef() prototype */
|
||||
#include "tic.h"
|
||||
#include "term.h"
|
||||
#include "term_entry.h"
|
||||
@ -156,12 +155,12 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent)
|
||||
/* tell max_attributes from arrow_key_map */
|
||||
if (token_type == NUMBER && !strcmp("ma", _nc_curr_token.tk_name))
|
||||
entry_ptr = _nc_find_type_entry("ma", NUMBER,
|
||||
_nc_syntax ? _nc_cap_table : _nc_info_table);
|
||||
_nc_get_table(_nc_syntax));
|
||||
|
||||
/* map terminfo's string MT to MT */
|
||||
else if (token_type==STRING &&!strcmp("MT",_nc_curr_token.tk_name))
|
||||
entry_ptr = _nc_find_type_entry("MT", STRING,
|
||||
_nc_syntax ? _nc_cap_table : _nc_info_table);
|
||||
_nc_get_table(_nc_syntax));
|
||||
|
||||
/* we couldn't recover; skip this token */
|
||||
else
|
||||
|
||||
@ -133,8 +133,8 @@ int _nc_read_termcap_entry(const char *tn, TERMTYPE *tp)
|
||||
}
|
||||
|
||||
/* get the data from all designated files or the buffer */
|
||||
_nc_make_hash_table(_nc_info_table, _nc_info_hash_table);
|
||||
_nc_make_hash_table(_nc_cap_table, _nc_cap_hash_table);
|
||||
_nc_make_hash_table(_nc_get_table(FALSE), _nc_info_hash_table);
|
||||
_nc_make_hash_table(_nc_get_table(TRUE), _nc_cap_hash_table);
|
||||
|
||||
/* parse the sources */
|
||||
if (use_buffer)
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <curses.h> /* solely for the ncurses version number define */
|
||||
#include "tic.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -37,7 +38,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "tic.h"
|
||||
#include "term.h"
|
||||
#include "dump_entry.h"
|
||||
#include "term_entry.h"
|
||||
@ -129,8 +129,8 @@ ENTRY *qp;
|
||||
exit (1);
|
||||
}
|
||||
|
||||
_nc_make_hash_table(_nc_info_table, _nc_info_hash_table);
|
||||
_nc_make_hash_table(_nc_cap_table, _nc_cap_hash_table);
|
||||
_nc_make_hash_table(_nc_get_table(FALSE), _nc_info_hash_table);
|
||||
_nc_make_hash_table(_nc_get_table(TRUE), _nc_cap_hash_table);
|
||||
if (infodump)
|
||||
dump_init(smart_defaults ? F_TERMINFO : F_LITERAL,
|
||||
S_TERMINFO, width, debug_level);
|
||||
|
||||
@ -45,11 +45,11 @@ static char *separator, *trailer;
|
||||
|
||||
#define OBSOLETE(n) (n[0] == 'O' && n[1] == 'T')
|
||||
|
||||
void dump_init(int mode, int sort, int twidth, int trace)
|
||||
void dump_init(int mode, int sort, int twidth, int traceval)
|
||||
/* set up for entry display */
|
||||
{
|
||||
width = twidth;
|
||||
tracelevel = trace;
|
||||
tracelevel = traceval;
|
||||
|
||||
/* implement display modes */
|
||||
switch (outform = mode)
|
||||
@ -86,13 +86,13 @@ void dump_init(int mode, int sort, int twidth, int trace)
|
||||
switch(sortmode = sort)
|
||||
{
|
||||
case S_NOSORT:
|
||||
if (trace)
|
||||
if (traceval)
|
||||
(void) fprintf(stderr,
|
||||
"%s: sorting by term structure order\n", _nc_progname);
|
||||
break;
|
||||
|
||||
case S_TERMINFO:
|
||||
if (trace)
|
||||
if (traceval)
|
||||
(void) fprintf(stderr,
|
||||
"%s: sorting by terminfo name order\n", _nc_progname);
|
||||
bool_indirect = bool_terminfo_sort;
|
||||
@ -101,7 +101,7 @@ void dump_init(int mode, int sort, int twidth, int trace)
|
||||
break;
|
||||
|
||||
case S_VARIABLE:
|
||||
if (trace)
|
||||
if (traceval)
|
||||
(void) fprintf(stderr,
|
||||
"%s: sorting by C variable order\n", _nc_progname);
|
||||
bool_indirect = bool_variable_sort;
|
||||
@ -110,7 +110,7 @@ void dump_init(int mode, int sort, int twidth, int trace)
|
||||
break;
|
||||
|
||||
case S_TERMCAP:
|
||||
if (trace)
|
||||
if (traceval)
|
||||
(void) fprintf(stderr,
|
||||
"%s: sorting by termcap name order\n", _nc_progname);
|
||||
bool_indirect = bool_termcap_sort;
|
||||
@ -119,14 +119,14 @@ void dump_init(int mode, int sort, int twidth, int trace)
|
||||
break;
|
||||
}
|
||||
|
||||
if (trace)
|
||||
if (traceval)
|
||||
(void) fprintf(stderr,
|
||||
"%s: width = %d, outform = %d\n",
|
||||
_nc_progname, width, outform);
|
||||
}
|
||||
|
||||
/* this deals with differences over whether 0x7f and 0x80..0x9f are controls */
|
||||
#define REALCTL(c) (isascii(c) && iscntrl(c) && (c != '\177'))
|
||||
#define REALCTL(c) ((c) < 127 && iscntrl(c))
|
||||
|
||||
char *expand(unsigned char *srcp)
|
||||
{
|
||||
@ -211,7 +211,7 @@ static int dump_predicate(int type, int idx)
|
||||
|
||||
case STRING:
|
||||
return (cur_type->Strings[idx] != ABSENT_STRING)
|
||||
? TRUE : FAIL;
|
||||
? (int)TRUE : FAIL;
|
||||
}
|
||||
|
||||
return(FALSE); /* pacify compiler */
|
||||
|
||||
@ -32,10 +32,10 @@
|
||||
#include <sys/param.h> /* for MAXPATHLEN */
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <curses.h> /* solely for the ncurses version number define */
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif /* HAVE_GETOPT_H */
|
||||
|
||||
#include "term.h"
|
||||
#include "tic.h"
|
||||
#include "term_entry.h"
|
||||
@ -105,7 +105,6 @@ static int use_predicate(int type, int idx)
|
||||
else
|
||||
return(FAIL);
|
||||
}
|
||||
break;
|
||||
|
||||
case NUMBER: {
|
||||
int value = -1;
|
||||
@ -126,7 +125,6 @@ static int use_predicate(int type, int idx)
|
||||
else
|
||||
return(FAIL);
|
||||
}
|
||||
break;
|
||||
|
||||
case STRING: {
|
||||
char *termstr, *usestr = (char *)NULL;
|
||||
@ -151,8 +149,7 @@ static int use_predicate(int type, int idx)
|
||||
return(TRUE);
|
||||
else
|
||||
return(FAIL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(FALSE); /* pacify compiler */
|
||||
@ -557,8 +554,8 @@ int main(int argc, char *argv[])
|
||||
ENTRY *tails[2];
|
||||
ENTRY *qp, *rp;
|
||||
|
||||
_nc_make_hash_table(_nc_info_table, _nc_info_hash_table);
|
||||
_nc_make_hash_table(_nc_cap_table, _nc_cap_hash_table);
|
||||
_nc_make_hash_table(_nc_get_table(FALSE), _nc_info_hash_table);
|
||||
_nc_make_hash_table(_nc_get_table(TRUE), _nc_cap_hash_table);
|
||||
dump_init(F_LITERAL, S_TERMINFO, 0, itrace);
|
||||
|
||||
for (saveoptind = optind; optind < argc; optind++)
|
||||
|
||||
@ -45,8 +45,7 @@ extern int errno;
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <curses.h> /* solely for the _tracef() prototype */
|
||||
#include "tic.h"
|
||||
#include <tic.h>
|
||||
#include "term.h"
|
||||
#include "term_entry.h"
|
||||
#include "object.h"
|
||||
|
||||
@ -50,8 +50,6 @@ unsigned seed;
|
||||
erase();
|
||||
showit();
|
||||
}
|
||||
endwin();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
@ -43,6 +43,7 @@ static void putstars(int);
|
||||
static bool evalmove(int);
|
||||
static bool chkmoves(void);
|
||||
static bool endgame(void);
|
||||
static int iabs(int); /* <stdlib.h> declares 'abs()' */
|
||||
static bool chksqr(int, int);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -300,12 +301,10 @@ static int getrc (void)
|
||||
case '\n':
|
||||
case ' ':
|
||||
return((BWIDTH * rw) + col);
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
case 'x':
|
||||
return(KEY_EXIT);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
werase(helpwin);
|
||||
@ -374,8 +373,8 @@ static bool evalmove(int j)
|
||||
if (movecount == 0)
|
||||
return(TRUE);
|
||||
|
||||
rdif = abs(rw - lastrow);
|
||||
cdif = abs(col - lastcol);
|
||||
rdif = iabs(rw - lastrow);
|
||||
cdif = iabs(col - lastcol);
|
||||
if (((rdif == 1) && (cdif == 2)) || ((rdif == 2) && (cdif == 1)))
|
||||
if (board [j] == 0)
|
||||
return(TRUE);
|
||||
@ -416,13 +415,11 @@ static bool endgame (void)
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
#ifndef abs
|
||||
static int abs(int num)
|
||||
static int iabs(int num)
|
||||
{
|
||||
if (num < 0) return (-num);
|
||||
else return (num);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool chksqr (int r1, int c1)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user