<jni.h>,
plus real machine mappings of Java types.
Convenient typedefs of both categories are also defined here.
These definitions distinguish between Java types and real machine types so as to keep the developer organized as to which is which in processing scenarios. The Java types begin with j and
the real machine types begin with r.
The main exception to this is the JVM class file definitions from the JVM spec, section 4, as implemented by classfile.h. These are followed without exception. In fact, a number of common type definitions are based on them. The jvm_XXX_index types are typically either direct class file references (such as jvm_object_hash or jvm_field_index) or are real machine definitions that directly support JVM processing structures (such as jvm_class_index or jvm_field_lookup_index).
The other common usage of a prefix is for variables. It is not related to this issue at all. In this situation, the letter p will typically be prefixed to pointers to/of any type in either processing domain.
The use of raw, native, 'C' language types such as int should
be restricted to system calls and library references such as open(2) or
strcmp(3),
respectively-- also the command line main() parameters
, which get propagated into argv_XXX() functions. Let the compiler perform any typing and sizing, which is unlikely, but keep all other usages to the Java jTYPEDEF and
real machine rTYPEDEF representations
. This single exception should be obvious when it occurs, and developers should be aware that this convention is used ubiquitously throughout the code.
Although definitions used by the JNI interface are found here, JNI is kept as a STRICTLY SEPARATE part of the code, and <jni.h> is
ONLY used there, namely in the ../include area.
JniSomeJavaClassWithNativeMethods.c source
file as found in its some.java.class.with.native.methods directory
. For example, the Java class java.lang.Object has
its Java source file stored in jni/src/vendor/product/version/src/java/lang/Object.java, with its native support found in the 'C' source file jni/src/vendor/product/version/src/java_lang_Object.c. The JNI header used to access this native java.lang.Object code
is found in the related include directory as jni/src/vendor/product/version/include/java_lang_Object.h.Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
Definition in file jrtypes.h.
Go to the source code of this file.
Selected manifest constants. | |
Common macros used commonly in 'C' code. Only permit use of #define's in constant definition source file, in static initialization, and in selected switch statements .
Most of these constants are found in some /usr/include directories on some platforms, but not others, and not regularly defined between platforms. Also, remove misc. inconsistencies in | |
#define | ERROR0 0 |
Typically found in <errno.h> or <sys/errno.h>. | |
Symbols to avoid. | |
In order to keep away from definitions of TRUE, FALSE, and NULL that may be defined all over the place, these symbols have been replaced in the real machine domain with rtrue, rfalse, and rnull. They have been replaced in the Java virtual machine domain by jtrue, jfalse, and jnull. | |
#define | FALSE ((rboolean) 0) |
Please use either rfalse for real machine FALSE cases or jfalse for Java virtual machine FALSE cases . | |
#define | FALSE DO_NOT_USE_FALSE |
Please use either rfalse for real machine FALSE cases or jfalse for Java virtual machine FALSE cases . | |
#define | NULL ((rvoid *) 0) |
Please use rnull for real machine NULL cases or jnull for Java virtual machine NULL cases . | |
#define | NULL DO_NOT_USE_NULL |
Please use rnull for real machine NULL cases or jnull for Java virtual machine NULL cases . | |
#define | TRUE ((rboolean) 1) |
Please use either rtrue for real machine TRUE cases or jtrue for Java virtual machine TRUE cases . | |
#define | TRUE DO_NOT_USE_TRUE |
Please use either rtrue for real machine TRUE cases or jtrue for Java virtual machine TRUE cases . | |
Java architecture primative types. | |
Real machine implementation of Java primative types. | |
#define | JBITS 8 |
Number of bits per byte in JVM. | |
typedef unsigned char | jboolean |
Java (boolean ). | |
typedef signed char | jbyte |
Java (byte ). | |
typedef unsigned short | jchar |
Java (char ). | |
typedef double | jdouble |
Java (double ). | |
typedef float | jfloat |
Java (float ). | |
typedef signed int | jint |
Java (int ). | |
typedef signed long long | jlong |
Java (long ). | |
typedef signed short | jshort |
Java (short ). | |
typedef void | jvoid |
Java (void ) is not found in <jni.h> !!! It is used here to be consistent with separation of Java vs real machine data types. | |
Java Native Interface definitions. | |
Selected JNI definitions needed by this implementation for JNI interface purposes, but never used in the core code. | |
#define | JNI_FALSE 0 |
Defined by <jni.h> (never used in core code). | |
#define | JNI_TRUE 1 |
Defined by <jni.h> (never used in core code). | |
Unsigned equivalents to Java primative types. | |
Convenient workarounds for unsigned typesthat are really not in Java.
These types are really faux, but are needed for internal implementation convenience or for more refined semantic interpretation of JVM spec fields. | |
typedef unsigned char | jubyte |
Unsigned equivalent of Java (byte). | |
typedef unsigned int | juint |
Unsigned equivalent of Java (int). | |
typedef unsigned long long | julong |
Unsigned equivalent of Java (long). | |
typedef unsigned short | jushort |
Unsigned equivalent of Java (short). | |
Real machine types. | |
Real machine abstraction of real machine primative types. With the exception of library(3) and system(2) calls, which use the types mandated in their man pages, all real machine primative types use these abstractions. This should significantly ease portability problems. | |
typedef unsigned char | rboolean |
Boolean for any purpose. | |
typedef unsigned char | rbyte |
8-bit byte for any purpose | |
typedef signed char | rchar |
Normal 8-bit 'C' character. | |
typedef double | rdouble |
Real machine (double ). | |
typedef float | rfloat |
Real machine (float ). | |
typedef signed int | rint |
Signed 32-bit integer. | |
typedef signed long long | rlong |
Signed 64-bit integer. | |
typedef signed short | rshort |
Signed 16-bit integer. | |
typedef unsigned int | ruint |
Unsigned 32-bit integer. | |
typedef unsigned long long | rulong |
Unsigned 64-bit integer. | |
typedef unsigned short | rushort |
Unsigned 16-bit integer. | |
typedef void | rvoid |
Real machine (void ), for pointers, (void *), untyped. | |
Classfile primative types. | |
Streams of unsigned bytes in the Java class file. The definitions of u1 and u2 and u4 are here so a to decouple these ubiquitous symbols from class file work.
Notice that, depending on context, these three definitions may be either signed or unsigned. For this implementation, there will be no further distinction made other than the | |
typedef jubyte | u1 |
Single byte. | |
typedef jushort | u2 |
Two bytes, like an unsigned short . | |
typedef juint | u4 |
Four bytes, like an unsigned int . | |
Java keywords | |
Real machine implementation of selected Java keywords. | |
const jboolean | jfalse |
Java constant false. | |
const jvoid * | jnull |
Java constant null. | |
const jboolean | jtrue |
Java constant true. | |
Real machine constants. | |
Real machine implementation of common industry keywords.
Instead of permitting unrestrained and potentially misuse and abuse of the common macros
Use rnull in all cases except static initalization. Use rtrue and $rfalse in all cases except static initialization and | |
const rboolean | rfalse |
Real machine constant FALSE. | |
const rboolean | rneither_true_nor_false |
Real machine constant neither. | |
const void * | rnull |
Real machine constant NULL. | |
const rboolean | rtrue |
Real machine constant TRUE. | |
Defines | |
#define | CHEAT_AND_ALLOW_NULL_CLASS_INDEX ((jvm_class_index) 0) |
Permit null class index manifest constant for initializing static and global storage. | |
#define | CHEAT_AND_ALLOW_NULL_OBJECT_HASH ((jvm_object_hash) 0) |
Permit null object hash manifest constant for initializing static and global storage. | |
#define | CHEAT_AND_ALLOW_NULL_THREAD_INDEX ((jvm_thread_index) 0) |
Permit null thread index manifest constant for initializing static and global storage. | |
#define | CHEAT_AND_USE_FALSE_TO_INITIALIZE ((rboolean) 0) |
Permit boolean "false" manifest constant for initializing static and global storage. | |
#define | CHEAT_AND_USE_NULL_TO_INITIALIZE ((rvoid *) 0) |
Permit null pointer manifest constant for initializing static and global storage. | |
#define | CHEAT_AND_USE_TRUE_TO_INITIALIZE ((rboolean) 1) |
Permit boolean "true" manifest constant for initializing static and global storage. | |
#define | NEITHER_TRUE_NOR_FALSE ((rboolean) 2) |
Value for initializing a boolean to "not initialized, that is, neither TRUE nor FALSE". | |
Functions | |
ARCH_COPYRIGHT_APACHE (jrtypes, h,"$URL: https://svn.apache.org/path/name/jrtypes.h $ $Id: jrtypes.h 0 09/28/2005 dlydick $") |
|
Number of bits per byte in JVM.
|
|
Defined by <jni.h> (never used in core code).
|
|
Defined by <jni.h> (never used in core code).
|
|
Typically found in <errno.h> or <sys/errno.h>.
Definition at line 335 of file jrtypes.h. Referenced by heap_get_error_simple(). |
|
Please use either rtrue for real machine
|
|
Please use either rfalse for real machine
|
|
Please use rnull for real machine
|
|
Please use rnull for real machine
|
|
Please use either rtrue for real machine
|
|
Please use either rfalse for real machine
|
|
Value for initializing a boolean to "not initialized, that is, neither TRUE nor FALSE".
|
|
Permit boolean "false" manifest constant for initializing static and global storage.
|
|
Permit boolean "true" manifest constant for initializing static and global storage.
|
|
Permit null pointer manifest constant for initializing static and global storage.
|
|
Permit null class index manifest constant for initializing static and global storage.
|
|
Permit null object hash manifest constant for initializing static and global storage.
|
|
Permit null thread index manifest constant for initializing static and global storage.
|
|
Java
|
|
Java
|
|
Java
|
|
Java
|
|
Java
|
|
Java
|
|
Java
|
|
Java
|
|
Java Also defined for our JNI purposes in jlObject.h |
|
Unsigned equivalent of Java (byte).
|
|
Unsigned equivalent of Java (short).
|
|
Unsigned equivalent of Java (int).
|
|
Unsigned equivalent of Java (long).
|
|
Single byte.
|
|
Two bytes, like an
|
|
Four bytes, like an
|
|
Normal 8-bit 'C' character.
|
|
8-bit byte for any purpose
|
|
Boolean for any purpose.
|
|
Signed 16-bit integer.
|
|
Unsigned 16-bit integer.
|
|
Signed 32-bit integer.
|
|
Unsigned 32-bit integer.
|
|
Signed 64-bit integer.
|
|
Unsigned 64-bit integer.
|
|
Real machine
|
|
Real machine
|
|
Real machine
|
|
|
|
Java constant
|
|
Java constant
Definition at line 57 of file jrtypes.c. Referenced by jlClass_isArray(), jlClass_isPrimative(), jlThread_currentThread(), jlThread_destroy(), jlThread_interrupt(), jlThread_setPriority(), jlThread_start(), and jlThread_yield(). |
|
Java constant
Definition at line 59 of file jrtypes.c. Referenced by jlClass_isArray(), jlThread_destroy(), jlThread_interrupt(), jlThread_interrupted(), jlThread_setPriority(), jlThread_start(), and jlThread_yield(). |
|
|
|
|
Real machine constant neither. Typically used during initialization to indicate a boolean is not ready. Definition at line 69 of file jrtypes.c. Referenced by classfile_loadclassdata(), and linkage_resolve_class(). |