There are three character string types in this program: null-terminated (rchar) strings ala 'C' language, UTF-8 (CONSTANT_Utf8_info) strings, and Unicode (jchar)[] strings.
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 nts.c.
#include "arch.h"
#include <string.h>
#include "jvmcfg.h"
#include "cfmacros.h"
#include "classfile.h"
#include "nts.h"
Go to the source code of this file.
Functions | |
static void | nts_c_dummy (void) |
jvm_array_dim | nts_get_prchar_arraydims (rchar *inbfr) |
Report the number of array dimensions prefixing a Java type string. | |
rchar * | nts_prchar2prchar_unformatted_classname (rchar *inbfr) |
Strip a null-terminated string of any class formatting it contains and return result in a heap-allocated buffer. When done with this result, perform HEAP_DATA_FREE(result) to return buffer to heap. | |
jshort | nts_prchar2unicode (rchar *inbfr, jchar *outbfr) |
Convert null-terminated string into Unicode buffer. | |
cp_info_dup * | nts_prchar2utf (rchar *inbfr) |
Convert null-terminated string buffer into UTF8 buffer. | |
cp_info_dup * | nts_prchar2utf_classname (rchar *inbfr, jvm_array_dim arraydims) |
Format a string buffer into UTF8 buffer with Java class information, including number of array dimensions. | |
rboolean | nts_prchar_isarray (rchar *inbfr) |
Test whether or not a Java type string is an array or not. | |
rboolean | nts_prchar_isclassformatted (rchar *src) |
Verify if a null-terminated string contains CLASS formatting or not. | |
rboolean | nts_prchar_isprimativeformatted (rchar *src) |
Verify if a null-terminated string contains PRIMATIVE formatting or not. May be prefixed with array specifiers. Everything after the base type character is ignored. | |
Variables | |
static char * | nts_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/nts.c $ $Id: nts.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." |
|
|
|
Convert null-terminated string buffer into UTF8 buffer.
rc->bytes UTF8 version of inbfr string
Definition at line 75 of file nts.c. References CONSTANT_Utf8_info::bytes, CONSTANT_Utf8, cp_info_dup::empty, FILL_INFO_DUP0, FILL_INFO_DUP1, FILL_INFO_DUP2, HEAP_GET_DATA, CONSTANT_Utf8_info::length, PTR_THIS_CP_Utf8, rfalse, and CONSTANT_Utf8_info::tag. Referenced by class_find_by_cp_entry(), and method_find_by_prchar(). |
|
Convert null-terminated string into Unicode buffer.
charcnvcount (Return value of function) Number of Unicode characters in outbfr. |
|
Format a string buffer into UTF8 buffer with Java class information, including number of array dimensions.
[[[Lsome/path/name/filename;\0
The string then has a
< an instance of class '/class/name' < terminator for instance of class Definition at line 193 of file nts.c. References BASETYPE_CHAR_ARRAY, BASETYPE_CHAR_L, BASETYPE_CHAR_L_TERM, CONSTANT_Utf8_info::bytes, CONSTANT_Utf8, cp_info_dup::empty, FILL_INFO_DUP0, FILL_INFO_DUP1, FILL_INFO_DUP2, HEAP_GET_DATA, CONSTANT_Utf8_info::length, PTR_THIS_CP_Utf8, rfalse, and CONSTANT_Utf8_info::tag. |
|
Report the number of array dimensions prefixing a Java type string. No overflow condition is reported since it is assumed that inbfr is a valid (rchar *) string. Notice that because this logic checks only for array specifiers and does not care about the rest of the string, it may be used to evaluate field descriptions, which will not contain any class formatting information. If there is even a remote possibility that more than CONSTANT_MAX_ARRAY_DIMS dimensions will be found, compare the result of this function with the result of nts_prchar_isarray(). If there is a discrepancy, then there was an overflow here. Properly formatted class files will never contain code with this condition.
[[[Lsome/path/name/filename;
The string does not have a < Reference to one array dimension < Highest number of array dimensions < Not stated in spec, but implied Definition at line 293 of file nts.c. Referenced by nts_prchar_isarray(). |
|
Test whether or not a Java type string is an array or not.
Definition at line 336 of file nts.c. References nts_get_prchar_arraydims(). |
|
Verify if a null-terminated string contains PRIMATIVE formatting or not. May be prefixed with array specifiers. Everything after the base type character is ignored.
@ (where @ is any BASETYPE_CHAR_x character), rfalse otherwise. May also have array descriptor prefixed, thus [ [@, eg, [ [I or [ [[[D< Signed byte < Unicode character < Double-precision floating-point value < Single-precision floating-point value < Integer < Long integer < Signed short < Boolean, true or false Definition at line 368 of file nts.c. References BASETYPE_CHAR_B, BASETYPE_CHAR_C, BASETYPE_CHAR_D, BASETYPE_CHAR_F, BASETYPE_CHAR_I, BASETYPE_CHAR_J, BASETYPE_CHAR_S, BASETYPE_CHAR_Z, rfalse, and rtrue. |
|
Verify if a null-terminated string contains CLASS formatting or not.
< an instance of class '/class/name' < terminator for instance of class < an instance of class '/class/name' Definition at line 416 of file nts.c. Referenced by utf_isarray(), and utf_pcfs_strcmp(). |
|
Strip a null-terminated string of any class formatting it contains and return result in a heap-allocated buffer. When done with this result, perform HEAP_DATA_FREE(result) to return buffer to heap.
Definition at line 498 of file nts.c. References BASETYPE_CHAR_L_TERM. |
|
|