New version of ncurses port applied, fixed memory leak in gutlgrp.cpp.

This commit is contained in:
Alexander S. Aganichev 2000-03-04 10:02:11 +00:00
parent c3909b39c9
commit 69b146f956
6 changed files with 134 additions and 84 deletions

View File

@ -1,73 +1,97 @@
Random remarks about the ncurses support for GoldEd+
by Jacobo Tarrio, 2:348/102.11@fidonet <jtarrio@iname.com>
This version of GoldEd+ bears the second public release of the ncurses
implementation of its video code; it's still considered beta, so expect some
strange behaviour while it is being completed.
It is being done in order to allow any Unix clone with ncurses installed
(and, probably, any implementation of curses) to run GoldEd+, independently
of the character set used by the system and of the terminal type; GoldEd+
will run fine from the console with a cyrillic character set, from a xterm
with the iso-8859-1 character set, or from a monochrome VT-100 dumb
terminal. It might even be possible in the near future to use GoldEd+
compiled for DOS, Win32 or OS/2, and linked with PDCurses.
This file tries to list some already known bugs along with other nasty
"features" of the code. Expect most of these bugs to disappear and a lot of
fresh new ones to show up in the next public release of the ncurses support
:-) However, I do not always succeed, so old, already existing bugs are
marked with '!', whilst new ones are marked with '*'.
If you find any bug not listed here, please report to Jacobo Tarrio,
2:348/102.11@fidonet <jtarrio@iname.com> ASAP to get it fixed soon, or,
better, fix it yourself and send me the patch :-)
=== 2000-02-25: Second public release
Known bugs:
! The splash screen looks a bit ugly :-)
! The cursor disappears every 30 seconds when editing a message
* Statusline displays a couple of odd characters (after GoldEd+'s name and
before the current time)
* Screen may become corrupted if someone other than GoldEd+ writes on the
terminal
* Messages from the program viewed before entering full-screen are not
displayed properly
Notes:
* I have "ment" the escape key affair (see below) by using some sort of
ncurses version detection and the so. If this misfeature (for I'm sure it
is going to give more trouble than good) annoys you, you can change the
delay after escape by modifying the "ESCDELAY = 50;" assignment at the
file 'goldlib/gall/gkbdbase.cpp', or by commenting it out.
Anyway, you should perhaps be able, with this default setting, to "press"
ALT on terminals that don't have this, by pressing ESC and the desired key
very quickly :-)
=== 2000-01-25: First public release
Known bugs:
* Tab key does not work properly
* Boxes are seen fine (at least with Latin-1) but lines are still drawn
with hyphens (-), plus signs (+), vertical lines (|) and the so.
* The splash screen looks a bit ugly :-)
* The box in the screensaver leaves traces when moving
* The cursor disappears every 30 seconds when editing a message
Notes:
* When pressing the escape key, you must wait for 1 second for GoldEd+ to
take action. This is due to the way most terminals send function keys and
keypad presses; they send ESC followed by some characters, and curses
waits for these characters to arrive. There is a way to shorten the
timeout to, say, 30ms, which is suitable for a 300-baud terminal and still
too fast for humans to notice, but it would make GoldEd+ dependant of a
particular implementation of curses, and of a particular version of that
implementation; also, it would make GoldEd+ unusable over a network or
with some dumb terminals or terminal emulators; this way you can press
ESC followed immediately by an A to "press" ALT-A.
Random remarks about the ncurses support for GoldEd+
by Jacobo Tarrio, 2:348/102.11@fidonet <jtarrio@iname.com>
This version of GoldEd+ bears the third public release of the ncurses
implementation of its video code; it's still considered beta, so expect some
strange behaviour while it is being completed.
It is being done in order to allow any Unix clone with ncurses installed
(and, probably, any implementation of curses) to run GoldEd+, independently
of the character set used by the system and of the terminal type; GoldEd+
will run fine from the console with a cyrillic character set, from a xterm
with the iso-8859-1 character set, or from a monochrome VT-100 dumb
terminal. It might even be possible in the near future to use GoldEd+
compiled for DOS, Win32 or OS/2, and linked with PDCurses.
This file tries to list some already known bugs along with other nasty
"features" of the code. Expect most of these bugs to disappear and a lot of
fresh new ones to show up in the next public release of the ncurses support
:-) However, I do not always succeed, so old, already existing bugs are
marked with '!', whilst new ones are marked with '*'.
If you find any bug not listed here, please report to Jacobo Tarrio,
2:348/102.11@fidonet <jtarrio@iname.com> ASAP to get it fixed soon, or,
better, fix it yourself and send me the patch :-)
=== 2000-02-17: Third public release
Known bugs:
! Statusline displays a couple of odd characters (after GoldEd+'s name and
before the current time)
! Screen may become corrupted if someone other than GoldEd+ writes on the
terminal
! Messages from the program viewed before entering full-screen are not
displayed properly
* The cursor grows very big every 30 seconds when editing a message
(possible reincarnation of a similar bug in former versions)
* The splash screen looks ugly, but not as much as before :)
Notes:
* ESCDELAY is now set by default to 50ms. If it is too short for you, you
can set the ESCDELAY environment variable to override it (under ncurses).
It must hold an integer value representing the delay in milliseconds.
Quite useful over wide area network links or on very-very-i-really-mean-it
slow terminals. Undocumented in ncurses 4, but functional. Documented
in ncurses 5 and above (I believe).
=== 2000-02-05: Second public release
Known bugs:
! The splash screen looks a bit ugly :-)
! The cursor disappears every 30 seconds when editing a message
* Statusline displays a couple of odd characters (after GoldEd+'s name and
before the current time)
* Screen may become corrupted if someone other than GoldEd+ writes on the
terminal
* Messages from the program viewed before entering full-screen are not
displayed properly
Notes:
* I have "ment" the escape key affair (see below) by using some sort of
ncurses version detection and the so. If this misfeature (for I'm sure it
is going to give more trouble than good) annoys you, you can change the
delay after escape by modifying the "ESCDELAY = 50;" assignment at the
file 'goldlib/gall/gkbdbase.cpp', or by commenting it out.
Anyway, you should perhaps be able, with this default setting, to "press"
ALT on terminals that don't have this, by pressing ESC and the desired key
very quickly :-)
=== 2000-01-25: First public release
Known bugs:
* Tab key does not work properly
* Boxes are seen fine (at least with Latin-1) but lines are still drawn
with hyphens (-), plus signs (+), vertical lines (|) and the so.
* The splash screen looks a bit ugly :-)
* The box in the screensaver leaves traces when moving
* The cursor disappears every 30 seconds when editing a message
Notes:
* When pressing the escape key, you must wait for 1 second for GoldEd+ to
take action. This is due to the way most terminals send function keys and
keypad presses; they send ESC followed by some characters, and curses
waits for these characters to arrive. There is a way to shorten the
timeout to, say, 30ms, which is suitable for a 300-baud terminal and still
too fast for humans to notice, but it would make GoldEd+ dependant of a
particular implementation of curses, and of a particular version of that
implementation; also, it would make GoldEd+ unusable over a network or
with some dumb terminals or terminal emulators; this way you can press
ESC followed immediately by an A to "press" ALT-A.

View File

@ -7,6 +7,18 @@ ______________________________________________________________________
--- === *** === ---
______________________________________________________________________
Notes for GoldED+ 1.1.4.4, March xx 2000
______________________________________________________________________
- Fixed sound support under DOS (GSNDAPI).
- From the previous version GoldED+ does not read goldrand.cfg
separately. Just include it with INCLUDE if not yet ;-)
- Fixed some memory leaks.
______________________________________________________________________
Notes for GoldED+ 1.1.4.3, February xx 2000

View File

@ -374,6 +374,14 @@ static void w_brag() {
char buf[200];
char* logo[6];
#if defined(__USE_NCURSES__)
logo[0] = throw_strdup(" 88 88 88 ");
logo[1] = throw_strdup(" oooooo oooooo 88 oooo88 oooooo oooo88 ");
logo[2] = throw_strdup(" 88 88 88 88 88 88 88 88oo88 88 88 ");
logo[3] = throw_strdup(" 88oo88 88oo88 88 88oo88 88oooo 88oo88 ");
logo[4] = throw_strdup(" oo 88 ");
logo[5] = throw_strdup(" 88oooooo88 ");
#else
if(W_BBRAG == 7) {
logo[0] = throw_strdup(" ** ** ** ");
logo[1] = throw_strdup(" ****** ****** ** ****** ****** ****** ");
@ -383,7 +391,7 @@ static void w_brag() {
logo[5] = throw_strdup(" ********** ");
}
else {
#if defined(__UNIX__) and not defined(__USE_NCURSES__)
#if defined(__UNIX__)
if(gvid_xterm) {
logo[0] = throw_strdup(" Ú¿ Ú¿ Ú¿ ");
logo[1] = throw_strdup(" ÚÂÄÄ¿ ÚÂÄÄ¿ ³³ ÚÂÄÄ´³ ÚÂÄÄ¿ ÚÂÄÄ´³ ");
@ -400,7 +408,7 @@ static void w_brag() {
logo[3] = throw_strdup(" ÈÊÍ͹º ÈÊÍÍʼ ȼ ÈÊÍÍʼ ÈÊÍÍʼ ÈÊÍÍʼ ");
logo[4] = throw_strdup(" É» ºº ");
logo[5] = throw_strdup(" ÈÊÍÍÍÍÍÍʼ ");
#if defined(__UNIX__) and not defined(__USE_NCURSES__)
#if defined(__UNIX__)
}
gvid_boxcvt(logo[0]);
gvid_boxcvt(logo[1]);
@ -410,6 +418,7 @@ static void w_brag() {
gvid_boxcvt(logo[5]);
#endif
}
#endif
W_READ = wopen_(1, 2, MAXROW-4, MAXCOL-5, W_BBRAG, C_BRAGB, C_BRAGW);
w_shadow();

View File

@ -32,6 +32,8 @@
#include <gkbdbase.h>
#include <gmemall.h>
#include <stdlib.h>
#if defined(__OS2__)
#define INCL_BASE
#include <os2.h>
@ -98,12 +100,13 @@ void GKbd::Init() {
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
// WARNING: this might break with another version of ncurses, or
// WARNING: this might break with an old version of ncurses, or
// with another implementation of curses. I'm putting it here because
// it is quote useful most of the time :-) For other implementations of
// curses, you might have to compile curses yourself to achieve this. -jt
#if defined(NCURSES_VERSION)
ESCDELAY = 50; // ms, slow for a 300bps terminal, fast for humans :-)
if(not getenv("ESCDELAY")) // If not specified by user via environment, set
ESCDELAY = 50; // ms, slow for a 300bps terminal, fast for humans :-)
#endif
// For more ncurses-dependent code, look at the gkbd_curstable array
// and at the kbxget_raw() function -jt

View File

@ -52,7 +52,7 @@ Grp::~Grp() {
multimap<int, grp_stock>::iterator i;
for(currgrp = container.begin(); currgrp != container.end(); currgrp++)
for(i = currgrp->second.find(GRP_MEMBER); i != currgrp->second.end(); i++) {
for(i = currgrp->second.begin(); i != currgrp->second.end(); i++) {
if(i->second.type == TYPE_OBJECT)
throw_free(i->second.data.object_item);
else if(i->second.type == TYPE_STRING)

View File

@ -1361,9 +1361,10 @@ void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) {
// Does anyone know a better solution?
if(lines >= 0) {
if (lines <= 1 + erow - srow) {
vatch *buf = vsave (srow + lines, scol, erow, ecol);
vrestore (buf, srow, scol, erow - lines, ecol);
if(lines <= 1 + erow - srow) {
vatch *buf = vsave(srow + lines, scol, erow, ecol);
vrestore(buf, srow, scol, erow - lines, ecol);
throw_xfree(buf);
}
else
lines = 1 + erow - srow;
@ -1374,9 +1375,10 @@ void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) {
}
else {
lines*=-1;
if (lines <= 1 + erow - srow) {
vatch *buf = vsave (srow, scol, erow - lines, ecol);
vrestore (buf, srow + lines, scol, erow, ecol);
if(lines <= 1 + erow - srow) {
vatch *buf = vsave(srow, scol, erow - lines, ecol);
vrestore(buf, srow + lines, scol, erow, ecol);
throw_xfree(buf);
}
else
lines = 1 + erow - srow;