pgsql: Decouple psqlscan.l from surrounding program. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Decouple psqlscan.l from surrounding program.
Date
Msg-id E1agziy-0007jD-7a@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Decouple psqlscan.l from surrounding program.

Remove assorted external references from psqlscan.l in preparation for
making it usable by other frontend programs.  This mostly involves
getting rid of direct calls to psql_error() and GetVariable() in favor
of introducing a callback-functions struct to encapsulate variable
fetching and error printing.  In addition, pass the current encoding
and standard-strings status as additional parameters to psql_scan_setup
instead of looking directly at "pset" or calling additional functions.

I did not bother to change some references to psql_error that are in
functions that will soon migrate to a psql-specific backslash-command
lexer.  Other than that, this version of psqlscan.l is capable of
compiling standalone.  It still depends on assorted src/common functions
as well as some encoding-related libpq functions, but we expect that
all programs using it will be happy with those dependencies.

Kyotaro Horiguchi, somewhat editorialized on by me

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4e1d2a170836028370675922ea9a690648d3c18d

Modified Files
--------------
src/bin/psql/common.c   |  59 ++++++++++++++++++++++++
src/bin/psql/common.h   |   2 +
src/bin/psql/mainloop.c |  16 +++++--
src/bin/psql/mainloop.h |   4 ++
src/bin/psql/psqlscan.h |  15 ++++++-
src/bin/psql/psqlscan.l | 116 +++++++++++++++++++++++++-----------------------
src/bin/psql/startup.c  |   6 +--
7 files changed, 154 insertions(+), 64 deletions(-)


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: Use INT64_FORMAT instead of %ld for int64.
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Merge wal_level "archive" and "hot_standby" into new name "repli