/****************************** Module Header ******************************* * * Module Name: showu.e * * Copyright (c) Netlabs EPM Distribution Project 2002 * * $Id$ * * =========================================================================== * * This file is part of the Netlabs EPM Distribution package and is free * software. You can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * Netlabs EPM Distribution. This library is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * ****************************************************************************/ ; http://groups.google.com/groups?hl=de&lr=&ie=UTF-8&selm=5etq66%24tao%241%40news-s01.ca.us.ibm.net ; ShowU.e, by Larry Margolis ; This is a simple routine that will let you dynamically display the value of ; a universal variable. Since the universal variable name must be compiled ; in to the code that attempts to display it, we have to be a wee bit clever ; in order to do this - we write some code to a temp file, then compile that ; and run the dynamically-generated code. compile if not defined( SMALL) -- If compiled separately EA_comment 'Show value of a universal var' define INCLUDING_FILE = 'SHOWU.E' include 'stdconst.e' const tryinclude 'mycnf.e' const compile if not defined( NLS_LANGUAGE) NLS_LANGUAGE = 'ENGLISH' compile endif include NLS_LANGUAGE'.e' defmain 'ShowU' arg( 1) compile endif ; --------------------------------------------------------------------------- defc ShowU if arg( 1) = '' then getline LineStr if lowcase( word( LineStr, 1)) <> 'universal' | not pos( substr( .line, .col, 1), ' ,') then "SayError Specify a univ. var or place cursor over one (on a 'universal' line)." return endif call Find_Token( startcol, endcol) UniVar = substr( LineStr, startcol, (endcol - startcol) + 1) else UniVar = arg( 1) if leftstr( UniVar, 1) = '.' then UniVar = substr( UniVar, 2) endif endif call EraseTemp( TmpFile) call EraseTemp( TmpExFile) call EraseTemp( LogFile) TmpName = 'su_temp.tmp' TmpFile = GetTmpPath()''TmpName ExName = ChangeStr( '.tmp', TmpName, '.ex') TmpExFile = Get_Env( 'NEPMD_USERDIR')'\ex\'ExName LogFile = ChangeStr( '.ex', TmpExFile, '.log') 'xcom e /c 'TmpFile replaceline 'defmain', 1 insertline ' universal' UniVar, 2 insertline ' ''SayError 'UniVar' = "'''UniVar'''"''', 3 'xcom file' 'Etpm 'TmpFile if rc then return endif --'UnLink' ExName -- (just in case...) 'su_temp' call EraseTemp( TmpFile) call EraseTemp( TmpExFile) call EraseTemp( LogFile)