Commit bd5ea42a authored by Michael Meskes's avatar Michael Meskes

*** empty log message ***

parent e80ade5e
...@@ -749,3 +749,9 @@ Wed Dec 15 08:10:52 CET 1999 ...@@ -749,3 +749,9 @@ Wed Dec 15 08:10:52 CET 1999
- Some cleanup in libecpg. - Some cleanup in libecpg.
- Set library version to 3.0.9. - Set library version to 3.0.9.
- Set ecpg version to 2.6.12. - Set ecpg version to 2.6.12.
Thu Dec 23 13:25:05 CET 1999
- Fixed command line parsing.
- Set ecpg version to 2.6.13.
...@@ -24,7 +24,7 @@ indicator-error? ...@@ -24,7 +24,7 @@ indicator-error?
Add a semantic check level, e.g. check if a table really exists. Add a semantic check level, e.g. check if a table really exists.
How can on insert arrays from c variables? How can one insert arrays from c variables?
Missing statements: Missing statements:
- exec sql ifdef - exec sql ifdef
......
...@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global ...@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION=2 MAJOR_VERSION=2
MINOR_VERSION=6 MINOR_VERSION=6
PATCHLEVEL=12 PATCHLEVEL=13
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
......
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
#include "extern.h" #include "extern.h"
struct _include_path *include_paths; struct _include_path *include_paths;
struct _defines *defines = NULL; int ret_value = OK, autocommit = 0;
int autocommit = 0;
int ret_value = OK;
struct cursor *cur = NULL; struct cursor *cur = NULL;
struct typedefs *types = NULL; struct typedefs *types = NULL;
...@@ -22,7 +20,7 @@ static void ...@@ -22,7 +20,7 @@ static void
usage(char *progname) usage(char *progname)
{ {
fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL); fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
fprintf(stderr, "Usage: %s: [-v] [-t] [-I include path] [ -o output file name] [-D define name] file1 [file2] ...\n", progname); fprintf(stderr, "Usage: %s: [-v] [-t] [-I include path] [ -o output file name] file1 [file2] ...\n", progname);
} }
static void static void
...@@ -35,23 +33,12 @@ add_include_path(char *path) ...@@ -35,23 +33,12 @@ add_include_path(char *path)
include_paths->next = ip; include_paths->next = ip;
} }
static void
add_preprocessor_define(char *define)
{
struct _defines *pd = defines;
defines = mm_alloc(sizeof(struct _defines));
defines->old = strdup(define);
defines->new = strdup("");
defines->pertinent = true;
defines->next = pd;
}
int int
main(int argc, char *const argv[]) main(int argc, char *const argv[])
{ {
int fnr, int fnr,
c, c,
verbose = false,
out_option = 0; out_option = 0;
struct _include_path *ip; struct _include_path *ip;
...@@ -60,7 +47,7 @@ main(int argc, char *const argv[]) ...@@ -60,7 +47,7 @@ main(int argc, char *const argv[])
add_include_path("/usr/local/include"); add_include_path("/usr/local/include");
add_include_path("."); add_include_path(".");
while ((c = getopt(argc, argv, "vo:I:tD:")) != EOF) while ((c = getopt(argc, argv, "vo:I:t")) != EOF)
{ {
switch (c) switch (c)
{ {
...@@ -82,14 +69,7 @@ main(int argc, char *const argv[]) ...@@ -82,14 +69,7 @@ main(int argc, char *const argv[])
autocommit = 1; autocommit = 1;
break; break;
case 'v': case 'v':
fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL); verbose = true;
fprintf(stderr, "exec sql include ... search starts here:\n");
for (ip = include_paths; ip != NULL; ip = ip->next)
fprintf(stderr, " %s\n", ip->path);
fprintf(stderr, "End of search list.\n");
return OK;
case 'D':
add_preprocessor_define(optarg);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
...@@ -97,6 +77,16 @@ main(int argc, char *const argv[]) ...@@ -97,6 +77,16 @@ main(int argc, char *const argv[])
} }
} }
if (verbose)
{
fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
fprintf(stderr, "exec sql include ... search starts here:\n");
for (ip = include_paths; ip != NULL; ip = ip->next)
fprintf(stderr, " %s\n", ip->path);
fprintf(stderr, "End of search list.\n");
return OK;
}
if (optind >= argc) /* no files specified */ if (optind >= argc) /* no files specified */
{ {
usage(argv[0]); usage(argv[0]);
...@@ -114,9 +104,7 @@ main(int argc, char *const argv[]) ...@@ -114,9 +104,7 @@ main(int argc, char *const argv[])
strcpy(input_filename, argv[fnr]); strcpy(input_filename, argv[fnr]);
/* take care of relative paths */ ptr2ext = strrchr(input_filename, '.');
ptr2ext = strrchr(input_filename, '/');
ptr2ext = (ptr2ext ? strrchr(ptr2ext, '.') : strrchr(input_filename, '.'));
/* no extension? */ /* no extension? */
if (ptr2ext == NULL) if (ptr2ext == NULL)
{ {
...@@ -189,29 +177,16 @@ main(int argc, char *const argv[]) ...@@ -189,29 +177,16 @@ main(int argc, char *const argv[])
ptr = ptr->next; ptr = ptr->next;
free(this); free(this);
} }
cur = NULL;
/* remove non-pertinent old defines as well */
while ( defines && !defines->pertinent ) {
defptr = defines;
defines = defines->next;
free(defptr->new);
free(defptr->old);
free(defptr);
}
for (defptr = defines; defptr != NULL; defptr = defptr->next ) /* remove old defines as well */
for (defptr = defines; defptr != NULL;)
{ {
struct _defines *this = defptr->next; struct _defines *this = defptr;
if ( this && !this->pertinent ) {
defptr->next = this->next;
free(this->new); free(defptr->new);
free(this->old); free(defptr->old);
defptr = defptr->next;
free(this); free(this);
}
} }
/* and old typedefs */ /* and old typedefs */
...@@ -225,13 +200,12 @@ main(int argc, char *const argv[]) ...@@ -225,13 +200,12 @@ main(int argc, char *const argv[])
typeptr = typeptr->next; typeptr = typeptr->next;
free(this); free(this);
} }
types = NULL;
/* initialize lex */ /* initialize lex */
lex_init(); lex_init();
/* we need two includes */ /* we need two includes */
fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These two include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#line 1 \"%s\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename); fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These two include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
/* and parse the source */ /* and parse the source */
yyparse(); yyparse();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment