This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Re: Baffled yet again by CDL
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