home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Tex / Dvi / dvieps.arc / MAIN.H < prev    next >
C/C++ Source or Header  |  1988-10-29  |  5KB  |  199 lines

  1. /* -*-C-*- main.h */
  2. /*-->main*/
  3. /**********************************************************************/
  4. /******************************** main ********************************/
  5. /**********************************************************************/
  6.  
  7. /**********************************************************************/
  8. /***********************  External Definitions  ***********************/
  9. /**********************************************************************/
  10.  
  11. #if    KCC_20
  12. #include <file.h>
  13. #endif /* KCC_20 */
  14.  
  15. #if    PCC_20                /* this stuff MUST be first */
  16.  
  17. #undef tops20                /* to keep definitions alive */
  18. #include <ioctl.h>            /* PCC-20 does not have this in */
  19.                     /* the others */
  20. #include <file.h>            /* need for f20open flags and */
  21.                     /* JSYS stuff */
  22. #define tops20  1            /* define for tops-20 */
  23. #endif /* PCC_20 */
  24.  
  25. #include "commands.h"
  26. #include <ctype.h>
  27. #include <math.h>
  28.  
  29. #if    BBNBITGRAPH
  30. #if    (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT)
  31.     /* not available */
  32. #else /* NOT (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT) */
  33. #include <signal.h>
  34. #endif /* (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT) */
  35. #endif /* BBNBITGRAPH */
  36.  
  37. #if    OS_UNIX
  38. #if    BSD42
  39.  
  40. #include <sys/ioctl.h>            /* need for DVISPOOL in dviterm.h */
  41.  
  42. #ifndef _NFILE
  43. /* VAX VMS, NMTCC, PCC-20, and HPUX have _NFILE in stdio.h.  V7 called
  44. it NFILE, and Posix calls it OPEN_MAX.  KCC-20 calls it SYS_OPEN.  VAX
  45. 4.3BSD and Gould UTX/32 don't define _NFILE in stdio.h; they use
  46. NOFILE from sys/param.h.  Sigh.... */
  47. #include <sys/param.h>
  48. #ifdef NOFILE
  49. #define _NFILE NOFILE            /* need for gblvars.h */
  50. #else
  51. #define _NFILE MAXOPEN            /* use our font limit value */
  52. #endif
  53. #endif
  54.  
  55. #endif /* BSD42 */
  56. #endif /* OS_UNIX */
  57.  
  58.  
  59.  
  60. #include "gendefs.h"
  61.  
  62. #if    DECLA75
  63. #undef STDMAG
  64.  
  65. #if    STDRES
  66. #define  STDMAG        720
  67. #else /* NOT STDRES */
  68. #define  STDMAG        720
  69. #endif /* STDRES */
  70.  
  71. #endif /* DECLA75 */
  72.  
  73. #if    DECLN03PLUS
  74. #undef STDMAG
  75.  
  76. #if    STDRES
  77. #define  STDMAG        1500
  78. #else /* NOT STDRES */
  79. #define  STDMAG        750
  80. #endif /* STDRES */
  81.  
  82. #endif /* DECLN03PLUS */
  83.  
  84. #if    EPSON
  85. #undef STDMAG
  86.  
  87. #if    STDRES
  88. #define  STDMAG        1200        /* use 240dpi fonts */
  89. #else /* NOT STDRES */
  90. #define  STDMAG        603        /* 1500 * 1.2**(-5) */
  91. #endif /* STDRES */
  92.  
  93. #endif /* EPSON */
  94.  
  95. #if    (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
  96. #undef STDMAG
  97.  
  98. #if    STDRES
  99. #define  STDMAG        1500        /* 300 dpi Canon LBP-CX print engine */
  100. #else /* NOT STDRES */
  101. #define  STDMAG        1440        /* near value in 1000*1.2**n family */
  102. #endif /* STDRES */
  103.  
  104. #endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
  105.  
  106. #if    TOSHIBAP1351            /* want to override STDMAG */
  107. #undef STDMAG
  108.  
  109. #if    STDRES
  110. #define  STDMAG        868        /* 1500 * 1.2**(-3) */
  111. #else /* NOT STDRES */
  112. #define  STDMAG        833        /* 1000 * 1.2**(-1) */
  113. #endif /* STDRES */
  114.  
  115. #endif /* TOSHIBAP1351 */
  116.  
  117. #include "gblprocs.h"
  118.  
  119. #include "gblvars.h"
  120.  
  121. #if    BBNBITGRAPH
  122. #include "keydef.h"
  123. #endif /* BBNBITGRAPH */
  124.  
  125. #if    OS_ATARI
  126. long _stksize = 40000L; /* make the stack a bit larger than 2KB */
  127.                         /* number must be even                  */
  128. #endif /* OS_ATARI */
  129.  
  130.  
  131. /**********************************************************************/
  132. /*******************************  main  *******************************/
  133. /**********************************************************************/
  134.  
  135. int
  136. main(argc, argv)
  137. int argc;
  138. char *argv[];
  139. {
  140.     register int k;        /* loop index */
  141.     register int file_args;    /* count of file arguments */
  142.  
  143.     (void)strcpy(g_progname, argv[0]); /* save program name */
  144.  
  145.     (void)initglob();        /* do this before argc check! */
  146.  
  147. #if    OS_UNIX
  148.     /* On Unix, we allow filtering of stdin to stdout */
  149. #else /* NOT OS_UNIX */
  150.     if (argc < 2)
  151.     {
  152.     (void)usage(stderr);
  153.     (void)EXIT(1);
  154.     }
  155. #endif /* OS_UNIX */
  156.  
  157.     for (k = 1; k < argc; ++k)
  158.     {
  159.     if (*argv[k] == '-')    /* -switch */
  160.         (void)option(argv[k]);
  161.     }
  162.  
  163.     if (!quiet)
  164.     {
  165.     (void)fprintf(stderr,"[TeX82 DVI Translator Version %s]",VERSION_NO);
  166.     NEWLINE(stderr);
  167.     (void)fprintf(stderr,"[%s]",DEVICE_ID);
  168.     NEWLINE(stderr);
  169.     }
  170.  
  171.     if (npage == 0)        /* no page ranges given, make a large one */
  172.     {
  173.     page_begin[0] = 1;
  174.     page_end[0] = 32767;    /* arbitrary large integer */
  175.     page_step[0] = 1;
  176.     npage = 1;
  177.     }
  178.     else /* need font defs from postamble if only some pages to be output */
  179.     preload = TRUE;
  180.  
  181.     file_args = 0;
  182.     for (k = 1; k < argc; ++k)
  183.     {
  184.     if (*argv[k] != '-')     /* must be file argument */
  185.     {
  186.         file_args++;
  187.         (void)dvifile(argc,argv,argv[k]);
  188.     }
  189.     }
  190.  
  191. #if    OS_UNIX
  192.     if (file_args == 0)        /* use stdin/stdout instead */
  193.         (void)dvifile(argc,argv,"");
  194. #endif
  195.  
  196.     (void)alldone();        /* this will never return */
  197.     return (0);            /* never executed; avoid compiler warnings */
  198. }
  199.