/****************************** Module Header ******************************* * * Module Name: info.e * * E wrapper routine to access the NEPMD library DLL. * Include of nepmdlib.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. * ****************************************************************************/ /* @@NepmdInfo@PROTOTYPE NepmdInfo( Option) @@NepmdInfo@CATEGORY@INSTALL @@NepmdInfo@SYNTAX This function creates a virtual file named *.NEPMD__INFO* within the file ring of the active EPM window and writes runtime information into it like for example about .ul compact - the *NEPMD* modules loaded and config files used - the loaded *EPM* modules - the latest *NEPMD* version. .el @@NepmdInfo@PARM@Option If *N* (no check) is specified as parameter, then the check for the latest *NEPMD* version is not executed. This parameter is optional. @@NepmdInfo@RETURNS *NepmdInfo* returns nothing. This procedure sets the implicit universal var *rc*. rc is set to an [inf:cp2 "Errors" OS/2 error code] or to zero for no error. @@NepmdInfo@REMARKS Note that any existing file in the ring named *.NEPMD__INFO* is discarded before the current file is being created. @@NepmdInfo@TESTCASE You can test this function from the *EPM* commandline by executing: .sl - *NepmdInfo* Executing this command will open up a virtual file and write all information related to *EPM* and the [=TITLE] into it. The contents of this file may be useful when reporting the configuration of your system and the installation of your [=TITLE] to the project team in order to allow us to help you. @@ */ ; --------------------------------------------------------------------------- ; Allow editor command to call function ; --------------------------------------------------------------------------- ; This command is executed from the menu and should be available from cammand ; line. defc NepmdInfo call NepmdInfo( arg( 1)) ; --------------------------------------------------------------------------- ; Procedure: NepmdInfo ; --------------------------------------------------------------------------- ; E syntax: ; NepmdInfo( [N]) ; --------------------------------------------------------------------------- ; C prototype: ; APIRET EXPENTRY NepmdInfo( HWND hwndClient); ; --------------------------------------------------------------------------- defproc NepmdInfo InfoFilename = '.NEPMD_INFO' fCheckNepmdVersion = 1 if leftstr( upcase( arg( 1)), 1) = 'N' then fCheckNepmdVersion = 0 endif fUnnamedFileCreated = 0 -- Check if old info file already in ring getfileid oldinfofid, InfoFilename if oldinfofid <> '' then -- If that's the only file, create an unnamed file to make EPM stay open if filesinring() = 1 then 'xcom edit /n' getfileid newfid fUnnamedFileCreated = 1 endif -- Discard previously loaded info file from ring getfileid curfid if curfid = oldinfofid then -- Quit current file 'xcom quit' else -- Temporarily switch to old info file and quit it activatefile oldinfofid 'xcom quit' activatefile curfid endif endif -- Open new file in ring -- '/c' creates a file with the filename as specified and bypasses searching. -- 'xcom edit /c' avoids the message 'New file' of 'edit /c'. -- '/q' has no effect. 'xcom edit /c' InfoFilename getfileid infofid -- Close the unnamed file if created before if fUnnamedFileCreated then activatefile newfid 'xcom quit' activatefile infofid endif -- Call C routine LibFile = helperNepmdGetlibfile() rc = dynalink32( LibFile, 'NepmdInfo', gethwndc( EPMINFO_EDITCLIENT)) helperNepmdCheckliberror( LibFile, rc) -- The C routine 'NepmdInfo' itself executes E commands. Apparently that -- suppresses the select event after the load event for .NEPMD_INFO. -- A missing select event after file loading can be recognized by the -- titlebar, when it contains only the filename. Therefore call it here, -- sometimes additionally. -- Executing ProcessSelect multiple times is suppressed, because it -- recognizes if select was already excuted: 'ProcessSelect' -- Check for new version if fCheckNepmdVersion then if isadefc( 'CheckNepmdVersion') then 'CheckNepmdVersion' endif endif -- Make file discardable .modify = 0 return ; --------------------------------------------------------------------------- ; Helper commands used by the C routine 'NepmdInfo' ; --------------------------------------------------------------------------- ; Some values can only be queried by E commands, so they're ; defined here to get executed by the C routine. ; --------------------------------------------------------------------------- ; --------------------------------------------------------------------------- ; Insert a line with version of ETK DLLs after the current. ; Used by nepmdinfo. defc AppendEditorVersion MsgName = 'STR_INFO_EDITORVERSION' insertline NepmdGetTextMessage( '', MsgName, ver( 0)), .last ; --------------------------------------------------------------------------- ; Insert a line with version of NEPMD after the current. ; Used a const from STDCONST.E, contained in EPM.E. ; Used by nepmdinfo. defc AppendNepmdVersion MsgName = 'STR_INFO_NEPMDVERSION' insertline NepmdGetTextMessage( '', MsgName, GetNepmdVersion()), .last ; --------------------------------------------------------------------------- ; Insert a line with version of EPM macros after the current. ; Used by nepmdinfo. ; The const EVERSION is supplied automatically by the ETPM compiler. defc AppendMacrosVersion MsgName = 'STR_INFO_MACROSVERSION' if isadefproc( 'GetEVersion') then -- In NEPMD, there should exist this proc MacrosVersion = GetEVersion() else -- This should not happen MacrosVersion = EVERSION' (queried from NEPMDLIB.EX)' endif insertline NepmdGetTextMessage( '', MsgName, MacrosVersion), .last ; --------------------------------------------------------------------------- ; Insert a line with path info of EPM.EX after the current ; Used by nepmdinfo. defc AppendLoaderVersion MsgName = 'STR_INFO_NEPMDMODULESTAMP' Loader = get_env( 'NEPMD_LOADEREXECUTABLE') Loader = NepmdQueryFullName( Loader) lp = lastpos( '\', Loader) Name = substr( Loader, lp + 1) Name = leftstr( Name, Max( 16, length( Name))) -- len = 16+, keep in sync with NepmdLib Path = GetRealCase( NepmdQueryFullname( leftstr( Loader, Max( 0, lp - 1)))) TStamp = NepmdQueryPathInfo( Loader, 'MTIME') insertline NepmdGetTextMessage( '', MsgName, Name, TStamp, Path), .last ; --------------------------------------------------------------------------- ; Insert lines with path info of EPM.EX and other linked .ex files after the current. ; Used by nepmdinfo. defc AppendExVersions MsgName = 'STR_INFO_NEPMDEXMODULESTAMP' LastLinkNum = GetAVar( 'linknum.last') if LastLinkNum = '' then LastLinkNum = 0 endif do LinkNum = 0 to LastLinkNum Num = rightstr( LinkNum, 2) ExFile = GetAVar( 'linkfilename.'LinkNum) lp = lastpos( '\', ExFile) Name = substr( ExFile, lp + 1) Name = leftstr( Name, Max( 16, length( Name))) -- len = 16+, keep in sync with NepmdLib Path = GetRealCase( NepmdQueryFullname( leftstr( ExFile, Max( 0, lp - 1)))) TStamp = NepmdQueryPathInfo( ExFile, 'MTIME') insertline NepmdGetTextMessage( '', MsgName, Num, Name, TStamp, Path), .last enddo ; --------------------------------------------------------------------------- ; Insert lines with path info of EPM.EX and other linked .ex files after the current. ; Used by nepmdinfo. defc AppendToolsVersions MsgName = 'STR_INFO_NEPMDTOOLMODULESTAMP' ToolsList = '' ToolsList = ToolsList'lxlite.exe;unlock.exe;grep.exe;diff.exe;' ToolsList = ToolsList'wget.exe;unzip.exe;uconv.exe;recode.exe;' ToolsList = ToolsList'kdiff3.exe;gfc.exe;oslexam.dll;wptools.dll;' rest = ToolsList do while rest <> '' parse value rest with Name';'rest Ext = GetFileSpec( 'E', Name) if upcase( Ext) = 'DLL' then FindDll( Name, Dir, DateTime, VersionString) else FindExe( Name, Dir, DateTime, VersionString) endif Name = leftstr( Name, Max( 16, length( Name))) -- len = 16+ DateTime = leftstr( DateTime, Max( 19, length( DateTime))) -- len = 19+ if Dir = '' then DateTime = NepmdGetTextMessage( '', 'STR_INFO_NOTFOUND') endif -- DateTime may also be '(not found)' insertline NepmdGetTextMessage( '', MsgName, Name, DateTime, Dir, VersionString), .last enddo