delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/01/09:47:16

Sender: perron AT art DOT alcatel DOT fr
Message-Id: <3482CD8A.2D87@art.alcatel.fr>
Date: Mon, 01 Dec 1997 15:45:30 +0100
From: Olivier PERRON <olivier DOT perron AT art DOT alcatel DOT fr>
Mime-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: djgpp AT delorie DOT com
Subject: Re: Help: RSXNTDJ and FLEX seem not to be compatible
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971201155404 DOT 9051A-100000 AT is>

Eli Zaretskii wrote:
> 
[...]
> 
> Both ferror and fileno are in the DJGPP C library.  There's something
> weird going on here.  Could you post 20 lines from flexread around
> line 286?  Also, please add -v to the gcc command line and post
> everything it prints.

Yes, but rsxntdj seems to link with its own libc.

Here you are:

1) Output with the -v switch:

gcc -v -Zwin32   parserad.o flexrad.o artist.o windecod.o  -o
windecod.exe  -lfl -lcomdl
Reading specs from C:\DJGPP\RSXNTDJ/lib\specs
gcc version 2.7.2.1
 c:/djgpp/bin\ld.exe -Lc:/djgpp/rsxntdj/lib/all -o windecod.exe
C:\DJGPP\RSXNTDJ
/lib\crt0w32.o -L. -LC:\DJGPP\RSXNTDJ/lib\st -LC:\DJGPP\RSXNTDJ/lib
-Lc:/djgpp/l
ib -L/usr/lib parserad.o flexrad.o artist.o windecod.o -lfl -lcomdl
-Trsxnt.djl
-lmain -lalias -lgcc -lc -lc_app -lc -lgcc -lemx -lemx2 -lkrn32 -lusr32
-lgdi32
flexrad.o: In function `yy_get_next_buffer':
flexrad.c:286: undefined reference to `_getc_inline'
flexrad.c(.text+0xdda): undefined reference to `ferror'
flexrad.c:287: undefined reference to `ferror'
flexrad.o: In function `yy_init_buffer':
flexrad.c:640: undefined reference to `fileno'


2) I have some problems with the line numbers above mentionned: 

According to my flexrad.c file, yy_get_next_buffer begins at line 836
and yy_init_buffer at line 1265 (strange, isn't it ?)

However, here are the lines 278 to 296 from my flexrad.c file:

278: #define YY_DO_BEFORE_ACTION \
279: 	yytext_ptr = yy_bp; \
280:	yyleng = (int) (yy_cp - yy_bp); \
281:	yy_hold_char = *yy_cp; \
282:	*yy_cp = '\0'; \
283:	yy_c_buf_p = yy_cp;
284:
285: #define YY_NUM_RULES 12
286: #define YY_END_OF_BUFFER 13
287: static yyconst short int yy_accept[35] =
288:    {   0,
289:        0,    0,    4,    4,   13,   11,    9,    8,   10,   11,
290:       11,    2,    4,    4,    6,    4,    5,    4,    4,    2,
291:        9,    3,    0,    4,    4,    5,    5,    7,    4,    0,
292:        4,    1,    1,    0
293:    } ;
294: 
295: static yyconst int yy_ec[256] =
296:     {   0,

If that can help, here is flexrad.l which gives flexrad.c with:
flex -t flexrad.l > flexrad.c (I use flex 2.5.4)

----------------------  BEGIN of flexrad.l --------------------------
%{
#include <string.h>
#include <malloc.h>
#include "parserad.h"
%}
 
%START COMMENT 

WORD           [0-9a-fA-F]{4}
 
%%

                int convert;
                extern int line_number;
                extern FILE* yyin;

 
{WORD}         {
                 sscanf(yytext,"%x",&convert);
                 yylval.Number = convert;
                 return NUMBER;
               }
 

";"            { 
                 yylval.Token = ';';
                 return ';';
               }

 
"/*"           BEGIN COMMENT;
 
<COMMENT>[^*\n]*      ;
<COMMENT>"*"+[^*/\n]* ;
<COMMENT>\n           line_number++;
<COMMENT>"*"+"/"      BEGIN INITIAL;
 
[\n]           { line_number++;
                 break;}
 
[ \t]+         { break;}

\15            { break; /* It is the fucking ^M on PC */ }
 
.              {fprintf(stderr,"At line %d: Error: Unrecognized
character: '%s'\n",line_number, yytext);
                exit (11);}
%%

----------------------  END of flexrad.l --------------------------

and parserad.h

----------------------  BEGIN of parserad.l --------------------------

typedef union
{
    int    Token;
    int    Number;
} YYSTYPE;
#define	NUMBER	258


extern YYSTYPE yylval;


----------------------  END of parserad.l --------------------------

- Raw text -


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