Re: [Autogen-users] A question about for loops
Brought to you by:
bkorb
|
From: Vivien K. <vi...@pl...> - 2018-08-31 19:31:38
|
Thank you, now everything works!
Vivien
Bruce Korb writes:
> On 08/31/2018 10:34 AM, Vivien Kraus wrote:
>> OK so compiling the new version... I get a -Werror=format-overflow in
>> getdefs.c:451:29, where sprintf writes up to 255 bytes in a 253-byte
>> region. If you add 4 to MAXNAMELEN for def_bf in line 377 (for the
>> storage of the indentation, the ' and the final NUL), gcc does not
>> complain anymore. Anyway, the tests pass.
>
> Again, you're behind. :) Under Git is a fix for that.
> Interesting it didn't show up with the prior release.
> Anyway, all that code was written before I wrote the
> SPN/BRK macros in autoopts/ag-char-map.h. Don't bother, though,
> your hack is just fine. Anybody using 255 character long names
> deserve what they get anyway. Still, there's a fix.
>
>> Are we talking about the same thing? For autogen version 5.18.16, given
>> example.def:
>
> I probably erased it because I rewrote a bit of the email, but
> earlier today my autogen was not working because guile requires libffi6
> and my new installation installs version 7. Fixed now:
>
>> ==> def.def <==
>> autogen definitions tpl;
>> /* Now set up the first 5 items of bar */
>>
>> i[0]='';
>> i[9]=''; // you have to have "i's" that span the full range
>>
>> example = {
>> foo = bar;
>> size = 5;
>> };
>>
>> ==> tpl.tpl <==
>> [= autogen5 template c =]
>> [= for example =] /* [= foo =] example */
>> /* Now set up the first [=size=] items of [=foo=] */
>> [= for i (for-from 0) (for-by 1) (define lim (string->number (get "size"))) (for-to lim) =] > [= foo =][[=(for-index)=]] = [=(for-index)=];
>> [= endfor =]
>> [= endfor =]
>
> NOTE: "for-to" requires a numeric argument and "get" always yields a string.
>
>> ==> def.c <==
>> /* bar example */
>> /* Now set up the first 5 items of bar */
>>
>> bar[0] = 0;
>>
>> bar[1] = 1;
>>
>> bar[2] = 2;
>>
>> bar[3] = 3;
>>
>> bar[4] = 4;
>>
>> bar[5] = 5;
>
> By the way, adding options like:
> --trace=everything --trace-out=gen.log
>
> can help. It isn't pretty, but you can see where stuff turns south
> (with a little bit of effort, of course).
|