home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / printer / dvi2pcl.lha / globals.h < prev    next >
C/C++ Source or Header  |  1993-02-16  |  8KB  |  274 lines

  1. /* $Log:        globals.h,v $
  2.  * Revision 0.8  92/11/23  19:47:02  19:47:02  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:17  02:41:17  bt (Bo Thide')
  6.  * More bug fixes and improvements. Support for PaintJet XL
  7.  * 
  8.  * Revision 0.6  92/11/10  21:48:43  21:48:43  bt (Bo Thide')
  9.  * Bug fixes. Added -R option. Better font handling.
  10.  * 
  11.  * Revision 0.5  92/11/09  16:25:50  16:25:50  bt (Bo Thide')
  12.  * Rewrite of dospecial.c. Extended \special support
  13.  * 
  14.  * Revision 0.4  92/11/08  02:46:06  02:46:06  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:43:17  12:43:17  bt (Bo Thide')
  18.  * Fixed 8 bit (dc font) support.
  19.  * 
  20.  * Revision 0.2  92/08/23  17:28:53  17:28:53  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. #ifndef _DVI2PCL_GLOBALS_INCLUDED
  29. #define _DVI2PCL_GLOBALS_INCLUDED
  30.  
  31. #define BANNER "TeX Dvi to HP Print Command Language translator dvi2pcl 0.7.\n"
  32. #define BITFILE_SUFFIX          ".pcl"  /* Bit file suffix */
  33. #define BLACKBYTE               '\377'
  34. #define DEV_LJPLUS              0
  35. #define DEV_LJ2                 1
  36. #define DEV_LJ2D                2
  37. #define DEV_LJ2P                3
  38. #define DEV_LJ3SI               4
  39. #define DEV_LJ3P                5
  40. #define DEV_PJ                  10
  41. #define DEV_PJXL                11
  42. #define DVIFILE_SUFFIX          ".dvi"  /* Dvi file suffix */
  43. #define DYNAMICFONTBASE         256     /* Start value for internal font #'s */
  44. #define FALSE                   0
  45. #define FIX                     (1 << 20)
  46. #define FMASK                   7
  47. #define FONTPATH                "/%dpt/%s.%d"   /* Where to look for fonts */
  48. #define HOFFSET                 200     
  49. #define INFINITY                0x7FFFFFFF
  50. #define MAXCHEIGHT              128     /* Max character height for printer */
  51. #define MAXCWIDTH               128     /* Max character width for printer */
  52. #define MAXDOWN                 128     /* Max number of downloadable fonts */
  53. #define MAXDRIFT                2       /* Max dots rounding error */
  54. #define MAXFONTS                256     /* Max # of fonts to be used */
  55. #define MAXPAGES                1000    /* Max # of pages of the document */
  56. #define MAXPKSIZE               65536   /* Max .pk buffer size */
  57. #define MAXPXLSIZE              65536   /* Max .pxl buffer size */
  58. #define MINPRINTERMEM           122880  /* 120 KByte */
  59. #define NAMELENGTH              255     /* Max length of file names */
  60. #define NAMESIZE                4096    /* Max texbtuffer size for names */
  61. #define NULL                    0
  62. #define PCLLEVEL                4       /* Default PCL level (old LaserJets) */
  63. #define PRESCAN_OFF             0       /* Not in the prescan cycle */
  64. #define PRESCAN_ON              1       /* In the prescan cycle */
  65. #define RESOLUTION              300
  66. #define SCALE                   75780587.52             /* 72.27*2**20 */
  67. #define STACKSIZE               100
  68. #define TERMLINELENGTH          80
  69. #define TRUE                    1
  70. #define USGFILE_SUFFIX          ".usg"          /* Usage (log) file suffix */
  71. #define VOFFSET                 150
  72. #define WHITEBYTE               '\0'
  73.  
  74.  
  75. /* Global type definitions */
  76.  
  77. typedef char            byte;
  78. typedef unsigned char   ubyte;
  79. typedef unsigned char   bool;
  80.  
  81. #ifdef TRUE
  82. #include <sys/types.h>
  83. #else
  84. typedef unsigned short  ushort;
  85. typedef unsigned int    uint;
  86. #endif /* TRUE */
  87. typedef unsigned int    uint;
  88.  
  89. /* PCL font descriptor */
  90. typedef struct {
  91.         ushort size;
  92.         ubyte  descriptor;
  93.         ubyte  font_type;
  94.         ubyte  style_MSB;
  95.         byte   reserved;
  96.         ushort baseline;
  97.         ushort cell_width;
  98.         ushort cell_height;
  99.         ubyte  orientation;
  100.         bool   spacing;
  101.         ushort symbol_set;
  102.         ushort pitch;
  103.         ushort height;
  104.         ushort x_height;
  105.         byte   width_type;
  106.         ubyte  style_LSB;
  107.         byte   stroke_weight;
  108.         ubyte  typeface_LSB;
  109.         ubyte  typeface_MSB;
  110.         ubyte  serif_style;
  111.         ubyte  quality;
  112.         byte   placement;
  113.         byte   underl_dist;
  114.         ubyte  underl_height;
  115.         ushort text_height;
  116.         ushort text_width;
  117.         ushort first_code;
  118.         ushort last_code;
  119.         ubyte  pitch_ext;
  120.         ubyte  height_ext;
  121.         ushort cap_height;
  122.         uint   font_number;
  123.         char   font_name[16];
  124.       } fdfmt;
  125.  
  126. /* PCL character descriptor */
  127. typedef struct {
  128.         ubyte  format;
  129.         bool   continuation;
  130.         ubyte  size;
  131.         ubyte  class;
  132.         ubyte  orientation;
  133.         byte   reserved;
  134.         short  left_offset;
  135.         short  top_offset;
  136.         ushort char_width;
  137.         ushort char_height;
  138.         short  delta_x;
  139.       } cdfmt;
  140.  
  141. /* Internal character information */
  142. typedef struct {
  143.         short pk_char;
  144.         long  pxl_width;
  145.         long  tfm_width;
  146.         long  use_count;
  147.       } charfmt;
  148.  
  149. /* Internal font information */
  150. typedef struct {
  151.         long    checksum;
  152.         long    scaled_size;
  153.         long    design_size;
  154.         long    space;
  155.         short   dir_size;
  156.         double  height;
  157.         short   down;
  158.         short   name; 
  159.         short   bc;
  160.         short   ec;
  161.         charfmt chr[256];
  162.       } fontfmt;
  163.  
  164. /* Internal graphic char information */
  165. typedef struct {
  166.         short pxl_bytes;
  167.         short pxl_rows;
  168.         long x_offset;
  169.         long y_offset;
  170.         byte *pxl_pattern;
  171.         } gcharfmt;
  172.  
  173. typedef gcharfmt (*gfontfmt)[256];      /* Internal graphic font information */
  174.  
  175. /* Header part of .tfm files */
  176. typedef struct {
  177.         short lf;
  178.         short lh;
  179.         short bc;
  180.         short ec;
  181.         short nw;
  182.         short nh;
  183.         short nd;
  184.         short ni;
  185.         short nl;
  186.         short nk;
  187.         short ne;
  188.         short np;
  189.         long  cs;
  190.         long  ds;
  191.         } tfmfmt;
  192.  
  193. /* Printer name and capabilities */
  194. typedef struct {
  195.         long mem;
  196.         char name[16];
  197.         char lang[8];
  198.         } prtfmt;
  199.  
  200. /* Global variables in alphabetical order */
  201. int             actualpagecount;
  202. cdfmt           cd;                     /* character descriptor */
  203. charfmt         *cbase;
  204. double          conv;
  205. double          convpxl;
  206. double          convtfm;
  207. long            count[10];
  208. int             c_black;
  209. int             c_flag;
  210. int             c_height;
  211. int             c_hoffset;
  212. int             c_nib;
  213. int             c_voffset;
  214. int             c_width;
  215. long            denominator;
  216. charfmt         *drawchar();
  217. int             dyn_f;
  218. byte            *endofchardata;
  219. int             e_offset;
  220. fdfmt           fd;                     /* font descriptor */
  221. long            firstpage;
  222. long            firstpar();
  223. fontfmt         *font;
  224. int             fontpathlen;
  225. fontfmt         *fontptr[MAXFONTS];
  226. gfontfmt        gfont;
  227. gfontfmt        gfontptr[MAXFONTS];
  228. bool            inpostamble;
  229. long            h_offset;
  230. bool            h_posed;
  231. int             landscape;
  232. long            lastpage;
  233. long            magnification;
  234. int             manualfeed;
  235. long            maxh;
  236. int             maxs;
  237. long            maxv;
  238. long            maxhsofar;
  239. int             maxssofar;
  240. long            maxvsofar;
  241. int             maxpages;
  242. int             max_depth;
  243. int             max_width;
  244. int             max_offset;
  245. char            names[NAMESIZE];
  246. int             nextfontdown;
  247. char            *nextnamesfree;
  248. long            numerator;
  249. int             o_offset;
  250. short           outreverse;
  251. byte            *pkbase;
  252. long            pkbuffer[MAXPKSIZE];
  253. byte            *pkcharinfo();
  254. char            pkfixname[NAMELENGTH];
  255. char            pkname[NAMELENGTH];
  256. byte            *pk_ptr;
  257. long            power[8];
  258. long            prevpage;
  259. prtfmt          printer;
  260. long            printermem_used;
  261. byte            pxlbuffer[MAXPXLSIZE];
  262. int             r_offset;
  263. int             s;
  264. long            startcount[10];
  265. int             startthere[10];
  266. int             startvals;
  267. long            v_offset;
  268. bool            v_posed;
  269. bool            verbose;
  270.  
  271. long            h, v, w, x, y, z;
  272.  
  273. #endif /* _DVI2PCL_GLOBALS_INCLUDED */
  274.