Shantonu Sen wrote:
>> on AIX 4.3.3 lex fails with
>yikes! it's not that big a program! hmm, in the old lexer, there were
>some options at the beginning like so:
>%e 2000
>%p 5000
>%n 1000
>%a 4000
>
>I didn't spend too much time looking into them. Could they be memory
>usage hints?

That's them exactly. lex -v will show the settings on AT&T lex. The
defaults in AT&T lex tend to be tiny, so this isn't an unusual
occurance.

Here's the lex -v output:

lex -v dtimep.lex 
"dtimep.lex":line 2: Error: missing translation value
0/1000 nodes(%e), 0/2500 positions(%p), 1/500 (%n), 0 transitions,
0/10000 packed char classes(%k),  0/2000 packed transitions(%a),
0/3000 output slots(%o)

I set the memory options back, removed %option noyywrap, and added
#undef yypwrap to the header section. This appears to work in Solaris
and in flex on my linux system. Here's the patch...

diff -c -r1.1 dtimep.lex
*** dtimep.lex  2000/05/29 07:29:09     1.1
--- dtimep.lex  2000/05/31 06:01:32
***************
*** 1,7 ****
! %option noyywrap
  %{
  #include <h/nmh.h>
  #include <h/tws.h>
  
  #define YY_NO_UNPUT
  #define YY_DECL struct tws * dparsetime(char *lexstr)
--- 1,12 ----
! %e 2000
! %p 5000
! %n 1000
! %a 4000
  %{
  #include <h/nmh.h>
  #include <h/tws.h>
+ 
+ #undef yywrap
  
  #define YY_NO_UNPUT
  #define YY_DECL struct tws * dparsetime(char *lexstr)

I'll check against AIX at the office.

>I might be able to use preprocessor #define's to simulate the %option.
>Did either AIX or solaris have a problem with the lexed version
>dtimep.c which is in CVS? hopefully that's ANSI C.

They didn't appear to. I'll check more today.

>Is it necessary to re-flex it even if flex is present? what would
>change from host to host that would make a locally-done flex more
>compatible or useful? if flex on my home machine generates good,
>portable C, what is the incentive?

Warm fuzzies of seeing nmh's awesome date parsing power? :-)

If it's going to turn out the same file, then obviously there's no
point in running it. I wonder though if flex on Solaris will output
the same file as flex on SunOS, or flex on linux, etc... Does flex
have any built-in system-dependent localizations? I just don't know.

--
Doug Morris
Morris Communications & Computer Services, Inc.
http://www.mhost.com/

Reply via email to