masscomp-request@soma.UUCP (02/04/87)
I have been working on getting gnuplot (see net.sources) working on the masscomp. Here is the results of my work. I have some general comments about SP-45 primitives that I will make in another article. For now, the code. If you need a copy of gnuplot, I will try and send it to you. It should be available from the GNU folks. ---------------------------------------------------------------- Masscomp support has now been added by Stan Barber, Cellular Neurophysiology Laboratory, Baylor College of Medicine (sob@soma.bcm.tmc.edu). Support for the Masscomp graphics displays may be added by defining MASSCOMP (e.g. -DMASSCOMP) in the TERMFLAGS line in the Makefile. You will also have to add the link flags to search the graphics library (e.g. -lgp) to the LIBS line. You may want to make some modifications to term.c to set the MC_XMAX and MC_YMAX for your particular graphics terminal. These things can be determined at run-time, but gnuplot does not have seem to have that capability at this time. Support for the Masscomp Graphics Primitive Stream protocol (GPS as found in SP-45) is available as well. You will have to define MCGPS in the Makefile on the TERMFLAGS line (e.g. -DMCGPS). No other modifications or libraries are needed. There is a "gotcha" here though. The files produced by other 68000 computers will be compatible and plotable on a Masscomp but other machines (with different byte-orders than the 68000) will not. If someone wants to fix this, feel free. It is annoying if you have a mixed environment. Stan Barber (sob@soma.bcm.tmc.edu or {cuae2|rice|seismo|ihnp4!shell}!soma!sob 02/03/87 ----------------------------------------------------------------------------- Here is the context diff ready to be added via "patch". ----------------------------------------------------------------------------- Index: term.c *** /tmp/,RCSt1012198 Tue Feb 3 19:26:52 1987 --- /tmp/,RCSt2012198 Tue Feb 3 19:26:54 1987 *************** *** 1540,1545 #endif /* V384 */ #ifdef UNIXPLOT --- 1540,1546 ----- #endif /* V384 */ + #ifdef MASSCOMP /* * *************** *** 1541,1546 #endif /* V384 */ #ifdef UNIXPLOT #define UP_XMAX 4096 --- 1542,1806 ----- #ifdef MASSCOMP + /* + * + * MASSCOMP graphics terminals (SP-40) + * + */ + #include <libgpcodes.h> + #include <libgpdefs.h> + /* this is for the 13" color screen */ + /* #define MC_XMAX 640 + #define MC_YMAX 480 */ + /* this is for the 19" color screen */ + #define MC_XMAX 832 + #define MC_YMAX 600 + /* this is for the aurora graphics */ + /* #define MC_XMAX 1152 + #define MC_YMAX 910 */ + + static unsigned int MC_X; + static unsigned int MC_Y; + static int MC_CNS[8]; + static int MC_INIT = 0; + #define MC_XLAST (MC_XMAX - 1) + #define MC_YLAST (MC_YMAX - 1) + + #define MC_VCHAR 12 + #define MC_HCHAR 10 + #define MC_VTIC 12 + #define MC_HTIC 10 + + /* initialize the graphics processor */ + MC_init() + { + int hc[8]; + mgiasngp(0,0); /* get a graphics processor */ + /* get the current color map and hold on to it */ + mgigetcms(1,8,MC_CNS); + /* reset the cms */ + hc[0] = mgfcns("red"); + hc[1] = mgfcns("green"); + hc[2] = mgfcns("blue"); + hc[3] = mgfcns("purple"); + hc[4] = mgfcns("orange"); + hc[5] = mgfcns("orange red"); + hc[6] = mgfcns("yellow"); + hc[7] = mgfcns("white"); + + mgicms(1,8,hc); + /* get a font */ + mgifetchgf(0,"7x9_bold.gpf"); + + MC_INIT++; + } + + + MC_graphics() + { + mgiclearpln(2,31,0); /* clear the display */ + mgihue(1); /* select red as first color */ + } + + + MC_text() /* we don't need to do this, I think */ + { + + } + + + MC_linetype(linetype) + int linetype; + { + static int color[]= { + 1 /* red */, + 2 /* green */, + 3 /* blue */, + 4 /* cyan */, + 5 /* magenta */, + 6 /* yellow */, /* not a good color so + not in use at the moment */ + 7 /* white */ + }; + + if (linetype < 0) + linetype=6; + else + linetype %= 5; + mgihue(linetype+1); + } + + + MC_move(x,y) + unsigned int x,y; + { + MC_X=x; /* set start point for next vector */ + MC_Y=y; + } + + + MC_vector(x,y) + unsigned int x,y; + { + mgil(MC_X,MC_Y,x,y); /* draw a vector */ + MC_X=x; + MC_Y=y; + } + + + MC_lrput_text(row,str) + unsigned int row; + char str[]; + { + MC_move(MC_XMAX - MC_HTIC - MC_HCHAR*(strlen(str)+1), + MC_VTIC + MC_VCHAR*(row+1)); + mgigfs(MC_X,MC_Y,0,str); + } + + + MC_ulput_text(row,str) + unsigned int row; + char str[]; + { + MC_move(MC_HTIC, MC_YMAX - MC_VTIC - MC_VCHAR*(row+1)); + mgigfs(MC_X,MC_Y,0,str); + } + + + MC_reset() + { + if (MC_INIT){ + mgicms(1,8,MC_CNS); + mgideagp(); /* free the graphics procesor */ + } + + } + + #endif /* MASSCOMP */ + + #ifdef MCGPS + + /* Masscomp SP-45 compatible */ + + #define MP_XMAX 4096 + #define MP_YMAX 4096 + + #define MP_XLAST (MP_XMAX - 1) + #define MP_YLAST (MP_YMAX - 1) + + #define MP_VCHAR (MP_YMAX/30) + #define MP_HCHAR (MP_XMAX/72) + #define MP_VTIC (MP_YMAX/80) + #define MP_HTIC (MP_XMAX/80) + static short buf[6]; /* work space */ + static unsigned int MP_X; + static unsigned int MP_Y; + static short linestyle; + MP_init() /* nothing needed */ + { + long clock; + (void)time(&clock); + buf[0] = 15 << 12; /* comment primitive coming */ + buf[0] = buf[0] | 23; /* it is 23 words long */ + write(fileno(outfile),(char *) buf,2); + write(fileno(outfile),"Created by gunplot ",20); + write(fileno(outfile),ctime(&clock),24); + } + + + MP_graphics() + { + linestyle = 20; /* set initial linestyle (color) */ + } + + + MP_text() /* would be nice to have a clear or pause primitive*/ + { + } + + + MP_linetype(linetype) + int linetype; + { + static short lt[] = {21, 22, 23, 24, 25, 6, 20 ,28, 29}; + if (linetype < 0) + linetype = 6; + else + linetype %= 8; + linestyle = lt[linetype]; + } + + + + MP_move(x,y) + unsigned int x,y; + { + MP_X = x; + MP_Y = y; + } + + + MP_vector(x,y) + unsigned int x,y; + { + buf[0] = 0; /* line drawing primitive coming */ + buf[0] = buf[0] | 6; /* it is six words long */ + buf[1] = (int) MP_X; /* starting X coordinate */ + buf[2] = (int) MP_Y; /* starting Y coordinate */ + buf[3] = (int) x; /* ending X coordinate */ + buf[4] = (int) y; /* ending Y coordinate */ + buf[5] = 0; + buf[5] = linestyle << 8; /* style word */ + /* have to use binary buffered write here */ + write(fileno(outfile),(char *) buf,12); + MP_X = x; + MP_Y = y; + } + + + MP_lrput_text(row,str) + unsigned int row; + char str[]; + { + MP_move(MP_XMAX - MP_HTIC - MP_HCHAR*(strlen(str)+1), + MP_VTIC + MP_VCHAR*(row+1)); + MP_label(str); + } + + + MP_ulput_text(row,str) + unsigned int row; + char str[]; + { + MP_move(MP_HTIC*3, MP_YMAX - MP_VTIC - MP_VCHAR*(row+1)); + MP_label(str); + } + MP_label(str) + char *str; + { + short length; + length = (short) strlen(str)/2; + if (strlen(str)%2) length++; + buf[0] = 2 << 12; /* text primitive coming */ + buf[0] = buf[0] | (length+5); /* it is x words long */ + buf[1] = (int) MP_X; /* x location */ + buf[2] = (int) MP_Y; /* y location */ + buf[3] = 0; + buf[3] = linestyle << 8; /* style word */ + buf[4] = 0; + buf[4] = 15 << 8; /* 75 units high, 0 degree orientation */ + /* have to use binary write here */ + write(fileno(outfile),(char *) buf,10); + write(fileno(outfile),str,strlen(str)); + if (strlen(str)%2) write(fileno(outfile),"\0",1); + } + + MP_reset() /* regular close should do */ + { + } + + #endif MCGPS + #ifdef UNIXPLOT #define UP_XMAX 4096 *************** *** 1753,1758 V384_HTIC, V384_init, V384_reset, V384_text, V384_graphics, V384_move, V384_vector, V384_linetype, V384_lrput_text, V384_ulput_text, do_point} #endif }; --- 2013,2031 ----- V384_HTIC, V384_init, V384_reset, V384_text, V384_graphics, V384_move, V384_vector, V384_linetype, V384_lrput_text, V384_ulput_text, do_point} + #endif + #ifdef MASSCOMP + ,{"masscomp", MC_XMAX, MC_YMAX, MC_VCHAR, MC_HCHAR, MC_VTIC, + MC_HTIC, MC_init, MC_reset, MC_text, MC_graphics, + MC_move, MC_vector, MC_linetype, MC_lrput_text, + MC_ulput_text, do_point} + #endif MASSCOMP + + #ifdef MCGPS + ,{"mcgps", MP_XMAX, MP_YMAX, MP_VCHAR, MP_HCHAR, MP_VTIC, + MP_HTIC, MP_init, MP_reset, MP_text, MP_graphics, + MP_move, MP_vector, MP_linetype, MP_lrput_text, + MP_ulput_text, do_point} #endif };