[Bond-users] Papyrus makelabels
Jasen Betts
jasen at treshna.com
Thu Dec 8 19:37:25 EST 2011
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;
}
--
Jasen Betts
treshna Enterprises Ltd
Tel: +64 3 974 9169 or 0800 894 149
(for Jasen dial ext 204 when the voice starts)
Fax: +64 28 894 860
Web: www.treshna.com
267 Madras Street, Christchurch, New Zealand
IT Consultancy - Websites - Database development - Computer tech support
More information about the Bond-users
mailing list