1
1

This stuff has been outdated for years -- might as well remove it (it

isn't included in the tarball and was only used to generate the
initial f90 scripts -- we've moved well beyond this XML by updating
the scripts without also updating the corresponding XML).

This commit was SVN r23670.
Этот коммит содержится в:
Jeff Squyres 2010-08-26 11:38:38 +00:00
родитель 271cfa8c9a
Коммит 60dacba04e
16 изменённых файлов: 0 добавлений и 16611 удалений

Просмотреть файл

@ -1,312 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- chasm-mpi.f90.xsl: creates F90 functions that call MPI equivalent
-
- Output should be directed to the file, Method_f90.f90
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="common.xsl"/>
<xsl:import href="common-C.xsl"/>
<xsl:import href="common-f90.xsl"/>
<xsl:output method="text"/>
<!-- global variables -->
<xsl:param name="test_function" select="unknown_function"/>
<!--
- root level
-->
<xsl:template match="/">
<xsl:call-template name="openFile"/>
<xsl:apply-templates select="/library/scope/method[@name=$test_function]"/>
<xsl:call-template name="closeFile"/>
</xsl:template>
<!--
- method level: define C test function>
-->
<xsl:template match="method">
<xsl:call-template name="compound-statement"/>
</xsl:template>
<!--
- param-id-list <method>
-->
<xsl:template name="param-id-list">
<xsl:param name="module"/>
<xsl:for-each select="arg">
<xsl:call-template name="param-decl">
<xsl:with-param name="id" select="@name"/>
</xsl:call-template>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="return/@name= 'ierr'">
<xsl:text>, int* ierr</xsl:text>
</xsl:if>
</xsl:template>
<!--
- compound-statement <method>
- decl-list statement-list
-->
<xsl:template name="statement-list">
<xsl:param name="function_id">
<xsl:call-template name="function-id"/>
</xsl:param>
<xsl:param name="ws" select="' '"/>
<xsl:if test="return/@name = 'ierr'">
<xsl:value-of select="concat($ws, '*ierr = 0;', $nl)"/>
</xsl:if>
<xsl:for-each select="arg">
<xsl:call-template name="type-spec-if-stmt"/>
</xsl:for-each>
</xsl:template>
<!--
- type-spec-if-stmt <arg>
-->
<xsl:template name="type-spec-if-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:variable name="name">
<xsl:call-template name="alias"/>
</xsl:variable>
<xsl:variable name="i" select="concat('i', position())"/>
<xsl:variable name="a" select="concat('a', position())"/>
<xsl:if test="type/@kind = 'ptr'">
<xsl:choose>
<xsl:when test="type/indirect/type/@ikind = 'char'"/>
<xsl:otherwise>
<xsl:value-of select="concat($ws, 'if ')"/>
<xsl:for-each select="type[1]">
<xsl:call-template name="type-spec-if-expr"/>
</xsl:for-each>
<xsl:value-of select="concat(' *ierr = 1;', $nl)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:for-each select="type[1]">
<xsl:choose>
<xsl:when test="@kind = 'ptr'">
<xsl:if test="indirect/type/@ikind = 'char'">
<xsl:if test="@alias">
<xsl:value-of select="concat($ws, 'if (STR_LEN != ')"/>
<xsl:value-of select="concat(@alias, ') *ierr = 1;', $nl)"/>
</xsl:if>
<xsl:value-of select="concat($ws, 'if (strncmp(', $name)"/>
<xsl:text>, STR_VAL, STR_LEN) != 0)</xsl:text>
<xsl:value-of select="concat(' *ierr = 1;', $nl)"/>
</xsl:if>
</xsl:when>
<xsl:when test="@kind = 'array'">
<xsl:if test="array/@rank = 1">
<xsl:value-of select="concat(' for (', $i, ' = 0; ')"/>
<xsl:value-of select="concat($i, ' &lt; ARRAY_LEN1D; ')"/>
<xsl:value-of select="concat($i, '++)', $nl)"/>
<xsl:value-of select="concat(' if (', $name, '[', $i, ']')"/>
<xsl:value-of select="concat(' != ', $a, '[', $i, '])')"/>
<xsl:value-of select="concat(' *ierr = 1;', $nl)"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($ws, 'if ')"/>
<xsl:call-template name="type-spec-if-expr"/>
<xsl:value-of select="concat(' *ierr = 1;', $nl)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!--
- decl-list-decl-rtn ([rtn_id=rtn-id, ws=' ']) <return/type>
-->
<xsl:template name="decl-list-decl-rtn">
</xsl:template>
<!--
- decl-list-decl-arg ([arg_id=arg-id, ws=' ']) <arg/type>
-->
<xsl:template name="decl-list-decl-arg">
<xsl:if test="@kind = 'array'">
<xsl:if test="array/@rank = 1">
<xsl:value-of select="concat(' int i', position(), ';', $nl)"/>
<xsl:value-of select="concat(' int a', position())"/>
<xsl:value-of select="concat('[] = ARRAY_VAL1D;', $nl)"/>
</xsl:if>
</xsl:if>
</xsl:template>
<!--
- type-spec-if-expr <type>
-->
<xsl:template name="type-spec-if-expr">
<xsl:param name="depth" select="0"/>
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="../@alias">
<xsl:value-of select="../@alias"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$depth = 0">
<xsl:value-of select="concat('(*', $name)"/>
</xsl:if>
<xsl:choose>
<!-- idl types (annotate xml to specify what this type is) -->
<xsl:when test="@idl = 'MPI_Aint'">
<xsl:text> != MPI_AINT_VAL)</xsl:text>
</xsl:when>
<xsl:when test="@idl = 'MPI_Fint'">
<xsl:text> != INT_VAL)</xsl:text>
</xsl:when>
<!-- C++ types -->
<xsl:when test="@kind = 'void'">
<xsl:text> != VOID_VAL)</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'bool'">
<xsl:text> != INT_VAL)</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'int'">
<xsl:choose>
<xsl:when test="@ikind = 'int'">
<xsl:text> != INT_VAL)</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'char'">
<xsl:if test="../../@kind != 'ptr'">
<xsl:text> != CHAR_VAL)</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:text> != UNSUPPORTED_VAL)</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:text> != FLOAT_VAL)</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:for-each select="indirect[1]/type[1]">
<xsl:call-template name="type-spec-if-expr">
<xsl:with-param name="depth" select="indirect/@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'array'"/>
<xsl:when test="@kind = 'ref'">
<xsl:text> != REF_VAL)</xsl:text>
<xsl:for-each select="indirect/type">
<xsl:call-template name="type-spec">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="@usertype = 'MPI_Aint'">
<xsl:text> != MPI_AINT_VAL)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'int64_t'">
<xsl:text> != INT64_VAL)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Status'">
<xsl:text> != STATUS_VAL)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:param name="prefix" select="substring-before(@usertype, '_')"/>
<xsl:if test="$prefix = 'MPI'">
<xsl:text> != USER_INT_VAL)</xsl:text>
</xsl:if>
<xsl:if test="$prefix != 'MPI'">
<xsl:text> != UNSUPPORTED_VAL)</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text> != UNSUPPORTED_VAL</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- type-spec-rtn <return/type>
-->
<xsl:template name="type-spec-rtn">
<xsl:if test="../@name = 'ierr'">
<xsl:text>void</xsl:text>
</xsl:if>
</xsl:template>
<!--
- alias : choose alias or name if no alias
-->
<xsl:template name="alias">
<xsl:choose>
<xsl:when test="@alias">
<xsl:value-of select="@alias"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- openFile: print file header information
-->
<xsl:template name="openFile">
<xsl:param name="filename" select="''"/>
</xsl:template>
<!--
- closeFile: finish up
-->
<xsl:template name="closeFile">
<xsl:param name="filename" select="''"/>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,559 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- chasm-mpi.f90.xsl: creates F90 functions that call MPI equivalent
-
- Output should be directed to the file, Method_f90.f90
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="common.xsl"/>
<xsl:import href="common-C.xsl"/>
<xsl:import href="common-f90.xsl"/>
<xsl:output method="text"/>
<!-- global variables -->
<xsl:param name="test_function" select="unknown_function"/>
<!--
- root level
-->
<xsl:template match="/">
<xsl:call-template name="openFile"/>
<xsl:apply-templates select="/library/scope/method[@name=$test_function]"/>
<xsl:call-template name="closeFile"/>
</xsl:template>
<!--
- method level: define program to call Fortran procedures>
-->
<xsl:template match="method">
<xsl:choose>
<xsl:when test="@template = 'yes'">
<xsl:call-template name="defineArrayFunctionBody"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="defineFunctionBody"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- defineFunctionBody
-->
<xsl:template name="defineFunctionBody">
<xsl:call-template name="decl-construct-list"/>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> integer :: ierr</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:if>
</xsl:for-each>
<xsl:call-template name="assign-stmt-list"/>
<xsl:call-template name="call-stmt"/>
</xsl:template>
<!--
- defineArrayFunctionBody
-->
<xsl:template name="defineArrayFunctionBody">
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
echo
done
echo
</xsl:text>
</xsl:template>
<!--
- call-or-assign <return/type>
-->
<xsl:template name="call-or-assign">
<xsl:text>call </xsl:text>
</xsl:template>
<!--
- act-arg-spec-list <method>
-->
<xsl:template name="act-arg-spec-list">
<xsl:for-each select="arg">
<xsl:value-of select="@name"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:if test="../arg[1]">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:text>ierr</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- arg-list <method>
-->
<xsl:template name="arg-list">
<xsl:for-each select="arg">
<xsl:value-of select="@name"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="position() = 5">
<xsl:text>&amp;</xsl:text>
<xsl:value-of select="concat($nl, ' ')"/>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:if test="../arg[1]">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@name"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- decl-construct-list <method>
-->
<xsl:template name="decl-construct-list">
<xsl:param name="ws" select="' '"/>
<xsl:for-each select="arg">
<xsl:call-template name="type-decl-stmt">
<xsl:with-param name="ws" select="$ws"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- type-decl-stmt <arg>
-->
<xsl:template name="type-decl-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:for-each select="type[1]">
<xsl:choose>
<xsl:when test="@idl = 'choice'">
<xsl:call-template name="type-decl-stmt-choice">
<xsl:with-param name="arg" select="../@name"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$ws"/>
<xsl:call-template name="decl-type-spec"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:value-of select="concat(' :: ', @name)"/>
<xsl:for-each select="type[1]">
<xsl:call-template name="type-spec-assign-val"/>
</xsl:for-each>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- decl-type-spec <arg>
-->
<xsl:template name="decl-type-spec">
<xsl:choose>
<!-- idl types (annotate xml to specify what this type is) -->
<xsl:when test="@idl = 'MPI_Aint'">
<xsl:text>integer(kind=MPI_ADDRESS_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@idl = 'MPI_Fint'">
<xsl:text>integer</xsl:text>
</xsl:when>
<!-- C++ types -->
<xsl:when test="@kind = 'void'">
<xsl:choose>
<xsl:when test="../../../../@template = 'yes'">
<xsl:text>integer(kind=MPI_INTEGER${kind}_KIND)</xsl:text>
<xsl:text>, dimension(${dim})</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>integer</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'bool'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'int'">
<xsl:choose>
<xsl:when test="@ikind = 'int'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'char'">
<xsl:text>character</xsl:text>
<xsl:if test="../../@kind = 'ptr'">
<xsl:text>(len=STR_LEN)</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:for-each select="indirect[1]/type[1]">
<xsl:call-template name="decl-type-spec"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'array'">
<xsl:for-each select="array[1]/type[1]">
<xsl:call-template name="decl-type-spec"/>
</xsl:for-each>
<xsl:text>, dimension(</xsl:text>
<xsl:for-each select="array[1]/dimension">
<xsl:text>ARRAY_LEN</xsl:text>
<xsl:value-of select="position()"/> <xsl:text>D</xsl:text>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ref'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="type-spec">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="@usertype = 'MPI_Aint'">
<xsl:text>integer(kind=MPI_ADDRESS_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'int64_t'">
<xsl:text>integer(kind=MPI_OFFSET_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Status'">
<xsl:text>integer, dimension(MPI_STATUS_SIZE)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Comm_errhandler_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Comm_copy_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Comm_delete_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Handler_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_File_errhandler_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Grequest_query_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Grequest_free_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Grequest_cancel_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Copy_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Delete_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_User_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Datarep_conversion_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Datarep_extent_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Type_copy_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Type_delete_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Win_errhandler_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Win_copy_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Win_delete_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:param name="prefix" select="substring-before(@usertype, '_')"/>
<xsl:if test="$prefix = 'MPI'">
<xsl:text>integer</xsl:text>
</xsl:if>
<xsl:if test="$prefix != 'MPI'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- type-decl-stmt-choice <type>
-->
<xsl:template name="type-decl-stmt-choice">
<xsl:param name="arg"/>
<xsl:text> integer(kind=MPI_INTEGER4_KIND), dimension(8) :: </xsl:text>
<xsl:value-of select="$arg"/> <xsl:text>1DI4
integer(kind=MPI_INTEGER4_KIND), dimension(2,4) :: </xsl:text>
<xsl:value-of select="$arg"/> <xsl:text>2DI4
integer(kind=MPI_INTEGER4_KIND), dimension(2,1,4) :: </xsl:text>
<xsl:value-of select="$arg"/> <xsl:text>3DI4
integer(kind=MPI_INTEGER4_KIND), dimension(2,1,1,4) :: </xsl:text>
<xsl:value-of select="$arg"/> <xsl:text>4DI4
integer(kind=MPI_INTEGER4_KIND), dimension(2,1,1,1,4) :: </xsl:text>
<xsl:value-of select="$arg"/> <xsl:text>5DI4
integer(kind=MPI_INTEGER4_KIND), dimension(2,1,1,1,1,4) :: </xsl:text>
<xsl:value-of select="$arg"/> <xsl:text>6DI4
integer(kind=MPI_INTEGER4_KIND), dimension(2,1,1,1,1,1,4) :: </xsl:text>
<xsl:value-of select="$arg"/> <xsl:text>7DI4</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- type-spec-assign-val <type>
-->
<xsl:template name="type-spec-assign-val">
<xsl:choose>
<!-- idl types (annotate xml to specify what this type is) -->
<xsl:when test="@idl = 'MPI_Aint'">
<xsl:text> = MPI_AINT_VAL</xsl:text>
</xsl:when>
<xsl:when test="@idl = 'MPI_Fint'">
<xsl:text> = INT_VAL</xsl:text>
</xsl:when>
<!-- C++ types -->
<xsl:when test="@kind = 'void'">
<xsl:text> = VOID_VAL</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'bool'">
<xsl:text> = INT_VAL</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'int'">
<xsl:choose>
<xsl:when test="@ikind = 'int'">
<xsl:text> = INT_VAL</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'char'">
<xsl:if test="../../@kind != 'ptr'">
<xsl:text> = CHAR_VAL</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:text> = UNSUPPORTED_VAL</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:text> = FLOAT_VAL</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:for-each select="indirect[1]/type[1]">
<xsl:call-template name="type-spec-assign-val"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'array'"/>
<xsl:when test="@kind = 'ref'">
<xsl:text> = REF_VAL</xsl:text>
<xsl:for-each select="indirect/type">
<xsl:call-template name="type-spec">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="@usertype = 'MPI_Aint'">
<xsl:text> = MPI_AINT_VAL</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'int64_t'">
<xsl:text> = INT64_VAL</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Status'">
<xsl:text> = STATUS_VAL</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Comm_errhandler_function'"/>
<xsl:when test="@usertype = 'MPI_Comm_copy_attr_function'"/>
<xsl:when test="@usertype = 'MPI_Comm_delete_attr_function'"/>
<xsl:when test="@usertype = 'MPI_Handler_function'"/>
<xsl:when test="@usertype = 'MPI_File_errhandler_function'"/>
<xsl:when test="@usertype = 'MPI_Grequest_query_function'"/>
<xsl:when test="@usertype = 'MPI_Grequest_free_function'"/>
<xsl:when test="@usertype = 'MPI_Grequest_cancel_function'"/>
<xsl:when test="@usertype = 'MPI_Copy_function'"/>
<xsl:when test="@usertype = 'MPI_Delete_function'"/>
<xsl:when test="@usertype = 'MPI_User_function'"/>
<xsl:when test="@usertype = 'MPI_Datarep_conversion_function'"/>
<xsl:when test="@usertype = 'MPI_Datarep_extent_function'"/>
<xsl:when test="@usertype = 'MPI_Type_copy_attr_function'"/>
<xsl:when test="@usertype = 'MPI_Type_delete_attr_function'"/>
<xsl:when test="@usertype = 'MPI_Win_errhandler_function'"/>
<xsl:when test="@usertype = 'MPI_Win_copy_attr_function'"/>
<xsl:when test="@usertype = 'MPI_Win_delete_attr_function'"/>
<xsl:otherwise>
<xsl:param name="prefix" select="substring-before(@usertype, '_')"/>
<xsl:if test="$prefix = 'MPI'">
<xsl:text> = USER_INT_VAL</xsl:text>
</xsl:if>
<xsl:if test="$prefix != 'MPI'">
<xsl:text> = UNSUPPORTED_VAL</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text> = UNSUPPORTED_VAL</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- assign-stmt <arg>
-->
<xsl:template name="assign-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:choose>
<xsl:when test="type/indirect/type/@ikind = 'char'">
<xsl:value-of select="$ws"/>
<xsl:value-of select="concat(@name, ' = STR_VAL')"/>
<xsl:value-of select="$nl"/>
</xsl:when>
<xsl:when test="type/@kind = 'array'">
<xsl:value-of select="$ws"/>
<xsl:value-of select="concat(@name, ' = ARRAY_VAL')"/>
<xsl:for-each select="type/array[1]/dimension">
<xsl:if test="position() = last()">
<xsl:value-of select="last()"/>
</xsl:if>
</xsl:for-each>
<xsl:text>D</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!--
- openFile: print file header information
-->
<xsl:template name="openFile">
<xsl:param name="filename" select="''"/>
<xsl:text>!</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>! Fortran program to test F90 interface to C function </xsl:text>
<xsl:value-of select="$test_function"/>
<xsl:value-of select="$nl"/>
<xsl:text>!</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>program main</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> use mpi</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> implicit none</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> include 'F90TestValues.h'</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- closeFile: finish up
-->
<xsl:template name="closeFile">
<xsl:param name="filename" select="''"/>
<xsl:text> if (ierr /= 0) print *, "ERROR running </xsl:text>
<xsl:value-of select="$test_function"/> <xsl:text>"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>end program</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,511 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- chasm-mpi.f90.xsl: creates F90 functions that call MPI equivalent
-
- Output should be directed to the file, Method_f90.f90
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="common.xsl"/>
<xsl:import href="common-C.xsl"/>
<xsl:import href="common-f90.xsl"/>
<xsl:output method="text"/>
<!-- global variables -->
<xsl:param name="test_function" select="unknown_function"/>
<xsl:param name="interface_size" select="medium"/>
<xsl:variable name="filename">
<xsl:call-template name="lower-case">
<xsl:with-param name="symbol" select="/library/scope/@name"/>
</xsl:call-template>
<xsl:text>_C.c</xsl:text>
</xsl:variable>
<xsl:variable name="header_file">
<xsl:call-template name="lower-case">
<xsl:with-param name="symbol" select="/library/scope/@name"/>
</xsl:call-template>
<xsl:text>_C.h</xsl:text>
</xsl:variable>
<!--
- root level
-->
<xsl:template match="/">
<xsl:call-template name="openFile">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
<!-- output all include files -->
<xsl:call-template name="include-files">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
<!-- define C bridging functions -->
<xsl:apply-templates select="/library/scope/method[@name=$test_function]"/>
<!--xsl:for-each select="library/scope">
<xsl:call-template name="defineFunctions"/>
</xsl:for-each-->
<xsl:call-template name="closeFile">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
</xsl:template>
<!--
- method level: define program to call Fortran procedures>
-->
<xsl:template match="method">
<xsl:param name="module" select="../@name"/>
<xsl:value-of select="$nl"/>
<xsl:if test="@kind != 'No_F90'">
<xsl:if test="@template = 'yes'">
<xsl:call-template name="defineFunction"/>
</xsl:if>
</xsl:if>
</xsl:template>
<!--
- defineFunctions: define functions to call Fortran procedures <scope>
-->
<xsl:template name="defineFunctions">
<xsl:param name="module" select="@name"/>
<xsl:value-of select="$nl"/>
<xsl:for-each select="method">
<xsl:if test="@kind != 'No_F90'">
<xsl:if test="@template = 'yes'">
<xsl:call-template name="defineFunction"/>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- defineFunction: define function to call Fortran procedures <method>
-->
<xsl:template name="defineFunction">
<xsl:param name="method" select="@name"/>
<xsl:text>
output() {
procedure=$1</xsl:text>
<xsl:choose>
<xsl:when test="@alias != ''">
<xsl:text>
rank=$3
type=$5
proc="$2$3D$4"
</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>
rank=$2
type=$4
proc="$1$2D$3"
</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
cat &lt;&lt;EOF
</xsl:text>
<xsl:call-template name="defineArrayFunctionBody"/>
<xsl:text>
EOF
}
for rank in $allranks
do
case "$rank" in 0) dim='' ; esac
case "$rank" in 1) dim=', dimension(*)' ; esac
case "$rank" in 2) dim=', dimension(1,*)' ; esac
case "$rank" in 3) dim=', dimension(1,1,*)' ; esac
case "$rank" in 4) dim=', dimension(1,1,1,*)' ; esac
case "$rank" in 5) dim=', dimension(1,1,1,1,*)' ; esac
case "$rank" in 6) dim=', dimension(1,1,1,1,1,*)' ; esac
case "$rank" in 7) dim=', dimension(1,1,1,1,1,1,*)' ; esac
</xsl:text>
<xsl:text> output </xsl:text> <xsl:value-of select="@name"/>
<xsl:if test="@alias != ''">
<xsl:text> </xsl:text> <xsl:value-of select="@alias"/>
</xsl:if>
<xsl:text> ${rank} CH "character${dim}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> output </xsl:text> <xsl:value-of select="@name"/>
<xsl:if test="@alias != ''">
<xsl:text> </xsl:text> <xsl:value-of select="@alias"/>
</xsl:if>
<xsl:text> ${rank} L "logical${dim}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> for kind in $ikinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> output </xsl:text> <xsl:value-of select="@name"/>
<xsl:if test="@alias != ''">
<xsl:text> </xsl:text> <xsl:value-of select="@alias"/>
</xsl:if>
<xsl:text> ${rank} I${kind} "integer*${kind}${dim}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> done</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> for kind in $rkinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> output </xsl:text> <xsl:value-of select="@name"/>
<xsl:if test="@alias != ''">
<xsl:text> </xsl:text> <xsl:value-of select="@alias"/>
</xsl:if>
<xsl:text> ${rank} R${kind} "real*${kind}${dim}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> done</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> for kind in $ckinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> output </xsl:text> <xsl:value-of select="@name"/>
<xsl:if test="@alias != ''">
<xsl:text> </xsl:text> <xsl:value-of select="@alias"/>
</xsl:if>
<xsl:text> ${rank} C${kind} "complex*${kind}${dim}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> done</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>done</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- defineArrayFunctionBody
-->
<xsl:template name="defineArrayFunctionBody">
<xsl:text>subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> include "mpif-config.h"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="''"/>
<xsl:with-param name="void_type" select="'${type}'"/>
<xsl:with-param name="void_kind" select="''"/>
<xsl:with-param name="has_dim" select="0"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> integer, intent(out) :: ierr</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>end subroutine ${proc}</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- arg-list <method>
-->
<xsl:template name="arg-list">
<xsl:for-each select="arg">
<xsl:value-of select="@name"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="position() = 5">
<xsl:text>&amp;</xsl:text>
<xsl:value-of select="concat($nl, ' ')"/>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:if test="../arg[1]">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@name"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- decl-construct-list <method>
-->
<xsl:template name="decl-construct-list">
<xsl:param name="ws" select="' '"/>
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:for-each select="arg">
<xsl:call-template name="type-decl-stmt">
<xsl:with-param name="ws" select="$ws"/>
<xsl:with-param name="void_type" select="$void_type"/>
<xsl:with-param name="void_kind" select="$void_kind"/>
<xsl:with-param name="has_dim" select="$has_dim"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- type-decl-stmt <arg>
-->
<xsl:template name="type-decl-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:value-of select="$ws"/>
<xsl:text> </xsl:text>
<xsl:for-each select="type[1]">
<xsl:call-template name="decl-type-spec">
<xsl:with-param name="void_type" select="$void_type"/>
<xsl:with-param name="void_kind" select="$void_kind"/>
<xsl:with-param name="has_dim" select="$has_dim"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="type/@kind != 'void'">
<xsl:value-of select="concat(', intent(', @intent, ')')"/>
</xsl:if>
<xsl:value-of select="concat(' :: ', @name, $nl)"/>
</xsl:template>
<!--
- decl-type-spec <arg>
-->
<xsl:template name="decl-type-spec">
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'void'">
<xsl:value-of select="$void_type"/>
</xsl:when>
<xsl:when test="@kind = 'bool'">
<xsl:text>logical</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'int'">
<xsl:choose>
<xsl:when test="@ikind = 'int'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'char'">
<xsl:text>character</xsl:text>
<xsl:if test="../../@kind = 'ptr'">
<xsl:text>(len=*)</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:for-each select="indirect[1]/type[1]">
<xsl:call-template name="decl-type-spec">
<xsl:with-param name="void_type" select="$void_type"/>
<xsl:with-param name="void_kind" select="$void_kind"/>
<xsl:with-param name="has_dim" select="$has_dim"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'array'">
<xsl:for-each select="array[1]/type[1]">
<xsl:call-template name="decl-type-spec"/>
</xsl:for-each>
<xsl:text>, dimension(</xsl:text>
<xsl:for-each select="array[1]/dimension">
<xsl:value-of select="@extent"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ref'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="type-spec">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="@usertype = 'default_integer'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Aint'">
<xsl:text>integer(kind=MPI_ADDRESS_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'int64_t'">
<xsl:text>integer(kind=MPI_OFFSET_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Status'">
<xsl:text>integer, dimension(MPI_STATUS_SIZE)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:param name="prefix" select="substring-before(@usertype, '_')"/>
<xsl:if test="$prefix = 'MPI'">
<xsl:text>integer</xsl:text>
</xsl:if>
<xsl:if test="$prefix != 'MPI'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- copyright: print copyright
-->
<xsl:template name="copyright">
<xsl:text>
#
# Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
</xsl:text>
</xsl:template>
<!--
- info: print information about file
-->
<xsl:template name="info">
<xsl:text>
#
# This file generates a Fortran code to bridge between an explicit F90
# generic interface and the F77 implementation.
#
# This file is automatically generated by either of the scripts
# ../xml/create_mpi_f90_medium.f90.sh or
# ../xml/create_mpi_f90_large.f90.sh
#
</xsl:text>
</xsl:template>
<!--
- openFile: print file header information
-->
<xsl:template name="openFile">
<xsl:param name="filename" select="''"/>
<xsl:text>#! /bin/sh</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="copyright"/>
<xsl:call-template name="info"/>
<xsl:text>. "$1/fortran_kinds.sh"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:text># This entire file is only generated in medium/large </xsl:text>
<xsl:text>modules. So if</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text># we're not at least medium, bail now.</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:text>check_size </xsl:text> <xsl:value-of select="$interface_size"/>
<xsl:value-of select="$nl"/>
<xsl:text>if test "$output" = "0"; then</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> exit 0</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>fi</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:text># Ok, we should continue.</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:text>allranks="0 $ranks"</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- closeFile: finish up
-->
<xsl:template name="closeFile">
<xsl:param name="filename" select="''"/>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,657 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- chasm-mpi.f90.xsl: creates F90 functions that call MPI equivalent
-
- Output should be directed to the file, Method_f90.f90
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="common.xsl"/>
<xsl:import href="common-C.xsl"/>
<xsl:import href="common-f90.xsl"/>
<xsl:output method="text"/>
<!-- global variables -->
<xsl:param name="test_function" select="unknown_function"/>
<xsl:variable name="filename">
<xsl:call-template name="lower-case">
<xsl:with-param name="symbol" select="/library/scope/@name"/>
</xsl:call-template>
<xsl:text>_C.c</xsl:text>
</xsl:variable>
<xsl:variable name="header_file">
<xsl:call-template name="lower-case">
<xsl:with-param name="symbol" select="/library/scope/@name"/>
</xsl:call-template>
<xsl:text>_C.h</xsl:text>
</xsl:variable>
<!--
- root level
-->
<xsl:template match="/">
<xsl:call-template name="openFile">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
<!-- output all include files -->
<xsl:call-template name="include-files">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
<!-- define C bridging functions -->
<xsl:apply-templates select="/library/scope/method[@name=$test_function]"/>
<xsl:call-template name="closeFile">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
</xsl:template>
<!--
- method level: define program to call Fortran procedures>
-->
<xsl:template match="method">
<xsl:param name="module" select="../@name"/>
<xsl:value-of select="$nl"/>
<xsl:if test="@template = 'yes'">
<xsl:if test="@kind != 'No_F90'">
<xsl:value-of select="$nl"/>
<xsl:text>procedure='</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>'</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:call-template name="defineArrayFunctionBody"/>
<xsl:text>echo</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>echo</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
</xsl:if>
</xsl:if>
</xsl:template>
<!--
- defineFunctions: define functions to call Fortran procedures <scope>
-->
<xsl:template name="defineFunctions">
<xsl:param name="module" select="@name"/>
<xsl:value-of select="$nl"/>
<xsl:for-each select="method">
<xsl:if test="@kind != 'No_F90'">
<xsl:if test="@template = 'yes'">
<xsl:value-of select="$nl"/>
<xsl:text>procedure='</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>'</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:call-template name="defineArrayFunctionBody"/>
<xsl:text>echo</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>echo</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- defineFunctionBody
-->
<xsl:template name="defineFunctionBody">
<xsl:text>proc="${procedure}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="''"/>
<xsl:with-param name="void_type" select="''"/>
<xsl:with-param name="void_kind" select="''"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text>echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>
echo "end subroutine ${proc}"
echo
</xsl:text>
</xsl:template>
<!--
- defineArrayFunctionBody
-->
<xsl:template name="defineArrayFunctionBody">
<xsl:text>rank=0</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>for kind in $lkinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> proc="${procedure}${rank}DL${kind}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
<xsl:with-param name="void_type" select="'logical'"/>
<xsl:with-param name="void_kind" select="'INTEGER'"/>
<xsl:with-param name="has_dim" select="0"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> echo " call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
</xsl:text>
<xsl:text>rank=0</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>for kind in $ikinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> proc="${procedure}${rank}DI${kind}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
<xsl:with-param name="void_type" select="'integer'"/>
<xsl:with-param name="void_kind" select="'INTEGER'"/>
<xsl:with-param name="has_dim" select="0"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> echo " call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
</xsl:text>
<xsl:text>rank=0</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>for kind in $rkinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> proc="${procedure}${rank}DR${kind}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
<xsl:with-param name="void_type" select="'real'"/>
<xsl:with-param name="void_kind" select="'REAL'"/>
<xsl:with-param name="has_dim" select="0"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> echo " call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
</xsl:text>
<xsl:text>rank=0</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>for kind in $ckinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> proc="${procedure}${rank}DC${kind}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
<xsl:with-param name="void_type" select="'complex'"/>
<xsl:with-param name="void_kind" select="'REAL'"/>
<xsl:with-param name="has_dim" select="0"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> echo " call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
</xsl:text>
<xsl:text>
for rank in $ranks
do
case "$rank" in 1) dim='*' ; esac
case "$rank" in 2) dim='1,*' ; esac
case "$rank" in 3) dim='1,1,*' ; esac
case "$rank" in 4) dim='1,1,1,*' ; esac
case "$rank" in 5) dim='1,1,1,1,*' ; esac
case "$rank" in 6) dim='1,1,1,1,1,*' ; esac
case "$rank" in 7) dim='1,1,1,1,1,1,*' ; esac
</xsl:text>
<xsl:text> for kind in $lkinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> proc="${procedure}${rank}DL${kind}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
<xsl:with-param name="void_type" select="'logical'"/>
<xsl:with-param name="void_kind" select="'INTEGER'"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> echo " call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
</xsl:text>
<xsl:text> for kind in $ikinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> proc="${procedure}${rank}DI${kind}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
<xsl:with-param name="void_type" select="'integer'"/>
<xsl:with-param name="void_kind" select="'INTEGER'"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> echo " call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
</xsl:text>
<xsl:text> for kind in $rkinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> proc="${procedure}${rank}DR${kind}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
<xsl:with-param name="void_type" select="'real'"/>
<xsl:with-param name="void_kind" select="'REAL'"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> echo " call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
</xsl:text>
<xsl:text> for kind in $ckinds</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> do</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> proc="${procedure}${rank}DC${kind}"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo "subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> echo " use mpi_kinds"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="' '"/>
<xsl:with-param name="void_type" select="'complex'"/>
<xsl:with-param name="void_kind" select="'REAL'"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> echo " integer, intent(out) :: ierr"</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:text> echo " call ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)"</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>
echo "end subroutine ${proc}"
echo
done
done
</xsl:text>
</xsl:template>
<!--
- arg-list <method>
-->
<xsl:template name="arg-list">
<xsl:for-each select="arg">
<xsl:value-of select="@name"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="position() = 5">
<xsl:text>&amp;</xsl:text>
<xsl:value-of select="concat($nl, ' ')"/>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:if test="../arg[1]">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@name"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- decl-construct-list <method>
-->
<xsl:template name="decl-construct-list">
<xsl:param name="ws" select="' '"/>
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:for-each select="arg">
<xsl:call-template name="type-decl-stmt">
<xsl:with-param name="ws" select="$ws"/>
<xsl:with-param name="void_type" select="$void_type"/>
<xsl:with-param name="void_kind" select="$void_kind"/>
<xsl:with-param name="has_dim" select="$has_dim"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- type-decl-stmt <arg>
-->
<xsl:template name="type-decl-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:value-of select="$ws"/>
<xsl:text>echo " </xsl:text>
<xsl:for-each select="type[1]">
<xsl:call-template name="decl-type-spec">
<xsl:with-param name="void_type" select="$void_type"/>
<xsl:with-param name="void_kind" select="$void_kind"/>
<xsl:with-param name="has_dim" select="$has_dim"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="type/@kind != 'void'">
<xsl:value-of select="concat(', intent(', @intent, ')')"/>
</xsl:if>
<xsl:value-of select="concat(' :: ', @name, '&quot;', $nl)"/>
</xsl:template>
<!--
- decl-type-spec <arg>
-->
<xsl:template name="decl-type-spec">
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'void'">
<xsl:value-of select="$void_type"/>
<xsl:text>(kind=MPI_</xsl:text>
<xsl:value-of select="$void_kind"/>
<xsl:text>${kind}_KIND)</xsl:text>
<xsl:if test="$has_dim">
<xsl:text>, dimension(${dim})</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@kind = 'bool'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'int'">
<xsl:choose>
<xsl:when test="@ikind = 'int'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'char'">
<xsl:text>character</xsl:text>
<xsl:if test="../../@kind = 'ptr'">
<xsl:text>(len=*)</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:for-each select="indirect[1]/type[1]">
<xsl:call-template name="decl-type-spec"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'array'">
<xsl:for-each select="array[1]/type[1]">
<xsl:call-template name="decl-type-spec"/>
</xsl:for-each>
<xsl:text>, dimension(</xsl:text>
<xsl:for-each select="array[1]/dimension">
<xsl:value-of select="@extent"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ref'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="type-spec">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="@usertype = 'MPI_Aint'">
<xsl:text>integer(kind=MPI_ADDRESS_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'int64_t'">
<xsl:text>integer(kind=MPI_OFFSET_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Status'">
<xsl:text>integer, dimension(MPI_STATUS_SIZE)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:param name="prefix" select="substring-before(@usertype, '_')"/>
<xsl:if test="$prefix = 'MPI'">
<xsl:text>integer</xsl:text>
</xsl:if>
<xsl:if test="$prefix != 'MPI'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- openFile: print file header information
-->
<xsl:template name="openFile">
<xsl:param name="filename" select="''"/>
<xsl:text>#! /bin/sh</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:text>. fortran_kinds.sh</xsl:text>
</xsl:template>
<!--
- closeFile: finish up
-->
<xsl:template name="closeFile">
<xsl:param name="filename" select="''"/>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,723 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- chasm-mpi.f90.xsl: creates F90 functions that call MPI equivalent
-
- Output should be directed to the file, Method_f90.f90
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="common.xsl"/>
<xsl:import href="common-C.xsl"/>
<xsl:import href="common-f90.xsl"/>
<xsl:output method="text"/>
<!-- global variables -->
<xsl:variable name="filename">
<xsl:call-template name="lower-case">
<xsl:with-param name="symbol" select="/library/scope/@name"/>
</xsl:call-template>
<xsl:text>_C.c</xsl:text>
</xsl:variable>
<xsl:variable name="header_file">
<xsl:call-template name="lower-case">
<xsl:with-param name="symbol" select="/library/scope/@name"/>
</xsl:call-template>
<xsl:text>_C.h</xsl:text>
</xsl:variable>
<!--
- root level
-->
<xsl:template match="/">
<xsl:call-template name="openFile">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
<!-- output all include files -->
<xsl:call-template name="include-files">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
<!-- define C bridging functions -->
<xsl:for-each select="library/scope">
<xsl:call-template name="defineFunctions"/>
</xsl:for-each>
<xsl:call-template name="closeFile">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
</xsl:template>
<!--
- defineFunctions: define functions to call Fortran procedures <scope>
-->
<xsl:template name="defineFunctions">
<xsl:param name="module" select="@name"/>
<xsl:for-each select="method">
<xsl:if test="@kind != 'No_F90'">
<xsl:choose>
<xsl:when test="@template = 'yes'">
<xsl:call-template name="defineArrayFunctionBody"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="defineFunctionBody"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- defineFunctionBody
-->
<xsl:template name="defineFunctionBody">
<xsl:text>
#------------------------------------------------------------------------
output_</xsl:text> <xsl:number/> <xsl:text>() {
if test "$output" = "0"; then
return 0
fi
procedure=$1
cat &lt;&lt;EOF
</xsl:text>
<xsl:text>subroutine ${procedure}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> include 'mpif-config.h'</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="''"/>
<xsl:with-param name="void_type" select="''"/>
<xsl:with-param name="void_kind" select="''"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> integer, intent(out) :: ierr</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>
end subroutine ${procedure}
EOF
}
start </xsl:text>
<xsl:choose>
<xsl:when test="@interface != ''">
<xsl:value-of select="@interface"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:call-template name="interface-size"/>
<xsl:text>
output_</xsl:text> <xsl:number/> <xsl:text> </xsl:text>
<xsl:value-of select="@name"/> <xsl:text>
end </xsl:text>
<xsl:choose>
<xsl:when test="@interface != ''">
<xsl:value-of select="@interface"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- defineArrayFunctionBody
-->
<xsl:template name="defineArrayFunctionBody">
<xsl:text>
#------------------------------------------------------------------------
output_</xsl:text> <xsl:number/> <xsl:text>() {
if test "$output" = "0"; then
return 0
fi
procedure=$1
rank=$2
type=$4
proc="$1$2D$3"
cat &lt;&lt;EOF
</xsl:text>
<xsl:text>subroutine ${proc}(</xsl:text>
<xsl:call-template name="arg-list"/> <xsl:text>)</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> include 'mpif-config.h'</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="decl-construct-list">
<xsl:with-param name="ws" select="''"/>
<xsl:with-param name="void_type" select="'logical'"/>
<xsl:with-param name="void_kind" select="'INTEGER'"/>
<xsl:with-param name="has_dim" select="0"/>
</xsl:call-template>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:text> integer, intent(out) :: ierr</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>
end subroutine ${proc}
EOF
}
start </xsl:text> <xsl:value-of select="@name"/> <xsl:text> </xsl:text>
<xsl:call-template name="interface-size"/>
<xsl:value-of select="$nl"/>
<xsl:text>
for rank in $allranks
do
case "$rank" in 0) dim='' ; esac
case "$rank" in 1) dim=', dimension(*)' ; esac
case "$rank" in 2) dim=', dimension(1,*)' ; esac
case "$rank" in 3) dim=', dimension(1,1,*)' ; esac
case "$rank" in 4) dim=', dimension(1,1,1,*)' ; esac
case "$rank" in 5) dim=', dimension(1,1,1,1,*)' ; esac
case "$rank" in 6) dim=', dimension(1,1,1,1,1,*)' ; esac
case "$rank" in 7) dim=', dimension(1,1,1,1,1,1,*)' ; esac
output_</xsl:text> <xsl:number/> <xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> ${rank} CH "character${dim}"
output_</xsl:text> <xsl:number/> <xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> ${rank} L "logical${dim}"
for kind in $ikinds
do
output_</xsl:text> <xsl:number/> <xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> ${rank} I${kind} "integer*${kind}${dim}"
done
for kind in $rkinds
do
output_</xsl:text> <xsl:number/> <xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> ${rank} R${kind} "real*${kind}${dim}"
done
for kind in $ckinds
do
output_</xsl:text> <xsl:number/> <xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> ${rank} C${kind} "complex*${kind}${dim}"
done
done
end </xsl:text>
<xsl:value-of select="@name"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- interface-size <method>
-->
<xsl:template name="interface-size">
<xsl:variable name="count">
<xsl:call-template name="choice-count"/>
</xsl:variable>
<xsl:choose>
<!-- special cases-->
<xsl:when test="@name = 'MPI_Alloc_mem'">
<xsl:text>medium</xsl:text>
</xsl:when>
<xsl:when test="@name = 'MPI_SIZEOF'">
<xsl:text>trivial</xsl:text>
</xsl:when>
<!-- end special cases-->
<xsl:when test="$count = ''">
<xsl:text>small</xsl:text>
</xsl:when>
<xsl:when test="$count = '1'">
<xsl:text>medium</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>large</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- choice-count <method>
-->
<xsl:template name="choice-count">
<xsl:for-each select="arg">
<xsl:if test="type/@idl = 'choice'">
<xsl:text>1</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- arg-list <method>
-->
<xsl:template name="arg-list">
<xsl:for-each select="arg">
<xsl:value-of select="@name"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="position() = 5">
<xsl:text>&amp;</xsl:text>
<xsl:value-of select="concat($nl, ' ')"/>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="return[1]">
<xsl:if test="@name = 'ierr'">
<xsl:if test="../arg[1]">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@name"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- decl-construct-list <method>
-->
<xsl:template name="decl-construct-list">
<xsl:param name="ws" select="' '"/>
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:for-each select="arg">
<xsl:call-template name="type-decl-stmt">
<xsl:with-param name="ws" select="$ws"/>
<xsl:with-param name="void_type" select="$void_type"/>
<xsl:with-param name="void_kind" select="$void_kind"/>
<xsl:with-param name="has_dim" select="$has_dim"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- type-decl-stmt <arg>
-->
<xsl:template name="type-decl-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:value-of select="$ws"/>
<xsl:text> </xsl:text>
<xsl:for-each select="type[1]">
<xsl:call-template name="decl-type-spec">
<xsl:with-param name="void_type" select="$void_type"/>
<xsl:with-param name="void_kind" select="$void_kind"/>
<xsl:with-param name="has_dim" select="$has_dim"/>
</xsl:call-template>
</xsl:for-each>
<xsl:for-each select="type[1]">
<xsl:call-template name="decl-type-intent"/>
</xsl:for-each>
<xsl:value-of select="concat(' :: ', @name, $nl)"/>
</xsl:template>
<!--
- decl-type-intent <type>
-->
<xsl:template name="decl-type-intent">
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'void'"/>
<xsl:when test="@kind = 'ptr'">
<xsl:choose>
<xsl:when
test="indirect/type/@usertype='MPI_Comm_errhandler_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Comm_copy_attr_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Comm_delete_attr_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Handler_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_File_errhandler_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Grequest_query_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Grequest_free_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Grequest_cancel_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Copy_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Delete_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_User_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Datarep_conversion_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Datarep_extent_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Type_copy_attr_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Type_delete_attr_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Win_errhandler_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Win_copy_attr_function'"/>
<xsl:when
test="indirect/type/@usertype='MPI_Win_delete_attr_function'"/>
<xsl:otherwise>
<xsl:value-of select="concat(', intent(', ../@intent, ')')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(', intent(', ../@intent, ')')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- decl-type-spec <type>
-->
<xsl:template name="decl-type-spec">
<xsl:param name="void_type"/>
<xsl:param name="void_kind"/>
<xsl:param name="has_dim" select="1"/>
<xsl:choose>
<!-- idl types (annotate xml to specify what this type is) -->
<xsl:when test="@idl = 'MPI_ARGV'">
<xsl:text>character(len=*), dimension(*)</xsl:text>
</xsl:when>
<xsl:when test="@idl = 'MPI_A_ARGV'">
<xsl:text>character(len=*), dimension(</xsl:text>
<xsl:value-of select="array/dimension[2]/@extent"/>
<xsl:text>,*)</xsl:text>
</xsl:when>
<xsl:when test="@idl = 'MPI_Aint'">
<xsl:text>integer(kind=MPI_ADDRESS_KIND)</xsl:text>
</xsl:when>
<!-- C++ types -->
<xsl:when test="@kind = 'void'">
<xsl:choose>
<xsl:when test="../../../../@template = 'yes'">
<xsl:text>${type}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>integer</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'bool'">
<xsl:text>logical</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'int'">
<xsl:choose>
<xsl:when test="@ikind = 'int'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'char'">
<xsl:text>character</xsl:text>
<xsl:if test="../../@kind = 'ptr'">
<xsl:text>(len=*)</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:for-each select="indirect[1]/type[1]">
<xsl:call-template name="decl-type-spec"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'array'">
<xsl:for-each select="array[1]/type[1]">
<xsl:call-template name="decl-type-spec"/>
</xsl:for-each>
<xsl:text>, dimension(</xsl:text>
<xsl:for-each select="array[1]/dimension">
<xsl:value-of select="@extent"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ref'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="type-spec">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="@usertype = 'default_integer'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Aint'">
<xsl:text>integer(kind=MPI_ADDRESS_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'int64_t'">
<xsl:text>integer(kind=MPI_OFFSET_KIND)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Status'">
<xsl:text>integer, dimension(MPI_STATUS_SIZE)</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Comm_errhandler_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Comm_copy_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Comm_delete_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Handler_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_File_errhandler_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Grequest_query_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Grequest_free_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Grequest_cancel_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Copy_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Delete_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_User_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Datarep_conversion_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Datarep_extent_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Type_copy_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Type_delete_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Win_errhandler_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Win_copy_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:when test="@usertype = 'MPI_Win_delete_attr_function'">
<xsl:text>external</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:param name="prefix" select="substring-before(@usertype, '_')"/>
<xsl:if test="$prefix = 'MPI'">
<xsl:text>integer</xsl:text>
</xsl:if>
<xsl:if test="$prefix != 'MPI'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- copyright: print copyright
-->
<xsl:template name="copyright">
<xsl:text>
#
# Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2006 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
</xsl:text>
</xsl:template>
<!--
- info: print information about file
-->
<xsl:template name="info">
<xsl:text>
# Do a little error checking
if test ! -f "$1/fortran_kinds.sh"; then
echo "ERROR: Cannot find fortran_kinds.sh" >&amp;2
exit 1
elif test -z "$1/fortran_kinds.sh"; then
echo "ERROR: fortran_kinds.sh appears to be empty!" >&amp;2
exit 1
fi
# Read in the KIND information
. "$1/fortran_kinds.sh"
# Setup
output=1
allranks="0 $ranks"
# A few hard-coded functions that cannot pass through to the F77
# equivalents
start MPI_Wtick small
if test "$output" = "1"; then
cat <<EOF
function MPI_Wtick()
double precision MPI_Wtick
end function MPI_Wtick
EOF
fi
end MPI_Wtick
start MPI_Wtime small
if test "$output" = "1"; then
cat <<EOF
function MPI_Wtime()
double precision MPI_Wtime
end function MPI_Wtime
EOF
fi
end MPI_Wtime
#------------------------------------------------------------------------
# Helper functions
start() {
check_size $2
if test "$output" = "1"; then
echo "interface $1"
fi
}
end() {
if test "$output" = "1"; then
cat &lt;&lt;EOF
end interface
EOF
fi
}
</xsl:text>
</xsl:template>
<!--
- openFile: print file header information
-->
<xsl:template name="openFile">
<xsl:param name="filename" select="''"/>
<xsl:text>#! /bin/sh</xsl:text>
<xsl:call-template name="copyright"/>
<xsl:call-template name="info"/>
</xsl:template>
<!--
- closeFile: finish up
-->
<xsl:template name="closeFile">
<xsl:param name="filename" select="''"/>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,446 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- common templates for creating C files
-
- templates:
-
- openFile ([filename=''])
- closeFile ([filename=''])
-
- openExternC
- closeExternC
-
- function-decl ([id=function-id, ws='']) <method>
- param-type-list <method>
- param-list <method>
- param-decl ([id=param-id]) <arg>
-
- function-def ([id=function-id, ws='', module]) <method>
- param-type-id-list <method>
- param-id-list <method>
-
- compound-statement <method>
- decl-list <method>
- decl-list-decl-rtn <method>
- decl-list-decl-arg <method>
-
- statement-list <method>
- call-statement <method>
-
- arg-list <method>
- arg-list-hidden <method>
-
- type-conv-name-ext <arg/type>
-
- function-id <method>
- param-id <arg>
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="type-conversions.xsl"/>
<xsl:output method="text"/>
<!--
- openFile: print file header information
-->
<xsl:template name="openFile">
<xsl:param name="filename" select="''"/>
<xsl:text>/**</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> * </xsl:text>
<xsl:if test="$filename != ''">
<xsl:value-of select="$filename"/>
</xsl:if>
<xsl:text> - this file is automatically generated</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> */</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- closeFile: finish up
-->
<xsl:template name="closeFile">
<xsl:param name="filename" select="''"/>
</xsl:template>
<!--
- openExternC: open extern "C" declaration
-->
<xsl:template name="openExternC">
<xsl:text>#if defined(c_plusplus) || defined(__cplusplus)</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text>extern "C" {</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text>#endif</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- closeExternC: close extern "C" declaration
-->
<xsl:template name="closeExternC">
<xsl:text>#if defined(c_plusplus) || defined(__cplusplus)</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text>}</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text>#endif</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- function-decl <method>
- type-qual type-spec function-id ( param-type-list );
-->
<xsl:template name="function-decl">
<xsl:param name="id">
<xsl:call-template name="function-id"/>
</xsl:param>
<xsl:param name="ws" select="''"/>
<xsl:value-of select="$ws"/>
<xsl:if test="@kind = 'static'">
<xsl:text>static </xsl:text>
</xsl:if>
<xsl:for-each select="return[1]/type">
<xsl:call-template name="type-spec"/>
</xsl:for-each>
<xsl:text> </xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>(</xsl:text>
<xsl:call-template name="param-type-list"/>
<xsl:text>);</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- param-type-list <method>
-->
<xsl:template name="param-type-list">
<xsl:param name="with_hidden" select="'no'"/>
<xsl:call-template name="param-list">
<xsl:with-param name="with_hidden" select="$with_hidden"/>
</xsl:call-template>
</xsl:template>
<!--
- param-list <method>
-
- NOTE, changed to use apply-templates to get around Xalan-C bug in ver 1.9.
-->
<xsl:template name="param-list">
<xsl:param name="with_hidden" select="'no'"/>
<xsl:apply-templates select="arg" mode="param-decl">
<xsl:with-param name="with_hidden" select="$with_hidden"/>
</xsl:apply-templates>
<xsl:apply-templates select="arg" mode="param-decl-hidden">
<xsl:with-param name="with_hidden" select="$with_hidden"/>
</xsl:apply-templates>
</xsl:template>
<!--
- param-decl - arg node
-->
<xsl:template match="arg" mode="param-decl">
<xsl:variable name="hide_arg">
<xsl:call-template name="hide-arg"/>
</xsl:variable>
<xsl:if test="$hide_arg = 'no'">
<xsl:call-template name="param-decl"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if>
</xsl:template>
<!--
- param-decl-hidden - arg node
-->
<xsl:template match="arg" mode="param-decl-hidden">
<xsl:param name="with_hidden" select="'no'"/>
<xsl:if test="$with_hidden = 'yes'">
<xsl:variable name="hidden">
<xsl:call-template name="param-decl-hidden"/>
</xsl:variable>
<xsl:if test="$hidden != ''">
<xsl:value-of select="concat(', ', $hidden)"/>
</xsl:if>
</xsl:if>
</xsl:template>
<!--
- param-decl <arg>
- type-qual type-spec pointer param-id
-->
<xsl:template name="param-decl">
<xsl:param name="id">
<xsl:call-template name="param-id"/>
</xsl:param>
<xsl:variable name="type_qual">
<xsl:call-template name="type-qual"/>
</xsl:variable>
<xsl:if test="$type_qual != ''">
<xsl:value-of select="concat($type_qual, ' ')"/>
</xsl:if>
<xsl:for-each select="type[1]">
<xsl:call-template name="type-spec"/>
<xsl:call-template name="pointer"/>
</xsl:for-each>
<xsl:if test="$id != ''">
<xsl:value-of select="concat(' ', $id)"/>
</xsl:if>
</xsl:template>
<!--
- param-decl-hidden <arg>
-->
<xsl:template name="param-decl-hidden">
</xsl:template>
<!--
- function-def <method>
- type-qual-rtn type-spec-rtn function-id ( param-type-id-list )
- compound-statement = { decl-list statement-list }
-->
<xsl:template name="function-def">
<xsl:param name="id">
<xsl:call-template name="function-id"/>
</xsl:param>
<xsl:param name="ws" select="''"/>
<xsl:param name="module"/>
<xsl:value-of select="$ws"/>
<xsl:for-each select="return[1]/type">
<xsl:call-template name="type-qual-rtn"/>
</xsl:for-each>
<xsl:for-each select="return[1]/type">
<xsl:call-template name="type-spec-rtn"/>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$id"/>
<xsl:text>(</xsl:text>
<xsl:call-template name="param-type-id-list">
<xsl:with-param name="module" select="$module"/>
</xsl:call-template>
<xsl:text>)</xsl:text> <xsl:value-of select="$nl"/>
<xsl:call-template name="compound-statement">
<xsl:with-param name="function_id" select="$id"/>
</xsl:call-template>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- param-type-id-list ([module]) <method>
-->
<xsl:template name="param-type-id-list">
<xsl:param name="module"/>
<xsl:call-template name="param-id-list">
<xsl:with-param name="module" select="$module"/>
</xsl:call-template>
</xsl:template>
<!--
- param-id-list ([module]) <method>
-->
<xsl:template name="param-id-list">
<xsl:param name="module"/>
<xsl:for-each select="arg">
<xsl:call-template name="param-decl">
<xsl:with-param name="id" select="@name"/>
</xsl:call-template>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- compound-statement <method>
- decl-list statement-list
-->
<xsl:template name="compound-statement">
<xsl:param name="function_id">
<xsl:call-template name="function-id"/>
</xsl:param>
<xsl:text>{</xsl:text> <xsl:value-of select="$nl"/>
<xsl:call-template name="decl-list"/>
<xsl:call-template name="statement-list">
<xsl:with-param name="function_id" select="$function_id"/>
</xsl:call-template>
<xsl:text>}</xsl:text> <xsl:value-of select="$nl"/>
</xsl:template>
<!--
- decl-list <method>
-->
<xsl:template name="decl-list">
<xsl:for-each select="return[1]/type">
<xsl:call-template name="decl-list-decl-rtn"/>
</xsl:for-each>
<xsl:for-each select="arg/type">
<xsl:call-template name="decl-list-decl-arg"/>
</xsl:for-each>
</xsl:template>
<!--
- decl-list-decl-rtn ([rtn_id=rtn-id, ws=' ']) <return/type>
-->
<xsl:template name="decl-list-decl-rtn">
</xsl:template>
<!--
- decl-list-decl-arg ([arg_id=arg-id, ws=' ']) <arg/type>
-->
<xsl:template name="decl-list-decl-arg">
</xsl:template>
<!--
- statement-list <method>
-->
<xsl:template name="statement-list">
<xsl:param name="function_id">
<xsl:call-template name="function-id"/>
</xsl:param>
<xsl:call-template name="statement-list-pre-call"/>
<xsl:call-template name="call-statement">
<xsl:with-param name="id">
<xsl:text>PTR_</xsl:text> <xsl:value-of select="$function_id"/>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="statement-list-post-call"/>
</xsl:template>
<!--
- statement-list-pre-call <method>
-->
<xsl:template name="statement-list-pre-call">
<xsl:param name="ws" select="' '"/>
</xsl:template>
<!--
- statement-list-post-call <method>
-->
<xsl:template name="statement-list-post-call">
<xsl:param name="ws" select="' '"/>
</xsl:template>
<!--
- call-statement <method>
- rtn-id assignment-operator function-id (arg-list)
-->
<xsl:template name="call-statement">
<xsl:param name="id">
<xsl:call-template name="function-id"/>
</xsl:param>
<xsl:param name="ws" select="' '"/>
<xsl:value-of select="$ws"/>
<xsl:for-each select="return[1]/type">
<xsl:call-template name="rtn-id"/>
<xsl:call-template name="assignment-operator"/>
</xsl:for-each>
<xsl:value-of select="$id"/>
<xsl:text>(</xsl:text>
<xsl:call-template name="arg-list"/>
<xsl:text>)</xsl:text>
<xsl:text>;</xsl:text> <xsl:value-of select="$nl"/>
</xsl:template>
<!--
- arg-list <method>
-->
<xsl:template name="arg-list">
<xsl:for-each select="arg/type">
<xsl:variable name="ext">
<xsl:call-template name="type-conv-name-ext"/>
</xsl:variable>
<xsl:call-template name="address-operator"/>
<xsl:call-template name="arg-id"/>
<xsl:value-of select="$ext"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:call-template name="arg-list-hidden"/>
</xsl:template>
<!--
- arg-list-hidden <method>
-->
<xsl:template name="arg-list-hidden">
</xsl:template>
<!--
- type-conv-name-ext <arg/type>
-->
<xsl:template name="type-conv-name-ext">
<xsl:param name="depth" select="0"/>
</xsl:template>
<!--
- type-conv-statement <method/arg/type>
-->
<xsl:template name="type-conv-statement">
<xsl:param name="depth" select="0"/>
<xsl:param name="ws"/>
<xsl:param name="arg_name"/>
<xsl:param name="ext"/>
</xsl:template>
<!--
- function-id <method>
-->
<xsl:template name="function-id">
<xsl:value-of select="@name"/>
</xsl:template>
<!--
- param-id <method>
-->
<xsl:template name="param-id"/>
<!--
- hide-arg <arg>
- return yes if arg is not to be included in parameter list
-->
<xsl:template name="hide-arg">
<xsl:text>no</xsl:text>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,732 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- common templates for creating C files
-
- templates:
-
- defineInitMacro ([module=@name]) <scope>
- defineMacros ([module=@name]) <scope>
- def-macro-lower
- def-macro-upper
-
- declareInitFunction <scope>
-
- declareFunctionPointers ([module=@name]) <scope>
- decl-function-pointer
-
- defineSetFunctionPointers ([module=@name]) <scope>
- def-set-function-pointer
-
- defineFunctions ([module=@name]) <scope>
-
- decl-arg-list <method>
- param-decl-hidden <arg>
-
- use-stmt-list ([ws=' ']) <method>
- use-stmt <arg>
-
- decl-construct-list ([ws=' ']) <method>
- type-decl-stmt <arg>
-
- assign-stmt-list ([ws=' ']) <method>
- assign-stmt <arg>
-
- call-stmt ([ws=' ']) <method>
- call-or-assign <method>
- proc-designator <method>
-
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="type-conv-f90.xsl"/>
<!--
- defineInitMacro: define macro for Fortran init module procedure <scope>
-->
<xsl:template name="defineInitMacro">
<xsl:param name="module" select="@name"/>
<xsl:text>/**</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> * Macros to create Fortran symbols</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> */</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<!-- lower case -->
<xsl:text>#if defined(F90_SYM_CASE_LOWER)</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="def-macro-lower">
<xsl:with-param name="symbol">
<xsl:text>CH_INIT_</xsl:text> <xsl:value-of select="$module"/>
</xsl:with-param>
</xsl:call-template>
<!-- upper case -->
<xsl:text>#elif defined(F90_SYM_CASE_UPPER)</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:call-template name="def-macro-upper">
<xsl:with-param name="symbol">
<xsl:text>CH_INIT_</xsl:text> <xsl:value-of select="$module"/>
</xsl:with-param>
</xsl:call-template>
<xsl:text>#endif /* F90_SYM_CASE */</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- defineMacros: define macros for Fortran symbols <scope>
-->
<xsl:template name="defineMacros">
<xsl:param name="module" select="@name"/>
<xsl:param name="symbol" select="''"/>
<xsl:text>/**</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> * Macros to create Fortran symbols</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> */</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<!-- lower case -->
<xsl:text>#if defined(F90_SYM_CASE_LOWER)</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:for-each select="method">
<xsl:if test='string-length($symbol) &gt; 0'>
<xsl:call-template name="def-macro-lower">
<xsl:with-param name="symbol" select="$symbol"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="def-macro-lower">
<xsl:with-param name="symbol">
<xsl:text>SET_</xsl:text> <xsl:value-of select="$module"/>
<xsl:text>_</xsl:text> <xsl:value-of select="@name"/>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<!-- upper case -->
<xsl:text>#elif defined(F90_SYM_CASE_UPPER)</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:for-each select="method">
<xsl:if test='string-length($symbol) &gt; 0'>
<xsl:call-template name="def-macro-upper">
<xsl:with-param name="symbol" select="$symbol"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="def-macro-upper">
<xsl:with-param name="symbol">
<xsl:text>SET_</xsl:text> <xsl:value-of select="$module"/>
<xsl:text>_</xsl:text> <xsl:value-of select="@name"/>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<xsl:text>#endif /* F90_SYM_CASE */</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- def-macro-lower
-->
<xsl:template name="def-macro-lower">
<xsl:param name="symbol"/>
<xsl:variable name="sym_lower">
<xsl:call-template name="lower-case">
<xsl:with-param name="symbol" select="$symbol"/>
</xsl:call-template>
</xsl:variable>
<xsl:text># define </xsl:text> <xsl:value-of select="$symbol"/>
<xsl:text> F90_SYMBOL(</xsl:text> <xsl:value-of select="$sym_lower"/>
<xsl:text>)</xsl:text> <xsl:value-of select="$nl"/>
</xsl:template>
<!--
- def-macro-upper
-->
<xsl:template name="def-macro-upper">
<xsl:param name="symbol"/>
<xsl:variable name="sym_upper">
<xsl:call-template name="upper-case">
<xsl:with-param name="symbol" select="$symbol"/>
</xsl:call-template>
</xsl:variable>
<xsl:text># define </xsl:text> <xsl:value-of select="$symbol"/>
<xsl:text> F90_SYMBOL(</xsl:text> <xsl:value-of select="$sym_upper"/>
<xsl:text>)</xsl:text> <xsl:value-of select="$nl"/>
</xsl:template>
<!--
- declareFunctionPointers: declare pointers to Fortran procedures <scope>
-->
<xsl:template name="declareFunctionPointers">
<xsl:param name="module" select="@name"/>
<xsl:text>/**</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> * Pointers to Fortran procedures</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> */</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:for-each select="method">
<xsl:call-template name="decl-function-pointer">
<xsl:with-param name="id">
<xsl:value-of select="$module"/> <xsl:text>_</xsl:text>
<xsl:value-of select="@name"/>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- declareInitFunction <scope>
-->
<xsl:template name="declareInitFunction">
<xsl:param name="symbol">
<xsl:text>CH_INIT_</xsl:text> <xsl:value-of select="@name"/>
</xsl:param>
<xsl:value-of select="concat('/**', $nl)"/>
<xsl:text> * Declare Fortran initialization routine</xsl:text>
<xsl:value-of select="concat($nl, ' */', $nl)"/>
<xsl:text>void </xsl:text>
<xsl:value-of select="$symbol"/> <xsl:text>(void);</xsl:text>
<xsl:value-of select="concat($nl, $nl)"/>
</xsl:template>
<!--
- decl-function-pointer
- type-qual type-spec ( * PTR_ function-id ) ( param-type-list );
-->
<xsl:template name="decl-function-pointer">
<xsl:param name="id"/>
<xsl:param name="ws" select="''"/>
<xsl:param name="module"/>
<xsl:value-of select="$ws"/>
<xsl:for-each select="return[1]/type">
<xsl:call-template name="type-spec"/>
</xsl:for-each>
<xsl:text> (*PTR_</xsl:text> <xsl:value-of select="$id"/>
<xsl:text>)(</xsl:text>
<xsl:call-template name="param-type-list">
<xsl:with-param name="with_hidden" select="'yes'"/>
</xsl:call-template>
<xsl:text>);</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- defineSetFunctionPointers: define functions to set pointers to Fortran
- procedures <scope>
-->
<xsl:template name="defineSetFunctionPointers">
<xsl:param name="module" select="@name"/>
<xsl:text>/**</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> * Functions to set pointers to Fortran procedures</xsl:text>
<xsl:text> (called from Fortran)</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> */</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:for-each select="method">
<xsl:call-template name="def-set-function-pointer">
<xsl:with-param name="id">
<xsl:value-of select="$module"/> <xsl:text>_</xsl:text>
<xsl:value-of select="@name"/>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- def-set-function-pointer
- void SET_ function-id ( type-qual type-spec (*fptr) ( param-type-list ) )
- { PTR_ function-id = fptr; }
-->
<xsl:template name="def-set-function-pointer">
<xsl:param name="id"/>
<xsl:param name="ws" select="''"/>
<xsl:param name="module"/>
<xsl:value-of select="$ws"/>
<xsl:text>void SET_</xsl:text> <xsl:value-of select="$id"/>
<xsl:text>(</xsl:text>
<xsl:for-each select="return[1]/type">
<xsl:call-template name="type-spec"/>
</xsl:for-each>
<xsl:text> (*fptr)(</xsl:text>
<xsl:call-template name="param-type-list">
<xsl:with-param name="with_hidden" select="'yes'"/>
</xsl:call-template>
<xsl:text>))</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text>{</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> PTR_</xsl:text> <xsl:value-of select="$id"/>
<xsl:text> = fptr;</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text>}</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- defineFunctions: define functions to call Fortran procedures <scope>
-->
<xsl:template name="defineFunctions">
<xsl:param name="module" select="@name"/>
<xsl:text>/**</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> * Bridging functions to call Fortran procedures</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text> */</xsl:text> <xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:for-each select="method">
<xsl:call-template name="function-def">
<xsl:with-param name="id">
<xsl:value-of select="$module"/> <xsl:text>_</xsl:text>
<xsl:value-of select="@name"/>
</xsl:with-param>
<xsl:with-param name="module" select="$module"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- defineMacros: define macros for Fortran symbols <scope>
-->
<xsl:template name="defineInitProc">
<xsl:param name="module" select="@name"/>
<xsl:param name="symbol" select="''"/>
<xsl:text>subroutine </xsl:text> <xsl:value-of select="$symbol"/>
<xsl:text>()</xsl:text> <xsl:value-of select="$nl"/>
<xsl:text> use </xsl:text> <xsl:value-of select="$module"/>
<xsl:value-of select="$nl"/>
<xsl:for-each select="method">
<xsl:text> call SET_</xsl:text> <xsl:value-of select="$module"/>
<xsl:text>_</xsl:text> <xsl:value-of select="@name"/>
<xsl:text>( </xsl:text> <xsl:value-of select="@name"/>
<xsl:text> )</xsl:text> <xsl:value-of select="$nl"/>
</xsl:for-each>
<xsl:text>end subroutine </xsl:text> <xsl:value-of select="$symbol"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- decl-list-decl-rtn ([rtn_id=rtn-id, ws=' ']) <return/type>
-->
<xsl:template name="decl-list-decl-rtn">
<xsl:param name="rtn_id">
<xsl:call-template name="rtn-id"/>
</xsl:param>
<xsl:param name="ws" select="' '"/>
<xsl:if test='string-length($rtn_id) &gt; 0'>
<xsl:value-of select="$ws"/> <xsl:call-template name="type-spec"/>
<xsl:text> </xsl:text> <xsl:value-of select="$rtn_id"/>
<xsl:text>;</xsl:text> <xsl:value-of select="$nl"/>
</xsl:if>
</xsl:template>
<!--
- decl-list-decl-arg ([arg_id=arg-id, ws=' ']) <arg/type>
-->
<xsl:template name="decl-list-decl-arg">
<xsl:param name="arg_id">
<xsl:call-template name="arg-id"/>
</xsl:param>
<xsl:param name="ws" select="' '"/>
<xsl:call-template name="decl-list-decl-arg-f90">
<xsl:with-param name="arg_id" select="$arg_id"/>
<xsl:with-param name="ws" select="$ws"/>
</xsl:call-template>
</xsl:template>
<!--
- decl-list-decl-arg-f90 ([arg_id=arg-id, ws=' ']) <arg/type>
-->
<xsl:template name="decl-list-decl-arg-f90">
<xsl:param name="arg_id">
<xsl:call-template name="arg-id"/>
</xsl:param>
<xsl:param name="ws" select="' '"/>
<xsl:variable name="ext">
<xsl:call-template name="type-conv-name-ext"/>
</xsl:variable>
<xsl:if test="$ext != ''">
<xsl:value-of select="$ws"/>
<xsl:call-template name="type-spec"/>
<xsl:value-of select="concat(' ', ../@name, $ext, ';', $nl)"/>
</xsl:if>
<xsl:variable name="hidden">
<xsl:call-template name="type-spec-hidden"/>
</xsl:variable>
<xsl:variable name="ext_h">
<xsl:call-template name="type-conv-name-ext-hidden"/>
</xsl:variable>
<xsl:if test="$hidden != ''">
<xsl:value-of select="concat($ws, $hidden, ' ', ../@name, $ext_h, ';')"/>
<xsl:value-of select="($nl)"/>
</xsl:if>
</xsl:template>
<!--
- statement-list-pre-call <method>
-->
<xsl:template name="statement-list-pre-call">
<xsl:param name="ws" select="' '"/>
<xsl:for-each select="arg/type">
<xsl:variable name="ext">
<xsl:call-template name="type-conv-name-ext"/>
</xsl:variable>
<xsl:if test="$ext != ''">
<xsl:call-template name="type-conv-statement">
<xsl:with-param name="ws" select="$ws"/>
<xsl:with-param name="arg_name" select="../@name"/>
<xsl:with-param name="ext" select="$ext"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="arg/type">
<xsl:call-template name="type-statement-hidden-pre-call"/>
</xsl:for-each>
</xsl:template>
<!--
- statement-list-post-call <method>
-->
<xsl:template name="statement-list-post-call">
<xsl:param name="ws" select="' '"/>
<xsl:for-each select="arg/type">
<xsl:call-template name="type-statement-hidden-post-call"/>
</xsl:for-each>
</xsl:template>
<!--
- param-decl-hidden <arg>
- type-spec pointer param-id
-->
<xsl:template name="param-decl-hidden">
<xsl:param name="id">
<xsl:call-template name="param-id"/>
</xsl:param>
<xsl:for-each select="type[1]">
<xsl:call-template name="type-spec-hidden"/>
</xsl:for-each>
<xsl:if test="$id != ''">
<xsl:value-of select="concat(' ', $id)"/>
</xsl:if>
</xsl:template>
<!--
- type-statement-hidden-pre-call <arg/type>
-->
<xsl:template name="type-statement-hidden-pre-call">
<xsl:param name="ws" select="' '"/>
<xsl:choose>
<!-- Fortran types -->
<xsl:when test="@kind = 'fchar'">
<xsl:if test="@clen = '*'">
<xsl:value-of select="concat($ws, ../@name)"/>
<xsl:text>_h = strlen(</xsl:text>
<xsl:value-of select="concat(../@name, ');', $nl)"/>
</xsl:if>
</xsl:when>
<xsl:when test="@kind = 'farray'">
<xsl:call-template name="type-statement-hidden-pre-call-farray">
<xsl:with-param name="ws" select="$ws"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<!--
- type-statement-hidden-post-call <arg/type>
-->
<xsl:template name="type-statement-hidden-post-call">
<xsl:param name="ws" select="' '"/>
<xsl:choose>
<!-- Fortran types -->
<xsl:when test="@kind = 'farray'">
<xsl:call-template name="type-statement-hidden-post-call-farray">
<xsl:with-param name="ws" select="$ws"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<!--
- type-statement-hidden-pre-call-farray <arg/type>
-->
<xsl:template name="type-statement-hidden-pre-call-farray">
<xsl:param name="ws" select="' '"/>
<xsl:if test="array/dimension/@extent = '*'">
<xsl:value-of select="$ws"/>
<xsl:text>APPEND_F90_COMPILER(createArrayDescAndHidden) (</xsl:text>
<xsl:value-of select="concat(../@name, ', ', array/@rank)"/>
<xsl:text>, F90_Array, &amp;</xsl:text>
<xsl:value-of select="concat(../@name, '_dv, &amp;', ../@name, '_dvh')"/>
<xsl:text>);</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:if>
</xsl:template>
<!--
- type-statement-hidden-post-call-farray <arg/type>
-->
<xsl:template name="type-statement-hidden-post-call-farray">
<xsl:param name="ws" select="' '"/>
<xsl:variable name="ext">
<xsl:call-template name="type-conv-name-ext-hidden"/>
</xsl:variable>
<xsl:if test="array/dimension/@extent = '*'">
<xsl:value-of select="$ws"/>
<xsl:text>APPEND_F90_COMPILER(freeArrayDescAndHidden) (</xsl:text>
<xsl:value-of select="concat('F90_Array, ',../@name, '_dv, ')"/>
<xsl:value-of select="concat(../@name, $ext, ');', $nl)"/>
</xsl:if>
</xsl:template>
<!--
- arg-list-hidden <method>
-->
<xsl:template name="arg-list-hidden">
<xsl:for-each select="arg/type">
<xsl:variable name="hidden">
<xsl:call-template name="type-spec-hidden"/>
</xsl:variable>
<xsl:variable name="ext">
<xsl:call-template name="type-conv-name-ext-hidden"/>
</xsl:variable>
<xsl:if test="$hidden != ''">
<xsl:value-of select="concat(', ', ../@name, $ext)"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- type-conv-name-ext <arg/type>
-->
<xsl:template name="type-conv-name-ext">
<xsl:param name="depth" select="0"/>
<xsl:choose>
<!-- Fortran types -->
<xsl:when test="@kind = 'farray'">
<xsl:if test="array/dimension/@extent = '*'">
<xsl:text>_dv</xsl:text>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:template>
<!--
- type-conv-name-ext-hidden <arg/type>
-->
<xsl:template name="type-conv-name-ext-hidden">
<xsl:param name="depth" select="0"/>
<xsl:choose>
<!-- Fortran types -->
<xsl:when test="@kind = 'fchar'">
<xsl:if test="@clen = '*'">
<xsl:text>_h</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@kind = 'farray'">
<xsl:if test="array/dimension/@extent = '*'">
<xsl:text>_dvh</xsl:text>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:template>
<!--
- use-stmt-list <method>
-->
<xsl:template name="use-stmt-list">
<xsl:param name="ws" select="' '"/>
<xsl:for-each select="arg">
<xsl:call-template name="use-stmt">
<xsl:with-param name="ws" select="$ws"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- use-stmt <arg>
-->
<xsl:template name="use-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:if test="type/@kind = 'usertype'">
<xsl:value-of select="$ws"/> <xsl:text>use </xsl:text>
<xsl:value-of select="concat(type/@context, ', only : ')"/>
<xsl:value-of select="concat(type/@usertype, $nl)"/>
</xsl:if>
</xsl:template>
<!--
- decl-construct-list <method>
-->
<xsl:template name="decl-construct-list">
<xsl:param name="ws" select="' '"/>
<xsl:for-each select="arg">
<xsl:call-template name="type-decl-stmt">
<xsl:with-param name="ws" select="$ws"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- type-decl-stmt <arg>
-->
<xsl:template name="type-decl-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:value-of select="$ws"/>
<xsl:for-each select="type[1]">
<xsl:call-template name="decl-type-spec"/>
</xsl:for-each>
<xsl:value-of select="concat(', intent(', @intent, ')')"/>
<xsl:value-of select="concat(' :: ', @name, '_l', $nl)"/>
</xsl:template>
<!--
- assign-stmt-list <method>
-->
<xsl:template name="assign-stmt-list">
<xsl:param name="ws" select="' '"/>
<xsl:for-each select="arg">
<xsl:call-template name="assign-stmt">
<xsl:with-param name="ws" select="$ws"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!--
- assign-stmt <arg>
-->
<xsl:template name="assign-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:param name="lowercase_name">
<xsl:call-template name="lower-case">
<xsl:with-param name="symbol" select="@name"/>
</xsl:call-template>
</xsl:param>
<xsl:value-of select="$ws"/>
<xsl:value-of select="concat(@name, '_l = ', $lowercase_name)"/>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- call-stmt <method>
- call-or-assign proc-designator ( act-arg-spec-list )
-->
<xsl:template name="call-stmt">
<xsl:param name="ws" select="' '"/>
<xsl:value-of select="$ws"/>
<xsl:for-each select="return[1]/type">
<xsl:call-template name="call-or-assign"/>
</xsl:for-each>
<xsl:call-template name="proc-designator"/>
<xsl:text>(</xsl:text>
<xsl:call-template name="act-arg-spec-list"/>
<xsl:text>)</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
<!--
- call-or-assign <return/type>
-->
<xsl:template name="call-or-assign">
<xsl:param name="rtn_id">
<xsl:call-template name="rtn-id"/>
</xsl:param>
<xsl:choose>
<xsl:when test="@kind = 'fvoid'">
<xsl:text>call </xsl:text>
</xsl:when>
<xsl:when test="$rtn_id != ''">
<xsl:value-of select="$rtn_id"/>
<xsl:text> = </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../../@name"/>
<xsl:text> = </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- act-arg-spec-list <method>
-->
<xsl:template name="act-arg-spec-list">
<xsl:for-each select="arg">
<xsl:value-of select="@name"/>
<xsl:text>_l</xsl:text>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--
- proc-designator <method>
-->
<xsl:template name="proc-designator">
<xsl:value-of select="@name"/>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,106 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- common templates for Chasm language interoperability system
-
- variables:
- nl - a newline "\n"
-
- templates:
-
- include-files
- include-file (filename)
- include-file-local (filename)
-
- upper-case (symbol)
- lower-case (symbol)
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<!--
- nl: a newline "\n"
-->
<xsl:variable name="nl">
<xsl:text>
</xsl:text>
</xsl:variable>
<!--
- include-files: include header files (to be overridden, this is a noop)
-->
<xsl:template name="include-files"/>
<!--
- include-file (filename): include named header file
-->
<xsl:template name="include-file">
<xsl:param name="filename"/>
<xsl:text>#include &lt;</xsl:text> <xsl:value-of select="$filename"/>
<xsl:text>&gt;</xsl:text> <xsl:value-of select="$nl"/>
</xsl:template>
<!--
- include-file-local (filename): include named header file
-->
<xsl:template name="include-file-local">
<xsl:param name="filename"/>
<xsl:text>#include &quot;</xsl:text> <xsl:value-of select="$filename"/>
<xsl:text>&quot;</xsl:text> <xsl:value-of select="$nl"/>
</xsl:template>
<!--
- upper-case (symbol): output symbol in upper case
-->
<xsl:template name="upper-case">
<xsl:param name="symbol"/>
<xsl:value-of select="translate($symbol,
'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
</xsl:template>
<!--
- lower-case (symbol): output symbol in lower case
-->
<xsl:template name="lower-case">
<xsl:param name="symbol"/>
<xsl:value-of select="translate($symbol,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:template>
<!--
- name-ifnot-alias : choose alias or name if no alias
-->
<xsl:template name="name-ifnot-alias">
<xsl:choose>
<xsl:when test="@alias">
<xsl:value-of select="@alias"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,18 +0,0 @@
#! /bin/sh
XSL_PATH=.
OUT_PATH=../scripts
. functions_f90_large.list
if test "$1" != ""; then
procedures=$1
fi
for proc in $procedures
do
lc_proc=`echo ${proc}|tr '[A-Z]' '[a-z]'`
echo "creating ${lc_proc}_f90.f90.sh"
Xalan -p test_function "'${proc}'" -p interface_size "'large'" -o ${OUT_PATH}/${lc_proc}_f90.f90.sh ../xml/mpi.h.xml ${XSL_PATH}/chasm-mpi.f90.sh.xsl
chmod 755 ../scripts/${lc_proc}_f90.f90.sh
done

Просмотреть файл

@ -1,18 +0,0 @@
#! /bin/sh
XSL_PATH=.
OUT_PATH=../scripts
. functions_f90_medium.list
if test "$1" != ""; then
procedures=$1
fi
for proc in $procedures
do
lc_proc=`echo ${proc}|tr '[A-Z]' '[a-z]'`
echo "creating ${lc_proc}_f90.f90.sh"
Xalan -p test_function "'${proc}'" -p interface_size "'medium'" -o ${OUT_PATH}/${lc_proc}_f90.f90.sh ../xml/mpi.h.xml ${XSL_PATH}/chasm-mpi.f90.sh.xsl
chmod 755 ../scripts/${lc_proc}_f90.f90.sh
done

Просмотреть файл

@ -1,28 +0,0 @@
proc_should_be_medium="
MPI_Accumulate
MPI_Get
MPI_Put
MPI_Sendrecv_replace
"
procedures="
MPI_Allgather
MPI_Allgatherv
MPI_Allreduce
MPI_Alltoall
MPI_Alltoallv
MPI_Alltoallw
MPI_Exscan
MPI_Gather
MPI_Gatherv
MPI_Pack
MPI_Pack_external
MPI_Reduce
MPI_Reduce_scatter
MPI_Scan
MPI_Scatter
MPI_Scatterv
MPI_Sendrecv
MPI_Unpack
MPI_Unpack_external
"

Просмотреть файл

@ -1,56 +0,0 @@
procedures="
MPI_Accumulate
MPI_Address
MPI_Bcast
MPI_Bsend
MPI_Bsend_init
MPI_Buffer_attach
MPI_Buffer_detach
MPI_File_iread
MPI_File_iread_at
MPI_File_iread_shared
MPI_File_iwrite
MPI_File_iwrite_at
MPI_File_iwrite_shared
MPI_File_read
MPI_File_read_all
MPI_File_read_all_begin
MPI_File_read_all_end
MPI_File_read_at
MPI_File_read_at_all
MPI_File_read_at_all_begin
MPI_File_read_at_all_end
MPI_File_read_ordered
MPI_File_read_ordered_begin
MPI_File_read_ordered_end
MPI_File_read_shared
MPI_File_write
MPI_File_write_all
MPI_File_write_all_begin
MPI_File_write_all_end
MPI_File_write_at
MPI_File_write_at_all
MPI_File_write_at_all_begin
MPI_File_write_at_all_end
MPI_File_write_ordered
MPI_File_write_ordered_begin
MPI_File_write_ordered_end
MPI_File_write_shared
MPI_Get
MPI_Ibsend
MPI_Irecv
MPI_Irsend
MPI_Isend
MPI_Issend
MPI_Put
MPI_Recv
MPI_Recv_init
MPI_Rsend
MPI_Rsend_init
MPI_Send
MPI_Send_init
MPI_Sendrecv_replace
MPI_Ssend
MPI_Ssend_init
MPI_Win_create
"

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,81 +0,0 @@
<!--
- templates for f90 type conversions
-
- variables:
-
- templates:
-
- type-spec-hidden
- decl-type-spec <arg>
-
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<!--
- type-spec-hidden
-->
<xsl:template name="type-spec-hidden">
<xsl:param name="depth" select="0"/>
<xsl:choose>
<!-- Fortran types -->
<xsl:when test="@kind = 'fchar'">
<xsl:if test="@clen = '*'">
<xsl:text>int</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@kind = 'farray'">
<xsl:call-template name="type-spec-hidden-farray"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!--
- type-spec-hidden-farray
-->
<xsl:template name="type-spec-hidden-farray">
<xsl:if test="array/dimension/@extent = '*'">
<xsl:text>void*</xsl:text>
</xsl:if>
</xsl:template>
<!--
- decl-type-spec <arg>
-->
<xsl:template name="decl-type-spec">
<xsl:choose>
<xsl:when test="@kind = 'fint'">
<xsl:text>integer</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ffloat'">
<xsl:text>real</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fcmplx'">
<xsl:text>complex</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'flogic'">
<xsl:text>logical</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fchar'">
<xsl:text>character (len=</xsl:text>
<xsl:value-of select="@clen"/>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'farray'"/>
<xsl:when test="@kind = 'usertype'">
<xsl:value-of select="concat('type(', @usertype, ')')"/>
</xsl:when>
<xsl:when test="@kind = 'fptr'"/>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,39 +0,0 @@
<!--
- user-defined templates for type conversions
-
- Users can add new types here (for types that are not already specified
- elsewhere).
-
- variables:
-
- templates:
- type-spec-user
-
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<!--
- type-spec-user <type>
- Enter user-defined tests to add to types not already specified
- in type-conversions.xsl (or elsewhere).
-->
<xsl:template name="type-spec-user">
<xsl:param name="out_default" select="'UNSUPPORTED'"/>
<xsl:choose>
<xsl:when test="@usertype = 'NOT_A_REAL_TYPE'">
<xsl:value-of select="$out_default"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$out_default"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -1,513 +0,0 @@
<!--
...........................................................................
Copyright (c) 2004-2006 The Regents of the University of California.
All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
...........................................................................
-->
<!--
- templates for type conversions
-
- variables:
-
- templates:
-
- type-qual-rtn
- type-spec-rtn
-
- type-qual
- type-spec
- type-spec-ptr
- type-spec-farray
-
- pointer
- address-operator <arg/type>
-
- rtn-id <return/type>
- assignment-operator <return/type>
-
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="type-conv-user.xsl"/>
<xsl:output method="text"/>
<!--
- type-qual-rtn <return/type>
-->
<xsl:template name="type-qual-rtn"/>
<!--
- type-spec-rtn <return/type>
-->
<xsl:template name="type-spec-rtn">
<xsl:call-template name="type-spec"/>
</xsl:template>
<!--
- type-qual
-->
<xsl:template name="type-qual"/>
<!--
- type-spec <type>
-->
<xsl:template name="type-spec">
<xsl:param name="depth" select="0"/>
<xsl:variable name="out_text">
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'void'">
<xsl:text>void</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'int'">
<xsl:choose>
<xsl:when test="@ikind = 'char'">
<xsl:text>char</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'uchar'">
<xsl:text>unsigned char</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'short'">
<xsl:text>short</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'ushort'">
<xsl:text>unsigned short</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'int'">
<xsl:text>int</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'uint'">
<xsl:text>unsigned int</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'long'">
<xsl:text>long</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'ulong'">
<xsl:text>unsigned long</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'longlong'">
<xsl:text>long long</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'ulonglong'">
<xsl:text>unsigned long long</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:choose>
<xsl:when test="@fkind = 'float'">
<xsl:text>float</xsl:text>
</xsl:when>
<xsl:when test="@fkind = 'dbl'">
<xsl:text>double</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="type-spec-ptr">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'ref'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="type-spec">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:when>
<!-- Fortran types -->
<xsl:when test="@kind = 'fvoid'">
<xsl:text>void</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'flogic'">
<xsl:text>int</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fint'">
<xsl:choose>
<xsl:when test="@ikind = 'char'">
<xsl:text>char</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'uchar'">
<xsl:text>unsigned char</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'short'">
<xsl:text>short</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'ushort'">
<xsl:text>unsigned short</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'int'">
<xsl:text>int</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'uint'">
<xsl:text>unsigned int</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'long'">
<xsl:text>long</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'ulong'">
<xsl:text>unsigned long</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'longlong'">
<xsl:text>long long</xsl:text>
</xsl:when>
<xsl:when test="@ikind = 'ulonglong'">
<xsl:text>unsigned long long</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'ffloat'">
<xsl:choose>
<xsl:when test="@fkind = 'float'">
<xsl:text>float</xsl:text>
</xsl:when>
<xsl:when test="@fkind = 'dbl'">
<xsl:text>double</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'fcmplx'">
<xsl:choose>
<xsl:when test="@fkind = 'float'">
<xsl:text>F90_ComplexFloat</xsl:text>
</xsl:when>
<xsl:when test="@fkind = 'dbl'">
<xsl:text>F90_ComplexDouble</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind = 'fchar'">
<xsl:text>char*</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'farray'">
<xsl:call-template name="type-spec-farray"/>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fptr'">
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$out_text = 'UNSUPPORTED'">
<xsl:call-template name="type-spec-user">
<xsl:with-param name="out_default" select="$out_text"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$out_text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- type-spec-ptr <type> - is a pointer
-->
<xsl:template name="type-spec-ptr">
<xsl:param name="depth" select="0"/>
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'usertype'">
<xsl:value-of select="@usertype"/> <xsl:text>*</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- type-spec-farray
-->
<xsl:template name="type-spec-farray">
<xsl:if test="array/dimension/@extent = '*'">
<xsl:text>void*</xsl:text>
</xsl:if>
</xsl:template>
<!--
- pointer
-->
<xsl:template name="pointer">
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'void'"/>
<xsl:when test="@kind = 'int'">
<xsl:text>*</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:text>*</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ptr'"/>
<xsl:when test="@kind = 'ref'"/>
<xsl:when test="@kind = 'usertype'">
<xsl:text>*</xsl:text>
</xsl:when>
<!-- Fortran types -->
<xsl:when test="@kind = 'fvoid'"/>
<xsl:when test="@kind = 'flogic'">
<xsl:text>*</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fint'">
<xsl:text>*</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ffloat'">
<xsl:text>*</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fcmplx'">
<xsl:text>*</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fchar'"/>
<xsl:when test="@kind = 'farray'"/>
<xsl:when test="@kind = 'usertype'"/>
<xsl:when test="@kind = 'fptr'"/>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- address-operator <arg/type>
-->
<xsl:template name="address-operator"/>
<!--
- rtn-id <return/type>
-->
<xsl:template name="rtn-id">
<xsl:param name="depth" select="0"/>
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'void'"/>
<xsl:when test="@kind = 'ptr'">
<xsl:text>rtn_</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ref'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="rtn-id">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="@usertype = 'std::string'">
<xsl:text>rtn_</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>rtn_</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Fortran types -->
<xsl:when test="@kind = 'fvoid'"/>
<xsl:when test="@kind = 'fint'">
<xsl:text>rtn_</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ffloat'">
<xsl:text>rtn_</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'flogic'">
<xsl:text>rtn_</xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fchar'"/>
<xsl:when test="@kind = 'farray'"/>
<xsl:when test="@kind = 'usertype'"/>
<xsl:when test="@kind = 'fptr'"/>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- assignment-operator <return/type>
-->
<xsl:template name="assignment-operator">
<xsl:param name="depth" select="0"/>
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'void'"/>
<xsl:when test="@kind = 'int'">
<xsl:text> = </xsl:text>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:text> = </xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'ref'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="assignment-operator">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="@usertype = 'std::string'">
<xsl:text> = </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> = </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Fortran types -->
<xsl:when test="@kind = 'fvoid'"/>
<xsl:when test="@kind = 'fint'">
<xsl:text> = </xsl:text>
</xsl:when>
<xsl:when test="@kind = 'ffloat'">
<xsl:text> = </xsl:text>
</xsl:when>
<xsl:when test="@kind = 'flogic'">
<xsl:text> = </xsl:text>
</xsl:when>
<xsl:when test="@kind = 'fchar'"/>
<xsl:when test="@kind = 'farray'"/>
<xsl:when test="@kind = 'usertype'"/>
<xsl:when test="@kind = 'fptr'"/>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
- arg-id <arg/type>
-->
<xsl:template name="arg-id">
<xsl:param name="depth" select="0"/>
<xsl:choose>
<!-- C++ types -->
<xsl:when test="@kind = 'void'"/>
<xsl:when test="@kind = 'int'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'float'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'ptr'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'ref'">
<xsl:for-each select="indirect/type">
<xsl:call-template name="arg-id">
<xsl:with-param name="depth" select="../@depth"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="@kind = 'usertype'">
<xsl:choose>
<xsl:when test="$depth > 0">
<xsl:value-of select="../../../@name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Fortran types -->
<xsl:when test="@kind = 'fvoid'"/>
<xsl:when test="@kind = 'flogic'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'fint'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'ffloat'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'fcmplx'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'fchar'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'farray'">
<xsl:value-of select="../@name"/>
</xsl:when>
<xsl:when test="@kind = 'usertype'"/>
<xsl:when test="@kind = 'fptr'"/>
<xsl:otherwise>
<xsl:text>UNSUPPORTED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>