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 */
32 boolish multipageflag = 0; /* true when the output should be 2 pages - key and profile */
34 static floatish WidthInPoints PROTO((char *)); /* forward */
35 static FILE *Fp PROTO((char *, char **, char *, char *)); /* forward */
43 static char *pathName;
44 static char *baseName; /* "basename" is a std C library name (sigh) */
50 floatish xrange = 0.0;
51 floatish yrange = 0.0;
53 floatish auxxrange = 0.0;
54 floatish auxyrange = 0.0;
63 floatish THRESHOLD_PERCENT = DEFAULT_THRESHOLD;
64 int TWENTY = DEFAULT_TWENTY;
71 programname = copystring(Basename(argv[0]));
74 while (argc && argv[0][0] == '-') {
82 epsfwidth = WidthInPoints(*argv + 1);
88 switch( *(*argv + 1) ) {
110 TWENTY = atoi(*argv + 1);
111 // only 20 keys fit on a page
112 if (TWENTY > DEFAULT_TWENTY)
120 THRESHOLD_PERCENT = (floatish) atof(*argv + 1);
121 if (THRESHOLD_PERCENT < 0 || THRESHOLD_PERCENT > 5)
146 pathName = copystring(argv[0]);
147 DropSuffix(pathName, ".hp");
148 baseName = copystring(Basename(pathName));
150 hpfp = Fp(pathName, &hpfile, ".hp", "r");
151 psfp = Fp(baseName, &psfile, ".ps", "w");
153 if (pflag) auxfp = Fp(baseName, &auxfile, ".aux", "r");
158 if (!filter && pflag) GetAuxFile(auxfp);
161 TraceElement(); /* Orders on total, Removes trace elements (tflag) */
163 if (dflag) Deviation(); /* ReOrders on deviation */
165 if (iflag) Identorder(iflag); /* ReOrders on identifier */
167 if (pflag) Reorder(); /* ReOrders on aux file */
169 /* Selects top bands (mflag) - can be more than 20 now */
170 if (TWENTY != 0) TopTwenty();
174 areabelow = AreaBelow();
181 auxfp = Fp(baseName, &auxfile, ".aux", "w");
190 typedef enum {POINTS, INCHES, MILLIMETRES} pim;
192 static pim Units PROTO((char *)); /* forward */
200 result = (floatish) atof(wstr);
202 switch (Units(wstr)) {
213 if (result <= 144) /* Minimum of 2in wide ! */
226 i = strlen(wstr) - 2;
228 if (wstr[i] == 'p' && wstr[i+1] == 't') {
230 } else if (wstr[i] == 'i' && wstr[i+1] == 'n') {
232 } else if (wstr[i] == 'm' && wstr[i+1] == 'm') {
240 Fp(rootname, filename, suffix, mode)
241 char* rootname; char** filename; char* suffix; char* mode;
243 *filename = copystring2(rootname, suffix);
245 return(OpenFile(*filename, mode));
250 _stgAssert (filename, linenum)
252 unsigned int linenum;
255 fprintf(stderr, "ASSERTION FAILED: file %s, line %u\n", filename, linenum);