home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xwphescr.zip / XWPH0208.ZIP / include / helpers / configsys.h < prev    next >
C/C++ Source or Header  |  2002-03-16  |  5KB  |  148 lines

  1.  
  2. /*
  3.  *@@sourcefile configsys.h:
  4.  *      header file for configsys.c. See notes there.
  5.  *
  6.  *      Note: Version numbering in this file relates to XWorkplace version
  7.  *            numbering.
  8.  *
  9.  *@@added V0.9.7 (2001-01-15) [umoeller]
  10.  *@@include #include <os2.h>
  11.  *@@include #include "helpers\xstring.h"            // for some funcs
  12.  *@@include #include "helpers\configsys.h"
  13.  */
  14.  
  15. /*
  16.  *      Copyright (C) 1997-2001 Ulrich Möller.
  17.  *      This file is part of the "XWorkplace helpers" source package.
  18.  *      This is free software; you can redistribute it and/or modify
  19.  *      it under the terms of the GNU General Public License as published
  20.  *      by the Free Software Foundation, in version 2 as it comes in the
  21.  *      "COPYING" file of the XWorkplace main distribution.
  22.  *      This program is distributed in the hope that it will be useful,
  23.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  24.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  25.  *      GNU General Public License for more details.
  26.  */
  27.  
  28. #if __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. #ifndef CONFIGSYS_HEADER_INCLUDED
  33.     #define CONFIGSYS_HEADER_INCLUDED
  34.  
  35.     typedef int CFGRPL;
  36.     #define CFGRPL_ADD            0
  37.     #define CFGRPL_UNIQUE         1
  38.     #define CFGRPL_ADDLEFT        2
  39.     #define CFGRPL_ADDRIGHT       3
  40.     #define CFGRPL_REMOVELINE     4
  41.     #define CFGRPL_REMOVEPART     5
  42.  
  43.     typedef int CFGVRT;
  44.     #define CFGVRT_BOTTOM         0
  45.     #define CFGVRT_TOP            1
  46.     #define CFGVRT_BEFORE         2
  47.     #define CFGVRT_AFTER          3
  48.  
  49.     /*
  50.      *@@ CONFIGMANIP:
  51.      *      describes a CONFIG.SYS manipulation.
  52.      */
  53.  
  54.     typedef struct _CONFIGMANIP
  55.     {
  56.         CFGRPL      iReplaceMode;   // this is an int, really
  57.                     // one of the following:
  58.                     // -- CFGRPL_ADD (0): just add line (default; iVertical applies).
  59.                     // -- CFGRPL_UNIQUE mode (1): existing line is replaced;
  60.                     //    if not found, iVertical applies.
  61.                     // -- CFGRPL_ADDLEFT mode (2): line is updated to the left;
  62.                     //    if not found, iVertical applies.
  63.                     // -- CFGRPL_ADDRIGHT mode (3): line is updated to the right;
  64.                     //    if not found, iVertical applies.
  65.                     // -- CFGRPL_REMOVELINE mode (4)
  66.                     // -- CFGRPL_REMOVEPART mode (5)
  67.  
  68.         PCSZ        pszUniqueSearchString2;
  69.                     // for UNIQUE(statement2):
  70.                     // the "statement2" to search for
  71.                     // V0.9.1 (2000-01-06) [umoeller]
  72.  
  73.         CFGVRT      iVertical;      // this is an int, really
  74.                     // 0: add to bottom (default)
  75.                     // 1: add to top
  76.                     // 2: add before pszSearchString
  77.                     // 3: add after pszSearchString
  78.         PCSZ        pszVerticalSearchString;
  79.                     // for iVertical == 2 or 3
  80.  
  81.         PCSZ        pszNewLine;
  82.                     // this is a copy of stuff before the "|" char
  83.                     // in pszConfigSys given to the constructor
  84.     } CONFIGMANIP, *PCONFIGMANIP;
  85.  
  86.     // error codes
  87.     #define CFGERR_FIRST                35000
  88.     #define CFGERR_NOSEPARATOR          (CFGERR_FIRST + 1)
  89.     #define CFGERR_MANIPULATING         (CFGERR_FIRST + 2)
  90.  
  91.     APIRET csysLoadConfigSys(const char *pcszFile,
  92.                              PSZ *ppszContents);
  93.  
  94.     APIRET csysWriteConfigSys(const char *pcszFile,
  95.                               const char *pcszContents,
  96.                               PSZ pszBackup);
  97.  
  98.     PSZ csysFindKey(const char *pcszSearchIn,
  99.                     const char *pcszKey,
  100.                     PSZ *ppStartOfLine,
  101.                     PBOOL pfIsAllUpperCase);
  102.  
  103.     PSZ csysGetParameter(const char *pcszSearchIn,
  104.                          const char *pcszKey,
  105.                          PSZ pszCopyTo,
  106.                          ULONG cbCopyTo);
  107.  
  108.     PSZ csysSetParameter(PSZ* ppszBuf,
  109.                          const char *pcszKey,
  110.                          const char *pcszNewParam,
  111.                          BOOL fRespectCase);
  112.  
  113.     BOOL csysDeleteLine(PSZ pszSearchIn, PSZ pszKey);
  114.  
  115.     #ifdef XSTRING_HEADER_INCLUDED
  116.         APIRET csysManipulate(PSZ *ppszContents,
  117.                               PCONFIGMANIP pManip,
  118.                               PBOOL pfDirty,
  119.                               PXSTRING pstrChanged);
  120.     #endif
  121.  
  122.     /* ******************************************************************
  123.      *
  124.      *   Swappath
  125.      *
  126.      ********************************************************************/
  127.  
  128.     BOOL XWPENTRY csysParseSwapPath(const char *pcszConfigSys,
  129.                                     PSZ pszSwapPath,
  130.                                     PULONG pulMinFree,
  131.                                     PULONG pulMinSize);
  132.     typedef BOOL XWPENTRY CSYSPARSESWAPPATH(const char *pcszConfigSys,
  133.                                             PSZ pszSwapPath,
  134.                                             PULONG pulMinFree,
  135.                                             PULONG pulMinSize);
  136.     typedef CSYSPARSESWAPPATH *PCSYSPARSESWAPPATH;
  137.  
  138.     ULONG XWPENTRY csysQuerySwapperSize(VOID);
  139.     typedef ULONG XWPENTRY CSYSQUERYSWAPPERSIZE(VOID);
  140.     typedef CSYSQUERYSWAPPERSIZE *PCSYSQUERYSWAPPERSIZE;
  141.  
  142. #endif
  143.  
  144. #if __cplusplus
  145. }
  146. #endif
  147.  
  148.