Need constant screen with periodic updates

K

Kris Dugan

I am using a Unix/Solaris 8/9 environment.

I want to make a tool that will constantly read a structure of
information and display that information (or "paint it") to the
screen. Rather than having the information scroll by, I want
a way in which the screen would be "repainted". Sample Screen:

-------------------------------------------------
| foo: 6 bar: 12 |
| this: 18 that: 20 |
|etc. |
-------------------------------------------------

If the values change, I want the screen to be repainted, as opposed
to using "printf" to print it to a screen or logfile.

I am aware that C has the "cursor" libraries, which will do what
I am looking for. Upon first examination, this looked somewhat
complicated. Are there any other modules/libraries that would
accomplish this kind of task (in any other languages) that would
be simple to use?

I am not doing anything with X windows, so this would just be text
to the screen.
 
M

Mike Wahler

Kris Dugan said:
I am using a Unix/Solaris 8/9 environment.

I want to make a tool that will constantly read a structure of
information and display that information (or "paint it") to the
screen. Rather than having the information scroll by, I want
a way in which the screen would be "repainted". Sample Screen:

The standard C language (the topic of comp.lang.c) has
no facilites for this, or for direct control of any
other hardware devices. All i/o is abstracted as
'streams of characters'.
I am aware that C has the "cursor" libraries,

No, the C language has no such thing. However, there exist
'third party' libraries for controlling hardware or interfacing
with operating systems, which have bindings to the C language.
which will do what
I am looking for. Upon first examination, this looked somewhat
complicated.

Many of them are, imo in the interest of 'completeness',
and the desire to address many different needs.
Are there any other modules/libraries that would
accomplish this kind of task (in any other languages) that would
be simple to use?

Many C implementations offer 'extensions' to the standard
library which can be used for more 'intimate' interaction
with the host platform (e.g. see MSVC++'s 'console functions').
Lacking that, you will need to choose a third-party library
and learn how to use it.

Also available for some implementations are 'device drivers'
to which one can send text commands and will translate them
into 'native' video hardware commands, such as 'move cursor',
etc. Google can help with finding them.
I am not doing anything with X windows, so this would just be text
to the screen.

Sorry but the C language has no notion of 'screen', only
the abstraction known as the 'standard output channel'.

Try checking your compiler documentation, consulting its
author's support resources, or asking in a newsgroup where
it's topical.

-Mike
 
B

Ben Morrow

Quoth Kris Dugan said:
I am using a Unix/Solaris 8/9 environment.

I want to make a tool that will constantly read a structure of
information and display that information (or "paint it") to the
screen. Rather than having the information scroll by, I want
a way in which the screen would be "repainted". Sample Screen:

-------------------------------------------------
| foo: 6 bar: 12 |
| this: 18 that: 20 |
|etc. |
-------------------------------------------------

If the values change, I want the screen to be repainted, as opposed
to using "printf" to print it to a screen or logfile.

I am aware that C has the "cursor" libraries, which will do what
I am looking for. Upon first examination, this looked somewhat
complicated. Are there any other modules/libraries that would
accomplish this kind of task (in any other languages) that would
be simple to use?

In Perl you can use Term::ANSIScreen to achieve this (very easily).

Ben
 
R

Randal L. Schwartz

Kris> I want to make a tool that will constantly read a structure of
Kris> information and display that information (or "paint it") to the
Kris> screen. Rather than having the information scroll by, I want
Kris> a way in which the screen would be "repainted".

Sounds like a perfect job for Curses.pm. Look in to it.
 
G

Gregory Toomey

Kris said:
I am using a Unix/Solaris 8/9 environment.

I want to make a tool that will constantly read a structure of
information and display that information (or "paint it") to the
screen. Rather than having the information scroll by, I want
a way in which the screen would be "repainted". Sample Screen:

Easiest Perl way:

system('clear');
print "new info ..."


gtoomey
 
B

Ben Morrow

Quoth Gregory Toomey said:
Easiest Perl way:

system('clear');
print "new info ..."

Come now, using external programs for something that simple is nearly
always wrong.

use Term::ANSIScreen qw/:screen :cursor/;

locate 1, 1;
cls;
print "...";

For some reason I have found that both cls and clline only work for me
if I locate to the start of the region to be cleared first... I am
presuming this is a bug in eiher Term::ANSIScreen or the linux console
driver :).

Ben
 
J

Joe Smith

Ben said:
use Term::ANSIScreen qw/:screen :cursor/;

locate 1, 1;
cls;
print "...";

For some reason I have found that both cls and clline only work for me
if I locate to the start of the region to be cleared first.

That's a bug in your terminal emulator; it is not responding to escape
sequences as per the ANSI specs.

cldown = "\x33[0J" = clear from location to end of screen
clup = "\x33[1J" = clear from beginning of screen to location
cls = "\x33[2J" = clear the entire screen
presuming this is a bug in the linux console driver :) .

Works fine with xterm, gnome-terminal, and the Linux 2.4.20 console.
-Joe
 
B

Ben Morrow

Quoth Joe Smith said:
Ben said:
use Term::ANSIScreen qw/:screen :cursor/;

locate 1, 1;
cls;
print "...";

For some reason I have found that both cls and clline only work for me
if I locate to the start of the region to be cleared first.

That's a bug in your terminal emulator; it is not responding to escape
sequences as per the ANSI specs.

cldown = "\x33[0J" = clear from location to end of screen
clup = "\x33[1J" = clear from beginning of screen to location
cls = "\x33[2J" = clear the entire screen

I suspected as much. I didn't *really* think it likely that there would
be a bug in a module as simple as Term::ANSIScreen :).
Works fine with xterm, gnome-terminal, and the Linux 2.4.20 console.

Linux 2.6.3 console, in UTF-8 mode. I suspect the latter may be the
problem...

Ben
 
T

Thomas Dickey

In comp.lang.perl.misc Ben Morrow said:
Quoth Joe Smith said:
Ben said:
use Term::ANSIScreen qw/:screen :cursor/;

locate 1, 1;
cls;
print "...";

For some reason I have found that both cls and clline only work for me
if I locate to the start of the region to be cleared first.

That's a bug in your terminal emulator; it is not responding to escape
sequences as per the ANSI specs.

cldown = "\x33[0J" = clear from location to end of screen
clup = "\x33[1J" = clear from beginning of screen to location
cls = "\x33[2J" = clear the entire screen
I suspected as much. I didn't *really* think it likely that there would
be a bug in a module as simple as Term::ANSIScreen :).
Linux 2.6.3 console, in UTF-8 mode. I suspect the latter may be the
problem...

....or the perl script (the defect you're describing is a well-known defect
of the so-called "ansi.sys" - perhaps someone made the perl script follow it).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top