summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/hp2ps/Defines.h2
-rw-r--r--utils/hp2ps/Dimensions.c3
-rw-r--r--utils/hp2ps/Error.c1
-rw-r--r--utils/hp2ps/Key.c13
-rw-r--r--utils/hp2ps/Main.c14
-rw-r--r--utils/hp2ps/Main.h2
-rw-r--r--utils/hp2ps/PsFile.c32
-rw-r--r--utils/hp2ps/PsFile.h1
8 files changed, 52 insertions, 16 deletions
diff --git a/utils/hp2ps/Defines.h b/utils/hp2ps/Defines.h
index 8d38546fec..ae620f4183 100644
--- a/utils/hp2ps/Defines.h
+++ b/utils/hp2ps/Defines.h
@@ -10,7 +10,7 @@
extern floatish _thresh_;
#define TWENTY _twenty_ /* show top 20 bands, grouping excess */
-#define DEFAULT_TWENTY 20 /* this is default and absolute maximum */
+#define DEFAULT_TWENTY 20 /* this is default and maximum per page */
extern int _twenty_;
#define LARGE_FONT 12 /* Helvetica 12pt */
diff --git a/utils/hp2ps/Dimensions.c b/utils/hp2ps/Dimensions.c
index e732402dac..4b4aadb101 100644
--- a/utils/hp2ps/Dimensions.c
+++ b/utils/hp2ps/Dimensions.c
@@ -51,7 +51,8 @@ Dimensions()
titleheight = TITLE_HEIGHT;
}
- graphwidth = titlewidth - graphx0 - (TWENTY ? KeyWidth() : 0);
+ boolish keyOnGraph = !multipageflag && TWENTY != 0;
+ graphwidth = titlewidth - graphx0 - (keyOnGraph ? KeyWidth() : 0);
graphheight = borderheight - titleheight - (2 * borderspace) - graphy0;
}
diff --git a/utils/hp2ps/Error.c b/utils/hp2ps/Error.c
index 809c24ea44..68f88d8c91 100644
--- a/utils/hp2ps/Error.c
+++ b/utils/hp2ps/Error.c
@@ -47,6 +47,7 @@ Usage(str)
printf(" -ef[in|mm|pt] produce Encapsulated PostScript f units wide (f > 2 inches)\n");
printf(" -g produce output suitable for GHOSTSCRIPT previever\n");
printf(" -i[+|-] sort by identifier string (-i+ gives greatest on top) \n");
+ printf(" -M multi-page output (key separate from graph)\n");
printf(" -mn print maximum of n bands (default & max 20)\n");
printf(" -m0 removes the band limit altogether\n");
printf(" -p use previous scaling, shading and ordering\n");
diff --git a/utils/hp2ps/Key.c b/utils/hp2ps/Key.c
index 8c63721c74..314a682dd6 100644
--- a/utils/hp2ps/Key.c
+++ b/utils/hp2ps/Key.c
@@ -5,6 +5,7 @@
#include "Dimensions.h"
#include "HpFile.h"
#include "Shade.h"
+#include "PsFile.h"
/* own stuff */
#include "Key.h"
@@ -20,12 +21,18 @@ void Key()
for (i = 0; i < nidents; i++) /* count identifiers */
;
- c = graphy0;
- dc = graphheight / (floatish) (i + 1);
+ c = multipageflag ? 0 : graphy0;
+ dc = graphheight / (floatish) ((i <= 20) ? (i + 1) : 20);
for (i = 0; i < nidents; i++) {
c += dc;
KeyEntry(c, identtable[i]->name, ShadeOf(identtable[i]->name));
+ // if we have spit out 20 entries and we're going to output more
+ // advance the page
+ if (i % DEFAULT_TWENTY == (DEFAULT_TWENTY - 1) && i != nidents - 1) {
+ c = 0;
+ NextPage();
+ }
}
}
@@ -42,7 +49,7 @@ KeyEntry(centreline, name, colour)
namebase = centreline - (floatish) (NORMAL_FONT / 2);
keyboxbase = centreline - ((floatish) KEY_BOX_WIDTH / 2.0);
- kstart = graphx0 + graphwidth;
+ kstart = graphx0 + (multipageflag ? 0 : graphwidth);
fprintf(psfp, "%f %f moveto\n", kstart + borderspace, keyboxbase);
fprintf(psfp, "0 %d rlineto\n", KEY_BOX_WIDTH);
diff --git a/utils/hp2ps/Main.c b/utils/hp2ps/Main.c
index 3b5efed51b..eb50e00036 100644
--- a/utils/hp2ps/Main.c
+++ b/utils/hp2ps/Main.c
@@ -17,7 +17,7 @@
#include "Utilities.h"
boolish pflag = 0; /* read auxiliary file */
-boolish eflag = 0; /* scaled EPSF */
+boolish eflag = 0; /* scaled EPSF */
boolish dflag = 0; /* sort by standard deviation */
int iflag = 0; /* sort by identifier (3-way flag) */
boolish gflag = 0; /* output suitable for previewer */
@@ -29,6 +29,7 @@ boolish tflag = 0; /* ignored threshold specified */
boolish cflag = 0; /* colour output */
boolish filter; /* true when running as a filter */
+boolish multipageflag = 0; /* true when the output should be 2 pages - key and profile */
static floatish WidthInPoints PROTO((char *)); /* forward */
static FILE *Fp PROTO((char *, char **, char *, char *)); /* forward */
@@ -107,9 +108,13 @@ char* argv[];
case 'm':
mflag++;
TWENTY = atoi(*argv + 1);
- if (TWENTY > DEFAULT_TWENTY)
- Usage(*argv-1);
+ // only 20 keys fit on a page
+ if (TWENTY > DEFAULT_TWENTY)
+ multipageflag++;
goto nextarg;
+ case 'M':
+ multipageflag++;
+ goto nextarg;
case 't':
tflag++;
THRESHOLD_PERCENT = (floatish) atof(*argv + 1);
@@ -161,7 +166,8 @@ nextarg: ;
if (pflag) Reorder(); /* ReOrders on aux file */
- if (TWENTY) TopTwenty(); /* Selects top twenty (mflag) */
+ /* Selects top bands (mflag) - can be more than 20 now */
+ if (TWENTY != 0) TopTwenty();
Dimensions();
diff --git a/utils/hp2ps/Main.h b/utils/hp2ps/Main.h
index 30e7a7e9be..81c62dc891 100644
--- a/utils/hp2ps/Main.h
+++ b/utils/hp2ps/Main.h
@@ -64,6 +64,8 @@ extern int mflag;
extern boolish tflag;
extern boolish cflag;
+extern boolish multipageflag;
+
extern char *programname;
extern char *hpfile;
diff --git a/utils/hp2ps/PsFile.c b/utils/hp2ps/PsFile.c
index 357f826259..1324da6f08 100644
--- a/utils/hp2ps/PsFile.c
+++ b/utils/hp2ps/PsFile.c
@@ -21,11 +21,8 @@ static void TitleOutlineBox PROTO((void)); /* forward */
static void BigTitleText PROTO((void)); /* forward */
static void TitleText PROTO((void)); /* forward */
-void
-PutPsFile()
+static void DoTitleAndBox()
{
- Prologue();
- Variables();
BorderOutlineBox();
if (bflag) {
@@ -35,12 +32,35 @@ PutPsFile()
TitleOutlineBox();
TitleText();
}
+}
+
+static void Landscape PROTO((void)); /* forward */
+static void Portrait PROTO((void)); /* forward */
+
+void NextPage() {
+ fprintf(psfp, "showpage\n");
+ if (gflag) Portrait(); else Landscape();
+ DoTitleAndBox();
+}
+
+void
+PutPsFile()
+{
+ Prologue();
+ Variables();
CurvesInit();
+ DoTitleAndBox();
+
+ if (multipageflag) {
+ Key(); // print multi-page key even if there are more than 20 bands
+ NextPage();
+ }
+
Axes();
- if (TWENTY) Key();
+ if (!multipageflag && (TWENTY != 0)) Key();
Curves();
@@ -52,8 +72,6 @@ PutPsFile()
static void StandardSpecialComments PROTO((void)); /* forward */
static void EPSFSpecialComments PROTO((floatish)); /* forward */
-static void Landscape PROTO((void)); /* forward */
-static void Portrait PROTO((void)); /* forward */
static void Scaling PROTO((floatish)); /* forward */
static void
diff --git a/utils/hp2ps/PsFile.h b/utils/hp2ps/PsFile.h
index acec0703bc..07d3ed2859 100644
--- a/utils/hp2ps/PsFile.h
+++ b/utils/hp2ps/PsFile.h
@@ -2,5 +2,6 @@
#define PS_FILE_H
void PutPsFile PROTO((void));
+void NextPage PROTO((void)); // for Key.c
#endif /* PS_FILE_H */