summaryrefslogtreecommitdiff
path: root/dviware/quicspool/src/qms.c
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/quicspool/src/qms.c
Initial commit
Diffstat (limited to 'dviware/quicspool/src/qms.c')
-rw-r--r--dviware/quicspool/src/qms.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/dviware/quicspool/src/qms.c b/dviware/quicspool/src/qms.c
new file mode 100644
index 0000000000..1159abef85
--- /dev/null
+++ b/dviware/quicspool/src/qms.c
@@ -0,0 +1,66 @@
+#ifndef lint
+static char *rcs = "$Header: qms.c,v 1.1 88/01/15 13:05:14 simpson Rel $";
+#endif
+/*
+$Log: qms.c,v $
+ * Revision 1.1 88/01/15 13:05:14 simpson
+ * initial release
+ *
+ * Revision 0.1 87/12/11 18:31:16 simpson
+ * beta test
+ *
+*/
+
+/* QMS printer routines */
+
+#include <stdio.h>
+#include <local/qms.h>
+#include "fontnode.h"
+
+
+/* Sets up the printer to portrait mode in a sane state. After the
+ * completion of a job, the banner page of the next job may be printed
+ * without running the "of" filter so we must setup the printer as the "of"
+ * filter does. Also, switch the tray offset in this routine. This
+ * routine is called before every filter exits.
+ */
+void sanestate(portfont)
+int portfont;
+{
+ fputs(QUICON, stdout);
+ fputs(PORTRAIT, stdout);
+ printf("%s00000", SYNTAX);
+ printf("%sXTX1", INITIALIZE);
+ printf("%s0000011000", INITMARGVERT);
+ printf("%s0025008500", INITMARGHORZ);
+ printf("%s%04d", LINESPACING, (int)(6.02 * 100));
+ printf("%s%d%s", DEFFONT, portfont, ENDCMD);
+ fputs(FREEOFF, stdout);
+}
+
+/* Trys to make room for numblocks. Return boolean if successful. */
+Boolean makeroom(head, maxblocks, curramblocks, curromblocks, numblocks)
+struct FontNode *head;
+int maxblocks;
+int *curramblocks; /* This one changes so pass by reference */
+int curromblocks;
+int numblocks;
+{
+ /* This is the number of blocks we need to free */
+ int freeblocks = numblocks - (maxblocks - *curramblocks
+ - curromblocks);
+ struct FontNode *p;
+
+ for (p = head; p && freeblocks > 0; p = p->next)
+ if (p->flags & RAM && p->flags & LOADED) { /* do ! delete rom fonts */
+ printf("%s%d%c%s", DOWNLOAD, p->qmsnumber, p->flags & PORT ? 'P'
+ : 'L', ENDCMD);
+ p->flags &= ~LOADED;
+ freeblocks -= p->blocksize;
+ *curramblocks -= p->blocksize;
+ }
+ if (freeblocks > 0)
+ return FALSE;
+ else
+ return TRUE;
+}