1 /*****************************************************************************/
5 /* Command line attributes */
9 /* (C) 2012, Ullrich von Bassewitz */
10 /* Roemerstrasse 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 /*****************************************************************************/
55 afInt, /* Integer number */
57 typedef enum AttrFlags AttrFlags;
60 typedef struct Attr Attr;
62 AttrFlags Flags; /* Attribute flags */
63 char* Name; /* Attribute name */
64 char Value[1]; /* Attribute value */
69 /*****************************************************************************/
71 /*****************************************************************************/
75 Attr* NewAttr (const char* Name, const char* Value);
76 /* Create a new attribute */
78 void DumpAttrColl (const Collection* C);
79 /* Dump a collection of attribute/value pairs for debugging */
81 int FindAttr (const Collection* C, const char* Name, unsigned* Index);
82 /* Search for an attribute with the given name in the collection. If it is
83 * found, the function returns true and Index contains the index of the
84 * entry. If Name isn't found, the function returns false and Index
85 * will contain the insert position.
88 void AddAttr (Collection* C, const char* Name, const char* Value);
89 /* Add an attribute to an alphabetically sorted attribute collection */
91 void SplitAddAttr (Collection* C, const char* Combined, const char* Name);
92 /* Split a combined name/value pair and add it as an attribute to C. Some
93 * attributes may not need a name. If the name is missing, use Name. If
94 * Name is NULL, terminate with an error.