1 | /****************************** Module Header *******************************
|
---|
2 | *
|
---|
3 | * Module Name: showu.e
|
---|
4 | *
|
---|
5 | * Copyright (c) Netlabs EPM Distribution Project 2002
|
---|
6 | *
|
---|
7 | * $Id: showu.e 4904 2022-03-03 19:02:26Z aschn $
|
---|
8 | *
|
---|
9 | * ===========================================================================
|
---|
10 | *
|
---|
11 | * This file is part of the Netlabs EPM Distribution package and is free
|
---|
12 | * software. You can redistribute it and/or modify it under the terms of the
|
---|
13 | * GNU General Public License as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * Netlabs EPM Distribution. This library is distributed in the hope that it
|
---|
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
---|
17 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
18 | * General Public License for more details.
|
---|
19 | *
|
---|
20 | ****************************************************************************/
|
---|
21 |
|
---|
22 | ; http://groups.google.com/groups?hl=de&lr=&ie=UTF-8&selm=5etq66%24tao%241%40news-s01.ca.us.ibm.net
|
---|
23 |
|
---|
24 | ; ShowU.e, by Larry Margolis
|
---|
25 |
|
---|
26 | ; This is a simple routine that will let you dynamically display the value of
|
---|
27 | ; a universal variable. Since the universal variable name must be compiled
|
---|
28 | ; in to the code that attempts to display it, we have to be a wee bit clever
|
---|
29 | ; in order to do this - we write some code to a temp file, then compile that
|
---|
30 | ; and run the dynamically-generated code.
|
---|
31 |
|
---|
32 | compile if not defined( SMALL) -- If compiled separately
|
---|
33 | EA_comment 'Show value of a universal var'
|
---|
34 |
|
---|
35 | define
|
---|
36 | INCLUDING_FILE = 'SHOWU.E'
|
---|
37 |
|
---|
38 | include 'stdconst.e'
|
---|
39 | const
|
---|
40 | tryinclude 'mycnf.e'
|
---|
41 | const
|
---|
42 | compile if not defined( NLS_LANGUAGE)
|
---|
43 | NLS_LANGUAGE = 'ENGLISH'
|
---|
44 | compile endif
|
---|
45 | include NLS_LANGUAGE'.e'
|
---|
46 |
|
---|
47 | defmain
|
---|
48 | 'ShowU' arg( 1)
|
---|
49 | compile endif
|
---|
50 |
|
---|
51 | ; ---------------------------------------------------------------------------
|
---|
52 | defc ShowU
|
---|
53 | if arg( 1) = '' then
|
---|
54 | getline LineStr
|
---|
55 | if lowcase( word( LineStr, 1)) <> 'universal' |
|
---|
56 | not pos( substr( .line, .col, 1), ' ,')
|
---|
57 | then
|
---|
58 | "SayError Specify a univ. var or place cursor over one (on a 'universal' line)."
|
---|
59 | return
|
---|
60 | endif
|
---|
61 | call Find_Token( startcol, endcol)
|
---|
62 | UniVar = substr( LineStr, startcol, (endcol - startcol) + 1)
|
---|
63 | else
|
---|
64 | UniVar = arg( 1)
|
---|
65 | if leftstr( UniVar, 1) = '.' then
|
---|
66 | UniVar = substr( UniVar, 2)
|
---|
67 | endif
|
---|
68 | endif
|
---|
69 |
|
---|
70 | call EraseTemp( TmpFile)
|
---|
71 | call EraseTemp( TmpExFile)
|
---|
72 | call EraseTemp( LogFile)
|
---|
73 |
|
---|
74 | TmpName = 'su_temp.tmp'
|
---|
75 | TmpFile = GetTmpPath()''TmpName
|
---|
76 | ExName = ChangeStr( '.tmp', TmpName, '.ex')
|
---|
77 | TmpExFile = Get_Env( 'NEPMD_USERDIR')'\ex\'ExName
|
---|
78 | LogFile = ChangeStr( '.ex', TmpExFile, '.log')
|
---|
79 |
|
---|
80 | 'xcom e /c 'TmpFile
|
---|
81 | replaceline 'defmain', 1
|
---|
82 | insertline ' universal' UniVar, 2
|
---|
83 | insertline ' ''SayError 'UniVar' = "'''UniVar'''"''', 3
|
---|
84 | 'xcom file'
|
---|
85 |
|
---|
86 | 'Etpm 'TmpFile
|
---|
87 | if rc then
|
---|
88 | return
|
---|
89 | endif
|
---|
90 |
|
---|
91 | --'UnLink' ExName -- (just in case...)
|
---|
92 | 'su_temp'
|
---|
93 |
|
---|
94 | call EraseTemp( TmpFile)
|
---|
95 | call EraseTemp( TmpExFile)
|
---|
96 | call EraseTemp( LogFile)
|
---|
97 |
|
---|