FDOSTUI
FreeDOS Text User Interface
ini.h
Go to the documentation of this file.
1 /*
2  INI.H
3 
4  License CC0 PUBLIC DOMAIN
5 
6  To the extent possible under law, Mark J. Olesen has waived all copyright
7  and related or neighboring rights to FDOSTUI Library. This work is published
8  from: United States.
9 */
10 #ifndef __ini_h__
11 
12 #include "hash.h"
13 
14 #define INI_KEY_MAX_LEN 128
15 #define INI_VALUE_MAX_LEN 4096
16 #define INI_SECTION_BUCKETS 100
17 #define INI_TUPLE_BUCKETS 50
18 
20 {
22 };
23 
24 struct ini_tuple
25 {
26  char * m_name;
27  char * m_value;
28 };
29 
31 {
32  char * m_name;
33  struct hash m_hash;
34 };
35 
36 struct ini
37 {
38  struct hash m_hash;
39 };
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 extern int
47  struct ini*const o_ini);
48 
49 extern void
51  struct ini*const io_ini);
52 
53 extern char const *
55  int*const o_found,
56  struct ini *const i_ini,
57  char const * i_section,
58  char const * i_key);
59 
60 extern int
61 ini_parse(
62  struct ini*const io_ini,
63  char const* i_path,
64  enum ini_options const i_options);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #define __ini_h__
71 #endif
int ini_parse(struct ini *const io_ini, char const *i_path, enum ini_options const i_options)
read an INI file
Definition: ini.c:548
char * m_name
Definition: ini.h:26
struct hash m_hash
Definition: ini.h:38
A hash table, which maps keys to values.
char * m_value
Definition: ini.h:27
holds key/value pair data
Definition: ini.h:24
container to hold sections
Definition: ini.h:36
container to hold data for a section
Definition: ini.h:30
char const * ini_lookup(int *const o_found, struct ini *const i_ini, char const *i_section, char const *i_key)
lookup a value
Definition: ini.c:516
void ini_discharge(struct ini *const io_ini)
release resources held by the object
Definition: ini.c:505
Definition: ini.h:21
char * m_name
Definition: ini.h:32
struct hash m_hash
Definition: ini.h:33
ini_options
place holder for future parsing options
Definition: ini.h:19
hash data structure that holds keys and values
Definition: hash.h:29
int ini_assign(struct ini *const o_ini)
initialize ini object
Definition: ini.c:489