[Bond-users] Papyrus makelabels

Colin Close itchka at compuserve.com
Sat Dec 10 08:00:53 EST 2011


On Saturday 10 Dec 2011 02:14:47 Colin Close wrote:
> On Friday 09 Dec 2011 15:13:00 Colin Close wrote:
> > On Friday 09 Dec 2011 13:37:25 Jasen Betts wrote:
> > > On Thu, Dec 08, 2011 at 11:53:50PM +0000, Colin Close wrote:
> > > > which is almost certainly not going to work for the label option.
> > > > What is needed if the ability with papyrus_gui to optionally disable
> > > > the
> > > > -a
> > > > flag generation to allow user option to be passed to papyrus.
> > > > I have looked at the source code for the section that does this work
> > > > and
> > > > it
> > > > seems to me from my limited understanding of C coding that if the
> > > > variable
> > > > name defined in the requires section of the xml began with a '-' or
> > > > '--'
> > > > an
> > > > extra 'if' statement  in this section of code could then overrride the
> > > > -a
> > > > %=% stuff and simply output the option with its parameter.
> > > 
> > > that's a good idea, <reuires> parameters have arbitrary names that are
> > > only
> > > used internally to the xml document. it's unlikely that anyone would
> > > have chosesn a name starting with --, and if they have they can
> > > probably change it to something else easily enough.
> > > 
> > > > I've pasted the code from report.c here so you can see how simple the
> > > > change could be. I have put in some pseudo code 'cus alas I have yet
> > > > to
> > > > grasp C. Its not elegant but I think it would work. What do you think?
> > > 
> > > papyrus doesn't like "--name=value" , it only works with "--name value"
> > > 
> > > I haven't allowed names starting with a single -, all papyrus options
> > > have a long version which should be preferred.
> > > 
> > > --- a/gui/src/report.c
> > > +++ b/gui/src/report.c
> > > @@ -104,8 +104,18 @@ run_report ()
> > > 
> > >           param = (require_parameter *) walk->data;
> > >           if (param->value)
> > >           
> > >             {
> > > 
> > > -             args=g_list_append(args,mem_strdup("-a"));
> > > -             args=g_list_append(args, mem_strdup_printf ("%s=%s",
> > > param->ident, +             if( param->ident[0] == '-' &&
> > > param->ident[1]
> > > == '-' ) +               { /* if param ident begins "--" emit it and the
> > > value without '-a' preamble +                  * and without "=" joining
> > > them */
> > > +                 if( param->ident[2] ) /* suppress '--' with nothing
> > > after, only emit value */ +
> > > args=g_list_append(args,mem_strdup(param->ident)); +
> > > args=g_list_append(args, mem_strdup(param->value)); +               }
> > > +             else
> > > +               {
> > > +                 args=g_list_append(args,mem_strdup("-a"));
> > > +                 args=g_list_append(args, mem_strdup_printf ("%s=%s",
> > > param->idnt, param->value)); +               }
> > > 
> > >             }
> > >           
> > >           walk = walk->next;
> > >         
> > >         }
> > 
> > Thank you Jasen, that's great! I'll patch it in and try it.
> > I'll also study what you have done and try to improve my C coding
> > comprehension some more.
> > Best
> > Colin
> 
> Hi Jasen,
> I patched and re-compiled and tried and alas it didnt work always papyrus
> blew out with some kind of error and just showed the help. In the end I
> disable the error trapping in papyrus and the prog ran to it's conclusion
> but did not get the correct label. A bit more thinking and it occured to me
> that what I was seing on the standard output may not actually be what was
> being sent to papyrus. A quick test showed that I could get similar
> behaviour by writing:- --labelsavery7160. A quick test with a leading space
> in front of the label parameter solved the problem so somehow the = needs
> to be replaced with a space. I understood enough of what uou coded to be
> able to implement the short -l option. I believe you are pulling individual
> elements out of a struct ident[0] etc and I know I will need something like
> %s' ' %s to be able to add the space... but....
> Best
> Colin
> 
Hi Jasen,
Please forgive this continued blather it seems that the extra space is not 
required. I confused myself by making more than one change at a time. It is 
just the  "ensure_variable(char *name)" thing  that is causing the problem.
Best,
Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.hcoop.net/pipermail/bond-users/attachments/20111210/ce550f3e/attachment-0001.htm 


More information about the Bond-users mailing list