newlisp with libreadline 6.3

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Post Reply
jef
Posts: 11
Joined: Sun May 18, 2014 8:42 am

newlisp with libreadline 6.3

Post by jef »

Hi everyone, I'm a newcomer to newlisp, that's my first post on this forum.

Had an issue compiling newlisp with readline on debian testing (error messages bellow).
CPPFunction and the like are unavailable since readline 6.3. I provide here a quick
diff to get it compiled properly:

--- newlisp-10.6.0/newlisp.c.ori 2014-04-08 16:54:24.000000000 +0200
+++ newlisp-10.6.0/newlisp.c 2014-05-18 10:31:44.003239839 +0200
@@ -904,7 +904,7 @@

#ifdef READLINE
rl_readline_name = "newlisp";
-rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
+rl_attempted_completion_function = (rl_completion_func_t *)newlisp_completion;
#if defined(LINUX) || defined(_BSD)
/* in Bash .inputrc put 'set blink-matching-paren on' */
rl_set_paren_blink_timeout(300000); /* 300 ms */
@@ -984,15 +984,11 @@
return ((char *)NULL);
}

-#ifdef _BSD
extern char **completion_matches PARAMS((char *, rl_compentry_func_t *));
-#else
-char ** completion_matches(const char * text, CPFunction commands);
-#endif

char ** newlisp_completion (char * text, int start, int end)
{
-return(completion_matches(text, (CPFunction *)command_generator));
+return(completion_matches(text, (rl_compentry_func_t *)command_generator));
}
#endif /* READLINE */


Error messages with unpatched newlisp 10.6.0:

make[1]: Entering directory '/home/jef/Downloads/newlisp-10.6.0'
gcc -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DREADLINE -DSUPPORT_UTF8 -DNEWLISP64 -DLINUX -DFFI -I/usr/local/lib/libffi-3.0.13/include newlisp.c
newlisp.c: In function ‘main’:
newlisp.c:907:37: error: ‘CPPFunction’ undeclared (first use in this function)
rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
^
newlisp.c:907:37: note: each undeclared identifier is reported only once for each function it appears in
newlisp.c:907:50: error: expected expression before ‘)’ token
rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
^
newlisp.c: At top level:
newlisp.c:990:47: error: unknown type name ‘CPFunction’
char ** completion_matches(const char * text, CPFunction commands);
^
newlisp.c: In function ‘newlisp_completion’:
newlisp.c:995:1: warning: implicit declaration of function ‘completion_matches’ [-Wimplicit-function-declaration]
return(completion_matches(text, (CPFunction *)command_generator));
^
newlisp.c:995:34: error: ‘CPFunction’ undeclared (first use in this function)
return(completion_matches(text, (CPFunction *)command_generator));
^
newlisp.c:995:46: error: expected expression before ‘)’ token
return(completion_matches(text, (CPFunction *)command_generator));
^
newlisp.c:996:1: warning: control reaches end of non-void function [-Wreturn-type]
}

Lutz
Posts: 5288
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: newlisp with libreadline 6.3

Post by Lutz »

Try with adding the following around line 36 in newlisp.c:

Code: Select all

#ifndef MAC_OSX /* needed for UBUNTU 14.04 */
typedef char **CPPFunction ();
typedef char *CPFunction ();
#endif
sie also here: http://www.newlisp.org/downloads/develo ... nprogress/

let us know if this works with libreadline 6.3

jef
Posts: 11
Joined: Sun May 18, 2014 8:42 am

Re: newlisp with libreadline 6.3

Post by jef »

Your patch works Lutz, and dev version 10.6.1 compiles just fine.
Thanks a lot for your work on newlisp, that's an amazing piece of software.

Post Reply