OSDN Git Service

code clean.
[putex/putex.git] / src / texsourc / texd.h
index b0983d1..d36cae9 100644 (file)
@@ -1,4 +1,6 @@
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+#ifndef _YANDYTEX_TEXD_H
+#define _YANDYTEX_TEXD_H
+
 #define ALLOCATEINI        /* allocate iniTeX (550 k) trie_c, trie_o, trie_l, trie_r, trie_hash, trie_taken */
 #define ALLOCATEMAIN       /* allocate main memory for TeX (2 Meg) zmem = zzzaa */
 #define ALLOCATEFONT       /* allocate font_info (800 k) (dynamically now) */
 #define ALLOCATEPARAMSTACK /* experiment to dynamically deal with param_stack 99/Jan/21 */
 #define ALLOCATEBUFFER     /* experiment to dynamically deal with input buffer 99/Jan/22 */
 #define INCREASEFIXED
-/* increase number of fonts - quarterword 16 bit - max_quarterword limit */
-/* there may still be some bugs with this however ... also may slow down */
-/* also: should split use of quarterword for (i) font from (ii) char */
-/* for example, xeq_level ? hyphenation trie_trc ? */
 #define INCREASEFONTS
-/* make font_info array fmemoryword == 32 bit instead of memory_word = 64 bit */
-#define SHORTFONTINFO
-/* make hash table htwo_halves == 32 bit instead of two_halves == 64 bit */
-/* increase trie_op_size from 751 to 3001 96/Oct/12 */
 #define INCREASETRIEOP
 #define COMPACTFORMAT
 
 #define STAT
 #include "texmf.h"
 
+#define file_name_size PATH_MAX
+
 // #define max_halfword 65535L  /* for 32 bit memory word */
-#define min_halfword -2147483647L /* for 64 bit memory word (signed) */
-#define max_halfword  2147483647L /* for 64 bit memory word (signed) */
+#define min_halfword -2147483647L /* LONG_MIN, for 64 bit memory word (signed) */
+#define max_halfword  2147483647L /* LONG_MAX, for 64 bit memory word (signed) */
 
 #define block_size 1000 /* block_size for variable length node alloc */
 
-/* min_quarterword assumed 0 -- i.e. we use unsigned types for quarterword */
 #define min_quarterword 0
 #ifdef INCREASEFONTS
   #define max_quarterword 65535L
@@ -91,7 +86,7 @@ EXTERN integer max_buf_stack;
 #endif
 
 #ifdef INCREASEFONTS
-  #define font_max 1023
+  #define font_max 65535 //1023 (2^n - 1)
 #else
   #define font_max 255
 #endif
@@ -136,20 +131,12 @@ EXTERN integer max_buf_stack;
   #define max_trie_op       500
 #endif
 
-#ifdef ALLOCATEDVIBUF
-  #define default_dvi_buf_size 16384
-  EXTERN int dvi_buf_size;
-#else
-  #define dvi_buf_size 16384
-#endif
 
-/* #define hash_size 9500  */
-/* #define hash_size 25000 */
-#define hash_size 32768
-/* trick to try and get around eqtb_extra problem */
+#define dvi_buf_size 16384
+
 #define hash_extra (255 - font_max)
-/* hash prime about 85% of hash_size (+ hash_extra) */
-#define hash_prime 27197
+#define hash_prime 27197 // (prime ~ 85% * (hash_size + hash_extra))
+#define hash_size  97280 // 32768 9500 25000
 
 #if (hash_extra != 255 - font_max)
   #error ERROR: hash_extra not equal to (255 - font_max)
@@ -171,6 +158,7 @@ typedef char two_choices;
 typedef char four_choices;
 /* sec 0113 */
 #include "texmfmem.h"
+#include "yandy_macros.h"
 /* sec 0150 */
 typedef char glue_ord; 
 /* sec 0212 */
@@ -203,7 +191,7 @@ typedef integer hyph_pointer;
 EXTERN integer bad;
 EXTERN ASCII_code xord[256];
 EXTERN ASCII_code xchr[256];
-EXTERN unsigned char name_of_file[PATHMAX + 4];
+EXTERN unsigned char name_of_file[file_name_size + 4];
 EXTERN integer name_length;
 
 #ifdef ALLOCATESTRING
@@ -250,25 +238,25 @@ EXTERN boolean arith_error;
 EXTERN scaled tex_remainder;
 EXTERN halfword temp_ptr;
 
+/* sec 0116 */
 #ifdef ALLOCATEMAIN
-  EXTERN memory_word * main_memory;   /* remembered so can be free() later */
+  EXTERN memory_word * main_memory;
   EXTERN memory_word * mem;
 #else
-  EXTERN memory_word 
-  /* #define zmem (zzzaa - (int)(mem_min)) */
-  /*  zzzaa[mem_max - mem_min + 1]; */
+  EXTERN memory_word zzzaa[mem_max - mem_bot + 1];
   #define zmem (zzzaa - (int)(mem_bot))
-  zzzaa[mem_max - mem_bot + 1];
 #endif
 
-EXTERN halfword lo_mem_max;
-EXTERN halfword hi_mem_min;
+EXTERN pointer lo_mem_max;
+EXTERN pointer hi_mem_min;
 EXTERN integer var_used, dyn_used;
-EXTERN halfword avail;
-EXTERN halfword mem_end;
-EXTERN halfword mem_start;
+/* sec 0118 */
+EXTERN pointer avail;
+EXTERN pointer mem_end;
+EXTERN halfword mem_start; // for yandytex
+/* sec 0124 */
 EXTERN halfword rover;
-
+/* sec 0165 */
 /* NOTE: the following really also need to be dynamically allocated */
 #ifdef DEBUG
   #ifdef ALLOCATEMAIN
@@ -309,19 +297,14 @@ EXTERN int old_setting;
   #define eqtb_extra 0
 #endif
 
-/* Probably require eqtb_extra to be zero, so hash_extra = 255 - font_max */
 #if (eqtb_extra != 0)
   #error ERROR: eqtb_extra is not zero (need hash_extra equal 255 - font_max)
 #endif
 
-#ifdef ALLOCATEZEQTB
-  EXTERN memory_word * zeqtb;
+#ifdef INCREASEFONTS
+  EXTERN memory_word eqtb[eqtb_size + 1 + eqtb_extra];
 #else
-  #ifdef INCREASEFONTS
-    EXTERN memory_word eqtb[(hash_size + 4007) + eqtb_extra];
-  #else
-    EXTERN memory_word zeqtb[(hash_size + 4007)];
-  #endif
+  EXTERN memory_word eqtb[eqtb_size + 1];
 #endif
 
 #ifdef INCREASEFONTS
@@ -330,31 +313,19 @@ EXTERN int old_setting;
   #define xeq_level (zzzad - (int_base))
 #endif
 
-EXTERN quarterword zzzad[844];
-/* region 5 & 6 int_base to eqtb_size: 13507 - 12663 */
+EXTERN quarterword zzzad[eqtb_size - int_base + 1];
 
 #ifdef ALLOCATEHASH
-  #ifdef SHORTHASH
-    EXTERN htwo_halves *zzzae;
-  #else
-    EXTERN two_halves *zzzae;
-  #endif
-
-  #define hash (zzzae - 514)
+  EXTERN two_halves *zzzae;
+  #define hash (zzzae - hash_base)
 #else
-  #ifdef SHORTHASH
-    EXTERN htwo_halves 
-  #else
-    EXTERN two_halves 
-  #endif
-
-  #define hash (zzzae - 514)
-
   #ifdef INCREASEFONTS
-    zzzae[hash_size + 267 + eqtb_extra];
+    EXTERN two_halves zzzae[undefined_control_sequence - hash_base + eqtb_extra];
   #else
-    zzzae[hash_size + 267];
+    EXTERN two_halves zzzae[undefined_control_sequence - hash_base];
   #endif
+
+  #define hash (zzzae - hash_base)
 #endif
 
 EXTERN halfword hash_used;
@@ -448,7 +419,7 @@ EXTERN int cur_val;
 EXTERN int cur_val_level;
 EXTERN int radix;
 EXTERN int cur_order;
-EXTERN alpha_file read_file[16];  /* hard wired limit in TeX */
+EXTERN alpha_file read_file[16];
 EXTERN char read_open[20];
 EXTERN halfword cond_ptr;
 EXTERN int if_limit;
@@ -498,9 +469,7 @@ EXTERN integer hyphen_char[font_max + 1];
 EXTERN integer skew_char[font_max + 1];
 EXTERN font_index bchar_label[font_max + 1];
 EXTERN short font_bchar[font_max + 1];
-/* don't change above to int or format file will be incompatible */
 EXTERN short font_false_bchar[font_max + 1];
-/* don't change above to int or format file will be incompatible */
 EXTERN integer char_base[font_max + 1];
 EXTERN integer width_base[font_max + 1];
 EXTERN integer height_base[font_max + 1];
@@ -537,7 +506,7 @@ EXTERN scaled pdf_delta_h, pdf_delta_v;
 EXTERN scaled cur_h, cur_v;
 EXTERN internal_font_number dvi_f;
 EXTERN internal_font_number pdf_f;
-EXTERN integer cur_s; /* sec 616 */
+EXTERN integer cur_s;
 EXTERN scaled total_stretch[4], total_shrink[4];
 EXTERN integer last_badness;
 EXTERN halfword adjust_tail;
@@ -623,8 +592,6 @@ EXTERN small_number hyf_num[trie_op_size + 1];
 EXTERN trie_op_code hyf_next[trie_op_size + 1];
 EXTERN integer op_start[256];
 
-/* if ALLOCATEHYPHEN is true, then hyphen_prime is a variable */
-/* otherwise it is a pre-processor defined constant */
 #ifdef ALLOCATEHYPHEN
   #define default_hyphen_prime 1009
   EXTERN str_number * hyph_word;
@@ -656,19 +623,20 @@ EXTERN trie_op_code max_op_used;
     EXTERN trie_pointer *trie_l;      /* left subtrie links */
     EXTERN trie_pointer *trie_r;      /* right subtrie links */
     EXTERN trie_pointer *trie_hash;   /* used to identify equivlent subtries */
-  #else /* end ALLOCATEINI */
+  #else
     EXTERN packed_ASCII_code trie_c[trie_size + 1];
     EXTERN trie_op_code trie_o[trie_size + 1];
     EXTERN trie_pointer trie_l[trie_size + 1];
     EXTERN trie_pointer trie_r[trie_size + 1];
     EXTERN trie_pointer trie_hash[trie_size + 1];
-  #endif /* end not ALLOCATEINI */
+  #endif
+
   EXTERN trie_pointer trie_ptr;
-#endif /* INITEX */
+#endif
 
 #ifdef INITEX
   #ifdef ALLOCATEINI
-    EXTERN char *trie_taken;
+    EXTERN char * trie_taken;
   #else
     EXTERN boolean trie_taken[trie_size + 1];
   #endif
@@ -676,15 +644,12 @@ EXTERN trie_op_code max_op_used;
   EXTERN trie_pointer trie_min[256];
   EXTERN trie_pointer trie_max;
   EXTERN boolean trie_not_ready;
-#endif /* INITEX */
+#endif
 
 EXTERN scaled best_height_plus_depth;
 EXTERN halfword page_tail;
 EXTERN int page_contents;
 
-/* do *some* sanity checking here --- rather than in TeX later 96/Jan/18 */
-/* (cannot catch everything here, since some is now dynamic) */
-
 #if (half_error_line < 30) || (half_error_line > error_line - 15)
   #error ERROR: (half_error_line < 30) || (half_error_line > error_line - 15) BAD 1
 #endif
@@ -739,19 +704,19 @@ EXTERN integer last_penalty;
 EXTERN scaled last_kern;
 EXTERN integer insert_penalties;
 EXTERN boolean output_active;
+/* sec 1032 */
 EXTERN internal_font_number main_f;
-
 EXTERN four_quarters main_i;
 EXTERN four_quarters main_j;
-
 EXTERN font_index main_k;
-EXTERN halfword main_p;
+EXTERN pointer main_p;
 EXTERN integer main_s;
 EXTERN halfword bchar;
 EXTERN halfword false_bchar;
 EXTERN boolean cancel_boundary;
 EXTERN boolean ins_disc;
-EXTERN halfword cur_box;
+/* sec 1074 */
+EXTERN pointer cur_box;
 EXTERN halfword after_token;
 EXTERN boolean long_help_seen;
 EXTERN str_number format_ident;
@@ -768,7 +733,7 @@ EXTERN pool_pointer edit_name_start;
 EXTERN integer edit_name_length, edit_line;
 EXTERN int tfm_temp;
 
-/* new stuff defined in local.c - bkph */
+/* new variables defined in local.c */
 EXTERN boolean is_initex;
 EXTERN boolean verbose_flag;
 EXTERN boolean trace_flag;
@@ -786,13 +751,11 @@ EXTERN boolean show_fonts_used;
 EXTERN boolean reset_exceptions;
 EXTERN boolean show_current;
 EXTERN boolean return_flag;
-EXTERN boolean want_version;
 EXTERN boolean civilize_flag;
 EXTERN boolean show_numeric;
 EXTERN boolean restrict_to_ascii;
 EXTERN boolean show_missing;
 EXTERN boolean full_file_name_flag;
-EXTERN boolean save_strings_flag;
 EXTERN int mem_initex;
 EXTERN int mem_extra_high;
 EXTERN int mem_extra_low;
@@ -814,8 +777,6 @@ EXTERN char * format_file;
 EXTERN char * source_direct;
 EXTERN char * format_name;
 EXTERN char * encoding_name;
-EXTERN boolean format_specific;
-EXTERN boolean encoding_specific;
 EXTERN boolean show_line_break_stats;
 EXTERN int first_pass_count;
 EXTERN int second_pass_count;
@@ -830,8 +791,6 @@ EXTERN FILE * errout;
 EXTERN int font_dimen_zero;
 EXTERN int ignore_frozen;
 EXTERN boolean suppress_f_ligs;
-EXTERN int abort_flag;
-EXTERN int err_level;
 EXTERN int jump_used;
 EXTERN jmp_buf jumpbuffer;
 extern int current_pool_size;
@@ -843,9 +802,9 @@ extern int current_stack_size;
 extern int current_nest_size;
 extern int current_param_size;
 extern int current_buf_size;
-extern char *tex_version;
-extern char *application;
-extern char *yandyversion;
+extern const char *tex_version;
+extern const char *application;
+extern const char *yandyversion;
 extern unsigned char wintodos[128];
 extern char log_line[MAXLINE];
 extern char *texpath;
@@ -869,7 +828,6 @@ void print_cs_names (FILE *, int);
 void perrormod(char *);
 char *grabenv(char *);
 void stamp_it (char *);
-void stampcopy (char *);
 boolean prime (int);
 int endit (int);
 
@@ -882,34 +840,39 @@ void call_edit (ASCII_code *filename, pool_pointer fnstart,
 
 void add_variable_space(int);
 
-void get_date_and_time (integer *minutes, integer *day,
-                        integer *month, integer *year);
-
 char *unixify (char *);
 
-#include "yandy_macros.h"
 #include "coerce.h"
 
 /* sec 79 */
+extern void node_list_display(integer p);
+extern void do_nothing(void);
+extern void update_terminal(void);
+extern void check_full_save_stack(void);
+extern void push_input(void);
+extern void pop_input(void);
+extern void print_err (const char * s);
+extern void ensure_dvi_open(void);
+extern void write_dvi(size_t a, size_t b);
+extern void prompt_input(const char *s);
 extern void synch_h(void);
 extern void synch_v(void);
 extern void set_cur_lang(void);
-extern str_number make_string_pool (char *s);
 extern char * md5_file(FILE * in_file);
-extern INLINE void str_room_ (int val);
-#define str_room(a) str_room_((int) a)
-extern INLINE void tail_append_ (pointer val);
+extern void str_room(int val);
+extern void tail_append_(pointer val);
 #define tail_append(a) tail_append_((pointer) a)
-extern INLINE void tex_help (unsigned int n, ...);
-extern INLINE void append_char(ASCII_code c);
-extern INLINE void append_lc_hex(ASCII_code c);
-extern INLINE void succumb(void);
-extern INLINE void dvi_out_ (ASCII_code op);
+extern void tex_help(unsigned int n, ...);
+extern void append_char(ASCII_code c);
+extern void append_lc_hex(ASCII_code c);
+extern void succumb(void);
+extern void dvi_out_(ASCII_code op);
 #define dvi_out(op) dvi_out_((ASCII_code) (op))
-extern INLINE void free_avail_(halfword p);
+extern void free_avail_(halfword p);
 #define free_avail(p) free_avail_((halfword) (p))
-extern INLINE void flush_string (void);
-extern int load_pool_strings (integer spare_size);
+extern void flush_string (void);
+extern str_number load_pool_strings (integer spare_size);
+extern str_number make_string_pool (const char *s);
 #define help0()     tex_help(0)
 #define help1(...)  tex_help(1, __VA_ARGS__)
 #define help2(...)  tex_help(2, __VA_ARGS__)
@@ -918,23 +881,5 @@ extern int load_pool_strings (integer spare_size);
 #define help5(...)  tex_help(5, __VA_ARGS__)
 #define help6(...)  tex_help(6, __VA_ARGS__)
 
-/********BINDING WITH LIBHARU*********/
-typedef struct _mapping_table mapping_table;
-typedef struct _mapping_entry mapping_entry;
-EXTERN HPDF_Doc  yandy_pdf;
-EXTERN HPDF_Page yandy_page;
-EXTERN HPDF_Font yandy_font[1024];
-EXTERN boolean pdf_doing_string;
-EXTERN boolean pdf_doing_text;
-EXTERN integer scaled_out;
-EXTERN boolean pdf_output_flag;
-EXTERN mapping_table * gentbl;
-EXTERN mapping_table * font_name_hash_init (void);
-EXTERN void font_name_hash_free (mapping_table * tbl);
-EXTERN void pdf_ship_out(pointer p);
-EXTERN void pdf_vlist_out (void);
-EXTERN void pdf_hlist_out (void);
-EXTERN void pdf_begin_text(void);
-EXTERN void pdf_font_def(internal_font_number f);
-EXTERN void pdf_error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user_data);
-/********BINDING WITH LIBHARU*********/
\ No newline at end of file
+EXTERN boolean shipout_flag;
+#endif
\ No newline at end of file