|
@@ -1,10 +1,9 @@
|
|
|
{
|
|
|
$Id$
|
|
|
+ Copyright (c) 1997 Balazs Scheidler ([email protected])
|
|
|
|
|
|
An interface unit for the terminfo database
|
|
|
|
|
|
- Copyright (c) 1997 Balazs Scheidler ([email protected])
|
|
|
-
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
License as published by the Free Software Foundation; either
|
|
@@ -608,18 +607,21 @@ type
|
|
|
WriterFunc = function (P: PChar): Longint;
|
|
|
|
|
|
var
|
|
|
- cur_term : TerminalCommon_ptr1 ;external name 'cur_term';
|
|
|
+ cur_term : TerminalCommon_ptr1; external name 'cur_term';
|
|
|
cur_term_booleans: ^TT_BoolArray;
|
|
|
cur_term_numbers: ^TT_WordArray;
|
|
|
cur_term_strings: ^TT_PCharArray;
|
|
|
cur_term_common: TerminalCommon_ptr2;
|
|
|
|
|
|
+const
|
|
|
+ cur_term_valid : boolean = false;
|
|
|
+
|
|
|
{ Note: the following two procedures expect a pointer to a full terminfo }
|
|
|
{ structure, not just to the common parts. However, since this structure }
|
|
|
{ differs for different versions of ncurses,it's impossible to give a }
|
|
|
{ general declaration here which is correct (JM) }
|
|
|
function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1;cdecl;
|
|
|
-function del_curterm(term: TerminalCommon_ptr1): Longint;cdecl;
|
|
|
+function del_curterm(term: TerminalCommon_ptr1): Longint;
|
|
|
|
|
|
{ sets whether to use environment variables for LINES and COLUMNS }
|
|
|
procedure use_env(B: Longint);cdecl;
|
|
@@ -653,6 +655,8 @@ function putp(Ndx: Longint): Longint;
|
|
|
var
|
|
|
P: PChar;
|
|
|
begin
|
|
|
+ if not assigned(cur_term) then
|
|
|
+ RunError(219);
|
|
|
P := cur_term_strings^[Ndx];
|
|
|
putp := fdWrite(cur_term_common^.filedes, P^, StrLen(P));
|
|
|
end;
|
|
@@ -661,14 +665,17 @@ function tputs(Ndx: Word; L1: Longint; F: WriterFunc): Longint;
|
|
|
var
|
|
|
P: PChar;
|
|
|
begin
|
|
|
- L1 := L1;
|
|
|
+ if not assigned(cur_term) then
|
|
|
+ RunError(219);
|
|
|
+ { L1 := L1; why was this here ?? PM }
|
|
|
P := cur_term_strings^[Ndx];
|
|
|
tputs := F(P);
|
|
|
end;
|
|
|
|
|
|
function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1; cdecl; external;
|
|
|
-function del_curterm(term: TerminalCommon_ptr1): Longint; cdecl; external;
|
|
|
+
|
|
|
procedure use_env(B: Longint); cdecl; external;
|
|
|
+
|
|
|
function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external;
|
|
|
|
|
|
function setuptermC(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external name 'setupterm';
|
|
@@ -680,6 +687,7 @@ begin
|
|
|
setupterm := setuptermC(term,fd,errcode);
|
|
|
if not assigned(cur_term) then
|
|
|
exit;
|
|
|
+ cur_term_valid := true;
|
|
|
versioncheck := 0;
|
|
|
repeat
|
|
|
if (Terminal_ptr4(cur_term)^.ttype.Booleans[versioncheck] in [false,true]) then
|
|
@@ -705,6 +713,26 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+function del_curtermC(term: TerminalCommon_ptr1): Longint; cdecl; external name 'del_curterm';
|
|
|
+
|
|
|
+function del_curterm(term: TerminalCommon_ptr1): Longint;
|
|
|
+var
|
|
|
+ reset_cur_term : boolean;
|
|
|
+begin
|
|
|
+ if term=cur_term then
|
|
|
+ begin
|
|
|
+ cur_term_booleans := nil;
|
|
|
+ cur_term_numbers := nil;
|
|
|
+ cur_term_strings := nil;
|
|
|
+ cur_term_common := nil;
|
|
|
+ reset_cur_term := true;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ reset_cur_term := false;
|
|
|
+ del_curterm := del_curtermC(term);
|
|
|
+ if reset_cur_term then
|
|
|
+ cur_term_valid := false;
|
|
|
+end;
|
|
|
{function tgetent(P1, P2: PChar): Longint; cdecl; external;
|
|
|
function tgetflag(P: PChar): Longint; cdecl; external;
|
|
|
function tgetnum(P: PChar): Longint; cdecl; external;
|
|
@@ -719,7 +747,10 @@ function tparam(const char *, char *, int, ...): PChar; cdecl; external;}
|
|
|
end.
|
|
|
{
|
|
|
$Log$
|
|
|
- Revision 1.2 2000-08-02 12:39:22 jonas
|
|
|
+ Revision 1.3 2000-10-15 09:20:21 peter
|
|
|
+ * linux terminal fixes merged
|
|
|
+
|
|
|
+ Revision 1.2 2000/08/02 12:39:22 jonas
|
|
|
* fixed crashes under ncurses 4 by adding auto-detection for ncurses 4/5
|
|
|
* cur_term is not directly usable anymore for the largest part because
|
|
|
of a different record layout in ncurses 4/5, therefore the pointers
|
|
@@ -728,38 +759,6 @@ end.
|
|
|
* adapted video.inc to use the new naming convention
|
|
|
(merged from fixes branch)
|
|
|
|
|
|
- Revision 1.1.2.2 2000/08/02 12:30:36 jonas
|
|
|
- * improved version check *slightly*
|
|
|
-
|
|
|
Revision 1.1 2000/07/13 06:29:39 michael
|
|
|
+ Initial import
|
|
|
-
|
|
|
- Revision 1.2 2000/06/30 12:28:57 jonas
|
|
|
- * fixed termtype structure
|
|
|
-
|
|
|
- Revision 1.1 2000/01/06 01:20:31 peter
|
|
|
- * moved out of packages/ back to topdir
|
|
|
-
|
|
|
- Revision 1.1 1999/11/24 23:36:38 peter
|
|
|
- * moved to packages dir
|
|
|
-
|
|
|
- Revision 1.3 1999/04/22 14:48:27 peter
|
|
|
- * remove asm
|
|
|
-
|
|
|
- Revision 1.2 1998/12/07 12:25:51 peter
|
|
|
- * link with ncurses which is more available the curses
|
|
|
-
|
|
|
- Revision 1.1 1998/12/04 12:48:30 peter
|
|
|
- * moved some dirs
|
|
|
-
|
|
|
- Revision 1.1 1998/10/26 11:31:47 peter
|
|
|
- + inital include files
|
|
|
-
|
|
|
- Revision 1.3 1998/10/26 09:36:26 peter
|
|
|
- * fixed cdecl
|
|
|
-
|
|
|
- Revision 1.2 1998/07/29 20:17:47 bazsi
|
|
|
- some updates to Video, it now uses terminfo. Some modifications for FreeVision.
|
|
|
-
|
|
|
- Revision 1.1 1998/06/13 12:38:54 bazsi
|
|
|
-}
|
|
|
+}
|