From: Chris M. <zm...@us...> - 2001-07-26 21:18:45
|
Update of /cvsroot/kuml/kuml/libkuml/uml/tools In directory usw-pr-cvs1:/tmp/cvs-serv25543 Modified Files: common_code.xsl gen_class_ccs.xsl gen_class_hs.xsl gen_proxy_hs.xsl Log Message: The red eyed release. The classes compile. Index: common_code.xsl =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/uml/tools/common_code.xsl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** common_code.xsl 2001/07/09 22:38:30 1.6 --- common_code.xsl 2001/07/26 21:18:43 1.7 *************** *** 175,178 **** --- 175,192 ---- + <!-- Template for dealing with C++ reserved words. + --> + + + <xsl:template name="reserved-word-processing"> + <xsl:param name="the_word"/> + <!-- Hack!! Note this is incomplete. :-) --> + <xsl:if test='$the_word = "namespace" or $the_word = "template"'> + <xsl:text>_cxx_</xsl:text> + </xsl:if> + <xsl:value-of select="$the_word"/> + </xsl:template> + + <!-- Template for mangling names. Special care must be taken to process idl_substitute name tags. *************** *** 302,305 **** --- 316,394 ---- <xsl:template match="Model:Class" mode="type_name"> + + <xsl:variable name="package_name"> + <xsl:call-template name="toName"> + <xsl:with-param name="text"> + <xsl:value-of select="ancestor::Model:Package/@name"/> + </xsl:with-param> + <xsl:with-param name="position" select="1"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="class_name"> + <xsl:call-template name="get_name"> + <xsl:with-param name="the_xmi_id"> + <xsl:value-of select="@xmi.id"/> + </xsl:with-param> + <xsl:with-param name="the_name"> + <xsl:value-of select="@name"/> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:value-of select="$package_name"/> + <xsl:text>::</xsl:text> + <xsl:value-of select="$class_name"/> + <xsl:text>_ptr</xsl:text> + + </xsl:template> + + + <!-- Templates for finding CORBA IDL set type implementations. --> + <!-- These use the type_set_name mode and setup the CORBA_set_type variable. --> + + + <xsl:template + match="Model:DataType.typeCode | XMI.CorbaTypeCode" + mode="type_set_name"> + <xsl:apply-templates mode="type_set_name"/> + </xsl:template> + + + <xsl:template match="XMI.CorbaTcBoolean" mode="type_set_name"> + <xsl:text>CORBA::Boolean</xsl:text> + </xsl:template> + + + <xsl:template match="XMI.CorbaTcString" mode="type_set_name"> + <xsl:text>Core::String</xsl:text> + </xsl:template> + + + <xsl:template match="XMI.CorbaTcAlias" mode="type_set_name"> + + <xsl:variable name="package_name"> + <xsl:call-template name="toName"> + <xsl:with-param name="text"> + <xsl:value-of select="ancestor::Model:Package/@name"/> + </xsl:with-param> + <xsl:with-param name="position" select="1"/> + </xsl:call-template> + </xsl:variable> + + <!-- xsl:value-of select="$package_name"/ --> + <xsl:text>Core::</xsl:text> + <xsl:value-of select="@xmi.tcName"/> + + </xsl:template> + + + <xsl:template match="XMI.CorbaTcEnum" mode="type_set_name"> + <xsl:text>DataTypes::</xsl:text> + <xsl:value-of select="@xmi.tcName"/> + </xsl:template> + + + <xsl:template match="Model:Class" mode="type_set_name"> <xsl:variable name="package_name"> Index: gen_class_ccs.xsl =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/uml/tools/gen_class_ccs.xsl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** gen_class_ccs.xsl 2001/07/21 23:01:33 1.5 --- gen_class_ccs.xsl 2001/07/26 21:18:43 1.6 *************** *** 155,158 **** --- 155,170 ---- select="./Model:StructuralFeature.multiplicity/XMI.field[position()=4]"/> + <!-- Define the value of the CORBA_type variable by applying templates + in the type_name mode to the descendant of the root node whos xmi.id + attribute matches type_ref. + --> + <xsl:variable name="CORBA_set_type"> + <xsl:if test="$upper = -1 or $upper > 1"> + <xsl:apply-templates + select='/descendant::*[@xmi.id=$type_ref]' + mode="type_set_name"/> + </xsl:if> + </xsl:variable> + <xsl:if test='$lower=0 and $upper=1'> *************** *** 243,255 **** --> ! <xsl:value-of select="$CORBA_type"/> ! <xsl:text> </xsl:text> <xsl:value-of select="$attr_name"/> <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> --- 255,269 ---- --> ! <xsl:value-of select="$CORBA_set_type"/> ! <xsl:text>Set* </xsl:text> <xsl:value-of select="$attr_name"/> <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> *************** *** 294,298 **** <xsl:value-of select="$attr_name"/> <xsl:text>( const </xsl:text> ! <xsl:value-of select="$CORBA_type"/> <xsl:text>Set& new_value ) </xsl:text> --- 308,312 ---- <xsl:value-of select="$attr_name"/> <xsl:text>( const </xsl:text> ! <xsl:value-of select="$CORBA_set_type"/> <xsl:text>Set& new_value ) </xsl:text> *************** *** 366,370 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> --- 380,384 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> *************** *** 420,424 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> --- 434,438 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> *************** *** 446,450 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> --- 460,464 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> *************** *** 470,474 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> --- 484,488 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> *************** *** 493,497 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> --- 507,511 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> *************** *** 531,538 **** </xsl:variable> <xsl:variable name="ref_name"> <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"/> --- 545,563 ---- </xsl:variable> + <xsl:variable name="reference"> + <xsl:call-template name="get_name"> + <xsl:with-param name="the_xmi_id"> + <xsl:value-of select="@xmi.id"/> + </xsl:with-param> + <xsl:with-param name="the_name"> + <xsl:value-of select="@name"/> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="ref_name"> <xsl:call-template name="to_name"> <xsl:with-param name="text"> ! <xsl:value-of select="$reference"/> </xsl:with-param> <xsl:with-param name="position" select="1"/> *************** *** 653,657 **** <xsl:value-of select="$class_name"/> <xsl:text>_impl::</xsl:text> ! <xsl:value-of select="$ref_name"/> <xsl:text>() </xsl:text> --- 678,688 ---- <xsl:value-of select="$class_name"/> <xsl:text>_impl::</xsl:text> ! ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> ! <xsl:text>() </xsl:text> *************** *** 676,680 **** <xsl:text> return assoc_proxy-></xsl:text> ! <xsl:value-of select="$ref_name"/> <xsl:text>( _this() ); </xsl:text> --- 707,717 ---- <xsl:text> return assoc_proxy-></xsl:text> ! ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> ! <xsl:text>( _this() ); </xsl:text> *************** *** 697,701 **** <xsl:value-of select="$class_name"/> <xsl:text>_impl::</xsl:text> ! <xsl:value-of select="$ref_name"/> <xsl:text>() </xsl:text> --- 734,744 ---- <xsl:value-of select="$class_name"/> <xsl:text>_impl::</xsl:text> ! ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> ! <xsl:text>() </xsl:text> *************** *** 718,722 **** <xsl:text> return assoc_proxy-></xsl:text> ! <xsl:value-of select="$ref_name"/> <xsl:text>( _this() ); </xsl:text> --- 761,771 ---- <xsl:text> return assoc_proxy-></xsl:text> ! ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> ! <xsl:text>( _this() ); </xsl:text> *************** *** 740,744 **** <xsl:value-of select="$class_name"/> <xsl:text>_impl::</xsl:text> ! <xsl:value-of select="$ref_name"/> <xsl:text>() </xsl:text> --- 789,799 ---- <xsl:value-of select="$class_name"/> <xsl:text>_impl::</xsl:text> ! ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> ! <xsl:text>() </xsl:text> *************** *** 807,814 **** <xsl:text> assoc_proxy->modify_</xsl:text> <xsl:value-of select="$ref_name"/> ! <xsl:text>( _this()-></xsl:text> ! <xsl:value-of select="$ref_name"/> ! <xsl:text>(), _this(), new_value ); </xsl:text> <xsl:text>} </xsl:text> --- 862,895 ---- <xsl:text> assoc_proxy->modify_</xsl:text> <xsl:value-of select="$ref_name"/> ! ! <xsl:choose> ! <xsl:when test='$end_a_or_b = "A_END"'> ! ! <xsl:text>( _this()-></xsl:text> ! ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> ! ! <xsl:text>(), _this(), new_value ); </xsl:text> + </xsl:when> + <xsl:otherwise> + + <xsl:text>( _this(), _this()-></xsl:text> + + <xsl:call-template name="reserved-word-processing"> + <xsl:with-param name="the_word"> + <xsl:value-of select="$ref_name"/> + </xsl:with-param> + </xsl:call-template> + + <xsl:text>(), new_value ); </xsl:text> + + </xsl:otherwise> + </xsl:choose> + <xsl:text>} </xsl:text> Index: gen_class_hs.xsl =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/uml/tools/gen_class_hs.xsl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** gen_class_hs.xsl 2001/06/18 22:57:27 1.4 --- gen_class_hs.xsl 2001/07/26 21:18:43 1.5 *************** *** 356,365 **** <!-- Define the value of the CORBA_type variable by applying templates ! in the type_name mode to the Model:DataType.typeCode child of a ! Model:DataType descendant of the root node whos xmi.id attribute ! matches type_ref. --> <xsl:variable name="CORBA_type"> ! <xsl:apply-templates select='/descendant::*[@xmi.id=$type_ref]' mode="type_name"/> </xsl:variable> --- 356,366 ---- <!-- Define the value of the CORBA_type variable by applying templates ! in the type_name mode to the descendant of the root node whos xmi.id ! attribute matches type_ref. --> <xsl:variable name="CORBA_type"> ! <xsl:apply-templates ! select='/descendant::*[@xmi.id=$type_ref]' ! mode="type_name"/> </xsl:variable> *************** *** 376,379 **** --- 377,393 ---- select="./Model:StructuralFeature.multiplicity/XMI.field[position()=4]"/> + <!-- Define the value of the CORBA_type variable by applying templates + in the type_name mode to the descendant of the root node whos xmi.id + attribute matches type_ref. + --> + <xsl:variable name="CORBA_set_type"> + <xsl:if test="$upper = -1 or $upper > 1"> + <xsl:apply-templates + select='/descendant::*[@xmi.id=$type_ref]' + mode="type_set_name"/> + </xsl:if> + </xsl:variable> + + <xsl:if test='$lower=0 and $upper=1'> *************** *** 428,437 **** <xsl:text> </xsl:text> ! <xsl:value-of select="$CORBA_type"/> ! <xsl:text> </xsl:text> <xsl:value-of select="$attr_name"/> <xsl:text>() </xsl:text> ! <xsl:text> throw(; </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> --- 442,451 ---- <xsl:text> </xsl:text> ! <xsl:value-of select="$CORBA_set_type"/> ! <xsl:text>Set* </xsl:text> <xsl:value-of select="$attr_name"/> <xsl:text>() </xsl:text> ! <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> *************** *** 476,480 **** <xsl:value-of select="$attr_name"/> <xsl:text>( const </xsl:text> ! <xsl:value-of select="$CORBA_type"/> <xsl:text>Set& new_value ) </xsl:text> --- 490,494 ---- <xsl:value-of select="$attr_name"/> <xsl:text>( const </xsl:text> ! <xsl:value-of select="$CORBA_set_type"/> <xsl:text>Set& new_value ) </xsl:text> *************** *** 545,549 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> --- 559,563 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> *************** *** 596,600 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> --- 610,614 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> *************** *** 621,625 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> --- 635,639 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> *************** *** 644,648 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> --- 658,662 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> *************** *** 666,670 **** <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound,; </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> --- 680,684 ---- <xsl:text> throw( </xsl:text> <xsl:text> ::CORBA::SystemException, </xsl:text> ! <xsl:text> ::Reflective::NotFound, </xsl:text> <xsl:text> ::Reflective::MofError) </xsl:text> <xsl:text> ; </xsl:text> *************** *** 774,783 **** <xsl:text>_ptr </xsl:text> ! <!-- Hack!! Deal with C++ reserved words (ahem) --> ! <xsl:if test='$ref_name = "namespace"'> ! <xsl:text>_cxx_</xsl:text> ! </xsl:if> - <xsl:value-of select="$ref_name"/> <xsl:text>() </xsl:text> --- 788,797 ---- <xsl:text>_ptr </xsl:text> ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> <xsl:text>() </xsl:text> *************** *** 803,807 **** <xsl:value-of select="$type_name"/> <xsl:text>_ptr </xsl:text> ! <xsl:value-of select="$ref_name"/> <xsl:text>() </xsl:text> --- 817,827 ---- <xsl:value-of select="$type_name"/> <xsl:text>_ptr </xsl:text> ! ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> ! <xsl:text>() </xsl:text> *************** *** 828,832 **** <xsl:text>Set* </xsl:text> ! <xsl:value-of select="$ref_name"/> <xsl:text>() </xsl:text> --- 848,857 ---- <xsl:text>Set* </xsl:text> ! <xsl:call-template name="reserved-word-processing"> ! <xsl:with-param name="the_word"> ! <xsl:value-of select="$ref_name"/> ! </xsl:with-param> ! </xsl:call-template> ! <xsl:text>() </xsl:text> Index: gen_proxy_hs.xsl =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/uml/tools/gen_proxy_hs.xsl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** gen_proxy_hs.xsl 2001/06/18 22:57:27 1.8 --- gen_proxy_hs.xsl 2001/07/26 21:18:43 1.9 *************** *** 127,131 **** <xsl:template ! match="Model:DataType | Model:DataType.typeCode | XMI.CorbaTcAlias | XMI.CorbaTypeCode" mode="create_param_type_name"> <xsl:param name="collection"/> --- 127,131 ---- <xsl:template ! match="Model:DataType | Model:DataType.typeCode | XMI.CorbaTypeCode" mode="create_param_type_name"> <xsl:param name="collection"/> *************** *** 146,150 **** ! <xsl:template match="XMI.CorbaTcString" mode="create_param_type_name"> <xsl:param name="collection"/> --- 146,150 ---- ! <xsl:template match="XMI.CorbaTcAlias" mode="create_param_type_name"> <xsl:param name="collection"/> *************** *** 158,162 **** </xsl:variable> ! <xsl:variable name="type_name" select="ancestor::Model:DataType/@name"/> <xsl:choose> --- 158,162 ---- </xsl:variable> ! <xsl:variable name="type_name" select="@xmi.tcName"/> <xsl:choose> *************** *** 176,179 **** --- 176,186 ---- + <!-- If we got this far it must be xmi.id='a23' name='String' --> + <xsl:template match="XMI.CorbaTcString" mode="create_param_type_name"> + <xsl:param name="collection"/> + <xsl:text>const char*</xsl:text> + </xsl:template> + + <xsl:template match="XMI.CorbaTcEnum" mode="create_param_type_name"> <xsl:param name="collection"/> *************** *** 207,211 **** <xsl:param name="collection"/> ! <xsl:variable name="package_name" select="ancestor::Model:Package/@name"/> <xsl:variable name="class_name"> --- 214,225 ---- <xsl:param name="collection"/> ! <xsl:variable name="package_name"> ! <xsl:call-template name="toName"> ! <xsl:with-param name="text"> ! <xsl:value-of select="ancestor::Model:Package/@name"/> ! </xsl:with-param> ! <xsl:with-param name="position" select="1"/> ! </xsl:call-template> ! </xsl:variable> <xsl:variable name="class_name"> *************** *** 233,237 **** <xsl:value-of select="$class_name"/> ! <xsl:value-of select="$collection"/> </xsl:template> --- 247,258 ---- <xsl:value-of select="$class_name"/> ! <xsl:choose> ! <xsl:when test='not(string-length($collection) = 0)'> ! <xsl:value-of select="$collection"/> ! </xsl:when> ! <xsl:otherwise> ! <xsl:text>_ptr</xsl:text> ! </xsl:otherwise> ! </xsl:choose> </xsl:template> |