standard unix graphics package

Mark Horton mark at cbnews.ATT.COM
Sat Oct 21 07:32:00 AEST 1989


From: mark at cbnews.ATT.COM (Mark Horton)

In article <404 at longway.TIC.COM> gwyn at brl.arpa (Doug Gwyn) writes:
>If there is this much variation possible simply in the UNIX
>portability of the "Hello, world" program, imagine how much
>more difficult it would be for a GRAPHICS program (as in the
>original specification).  By the way, we all understand the
>"graphics" requirement to not be satisfied by a text-oriented
>program.

I think it should be possible, but you have to stretch the notion
of "graphics" a bit.  Back in the dark ages when we all used character
oriented output devices, there were programs that plotted graphs like this:

	for x from start to stop
	    y = f(x)
	    nblank = y * 80	/* assumes function range 0..1 */
	    for i from 1 to y
		putchar(' ')
	    putchar('*')
	    putchar('\n');

This isn't really in C, but you get the idea.  Assume a 66x80 resolution
output device and draw with stars and blanks.  Do all I/O with getchar
and putchar and I think it works everywhere (unless there's some gotcha
with ANSI C) with no #include files.

If you want to get really fancy, use graphcap (see the source to vfontinfo
in 4.2BSD for the tables and an example of using them) and you can get
better resolution: 164x160 on that same printed page.  This does assume
lower case, which many early UNIX systems didn't have, but that just
makes the output ugly if you have only upper case, it will still run.

	Mark

Volume-Number: Volume 17, Number 45



More information about the Comp.std.unix mailing list