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 | ␊ |
28 | enum xmltype␊ |
29 | {␊ |
30 | ␉kTagTypeNone = 0,␊ |
31 | ␉kTagTypeDict,␊ |
32 | ␉kTagTypeKey,␊ |
33 | ␉kTagTypeString,␊ |
34 | ␉kTagTypeInteger,␊ |
35 | ␉kTagTypeData,␊ |
36 | ␉kTagTypeDate,␊ |
37 | ␉kTagTypeFalse,␊ |
38 | ␉kTagTypeTrue,␊ |
39 | ␉kTagTypeArray␊ |
40 | };␊ |
41 | ␊ |
42 | struct string_ref␊ |
43 | {␊ |
44 | ␉char* string;␊ |
45 | ␉int id;␊ |
46 | ␉struct string_ref* next;␊ |
47 | };␊ |
48 | typedef struct string_ref string_ref;␊ |
49 | ␊ |
50 | extern string_ref* ref_strings;␊ |
51 | ␊ |
52 | #define kXMLTagPList "plist "␊ |
53 | #define kXMLTagDict "dict"␊ |
54 | #define kXMLTagKey "key"␊ |
55 | #define kXMLTagString "string"␊ |
56 | #define kXMLTagInteger "integer"␊ |
57 | #define kXMLTagData "data"␊ |
58 | #define kXMLTagDate "date"␊ |
59 | #define kXMLTagFalse "false/"␊ |
60 | #define kXMLTagTrue "true/"␊ |
61 | #define kXMLTagArray "array"␊ |
62 | // for back-references used by libkern serializer␊ |
63 | #define kXMLTagReference "reference"␊ |
64 | #define kXMLStringID "ID="␊ |
65 | #define kXMLStringIDRef "IDREF="␊ |
66 | ␊ |
67 | #define kPropCFBundleIdentifier ("CFBundleIdentifier")␊ |
68 | #define kPropCFBundleExecutable ("CFBundleExecutable")␊ |
69 | #define kPropOSBundleRequired ("OSBundleRequired")␊ |
70 | #define kPropOSBundleLibraries ("OSBundleLibraries")␊ |
71 | #define kPropIOKitPersonalities ("IOKitPersonalities")␊ |
72 | #define kPropIONameMatch ("IONameMatch")␊ |
73 | ␊ |
74 | /*␊ |
75 | struct Tag␊ |
76 | {␊ |
77 | ␉long type;␊ |
78 | ␉char *string;␊ |
79 | ␉struct Tag *tag;␊ |
80 | ␉struct Tag *tagNext;␊ |
81 | };␊ |
82 | typedef struct Tag Tag, *TagPtr;␊ |
83 | */␊ |
84 | ␊ |
85 | extern long gImageFirstBootXAddr;␊ |
86 | extern long gImageLastKernelAddr;␊ |
87 | ␊ |
88 | TagPtr XMLGetProperty( TagPtr dict, const char * key );␊ |
89 | TagPtr XMLGetElement( TagPtr dict, int id );␊ |
90 | TagPtr XMLGetKey( TagPtr dict, int id );␊ |
91 | TagPtr XMLGetValueForKey(TagPtr key);␊ |
92 | ␊ |
93 | int XMLTagCount( TagPtr dict );␊ |
94 | ␊ |
95 | bool XMLIsType(TagPtr dict, enum xmltype type);␊ |
96 | ␊ |
97 | bool XMLCastBoolean( TagPtr dict );␊ |
98 | char* XMLCastString( TagPtr dict );␊ |
99 | long XMLCastStringOffset(TagPtr dict);␊ |
100 | int XMLCastInteger ( TagPtr dict );␊ |
101 | TagPtr XMLCastDict ( TagPtr dict );␊ |
102 | TagPtr XMLCastArray( TagPtr dict );␊ |
103 | char* XMLCastData( TagPtr dict, int* length );␊ |
104 | ␊ |
105 | bool XMLIsBoolean(TagPtr entry);␊ |
106 | bool XMLIsString (TagPtr entry);␊ |
107 | bool XMLIsInteger(TagPtr entry);␊ |
108 | bool XMLIsDict (TagPtr entry);␊ |
109 | bool XMLIsArray (TagPtr entry);␊ |
110 | bool XMLIsData (TagPtr entry);␊ |
111 | ␊ |
112 | ␊ |
113 | bool XMLAddTagToDictionary(TagPtr dict, char* key, TagPtr value);␊ |
114 | ␊ |
115 | long XMLParseNextTag(char *buffer, TagPtr *tag);␊ |
116 | void XMLFreeTag(TagPtr tag);␊ |
117 | char* XMLDecode(const char *in);␊ |
118 | //==========================================================================␊ |
119 | // XMLParseFile␊ |
120 | // Expects to see one dictionary in the XML file.␊ |
121 | // Puts the first dictionary it finds in the␊ |
122 | // tag pointer and returns 0, or returns -1 if not found.␊ |
123 | //␊ |
124 | long XMLParseFile( char * buffer, TagPtr * dict );␊ |
125 | ␊ |
126 | //==========================================================================␊ |
127 | // ParseTag*␊ |
128 | long ParseTagBoolean( char * buffer, TagPtr * tag, long type );␊ |
129 | ␊ |
130 | ␊ |
131 | #endif /* __LIBSAIO_XML_H */␊ |
132 | |