pgsql: Decouple psqlscan.l from surrounding program.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Decouple psqlscan.l from surrounding program.
Date: 2016-03-18 19:06:16
Message-ID: E1agziy-0007jD-7a@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2016-03-18 20:22:59 Re: [COMMITTERS] pgsql: Improve memory management for external sorts.
Previous Message Robert Haas 2016-03-18 18:58:00 pgsql: Use INT64_FORMAT instead of %ld for int64.