mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Move keywords.c/kwlookup.c into src/common/.
Now that we have src/common/ for code shared between frontend and backend, we can get rid of (most of) the klugy ways that the keyword table and keyword lookup code were formerly shared between different uses. This is a first step towards a more general plan of getting rid of special-purpose kluges for sharing code in src/bin/. I chose to merge kwlookup.c back into keywords.c, as it once was, and always has been so far as keywords.h is concerned. We could have kept them separate, but there is noplace that uses ScanKeywordLookup without also wanting access to the backend's keyword list, so there seems little point. ecpg is still a bit weird, but at least now the trickiness is documented. I think that the MSVC build script should require no adjustments beyond what's done here ... but we'll soon find out.
This commit is contained in:
parent
3df9c374e2
commit
2c6af4f442
@ -12,7 +12,7 @@ include $(top_builddir)/src/Makefile.global
|
||||
|
||||
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS)
|
||||
|
||||
OBJS= analyze.o gram.o scan.o keywords.o kwlookup.o parser.o \
|
||||
OBJS= analyze.o gram.o scan.o parser.o \
|
||||
parse_agg.o parse_clause.o parse_coerce.o parse_collate.o parse_cte.o \
|
||||
parse_expr.o parse_func.o parse_node.o parse_oper.o parse_param.o \
|
||||
parse_relation.o parse_target.o parse_type.o parse_utilcmd.o scansup.o
|
||||
@ -44,7 +44,7 @@ scan.c: FLEX_NO_BACKUP=yes
|
||||
|
||||
|
||||
# Force these dependencies to be known even without dependency info built:
|
||||
gram.o scan.o keywords.o parser.o: gram.h
|
||||
gram.o scan.o parser.o: gram.h
|
||||
|
||||
|
||||
# gram.c, gram.h, and scan.c are in the distribution tarball, so they
|
||||
|
@ -10,8 +10,6 @@ to the optimizer and then executor.
|
||||
parser.c things start here
|
||||
scan.l break query into tokens
|
||||
scansup.c handle escapes in input strings
|
||||
kwlookup.c turn keywords into specific tokens
|
||||
keywords.c table of standard keywords (passed to kwlookup.c)
|
||||
gram.y parse the tokens and produce a "raw" parse tree
|
||||
analyze.c top level of parse analysis for optimizable queries
|
||||
parse_agg.c handle aggregates, like SUM(col1), AVG(col2), ...
|
||||
@ -28,3 +26,7 @@ parse_relation.c support routines for tables and column handling
|
||||
parse_target.c handle the result list of the query
|
||||
parse_type.c support routines for data type handling
|
||||
parse_utilcmd.c parse analysis for utility commands (done at execution time)
|
||||
|
||||
See also src/common/keywords.c, which contains the table of standard
|
||||
keywords and the keyword lookup function. We separated that out because
|
||||
various frontend code wants to use it too.
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* keywords.c
|
||||
* lexical token lookup for key words in PostgreSQL
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/backend/parser/keywords.c
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "parser/gramparse.h"
|
||||
|
||||
#define PG_KEYWORD(a,b,c) {a,b,c},
|
||||
|
||||
|
||||
const ScanKeyword ScanKeywords[] = {
|
||||
#include "parser/kwlist.h"
|
||||
};
|
||||
|
||||
const int NumScanKeywords = lengthof(ScanKeywords);
|
@ -25,10 +25,10 @@
|
||||
#include "catalog/pg_tablespace.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "common/keywords.h"
|
||||
#include "funcapi.h"
|
||||
#include "miscadmin.h"
|
||||
#include "parser/scansup.h"
|
||||
#include "parser/keywords.h"
|
||||
#include "postmaster/syslogger.h"
|
||||
#include "rewrite/rewriteHandler.h"
|
||||
#include "storage/fd.h"
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/tablespace.h"
|
||||
#include "common/keywords.h"
|
||||
#include "executor/spi.h"
|
||||
#include "funcapi.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
@ -45,7 +46,6 @@
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
#include "optimizer/tlist.h"
|
||||
#include "parser/keywords.h"
|
||||
#include "parser/parse_node.h"
|
||||
#include "parser/parse_agg.h"
|
||||
#include "parser/parse_func.h"
|
||||
|
2
src/bin/pg_dump/.gitignore
vendored
2
src/bin/pg_dump/.gitignore
vendored
@ -1,5 +1,3 @@
|
||||
/kwlookup.c
|
||||
|
||||
/pg_dump
|
||||
/pg_dumpall
|
||||
/pg_restore
|
||||
|
@ -22,21 +22,16 @@ OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
|
||||
pg_backup_null.o pg_backup_tar.o pg_backup_directory.o \
|
||||
pg_backup_utils.o parallel.o compress_io.o dumputils.o $(WIN32RES)
|
||||
|
||||
KEYWRDOBJS = keywords.o kwlookup.o
|
||||
|
||||
kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
all: pg_dump pg_restore pg_dumpall
|
||||
|
||||
pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(KEYWRDOBJS) | submake-libpq submake-libpgport
|
||||
$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(KEYWRDOBJS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
||||
pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) | submake-libpq submake-libpgport
|
||||
$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
||||
|
||||
pg_restore: pg_restore.o $(OBJS) $(KEYWRDOBJS) | submake-libpq submake-libpgport
|
||||
$(CC) $(CFLAGS) pg_restore.o $(KEYWRDOBJS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
||||
pg_restore: pg_restore.o $(OBJS) | submake-libpq submake-libpgport
|
||||
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
||||
|
||||
pg_dumpall: pg_dumpall.o dumputils.o $(KEYWRDOBJS) | submake-libpq submake-libpgport
|
||||
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(KEYWRDOBJS) $(WIN32RES) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
||||
pg_dumpall: pg_dumpall.o dumputils.o | submake-libpq submake-libpgport
|
||||
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(WIN32RES) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
||||
|
||||
install: all installdirs
|
||||
$(INSTALL_PROGRAM) pg_dump$(X) '$(DESTDIR)$(bindir)'/pg_dump$(X)
|
||||
@ -50,4 +45,4 @@ uninstall:
|
||||
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, pg_dump$(X) pg_restore$(X) pg_dumpall$(X))
|
||||
|
||||
clean distclean maintainer-clean:
|
||||
rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o kwlookup.c $(KEYWRDOBJS)
|
||||
rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o
|
||||
|
@ -18,13 +18,9 @@
|
||||
|
||||
#include "dumputils.h"
|
||||
|
||||
#include "parser/keywords.h"
|
||||
#include "common/keywords.h"
|
||||
|
||||
|
||||
/* Globals from keywords.c */
|
||||
extern const ScanKeyword FEScanKeywords[];
|
||||
extern const int NumFEScanKeywords;
|
||||
|
||||
#define supports_grant_options(version) ((version) >= 70400)
|
||||
|
||||
static bool parseAclItem(const char *item, const char *type,
|
||||
@ -116,8 +112,8 @@ fmtId(const char *rawid)
|
||||
* that's fine, since we already know we have all-lower-case.
|
||||
*/
|
||||
const ScanKeyword *keyword = ScanKeywordLookup(rawid,
|
||||
FEScanKeywords,
|
||||
NumFEScanKeywords);
|
||||
ScanKeywords,
|
||||
NumScanKeywords);
|
||||
|
||||
if (keyword != NULL && keyword->category != UNRESERVED_KEYWORD)
|
||||
need_quotes = true;
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* keywords.c
|
||||
* lexical token lookup for key words in PostgreSQL
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/bin/pg_dump/keywords.c
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
|
||||
#include "parser/keywords.h"
|
||||
|
||||
/*
|
||||
* We don't need the token number, so leave it out to avoid requiring other
|
||||
* backend headers.
|
||||
*/
|
||||
#define PG_KEYWORD(a,b,c) {a,0,c},
|
||||
|
||||
const ScanKeyword FEScanKeywords[] = {
|
||||
#include "parser/kwlist.h"
|
||||
};
|
||||
|
||||
const int NumFEScanKeywords = lengthof(FEScanKeywords);
|
2
src/bin/psql/.gitignore
vendored
2
src/bin/psql/.gitignore
vendored
@ -3,7 +3,5 @@
|
||||
/sql_help.h
|
||||
/sql_help.c
|
||||
/dumputils.c
|
||||
/keywords.c
|
||||
/kwlookup.c
|
||||
|
||||
/psql
|
||||
|
@ -22,7 +22,7 @@ override CPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/p
|
||||
|
||||
OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
|
||||
startup.o prompt.o variables.o large_obj.o print.o describe.o \
|
||||
tab-complete.o mbprint.o dumputils.o keywords.o kwlookup.o \
|
||||
tab-complete.o mbprint.o dumputils.o \
|
||||
sql_help.o psqlscan.o psqlscanslash.o \
|
||||
$(WIN32RES)
|
||||
|
||||
@ -34,10 +34,7 @@ psql: $(OBJS) | submake-libpq submake-libpgport
|
||||
|
||||
help.o: sql_help.h
|
||||
|
||||
dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
|
||||
dumputils.c: % : $(top_srcdir)/src/bin/pg_dump/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
sql_help.c: sql_help.h ;
|
||||
@ -70,7 +67,7 @@ uninstall:
|
||||
rm -f '$(DESTDIR)$(bindir)/psql$(X)' '$(DESTDIR)$(datadir)/psqlrc.sample'
|
||||
|
||||
clean distclean:
|
||||
rm -f psql$(X) $(OBJS) dumputils.c keywords.c kwlookup.c lex.backup
|
||||
rm -f psql$(X) $(OBJS) dumputils.c lex.backup
|
||||
|
||||
# files removed here are supposed to be in the distribution tarball,
|
||||
# so do not clean them in the clean/distclean rules
|
||||
|
2
src/bin/scripts/.gitignore
vendored
2
src/bin/scripts/.gitignore
vendored
@ -10,8 +10,6 @@
|
||||
/pg_isready
|
||||
|
||||
/dumputils.c
|
||||
/keywords.c
|
||||
/kwlookup.c
|
||||
/mbprint.c
|
||||
/print.c
|
||||
|
||||
|
@ -25,26 +25,23 @@ all: $(PROGRAMS)
|
||||
%: %.o $(WIN32RES)
|
||||
$(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
||||
|
||||
createdb: createdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq submake-libpgport
|
||||
createdb: createdb.o common.o dumputils.o | submake-libpq submake-libpgport
|
||||
createlang: createlang.o common.o print.o mbprint.o | submake-libpq submake-libpgport
|
||||
createuser: createuser.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq submake-libpgport
|
||||
dropdb: dropdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq submake-libpgport
|
||||
createuser: createuser.o common.o dumputils.o | submake-libpq submake-libpgport
|
||||
dropdb: dropdb.o common.o dumputils.o | submake-libpq submake-libpgport
|
||||
droplang: droplang.o common.o print.o mbprint.o | submake-libpq submake-libpgport
|
||||
dropuser: dropuser.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq submake-libpgport
|
||||
clusterdb: clusterdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq submake-libpgport
|
||||
vacuumdb: vacuumdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq submake-libpgport
|
||||
reindexdb: reindexdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq submake-libpgport
|
||||
dropuser: dropuser.o common.o dumputils.o | submake-libpq submake-libpgport
|
||||
clusterdb: clusterdb.o common.o dumputils.o | submake-libpq submake-libpgport
|
||||
vacuumdb: vacuumdb.o common.o dumputils.o | submake-libpq submake-libpgport
|
||||
reindexdb: reindexdb.o common.o dumputils.o | submake-libpq submake-libpgport
|
||||
pg_isready: pg_isready.o common.o | submake-libpq submake-libpgport
|
||||
|
||||
dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/%
|
||||
dumputils.c: % : $(top_srcdir)/src/bin/pg_dump/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
print.c mbprint.c : % : $(top_srcdir)/src/bin/psql/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
install: all installdirs
|
||||
$(INSTALL_PROGRAM) createdb$(X) '$(DESTDIR)$(bindir)'/createdb$(X)
|
||||
$(INSTALL_PROGRAM) dropdb$(X) '$(DESTDIR)$(bindir)'/dropdb$(X)
|
||||
@ -65,8 +62,8 @@ uninstall:
|
||||
|
||||
clean distclean maintainer-clean:
|
||||
rm -f $(addsuffix $(X), $(PROGRAMS)) $(addsuffix .o, $(PROGRAMS))
|
||||
rm -f common.o dumputils.o kwlookup.o keywords.o print.o mbprint.o $(WIN32RES)
|
||||
rm -f dumputils.c print.c mbprint.c kwlookup.c keywords.c
|
||||
rm -f common.o dumputils.o print.o mbprint.o $(WIN32RES)
|
||||
rm -f dumputils.c print.c mbprint.c
|
||||
rm -rf tmp_check
|
||||
|
||||
check:
|
||||
|
@ -36,8 +36,9 @@ override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\""
|
||||
override CPPFLAGS += -DVAL_LDFLAGS_SL="\"$(LDFLAGS_SL)\""
|
||||
override CPPFLAGS += -DVAL_LIBS="\"$(LIBS)\""
|
||||
|
||||
OBJS_COMMON = config_info.o controldata_utils.o exec.o pg_lzcompress.o \
|
||||
pgfnames.o psprintf.o relpath.o rmtree.o string.o username.o wait_error.o
|
||||
OBJS_COMMON = config_info.o controldata_utils.o exec.o keywords.o \
|
||||
pg_lzcompress.o pgfnames.o psprintf.o relpath.o rmtree.o \
|
||||
string.o username.o wait_error.o
|
||||
|
||||
OBJS_FRONTEND = $(OBJS_COMMON) fe_memutils.o restricted_token.o
|
||||
|
||||
@ -83,5 +84,14 @@ $(OBJS_SRV): | submake-errcodes
|
||||
submake-errcodes:
|
||||
$(MAKE) -C ../backend submake-errcodes
|
||||
|
||||
# Dependencies of keywords.o need to be managed explicitly to make sure
|
||||
# that you don't get broken parsing code, even in a non-enable-depend build.
|
||||
# Note that gram.h isn't required for the frontend version of keywords.o.
|
||||
$(top_builddir)/src/include/parser/gram.h: $(top_srcdir)/src/backend/parser/gram.y
|
||||
$(MAKE) -C $(top_builddir)/src/backend $(top_builddir)/src/include/parser/gram.h
|
||||
|
||||
keywords.o: $(top_srcdir)/src/include/parser/kwlist.h
|
||||
keywords_srv.o: $(top_builddir)/src/include/parser/gram.h $(top_srcdir)/src/include/parser/kwlist.h
|
||||
|
||||
clean distclean maintainer-clean:
|
||||
rm -f libpgcommon.a libpgcommon_srv.a $(OBJS_FRONTEND) $(OBJS_SRV)
|
||||
|
@ -1,31 +1,56 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* kwlookup.c
|
||||
* keywords.c
|
||||
* lexical token lookup for key words in PostgreSQL
|
||||
*
|
||||
* NB - this file is also used by ECPG and several frontend programs in
|
||||
* src/bin/ including pg_dump and psql
|
||||
*
|
||||
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/backend/parser/kwlookup.c
|
||||
* src/common/keywords.c
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef FRONTEND
|
||||
#include "postgres.h"
|
||||
#else
|
||||
#include "postgres_fe.h"
|
||||
#endif
|
||||
|
||||
/* use c.h so this can be built as either frontend or backend */
|
||||
#include "c.h"
|
||||
#ifndef FRONTEND
|
||||
|
||||
#include <ctype.h>
|
||||
#include "parser/gramparse.h"
|
||||
|
||||
#define PG_KEYWORD(a,b,c) {a,b,c},
|
||||
|
||||
#else
|
||||
|
||||
#include "common/keywords.h"
|
||||
|
||||
/*
|
||||
* We don't need the token number for frontend uses, so leave it out to avoid
|
||||
* requiring backend headers that won't compile cleanly here.
|
||||
*/
|
||||
#define PG_KEYWORD(a,b,c) {a,0,c},
|
||||
|
||||
#endif /* FRONTEND */
|
||||
|
||||
|
||||
const ScanKeyword ScanKeywords[] = {
|
||||
#include "parser/kwlist.h"
|
||||
};
|
||||
|
||||
const int NumScanKeywords = lengthof(ScanKeywords);
|
||||
|
||||
#include "parser/keywords.h"
|
||||
|
||||
/*
|
||||
* ScanKeywordLookup - see if a given word is a keyword
|
||||
*
|
||||
* The table to be searched is passed explicitly, so that this can be used
|
||||
* to search keyword lists other than the standard list appearing above.
|
||||
*
|
||||
* Returns a pointer to the ScanKeyword table entry, or NULL if no match.
|
||||
*
|
||||
* The match is done case-insensitively. Note that we deliberately use a
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/keywords.h
|
||||
* src/include/common/keywords.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -31,6 +31,7 @@ typedef struct ScanKeyword
|
||||
extern PGDLLIMPORT const ScanKeyword ScanKeywords[];
|
||||
extern PGDLLIMPORT const int NumScanKeywords;
|
||||
|
||||
|
||||
extern const ScanKeyword *ScanKeywordLookup(const char *text,
|
||||
const ScanKeyword *keywords,
|
||||
int num_keywords);
|
@ -4,8 +4,8 @@
|
||||
* Shared definitions for the "raw" parser (flex and bison phases only)
|
||||
*
|
||||
* NOTE: this file is only meant to be included in the core parsing files,
|
||||
* ie, parser.c, gram.y, scan.l, and keywords.c. Definitions that are needed
|
||||
* outside the core parser should be in parser.h.
|
||||
* ie, parser.c, gram.y, scan.l, and src/common/keywords.c.
|
||||
* Definitions that are needed outside the core parser should be in parser.h.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef SCANNER_H
|
||||
#define SCANNER_H
|
||||
|
||||
#include "parser/keywords.h"
|
||||
#include "common/keywords.h"
|
||||
|
||||
/*
|
||||
* The scanner returns extra data about scanned tokens in this union type.
|
||||
|
1
src/interfaces/ecpg/preproc/.gitignore
vendored
1
src/interfaces/ecpg/preproc/.gitignore
vendored
@ -4,4 +4,3 @@
|
||||
/pgc.c
|
||||
|
||||
/ecpg
|
||||
/kwlookup.c
|
||||
|
@ -27,7 +27,7 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
|
||||
override CFLAGS += $(PTHREAD_CFLAGS) -DECPG_COMPILE
|
||||
|
||||
OBJS= preproc.o pgc.o type.o ecpg.o output.o parser.o \
|
||||
keywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descriptor.o variable.o \
|
||||
keywords.o c_keywords.o ecpg_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
|
||||
$(WIN32RES)
|
||||
|
||||
# Suppress parallel build to avoid a bug in GNU make 3.82
|
||||
@ -53,9 +53,6 @@ preproc.y: ../../../backend/parser/gram.y parse.pl ecpg.addons ecpg.header ecpg.
|
||||
|
||||
ecpg_keywords.o c_keywords.o keywords.o preproc.o pgc.o parser.o: preproc.h
|
||||
|
||||
kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
distprep: preproc.y preproc.c preproc.h pgc.c
|
||||
|
||||
install: all installdirs
|
||||
@ -68,7 +65,7 @@ uninstall:
|
||||
rm -f '$(DESTDIR)$(bindir)/ecpg$(X)'
|
||||
|
||||
clean distclean:
|
||||
rm -f kwlookup.c *.o ecpg$(X)
|
||||
rm -f *.o ecpg$(X)
|
||||
# garbage from development
|
||||
@rm -f core a.out
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
#define _ECPG_PREPROC_EXTERN_H
|
||||
|
||||
#include "type.h"
|
||||
#include "parser/keywords.h"
|
||||
|
||||
#include "common/keywords.h"
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef CHAR_BIT
|
||||
|
@ -15,13 +15,23 @@
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
|
||||
#include "parser/keywords.h"
|
||||
#include "type.h"
|
||||
/*
|
||||
* This is much trickier than it looks. We are #include'ing kwlist.h
|
||||
* but the "value" numbers that go into the table are from preproc.h
|
||||
* not the backend's gram.h. Therefore this table will recognize all
|
||||
* keywords known to the backend, but will supply the token numbers used
|
||||
* by ecpg's grammar, which is what we need. The ecpg grammar must
|
||||
* define all the same token names the backend does, else we'll get
|
||||
* undefined-symbol failures in this compile.
|
||||
*/
|
||||
|
||||
#include "common/keywords.h"
|
||||
|
||||
#include "extern.h"
|
||||
#include "preproc.h"
|
||||
|
||||
#define PG_KEYWORD(a,b,c) {a,b,c},
|
||||
|
||||
#define PG_KEYWORD(a,b,c) {a,b,c},
|
||||
|
||||
const ScanKeyword SQLScanKeywords[] = {
|
||||
#include "parser/kwlist.h"
|
||||
|
@ -108,8 +108,9 @@ sub mkvcbuild
|
||||
}
|
||||
|
||||
our @pgcommonallfiles = qw(
|
||||
config_info.c controldata_utils.c exec.c pg_lzcompress.c pgfnames.c
|
||||
psprintf.c relpath.c rmtree.c string.c username.c wait_error.c);
|
||||
config_info.c controldata_utils.c exec.c keywords.c
|
||||
pg_lzcompress.c pgfnames.c psprintf.c relpath.c rmtree.c
|
||||
string.c username.c wait_error.c);
|
||||
|
||||
our @pgcommonfrontendfiles = (
|
||||
@pgcommonallfiles, qw(fe_memutils.c
|
||||
@ -343,8 +344,6 @@ sub mkvcbuild
|
||||
$pgdump->AddFile('src/bin/pg_dump/pg_dump.c');
|
||||
$pgdump->AddFile('src/bin/pg_dump/common.c');
|
||||
$pgdump->AddFile('src/bin/pg_dump/pg_dump_sort.c');
|
||||
$pgdump->AddFile('src/bin/pg_dump/keywords.c');
|
||||
$pgdump->AddFile('src/backend/parser/kwlookup.c');
|
||||
$pgdump->AddLibrary('ws2_32.lib');
|
||||
|
||||
my $pgdumpall = AddSimpleFrontend('pg_dump', 1);
|
||||
@ -360,16 +359,12 @@ sub mkvcbuild
|
||||
$pgdumpall->AddIncludeDir('src/backend');
|
||||
$pgdumpall->AddFile('src/bin/pg_dump/pg_dumpall.c');
|
||||
$pgdumpall->AddFile('src/bin/pg_dump/dumputils.c');
|
||||
$pgdumpall->AddFile('src/bin/pg_dump/keywords.c');
|
||||
$pgdumpall->AddFile('src/backend/parser/kwlookup.c');
|
||||
$pgdumpall->AddLibrary('ws2_32.lib');
|
||||
|
||||
my $pgrestore = AddSimpleFrontend('pg_dump', 1);
|
||||
$pgrestore->{name} = 'pg_restore';
|
||||
$pgrestore->AddIncludeDir('src/backend');
|
||||
$pgrestore->AddFile('src/bin/pg_dump/pg_restore.c');
|
||||
$pgrestore->AddFile('src/bin/pg_dump/keywords.c');
|
||||
$pgrestore->AddFile('src/backend/parser/kwlookup.c');
|
||||
$pgrestore->AddLibrary('ws2_32.lib');
|
||||
|
||||
my $zic = $solution->AddProject('zic', 'exe', 'utils');
|
||||
@ -618,15 +613,7 @@ sub mkvcbuild
|
||||
foreach my $f (@files)
|
||||
{
|
||||
$f =~ s/\.o$/\.c/;
|
||||
if ($f eq 'keywords.c')
|
||||
{
|
||||
$proj->AddFile('src/bin/pg_dump/keywords.c');
|
||||
}
|
||||
elsif ($f eq 'kwlookup.c')
|
||||
{
|
||||
$proj->AddFile('src/backend/parser/kwlookup.c');
|
||||
}
|
||||
elsif ($f eq 'dumputils.c')
|
||||
if ($f eq 'dumputils.c')
|
||||
{
|
||||
$proj->AddFile('src/bin/pg_dump/dumputils.c');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user