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
RevLine 
[2446]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
[3368]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
[2446]37defmain
[3368]38 'ShowF' arg( 1)
[2446]39compile endif
40
41; ---------------------------------------------------------------------------
[3368]42defc ShowF
[3404]43 if arg( 1) = '' then
44 getline LineStr
[3368]45 call Find_Token( startcol, endcol)
[4596]46 FieldVar = substr( LineStr, startcol, endcol - startcol + 1)
47 if leftstr( FieldVar, 1) <> '.' then
[4904]48 "SayError Specify a field var or place cursor over one."
[2446]49 return
50 endif
51 else
[4596]52 FieldVar = arg( 1)
[2446]53 endif
[3404]54
[4596]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
[3404]65 TmpName = 'sf_temp.tmp'
66 TmpFile = GetTmpPath()''TmpName
67 ExName = ChangeStr( '.tmp', TmpName, '.ex')
68 TmpExFile = Get_Env( 'NEPMD_USERDIR')'\ex\'ExName
[3405]69 LogFile = ChangeStr( '.ex', TmpExFile, '.log')
[3404]70
[4596]71 call EraseTemp( TmpFile)
72 call EraseTemp( TmpExFile)
73 call EraseTemp( LogFile)
74
[3404]75 'xcom e /c 'TmpFile
[2446]76 replaceline 'defmain', 1
77 insertline ' fid = 'fid, 2
[4904]78 insertline ' ''SayError 'FieldVar' = "''fid'FieldVar'''"''', 3
[3404]79 'xcom File'
80
81 'Etpm 'TmpFile
[3368]82 if rc then
83 return
84 endif
[3404]85
[4904]86 --'UnLink' ExName -- (just in case...)
[2446]87 'sf_temp'
88
[3404]89 call EraseTemp( TmpFile)
90 call EraseTemp( TmpExFile)
[3405]91 call EraseTemp( LogFile)
[3404]92
Note: See TracBrowser for help on using the repository browser.