summaryrefslogtreecommitdiff
path: root/dviware/dvi2pcl/firstpar.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/dvi2pcl/firstpar.c
Initial commit
Diffstat (limited to 'dviware/dvi2pcl/firstpar.c')
-rw-r--r--dviware/dvi2pcl/firstpar.c136
1 files changed, 136 insertions, 0 deletions
diff --git a/dviware/dvi2pcl/firstpar.c b/dviware/dvi2pcl/firstpar.c
new file mode 100644
index 0000000000..2c2c79adf6
--- /dev/null
+++ b/dviware/dvi2pcl/firstpar.c
@@ -0,0 +1,136 @@
+/* $Log: firstpar.c,v $
+ * Revision 0.8 92/11/23 19:46:45 19:46:45 bt (Bo Thide')
+ * Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
+ *
+ * Revision 0.7 92/11/13 02:41:29 02:41:29 bt (Bo Thide')
+ * More bug fixes and improvements. Support for PaintJet XL
+ *
+ * Revision 0.6 92/11/10 21:47:45 21:47:45 bt (Bo Thide')
+ * Bug fixes. Added -R option. Better font handling.
+ *
+ * Revision 0.5 92/11/09 16:25:32 16:25:32 bt (Bo Thide')
+ * Rewrite of dospecial.c. Extended \special support
+ *
+ * Revision 0.4 92/11/08 02:45:48 02:45:48 bt (Bo Thide')
+ * Changed to portable bit manipulations. Replaced strrstr for non-POSIX compliant C. Fixed numerous bugs. Added support for more \special's.
+ *
+ * Revision 0.3 92/08/24 12:45:40 12:45:40 bt (Bo Thide')
+ * Fixed 8 bit (dc font) support.
+ *
+ * Revision 0.2 92/08/23 17:28:57 17:28:57 bt (Bo Thide')
+ * Source cleaned up. Changed certain function calls. Removed globals.
+ *
+ * Revision 0.1 92/08/22 23:58:47 23:58:47 bt (Bo Thide')
+ * First Release.
+ * */
+
+#include <stdio.h>
+#include "dvi.h"
+#include "globals.h"
+#include "macros.h"
+
+static char rcsid[] = "$Header: firstpar.c,v 0.8 92/11/23 19:46:45 bt Exp $";
+
+/*
+ * This routine computes the first parameter of each dvi opcode.
+ */
+long firstpar(dvifile, k)
+FILE *dvifile;
+int k;
+{
+ switch (k)
+ {
+ case DVI_SET1:
+ case DVI_PUT1:
+ case DVI_FNT1:
+ case DVI_XXX1:
+ case DVI_FNT_DEF1:
+ return((long)getubyte(dvifile));
+ break;
+ case DVI_SET2:
+ case DVI_PUT2:
+ case DVI_FNT2:
+ case DVI_XXX2:
+ case DVI_FNT_DEF2:
+ return((long)getupair(dvifile));
+ break;
+ case DVI_SET3:
+ case DVI_PUT3:
+ case DVI_FNT3:
+ case DVI_XXX3:
+ case DVI_FNT_DEF3:
+ return((long)getutrio(dvifile));
+ break;
+ case DVI_RIGHT1:
+ case DVI_W1:
+ case DVI_X1:
+ case DVI_DOWN1:
+ case DVI_Y1:
+ case DVI_Z1:
+ return((long)getsbyte(dvifile));
+ break;
+ case DVI_RIGHT2:
+ case DVI_W2:
+ case DVI_X2:
+ case DVI_DOWN2:
+ case DVI_Y2:
+ case DVI_Z2:
+ return((long)getspair(dvifile));
+ break;
+ case DVI_RIGHT3:
+ case DVI_W3:
+ case DVI_X3:
+ case DVI_DOWN3:
+ case DVI_Y3:
+ case DVI_Z3:
+ return((long)getstrio(dvifile));
+ break;
+ case DVI_SET4:
+ case DVI_SET_RULE:
+ case DVI_PUT4:
+ case DVI_PUT_RULE:
+ case DVI_RIGHT4:
+ case DVI_W4:
+ case DVI_X4:
+ case DVI_DOWN4:
+ case DVI_Y4:
+ case DVI_Z4:
+ case DVI_FNT4:
+ case DVI_XXX4:
+ case DVI_FNT_DEF4:
+ return((long)getsquad(dvifile));
+ break;
+ case DVI_NOP:
+ case DVI_BOP:
+ case DVI_EOP:
+ case DVI_PUSH:
+ case DVI_POP:
+ case DVI_PRE:
+ case DVI_POST:
+ case DVI_POSTPOST:
+ case DVI_UNDEF0:
+ case DVI_UNDEF1:
+ case DVI_UNDEF2:
+ case DVI_UNDEF3:
+ case DVI_UNDEF4:
+ case DVI_UNDEF5:
+ return(0);
+ break;
+ case DVI_W0:
+ return(w);
+ break;
+ case DVI_X0:
+ return(x);
+ break;
+ case DVI_Y0:
+ return(y);
+ break;
+ case DVI_Z0:
+ return(z);
+ break;
+ default:
+ if((k >= DVI_FNT_NUM_0) && (k <= DVI_FNT_NUM_63))
+ return((long)(k - DVI_FNT_NUM_0));
+ break;
+ }
+}