* [ECOS] Baffled yet again by CDL
@ 2012-03-21 20:31 Grant Edwards
2012-03-21 21:20 ` Jay Foster
0 siblings, 1 reply; 5+ messages in thread
From: Grant Edwards @ 2012-03-21 20:31 UTC (permalink / raw)
To: ecos-discuss
How do I get a quoted string as a default value for a CDL option?
If I put
default_value {"Foobar"}
I get this:
#define CYG_WHATEVER Foobar
But when user_value like this
user_value {"Foobar"}
Then I get this:
#define CYG_WHATEVER "Foobar"
Why do they behave differently? How do I get the latter result with a
default value? [This reminds me yet again why I loathe TCL]
--
Grant Edwards grant.b.edwards Yow! I Know A Joke!!
at
gmail.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ECOS] Baffled yet again by CDL
2012-03-21 20:31 [ECOS] Baffled yet again by CDL Grant Edwards
@ 2012-03-21 21:20 ` Jay Foster
2012-03-21 22:18 ` [ECOS] " Grant Edwards
0 siblings, 1 reply; 5+ messages in thread
From: Jay Foster @ 2012-03-21 21:20 UTC (permalink / raw)
To: Grant Edwards; +Cc: ecos-discuss
Use
default_value { "\"Foobar\"" }
There are many examples in the eCos repository that do this.
Jay
On 3/21/2012 1:31 PM, Grant Edwards wrote:
> How do I get a quoted string as a default value for a CDL option?
>
>
> If I put
>
> default_value {"Foobar"}
>
> I get this:
>
> #define CYG_WHATEVER Foobar
>
> But when user_value like this
>
> user_value {"Foobar"}
>
> Then I get this:
>
> #define CYG_WHATEVER "Foobar"
>
> Why do they behave differently? How do I get the latter result with a
> default value? [This reminds me yet again why I loathe TCL]
>
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ECOS] Re: Baffled yet again by CDL
2012-03-21 21:20 ` Jay Foster
@ 2012-03-21 22:18 ` Grant Edwards
2012-03-22 7:43 ` Sergei Gavrikov
0 siblings, 1 reply; 5+ messages in thread
From: Grant Edwards @ 2012-03-21 22:18 UTC (permalink / raw)
To: ecos-discuss
On 2012-03-21, Jay Foster <jay@systech.com> wrote:
> Use
>
> default_value { "\"Foobar\"" }
>
> There are many examples in the eCos repository that do this.
Thanks. I did find some examples after fixing my grep command.
I still don't get why it's { "\"Foobar\"" } in a default value and {
"Foobar" } when a user value. That doesn't seem intuitive at all.
--
Grant Edwards grant.b.edwards Yow! An INK-LING? Sure --
at TAKE one!! Did you BUY any
gmail.com COMMUNIST UNIFORMS??
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ECOS] Re: Baffled yet again by CDL
2012-03-21 22:18 ` [ECOS] " Grant Edwards
@ 2012-03-22 7:43 ` Sergei Gavrikov
2012-03-22 16:55 ` Grant Edwards
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Gavrikov @ 2012-03-22 7:43 UTC (permalink / raw)
To: Grant Edwards; +Cc: ecos-discuss
On Wed, 21 Mar 2012, Grant Edwards wrote:
> On 2012-03-21, Jay Foster <jay@systech.com> wrote:
> > Use
> >
> > default_value { "\"Foobar\"" }
> >
> > There are many examples in the eCos repository that do this.
>
> Thanks. I did find some examples after fixing my grep command.
>
> I still don't get why it's { "\"Foobar\"" } in a default value and {
> "Foobar" } when a user value. That doesn't seem intuitive at all.
Hi
Grant, I would explain it so, defalt_value vs user_value is something
like MI (machine interface) vs HI (human interface). Look at the value
of a 'defalt_value' as MI instance (i.e. an expression), but, the value
of a 'user_value' is a user input (an input in configtool, or editing
ecos.ecc config file). **No wrong with TCL here**. Well, then in C
#include <stdio.h>
main()
{
const char *default_value = "\"Foobar\""; // MI
char user_value[256];
printf("default_value is %s\n", default_value);
printf("user_value? ");
fflush(stdout);
fgets(user_value, sizeof(user_value) - 1, stdin); // HI
printf("user_value is %s\n", user_value);
return (0);
}
compare
% ./a.out
default_value is "Foobar"
user_value? Baz
user_value is Baz
and
% ./a.out
default_value is "Foobar"
user_value? "Baz"
user_value is "Baz"
CDL != TCL. CDL is a huge interface in C++ (~40K lines of code) which
uses TCL for some cases. There are useful comments in these sources
host/libcdl/cdlcore.cxx
host/libcdl/value.cxx
by the topic.
Sergei
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ECOS] Re: Baffled yet again by CDL
2012-03-22 7:43 ` Sergei Gavrikov
@ 2012-03-22 16:55 ` Grant Edwards
0 siblings, 0 replies; 5+ messages in thread
From: Grant Edwards @ 2012-03-22 16:55 UTC (permalink / raw)
To: ecos-discuss
On 2012-03-22, Sergei Gavrikov <sergei.gavrikov@gmail.com> wrote:
> CDL != TCL. CDL is a huge interface in C++ (~40K lines of code) which
> uses TCL for some cases.
I thought all of the expression evaluation was done in TCL. I tried
writing reasonably sized a TCL/Tk application once, and gave up
because the quoting semantics were entirely too obtuse. Writing the
same app in Scheme/Tk or Python/Tk was far easier.
> There are useful comments in these sources
>
> host/libcdl/cdlcore.cxx
> host/libcdl/value.cxx
>
> by the topic.
Thanks.
--
Grant Edwards grant.b.edwards Yow! ... he dominates the
at DECADENT SUBWAY SCENE.
gmail.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-22 16:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-21 20:31 [ECOS] Baffled yet again by CDL Grant Edwards
2012-03-21 21:20 ` Jay Foster
2012-03-21 22:18 ` [ECOS] " Grant Edwards
2012-03-22 7:43 ` Sergei Gavrikov
2012-03-22 16:55 ` Grant Edwards
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).