YA readline 4.2 patch 
Author Message
 YA readline 4.2 patch

--2zOQQdywfI9Y8VQp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

The attached patch enables PostgreSQL CVS to build cleanly under Cygwin
when built against readline 4.2.  Specifically, it handles the deprecation
of

    filename_completion_function()

with preference for

    rl_filename_completion_function()

Although, I was motivated by Cygwin support, IMO this patch is appropriate
for all platforms.  To quote from the readline source:

    #if 0
    /* Backwards compatibility (compat.c).  These will go away sometime. */
    ...
    extern READLINE_EXPORT(char, *filename_completion_function) ...
    #endif

Note that this patch is modeled after the one by Peter Eisentraut for
completion_matches():

    http://www.***.com/ ~petere/readline42.html

I tested this patch under the following environments:

    Cygwin with readline 4.1
    Cygwin with readline 4.2
    Linux with readline 2.2.1
    Linux with readline 4.2

and it behaved as expected.

Thanks,
Jason

--
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798

Hazlet, NJ 07730 USA                 WWW:   http://www.***.com/

--2zOQQdywfI9Y8VQp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pgrl.patch"

Index: configure.in
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/configure.in,v
retrieving revision 1.128
diff -u -p -r1.128 configure.in
--- configure.in        2001/06/02 18:25:16     1.128

 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER)],
 [AC_MSG_RESULT(no)])

-AC_CHECK_FUNCS([rl_completion_matches])
+AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])

 dnl Cannot use AC_CHECK_FUNC because finite may be a macro
Index: src/bin/psql/tab-complete.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/bin/psql/tab-complete.c,v
retrieving revision 1.32
diff -u -p -r1.32 tab-complete.c
--- src/bin/psql/tab-complete.c 2001/05/08 21:06:43     1.32

 #include "common.h"
 #include "settings.h"

-extern char *filename_completion_function();
+#ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION
+#define filename_completion_function rl_filename_completion_function
+#endif

 #ifdef HAVE_RL_COMPLETION_MATCHES
 #define completion_matches(x, y) rl_completion_matches((x), ((rl_compentry_func_t *)(y)))
Index: src/include/config.h.in
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/config.h.in,v
retrieving revision 1.165
diff -u -p -r1.165 config.h.in
--- src/include/config.h.in     2001/06/02 18:25:18     1.165

 /* Set to 1 if you have rl_completion_matches */
 #undef HAVE_RL_COMPLETION_MATCHES

+/* Set to 1 if you have rl_filename_completion_function */
+#undef HAVE_RL_FILENAME_COMPLETION_FUNCTION
+
 /* Set to 1 if you have getopt_long() (GNU long options) */
 #undef HAVE_GETOPT_LONG

--2zOQQdywfI9Y8VQp
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0

---------------------------(end of broadcast)---------------------------

--2zOQQdywfI9Y8VQp--



Mon, 24 Nov 2003 00:59:54 GMT
 YA readline 4.2 patch

Quote:

> The attached patch enables PostgreSQL CVS to build cleanly under Cygwin
> when built against readline 4.2.

I'm confused.  The current code already builds cleanly against readline
4.2.  Why do we need to change it?

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Mon, 24 Nov 2003 02:31:31 GMT
 YA readline 4.2 patch

Quote:

>> I'm confused.  The current code already builds cleanly against readline
>> 4.2.  Why do we need to change it?
> 1.  The current code does *not* build cleanly against readline 4.2
> under Cygwin.

Why not?  It builds cleanly for me, under gcc.  I don't understand why
Cygwin would be different.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Mon, 24 Nov 2003 02:37:09 GMT
 YA readline 4.2 patch
Tom,

Quote:


> > The attached patch enables PostgreSQL CVS to build cleanly under Cygwin
> > when built against readline 4.2.

> I'm confused.  The current code already builds cleanly against readline
> 4.2.  Why do we need to change it?

For the following reasons:

1.  The current code does *not* build cleanly against readline 4.2
under Cygwin.

2. The current code is using a deprecate function,
filename_completion_function(), which as of readline 4.2, is no longer
declared in readline.h:

    #if 0
    /* Backwards compatibility (compat.c).  These will go away sometime. */
    ...
    extern READLINE_EXPORT(char, *filename_completion_function) ...
    #endif

This is why it is (locally) declared on line 63 of
src/bin/psql/tab-complete.c.

3. Peter has already committed changes to CVS to handle
completion_matches() in exactly the same way.

4. Sometime in the future (readline 4.3?), this will have to be dealt
with when filename_completion_function() is finally removed from readline.

Jason

--
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798

Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Mon, 24 Nov 2003 02:42:41 GMT
 YA readline 4.2 patch
Tom,

Quote:


> >> I'm confused.  The current code already builds cleanly against readline
> >> 4.2.  Why do we need to change it?

> > 1.  The current code does *not* build cleanly against readline 4.2
> > under Cygwin.

> Why not?  It builds cleanly for me, under gcc.  I don't understand why
> Cygwin would be different.

I thought that we have been here before...

Remember that DLLs under Windows are *not* the same as shared libraries
under UNIX.

In order for Cygwin PostgreSQL to link cleanly against Cygwin readline
(which is DLL), the functions imported must be decorated with:

    __declspec(dllimport)

So, declaring filename_completion_function() with:

    extern char *filename_completion_function();

is not sufficient.  Instead, it must be declared as follows:

    extern __declspec(dllimport) char *filename_completion_function(const char *, int);

My patch accomplishes the above (without affecting other platforms),
but conditionally uses filename_completion_function() or
rl_filename_completion_function() as appropriate.

Jason

--
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798

Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Mon, 24 Nov 2003 03:41:26 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. YA readline 4.2 patch

2. installation of readline 4.2

3. configure.in patch for readline and curses.

4. PATCH: postgresql-7.1 + readline-4.2 compatability

5. [PATCH] One more (was Re: [PATCH] One line patch for

6. ODBC , Office 4.2 16 bit

7. SQL Server 4.2 and NT 4.0

8. Migrating from 4.2 to 6.5

9. SQL Server 4.2/6.0 Y2k Compliance

10. Gupta 5.02/SQL Server 4.2 - best config

11. MS SQL 6.0 Enterprise Managing 4.2 servers

12. SQLPutData and MSVC++ 4.2, please help


 
Powered by phpBB® Forum Software