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

  1. /* $Log:    skippages.c,v $
  2.  * Revision 0.8  92/11/23  19:47:00  19:47:00  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:44  02:41:44  bt (Bo Thide')
  6.  * More bug fixes and improvements. Support for PaintJet XL
  7.  * 
  8.  * Revision 0.6  92/11/10  21:48:41  21:48:41  bt (Bo Thide')
  9.  * Bug fixes. Added -R option. Better font handling.
  10.  * 
  11.  * Revision 0.5  92/11/09  16:25:48  16:25:48  bt (Bo Thide')
  12.  * Rewrite of dospecial.c. Extended \special support
  13.  * 
  14.  * Revision 0.4  92/11/08  02:46:04  02:46:04  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:54  12:45:54  bt (Bo Thide')
  18.  * Fixed 8 bit (dc font) support.
  19.  * 
  20.  * Revision 0.2  92/08/23  17:29:01  17:29:01  bt (Bo Thide')
  21.  * Source cleaned up.  Changed certain function calls.  Removed globals.
  22.  * 
  23.  * Revision 0.1  92/08/22  23:58:48  23:58:48  bt (Bo Thide')
  24.  * First Release.
  25.  *  */
  26.  
  27. /*
  28.  * This routine is used to pass over pages that are not being translated. It 
  29.  * is assumed to begin just after the preamble has been read, or just after a
  30.  * DVI_BOP has been processed. It continues until either finding a DVI_BOP that
  31.  * matches the desired starting page specification, or until running into the
  32.  * postamble.
  33.  */
  34.  
  35. #include <stdio.h>
  36. #include "dvi.h"
  37. #include "globals.h"
  38. #include "macros.h"
  39.  
  40. static char rcsid[] = "$Header: skippages.c,v 0.8 92/11/23 19:47:00 bt Exp $";
  41.  
  42. long skippages(bitfile, dvifile, pcllevel, resolution)
  43. FILE    *bitfile;
  44. FILE    *dvifile;
  45. short    pcllevel;
  46. short    resolution;
  47.   int   i, k, q;
  48.   bool  badchar;
  49.   bool  match;
  50.   long  p;
  51.   long  hh=0L;        /* Pixel analog of DVI unit h */
  52.   long  vv=0L;        /* Pixel analog of DVI unit v */
  53.   long  startloc=0;
  54.  
  55.   while (TRUE) { 
  56.     if((k = (int)getubyte(dvifile)) >= DVI_SET1) { 
  57.       p = firstpar(dvifile, k);
  58.       switch(k) { 
  59.       case DVI_BOP:
  60.         scanbop(dvifile);
  61.         match = TRUE;
  62.         for(i = 0 ; i <= startvals ; i++)
  63.           if(startthere[i] && (startcount[i] != count[i]))
  64.         match = FALSE;
  65.         if(match) { 
  66.           startloc = lastpage - 1;
  67.           goto end;
  68.         }
  69.         break;
  70.       case DVI_SET_RULE:
  71.       case DVI_PUT_RULE:
  72.         getsquad(dvifile);
  73.         break;
  74.       case DVI_FNT_DEF1:
  75.       case DVI_FNT_DEF2:
  76.       case DVI_FNT_DEF3:
  77.       case DVI_FNT_DEF4:
  78.         definefont(dvifile, p);
  79.         break;
  80.       case DVI_XXX1:
  81.       case DVI_XXX2:
  82.       case DVI_XXX3:
  83.       case DVI_XXX4:
  84.         badchar = FALSE;
  85.         if(p + nextnamesfree - names > NAMESIZE)
  86.           prerror("Out of string space during special\n");
  87.         for (k=0; k<(int)p; k++) { 
  88.           q = (int)getubyte(dvifile);
  89.           if((q < ' ') || (q > '~'))
  90.             badchar = TRUE;
  91.           *(nextnamesfree + k) = q;
  92.         }
  93.         *(nextnamesfree + p) = 0;
  94.         if(badchar)
  95.           fprintf(stderr,"Non-ASCII character in DVI_XX command\n");
  96.         dospecial(bitfile, PRESCAN_ON, pcllevel, hh, vv, resolution);
  97.         break;
  98.       case DVI_POST:
  99.         inpostamble = TRUE;
  100.         goto end;
  101.         break;
  102.       default:
  103.         break;
  104.       }
  105.     }
  106.   }
  107. end:
  108.   return(startloc);
  109. }
  110.