Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-02

Video unit -- bug? Tracedump -- request?

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Kornel Kisielewicz

Hello all,

I know, I posted about it already on fpc-pascal, but I got no reply, and I'm realy stuck with the linux version of my game because of it... At least please tell me where can I get answers to these questions :-( (other than "use the source, Luke" ;-) )

I'm in the process of porting my FreePascal roguelike game from DOS to Linux. The game finally compiles, but I've hit two problems, one with the Video unit, the other one with LineInfo/Tracedump.

Video doesn't restore terminal settings on Linux after exiting -- the command line doesn't show any typed in text, and doesn't process CR characters... Is this a bug? And if not, what's the cure? (except of course manual reset of the console after execution)

LineInfo/Tracedump -- Is there an easy way to make the output of the tracedump after a crash be appended to a file? Or redirected at all? I need people to submit bug-reports, and while using Video unit the dumps arent readable at all on linux... :-(

At your service,
Kornel Kisielewicz

Reply by email

Marco van de Voort
to Kornel Kisielewicz
Video doesn't restore terminal settings on Linux after exiting -- the command line doesn't show any typed in text, and doesn't process CR characters... Is this a bug? And if not, what's the cure? (except of course manual reset of the console after execution)

Do you call donevideo?

LineInfo/Tracedump -- Is there an easy way to make the output of the tracedump after a crash be appended to a file? Or redirected at all? I need people to submit bug-reports, and while using Video unit the dumps arent readable at all on linux... :-(

Don't know, try:

./x 2> filename.txt

Reply by email

Peter Vreman
to Marco van de Voort
Show quoted text 19 lines
> Video doesn't restore terminal settings on Linux after exiting -- > the > command line doesn't show any typed in text, and doesn't process CR > characters... Is this a bug? And if not, what's the cure? (except of > course > manual reset of the console after execution) Do you call donevideo? > LineInfo/Tracedump -- Is there an easy way to make the output of the > tracedump after a crash be appended to a file? Or redirected at all? I > need > people to submit bug-reports, and while using Video unit the dumps arent > readable at all on linux... :-( Don't know, try: ./x 2> filename.txt

For heaptrc you can use SetHeapTrcOutput("heap.log"). For normal runtime errors/exceptions with backtrace there is no way to redirect. The writing of that info is to stdout for compatibility.

Reply by email

Kornel Kisielewicz
to Marco van de Voort: Do you call donevideo? Don't know, try: ./x 2> filename.txt
Marco van de Voort wrote 6 lines
> Video doesn't restore terminal settings on Linux after exiting > -- the command line doesn't show any typed in text, and doesn't > process CR characters... Is this a bug? And if not, what's the cure? > (except of course manual reset of the console after execution) Do you call donevideo?

Yes. Always. I also use Keyboard, now that I think about it (and call DoneKeyboard too).

Show quoted text 8 lines
> LineInfo/Tracedump -- Is there an easy way to make the output of > the tracedump after a crash be appended to a file? Or redirected at > all? I need people to submit bug-reports, and while using Video unit > the dumps arent readable at all on linux... :-( Don't know, try: ./x 2> filename.txt

This is not something I can tell a non-programmer beta-tester to do -- I wanted something simple :-(.

Peter Vreman wrote
For normal runtime errors/exceptions with backtrace there is no way to redirect. The writing of that info is to stdout for compatibility.

Isn't there any way to catch stdout to a file? (I tried to check in a ExitrProc wether ExitCode is non-zero and if so Assign StdOut, but assigning stdout doesn't seem to work -- guess it cant be reasigned...)

At your service,
Kornel Kisielewicz

Reply by email

Dr. Karl-Michael Schindler
to Marco van de Voort: Do you call donevideo? Don't know, try: ./x 2> filename.txt

There is a endian related bug in the crt unit, which breaks the examples ex10 and ex11 of the crt docs. The following fixes the bug and makes the code more obvious. I suggest to replace the following two routines. Tested on Mac OS X. It fixes web bug 3788 (I submitted that one) and 3391 as good as possible (submitted by coraxyn). Some small editing corrections as well.

Procedure DoEmptyLine(y,xl,xh:Longint);
{
   Write an empty line at row Y from column Xl to Xh. Memory is also
updated.
}
Var
   len : Longint;
   blank_with_attribute : TCharAttr;
Begin
   ttyGotoXY(xl,y);
   len:=xh-xl+1;
   LineWrite(Space(len));
   blank_with_attribute.ch:=' ';
   blank_with_attribute.attr:=TextAttr;
FillWord(ConsoleBuf^[(y-1)*ScreenWidth+xl
-1],len,word(blank_with_attribute));
End;
Procedure ClrScr;
{
   Clear the current window, and set the cursor on 1,1
}
Var
   CY,i      : Longint;
   oldflush  : boolean;
   blank_with_attribute : TCharAttr;
Begin
   { See if color has changed }
   if OldTextAttrTextAttr then
    begin
      i:=TextAttr;
      TextAttr:=OldTextAttr;
      ttyColor(i);
    end;
   oldflush:=ttySetFlush(Flushing);
   if FullWin then
    begin
      if not OutputRedir then
       ttySendStr(#27'[H'#27'[2J');
      CurrX:=1;
      CurrY:=1;
      blank_with_attribute.ch   := ' ';
      blank_with_attribute.attr := TextAttr;
FillWord(ConsoleBuf^,ScreenWidth*ScreenHeight,word(blank_with_attribute)
);
    end
   else
    begin
      For Cy:=WinMinY To WinMaxY Do
       DoEmptyLine(Cy,WinMinX,WinMaxX);
      GoToXY(1,1);
    end;
   ttySetFlush(oldflush);
End;

Reply by email

Jonas Maebe
to Dr. Karl-Michael Schindler
Dr. Karl-Michael Schindler wrote 6 lines
There is a endian related bug in the crt unit, which breaks the examples ex10 and ex11 of the crt docs. The following fixes the bug and makes the code more obvious. I suggest to replace the following two routines. Tested on Mac OS X. It fixes web bug 3788 (I submitted that one) and 3391 as good as possible (submitted by coraxyn). Some small editing corrections as well.

There's still a problem somewhere though: at the end of ex10, the output on the screen is

Line 1
Line 2
Line 3

Oops, forgot Line 2, let's insert at the cursor postion

Under Linux, there is no space before "Line 2", and from looking at the source, there shouldn't be any. Nevertheless, your patch already solves some other problems, so I've committed it. Thanks.

Jonas

Reply by email

Dr. Karl-Michael Schindler
to Jonas Maebe

The additional blank only shows up in Terminal.app and X11 mlterm, but not in X11 xterm, aterm, eterm and rxvt. I am not sure, whether I will follow that :)

MIchael

Jonas Maebe wrote 26 lines
On 15 mrt 2005, at 08:51, Dr. Karl-Michael Schindler wrote: > There is a endian related bug in the crt unit, which breaks the > examples ex10 and ex11 of the crt docs. The following fixes the bug > and makes the code more obvious. I suggest to replace the following > two routines. Tested on Mac OS X. It fixes web bug 3788 (I submitted > that one) and 3391 as good as possible (submitted by coraxyn). Some > small editing corrections as well. There's still a problem somewhere though: at the end of ex10, the output on the screen is Line 1 Line 2 Line 3 Oops, forgot Line 2, let's insert at the cursor postion Under Linux, there is no space before "Line 2", and from looking at the source, there shouldn't be any. Nevertheless, your patch already solves some other problems, so I've committed it. Thanks. Jonas

Reply by email

Dr. Karl-Michael Schindler
to Jonas Maebe: There's still a problem somewhere though: at the end of ex10, the output on the screen is…

On Mac OS X I could fix it by deleting line 463 and 464 of crt.pp. Then it works with ALL 6 different terminals (Terminal.app, X11, xterm, aterm, eterm, rxvt, mlterm) I have installed.

Jonas Maebe wrote 23 lines
On 15 mrt 2005, at 08:51, Dr. Karl-Michael Schindler wrote: > There is a endian related bug in the crt unit, which breaks the > examples ex10 and ex11 of the crt docs. The following fixes the bug > and makes the code more obvious. I suggest to replace the following > two routines. Tested on Mac OS X. It fixes web bug 3788 (I submitted > that one) and 3391 as good as possible (submitted by coraxyn). Some > small editing corrections as well. There's still a problem somewhere though: at the end of ex10, the output on the screen is Line 1 Line 2 Line 3 Oops, forgot Line 2, let's insert at the cursor postion Under Linux, there is no space before "Line 2", and from looking at the source, there shouldn't be any. Nevertheless, your patch already solves some other problems, so I've committed it. Thanks.

Reply by email

Jonas Maebe
to Dr. Karl-Michael Schindler
Dr. Karl-Michael Schindler wrote
On Mac OS X I could fix it by deleting line 463 and 464 of crt.pp. Then it works with ALL 6 different terminals (Terminal.app, X11, xterm, aterm, eterm, rxvt, mlterm) I have installed.

Thanks, fixed (worked fine under Linux as well).

Jonas

Reply by email

Dr. Karl-Michael Schindler
to Jonas Maebe

Hi,

When I was at the crt unit, I noticed that a number procedures are small (less then 5 lines of code) and called only once. Some others are quite general like scrollregion, but called only once with one line. In my opinion the code would be better readable with some degree of "inlining" these procedures. Would you accept such a modest rewrite of the crt unit?

All the best - mischi.

Reply by email

Michael Van Canneyt
to Dr. Karl-Michael Schindler
Dr. Karl-Michael Schindler wrote 7 lines
Hi, When I was at the crt unit, I noticed that a number procedures are small (less then 5 lines of code) and called only once. Some others are quite general like scrollregion, but called only once with one line. In my opinion the code would be better readable with some degree of "inlining" these procedures. Would you accept such a modest rewrite of the crt unit?

The code is usually separated out for porting purposes; it allows to {$ifdef} an entire procedure instead of having {$ifdef } in the code itself.

What really needs to be done is to rewrite the CRT unit so it uses the video unit. Then we would have only 1 CRT unit, and not 4, as now. The video unit offers a cross-platform interface. When porting to a new platform, only video must be ported. Now both video and crt must be ported.

Michael.

Reply by email