OSDN Git Service

65535 fonts support (adjusted hash array).
[putex/putex.git] / src / texsourc / texd.h
index fb7be91..6e7229e 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
-#define SHORTFONTINFO
 #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 */
 
@@ -87,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
@@ -132,16 +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 32768 // 9500 25000
+#define dvi_buf_size 16384
+
 #define hash_extra (255 - font_max)
-#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)
@@ -163,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 */
@@ -195,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[PATH_MAX + 4];
+EXTERN unsigned char name_of_file[file_name_size + 4];
 EXTERN integer name_length;
 
 #ifdef ALLOCATESTRING
@@ -244,14 +240,11 @@ 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 pointer lo_mem_max;
@@ -304,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
@@ -325,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;
@@ -443,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;
@@ -493,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];
@@ -532,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;
@@ -618,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;
@@ -651,15 +623,16 @@ 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
@@ -671,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
@@ -763,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;
@@ -787,7 +757,6 @@ 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;
@@ -823,8 +792,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;
@@ -875,32 +842,33 @@ 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 INLINE void synch_h(void);
-extern INLINE void synch_v(void);
-extern INLINE void set_cur_lang(void);
-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 inline void push_input(void);
+extern inline void pop_input(void);
+extern inline void print_err (const char * s);
+extern inline void ensure_dvi_open(void);
+extern inline void write_dvi(size_t a, size_t b);
+extern inline void prompt_input(const char *s);
+extern inline void synch_h(void);
+extern inline void synch_v(void);
+extern inline void set_cur_lang(void);
+extern char * md5_file (FILE * in_file);
+extern inline void str_room (int val);
+extern inline 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 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);
 #define dvi_out(op) dvi_out_((ASCII_code) (op))
-extern INLINE void free_avail_(halfword p);
+extern inline void free_avail_(halfword p);
 #define free_avail(p) free_avail_((halfword) (p))
-extern INLINE void flush_string (void);
+extern inline 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)
@@ -911,23 +879,5 @@ extern str_number make_string_pool (const char *s);
 #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 shipout_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
+#endif
\ No newline at end of file