home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
gnuish
/
m4v05.arc
/
patches
< prev
next >
Wrap
Text File
|
1990-11-01
|
48KB
|
1,750 lines
*** e:\tmp/RCSt1006154 Sat Oct 27 09:53:50 1990
--- builtin.c Sat Oct 27 09:35:08 1990
***************
*** 16,21 ****
--- 16,34 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+ /*
+ * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+ * This port is also distributed under the terms of the
+ * GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * Please note that this file is not identical to the
+ * original GNU release, you should have received this
+ * code as patch to the official release.
+ *
+ * $Header: e:/gnu/m4/RCS/builtin.c 0.5.1.0 90/09/28 18:34:53 tho Exp $
+ */
/*
* Code for all builtin macros, initialisation of symbol table, and
***************
*** 32,37 ****
--- 45,110 ----
* "builtin_tab" is both used for initialisation, and by the "builtin"
* builtin.
*/
+
+ #ifdef MSDOS
+
+ #include <process.h>
+ #include <errno.h>
+ #include <io.h>
+
+ #define M4_ARGS \
+ struct obstack *obs, int argc, struct token_data **argv
+
+ builtin *find_builtin_by_name(char *name);
+ builtin *find_builtin_by_addr(builtin_func *func);
+ static char *ntoa (eval_t value, int radix);
+ static enum boolean bad_argc (char *name, int argc, int min, int max);
+ static int dumpdef_cmp (struct symbol **s1, struct symbol **s2);
+ static void define_builtin (char *name, struct builtin *bp,\
+ enum symbol_lookup mode);
+ static void define_macro (int argc, struct token_data **argv,\
+ enum symbol_lookup mode);
+ static void dump_args (struct obstack *obs, int argc,\
+ struct token_data **argv, char *sep,\
+ enum boolean quoted);
+ static void dump_symbol (struct symbol *sym, struct dump_symbol_data *data);
+ static void include (int argc, struct token_data **argv, enum boolean silent);
+ static void m4_builtin (M4_ARGS);
+ static void m4_changecom (M4_ARGS);
+ static void m4_changequote (M4_ARGS);
+ static void m4_define (M4_ARGS);
+ static void m4_defn (M4_ARGS);
+ static void m4_divert (M4_ARGS);
+ static void m4_divnum (M4_ARGS);
+ static void m4_dnl (M4_ARGS);
+ static void m4_dumpdef (M4_ARGS);
+ static void m4_errprint (M4_ARGS);
+ static void m4_eval (M4_ARGS);
+ static void m4_ifdef (M4_ARGS);
+ static void m4_ifelse (M4_ARGS);
+ static void m4_include (M4_ARGS);
+ static void m4_index (M4_ARGS);
+ static void m4_len (M4_ARGS);
+ static void m4_m4exit (M4_ARGS);
+ static void m4_m4wrap (M4_ARGS);
+ static void m4_maketemp (M4_ARGS);
+ static void m4_popdef (M4_ARGS);
+ static void m4_pushdef (M4_ARGS);
+ static void m4_shift (M4_ARGS);
+ static void m4_sinclude (M4_ARGS);
+ static void m4_substr (M4_ARGS);
+ static void m4_syscmd (M4_ARGS);
+ static void m4_sysval (M4_ARGS);
+ static void m4_traceoff (M4_ARGS);
+ static void m4_traceon (M4_ARGS);
+ static void m4_translit (M4_ARGS);
+ static void m4_undefine (M4_ARGS);
+ static void m4_undivert (M4_ARGS);
+ static void set_trace (struct symbol *sym, char *data);
+ static void shipout_int (struct obstack *obs, int val);
+
+ #else /* not MSDOS */
+
static void m4_builtin();
static void m4_changecom();
static void m4_changequote();
***************
*** 64,69 ****
--- 137,144 ----
static void m4_undefine();
static void m4_undivert();
+ #endif /* not MSDOS */
+
static builtin
builtin_tab[] = {
***************
*** 273,279 ****
if (quoted)
obstack_1grow(obs, rquote);
}
-
}
--- 348,353 ----
***************
*** 448,454 ****
--- 522,533 ----
if (!sym->shadowed) {
obstack_blank(data->obs, sizeof(symbol*));
data->base = (symbol **)obstack_base(data->obs);
+ #if defined(_MSC_VER) && (_MSC_VER == 600)
+ /* Work around an optimizer bug. */
+ { int tmp = data->size++; data->base[tmp] = sym; }
+ #else
data->base[data->size++] = sym;
+ #endif
}
}
***************
*** 487,493 ****
--- 566,576 ----
for (i = 1; i < argc; i++) {
s = lookup_symbol(TOKEN_DATA_TEXT(argv[i]), SYMBOL_LOOKUP);
if (s != nil)
+ #ifdef MSDOS
+ dump_symbol(s, &data);
+ #else /* not MSDOS */
dump_symbol(s, (char *)&data);
+ #endif /* not MSDOS */
else
error("Undefined name %s", TOKEN_DATA_TEXT(argv[i]));
}
***************
*** 512,517 ****
--- 595,606 ----
break;
}
}
+
+ #ifdef MSDOS /* but it's a genuine bug. */
+ /* Or is the intention to finalize the object?
+ (cf. m4_errprint (), which could also free the object) */
+ obstack_free (obs, obstack_base (obs));
+ #endif
}
/*
***************
*** 589,597 ****
--- 678,729 ----
int argc;
token_data **argv;
{
+ #ifdef MSDOS
+
+ /* The system function from the MSC runtime lib doesn't return
+ the exit code, so we have to hack one ourselves. */
+
+ char *sysargv[4];
+ char *p = NULL;
+
+ if (bad_argc(TOKEN_DATA_TEXT(argv[0]), argc, 2, 2))
+ return;
+
+ /* Find $SHELL or $COMSPEC, assuming the former is a UNIX style
+ shell (preferred) and the latter is a DOS style command
+ processor. */
+
+ sysargv[0] = getenv ("SHELL");
+ if (sysargv[0])
+ sysargv[1] = "-c";
+ else
+ {
+ sysargv[0] = getenv ("COMSPEC");
+ if (sysargv[0])
+ sysargv[1] = "/c";
+ else
+ {
+ errno = ENOENT;
+ sysval = (-1) << 8;
+ return;
+ }
+ }
+
+ /* Let the shell execute COMMAND. */
+
+ sysargv[2] = ARG(1);
+ sysargv[3] = NULL;
+
+ /* Precompensate the ">> 8" from m4_sysval () */
+ sysval = spawnvpe (P_WAIT, sysargv[0], sysargv, NULL) << 8;
+
+ #else /* not MSDOS */
+
if (bad_argc(TOKEN_DATA_TEXT(argv[0]), argc, 2, 2))
return;
sysval = system(ARG(1));
+
+ #endif /* not MSDOS */
}
static void
***************
*** 615,624 ****
static char *
ntoa(value, radix)
! register int value;
int radix;
{
unsigned int uvalue;
static char str[256];
register char *s = &str[sizeof str];
boolean negative = false;
--- 747,760 ----
static char *
ntoa(value, radix)
! register eval_t value;
int radix;
{
+ #ifdef MSDOS
+ unsigned long uvalue;
+ #else
unsigned int uvalue;
+ #endif
static char str[256];
register char *s = &str[sizeof str];
boolean negative = false;
***************
*** 631,637 ****
--- 767,777 ----
negative = true;
value = -(value+1);
+ #ifdef MSDOS /* shut up the compiler. */
+ tmp = (int) (value%radix);
+ #else
tmp = value%radix;
+ #endif
if (tmp == radix - 1) {
*--s = '0';
value = value/radix + 1;
***************
*** 645,651 ****
--- 785,796 ----
}
}
+
+ #ifdef MSDOS
+ uvalue = (unsigned long)value;
+ #else
uvalue = (unsigned int)value;
+ #endif
do {
*--s = digits[uvalue%radix];
uvalue /= radix;
***************
*** 662,668 ****
int argc;
token_data **argv;
{
! int value;
int radix = 10;
int min = 1;
char *s;
--- 807,813 ----
int argc;
token_data **argv;
{
! eval_t value;
int radix = 10;
int min = 1;
char *s;
***************
*** 915,920 ****
--- 1060,1068 ----
token_data **argv;
{
dump_args(obs, argc, argv, " ", false);
+ #ifdef MSDOS /* but it's a genuine bug. */
+ obstack_1grow(obs, '\0');
+ #endif
fprintf(stderr, "%s", obstack_finish(obs));
fflush(stderr);
}
***************
*** 960,965 ****
--- 1108,1116 ----
obstack_grow(obs, ARG(1), strlen(ARG(1)));
} else
dump_args(obs, argc, argv, " ", false);
+ #ifdef MSDOS /* but it's a genuine bug. */
+ obstack_1grow(obs, '\0');
+ #endif
push_wrapup(obstack_finish(obs));
}
*** e:\tmp/RCSt1006154 Sat Oct 27 09:53:52 1990
--- eval.c Sat Oct 27 09:37:30 1990
***************
*** 16,21 ****
--- 16,34 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+ /*
+ * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+ * This port is also distributed under the terms of the
+ * GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * Please note that this file is not identical to the
+ * original GNU release, you should have received this
+ * code as patch to the official release.
+ *
+ * $Header: e:/gnu/m4/RCS/eval.c 0.5.1.0 90/09/28 18:34:58 tho Exp $
+ */
/*
* This file contains teh functions to evaluate integer expressions for
***************
*** 54,59 ****
--- 67,91 ----
MODULO_ZERO,
} eval_error;
+ #ifdef MSDOS
+
+ static enum eval_error add_term (enum eval_token et, eval_t *v1);
+ static enum eval_error and_term (enum eval_token et, eval_t *v1);
+ static enum eval_error cmp_term (enum eval_token et, eval_t *v1);
+ static enum eval_error exp_term (enum eval_token et, eval_t *v1);
+ static enum eval_error logical_and_term (enum eval_token et, eval_t *v1);
+ static enum eval_error logical_or_term (enum eval_token et, eval_t *v1);
+ static enum eval_error mult_term (enum eval_token et, eval_t *v1);
+ static enum eval_error not_term (enum eval_token et, eval_t *v1);
+ static enum eval_error or_term (enum eval_token et, eval_t *v1);
+ static enum eval_error simple_term (enum eval_token et, eval_t *v1);
+ static enum eval_error unary_term (enum eval_token et, eval_t *v1);
+ static enum eval_token eval_lex (eval_t *val);
+ static void eval_init_lex (char *text);
+ static void eval_undo (void);
+
+ #else /* not MSDOS */
+
static eval_error logical_or_term();
static eval_error logical_and_term();
static eval_error or_term();
***************
*** 66,71 ****
--- 98,105 ----
static eval_error unary_term();
static eval_error simple_term();
+ #endif /* not MSDOS */
+
/*
* Lexical functions.
*/
***************
*** 93,99 ****
static eval_token
eval_lex(val)
! int *val; /* numerical value, if any */
{
while (isspace(*eval_text))
eval_text++;
--- 127,133 ----
static eval_token
eval_lex(val)
! eval_t *val; /* numerical value, if any */
{
while (isspace(*eval_text))
eval_text++;
***************
*** 194,200 ****
boolean
evaluate(expr, val)
char *expr;
! int *val;
{
eval_token et;
eval_error err;
--- 228,234 ----
boolean
evaluate(expr, val)
char *expr;
! eval_t *val;
{
eval_token et;
eval_error err;
***************
*** 235,243 ****
static eval_error
logical_or_term(et, v1)
eval_token et;
! int *v1;
{
! int v2;
eval_error er;
if (er = logical_and_term(et, v1))
--- 269,277 ----
static eval_error
logical_or_term(et, v1)
eval_token et;
! eval_t *v1;
{
! eval_t v2;
eval_error er;
if (er = logical_and_term(et, v1))
***************
*** 263,271 ****
static eval_error
logical_and_term(et, v1)
eval_token et;
! int *v1;
{
! int v2;
eval_error er;
if (er = or_term(et, v1))
--- 297,305 ----
static eval_error
logical_and_term(et, v1)
eval_token et;
! eval_t *v1;
{
! eval_t v2;
eval_error er;
if (er = or_term(et, v1))
***************
*** 291,299 ****
static eval_error
or_term(et, v1)
eval_token et;
! int *v1;
{
! int v2;
eval_error er;
if (er = and_term(et, v1))
--- 325,333 ----
static eval_error
or_term(et, v1)
eval_token et;
! eval_t *v1;
{
! eval_t v2;
eval_error er;
if (er = and_term(et, v1))
***************
*** 319,327 ****
static eval_error
and_term(et, v1)
eval_token et;
! int *v1;
{
! int v2;
eval_error er;
if (er = not_term(et, v1))
--- 353,361 ----
static eval_error
and_term(et, v1)
eval_token et;
! eval_t *v1;
{
! eval_t v2;
eval_error er;
if (er = not_term(et, v1))
***************
*** 347,353 ****
static eval_error
not_term(et, v1)
eval_token et;
! int *v1;
{
eval_error er;
--- 381,387 ----
static eval_error
not_term(et, v1)
eval_token et;
! eval_t *v1;
{
eval_error er;
***************
*** 369,378 ****
static eval_error
cmp_term(et, v1)
eval_token et;
! int *v1;
{
eval_token op;
! int v2;
eval_error er;
if (er = add_term(et, v1))
--- 403,412 ----
static eval_error
cmp_term(et, v1)
eval_token et;
! eval_t *v1;
{
eval_token op;
! eval_t v2;
eval_error er;
if (er = add_term(et, v1))
***************
*** 423,432 ****
static eval_error
add_term(et, v1)
eval_token et;
! int *v1;
{
eval_token op;
! int v2;
eval_error er;
if (er = mult_term(et, v1))
--- 457,466 ----
static eval_error
add_term(et, v1)
eval_token et;
! eval_t *v1;
{
eval_token op;
! eval_t v2;
eval_error er;
if (er = mult_term(et, v1))
***************
*** 455,464 ****
static eval_error
mult_term(et, v1)
eval_token et;
! int *v1;
{
eval_token op;
! int v2;
eval_error er;
if (er = exp_term(et, v1))
--- 489,498 ----
static eval_error
mult_term(et, v1)
eval_token et;
! eval_t *v1;
{
eval_token op;
! eval_t v2;
eval_error er;
if (er = exp_term(et, v1))
***************
*** 503,512 ****
static eval_error
exp_term(et, v1)
eval_token et;
! int *v1;
{
! register int result;
! int v2;
eval_error er;
if (er = unary_term(et, v1))
--- 537,546 ----
static eval_error
exp_term(et, v1)
eval_token et;
! eval_t *v1;
{
! register eval_t result;
! eval_t v2;
eval_error er;
if (er = unary_term(et, v1))
***************
*** 536,542 ****
static eval_error
unary_term(et, v1)
eval_token et;
! int *v1;
{
eval_token et2 = et;
eval_error er;
--- 570,576 ----
static eval_error
unary_term(et, v1)
eval_token et;
! eval_t *v1;
{
eval_token et2 = et;
eval_error er;
***************
*** 561,569 ****
static eval_error
simple_term(et, v1)
eval_token et;
! int *v1;
{
! int v2;
eval_error er;
switch (et) {
--- 595,603 ----
static eval_error
simple_term(et, v1)
eval_token et;
! eval_t *v1;
{
! eval_t v2;
eval_error er;
switch (et) {
*** e:\tmp/RCSt1006154 Sat Oct 27 09:53:56 1990
--- input.c Sat Oct 27 09:33:40 1990
***************
*** 16,21 ****
--- 16,34 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+ /*
+ * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+ * This port is also distributed under the terms of the
+ * GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * Please note that this file is not identical to the
+ * original GNU release, you should have received this
+ * code as patch to the official release.
+ *
+ * $Header: e:/gnu/m4/RCS/input.c 0.5.1.0 90/09/28 18:35:00 tho Exp $
+ */
/*
* Handling of different input sources, and lexical analysis.
***************
*** 130,135 ****
--- 143,155 ----
char bcomm;
char ecomm;
+
+ #ifdef MSDOS
+ static int next_char (void);
+ static void (*get_macro_func (void)) ();
+ static void advance_input (void);
+ static void pop_input (void);
+ #endif /* MSDOS */
/*
*** e:\tmp/RCSt1006154 Sat Oct 27 09:53:58 1990
--- m4.c Sat Oct 27 09:17:50 1990
***************
*** 16,21 ****
--- 16,34 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+ /*
+ * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+ * This port is also distributed under the terms of the
+ * GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * Please note that this file is not identical to the
+ * original GNU release, you should have received this
+ * code as patch to the official release.
+ *
+ * $Header: e:/gnu/m4/RCS/m4.c 0.5.1.0 90/09/28 18:35:03 tho Exp $
+ */
#include "m4.h"
#include "version.h"
***************
*** 37,42 ****
--- 50,68 ----
/* Disable GNU extensions (-G) */
int no_gnu_extensions = 0;
+ #ifdef TRACE_MEMORY_USAGE
+ /* Look where m4 eats up the memory (-t) */
+ int trace_memory_usage = 0;
+ #endif /* TRACE_MEMORY_USAGE */
+
+
+ #ifdef MSDOS
+ extern int main (int argc, char **argv);
+ static void vmesg(char *level, char *fmt, va_list args);
+ static void no_memory (void);
+ static void usage (void);
+ #endif /* MSDOS */
+
/*
* usage --- Print usage message on stderr.
***************
*** 71,80 ****
--- 97,115 ----
case 'V':
fprintf(stderr,
+ #ifdef MSDOS
+ "\
+ GNU m4 %s, Copyright (C) 1989, 1990 Free Software Foundation, Inc.\n\
+ There is ABSOLUTELY NO WARRANTY for GNU m4. See the file\n\
+ COPYING in the source distribution for more details.\n\
+ $Header: e:/gnu/m4/RCS/m4.c 0.5.1.0 90/09/28 18:35:03 tho Exp $\n\
+ (compiled " __DATE__ " " __TIME__ " MS-DOS)\n",
+ #else /* not MSDOS */
"\
GNU m4 %s, Copyright (C) 1989, 1990 Free Software Foundation, Inc.\n\
There is ABSOLUTELY NO WARRANTY for GNU m4. See the file\n\
COPYING in the source distribution for more details.\n",
+ #endif /* not MSDOS */
version);
break;
***************
*** 103,108 ****
--- 138,149 ----
case 'T':
break;
+ #ifdef TRACE_MEMORY_USAGE
+ case 't':
+ trace_memory_usage++;
+ break;
+ #endif /* TRACE_MEMORY_USAGE */
+
default:
usage();
***************
*** 203,209 ****
--- 244,322 ----
* allocation.
*/
+ #ifdef MSDOS /* <stdarg.h> */
+
+ /* Basic varargs function for all error output */
+
+ void
+ vmesg(char *level, char *fmt, va_list args)
+ {
+ fflush(stdout);
+ fprintf(stderr, "%s: %d: ", current_file, current_line);
+ if (level != nil)
+ fprintf(stderr, "%s: ", level);
+
+ vfprintf(stderr, fmt, args);
+
+ putc('\n', stderr);
+ }
+
+ /* Internal errors -- print and dump core */
+
+ void
+ internal_error (char *fmt, ...)
+ {
+ va_list args;
+
+ va_start (args, fmt);
+ vmesg ("internal error", fmt, args);
+ va_end (args);
+
+ abort();
+ }
+
+ /* Fatal error -- print and exit */
+
+ void
+ fatal (char *fmt, ...)
+ {
+ va_list args;
+
+ va_start (args, fmt);
+ vmesg ("fatal error", fmt, args);
+ va_end (args);
+
+ exit (1);
+ }
+
+ /* "Normal" error -- just complain */
+
+ void
+ error (char *fmt, ...)
+ {
+ va_list args;
+
+ va_start (args, fmt);
+ vmesg ((char *)nil, fmt, args);
+ va_end (args);
+ }
+
+ /* Warning --- for potential trouble */
+
+ void
+ warning (char *fmt, ...)
+ {
+ va_list args;
+
+ va_start (args, fmt);
+ vmesg ("warning", fmt, args);
+ va_end (args);
+ }
+
+ #else /* not MSDOS */
+
/* Basic varargs function for all error output */
+
void
vmesg(level, args)
char *level;
***************
*** 272,277 ****
--- 385,392 ----
va_end(args);
}
+ #endif /* not MSDOS */
+
/*
* Memory allocation functions
***************
*** 289,294 ****
--- 404,413 ----
xfree(p)
char *p;
{
+ #ifdef TRACE_MEMORY_USAGE
+ if (trace_memory_usage)
+ fprintf (stderr, "freeing @%Fp.\n", (void _far *) p);
+ #endif /* TRACE_MEMORY_USAGE */
free(p);
}
***************
*** 298,303 ****
--- 417,432 ----
unsigned int size;
{
register char *cp = malloc(size);
+ #ifdef TRACE_MEMORY_USAGE
+ if (trace_memory_usage)
+ {
+ fprintf (stderr, "allocating %5u (%04x) bytes ", size, size);
+ if (cp == nil)
+ fprintf (stderr, "failed.\n");
+ else
+ fprintf (stderr, "@%Fp.\n", (void _far *) cp);
+ }
+ #endif /* TRACE_MEMORY_USAGE */
if (cp == nil)
no_memory();
return cp;
*** e:\tmp/RCSt1006154 Sat Oct 27 09:54:00 1990
--- m4.h Sat Oct 27 09:33:16 1990
***************
*** 16,33 ****
--- 16,54 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+ /*
+ * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+ * This port is also distributed under the terms of the
+ * GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * Please note that this file is not identical to the
+ * original GNU release, you should have received this
+ * code as patch to the official release.
+ *
+ * $Header: e:/gnu/m4/RCS/m4.h 0.5.1.0 90/09/28 18:35:05 tho Exp $
+ */
#include <stdio.h>
#include <ctype.h>
+ #ifdef MSDOS
+ #include <stdarg.h>
+ #else
#include <varargs.h>
+ #endif
#include "obstack.h"
+ #ifdef MSDOS
+ #include <stdlib.h>
+ #else /* not MSDOS */
extern char *malloc();
extern char *realloc();
extern void free();
extern char *mktemp();
extern int mkstemp();
+ #endif /* not MSDOS */
#ifdef USG
#include <string.h>
***************
*** 54,62 ****
--- 75,85 ----
typedef enum boolean { false = 0, true = 1 } boolean;
+ #ifndef MSDOS
extern int errno;
extern int sys_nerr;
extern char *sys_errlist[];
+ #endif /* not MSDOS */
#define syserr() ((errno > 0 && errno < sys_nerr) ? sys_errlist[errno] : "Unknown error")
***************
*** 75,90 ****
--- 98,126 ----
extern int no_gnu_extensions; /* -g */
/* Error handling */
+ #ifdef MSDOS
+ extern void warning (char *fmt, ...);
+ extern void error (char *fmt, ...);
+ extern void fatal (char *fmt, ...);
+ extern void internal_error (char *fmt, ...);
+ #else /* not MSDOS */
extern void warning();
extern void error();
extern void fatal();
extern void internal_error();
+ #endif /* not MSDOS */
/* Memory allocation */
+ #ifdef MSDOS
+ extern char *xmalloc (unsigned int size);
+ extern void xfree (char *p);
+ extern char *xstrdup (char *s);
+ #else /* not MSDOS */
extern char *xmalloc();
extern char *xrealloc();
extern void xfree();
extern char *xstrdup();
+ #endif /* not MSDOS */
/* File: input.c --- lexical definitions */
***************
*** 121,141 ****
typedef enum token_data_type token_data_type;
typedef struct token_data token_data;
extern void input_init();
extern int peek_input();
extern token_type next_token();
extern void skip_line();
/* push back input */
extern void push_file();
extern void push_macro();
-
extern void push_string();
extern struct obstack *push_string_init();
extern char *push_string_finish();
-
extern void push_wrapup();
extern boolean pop_wrapup();
/* current input file, and line */
extern char *current_file;
--- 157,191 ----
typedef enum token_data_type token_data_type;
typedef struct token_data token_data;
+ #ifdef MSDOS
+ extern void input_init (void);
+ extern int peek_input (void);
+ extern enum token_type next_token (struct token_data *td);
+ extern void skip_line (void);
+ #else /* not MSDOS */
extern void input_init();
extern int peek_input();
extern token_type next_token();
extern void skip_line();
+ #endif /* not MSDOS */
/* push back input */
+ #ifdef MSDOS
+ extern void push_file (FILE *fp, char *title);
+ extern void push_macro (void (*func) ());
+ extern struct obstack *push_string_init (void);
+ extern char *push_string_finish (void);
+ extern void push_wrapup (char *s);
+ extern enum boolean pop_wrapup (void);
+ #else /* not MSDOS */
extern void push_file();
extern void push_macro();
extern void push_string();
extern struct obstack *push_string_init();
extern char *push_string_finish();
extern void push_wrapup();
extern boolean pop_wrapup();
+ #endif /* not MSDOS */
/* current input file, and line */
extern char *current_file;
***************
*** 154,164 ****
--- 204,222 ----
extern int output_lines;
extern int output_current_line;
+ #ifdef MSDOS
+ extern void output_init (void);
+ extern void sync_line (int line, char *file);
+ extern void shipout_text (struct obstack *obs, char *text);
+ extern void make_divertion (int divnum);
+ extern void insert_divertion (int divnum);
+ #else /* not MSDOS */
extern void output_init();
extern void sync_line();
extern void shipout_text();
extern void make_divertion();
extern void insert_divertion();
+ #endif /* not MSDOS */
/* File symtab.c --- symbol table definitions */
***************
*** 194,214 ****
typedef enum symbol_lookup symbol_lookup;
typedef struct symbol symbol;
typedef void hack_symbol();
#define HASHMAX 509 /* Default, overridden by -Hsize */
extern symbol **symtab;
extern void symtab_init();
extern symbol *lookup_symbol();
!
! extern void hack_all_symbols();
/* File: macro.c --- macro expansion */
extern void expand_input();
/* File: builtin.c --- builtins */
--- 252,285 ----
typedef enum symbol_lookup symbol_lookup;
typedef struct symbol symbol;
+ #ifdef MSDOS
+ typedef void hack_symbol(symbol *sym, char *data);
+ #else /* not MSDOS */
typedef void hack_symbol();
+ #endif /* not MSDOS */
#define HASHMAX 509 /* Default, overridden by -Hsize */
extern symbol **symtab;
+ #ifdef MSDOS
+ extern void symtab_init (void);
+ extern struct symbol *lookup_symbol (char *name, enum symbol_lookup mode);
+ extern void hack_all_symbols (hack_symbol *func, char *data);
+ #else /* not MSDOS */
extern void symtab_init();
extern symbol *lookup_symbol();
! extern hack_symbol hack_all_symbols();
! #endif /* not MSDOS */
/* File: macro.c --- macro expansion */
+ #ifdef MSDOS
+ extern void expand_input (void);
+ #else /* not MSDOS */
extern void expand_input();
+ #endif /* not MSDOS */
/* File: builtin.c --- builtins */
***************
*** 229,243 ****
--- 300,329 ----
typedef struct builtin builtin;
typedef struct predefined predefined;
+ #ifdef MSDOS
+ extern void builtin_init (void);
+ extern void define_user_macro (char *name, char *text,\
+ enum symbol_lookup mode);
+ extern void undivert_all (void);
+ extern void expand_user_macro (struct obstack *obs, struct symbol *sym,\
+ int argc, struct token_data **argv);
+ #else /* not MSDOS */
extern void builtin_init();
extern void define_user_macro();
extern void undivert_all();
extern void expand_user_macro();
+ #endif /* not MSDOS */
/* File: eval.c --- expression evaluation */
+ #ifdef MSDOS
+ typedef long eval_t; /* use 32-bit arithmetic */
+ extern enum boolean evaluate (char *expr, eval_t *val); /* eval.c */
+ #else /* not MSDOS */
+ typedef int eval_t;
extern boolean evaluate();
+ #endif /* not MSDOS */
/* Debug stuff */
***************
*** 248,250 ****
--- 334,349 ----
#define DEBUG_SYM
#endif
+
+
+ /* Obstack stuff. */
+
+ #ifdef MSDOS
+ extern void _obstack_free (struct obstack *h, void *obj);
+ extern void _obstack_begin (struct obstack *h, int size, int alignment,\
+ void * (*chunkfun) (unsigned int size),\
+ void (*freefun) (char *p));
+ extern void _obstack_newchunk (struct obstack *h, int length);
+ extern int _obstack_allocated_p (struct obstack *h, void *obj);
+ #endif /* MSDOS */
+
*** e:\tmp/RCSt1006154 Sat Oct 27 09:54:02 1990
--- macro.c Sat Oct 27 09:36:54 1990
***************
*** 16,21 ****
--- 16,34 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+ /*
+ * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+ * This port is also distributed under the terms of the
+ * GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * Please note that this file is not identical to the
+ * original GNU release, you should have received this
+ * code as patch to the official release.
+ *
+ * $Header: e:/gnu/m4/RCS/macro.c 0.5.1.0 90/09/28 18:35:07 tho Exp $
+ */
/*
* This file contains the functions, that performs the basic argument
***************
*** 24,31 ****
--- 37,52 ----
#include "m4.h"
+ #ifdef MSDOS
+ static enum boolean expand_argument (struct obstack *obs,\
+ struct token_data *argp);
+ static void expand_macro (struct symbol *sym);
+ static void expand_token (struct obstack *obs, enum token_type t,\
+ struct token_data *td);
+ #else /* not MSDOS */
static void expand_token();
static void expand_macro();
+ #endif /* not MSDOS */
/*
* This function read all input, and expands each token, one at a time.
*** e:\tmp/RCSt1006154 Sat Oct 27 09:54:04 1990
--- obstack.c Sat Oct 27 09:38:10 1990
***************
*** 21,26 ****
--- 21,40 ----
what you give them. Help stamp out software-hoarding! */
+ /* MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+
+ WARNING: This is still a beta version of the port, proper functioning
+ with far pointers has not yet been verified completely.
+
+ This port is also distributed under the terms of the GNU General Public
+ License as published by the Free Software Foundation.
+
+ Please note that this file is not identical to the original GNU release,
+ you should have received this code as patch to the official release.
+
+ $Header: e:/gnu/m4/RCS/obstack.c 0.5.1.0 90/09/28 18:36:23 tho Exp $ */
+
+
#include "obstack.h"
#ifdef __STDC__
***************
*** 29,34 ****
--- 43,64 ----
#define POINTER char *
#endif
+ #ifdef MSDOS
+
+ #include <stdlib.h>
+ #ifndef MALLOC_PAGE
+ #define MALLOC_PAGE 0x0100
+ #endif
+
+ void _obstack_begin (struct obstack *h, int size, int alignment, \
+ POINTER (*chunkfun) (SIZE_T size),\
+ void (*freefun) (char *p));
+ void _obstack_newchunk (struct obstack *h, int length);
+ int _obstack_allocated_p (struct obstack *h, POINTER obj);
+ void _obstack_free (struct obstack *h, POINTER obj);
+
+ #endif /* MSDOS */
+
/* Determine default alignment. */
struct fooalign {char x; double d;};
#define DEFAULT_ALIGNMENT ((char *)&((struct fooalign *) 0)->d - (char *)0)
***************
*** 61,68 ****
--- 91,103 ----
struct obstack *h;
int size;
int alignment;
+ #ifdef MSDOS
+ POINTER (*chunkfun) (SIZE_T size);
+ void (*freefun) (char *p);
+ #else /* not MSDOS */
POINTER (*chunkfun) ();
void (*freefun) ();
+ #endif /* not MSDOS */
{
register struct _obstack_chunk* chunk; /* points to new chunk */
***************
*** 76,90 ****
--- 111,134 ----
int extra = 4;
if (extra < DEFAULT_ROUNDING)
extra = DEFAULT_ROUNDING;
+ #ifdef MSDOS
+ size = MALLOC_PAGE - extra;
+ #else /* not MSDOS */
size = 4096 - extra;
+ #endif /* not MSDOS */
}
+ #ifdef MSDOS
+ h->chunkfun = (struct _obstack_chunk * (*)(size_t size)) chunkfun;
+ #else /* not MSDOS */
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
+ #endif /* not MSDOS */
h->freefun = freefun;
h->chunk_size = size;
h->alignment_mask = alignment - 1;
chunk = h->chunk = (*h->chunkfun) (h->chunk_size);
+
h->next_free = h->object_base = chunk->contents;
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
***************
*** 104,110 ****
{
register struct _obstack_chunk* old_chunk = h->chunk;
register struct _obstack_chunk* new_chunk;
! register long new_size;
register int obj_size = h->next_free - h->object_base;
register int i;
--- 148,154 ----
{
register struct _obstack_chunk* old_chunk = h->chunk;
register struct _obstack_chunk* new_chunk;
! register SIZE_T new_size;
register int obj_size = h->next_free - h->object_base;
register int i;
***************
*** 171,177 ****
--- 215,225 ----
while (lp != 0 && ((POINTER)lp > obj || (POINTER)(lp)->limit < obj))
{
plp = lp -> prev;
+ #ifdef MSDOS
+ (*h->freefun) ((char *)lp);
+ #else /* not MSDOS */
(*h->freefun) (lp);
+ #endif /* not MSDOS */
lp = plp;
}
if (lp)
*** e:\tmp/RCSt1006154 Sat Oct 27 09:54:06 1990
--- obstack.h Sat Oct 27 09:33:16 1990
***************
*** 21,26 ****
--- 21,40 ----
what you give them. Help stamp out software-hoarding! */
+ /* MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+
+ WARNING: This is still a beta version of the port, proper functioning
+ with far pointers has not yet been verified completely.
+
+ This port is also distributed under the terms of the GNU General Public
+ License as published by the Free Software Foundation.
+
+ Please note that this file is not identical to the original GNU release,
+ you should have received this code as patch to the official release.
+
+ $Header: e:/gnu/m4/RCS/obstack.h 0.5.1.0 90/09/28 18:36:25 tho Exp $ */
+
+
/* Summary:
All the apparent functions defined here are macros. The idea
***************
*** 109,125 ****
--- 123,175 ----
#ifndef __OBSTACKS__
#define __OBSTACKS__
+ #ifdef MSDOS
+ #ifndef FILE
+ #include <stdio.h>
+ #endif
+ #define temp16 tmp._16
+ #define temp32 tmp._32
+ #if defined(M_I86CM) || defined(M_I86LM) /* Intel 80x86, _far pointers. */
+ #define LONG long
+ #define SIZE_T size_t
+ #define HUGE _huge
+ #define PDIFF(p1, p2) \
+ ((long)((char HUGE *) (p1) - (char HUGE *) (p2)))
+ #else /* Intel 80x86, _near pointers. */
+ #define LONG int
+ #define SIZE_T size_t
+ #define HUGE
+ #define PDIFF(p1, p2) ((char *) (p1) - (char *) (p2))
+ #endif
+ #else /* not MSDOS */ /* `real' computers ... */
+ #define temp16 temp
+ #define temp32 temp
+ #define LONG int
+ #define SIZE_T long
+ #define HUGE
+ #define PDIFF(p1, p2) ((char *) (p1) - (char *) (p2))
+ #endif /* not MSDOS */
+
+
/* We use subtraction of (char *)0 instead of casting to int
because on word-addressable machines a simple cast to int
may ignore the byte-within-word field of the pointer. */
#ifndef __PTR_TO_INT
+ #ifdef MSDOS
+ #define __PTR_TO_INT(P) ((LONG)(P))
+ #else
#define __PTR_TO_INT(P) ((P) - (char *)0)
#endif
+ #endif
#ifndef __INT_TO_PTR
+ #ifdef MSDOS
+ #define __INT_TO_PTR(P) ((char HUGE *)(P))
+ #else
#define __INT_TO_PTR(P) ((P) + (char *)0)
#endif
+ #endif
struct _obstack_chunk /* Lives at front of each chunk. */
{
***************
*** 130,144 ****
struct obstack /* control current object in current chunk */
{
! long chunk_size; /* preferred size to allocate chunks in */
struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
int temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
void (*freefun) (); /* User's function to free a chunk. */
};
#ifdef __STDC__
--- 180,206 ----
struct obstack /* control current object in current chunk */
{
! SIZE_T chunk_size; /* preferred size to allocate chunks in */
struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
+ #ifdef MSDOS
+ union /* Temporary for some macros. */
+ {
+ LONG _32; /* 32 bit for _far pointer differences */
+ size_t _16; /* 16 bit for malloc() */
+ } tmp;
+ LONG alignment_mask; /* Mask of alignment for each object. */
+ struct _obstack_chunk *(*chunkfun) (unsigned int size);
+ /* User's fcn to allocate a chunk. */
+ void (*freefun) (char *p); /* User's function to free a chunk. */
+ #else /* not MSDOS */
int temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
void (*freefun) (); /* User's function to free a chunk. */
+ #endif /* not MSDOS */
};
#ifdef __STDC__
***************
*** 299,334 ****
extern struct obstack *_obstack;
#define obstack_object_size(h) \
! (unsigned) (_obstack = (h), (h)->next_free - (h)->object_base)
#define obstack_room(h) \
! (unsigned) (_obstack = (h), (h)->chunk_limit - (h)->next_free)
#define obstack_grow(h,where,length) \
! ( (h)->temp = (length), \
! (((h)->next_free + (h)->temp > (h)->chunk_limit) \
! ? _obstack_newchunk ((h), (h)->temp) : 0), \
! bcopy (where, (h)->next_free, (h)->temp), \
! (h)->next_free += (h)->temp)
#define obstack_grow0(h,where,length) \
! ( (h)->temp = (length), \
! (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
! ? _obstack_newchunk ((h), (h)->temp + 1) : 0), \
! bcopy (where, (h)->next_free, (h)->temp), \
! (h)->next_free += (h)->temp, \
*((h)->next_free)++ = 0)
#define obstack_1grow(h,datum) \
( (((h)->next_free + 1 > (h)->chunk_limit) \
? _obstack_newchunk ((h), 1) : 0), \
! *((h)->next_free)++ = (datum))
#define obstack_blank(h,length) \
! ( (h)->temp = (length), \
! (((h)->next_free + (h)->temp > (h)->chunk_limit) \
! ? _obstack_newchunk ((h), (h)->temp) : 0), \
! (h)->next_free += (h)->temp)
#define obstack_alloc(h,length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
--- 361,396 ----
extern struct obstack *_obstack;
#define obstack_object_size(h) \
! (unsigned) (_obstack = (h), PDIFF ((h)->next_free, (h)->object_base))
#define obstack_room(h) \
! (unsigned) (_obstack = (h), PDIFF ((h)->chunk_limit, (h)->next_free))
#define obstack_grow(h,where,length) \
! ( (h)->temp16 = (length), \
! (((h)->next_free + (h)->temp16 > (h)->chunk_limit) \
! ? _obstack_newchunk ((h), (h)->temp16) : 0), \
! bcopy (where, (h)->next_free, (h)->temp16), \
! (h)->next_free += (h)->temp16)
#define obstack_grow0(h,where,length) \
! ( (h)->temp16 = (length), \
! (((h)->next_free + (h)->temp16 + 1 > (h)->chunk_limit) \
! ? _obstack_newchunk ((h), (h)->temp16 + 1) : 0), \
! bcopy (where, (h)->next_free, (h)->temp16), \
! (h)->next_free += (h)->temp16, \
*((h)->next_free)++ = 0)
#define obstack_1grow(h,datum) \
( (((h)->next_free + 1 > (h)->chunk_limit) \
? _obstack_newchunk ((h), 1) : 0), \
! *((h)->next_free)++ = (char) (datum))
#define obstack_blank(h,length) \
! ( (h)->temp16 = (length), \
! (((h)->next_free + (h)->temp16 > (h)->chunk_limit) \
! ? _obstack_newchunk ((h), (h)->temp16) : 0), \
! (h)->next_free += (h)->temp16)
#define obstack_alloc(h,length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
***************
*** 340,372 ****
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
#define obstack_finish(h) \
! ( (h)->temp = __PTR_TO_INT ((h)->object_base), \
(h)->next_free \
= __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
& ~ ((h)->alignment_mask)), \
! (((h)->next_free - (char *)(h)->chunk \
! > (h)->chunk_limit - (char *)(h)->chunk) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
! __INT_TO_PTR ((h)->temp))
#ifdef __STDC__
#define obstack_free(h,obj) \
! ( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
! (((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
! = (h)->temp + (char *) (h)->chunk) \
! : ((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0)))
#else
#define obstack_free(h,obj) \
! ( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
! (((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
! = (h)->temp + (char *) (h)->chunk) \
! : (int) _obstack_free ((h), (h)->temp + (char *) (h)->chunk)))
#endif
#endif /* not __GNUC__ or not __STDC__ */
#endif /* not __OBSTACKS__ */
--- 402,460 ----
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
#define obstack_finish(h) \
! ( (h)->temp32 = __PTR_TO_INT ((h)->object_base), \
(h)->next_free \
= __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
& ~ ((h)->alignment_mask)), \
! ((PDIFF ((h)->next_free, (h)->chunk) \
! > PDIFF ((h)->chunk_limit, (h)->chunk)) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
! __INT_TO_PTR ((h)->temp32))
!
!
! #if defined(M_I86CM) || defined(M_I86LM) /* Intel 80x86, far pointers. */
!
! /* We assume here that
!
! (char *)(obj) ==
! ((char *)(obj) - (char *) (h)->chunk) + (char *) (h)->chunk)
!
! Which might be not true because of alignment (???), but this
! avoids a pointer subtraction, which is always a problem in segmented
! architecture .... */
+ #define obstack_free(h,obj) \
+ ( (h)->temp32 = PDIFF (obj, (h)->chunk), \
+ (((h)->temp32 >= 0 && (h)->temp32 \
+ < PDIFF ((h)->chunk_limit, (h)->chunk)) \
+ ? (LONG) ((h)->next_free = (h)->object_base = (char *) (obj)) \
+ : ((obstack_free) ((h), (char *) (obj)), 0)))
+
+ #else /* not (M_I86CM || M_I86LM) */
+
#ifdef __STDC__
#define obstack_free(h,obj) \
! ( (h)->temp32 = PDIFF (obj, (h)->chunk), \
! (((h)->temp32 >= 0 && (h)->temp32 \
! < PDIFF ((h)->chunk_limit, (h)->chunk)) \
? (int) ((h)->next_free = (h)->object_base \
! = (h)->temp32 + (char HUGE *) (h)->chunk) \
! : ((obstack_free) ((h), (h)->temp32 + (char HUGE *) (h)->chunk), 0)))
#else
#define obstack_free(h,obj) \
! ( (h)->temp32 = (char *)(obj) - (char *) (h)->chunk, \
! (((h)->temp32 >= 0 && (h)->temp32 \
! < (h)->chunk_limit - (char *) (h)->chunk) \
? (int) ((h)->next_free = (h)->object_base \
! = (h)->temp32 + (char *) (h)->chunk) \
! : (int) _obstack_free ((h), (h)->temp32 + (char *) (h)->chunk)))
#endif
+ #endif /* not (M_I86CM || M_I86LM) */
+
#endif /* not __GNUC__ or not __STDC__ */
#endif /* not __OBSTACKS__ */
+
*** e:\tmp/RCSt1006154 Sat Oct 27 09:54:08 1990
--- output.c Sat Oct 27 09:34:26 1990
***************
*** 16,24 ****
--- 16,43 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+ /*
+ * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+ * This port is also distributed under the terms of the
+ * GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * Please note that this file is not identical to the
+ * original GNU release, you should have received this
+ * code as patch to the official release.
+ *
+ * $Header: e:/gnu/m4/RCS/output.c 0.5.1.0 90/09/28 18:36:42 tho Exp $
+ */
#include "m4.h"
+ #ifdef MSDOS
+ #include <io.h>
+ #include <malloc.h>
+ int mkstemp (char *tmpl);
+ #endif /* MSDOS */
+
/*
* Output functions. Most of the complexity is for handling cpp like
* sync lines.
***************
*** 152,157 ****
--- 171,182 ----
}
#endif /* USG */
+
+ #ifdef MSDOS
+ char template_base[] = "/m4%02dXXXXXX";
+ char *template;
+ #endif /* MSDOS */
+
/*
* Make a file for diversion DIVNUM, and install it in the diversion
* table "divtab". The file is opened read-write, so we can unlink it
***************
*** 173,179 ****
--- 198,227 ----
}
if (divtab[divnum] == nil) {
+ #ifdef MSDOS
+ {
+ char *p;
+
+ if ((p = getenv ("TMP")) || (p = getenv ("TEMP")))
+ {
+ int len = strlen (p);
+ template = (char *) alloca (sizeof (template_base) + len + 1);
+ strcpy (template, p);
+ p = template + len - 1;
+ if (*p == '/' || *p == '\\') /* strip trailing slash */
+ *p = '\0';
+ }
+ else
+ {
+ template = (char *) alloca (sizeof (template_base) + 2);
+ strcpy (template, ".");
+ }
+ strcat (template, template_base);
+ }
+ sprintf(buf, template, divnum);
+ #else /* not MSDOS */
sprintf(buf, "/tmp/m4.%02d.XXXXXX", divnum);
+ #endif /* not MSDOS */
fd = mkstemp(buf);
if (fd < 0)
fatal("can't create file for diversion: %s", syserr());
*** e:\tmp/RCSt1006154 Sat Oct 27 09:54:10 1990
--- symtab.c Sat Oct 27 09:34:48 1990
***************
*** 16,21 ****
--- 16,34 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+ /*
+ * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
+ * This port is also distributed under the terms of the
+ * GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * Please note that this file is not identical to the
+ * original GNU release, you should have received this
+ * code as patch to the official release.
+ *
+ * $Header: e:/gnu/m4/RCS/symtab.c 0.5.1.0 90/09/28 18:36:45 tho Exp $
+ */
/*
* This file handles all the low level work around the symbol table.
***************
*** 31,36 ****
--- 44,54 ----
* The current definition will then always be the first found.
*/
#include "m4.h"
+
+ #ifdef MSDOS
+ static int hash (char *s);
+ static void free_symbol (struct symbol *sym);
+ #endif /* MSDOS */
/*
* Initialise the symbol table, by allocating the necessary storage, and