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 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
149 DropSuffix(pathName, ".exe");
151 baseName = copystring(Basename(pathName));
153 hpfp = Fp(pathName, &hpfile, ".hp", "r");
154 psfp = Fp(baseName, &psfile, ".ps", "w");
156 if (pflag) auxfp = Fp(baseName, &auxfile, ".aux", "r");
161 if (!filter && pflag) GetAuxFile(auxfp);
164 TraceElement(); /* Orders on total, Removes trace elements (tflag) */
166 if (dflag) Deviation(); /* ReOrders on deviation */
168 if (iflag) Identorder(iflag); /* ReOrders on identifier */
170 if (pflag) Reorder(); /* ReOrders on aux file */
172 /* Selects top bands (mflag) - can be more than 20 now */
173 if (TWENTY != 0) TopTwenty();
177 areabelow = AreaBelow();
184 auxfp = Fp(baseName, &auxfile, ".aux", "w");
193 typedef enum {POINTS, INCHES, MILLIMETRES} pim;
195 static pim Units PROTO((char *)); /* forward */
203 result = (floatish) atof(wstr);
205 switch (Units(wstr)) {
216 if (result <= 144) /* Minimum of 2in wide ! */
229 i = strlen(wstr) - 2;
231 if (wstr[i] == 'p' && wstr[i+1] == 't') {
233 } else if (wstr[i] == 'i' && wstr[i+1] == 'n') {
235 } else if (wstr[i] == 'm' && wstr[i+1] == 'm') {
243 Fp(rootname, filename, suffix, mode)
244 char* rootname; char** filename; char* suffix; char* mode;
246 *filename = copystring2(rootname, suffix);
248 return(OpenFile(*filename, mode));
253 _stgAssert (filename, linenum)
255 unsigned int linenum;
258 fprintf(stderr, "ASSERTION FAILED: file %s, line %u\n", filename, linenum);