From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15241 invoked by alias); 9 Jul 2012 22:48:27 -0000 Received: (qmail 15231 invoked by uid 22791); 9 Jul 2012 22:48:25 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,MALFORMED_FREEMAIL,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f177.google.com (HELO mail-we0-f177.google.com) (74.125.82.177) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Jul 2012 22:48:12 +0000 Received: by werb13 with SMTP id b13so6452477wer.36 for ; Mon, 09 Jul 2012 15:48:11 -0700 (PDT) Received: by 10.216.54.212 with SMTP id i62mr13307917wec.98.1341874086693; Mon, 09 Jul 2012 15:48:06 -0700 (PDT) Received: from sg-laptop ([178.123.159.129]) by mx.google.com with ESMTPS id l5sm38267164wix.5.2012.07.09.15.48.04 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Jul 2012 15:48:05 -0700 (PDT) Date: Mon, 09 Jul 2012 22:48:00 -0000 From: Sergei Gavrikov To: Ilija Kocho cc: eCos Discuss In-Reply-To: <4FF9FB35.2080702@siva.com.mk> Message-ID: References: <4FF9E752.3030606@siva.com.mk> <4FF9FB35.2080702@siva.com.mk> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Assign a CDL value to TCL variable. X-SW-Source: 2012-07/txt/msg00014.txt.bz2 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