Warning, file /multimedia/kmplayer/src/moz-sdk/jritypes.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
0002 /* ***** BEGIN LICENSE BLOCK *****
0003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
0004  *
0005  * The contents of this file are subject to the Mozilla Public License Version
0006  * 1.1 (the "License"); you may not use this file except in compliance with
0007  * the License. You may obtain a copy of the License at
0008  * http://www.mozilla.org/MPL/
0009  *
0010  * Software distributed under the License is distributed on an "AS IS" basis,
0011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
0012  * for the specific language governing rights and limitations under the
0013  * License.
0014  *
0015  * The Original Code is mozilla.org code.
0016  *
0017  * The Initial Developer of the Original Code is
0018  * Netscape Communications Corporation.
0019  * Portions created by the Initial Developer are Copyright (C) 1998
0020  * the Initial Developer. All Rights Reserved.
0021  *
0022  * Contributor(s):
0023  *
0024  * Alternatively, the contents of this file may be used under the terms of
0025  * either the GNU General Public License Version 2 or later (the "GPL"), or
0026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
0027  * in which case the provisions of the GPL or the LGPL are applicable instead
0028  * of those above. If you wish to allow use of your version of this file only
0029  * under the terms of either the GPL or the LGPL, and not to allow others to
0030  * use your version of this file under the terms of the MPL, indicate your
0031  * decision by deleting the provisions above and replace them with the notice
0032  * and other provisions required by the GPL or the LGPL. If you do not delete
0033  * the provisions above, a recipient may use your version of this file under
0034  * the terms of any one of the MPL, the GPL or the LGPL.
0035  *
0036  * ***** END LICENSE BLOCK ***** */
0037 
0038 /*******************************************************************************
0039  * Java Runtime Interface
0040  ******************************************************************************/
0041 
0042 #ifndef JRITYPES_H
0043 #define JRITYPES_H
0044 
0045 #include "jri_md.h"
0046 #include "jni.h"
0047 #include <stddef.h>
0048 #include <stdlib.h>
0049 #include <stdarg.h>
0050 
0051 #ifdef __cplusplus
0052 extern "C" {
0053 #endif
0054 
0055 /*******************************************************************************
0056  * Types
0057  ******************************************************************************/
0058 
0059 struct JRIEnvInterface;
0060 
0061 typedef void*       JRIRef;
0062 typedef void*       JRIGlobalRef;
0063 
0064 typedef jint        JRIFieldID;
0065 typedef jint        JRIMethodID;
0066 
0067 /* synonyms: */
0068 typedef JRIGlobalRef    jglobal;
0069 
0070 typedef union JRIValue {
0071     jbool           z;
0072     jbyte           b;
0073     jchar           c;
0074     jshort          s;
0075     jint            i;
0076     jlong           l;
0077     jfloat          f;
0078     jdouble         d;
0079     jref            r;
0080 } JRIValue;
0081 
0082 typedef enum JRIBoolean {
0083     JRIFalse        = 0,
0084     JRITrue         = 1
0085 } JRIBoolean;
0086 
0087 typedef enum JRIConstant {
0088     JRIUninitialized    = -1
0089 } JRIConstant;
0090 
0091 /* convenience types (these must be distinct struct types for c++ overloading): */
0092 #if 0   /* now in jni.h */
0093 typedef struct jbooleanArrayStruct*     jbooleanArray;
0094 typedef struct jbyteArrayStruct*        jbyteArray;
0095 typedef struct jcharArrayStruct*        jcharArray;
0096 typedef struct jshortArrayStruct*       jshortArray;
0097 typedef struct jintArrayStruct*         jintArray;
0098 typedef struct jlongArrayStruct*        jlongArray;
0099 typedef struct jfloatArrayStruct*       jfloatArray;
0100 typedef struct jdoubleArrayStruct*      jdoubleArray;
0101 typedef struct jobjectArrayStruct*      jobjectArray;
0102 #endif
0103 typedef struct jstringArrayStruct*      jstringArray;
0104 typedef struct jarrayArrayStruct*       jarrayArray;
0105 
0106 #define JRIConstructorMethodName    "<init>"
0107 
0108 /*******************************************************************************
0109  * Signature Construction Macros
0110  ******************************************************************************/
0111 
0112 /*
0113 ** These macros can be used to construct signature strings. Hopefully their names
0114 ** are a little easier to remember than the single character they correspond to.
0115 ** For example, to specify the signature of the method:
0116 **
0117 **  public int read(byte b[], int off, int len);
0118 **
0119 ** you could write something like this in C:
0120 **
0121 **  char* readSig = JRISigMethod(JRISigArray(JRISigByte)
0122 **                               JRISigInt
0123 **                               JRISigInt) JRISigInt;
0124 **
0125 ** Of course, don't put commas between the types.
0126 */
0127 #define JRISigArray(T)      "[" T
0128 #define JRISigByte          "B"
0129 #define JRISigChar          "C"
0130 #define JRISigClass(name)   "L" name ";"
0131 #define JRISigFloat         "F"
0132 #define JRISigDouble        "D"
0133 #define JRISigMethod(args)  "(" args ")"
0134 #define JRISigNoArgs        ""
0135 #define JRISigInt           "I"
0136 #define JRISigLong          "J"
0137 #define JRISigShort         "S"
0138 #define JRISigVoid          "V"
0139 #define JRISigBoolean       "Z"
0140 
0141 /*******************************************************************************
0142  * Environments
0143  ******************************************************************************/
0144 
0145 extern JRI_PUBLIC_API(const struct JRIEnvInterface**)
0146 JRI_GetCurrentEnv(void);
0147 
0148 /*******************************************************************************
0149  * Specific Scalar Array Types
0150  ******************************************************************************/
0151 
0152 /*
0153 ** The JRI Native Method Interface does not support boolean arrays. This
0154 ** is to allow Java runtime implementations to optimize boolean array
0155 ** storage. Using the ScalarArray operations on boolean arrays is bound
0156 ** to fail, so convert any boolean arrays to byte arrays in Java before
0157 ** passing them to a native method.
0158 */
0159 
0160 #define JRI_NewByteArray(env, length, initialValues)    \
0161     JRI_NewScalarArray(env, length, JRISigByte, (jbyte*)(initialValues))
0162 #define JRI_GetByteArrayLength(env, array)  \
0163     JRI_GetScalarArrayLength(env, array)
0164 #define JRI_GetByteArrayElements(env, array)    \
0165     JRI_GetScalarArrayElements(env, array)
0166 
0167 #define JRI_NewCharArray(env, length, initialValues)    \
0168     JRI_NewScalarArray(env, ((length) * sizeof(jchar)), JRISigChar, (jbyte*)(initialValues))
0169 #define JRI_GetCharArrayLength(env, array)  \
0170     JRI_GetScalarArrayLength(env, array)
0171 #define JRI_GetCharArrayElements(env, array)           \
0172     ((jchar*)JRI_GetScalarArrayElements(env, array))
0173 
0174 #define JRI_NewShortArray(env, length, initialValues)   \
0175     JRI_NewScalarArray(env, ((length) * sizeof(jshort)), JRISigShort, (jbyte*)(initialValues))
0176 #define JRI_GetShortArrayLength(env, array) \
0177     JRI_GetScalarArrayLength(env, array)
0178 #define JRI_GetShortArrayElements(env, array)          \
0179     ((jshort*)JRI_GetScalarArrayElements(env, array))
0180 
0181 #define JRI_NewIntArray(env, length, initialValues) \
0182     JRI_NewScalarArray(env, ((length) * sizeof(jint)), JRISigInt, (jbyte*)(initialValues))
0183 #define JRI_GetIntArrayLength(env, array)   \
0184     JRI_GetScalarArrayLength(env, array)
0185 #define JRI_GetIntArrayElements(env, array)        \
0186     ((jint*)JRI_GetScalarArrayElements(env, array))
0187 
0188 #define JRI_NewLongArray(env, length, initialValues)    \
0189     JRI_NewScalarArray(env, ((length) * sizeof(jlong)), JRISigLong, (jbyte*)(initialValues))
0190 #define JRI_GetLongArrayLength(env, array)  \
0191     JRI_GetScalarArrayLength(env, array)
0192 #define JRI_GetLongArrayElements(env, array)           \
0193     ((jlong*)JRI_GetScalarArrayElements(env, array))
0194 
0195 #define JRI_NewFloatArray(env, length, initialValues)   \
0196     JRI_NewScalarArray(env, ((length) * sizeof(jfloat)), JRISigFloat, (jbyte*)(initialValues))
0197 #define JRI_GetFloatArrayLength(env, array) \
0198     JRI_GetScalarArrayLength(env, array)
0199 #define JRI_GetFloatArrayElements(env, array)          \
0200     ((jfloat*)JRI_GetScalarArrayElements(env, array))
0201 
0202 #define JRI_NewDoubleArray(env, length, initialValues)  \
0203     JRI_NewScalarArray(env, ((length) * sizeof(jdouble)), JRISigDouble, (jbyte*)(initialValues))
0204 #define JRI_GetDoubleArrayLength(env, array)    \
0205     JRI_GetScalarArrayLength(env, array)
0206 #define JRI_GetDoubleArrayElements(env, array)         \
0207     ((jdouble*)JRI_GetScalarArrayElements(env, array))
0208 
0209 /******************************************************************************/
0210 /*
0211 ** JDK Stuff -- This stuff is still needed while we're using the JDK
0212 ** dynamic linking strategy to call native methods.
0213 */
0214 
0215 typedef union JRI_JDK_stack_item {
0216     /* Non pointer items */
0217     jint           i;
0218     jfloat         f;
0219     jint           o;
0220     /* Pointer items */
0221     void          *h;
0222     void          *p;
0223     unsigned char *addr;
0224 #ifdef IS_64
0225     double         d;
0226     long           l;       /* == 64bits! */
0227 #endif
0228 } JRI_JDK_stack_item;
0229 
0230 typedef union JRI_JDK_Java8Str {
0231     jint x[2];
0232     jdouble d;
0233     jlong l;
0234     void *p;
0235     float f;
0236 } JRI_JDK_Java8;
0237 
0238 /******************************************************************************/
0239 #ifdef __cplusplus
0240 }
0241 #endif
0242 #endif /* JRITYPES_H */
0243 /******************************************************************************/