/****************************** Module Header ******************************* * * Module Name: importuserconfig.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. * ****************************************************************************/ /* @@NepmdImportUserConfig@PROTOTYPE NepmdImportUserConfig( Handle, UserConfigFilename) @@NepmdImportUserConfig@CATEGORY@CONFIG @@NepmdImportUserConfig@SYNTAX .ttchar ~ This function imports user settings from a text config file into the configuration repository of the [=TITLE] installation. Note that a config file with a default path and name will be automatically imported by [.IDPNL_EFUNC_NEPMINITCONFIG], if it exists and if its date, time or size has changed. That filename is ~user.cfg~ in the user's ~bin~ directory, which is usually ~NEPMD\myepm\bin~. Also the file with the default settings ~defaults.cfg~ is automatically imported, if it has changed. Other files have to be imported by this function. @@NepmdImportUserConfig@PARM@Handle This parameter determines the handle obtained by a previous call to [.IDPNL_EFUNC_NEPMDOPENCONFIG]. Use *-3* or *HINI__NEPMDPROFILE* to automatically insert the value of the universal var *nepmd__hini*. That's the handle returned by the initial opening of NEPMD.INI. You may pass an *empty string* or *-9* to [.IDPNL_REGISTRY_IMPLICITOPEN implicitely open and close] the configuration repository before and after this call. @@NepmdImportUserConfig@PARM@UserConfigFilename This parameter specifies the filename of the text configuration file. @@NepmdImportUserConfig@RETURNS *NepmdImportUserConfig* 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. rc is set to 232 (ERROR__NO__DATA), if no import is required. That is the case, if the default filename ~user.cfg~ is specified and if its date, time or size hasn't changed since the last import. @@NepmdImportUserConfig@TESTCASE You can test this function from the *EPM* commandline by executing: .sl - *NepmdImportUserConfig* [.IDPNL_EFUNC_NEPMDIMPORTUSERCONFIG_PARM_UserConfigFilename UserConfigFilename] - or - *NepmdSelectUserConfig* @@ */ ; --------------------------------------------------------------------------- ; Allow editor command to call function ; --------------------------------------------------------------------------- compile if NEPMD_LIB_TEST defc NepmdImportUserConfig UserConfigFile = arg( 1) call NepmdImportUserConfig( '', UserConfigFile) if rc then sayerror 'Configuration file "'UserConfigFile'" could not be imported, rc = 'rc'.' else sayerror 'Configuration file "'UserConfigFile'" imported successfully.' endif defc NepmdSelectUserConfig Title = 'Select a user configuration file to import' Cmd = 'NepmdImportUserConfig' FileMask = Get_Env( 'NEPMD_USERDIR')'\bin\*.cfg' 'FileDlg' Title', 'Cmd', 'FileMask compile endif ; --------------------------------------------------------------------------- ; Procedure: NepmdImportUserConfig ; --------------------------------------------------------------------------- ; E syntax: ; NepmdImportUserConfig( Handle, UserConfigFile) ; --------------------------------------------------------------------------- ; C prototype: ; APIRET EXPENTRY NepmdImportUserConfig( HCONFIG hconfig, PSZ pszUserFilename); ; --------------------------------------------------------------------------- defproc NepmdImportUserConfig( Handle, UserConfigFile) -- For -3, use the handle returned by the initial OpenConfig of NEPMD.INI. if Handle = HINI_NEPMDPROFILE then Handle = helperNepmdGetConfigHandle() elseif Handle = '' then Handle = -9 endif -- Prepare parameters for C routine UserConfigFile = UserConfigFile\0 -- Call C routine LibFile = helperNepmdGetlibfile() rc = dynalink32( LibFile, "NepmdImportUserConfig", atol( Handle) || address( UserConfigFile)) helperNepmdCheckliberror( LibFile, rc) return