1 /*****************************************************************************/
5 /* Config data structure */
9 /* (C) 2002-2003 Ullrich von Bassewitz */
10 /* Römerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
46 /*****************************************************************************/
48 /*****************************************************************************/
52 typedef struct CfgData CfgData;
59 } Type; /* Type of the value */
61 char* SVal; /* String or id value */
62 long IVal; /* Integer value */
64 unsigned Line; /* Line where the attribute was defined */
65 unsigned Col; /* Column of attribute definition */
66 char Attr[1]; /* The attribute name */
71 /*****************************************************************************/
73 /*****************************************************************************/
77 CfgData* NewCfgData (void);
78 /* Create and intialize a new CfgData struct, then return it. The function
79 * uses the current output of the config scanner.
82 void FreeCfgData (CfgData* D);
83 /* Free a config data structure */
85 void CfgDataCheckType (const CfgData* D, unsigned Type);
86 /* Check the config data type and print an error message if it has the wrong
90 int CfgDataFind (const Collection* Attributes, const char* AttrName);
91 /* Find the attribute with the given name and return its index. Return -1 if
92 * the attribute was not found.
95 int CfgDataGetId (Collection* Attributes, const char* Name, char** Id);
96 /* Search CfgInfo for an attribute with the given name and type "id". If
97 * found, remove it from the configuration, copy it into Buf and return
98 * true. If not found, return false.
101 int CfgDataGetStr (Collection* Attributes, const char* Name, char** S);
102 /* Search CfgInfo for an attribute with the given name and type "string".
103 * If found, remove it from the configuration, copy it into Buf and return
104 * true. If not found, return false.
107 int CfgDataGetNum (Collection* Attributes, const char* Name, long* Val);
108 /* Search CfgInfo for an attribute with the given name and type "number".
109 * If found, remove it from the configuration, copy it into Val and return
110 * true. If not found, return false.
115 /* End of cfgdata.h */