source: trunk/src/netlabs/macros/showf.e@ 5224

Last change on this file since 5224 was 4904, checked in by Andreas Schnellbacher, 3 years ago
  • Avoid error msg on trying to unlink an already unlinked file.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author HeadURL Id
File size: 2.5 KB
Line 
1/****************************** Module Header *******************************
2*
3* Module Name: showf.e
4*
5* Copyright (c) Netlabs EPM Distribution Project 2002
6*
7* $Id: showf.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
22compile if not defined( SMALL) -- If compiled separately
23 EA_comment 'Show value of a field var'
24
25define
26 INCLUDING_FILE = 'SHOWF.E'
27
28 include 'stdconst.e'
29const
30 tryinclude 'mycnf.e'
31const
32 compile if not defined( NLS_LANGUAGE)
33 NLS_LANGUAGE = 'ENGLISH'
34 compile endif
35 include NLS_LANGUAGE'.e'
36
37defmain
38 'ShowF' arg( 1)
39compile endif
40
41; ---------------------------------------------------------------------------
42defc ShowF
43 if arg( 1) = '' then
44 getline LineStr
45 call Find_Token( startcol, endcol)
46 FieldVar = substr( LineStr, startcol, endcol - startcol + 1)
47 if leftstr( FieldVar, 1) <> '.' then
48 "SayError Specify a field var or place cursor over one."
49 return
50 endif
51 else
52 FieldVar = arg( 1)
53 endif
54
55 p = pos( '.', FieldVar)
56 if p = 0 then
57 FieldVar = '.'FieldVar
58 getfileid fid
59 elseif p = 1 then
60 getfileid fid
61 elseif p > 1 then
62 parse value FieldVar with fid'.' -1 FieldVar
63 endif
64
65 TmpName = 'sf_temp.tmp'
66 TmpFile = GetTmpPath()''TmpName
67 ExName = ChangeStr( '.tmp', TmpName, '.ex')
68 TmpExFile = Get_Env( 'NEPMD_USERDIR')'\ex\'ExName
69 LogFile = ChangeStr( '.ex', TmpExFile, '.log')
70
71 call EraseTemp( TmpFile)
72 call EraseTemp( TmpExFile)
73 call EraseTemp( LogFile)
74
75 'xcom e /c 'TmpFile
76 replaceline 'defmain', 1
77 insertline ' fid = 'fid, 2
78 insertline ' ''SayError 'FieldVar' = "''fid'FieldVar'''"''', 3
79 'xcom File'
80
81 'Etpm 'TmpFile
82 if rc then
83 return
84 endif
85
86 --'UnLink' ExName -- (just in case...)
87 'sf_temp'
88
89 call EraseTemp( TmpFile)
90 call EraseTemp( TmpExFile)
91 call EraseTemp( LogFile)
92
Note: See TracBrowser for help on using the repository browser.