#include <stdlib.h>#include <string.h>#include <ctype.h>#include <stdio.h>#include "util.h"Include dependency graph for Slpr.c:

Go to the source code of this file.
Functions | |
| static void | Sed (char *, char *, char *, char *, char *, char *, char *) |
| static void | ComputeSize (int num, int i, double *, double *, double *, double *) |
| int | main (int argc, char **argv) |
Variables | |
| char * | UsageStr [] |
| char | entete [160] |
Definition at line 169 of file Slpr.c.
00170 { 00171 switch (num) 00172 { 00173 case 1 : 00174 *x=3.0;*y=24.0;*h=20.0;*w=15.0; 00175 break; 00176 case 2 : 00177 *x=3.0;*y=(24-(i-1)*11);*h=10.0;*w=15.0; 00178 break; 00179 case 3 : 00180 *x=3.0;*y=(26.5-(i-1)*8.5);*h=8.0;*w=15.0; 00181 break; 00182 case 4 : 00183 if (i <= 2) *y=24.0;else *y=24-11.0; 00184 if ( (i % 2 ) == 0 ) 00185 { *x= 2+8.5;*h=8.0;*w=8.0;} 00186 else 00187 {*x= 2.0;*h=8.0;*w=8.0;} 00188 break ; 00189 case 5 : 00190 case 6 : 00191 if (i <= 2) *y=26.0;else { if ( i <= 4) *y=26-8.5; else *y=26-2*8.5;} 00192 if ( (i % 2 ) == 0 ) 00193 { *x= 2+8.5;*h=7.5;*w=8.0;} 00194 else 00195 {*x= 2.0;*h=7.5;*w=8.0;} 00196 break ; 00197 case 7 : 00198 case 8 : 00199 case 9 : 00200 if (i <= 3) *y=26.0;else { if ( i <= 6) *y=26-8.5; else *y=26-2*8.5;} 00201 if ( (i % 3 ) == 0 ) 00202 { *x= 1.5+2*6;*h=7.5;*w=5.5;} 00203 else 00204 { 00205 if ( (i % 3 ) == 1 ) 00206 { *x= 1.5;*h=7.5;*w=5.5;} 00207 else 00208 {*x= 1.5+6 ;*h=7.5;*w=5.5;} 00209 } 00210 break ; 00211 case 10 : 00212 case 11 : 00213 case 12 : 00214 default : 00215 if (i <= 3) *y=27.0; 00216 else { 00217 if ( i <= 6) *y=27-6.5; 00218 else { 00219 if (i <= 9 ) *y=27-2*6.5; else *y=27-3*6.5;} 00220 } 00221 if ( (i % 3 ) == 0 ) 00222 { *x= 1.5+2*6;*h=6;*w=5.5;} 00223 else 00224 { 00225 if ( (i % 3 ) == 1 ) 00226 { *x= 1.5;*h=6.0;*w=5.5;} 00227 else 00228 {*x= 1.5+6 ;*h=6.0;*w=5.5;} 00229 } 00230 break ; 00231 } 00232 }
Definition at line 50 of file Slpr.c.
References buf, ComputeSize(), entete, env, fd, getenv(), h, i, NULL, SciEnv(), Sed(), UsageStr, w, x, and y.
00051 { 00052 char *env; 00053 double x,y,w,h; 00054 char buf[256]; 00055 int i ; 00056 FILE *fd; 00057 #if defined(freebsd) || defined(netbsd) 00058 fpsetmask(0); 00059 #endif 00060 if (argc <= 2) { int i=0; 00061 while (strcmp(UsageStr[i],"fin")!=0) 00062 { 00063 fprintf(stderr,"%s",UsageStr[i]),i++; 00064 } 00065 exit(0); 00066 } 00067 #ifdef _MSC_VER 00068 SciEnv(); 00069 #endif 00070 env = getenv("SCI"); 00071 if (env == NULL) { 00072 fprintf(stderr,"Environment variable SCI must be defined\n"); 00073 exit(0); 00074 } 00075 sprintf(entete,"%s/tools/printer/NperiPos.ps",env); 00076 fd=fopen(entete,"r"); 00077 if (fd != 0) 00078 { int c; 00079 while ( (c=getc(fd)) != EOF) putc((char) c,stdout); 00080 fclose(fd); 00081 } 00082 else 00083 { 00084 fprintf(stderr,"file %s not found ",entete); 00085 return(1); 00086 } 00087 fprintf(stdout,"/Times-Roman findfont 14 scf mul scalefont setfont\n"); 00088 fprintf(stdout,"100 780 moveto ( %s ) show\n",argv[1]); 00089 for ( i = 2 ; i < argc-1 ; i++) 00090 { 00091 ComputeSize(argc-2,i-1,&x,&y,&w,&h) ; 00092 sprintf(buf,"gsave [1 0 0 -1 0 0] concat %5.2f %5.2f %5.2f %5.2f DesPosi" 00093 ,x,y,w,h); 00094 Sed(argv[i],"[0.5 10 div 0 0 0.5 10 div neg 0 2120 10 div] concat", 00095 buf," showpage","grestore", 00096 " end saved restore","% end saved restore"); 00097 } 00098 ComputeSize(argc-2,argc-2,&x,&y,&w,&h); 00099 sprintf(buf,"gsave [1 0 0 -1 0 0] concat %5.2f %5.2f %5.2f %5.2f DesPosi" 00100 ,x,y,w,h); 00101 Sed(argv[argc-1],"[0.5 10 div 0 0 0.5 10 div neg 0 2120 10 div] concat", 00102 buf, " showpage"," grestore showpage", 00103 " end saved restore"," end saved restore"); 00104 return(0); 00105 }
Here is the call graph for this function:

| static void Sed | ( | char * | , | |
| char * | , | |||
| char * | , | |||
| char * | , | |||
| char * | , | |||
| char * | , | |||
| char * | ||||
| ) | [static] |
Definition at line 113 of file Slpr.c.
References buflen, fd, malloc(), NULL, and read_one_line().
00114 { 00115 FILE *fd; 00116 00117 static char *buff = NULL; 00118 static int buflen = 512; 00119 if ( buff == NULL) 00120 { 00121 buff = malloc(buflen*sizeof(char)); 00122 if ( buff == NULL) 00123 { 00124 fprintf(stderr,"Running out of space \n"); 00125 exit(1); 00126 } 00127 } 00128 00129 fd=fopen(file,"r"); 00130 if (fd != 0) 00131 { int stop=0; 00132 while ( stop != 1) 00133 { 00134 read_one_line (&buff,&stop,fd,&buflen); 00135 if (strncmp(buff,strin1,strlen(strin1))==0) 00136 fprintf(stdout,"%s\n",strout1); 00137 else 00138 { 00139 if (strncmp(buff,strin2,strlen(strin2))==0) 00140 fprintf(stdout,"%s\n",strout2); 00141 else 00142 { 00143 if (strncmp(buff,strin3,strlen(strin3))==0) 00144 fprintf(stdout,"%s\n",strout3); 00145 else 00146 fprintf(stdout,"%s",buff); 00147 } 00148 } 00149 } 00150 fclose(fd); 00151 } 00152 else 00153 { 00154 fprintf(stderr,"file %s not found ",file); 00155 return; 00156 } 00157 }
Here is the call graph for this function:

| char* UsageStr[] |
Initial value:
{
"Usage : Blpr Title file1 ... filen | lpr \n",
" : Blpr Title file1 ... filen > fileres \n",
"\tfile1, ... filen : are n Postscript files produced by Scilab\n",
"\tfileres : a file name for the result \n",
"\ttitle : a string for title\n",
"\tThis command print n Postscript files produced by Scilab on a\n",
"\tsingle page with a title Title\n",
"fin"}
1.5.1