/* * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. * Copying of this file is granted according to the provisions * specified in the file COPYING which must accompany this file. */ /* * tex.h */ #include #include #include /* * constants in the outer block */ #define NUL '\0' #define EOLN '\n' #define FALSE 0 #define TRUE 1 #define EMPTY 0 #ifdef INIT #define BUF_SIZE 512 #define DVI_BUF_SIZE 1024 #define ERROR_LINE 78 #define FILE_NAME_SIZE 104 #define FONT_BASE 0 #define FONT_MAX 75 #define FONT_MEM_SIZE 16380 #define HALF_BUF 512 #define HALF_ERROR_LINE 39 #define HASH_SIZE 3000 #define HASH_PRIME 2551 #define HYPH_SIZE 307 #define MAX_IN_OPEN 15 #define MAX_PRINT_LINE 78 #define MAX_STRINGS 5400 #define NEST_SIZE 40 #define PARAM_SIZE 30 #define POOL_SIZE 12000 #define SAVE_SIZE 600 #define STACK_SIZE 200 #define STRING_VACANCIES 1000 #define TRIE_OP_HASH_SIZE 512 #define TRIE_SIZE 8000 #if !defined(BIGG) && !defined(BIG) #define MEM_BOT 0 #define MEM_TOP 7000 #define TOK_BOT 0 #define TOK_TOP 12000 #define MEM_MIN MEM_BOT #define MEM_MAX MEM_TOP #define TOK_MIN TOK_BOT #define TOK_MAX TOK_TOP #define MIN_QUARTERWORD 0 #define MAX_QUARTERWORD 255 #define MIN_HALFWORD 0 #define MAX_HALFWORD 65535 #endif #ifdef BIG #define MEM_BOT 0 #define MEM_TOP 17000 #define TOK_BOT 0 #define TOK_TOP 27000 #define MEM_MIN MEM_BOT #define MEM_MAX MEM_TOP #define TOK_MIN TOK_BOT #define TOK_MAX TOK_TOP #define MIN_QUARTERWORD 0 #define MAX_QUARTERWORD 255 #define MIN_HALFWORD 0 #define MAX_HALFWORD 655350 #endif #ifdef BIGG #define MEM_BOT 0 #define MEM_TOP 27000 #define TOK_BOT 0 #define TOK_TOP 37000 #define MEM_MIN MEM_BOT #define MEM_MAX MEM_TOP #define TOK_MIN TOK_BOT #define TOK_MAX TOK_TOP #define MIN_QUARTERWORD 0 #define MAX_QUARTERWORD 255 #define MIN_HALFWORD 0 #define MAX_HALFWORD 6553500 #endif #else #define BUF_SIZE 512 #define DVI_BUF_SIZE 1024 #define ERROR_LINE 78 #define FILE_NAME_SIZE 104 #define FONT_BASE 0 #define FONT_MAX 75 #define FONT_MEM_SIZE 16380 #define HALF_BUF 512 #define HALF_ERROR_LINE 39 #define HASH_SIZE 3000 #define HASH_PRIME 2551 #define HYPH_SIZE 307 #define MAX_IN_OPEN 15 #define MAX_PRINT_LINE 78 #define MAX_STRINGS 5400 #define NEST_SIZE 40 #define PARAM_SIZE 30 #define POOL_SIZE 12000 #define SAVE_SIZE 600 #define STACK_SIZE 200 #define STRING_VACANCIES 1000 #define TRIE_OP_HASH_SIZE 512 #define TRIE_SIZE 8000 #if !defined(BIGG) && !defined(BIG) #define MEM_BOT 0 #define MEM_TOP 7000 #define TOK_BOT 0 #define TOK_TOP 12000 #define MEM_MIN 0 #define MEM_MAX 16300 #define TOK_MIN 0 #define TOK_MAX 25000 #define MIN_QUARTERWORD 0 #define MAX_QUARTERWORD 255 #define MIN_HALFWORD 0 #define MAX_HALFWORD 65535 #endif #ifdef BIG #define MEM_BOT 0 #define MEM_TOP 17000 #define TOK_BOT 0 #define TOK_TOP 27000 #define MEM_MIN 0 #define MEM_MAX 128000 #define TOK_MIN 0 #define TOK_MAX 45000 #define MIN_QUARTERWORD 0 #define MAX_QUARTERWORD 255 #define MIN_HALFWORD 0 #define MAX_HALFWORD 655350 #endif #ifdef BIGG #define MEM_BOT 0 #define MEM_TOP 27000 #define TOK_BOT 0 #define TOK_TOP 37000 #define MEM_MIN 0 #define MEM_MAX 256000 #define TOK_MIN 0 #define TOK_MAX 65000 #define MIN_QUARTERWORD 0 #define MAX_QUARTERWORD 255 #define MIN_HALFWORD 0 #define MAX_HALFWORD 6553500 #endif #endif /* * types in the outer block */ #define global extern #define ascii unsigned char #define bool int #define byte unsigned char #define fnt int #define gord unsigned char #define gratio float #define group int #define ptr hword #define sc i #define scal long #define str hword #define val long typedef FILE *word_file; typedef FILE *alpha_file; typedef FILE *byte_file; #define qword unsigned char #if defined(BIG) || defined(BIGG) #define hword unsigned long #else #define hword unsigned short #endif typedef union { struct { hword rh; hword lh; } hh1; struct { hword rh; qword b0; qword b1; } hh2; } twoh; typedef struct { qword b0; qword b1; qword b2; qword b3; } fourq; typedef union { long i; gratio gr; twoh hh; fourq qqqq; } mword; /* * variables in the outer block */ global char banner[]; global int ready_already; /* * functions in the outer block */ int final_cleanup(); int close_files_and_terminate(); int initialize(); bool decode_args(); int handle_int(); /* * some common programming idioms */ #define incr(i) ++(i) #define decr(i) --(i) #define odd(i) ((i) & 1) #define abs(i) ((i) >= 0 ? (i) : -(i)) #define round(x) (long) ((x) > 0.0 ? ((x) + 0.5) : ((x) - 0.5)) #define negate(x) (x) = -(x) #define loop while (1)