home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / d / dvips549.zip / DVIPS / SKIPPAGE.C < prev    next >
C/C++ Source or Header  |  1992-10-14  |  3KB  |  95 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. extern void bopcolor() ;
  22. /*
  23.  *   These are the external variables accessed.
  24.  */
  25. #ifdef DEBUG
  26. extern integer debug_flag;
  27. #endif  /* DEBUG */
  28. extern integer pagenum ;
  29. extern char errbuf[] ;
  30. /*
  31.  *   And now the big routine.
  32.  */
  33. void
  34. skippage()
  35. {
  36.    register shalfword cmd ;
  37.    register integer i ;
  38.  
  39. #ifdef DEBUG
  40.    if (dd(D_PAGE))
  41. #ifdef SHORTINT
  42.    (void)fprintf(stderr,"Skipping page %ld\n", pagenum) ;
  43. #else   /* ~SHORTINT */
  44.    (void)fprintf(stderr,"Skipping page %d\n", pagenum) ;
  45. #endif  /* ~SHORTINT */
  46. #endif  /* DEBUG */
  47.    skipover(40) ; /* skip rest of bop command */
  48.    bopcolor(0) ;
  49.    while ((cmd=dvibyte())!=140) {
  50.      switch (cmd) {
  51. /* illegal options */
  52. case 129: case 130: case 131: case 134: case 135: case 136: case 139: 
  53. case 247: case 248: case 249: case 250: case 251: case 252: case 253:
  54. case 254: case 255:
  55.          (void)sprintf(errbuf,
  56. #ifdef SHORTINT
  57.             "! DVI file contains unexpected command (%ld)",cmd) ;
  58. #else   /* ~SHORTINT */
  59.             "! DVI file contains unexpected command (%d)",cmd) ;
  60. #endif  /* ~SHORTINT */
  61.          error(errbuf) ;
  62. /* eight byte commands */
  63. case 132: case 137:
  64.    cmd = dvibyte() ;
  65.    cmd = dvibyte() ;
  66.    cmd = dvibyte() ;
  67.    cmd = dvibyte() ;
  68. /* four byte commands */
  69. case 146: case 151: case 156: case 160: case 165: case 170: case 238:
  70.    cmd = dvibyte() ;
  71. /* three byte commands */
  72. case 145: case 150: case 155: case 159: case 164: case 169: case 237:
  73.    cmd = dvibyte() ;
  74. /* two byte commands */
  75. case 144: case 149: case 154: case 158: case 163: case 168: case 236:
  76.    cmd = dvibyte() ;
  77. /* one byte commands */
  78. case 128: case 133: case 143: case 148: case 153: case 157: case 162:
  79. case 167: case 235:
  80.    cmd = dvibyte() ;
  81.    break ;
  82. /* specials */
  83. case 239: i = dvibyte() ; predospecial(i, 0) ; break ;
  84. case 240: i = twobytes() ; predospecial(i, 0) ; break ;
  85. case 241: i = threebytes() ; predospecial(i, 0) ; break ;
  86. case 242: i = signedquad() ; predospecial(i, 0) ; break ;
  87. /* font definition */
  88. case 243: case 244: case 245: case 246:
  89.    fontdef(cmd - 242) ;
  90.    break ;
  91. default: ;
  92.       }
  93.    }
  94. }
  95.