Chameleon

Chameleon Svn Source Tree

Root/branches/chucko/i386/libsaio/xml.h

1/*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Portions Copyright (c) 2003 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 2.0 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
12 * this file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License.
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24
25#ifndef __LIBSAIO_XML_H
26#define __LIBSAIO_XML_H
27
28enum xmltype {
29kTagTypeNone = 0,
30kTagTypeDict,
31kTagTypeKey,
32kTagTypeString,
33kTagTypeInteger,
34kTagTypeData,
35kTagTypeDate,
36kTagTypeFalse,
37kTagTypeTrue,
38kTagTypeArray
39};
40
41struct string_ref
42{
43char* string;
44int id;
45struct string_ref* next;
46};
47typedef struct string_ref string_ref;
48
49extern string_ref* ref_strings;
50
51#define kPropCFBundleIdentifier ("CFBundleIdentifier")
52#define kPropCFBundleExecutable ("CFBundleExecutable")
53#define kPropOSBundleRequired ("OSBundleRequired")
54#define kPropOSBundleLibraries ("OSBundleLibraries")
55#define kPropIOKitPersonalities ("IOKitPersonalities")
56#define kPropIONameMatch ("IONameMatch")
57
58/*
59struct Tag {
60long type;
61char *string;
62struct Tag *tag;
63struct Tag *tagNext;
64};
65typedef struct Tag Tag, *TagPtr;
66 */
67
68extern long gImageFirstBootXAddr;
69extern long gImageLastKernelAddr;
70
71TagPtr XMLGetProperty( TagPtr dict, const char * key );
72TagPtr XMLGetElement( TagPtr dict, int id );
73TagPtr XMLGetKey( TagPtr dict, int id );
74TagPtr XMLGetValueForKey(TagPtr key);
75
76int XMLTagCount( TagPtr dict );
77
78bool XMLIsType(TagPtr dict, enum xmltype type);
79
80bool XMLCastBoolean( TagPtr dict );
81char* XMLCastString( TagPtr dict );
82long XMLCastStringOffset(TagPtr dict);
83int XMLCastInteger ( TagPtr dict );
84TagPtr XMLCastDict ( TagPtr dict );
85TagPtr XMLCastArray( TagPtr dict );
86char* XMLCastData( TagPtr dict, int* length );
87
88bool XMLIsBoolean(TagPtr entry);
89bool XMLIsString (TagPtr entry);
90bool XMLIsInteger(TagPtr entry);
91bool XMLIsDict (TagPtr entry);
92bool XMLIsArray (TagPtr entry);
93bool XMLIsData (TagPtr entry);
94
95
96bool XMLAddTagToDictionary(TagPtr dict, char* key, TagPtr value);
97
98long XMLParseNextTag(char *buffer, TagPtr *tag);
99void XMLFreeTag(TagPtr tag);
100char* XMLDecode(const char *in);
101//==========================================================================
102// XMLParseFile
103// Expects to see one dictionary in the XML file.
104// Puts the first dictionary it finds in the
105// tag pointer and returns 0, or returns -1 if not found.
106//
107long XMLParseFile( char * buffer, TagPtr * dict );
108
109//==========================================================================
110// ParseTag*
111long ParseTagBoolean( char * buffer, TagPtr * tag, long type );
112
113
114#endif /* __LIBSAIO_XML_H */
115

Archive Download this file

Revision: HEAD