Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!usc!elroy.jpl.nasa.gov!decwrl!ucbvax!hplabs!hp-sdd!apollo!aramini From: aramini@apollo.HP.COM (Michael Aramini) Newsgroups: comp.sys.apollo Subject: Re: apollo driver for gnuplot Keywords: graphics, plotting, gnuplot Message-ID: <4972b856.20b6d@apollo.HP.COM> Date: 27 Mar 90 18:05:00 GMT References: <1990Mar23.210229.11573@caen.engin.umich.edu> <496d6ac7.20b6d@apollo.HP.COM> Sender: root@apollo.HP.COM Distribution: usa Lines: 264 Here is an apollo driver (gpr) for gnuplot which I wrote (gpr.trm). Also included are file comparisons showing the changes I made to other source files in order to integrate this driver into gnuplot. I'm providing as is and neither I nor my employer are making any commitment to support it. (That is, I would like to hear about any bugs or suggestions for improvements, but I may not have the time or interest to implement them.) -Michael Aramini $ catf gpr.trm #include #include #include #include #define GPR_XMAX 720 #define GPR_YMAX 450 #define GPR_XLAST (GPR_XMAX - 1) #define GPR_YLAST (GPR_YMAX - 1) #define GPR_VCHAR 19 #define GPR_HCHAR 10 #define GPR_VTIC (GPR_YMAX/80) #define GPR_HTIC (GPR_XMAX/80) static status_$t status; static void check(messagex) char *messagex; { if (status.all = status_$ok) { error_$print(status); printf("Error occurred while %s.\n", messagex); } } GPR_init() { gpr_$offset_t dm_bitmap_size; gpr_$bitmap_desc_t dm_bitmap_desc; pad_$window_desc_t window; short font_id; stream_$id_t stream_id; /* open a pad to do graphics in */ window.top = 0; window.left = 0; window.width = GPR_XMAX+7; window.height = GPR_YMAX+32; pad_$create_window("", (short)0, pad_$transcript, (short)1, window, &stream_id, &status); check("pad_$create_window"); dm_bitmap_size.x_size = GPR_XMAX+2; dm_bitmap_size.y_size = GPR_YMAX+2; gpr_$init(gpr_$direct, stream_id, dm_bitmap_size, (gpr_$rgb_plane_t)7, &dm_bitmap_desc, &status); check("in gpr_$init"); gpr_$set_obscured_opt(gpr_$pop_if_obs, &status); check("in gpr_$set_obscured_opt"); gpr_$set_auto_refresh(true, &status); check("in gpr_$set_auto_refresh"); /* load a font and make it current */ gpr_$load_font_file("f7x13", 5, &font_id, &status); check("in gpr_$load_font_file"); gpr_$set_text_font(font_id, &status); check("in gpr_$set_text_font"); /* set up color values */ gpr_$set_draw_value((gpr_$pixel_value_t)7, &status); /* white */ check("in gpr_set_draw_value"); gpr_$set_text_background_value((gpr_$pixel_value_t)(-1), &status); /* trans */ check("in gpr_$set_text_background_value"); gpr_$set_text_value((gpr_$pixel_value_t)7, &status); /* white */ check("in gpr_$set_text_value"); } GPR_graphics() { (void) gpr_$acquire_display(&status); check("in gpr_$acquire display"); gpr_$clear((gpr_$pixel_value_t)0, &status); /* black */ check("in gpr_$clear"); } GPR_text() { gpr_$release_display(&status); check("gpr_$release_display"); } GPR_linetype(linetype) int linetype; { static gpr_$line_pattern_t patterns[2+5] = { { 0xFFFF }, /* solid */ { 0x3FFF }, /* long dashed */ { 0xFFFF }, /* solid */ { 0x5555 }, /* dotted */ { 0x3333 }, /* short dashed */ { 0xB5AD }, /* dot dashed */ { 0x3FFF } }; /* long dashed */ if (linetype >= 5) linetype %= 5; gpr_$set_line_pattern((short)1, patterns[linetype+2], (short)16, &status); check("in gpr_$set_line_pattern"); } GPR_move(x, y) unsigned int x, y; { gpr_$move((short)(x+1), (short)(GPR_YMAX-y), &status); check("in gpr_$move"); } GPR_vector(x, y) unsigned int x, y; { gpr_$line((short)(x+1), (short)(GPR_YMAX-y), &status); check("in gpr_$line"); } GPR_lrput_text(row, str) unsigned int row; char str[]; { GPR_move(GPR_XMAX - GPR_HTIC - GPR_HCHAR*(strlen(str)+1), GPR_VTIC + GPR_VCHAR*(row+1)); gpr_$text(str, (short)strlen(str), &status); check("in gpr_$text"); } GPR_ulput_text(row, str) unsigned int row; char str[]; { GPR_move(GPR_HTIC, GPR_YMAX - GPR_VTIC - GPR_VCHAR*(row+1)); gpr_$text(str, (short)strlen(str), &status); check("in gpr_$text"); } GPR_reset() { gpr_$terminate(false, &status); check("gpr_$terminate"); } $ cmf internal.c.orig internal.c A36 matherr() changed to B36 matherr(x) B37 struct exception *x; 1 discrepancy found. $ cmf makefile.orig makefile A5 # successfully. This includes creating the help tree in /usr/local/lib. changed to B5 # successfully. This includes creating the help tree in /usr/local/help. A16 # where to install man page on 'make man_install' A17 MANDEST=/usr/man/man1/gnuplot.1 changed to B16 B17 # where to install man page on 'make man_install' B18 #MANDEST=/usr/man/man1/gnuplot.1 B19 CATMANDEST=/usr/man/cat1/gnuplot.1 A23 # -O if you trust your compiler's optimizer A24 CFLAGS = -DGAMMA -DUNIXPC -O # -gx # debug it. changed to B25 # -DGPR if Apollo Graphics Primitives B26 # -O if you trust your compiler's optimizer B27 CFLAGS = -DVFORK -DBCOPY -DGAMMA -O -DGPR A41 TERMFLAGS = -DUNIXPC -DUNIXPLOT changed to B44 TERMFLAGS = -DAED -DBITGRAPH -DHP26 -DHP75 -DPOSTSCRIPT -DQMS -DREGIS -DSELANAR -DTEK -DUNIXPLOT A56 ld /lib/crt0s.o /lib/shlib.ifile $(OBJS) version.o $(LIBS) -o gnuplot changed to B59 cc $(OBJS) version.o $(LIBS) -o gnuplot A64 # note that directory /usr/local/lib must exist for the help tree changed to B67 # note that directory /usr/local/help must exist for the help tree A69 docs/helptree -t /usr/local/lib/gnuplot < docs/gnuplot.hlp changed to B72 docs/helptree -t /usr/local/help/gnuplot < docs/gnuplot.hlp A73 cp gnuplot.1 $(MANDEST) changed to B76 nroff -man gnuplot.1 > $(CATMANDEST) B77 # cp gnuplot.1 $(MANDEST) A77 unixplot.trm v384.trm changed to B81 unixplot.trm gpr.trm v384.trm B82 rm -f term.o 9 discrepancies found. $ cmf plot.h.orig plot.h B41 #ifdef GPR B42 #define TERM "gpr" B43 #else inserted before A41 #define TERM "tek40xx" /* put your most common term type here! */ B47 #endif inserted before A44 2 discrepancies found. $ cmf term.c.orig term.c B387 #ifdef GPR /* Apollo Graphics Primitives */ B388 #include "gpr.trm" B389 #endif /* GPR */ B390 inserted before A387 #ifdef UNIXPC /* unix-PC ATT 7300 or 3b1 machine */ B584 #ifdef GPR B585 ,{"gpr", GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR, GPR_VTIC, GPR_HTIC, B586 GPR_init, GPR_reset, GPR_text, GPR_graphics, GPR_move, GPR_vector, B587 GPR_linetype, GPR_lrput_text, GPR_ulput_text, line_and_point} B588 #endif B589 inserted before A580 #ifdef V384 2 discrepancies found.