OSDN Git Service

added some codes.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Fri, 9 May 2014 01:25:42 +0000 (09:25 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Fri, 9 May 2014 01:25:42 +0000 (09:25 +0800)
src/texsourc/local.c
src/texsourc/openinou.c
src/texsourc/texd.h
src/texsourc/yandytex.c
src/texsourc/yandytex.h

index a1800c7..e0e15d3 100644 (file)
@@ -579,7 +579,11 @@ void *ourrealloc (void *old, size_t new_size)
   if (old == NULL)
     return malloc (new_size);  /* no old block - use malloc */
 
+#ifdef MSDOS
   old_size = _msize (old);
+#else
+  old_size = malloc_usable_size (old);
+#endif
 
   if (old_size >= new_size && old_size < new_size + 4)
     return old;
@@ -2390,7 +2394,6 @@ char *grabenv (char *varname)
     return NULL;
 
 /*  speedup to avoid double lookup when called from set_paths in ourpaths.c */
-/*  if (lastname != NULL && strcmp(lastname, varname) == 0) { */
   if (lastname != NULL && _strcmpi(lastname, varname) == 0)
   {
     if (trace_flag)
@@ -3103,7 +3106,7 @@ void perrormod (char *s)
   show_line(log_line, 1);
 }
 
-void pause (void)
+void yandy_pause (void)
 {
 #ifndef _WINDOWS
   fflush(stdout);     /* ??? */
@@ -3136,7 +3139,7 @@ void checkpause (int flag)
       show_line("\n", 0);
 #ifndef _WINDOWS
       show_line("Press any key to continue . . .\n", 0);
-      pause();
+      yandy_pause();
 #endif
     }
   }
index e079dea..2cee0f4 100644 (file)
@@ -36,7 +36,6 @@ extern int shorten_file_name;       /* in local.c bkph */
   extern void funny_core_dump();
 #endif
 
-#ifdef MSDOS
 
 #ifdef BUILDNAMEDIRECT
 // similar to concat, but AVOIDS using malloc, pass in place to put result
@@ -82,9 +81,6 @@ char *xconcat3 (char *buffer, char *s1, char *s2, char *s3)
 }
 #endif
 
-#endif
-
-#ifdef MSDOS
 // separated out 1996/Jan/20 to make easier to read
 // assumes path does not end in PATH_SEP
 void patch_in_path (unsigned char *buffer, unsigned char *name, unsigned char *path)
@@ -127,7 +123,7 @@ int prepend_path_if (unsigned char *buffer, unsigned char *name, char *ext, unsi
 
   return 1;
 }
-#endif      /* end of MSDOS */
+
 
 //  Following works on null-terminated strings
 void check_short_name (unsigned char *s)
@@ -194,13 +190,11 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
     funny_core_dump();
 #endif
 
-#ifdef MSDOS
   if (return_flag)
   {
     if (strcmp(fopen_mode, "r") == 0)
       fopen_mode = "rb";    /* so can catch `return' bkph */
   }
-#endif /* MSDOS */
 
   name_of_file[name_length + 1] = '\0'; /* null terminate */
 
@@ -209,13 +203,11 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
   if (pseudo_tilde != 0 || pseudo_space != 0)
     retwiddle(name_of_file + 1);
 
-#ifdef MSDOS
 /* 8 + 3 file names on Windows NT 95/Feb/20 */
   if (shorten_file_name)
   {
     check_short_name(name_of_file + 1);
   }
-#endif  /* MSDOS */
   
   if (open_trace_flag)
   {
@@ -267,7 +259,6 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
       //ungetc(tfm_temp, *f);
     } 
 
-#ifdef MSDOS
     if (strstr((char *) name_of_file + 1, ".fmt") != NULL)
     {
       if (format_file == NULL)
@@ -319,7 +310,7 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
         show_line(log_line, 0);
       }
     }
-#endif  /* end of MSDOS */
+
     openable = true;
   }
 
@@ -379,15 +370,12 @@ bool open_output (FILE **f, char *fopen_mode)
     retwiddle(name_of_file + 1);
   }
 
-#ifdef MSDOS
 /* 8 + 3 file names on Windows NT 95/Feb/20 */
   if (shorten_file_name)
   {
     check_short_name(name_of_file + 1);
   }
-#endif
 
-#ifdef MSDOS
   if (prepend_path_if (name_of_file + 1, name_of_file + 1, ".dvi", (unsigned char *) dvi_directory) ||
       prepend_path_if (name_of_file + 1, name_of_file + 1, ".log", (unsigned char *) log_directory) ||
       prepend_path_if (name_of_file + 1, name_of_file + 1, ".aux", (unsigned char *) aux_directory) ||
@@ -400,7 +388,6 @@ bool open_output (FILE **f, char *fopen_mode)
       show_line(log_line, 0);
     }
   }
-#endif
 
   if (open_trace_flag)
   {
index 9c48015..079eb14 100644 (file)
@@ -1,44 +1,28 @@
-//#include "hpdf.h"
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-#ifdef MSDOS
-  #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 ALLOCATETRIES      /* allocate hyphenation trie stuff (270 k) trie_trl, trie_tro, trie_trc */
-  #define ALLOCATEHYPHEN     /* allocate hyphenation exception tables */
-  #define VARIABLETRIESIZE   /* allow trie_size to be variable */
-  #define ALLOCATESTRING     /* allocate strings and string pointers (184 k)str_pool & str_start */
-  #define ALLOCATESAVESTACK  /* experiment to dynamically deal with save_stack 99/Jan/4 */
-  #define ALLOCATEINPUTSTACK /* experiment to dynamically deal with input_stack 99/Jan/21 */
-  #define ALLOCATENESTSTACK  /* experiment to dynamically deal with nest_stack 99/Jan/21 */
-  #define ALLOCATEPARAMSTACK /* experiment to dynamically deal with param_stack 99/Jan/21 */
-  #define ALLOCATEBUFFER     /* experiment to dynamically deal with input buffer 99/Jan/22 */
-  /* NOT *//* allow increasing high area of main memory */ /* FLUSH */
-  #undef ALLOCATEHIGH
-  /* NOT *//* allow increasing low area of main memory */ /* FLUSH */
-  #undef ALLOCATELOW
-  /* NOT */ /* allocate hash table (zzzae) (78k) */
-  #undef ALLOCATEHASH
-  /* NOT */ /* allocate dvi_buf (16k) */ /* changed in 1.3 1996/Jan/18 */
-  /* #define ALLOCATEDVIBUF */
-  #undef ALLOCATEDVIBUF
-  /* increase fixed allocations */
-  #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
-  /* NOT NOT *//* allocate eqtb (108k) */ /* changed in 1.3 1996/Jan/18 */
-  #undef ALLOCATEZEQTB
-  /* make font_info array fmemoryword == 32 bit instead of memory_word = 64 bit */
-  #define SHORTFONTINFO
-  /* make hash table htwohalves == 32 bit instead of twohalves == 64 bit */
-  // #define SHORTHASH  --- changed 2000/Feb/22 increase max_strings from 64K to 512M
-  #undef SHORTHASH
-  /* increase trie_op_size from 751 to 3001 96/Oct/12 */
-  #define INCREASETRIEOP
-#endif
+#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 ALLOCATETRIES      /* allocate hyphenation trie stuff (270 k) trie_trl, trie_tro, trie_trc */
+#define ALLOCATEHYPHEN     /* allocate hyphenation exception tables */
+#define VARIABLETRIESIZE   /* allow trie_size to be variable */
+#define ALLOCATESTRING     /* allocate strings and string pointers (184 k)str_pool & str_start */
+#define ALLOCATESAVESTACK  /* experiment to dynamically deal with save_stack 99/Jan/4 */
+#define ALLOCATEINPUTSTACK /* experiment to dynamically deal with input_stack 99/Jan/21 */
+#define ALLOCATENESTSTACK  /* experiment to dynamically deal with nest_stack 99/Jan/21 */
+#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 htwohalves == 32 bit instead of twohalves == 64 bit */
+/* increase trie_op_size from 751 to 3001 96/Oct/12 */
+#define INCREASETRIEOP
+
 
 /* With old PharLap linker it was important to avoid large fixed allocation */
 /* Now may be better to use fixed arrays rather than allocate them */
index e51eb51..e4118f1 100644 (file)
@@ -48,9 +48,7 @@ char **gargv;   /* char *gargv[] -- bkph ? */
 /* The entry point: set up for reading the command line, which will
    happen in `t_open_in', then call the main body.  */
 
-#ifdef MSDOS
-  int main_init(int, char **);     /* in local.c */
-#endif /* INIVIR */
+int main_init(int, char **);     /* in local.c */
 
 int jump_used = 0;
 
@@ -798,7 +796,11 @@ void call_edit (ASCII_code *stringpool, pool_pointer fnstart, integer fnlength,
   }
 
 /*  You must explicitly flush (using fflush or _flushall) or close any stream before calling system. */
+#ifdef MSDOS
   _flushall();
+#else
+  fflush(NULL);
+#endif
 /*  Try and execute the command.  */
 /*  There may be problem here with long names and spaces ??? */
 /*  Use _exec or _spawn instead ??? */
index 2f6ad9a..93271a4 100644 (file)
@@ -60,7 +60,7 @@
 #include "hpdf_utils.h"
 #include "avl.h"
 
-typedef long        integer;
+typedef int         integer;
 typedef double      glue_ratio;
 typedef boolean     bool;
 typedef double      real;