jack@csccat.UUCP (Jack Hudler) (12/16/87)
Here is a driver for the starchart program that uses HP's Starbase graphics drivers. An appropriate name don't you think :-). Here is the entry for your makefile. SBDRIVERS=-ldd300l -lddbyte -lsb1 -lsb2 -ldvio starsb: $(COBJ) starsb.o starimages.o cc $(LFLAGS) $(COBJ) starsb.o starimages.o -lm $(SBDRIVERS) -o $@ If you have have the highres display then change the library to dd300h and the gopen to 'hp300h'. Enjoy. Jack Hudler /* ** Hewlett-Packard Starbase graphics library driver for starchart. ** Starbase support for HP9000 Series written and copyrighted by ** Jack Hudler jack@csccat ** Taken from 'starhp.c' written and copyrighted by ** Jyrki Yli-Nokari (jty@intrin.FI), ** Petri Launiainen (pl@intrin.FI), ** Intrinsic, Ltd., FINLAND. ** ** You may use this code as you wish if credit is given and this message ** is retained. */ /* ** Star scaling is changed to happen only for the placement, ** therefore the stars look always nice */ #include <stdio.h> #include <starbase.c.h> #include "starchart.h" #define SCALEU 1 #define SCALEL 2 int gfd; /* Graphics file descriptor */ /* ** Chart parameters (limiting magnitude and window x,y,w,h) */ mapblock thumbnail = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.2, 1.0, 420, 35, 480, 195, 0.0 }; mapblock master = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 8.0, 3.0, 20, 265, 880, 500, 0.0 }; /* ** Generic functions */ vecopen () { gfd = gopen("/dev/crt",OUTDEV,"hp300l",INIT); if (gfd>0) { /* scaled to lift it off the bottom and right a bit */ vdc_extent(gfd,0.0,-9.0,0.0,520.0,400.0,0.0); buffer_mode(gfd,1); write_enable(gfd,255); display_enable(gfd,255); mapping_mode(gfd,DISTORT); drawing_mode(gfd,3); clear_view_surface(gfd); clear_control(gfd,CLEAR_DISPLAY_SURFACE); } } vecclose () { make_picture_current(gfd); clear_control(gfd,CLEAR_DISPLAY_SURFACE); gclose(gfd); } vecsize (points) int points; { float fp; fp = (float) points * 0.9; character_height(gfd,fp); character_width(gfd,fp*0.75); } vecmove (x, y) int x,y; { x = SCALEU*x/SCALEL; /* adjust to screen size */ y = SCALEU*y/SCALEL; sbmove(x, y); } vecdraw (x, y) int x,y; { x = SCALEU*x/SCALEL; /* adjust to screen size */ y = SCALEU*y/SCALEL; sbdraw(x, y); } vecdrawdot(x, y) { vecdraw(x, y); /* solid and dotted currently the same */ } vecdrawhyph(x, y) { vecdraw(x, y); /* solid and dashed currently the same */ } xvecsym (x, y, s) int x,y; char s; { char buf[2]; y -= 11; /* center character strings */ x = SCALEU*x/SCALEL; /* adjust to screen size */ y = SCALEU*y/SCALEL; buf[0]=s; buf[1]='\0'; sbtext(x,y-11,buf); } vecsyms (x, y, s) int x,y; char *s; { y -= 11; /* center character strings */ x = SCALEU*x/SCALEL; /* adjust to screen size */ y = SCALEU*y/SCALEL; sbtext(x,y,s); } vecmovedraw (x1, y1, x2, y2) int x1, x2, y1, y2; { x1 = SCALEU*x1/SCALEL; /* adjust to screen size */ y1 = SCALEU*y1/SCALEL; x2 = SCALEU*x2/SCALEL; /* adjust to screen size */ y2 = SCALEU*y2/SCALEL; sbmove(x1, y1); sbdraw(x2, y2); } drawlen (x, y, dx, dy, len) int x, y, dx, dy, len; { x = SCALEU*x/SCALEL; /* adjust to screen size */ y = SCALEU*y/SCALEL; sbmove(x + dx, y + dy); sbdraw(x + dx + len - 1, y+dy); } vecsymsgk(str, x, y) char *str; { vecsyms(str, x, y); } sbmove(x,y) int x,y; { move2d(gfd,(float) x,(float) y); } sbdraw(x,y) int x,y; { draw2d(gfd,(float) x,(float) y); } sbtext(x,y,s) int x,y; char *s; { text2d(gfd,(float) x, (float) y,s,VDC_TEXT,FALSE); } -- See above (214)661-8960