-/* 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
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
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 '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
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