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

  1. /* $Log:    initialize.c,v $
  2.  * Revision 0.8  92/11/23  19:46:47  19:46:47  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:31  02:41:31  bt (Bo Thide')
  6.  * More bug fixes and improvements. Support for PaintJet XL
  7.  * 
  8.  * Revision 0.6  92/11/10  21:47:47  21:47:47  bt (Bo Thide')
  9.  * Bug fixes. Added -R option. Better font handling.
  10.  * 
  11.  * Revision 0.5  92/11/09  16:25:35  16:25:35  bt (Bo Thide')
  12.  * Rewrite of dospecial.c. Extended \special support
  13.  * 
  14.  * Revision 0.4  92/11/08  02:45:50  02:45:50  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:42  12:45:42  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. #include <stdio.h>
  28. #include "globals.h"
  29. #include "paths.h"
  30.  
  31. static char rcsid[] = "$Header: initialize.c,v 0.8 92/11/23 19:46:47 bt Exp $";
  32.  
  33. /*
  34.  * Get all variables initialized
  35.  */
  36.  
  37. initialize()
  38. {
  39.     int    i,j;
  40.     int    linelength=80;
  41.     char    *cols;
  42.  
  43.     if(verbose)
  44.         fprintf(stderr,BANNER);
  45.     for(i=0; i<MAXFONTS; i++) {
  46.         fontptr[i] = NULL;
  47.         gfontptr[i] = NULL;
  48.     }
  49.     pkbase = (byte *)pkbuffer;
  50. #ifdef DEBUG
  51.     fprintf(stderr,"initialize: pkbase = %d\n", &pkbase);
  52. #endif /* DEBUG */
  53.     nextnamesfree = names + 1;
  54.     verbose = FALSE;
  55.     maxpages = MAXPAGES;
  56.     startvals = 0;
  57.     startthere[0] = FALSE;
  58.     inpostamble = FALSE;
  59.     maxv = INFINITY - 99;
  60.     maxh = INFINITY - 99;
  61.     maxs = STACKSIZE + 1;
  62.     maxvsofar = 0;
  63.     maxhsofar = 0;
  64.     maxssofar = 0;
  65.     h_posed = FALSE;
  66.     v_posed = FALSE;
  67.     h_offset = HOFFSET;
  68.     r_offset = HOFFSET;
  69.     v_offset = VOFFSET;
  70.  
  71.     lastpage = -1;
  72.     prevpage = -1;
  73.     actualpagecount = 0;
  74.     nextfontdown = DYNAMICFONTBASE;
  75.     printermem_used = 0;
  76.     landscape = FALSE;
  77.     manualfeed = FALSE;
  78.  
  79.     /* Initialize font descriptor data */
  80.     fd.size = 64;
  81.     fd.descriptor = 0;
  82.     fd.font_type = 2;
  83.     fd.style_MSB = 0;
  84.     fd.reserved = 0;
  85.     fd.baseline = 0;
  86.     fd.cell_width = 1;
  87.     fd.cell_height = 1;
  88.     fd.orientation = 0;
  89.     fd.spacing = 1;
  90.     fd.symbol_set = 2048;    /* Largest allowed value + 1 */
  91.     fd.pitch = 1;
  92.     fd.height = 1;
  93.     fd.x_height = 0;
  94.     fd.width_type = 0;
  95.     fd.style_LSB = 0;
  96.     fd.stroke_weight = 0;
  97.     fd.typeface_LSB = 0;
  98.     fd.typeface_MSB = 0;
  99.         fd.serif_style = 128;    /* Serif */
  100.         fd.quality = 0;
  101.         fd.placement = 0;
  102.         fd.underl_dist = 0;
  103.         fd.underl_height = 0;
  104.         fd.text_height = 0;
  105.         fd.text_width = 0;
  106.         fd.first_code = 1;
  107.         fd.last_code = 255;
  108.         fd.pitch_ext = 0;
  109.         fd.height_ext = 0;
  110.         fd.cap_height = 0;
  111.         fd.font_number = 0;
  112.         strcpy(fd.font_name,"-TeX dvi font-");
  113.  
  114.     /* Initialize character descriptor data */
  115.     cd.format = 4;
  116.     cd.continuation = 0;
  117.     cd.size = 14;
  118.     cd.class = 1;
  119.     cd.orientation = 0;
  120.     cd.reserved = 0;
  121.     cd.left_offset = 0;
  122.     cd.top_offset = 0;
  123.     cd.char_width = 0;
  124.     cd.char_height = 0;
  125.     cd.delta_x = 0;
  126.  
  127.     j = 1;
  128.     for(i=0 ; i<8; i++)
  129.     { 
  130.         power[i] = (long)j;
  131.         j <<= 1;
  132.     }
  133.  
  134.     /* Take a stab at line length (SYSVish) */
  135.     if ((cols = (char *)getenv("COLUMNS")) != NULL){ 
  136.         sscanf(cols, " %d", &linelength);
  137.         if(linelength > 500) linelength = 500;
  138.         if(linelength < 20) linelength = 20;
  139.     }
  140.   
  141.     strcpy(pkfixname,fontpath);
  142.     fontpathlen = strlen(pkfixname);
  143. }
  144.