1 /* Copyright 2007 TeX Users Group
2 Copyright 2014 Clerk Ma
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 #pragma warning(disable:4115) // kill rpcasync.h complaint
25 #define MYLIBAPI __declspec(dllexport)
28 #pragma warning(disable:4996)
29 #pragma warning(disable:4131) // old style declarator
30 #pragma warning(disable:4135) // conversion between different integral types
31 #pragma warning(disable:4127) // conditional expression is constant
39 #include <io.h> // needed for _finddata_t
40 #include <ctype.h> // needed for isascii and isalpha
42 #define NAME_MAX 255 // max size of name component
45 #define PATH_SEP_STRING "/"
46 #define PATH_DELIMITER ';'
47 #define PATH_DELIMITER_STRING ";"
49 // default paths to look for things
51 #define TEXPATH "C:/yandy/yandytex/"
52 #define TEXFORMATS "C:/yandy/yandytex/fmt"
53 #define TEXPOOL "C:/yandy/yandytex/pool"
54 #define TEXFONTS "C:/yandy/yandytex/tfm"
55 #define TEXINPUTS TEXPATH "tex//;" "C:/tex;" "C:/texinput"
57 extern bool usesourcedirectory; /* in local.c */
59 extern bool workingdirectory; /* in local.c */
61 string truncate_pathname (string name);
63 // the following do *not* use MALLOC
64 extern char * xconcat (char *buffer, char *s1, char *s2); /* openinou.c */
65 extern char * xconcat3 (char *buffer, char *s1, char *s2, char *s3); /* openinou.c */
67 /////////////////////////////////////////////////////////////////////////
69 // used only in jump_out in tex0.c, and in texbody in itex.c
70 // and main in texmf.c and a few other abort situations in texmf.c
71 /* texk/web2c/lib/uexit.c */
72 void uexit (int unix_code)
81 final_code = EXIT_SUCCESS;
82 else if (unix_code == 1)
83 final_code = EXIT_FAILURE;
85 final_code = unix_code;
89 show_line("Jump Buffer already used\n", 1);
96 /* texk/web2c/lib/zround.c */
97 integer zround (double r)
101 if (r > 2147483647.0)
103 else if (r < -2147483647.0)
106 i = (integer) (r + 0.5);
108 i = (integer) (r - 0.5);
112 /* texk/web2c/lib/eofeoln.c */
113 bool eoln (FILE * file)
123 (void) ungetc (c, file);
125 return c == '\n' || c == '\r' || c == EOF;
128 char * read_a_line (FILE *f, char *line, int limit)
133 while ((c = getc (f)) != EOF)
135 if (c == '\n' || c == '\r')
138 else continue; /* ignore \r\n and blank lines */
141 line[loc] = (char) c;
144 if (loc == limit - 1)
146 sprintf(log_line, " ERROR: line too long\n");
147 show_line(log_line, 1);
154 if (c != EOF || loc > 0)
156 line[loc] = '\0'; /* terminate */
157 return line; /* and return */
160 return(NULL); /* true EOF */
163 /* Modified 97/May/17 to avoid malloc for each line read */
169 /* Unixify filename and path (turn \ into /) --- assumes null terminated */
171 char *unixify (char * t)
176 return s; /* paranoia -- 1993/Apr/10 */
181 while (*s != '\0') { /* paranoia -- 1997/Oct/23 */
182 /* if (*s == '\\') *s = '/'; */
192 sprintf(log_line, "Unixified name: %s\n", t);
193 show_line(log_line, 0);
200 /* NOTE: _dos_find... prevents running under Windows NT as console app ??? */
201 /* Yes, so lets flush it! use _findfirst, _findnext, _findclose instead */
203 char *get_env_shroud (char *); /* in texmf.c */