-/* Copyright 2007 TeX Users Group\r
+/*\r
+ Copyright 2007 TeX Users Group\r
Copyright 2014 Clerk Ma \r
\r
This program is free software; you can redistribute it and/or modify\r
You should have received a copy of the GNU General Public License\r
along with this program; if not, write to the Free Software\r
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- 02110-1301 USA. */\r
+ 02110-1301 USA.\r
+*/\r
+\r
+#if defined (__ANDROID__)\r
+ #define malloc_usable_size dlmalloc_usable_size\r
+#elif defined (__APPLE__)\r
+ #include <malloc/malloc.h>\r
+ #define malloc_usable_size malloc_size\r
+#endif\r
\r
#define EXTERN extern\r
\r
#define REALLOC realloc\r
#endif\r
\r
-#if defined (__ANDROID__)\r
- #define malloc_usable_size dlmalloc_usable_size\r
-#elif defined (__APPLE__)\r
- #define malloc_usable_size malloc_size\r
-#endif\r
-\r
#if defined (__clang__)\r
-const char * compiler = "Clang/LLVM";\r
+const char * compiler = "Clang";\r
#elif defined (__GNUC__) || defined(__GNUG__)\r
const char * compiler = "GCC";\r
#elif defined (_MSC_VER)\r
const char * compiler = "MSVC";\r
+#else\r
+const char * compiler = "Unknown";\r
#endif\r
\r
#if defined (_WIN64)\r
{\r
char dist_ver[256];\r
memset(dist_ver, 0, sizeof(dist_ver));\r
- sprintf(dist_ver, "%s (%s %s/%s)", banner, application, yandyversion, dist);\r
+ sprintf(dist_ver, "%s (%s %s)", banner, application, yandyversion);\r
prints(dist_ver);\r
}\r
\r
boolean format_spec = false;\r
boolean reorder_arg_flag = true; /* put command line flags/arguments first */\r
\r
-/* Mapping from Windows ANSI to DOS code page 850 96/Jan/20 */\r
-\r
-unsigned char wintodos[128] =\r
-{\r
- 0, 0, 0, 159, 0, 0, 0, 0,\r
- 94, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 96, 39, 0, 0, 7, 0, 0,\r
- 126, 0, 0, 0, 0, 0, 0, 0,\r
- 32, 173, 189, 156, 207, 190, 221, 21,\r
- 0, 184, 166, 174, 170, 45, 169, 0,\r
- 248, 241, 253, 252, 0, 230, 20, 250,\r
- 0, 251, 167, 175, 172, 171, 243, 168,\r
- 183, 181, 182, 199, 142, 143, 146, 128,\r
- 212, 144, 210, 211, 222, 214, 215, 216,\r
- 209, 165, 227, 224, 226, 229, 153, 158,\r
- 157, 235, 233, 234, 154, 237, 232, 225,\r
- 133, 160, 131, 198, 132, 134, 145, 135,\r
- 138, 130, 136, 137, 141, 161, 140, 139,\r
- 208, 164, 149, 162, 147, 228, 148, 246,\r
- 155, 151, 163, 150, 129, 236, 231, 152\r
-};\r
-\r
void show_usage (void)\r
{\r
printf("\n"\r
- "Useage: yandytex [OPTION]... [+format_file] [tex_file]\n\n"\r
+ "Useage: yandytex [OPTION]... [+format_file] [file]\n\n"\r
"--help -? show this usage summary\n"\r
"--initex -i start up as initex (create format file)\n"\r
"--verbose -v be verbose (show implementation version number)\n"\r
" (complain instead)\n"\r
"--showhex -w do not show `non ASCII' characters in hexadecimal\n"\r
" (show as is)\n"\r
- "--nodos -d do not allow DOS style file names - i.e. do not convert\n"\r
- " \\ to /\n"\r
- "--nomac -r do not allow Mac style termination - i.e. do not convert\n"\r
- " \\r to \\n\n"\r
"--patterns -p allow use of \\patterns after loading format (initex only)\n"\r
"--knuthify -K disable all extensions to basic TeX\n"\r
"--main-mem -m initial main memory size in kilo words (initex only)\n"\r
date[9] = '0';\r
}\r
\r
-// Thu Sep 27 06:26:35 1990 => 1990 Sep 27 06:26:35\r
-void lcivilize (char * date)\r
-{\r
- int k;\r
- char pyear[6];\r
-\r
- strcpy(pyear, date + 20);\r
-\r
- for (k = 18; k >= 0; k--)\r
- date[k + 1] = date[k];\r
-\r
- date[20] = '\0';\r
-\r
- for (k = 0; k < 4; k++)\r
- date[k] = pyear[k];\r
-\r
- date[4] = ' ';\r
-}\r
-\r
void stamp_it (char * s)\r
{\r
char date[11 + 1];\r
\r
strcpy(date, compiledate);\r
scivilize(date);\r
- sprintf(s, "%s %s (compiled time: %s %s with %s)",\r
- application, yandyversion, date, compiletime, compiler);\r
+ sprintf(s, "%s %s (compiled time: %s %s with %s/%s)",\r
+ application, yandyversion, date, compiletime, dist, compiler);\r
s += strlen(s);\r
}\r
\r
{\r
if (log_opened)\r
{\r
- fprintf(log_file, "\n! Unable to allocate %d bytes for %s\n", n, s);\r
+ log_printf("\n! Unable to allocate %d bytes for %s\n", n, s);\r
show_maximums(log_file);\r
}\r
\r
#ifdef ALLOCATEPARAMSTACK\r
int current_param_size = 0;\r
\r
-halfword *realloc_param_stack (int size)\r
+halfword * realloc_param_stack (int size)\r
{\r
int k, min_size;\r
int n = 0, new_size = 0;\r
return true;\r
}\r
\r
-int quitflag = 0;\r
boolean show_use = false;\r
\r
void complainarg (int c, char *s)\r
restrict_to_ascii = false; /* don't complain non ASCII */\r
allow_patterns = false; /* don't allow pattern redefinition */\r
show_in_hex = true; /* show character code in hex */\r
- show_in_dos = false; /* redundant with previous */\r
show_numeric = false; /* don't show character code decimal */\r
show_missing = false; /* don't show missing characters */\r
civilize_flag = false; /* don't reorder date fields */\r
c_style_flag = false; /* don't add file name to error msg */\r
show_fmt_flag = false; /* don't show format file in log */\r
show_tfm_flag = false; /* don't show metric file in log */\r
- tab_step = 0;\r
+ tab_step = 0; /* tab's size of width */\r
show_line_break_stats = false; /* do not show line break stats */\r
show_fonts_used = false;\r
default_rule = 26214; /* revert to default rule thickness */\r
case 'w':\r
show_in_hex = true;\r
break;\r
- case 'j':\r
- show_in_dos = true;\r
- break;\r
case 'n':\r
restrict_to_ascii = true; /* 0 - 127 1994/Jan/21 */\r
break;\r
case 't':\r
trace_flag = true;\r
break;\r
- case 'q':\r
- quitflag++; /* 93/Dec/16 */\r
- break;\r
/* The following are really obscure and should not be advertized */\r
case 's':\r
show_current = false;\r
analyze_flag(c, optargnew);\r
}\r
\r
- if (show_use || quitflag == 3)\r
+ if (show_use)\r
{\r
stamp_it(log_line);\r
strcat(log_line, "\n");\r
show_line(log_line, 0);\r
-\r
- if (show_use)\r
- show_usage();\r
- else if (quitflag == 3)\r
- {\r
- strcat(log_line, "\n");\r
- show_line(log_line, 0);\r
- }\r
-\r
+ show_usage();\r
return -1; // failure\r
} \r
\r
\r
int init_commands (int ac, char **av)\r
{\r
- shipout_flag = out_dvi_flag;\r
is_initex = false; \r
allow_patterns = false;\r
reset_exceptions = false;\r
verbose_flag = false;\r
restrict_to_ascii = false;\r
show_in_hex = false; /* default is not to show as hex code ^^ 00/Jun/18 */\r
- show_in_dos = false; /* default is not to translate to DOS 850 */ \r
return_flag = true; // hard wired now\r
trimeof = true; // hard wired now\r
deslash = true;\r
if (mem_initex < 0)\r
mem_initex = 0;\r
\r
- if (is_initex)\r
- {\r
- #if defined(ALLOCATEHIGH) || defined(ALLOCATELOW)\r
- if (mem_extra_high != 0 || mem_extra_low != 0)\r
- {\r
- puts("ERROR: Cannot extend main memory in initex");\r
- mem_extra_high = 0;\r
- mem_extra_low = 0;\r
- }\r
-#endif\r
- }\r
- else\r
+ if (!is_initex)\r
{\r
if (mem_initex != 0)\r
{\r
/* trie_size = 0; */\r
}\r
}\r
+\r
if (mem_initex == 0)\r
mem_initex = default_mem_top;\r
\r
return 0;\r
}\r
\r
+#ifdef __APPLE__\r
+#undef CLK_TCK\r
+#endif\r
#define CLK_TCK CLOCKS_PER_SEC\r
\r
+\r
void show_inter_val (clock_t inter_val)\r
{\r
int seconds, tenths, hundredth, thousands;\r
show_line("0", 0);\r
}\r
\r
-int endit(int flag)\r
+int endit (int flag)\r
{\r
finish_time = clock();\r
\r
\r
checksum = (((font_check[f].b0) << 8 | font_check[f].b1) << 8 | font_check[f].b2) << 8 | font_check[f].b3;\r
decode_fourty(checksum, checksumvector);\r
- fprintf(log_file, "encoding: %s..", checksumvector);\r
+ log_printf("encoding: %s..", checksumvector);\r
}\r
\r
putc('\n', log_file);\r
\r
fnumtable = (short *) malloc(fcount * sizeof(short));\r
\r
- fprintf(log_file, "\nUsed %d font%s:\n", fcount, (fcount == 1) ? "" : "s");\r
+ log_printf("\nUsed %d font%s:\n", fcount, (fcount == 1) ? "" : "s");\r
\r
fcount = 0;\r
\r