Adapt the remaining plugins to put the greyscale isr on cop. Now they can be used...
[Rockbox.git] / apps / plugins / lib / configfile.h
blob7aa69f3ecfeca87e4fd0cb610a71380a209521c2
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Linus Nielsen Feltzing
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #ifndef CONFIGFILE_H
20 #define CONFIGFILE_H
22 #define TYPE_INT 1
23 #define TYPE_ENUM 2
24 #define TYPE_STRING 3
26 struct configdata
28 int type; /* See TYPE_ macros above */
29 int min; /* Min value for integers, should be 0 for enums */
30 int max; /* Max value for enums and integers,
31 buffer size for strings */
32 int *val; /* Pointer to integer/enum value,
33 NULL if the item is a string */
34 char *name; /* Pointer to the name of the item */
35 char **values; /* List of strings for enums, NULL if not enum */
36 char *string; /* Pointer to a string buffer if the item is a string,
37 NULL otherwise */
40 void configfile_init(struct plugin_api* newrb);
42 /* configfile_save - Given configdata entries this function will
43 create a config file with these entries, destroying any
44 previous config file of the same name */
45 int configfile_save(const char *filename, struct configdata *cfg,
46 int num_items, int version);
48 int configfile_load(const char *filename, struct configdata *cfg,
49 int num_items, int min_version);
51 /* configfile_get_value - Given a key name, this function will
52 return the integer value for that key.
54 Input:
55 filename = config file filename
56 name = (name/value) pair name entry
57 Return:
58 value if (name/value) pair is found
59 -1 if entry is not found
61 int configfile_get_value(const char* filename, const char* name);
63 /* configure_update_entry - Given a key name and integer value
64 this function will update the entry if found, or add it if
65 not found.
67 Input:
68 filename = config file filename
69 name = (name/value) pair name entry
70 val = new value for (name/value) pair
71 Return:
72 1 if the (name/value) pair was found and updated with the new value
73 0 if the (name/value) pair was added as a new entry
74 -1 if error
76 int configfile_update_entry(const char* filename, const char* name, int val);
78 #endif