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

  1. /* $Log:    loadpkfile.c,v $
  2.  * Revision 0.8  92/11/23  19:46:48  19:46:48  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:32  02:41:32  bt (Bo Thide')
  6.  * More bug fixes and improvements. Support for PaintJet XL
  7.  * 
  8.  * Revision 0.6  92/11/10  21:47:48  21:47:48  bt (Bo Thide')
  9.  * Bug fixes. Added -R option. Better font handling.
  10.  * 
  11.  * Revision 0.5  92/11/09  16:25:36  16:25:36  bt (Bo Thide')
  12.  * Rewrite of dospecial.c. Extended \special support
  13.  * 
  14.  * Revision 0.4  92/11/08  02:45:52  02:45:52  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:43  12:45:43  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. /*
  28.  * Here is a procedure that reads the .pk file into 'pkbuffer'. Other than
  29.  * insuring that the initial two bytes are 247 and 89 (the pk_pre command,
  30.  * followed by the current .pk format identifier), it does no format checks.
  31.  * If the corresponding .pk file doesn't fit into pkbuffer, 'dvi2pcl' will be
  32.  * aborted. In this case MAXPKSIZE has to be increased by an appropriate
  33.  * amount and 'dvi2pcl' has to be recompiled. At this state the choosen value
  34.  * of MAXPKSIZE will serve all existing .pk files but for future .pk font
  35.  * files this might happen.
  36.  */
  37.  
  38. #include <stdio.h>
  39. #include "globals.h"
  40. #include "macros.h"
  41. #include "pk.h"
  42.  
  43. static char rcsid[] = "$Header: loadpkfile.c,v 0.8 92/11/23 19:46:48 bt Exp $";
  44.  
  45. extern FILE    *openpkfile();
  46.  
  47. void loadpkfile()
  48.     FILE    *pkfile;
  49.     long    *pkptr;
  50.     byte    *p;
  51.  
  52.     pkfile = openpkfile();
  53.     pkptr = pkbuffer;
  54.     p = (byte *) pkptr;
  55.     if(verbose)
  56.         fprintf(stderr,"Trying to load %s\n",pkname);
  57.     *pkptr++ = (long)getw(pkfile);
  58.     if((getpubyte(p) != PK_PRE) || (getpubyte(p) != PK_ID))
  59.         fprintf(stderr,".pk file corrupt -- not loaded\n");
  60.     else { 
  61.         while((*pkptr++ = (long)getw(pkfile)) != EOF) { 
  62.             if(pkptr - pkbuffer >= MAXPKSIZE)
  63.                 prerror("Memory size exceeded when loading .pk file\n");
  64.         }
  65.         font->down = -2;
  66.     }
  67.     fclose(pkfile);
  68. }
  69.