1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char sccsid[] = "@(#)open.c	5.2 (Berkeley) 4/30/85";
   9: #endif not lint
  10: 
  11: 
  12: /*
  13:  * Displays plot files on a AED512 graphics terminal.
  14:  */
  15: 
  16: #include "aed.h"
  17: 
  18: char dbuf[BUFSIZ];  /* Used to buffer display characters */
  19: struct sgttyb sgttyb;   /* Used to save terminal control bits */
  20: int curx, cury;     /* Current screen position */
  21: int xbot, ybot;     /* Coordinates of screen lower-left corner */
  22: int scale;      /* The number of pixels per 2**12 units
  23: 			 * of world coordinates.
  24: 			 */
  25: 
  26: /*
  27:  * The following is the color map, containing reg, green, and blue
  28:  * values for color locations 0 and 1.
  29:  */
  30: 
  31: static int colors[] = {200, 200, 200, 0, 0, 125, 125, 0, 0, 125, 0, 0};
  32: 
  33: /*---------------------------------------------------------
  34:  *	Openpl initializes the graphics display and clears its screen.
  35:  *
  36:  *	Results:	None.
  37:  *
  38:  *	Side Effects:
  39:  *	The display is re-initialized and the file is remembered for
  40:  *	use in all subsequent calls to this module.  The display's
  41:  *	color map is reset.  The display is put into raw mode, but
  42:  *	the previous mode bits are saved.
  43:  *
  44:  *	Errors:		None.
  45:  *---------------------------------------------------------
  46:  */
  47: openpl()
  48: {
  49:     int flags, *p, i;
  50:     char dum[4];
  51: 
  52:     /* First, grab up the display modes, then reset them to put it
  53:      * into cooked mode.  Also, lock the terminal.
  54:      */
  55: 
  56:     (void) gtty(fileno(stdout), &sgttyb);
  57:     flags = sgttyb.sg_flags;
  58:     sgttyb.sg_flags = (sgttyb.sg_flags & ~(RAW | CBREAK)) | EVENP | ODDP;
  59:     (void) stty(fileno(stdout), &sgttyb);
  60:     sgttyb.sg_flags = flags;
  61: 
  62:     /* Save the file pointer around for later use, then output an
  63:      * initialization string to the display.  The initialization
  64:      * string resets the terminal, sets formats, clears the display,
  65:      * initializes the read and write masks, and sets the color map.
  66:      */
  67: 
  68:     setbuf(stdout, dbuf);
  69:     fputs("\33\33G1HHHN[00LFFCFFMFFFFFFFF", stdout);
  70:     fputs("K0004", stdout);
  71:     p = colors;
  72:     for (i=0; i<12; i++)
  73:     {
  74:     chex(*p++, dum, 2);
  75:     fputs(dum, stdout);
  76:     }
  77:     fputs("^15060AL", stdout);
  78:     scale = 1<<12;
  79:     curx = cury = xbot = ybot = 0;
  80:     (void) fflush(stdout);
  81: }

Defined functions

openpl defined in line 47; never used

Defined variables

colors defined in line 31; used 1 times
  • in line 71
curx defined in line 20; used 35 times
cury defined in line 20; used 29 times
dbuf defined in line 18; used 2 times
sccsid defined in line 8; never used
sgttyb defined in line 19; used 13 times
Last modified: 1987-03-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2140
Valid CSS Valid XHTML 1.0 Strict