hardcp_.c 644 141 22 1125 3755450424 5652 #include #include #include static char hardcopy[] = "screendump | lpr -v"; hardcp_() { int status, pid, w, (*istat)(), (*qstat)(); char *getenv(); if ((pid = vfork()) == 0) { execl("/bin/sh", "sh", "-c", getenv("HARDCOPY") ? getenv("HARDCOPY") : hardcopy, 0); _exit(127); } istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); while ((w = wait((union wait *)&status)) != pid && w != -1) ; signal(SIGINT, istat); signal(SIGQUIT, qstat); if (w == -1 || status != 0) fprintf(stderr, " Hard copy error status: %d\n", status); }  DISK.INFO.Z 4F05READMEeT>Æpam´À aeb.plas5.h1(Ä›Lksg.oldÔVÎOS4.0.1àm.plsü|¤ vgr.leverrier.h1})³Œsjs˜¬Rkip¤J.Z°K¼L¬ÈM¤ÔNogàOìP}0G¶aeb“äjcq8 README.leverrier.h1DÛvecT^|plsplslllout_.c 644 141 22 7573 5226372322 5560 /* Tue Jul 7 15:47:29 EDT 1992 /leverrier/h1/ksg/src/test llout_.c */ /* llout_ps.c this file includes routines to make a postscript file out of the plots and to send them for printing. */ #include static float xmin=0.,xmax=12.0,ymin=0.,ymax=8.55,mx0=100,my0=100; static float ax=2450.,ay=3300.; static float ax0=2450.,ay0=3300.; static float a00=1.0; static int ic = -1,jf=0; static int lport=0; /* 0 => landscape, 1 => portrait */ static char name[80],*tempfilename=".temp.plot.file.0987654321..." ; static FILE *filename; static int ipage; static int new_org=0; static int anycolor=0; lloutc_( x0,x2,y0,y2) float *x0,*x2,*y0,*y2; { xmin = *x0; xmax = *x2; ymin = *y0; ymax = *y2; } llout_( itype, x, y, npen) int *itype,*npen; float *x, *y; { int mx,my,ipen; /* fprintf(stderr," inside llout itype = %d npen = %d\n",*itype,*npen); */ if ( *npen == 999) { /* finish the plot and send for printing */ exx(); } if ( *itype == 2 ) { /* change a pen */ if ( anycolor == 0 ) fprintf(filename," %d setpen\n",*npen); else fprintf(filename," %d setpen\n", 0); } if ( *itype == 3 ) { /* set landscape etc. */ lport = *npen; return(0); } if ( *itype == 4) { ipage++; fprintf(filename,"\n showpage \n"); fprintf(filename,"\n%%%%Page:%d %d \n restore \n save \n", ipage,ipage); if ( *npen == 0) { /* erase old data */ fclose(filename); } else if ( *npen == 1) /* print file on laser */ exx(); else if ( *npen == 2) { /* just write file */ fclose(filename); } return(0); } if ( *itype == 5) { ipage++; new_org = 0; fprintf(filename,"\n%% NEW_ORG \n"); fprintf(filename,"\n showpage \n"); fprintf(filename,"\n%%%%Page:%d %d \n restore \n save \n", ipage,ipage); return(0); } if ( *itype == 6) { new_org = 0; fprintf(filename,"\n%% NEW_ORG \n"); fprintf(filename,"\n%% NEW_ORG \n"); return(0); } if ( ic == -1) { ic = 0; ax = ax0 - 2*mx0; ay = ay0 - 2*my0; } if (*itype == 2 ) return(0); if (( *x < xmin) || ( *x > xmax)) return(1); if (( *y < ymin) || ( *y > ymax)) return(1); if ( lport == 1) { mx = ax*( *x - xmin)/(xmax - xmin) + mx0; my = ay*( *y - ymin)/(ymax - ymin) + my0; } else { my = ay*( *x - xmin)/(xmax - xmin) + my0; mx = ax*(a00 - ( *y - ymin)/(ymax - ymin)) + mx0; } ipen = ( *npen > 0) ? *npen : -*npen; ipen %= 10; if ( new_org == 0 ) { new_org++; fprintf(filename,"\n%% new_org \n"); fprintf(filename,"\n%% new_org \n"); /* */ fprintf(filename," stroke %d %d moveto \n",mx,my); } if ( ipen == 3 ) { fprintf(filename," stroke %d %d moveto \n",mx,my); } else { fprintf(filename," %d %d lineto \n",mx,my); } } llchpn_( ipen) int *ipen; { if ( *ipen == -100 ) anycolor ^= 1; } static exx() { int ii; char cmd[80]; fprintf(filename,"\n stroke\n"); fclose(filename); sprintf(cmd,"/usr/ucb/lpr %s\n",tempfilename); /* sprintf(cmd,"/plas5/h1/vgr/plt_prt/print %s\n",tempfilename); */ if ((ii = system( cmd )) != 0 ) fprintf( stderr, " system returned error %d \n", ii); ic = -1; } void getplotname_() { /* get the plot name */ fprintf(stderr, "\nWhat name do you wish the plot be called ( - don't save)?"); (void) gets(name); /* now rename the file to the requested name */ if ( *name && rename(tempfilename,name)) { fprintf(stderr,"\n problems in saving the plot file.quitting\n"); exit(1); } } void opentempplotfile_() { /* open a temporary file for the plots */ if ((filename = fopen(tempfilename,"w")) == NULL) { fprintf(stderr,"\n problems in opening temporary file.quitting.\n"); exit(1); } fprintf( filename,"%%!\n\%%%%Page: 1 1\n\ /setpen {\n\ 0.6 mul setlinewidth\n\ } def\n\ 0.25 0.25 scale\n"); if ( lport == 0 ) fprintf( filename,"0 -50 translate\n"); fprintf( filename," save \n"); ipage = 1; new_org = 0; } void closetempplotfile() { /* close the temporary file for the plots */ fclose(filename); } lout.c 644 141 22 2456 4226500206 5231 /* Wed Apr 6 14:58:33 EDT 1988 /usr4/gsg/src/test lout.c */ #include #include #define MAXBUF 2048 static unsigned int buf[ MAXBUF], itemp; static int n1=MAXBUF,n2=MAXBUF; static int ic = -1,jf=0; static int fid; lout_( itype, x, y, npen) int *itype,*npen; long float *x, *y; { int mx,my; static unsigned int imove=0x80000000,idraw=0x8000,ipage=0x80008000,iend=0xffffffff; int pid,flags,ipen; char name[256]; float ai=1300.; static unsigned int mode=0x644; static long float xmin=0.,xmax=11.,ymin=0.,ymax=8.0; if ( ic == -1) { pid = getpid(); sscanf(name,"/tmp/laser%x.%xvec\0",pid,++jf); flags = O_CREAT & O_WRONLY ; if ((fid=open( name, flags, mode)) == -1) perror( name, exit(1)); ic = 0; } if (*itype == 2 ) return(0); if (( *x < xmin) || ( *x > xmax)) return(1); if (( *y < ymin) || ( *y > ymax)) return(1); mx = ai*( *x - xmin)/(xmax - xmin); my = ai*( *y - ymin)/(ymax - ymin); ipen = ( *npen > 0) ? *npen : -*npen; itemp = 0; itemp = mx; itemp <<= 16; itemp |= my; itemp |= ( ipen == 3) ? imove : idraw; buf[ic++] = itemp; if ( ic >= MAXBUF) pushbuf(); if ( npen < 0) buf[ic++] = ipage; if ( ic >= MAXBUF) pushbuf(); if ( ipen == 999) { buf[ic++] = iend; pushbuf(); close( fid); } return; } pushbuf() { n1 = 4*ic; write( fid, &n1, 4); write( fid, buf, n1); write( fid, &n1, 4); } ( *npen == 0) { /* erase old data */ fclose(filename); } else if ( *npen == 1) /* print file on laser */ exx(); else if ( *npen == 2) { /* just write file */ fclose(filename); } return(0); == -1 || status != 0) fprintf(stderr, " Hard copy error status: %d\n", status); }  DISK.INFO.Z 4F05READMEeT>Æpam´À aeb.plas5.h1(Ä›Lksg.oldÔVÎOS4.0.1àm.plsü|¤ vgr.leverrier.h1})³Œsjs˜¬Rkip¤J.Z°K¼L¬ÈM¤ÔNogàOìP}0G¶aeb“äjcq8 README.leverrier.h1DÛvecT^|plsplslllout_.c 644 141 22 7573 5226372322 5560 /* Tue Jul 7 15:47:29 EDT 1992 /leverrier/h1/ksg/src/test llout_.c */ /* llout_ps.c this file includes routines to make a postscript file out of the plots and to send them for printing. */ #include static float xmin=0.,xmax=12.0,ymin=0.,ymax=8.55,mx0=100,my0=100; static float ax=2450.,ay=3300.; static float ax0=2450.,ay0=3300.; static float a00=1.0; static int ic = -1,jf=0; static int lport=0; /* 0 => landscape, 1 => portrait */ static char name[80],*tempfilename=".temp.plot.file.0987654321..." ; static FILE *filename; static int ipage; static int new_org=0; static int anycolor=0; lloutc_( x0,x2,y0,y2) float *x0,*x2,*y0,*y2; { xmin = *x0; xmax = *x2; ymin = *y0; ymax = *y2; } llout_( itype, x, y, npen) int *itype,*npen; float *x, *y; { int mx,my,ipen; /* fprintf(stderr," inside llout itype = %d npen = %d\n",*itype,*npen); */ if ( *npen == 999) { /* finish the plot and send for printing */ exx(); } if ( *itype == 2 ) { /* change a pen */ if ( anycolor == 0 ) fprintf(filename," %d setpen\n",*npen); else fprintf(filename," %d setpen\n", 0); } if ( *itype == 3 ) { /* set landscape etc. */ lport = *npen; return(0); } if ( *itype == 4) { ipage++; fprintf(filename,"\n showpage \n"); fprintf(filename,"\n%%%%Page:%d %d \n restore \n save \n", ipage,ipage); if ( *npen == 0) { /* erase old data */ fclose(filename); } else if ( *npen == 1) /* print file on laser */ exx(); else if ( *npen == 2) { /* just write file */ fclose(filename); } return(0); } if ( *itype == 5) { ipage++; new_org = 0; fprintf(filename,"\n%% NEW_ORG \n"); fprintf(filename,"\n showpage \n"); fprintf(filename,"\n%%%%Page:%d %d \n restore \n save \n", ipage,ipage); return(0); } if ( *itype == 6) { new_org = 0; fprintf(filename,"\n%% NEW_ORG \n"); fprintf(filename,"\n%% NEW_ORG \n"); return(0); } if ( ic == -1) { ic = 0; ax = ax0 - 2*mx0; ay = ay0 - 2*my0; } if (*itype == 2 ) return(0); if (( *x < xmin) || ( *x > xmax)) return(1); if (( *y < ymin) || ( *y > ymax)) return(1); if ( lport == 1) { mx = ax*( *x - xmin)/(xmax - xmin) + mx0; my = ay*( *y - ymin)/(ymax - ymin) + my0; } else { my = ay*( *x - xmin)/(xmax - xmin) + my0; mx = ax*(a00 - ( *y - ymin)/(ymax - ymin)) + mx0; } ipen = ( *npen > 0) ? *npen : -*npen; ipen %= 10; if ( new_org == 0 ) { new_org++; fprintf(filename,"\n%% new_org \n"); fprintf(filename,"\n%% new_org \n"); /* */ fprintf(filename," stroke %d %d moveto \n",mx,my); } if ( ipen == 3 ) { fprintf(filename," stroke %d %d moveto \n",mx,my); } else { fprintf(filename," %d %d lineto \n",mx,my); } } llchpn_( ipen) int *ipen; { if ( *ipen == -100 ) anycolor ^= 1; } static exx() { int ii; char cmd[80]; fprintf(filename,"\n stroke\n"); fclose(filename); sprintf(cmd,"/usr/ucb/lpr %s\n",tempfilename); /* sprintf(cmd,"/plas5/h1/vgr/plt_prt/print %s\n",tempfilename); */ if ((ii = system( cmd )) != 0 ) fprintf( stderr, " system returned error %d \n", ii); ic = -1; } void getplotname_() { /* get the plot name */ fprintf(stderr, "\nWhat name do you wish the plot be called ( - don't save)?"); (void) gets(name); /* now rename the file to the requested name */ if ( *name && rename(tempfilename,name)) { fprintf(stderr,"\n problems in saving the plot file.quitting\n"); exit(1); } } void opentempplotfile_() { /* open a temporary file for the plots */ if ((filename = fopen(tempfilename,"w")) == NULL) { fprintf(stderr,"\n problems in opening temporary file.quitting.\n"); exit(1); } fprintf( filename,"%%!\n\%%%%Page: 1 1\n\ /setpen {\n\ 0.6 mul setlinewidth\n\ } def\n\ 0.25 0.25 scale\n"); if ( lport == 0 ) fprintf( filename,"0 -50 translate\n"); fprintf( filename," save \n"); ipage = 1; new_org = 0; } void closetempplotfile() { /* close the temporary file for the plots */ fclose(filename); } lout.c 644 141 22 2456 4226500206 5231 /* Wed Apr 6 14:58:33 EDT 1988 /usr4/gsg/src/test lout.c */ #include #include #define MAXBUF 2048 static unsigned int buf[ MAXBUF], itemp; static int n1=MAXBUF,n2=MAXBUF; static int ic = -1,jf=0; static int fid; lout_( itype, x, y, npen) int *itype,*npen; long float *x, *y; { int mx,my; static unsigned int imove=0x80000000,idraw=0x8000,ipage=0x80008000,iend=0xffffffff; int pid,flags,ipen; char name[256]; float ai=1300.; static unsigned int mode=0x644; static long float xmin=0.,xmax=11.,ymin=0.,ymax=8.0; if ( ic == -1) { pid = getpid(); sscanf(name,"/tmp/laser%x.%xvec\0",pid,++jf); flags = O_CREAT & O_WRONLY ; if ((fid=open( name, flags, mode)) == -1) perror( name, exit(1)); ic = 0; } if (*itype == 2 ) return(0); if (( *x < xmin) || ( *x > xmax)) return(1); if (( *y < ymin) || ( *y > ymax)) return(1); mx = ai*( *x - xmin)/(xmax - xmin); my = ai*( *y - ymin)/(ymax - ymin); ipen = ( *npen > 0) ? *npen : -*npen; itemp = 0; itemp = mx; itemp <<= 16; itemp |= my; itemp |= ( ipen == 3) ? imove : idraw; buf[ic++] = itemp; if ( ic >= MAXBUF) pushbuf(); if ( npen < 0) buf[ic++] = ipage; if ( ic >= MAXBUF) pushbuf(); if ( ipen == 999) { buf[ic++] = iend; pushbuf(); close( fid); } return; } pushbuf() { n1 = 4*ic; write( fid, &n1, 4); write( fid, buf, n1); write( fid, &n1, 4); } ( *npen == 0) { /* erase old data */ fclose(filename); } else if ( *npen == 1) /* print file on laser */ exx(); else if ( *npen == 2) { /* just write file */ fclose(filename); } return(0);