summaryrefslogtreecommitdiff
path: root/utils/hp2ps/Key.c
diff options
context:
space:
mode:
authorRavi Nanavati <ravi@bluespec.com>2006-09-29 22:47:39 +0000
committerRavi Nanavati <ravi@bluespec.com>2006-09-29 22:47:39 +0000
commit138de4239c816531feebc8dcc478995d984276a9 (patch)
tree0702faf972c1f57ed4197ea8eda0d529976c89a4 /utils/hp2ps/Key.c
parent9cd54893c0097b5b763dc9657e3c228492cdb87f (diff)
downloadhaskell-138de4239c816531feebc8dcc478995d984276a9.tar.gz
multipage_hp2ps
Add support for splitting the key index over multiple pages in hp2ps Multipage support can be requested with the -M command-line flag or inferred if the number of bands requested is greater than 20 (the limit on the number of bands displayed has been removed) Please include this change in the 6.6 branch as well as HEAD
Diffstat (limited to 'utils/hp2ps/Key.c')
-rw-r--r--utils/hp2ps/Key.c13
1 files changed, 10 insertions, 3 deletions
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);