usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADR.rng
changeset 809 8a6fba4105d7
parent 808 2122a04679c0
child 810 9907d0f6f03a
--- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADR.rng	Wed Mar 14 04:47:00 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,386 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
-
- CDDL HEADER START
-
-  The contents of this file are subject to the terms of the
-  Common Development and Distribution License (the "License").
-  You may not use this file except in compliance with the License.
- 
-  You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-  or http://www.opensolaris.org/os/licensing.
-  See the License for the specific language governing permissions
-  and limitations under the License.
- 
-  When distributing Covered Code, include this CDDL HEADER in each
-  file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-  If applicable, add the following below this CDDL HEADER, with the
-  fields enclosed by brackets "[]" replaced with your own identifying
-  information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
--->
-
-<!--
-  adr.rng: an Abstract Data Representation
-
-  Should be broken up into two schemas, one for data and one for
-  APIs.
--->
-
-<grammar ns="http://www.opensolaris.org/ns/adr"
-    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
-    xmlns="http://relaxng.org/ns/structure/1.0">
-
-	<include href="ADRdoc.rng" />
-
-	<!--
-	  We support a fixed set of built-in types.
-	-->
-	<define name="basetype">
-		<attribute name="type">
-			<choice>
-				<value>boolean</value>
-				<value>string</value>
-				<value>integer</value>
-				<value>long</value>
-				<value>time</value>
-				<value>name</value>
-				<value>uinteger</value>
-				<value>ulong</value>
-				<value>opaque</value>
-				<value>password</value>
-				<value>float</value>
-				<value>double</value>
-			</choice>
-		</attribute>
-	</define>
-
-	<!--
-	  An item is one of a built-in type, a reference to a defined
-	  type, or a list.  The first two are defined by attributes,
-	  the last by a nested, typed list element.
-	-->
-	<define name="typespec">
-		<choice>
-			<ref name="basetype" />
-			<attribute name="typeref" />
-			<ref name="element_list" />
-		</choice>
-	</define>
-
-	<!--
-	  A variable-length list type.
-	-->
-	<define name="element_list">
-		<element name="list">
-			<ref name="typespec" />
-		</element>
-	</define>
-
-	<!--
-	  Some data is optional, i.e. it may more may not be present.
-	  This only applies to certain types, though constraining which
-	  types is currently beyond the scope of this schema.
-	-->
-	<define name="optdata">
-		<optional>
-			<attribute name="optional">
-				<data type="boolean" />
-			</attribute>
-		</optional>
-	</define>
-
-	<define name="typespec-opt" >
-		<ref name="optdata" />
-		<ref name="typespec" />
-	</define>
-
-	<define name="typespec-arm" >
-		<choice>
-			<attribute name="type">
-				<value>void</value>
-			</attribute>
-			<ref name="typespec-opt" />
-		</choice>
-	</define>
-
-	<!--
-	  Permit a structure type to include another structure type.
-	  This is largely syntactic sugar, though it could be exploited
-	  in target languages that support inheritance relationships.
-	-->
-	<define name="element_include">
-		<element name="include">
-			<attribute name="typeref" />
-		</element>
-	</define>
-
-	<define name="element_field">
-		<element name="field">
-			<attribute name="name" />
-			<ref name="doc-optional" /> 
-			<ref name="typespec-opt" />
-		</element>
-	</define>
-
-	<define name="element_type">
-		<element name="type">
-			<attribute name="name" />
-			<ref name="doc-optional" />
-		<choice>
-			<!--
-			  We require at least one field or include.
-			  All includes must come first, though.
-			  Takes care to avoid UPA rule in XSD.
-			-->
-			<group>
-				<oneOrMore>
-					<ref name="element_include" />
-				</oneOrMore>
-				<zeroOrMore>
-					<ref name="element_field" />
-				</zeroOrMore>
-			</group>
-			<oneOrMore>
-				<ref name="element_field" />
-			</oneOrMore>
-		</choice>
-		</element>
-	</define>
-
-	<define name="element_arm">
-		<element name="arm">
-			<attribute name="value" />
-			<ref name="typespec-arm" />
-		</element>
-	</define>
-
-	<define name="element_defaultarm">
-		<element name="default">
-			<ref name="typespec-arm" />
-		</element>
-	</define>
-
-	<define name="element_union">
-		<element name="union">
-			<attribute name="name" />
-			<ref name="doc-optional" />
-			<choice>
-				<attribute name="type">
-					<value>boolean</value>
-				</attribute>
-				<!-- Must be an enumeration -->
-				<attribute name="typeref" />
-			</choice>
-			<oneOrMore>
-				<ref name="element_arm" />
-			</oneOrMore>
-			<optional>
-				<ref name="element_defaultarm" />
-			</optional>
-		</element>
-	</define>
-
-	<define name="element_value">
-		<element name="value">
-			<attribute name="name" />
-			<optional>
-				<attribute name="value" />
-			</optional>
-			<ref name="doc-optional" />
-		</element>
-	</define>
-
-	<define name="element_fallback">
-		<element name="fallback">
-			<attribute name="name" />
-			<ref name="doc-optional" />
-		</element>
-	</define>
-
-	<define name="element_enum">
-		<element name="enum">
-			<attribute name="name" />
-			<ref name="doc-optional" />
-			<oneOrMore>
-				<ref name="element_value" />
-			</oneOrMore>
-			<optional>
-				<ref name="element_fallback" />
-			</optional>
-		</element>
-	</define>
-
-	<define name="element_pragma">
-		<element name="pragma">
-			<attribute name="domain" />
-			<attribute name="name" />
-			<attribute name="value" />
-		</element>
-	</define>
-
-	<define name="optional_error">
-		<optional>
-			<element name="error">
-				<ref name="optdata" />
-				<optional>
-					<attribute name="typeref" />
-				</optional>
-				<ref name="doc-optional" />
-			</element>
-		</optional>
-	</define>
-
-	<define name="property_error">
-		<element name="error">
-			<ref name="optdata"/>
-			<optional>
-				<attribute name="typeref"/>
-			</optional>
-			<optional>
-				<attribute name="for">
-					<choice>
-						<value>ro</value>
-						<value>rw</value>
-						<value>wo</value>
-					</choice>
-				</attribute>
-			</optional>
-			<ref name="doc-optional" />
-		</element>
-	</define>
-
-	<define name="optional_stability">
-		<optional>
-			<attribute name="stability">
-				<choice>
-			  		<value>committed</value>
-				  	<value>uncommitted</value>
-				  	<value>private</value>
-				</choice>	
-			</attribute>		
-		</optional>		
-	</define>
-
-	<define name="element_property">
-		<element name="property">
-			<attribute name="name" />
-			<ref name="optional_stability" />
-			<attribute name="access">
-				<choice>
-					<value>ro</value>
-					<value>rw</value>
-					<value>wo</value>
-				</choice>
-			</attribute>
-			<ref name="doc-optional" />
-			<ref name="typespec-opt" />
-			<optional>
-				<ref name="property_error"/>
-				<optional>
-					<ref name="property_error"/>
-				</optional>
-			</optional>
-		</element>
-	</define>
-
-	<define name="element_method">
-		<element name="method">
-			<attribute name="name" />
-			<ref name="optional_stability" />
-			<ref name="doc-optional" />
-			<optional>
-				<element name="result">
-					<ref name="doc-optional" />
-					<ref name="typespec-opt" />
-				</element>
-			</optional>
-			<ref name="optional_error" />
-			<zeroOrMore>
-				<element name="argument">
-					<attribute name="name" />
-				    	<ref name="doc-optional" />
-					<ref name="typespec-opt" />
-				</element>
-			</zeroOrMore>
-		</element>
-	</define>
-
-	<define name="element_event">
-		<element name="event">
-			<attribute name="name" />
-			<ref name="optional_stability" />
-			<choice>
-				<ref name="basetype" />
-				<attribute name="typeref" />
-			</choice>
-			<ref name="doc-optional" />
-		</element>
-	</define>
-
-	<define name="element_version">
-		<element name="version">
-			<attribute name="major">
-				<data type="integer" />
-			</attribute>
-			<attribute name="minor">
-				<data type="integer" />
-			</attribute>
-			<!-- micro is specified by implementation -->
-			<attribute name="stability">
-				<choice>
-			  		<value>committed</value>
-				  	<value>uncommitted</value>
-				  	<value>private</value>
-				</choice>	
-			</attribute>
-		</element>
-	</define>
-
-	<define name="element_api">
-		<element name="api">
-			<attribute name="name" />
-			<ref name="doc-optional" />
-			<!-- only 1 version per stability level is permitted -->
-			<zeroOrMore>
-				<ref name="element_version" />
-			</zeroOrMore>
-			<zeroOrMore>
-				<ref name="element_include" />
-			</zeroOrMore>
-			<oneOrMore>
-				<choice>
-					<ref name="element_property" />
-					<ref name="element_method" />
-					<ref name="element_event" />
-				</choice>
-			</oneOrMore>
-		</element>
-	</define>
-
-	<!-- optional documentation -->
-	<define name="doc-optional">
-		<optional>
-			<ref name="documentation" />
-		</optional>
-	</define>
-
-    	<start>
-		<element name="interface">
-			<attribute name="name" />
-			<ref name="doc-optional" />
-			<oneOrMore>
-				<choice>
-					<ref name="element_pragma" />
-					<ref name="element_type" />
-					<ref name="element_enum" />
-					<ref name="element_union" />
-					<ref name="element_api" />
-				</choice>
-			</oneOrMore>
-		</element>
-	</start>
-
-</grammar>