This is hp7580.c in view mode; [Download] [Up]
/* This file contains the IMPRESS device dependent subroutines for */ /* use with plplot. */ #include "plplot.h" #include <stdio.h> #define HPXMIN -4500 #define HPXMAX 4500 #define HPYMIN -2790 #define HPYMAX 2790 #define ESC 27 static FILE *OutFile=NULL; static int porient=0; static int fileopen=0; void hp7580setup(xdpi,ydpi,xwid,ywid) int xwid, ywid; double xdpi, ydpi; { } /* Open file. Set up for graphics. */ void hp7580init() { char response[80]; smod(0); /* not an interactive terminal */ scol(1); swid(1); setpxl(40.,40.); if(!porient) setphy(HPXMIN,HPXMAX,HPYMIN,HPYMAX); else setphy(HPYMIN,HPYMAX,HPXMIN,HPXMAX); while(!OutFile) { printf("Enter graphics command storage file name. "); fgets(response,sizeof(response),stdin); response[strlen(response)-1] = '\0'; if (!(OutFile = fopen(response,"w"))) fprintf(stderr,"Can't open %s.\n",response); else fileopen = 1; } fprintf(OutFile,"%c.I200;;17:%c.N;19:%c.M;;;10:in;\n",ESC,ESC,ESC); fprintf(OutFile,"ro 90;ip;sp 4;pa;"); } void hp7580orient(orient) int orient; { porient = orient; } void hp7580select(file) FILE *file; { OutFile = file; } /* Sets to text mode */ void hp7580text() { } /* Sets the IMPRESS to graphics mode */ void hp7580graph() { } /* Form feed */ void hp7580clear() { } static int xold, yold; void hp7580page() { xold = -100000; yold = -100000; } void hp7580eop() { fflush(OutFile); } /* May put something here someday */ void hp7580color(colour) int colour; { if(colour<1 || colour>8) fprintf(stderr,"\nInvalid pen selection."); else fprintf(OutFile,"sp%d\n",colour); } void hp7580width(width) int width; { } void hp7580line(x1,y1,x2,y2) int x1,y1,x2,y2; { if(!porient) { if(x1 == xold && y1 == yold) /* Add new point to path */ fprintf(OutFile," %d %d",x2,y2); else /* Write out old path */ fprintf(OutFile,"\npu%d %d pd%d %d",x1,y1,x2,y2); } else { if(x1 == xold && y1 == yold) /* Add new point to path */ fprintf(OutFile," %d %d",-y2,x2); else /* Write out old path */ fprintf(OutFile,"\npu%d %d pd%d %d",-y1,x1,-y2,x2); } xold = x2; yold = y2; } /* Close graphics file */ void hp7580tidy() { fprintf(OutFile,"\nsp0"); if(fileopen) fclose(OutFile); } void hp7580cwin() { } void hp7580gwin() { }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.