summaryrefslogtreecommitdiff
path: root/sid/sidplay-libs-2.1.0/libsidutils/src/ini/ini.h
blob: bc622cbad7d719f10af5b6c96690c8da7f286377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/***************************************************************************
                          ini.h  -  Ini database definition

                             -------------------
    begin                : Fri Apr 21 2000
    copyright            : (C) 2000 by Simon White
    email                : s_a_white@email.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef _ini_h_
#define _ini_h_

#define INI_USE_HASH_TABLE

#include "libini.h"
#include "keys.h"
#include "headings.h"
#ifdef INI_ADD_LIST_SUPPORT
#   include "list.h"
#endif

typedef enum {INI_NEW, INI_EXIST, INI_READ} ini_mode_t;

// Database containing all information about an ini file.
typedef struct ini_t
{
    char      *filename;
    FILE      *ftmp;   // Temporary work file
    bool       changed;
    bool       newfile;
    ini_mode_t mode;   // Access mode

    struct section_tag *first;
    struct section_tag *last;
    struct section_tag *selected;
    char  *write; // Last written section.
    struct section_tag tmpSection;
    struct key_tag     tmpKey;

#ifdef INI_USE_HASH_TABLE
    struct section_tag *sections[256];
#endif

#ifdef INI_ADD_LIST_SUPPORT
    // Rev 1.1 Added - New for list accessing
    char        *list;         // Accelerator for accessing same list (When all list read, will be freed)
    char        *listDelims;   // list sperators
    char        *listIndexPtr; // current element we wish to access   (will auto increment)
    unsigned int listLength;
    unsigned int listIndex;
#endif // INI_ADD_LIST_SUPPORT
} ini_t;

static void                __ini_strtrim         (char *str);
#ifdef INI_USE_HASH_TABLE
static unsigned long       __ini_createCrc32     (char *pBuf, size_t length);
#endif

#endif // _ini_h_