src/share/vm/prims/jvmtiH.xsl

changeset 435
a61af66fc99e
child 1907
c18cbe5936b8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/prims/jvmtiH.xsl	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,452 @@
     1.4 +<?xml version="1.0" encoding="utf-8"?>
     1.5 +<!--
     1.6 + Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
     1.7 + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 +
     1.9 + This code is free software; you can redistribute it and/or modify it
    1.10 + under the terms of the GNU General Public License version 2 only, as
    1.11 + published by the Free Software Foundation.
    1.12 +
    1.13 + This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + version 2 for more details (a copy is included in the LICENSE file that
    1.17 + accompanied this code).
    1.18 +
    1.19 + You should have received a copy of the GNU General Public License version
    1.20 + 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 +
    1.23 + Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.24 + CA 95054 USA or visit www.sun.com if you need additional information or
    1.25 + have any questions.
    1.26 +  
    1.27 +-->
    1.28 +
    1.29 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    1.30 +                version="1.0">
    1.31 +
    1.32 +  <xsl:import href="jvmtiLib.xsl"/>
    1.33 +
    1.34 +  <xsl:output method="text" omit-xml-declaration="yes"/>
    1.35 +
    1.36 +  <xsl:template match="/">
    1.37 +    <xsl:apply-templates select="specification"/>
    1.38 +  </xsl:template>
    1.39 +
    1.40 +  <xsl:template match="specification">
    1.41 +
    1.42 +    <xsl:call-template name="intro"/>
    1.43 +
    1.44 +    <xsl:text>/* Derived Base Types */
    1.45 +</xsl:text>
    1.46 +    <xsl:apply-templates select="//basetype"/>
    1.47 +
    1.48 +    <xsl:text>
    1.49 +
    1.50 +    /* Constants */
    1.51 +</xsl:text>
    1.52 +    <xsl:apply-templates select="//constants"/>
    1.53 +    
    1.54 +    <xsl:text>
    1.55 +
    1.56 +    /* Errors */
    1.57 +
    1.58 +typedef enum {
    1.59 +</xsl:text>
    1.60 +     <xsl:for-each select="//errorid">
    1.61 +       <xsl:sort select="@num" data-type="number"/>
    1.62 +         <xsl:apply-templates select="." mode="enum"/>
    1.63 +         <xsl:text>,
    1.64 +</xsl:text>
    1.65 +         <xsl:if test="position() = last()">
    1.66 +           <xsl:text>    JVMTI_ERROR_MAX = </xsl:text>
    1.67 +           <xsl:value-of select="@num"/>
    1.68 +         </xsl:if>
    1.69 +     </xsl:for-each>
    1.70 +    <xsl:text>
    1.71 +} jvmtiError;
    1.72 +</xsl:text>
    1.73 +    <xsl:apply-templates select="eventsection" mode="enum"/>
    1.74 +
    1.75 +    <xsl:text>
    1.76 +    /* Pre-Declarations */
    1.77 +</xsl:text>
    1.78 +<xsl:apply-templates select="//typedef|//uniontypedef" mode="early"/>
    1.79 +
    1.80 +    <xsl:text>
    1.81 +    /* Function Types */
    1.82 +</xsl:text>
    1.83 +    <xsl:apply-templates select="//callback"/>
    1.84 +
    1.85 +    <xsl:text>
    1.86 +
    1.87 +    /* Structure Types */
    1.88 +</xsl:text>
    1.89 +    <xsl:apply-templates select="//typedef|//uniontypedef" mode="body"/>
    1.90 +    <xsl:apply-templates select="//capabilitiestypedef"/>
    1.91 +
    1.92 +    <xsl:apply-templates select="eventsection" mode="body"/>
    1.93 +
    1.94 +    <xsl:apply-templates select="functionsection"/>
    1.95 +
    1.96 +    <xsl:call-template name="outro"/>
    1.97 +      
    1.98 +  </xsl:template>
    1.99 +
   1.100 +  <xsl:template name="intro">
   1.101 +  <xsl:call-template name="includeHeader"/>
   1.102 +  <xsl:text>
   1.103 +    /* Include file for the Java(tm) Virtual Machine Tool Interface */
   1.104 +
   1.105 +#ifndef _JAVA_JVMTI_H_
   1.106 +#define _JAVA_JVMTI_H_
   1.107 +
   1.108 +#include "jni.h"
   1.109 +
   1.110 +#ifdef __cplusplus
   1.111 +extern "C" {
   1.112 +#endif
   1.113 +
   1.114 +enum {
   1.115 +    JVMTI_VERSION_1   = 0x30010000,
   1.116 +    JVMTI_VERSION_1_0 = 0x30010000,
   1.117 +    JVMTI_VERSION_1_1 = 0x30010100,
   1.118 +
   1.119 +    JVMTI_VERSION = 0x30000000 + (</xsl:text>
   1.120 +  <xsl:value-of select="//specification/@majorversion"/>
   1.121 +  <xsl:text> * 0x10000) + (</xsl:text>
   1.122 +  <xsl:value-of select="//specification/@minorversion"/>
   1.123 +  <xsl:text> * 0x100)</xsl:text>
   1.124 +  <xsl:variable name="micro">
   1.125 +    <xsl:call-template name="microversion"/>
   1.126 +  </xsl:variable>
   1.127 +  <xsl:choose>
   1.128 +    <xsl:when test="string($micro)='dev'">
   1.129 +      <xsl:text>  /* checked out - </xsl:text>
   1.130 +    </xsl:when>
   1.131 +    <xsl:otherwise>
   1.132 +      <xsl:text> + </xsl:text>
   1.133 +      <xsl:value-of select="$micro"/>
   1.134 +      <xsl:text>  /* </xsl:text>
   1.135 +    </xsl:otherwise>
   1.136 +  </xsl:choose>
   1.137 +  <xsl:text>version: </xsl:text>
   1.138 +  <xsl:call-template name="showversion"/>
   1.139 +  <xsl:text> */
   1.140 +};
   1.141 +
   1.142 +JNIEXPORT jint JNICALL 
   1.143 +Agent_OnLoad(JavaVM *vm, char *options, void *reserved);
   1.144 +
   1.145 +JNIEXPORT jint JNICALL
   1.146 +Agent_OnAttach(JavaVM* vm, char* options, void* reserved);
   1.147 +
   1.148 +JNIEXPORT void JNICALL 
   1.149 +Agent_OnUnload(JavaVM *vm);
   1.150 +
   1.151 +    /* Forward declaration of the environment */
   1.152 +        
   1.153 +struct _jvmtiEnv;
   1.154 +
   1.155 +struct jvmtiInterface_1_;
   1.156 +  
   1.157 +#ifdef __cplusplus
   1.158 +typedef _jvmtiEnv jvmtiEnv;
   1.159 +#else
   1.160 +typedef const struct jvmtiInterface_1_ *jvmtiEnv;
   1.161 +#endif /* __cplusplus */
   1.162 +
   1.163 +</xsl:text>
   1.164 +  </xsl:template>
   1.165 +
   1.166 +  <xsl:template name="outro">
   1.167 +  <xsl:text>
   1.168 +
   1.169 +#ifdef __cplusplus
   1.170 +} /* extern "C" */
   1.171 +#endif /* __cplusplus */
   1.172 +
   1.173 +#endif /* !_JAVA_JVMTI_H_ */
   1.174 +
   1.175 +</xsl:text>
   1.176 +</xsl:template>
   1.177 +
   1.178 +<xsl:template match="eventsection" mode="enum">
   1.179 +  <xsl:text>
   1.180 +    /* Event IDs */
   1.181 +
   1.182 +typedef enum {
   1.183 +</xsl:text>
   1.184 +     <xsl:for-each select="event">
   1.185 +       <xsl:sort select="@num" data-type="number"/>
   1.186 +       <xsl:if test="position()=1">
   1.187 +         <xsl:text>    JVMTI_MIN_EVENT_TYPE_VAL = </xsl:text>
   1.188 +         <xsl:value-of select="@num"/>
   1.189 +         <xsl:text>,
   1.190 +</xsl:text>
   1.191 +       </xsl:if>
   1.192 +       <xsl:apply-templates select="." mode="enum"/>
   1.193 +       <xsl:text>,
   1.194 +</xsl:text>
   1.195 +       <xsl:if test="position()=last()">
   1.196 +         <xsl:text>    JVMTI_MAX_EVENT_TYPE_VAL = </xsl:text>
   1.197 +         <xsl:value-of select="@num"/>
   1.198 +       </xsl:if>
   1.199 +     </xsl:for-each>
   1.200 +    <xsl:text>
   1.201 +} jvmtiEvent;
   1.202 +
   1.203 +</xsl:text>
   1.204 +</xsl:template>
   1.205 +
   1.206 +<xsl:template match="eventsection" mode="body">
   1.207 +  <xsl:text>
   1.208 +
   1.209 +    /* Event Definitions */
   1.210 +
   1.211 +typedef void (JNICALL *jvmtiEventReserved)(void);
   1.212 +
   1.213 +</xsl:text>
   1.214 +  <xsl:apply-templates select="event" mode="definition">
   1.215 +    <xsl:sort select="@id"/>
   1.216 +  </xsl:apply-templates>
   1.217 +
   1.218 +  <xsl:text>
   1.219 +    /* Event Callback Structure */
   1.220 +
   1.221 +typedef struct {
   1.222 +</xsl:text>
   1.223 +  <xsl:call-template name="eventStruct">
   1.224 +    <xsl:with-param name="events" select="event"/>
   1.225 +    <xsl:with-param name="index" select="0"/>
   1.226 +    <xsl:with-param name="started" select="false"/>
   1.227 +    <xsl:with-param name="comment" select="'Yes'"/>
   1.228 +  </xsl:call-template>
   1.229 +  <xsl:text>} jvmtiEventCallbacks;
   1.230 +</xsl:text>
   1.231 +
   1.232 +</xsl:template>
   1.233 +
   1.234 +
   1.235 +<xsl:template match="event" mode="definition">
   1.236 +  <xsl:text>
   1.237 +typedef void (JNICALL *jvmtiEvent</xsl:text>
   1.238 +  <xsl:value-of select="@id"/>
   1.239 +  <xsl:text>)
   1.240 +    (jvmtiEnv *jvmti_env</xsl:text>
   1.241 +  <xsl:apply-templates select="parameters" mode="signature">
   1.242 +    <xsl:with-param name="comma">
   1.243 +      <xsl:text>, 
   1.244 +     </xsl:text>
   1.245 +    </xsl:with-param>
   1.246 +   </xsl:apply-templates>
   1.247 + <xsl:text>);
   1.248 +</xsl:text>
   1.249 +</xsl:template>
   1.250 +
   1.251 +<xsl:template match="functionsection">
   1.252 +   <xsl:text>
   1.253 +
   1.254 +    /* Function Interface */
   1.255 +    
   1.256 +typedef struct jvmtiInterface_1_ {
   1.257 +
   1.258 +</xsl:text>
   1.259 +  <xsl:call-template name="funcStruct">
   1.260 +    <xsl:with-param name="funcs" select="category/function[count(@hide)=0]"/>
   1.261 +    <xsl:with-param name="index" select="1"/>
   1.262 +  </xsl:call-template>
   1.263 +
   1.264 +  <xsl:text>} jvmtiInterface_1;
   1.265 +
   1.266 +struct _jvmtiEnv {
   1.267 +    const struct jvmtiInterface_1_ *functions;
   1.268 +#ifdef __cplusplus
   1.269 +
   1.270 +</xsl:text>
   1.271 +  <xsl:apply-templates select="category" mode="cppinline"/>
   1.272 +  <xsl:text>
   1.273 +#endif /* __cplusplus */
   1.274 +};
   1.275 +</xsl:text>
   1.276 +
   1.277 +</xsl:template>
   1.278 +
   1.279 +<xsl:template name="funcStruct">
   1.280 +  <xsl:param name="funcs"/>
   1.281 +  <xsl:param name="index"/>
   1.282 +  <xsl:variable name="thisFunction" select="$funcs[@num=$index]"/>
   1.283 +  <xsl:text>  /* </xsl:text>
   1.284 +  <xsl:number value="$index" format="  1"/>
   1.285 +  <xsl:text> : </xsl:text>
   1.286 +  <xsl:choose>
   1.287 +    <xsl:when test="count($thisFunction)=1">
   1.288 +      <xsl:value-of select="$thisFunction/synopsis"/>
   1.289 +      <xsl:text> */
   1.290 +  jvmtiError (JNICALL *</xsl:text>
   1.291 +      <xsl:value-of select="$thisFunction/@id"/>
   1.292 +      <xsl:text>) (jvmtiEnv* env</xsl:text>
   1.293 +      <xsl:apply-templates select="$thisFunction/parameters" mode="signature">
   1.294 +        <xsl:with-param name="comma">
   1.295 +          <xsl:text>, 
   1.296 +    </xsl:text>
   1.297 +        </xsl:with-param>
   1.298 +      </xsl:apply-templates>
   1.299 +      <xsl:text>)</xsl:text>
   1.300 +    </xsl:when>
   1.301 +    <xsl:otherwise>
   1.302 +      <xsl:text> RESERVED */
   1.303 +  void *reserved</xsl:text>        
   1.304 +      <xsl:value-of select="$index"/>
   1.305 +    </xsl:otherwise>
   1.306 +  </xsl:choose>
   1.307 +  <xsl:text>;
   1.308 +
   1.309 +</xsl:text>
   1.310 +  <xsl:if test="count($funcs[@num &gt; $index]) &gt; 0">
   1.311 +    <xsl:call-template name="funcStruct">
   1.312 +      <xsl:with-param name="funcs" select="$funcs"/>
   1.313 +      <xsl:with-param name="index" select="1+$index"/>
   1.314 +    </xsl:call-template>
   1.315 +  </xsl:if>
   1.316 +</xsl:template>
   1.317 +
   1.318 +
   1.319 +<xsl:template match="function">
   1.320 +  <xsl:text>  jvmtiError (JNICALL *</xsl:text>
   1.321 +  <xsl:value-of select="@id"/>
   1.322 +  <xsl:text>) (jvmtiEnv* env</xsl:text>
   1.323 +  <xsl:apply-templates select="parameters" mode="signature"/>
   1.324 +  <xsl:text>);
   1.325 +
   1.326 +</xsl:text>
   1.327 +</xsl:template>
   1.328 +
   1.329 +<xsl:template match="category" mode="cppinline">
   1.330 +    <xsl:apply-templates select="function[count(@hide)=0]" mode="cppinline"/>
   1.331 +</xsl:template>
   1.332 +
   1.333 +<xsl:template match="function" mode="cppinline">
   1.334 +  <xsl:text>
   1.335 +  jvmtiError </xsl:text>
   1.336 +  <xsl:value-of select="@id"/>
   1.337 +  <xsl:text>(</xsl:text>
   1.338 +  <xsl:apply-templates select="parameters" mode="signaturenoleadcomma"/>
   1.339 +  <xsl:text>) {
   1.340 +    return functions-></xsl:text>
   1.341 +  <xsl:value-of select="@id"/>
   1.342 +  <xsl:text>(this</xsl:text>
   1.343 +  <xsl:for-each select="parameters">
   1.344 +    <xsl:for-each select="param">
   1.345 +      <xsl:if test="@id != '...' and count(jclass/@method) = 0">
   1.346 +        <xsl:text>, </xsl:text>
   1.347 +        <xsl:value-of select="@id"/>
   1.348 +      </xsl:if>
   1.349 +    </xsl:for-each>
   1.350 +  </xsl:for-each>
   1.351 +  <xsl:text>);
   1.352 +  }
   1.353 +</xsl:text>
   1.354 +</xsl:template>
   1.355 +
   1.356 +
   1.357 +  <xsl:template match="basetype">
   1.358 +    <xsl:if test="count(definition)!=0">
   1.359 +      <xsl:text>
   1.360 +</xsl:text>
   1.361 +      <xsl:apply-templates select="definition"/>
   1.362 +    </xsl:if>
   1.363 +  </xsl:template>
   1.364 +
   1.365 +  <xsl:template match="constants">
   1.366 +    <xsl:text>
   1.367 +
   1.368 +    /* </xsl:text>
   1.369 +    <xsl:value-of select="@label"/>
   1.370 +    <xsl:text> */ 
   1.371 +</xsl:text>
   1.372 +    <xsl:choose>
   1.373 +      <xsl:when test="@kind='enum'">
   1.374 +        <xsl:apply-templates select="." mode="enum"/>
   1.375 +      </xsl:when>
   1.376 +      <xsl:otherwise>
   1.377 +        <xsl:apply-templates select="." mode="constants"/>
   1.378 +      </xsl:otherwise>
   1.379 +    </xsl:choose>
   1.380 +  </xsl:template>
   1.381 +
   1.382 +<xsl:template match="callback">
   1.383 +      <xsl:text>
   1.384 +typedef </xsl:text>
   1.385 +      <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
   1.386 +      <xsl:text> (JNICALL *</xsl:text>
   1.387 +      <xsl:value-of select="@id"/>
   1.388 +      <xsl:text>)
   1.389 +    (</xsl:text>
   1.390 +      <xsl:for-each select="parameters">
   1.391 +        <xsl:apply-templates select="param[position()=1]" mode="signature"/>
   1.392 +        <xsl:for-each select="param[position()>1]">
   1.393 +          <xsl:text>, </xsl:text>
   1.394 +          <xsl:apply-templates select="." mode="signature"/>
   1.395 +        </xsl:for-each>
   1.396 +      </xsl:for-each>
   1.397 +      <xsl:text>);
   1.398 +</xsl:text>
   1.399 +</xsl:template>
   1.400 +
   1.401 +<xsl:template match="capabilitiestypedef">
   1.402 +  <xsl:text>
   1.403 +</xsl:text>
   1.404 +  <xsl:apply-templates select="." mode="genstruct"/>
   1.405 +  <xsl:text>
   1.406 +</xsl:text>
   1.407 +</xsl:template>
   1.408 +
   1.409 +<xsl:template match="typedef" mode="early">
   1.410 +  <xsl:text>struct _</xsl:text>
   1.411 +  <xsl:value-of select="@id"/>
   1.412 +  <xsl:text>;
   1.413 +</xsl:text>
   1.414 +  <xsl:text>typedef struct _</xsl:text>
   1.415 +  <xsl:value-of select="@id"/>
   1.416 +  <xsl:text> </xsl:text>
   1.417 +  <xsl:value-of select="@id"/>
   1.418 +  <xsl:text>;
   1.419 +</xsl:text>
   1.420 +</xsl:template>
   1.421 +
   1.422 +<xsl:template match="typedef" mode="body">
   1.423 +  <xsl:text>struct _</xsl:text>
   1.424 +  <xsl:value-of select="@id"/>
   1.425 +  <xsl:text> {
   1.426 +</xsl:text>
   1.427 +<xsl:apply-templates select="field" mode="signature"/>
   1.428 +  <xsl:text>};
   1.429 +</xsl:text>
   1.430 +</xsl:template>
   1.431 +
   1.432 +<xsl:template match="uniontypedef" mode="early">
   1.433 +  <xsl:text>union _</xsl:text>
   1.434 +  <xsl:value-of select="@id"/>
   1.435 +  <xsl:text>;
   1.436 +</xsl:text>
   1.437 +  <xsl:text>typedef union _</xsl:text>
   1.438 +  <xsl:value-of select="@id"/>
   1.439 +  <xsl:text> </xsl:text>
   1.440 +  <xsl:value-of select="@id"/>
   1.441 +  <xsl:text>;
   1.442 +</xsl:text>
   1.443 +</xsl:template>
   1.444 +
   1.445 +<xsl:template match="uniontypedef" mode="body">
   1.446 +  <xsl:text>union _</xsl:text>
   1.447 +  <xsl:value-of select="@id"/>
   1.448 +  <xsl:text> {
   1.449 +</xsl:text>
   1.450 +<xsl:apply-templates select="field" mode="signature"/>
   1.451 +  <xsl:text>};
   1.452 +</xsl:text>
   1.453 +</xsl:template>
   1.454 +
   1.455 +</xsl:stylesheet>

mercurial