home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR13 / INIFIL.ZIP / INIFILE.H < prev   
C/C++ Source or Header  |  1993-10-13  |  4KB  |  141 lines

  1. /*
  2.     Copyright (c) 1993, George Byrkit,
  3.                 Software Professionals Limited
  4.                 1809 Saxon Street
  5.                 Ann Arbor, MI 48103
  6.                 (313)-663-1009
  7.  
  8.                 ALL RIGHTS RESERVED
  9.  
  10.     THIS FILE MAY BE INCLUDED ROYALTY-FREE in any program as long as the
  11.     above copyright notice also appears in the text of the program executable.
  12.  
  13.     filename:    inifile.h
  14.  
  15.     purpose:    emulate windows API functions to access the ini files
  16.  
  17.     These functions are extracted from windows.h
  18.  
  19.     instructions for building:
  20.         compile:
  21.         link:
  22.         other:
  23.  
  24.     change log:
  25.     When        Version    Who        Why
  26.     01-jan-93    1.0        ghb        created
  27. */
  28.  
  29. #ifndef    INIFILE_H
  30. #define    INIFILE_H
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {            /* Assume C declarations for C++ */
  34. #endif  /* __cplusplus */
  35.  
  36. /******* Common definitions and typedefs ***********************************/
  37.  
  38. #define VOID                void
  39.  
  40. #define FAR                 _far
  41. #define NEAR                _near
  42. #define PASCAL              _pascal
  43. #define CDECL               _cdecl
  44.  
  45. #define WINAPI              _far _pascal
  46. #define CALLBACK            _far _pascal
  47.  
  48. /****** Simple types & common helper macros *********************************/
  49.  
  50. typedef int                 BOOL;
  51. #define FALSE               0
  52. #define TRUE                1
  53.  
  54. typedef unsigned char       BYTE;
  55. typedef unsigned short      WORD;
  56. typedef unsigned long       DWORD;
  57.  
  58. typedef unsigned int        UINT;
  59.  
  60. #ifdef STRICT
  61. typedef signed long         LONG;
  62. #else
  63. #define LONG long
  64. #endif
  65.  
  66. #define LOBYTE(w)           ((BYTE)(w))
  67. #define HIBYTE(w)           ((BYTE)((UINT)(w) >> 8))
  68.  
  69. #define LOWORD(l)           ((WORD)(l))
  70. #define HIWORD(l)           ((WORD)((DWORD)(l) >> 16))
  71.  
  72. #define MAKELONG(low, high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
  73.  
  74. #if !defined(NOMINMAX) && !defined(__cplusplus)
  75. #ifndef max
  76. #define max(a,b)            (((a) > (b)) ? (a) : (b))
  77. #endif
  78. #ifndef min
  79. #define min(a,b)            (((a) < (b)) ? (a) : (b))
  80. #endif
  81. #endif  /* NOMINMAX */
  82.  
  83. /* Types use for passing & returning polymorphic values */
  84. typedef UINT WPARAM;
  85. typedef LONG LPARAM;
  86. typedef LONG LRESULT;
  87.  
  88. #define MAKELPARAM(low, high)   ((LPARAM)MAKELONG(low, high))
  89. #define MAKELRESULT(low, high)  ((LRESULT)MAKELONG(low, high))
  90.  
  91. /****** Common pointer types ************************************************/
  92.  
  93. #ifndef NULL
  94. #define NULL                0
  95. #endif
  96.  
  97. typedef char NEAR*          PSTR;
  98. typedef char NEAR*          NPSTR;
  99.  
  100.  
  101. typedef char FAR*           LPSTR;
  102. typedef const char FAR*     LPCSTR;
  103.  
  104. typedef BYTE NEAR*          PBYTE;
  105. typedef BYTE FAR*           LPBYTE;
  106.  
  107. typedef int NEAR*           PINT;
  108. typedef int FAR*            LPINT;
  109.  
  110. typedef WORD NEAR*          PWORD;
  111. typedef WORD FAR*           LPWORD;
  112.  
  113. typedef long NEAR*          PLONG;
  114. typedef long FAR*           LPLONG;
  115.  
  116. typedef DWORD NEAR*         PDWORD;
  117. typedef DWORD FAR*          LPDWORD;
  118.  
  119. typedef void FAR*           LPVOID;
  120.  
  121. #define MAKELP(sel, off)    ((void FAR*)MAKELONG((off), (sel)))
  122. #define SELECTOROF(lp)      HIWORD(lp)
  123. #define OFFSETOF(lp)        LOWORD(lp)
  124.  
  125. #define FIELDOFFSET(type, field)    ((int)(&((type NEAR*)1)->field)-1)
  126.  
  127. /* User Profile Routines */
  128. UINT    WINAPI GetProfileInt(LPCSTR, LPCSTR, int);
  129. int     WINAPI GetProfileString(LPCSTR, LPCSTR, LPCSTR, LPSTR, int);
  130. BOOL    WINAPI WriteProfileString(LPCSTR, LPCSTR, LPCSTR);
  131.  
  132. UINT    WINAPI GetPrivateProfileInt(LPCSTR, LPCSTR, int, LPCSTR);
  133. int     WINAPI GetPrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPSTR, int, LPCSTR);
  134. BOOL    WINAPI WritePrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
  135.  
  136. #ifdef __cplusplus
  137. }                       /* End of extern "C" { */
  138. #endif    /* __cplusplus */
  139.  
  140. #endif    // inifile.h
  141.