Added More Comments and started doing data type checking so that if a ModuleName...
[mirror_edk2.git] / Tools / XMLSchema / NamingConvention.xsd
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.TianoCore.org/2006/Edk2.0" xmlns="http://www.TianoCore.org/2006/Edk2.0">
3 <!--
4 Filename: NamingConvention.xsd
5
6 Copyright (c) 2006, Intel Corp.
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which may be found at http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 -->
15 <xs:annotation>
16 <xs:documentation xml:lang="en"> This schema defines various data types and naming conventions including: base name, filename and directory naming conventions. These are all simple data types.</xs:documentation>
17 </xs:annotation>
18 <xs:simpleType name="BaseNameConvention">
19 <xs:annotation>
20 <xs:documentation xml:lang="en"> Base Names must start with an upper case character, followed by one or more alphanumeric characters and/or an optional underscore (_) character followed by one or more alphanumeric characters. Examples: Base_name3, BASE_NAME3, BaseName3 </xs:documentation>
21 </xs:annotation>
22 <xs:restriction base="xs:string">
23 <xs:pattern value="[A-Z]([a-zA-Z0-9])*(_)?([a-zA-Z0-9])*"/>
24 </xs:restriction>
25 </xs:simpleType>
26 <xs:simpleType name="C_Name">
27 <xs:annotation>
28 <xs:documentation xml:lang="en"> C_Names must start with either an underscore (_) character followed by one or more alpha characters, followed by any combination of underscore or alphanumeric characters.</xs:documentation>
29 </xs:annotation>
30 <xs:restriction base="xs:string">
31 <xs:pattern value="((_)*([a-zA-Z])+((_)*[a-zA-Z0-9]*))*"/>
32 </xs:restriction>
33 </xs:simpleType>
34 <xs:simpleType name="DirectoryNamingConvention">
35 <xs:annotation>
36 <xs:documentation xml:lang="en"> Directory naming convention is a UNION of DOS an UNIX directory path names </xs:documentation>
37 </xs:annotation>
38 <xs:union memberTypes="Directory_DOS Directory_UNIX"/>
39 </xs:simpleType>
40 <xs:simpleType name="Directory_DOS">
41 <xs:annotation>
42 <xs:documentation xml:lang="en"> Directory naming convention for Windows backslash (\) directory path name </xs:documentation>
43 </xs:annotation>
44 <xs:restriction base="xs:string">
45 <xs:pattern value="([a-zA-Z]:\\)?(((\\?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\)?)*"/>
46 </xs:restriction>
47 </xs:simpleType>
48 <xs:simpleType name="Directory_UNIX">
49 <xs:annotation>
50 <xs:documentation xml:lang="en"> Directory naming convention for UNIX forwardslash (/) directory path name </xs:documentation>
51 </xs:annotation>
52 <xs:restriction base="xs:string">
53 <xs:pattern value="(\/)?(((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\/)?)*"/>
54 </xs:restriction>
55 </xs:simpleType>
56 <xs:simpleType name="E-Mail">
57 <xs:restriction base="xs:string">
58 <xs:pattern value="[a-zA-Z]+(( )*.?-?[a-zA-Z]*)*@[a-zA-Z]+(( )*.?-?[a-zA-Z]*)*"/>
59 </xs:restriction>
60 </xs:simpleType>
61 <xs:simpleType name="FileNameConvention">
62 <xs:annotation>
63 <xs:documentation xml:lang="en"> This defines what a Filename is: Alphanumeric characters and optional underscore (_) or dash (-) characters, followed by a optional dot and more alphanumeric characters. </xs:documentation>
64 </xs:annotation>
65 <xs:restriction base="xs:string">
66 <xs:pattern value="[a-zA-Z][a-zA-Z0-9]*((_)*(-)*(.)*[a-zA-Z0-9]*)*"/>
67 </xs:restriction>
68 </xs:simpleType>
69 <xs:simpleType name="GuidArrayType">
70 <xs:annotation>
71 <xs:documentation xml:lang="en"> This defines the minimum specification for a GUID Array which is 8 Hex Digits - 4 Hex Digits - 4 Hex Digits - 8 Hex Bytes, the last 16 Hex Digits can be enclosed in sqiggle {} brackets.</xs:documentation>
72 </xs:annotation>
73 <xs:restriction base="xs:string">
74 <xs:pattern value="0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\})?"/>
75 </xs:restriction>
76 </xs:simpleType>
77 <xs:simpleType name="GuidNamingConvention">
78 <xs:annotation>
79 <xs:documentation xml:lang="en"> A GUID must contain five different Hexadecimal character sets that are separated by a dash (-) character. </xs:documentation>
80 </xs:annotation>
81 <xs:restriction base="xs:string">
82 <xs:pattern value="[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"/>
83 </xs:restriction>
84 </xs:simpleType>
85 <xs:simpleType name="GuidType">
86 <xs:annotation>
87 <xs:documentation xml:lang="en"> The GUID data is union of GuidNaming Convetion and GuidArrayType. </xs:documentation>
88 </xs:annotation>
89 <xs:union memberTypes="GuidArrayType GuidNamingConvention"/>
90 </xs:simpleType>
91 <xs:simpleType name="Hex64BitDataType">
92 <xs:annotation>
93 <xs:documentation xml:lang="en">Define a Hex 64 Bit Value to be 0x[a-f0-9]{16}</xs:documentation>
94 </xs:annotation>
95 <xs:restriction base="xs:string">
96 <xs:pattern value="(0x)?[a-fA-F0-9]{1,16}"/>
97 </xs:restriction>
98 </xs:simpleType>
99 <xs:simpleType name="HexAddressType">
100 <xs:annotation>
101 <xs:documentation xml:lang="en">Define a Hex Address, 0x[a-fA-F0-9]{1,16}</xs:documentation>
102 </xs:annotation>
103 <xs:restriction base="xs:string">
104 <xs:pattern value="0x[a-fA-F0-9]{1,16}"/>
105 </xs:restriction>
106 </xs:simpleType>
107 <xs:simpleType name="HexByteDataType">
108 <xs:annotation>
109 <xs:documentation xml:lang="en">Define a Hex Byte Value to be 0x[a-f0-9]{2}</xs:documentation>
110 </xs:annotation>
111 <xs:restriction base="xs:string">
112 <xs:pattern value="(0x)?[a-fA-F0-9]{1,2}"/>
113 </xs:restriction>
114 </xs:simpleType>
115 <xs:simpleType name="HexDataType">
116 <xs:annotation>
117 <xs:documentation xml:lang="en">Define a Hex Value to be 0x[a-f0-9]+</xs:documentation>
118 </xs:annotation>
119 <xs:restriction base="xs:string">
120 <xs:pattern value="0x[a-fA-F0-9]+"/>
121 </xs:restriction>
122 </xs:simpleType>
123 <xs:simpleType name="HexDigitType">
124 <xs:annotation>
125 <xs:documentation xml:lang="en">Define a Hex Diget to be 0x[a-f0-9]</xs:documentation>
126 </xs:annotation>
127 <xs:restriction base="xs:string">
128 <xs:pattern value="[a-fA-F0-9]{1}"/>
129 </xs:restriction>
130 </xs:simpleType>
131 <xs:simpleType name="HexDoubleWordDataType">
132 <xs:annotation>
133 <xs:documentation xml:lang="en">Define a Hex Double Word Value to be 0x[a-f0-9]{8}</xs:documentation>
134 </xs:annotation>
135 <xs:restriction base="xs:string">
136 <xs:pattern value="0x[a-fA-F0-9]{1,8}"/>
137 </xs:restriction>
138 </xs:simpleType>
139 <xs:simpleType name="HexWordDataType">
140 <xs:annotation>
141 <xs:documentation xml:lang="en">Define a Hex Word Value to be 0x[a-f0-9]{4}</xs:documentation>
142 </xs:annotation>
143 <xs:restriction base="xs:string">
144 <xs:pattern value="0x[a-fA-F0-9]{1,4}"/>
145 </xs:restriction>
146 </xs:simpleType>
147 <xs:simpleType name="LibraryNameConvention">
148 <xs:annotation>
149 <xs:documentation xml:lang="en"> This defines what a Library name is: alphanumeric characters and optional underscore (_) characters. </xs:documentation>
150 </xs:annotation>
151 <xs:restriction base="xs:string">
152 <xs:pattern value="[A-Z][a-zA-Z0-9]*(_*[a-zA-Z0-9])*"/>
153 </xs:restriction>
154 </xs:simpleType>
155 <xs:simpleType name="NameConvention">
156 <xs:annotation>
157 <xs:documentation xml:lang="en">What is a name, any series of alphanumeric characters and one or more underline characters that may occur in any position</xs:documentation>
158 </xs:annotation>
159 <xs:restriction base="xs:normalizedString">
160 <xs:pattern value="(_*[a-zA-Z0-9]*_*)+"/>
161 </xs:restriction>
162 </xs:simpleType>
163 <xs:simpleType name="Paragraph">
164 <xs:annotation>
165 <xs:documentation xml:lang="en">This describes the normal text of a paragraph that can be used in a license or description tag.</xs:documentation>
166 </xs:annotation>
167 <xs:restriction base="xs:normalizedString"/>
168 </xs:simpleType>
169 <xs:simpleType name="PathAndFilename">
170 <xs:annotation>
171 <xs:documentation xml:lang="en"> Naming convention for a path and file name</xs:documentation>
172 </xs:annotation>
173 <xs:union memberTypes="Directory_DOS Directory_UNIX"/>
174 </xs:simpleType>
175 <xs:simpleType name="PlatformNamingConvention">
176 <xs:annotation>
177 <xs:documentation xml:lang="en"> This defines what a Platform Name is: Alphanumeric characters and optional underscore (_) or dash (-) characters, followed by a dot and more alphanumeric characters. </xs:documentation>
178 </xs:annotation>
179 <xs:restriction base="xs:string">
180 <xs:pattern value="(([a-zA-Z][a-zA-Z0-9]*)(_)*(.)*)+"/>
181 </xs:restriction>
182 </xs:simpleType>
183 <xs:simpleType name="Polarity">
184 <xs:annotation>
185 <xs:documentation xml:lang="en">Limit Polarity vaild values to -1, 0 and 1</xs:documentation>
186 </xs:annotation>
187 <xs:restriction base="xs:int">
188 <xs:pattern value="-1|0|1"/>
189 </xs:restriction>
190 </xs:simpleType>
191 <xs:simpleType name="Sentence">
192 <xs:annotation>
193 <xs:documentation xml:lang="en"> This data type requires two or more words </xs:documentation>
194 </xs:annotation>
195 <xs:restriction base="xs:normalizedString">
196 <xs:pattern value="(\w+\W*)+( )+(\W*\w*\W*\s*)*"/>
197 </xs:restriction>
198 </xs:simpleType>
199 <xs:simpleType name="ToolNameConvention">
200 <xs:annotation>
201 <xs:documentation xml:lang="en"> This defines what a Tool name is: Alphanumeric characters and optional underscore (_) or dash (-) characters, optionally followed by a dot and more alphanumeric characters. </xs:documentation>
202 </xs:annotation>
203 <xs:restriction base="xs:string">
204 <xs:pattern value="[a-zA-Z][a-zA-Z0-9]*(_*-*.*[a-zA-Z0-9])*"/>
205 </xs:restriction>
206 </xs:simpleType>
207 <xs:simpleType name="UCLetterType">
208 <xs:annotation>
209 <xs:documentation xml:lang="en"> Definition of a UpperCase Letter type, which can be any combination of upper case characters followed by zero or more underscore and/or uppercase alphanumeric characters </xs:documentation>
210 </xs:annotation>
211 <xs:restriction base="xs:string">
212 <xs:pattern value="[A-Z]{1}"/>
213 </xs:restriction>
214 </xs:simpleType>
215 <xs:simpleType name="UCNameType">
216 <xs:annotation>
217 <xs:documentation xml:lang="en"> Definition of a UpperCase Name, which can be any combination of upper case characters followed by zero or more underscore and/or uppercase alphanumeric characters </xs:documentation>
218 </xs:annotation>
219 <xs:restriction base="xs:string">
220 <xs:pattern value="[A-Z]+(_*[A-Z0-9]*( )*)*"/>
221 </xs:restriction>
222 </xs:simpleType>
223 <xs:simpleType name="UserName">
224 <xs:annotation>
225 <xs:documentation xml:lang="en">Specify a User Name</xs:documentation>
226 </xs:annotation>
227 <xs:restriction base="xs:string">
228 <xs:pattern value="[a-zA-Z]+(( )*.?-?[a-zA-Z]*)*"/>
229 </xs:restriction>
230 </xs:simpleType>
231 <xs:simpleType name="V1">
232 <xs:annotation>
233 <xs:documentation xml:lang="en">%VAR%(Directory)*(File_Names)*</xs:documentation>
234 </xs:annotation>
235 <xs:restriction base="xs:string">
236 <xs:pattern value="((%[A-Z](_*[A-Z0-9]*)*%)+((((\\)?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\)?)*)"/>
237 </xs:restriction>
238 </xs:simpleType>
239 <xs:simpleType name="V2">
240 <xs:annotation>
241 <xs:documentation xml:lang="en">($VAR | $( VAR) | ${VAR})(Directory)*(File_Names)</xs:documentation>
242 </xs:annotation>
243 <xs:restriction base="xs:string">
244 <xs:pattern value="(($[A-Z](_*[A-Z0-9]*)*)+||($\([A-Z](_*[A-Z0-9]*)*\))+||($\{[A-Z](_*[A-Z0-9]*)*\})+)+(\/)?(((((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\/)?)*)*)"/>
245 </xs:restriction>
246 </xs:simpleType>
247 <xs:simpleType name="VariableConvention">
248 <xs:annotation>
249 <xs:documentation xml:lang="en">VariableConvention is a UNION of: $VAR, $( VAR), ${VAR} and %VAR% and Directory and File Names</xs:documentation>
250 </xs:annotation>
251 <xs:union memberTypes="V1 V2"/>
252 </xs:simpleType>
253 <xs:simpleType name="VariableGuidType">
254 <xs:annotation>
255 <xs:documentation xml:lang="en"> The GUID data is union of GuidNaming Convetion and GuidArrayType. </xs:documentation>
256 </xs:annotation>
257 <xs:union memberTypes="GuidArrayType GuidNamingConvention Zero"/>
258 </xs:simpleType>
259 <xs:simpleType name="VariableNamingConvention">
260 <xs:annotation>
261 <xs:documentation xml:lang="en">VariableConvention is a UNION of: $VAR, $( VAR), ${VAR} and %VAR%</xs:documentation>
262 </xs:annotation>
263 <xs:union memberTypes="Variable_DOS Variable_UNIX Variable_UNIX_Scope1 Variable_UNIX_Scope2"/>
264 </xs:simpleType>
265 <xs:simpleType name="Variable_DOS">
266 <xs:annotation>
267 <xs:documentation xml:lang="en"> Definition of a DOS Variable Name: %VAR% It must start with an Upper Case character.</xs:documentation>
268 </xs:annotation>
269 <xs:restriction base="xs:string">
270 <xs:pattern value="%[A-Z](_*[A-Z0-9]*)*%"/>
271 </xs:restriction>
272 </xs:simpleType>
273 <xs:simpleType name="Variable_UNIX">
274 <xs:annotation>
275 <xs:documentation xml:lang="en"> Definition of a UNIX Variable Name: $VAR It must start with an Upper Case character.</xs:documentation>
276 </xs:annotation>
277 <xs:restriction base="xs:string">
278 <xs:pattern value="$[A-Z](_*[A-Z0-9]*)*"/>
279 </xs:restriction>
280 </xs:simpleType>
281 <xs:simpleType name="Variable_UNIX_Scope1">
282 <xs:annotation>
283 <xs:documentation xml:lang="en"> Definition of a UNIX Variable Name: $( VAR1) It must start with an Upper Case character.</xs:documentation>
284 </xs:annotation>
285 <xs:restriction base="xs:string">
286 <xs:pattern value="$\([A-Z](_*[A-Z0-9]*)*\)"/>
287 </xs:restriction>
288 </xs:simpleType>
289 <xs:simpleType name="Variable_UNIX_Scope2">
290 <xs:annotation>
291 <xs:documentation xml:lang="en"> Definition of a UNIX Variable Name: ${ VAR1} It must start with an Upper Case character.</xs:documentation>
292 </xs:annotation>
293 <xs:restriction base="xs:string">
294 <xs:pattern value="$\{[A-Z](_*[A-Z0-9]*)*\}"/>
295 </xs:restriction>
296 </xs:simpleType>
297 <xs:simpleType name="VersionDataType">
298 <xs:annotation>
299 <xs:documentation xml:lang="en"> Definition of a Version Number, which can be any combination of a number followed by zero or more alphanumeric-dot-alphanumeric characters </xs:documentation>
300 </xs:annotation>
301 <xs:restriction base="xs:string">
302 <xs:pattern value="xs:normalizedString"/>
303 </xs:restriction>
304 </xs:simpleType>
305 <xs:simpleType name="Zero">
306 <xs:annotation>
307 <xs:documentation xml:lang="en">Define Zero as a vaild value</xs:documentation>
308 </xs:annotation>
309 <xs:restriction base="xs:int">
310 <xs:pattern value="0"/>
311 </xs:restriction>
312 </xs:simpleType>
313 <xs:simpleType name="OldVersionDataType">
314 <xs:annotation>
315 <xs:documentation xml:lang="en"> Definition of a Version Number, which can be any combination of a number followed by zero or more alphanumeric-dot-alphanumeric characters </xs:documentation>
316 </xs:annotation>
317 <xs:restriction base="xs:string">
318 <xs:pattern value="([0-9])+[a-zA-Z0-9]*(-?.?([a-zA-Z0-9])*)*"/>
319 </xs:restriction>
320 </xs:simpleType>
321 </xs:schema>