- To: Grant Edwards <grant.b.edwards@xxxxxxxxx>
- Subject: Re: Re: Baffled yet again by CDL
- From: Sergei Gavrikov <sergei.gavrikov@xxxxxxxxx>
- Date: Thu, 22 Mar 2012 10:42:48 +0300 (FET)
- Cc: ecos-discuss@xxxxxxxxxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- In-reply-to: <jkdk33$og4$1@dough.gmane.org>
- User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Wed, 21 Mar 2012, Grant Edwards wrote:
> On 2012-03-21, Jay Foster <jay@xxxxxxxxxxx> 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
[Linux Embedded]
[U-Boot V2]
[Linux Kernel]
[Linux MIPS]
[Linux ARM]
[Linux for the Blind]
[Linux Resources]
[Photo]
[Yosemite]
[ISDN Cause Codes]
[ECOS Home]
[Site Home]