Sign in Join

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

Mailing lists / fpc-pascal / 2001-02

WriteLn call in ncurses - help needed

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Santucco

Hello :-)!

I'm porting a DOS application into Linux.
This application use propriertary window library, particularily based on CRT and low-level DOS calls.
I'm using ncrt.inc instead of CRT and low-level DOS calls. But I have a problem calling WriteLn from application part.

A window is scrolled by placing cursor at the end of last line and calling WriteLn. This call cleans current line and scrolls window by one line.

Why is the current line being cleaned? What ncurses window parameter must (or can) I set to solve this problem?

(It's not permitted to change the application part, that calls this function).

Best regards,
Santucco

Reply by email

Ken Wright
to Santucco
you wrote 6 lines
Hello :-)! I'm porting a DOS application into Linux. This application use propriertary window library, particularily based on CRT and low-level DOS calls. I'm using ncrt.inc instead of CRT and low-level DOS calls.

Just to make sure. Are you including ncrt.inc in your program with {$I}, or are you putting ncrt in your "uses" clause? You need to include the unit so it initializes correctly.

Show quoted text 7 lines
But I have a problem calling WriteLn from application part. A window is scrolled by placing cursor at the end of last line and calling WriteLn. This call cleans current line and scrolls window by one line. Why is the current line being cleaned? What ncurses window parameter must (or can) I set to solve this problem?

The following test program works correctly for me the way you decribe. The readkeys are just to pause so you can see the steps. If this doesn't work for you, try downloading the latest ncrt from http://www.cncware.com/fpc.html just to make sure you've got the latest.

program t;
uses ncrt;
begin
   gotoxy(1,25);write('testing');readkey;
   gotoxy(80,25);readkey;
   writeln;
end.

However, a note about writeln with ncrt. The ncurses library does do something like you describe. It first clears the current line from the cursor to the right margin before doing the line feed. So if you placed the cursor at column 1 rather than column 80, it would behave like the problem you described. This is part of ncurses and can't be changed.

Ken

Reply by email

Sakari Nylund OH1KH
to Santucco: Hello :-)! I'm porting a DOS application into Linux. This application use propriertary…

Hi !

Still back to lost keyboard echo in Linux after FPC-shell & graphics.

I get rid of the problem by change CRT to nCRT unit in text based programs. Altough it was "little" complicated process to install nCrt. (for some reason compile did not find ncrt, and after next try of install it complained that ncurses unit was not found(?!). Finally bored to see those I copied all into same (current) directory with my source code. That was working)

Sometime few lines of DOC would be nice ;-). In NCRT.ZIP there are not so many....about installing OR usage. We are not gurus all of us. It also seems that there are different places for units depending user... My FPCs are installed from RPMs and were not directly ok for Makefile of NCrt. (also I do not have user called "ken", hi :-) )

Using nCRT with other program that uses GRAPH unit and 640x480x255 terminal mode was not so succesfull.

At end of program keyboard echo was not returned to console even if nStop and RestoreCrt was used.

Finally clearing all "nSt.." lines and new compile caused effect where nCRT was causing program chrash every time a key was pressed. Just change "uses nCrt" to "uses Crt" and new compile without any furher changes to source caused program to run as expected without crashing.

How ever, no keyboard echo after returning from program.

Is there anything else that is needed exept nCrt ?

73s Saku ________________________________________________________________ Ilmainen Internet @ http://www.nic.fi/

Reply by email

Ken Wright
to Ken Wright
you wrote 6 lines
On Wed, 07 Feb 2001, you wrote: > Hi ! > > Still back to lost keyboard echo in Linux after FPC-shell & graphics. Could you send me all this code so I can have a look at the problem?

Saku,

After some testing here's what I got. BTW I tested on RedHat 6.2.

1) Using ncrt is no good once graphics mode is initialized. The keyboard goes away. I don't know how graph is handling keyboard input/output. Maybe this can be fixed.

2) Using crt, the console does not get restored correctly. Echo is lost and newline goes away.

3) If the program is reduced to nothing more than initializing, then closing graphics mode, including crt in the uses clause causes the condition like 2) above. Including ncrt in the uses clause, the console restores correctly at program exit. So there is some trouble between crt and graph.

This isn't a lot of help, but maybe someone who knows graph can assist more.

Ken

Reply by email

Marco van de Voort
to Ken Wright
Show quoted text 9 lines
On Thu, 08 Feb 2001, you wrote: > On Wed, 07 Feb 2001, you wrote: > > Hi ! > > > > Still back to lost keyboard echo in Linux after FPC-shell & graphics. > > Could you send me all this code so I can have a look at the problem? After some testing here's what I got. BTW I tested on RedHat 6.2.

Maybe checking the source of the "reset" command would help.

Reply by email

Sakari Nylund OH1KH
to Marco van de Voort

At least it is nice to hear that problem can be reproduced.

I have tested it with Mandrake 7.2, at my server (RedHat 6.2) it does not giving some kind of PCI bus notice. "This macihe uses PCI bus 2 and we support only PCI 1" or something like that, cant remember excatly now. It has ATI PC2TV PCI card, At Md 7.2 I have ATI AGP.

Graphics is displayed on virtual terminal #8. Perhaps returning from that does not go ok.

Hmm. Perhaps it could be worth to download FPC source, too...

73s Saku ________________________________________________________________ Ilmainen Internet @ http://www.nic.fi/

Reply by email