home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Tex / Tex29 / StTeXsrc.zoo / src / texunix.h < prev    next >
C/C++ Source or Header  |  1988-09-27  |  6KB  |  247 lines

  1.  
  2. /*
  3.  * @(#)tex.h 2.6 EPA
  4.  *
  5.  * Copyright 1987,1988 Pat J Monardo
  6.  *
  7.  * Redistribution of this file is permitted through
  8.  * the specifications in the file COPYING.
  9.  *
  10.  * 
  11.  */
  12.  
  13. #include    <stdio.h>
  14. #include    <signal.h>
  15. #include    <time.h>
  16. /*#include     <sys/time.h>*/
  17.  
  18. /*
  19.  * constants in the outer block
  20.  */
  21.  
  22. #define NUL                 '\0'
  23. #define EOLN                '\n'
  24. #define FALSE               0
  25. #define TRUE                1
  26. #define EMPTY               0
  27.  
  28.  
  29. #define BUF_SIZE            500
  30. #define DVI_BUF_SIZE        4096
  31. #define ERROR_LINE          64
  32. #define FILE_NAME_SIZE      104
  33. #define FONT_BASE           0
  34. #define FONT_MAX            250    /* was 150 */
  35. #define FONT_MEM_SIZE       65000    /* was 25000 */
  36. #define HALF_BUF            2048
  37. #define HALF_ERROR_LINE     32
  38. #define HASH_SIZE           5000    /* was 3000 */
  39. #define HASH_PRIME          2551
  40. #define HYPH_SIZE           307
  41. #define MAX_IN_OPEN         15
  42. #define MAX_PRINT_LINE      72
  43. #define MAX_STRINGS         4400
  44. #define NEST_SIZE           400    /* was 40 */
  45. #define PARAM_SIZE          300    /* was 30 */
  46.  
  47. #ifdef BIGG
  48. #define POOL_SIZE           100000
  49. #else
  50. #ifdef BIGGG
  51. #define POOL_SIZE           100000
  52. #else
  53. #define POOL_SIZE           20000
  54. #endif
  55. #endif
  56.  
  57. #define SAVE_SIZE           2400    /* was 600 */
  58. #define STACK_SIZE          800        /* was 200 */
  59. #define STRING_VACANCIES    1000
  60. #define TRIE_OP_HASH_SIZE   512
  61. #define TRIE_SIZE           8000
  62.  
  63. #ifdef BIG
  64. #define MEM_BOT             0
  65. #define MEM_TOP             50000
  66. #define TOK_BOT             0
  67. #define TOK_TOP             30000
  68. #ifdef INIT
  69. #define MEM_MIN             MEM_BOT
  70. #define MEM_MAX             MEM_TOP
  71. #define TOK_MIN             TOK_BOT
  72. #define TOK_MAX             TOK_TOP
  73. #else
  74. #define MEM_MIN             0
  75. #define MEM_MAX             55000
  76. #define TOK_MIN             0
  77. #define TOK_MAX             55000
  78. #endif
  79. #define MIN_QUARTERWORD     0
  80. #define MAX_QUARTERWORD     255
  81. #define MIN_HALFWORD        0
  82. #define MAX_HALFWORD        65535
  83. #endif
  84.  
  85. #ifdef BIGG
  86. #define MEM_BOT             0
  87. #define MEM_TOP             250000
  88. #define TOK_BOT             0
  89. #define TOK_TOP             30000
  90. #ifdef INIT
  91. #define MEM_MIN             MEM_BOT
  92. #define MEM_MAX             MEM_TOP
  93. #define TOK_MIN             TOK_BOT
  94. #define TOK_MAX             TOK_TOP
  95. #else
  96. #define MEM_MIN             0
  97. #define MEM_MAX             524200
  98. /* #define MEM_MAX             1048400 */
  99. #define TOK_MIN             0
  100. #define TOK_MAX             55000
  101. #endif
  102. #define MIN_QUARTERWORD     0
  103. #define MAX_QUARTERWORD     255
  104. #define MIN_HALFWORD        0
  105. #define MAX_HALFWORD        655350
  106. #endif
  107.  
  108.  
  109. #ifdef BIGGG
  110. #define MEM_BOT             0
  111. #define MEM_TOP             250000
  112. #define TOK_BOT             0
  113. #define TOK_TOP             47000    /* was 30000 */
  114. #ifdef INIT
  115. #define MEM_MIN             MEM_BOT
  116. #define MEM_MAX             MEM_TOP
  117. #define TOK_MIN             TOK_BOT
  118. #define TOK_MAX             TOK_TOP
  119. #else
  120. #define MEM_MIN             0
  121. #define MEM_MAX             256000
  122. /* #define MEM_MAX             1048400 */
  123. #define TOK_MIN             0
  124. #define TOK_MAX             65000    /* was 55000 */
  125. #endif
  126. #define MIN_QUARTERWORD     0
  127. #define MAX_QUARTERWORD     255
  128. #define MIN_HALFWORD        0
  129. #define MAX_HALFWORD        6553500
  130. #endif
  131.  
  132.  
  133. #if !defined(BIGG) && !defined(BIG) && !defined(BIGGG)
  134. #define MEM_BOT             0
  135. #define MEM_TOP             30000
  136. #define TOK_BOT             0
  137. #define TOK_TOP             30000
  138. #ifdef INIT
  139. #define MEM_MIN             MEM_BOT
  140. #define MEM_MAX             MEM_TOP
  141. #define TOK_MIN             TOK_BOT
  142. #define TOK_MAX             TOK_TOP
  143. #else
  144. #define MEM_MIN             0
  145. #define MEM_MAX             35000
  146. #define TOK_MIN             0
  147. #define TOK_MAX             35000
  148. #endif
  149. #define MIN_QUARTERWORD     0
  150. #define MAX_QUARTERWORD     255
  151. #define MIN_HALFWORD        0
  152. #define MAX_HALFWORD        65535
  153. #endif
  154.  
  155. /*
  156.  *  types in the outer block
  157.  */
  158.  
  159. #define global      extern
  160. #if defined(BIG) || defined(BIGG) || defined(BIGGG)
  161. typedef unsigned char   qword;
  162. typedef unsigned long   hword;
  163. #else
  164. typedef unsigned char   qword;
  165. typedef unsigned short  hword;
  166. #endif
  167. typedef unsigned char   ascii;
  168. typedef int             bool;
  169. typedef unsigned char   byte;
  170. typedef char *          chrs;
  171. typedef int             fnt;
  172. typedef unsigned char   gord;
  173. typedef float           gratio;
  174. typedef int             group;
  175. typedef hword           ptr;
  176. typedef long            scal;
  177. typedef hword           str;
  178. typedef hword           tok;
  179. typedef long            val;
  180. typedef FILE            *word_file;
  181. typedef FILE            *alpha_file;            
  182. typedef FILE            *byte_file;
  183. typedef union { 
  184.     struct { 
  185.         hword   rh; 
  186.         hword   lh; 
  187.     } hh1; 
  188.     struct { 
  189.         hword   rh; 
  190.         qword   b0; 
  191.         qword   b1; 
  192.     } hh2; 
  193. } hh;
  194. typedef struct { 
  195.     qword   b0;
  196.     qword   b1;
  197.     qword   b2;
  198.     qword   b3;
  199. } qqqq;
  200. typedef union { 
  201.     hh      hh;  
  202.     qqqq    qqqq;
  203.     long    i;   
  204.     gratio  gr;  
  205. } mword;
  206.  
  207. /*
  208.  *  variables in the outer block
  209.  */
  210.  
  211. global  char        banner[];
  212. global  int         ready_already;
  213.  
  214. /*
  215.  *  functions in the outer block
  216.  */
  217.  
  218. int     final_cleanup();
  219. int     close_files_and_terminate();
  220. int     initialize();
  221. bool    decode_args();
  222. int     handle_int();
  223. int     call_edit();
  224.  
  225. /*
  226.  * some common programming idioms
  227.  */
  228.  
  229. #define sc                  i
  230. #define incr(i)             ++(i)
  231. #define decr(i)             --(i)
  232. #define odd(i)              ((i) & 1)
  233. #define abs(i)              ((i) >= 0 ? (i) : -(i))
  234. #define round(x)            (long) ((x) > 0.0 ? ((x) + 0.5) : ((x) - 0.5))
  235. #define negate(x)           (x) = -(x)
  236. #define loop                while (1)
  237. #include "cmds.h"
  238. #include "char.h"
  239. #include "str.h"
  240. #include "io.h"
  241. #include "print.h"
  242. #include "error.h"
  243. #include "heap.h"
  244. #include "eq.h"
  245. #include "hash.h"
  246. #include "arith.h"
  247.