Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (01/15/90)
Submitted-by: Anthony M. Richardson <amr@dukee.egr.duke.edu> Posting-number: Volume 90, Issue 006 Archive-name: applications/plplot-2.6/part05 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 5 (of 12)." # Contents: drivers/aegis.c drivers/dispatch.c drivers/iff.c # src/global.c src/plcntr.c src/plfill.c src/plzbx.c unix/dispatch.c # unix/impress.c unix/laserjetii.c # Wrapped by tadguy@xanth on Sun Jan 14 18:11:35 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'drivers/aegis.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'drivers/aegis.c'\" else echo shar: Extracting \"'drivers/aegis.c'\" \(4782 characters\) sed "s/^X//" >'drivers/aegis.c' <<'END_OF_FILE' X/* This file contains drivers for the HP7475A plotter */ X X#include "plplot.h" X#include <stdio.h> X#include <string.h> X X#define AEGX 10000 X#define AEGY 10000 X Xstatic FILE *OutDev; Xstatic PLINT select=0; Xstatic char FileName[80]; Xstatic short *buffptr, bufflen; X#define BSIZE 25 X Xvoid aegissetup(xdpi, ydpi, xwid, ywid) XPLINT xwid, ywid; XPLFLT xdpi, ydpi; X{ X} X Xvoid aegisselect(ori, name) XPLINT ori; Xchar *name; X{ X strncpy(FileName,name,sizeof(FileName)-1); X FileName[sizeof(FileName)-1] = '\0'; X select = 1; X} X X/* Set up device specific stuff and initialize the device */ Xvoid aegisinit() X{ X /* setpxl() sets the dots/mm in the x and y directions */ X setpxl((PLFLT)39.37, (PLFLT)39.37); X X /* setphy() sets the device coordinates. These are integer */ X /* values. Set up for landscape orientation (long axis of page in the */ X /* x direction). Origin is in the lower left hand corner. */ X setphy(0,AEGX,0,AEGY); X X /* Set default pen color using scol(color). */ X /* Any default pen color can be used but a black pen is probably best. */ X scol(1); X X /* Set default pen width using swid(width) */ X swid(1); X X /* Set device interaction mode using smod(mode). Set mode to 0 for */ X /* a noninteractive device, Unless you are writing your */ X /* own Amiga screen driver mode should be 0. */ X smod(0); X X bufflen = 2*BSIZE; X buffptr = (short *)malloc(sizeof(short)*bufflen); X if(buffptr == NULL) X plexit("Out of memory!"); X X} X X/* Sets to text mode */ Xvoid aegistext() X{ X} X X/* Sets to graphics mode */ Xvoid aegisgraph() X{ X} X Xstatic PLINT firstline; X/* Clears the page */ Xvoid aegisclear() X{ X void flushbuffer(); X X /* Close the file */ X if(!firstline) { X flushbuffer(); X } X fclose(OutDev); X} X Xstatic short xlast, ylast; X Xvoid aegispage() X{ X char line[80]; X for(;;) { X if(!select) { X printf("Enter graphics file name. "); X fgets(line,sizeof(line),stdin); X if(sscanf(line,"%s",FileName)!=1) X continue; X } X X if (!(OutDev = fopen(FileName,"w"))) { X fprintf(stderr,"Can't open %s.\n",FileName); X select = 0; X } X else X break; X } X select = 0; X firstline = 1; X xlast = -10000; ylast = -10000; X X /* Write out header */ X fprintf(OutDev,"81086 0.0 0.0 100.0 100.0 0 10.\n"); X fprintf(OutDev,"\"%s\"\n-1\n",FileName); X} X Xstatic int curwid; Xvoid aegiswidth(width) XPLINT width; X{ X void flushbuffer(); X X flushbuffer(); X firstline = 1; X X if(width <= 1) X curwid = 0; X else if(width >= 4) X curwid = 3; X else X curwid = width-1; X} X Xstatic int curcol; X/* Change the pen color */ Xvoid aegiscolor(color) XPLINT color; X{ X void flushbuffer(); X X flushbuffer(); X firstline = 1; X /* Aegis pen 1 is the "paper" color */ X if (color >= 2 && color <=15) X curcol = color; X else X curcol = 0; X} X Xstatic short count, xmin, xmax, ymin, ymax; X X/* Draws a line from (x1,y1) to (x2,y2) */ Xvoid aegisline(x1,y1,x2,y2) XPLINT x1,y1,x2,y2; X{ X short *tempptr; X void flushbuffer(); X X /* If starting point of this line is the same as the ending point of */ X /* the previous line then don't raise the pen. (This really speeds up */ X /* plotting and reduces the size of the file. */ X if(firstline) { X count = 0; X *(buffptr+count++) = x1; X *(buffptr+count++) = y1; X *(buffptr+count++) = x2; X *(buffptr+count++) = y2; X xmin = min(x1,x2); ymin = min(y1,y2); X xmax = max(x1,x2); ymax = max(y1,y2); X firstline = 0; X } X else if(x1 == xlast && y1 == ylast) { X if(count+2 >= bufflen) { X bufflen += 2*BSIZE; X tempptr = (short *)realloc((void *)buffptr,bufflen*sizeof(short)); X if(tempptr == NULL){ X free((void *)buffptr); X plexit("Out of memory!"); X } X buffptr = tempptr; X } X *(buffptr+count++) = x2; X *(buffptr+count++) = y2; X xmin = min(x2,xmin); ymin = min(y2,ymin); X xmax = max(x2,xmax); ymax = max(y2,ymax); X } X else { X flushbuffer(); X *(buffptr+count++) = x1; X *(buffptr+count++) = y1; X *(buffptr+count++) = x2; X *(buffptr+count++) = y2; X xmin = min(x1,x2); ymin = min(y1,y2); X xmax = max(x1,x2); ymax = max(y1,y2); X } X X xlast = x2; X ylast = y2; X} X Xstatic void flushbuffer() X{ X short i=0; X X fprintf(OutDev,"1 52 %.2f %.2f",xmin/100.,ymin/100.); X fprintf(OutDev," %.2f %.2f",xmax/100.,ymax/100.); X fprintf(OutDev," %d 0 0 %d 0\n",curcol,curwid); X while(i<count) { X fprintf(OutDev," 1 %.2f %.2f\n",*(buffptr+i)/100.,*(buffptr+i+1)/100.); X i += 2; X } X fprintf(OutDev," 0\n"); X count = 0; X} X X/* Cleanup and close file. */ Xvoid aegistidy() X{ X flushbuffer(); X free((VOID *)buffptr); X fclose(OutDev); X} X X X END_OF_FILE if test 4782 -ne `wc -c <'drivers/aegis.c'`; then echo shar: \"'drivers/aegis.c'\" unpacked with wrong size! fi # end of 'drivers/aegis.c' fi if test -f 'drivers/dispatch.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'drivers/dispatch.c'\" else echo shar: Extracting \"'drivers/dispatch.c'\" \(4680 characters\) sed "s/^X//" >'drivers/dispatch.c' <<'END_OF_FILE' X#include "plplot.h" X#include "dispatch.h" X Xvoid amisetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid amiselect PLARGS((PLINT or, char *file)); Xvoid amiinit PLARGS((void)); Xvoid amiline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid amiclear PLARGS((void)); Xvoid amipage PLARGS((void)); Xvoid amitidy PLARGS((void)); Xvoid amicolor PLARGS((PLINT color)); Xvoid amitext PLARGS((void)); Xvoid amigraph PLARGS((void)); Xvoid amiwidth PLARGS((PLINT width)); X Xvoid prefsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid prefselect PLARGS((PLINT or, char *file)); Xvoid prefinit PLARGS((void)); Xvoid prefline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid prefclear PLARGS((void)); Xvoid prefpage PLARGS((void)); Xvoid preftidy PLARGS((void)); Xvoid prefcolor PLARGS((PLINT color)); Xvoid preftext PLARGS((void)); Xvoid prefgraph PLARGS((void)); Xvoid prefwidth PLARGS((PLINT width)); X Xvoid iffsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid iffselect PLARGS((PLINT or, char *file)); Xvoid iffinit PLARGS((void)); Xvoid iffline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid iffclear PLARGS((void)); Xvoid iffpage PLARGS((void)); Xvoid ifftidy PLARGS((void)); Xvoid iffcolor PLARGS((PLINT color)); Xvoid ifftext PLARGS((void)); Xvoid iffgraph PLARGS((void)); Xvoid iffwidth PLARGS((PLINT width)); X Xvoid hp7475setup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid hp7475select PLARGS((PLINT or, char *file)); Xvoid hp7475init PLARGS((void)); Xvoid hp7475line PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid hp7475clear PLARGS((void)); Xvoid hp7475page PLARGS((void)); Xvoid hp7475tidy PLARGS((void)); Xvoid hp7475color PLARGS((PLINT color)); Xvoid hp7475text PLARGS((void)); Xvoid hp7475graph PLARGS((void)); Xvoid hp7475width PLARGS((PLINT width)); X Xvoid aegissetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid aegisselect PLARGS((PLINT or, char *file)); Xvoid aegisinit PLARGS((void)); Xvoid aegisline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid aegisclear PLARGS((void)); Xvoid aegispage PLARGS((void)); Xvoid aegistidy PLARGS((void)); Xvoid aegiscolor PLARGS((PLINT color)); Xvoid aegistext PLARGS((void)); Xvoid aegisgraph PLARGS((void)); Xvoid aegiswidth PLARGS((PLINT width)); X Xvoid pssetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid psselect PLARGS((PLINT or, char *file)); Xvoid psinit PLARGS((void)); Xvoid psline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid psclear PLARGS((void)); Xvoid pspage PLARGS((void)); Xvoid pstidy PLARGS((void)); Xvoid pscolor PLARGS((PLINT color)); Xvoid pstext PLARGS((void)); Xvoid psgraph PLARGS((void)); Xvoid pswidth PLARGS((PLINT width)); X XDISPATCH_TABLE plDispatchTable[] = { X /* Amiga routines */ X { X /* This string appears in the device menu list. */ X "Amiga Window", X /* Page Setup routine */ X amisetup, X /* Orientation and file name selection */ X amiselect, X /* Device initialization function pointer. */ X amiinit, X /* Function to draw line between two points */ X amiline, X /* Clear screen (or eject page) function. */ X amiclear, X /* New page set up. */ X amipage, X /* Tidy up device (flush buffers, close file, etc.) */ X amitidy, X /* Function to change pen color. */ X amicolor, X /* Switch to text mode. */ X amitext, X /* Switch to graphics mode. */ X amigraph, X /* Set pen width */ X amiwidth X }, X { X "Preferences Printer", X prefsetup, X prefselect, X prefinit, X prefline, X prefclear, X prefpage, X preftidy, X prefcolor, X preftext, X prefgraph, X prefwidth X }, X { X "IFF Graphics File", X iffsetup, X iffselect, X iffinit, X iffline, X iffclear, X iffpage, X ifftidy, X iffcolor, X ifftext, X iffgraph, X iffwidth X }, X { X "HP7475A Plotter (PLT: device)", X hp7475setup, X hp7475select, X hp7475init, X hp7475line, X hp7475clear, X hp7475page, X hp7475tidy, X hp7475color, X hp7475text, X hp7475graph, X hp7475width X }, X { X "Aegis Draw File", X aegissetup, X aegisselect, X aegisinit, X aegisline, X aegisclear, X aegispage, X aegistidy, X aegiscolor, X aegistext, X aegisgraph, X aegiswidth X }, X { X "PostScript File", X pssetup, X psselect, X psinit, X psline, X psclear, X pspage, X pstidy, X pscolor, X pstext, X psgraph, X pswidth X } X}; X Xint npldrivers = (sizeof(plDispatchTable)/sizeof(struct dispatch_table)); END_OF_FILE if test 4680 -ne `wc -c <'drivers/dispatch.c'`; then echo shar: \"'drivers/dispatch.c'\" unpacked with wrong size! fi # end of 'drivers/dispatch.c' fi if test -f 'drivers/iff.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'drivers/iff.c'\" else echo shar: Extracting \"'drivers/iff.c'\" \(4271 characters\) sed "s/^X//" >'drivers/iff.c' <<'END_OF_FILE' X/* IFF file driver. Supplied by Tomas Rokicki (Radical Eye Software) */ X X#include "plplot.h" X#include <stdio.h> X Xstatic FILE *OutFile; Xstatic PLINT orient, setup=0, select=0, curwid; Xstatic char FileName[80]; Xstatic char line[80]; Xstatic PLINT xwidth, ywidth, xsubw, ysubw; Xstatic PLINT vxwidth, vywidth; Xstatic PLFLT xdotspi, ydotspi; X Xvoid iffsetup(xdpi, ydpi, xwid, ywid) XPLINT xwid, ywid; XPLFLT xdpi, ydpi; X{ X xdotspi = xdpi; X ydotspi = ydpi; X xwidth = xwid; X ywidth = ywid; X setup = 1; X} X Xvoid iffselect(ori, name) XPLINT ori; Xchar *name; X{ X orient = ori; X strncpy(FileName,name,sizeof(FileName)-1); X FileName[sizeof(FileName)-1] = '\0'; X select = 1; X} X Xstatic PLINT getint(s) Xchar *s; X{ X PLINT m; X X while(1) { X printf(s); X fgets(line,sizeof(line),stdin); X if(sscanf(line,"%d",&m) == 1) X return(m); X printf("No value or value out of range; please try again\n"); X } X} X Xstatic PLFLT getflt(s) Xchar *s; X{ X PLFLT m; X X while(1) { X printf(s); X fgets(line,sizeof(line),stdin); X if(sscanf(line,"%f",&m) == 1) X return(m); X printf("No value or value out of range; please try again\n"); X } X} X Xvoid iffopenfile() X{ X for(;;) { X if(!select) { X printf("Enter graphics file name. "); X fgets(line,sizeof(line),stdin); X if(sscanf(line,"%s",FileName)!=1) X continue; X } X X if (!(OutFile = fopen(FileName,"w"))) { X fprintf(stderr,"Can't open %s.\n",FileName); X select = 0; X } X else X break; X } X select = 0; X} X Xvoid iffinit() X{ X int mapinit(); X X if(!setup) { X xdotspi = getflt("Enter desired horizontal IFF resolution (dpi): "); X ydotspi = getflt("Enter desired vertical IFF resolution (dpi): "); X xwidth = getint("Enter desired horizontal IFF size in pixels : "); X ywidth = getint("Enter desired vertical IFF size in pixels : "); X } X setup = 0; X X vxwidth = xwidth*25; X vywidth = ywidth*25; X X if(!select) X orient = getint("Landscape or portrait orientation? (0 or 1) "); X X if(orient) { X setpxl((PLFLT)(ydotspi*25/25.4), (PLFLT)(xdotspi*25/25.4)); X setphy(0,vywidth,0,vxwidth); X } X else { X setpxl((PLFLT)(xdotspi*25./25.4), (PLFLT)(ydotspi*25/25.4)); X setphy(0,vxwidth,0,vywidth); X } X X xsubw = xwidth - 2; X ysubw = ywidth - 2; X X scol(1); /* set pen color (ignored for this driver) */ X swid(1); /* set default pen width */ X smod(0); /* set mode (not an interactive device) */ X X /* Allocate bitmap and initialize for line drawing */ X if(mapinit(xwidth, ywidth)) { X plexit(""); X } X} X X/* Set IFF to test mode */ Xvoid ifftext() X{ X /* do nothing here */ X} X X/* Set IFF to graphics mode */ Xvoid iffgraph() X{ X /* Do nothing here */ X} X X/* Print out page */ Xvoid iffclear() X{ X void iffwritefile(); X X iffwritefile((PLINT)xdotspi,(PLINT)ydotspi,OutFile); X fclose(OutFile) ; X} X Xvoid iffpage() X{ X void mapclear(); X X mapclear(); X iffopenfile(); X} X Xvoid iffwidth(width) XPLINT width; X{ X if(width < 1) X curwid = 1; X else if(width > 3) X curwid = 3; X else X curwid = width; X} X X/* Change color */ Xvoid iffcolor(colour) XPLINT colour; X{ X} X Xvoid iffline(x1,y1,x2,y2) XPLINT x1, y1, x2, y2; X{ X long xn1, yn1, xn2, yn2; X void mapline(); X X if(orient) { X xn1 = (x1*ysubw)/vywidth; X yn1 = (y1*xsubw)/vxwidth; X xn2 = (x2*ysubw)/vywidth; X yn2 = (y2*xsubw)/vxwidth; X switch(curwid) { X case 3: X mapline(yn1,xn1,yn2,xn2); X case 2: X mapline(yn1+2,xn1+2,yn2+2,xn2+2); X case 1: X default: X mapline(yn1+1,xn1+1,yn2+1,xn2+1); X } X } X else { X xn1 = (x1*xsubw)/vxwidth; X yn1 = (y1*ysubw)/vywidth; X xn2 = (x2*xsubw)/vxwidth; X yn2 = (y2*ysubw)/vywidth; X switch(curwid) { X case 3: X mapline(xn1,ysubw-yn1,xn2,ysubw-yn2); X case 2: X mapline(xn1+2,ysubw-yn1+2,xn2+2,ysubw-yn2+2); X case 1: X default: X mapline(xn1+1,ysubw-yn1+1,xn2+1,ysubw-yn2+1); X } X } X} X X/* Reset printer and close file */ Xvoid ifftidy() X{ X void iffwritefile(), mapfree(); X X iffwritefile((PLINT)xdotspi,(PLINT)ydotspi,OutFile); X fclose(OutFile) ; X mapfree(); X} X END_OF_FILE if test 4271 -ne `wc -c <'drivers/iff.c'`; then echo shar: \"'drivers/iff.c'\" unpacked with wrong size! fi # end of 'drivers/iff.c' fi if test -f 'src/global.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/global.c'\" else echo shar: Extracting \"'src/global.c'\" \(6662 characters\) sed "s/^X//" >'src/global.c' <<'END_OF_FILE' X/* Sets and gets global variables */ X X#include "plplot.h" X#include "declare.h" X Xvoid glev(n) XPLINT *n; X{ X *n = level; X} X Xvoid slev(n) XPLINT n; X{ X level = n; X} X Xvoid gbase(x,y,xc,yc) XPLFLT *x,*y,*xc,*yc; X{ X *x = base3x; X *y = base3y; X *xc = basecx; X *yc = basecy; X} X Xvoid sbase(x,y,xc,yc) XPLFLT x,y,xc,yc; X{ X base3x = x; X base3y = y; X basecx = xc; X basecy = yc; X} X Xvoid gnms(n) XPLINT *n; X{ X *n = nms; X} X Xvoid snms(n) XPLINT n; X{ X nms = n; X} X Xvoid gdev(dev,term,gra) XPLINT *dev,*term,*gra; X{ X *dev = device; X *term = termin; X *gra = graphx; X} X Xvoid sdev(dev,term,gra) XPLINT dev,term,gra; X{ X device = dev; X termin = term; X graphx = gra; X} X Xvoid smod(term) XPLINT term; X{ X termin = term; X} X Xvoid gcurr(ix,iy) XPLINT *ix,*iy; X{ X *ix = currx; X *iy = curry; X} X Xvoid scurr(ix,iy) XPLINT ix,iy; X{ X currx = ix; X curry = iy; X} X Xvoid gdom(xmin,xmax,ymin,ymax) XPLFLT *xmin,*xmax,*ymin,*ymax; X{ X *xmin = domxmi; X *xmax = domxma; X *ymin = domymi; X *ymax = domyma; X} X Xvoid sdom(xmin,xmax,ymin,ymax) XPLFLT xmin,xmax,ymin,ymax; X{ X domxmi = xmin; X domxma = xmax; X domymi = ymin; X domyma = ymax; X} X Xvoid grange(zscl,zmin,zmax) XPLFLT *zscl,*zmin,*zmax; X{ X *zscl = zzscl; X *zmin = ranmi; X *zmax = ranma; X} X Xvoid srange(zscl,zmin,zmax) XPLFLT zscl,zmin,zmax; X{ X zzscl = zscl; X ranmi = zmin; X ranma = zmax; X} X Xvoid gw3wc(dxx,dxy,dyx,dyy,dyz) XPLFLT *dxx,*dxy,*dyx,*dyy,*dyz; X{ X *dxx = cxx; X *dxy = cxy; X *dyx = cyx; X *dyy = cyy; X *dyz = cyz; X} X Xvoid sw3wc(dxx,dxy,dyx,dyy,dyz) XPLFLT dxx,dxy,dyx,dyy,dyz; X{ X cxx = dxx; X cxy = dxy; X cyx = dyx; X cyy = dyy; X cyz = dyz; X} X Xvoid gvpp(ixmin,ixmax,iymin,iymax) XPLINT *ixmin,*ixmax,*iymin,*iymax; X{ X *ixmin = vppxmi; X *ixmax = vppxma; X *iymin = vppymi; X *iymax = vppyma; X} X Xvoid svpp(ixmin,ixmax,iymin,iymax) XPLINT ixmin,ixmax,iymin,iymax; X{ X vppxmi = ixmin; X vppxma = ixmax; X vppymi = iymin; X vppyma = iymax; X} X Xvoid gspp(ixmin,ixmax,iymin,iymax) XPLINT *ixmin,*ixmax,*iymin,*iymax; X{ X *ixmin = sppxmi; X *ixmax = sppxma; X *iymin = sppymi; X *iymax = sppyma; X} X Xvoid sspp(ixmin,ixmax,iymin,iymax) XPLINT ixmin,ixmax,iymin,iymax; X{ X sppxmi = ixmin; X sppxma = ixmax; X sppymi = iymin; X sppyma = iymax; X} X Xvoid gclp(ixmin,ixmax,iymin,iymax) XPLINT *ixmin,*ixmax,*iymin,*iymax; X{ X *ixmin = clpxmi; X *ixmax = clpxma; X *iymin = clpymi; X *iymax = clpyma; X} X Xvoid sclp(ixmin,ixmax,iymin,iymax) XPLINT ixmin,ixmax,iymin,iymax; X{ X clpxmi = ixmin; X clpxma = ixmax; X clpymi = iymin; X clpyma = iymax; X} X Xvoid gphy(ixmin,ixmax,iymin,iymax) XPLINT *ixmin,*ixmax,*iymin,*iymax; X{ X *ixmin = phyxmi; X *ixmax = phyxma; X *iymin = phyymi; X *iymax = phyyma; X} X Xvoid sphy(ixmin,ixmax,iymin,iymax) XPLINT ixmin,ixmax,iymin,iymax; X{ X phyxmi = ixmin; X phyxma = ixmax; X phyymi = iymin; X phyyma = iymax; X} X Xvoid gsub(nx,ny,cs) XPLINT *nx,*ny,*cs; X{ X *nx = nsubx; X *ny = nsuby; X *cs = cursub; X} X Xvoid ssub(nx,ny,cs) XPLINT nx,ny,cs; X{ X nsubx = nx; X nsuby = ny; X cursub = cs; X} X Xvoid gumpix(ix,iy) XPLINT *ix,*iy; X{ X *ix = umx; X *iy = umy; X} X Xvoid sumpix(ix,iy) XPLINT ix,iy; X{ X umx = ix; X umy = iy; X} X Xvoid gatt(ifnt,icol) XPLINT *ifnt,*icol; X{ X *ifnt = font; X *icol = colour; X} X Xvoid satt(ifnt,icol) XPLINT ifnt,icol; X{ X font = ifnt; X colour = icol; X} X Xvoid gcol(icol) XPLINT *icol; X{ X *icol = colour; X} X Xvoid scol(icol) XPLINT icol; X{ X colour = icol; X} X Xvoid gwid(pwid) XPLINT *pwid; X{ X *pwid = width; X} X Xvoid swid(pwid) XPLINT pwid; X{ X width = pwid; X} X Xvoid gspd(xmin,xmax,ymin,ymax) XPLFLT *xmin,*xmax,*ymin,*ymax; X{ X *xmin = spdxmi; X *xmax = spdxma; X *ymin = spdymi; X *ymax = spdyma; X} X Xvoid sspd(xmin,xmax,ymin,ymax) XPLFLT xmin,xmax,ymin,ymax; X{ X spdxmi = xmin; X spdxma = xmax; X spdymi = ymin; X spdyma = ymax; X} X Xvoid gvpd(xmin,xmax,ymin,ymax) XPLFLT *xmin,*xmax,*ymin,*ymax; X{ X *xmin = vpdxmi; X *xmax = vpdxma; X *ymin = vpdymi; X *ymax = vpdyma; X} X Xvoid svpd(xmin,xmax,ymin,ymax) XPLFLT xmin,xmax,ymin,ymax; X{ X vpdxmi = xmin; X vpdxma = xmax; X vpdymi = ymin; X vpdyma = ymax; X} X Xvoid gvpw(xmin,xmax,ymin,ymax) XPLFLT *xmin,*xmax,*ymin,*ymax; X{ X *xmin = vpwxmi; X *xmax = vpwxma; X *ymin = vpwymi; X *ymax = vpwyma; X} X Xvoid svpw(xmin,xmax,ymin,ymax) XPLFLT xmin,xmax,ymin,ymax; X{ X vpwxmi = xmin; X vpwxma = xmax; X vpwymi = ymin; X vpwyma = ymax; X} X Xvoid gpixmm(x,y) XPLFLT *x,*y; X{ X *x = xpmm; X *y = ypmm; X} X Xvoid spixmm(x,y) XPLFLT x,y; X{ X xpmm = x; X ypmm = y; X} X Xvoid gwp(xscl,xoff,yscl,yoff) XPLFLT *xscl,*xoff,*yscl,*yoff; X{ X *xscl = wpxscl; X *xoff = wpxoff; X *yscl = wpyscl; X *yoff = wpyoff; X} X Xvoid swp(xscl,xoff,yscl,yoff) XPLFLT xscl,xoff,yscl,yoff; X{ X wpxscl = xscl; X wpxoff = xoff; X wpyscl = yscl; X wpyoff = yoff; X} X Xvoid gwm(xscl,xoff,yscl,yoff) XPLFLT *xscl,*xoff,*yscl,*yoff; X{ X *xscl = wmxscl; X *xoff = wmxoff; X *yscl = wmyscl; X *yoff = wmyoff; X} X Xvoid swm(xscl,xoff,yscl,yoff) XPLFLT xscl,xoff,yscl,yoff; X{ X wmxscl = xscl; X wmxoff = xoff; X wmyscl = yscl; X wmyoff = yoff; X} X Xvoid gdp(xscl,xoff,yscl,yoff) XPLFLT *xscl,*xoff,*yscl,*yoff; X{ X *xscl = dpxscl; X *xoff = dpxoff; X *yscl = dpyscl; X *yoff = dpyoff; X} X Xvoid sdp(xscl,xoff,yscl,yoff) XPLFLT xscl,xoff,yscl,yoff; X{ X dpxscl = xscl; X dpxoff = xoff; X dpyscl = yscl; X dpyoff = yoff; X} X Xvoid gmp(xscl,xoff,yscl,yoff) XPLFLT *xscl,*xoff,*yscl,*yoff; X{ X *xscl = mpxscl; X *xoff = mpxoff; X *yscl = mpyscl; X *yoff = mpyoff; X} X Xvoid smp(xscl,xoff,yscl,yoff) XPLFLT xscl,xoff,yscl,yoff; X{ X mpxscl = xscl; X mpxoff = xoff; X mpyscl = yscl; X mpyoff = yoff; X} X Xvoid gchr(def,ht) XPLFLT *def,*ht; X{ X *def = chrdef; X *ht = chrht; X} X Xvoid schr(def,ht) XPLFLT def,ht; X{ X chrdef = def; X chrht = ht; X} X Xvoid gsym(def,ht) XPLFLT *def,*ht; X{ X *def = symdef; X *ht = symht; X} X Xvoid ssym(def,ht) XPLFLT def,ht; X{ X symdef = def; X symht = ht; X} X Xvoid gmaj(def,ht) XPLFLT *def,*ht; X{ X *def = majdef; X *ht = majht; X} X Xvoid smaj(def,ht) XPLFLT def,ht; X{ X majdef = def; X majht = ht; X} X Xvoid gmin(def,ht) XPLFLT *def,*ht; X{ X *def = mindef; X *ht = minht; X} X Xvoid smin(def,ht) XPLFLT def,ht; X{ X mindef = def; X minht = ht; X} X END_OF_FILE if test 6662 -ne `wc -c <'src/global.c'`; then echo shar: \"'src/global.c'\" unpacked with wrong size! fi # end of 'src/global.c' fi if test -f 'src/plcntr.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/plcntr.c'\" else echo shar: Extracting \"'src/plcntr.c'\" \(5746 characters\) sed "s/^X//" >'src/plcntr.c' <<'END_OF_FILE' X/* points is a pointer to a 2d array of nx by ny points. */ X/* iscan has nx elements. ixstor and iystor each have nstor elements. */ X X#include "plplot.h" X Xvoid plcntr(points,nx,ny,kx,lx,ky,ly,zlev,iscan,ixstor,iystor,nstor,pltr) XPLINT nx, ny, ky, ly, kx, lx, nstor; XPLFLT zlev, *points; XPLINT *iscan, *ixstor, *iystor; Xvoid (*pltr)(); X{ X PLINT kcol, krow, kstor, kscan, iwbeg, ixbeg, iybeg, izbeg; X PLINT iboun, iw, ix, iy, iz, ifirst, istep, ixgo, iygo; X PLINT l, ixg, iyg, ia, ib, ixt, iyt, jstor, next; X PLFLT dist, dx, dy, xnew, ynew, x, y; X PLFLT xlas=0., ylas=0., tpx, tpy, xt, yt; X X /* Initialize memory pointers */ X X kstor = 0; X kscan = 0; X X for (krow=ky; krow<=ly; krow++) { X for (kcol=kx+1; kcol <= lx; kcol++) { X X /* Check if a contour has been crossed */ X X x = *(points + (kcol-2)*ny + krow-1); X y = *(points + (kcol-1)*ny + krow-1); X if (x < zlev && y >= zlev) { X ixbeg = kcol-1; X iwbeg = kcol; X } X else if (y < zlev && x >= zlev) { X ixbeg = kcol; X iwbeg = kcol-1; X } X else X goto lab70; X X iybeg = krow; X izbeg = krow; X X /* Yes, a contour has been crossed. Check to see if it */ X /* is a new one. */ X X for(l=0;l<kscan;l++) X if (ixbeg == iscan[l]) goto lab70; X X /* Here is the section which follows and draws a contour */ X X for (iboun=1; iboun>= -1; iboun -= 2) { X X /* Set up starting point and initial search directions */ X X ix = ixbeg; X iy = iybeg; X iw = iwbeg; X iz = izbeg; X ifirst = 1; X istep = 0; X ixgo = iw - ix; X iygo = iz - iy; X Xlab20: X plccal(points,nx,ny,zlev,ix,iy,ixgo,iygo,&dist); X dx = dist * ixgo; X dy = dist * iygo; X xnew = ix+dx; X ynew = iy+dy; X X /* Has a step occured in search? */ X X if (istep != 0) { X if (ixgo*iygo == 0) { X X /* This was a diagonal step, so interpolate missed */ X /* point, rotating 45 degrees to get it */ X X ixg = ixgo; X iyg = iygo; X plr45(&ixg,&iyg,iboun); X ia = iw-ixg; X ib = iz-iyg; X plccal(points,nx,ny,zlev,ia,ib,ixg,iyg,&dist); X (*pltr)(xlas-1,ylas-1,&tpx,&tpy); X drawor(tpx,tpy); X dx = dist*ixg; X dy = dist*iyg; X xlas = ia+dx; X ylas = ib+dy; X } X else { X if (dist > 0.5) { X xt = xlas; X xlas = xnew; X xnew = xt; X yt = ylas; X ylas = ynew; X ynew = yt; X } X } X } X if (ifirst != 1) { X (*pltr)(xlas-1,ylas-1,&tpx,&tpy); X drawor(tpx,tpy); X } X else { X (*pltr)(xnew-1,ynew-1,&tpx,&tpy); X movwor(tpx,tpy); X } X xlas = xnew; X ylas = ynew; X X /* Check if the contour is closed */ X X if (ifirst != 1 && ix == ixbeg && iy == iybeg X && iw == iwbeg && iz == izbeg) { X (*pltr)(xlas-1,ylas-1,&tpx,&tpy); X drawor(tpx,tpy); X goto lab70; X } X ifirst = 0; X X /* Now the rotation */ X X istep = 0; X plr45(&ixgo,&iygo,iboun); X iw = ix+ixgo; X iz = iy+iygo; X X /* Check if out of bounds */ X X if (iw<kx || iw>lx || iz<ky || iz>ly) goto lab50; X X /* Has contact been lost with the contour? */ X X if (*(points+(iw-1)*ny+iz-1) < zlev) { X X /* Yes, lost contact => step to new centre */ X X istep = 1; X ix = iw; X iy = iz; X plr135(&ixgo,&iygo,iboun); X iw = ix+ixgo; X iz = iy+iygo; X X /* And do the contour memory */ X X if (iy == krow) { X kscan = kscan+1; X iscan[kscan-1] = ix; X } X else if (iy>krow) { X kstor = kstor+1; X if (kstor>nstor) { X plexit("Heap exhausted in plcont."); X } X ixstor[kstor-1] = ix; X iystor[kstor-1] = iy; X } X } X goto lab20; Xlab50: X /* Reach here only if boundary encountered - Draw last bit */ X X (*pltr)(xnew-1,ynew-1,&tpx,&tpy); X drawor(tpx,tpy); X } Xlab70: X ; /* Null statement to carry label */ X } X X /* Search of row complete - set up memory of next row in iscan and */ X /* edit ixstor and iystor */ X X if (krow<ny) { X jstor = 0; X kscan = 0; X next = krow+1; X for (l=1; l<=kstor; l++) { X ixt = ixstor[l-1]; X iyt = iystor[l-1]; X X /* Memory of next row into iscan */ X X if (iyt == next) { X kscan = kscan+1; X iscan[kscan-1] = ixt; X X /* Retain memory of rows to come, and forget rest */ X X } X else if (iyt>next) { X jstor = jstor+1; X ixstor[jstor-1] = ixt; X iystor[jstor-1] = iyt; X } X } X kstor = jstor; X } X } X} END_OF_FILE if test 5746 -ne `wc -c <'src/plcntr.c'`; then echo shar: \"'src/plcntr.c'\" unpacked with wrong size! fi # end of 'src/plcntr.c' fi if test -f 'src/plfill.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/plfill.c'\" else echo shar: Extracting \"'src/plfill.c'\" \(5226 characters\) sed "s/^X//" >'src/plfill.c' <<'END_OF_FILE' X#include "plplot.h" X#include "declare.h" X#include <math.h> X#ifdef PLSTDC X#include <stdlib.h> X#else Xextern char *malloc(); Xextern char *realloc(); Xextern void free(); X#endif X X#define betw(ix,ia,ib) (((ix)<=(ia)&&(ix)>=(ib)) || ((ix)>=(ia)&&(ix)<=(ib))) X#define ssqr(a,b) sqrt((a)*(a)+(b)*(b)) X#define sign(a) ((a)<0 ? -1 : 1) X#define DTOR 0.0174533 X#define BINC 50 X Xstruct point { X short x, y; X}; X Xstatic short bufferleng, buffersize, *buffer; X Xvoid plfill(n,x,y) XPLINT n; XPLFLT *x, *y; X{ X PLINT i,level; X PLINT xmin, ymin, x1, y1, x2, y2, x3, y3; X PLINT k, dinc; X PLFLT ci, si, thetd; X short swap; X int compare(); X void buildlist(), qsort(), tran(); X X glev(&level); X if (level<3) plexit("Please set up window before calling plfill."); X if (n<3) plexit("Not enough points in plfill object!"); X X buffersize = 2*BINC; X buffer = (short *)malloc(buffersize*sizeof(short)); X if(!buffer) X plexit("Out of memory in plfill."); X X for(k=0; k<nps; k++) { X bufferleng = 0; X X if(abs(inclin[k]) <= 450) { X thetd = atan(tan(DTOR*inclin[k]/10.)*ypmm/xpmm); X swap = 0; X } X else { X thetd = atan(tan(DTOR*sign(inclin[k])* X (abs(inclin[k])-900)/10.)*xpmm/ypmm); X swap = 1; X } X ci = cos(thetd); X si = sin(thetd); X if(swap) X dinc = delta[k]*ssqr(xpmm*abs(ci),ypmm*abs(si))/1000.; X else X dinc = delta[k]*ssqr(ypmm*abs(ci),xpmm*abs(si))/1000.; X X xmin = wcpcx(x[0]); ymin = wcpcy(y[0]); X for(i=1; i<n; i++) { X xmin = min(xmin,wcpcx(x[i])); X ymin = min(ymin,wcpcy(y[i])); X } X X x1 = wcpcx(x[0]) - xmin; X y1 = wcpcy(y[0]) - ymin; X tran(&x1,&y1,ci,si); X x2 = wcpcx(x[1]) - xmin; X y2 = wcpcy(y[1]) - ymin; X tran(&x2,&y2,ci,si); X for(i=2; i<n; i++) { X x3 = wcpcx(x[i]) - xmin; X y3 = wcpcy(y[i]) - ymin; X tran(&x3,&y3,ci,si); X if(swap) X buildlist(y1,x1,y2,x2,y3,x3,dinc); X else X buildlist(x1,y1,x2,y2,x3,y3,dinc); X x1 = x2; y1 = y2; X x2 = x3; y2 = y3; X } X x3 = wcpcx(x[0]) - xmin; X y3 = wcpcy(y[0]) - ymin; X tran(&x3,&y3,ci,si); X if(swap) X buildlist(y1,x1,y2,x2,y3,x3,dinc); X else X buildlist(x1,y1,x2,y2,x3,y3,dinc); X X x1 = x2; y1 = y2; X x2 = x3; y2 = y3; X x3 = wcpcx(x[1]) - xmin; X y3 = wcpcy(y[1]) - ymin; X tran(&x3,&y3,ci,si); X if(swap) X buildlist(y1,x1,y2,x2,y3,x3,dinc); X else X buildlist(x1,y1,x2,y2,x3,y3,dinc); X X /* Sort list by y then x */ X qsort((char *)buffer,bufferleng/2,sizeof(struct point),compare); X X /* OK, now do the hatching */ X i = 0; X while(i<bufferleng) { X if(swap) { X x1 = buffer[i+1]; y1 = buffer[i]; X } X else { X x1 = buffer[i]; y1 = buffer[i+1]; X } X i += 2; X x2 = x1; y2 = y1; X tran(&x1,&y1,ci,-si); X movphy(x1+xmin,y1+ymin); X if(swap) { X x1 = buffer[i+1]; y1 = buffer[i]; X } X else { X x1 = buffer[i]; y1 = buffer[i+1]; X } X i += 2; X if((swap && x2 != x1) || (!swap && y2 != y1)) X continue; /* Uh oh we're lost */ X tran(&x1,&y1,ci,-si); X draphy(x1+xmin,y1+ymin); X } X X } X free((VOID *)buffer); X} X Xvoid tran(a,b,c,d) XPLINT *a, *b; XPLFLT c, d; X{ X PLINT ta, tb; X X ta = *a; X tb = *b; X X *a = round(ta*c + tb*d); X *b = round(tb*c - ta*d); X} X Xvoid buildlist(x1,y1,x2,y2,x3,y3,dinc) Xint x1, y1, x2, y2, x3, y3; X{ X int i; X int dx, dy, cstep, nstep, lines, ploty, plotx; X void addcoord(); X X dx = x2 - x1; dy = y2 - y1; X X if(dy == 0) return; X X cstep = (y2>y1 ? 1 : -1); X nstep = (y3>y2 ? 1 : -1); X if(y3 == y2) nstep = 0; X X /* Build coordinate list */ X lines = abs(dy)/dinc + 1; X if(cstep == 1 && y1 > 0) X ploty = (y1/dinc + 1)*dinc; X else if (cstep == -1 && y1 < 0) X ploty = (y1/dinc - 1)*dinc; X else X ploty = (y1/dinc)*dinc; X X for(i=0; i<lines; i++) { X if(!betw(ploty,y1,y2)) break; X plotx = x1 + round(((float)(ploty-y1)*dx)/dy + .5); X /* Check for extremum at end point, otherwise add to coord list */ X if(!((ploty == y1) || (ploty == y2 && nstep != cstep))) X addcoord(plotx,ploty); X ploty += cstep*dinc; X } X} X Xvoid addcoord(x1, y1) Xint x1, y1; X{ X short *temp; X X if(bufferleng + 2 > buffersize) { X buffersize += 2*BINC; X temp = (short *)realloc((VOID *)buffer,buffersize*sizeof(short)); X if(!temp) { X free((VOID *)buffer); X plexit("Out of memory in plfill!"); X } X buffer = temp; X } X X buffer[bufferleng++] = x1; X buffer[bufferleng++] = y1; X} X Xint compare(pnum1, pnum2) Xchar *pnum1, *pnum2; X{ X struct point *pnt1, *pnt2; X X pnt1 = (struct point *)pnum1; X pnt2 = (struct point *)pnum2; X X if(pnt1->y < pnt2->y) X return(-1); X else if(pnt1->y > pnt2->y) X return(1); X X /* Only reach here if y coords are equal, so sort by x */ X if(pnt1->x < pnt2->x) X return(-1); X else if(pnt1->x > pnt2->x) X return(1); X X return(0); X} END_OF_FILE if test 5226 -ne `wc -c <'src/plfill.c'`; then echo shar: \"'src/plfill.c'\" unpacked with wrong size! fi # end of 'src/plfill.c' fi if test -f 'src/plzbx.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/plzbx.c'\" else echo shar: Extracting \"'src/plzbx.c'\" \(4379 characters\) sed "s/^X//" >'src/plzbx.c' <<'END_OF_FILE' X/* This draws a vertical line from (wx,wy1) to (wx,wy2) */ X/* which represents the vertical axis of a 3-d graph with data */ X/* values from "vmin" to "vmax". Depending on "opt", ticks and/or*/ X/* subticks are placed on the line at major tick interval "tick" */ X/* with "nsub" subticks between major ticks. If "tick" and/or */ X/* "nsub" is zero, automatic tick positions are computed */ X X/* B: Draws left-hand axis*/ X/* C: Draws right-hand axis*/ X/* I: Inverts tick marks (i.e. drawn to the left) */ X/* L: Logarithmic axes, major ticks at decades, minor ticks at units*/ X/* M: Write numeric label on right axis*/ X/* N: Write numeric label on left axis*/ X/* S: Draw minor tick marks */ X/* T: Draw major tick marks */ X/* U: Writes left-hand label*/ X/* V: Writes right-hand label*/ X X#include "plplot.h" X#include <stdio.h> X#include <math.h> X X#define betw(c,a,b) ((a <= c && c <= b) || (b <= c && c <= a)) X Xstatic PLFLT xlog[8] = X {0.301030,0.477121,0.602060,0.698970,0.778151,0.845098, X 0.903090,0.954243}; X Xvoid plzbx(opt,label,right,dx,dy,wx,wy1,wy2,vmin,vmax,tick,nsub) Xchar *opt, *label; XPLFLT dx, dy, wx, wy1, wy2, vmin, vmax, tick; XPLINT nsub, right; X{ X static char string[40]; X PLINT lb,lc,li,ll,lm,ln,ls,lt,lu,lv; X PLINT i, mode, prec; X PLINT nsub1; X PLFLT xpmm, ypmm, defmaj, defmin, tick1; X PLFLT pos, tn, tp, temp; X PLFLT dwy, lambda, diag, major, minor, xmajor, xminor; X PLFLT ymajor, yminor, dxm, dym, xscl, xoff, yscl, yoff; X X dwy = wy2 - wy1; X X /* Tick and subtick sizes in device coords */ X X gpixmm(&xpmm,&ypmm); X gmaj(&defmaj,&major); X gmin(&defmin,&minor); X X tick1=tick; X nsub1=nsub; X X lb=stsearch(opt,'b'); X lc=stsearch(opt,'c'); X li=stsearch(opt,'i'); X ll=stsearch(opt,'l'); X lm=stsearch(opt,'m'); X ln=stsearch(opt,'n'); X ls=stsearch(opt,'s'); X lt=stsearch(opt,'t'); X lu=stsearch(opt,'u'); X lv=stsearch(opt,'v'); X X if (lu && !right) X plztx("h",dx,dy,wx,wy1,wy2,(PLFLT)5.0,(PLFLT)0.5,(PLFLT)0.5,label); X if (lv && right) X plztx("h",dx,dy,wx,wy1,wy2,(PLFLT)-5.0,(PLFLT)0.5,(PLFLT)0.5,label); X X if (right && !lc) X return; X if (!right && !lb) X return; X X if (ll) X tick1 = (PLFLT)1.0; X if (lt) X pldtik(vmin,vmax,&tick1,&nsub1,&mode,&prec); X X if ( (li && !right) || (!li && right) ) { X minor = -minor; X major = -major; X } X X gwm(&xscl,&xoff,&yscl,&yoff); X dxm = dx * xscl; X dym = dy * yscl; X diag = sqrt(dxm*dxm + dym*dym); X X xminor = minor * dxm/diag; X xmajor = major * dxm/diag; X yminor = minor * dym/diag; X ymajor = major * dym/diag; X X /* Draw the line */ X X movwor(wx,wy1); X if (lt) { X tp=tick1*floor(vmin/tick1); X for(;;) { X tn=tp+tick1; X if (ls) { X if (ll) { X for (i=0; i <= 7; i++) { X temp=tp+xlog[i]; X if (betw(temp,vmin,vmax)) { X lambda = (temp-vmin)/(vmax-vmin); X plstik(wcmmx(wx),wcmmy((PLFLT)(wy1+lambda*dwy)),xminor,yminor); X } X } X } X else { X for (i=1; i<= nsub1-1; i++) { X temp=tp+i*tick1/nsub1; X if (betw(temp,vmin,vmax)) { X lambda = (temp-vmin)/(vmax-vmin); X plstik(wcmmx(wx),wcmmy((PLFLT)(wy1+lambda*dwy)),xminor,yminor); X } X } X } X } X temp=tn; X if (!betw(temp,vmin,vmax)) X break; X lambda = (temp-vmin)/(vmax-vmin); X plstik(wcmmx(wx),wcmmy((PLFLT)(wy1+lambda*dwy)),xmajor,ymajor); X tp=tn; X } X } X X drawor(wx,wy2); X X /* Label the line */ X X if (ln && lt) { X tp=tick1*floor(vmin/tick1); X for(tn=tp+tick1; betw(tn,vmin,vmax); tn+=tick1) { X if (!ll) X plform(tn,mode,prec,string); X else X sprintf(string,"10#u%d",round(tn)); X pos=(tn-vmin)/(vmax-vmin); X if (ln && !right) X plztx("v",dx,dy,wx,wy1,wy2,(PLFLT)0.5,pos,(PLFLT)1.0,string); X if (lm && right) X plztx("v",dx,dy,wx,wy1,wy2,(PLFLT)-0.5,pos,(PLFLT)0.0,string); X } X } X} END_OF_FILE if test 4379 -ne `wc -c <'src/plzbx.c'`; then echo shar: \"'src/plzbx.c'\" unpacked with wrong size! fi # end of 'src/plzbx.c' fi if test -f 'unix/dispatch.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'unix/dispatch.c'\" else echo shar: Extracting \"'unix/dispatch.c'\" \(6432 characters\) sed "s/^X//" >'unix/dispatch.c' <<'END_OF_FILE' X#include "plplot.h" X#include "dispatch.h" X Xvoid xtesetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid xteselect PLARGS((PLINT or, char *file)); Xvoid xteinit PLARGS((void)); Xvoid xteline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid xteclear PLARGS((void)); Xvoid xtepage PLARGS((void)); Xvoid xtetidy PLARGS((void)); Xvoid xtecolor PLARGS((PLINT color)); Xvoid xtetext PLARGS((void)); Xvoid xtegraph PLARGS((void)); Xvoid xtewidth PLARGS((PLINT width)); X Xvoid tektsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid tekfsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid tektselect PLARGS((PLINT or, char *file)); Xvoid tekfselect PLARGS((PLINT or, char *file)); Xvoid tektinit PLARGS((void)); Xvoid tekfinit PLARGS((void)); Xvoid tekline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid tektclear PLARGS((void)); Xvoid tekfclear PLARGS((void)); Xvoid tekpage PLARGS((void)); Xvoid tekttidy PLARGS((void)); Xvoid tekftidy PLARGS((void)); Xvoid tekcolor PLARGS((PLINT color)); Xvoid tektext PLARGS((void)); Xvoid tekgraph PLARGS((void)); Xvoid tekwidth PLARGS((PLINT width)); X Xvoid dgsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid dgselect PLARGS((PLINT or, char *file)); Xvoid dginit PLARGS((void)); Xvoid dgline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid dgclear PLARGS((void)); Xvoid dgpage PLARGS((void)); Xvoid dgtidy PLARGS((void)); Xvoid dgcolor PLARGS((PLINT color)); Xvoid dgtext PLARGS((void)); Xvoid dggraph PLARGS((void)); Xvoid dgwidth PLARGS((PLINT width)); X Xvoid hp7470setup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid hp7470select PLARGS((PLINT or, char *file)); Xvoid hp7470init PLARGS((void)); Xvoid hp7470line PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid hp7470clear PLARGS((void)); Xvoid hp7470page PLARGS((void)); Xvoid hp7470tidy PLARGS((void)); Xvoid hp7470color PLARGS((PLINT color)); Xvoid hp7470text PLARGS((void)); Xvoid hp7470graph PLARGS((void)); Xvoid hp7470width PLARGS((PLINT width)); X Xvoid hp7580setup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid hp7580select PLARGS((PLINT or, char *file)); Xvoid hp7580init PLARGS((void)); Xvoid hp7580line PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid hp7580clear PLARGS((void)); Xvoid hp7580page PLARGS((void)); Xvoid hp7580tidy PLARGS((void)); Xvoid hp7580color PLARGS((PLINT color)); Xvoid hp7580text PLARGS((void)); Xvoid hp7580graph PLARGS((void)); Xvoid hp7580width PLARGS((PLINT width)); X Xvoid impsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid impselect PLARGS((PLINT or, char *file)); Xvoid impinit PLARGS((void)); Xvoid impline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid impclear PLARGS((void)); Xvoid imppage PLARGS((void)); Xvoid imptidy PLARGS((void)); Xvoid impcolor PLARGS((PLINT color)); Xvoid imptext PLARGS((void)); Xvoid impgraph PLARGS((void)); Xvoid impwidth PLARGS((PLINT width)); X Xvoid jetsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid jetselect PLARGS((PLINT or, char *file)); Xvoid jetinit PLARGS((void)); Xvoid jetline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid jetclear PLARGS((void)); Xvoid jetpage PLARGS((void)); Xvoid jettidy PLARGS((void)); Xvoid jetcolor PLARGS((PLINT color)); Xvoid jettext PLARGS((void)); Xvoid jetgraph PLARGS((void)); Xvoid jetwidth PLARGS((PLINT width)); X Xvoid pssetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize)); Xvoid psselect PLARGS((PLINT or, char *file)); Xvoid psinit PLARGS((void)); Xvoid psline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2)); Xvoid psclear PLARGS((void)); Xvoid pspage PLARGS((void)); Xvoid pstidy PLARGS((void)); Xvoid pscolor PLARGS((PLINT color)); Xvoid pstext PLARGS((void)); Xvoid psgraph PLARGS((void)); Xvoid pswidth PLARGS((PLINT width)); X XDISPATCH_TABLE plDispatchTable[] = { X /* Xterm routines */ X { X /* This string appears in the device menu list. */ X "Xterm Window", X /* Page Setup routine */ X xtesetup, X /* Orientation and file name selection */ X xteselect, X /* Device initialization function pointer. */ X xteinit, X /* Function to draw line between two points */ X xteline, X /* Clear screen (or eject page) function. */ X xteclear, X /* New page set up. */ X xtepage, X /* Tidy up device (flush buffers, close file, etc.) */ X xtetidy, X /* Function to change pen color. */ X xtecolor, X /* Switch to text mode. */ X xtetext, X /* Switch to graphics mode. */ X xtegraph, X /* Set pen width */ X xtewidth X }, X { X "Tektronix Terminal", X tektsetup, X tektselect, X tektinit, X tekline, X tektclear, X tekpage, X tekttidy, X tekcolor, X tektext, X tekgraph, X tekwidth X }, X { X "DG300 Terminal", X dgsetup, X dgselect, X dginit, X dgline, X dgclear, X dgpage, X dgtidy, X dgcolor, X dgtext, X dggraph, X dgwidth X }, X { X "HP 7470 Plotter File (HPGL Cartridge, Small Plotter)", X hp7470setup, X hp7470select, X hp7470init, X hp7470line, X hp7470clear, X hp7470page, X hp7470tidy, X hp7470color, X hp7470text, X hp7470graph, X hp7470width X }, X { X "HP 7580 Plotter File (Large Plotter)", X hp7580setup, X hp7580select, X hp7580init, X hp7580line, X hp7580clear, X hp7580page, X hp7580tidy, X hp7580color, X hp7580text, X hp7580graph, X hp7580width X }, X { X "Impress File", X impsetup, X impselect, X impinit, X impline, X impclear, X imppage, X imptidy, X impcolor, X imptext, X impgraph, X impwidth X }, X { X "Tektronix File", X tekfsetup, X tekfselect, X tekfinit, X tekline, X tekfclear, X tekpage, X tekftidy, X tekcolor, X tektext, X tekgraph, X tekwidth X }, X { X "LaserJet II Bitmap File (150 dpi)", X jetsetup, X jetselect, X jetinit, X jetline, X jetclear, X jetpage, X jettidy, X jetcolor, X jettext, X jetgraph, X jetwidth X }, X { X "PostScript File", X pssetup, X psselect, X psinit, X psline, X psclear, X pspage, X pstidy, X pscolor, X pstext, X psgraph, X pswidth X } X}; X Xint npldrivers = (sizeof(plDispatchTable)/sizeof(struct dispatch_table)); END_OF_FILE if test 6432 -ne `wc -c <'unix/dispatch.c'`; then echo shar: \"'unix/dispatch.c'\" unpacked with wrong size! fi # end of 'unix/dispatch.c' fi if test -f 'unix/impress.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'unix/impress.c'\" else echo shar: Extracting \"'unix/impress.c'\" \(5079 characters\) sed "s/^X//" >'unix/impress.c' <<'END_OF_FILE' X/* This file contains the IMPRESS device dependent subroutines for */ X/* use with plplot. */ X X#include "plplot.h" X#include <stdio.h> X#include <limits.h> X X#define SET_HV_SYSTEM 0315 X#define OPBYTE1 031 X#define OPBYTE2 0140 X#define SET_ABS_H 0207 X#define SET_ABS_V 0211 X#define OPWORDH1 0 X#define OPWORDH2 150 X#define OPWORDV1 0 X#define OPWORDV2 150 X#define ENDPAGE 0333 X X#define BUFFPTS 50 X#define BUFFLENG 2*BUFFPTS X X#define IMPX 2999 X#define IMPY 2249 X Xstatic FILE *OutFile; Xstatic int porient; Xstatic short *LineBuff; Xstatic int select=0; Xchar FileName[80]; X Xvoid flushline(void); X Xvoid impsetup(xdpi,ydpi,xwid,ywid) XPLINT xwid, ywid; XPLFLT xdpi, ydpi; X{ X} X X/* Open file. Set up for graphics. */ Xvoid impinit() X{ X char response[80]; X int ori; X X smod(0); /* not an interactive terminal */ X scol(1); X swid(1); X setpxl(11.81,11.81); X X if(!select) { X printf("Landscape or portrait orientation? (0 or 1): "); X fgets(response,sizeof(response),stdin); X if(sscanf(response,"%d",&ori) != 1) X ori = 0; /* carriage return defaults to landscape */ X } X X porient = ori; X if(!porient) X setphy(0,IMPX,0,IMPY); X else X setphy(0,IMPY,0,IMPX); X X OutFile = NULL; X while(!OutFile) { X if(!select) { X printf("Enter graphics command storage file name. "); X fgets(response,sizeof(response),stdin); X if(sscanf(response,"%s",FileName) != 1) { X printf("Invalid entry.n"); X continue; X } X } X select = 0; X if ((OutFile = fopen(FileName,"w")) == NULL) X printf("Can't open %s.\n",FileName); X } X X LineBuff = (short *)malloc(BUFFLENG*sizeof(short)); X if(LineBuff == NULL) { X printf("\nError in memory alloc in impini().\n"); X exit(1); X } X fprintf(OutFile,"@Document(Language ImPress, jobheader off)"); X fprintf(OutFile,"%c%c",SET_HV_SYSTEM,OPBYTE1); X fprintf(OutFile,"%c%c%c",SET_ABS_H,OPWORDH1,OPWORDH2); X fprintf(OutFile,"%c%c%c",SET_ABS_V,OPWORDV1,OPWORDV2); X fprintf(OutFile,"%c%c",SET_HV_SYSTEM,OPBYTE2); X} X Xvoid impselect(ori,file) XPLINT ori; Xchar *file; X{ X porient = ori; X strncpy(FileName,file,sizeof(FileName)-1); X FileName[sizeof(FileName)-1] = '\0'; X select = 1; X} X X/* Sets the IMPRESS to text mode */ Xvoid imptext() X{ X} X X/* Sets the IMPRESS to graphics mode */ Xvoid impgraph() X{ X} X X/* Form feed */ Xvoid impclear() X{ X flushline(); X fprintf(OutFile,"%c",ENDPAGE); X} X Xstatic short FirstLine; X Xvoid imppage() X{ X FirstLine = 1; X} X X/* May put something here someday */ Xvoid impcolor(colour) XPLINT colour; X{ X} X X#define SET_PEN 0350 X Xstatic int penchange=0, penwidth; X Xvoid impwidth(width) XPLINT width; X{ X if(width>0 && width <= 20) { X penwidth = width; X penchange = 1; X } X} X X#define CREATE_PATH 0346 X#define DRAW_PATH 0352 X#define OPTYPE 017 X Xstatic short count; X Xvoid impline(x1a,y1a,x2a,y2a) XPLINT x1a,y1a,x2a,y2a; X{ X static int xold, yold; X int x1, y1, x2, y2; X X if(!porient) { X x1 = x1a; X y1 = y1a; X x2 = x2a; X y2 = y2a; X } X else { X x1 = IMPX - y1a; X y1 = x1a; X x2 = IMPX - y2a; X y2 = x2a; X } X X if(FirstLine) { X if(penchange) { X fprintf(OutFile,"%c%c",SET_PEN,(char)penwidth); X penchange = 0; X } X /* Add both points to path */ X count = 0; X FirstLine = 0; X *(LineBuff+count++) = (short)x1; X *(LineBuff+count++) = (short)y1; X *(LineBuff+count++) = (short)x2; X *(LineBuff+count++) = (short)y2; X } X else if((count+2) < BUFFLENG && x1 == xold && y1 == yold) { X /* Add new point to path */ X *(LineBuff+count++) = (short)x2; X *(LineBuff+count++) = (short)y2; X } X else { X /* Write out old path */ X count /= 2; X fprintf(OutFile,"%c%c%c",CREATE_PATH,(char)count/256,(char)count%256); X fwrite((char *)LineBuff,sizeof(short),2*count,OutFile); X fprintf(OutFile,"%c%c",DRAW_PATH,OPTYPE); X X /* And start a new path */ X if(penchange) { X fprintf(OutFile,"%c%c",SET_PEN,(char)penwidth); X penchange = 0; X } X count = 0; X *(LineBuff+count++) = (short)x1; X *(LineBuff+count++) = (short)y1; X *(LineBuff+count++) = (short)x2; X *(LineBuff+count++) = (short)y2; X } X X xold = x2; X yold = y2; X} X Xvoid flushline() X{ X count /= 2; X fprintf(OutFile,"%c%c%c",CREATE_PATH,(char)count/256,(char)count%256); X fwrite((char *)LineBuff,sizeof(short),2*count,OutFile); X fprintf(OutFile,"%c%c",DRAW_PATH,OPTYPE); X FirstLine = 1; X} X/* Close graphics file */ Xvoid imptidy() X{ X flushline(); X fprintf(OutFile,"%c",ENDPAGE); X free((char *)LineBuff); X fclose(OutFile); X select = 0; X} END_OF_FILE if test 5079 -ne `wc -c <'unix/impress.c'`; then echo shar: \"'unix/impress.c'\" unpacked with wrong size! fi # end of 'unix/impress.c' fi if test -f 'unix/laserjetii.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'unix/laserjetii.c'\" else echo shar: Extracting \"'unix/laserjetii.c'\" \(4262 characters\) sed "s/^X//" >'unix/laserjetii.c' <<'END_OF_FILE' X/* This file contains the Laser Jet II device dependent subroutines for */ X/* use with plplot. Only the 150 dpi mode is supported. The others */ X/* (75,100,300) should work by just changing the value of DPI and */ X/* changing the values passed to setphy in DEVICE.f77 */ X X#include "plplot.h" X#include <stdio.h> X#include <string.h> X#include <math.h> X X#define DPI 150 /* Resolution Dots per Inch */ X#define CURX 51 X#define CURY 61 X#define ESC 0x1b X#define FF 0x0c X#define XDOTS 1104 /* # dots across */ X#define YDOTS 1410 /* # dots down */ X#define BPROW XDOTS/8 /* # bytes across */ X#define NBYTES BPROW*YDOTS /* total number of bytes */ X X#define JETX 1409 X#define JETY 1103 X Xstatic FILE *OutFile; Xstatic int porient; Xstatic int select=0; Xchar FileName[80]; X X/* bitmap contains a pointer to an area of memory NBYTES in size */ Xstatic char *bitmap; X Xvoid jetsetup(xdpi, ydpi, xwid, ywid) XPLINT xwid, ywid; XPLFLT xdpi, ydpi; X{ X} X X/* Opens the file for binary mode. */ Xvoid jetinit() X{ X char response[80]; X int ori; X X smod(0); /* not an interactive terminal */ X scol(1); X swid(1); X setpxl(5.905,5.905); X X if(!select) { X printf("Landscape or portrait orientation? (0 or 1): "); X fgets(response,sizeof(response),stdin); X if(sscanf(response,"%d",&ori) != 1) X ori = 0; /* carriage return defaults to landscape */ X } X X porient = ori; X if(!porient) X setphy(0,JETX,0,JETY); X else X setphy(0,JETY,0,JETX); X X OutFile = NULL; X while(!OutFile) { X if(!select) { X printf("Enter graphics command storage file name. "); X fgets(response,sizeof(response),stdin); X if(sscanf(response,"%s",FileName) != 1) { X printf("Invalid entry.n"); X continue; X } X } X if ((OutFile = fopen(FileName,"w")) == NULL) X printf("Can't open %s.\n",FileName); X select = 0; X } X X /* Allocate storage for bit map matrix */ X if((bitmap = (char *)calloc(NBYTES,sizeof(char))) == NULL) X printf("Out of memory in call to calloc \n"); X X /* Reset Printer */ X fprintf(OutFile,"%cE",ESC); X} X Xvoid jetselect(ori,file) XPLINT ori; Xchar *file; X{ X porient = ori; X strncpy(FileName,file,sizeof(FileName)-1); X FileName[sizeof(FileName)-1] = '\0'; X select = 1; X} X X/* Set JET to test mode */ Xvoid jettext() X{ X /* do nothing here */ X} X X/* Set JET to graphics mode */ Xvoid jetgraph() X{ X /* Do nothing here */ X} X X/* Print out page */ Xvoid jetclear() X{ X int i,j; X X /* First move cursor to origin */ X fprintf(OutFile,"%c*p%dX",ESC,CURX); X fprintf(OutFile,"%c*p%dY",ESC,CURY); X X /* Then put Laser Printer in 150 dpi mode */ X fprintf(OutFile,"%c*t%dR",ESC,DPI); X fprintf(OutFile,"%c*r1A",ESC); X X /* Write out raster data */ X for(j=0;j<YDOTS;j++){ X fprintf(OutFile,"%c*b%dW",ESC,BPROW); X for(i=0;i<BPROW;i++) X putc(*(bitmap+i+j*BPROW),OutFile); X } X X /* End raster graphics and send Form Feed */ X fprintf(OutFile,"%c*rB",ESC); X fprintf(OutFile,"%c",FF); X X /* Finally, clear out bitmap storage area */ X memset(bitmap,'\0',NBYTES); X} X Xvoid jetpage() X{ X} X X/* Change color */ Xvoid jetcolor(colour) XPLINT colour; X{ X} X Xvoid jetwidth(width) XPLINT width; X{ X} X X/* Function to draw the line in the bitmap */ Xvoid jetline(x1a,y1a,x2a,y2a) XPLINT x1a,y1a,x2a,y2a; X{ X int i,x1,y1,x2,y2; X float length,fx,fy,dx,dy; X void setpoint(); X X if(!porient) { X x1 = x1a; X y1 = y1a; X x2 = x2a; X y2 = y2a; X } X else { X x1 = JETX - y1a; X y1 = x1a; X x2 = JETX - y2a; X y2 = x2a; X } X X length = (float)sqrt((double)((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))); X if(length == 0.) X length = 1.; X dx = (x2 - x1)/length; X dy = (y2 - y1)/length; X X fx = x1; X fy = y1; X setpoint(x1,y1); X setpoint(x2,y2); X X for(i=1;i<=(int)length;i++) X setpoint((int)(fx+=dx),(int)(fy+=dy)); X} X Xstatic char mask[8] = {'\200','\100','\040','\020','\010','\004','\002','\001'}; X X/* Function to set a bit in the bitmap */ Xstatic void setpoint(x,y) Xint x,y; X{ X int index; X index = x/8 + y*BPROW; X *(bitmap+index) = *(bitmap+index) | mask[x%8]; X} X X/* Reset printer and close file */ Xvoid jettidy() X{ X jetclear(); X /* Reset Printer */ X fprintf(OutFile,"%cE",ESC); X fclose(OutFile); X free((char *)bitmap); X} END_OF_FILE if test 4262 -ne `wc -c <'unix/laserjetii.c'`; then echo shar: \"'unix/laserjetii.c'\" unpacked with wrong size! fi # end of 'unix/laserjetii.c' fi echo shar: End of archive 5 \(of 12\). cp /dev/null ark5isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 12 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to: amiga@cs.odu.edu or amiga@xanth.cs.odu.edu ( obsolescent mailers may need this address ) or ...!uunet!xanth!amiga ( very obsolescent mailers need this address ) Comments, questions, and suggestions s should be addressed to ``amiga-request'' (only use ``amiga'' for submissions) at the above addresses.