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