[comp.lang.c] Curses and portability question.

accwork@vax1.mankato.msus.edu (12/11/90)

I am writing a program, which i hope to maintain a high level of portability. 
But i also want to some screen management.  I was planning on using curses.  Is
this a "good" choice ?  Is their something that is more standard ?  I hope to
keep the portability accross a vax, and a pc.  So is their any chance of this ?

thanks for your time.
   brian.
--
Brian D. Goecke
Mankato State University
Accademic Computer Center Programmer.
accwork@vax1.mankato.msus.edu
   

drack@titan.tsd.arlut.utexas.edu (Dave Rackley) (12/11/90)

In article <1990Dec10.110403.139@vax1.mankato.msus.edu> accwork@vax1.mankato.msus.edu writes:


>I am writing a program, which i hope to maintain a high level of portability. 
>But i also want to some screen management.  I was planning on using curses.  Is
>this a "good" choice ?  Is their something that is more standard ?  I hope to
>keep the portability accross a vax, and a pc.  So is their any chance of this >?

>   thanks for your time.
>      brian.
>   --
>   Brian D. Goecke
>   Mankato State University
>   Accademic Computer Center Programmer.
>   accwork@vax1.mankato.msus.edu

When faced with this situation I chose to use ANSI escape sequences
instead of curses.  VAXen with VMS and DOS machines have very similar
escape codes.  Of course when you do this, screen management is up to you.

Just my two cents worth :-)

--

  DISCLAIMER?  I don't know anything 'bout any ol' disclaimer!         

+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
| David Rackley		        |                                             |
| Applied Research Laboratories |      It's OK to be a martyr, as long as     |
| The University of Texas       |      you don't bring your own firewood.     |
| Austin, TX.  78758            |                          -- Dr. James Rigby |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+

kpv@ulysses.att.com (Phong Vo[drew]) (12/11/90)

In article <DRACK.90Dec10132800@diablo.titan.tsd.arlut.utexas.edu>, drack@titan.tsd.arlut.utexas.edu (Dave Rackley) writes:
- In article <1990Dec10.110403.139@vax1.mankato.msus.edu> accwork@vax1.mankato.msus.edu writes:
- 
- >I am writing a program, which i hope to maintain a high level of portability. 
- >But i also want to some screen management.  I was planning on using curses.  Is
- >this a "good" choice ?  Is their something that is more standard ?  I hope to
- >keep the portability accross a vax, and a pc.  So is their any chance of this >?
- 
- >   Brian D. Goecke
- 
- When faced with this situation I chose to use ANSI escape sequences
- instead of curses.  VAXen with VMS and DOS machines have very similar
- escape codes.  Of course when you do this, screen management is up to you.
- 
- Just my two cents worth :-)
- 
- | David Rackley		        |                                             |

This is very bad advice. Escape codes are typically defined by the terminal
being used, not the OS! And, there are a hell of a lot more different types
of the former than of the latter. There are curses versions that have been
ported to DOS and VMS. You should at least look into that first. In addition,
curses is really two libraries, a high level one for managing the screen,
and a low level once for getting escape codes and setting up interaction modes.
On BSD UNIX systems, the low level library is libtermcap which is separated
from libcurses. On SysV machines, both libraries are merged into libcurses.
So if you don't want the overhead of high level curses code (which could be
significant if you are not using the right version of curses), you should
at least use its low level code for defining escape sequences. This gives
you "transparency" with respect to terminal types which in a normal day work
may be even more important than "portability" with respect to OS or machine types.

david@doe.utoronto.ca (David Megginson) (12/12/90)

In article <1990Dec10.110403.139@vax1.mankato.msus.edu> accwork@vax1.mankato.msus.edu writes:
>
>I am writing a program, which i hope to maintain a high level of portability. 
>But i also want to some screen management.  I was planning on using curses.  Is
>this a "good" choice ?  Is their something that is more standard ?  I hope to
>keep the portability accross a vax, and a pc.  So is their any chance of this ?
>
>thanks for your time.
>   brian.
>--
>Brian D. Goecke
>Mankato State University
>Accademic Computer Center Programmer.
>accwork@vax1.mankato.msus.edu
>   

There is a good curses library for GCC on the Atari ST, and I have seen at
least one for the PC. The most important thing about portability will be
to remember that sizeof(int) != sizeof(void *) on many machines (the
reason why porting sloppily-written Unix code can be hell). Also, on
some machines, malloc() takes an int argument, while under ANSI C, it can
take a (size_t) argument, where size_t _could_ be (long) or (unsigned long).


David Megginson
-- 
////////////////////////////////////////////////////////////////////////
/  David Megginson                      david@doe.utoronto.ca          /
/  Centre for Medieval Studies          meggin@vm.epas.utoronto.ca     /
////////////////////////////////////////////////////////////////////////

hp@vmars.tuwien.ac.at (Peter Holzer) (12/12/90)

drack@titan.tsd.arlut.utexas.edu (Dave Rackley) writes:

>In article <1990Dec10.110403.139@vax1.mankato.msus.edu> accwork@vax1.mankato.msus.edu writes:


>>I am writing a program, which i hope to maintain a high level of portability. 
>>But i also want to some screen management.  I was planning on using curses.  Is
>>this a "good" choice ?  Is their something that is more standard ?  I hope to
>>keep the portability accross a vax, and a pc.  So is their any chance of this >?


>When faced with this situation I chose to use ANSI escape sequences
>instead of curses.  VAXen with VMS and DOS machines have very similar
>escape codes. 

The escape codes have nothing to do with your computer or
operating system but only with the _terminal_ you use (Or the
screen driver in case of a memory mapped display). 

Curses does exist for MS-DOS (there is at least one PD-version
called PCurses) and I think there should be one for VMS too.

If you are not ABSOLUTELY sure that all users of your program
will use the same terminals as you are using now, you should use
curses.


>Just my two cents worth :-)

--
|    _  | Peter J. Holzer                       | Think of it   |
| |_|_) | Technical University Vienna           | as evolution  |
| | |   | Dept. for Real-Time Systems           | in action!    |
| __/   | hp@vmars.tuwien.ac.at                 |     Tony Rand |