*** empty log message ***

This commit is contained in:
Michael Meskes 1999-12-23 12:33:19 +00:00
parent e80ade5e22
commit bd5ea42a8d
4 changed files with 31 additions and 51 deletions

View File

@ -749,3 +749,9 @@ Wed Dec 15 08:10:52 CET 1999
- Some cleanup in libecpg.
- Set library version to 3.0.9.
- 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.

View File

@ -24,7 +24,7 @@ indicator-error?
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:
- exec sql ifdef

View File

@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION=2
MINOR_VERSION=6
PATCHLEVEL=12
PATCHLEVEL=13
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \

View File

@ -12,9 +12,7 @@
#include "extern.h"
struct _include_path *include_paths;
struct _defines *defines = NULL;
int autocommit = 0;
int ret_value = OK;
int ret_value = OK, autocommit = 0;
struct cursor *cur = NULL;
struct typedefs *types = NULL;
@ -22,7 +20,7 @@ static void
usage(char *progname)
{
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
@ -35,23 +33,12 @@ add_include_path(char *path)
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
main(int argc, char *const argv[])
{
int fnr,
c,
verbose = false,
out_option = 0;
struct _include_path *ip;
@ -60,7 +47,7 @@ main(int argc, char *const argv[])
add_include_path("/usr/local/include");
add_include_path(".");
while ((c = getopt(argc, argv, "vo:I:tD:")) != EOF)
while ((c = getopt(argc, argv, "vo:I:t")) != EOF)
{
switch (c)
{
@ -82,14 +69,7 @@ main(int argc, char *const argv[])
autocommit = 1;
break;
case 'v':
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;
case 'D':
add_preprocessor_define(optarg);
verbose = true;
break;
default:
usage(argv[0]);
@ -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 */
{
usage(argv[0]);
@ -114,9 +104,7 @@ main(int argc, char *const argv[])
strcpy(input_filename, argv[fnr]);
/* take care of relative paths */
ptr2ext = strrchr(input_filename, '/');
ptr2ext = (ptr2ext ? strrchr(ptr2ext, '.') : strrchr(input_filename, '.'));
ptr2ext = strrchr(input_filename, '.');
/* no extension? */
if (ptr2ext == NULL)
{
@ -189,29 +177,16 @@ main(int argc, char *const argv[])
ptr = ptr->next;
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;
if ( this && !this->pertinent ) {
defptr->next = this->next;
struct _defines *this = defptr;
free(this->new);
free(this->old);
free(defptr->new);
free(defptr->old);
defptr = defptr->next;
free(this);
}
}
/* and old typedefs */
@ -225,13 +200,12 @@ main(int argc, char *const argv[])
typeptr = typeptr->next;
free(this);
}
types = NULL;
/* initialize lex */
lex_init();
/* 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 */
yyparse();