[GCC-XML]New cv-qualified type referencing scheme

Paul Ross gccxml at paulross.demon.co.uk
Sun Oct 12 07:14:00 EDT 2003


Brad,

This looks good! I have updated the DTD I posted back in July to take 
account of this and other recent changes (see the change list at the 
end of the DTD for the changes).

Paul Ross.

<!-- Estimated DTD for GCCXML
This is based on the DTD for GCCXML 0.4.2 and includes support for
planned changes for GCCXML release 0.5

See end for change list, authors.

Notes:
'location' attribute values are of the form '(.+):([1-9][0-9]*)'
Where:
\1 is the file element ID
\2 is the line number

-->

<!ATTLIST Argument default CDATA #IMPLIED>
<!ATTLIST Argument name CDATA #IMPLIED>
<!ATTLIST Argument type IDREF #REQUIRED>

<!ATTLIST ArrayType id ID #REQUIRED>
<!ATTLIST ArrayType max CDATA #REQUIRED>
<!ATTLIST ArrayType min CDATA #FIXED "0">
<!ATTLIST ArrayType type IDREF #REQUIRED>

<!ATTLIST Class abstract (0 | 1) "0">
<!ATTLIST Class bases CDATA #IMPLIED>
<!ATTLIST Class context IDREF #REQUIRED>
<!ATTLIST Class id ID #REQUIRED>
<!ATTLIST Class incomplete (0 | 1) "0">
<!ATTLIST Class location CDATA #REQUIRED>
<!ATTLIST Class members CDATA #IMPLIED>
<!ATTLIST Class name CDATA #REQUIRED>

<!ATTLIST Constructor access (public | private | protected) "public">
<!ATTLIST Constructor context CDATA #REQUIRED>
<!ATTLIST Constructor extern (0 | 1) "0">
<!ATTLIST Constructor id ID #REQUIRED>
<!ATTLIST Constructor location CDATA #REQUIRED>
<!ATTLIST Constructor name CDATA #REQUIRED>
<!ATTLIST Constructor artificial (0 | 1) #IMPLIED>
<!ATTLIST Constructor throw CDATA #IMPLIED>
<!ATTLIST Constructor endline CDATA #REQUIRED>

<!ATTLIST Converter const (0 | 1) "0">
<!ATTLIST Converter context IDREF #REQUIRED>
<!ATTLIST Converter extern (0 | 1) "0">
<!ATTLIST Converter id ID #REQUIRED>
<!ATTLIST Converter location CDATA #REQUIRED>
<!ATTLIST Converter name CDATA #REQUIRED>
<!ATTLIST Converter returns IDREF #REQUIRED>
<!ATTLIST Converter throw CDATA #IMPLIED>
<!ATTLIST Converter endline CDATA #REQUIRED>

<!ATTLIST CvQualifiedType id ID #REQUIRED>
<!ATTLIST CvQualifiedType type IDREF #REQUIRED>
<!ATTLIST CvQualifiedType const (0 | 1) "0">
<!ATTLIST CvQualifiedType volatile (0 | 1) "0">

<!ATTLIST Destructor access (public | private | protected) "public">
<!ATTLIST Destructor context IDREF #REQUIRED>
<!ATTLIST Destructor extern (0 | 1) "0">
<!ATTLIST Destructor id ID #REQUIRED>
<!ATTLIST Destructor location CDATA #REQUIRED>
<!ATTLIST Destructor name CDATA #REQUIRED>
<!ATTLIST Destructor virtual (0 | 1) "0">
<!ATTLIST Destructor throw CDATA #IMPLIED>
<!ATTLIST Destructor endline CDATA #REQUIRED>

<!ATTLIST EnumValue init CDATA #REQUIRED>
<!ATTLIST EnumValue name CDATA #REQUIRED>

<!ATTLIST Enumeration access (public | private | protected) "public">
<!ATTLIST Enumeration context CDATA #REQUIRED>
<!ATTLIST Enumeration id ID #REQUIRED>
<!ATTLIST Enumeration location CDATA #REQUIRED>
<!ATTLIST Enumeration name CDATA #REQUIRED>

<!ATTLIST Field access (public | private | protected) "public">
<!ATTLIST Field context IDREF #REQUIRED>
<!ATTLIST Field id ID #REQUIRED>
<!ATTLIST Field location CDATA #REQUIRED>
<!ATTLIST Field name CDATA #REQUIRED>
<!ATTLIST Field type IDREF #REQUIRED>

<!ATTLIST File id ID #REQUIRED>
<!ATTLIST File name CDATA #REQUIRED>

<!ATTLIST Function context IDREF #REQUIRED>
<!ATTLIST Function extern (0 | 1) "0">
<!ATTLIST Function id ID #REQUIRED>
<!ATTLIST Function location CDATA #REQUIRED>
<!ATTLIST Function name CDATA #REQUIRED>
<!ATTLIST Function returns IDREF #REQUIRED>
<!ATTLIST Function throw CDATA #IMPLIED>
<!ATTLIST Function endline CDATA #REQUIRED>

<!ATTLIST FunctionType id ID #REQUIRED>
<!ATTLIST FunctionType returns IDREF #REQUIRED>

<!ATTLIST FundamentalType id ID #REQUIRED>
<!ATTLIST FundamentalType name CDATA #REQUIRED>

<!ATTLIST Method access (public | private | protected) "public">
<!ATTLIST Method const (0 | 1) "0">
<!ATTLIST Method context IDREF #REQUIRED>
<!ATTLIST Method extern (0 | 1) "0">
<!ATTLIST Method id ID #REQUIRED>
<!ATTLIST Method location CDATA #REQUIRED>
<!ATTLIST Method name CDATA #REQUIRED>
<!ATTLIST Method pure_virtual (0 | 1) "0">
<!ATTLIST Method returns IDREF #REQUIRED>
<!ATTLIST Method static (0 | 1) "0">
<!ATTLIST Method virtual (0 | 1) "0">
<!ATTLIST Method throw CDATA #IMPLIED>
<!ATTLIST Method endline CDATA #REQUIRED>

<!ATTLIST MethodType basetype IDREF #REQUIRED>
<!ATTLIST MethodType id ID #REQUIRED>
<!ATTLIST MethodType returns IDREF #REQUIRED>

<!ATTLIST Namespace context IDREF #IMPLIED>
<!ATTLIST Namespace id ID #REQUIRED>
<!ATTLIST Namespace members CDATA #IMPLIED>
<!ATTLIST Namespace name CDATA #REQUIRED>

<!ATTLIST OperatorFunction context IDREF #REQUIRED>
<!ATTLIST OperatorFunction extern (0 | 1) "0">
<!ATTLIST OperatorFunction id ID #REQUIRED>
<!ATTLIST OperatorFunction location CDATA #REQUIRED>
<!ATTLIST OperatorFunction name CDATA #REQUIRED>
<!ATTLIST OperatorFunction returns IDREF #REQUIRED>
<!ATTLIST OperatorFunction throw CDATA #IMPLIED>
<!ATTLIST OperatorFunction endline CDATA #REQUIRED>

<!ATTLIST OperatorMethod access (public | private | protected) "public">
<!ATTLIST OperatorMethod const (0 | 1) "0">
<!ATTLIST OperatorMethod context IDREF #REQUIRED>
<!ATTLIST OperatorMethod extern (0 | 1) "0">
<!ATTLIST OperatorMethod id ID #REQUIRED>
<!ATTLIST OperatorMethod location CDATA #REQUIRED>
<!ATTLIST OperatorMethod name CDATA #REQUIRED>
<!ATTLIST OperatorMethod pure_virtual (0 | 1) "0">
<!ATTLIST OperatorMethod returns IDREF #REQUIRED>
<!ATTLIST OperatorMethod virtual (0 | 1) "0">
<!ATTLIST OperatorMethod throw CDATA #IMPLIED>
<!ATTLIST OperatorMethod endline CDATA #REQUIRED>

<!ATTLIST PointerType id ID #REQUIRED>
<!ATTLIST PointerType type IDREF #REQUIRED>

<!ATTLIST ReferenceType id ID #REQUIRED>
<!ATTLIST ReferenceType type IDREF #REQUIRED>

<!ATTLIST Struct access (public | private | protected) "public">
<!ATTLIST Struct bases CDATA #IMPLIED>
<!ATTLIST Struct context IDREF #REQUIRED>
<!ATTLIST Struct id ID #REQUIRED>
<!ATTLIST Struct incomplete (0 | 1) "0">
<!ATTLIST Struct location CDATA #REQUIRED>
<!ATTLIST Struct members CDATA #IMPLIED>
<!ATTLIST Struct name CDATA #REQUIRED>

<!ATTLIST Typedef context IDREF #REQUIRED>
<!ATTLIST Typedef id ID #REQUIRED>
<!ATTLIST Typedef location CDATA #REQUIRED>
<!ATTLIST Typedef name CDATA #REQUIRED>
<!ATTLIST Typedef type IDREF #REQUIRED>

<!ATTLIST Unimplemented id ID #REQUIRED>
<!ATTLIST Unimplemented node CDATA #REQUIRED>
<!ATTLIST Unimplemented tree_code (187 | 190 | 193) #REQUIRED>
<!ATTLIST Unimplemented tree_code_name (template_type_parm | 
typename_type | using_decl) #REQUIRED>

<!ATTLIST Union bases CDATA #REQUIRED>
<!ATTLIST Union context IDREF #REQUIRED>
<!ATTLIST Union id ID #REQUIRED>
<!ATTLIST Union location CDATA #REQUIRED>
<!ATTLIST Union members CDATA #REQUIRED>
<!ATTLIST Union name CDATA #REQUIRED>

<!ATTLIST Variable access (public | private | protected) "public">
<!ATTLIST Variable context IDREF #REQUIRED>
<!ATTLIST Variable extern (0 | 1) "0">
<!ATTLIST Variable id ID #REQUIRED>
<!ATTLIST Variable init CDATA #IMPLIED>
<!ATTLIST Variable location CDATA #REQUIRED>
<!ATTLIST Variable name CDATA #REQUIRED>
<!ATTLIST Variable type IDREF #REQUIRED>

<!ELEMENT Argument EMPTY>
<!ELEMENT Ellipsis EMPTY>
<!ELEMENT ArrayType EMPTY>
<!ELEMENT Class EMPTY>
<!ELEMENT Constructor (Argument | Ellipsis)*>
<!ELEMENT Converter EMPTY>
<!ELEMENT CvQualifiedType EMPTY>
<!ELEMENT Destructor EMPTY>
<!ELEMENT EnumValue EMPTY>
<!ELEMENT Enumeration (EnumValue)+>
<!ELEMENT Field EMPTY>
<!ELEMENT File EMPTY>
<!ELEMENT Function (Argument | Ellipsis)*>
<!ELEMENT FunctionType (Argument | Ellipsis)*>
<!ELEMENT FundamentalType EMPTY>
<!ELEMENT Method (Argument | Ellipsis)*>
<!ELEMENT MethodType (Argument | Ellipsis)*>
<!ELEMENT Namespace EMPTY>
<!ELEMENT OperatorFunction (Argument | Ellipsis)*>
<!ELEMENT OperatorMethod (Argument | Ellipsis)*>
<!ELEMENT PointerType EMPTY>
<!ELEMENT ReferenceType EMPTY>
<!ELEMENT Struct EMPTY>
<!ELEMENT Typedef EMPTY>
<!ELEMENT Unimplemented EMPTY>
<!ELEMENT Union EMPTY>
<!ELEMENT Variable EMPTY>
<!ELEMENT GCC_XML (ArrayType | Class | Constructor | Converter | 
CvQualifiedType | Destructor | Enumeration | Field | File | Function 
| FunctionType | FundamentalType | Method | MethodType | Namespace | 
OperatorFunction | OperatorMethod | PointerType | ReferenceType | 
Struct | Typedef | Unimplemented | Union | Variable)+>

<!-- Change list (latest at top):
2003-10-11:
+++++++++++
Paul Ross <gccxml at paulross.demon.co.uk>
Updated to current CVS version plus planned support for CvQualifiedType.
   Program:   GCC-XML
   Module:    $RCSfile: xml.c,v $
   Language:  C++
   Date:      $Date: 2003/09/24 13:50:59 $
   Version:   $Revision: 1.61 $

Summary:
1. Addded <ELEMENT CvQualifiedType ...> and attributes.

2. Changed the attribute kind from CDATA to IDREF of the following:
Argument type, Field type, Function returns, Method returns,
MethodType returns, PointerType type, ReferenceType type,
Typedef type, Variable type.
This references CvQualifiedType id.

3. Added <!ATTLIST Constructor artificial (0 | 1) #IMPLIED>

4. Added <!ATTLIST ... throw CDATA #IMPLIED> to the following:
Constructor, Converter, Destructor, Function, Method, 
OperatorFunction, OperatorMethod.

5. Added <!ATTLIST ... endline CDATA #REQUIRED> to the following:
Constructor, Converter, Destructor, Function, Method, 
OperatorFunction, OperatorMethod.

2003-07-13:
+++++++++++
Paul Ross <gccxml at paulross.demon.co.uk>
First draft, compatible with gccxml 0.4.2
-->


>Hello GCC-XML Users,
>
>The current GCC-XML dump uses the following technique to reference a
>top-level cv-qualified type:
>
><PointerType id="_1" type="_5"/>       <!-- "int*" -->
><PointerType id="_2" type="_5c"/>      <!-- "int const*" -->
><PointerType id="_3" type="_5v"/>      <!-- "int volatile*" -->
><PointerType id="_4" type="_5cv"/>     <!-- "int const volatile*" -->
><FundamentalType id="_5" name="int"/>
>
>In this example, the type attribute of PointerType contains extra
>characters to denote top-level cv-qualifiers in the type to which it
>points.  While this is easy to parse when using a language like C++ or
>python, it violates the ID/IDREF specification for XML:
>
>http://www.w3.org/TR/REC-xml#id
>http://www.w3.org/TR/REC-xml#idref
>
>I'm planning to change the referencing scheme to work like this:
>
><PointerType id="_1" type="_5"/>       <!-- "int*" -->
><PointerType id="_2" type="_5c"/>      <!-- "int const*" -->
><PointerType id="_3" type="_5v"/>      <!-- "int volatile*" -->
><PointerType id="_4" type="_5cv"/>     <!-- "int const volatile*" -->
><FundamentalType id="_5" name="int"/>
><CvQualifiedType id="_5c" type="_5" const="1"/>
><CvQualifiedType id="_5v" type="_5" volatile="1"/>
><CvQualifiedType id="_5cv" type="_5" const="1" volatile="1"/>
>
>In this approach, the three CvQualifiedType elements correspond to the
>FundamentalType element with added cv-qualification.  They are referenced
>with standard IDREF attributes by other elements.  Backward-compatibility
>is maintained by the special form of the ID attributes of CvQualifiedType
>elements.
>
>I'm going to commit the changes for this sometime next week unless anyone
>points out a flaw in the design.  Please be prepared to modify your
>parsers to handle the new CvQualifiedType element.  The elements can be
>safely ignored by parsers that already know how to handle the old
>referencing scheme.  New parsers or XSL transformations will be able to
>take advantage of the full ID/IDREF support in XML.
>
>-Brad
>
>_______________________________________________
>gccxml mailing list
>gccxml at gccxml.org
>http://www.gccxml.org/mailman/listinfo/gccxml


-- 
______________________________________________________________
Paul Ross - Current Affairs photojournalist, home and foreign.
http://www.caliach.com/paulr/index.html



More information about the gccxml mailing list