|
From: Chris M. <zm...@us...> - 2001-05-22 23:01:41
|
Update of /cvsroot/kuml/kuml/libkuml/uml/tools
In directory usw-pr-cvs1:/tmp/cvs-serv28059
Modified Files:
common_code.xsl gen_proxy_hs.xsl
Log Message:
Class proxy headers almost complete.
Small bugfix in common_code.xsl
Index: common_code.xsl
===================================================================
RCS file: /cvsroot/kuml/kuml/libkuml/uml/tools/common_code.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** common_code.xsl 2001/05/16 22:01:49 1.1
--- common_code.xsl 2001/05/22 23:00:40 1.2
***************
*** 53,57 ****
<xsl:variable name="new_string">
<xsl:value-of select='substring($text, 1, $position - 1)'/>
! <xsl:text>_</xsl:text>
<xsl:call-template name="to_lower">
<xsl:with-param name="the_string" select="$letter"/>
--- 53,59 ----
<xsl:variable name="new_string">
<xsl:value-of select='substring($text, 1, $position - 1)'/>
! <xsl:if test='not($position = 1)'>
! <xsl:text>_</xsl:text>
! </xsl:if>
<xsl:call-template name="to_lower">
<xsl:with-param name="the_string" select="$letter"/>
Index: gen_proxy_hs.xsl
===================================================================
RCS file: /cvsroot/kuml/kuml/libkuml/uml/tools/gen_proxy_hs.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gen_proxy_hs.xsl 2001/05/16 22:21:39 1.2
--- gen_proxy_hs.xsl 2001/05/22 23:00:40 1.3
***************
*** 11,14 ****
--- 11,77 ----
+ <!-- Templates to do parameters to the create_<class> method.
+ These templates all use the create_params mode.
+ -->
+
+
+ <!-- Replace the default rule. -->
+ <xsl:template match="*" mode="create_params"/>
+
+
+ <!-- Certain nodes do nothing. -->
+ <xsl:template mode="create_params"
+ match="/ | XMI | XMI.content | Model:Package | Model:Namespace.contents | Model:DataType.typeCode | XMI.CorbaTypeCode">
+ <xsl:apply-templates mode="create_params"/>
+ </xsl:template>
+
+
+ <xsl:template match="Model:Attribute" mode="create_params">
+ <xsl:variable name="type_ref" select="@type"/>
+ <xsl:apply-templates
+ select='/descendant::Model:DataType[attribute::xmi.id=$type_ref]/Model:DataType.typeCode'
+ mode="type_name"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="to_name">
+ <xsl:with-param name="text">
+ <xsl:value-of select="@name"/>
+ </xsl:with-param>
+ <xsl:with-param name="position" select="1"/>
+ </xsl:call-template>
+ <xsl:text>, </xsl:text>
+ </xsl:template>
+
+
+ <xsl:template match="Model:Class" mode="create_params">
+
+ <!-- attempt to find this class's supertype -->
+ <xsl:variable name="supertypes" select="@supertypes"/>
+ <!-- xsl:variable name="superclass"
+ select="/descendant::Model:Class[@xmi.id=$supertypes]"/ -->
+
+ <!-- if a supertype exists recurse on supertype -->
+ <xsl:if test='count(attribute::supertypes) > 0'>
+
+ <xsl:choose>
+ <xsl:when test='contains(@supertypes," ")'>
+ <xsl:apply-templates mode="create_params"
+ select='/descendant::Model:Class[@xmi.id=substring-before($supertypes," ")]'/>
+ <!-- Hack!! xsl:apply-templates mode="create_params"
+ select='/descendant::Model:Class[@xmi.id=substring-after($supertypes," ")]'/ -->
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="create_params"
+ select='/descendant::Model:Class[@xmi.id=$supertypes]'/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:if>
+
+ <!-- output the current nodes attributes -->
+ <xsl:apply-templates mode="create_params"/>
+
+ </xsl:template>
+
+
<xsl:template name="CLASS_PROXY">
***************
*** 16,20 ****
<xsl:variable name="class_name" select="@name"/>
<xsl:variable name="supertypes" select="@supertypes"/>
! <xsl:variable name="superclass" select="/descendant::Model:Class[@xmi.id=$supertypes]/@name"/>
<xsl:variable name="processed_cn">
--- 79,84 ----
<xsl:variable name="class_name" select="@name"/>
<xsl:variable name="supertypes" select="@supertypes"/>
! <xsl:variable name="superclass"
! select="/descendant::Model:Class[@xmi.id=$supertypes]/@name"/>
<xsl:variable name="processed_cn">
***************
*** 103,107 ****
<xsl:text>::</xsl:text>
<xsl:value-of select="$class_name"/>
! <xsl:text>ClassSet* all_of_type</xsl:text>
<xsl:value-of select="$processed_cn"/>
<xsl:text>() </xsl:text>
--- 167,171 ----
<xsl:text>::</xsl:text>
<xsl:value-of select="$class_name"/>
! <xsl:text>ClassSet* all_of_type_</xsl:text>
<xsl:value-of select="$processed_cn"/>
<xsl:text>() </xsl:text>
***************
*** 115,119 ****
<xsl:text>::</xsl:text>
<xsl:value-of select="$class_name"/>
! <xsl:text>ClassSet* all_of_class</xsl:text>
<xsl:value-of select="$processed_cn"/>
<xsl:text>() </xsl:text>
--- 179,183 ----
<xsl:text>::</xsl:text>
<xsl:value-of select="$class_name"/>
! <xsl:text>ClassSet* all_of_class_</xsl:text>
<xsl:value-of select="$processed_cn"/>
<xsl:text>() </xsl:text>
***************
*** 123,129 ****
</xsl:if>
<xsl:text>}; </xsl:text>
! <xsl:text>#endif</xsl:text>
</xsl:template>
--- 187,216 ----
</xsl:if>
+ <!-- create_<class> method. -->
+
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$package_name"/>
+ <xsl:text>::</xsl:text>
+ <xsl:value-of select="$class_name"/>
+ <xsl:text>_ptr create_</xsl:text>
+ <xsl:value-of select="$processed_cn"/>
+ <xsl:text>( </xsl:text>
+
+ <xsl:apply-templates mode="create_params" select="."/>
+
+ <xsl:text> ) </xsl:text>
+
+ <xsl:text> throw( </xsl:text>
+ <xsl:text> ::CORBA::SystemException, </xsl:text>
+ <xsl:text> ::Reflective::MofError) </xsl:text>
+ <xsl:text> ; </xsl:text>
+
+ <xsl:text> </xsl:text>
+
<xsl:text>}; </xsl:text>
+
+ <xsl:text> </xsl:text>
! <xsl:text>#endif </xsl:text>
</xsl:template>
|