On Tue, 5 Dec 2000, Angus Leeming wrote:
> Results in, eg, this:
>   // xgettext:no-c-format
>    fdui->counter_zoom = obj = fl_add_counter(FL_NORMAL_COUNTER, 310, 130, 
> 100, 30, idex(_("Zoom %|#Z")));
>      fl_set_button_shortcut(obj, scex(_("Zoom %|#Z")), 1);
> 
> (Sorry I can't seem to turn my line-breaks off)
> 
> Ie, the first line here is correct, but the second is missing it's preceeding 
> comment. 
> 
> The problem lies with this line only. The other three gettext lines in 
> fdfixc.sed correctly insert the "// xgettext:no-c-format" comment.
> 
> #  For all lines containing "fl_add" and a string containing |, add the
> #  shortcut command after the end of this line
> /fl_add/ s/idex(\(.*\)").*$/&\
>     fl_set_button_shortcut(obj,scex(\1")),1);/
> 
> I don't understand this line. (I can see what it does.) I've never come 
> across the &\  bit before; it appears that the modified line is not available 
> for further modification.

The '&' simply copies everything that matched in the first part of the
s/// expression while the '\' is just embedding a newline in the second
part of the s/// expression.

I don't see why you aren't able to change the resultant output with a
later rule.  It may be necessary in this to case split this rule into two
versions -- one for expressions with a '%' and one without.  Not pretty
though.

I'll add it to my todo list.


Actually, here's an idea.  What if we changed the rules around so we had
code that looked like:

   // xgettext:no-c-format
   char * dummy = N_("Zoom %|#Z");
   fdui->counter_zoom = obj = fl_add_counter(FL_NORMAL_COUNTER, 310, 130, 
 100, 30, idex(_(dummy)));
   fl_set_button_shortcut(obj, scex(_(dummy)), 1);

This way we could make a small simplification of the idex()->scex() rule
that's giving problems and we could probably merge the two fl_add and
shortcut rules into one that makes code similar to the above (ie. only
handle two cases -- with[out] shortcut.

Hmmm... I'll think about it.  Over dinner and after a nap.  Not enough
sleep and no lunch. 

Allan. (ARRae)



Reply via email to