pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Decouple psqlscan.l from surrounding program.
Date: Fri, 18 Mar 2016 19:06:16 +0000
Message-ID: <E1agziy-0007jD-7a@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1agziy-0007jD-7a@gemulon.postgresql.org>
Permalink:  ../E1agziy-0007jD-7a@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1agziy-0007jD-7a@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Decouple psqlscan.l from surrounding program.
  In-Reply-To: <E1agziy-0007jD-7a@gemulon.postgresql.org>
  References: <E1agziy-0007jD-7a@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox