Doxygen Source Code Documentation
plot_ps.c File Reference
#include <stdio.h>#include <time.h>#include <math.h>#include <string.h>Go to the source code of this file.
Defines | |
| #define | M_PI 3.14159265358979323846 |
Functions | |
| void | ps_move (int, int) |
| void | ps_line (int, int, int, int) |
| void | ps_cont (int, int) |
| void | ps_point (int, int) |
| void | ps_label (char *) |
| void | ps_arc (int, int, int, int, int, int) |
| void | ps_circle (int, int, int) |
| void | ps_erase (void) |
| void | ps_linemod (char *) |
| void | ps_space (int, int, int, int) |
| int | ps_openpl (char *) |
| void | ps_closepl (void) |
| void | ps_setrgb (float, float, float) |
| void | ps_setwidth (float) |
| void | ps_rect (int, int, int, int) |
| void | zzpsco_ (float *, float *, float *) |
| void | zzpsop_ (char *cfl, int ncfl) |
| void | zzpsli_ (int *, int *, int *, int *) |
| void | zzpsfr_ (void) |
| void | zzpscl_ (void) |
| void | ps_maybe_stroke (void) |
| void | ps_stroke (void) |
| int | ps_setfont (void) |
| void | ps_prolog (void) |
| void | ps_epilog (void) |
| void | ps_clear (void) |
Variables | |
| int | font |
| int | error |
| int | npages = 0 |
| int | cx |
| int | cy |
| int | ttcur = 0 |
| int | atcur = 0 |
| int | inpath = 0 |
| int | plot = 0 |
| double | scal = 1.0 |
| int | prolog_not_output = 1 |
| FILE * | psfile = NULL |
| int | psfile_ispipe = 0 |
| char * | prolog_text [] |
Define Documentation
|
|
Definition at line 137 of file plot_ps.c. Referenced by ps_arc(). |
Function Documentation
|
||||||||||||||||||||||||||||
|
Definition at line 140 of file plot_ps.c. References atcur, inpath, M_PI, plot, ps_stroke(), psfile, x2, and y1.
00141 { double dx , dy ;
00142
00143 if (inpath) ps_stroke() ;
00144 dx=x1-x;
00145 dy=y1-y;
00146 fprintf( psfile , "%d %d %f ", x, y, sqrt(dx*dx+dy*dy) );
00147 fprintf( psfile , "%f ", (double)(atan2(dy,dx)/M_PI)*180.0 );
00148 dx=x2-x;
00149 dy=y2-y;
00150 fprintf( psfile , "%f ", (double)(atan2(dy,dx)/M_PI)*180.0 );
00151 plot=1;
00152 atcur=inpath=0;
00153 }
|
|
||||||||||||||||
|
Definition at line 155 of file plot_ps.c. References plot, psfile, and r.
|
|
|
Definition at line 298 of file plot_ps.c. References atcur, inpath, npages, plot, ps_stroke(), psfile, and ttcur. Referenced by ps_epilog(), and ps_erase().
|
|
|
Definition at line 251 of file plot_ps.c. References pclose, ps_epilog(), psfile, and psfile_ispipe.
00252 { ps_epilog();
00253
00254 if( psfile == stdout ){ /* 29 Nov 2002: don't close stdout */
00255 fflush(psfile) ; /* just flush it */
00256 } else {
00257 if( ! psfile_ispipe ) fclose(psfile) ;
00258 else pclose(psfile) ; /* RWCox */
00259 }
00260
00261 psfile = NULL ; psfile_ispipe = 0 ;
00262 }
|
|
||||||||||||
|
Definition at line 85 of file plot_ps.c. References atcur, cx, cy, inpath, plot, ps_maybe_stroke(), ps_move(), psfile, and ttcur.
|
|
|
Definition at line 310 of file plot_ps.c. References npages, ps_clear(), and psfile. Referenced by ps_closepl().
|
|
|
Definition at line 160 of file plot_ps.c. References ps_clear().
00161 { ps_clear() ; }
|
|
|
Definition at line 118 of file plot_ps.c. References atcur, c, cx, cy, font, inpath, plot, ps_setfont(), ps_stroke(), psfile, putchar, and ttcur.
00119 { int is ;
00120 char c ;
00121
00122 if (inpath) ps_stroke() ;
00123 if (!ttcur) fprintf( psfile , "%d %d M\n",cx,cy);
00124 if (!font) font=ps_setfont();
00125 fprintf( psfile , "(");
00126 for( is=0,c=s[is] ; (c!='\0')&&(c!='\n') ; ++is,c=s[is] )
00127 {
00128 if (c=='(' || c==')' || c=='\\')putchar('\\');
00129 putchar(c);
00130 }
00131 fprintf( psfile , ") T\n");
00132 ttcur=plot=1;
00133 atcur=inpath=0;
00134 }
|
|
||||||||||||||||||||
|
Definition at line 77 of file plot_ps.c. References ps_cont(), and ps_move().
|
|
|
Definition at line 166 of file plot_ps.c. References ps_stroke(), psfile, and scal.
00167 { double pt ;
00168 pt = 1.0 / scal ;
00169
00170 if (inpath) ps_stroke() ; /* draw anything specified before setdash */
00171
00172 if (strncmp(s,"solid",5) == 0) {
00173 fprintf( psfile , "[] 0 setdash\n") ;
00174 } else if( strncmp(s,"dotted",6) == 0 ) {
00175 fprintf( psfile , "[ %f %f ] 0 setdash\n" , 2.0*pt , 3.0*pt ) ;
00176 } else if( strncmp(s,"dotdashed",9) == 0 ) {
00177 fprintf( psfile , "[ %f %f %f %f ] 0 setdash\n" ,
00178 2.0*pt , 3.0*pt , 6.0*pt , 3.0*pt ) ;
00179 } else if( strncmp(s,"shortdashed",11) == 0 ) {
00180 fprintf( psfile , "[ %f %f ] 0 setdash\n" , 6.0*pt , 3.0*pt ) ;
00181 } else if( strncmp(s,"longdashed",10) == 0 ) {
00182 fprintf( psfile , "[ %f %f ] 0 setdash\n" , 9.0*pt , 4.5*pt ) ;
00183 } else {
00184 fprintf(stderr,
00185 "plotps: linestyle '%s' not implemented.\n",s);
00186 fprintf( psfile , "[] 0 setdash\n") ;
00187 }
00188 }
|
|
|
Definition at line 63 of file plot_ps.c. References inpath, and ps_stroke(). Referenced by ps_cont().
|
|
||||||||||||
|
Definition at line 69 of file plot_ps.c. References atcur, cx, cy, and ttcur.
|
|
|
Definition at line 222 of file plot_ps.c. References popen, ps_prolog(), psfile, and psfile_ispipe.
00223 {
00224 if( strcmp(fname,"-") == 0 ){ /* 29 Nov 2002: to stdout */
00225 psfile = stdout ;
00226 psfile_ispipe = 0 ;
00227 } else if( fname[0] != '|' ){ /* normal file */
00228 psfile = fopen( fname , "w" ) ;
00229 psfile_ispipe = 0 ;
00230 } else { /* open a pipe */
00231 psfile = popen( fname+1 , "w" ) ;
00232 psfile_ispipe = 1 ;
00233 }
00234 if( psfile == NULL ) return 0 ;
00235 ps_prolog();
00236 return 1 ;
00237 }
|
|
||||||||||||
|
Definition at line 110 of file plot_ps.c. References atcur, cx, cy, inpath, plot, ps_move(), ps_stroke(), psfile, and ttcur.
|
|
|
Definition at line 286 of file plot_ps.c. References font, p, prolog_not_output, prolog_text, psfile, and tt. Referenced by ps_openpl(), and ps_space().
|
|
||||||||||||||||||||
|
Definition at line 96 of file plot_ps.c. References ps_stroke(), psfile, x2, and y1.
00097 {
00098 if( inpath ) ps_stroke() ;
00099 fprintf( psfile , "NP ");
00100 fprintf( psfile , "%d %d M ",x1,y1);
00101 fprintf( psfile , "%d %d N ",x2,y1);
00102 fprintf( psfile , "%d %d N ",x2,y2);
00103 fprintf( psfile , "%d %d N ",x1,y2);
00104 #if 0
00105 fprintf( psfile , "%d %d N ",x1,y1);
00106 #endif
00107 fprintf( psfile , "F S\n") ;
00108 }
|
|
|
Definition at line 216 of file plot_ps.c. Referenced by ps_label().
|
|
||||||||||||||||
|
Definition at line 208 of file plot_ps.c. References ps_stroke(), and psfile.
|
|
|
Definition at line 203 of file plot_ps.c. References ps_stroke(), and psfile.
|
|
||||||||||||||||||||
|
Definition at line 190 of file plot_ps.c. References atcur, font, inpath, ps_linemod(), ps_prolog(), ps_stroke(), psfile, and scal.
00191 { if( prolog_not_output ) ps_prolog() ;
00192 if (inpath) ps_stroke() ;
00193 fprintf( psfile , "initgraphics\n");
00194 fprintf( psfile , "1 setlinewidth\n");
00195 fprintf( psfile , "66 72 translate\n");
00196 scal=480.0/(ix2-ix1);
00197 fprintf( psfile , "%f %f scale\n",scal,480.0/(iy2-iy1));
00198 if (ix1 || iy1) fprintf( psfile , "%d %d translate\n",-ix1, -iy1);
00199 ps_linemod( "solid" ) ;
00200 atcur=inpath=font=0;
00201 }
|
|
|
Definition at line 66 of file plot_ps.c. References atcur, inpath, and psfile. Referenced by ps_arc(), ps_clear(), ps_label(), ps_linemod(), ps_maybe_stroke(), ps_point(), ps_rect(), ps_setrgb(), ps_setwidth(), and ps_space().
|
|
|
Definition at line 319 of file plot_ps.c. References ps_closepl().
00320 { ps_closepl() ; }
|
|
||||||||||||||||
|
Definition at line 213 of file plot_ps.c. References ps_setrgb().
00214 { ps_setrgb( *rrr,*ggg,*bbb ) ; }
|
|
|
Definition at line 163 of file plot_ps.c. References ps_erase().
00164 { ps_erase() ; }
|
|
||||||||||||||||||||
|
Definition at line 82 of file plot_ps.c. References ps_line().
00083 { ps_line( *ix1,*iy1 , *ix2,*iy2 ) ; }
|
|
||||||||||||
|
Definition at line 239 of file plot_ps.c. References i, ps_openpl(), ps_space(), and psfile.
|
Variable Documentation
|
|
Definition at line 53 of file plot_ps.c. Referenced by ps_arc(), ps_clear(), ps_cont(), ps_label(), ps_move(), ps_point(), ps_space(), and ps_stroke(). |
|
|
Definition at line 51 of file plot_ps.c. Referenced by ps_cont(), ps_label(), ps_move(), and ps_point(). |
|
|
Definition at line 51 of file plot_ps.c. Referenced by ps_cont(), ps_label(), ps_move(), and ps_point(). |
|
|
|
|
|
Definition at line 48 of file plot_ps.c. Referenced by ps_label(), ps_prolog(), and ps_space(). |
|
|
Definition at line 54 of file plot_ps.c. Referenced by ps_arc(), ps_clear(), ps_cont(), ps_label(), ps_maybe_stroke(), ps_point(), ps_space(), and ps_stroke(). |
|
|
Definition at line 50 of file plot_ps.c. Referenced by ps_clear(), and ps_epilog(). |
|
|
Definition at line 55 of file plot_ps.c. Referenced by ps_arc(), ps_circle(), ps_clear(), ps_cont(), ps_label(), and ps_point(). |
|
|
Definition at line 57 of file plot_ps.c. Referenced by ps_prolog(). |
|
|
Initial value: {
"%%BoundingBox: 36 36 540 690",
"%%Title: plotps output",
"%%Creator: plotps 1.0 (RWCox)",
"%%Pages: (atend)",
"%%DocumentFonts: Times-Roman",
"%%EndComments",
"/S{stroke}bind def",
"/F{fill}bind def" ,
"/NP{newpath}bind def",
"/M{moveto}bind def",
"/N{lineto}bind def",
"/A{NP arc S}bind def",
"/C{0 360 A}bind def",
"/P{1 0 360 A}bind def",
"/T{show}bind def",
"/CL{showpage}bind def",
"/SF{/Times-Roman findfont exch scalefont setfont}bind def",
"%%EndProlog",
NULL
}Definition at line 264 of file plot_ps.c. Referenced by ps_prolog(). |
|
|
Definition at line 58 of file plot_ps.c. Referenced by ps_arc(), ps_circle(), ps_clear(), ps_closepl(), ps_cont(), ps_epilog(), ps_label(), ps_linemod(), ps_openpl(), ps_point(), ps_prolog(), ps_rect(), ps_setfont(), ps_setrgb(), ps_setwidth(), ps_space(), ps_stroke(), and zzpsop_(). |
|
|
Definition at line 59 of file plot_ps.c. Referenced by ps_closepl(), and ps_openpl(). |
|
|
Definition at line 56 of file plot_ps.c. Referenced by ps_linemod(), ps_setfont(), and ps_space(). |
|
|
Definition at line 52 of file plot_ps.c. Referenced by ps_clear(), ps_cont(), ps_label(), ps_move(), and ps_point(). |