usr/src/doc/rad-dev/c-adr-idl.xml
changeset 865 025928ac8888
parent 842 abc3d63bd4da
equal deleted inserted replaced
864:2e056f355d24 865:025928ac8888
    29 </para>
    29 </para>
    30 
    30 
    31     <section><title>Overview</title>
    31     <section><title>Overview</title>
    32     <para>
    32     <para>
    33     The top level element in an <acronym>ADR</acronym> definition
    33     The top level element in an <acronym>ADR</acronym> definition
    34     document is an <sgmltag class='element'>interface</sgmltag>.  The
    34     document is an 
    35     <sgmltag class='element'>interface</sgmltag> element has one
    35     <sgmltag class='element'>api</sgmltag>.  The
       
    36     <sgmltag class='element'>api</sgmltag> element 
       
    37     has one
    36     attribute, <sgmltag class='attribute'>name</sgmltag>, which is used
    38     attribute, <sgmltag class='attribute'>name</sgmltag>, which is used
    37     to name the output files.  The element contains one or more derived
    39     to name the output files.  The element contains one or more derived
    38     type or <acronym>API</acronym> definitions.  As there is no
    40     type or interface definitions.  As there is no
    39     requirement that an <acronym>API</acronym> use derived types, there
    41     requirement that an interface use derived types, there
    40     is no requirement that any derived types be specified in an
    42     is no requirement that any derived types be specified in an
    41     interface document.  To let consumers use the data typing defined
    43     <acronym>API</acronym> document.  
    42     by <acronym>ADR</acronym> for non-<acronym>API</acronym> purposes,
    44     To let consumers use the data typing defined
    43     there is no requirement that an <acronym>API</acronym> is defined
    45     by <acronym>ADR</acronym> for non-interface purposes,
       
    46     there is no requirement that an interface is defined
    44     either.  (At least one thing, derived type or
    47     either.  (At least one thing, derived type or
    45     <acronym>API</acronym>, <emphasis>must</emphasis> be defined,
    48     interface, <emphasis>must</emphasis> be defined,
    46     though.)
    49     though.)
    47     </para>
    50     </para>
    48 
    51 
    49     <para>
    52     <para>
    50     As discussed in the previous chapter, three derived types are
    53     As discussed in the previous chapter, three derived types are
    51     available for definition and use by <acronym>API</acronym>s: a
    54     available for definition and use by interfaces: a
    52     <type>structured</type> type can be defined with a <sgmltag
    55     <type>structured</type> type can be defined with a <sgmltag
    53     class='element'>struct</sgmltag> element, an
    56     class='element'>struct</sgmltag> element, an
    54     <type>enumeration</type> type can be defined with an <sgmltag
    57     <type>enumeration</type> type can be defined with an <sgmltag
    55     class='element'>enum</sgmltag> element, and a <type>union</type>
    58     class='element'>enum</sgmltag> element, and a <type>union</type>
    56     type can be defined with a <sgmltag 
    59     type can be defined with a <sgmltag 
    57     class='element'>union</sgmltag> element.  <acronym>API</acronym>s
    60     class='element'>union</sgmltag> element.  Interfaces
    58     are defined using <sgmltag class='element'>api</sgmltag> elements.
    61     are defined using <sgmltag class='element'>interface</sgmltag> elements.
    59     The derived types defined in an interface document are available
    62     The derived types defined in an <acronym>API</acronym> 
    60     for use by all <acronym>API</acronym>s defined in that document.
    63     document are available
    61     </para>
    64     for use by all interfaces defined in that document.
    62 
    65     </para>
    63     <example><title>Skeleton interface document</title>
    66 
    64 <programlisting><![CDATA[
    67     <example><title>Skeleton <acronym>API</acronym> document</title>
    65 <interface xmlns="http://xmlns.oracle.com/radadr" name="example">
    68 <programlisting><![CDATA[
       
    69 <api xmlns="http://xmlns.oracle.com/radadr" name="example">
    66         <struct>...</struct>
    70         <struct>...</struct>
    67         <struct>...</struct>
    71         <struct>...</struct>
    68         <enum>...</enum>
    72         <enum>...</enum>
    69         <union>...</union>
    73         <union>...</union>
    70         <api>...</api>
    74         <interface>...</interface>
    71         <api>...</api>
    75         <interface>...</interface>
    72 </interface>
    76 </api>
    73 ]]></programlisting>
    77 ]]></programlisting>
    74     </example>
    78     </example>
    75     </section>
    79     </section>
    76 
    80 
    77     <section><title><type>enumeration</type> definitions</title>
    81     <section><title><type>enumeration</type> definitions</title>
    79     The <sgmltag class='element'>enum</sgmltag> element has a single
    83     The <sgmltag class='element'>enum</sgmltag> element has a single
    80     <emphasis>mandatory</emphasis> attribute, <sgmltag
    84     <emphasis>mandatory</emphasis> attribute, <sgmltag
    81     class='attribute'>name</sgmltag>.  The <sgmltag
    85     class='attribute'>name</sgmltag>.  The <sgmltag
    82     class='attribute'>name</sgmltag> is used when referring to the
    86     class='attribute'>name</sgmltag> is used when referring to the
    83     <type>enumeration</type> from other derived type or
    87     <type>enumeration</type> from other derived type or
    84     <acronym>API</acronym> definitions.  An <sgmltag
    88     interface definitions.  An <sgmltag
    85     class='element'>enum</sgmltag> contains <emphasis>one or
    89     class='element'>enum</sgmltag> contains <emphasis>one or
    86     more</emphasis> <sgmltag class='element'>value</sgmltag> elements,
    90     more</emphasis> <sgmltag class='element'>value</sgmltag> elements,
    87     one for each user-defined enumerated value.  A <sgmltag
    91     one for each user-defined enumerated value.  A <sgmltag
    88     class='element'>value</sgmltag> element has a
    92     class='element'>value</sgmltag> element has a
    89     <emphasis>mandatory</emphasis> <sgmltag
    93     <emphasis>mandatory</emphasis> <sgmltag
   148     <sgmltag class='element'>struct</sgmltag> element has a single
   152     <sgmltag class='element'>struct</sgmltag> element has a single
   149     <emphasis>mandatory</emphasis> attribute, <sgmltag
   153     <emphasis>mandatory</emphasis> attribute, <sgmltag
   150     class='attribute'>name</sgmltag>.  The <sgmltag
   154     class='attribute'>name</sgmltag>.  The <sgmltag
   151     class='attribute'>name</sgmltag> is used when referring to the
   155     class='attribute'>name</sgmltag> is used when referring to the
   152     <type>structure</type> from other derived type or
   156     <type>structure</type> from other derived type or
   153     <acronym>API</acronym> definitions.  A <sgmltag
   157     interface definitions.  A <sgmltag
   154     class='element'>struct</sgmltag> contains <emphasis>one or
   158     class='element'>struct</sgmltag> contains <emphasis>one or
   155     more</emphasis> <sgmltag class='element'>field</sgmltag> elements,
   159     more</emphasis> <sgmltag class='element'>field</sgmltag> elements,
   156     one for each field of the <type>structure</type>.  A <sgmltag
   160     one for each field of the <type>structure</type>.  A <sgmltag
   157     class='element'>field</sgmltag> element has a
   161     class='element'>field</sgmltag> element has a
   158     <emphasis>mandatory</emphasis> <sgmltag
   162     <emphasis>mandatory</emphasis> <sgmltag
   165 
   169 
   166     <para>
   170     <para>
   167     There are multiple ways to define the type of a field.  If a field
   171     There are multiple ways to define the type of a field.  If a field
   168     is a plain base type, that type is defined with a
   172     is a plain base type, that type is defined with a
   169     <sgmltag class='attribute'>type</sgmltag> attribute.  If a field is
   173     <sgmltag class='attribute'>type</sgmltag> attribute.  If a field is
   170     a derived type defined elsewhere in the interface document, that
   174     a derived type defined elsewhere in the <acronym>API</acronym> 
       
   175     document, that
   171     type is defined with a <sgmltag class='attribute'>typeref</sgmltag>
   176     type is defined with a <sgmltag class='attribute'>typeref</sgmltag>
   172     attribute.  If a field is an <type>array</type> of some type (base
   177     attribute.  If a field is an <type>array</type> of some type (base
   173     or derived), that type is defined with a nested
   178     or derived), that type is defined with a nested
   174     <sgmltag class='element'>list</sgmltag> element.  The type of the
   179     <sgmltag class='element'>list</sgmltag> element.  The type of the
   175     <type>array</type> is defined in the same fashion as the type of
   180     <type>array</type> is defined in the same fashion as the type of
   264     <sgmltag class='element'>arm</sgmltag> for that value is void.  The
   269     <sgmltag class='element'>arm</sgmltag> for that value is void.  The
   265     default <sgmltag class='element'>arm</sgmltag> is optional.
   270     default <sgmltag class='element'>arm</sgmltag> is optional.
   266     </para>
   271     </para>
   267     </section>
   272     </section>
   268 
   273 
   269     <section><title><acronym>API</acronym> definitions</title>
   274     <section><title><acronym>Interface</acronym> definitions</title>
   270     <para>
   275     <para>
   271     An <acronym>API</acronym> definition has a name, <emphasis>zero or
   276     An interface definition has a name, <emphasis>zero or
   272     more</emphasis> version specifications, and <emphasis>one or
   277     more</emphasis> version specifications, and <emphasis>one or
   273     more</emphasis> attributes, methods, or events.  An
   278     more</emphasis> attributes, methods, or events.  An
   274     <acronym>API</acronym>'s name is defined with the <sgmltag
   279     interface's name is defined with the <sgmltag
   275     class='element'>api</sgmltag> element's
   280     class='element'>interface</sgmltag> element's
   276     <emphasis>mandatory</emphasis> <sgmltag
   281     <emphasis>mandatory</emphasis> <sgmltag
   277     class='attribute'>name</sgmltag> attribute.  This name isn't
   282     class='attribute'>name</sgmltag> attribute.  This name is used
   278     referred to elsewhere in the interface document; it is used only in
   283     when referring to the (inherited) interface from other interface 
       
   284     defintions, as well as in
   279     the server and various client environments.  The other
   285     the server and various client environments.  The other
   280     characteristics of an <acronym>API</acronym> are defined using
   286     characteristics of an interface are defined using
   281     child elements of the <sgmltag class='element'>api</sgmltag>
   287     child elements of the <sgmltag class='element'>interface</sgmltag>
   282     element.
   288     element.
   283     </para>
   289     </para>
   284 
   290 
   285         <section><title>Version</title>
   291         <section><title>Version</title>
   286 	<para>
   292 	<para>
   287 	An <acronym>API</acronym> <emphasis>may</emphasis> define one
   293 	An interface <emphasis>may</emphasis> define one
   288 	version for each commitment level.  It is not necessary to
   294 	version for each commitment level.  It is not necessary to
   289 	define a version for every commitment level, but it is
   295 	define a version for every commitment level, but it is
   290 	recommended that one be specifed for every commitment level
   296 	recommended that one be specifed for every commitment level
   291 	assigned to the features defined in the <acronym>API</acronym>
   297 	assigned to the features defined in the interface
   292 	(i.e. the features defined in the enclosing <sgmltag
   298 	(i.e. the features defined in the enclosing <sgmltag
   293 	class='element'>api</sgmltag> element).
   299 	class='element'>interface</sgmltag> element).
   294 	</para>
   300 	</para>
   295 
   301 
   296 	<para>
   302 	<para>
   297 	A version is defined using a <sgmltag
   303 	A version is defined using a <sgmltag
   298 	class='element'>version</sgmltag> element.  The commitment
   304 	class='element'>version</sgmltag> element.  The commitment
   318 
   324 
   319 	<!-- XXX: How is commitment specified? -->
   325 	<!-- XXX: How is commitment specified? -->
   320 
   326 
   321         <section><title>Methods</title>
   327         <section><title>Methods</title>
   322 	<para>
   328 	<para>
   323 	Each method in an <acronym>API</acronym> is defined by a
   329 	Each method in an interface is defined by a
   324 	<sgmltag class='element'>method</sgmltag> element.  The name of
   330 	<sgmltag class='element'>method</sgmltag> element.  The name of
   325 	a method is defined by this element's
   331 	a method is defined by this element's
   326 	<emphasis>mandatory</emphasis> <sgmltag
   332 	<emphasis>mandatory</emphasis> <sgmltag
   327 	class='attribute'>name</sgmltag> attribute.  The other
   333 	class='attribute'>name</sgmltag> attribute.  The other
   328 	properties of a method are defined by child elements of the
   334 	properties of a method are defined by child elements of the
   379         </example>
   385         </example>
   380 	</section>
   386 	</section>
   381 
   387 
   382         <section><title>Attributes</title>
   388         <section><title>Attributes</title>
   383 	<para>
   389 	<para>
   384 	Each attribute in an <acronym>API</acronym> is defined by a
   390 	Each attribute in an interface is defined by a
   385 	<sgmltag class='element'>property</sgmltag> element.  The name
   391 	<sgmltag class='element'>property</sgmltag> element.  The name
   386 	of an attribute is defined by this element's
   392 	of an attribute is defined by this element's
   387 	<emphasis>mandatory</emphasis> <sgmltag
   393 	<emphasis>mandatory</emphasis> <sgmltag
   388 	class='attribute'>name</sgmltag> attribute.  The types of
   394 	class='attribute'>name</sgmltag> attribute.  The types of
   389 	access permitted are defined by the
   395 	access permitted are defined by the
   448         </example>
   454         </example>
   449 	</section>
   455 	</section>
   450 
   456 
   451         <section><title>Events</title>
   457         <section><title>Events</title>
   452 	<para>
   458 	<para>
   453 	Each event in an <acronym>API</acronym> is defined by a
   459 	Each event in an interface is defined by a
   454 	<sgmltag class='element'>event</sgmltag> element.  The name of
   460 	<sgmltag class='element'>event</sgmltag> element.  The name of
   455 	an event is defined by this element's
   461 	an event is defined by this element's
   456 	<emphasis>mandatory</emphasis> <sgmltag
   462 	<emphasis>mandatory</emphasis> <sgmltag
   457 	class='attribute'>name</sgmltag> attribute.  The type of an
   463 	class='attribute'>name</sgmltag> attribute.  The type of an
   458 	event is specified in the same way the type is specified for a
   464 	event is specified in the same way the type is specified for a
   472     <section id="adr-idl.pragmas"><title>Pragmas</title>
   478     <section id="adr-idl.pragmas"><title>Pragmas</title>
   473     <para>
   479     <para>
   474     Occasionally it is necessary to provide auxilliary information to a
   480     Occasionally it is necessary to provide auxilliary information to a
   475     specific <acronym>ADR</acronym> consumer.  The
   481     specific <acronym>ADR</acronym> consumer.  The
   476     <acronym>ADR</acronym> <acronym>IDL</acronym> has a pragma
   482     <acronym>ADR</acronym> <acronym>IDL</acronym> has a pragma
   477     mechanism that lets an interface creator specify that information
   483     mechanism that lets an <acronym>API</acronym> creator specify that 
       
   484     information
   478     in-line.
   485     in-line.
   479     </para>
   486     </para>
   480 
   487 
   481     <para>
   488     <para>
   482     A pragma is specified with a <sgmltag
   489     A pragma is specified with a <sgmltag
   483     class='element'>pragma</sgmltag> child element of the <sgmltag
   490     class='element'>pragma</sgmltag> child element of the <sgmltag
   484     class='element'>interface</sgmltag>.  A <sgmltag
   491     class='element'>api</sgmltag>.  A <sgmltag
   485     class='element'>pragma</sgmltag> has no child elements, and three
   492     class='element'>pragma</sgmltag> has no child elements, and three
   486     <emphasis>mandatory</emphasis> attributes.  The <sgmltag
   493     <emphasis>mandatory</emphasis> attributes.  The <sgmltag
   487     class='attvalue'>domain</sgmltag> attribute indicates which
   494     class='attvalue'>domain</sgmltag> attribute indicates which
   488     consumer the pragma is intended for, and a <sgmltag
   495     consumer the pragma is intended for, and a <sgmltag
   489     class='attribute'>name</sgmltag> and a <sgmltag
   496     class='attribute'>name</sgmltag> and a <sgmltag