hi see below please
On 12 November 2012 09:30, Andre Fischer <awf....@gmail.com> wrote: > On 11.11.2012 22:06, jan iversen wrote: > >> Hi. >> >> I would like to hear your opinion on the following problem: >> >> The l10n tools uses flex, which is quite nice, however I have found two >> problems with flex: >> >> - the .l sources defines YYLMAX, but the generated .c source declares >> yytext[YYLMAX] BEFORE the definition code it sucked in. I have verified >> this with the flex sources, nothing to do about it. the flex generated c >> sources start with flex things (including yytext[YYLMAX]) and then the >> first part of the .l file is included. The manual states to use YYLMAX to >> change the yytext buffer size, but with the current flex sources it does >> not work. >> > That is a good way, especially since I can make my own targets (yy.c -> .o) in the makefile. I will do that. But it does not solve the name issue (yytext), I will make a bug report on flex, and mail one I know that was involved in flex. Jan > >> - the .l sources defines a '%option prefix="genXrm_"`which according to >> the >> manual should replace all yy in the generated code, however it does not >> work for yytext and yytext_ptr, because the are instanciated before the >> code is included. >> >> The leads to two problems: >> - YYLMAX not being used, it a performance degradation on all platforms >> (but >> no real problem). >> - yytext not being changed, is in Ubuntu (linux) not a problem, but in >> windows I had to use a new swich (/forcemultiple), and I have no clue >> about >> mac. >> >> I see different solutions: >> 1) I edit the generated .c file, and make a thick note, that if the .l >> file >> is translated, that has to be changed. >> 2) I create a sed that takes the output of flex and does the trix, this >> requires changing the details of the make files. >> 3) I report the bug to the flex people with a patch, and we wait until a >> new version is ready. >> >> I am for version 1), but I would like to hear opinions ? >> > > I found an answer via Google on another Apache mailing list (Apache > Thrift): > http://markmail.org/message/**hgphhaciu6nxwtk7#query:+page:** > 1+mid:hgphhaciu6nxwtk7+state:**results<http://markmail.org/message/hgphhaciu6nxwtk7#query:+page:1+mid:hgphhaciu6nxwtk7+state:results> > > In short: > Add "CPPFLAGS='-DYYLMAX=whatever'" to the compiler invocation (not the > call to flex that converts %lex.l to %_yy.c) > However, if I look at l10ntools/source/makefile.mk, then I don't see > an explicit compile rule for the %_yy.c files. You may have to add one. > > > Oh, and I think option 3) would be good to do also, without the waiting > part. > > -Andre > >