From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12068 invoked by alias); 28 Mar 2013 16:32:36 -0000 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 Received: (qmail 12041 invoked by uid 89); 28 Mar 2013 16:32:29 -0000 X-Spam-SWARE-Status: No, score=2.9 required=5.0 tests=AWL,BAYES_00,KAM_STOCKTIP,RCVD_IN_DNSWL_NONE,TW_VP autolearn=no version=3.3.1 Received: from relay02.alfahosting-server.de (HELO relay02.alfahosting-server.de) (109.237.142.238) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 28 Mar 2013 16:32:24 +0000 Received: by relay02.alfahosting-server.de (Postfix, from userid 1001) id 39CE832C07B2; Thu, 28 Mar 2013 17:32:21 +0100 (CET) X-Spam-DCC: : Received: from alfa3017.alfahosting-server.de (alfa3017.alfahosting-server.de [109.237.140.28]) by relay02.alfahosting-server.de (Postfix) with ESMTP id F2E5A32C0820 for ; Thu, 28 Mar 2013 17:32:18 +0100 (CET) Received: from itrrrauch (p578a450a.dip0.t-ipconnect.de [87.138.69.10]) by alfa3017.alfahosting-server.de (Postfix) with ESMTPA id CC8AE2934783 for ; Thu, 28 Mar 2013 17:32:18 +0100 (CET) From: "Richard Rauch" To: Date: Thu, 28 Mar 2013 16:32:00 -0000 Message-ID: <000301ce2bd1$d0acd530$72067f90$@itrgmbh.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Virus-Checker-Version: clamassassin 1.2.4 with ClamAV 0.97.3/16920/Thu Mar 28 15:54:38 2013 Subject: [ECOS] CDL/TCL issue building macro names in loops X-SW-Source: 2013-03/txt/msg00065.txt.bz2 Hi all, is there an expert for CDL/TCL language? I have problems with creating macro name dynamically with TCL language. I have to implement an ADC driver. I want to create the list of channels. Because the large number of channels (10 internal channel with ACT value, MIN value and MAX value and 15 external channels) I want to create the channel list more convenient. The following code (some excerpt of my CDL script) works already good, but it is not matching my requirements completely: #--------------------------------------------------------------------------- ---------------------------------------- set SensorList { temp vccint vccaux vpvn vrefp vrefn vccbram vccpint vccpaux vcc0ddr } foreach Sensor $SensorList { cdl_component CYGNUM_DEVS_ADC_ARM_XC7Z_ONCHIP_$Sensor { parent CYGNUM_DEVS_ADC_ARM_XC7Z_ONCHIP_SENSORS display "on-chip $Sensor" flavor none description "XADC on-chip $Sensor sensor measurement" cdl_option CYGDAT_DEVS_ADC_ARM_XC7Z_CHANNEL_NAME_ONCHIP_ACT_$Sensor { display "Device name" flavor data default_value [format {"\"/dev/xadc_act_%s\""} $Sensor ] description " This option controls the name that an eCos application should use to access this device via cyg_io_lookup(), open(), or similar calls." } . . . #--------------------------------------------------------------------------- ----------------------------------------- The $Sensor symbol is replaced in the code for each loop correctly. But it works only, when $Sensor is separated by blanks or if it is at end of string. It is NOT working, when I place it inside the MACRO Name: e.g. CYGDAT_DEVS_ADC_ARM_XC7Z_CHANNEL_ONCHIP_$Sensor _ACT_NAME I have tried different syntax approaches...e..g "$$", $ at beginning and end of symbol, put into "[...]", but no success! Is this possible anyhow? And what is the correct syntax? Further I want to use string functions "string toupper" and "string tolower". In Macro Names I want to convert to upper, in device name I want to convert to lower (which would match the naming conventions). But this is not working too. I tried e.g [string tolower ($Sensor)] or [expr string tolower($Sensor)] and a lot of other variants. But I always get syntax errors. Any ideas, what is wrong? Thanks Richard ITR GmbH web: http://www.itrgmbh.com email: info@itrgmbh.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