3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define INI_FILE_COMMENT_CHAR ';'
27 // This structure describes a single .ini file item
28 // The item format in the .ini file is:
36 } INI_SECTION_ITEM
, *PINI_SECTION_ITEM
;
38 // This structure describes a .ini file section
39 // The section format in the .ini file is:
41 // This structure has a list of section items with
42 // one INI_SECTION_ITEM for each line in the section
47 ULONG SectionItemCount
;
48 PINI_SECTION_ITEM SectionItemList
;
50 } INI_SECTION
, *PINI_SECTION
;
52 extern PINI_SECTION IniFileSectionListHead
;
53 extern ULONG IniFileSectionCount
;
54 extern ULONG IniFileSettingCount
;
56 PFILE
IniOpenIniFile();
58 BOOL
IniParseFile(PCHAR IniFileData
, ULONG IniFileSize
);
59 ULONG
IniGetNextLineSize(PCHAR IniFileData
, ULONG IniFileSize
, ULONG CurrentOffset
);
60 ULONG
IniGetNextLine(PCHAR IniFileData
, ULONG IniFileSize
, PCHAR Buffer
, ULONG BufferSize
, ULONG CurrentOffset
);
61 BOOL
IniIsLineEmpty(PCHAR LineOfText
, ULONG TextLength
);
62 BOOL
IniIsCommentLine(PCHAR LineOfText
, ULONG TextLength
);
63 BOOL
IniIsSectionName(PCHAR LineOfText
, ULONG TextLength
);
64 ULONG
IniGetSectionNameSize(PCHAR SectionNameLine
, ULONG LineLength
);
65 VOID
IniExtractSectionName(PCHAR SectionName
, PCHAR SectionNameLine
, ULONG LineLength
);
66 BOOL
IniIsSetting(PCHAR LineOfText
, ULONG TextLength
);
67 ULONG
IniGetSettingNameSize(PCHAR SettingNameLine
, ULONG LineLength
);
68 ULONG
IniGetSettingValueSize(PCHAR SettingValueLine
, ULONG LineLength
);
69 VOID
IniExtractSettingName(PCHAR SettingName
, PCHAR SettingNameLine
, ULONG LineLength
);
70 VOID
IniExtractSettingValue(PCHAR SettingValue
, PCHAR SettingValueLine
, ULONG LineLength
);
72 BOOL
IniFileInitialize(VOID
);
74 BOOL
IniOpenSection(PCSTR SectionName
, ULONG
* SectionId
);
75 ULONG
IniGetNumSectionItems(ULONG SectionId
);
76 ULONG
IniGetSectionSettingNameSize(ULONG SectionId
, ULONG SettingIndex
);
77 ULONG
IniGetSectionSettingValueSize(ULONG SectionId
, ULONG SettingIndex
);
78 BOOL
IniReadSettingByNumber(ULONG SectionId
, ULONG SettingNumber
, PCHAR SettingName
, ULONG NameSize
, PCHAR SettingValue
, ULONG ValueSize
);
79 BOOL
IniReadSettingByName(ULONG SectionId
, PCSTR SettingName
, PCHAR Buffer
, ULONG BufferSize
);
80 BOOL
IniAddSection(PCSTR SectionName
, ULONG
* SectionId
);
81 BOOL
IniAddSettingValueToSection(ULONG SectionId
, PCSTR SettingName
, PCSTR SettingValue
);
84 #endif // defined __PARSEINI_H