public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Assign a CDL value to  TCL variable.
@ 2012-07-08 20:02 Ilija Kocho
  2012-07-08 20:57 ` Sergei Gavrikov
  0 siblings, 1 reply; 4+ messages in thread
From: Ilija Kocho @ 2012-07-08 20:02 UTC (permalink / raw)
  To: ecos-discuss

Hi colleagues

Is there a way to assign a value of CDL option/component to a TCL
variable. something equivalent to:

    cdl_option CYGFOO {
        flavor data
        calculated 5
    }

  set cygbar some_function(CYGFOO)
# Here cygbar == 5

Ilija


-- 
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] 4+ messages in thread

* Re: [ECOS] Assign a CDL value to  TCL variable.
  2012-07-08 20:02 [ECOS] Assign a CDL value to TCL variable Ilija Kocho
@ 2012-07-08 20:57 ` Sergei Gavrikov
  2012-07-08 21:27   ` Ilija Kocho
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Gavrikov @ 2012-07-08 20:57 UTC (permalink / raw)
  To: Ilija Kocho; +Cc: ecos-discuss

On Sun, 8 Jul 2012, Ilija Kocho wrote:

> Hi colleagues
> 
> Is there a way to assign a value of CDL option/component to a TCL
> variable. something equivalent to:
> 
>     cdl_option CYGFOO {
>         flavor data
>         calculated 5
>     }
> 
>   set cygbar some_function(CYGFOO)
> # Here cygbar == 5

Hi Ilija

Would not you use TCL's ``set'' command for that? E.g.

  cdl_package CYGPKG_FOO {
      cdl_option CYGGLO_FOOBAR {
          flavor data
          calculated [set ::foobar 5]
      }
  }

In such a case you'll find in pkgconf/foo.h

  #define CYGGLO_FOOBAR 5
  #define CYGGLO_FOOBAR_5

Sure that global TCL variable ``foobar'' will be set to 5 too.

HTH

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] 4+ messages in thread

* Re: [ECOS] Assign a CDL value to  TCL variable.
  2012-07-08 20:57 ` Sergei Gavrikov
@ 2012-07-08 21:27   ` Ilija Kocho
  2012-07-09 22:48     ` Sergei Gavrikov
  0 siblings, 1 reply; 4+ messages in thread
From: Ilija Kocho @ 2012-07-08 21:27 UTC (permalink / raw)
  To: Sergei Gavrikov; +Cc: ecos-discuss

On 08.07.2012 22:56, Sergei Gavrikov wrote:

Thanks Sergei, but that's not what I need. I heed to assign some Tcl
variable with the value of some CDL option.

Ilija



> On Sun, 8 Jul 2012, Ilija Kocho wrote:
>
>> Hi colleagues
>>
>> Is there a way to assign a value of CDL option/component to a TCL
>> variable. something equivalent to:
>>
>>     cdl_option CYGFOO {
>>         flavor data
>>         calculated 5
>>     }
>>
>>   set cygbar some_function(CYGFOO)
>> # Here cygbar == 5
> Hi Ilija
>
> Would not you use TCL's ``set'' command for that? E.g.
>
>   cdl_package CYGPKG_FOO {
>       cdl_option CYGGLO_FOOBAR {
>           flavor data
>           calculated [set ::foobar 5]
>       }
>   }
>
> In such a case you'll find in pkgconf/foo.h
>
>   #define CYGGLO_FOOBAR 5
>   #define CYGGLO_FOOBAR_5
>
> Sure that global TCL variable ``foobar'' will be set to 5 too.
>
> HTH
>
> 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] 4+ messages in thread

* Re: [ECOS] Assign a CDL value to  TCL variable.
  2012-07-08 21:27   ` Ilija Kocho
@ 2012-07-09 22:48     ` Sergei Gavrikov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Gavrikov @ 2012-07-09 22:48 UTC (permalink / raw)
  To: Ilija Kocho; +Cc: eCos Discuss

On Sun, 8 Jul 2012, Ilija Kocho wrote:

> On 08.07.2012 22:56, Sergei Gavrikov wrote:
> 
> Thanks Sergei, but that's not what I need. I heed to assign some Tcl
> variable with the value of some CDL option.

AFAIK, eCos CDL library `libcdl' does not provide such an ability (it
does not provide a binding the CDL instances with the Tcl ones).  But,
if you looking for a read-only access to CYG* values via Tcl it can be
done in Tcl. I've got a few lines in Tcl to get something likes below

For CDL

  # foo.cdl --
  cdl_package CYGPKG_FOO {
     display "Foo package"

     cdl_option CYGDAT_BAR {
        display "Bar option"
        flavor boolean
        default_value 1
     }
  }

it provides an access via Tcl namespaces (not nested)

  % CYGPKG_FOO::display
  Foo package
  % puts [GYGDAT_BAR::flavor]
  boolean

YA access via Tcl global variables

  % set CYGDAT_BAR
  1

or that can be used as simple CDL cheker/dumper

  % source cdl_dump.tcl
  % source ecos.ecc
  % set CYG_HAL_STARTUP
  ROM

However, I have no idea how to use that for your needs.  If I understand
correctly the CDL files source itself only once by CT or ecosconfig, so
it looks like static RO access, I do not see any benefits for such a
post processor in Tcl inside CDL sources. But it is possible. If it can
be useful for you I can attach that code (if a fact that is just a demo
snippet, how you would process CDL options).

If you looking for a real binding for the CDL CYG* instances I afraid
that there is only one way to get it, that is to investigate in eCos CDL
library.

Sergei

> Ilija
> 
> 
> 
> > On Sun, 8 Jul 2012, Ilija Kocho wrote:
> >
> >> Hi colleagues
> >>
> >> Is there a way to assign a value of CDL option/component to a TCL
> >> variable. something equivalent to:
> >>
> >>     cdl_option CYGFOO {
> >>         flavor data
> >>         calculated 5
> >>     }
> >>
> >>   set cygbar some_function(CYGFOO)
> >> # Here cygbar == 5
> > Hi Ilija
> >
> > Would not you use TCL's ``set'' command for that? E.g.
> >
> >   cdl_package CYGPKG_FOO {
> >       cdl_option CYGGLO_FOOBAR {
> >           flavor data
> >           calculated [set ::foobar 5]
> >       }
> >   }
> >
> > In such a case you'll find in pkgconf/foo.h
> >
> >   #define CYGGLO_FOOBAR 5
> >   #define CYGGLO_FOOBAR_5
> >
> > Sure that global TCL variable ``foobar'' will be set to 5 too.
> >
> > HTH
> >
> > 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] 4+ messages in thread

end of thread, other threads:[~2012-07-09 22:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-08 20:02 [ECOS] Assign a CDL value to TCL variable Ilija Kocho
2012-07-08 20:57 ` Sergei Gavrikov
2012-07-08 21:27   ` Ilija Kocho
2012-07-09 22:48     ` Sergei Gavrikov

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).