home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.17 / text0039.txt < prev    next >
Encoding:
Internet Message Format  |  1990-01-06  |  1.4 KB

  1. From: mark@cbnews.ATT.COM (Mark Horton)
  2.  
  3. In article <404@longway.TIC.COM> gwyn@brl.arpa (Doug Gwyn) writes:
  4. >If there is this much variation possible simply in the UNIX
  5. >portability of the "Hello, world" program, imagine how much
  6. >more difficult it would be for a GRAPHICS program (as in the
  7. >original specification).  By the way, we all understand the
  8. >"graphics" requirement to not be satisfied by a text-oriented
  9. >program.
  10.  
  11. I think it should be possible, but you have to stretch the notion
  12. of "graphics" a bit.  Back in the dark ages when we all used character
  13. oriented output devices, there were programs that plotted graphs like this:
  14.  
  15.     for x from start to stop
  16.         y = f(x)
  17.         nblank = y * 80    /* assumes function range 0..1 */
  18.         for i from 1 to y
  19.         putchar(' ')
  20.         putchar('*')
  21.         putchar('\n');
  22.  
  23. This isn't really in C, but you get the idea.  Assume a 66x80 resolution
  24. output device and draw with stars and blanks.  Do all I/O with getchar
  25. and putchar and I think it works everywhere (unless there's some gotcha
  26. with ANSI C) with no #include files.
  27.  
  28. If you want to get really fancy, use graphcap (see the source to vfontinfo
  29. in 4.2BSD for the tables and an example of using them) and you can get
  30. better resolution: 164x160 on that same printed page.  This does assume
  31. lower case, which many early UNIX systems didn't have, but that just
  32. makes the output ugly if you have only upper case, it will still run.
  33.  
  34.     Mark
  35.  
  36. Volume-Number: Volume 17, Number 45
  37.  
  38.  
  39.