1 | /****************************************************************************
|
---|
2 | *
|
---|
3 | * File : profile.h
|
---|
4 | * Date Created : 11/24/94
|
---|
5 | * Description : header file for .ini file management
|
---|
6 | *
|
---|
7 | * Programmer(s) : Nick Skrepetos
|
---|
8 | * Last Modification : 11/25/94 - 11:14:58 PM
|
---|
9 | * Additional Notes :
|
---|
10 | *
|
---|
11 | *****************************************************************************
|
---|
12 | * Copyright (c) 1993-95, HMI, Inc. All Rights Reserved *
|
---|
13 | ****************************************************************************/
|
---|
14 |
|
---|
15 | #ifndef _HMI_INI_MANAGER
|
---|
16 | #define _HMI_INI_MANAGER
|
---|
17 |
|
---|
18 | // profile structure
|
---|
19 | typedef struct _tagINIInstance
|
---|
20 | {
|
---|
21 |
|
---|
22 | W32 wFlags; // misc. flags
|
---|
23 | BYTE szName[ 128 ]; // name of .ini file
|
---|
24 |
|
---|
25 | PSTR pData; // pointer to .ini file in memory
|
---|
26 | W32 wSize; // size, in bytes, of file
|
---|
27 | W32 wMaxSize; // maximum size in bytes of the .ini
|
---|
28 |
|
---|
29 | PSTR pCurrent; // current location in file
|
---|
30 | W32 wCurrent; // current location in file
|
---|
31 |
|
---|
32 | PSTR pSection; // pointer to section start
|
---|
33 |
|
---|
34 | PSTR pItemPtr; // pointer to the start of line w/item
|
---|
35 | PSTR pItem; // pointer to last item
|
---|
36 | PSTR pList; // pointer to last item location, for list
|
---|
37 | // management.
|
---|
38 | PSTR pListPtr; // pointer for raw string list
|
---|
39 |
|
---|
40 | } _INI_INSTANCE;
|
---|
41 |
|
---|
42 | // equates
|
---|
43 | #define _INI_SECTION_START '['
|
---|
44 | #define _INI_SECTION_END ']'
|
---|
45 | #define _INI_EQUATE '='
|
---|
46 | #define _INI_SPACE ' '
|
---|
47 | #define _INI_TAB 0x9
|
---|
48 | #define _INI_STRING_START '"'
|
---|
49 | #define _INI_STRING_END '"'
|
---|
50 | #define _INI_EOL 0x0d
|
---|
51 | #define _INI_CR 0x0d
|
---|
52 | #define _INI_LF 0x0a
|
---|
53 | #define _INI_HEX_INDICATOR 'x'
|
---|
54 | #define _INI_LIST_SEPERATOR ','
|
---|
55 |
|
---|
56 | // amount of bytes to allocate in addition to file size so that the
|
---|
57 | // .ini file may be modified by the application.
|
---|
58 | #define _INI_EXTRA_MEMORY 1024
|
---|
59 |
|
---|
60 | // various flags for .ini structure
|
---|
61 | #define _INI_MODIFIED 0x8000
|
---|
62 |
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | // function prototypes
|
---|
66 | BOOL cdecl hmiINIOpen ( _INI_INSTANCE * sInstance, char *szName );
|
---|
67 | BOOL cdecl hmiINIClose ( _INI_INSTANCE * sInstance );
|
---|
68 | BOOL cdecl hmiINILocateSection ( _INI_INSTANCE * sInstance, PSTR szName );
|
---|
69 | BOOL cdecl hmiINILocateItem ( _INI_INSTANCE * sInstance, PSTR szItem );
|
---|
70 | BOOL cdecl hmiINIGetDecimal ( _INI_INSTANCE * sInstance, W32 * wValue );
|
---|
71 | BOOL cdecl hmiINIGetString ( _INI_INSTANCE * sInstance, PSTR pString, W32 wMaxLength );
|
---|
72 | BOOL cdecl hmiINIGetQuery ( _INI_INSTANCE * sInstance, PSTR szItem );
|
---|
73 | BOOL cdecl hmiINIWriteDecimal ( _INI_INSTANCE * sInstance, W32 wValue );
|
---|
74 | BOOL cdecl hmiINIWriteString ( _INI_INSTANCE * sInstance, PSTR szString );
|
---|
75 | BOOL cdecl hmiINIWriteQuery ( _INI_INSTANCE * sInstance, PSTR szItem, BOOL wState );
|
---|
76 | BOOL cdecl hmiINIDeleteItem ( _INI_INSTANCE * sInstance, PSTR szItem );
|
---|
77 | BOOL cdecl hmiINIDeleteSection ( _INI_INSTANCE * sInstance, PSTR szSection );
|
---|
78 | BOOL cdecl hmiINIGetRawString ( _INI_INSTANCE * sInstance, PSTR pString, W32 wMaxLength );
|
---|
79 | BOOL cdecl hmiINIAddSection ( _INI_INSTANCE * sInstance, PSTR szSection );
|
---|
80 | BOOL cdecl hmiINIAddItemString ( _INI_INSTANCE * sInstance, PSTR szItem, PSTR szString, W32 wJustify );
|
---|
81 | BOOL cdecl hmiINIGetItemDecimal ( _INI_INSTANCE * sInstance, PSTR szItem, W32 * wValue );
|
---|
82 | BOOL cdecl hmiINIGetItemString ( _INI_INSTANCE * sInstance,
|
---|
83 | PSTR szItem,
|
---|
84 | PSTR pString,
|
---|
85 | W32 wMaxSize );
|
---|
86 | BOOL cdecl hmiINIAddItemDecimal ( _INI_INSTANCE * sInstance,
|
---|
87 | PSTR szItem,
|
---|
88 | W32 wValue,
|
---|
89 | W32 wJustify,
|
---|
90 | W32 wRadix );
|
---|
91 |
|
---|