diff options
| author | Alvaro Herrera | 2009-03-07 00:13:58 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2009-03-07 00:13:58 +0000 |
| commit | 328d235571616669273979dd1b4c7ace018efc0b (patch) | |
| tree | 2b0e99a747066d395c40baa06ecbea61b334906a /src/interfaces | |
| parent | 00ce73778baa496f979b0dce91b0dbb5adf0cd8d (diff) | |
Separate the key word list that lived in keywords.c into a new header file
kwlist.h, to avoid having to link the backend object file into other programs
like pg_dump. We can now simply symlink a single source file from the backend
(kwlookup.c, containing the shared routine ScanKeywordLookup) and compile it
locally, which is a lot cleaner.
Diffstat (limited to 'src/interfaces')
| -rw-r--r-- | src/interfaces/ecpg/preproc/Makefile | 9 | ||||
| -rw-r--r-- | src/interfaces/ecpg/preproc/keywords.c | 30 |
2 files changed, 34 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile index 7983659ed1e..3e95606c9dd 100644 --- a/src/interfaces/ecpg/preproc/Makefile +++ b/src/interfaces/ecpg/preproc/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1998-2009, PostgreSQL Global Development Group # -# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.141 2009/01/01 17:24:02 momjian Exp $ +# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.142 2009/03/07 00:13:58 alvherre Exp $ # #------------------------------------------------------------------------- @@ -25,7 +25,7 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \ override CFLAGS += $(PTHREAD_CFLAGS) -DECPG_COMPILE OBJS= preproc.o type.o ecpg.o output.o parser.o \ - keywords.o c_keywords.o ecpg_keywords.o ../ecpglib/typename.o descriptor.o variable.o \ + keywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descriptor.o variable.o \ $(WIN32RES) all: submake-libpgport ecpg @@ -57,8 +57,7 @@ $(srcdir)/preproc.y: $(top_srcdir)/src/backend/parser/gram.y parse.pl ecpg.addon ecpg_keywords.o c_keywords.o keywords.o preproc.o parser.o: preproc.h -# instead of maintaining our own list, take the one from the backend -keywords.c: % : $(top_srcdir)/src/backend/parser/% +kwlookup.c: % : $(top_srcdir)/src/backend/parser/% rm -f $@ && $(LN_S) $< . distprep: $(srcdir)/preproc.y $(srcdir)/preproc.c $(srcdir)/preproc.h $(srcdir)/pgc.c @@ -73,7 +72,7 @@ uninstall: rm -f '$(DESTDIR)$(bindir)/ecpg$(X)' clean distclean: - rm -f keywords.c *.o ecpg$(X) + rm -f kwlookup.c *.o ecpg$(X) # garbage from development @rm -f core a.out diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c new file mode 100644 index 00000000000..62065ba2f22 --- /dev/null +++ b/src/interfaces/ecpg/preproc/keywords.c @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * keywords.c + * lexical token lookup for key words in PostgreSQL + * + * + * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * + * IDENTIFICATION + * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.87 2009/03/07 00:13:58 alvherre Exp $ + * + *------------------------------------------------------------------------- + */ +#include "postgres_fe.h" + +#include "parser/keywords.h" +#include "type.h" +#include "preproc.h" + +#define PG_KEYWORD(a,b,c) {a,b,c}, + + +const ScanKeyword ScanKeywords[] = { +#include "parser/kwlist.h" +}; + +/* End of ScanKeywords, for use elsewhere */ +const ScanKeyword *LastScanKeyword = endof(ScanKeywords); |
