home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / PRINTING / DVIPS54.ZIP / DVIPS / SKIPPAGE.C < prev    next >
C/C++ Source or Header  |  1990-11-25  |  3KB  |  93 lines

  1. /*
  2.  *   Skips over a page, collecting possible font definitions.  A very simple
  3.  *   case statement insures we maintain sync with the dvi file by collecting
  4.  *   the necessary parameters; but font definitions must be processed normally.
  5.  */
  6. #include "structures.h" /* The copyright notice in that file is included too! */
  7. /*
  8.  *   These are the external routines called.
  9.  */
  10. extern shalfword dvibyte() ;
  11. extern halfword twobytes() ;
  12. extern integer threebytes() ;
  13. extern integer signedquad() ;
  14. extern shalfword signedbyte() ;
  15. extern shalfword signedpair() ;
  16. extern integer signedtrio() ;
  17. extern void skipover() ;
  18. extern void fontdef() ;
  19. extern void predospecial() ;
  20. extern void error() ;
  21. /*
  22.  *   These are the external variables accessed.
  23.  */
  24. #ifdef DEBUG
  25. extern integer debug_flag;
  26. #endif  /* DEBUG */
  27. extern integer pagenum ;
  28. extern char errbuf[] ;
  29. /*
  30.  *   And now the big routine.
  31.  */
  32. void
  33. skippage()
  34. {
  35.    register shalfword cmd ;
  36.    register integer i ;
  37.  
  38. #ifdef DEBUG
  39.    if (dd(D_PAGE))
  40. #ifdef SHORTINT
  41.    (void)fprintf(stderr,"Skipping page %ld\n", pagenum) ;
  42. #else   /* ~SHORTINT */
  43.    (void)fprintf(stderr,"Skipping page %d\n", pagenum) ;
  44. #endif  /* ~SHORTINT */
  45. #endif  /* DEBUG */
  46.    skipover(40) ; /* skip rest of bop command */
  47.    while ((cmd=dvibyte())!=140) {
  48.      switch (cmd) {
  49. /* illegal options */
  50. case 129: case 130: case 131: case 134: case 135: case 136: case 139: 
  51. case 247: case 248: case 249: case 250: case 251: case 252: case 253:
  52. case 254: case 255:
  53.          (void)sprintf(errbuf,
  54. #ifdef SHORTINT
  55.             "! DVI file contains unexpected command (%ld)",cmd) ;
  56. #else   /* ~SHORTINT */
  57.             "! DVI file contains unexpected command (%d)",cmd) ;
  58. #endif  /* ~SHORTINT */
  59.          error(errbuf) ;
  60. /* eight byte commands */
  61. case 132: case 137:
  62.    cmd = dvibyte() ;
  63.    cmd = dvibyte() ;
  64.    cmd = dvibyte() ;
  65.    cmd = dvibyte() ;
  66. /* four byte commands */
  67. case 146: case 151: case 156: case 160: case 165: case 170: case 238:
  68.    cmd = dvibyte() ;
  69. /* three byte commands */
  70. case 145: case 150: case 155: case 159: case 164: case 169: case 237:
  71.    cmd = dvibyte() ;
  72. /* two byte commands */
  73. case 144: case 149: case 154: case 158: case 163: case 168: case 236:
  74.    cmd = dvibyte() ;
  75. /* one byte commands */
  76. case 128: case 133: case 143: case 148: case 153: case 157: case 162:
  77. case 167: case 235:
  78.    cmd = dvibyte() ;
  79.    break ;
  80. /* specials */
  81. case 239: i = dvibyte() ; predospecial(i, 0) ; break ;
  82. case 240: i = twobytes() ; predospecial(i, 0) ; break ;
  83. case 241: i = threebytes() ; predospecial(i, 0) ; break ;
  84. case 242: i = signedquad() ; predospecial(i, 0) ; break ;
  85. /* font definition */
  86. case 243: case 244: case 245: case 246:
  87.    fontdef(cmd - 242) ;
  88.    break ;
  89. default: ;
  90.       }
  91.    }
  92. }
  93.