automatic CRTInit

Francesco Bonomi f.bonomi at silab.it
Thu Dec 30 01:53:45 CET 2004



Dear all,

My question is :how can I disable or delay the automatic CRTInit?

What I need to do is write a program that (according to situations) writes 
binary data to output or open an interface (requiring CRT)

The problem is that my binary data gets "filtered" somehow, and some bytes 
are replaced.
I imagine this is because of ncurses, and reading the docs I found out that:

 > If you terminate the program before calling CRTInit or any routine
 > that causes automatic initialization, curses will never be
 > initialized, so e.g., the screen won't be cleared.

But in effects, even without using any CRT routine, just including the crt 
in the uses clause
will initialize ncurses.

I have minimized this problem to a small program that uses the ANSI 
"reverse video" escape sequence Esc-[7m (I use an ansi sequence just 
because it's easily visible, the problem is the same with any other 
non-printable character).

unit beforecrt;
interface

implementation

begin
  write(chr(27),'[7m','BEFORE');
  readln;
end.


program chr;
uses
  beforecrt,
  crt;

begin
  write(chr(27),'[7m','AFTER');
end.

This is what happens:
1) without any clear screen, I see BEFORE in reverse
2) I press Enter
3) The screen is cleared, and "<[7m AFTER" is printed (in normal mode)

The unit beforecrt is initialized before crt, so it's output is correct.
The output from the main program (that gets executed after the 
initialization of crt) is filtered.

Somehow, CRTInit is happening even if I do not use any routine of crt.
How can I avoid this?
Alternatively, how can I disable the ncurses at all?
I have tried  to use
CRTSetTerminal('dumb', input, output);
without any result.

thanks
Francesco
(using gps 20040516)




More information about the Gpc mailing list