<?xml version="1.0" encoding="UTF-8"?>
<!--
  This file is part of DocBook V5.0
  
  Copyright 1992-2008 HaL Computer Systems, Inc.,
  O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software
  Corporation, Norman Walsh, Sun Microsystems, Inc., and the
  Organization for the Advancement of Structured Information
  Standards (OASIS).
  
  Release: $Id: pool.rnc 7466 2007-09-27 14:03:55Z nwalsh $
  
  Permission to use, copy, modify and distribute the DocBook schema
  and its accompanying documentation for any purpose and without fee
  is hereby granted in perpetuity, provided that the above copyright
  notice and this paragraph appear in all copies. The copyright
  holders make no representation about the suitability of the schema
  for any purpose. It is provided "as is" without expressed or implied
  warranty.
  
  If you modify the DocBook schema in any way, label your schema as a
  variant of DocBook. See the reference documentation
  (http://docbook.org/tdg5/en/html/ch05.html#s-notdocbook)
  for more information.
  
  Please direct all questions, bug reports, or suggestions for changes
  to the docbook@lists.oasis-open.org mailing list. For more
  information, see http://www.oasis-open.org/docbook/.
  
  ======================================================================
-->
<grammar ns="http://docbook.org/ns/docbook" xmlns:db="http://docbook.org/ns/docbook" xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:ctrl="http://nwalsh.com/xmlns/schema-control/" xmlns="http://relaxng.org/ns/structure/1.0">
  <start combine="choice">
    <ref name="db.cmdsynopsis"/>
  </start>
  <define name="db.domain.inlines" combine="choice">
    <ref name="db.os.inlines"/>
  </define>
  <define name="db.synopsis.blocks" combine="choice">
    <ref name="db.cmdsynopsis"/>
  </define>
  <define name="db.os.inlines">
    <choice>
      <ref name="db.prompt"/>
      <ref name="db.envar"/>
      <ref name="db.filename"/>
      <ref name="db.command"/>
      <ref name="db.computeroutput"/>
      <ref name="db.userinput"/>
    </choice>
  </define>
  <define name="db.computeroutput.inlines">
    <choice>
      <text/>
      <ref name="db.ubiq.inlines"/>
      <ref name="db.os.inlines"/>
      <ref name="db.technical.inlines"/>
    </choice>
  </define>
  <define name="db.userinput.inlines">
    <choice>
      <text/>
      <ref name="db.ubiq.inlines"/>
      <ref name="db.os.inlines"/>
      <ref name="db.technical.inlines"/>
    </choice>
  </define>
  <!-- ====================================================================== -->
  <define name="db.prompt.inlines">
    <ref name="db._text"/>
  </define>
  <!-- ====================================================================== -->
  <div>
    <db:refname>prompt</db:refname>
    <db:refpurpose>A character or string indicating the start of an input field in a  computer display</db:refpurpose>
    <define name="db.prompt.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.prompt.attlist">
      <interleave>
        <optional>
          <ref name="db.prompt.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.prompt">
      <element name="prompt">
        <ref name="db.prompt.attlist"/>
        <zeroOrMore>
          <ref name="db.prompt.inlines"/>
        </zeroOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>envar</db:refname>
    <db:refpurpose>A software environment variable</db:refpurpose>
    <define name="db.envar.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.envar.attlist">
      <interleave>
        <optional>
          <ref name="db.envar.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.envar">
      <element name="envar">
        <ref name="db.envar.attlist"/>
        <ref name="db._text"/>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>filename</db:refname>
    <db:refpurpose>The name of a file</db:refpurpose>
    <define name="db.filename.class.enumeration">
      <choice>
        <value>devicefile</value>
        <a:documentation>A device</a:documentation>
        <value>directory</value>
        <a:documentation>A directory</a:documentation>
        <value>extension</value>
        <a:documentation>A filename extension</a:documentation>
        <value>headerfile</value>
        <a:documentation>A header file (as for a programming language)</a:documentation>
        <value>libraryfile</value>
        <a:documentation>A library file</a:documentation>
        <value>partition</value>
        <a:documentation>A partition (as of a hard disk)</a:documentation>
        <value>symlink</value>
        <a:documentation>A symbolic link</a:documentation>
      </choice>
    </define>
    <define name="db.filename.class.attribute">
      <attribute name="class">
        <db:refpurpose>Identifies the class of filename</db:refpurpose>
        <ref name="db.filename.class.enumeration"/>
      </attribute>
    </define>
    <define name="db.filename.path.attribute">
      <attribute name="path">
        <db:refpurpose>Specifies the path of the filename</db:refpurpose>
      </attribute>
    </define>
    <define name="db.filename.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.filename.attlist">
      <interleave>
        <optional>
          <ref name="db.filename.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
        <optional>
          <ref name="db.filename.path.attribute"/>
        </optional>
        <optional>
          <ref name="db.filename.class.attribute"/>
        </optional>
      </interleave>
    </define>
    <define name="db.filename">
      <element name="filename">
        <ref name="db.filename.attlist"/>
        <ref name="db._text"/>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>command</db:refname>
    <db:refpurpose>The name of an executable program or other software command</db:refpurpose>
    <define name="db.command.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.command.attlist">
      <interleave>
        <optional>
          <ref name="db.command.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.command">
      <element name="command">
        <ref name="db.command.attlist"/>
        <ref name="db._text"/>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>computeroutput</db:refname>
    <db:refpurpose>Data, generally text, displayed or presented by a computer</db:refpurpose>
    <define name="db.computeroutput.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.computeroutput.attlist">
      <interleave>
        <optional>
          <ref name="db.computeroutput.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.computeroutput">
      <element name="computeroutput">
        <ref name="db.computeroutput.attlist"/>
        <zeroOrMore>
          <ref name="db.computeroutput.inlines"/>
        </zeroOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>userinput</db:refname>
    <db:refpurpose>Data entered by the user</db:refpurpose>
    <define name="db.userinput.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.userinput.attlist">
      <interleave>
        <optional>
          <ref name="db.userinput.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.userinput">
      <element name="userinput">
        <ref name="db.userinput.attlist"/>
        <zeroOrMore>
          <ref name="db.userinput.inlines"/>
        </zeroOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>cmdsynopsis</db:refname>
    <db:refpurpose>A syntax summary for a software command</db:refpurpose>
    <define name="db.cmdsynopsis.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.cmdsynopsis.sepchar.attribute">
      <attribute name="sepchar">
        <db:refpurpose>Specifies the character that should separate the command and its top-level arguments</db:refpurpose>
      </attribute>
    </define>
    <define name="db.cmdsynopsis.cmdlength.attribute">
      <attribute name="cmdlength">
        <db:refpurpose>Indicates the displayed length of the command; this information may be used to intelligently indent command synopses which extend beyond one line</db:refpurpose>
      </attribute>
    </define>
    <define name="db.cmdsynopsis.label.attribute">
      <ref name="db.label.attribute"/>
    </define>
    <define name="db.cmdsynopsis.attlist">
      <interleave>
        <optional>
          <ref name="db.cmdsynopsis.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
        <optional>
          <ref name="db.cmdsynopsis.sepchar.attribute"/>
        </optional>
        <optional>
          <ref name="db.cmdsynopsis.cmdlength.attribute"/>
        </optional>
        <optional>
          <ref name="db.cmdsynopsis.label.attribute"/>
        </optional>
      </interleave>
    </define>
    <define name="db.cmdsynopsis.info">
      <ref name="db._info.title.forbidden"/>
    </define>
    <define name="db.cmdsynopsis">
      <element name="cmdsynopsis">
        <ref name="db.cmdsynopsis.attlist"/>
        <ref name="db.cmdsynopsis.info"/>
        <oneOrMore>
          <choice>
            <ref name="db.command"/>
            <ref name="db.arg"/>
            <ref name="db.group"/>
            <ref name="db.sbr"/>
          </choice>
        </oneOrMore>
        <zeroOrMore>
          <ref name="db.synopfragment"/>
        </zeroOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <define name="db.rep.enumeration">
    <choice>
      <value>norepeat</value>
      <a:documentation>Can not be repeated.</a:documentation>
      <value>repeat</value>
      <a:documentation>Can be repeated.</a:documentation>
    </choice>
  </define>
  <define name="db.rep.attribute">
    <attribute name="rep" a:defaultValue="norepeat">
      <db:refpurpose>Indicates whether or not repetition is possible.</db:refpurpose>
      <ref name="db.rep.enumeration"/>
    </attribute>
  </define>
  <define name="db.choice.enumeration">
    <choice>
      <value>opt</value>
      <a:documentation>Formatted to indicate that it is optional.</a:documentation>
      <value>plain</value>
      <a:documentation>Formatted without indication.</a:documentation>
      <value>req</value>
      <a:documentation>Formatted to indicate that it is required.</a:documentation>
    </choice>
  </define>
  <define name="db.choice.opt.attribute">
    <attribute name="choice" a:defaultValue="opt">
      <db:refpurpose>Indicates optionality.</db:refpurpose>
      <ref name="db.choice.enumeration"/>
    </attribute>
  </define>
  <define name="db.choice.req.attribute">
    <attribute name="choice" a:defaultValue="req">
      <db:refpurpose>Indicates optionality.</db:refpurpose>
      <ref name="db.choice.enumeration"/>
    </attribute>
  </define>
  <!-- ====================================================================== -->
  <div>
    <db:refname>arg</db:refname>
    <db:refpurpose>An argument in a cmdsynopsis</db:refpurpose>
    <define name="db.arg.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.arg.rep.attribute">
      <ref name="db.rep.attribute"/>
    </define>
    <define name="db.arg.choice.attribute">
      <ref name="db.choice.opt.attribute"/>
    </define>
    <define name="db.arg.attlist">
      <interleave>
        <optional>
          <ref name="db.arg.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
        <optional>
          <ref name="db.arg.rep.attribute"/>
        </optional>
        <optional>
          <ref name="db.arg.choice.attribute"/>
        </optional>
      </interleave>
    </define>
    <define name="db.arg">
      <element name="arg">
        <ref name="db.arg.attlist"/>
        <zeroOrMore>
          <choice>
            <ref name="db._text"/>
            <ref name="db.arg"/>
            <ref name="db.group"/>
            <ref name="db.option"/>
            <ref name="db.synopfragmentref"/>
            <ref name="db.sbr"/>
          </choice>
        </zeroOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>group</db:refname>
    <db:refpurpose>A group of elements in a cmdsynopsis</db:refpurpose>
    <define name="db.group.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.group.rep.attribute">
      <ref name="db.rep.attribute"/>
    </define>
    <define name="db.group.choice.attribute">
      <ref name="db.choice.opt.attribute"/>
    </define>
    <define name="db.group.attlist">
      <interleave>
        <optional>
          <ref name="db.group.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
        <optional>
          <ref name="db.group.rep.attribute"/>
        </optional>
        <optional>
          <ref name="db.group.choice.attribute"/>
        </optional>
      </interleave>
    </define>
    <define name="db.group">
      <element name="group">
        <ref name="db.group.attlist"/>
        <oneOrMore>
          <choice>
            <ref name="db.arg"/>
            <ref name="db.group"/>
            <ref name="db.option"/>
            <ref name="db.synopfragmentref"/>
            <ref name="db.replaceable"/>
            <ref name="db.sbr"/>
          </choice>
        </oneOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>sbr</db:refname>
    <db:refpurpose>An explicit line break in a command synopsis</db:refpurpose>
    <define name="db.sbr.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.sbr.attlist">
      <interleave>
        <optional>
          <ref name="db.sbr.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
      </interleave>
    </define>
    <define name="db.sbr">
      <element name="sbr">
        <ref name="db.sbr.attlist"/>
        <empty/>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>synopfragment</db:refname>
    <db:refpurpose>A portion of a cmdsynopsis broken out from the main body of the synopsis</db:refpurpose>
    <define name="db.synopfragment.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.synopfragment.attlist">
      <interleave>
        <optional>
          <ref name="db.synopfragment.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.synopfragment">
      <element name="synopfragment">
        <ref name="db.synopfragment.attlist"/>
        <oneOrMore>
          <choice>
            <ref name="db.arg"/>
            <ref name="db.group"/>
          </choice>
        </oneOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>synopfragmentref</db:refname>
    <db:refpurpose>A reference to a fragment of a command synopsis</db:refpurpose>
    <define name="db.synopfragmentref.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.synopfragmentref.attlist">
      <interleave>
        <optional>
          <ref name="db.synopfragmentref.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.linkend.attribute"/>
      </interleave>
    </define>
    <define name="db.synopfragmentref">
      <element name="synopfragmentref">
        <s:pattern name="Synopsis fragment type constraint">
          <s:rule context="db:synopfragmentref">
            <s:assert test="local-name(//*[@xml:id=current()/@linkend]) = 'synopfragment' and namespace-uri(//*[@xml:id=current()/@linkend]) = 'http://docbook.org/ns/docbook'">@linkend on synopfragmentref must point to a synopfragment.</s:assert>
          </s:rule>
        </s:pattern>
        <ref name="db.synopfragmentref.attlist"/>
        <text/>
      </element>
    </define>
  </div>
</grammar>
