home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Tex / Tex29 / StTeXsrc.zoo / src / btex.h < prev    next >
C/C++ Source or Header  |  1989-09-30  |  7KB  |  285 lines

  1. /*
  2.  * @(#)tex.h 2.6 EPA
  3.  *
  4.  * Copyright 1987,1988 Pat J Monardo
  5.  *
  6.  * Redistribution of this file is permitted through
  7.  * the specifications in the file COPYING.
  8.  *
  9.  * 
  10.  */
  11.  
  12. #include    <stdio.h>
  13. #include    <signal.h>
  14. #include    <time.h>
  15. /*#include     <sys/time.h>*/
  16.  
  17. /*
  18.  * constants in the outer block
  19.  */
  20.  
  21. #define NUL                 '\0'
  22. #define EOLN                '\n'
  23. #define FALSE               0
  24. #define TRUE                1
  25. #define EMPTY               0
  26.  
  27. /*
  28.  * Configurable Parameters: (++jrb    bammi@dsrgsun.ces.cwru.edu)
  29.  *  Please read and understand the meaning of each paramter, and its
  30.  * relationship to other parameters, before randomly changing values
  31.  * (which in my experience is the cause of 99% of the problems people
  32.  *  have in TeX, rather than the program itself.)  Please note: the type of
  33.  * `hword' below. Depending on how you set the parameter value, it may
  34.  * need to be changed from a type `unsigned short' to a type `unsigned long'.
  35.  * When you do that, you need to also re-compile and initex, and run it
  36.  * to get new `.fmt' files, otherwise virtex will complain about format
  37.  * file errors.
  38.  *    (all xxx_MIN's are always 0 in this implementation)
  39.  * MEM_MAX    greatest index in TeX's internal mem array.
  40.  *        MEM_MAX < MEM_TOP in initex
  41.  *        MEM_MAX >= MEM_TOP in virtex
  42.  *
  43.  * BUF_SIZE    max number of characters simultaneously present  in current
  44.  *        linesof open files.
  45.  *        BUF_SIZ <= MAX_HALFWORD
  46.  *
  47.  * ERROR_LINE   width of context lines on error message
  48.  *
  49.  * HALF_ERROR_LINE  width of first lines of context on error messages
  50.  *            30 < HALF_ERROR_LINE < (ERROR_LINE - 15)
  51.  *
  52.  * MAX_PRINT_LINE   width of longest output line
  53.  *            60 <= MAX_PRINT_LINE
  54.  *
  55.  * STACK_SIZE    maximum number of simultaneous input sources
  56.  *
  57.  * MAX_IN_OPEN  maximum number of input files and error insertions simul.
  58.  *
  59.  * FONT_MAX    max internal font number
  60.  *        FONT_MAX < MAX_QUATERWORD and FONT_MAX < FONT_BASE+256
  61.  *
  62.  * FONT_MEM_SIZE max # of words of font info
  63.  *
  64.  * PARAM_SIZE    max # of simultaneous macro params
  65.  *
  66.  * NEST_SIZE    max # of semantic nestings
  67.  *
  68.  * MAX_STRINGS    max # of string
  69.  *        MAX_STRING < MAX_HALFWORD
  70.  *
  71.  * STRING_VACANCIES min # of chars for user after TeX error message/fonts
  72.  *            names etc.
  73.  * 
  74.  * POOL_SIZE    max # of chars in strings
  75.  *
  76.  * SAVE_SIZE    space for saving values outside of current group
  77.  *        SAVE_SIZE < MAX_HALFWORD
  78.  *
  79.  * TRIE_SIZE    space for hyph patters (large for initex)
  80.  *
  81.  * DVI_BUF_SIZE output buffer, must be multiple of 8
  82.  *
  83.  * FILE_NAME_SIZE max filename size
  84.  *
  85.  * MEM_TOP      largest index  in mem array dumped by initex < MEM_MAX
  86.  *
  87.  * HASH_SIZE    max # of control sequences, shoule be around
  88.  *        (MEM_MAX)/10
  89.  *
  90.  * HASH_PRIME    prime # equal to or about 85% of HASH_SIZE
  91.  *
  92.  * HYPH_SIZE    another prime, the number of hyph. exceptions
  93.  *
  94.  */
  95.  
  96. #define BUF_SIZE            500
  97. #define DVI_BUF_SIZE        4096
  98. #define HALF_BUF            2048
  99. #define ERROR_LINE          64
  100. #define HALF_ERROR_LINE     32
  101. #ifdef atarist
  102. #define FILE_NAME_SIZE      64
  103. #else
  104. #define FILE_NAME_SIZE      104
  105. #endif
  106. #define FONT_BASE           0
  107. #define FONT_MAX            150
  108. #define FONT_MEM_SIZE       25000
  109. #define HASH_SIZE           3000
  110. #define HASH_PRIME          2551
  111. #define HYPH_SIZE           307
  112. #define MAX_IN_OPEN         15
  113. #define MAX_PRINT_LINE      72
  114. #define MAX_STRINGS         4400
  115. #define NEST_SIZE           40
  116. #define PARAM_SIZE          30
  117. #define POOL_SIZE           32000
  118. #define SAVE_SIZE           600
  119. #define STACK_SIZE          200
  120. #define STRING_VACANCIES    1000
  121. #define TRIE_OP_HASH_SIZE   512
  122. #define TRIE_SIZE           8000
  123.  
  124. #ifdef BIG
  125. #define MEM_BOT             0
  126. #define MEM_TOP             50000
  127. #define TOK_BOT             0
  128. #define TOK_TOP             30000
  129. #ifdef INIT
  130. #define MEM_MIN             MEM_BOT
  131. #define MEM_MAX             MEM_TOP
  132. #define TOK_MIN             TOK_BOT
  133. #define TOK_MAX             TOK_TOP
  134. #else
  135. #define MEM_MIN             0
  136. #define MEM_MAX             55000
  137. #define TOK_MIN             0
  138. #define TOK_MAX             55000
  139. #endif
  140. #define MIN_QUARTERWORD     0
  141. #define MAX_QUARTERWORD     255
  142. #define MIN_HALFWORD        0
  143. #define MAX_HALFWORD        65535
  144. #endif /* BIG */
  145.  
  146. #ifdef BIGG
  147. #define MEM_BOT             0
  148. #define MEM_TOP             250000
  149. #define TOK_BOT             0
  150. #define TOK_TOP             30000
  151. #ifdef INIT
  152. #define MEM_MIN             MEM_BOT
  153. #define MEM_MAX             MEM_TOP
  154. #define TOK_MIN             TOK_BOT
  155. #define TOK_MAX             TOK_TOP
  156. #else
  157. #define MEM_MIN             0
  158. #define MEM_MAX             524200
  159. #define TOK_MIN             0
  160. #define TOK_MAX             55000
  161. #endif
  162. #define MIN_QUARTERWORD     0
  163. #define MAX_QUARTERWORD     255
  164. #define MIN_HALFWORD        0
  165. #define MAX_HALFWORD        655350
  166. #endif /* BIGG */
  167.  
  168. #if !defined(BIGG) && !defined(BIG)
  169. #define MEM_BOT             0
  170. #define MEM_TOP             30000
  171. #define TOK_BOT             0
  172. #define TOK_TOP             30000
  173. #ifdef INIT
  174. #define MEM_MIN             MEM_BOT
  175. #define MEM_MAX             MEM_TOP
  176. #define TOK_MIN             TOK_BOT
  177. #define TOK_MAX             TOK_TOP
  178. #else
  179. #define MEM_MIN             0
  180. #define MEM_MAX             55000
  181. #define TOK_MIN             0
  182. #define TOK_MAX             45000
  183. #endif
  184. #define MIN_QUARTERWORD     0
  185. #define MAX_QUARTERWORD     255
  186. #define MIN_HALFWORD        0
  187. #define MAX_HALFWORD        65535
  188. #endif
  189.  
  190. /*
  191.  *  types in the outer block
  192.  */
  193.  
  194. #define global      extern
  195. #if defined(BIG) || defined(BIGG)
  196. typedef unsigned char   qword;
  197. typedef unsigned long   hword;
  198. #else
  199. typedef unsigned char   qword;
  200. typedef unsigned short  hword;
  201. #endif
  202. typedef unsigned char   ascii;
  203. typedef int             bool;
  204. typedef unsigned char   byte;
  205. typedef char *          chrs;
  206. typedef int             fnt;
  207. typedef unsigned char   gord;
  208. typedef float           gratio;
  209. typedef int             group;
  210. typedef hword           ptr;
  211. typedef long            scal;
  212. typedef hword           str;
  213. typedef hword           tok;
  214. typedef long            val;
  215. typedef FILE            *word_file;
  216. typedef FILE            *alpha_file;            
  217. typedef FILE            *byte_file;
  218. typedef union { 
  219.     struct { 
  220.         hword   rh; 
  221.         hword   lh; 
  222.     } hh1; 
  223.     struct { 
  224.         hword   rh; 
  225.         qword   b0; 
  226.         qword   b1; 
  227.     } hh2; 
  228. } hh;
  229. typedef struct { 
  230.     qword   b0;
  231.     qword   b1;
  232.     qword   b2;
  233.     qword   b3;
  234. } qqqq;
  235. typedef union { 
  236.     hh      hh;  
  237.     qqqq    qqqq;
  238.     long    i;   
  239.     gratio  gr;  
  240. } mword;
  241.  
  242. /*
  243.  *  variables in the outer block
  244.  */
  245.  
  246. global  char        banner[];
  247. global  int         ready_already;
  248.  
  249. /*
  250.  *  functions in the outer block
  251.  */
  252.  
  253. int     final_cleanup();
  254. int     close_files_and_terminate();
  255. int     initialize();
  256. bool    decode_args();
  257. int     call_edit();
  258. #ifdef atarist
  259. void     handle_int();
  260. #else
  261. int     handle_int();
  262. #endif
  263. /*
  264.  * some common programming idioms
  265.  */
  266.  
  267. #define sc                  i
  268. #define incr(i)             ++(i)
  269. #define decr(i)             --(i)
  270. #define odd(i)              ((i) & 1)
  271. #define abs(i)              ((i) >= 0 ? (i) : -(i))
  272. #define round(x)            (long) ((x) > 0.0 ? ((x) + 0.5) : ((x) - 0.5))
  273. #define negate(x)           (x) = -(x)
  274. #define loop                while (1)
  275. #include "cmds.h"
  276. #include "char.h"
  277. #include "str.h"
  278. #include "io.h"
  279. #include "print.h"
  280. #include "error.h"
  281. #include "heap.h"
  282. #include "eq.h"
  283. #include "hash.h"
  284. #include "arith.h"
  285.