delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2010/12/20/13:49:40

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX19woGJQrv1wuPXMKu/qj9oGH0VhuTHo5q5nBkOVuX
EuT/zxd0HSIE4I
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
To: djgpp AT delorie DOT com
Subject: Re: error compiling bc 1.06 with readline 6.1 and flex 2.54
Date: Mon, 20 Dec 2010 19:23:11 +0100
User-Agent: KMail/1.9.10
MIME-Version: 1.0
Message-Id: <201012201923.11290.juan.guerrero@gmx.de>
X-Y-GMX-Trusted: 0

On Sat, 18 Dec 2010 13:17:51 -0600, Allan wrote:

[snip]
> I got it to build by manually editing bc\scan.l; just comment out the
> (re)definition of the string pointer `readline'.
[snip]

That is wrong.  The bc-1.06 port ist 10 years old so that certain readline
declarations do no longer match the declarations used in the bc headers.
The readline function declaration in readline header is an external declaration
and you should make match the readline declaration in the .l file with the one
in the readline header .  Below a small patch that will make compile the
bc port with djdev204 and rdln61.

Regards,
Juan M. Guerrero


diff -aprNU5 bc-1.06.orig/bc/scan.l bc-1.06/bc/scan.l
--- bc-1.06.orig/bc/scan.l	2000-09-13 18:25:46 +0000
+++ bc-1.06/bc/scan.l	2010-12-20 18:47:54 +0000
@@ -141,11 +141,11 @@ static char *rl_line = (char *)NULL;
 static char *rl_start = (char *)NULL;
 static int   rl_len = 0;
 
 /* Definitions for readline access. */
 extern FILE *rl_instream;
-_PROTOTYPE(char *readline, (char *));
+_PROTOTYPE(char *readline, (const char *));
 
 /* rl_input puts upto MAX characters into BUF with the number put in
    BUF placed in *RESULT.  If the yy input file is the same as
    rl_instream (stdin), use readline.  Otherwise, just read it.
 */
@@ -311,11 +311,11 @@ limits return(Limits);
 	      }
 	  }
       }
 [a-z][a-z0-9_]* { yylval.s_value = strcopyof(yytext); return(NAME); }
 \"[^\"]*\"  {
- 	      unsigned char *look;
+ 	      char *look;
 	      int count = 0;
 	      yylval.s_value = strcopyof(yytext);
 	      for (look = yytext; *look != 0; look++)
 		{
 		  if (*look == '\n') line_no++;
@@ -323,11 +323,11 @@ limits return(Limits);
 		}
 	      if (count != 2) yyerror ("NUL character in string.");
 	      return(STRING);
 	    }
 {DIGIT}({DIGIT}|\\\n)*("."({DIGIT}|\\\n)*)?|"."(\\\n)*{DIGIT}({DIGIT}|\\\n)* {
-	      unsigned char *src, *dst;
+	      char *src, *dst;
 	      int len;
 	      /* remove a trailing decimal point. */
 	      len = strlen(yytext);
 	      if (yytext[len-1] == '.')
 	        yytext[len-1] = 0;
diff -aprNU5 bc-1.06.orig/djgpp/config.bat bc-1.06/djgpp/config.bat
--- bc-1.06.orig/djgpp/config.bat	2000-12-23 01:40:26 +0000
+++ bc-1.06/djgpp/config.bat	2010-12-20 18:20:30 +0000
@@ -145,18 +145,18 @@ if errorlevel 1 goto WithoutNLS
 
 :WithNLS
 Rem We prefer without-included-gettext because libintl.a from gettext package
 Rem is the only one that is garanteed to have been ported to DJGPP.
 echo Running the ./configure script...
-sh ./configure --src=%XSRC% --enable-nls --without-included-gettext
+sh ./configure --src=%XSRC% --enable-nls --without-included-gettext  --with-readline
 if errorlevel 1 goto CfgError
 echo Done.
 goto End
 
 :WithoutNLS
 echo Running the ./configure script...
-sh ./configure --src=%XSRC% --disable-nls
+sh ./configure --src=%XSRC% --disable-nls  --with-readline
 if errorlevel 1 goto CfgError
 echo Done.
 goto End
 
 :SedError
diff -aprNU5 bc-1.06.orig/lib/number.c bc-1.06/lib/number.c
--- bc-1.06.orig/lib/number.c	2000-10-03 18:34:24 +0000
+++ bc-1.06/lib/number.c	2010-12-20 18:36:42 +0000
@@ -33,10 +33,13 @@
 #include <config.h>
 #include <number.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <ctype.h>/* Prototypes needed for external utility routines. */
+#if defined (HAVE_STRING_H)
+# include <string.h>
+#endif
 
 #define bc_rt_warn rt_warn
 #define bc_rt_error rt_error
 #define bc_out_of_memory out_of_memory
 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019