diff --git a/c/dsls/Makefile.am b/c/dsls/Makefile.am index 8f2d7ea7e..25ec66cdd 100644 --- a/c/dsls/Makefile.am +++ b/c/dsls/Makefile.am @@ -7,6 +7,8 @@ lemon_SOURCES= lemon.c \ lemon_assert.h \ lemon_error.c \ lemon_error.h \ + lemon_memory.c \ + lemon_memory.h \ lemon_option.c \ lemon_option.h diff --git a/c/dsls/Makefile.no-autoconfig b/c/dsls/Makefile.no-autoconfig index 139480de0..9f4ee7894 100644 --- a/c/dsls/Makefile.no-autoconfig +++ b/c/dsls/Makefile.no-autoconfig @@ -105,8 +105,8 @@ ex2_lexer.c ex2_lexer.h: ex2_lexer.l ./ex_ast.h flex --prefix=ex2_lexer_ --outfile=ex2_lexer.c --header-file=ex2_lexer.h ex2_lexer.l # ---------------------------------------------------------------- -lemon: lemon.c lemon_assert.c lemon_error.c lemon_option.c - $(DSLCC) -o lemon lemon.c lemon_assert.c lemon_error.c lemon_option.c +lemon: lemon.c lemon_assert.c lemon_error.c lemon_memory.c lemon_option.c + $(DSLCC) -o lemon lemon.c lemon_assert.c lemon_error.c lemon_memory.c lemon_option.c # ---------------------------------------------------------------- clean: diff --git a/c/dsls/lemon.c b/c/dsls/lemon.c index 32a921395..6e8f5a115 100644 --- a/c/dsls/lemon.c +++ b/c/dsls/lemon.c @@ -15,14 +15,9 @@ #include "lemon_assert.h" #include "lemon_error.h" +#include "lemon_memory.h" #include "lemon_option.h" -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - /* #define PRIVATE static */ #define PRIVATE @@ -248,11 +243,6 @@ struct lemon { char *argv0; /* Name of the program */ }; -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - /**************** From the file "table.h" *********************************/ /* ** All code in this file has been automatically generated @@ -1189,14 +1179,6 @@ void Configlist_eat(struct config *cfp) ** Main program file for the LEMON parser generator. */ -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr, "Out of memory. Aborting...\n"); - exit(1); -} - static int nDefine = 0; /* Number of -D options on the command line */ static char **azDefine = 0; /* Name of the -D macros */