[comp.sources.misc] v07i067: IRIS4D version of GNUplot

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (07/09/89)

Posting-number: Volume 7, Issue 67
Submitted-by: merritt@iris613.gsfc.nasa.gov (John H Merritt)
Archive-name: gnuplot.iris4d

[...now all we have to do is figure out how to wedge *this* into the
patch-handling system....  ++bsa]

Here are the additions to GNUplot so it runs on an IRIS4D series computer.
Don't forget to compile with -DIRIS4D and include -Zg as one of the
libraries.  The window that the plot goes to can be reshaped and moved, but
you will have to replot the data.

+----------------------------------+-----------------------------+
|John H. Merritt                   |  Yesterday I knew nothing,  |
|Applied Research Corporation      |  Today I know that.         |
|merritt@iris613.gsfc.nasa.gov     |                             |
+----------------------------------+-----------------------------+

----------------------------------------------------------
------------ place following in struct termentry ---------
------------ daffynition near bottom of term.c   ---------
----------------------------------------------------------
#ifdef IRIS4D
	,{"iris4d", IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR,
		IRIS4D_HCHAR, IRIS4D_VTIC, IRIS4D_HTIC,
		IRIS4D_init, IRIS4D_reset, IRIS4D_text,
		IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
		IRIS4D_linetype, IRIS4D_lrput_text, IRIS4D_ulput_text,
		do_point}
#endif

------------------------------------------------------------
------------ place following anywhere in term.c ------------
------------------------------------------------------------
#ifdef IRIS4D

/* Provided by John H. Merritt (Applied Research Corporation) 7/1/89 */
/* INTERNET: merritt@iris613.gsfc.nasa.gov */

#include <gl.h>
#define IRIS4D_XMAX 1024
#define IRIS4D_YMAX 1024

#define IRIS4D_XLAST (IRIS4D_XMAX - 1)
#define IRIS4D_YLAST (IRIS4D_YMAX - 1)

#define IRIS4D_VCHAR (IRIS4D_YMAX/30)
#define IRIS4D_HCHAR (IRIS4D_XMAX/72)
#define IRIS4D_VTIC (IRIS4D_YMAX/80)
#define IRIS4D_HTIC (IRIS4D_XMAX/80)

IRIS4D_init()
{
  foreground();
  winopen("Gnuplot");
  deflinestyle(1, 0x3FFF); /* Long dash */
  deflinestyle(2, 0x5555); /* dotted */
  deflinestyle(3, 0x3333); /* short dash */
  deflinestyle(4, 0xB5AD); /* dotdashed */
  return;
}

IRIS4D_graphics()
{
  reshapeviewport();
  ortho2((Coord)0, (Coord)IRIS4D_XMAX, (Coord)0, (Coord)IRIS4D_YMAX);
  color(WHITE);
  clear();
  
  return;
}

IRIS4D_text()
{
  return; /* enter text from another window!!! */
}

IRIS4D_linetype(linetype)
int linetype;
{
  static int pen_color[5] = {1, 2, 3, 4, 5};
  
  linetype = linetype % 5;
  color((Colorindex) pen_color[linetype]);
  setlinestyle(linetype);
  return;
}

IRIS4D_move(x, y)
unsigned int x, y;
{
  move2i(x, y);
  return;
}

IRIS4D_cmove(x, y)
unsigned int x, y;
{
  cmov2i(x, y);
  return;
}

IRIS4D_vector(x, y)
unsigned x, y;
{
  draw2i(x, y);
  return;
}

IRIS4D_lrput_text(row, str)
unsigned int row;
char *str;
{
  IRIS4D_cmove(IRIS4D_XMAX - IRIS4D_HTIC - IRIS4D_HCHAR*(strlen(str)+1),
          IRIS4D_VTIC + IRIS4D_VCHAR*(row+1)) ;
  charstr(str);
  return;
}


IRIS4D_ulput_text(row,str)
unsigned int row ;
char *str ;
{
  IRIS4D_cmove(IRIS4D_HTIC, IRIS4D_YMAX - IRIS4D_VTIC - IRIS4D_VCHAR*(row+1)) ;
  charstr(str);
  return;
}

IRIS4D_reset()
{
  return;
}

#endif /* IRIS4D */