1<?xml version="1.0" encoding="utf-8"?>
2<!--
3
4 Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
7 This code is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License version 2 only, as
9 published by the Free Software Foundation.
10
11 This code is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 version 2 for more details (a copy is included in the LICENSE file that
15 accompanied this code).
16
17 You should have received a copy of the GNU General Public License version
18 2 along with this work; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 or visit www.oracle.com if you need additional information or have any
23 questions.
24
25-->
26
27<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28                version="1.0">
29
30  <xsl:param name="majorversion"></xsl:param>
31
32  <xsl:template name="microversion">
33    <!-- Now microversion is always 0 -->
34    <xsl:text>0</xsl:text>
35  </xsl:template>
36
37  <xsl:template name="showbasicversion">
38    <xsl:value-of select="$majorversion"/>
39    <!-- Now minorversion is always 0 -->
40    <xsl:text>.0</xsl:text>
41  </xsl:template>
42
43  <xsl:template name="showversion">
44    <xsl:call-template name="showbasicversion"/>
45    <xsl:text>.</xsl:text>
46    <xsl:call-template name="microversion"/>
47  </xsl:template>
48
49  <xsl:variable name="GPL_header">
50    <!-- The Copyright comment from jvmti.xml -->
51    <xsl:value-of select="/comment()[position()=1]"/>
52  </xsl:variable>
53
54  <xsl:variable name="GPL_CP_header_body">
55    <xsl:text> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.&#xA;</xsl:text>
56    <xsl:text> *&#xA;</xsl:text>
57    <xsl:text> * This code is free software; you can redistribute it and/or modify it&#xA;</xsl:text>
58    <xsl:text> * under the terms of the GNU General Public License version 2 only, as&#xA;</xsl:text>
59    <xsl:text> * published by the Free Software Foundation.  Oracle designates this&#xA;</xsl:text>
60    <xsl:text> * particular file as subject to the "Classpath" exception as provided&#xA;</xsl:text>
61    <xsl:text> * by Oracle in the LICENSE file that accompanied this code.&#xA;</xsl:text>
62    <xsl:text> *&#xA;</xsl:text>
63    <xsl:text> * This code is distributed in the hope that it will be useful, but WITHOUT&#xA;</xsl:text>
64    <xsl:text> * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or&#xA;</xsl:text>
65    <xsl:text> * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License&#xA;</xsl:text>
66    <xsl:text> * version 2 for more details (a copy is included in the LICENSE file that&#xA;</xsl:text>
67    <xsl:text> * accompanied this code).&#xA;</xsl:text>
68    <xsl:text> *&#xA;</xsl:text>
69    <xsl:text> * You should have received a copy of the GNU General Public License version&#xA;</xsl:text>
70    <xsl:text> * 2 along with this work; if not, write to the Free Software Foundation,&#xA;</xsl:text>
71    <xsl:text> * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.&#xA;</xsl:text>
72    <xsl:text> *&#xA;</xsl:text>
73    <xsl:text> * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA&#xA;</xsl:text>
74    <xsl:text> * or visit www.oracle.com if you need additional information or have any&#xA;</xsl:text>
75    <xsl:text> * questions.&#xA;</xsl:text>
76  </xsl:variable>
77
78  <xsl:template name="copyrightComment">
79    <xsl:text>/*</xsl:text>
80    <!-- The Copyright comment from jvmti.xml -->
81    <xsl:value-of select="$GPL_header"/>
82    <xsl:text> */&#xA;&#xA;</xsl:text>
83  </xsl:template>
84
85  <xsl:template name="GPL_CP_copyrightComment">
86    <xsl:text>/*&#xA; *</xsl:text>
87    <!-- The Copyright year from jvmti.xml -->
88    <xsl:value-of select="substring-after(substring-before($GPL_header, ' DO NOT ALTER'), '&#xA;')"/>
89    <!-- The GPL+CP Copyright header body -->
90    <xsl:value-of select="$GPL_CP_header_body"/>
91    <xsl:text> */&#xA;&#xA;</xsl:text>
92  </xsl:template>
93
94  <xsl:template name="include_GPL_CP_Header">
95    <xsl:call-template name="GPL_CP_copyrightComment"/>
96    <xsl:text> /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */&#xA;</xsl:text>
97  </xsl:template>
98
99  <xsl:template name="includeHeader">
100    <xsl:call-template name="copyrightComment"/>
101    <xsl:text> /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */&#xA;</xsl:text>
102  </xsl:template>
103
104  <xsl:template name="sourceHeader">
105    <xsl:call-template name="copyrightComment"/>
106    <xsl:text> // AUTOMATICALLY GENERATED FILE - DO NOT EDIT&#xA;</xsl:text>
107  </xsl:template>
108
109
110<xsl:template match="parameters" mode="signature">
111  <xsl:param name="comma">
112    <xsl:text>,
113            </xsl:text>
114  </xsl:param>
115  <xsl:if test="count(param) != 0">
116    <xsl:value-of select="$comma"/>
117  </xsl:if>
118  <xsl:apply-templates select="." mode="signaturenoleadcomma">
119    <xsl:with-param name="comma" select="$comma"/>
120  </xsl:apply-templates>
121</xsl:template>
122
123
124<xsl:template match="parameters" mode="signaturenoleadcomma">
125  <xsl:param name="comma">
126    <xsl:text>,
127            </xsl:text>
128  </xsl:param>
129  <xsl:variable name="length" select="count(param)"/>
130  <xsl:for-each select="param">
131    <xsl:variable name="separator">
132        <xsl:choose>
133          <xsl:when test="position()=$length">
134            <xsl:text></xsl:text>
135          </xsl:when>
136          <xsl:otherwise>
137            <xsl:value-of select="$comma"/>
138          </xsl:otherwise>
139        </xsl:choose>
140    </xsl:variable>
141    <xsl:apply-templates select="." mode="signature">
142      <xsl:with-param name="comma" select="$separator"/>
143    </xsl:apply-templates>
144  </xsl:for-each>
145</xsl:template>
146
147
148<!-- remove jclass parameters that are jclass/jmethodID pairs.
149     since the jclass was removed in JVMTI.
150-->
151<xsl:template match="param" mode="signature">
152  <xsl:param name="comma"/>
153  <xsl:variable name="id" select="@id"/>
154  <xsl:for-each select="child::*[position()=1]">
155    <xsl:if test="count(@method)=0">
156      <xsl:apply-templates select="." mode="signature"/>
157      <xsl:text> </xsl:text>
158      <xsl:value-of select="$id"/>
159      <xsl:value-of select="$comma"/>
160    </xsl:if>
161  </xsl:for-each>
162</xsl:template>
163
164
165<xsl:template match="field" mode="signature">
166  <xsl:text>    </xsl:text>
167  <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
168  <xsl:text> </xsl:text>
169  <xsl:value-of select="@id"/>
170  <xsl:text>;
171</xsl:text>
172</xsl:template>
173
174<xsl:template match="nullok" mode="funcdescription">
175  If
176  <code>
177    <xsl:value-of select="../../@id"/>
178  </code>
179  is
180  <code>NULL</code>, <xsl:apply-templates/>.
181</xsl:template>
182
183<xsl:template match="vmbuf|allocfieldbuf|struct" mode="funcdescription">
184  <xsl:message terminate="yes">
185    vmbuf|allocfieldbuf|struct as type of function parameter
186  </xsl:message>
187</xsl:template>
188
189<xsl:template match="ptrtype" mode="funcdescription">
190  <div class="sep"/>
191  <xsl:apply-templates select="nullok" mode="funcdescription"/>
192</xsl:template>
193
194<xsl:template match="inptr" mode="funcdescription">
195  <div class="sep"/>
196  <xsl:variable name="child" select="child::*[position()=1]"/>
197  <xsl:text>Agent passes in a pointer</xsl:text>
198  <xsl:if test="name($child)!='void'">
199    <xsl:text> to </xsl:text>
200    <code>
201      <xsl:apply-templates select="$child" mode="signature"/>
202    </code>
203  </xsl:if>
204  <xsl:text>. </xsl:text>
205  <xsl:apply-templates select="nullok" mode="funcdescription"/>
206</xsl:template>
207
208<xsl:template match="inbuf" mode="funcdescription">
209  <div class="sep"/>
210  <xsl:variable name="child" select="child::*[position()=1]"/>
211  <xsl:text>Agent passes in </xsl:text>
212  <xsl:choose>
213    <xsl:when test="name($child)='void'">
214      <xsl:text> a pointer</xsl:text>
215    </xsl:when>
216    <xsl:otherwise>
217      <xsl:text> an array of </xsl:text>
218      <xsl:if test="count(@incount)=1 and @incount!=''">
219        <code>
220          <xsl:value-of select="@incount"/>
221        </code>
222        <xsl:text> elements of </xsl:text>
223      </xsl:if>
224      <code>
225        <xsl:apply-templates select="$child" mode="signature"/>
226      </code>
227    </xsl:otherwise>
228  </xsl:choose>
229  <xsl:text>. </xsl:text>
230  <xsl:apply-templates select="nullok" mode="funcdescription"/>
231</xsl:template>
232
233<xsl:template match="outptr" mode="funcdescription">
234  <div class="sep"/>
235  <xsl:text>Agent passes a pointer to a </xsl:text>
236  <code>
237    <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
238  </code>
239  <xsl:text>. </xsl:text>
240  <xsl:text>On return, the </xsl:text>
241  <code>
242    <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
243  </code>
244  <xsl:text> has been set. </xsl:text>
245  <xsl:apply-templates select="nullok" mode="funcdescription"/>
246  <xsl:apply-templates select="child::*[position()=1]" mode="returndescription"/>
247</xsl:template>
248
249<xsl:template match="allocbuf" mode="funcdescription">
250  <div class="sep"/>
251  <xsl:text>Agent passes a pointer to a </xsl:text>
252  <code>
253    <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
254    <xsl:text>*</xsl:text>
255  </code>
256  <xsl:text>. </xsl:text>
257  <xsl:text>On return, the </xsl:text>
258  <code>
259    <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
260    <xsl:text>*</xsl:text>
261  </code>
262  <xsl:text> points to a newly allocated array</xsl:text>
263  <xsl:choose>
264    <xsl:when test="count(@outcount)=1 and @outcount!=''">
265      <xsl:text> of size </xsl:text>
266      <code>
267        <xsl:text>*</xsl:text>
268        <xsl:value-of select="@outcount"/>
269      </code>
270    </xsl:when>
271    <xsl:otherwise>
272      <xsl:if test="count(@incount)=1 and @incount!=''">
273        <xsl:text> of size </xsl:text>
274        <code>
275          <xsl:value-of select="@incount"/>
276        </code>
277      </xsl:if>
278    </xsl:otherwise>
279  </xsl:choose>
280  <xsl:text>.  The array should be freed with </xsl:text>
281  <a href="#Deallocate"><code>Deallocate</code></a>
282  <xsl:text>. </xsl:text>
283  <xsl:apply-templates select="nullok" mode="funcdescription"/>
284  <xsl:apply-templates select="child::*[position()=1]" mode="returndescription">
285    <xsl:with-param name="plural" select="'plural'"/>
286  </xsl:apply-templates>
287</xsl:template>
288
289<xsl:template match="allocallocbuf" mode="funcdescription">
290  <div class="sep"/>
291  <xsl:text>Agent passes a pointer to a </xsl:text>
292  <code>
293    <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
294    <xsl:text>**</xsl:text>
295  </code>
296  <xsl:text>. </xsl:text>
297  <xsl:text>On return, the </xsl:text>
298  <code>
299    <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
300    <xsl:text>**</xsl:text>
301  </code>
302  <xsl:text> points to a newly allocated array</xsl:text>
303  <xsl:choose>
304    <xsl:when test="count(@outcount)=1 and @outcount!=''">
305      <xsl:text> of size </xsl:text>
306      <code>
307        <xsl:text>*</xsl:text>
308        <xsl:value-of select="@outcount"/>
309      </code>
310    </xsl:when>
311    <xsl:otherwise>
312      <xsl:if test="count(@incount)=1 and @incount!=''">
313        <xsl:text> of size </xsl:text>
314        <code>
315          <xsl:value-of select="@incount"/>
316        </code>
317      </xsl:if>
318    </xsl:otherwise>
319  </xsl:choose>
320  <xsl:text>, each element of which is also newly allocated.
321  The array should be freed with </xsl:text>
322  <a href="#Deallocate"><code>Deallocate</code></a>
323  <xsl:text>.
324  Each of the elements should be freed with </xsl:text>
325  <a href="#Deallocate"><code>Deallocate</code></a>
326  <xsl:text>. </xsl:text>
327  <xsl:apply-templates select="nullok" mode="funcdescription"/>
328  <xsl:apply-templates select="child::*[position()=1]" mode="returndescription">
329    <xsl:with-param name="plural" select="'plural'"/>
330  </xsl:apply-templates>
331</xsl:template>
332
333<xsl:template match="outbuf" mode="funcdescription">
334  <div class="sep"/>
335  <xsl:text>Agent passes an array </xsl:text>
336  <xsl:if test="count(@incount)=1 and @incount!=''">
337    <xsl:text>large enough to hold </xsl:text>
338    <code>
339      <xsl:value-of select="@incount"/>
340    </code>
341    <xsl:text> elements </xsl:text>
342  </xsl:if>
343  <xsl:text>of </xsl:text>
344  <code>
345    <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
346  </code>
347  <xsl:text>. The incoming values of the elements of the array are ignored. </xsl:text>
348  <xsl:text>On return, </xsl:text>
349  <xsl:if test="count(@outcount)=1 and @outcount!=''">
350    <code>
351      <xsl:text>*</xsl:text>
352      <xsl:value-of select="@outcount"/>
353    </code>
354    <xsl:text> of </xsl:text>
355  </xsl:if>
356  <xsl:text>the elements are set. </xsl:text>
357  <xsl:apply-templates select="nullok" mode="funcdescription"/>
358  <xsl:apply-templates select="child::*[position()=1]" mode="returndescription">
359    <xsl:with-param name="plural" select="'plural'"/>
360  </xsl:apply-templates>
361</xsl:template>
362
363<xsl:template match="agentbuf" mode="funcdescription">
364  <div class="sep"/>
365  <xsl:apply-templates select="nullok" mode="funcdescription"/>
366  <xsl:apply-templates select="child::*[position()=1]" mode="returndescription">
367    <xsl:with-param name="plural" select="'plural'"/>
368  </xsl:apply-templates>
369</xsl:template>
370
371<xsl:template match="jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jobject|jvalue|jthreadGroup|enum|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct" mode="funcdescription">
372</xsl:template>
373
374<xsl:template match="jthread" mode="funcdescription">
375  <xsl:if test="count(@null)!=0">
376    If
377    <code>
378      <xsl:value-of select="../@id"/>
379    </code>
380    is
381    <code>NULL</code>, the current thread is used.
382  </xsl:if>
383</xsl:template>
384
385<xsl:template match="jmethodID|jfieldID|jframeID|jrawMonitorID|enum|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs" mode="returndescription">
386</xsl:template>
387
388<xsl:template match="struct" mode="returndescription">
389  <xsl:param name="plural"/>
390  <xsl:variable name="structname" select="."/>
391  <xsl:for-each select="//typedef[@id=$structname]|//uniontypedef[@id=$structname]">
392    <xsl:for-each select="field">
393      <xsl:apply-templates select="child::*[position()=1]" mode="fieldreturndescription">
394        <xsl:with-param name="plural" select="$plural"/>
395      </xsl:apply-templates>
396    </xsl:for-each>
397  </xsl:for-each>
398</xsl:template>
399
400<xsl:template match="jclass|jthread|jobject|jvalue|jthreadGroup" mode="returndescription">
401  <xsl:param name="plural"/>
402  <xsl:text>The object</xsl:text>
403  <xsl:if test="$plural='plural'">
404    <xsl:text>s</xsl:text>
405  </xsl:if>
406  <xsl:text> returned by </xsl:text>
407  <code>
408    <xsl:value-of select="../../@id"/>
409  </code>
410  <xsl:choose>
411    <xsl:when test="$plural='plural'">
412      <xsl:text> are JNI local references and must be </xsl:text>
413    </xsl:when>
414    <xsl:otherwise>
415      <xsl:text> is a JNI local reference and must be </xsl:text>
416    </xsl:otherwise>
417  </xsl:choose>
418  <a href="#refs">managed</a>.
419</xsl:template>
420
421<xsl:template match="outptr|inptr|inbuf|agentbuf|allocbuf|allocallocbuf" mode="fieldreturndescription">
422  <xsl:variable name="field" select="ancestor::field"/>
423  <xsl:message terminate="yes">
424    outptr, allocallocbuf, outbuf, vmbuf, allocbuf, inptr, inbuf or agentbuf as type of returned field:
425    <xsl:value-of select="$field/@id"/> of <xsl:value-of select="$field/../@id"/>
426  </xsl:message>
427</xsl:template>
428
429<xsl:template match="outbuf" mode="fieldreturndescription">
430  <!-- hand document this special case.
431  -->
432</xsl:template>
433
434<xsl:template match="struct" mode="fieldreturndescription">
435  <xsl:param name="plural"/>
436  <xsl:variable name="structname" select="."/>
437  <xsl:for-each select="//typedef[@id=$structname]|//uniontypedef[@id=$structname]">
438    <xsl:for-each select="field">
439      <xsl:apply-templates select="child::*[position()=1]" mode="fieldreturndescription">
440        <xsl:with-param name="plural" select="$plural"/>
441      </xsl:apply-templates>
442    </xsl:for-each>
443  </xsl:for-each>
444</xsl:template>
445
446<xsl:template match="allocfieldbuf" mode="fieldreturndescription">
447  <xsl:param name="plural"/>
448  <xsl:variable name="field" select="ancestor::field"/>
449  <xsl:text>The pointer</xsl:text>
450  <xsl:if test="$plural='plural'">
451    <xsl:text>s</xsl:text>
452  </xsl:if>
453  <xsl:text> returned in the field </xsl:text>
454  <code>
455    <xsl:value-of select="$field/@id"/>
456  </code>
457  <xsl:text> of </xsl:text>
458  <code>
459    <xsl:value-of select="$field/../@id"/>
460  </code>
461  <xsl:choose>
462    <xsl:when test="$plural='plural'">
463      <xsl:text> are newly allocated arrays. The arrays</xsl:text>
464    </xsl:when>
465    <xsl:otherwise>
466      <xsl:text> is a newly allocated array. The array</xsl:text>
467    </xsl:otherwise>
468  </xsl:choose>
469  <xsl:text> should be freed with </xsl:text>
470  <a href="#Deallocate"><code>Deallocate</code></a>
471  <xsl:text>. </xsl:text>
472
473  <xsl:apply-templates select="child::*[position()=1]" mode="fieldreturndescription">
474    <xsl:with-param name="plural" select="'plural'"/>
475  </xsl:apply-templates>
476</xsl:template>
477
478<xsl:template match="ptrtype|vmbuf|jmethodID|jfieldID|jframeID|jrawMonitorID|enum|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void" mode="fieldreturndescription">
479</xsl:template>
480
481<xsl:template match="jclass|jthread|jobject|jvalue|jthreadGroup" mode="fieldreturndescription">
482  <xsl:param name="plural"/>
483  <xsl:variable name="field" select="ancestor::field"/>
484  <xsl:text>The object</xsl:text>
485  <xsl:if test="$plural='plural'">
486    <xsl:text>s</xsl:text>
487  </xsl:if>
488  <xsl:text> returned in the field </xsl:text>
489  <code>
490    <xsl:value-of select="$field/@id"/>
491  </code>
492  <xsl:text> of </xsl:text>
493  <code>
494    <xsl:value-of select="$field/../@id"/>
495  </code>
496  <xsl:choose>
497    <xsl:when test="$plural='plural'">
498      <xsl:text> are JNI local references and must be </xsl:text>
499    </xsl:when>
500    <xsl:otherwise>
501      <xsl:text> is a JNI local reference and must be </xsl:text>
502    </xsl:otherwise>
503  </xsl:choose>
504  <a href="#refs">managed</a>.
505</xsl:template>
506
507<xsl:template match="nullok" mode="signature">
508</xsl:template>
509
510<xsl:template match="jmethodID|jfieldID|jrawMonitorID|jclass|jthread|jobject|jvalue|jthreadGroup|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|size_t|void" mode="signature">
511  <xsl:value-of select="name()"/>
512</xsl:template>
513
514<xsl:template match="jframeID" mode="signature">
515  <xsl:text>jint</xsl:text>
516</xsl:template>
517
518<xsl:template match="uchar" mode="signature">
519  <xsl:text>unsigned char</xsl:text>
520</xsl:template>
521
522<xsl:template match="enum|struct" mode="signature">
523  <xsl:value-of select="."/>
524</xsl:template>
525
526<xsl:template match="varargs" mode="signature">
527</xsl:template>
528
529<xsl:template match="outptr|outbuf|allocfieldbuf" mode="signature">
530  <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
531  <xsl:text>*</xsl:text>
532</xsl:template>
533
534<xsl:template match="ptrtype" mode="signature">
535  <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
536</xsl:template>
537
538<xsl:template match="inptr|inbuf|vmbuf" mode="signature">
539  <xsl:text>const </xsl:text>
540  <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
541  <xsl:text>*</xsl:text>
542</xsl:template>
543
544<xsl:template match="allocbuf|agentbuf" mode="signature">
545  <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
546  <xsl:text>**</xsl:text>
547</xsl:template>
548
549<xsl:template match="allocallocbuf" mode="signature">
550  <xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
551  <xsl:text>***</xsl:text>
552</xsl:template>
553
554<xsl:template match="nullok" mode="link">
555</xsl:template>
556
557<xsl:template match="jmethodID|jfieldID|jrawMonitorID|jclass|jthread|jobject|jvalue|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|jthreadGroup" mode="link">
558  <a>
559    <xsl:attribute name="href">
560      <xsl:text>#</xsl:text><xsl:value-of select="name()"/>
561    </xsl:attribute>
562    <xsl:value-of select="name()"/>
563  </a>
564</xsl:template>
565
566<xsl:template match="jframeID" mode="link">
567  <a>
568    <xsl:attribute name="href">
569      <xsl:text>#jint</xsl:text>
570    </xsl:attribute>
571    <xsl:text>jint</xsl:text>
572  </a>
573</xsl:template>
574
575<xsl:template match="enum|struct" mode="link">
576  <a>
577    <xsl:attribute name="href">
578      <xsl:text>#</xsl:text>
579      <xsl:value-of select="."/>
580    </xsl:attribute>
581    <xsl:value-of select="."/>
582  </a>
583</xsl:template>
584
585<xsl:template match="char|size_t|void" mode="link">
586    <xsl:value-of select="name()"/>
587</xsl:template>
588
589<xsl:template match="uchar" mode="link">
590    <xsl:text>unsigned char</xsl:text>
591</xsl:template>
592
593<xsl:template match="varargs" mode="link">
594  <xsl:text>...</xsl:text>
595</xsl:template>
596
597<xsl:template match="ptrtype" mode="link">
598  <xsl:apply-templates mode="link"/>
599</xsl:template>
600
601<xsl:template match="outptr|outbuf|allocfieldbuf" mode="link">
602  <xsl:apply-templates mode="link"/>
603  <xsl:text>*</xsl:text>
604</xsl:template>
605
606<xsl:template match="inptr|inbuf|vmbuf" mode="link">
607  <xsl:text>const </xsl:text>
608  <xsl:apply-templates mode="link"/>
609  <xsl:text>*</xsl:text>
610</xsl:template>
611
612<xsl:template match="allocbuf|agentbuf" mode="link">
613  <xsl:apply-templates mode="link"/>
614  <xsl:text>**</xsl:text>
615</xsl:template>
616
617<xsl:template match="allocallocbuf" mode="link">
618  <xsl:apply-templates mode="link"/>
619  <xsl:text>***</xsl:text>
620</xsl:template>
621
622<xsl:template match="jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jobject|jvalue|jthreadGroup|jthread|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|size_t|void" mode="btsig">
623  <xsl:value-of select="name()"/>
624</xsl:template>
625
626<xsl:template match="uchar" mode="btsig">
627  <xsl:text>unsigned char</xsl:text>
628</xsl:template>
629
630<xsl:template match="enum|struct" mode="btsig">
631  <xsl:value-of select="."/>
632</xsl:template>
633
634<xsl:template match="outbuf" mode="btsig">
635  <xsl:apply-templates select="child::*[position()=1]" mode="btsig"/>
636  <xsl:text>*</xsl:text>
637</xsl:template>
638
639<xsl:template name="gentypedef">
640  <xsl:param name="tdef"/>
641  <xsl:text>typedef struct {
642</xsl:text>
643<xsl:apply-templates select="$tdef/field" mode="signature"/>
644  <xsl:text>} </xsl:text>
645  <xsl:value-of select="$tdef/@id"/>
646  <xsl:text>;</xsl:text>
647</xsl:template>
648
649<xsl:template name="genuniontypedef">
650  <xsl:param name="tdef"/>
651  <xsl:text>typedef union {
652</xsl:text>
653<xsl:apply-templates select="$tdef/field" mode="signature"/>
654  <xsl:text>} </xsl:text>
655  <xsl:value-of select="$tdef/@id"/>
656  <xsl:text>;</xsl:text>
657</xsl:template>
658
659
660<xsl:template match="capabilitiestypedef" mode="genstruct">
661  <xsl:variable name="caps" select="count(capabilityfield)"/>
662  <xsl:text>typedef struct {
663</xsl:text>
664  <xsl:apply-templates select="capabilityfield" mode="signature"/>
665  <xsl:variable name="rem" select="$caps mod 16"/>
666  <xsl:if test="$rem != 0">
667    <xsl:text>    unsigned int : </xsl:text>
668    <xsl:value-of select="16 - $rem"/>
669    <xsl:text>;
670</xsl:text>
671  </xsl:if>
672  <xsl:if test="$caps &lt;= 32">
673    <xsl:text>    unsigned int : 16;
674</xsl:text>
675  </xsl:if>
676  <xsl:if test="$caps &lt;= 48">
677    <xsl:text>    unsigned int : 16;
678</xsl:text>
679  </xsl:if>
680  <xsl:if test="$caps &lt;= 64">
681    <xsl:text>    unsigned int : 16;
682</xsl:text>
683  </xsl:if>
684  <xsl:if test="$caps &lt;= 80">
685    <xsl:text>    unsigned int : 16;
686</xsl:text>
687  </xsl:if>
688  <xsl:if test="$caps &lt;= 96">
689    <xsl:text>    unsigned int : 16;
690</xsl:text>
691  </xsl:if>
692  <xsl:if test="$caps &lt;= 112">
693    <xsl:text>    unsigned int : 16;
694</xsl:text>
695  </xsl:if>
696  <xsl:text>} </xsl:text>
697  <xsl:value-of select="@id"/>
698  <xsl:text>;</xsl:text>
699</xsl:template>
700
701<xsl:template match="capabilityfield" mode="signature">
702  <xsl:text>    unsigned int </xsl:text>
703  <xsl:value-of select="@id"/>
704  <xsl:text> : 1;
705</xsl:text>
706</xsl:template>
707
708<xsl:template match="constants" mode="enum">
709  <xsl:text>
710typedef </xsl:text>
711  <xsl:apply-templates select="." mode="enumcore"/>
712  <xsl:text> </xsl:text>
713  <xsl:value-of select="@id"/>
714  <xsl:text>;</xsl:text>
715</xsl:template>
716
717<xsl:template match="constants" mode="constants">
718  <xsl:text>
719</xsl:text>
720  <xsl:apply-templates select="." mode="enumcore"/>
721  <xsl:text>;</xsl:text>
722</xsl:template>
723
724<xsl:template match="constants" mode="enumcore">
725  <xsl:text>enum {
726</xsl:text>
727  <xsl:for-each select="constant">
728    <xsl:if test="position() &gt; 1">
729      <xsl:text>,
730</xsl:text>
731    </xsl:if>
732    <xsl:apply-templates select="." mode="enum"/>
733  </xsl:for-each>
734  <xsl:text>
735}</xsl:text>
736</xsl:template>
737
738<xsl:template match="event" mode="enum">
739  <xsl:text>    </xsl:text>
740  <xsl:value-of select="@const"/>
741  <xsl:text> = </xsl:text>
742  <xsl:value-of select="@num"/>
743</xsl:template>
744
745<xsl:template match="constant|errorid" mode="enum">
746  <xsl:text>    </xsl:text>
747  <xsl:value-of select="@id"/>
748  <xsl:text> = </xsl:text>
749  <xsl:value-of select="@num"/>
750</xsl:template>
751
752
753  <xsl:template name="eventStruct">
754    <xsl:param name="events"/>
755    <xsl:param name="index"/>
756    <xsl:param name="started"/>
757    <xsl:param name="comment"/>
758    <xsl:variable name="thisEvent" select="$events[@num=$index]"/>
759    <xsl:choose>
760      <xsl:when test="count($thisEvent)=1">
761        <xsl:if test="$comment='Yes'">
762          <xsl:text>                              /* </xsl:text>
763          <xsl:number value="$index" format="  1"/>
764          <xsl:text> : </xsl:text>
765          <xsl:value-of select="$thisEvent/@label"/>
766          <xsl:text> */
767</xsl:text>
768        </xsl:if>
769        <xsl:text>    jvmtiEvent</xsl:text>
770        <xsl:value-of select="$thisEvent/@id"/>
771        <xsl:text> </xsl:text>
772        <xsl:value-of select="$thisEvent/@id"/>
773        <xsl:text>;
774</xsl:text>
775    </xsl:when>
776    <xsl:otherwise>
777      <xsl:if test="$started">
778        <xsl:if test="$comment='Yes'">
779          <xsl:text>                              /* </xsl:text>
780          <xsl:number value="$index" format="  1"/>
781          <xsl:text> */
782</xsl:text>
783        </xsl:if>
784        <xsl:text>    jvmtiEventReserved reserved</xsl:text>
785        <xsl:value-of select="$index"/>
786        <xsl:text>;
787</xsl:text>
788    </xsl:if>
789  </xsl:otherwise>
790</xsl:choose>
791    <xsl:if test="count($events[@num &gt; $index]) &gt; 0">
792      <xsl:call-template name="eventStruct">
793        <xsl:with-param name="events" select="$events"/>
794        <xsl:with-param name="index" select="1+$index"/>
795        <xsl:with-param name="started" select="$started or count($thisEvent)=1"/>
796        <xsl:with-param name="comment" select="$comment"/>
797      </xsl:call-template>
798    </xsl:if>
799  </xsl:template>
800
801
802<!-- ======== HotSpotType ======== -->
803
804<xsl:template match="parameters" mode="HotSpotSig">
805  <xsl:variable name="length" select="count(param)"/>
806  <xsl:for-each select="param">
807    <xsl:variable name="separator">
808        <xsl:choose>
809          <xsl:when test="position()=$length">
810            <xsl:text></xsl:text>
811          </xsl:when>
812          <xsl:otherwise>
813            <xsl:text>, </xsl:text>
814          </xsl:otherwise>
815        </xsl:choose>
816    </xsl:variable>
817    <xsl:apply-templates select="." mode="HotSpotSig">
818      <xsl:with-param name="comma" select="$separator"/>
819    </xsl:apply-templates>
820  </xsl:for-each>
821</xsl:template>
822
823<xsl:template match="param" mode="HotSpotSig">
824  <xsl:param name="comma"/>
825  <xsl:variable name="result">
826    <xsl:apply-templates select="child::*[position()=1]" mode="HotSpotType"/>
827  </xsl:variable>
828  <xsl:if test="string-length($result)!=0">
829    <xsl:value-of select="$result"/>
830    <xsl:text> </xsl:text>
831    <xsl:apply-templates select="child::*[position()=1]" mode="HotSpotName">
832      <xsl:with-param name="name" select="@id"/>
833    </xsl:apply-templates>
834    <xsl:value-of select="$comma"/>
835  </xsl:if>
836</xsl:template>
837
838<xsl:template match="jthread" mode="HotSpotType">
839  <xsl:choose>
840    <xsl:when test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
841      <xsl:text>JavaThread*</xsl:text>
842    </xsl:when>
843    <xsl:otherwise>
844      <xsl:value-of select="name()"/>
845    </xsl:otherwise>
846  </xsl:choose>
847</xsl:template>
848
849<xsl:template match="jrawMonitorID" mode="HotSpotType">
850  <xsl:text>JvmtiRawMonitor *</xsl:text>
851</xsl:template>
852
853<xsl:template match="jframeID" mode="HotSpotType">
854  <xsl:text>jint</xsl:text>
855</xsl:template>
856
857<xsl:template match="jmethodID" mode="HotSpotType">
858  <xsl:text>Method*</xsl:text>
859</xsl:template>
860
861<xsl:template match="jfieldID" mode="HotSpotType">
862  <xsl:text>fieldDescriptor*</xsl:text>
863</xsl:template>
864
865<xsl:template match="jclass" mode="HotSpotType">
866  <!--
867    classes passed as part of a class/method or class/field pair are used
868    by the wrapper to get the internal type but are not needed by nor
869    passed to the implementation layer.
870  -->
871  <xsl:if test="count(@method|@field)=0">
872    <xsl:text>oop</xsl:text>
873  </xsl:if>
874</xsl:template>
875
876<xsl:template match="nullok" mode="HotSpotType">
877</xsl:template>
878
879<xsl:template match="jobject|jvalue|jthreadGroup|enum|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|struct" mode="HotSpotType">
880  <xsl:apply-templates select="." mode="btsig"/>
881</xsl:template>
882
883<xsl:template match="varargs" mode="HotSpotType">
884  <xsl:text> </xsl:text>
885</xsl:template>
886
887<xsl:template match="outptr|outbuf|allocfieldbuf" mode="HotSpotType">
888  <xsl:apply-templates select="child::*[position()=1]" mode="btsig"/>
889  <xsl:text>*</xsl:text>
890</xsl:template>
891
892<xsl:template match="ptrtype" mode="HotSpotType">
893  <xsl:apply-templates select="child::*[position()=1]" mode="btsig"/>
894</xsl:template>
895
896<xsl:template match="inptr|inbuf|vmbuf" mode="HotSpotType">
897  <xsl:text>const </xsl:text>
898  <xsl:apply-templates select="child::*[position()=1]" mode="btsig"/>
899  <xsl:text>*</xsl:text>
900</xsl:template>
901
902<xsl:template match="allocbuf|agentbuf" mode="HotSpotType">
903  <xsl:apply-templates select="child::*[position()=1]" mode="btsig"/>
904  <xsl:text>**</xsl:text>
905</xsl:template>
906
907<xsl:template match="allocallocbuf" mode="HotSpotType">
908  <xsl:apply-templates select="child::*[position()=1]" mode="btsig"/>
909  <xsl:text>***</xsl:text>
910</xsl:template>
911
912<!-- ========  HotSpotName ======== -->
913
914<xsl:template match="jthread" mode="HotSpotName">
915  <xsl:param name="name"/>
916  <xsl:choose>
917    <xsl:when test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
918      <xsl:text>java_thread</xsl:text>
919    </xsl:when>
920    <xsl:otherwise>
921      <xsl:value-of select="$name"/>
922    </xsl:otherwise>
923  </xsl:choose>
924</xsl:template>
925
926<xsl:template match="jrawMonitorID" mode="HotSpotName">
927  <xsl:text>rmonitor</xsl:text>
928</xsl:template>
929
930<xsl:template match="jframeID" mode="HotSpotName">
931  <xsl:text>depth</xsl:text>
932</xsl:template>
933
934<xsl:template match="jmethodID" mode="HotSpotName">
935  <xsl:text>checked_method</xsl:text>
936</xsl:template>
937
938<xsl:template match="jfieldID" mode="HotSpotName">
939  <xsl:text>fdesc_ptr</xsl:text>
940</xsl:template>
941
942<xsl:template match="jclass" mode="HotSpotName">
943  <!--
944    classes passed as part of a class/method or class/field pair are used
945    by the wrapper to get the internal type but are not needed by nor
946    passed to the implementation layer.  This value is checked for empty.
947  -->
948  <xsl:if test="count(@method|@field)=0">
949    <xsl:text>k_mirror</xsl:text>
950  </xsl:if>
951</xsl:template>
952
953<xsl:template match="nullok" mode="HotSpotName">
954</xsl:template>
955
956<xsl:template match="jobject|jvalue|jthreadGroup|enum|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|outptr|outbuf|allocfieldbuf|ptrtype|inptr|inbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="HotSpotName">
957  <xsl:param name="name"/>
958  <xsl:value-of select="$name"/>
959</xsl:template>
960
961<!-- ======== HotSpotValue ======== -->
962
963
964<xsl:template match="parameters" mode="HotSpotValue">
965  <xsl:variable name="length" select="count(param)"/>
966  <xsl:for-each select="param">
967    <xsl:variable name="separator">
968        <xsl:choose>
969          <xsl:when test="position()=$length">
970            <xsl:text></xsl:text>
971          </xsl:when>
972          <xsl:otherwise>
973            <xsl:text>, </xsl:text>
974          </xsl:otherwise>
975        </xsl:choose>
976    </xsl:variable>
977    <xsl:apply-templates select="." mode="HotSpotValue">
978      <xsl:with-param name="comma" select="$separator"/>
979    </xsl:apply-templates>
980  </xsl:for-each>
981</xsl:template>
982
983<xsl:template match="param" mode="HotSpotValue">
984  <xsl:param name="comma"/>
985  <xsl:variable name="result">
986    <xsl:apply-templates select="child::*[position()=1]" mode="HotSpotValue">
987      <xsl:with-param name="name" select="@id"/>
988    </xsl:apply-templates>
989  </xsl:variable>
990  <xsl:if test="string-length($result)!=0">
991    <xsl:value-of select="$result"/>
992    <xsl:value-of select="$comma"/>
993  </xsl:if>
994</xsl:template>
995
996<xsl:template match="jframeID|jmethodID|jrawMonitorID|jthread|jclass|nullok" mode="HotSpotValue">
997  <xsl:param name="name"/>
998  <xsl:apply-templates select="." mode="HotSpotName">
999    <xsl:with-param name="name" select="$name"/>
1000  </xsl:apply-templates>
1001</xsl:template>
1002
1003<xsl:template match="jfieldID" mode="HotSpotValue">
1004  <xsl:text>&amp;fdesc</xsl:text>
1005</xsl:template>
1006
1007<xsl:template match="jobject|jvalue|jthreadGroup|enum|jint|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|struct|outptr|outbuf|allocfieldbuf|ptrtype|inptr|inbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="HotSpotValue">
1008  <xsl:param name="name"/>
1009  <xsl:value-of select="$name"/>
1010</xsl:template>
1011
1012<xsl:template match="varargs" mode="HotSpotValue">
1013  <xsl:text>NULL</xsl:text>
1014</xsl:template>
1015
1016</xsl:stylesheet>
1017
1018