8 #include "Dimensions.h"
13 #include "TopTwenty.h"
14 #include "TraceElement.h"
15 #include "Deviation.h"
17 #include "Utilities.h"
19 boolish pflag = 0; /* read auxiliary file */
20 boolish eflag = 0; /* scaled EPSF */
21 boolish dflag = 0; /* sort by standard deviation */
22 int iflag = 0; /* sort by identifier (3-way flag) */
23 boolish gflag = 0; /* output suitable for previewer */
24 boolish yflag = 0; /* ignore marks */
25 boolish bflag = 0; /* use a big title box */
26 boolish sflag = 0; /* use a small title box */
27 int mflag = 0; /* max no. of bands displayed (default 20) */
28 boolish tflag = 0; /* ignored threshold specified */
29 boolish cflag = 0; /* colour output */
31 boolish filter; /* true when running as a filter */
33 static floatish WidthInPoints PROTO((char *)); /* forward */
34 static FILE *Fp PROTO((char *, char **, char *, char *)); /* forward */
42 static char *pathName;
43 static char *baseName; /* "basename" is a std C library name (sigh) */
49 floatish xrange = 0.0;
50 floatish yrange = 0.0;
52 floatish auxxrange = 0.0;
53 floatish auxyrange = 0.0;
62 floatish THRESHOLD_PERCENT = DEFAULT_THRESHOLD;
63 int TWENTY = DEFAULT_TWENTY;
70 programname = copystring(Basename(argv[0]));
73 while (argc && argv[0][0] == '-') {
81 epsfwidth = WidthInPoints(*argv + 1);
87 switch( *(*argv + 1) ) {
109 TWENTY = atoi(*argv + 1);
110 if (TWENTY > DEFAULT_TWENTY)
115 THRESHOLD_PERCENT = (floatish) atof(*argv + 1);
116 if (THRESHOLD_PERCENT < 0 || THRESHOLD_PERCENT > 5)
141 pathName = copystring(argv[0]);
142 DropSuffix(pathName, ".hp");
143 baseName = copystring(Basename(pathName));
145 hpfp = Fp(pathName, &hpfile, ".hp", "r");
146 psfp = Fp(baseName, &psfile, ".ps", "w");
148 if (pflag) auxfp = Fp(baseName, &auxfile, ".aux", "r");
153 if (!filter && pflag) GetAuxFile(auxfp);
156 TraceElement(); /* Orders on total, Removes trace elements (tflag) */
158 if (dflag) Deviation(); /* ReOrders on deviation */
160 if (iflag) Identorder(iflag); /* ReOrders on identifier */
162 if (pflag) Reorder(); /* ReOrders on aux file */
164 if (TWENTY) TopTwenty(); /* Selects top twenty (mflag) */
168 areabelow = AreaBelow();
175 auxfp = Fp(baseName, &auxfile, ".aux", "w");
184 typedef enum {POINTS, INCHES, MILLIMETRES} pim;
186 static pim Units PROTO((char *)); /* forward */
194 result = (floatish) atof(wstr);
196 switch (Units(wstr)) {
207 if (result <= 144) /* Minimum of 2in wide ! */
220 i = strlen(wstr) - 2;
222 if (wstr[i] == 'p' && wstr[i+1] == 't') {
224 } else if (wstr[i] == 'i' && wstr[i+1] == 'n') {
226 } else if (wstr[i] == 'm' && wstr[i+1] == 'm') {
234 Fp(rootname, filename, suffix, mode)
235 char* rootname; char** filename; char* suffix; char* mode;
237 *filename = copystring2(rootname, suffix);
239 return(OpenFile(*filename, mode));
244 _stgAssert (filename, linenum)
246 unsigned int linenum;
249 fprintf(stderr, "ASSERTION FAILED: file %s, line %u\n", filename, linenum);