Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-22 Thread A.J. Venter

Nope,
Ncurses does not use escapes except in a very few esoteric cases. In
fact ncurses was orriginally created to replace the old curses
library. Curses had been an escape sequence based lib that was itself
created orriginally to implement the game rogue. The move from curses
to ncurses was primarilly motivated by the need to a terminal
independent library to do the job. Curses could only run on terminals
that supported the full ansi set, ncurses runs on almost any terminal.
The person who did about 95% of the conversion of was Eric Raymond,
and in the spirit of teh grandfather lib, the major reason for the
task was to create nethack, which is a multiplatform rogue descendent
- it needed a terminal independent lib to be that.

Yes, I scare myself too.

A.J.

On 5/22/07, Albert Zeyer <[EMAIL PROTECTED]> wrote:


 Am Dienstag, den 22.05.2007, 10:09 +0200 schrieb A.J. Venter:
 So it's a case of which is your needs - for general console apps
though - you should use ncrt because it's terminal independent and a
LOT faster (ansi escapes take a long time to execute and make your
whole program feel slow)


 Why is it faster? I always thought, that ncurses also uses escape
sequences, but it is very optimized in that to minimize them.





--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-22 Thread Albert Zeyer
Am Dienstag, den 22.05.2007, 10:09 +0200 schrieb A.J. Venter:

> So it's a case of which is your needs - for general console apps
> though - you should use ncrt because it's terminal independent and a
> LOT faster (ansi escapes take a long time to execute and make your
> whole program feel slow)
> 

Why is it faster? I always thought, that ncurses also uses escape
sequences, but it is very optimized in that to minimize them.



Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-22 Thread vsnijders
> On 5/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > (Tested on windows).
> 
> cool!! Works on linux too =) At least with Konsole
> 

Inspired by Sam: http://www.mail-archive.com/lazarus@miraclec.com/msg15586.html

Vincent

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-22 Thread Felipe Monteiro de Carvalho

Something wierd is that I just noticed that after using ncrt my
Konsole window will loose the hability to scroll (scrollbar stops
working), after the program finished executing, so I can't see the
full output of ls -l for example.

Doesn't happen with crt or vincent's app

--
Felipe Monteiro de Carvalho

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-22 Thread Felipe Monteiro de Carvalho

On 5/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

(Tested on windows).


cool!! Works on linux too =) At least with Konsole

--
Felipe Monteiro de Carvalho

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-22 Thread vsnijders


- Original Message -
From: Felipe Monteiro de Carvalho <[EMAIL PROTECTED]>
Date: Tuesday, May 22, 2007 10:02 am
Subject: Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

> On 5/22/07, A.J. Venter <[EMAIL PROTECTED]> wrote:
> > CRT is one way but rather relies on using the whole console. Anyway
> > ncrt is safer. Sounds like you need something like this:
> > uses ncrt;
> 
> I got interrested on this, so I wrote a test program. I tested with
> both ncrt and crt, and actually I found that ncrt will erase the whole
> console and start writing from position (1,1), while crt will keep
> things that already exist on the console and start writing on the next
> line.
> 
> So, for some uses, crt may be nicer.
> 

I used this to write a program without crt at all.

program console;

{$mode objfpc}{$H+}

uses
  SysUtils; // here you can change crt with ncrt
  
var
  i: integer;

begin
  Write('[] 0%');
  Sleep(2000);

  Write(#13'[=>  ] 10%');
  Sleep(2000);

  Write(#13'[===>] 20%');
  Sleep(2000);

  Write(#13'[=>  ] 30%');
  Sleep(2000);

  Write(#13'[===>] 40%');
  Sleep(2000);

  Write(#13'[=>  ] 50%');
  Sleep(2000);
end.

(Tested on windows).

Vincent 

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-22 Thread A.J. Venter

On 5/22/07, Felipe Monteiro de Carvalho
<[EMAIL PROTECTED]> wrote:

On 5/22/07, A.J. Venter <[EMAIL PROTECTED]> wrote:
> CRT is one way but rather relies on using the whole console. Anyway
> ncrt is safer. Sounds like you need something like this:
> uses ncrt;

I got interrested on this, so I wrote a test program. I tested with
both ncrt and crt, and actually I found that ncrt will erase the whole
console and start writing from position (1,1), while crt will keep
things that already exist on the console and start writing on the next
line.

So, for some uses, crt may be nicer.

This is actually a side effect, there is another problem to consider:
1) crt wins for small environments since it needs no external libs
2) ncrt wins for all other cases even though it needs ncurses and
clears the whole screen.

The real difference is that ncrt is terminal independent - it works on
anything unix supports (less of an issue in this day of virtual
terminals with vt100 compatibility but still) - while crt uses ansi
escape sequences - which are terminal specific.

This has an opposite side though: you CAN use crt to set your console
font color etc. - the changes will remain after your program exits,
ncrt will not.

So it's a case of which is your needs - for general console apps
though - you should use ncrt because it's terminal independent and a
LOT faster (ansi escapes take a long time to execute and make your
whole program feel slow)

A.J.


program console;

{$mode objfpc}{$H+}

uses
  crt, SysUtils; // here you can change crt with ncrt

begin
  Write('[] 0%');
  GotoXY(1, WhereY);
  Sleep(200);

  Write('[=>  ] 10%');
  GotoXY(1, WhereY);
  Sleep(200);

  Write('[===>] 20%');
  GotoXY(1, WhereY);
  Sleep(200);

  Write('[=>  ] 30%');
  GotoXY(1, WhereY);
  Sleep(200);

  Write('[===>] 40%');
  GotoXY(1, WhereY);
  Sleep(200);

  Write('[=>  ] 50%');
  GotoXY(1, WhereY);
  Sleep(200);
end.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives




--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-22 Thread Felipe Monteiro de Carvalho

On 5/22/07, A.J. Venter <[EMAIL PROTECTED]> wrote:

CRT is one way but rather relies on using the whole console. Anyway
ncrt is safer. Sounds like you need something like this:
uses ncrt;


I got interrested on this, so I wrote a test program. I tested with
both ncrt and crt, and actually I found that ncrt will erase the whole
console and start writing from position (1,1), while crt will keep
things that already exist on the console and start writing on the next
line.

So, for some uses, crt may be nicer.

program console;

{$mode objfpc}{$H+}

uses
 crt, SysUtils; // here you can change crt with ncrt

begin
 Write('[] 0%');
 GotoXY(1, WhereY);
 Sleep(200);

 Write('[=>  ] 10%');
 GotoXY(1, WhereY);
 Sleep(200);

 Write('[===>] 20%');
 GotoXY(1, WhereY);
 Sleep(200);

 Write('[=>  ] 30%');
 GotoXY(1, WhereY);
 Sleep(200);

 Write('[===>] 40%');
 GotoXY(1, WhereY);
 Sleep(200);

 Write('[=>  ] 50%');
 GotoXY(1, WhereY);
 Sleep(200);
end.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-21 Thread A.J. Venter

CRT is one way but rather relies on using the whole console. Anyway
ncrt is safer. Sounds like you need something like this:
uses ncrt;
...
write('i wrote this code');
window(1,wherey,80,wherey);
clrscr;
write('on my phone from memory');

Hope that helps.


On 5/21/07, Lee Jenkins <[EMAIL PROTECTED]> wrote:

Lee Jenkins wrote:
>
> Hi all,
>
> I'm wondering how to emulate the static console output seen with some
> linux applications such as yum.  More specifically, static output
> without  going to another line or appending to existing text already
> written such as this:
>
> Getting File: somefile.txt
> [=>] 50%
>
> I hope that I explained my question well enough.
>
> Thanks!
>

Thanks all,

I'll take a look at the crt unit.

--

Warm Regards,

Lee



_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives




--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-21 Thread Lee Jenkins

Lee Jenkins wrote:


Hi all,

I'm wondering how to emulate the static console output seen with some 
linux applications such as yum.  More specifically, static output 
without  going to another line or appending to existing text already 
written such as this:


Getting File: somefile.txt
[=>] 50%

I hope that I explained my question well enough.

Thanks!



Thanks all,

I'll take a look at the crt unit.

--

Warm Regards,

Lee



_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-21 Thread Michael Van Canneyt


On Mon, 21 May 2007, Tiziano_mk wrote:

> Michael Van Canneyt wrote:
> > 
> > On Sun, 20 May 2007, Lee Jenkins wrote:
> > 
> >
> > > another line or appending to existing text already written such as this:
> > >
> > > Getting File: somefile.txt
> > > [=>] 50%
> > >
> > > I hope that I explained my question well enough.
> > 
> > Try to use the crt unit. It contains all routines to do this.
> > It's documented.
> > 
> > Michael.
> 
> Am I wrong or documentation says that the video unit is to be preferred
> against crt unit?

It is, if you need total control over the screen. The video unit
starts by blanking the screen.

This is not so in this particular case...

Michael.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-21 Thread Tiziano_mk

Michael Van Canneyt wrote:


On Sun, 20 May 2007, Lee Jenkins wrote:



another line or appending to existing text already written such as this:

Getting File: somefile.txt
[=>] 50%

I hope that I explained my question well enough.


Try to use the crt unit. It contains all routines to do this.
It's documented.

Michael.


Am I wrong or documentation says that the video unit is to be preferred 
against crt unit?


tiziano

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


RE: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-20 Thread Sam Liddicott
As said before, use write, not writeln.

Character 8 is back-space, useful for spinners by alternating between / - \ |.
Character 13 will move the cursor to the beginning of the line and you can 
overwrite what is already there.

Or, as said, use crt an don't worry about it.

Sam

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-20 Thread Michael Van Canneyt


On Sun, 20 May 2007, Lee Jenkins wrote:

> 
> Hi all,
> 
> I'm wondering how to emulate the static console output seen with some linux
> applications such as yum.  More specifically, static output without  going to
> another line or appending to existing text already written such as this:
> 
> Getting File: somefile.txt
> [=>] 50%
> 
> I hope that I explained my question well enough.

Try to use the crt unit. It contains all routines to do this.
It's documented.

Michael.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Linux WriteLn - Staionary Output - how is done?

2007-05-20 Thread Steven Graham

Lee Jenkins wrote:


Hi all,

I'm wondering how to emulate the static console output seen with some 
linux applications such as yum.  More specifically, static output 
without  going to another line or appending to existing text already 
written such as this:


Getting File: somefile.txt
[=>] 50%

I hope that I explained my question well enough.


I think rather than using WriteLn, you should just use Write.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives