home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / printer / dvi2pcl.lha / firstpar.c < prev    next >
C/C++ Source or Header  |  1992-11-25  |  3KB  |  137 lines

  1. /* $Log:    firstpar.c,v $
  2.  * Revision 0.8  92/11/23  19:46:45  19:46:45  bt (Bo Thide')
  3.  * Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
  4.  * 
  5.  * Revision 0.7  92/11/13  02:41:29  02:41:29  bt (Bo Thide')
  6.  * More bug fixes and improvements. Support for PaintJet XL
  7.  * 
  8.  * Revision 0.6  92/11/10  21:47:45  21:47:45  bt (Bo Thide')
  9.  * Bug fixes. Added -R option. Better font handling.
  10.  * 
  11.  * Revision 0.5  92/11/09  16:25:32  16:25:32  bt (Bo Thide')
  12.  * Rewrite of dospecial.c. Extended \special support
  13.  * 
  14.  * Revision 0.4  92/11/08  02:45:48  02:45:48  bt (Bo Thide')
  15.  * Changed to portable bit manipulations. Replaced strrstr for non-POSIX compliant C. Fixed numerous bugs. Added support for more \special's.
  16.  * 
  17.  * Revision 0.3  92/08/24  12:45:40  12:45:40  bt (Bo Thide')
  18.  * Fixed 8 bit (dc font) support.
  19.  * 
  20.  * Revision 0.2  92/08/23  17:28:57  17:28:57  bt (Bo Thide')
  21.  * Source cleaned up.  Changed certain function calls.  Removed globals.
  22.  * 
  23.  * Revision 0.1  92/08/22  23:58:47  23:58:47  bt (Bo Thide')
  24.  * First Release.
  25.  *  */
  26.  
  27. #include <stdio.h>
  28. #include "dvi.h"
  29. #include "globals.h"
  30. #include "macros.h"
  31.  
  32. static char rcsid[] = "$Header: firstpar.c,v 0.8 92/11/23 19:46:45 bt Exp $";
  33.  
  34. /*
  35.  * This routine computes the first parameter of each dvi opcode.
  36.  */
  37. long firstpar(dvifile, k)
  38. FILE    *dvifile;
  39. int    k;
  40. {
  41.     switch (k)
  42.     { 
  43.     case DVI_SET1:
  44.     case DVI_PUT1:
  45.     case DVI_FNT1:
  46.     case DVI_XXX1:
  47.     case DVI_FNT_DEF1:
  48.         return((long)getubyte(dvifile));
  49.         break;
  50.     case DVI_SET2:
  51.     case DVI_PUT2:
  52.     case DVI_FNT2:
  53.     case DVI_XXX2:
  54.     case DVI_FNT_DEF2:
  55.         return((long)getupair(dvifile));
  56.         break;
  57.     case DVI_SET3:
  58.     case DVI_PUT3:
  59.     case DVI_FNT3:
  60.     case DVI_XXX3:
  61.     case DVI_FNT_DEF3:
  62.         return((long)getutrio(dvifile));
  63.         break;
  64.     case DVI_RIGHT1:
  65.     case DVI_W1:
  66.     case DVI_X1:
  67.     case DVI_DOWN1:
  68.     case DVI_Y1:
  69.     case DVI_Z1:
  70.         return((long)getsbyte(dvifile));
  71.         break;
  72.     case DVI_RIGHT2:
  73.     case DVI_W2:
  74.     case DVI_X2:
  75.     case DVI_DOWN2:
  76.     case DVI_Y2:
  77.     case DVI_Z2:
  78.         return((long)getspair(dvifile));
  79.         break;
  80.     case DVI_RIGHT3:
  81.     case DVI_W3:
  82.     case DVI_X3:
  83.     case DVI_DOWN3:
  84.     case DVI_Y3:
  85.     case DVI_Z3:
  86.         return((long)getstrio(dvifile));
  87.         break;
  88.     case DVI_SET4:
  89.     case DVI_SET_RULE:
  90.     case DVI_PUT4:
  91.     case DVI_PUT_RULE:
  92.     case DVI_RIGHT4:
  93.     case DVI_W4:
  94.     case DVI_X4:
  95.     case DVI_DOWN4:
  96.     case DVI_Y4:
  97.     case DVI_Z4:
  98.     case DVI_FNT4:
  99.     case DVI_XXX4:
  100.     case DVI_FNT_DEF4:
  101.         return((long)getsquad(dvifile));
  102.         break;
  103.     case DVI_NOP:
  104.     case DVI_BOP:
  105.     case DVI_EOP:
  106.     case DVI_PUSH:
  107.     case DVI_POP:
  108.     case DVI_PRE:
  109.     case DVI_POST:
  110.     case DVI_POSTPOST:
  111.     case DVI_UNDEF0:
  112.     case DVI_UNDEF1:
  113.     case DVI_UNDEF2:
  114.     case DVI_UNDEF3:
  115.     case DVI_UNDEF4:
  116.     case DVI_UNDEF5:
  117.         return(0);
  118.         break;
  119.     case DVI_W0:
  120.         return(w);
  121.         break;
  122.     case DVI_X0:
  123.         return(x);
  124.         break;
  125.     case DVI_Y0:
  126.         return(y);
  127.         break;
  128.     case DVI_Z0:
  129.         return(z);
  130.         break;
  131.     default:
  132.         if((k >= DVI_FNT_NUM_0) && (k <= DVI_FNT_NUM_63))
  133.             return((long)(k - DVI_FNT_NUM_0));
  134.         break;
  135.     }
  136. }
  137.