mirror of
https://github.com/Aigor44/ncursesw-morphos.git
synced 2024-12-21 07:39:06 +08:00
ncurses 5.7 - patch 20081122
+ change _nc_has_mouse() to has_mouse(), reflect its use in C++ and Ada95 (patch by Juergen Pfeifer). + document in TO-DO an issue with Cygwin's package for GNAT (report by Mike Dennison). + improve error-checking of command-line options in "tabs" program.
This commit is contained in:
parent
412da50547
commit
65ee0f2ca5
@ -1,5 +1,5 @@
|
||||
##############################################################################
|
||||
# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. #
|
||||
# Copyright (c) 1998-2005,2008 Free Software Foundation, Inc. #
|
||||
# #
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a #
|
||||
# copy of this software and associated documentation files (the "Software"), #
|
||||
@ -28,7 +28,7 @@
|
||||
#
|
||||
# Author: Juergen Pfeifer, 1996
|
||||
#
|
||||
# $Id: Makefile.in,v 1.34 2006/12/17 16:45:02 tom Exp $
|
||||
# $Id: Makefile.in,v 1.35 2008/11/23 00:17:20 juergen Exp $
|
||||
#
|
||||
.SUFFIXES:
|
||||
|
||||
@ -145,7 +145,7 @@ mostlyclean:
|
||||
|
||||
clean :: mostlyclean
|
||||
rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] \
|
||||
explain.msg trace screendump
|
||||
explain.msg trace screendump b~*.ad[bs]
|
||||
|
||||
distclean :: clean
|
||||
rm -f Makefile
|
||||
|
@ -35,8 +35,8 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Author: Juergen Pfeifer, 1996
|
||||
-- Version Control:
|
||||
-- $Revision: 1.22 $
|
||||
-- $Date: 2008/07/26 18:51:11 $
|
||||
-- $Revision: 1.23 $
|
||||
-- $Date: 2008/11/16 00:19:59 $
|
||||
-- Binding Version 01.00
|
||||
------------------------------------------------------------------------------
|
||||
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
|
||||
@ -50,7 +50,7 @@ package body Terminal_Interface.Curses.Mouse is
|
||||
function Has_Mouse return Boolean
|
||||
is
|
||||
function Mouse_Avail return C_Int;
|
||||
pragma Import (C, Mouse_Avail, "_nc_has_mouse");
|
||||
pragma Import (C, Mouse_Avail, "has_mouse");
|
||||
begin
|
||||
if Has_Key (Key_Mouse) or else Mouse_Avail /= 0 then
|
||||
return True;
|
||||
|
9
NEWS
9
NEWS
@ -25,7 +25,7 @@
|
||||
-- sale, use or other dealings in this Software without prior written --
|
||||
-- authorization. --
|
||||
-------------------------------------------------------------------------------
|
||||
-- $Id: NEWS,v 1.1322 2008/11/16 00:35:35 tom Exp $
|
||||
-- $Id: NEWS,v 1.1325 2008/11/23 00:20:04 tom Exp $
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This is a log of changes that ncurses has gone through since Zeyd started
|
||||
@ -45,6 +45,13 @@ See the AUTHORS file for the corresponding full names.
|
||||
Changes through 1.9.9e did not credit all contributions;
|
||||
it is not possible to add this information.
|
||||
|
||||
20081122
|
||||
+ change _nc_has_mouse() to has_mouse(), reflect its use in C++ and
|
||||
Ada95 (patch by Juergen Pfeifer).
|
||||
+ document in TO-DO an issue with Cygwin's package for GNAT (report
|
||||
by Mike Dennison).
|
||||
+ improve error-checking of command-line options in "tabs" program.
|
||||
|
||||
20081115
|
||||
+ change several terminfo entries to make consistent use of ANSI
|
||||
clear-all-tabs -TD
|
||||
|
20
TO-DO
20
TO-DO
@ -25,7 +25,7 @@
|
||||
-- sale, use or other dealings in this Software without prior written --
|
||||
-- authorization. --
|
||||
-------------------------------------------------------------------------------
|
||||
-- $Id: TO-DO,v 1.51 2008/10/11 19:22:27 tom Exp $
|
||||
-- $Id: TO-DO,v 1.52 2008/11/22 22:58:59 tom Exp $
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
SHORT-TERM TO-DO ITEMS:
|
||||
@ -66,6 +66,24 @@ Known Problems:
|
||||
+ the --with-pthread configuration builds for Cygwin, but does not work
|
||||
properly (test/worm.c shows all of the worms in the same location).
|
||||
|
||||
+ the Ada95 tree requires a small fix to build on Cygwin, since the GNAT port
|
||||
to that platform provides an incomplete Interrupts.Names package. For
|
||||
instance (your gcc version may be different):
|
||||
/usr/lib/gcc/i686-pc-cygwin/3.4.4/adainclude/a-intnam.ads
|
||||
|
||||
cut here...
|
||||
-------------------------------------------------------------------------------
|
||||
--- a-intnam.ads.orig 2003-10-21 13:41:51.000000000 +0000
|
||||
+++ a-intnam.ads 2007-05-05 22:40:02.609375000 +0000
|
||||
@@ -44,5 +44,6 @@
|
||||
|
||||
DUMMY_INTERRUPT_1 : constant Interrupt_ID := 1;
|
||||
DUMMY_INTERRUPT_2 : constant Interrupt_ID := 2;
|
||||
+ SIGINT : constant Interrupt_ID := 1;
|
||||
|
||||
end Ada.Interrupts.Names;
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
+ the --enable-rpath configure option builds for the corresponding platforms;
|
||||
however combining it with --with-ticlib and --with-termlib does not always
|
||||
produce libraries that can be run without setting environment variables.
|
||||
|
@ -1,6 +1,6 @@
|
||||
// * this is for making emacs happy: -*-Mode: C++;-*-
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2007 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 2007,2008 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the *
|
||||
@ -42,7 +42,7 @@
|
||||
#include "internal.h"
|
||||
#include "cursesw.h"
|
||||
|
||||
MODULE_ID("$Id: cursesw.cc,v 1.49 2007/12/15 23:01:57 tom Exp $")
|
||||
MODULE_ID("$Id: cursesw.cc,v 1.50 2008/11/23 00:17:31 juergen Exp $")
|
||||
|
||||
#define COLORS_NEED_INITIALIZATION -1
|
||||
#define COLORS_NOT_INITIALIZED 0
|
||||
@ -287,7 +287,6 @@ NCursesWindow::NCursesWindow(WINDOW *win, int ncols)
|
||||
{
|
||||
initialize();
|
||||
w = win;
|
||||
assert((w->_maxx +1 ) == ncols);
|
||||
}
|
||||
|
||||
int _nc_xx_ripoff_init(WINDOW *w, int ncols)
|
||||
@ -464,7 +463,7 @@ NCursesWindow::setcolor(short pair)
|
||||
#if HAVE_HAS_KEY
|
||||
bool NCursesWindow::has_mouse() const
|
||||
{
|
||||
return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse())
|
||||
return ((::has_key(KEY_MOUSE) || ::has_mouse())
|
||||
? TRUE : FALSE);
|
||||
}
|
||||
#endif
|
||||
|
4
dist.mk
4
dist.mk
@ -25,7 +25,7 @@
|
||||
# use or other dealings in this Software without prior written #
|
||||
# authorization. #
|
||||
##############################################################################
|
||||
# $Id: dist.mk,v 1.672 2008/11/15 22:12:37 tom Exp $
|
||||
# $Id: dist.mk,v 1.673 2008/11/22 19:33:58 tom Exp $
|
||||
# Makefile for creating ncurses distributions.
|
||||
#
|
||||
# This only needs to be used directly as a makefile by developers, but
|
||||
@ -37,7 +37,7 @@ SHELL = /bin/sh
|
||||
# These define the major/minor/patch versions of ncurses.
|
||||
NCURSES_MAJOR = 5
|
||||
NCURSES_MINOR = 7
|
||||
NCURSES_PATCH = 20081115
|
||||
NCURSES_PATCH = 20081122
|
||||
|
||||
# We don't append the patch to the version, since this only applies to releases
|
||||
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: curses.tail,v 1.16 2008/07/05 20:20:38 tom Exp $ */
|
||||
/* $Id: curses.tail,v 1.17 2008/11/23 00:12:12 tom Exp $ */
|
||||
/*
|
||||
* vile:cmode:
|
||||
* This file is part of ncurses, designed to be appended after curses.h.in
|
||||
@ -94,6 +94,7 @@ typedef struct
|
||||
}
|
||||
MEVENT;
|
||||
|
||||
extern NCURSES_EXPORT(bool) has_mouse (void);
|
||||
extern NCURSES_EXPORT(int) getmouse (MEVENT *);
|
||||
extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
|
||||
extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
|
||||
|
@ -1,6 +1,6 @@
|
||||
'\" t
|
||||
.\"***************************************************************************
|
||||
.\" Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
|
||||
.\" Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
|
||||
.\" *
|
||||
.\" Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
.\" copy of this software and associated documentation files (the *
|
||||
@ -27,11 +27,12 @@
|
||||
.\" authorization. *
|
||||
.\"***************************************************************************
|
||||
.\"
|
||||
.\" $Id: curs_mouse.3x,v 1.30 2006/12/30 23:43:34 tom Exp $
|
||||
.\" $Id: curs_mouse.3x,v 1.31 2008/11/23 00:09:53 tom Exp $
|
||||
.TH curs_mouse 3X ""
|
||||
.na
|
||||
.hy 0
|
||||
.SH NAME
|
||||
\fBhas_mouse\fR,
|
||||
\fBgetmouse\fR, \fBungetmouse\fR,
|
||||
\fBmousemask\fR, \fBwenclose\fR,
|
||||
\fBmouse_trafo\fR, \fBwmouse_trafo\fR,
|
||||
@ -53,7 +54,9 @@ typedef struct
|
||||
MEVENT;\fR
|
||||
.fi
|
||||
.br
|
||||
\fBint getmouse(MEVENT *event);\fR
|
||||
\fBbool has_mouse(void);\fR
|
||||
.br
|
||||
-\fBint getmouse(MEVENT *event);\fR
|
||||
.br
|
||||
\fBint ungetmouse(MEVENT *event);\fR
|
||||
.br
|
||||
@ -197,6 +200,9 @@ This function returns the previous interval value.
|
||||
Use \fBmouseinterval(-1)\fR to obtain the interval without altering it.
|
||||
The default is one sixth of a second.
|
||||
.PP
|
||||
The \fBhas_mouse\fP function returns TRUE if the mouse driver has been
|
||||
successfully initialized.
|
||||
.PP
|
||||
Note that mouse events will be ignored when input is in cooked mode, and will
|
||||
cause an error beep when cooked mode is being simulated in a window by a
|
||||
function such as \fBgetstr\fR that expects a linefeed for input-loop
|
||||
|
@ -79,7 +79,7 @@
|
||||
|
||||
#include <curses.priv.h>
|
||||
|
||||
MODULE_ID("$Id: lib_mouse.c,v 1.102 2008/10/18 21:48:55 tom Exp $")
|
||||
MODULE_ID("$Id: lib_mouse.c,v 1.103 2008/11/23 00:11:46 tom Exp $")
|
||||
|
||||
#include <term.h>
|
||||
#include <tic.h>
|
||||
@ -1397,10 +1397,16 @@ mouseinterval(int maxclick)
|
||||
|
||||
/* This may be used by other routines to ask for the existence of mouse
|
||||
support */
|
||||
NCURSES_EXPORT(int)
|
||||
_nc_has_mouse(void)
|
||||
NCURSES_EXPORT(bool)
|
||||
_nc_has_mouse(SCREEN *sp)
|
||||
{
|
||||
return (SP->_mouse_type == M_NONE ? 0 : 1);
|
||||
return ((sp->_mouse_type == M_NONE) ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
NCURSES_EXPORT(bool)
|
||||
has_mouse(void)
|
||||
{
|
||||
return _nc_has_mouse(SP);
|
||||
}
|
||||
|
||||
NCURSES_EXPORT(bool)
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* $Id: curses.priv.h,v 1.394 2008/10/04 21:37:45 tom Exp $
|
||||
* $Id: curses.priv.h,v 1.395 2008/11/23 00:09:04 tom Exp $
|
||||
*
|
||||
* curses.priv.h
|
||||
*
|
||||
@ -1519,7 +1519,7 @@ extern NCURSES_EXPORT(void) _nc_screen_resume (void);
|
||||
extern NCURSES_EXPORT(void) _nc_screen_wrap (void);
|
||||
|
||||
/* lib_mouse.c */
|
||||
extern NCURSES_EXPORT(int) _nc_has_mouse (void);
|
||||
extern NCURSES_EXPORT(bool) _nc_has_mouse (SCREEN *);
|
||||
|
||||
/* lib_mvcur.c */
|
||||
#define INFINITY 1000000 /* cost: too high to use */
|
||||
|
227
progs/tabs.c
227
progs/tabs.c
@ -37,7 +37,7 @@
|
||||
#define USE_LIBTINFO
|
||||
#include <progs.priv.h>
|
||||
|
||||
MODULE_ID("$Id: tabs.c,v 1.11 2008/11/16 00:58:24 tom Exp $")
|
||||
MODULE_ID("$Id: tabs.c,v 1.15 2008/11/23 00:47:51 tom Exp $")
|
||||
|
||||
static void usage(void) GCC_NORETURN;
|
||||
|
||||
@ -83,41 +83,48 @@ decode_tabs(const char *tab_list)
|
||||
int prior = 0;
|
||||
int ch;
|
||||
|
||||
while ((ch = *tab_list++) != '\0') {
|
||||
if (isdigit(UChar(ch))) {
|
||||
value *= 10;
|
||||
value += (ch - '0');
|
||||
} else if (ch == ',') {
|
||||
result[n] = value + prior;
|
||||
if (n > 0 && value <= result[n - 1]) {
|
||||
fprintf(stderr, "tab-stops are not in increasing order\n");
|
||||
ExitProgram(EXIT_FAILURE);
|
||||
if (result != 0) {
|
||||
while ((ch = *tab_list++) != '\0') {
|
||||
if (isdigit(UChar(ch))) {
|
||||
value *= 10;
|
||||
value += (ch - '0');
|
||||
} else if (ch == ',') {
|
||||
result[n] = value + prior;
|
||||
if (n > 0 && value <= result[n - 1]) {
|
||||
fprintf(stderr,
|
||||
"tab-stops are not in increasing order\n");
|
||||
free(result);
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
value = 0;
|
||||
prior = 0;
|
||||
} else if (ch == '+') {
|
||||
if (n)
|
||||
prior = result[n - 1];
|
||||
}
|
||||
++n;
|
||||
value = 0;
|
||||
prior = 0;
|
||||
} else if (ch == '+') {
|
||||
if (n)
|
||||
prior = result[n - 1];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is only one value, then it is an option such as "-8".
|
||||
*/
|
||||
if ((n == 0) && (value > 0)) {
|
||||
int step = value;
|
||||
while (n < max_cols - 1) {
|
||||
result[n++] = value;
|
||||
value += step;
|
||||
if (result != 0) {
|
||||
/*
|
||||
* If there is only one value, then it is an option such as "-8".
|
||||
*/
|
||||
if ((n == 0) && (value > 0)) {
|
||||
int step = value;
|
||||
while (n < max_cols - 1) {
|
||||
result[n++] = value;
|
||||
value += step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the last value, if any.
|
||||
*/
|
||||
result[n++] = value;
|
||||
result[n] = 0;
|
||||
/*
|
||||
* Add the last value, if any.
|
||||
*/
|
||||
result[n++] = value;
|
||||
result[n] = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -180,6 +187,128 @@ write_tabs(int *tab_list)
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
/*
|
||||
* Trim leading/trailing blanks, as well as blanks after a comma.
|
||||
* Convert embedded blanks to commas.
|
||||
*/
|
||||
static char *
|
||||
trimmed_tab_list(const char *source)
|
||||
{
|
||||
char *result = strdup(source);
|
||||
int ch, j, k, last;
|
||||
|
||||
if (result != 0) {
|
||||
for (j = k = last = 0; result[j] != 0; ++j) {
|
||||
ch = UChar(result[j]);
|
||||
if (isspace(ch)) {
|
||||
if (last == '\0') {
|
||||
continue;
|
||||
} else if (isdigit(last) || last == ',') {
|
||||
ch = ',';
|
||||
}
|
||||
} else if (ch == ',') {
|
||||
;
|
||||
} else {
|
||||
if (last == ',')
|
||||
result[k++] = last;
|
||||
result[k++] = ch;
|
||||
}
|
||||
last = ch;
|
||||
}
|
||||
result[k] = '\0';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool
|
||||
comma_is_needed(const char *source)
|
||||
{
|
||||
bool result = FALSE;
|
||||
|
||||
if (source != 0) {
|
||||
unsigned len = strlen(source);
|
||||
if (len != 0)
|
||||
result = (source[len - 1] != ',');
|
||||
} else {
|
||||
result = FALSE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a command-line parameter to the tab-list. It can be blank- or comma-
|
||||
* separated (or a mixture). For simplicity, empty tabs are ignored, e.g.,
|
||||
* tabs 1,,6,11
|
||||
* tabs 1,6,11
|
||||
* are treated the same.
|
||||
*/
|
||||
static const char *
|
||||
add_to_tab_list(char **append, const char *value)
|
||||
{
|
||||
char *result = *append;
|
||||
char *copied = trimmed_tab_list(value);
|
||||
|
||||
if (copied != 0 && *copied != '\0') {
|
||||
const char *comma = ",";
|
||||
unsigned need = 1 + strlen(copied);
|
||||
|
||||
if (*copied == ',')
|
||||
comma = "";
|
||||
else if (!comma_is_needed(*append))
|
||||
comma = "";
|
||||
|
||||
need += strlen(comma);
|
||||
if (*append != 0)
|
||||
need += strlen(*append);
|
||||
|
||||
result = malloc(need);
|
||||
if (result != 0) {
|
||||
*result = '\0';
|
||||
if (*append != 0) {
|
||||
strcpy(result, *append);
|
||||
free(*append);
|
||||
}
|
||||
strcat(result, comma);
|
||||
strcat(result, copied);
|
||||
}
|
||||
|
||||
*append = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for illegal characters in the tab-list.
|
||||
*/
|
||||
static bool
|
||||
legal_tab_list(const char *program, const char *tab_list)
|
||||
{
|
||||
bool result = TRUE;
|
||||
|
||||
if (tab_list != 0 && *tab_list != '\0') {
|
||||
if (comma_is_needed(tab_list)) {
|
||||
int n, ch;
|
||||
for (n = 0; tab_list[n] != '\0'; ++n) {
|
||||
ch = UChar(tab_list[n]);
|
||||
if (!(isdigit(ch) || ch == ',')) {
|
||||
fprintf(stderr,
|
||||
"%s: unexpected character found '%c'\n",
|
||||
program, ch);
|
||||
result = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "%s: trailing comma found '%s'\n", program, tab_list);
|
||||
result = FALSE;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "%s: no tab-list given\n", program);
|
||||
result = FALSE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
@ -218,7 +347,7 @@ usage(void)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int rc = EXIT_SUCCESS;
|
||||
int rc = EXIT_FAILURE;
|
||||
bool debug = FALSE;
|
||||
bool no_op = FALSE;
|
||||
int n, ch;
|
||||
@ -324,25 +453,15 @@ main(int argc, char *argv[])
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (isdigit(*option)) {
|
||||
if (append != 0) {
|
||||
if (tab_list != (const char *) append) {
|
||||
/* one of the predefined options was used */
|
||||
append = strdup(option);
|
||||
tab_list = append;
|
||||
} else {
|
||||
append = malloc(strlen(tab_list) + strlen(option) + 2);
|
||||
sprintf(append, "%s,%s", tab_list, option);
|
||||
free((char *) tab_list);
|
||||
tab_list = append;
|
||||
}
|
||||
} else {
|
||||
append = strdup(option);
|
||||
tab_list = append;
|
||||
if (append != 0) {
|
||||
if (tab_list != (const char *) append) {
|
||||
/* one of the predefined options was used */
|
||||
free(append);
|
||||
append = 0;
|
||||
}
|
||||
} else {
|
||||
usage();
|
||||
}
|
||||
tab_list = add_to_tab_list(&append, option);
|
||||
option += ((int) strlen(option)) - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -355,13 +474,11 @@ main(int argc, char *argv[])
|
||||
fprintf(stderr,
|
||||
"%s: terminal type '%s' cannot reset tabs\n",
|
||||
argv[0], term_name);
|
||||
rc = EXIT_FAILURE;
|
||||
} else if (!VALID_STRING(set_tab)) {
|
||||
fprintf(stderr,
|
||||
"%s: terminal type '%s' cannot set tabs\n",
|
||||
argv[0], term_name);
|
||||
rc = EXIT_FAILURE;
|
||||
} else {
|
||||
} else if (legal_tab_list(argv[0], tab_list)) {
|
||||
int *list = decode_tabs(tab_list);
|
||||
|
||||
if (!no_op)
|
||||
@ -371,13 +488,19 @@ main(int argc, char *argv[])
|
||||
if (!no_op)
|
||||
do_tabs(list);
|
||||
if (debug) {
|
||||
fflush(stderr);
|
||||
printf("tabs %s\n", tab_list);
|
||||
print_ruler(list);
|
||||
write_tabs(list);
|
||||
}
|
||||
free(list);
|
||||
} else if (debug) {
|
||||
fflush(stderr);
|
||||
printf("tabs %s\n", tab_list);
|
||||
}
|
||||
rc = EXIT_SUCCESS;
|
||||
}
|
||||
if (append)
|
||||
if (append != 0)
|
||||
free(append);
|
||||
ExitProgram(rc);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user