Merge branch '3.0' into feature/stream
This commit is contained in:
commit
82e0f77715
|
@ -51,6 +51,13 @@ IF(${TD_WINDOWS})
|
||||||
"If build unit tests using googletest"
|
"If build unit tests using googletest"
|
||||||
ON
|
ON
|
||||||
)
|
)
|
||||||
|
ELSEIF (TD_DARWIN_64)
|
||||||
|
add_definitions(-DCOMPILER_SUPPORTS_CXX13)
|
||||||
|
option(
|
||||||
|
BUILD_TEST
|
||||||
|
"If build unit tests using googletest"
|
||||||
|
ON
|
||||||
|
)
|
||||||
ELSE ()
|
ELSE ()
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13)
|
CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13)
|
||||||
|
|
|
@ -127,7 +127,7 @@ int indexSearch(SIndex* index, SIndexMultiTermQuery* query, SArray* result);
|
||||||
* @parma opt (input, rebuild index opts)
|
* @parma opt (input, rebuild index opts)
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
int indexRebuild(SIndex* index, SIndexOpts* opt);
|
// int indexRebuild(SIndex* index, SIndexOpts* opt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* open index
|
* open index
|
||||||
|
@ -185,6 +185,25 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn operType, uint8_t c
|
||||||
int32_t nColName, const char* colVal, int32_t nColVal);
|
int32_t nColName, const char* colVal, int32_t nColVal);
|
||||||
void indexTermDestroy(SIndexTerm* p);
|
void indexTermDestroy(SIndexTerm* p);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rebuild index
|
||||||
|
*/
|
||||||
|
void indexRebuild(SIndexJson* idx, void* iter);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check index json status
|
||||||
|
**/
|
||||||
|
bool indexIsRebuild(SIndex* idx);
|
||||||
|
/*
|
||||||
|
* rebuild index json
|
||||||
|
*/
|
||||||
|
void indexJsonRebuild(SIndexJson* idx, void* iter);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check index json status
|
||||||
|
**/
|
||||||
|
bool indexJsonIsRebuild(SIndexJson* idx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* init index env
|
* init index env
|
||||||
*
|
*
|
||||||
|
@ -203,7 +222,7 @@ typedef enum { SFLT_NOT_INDEX, SFLT_COARSE_INDEX, SFLT_ACCURATE_INDEX } SIdxFltS
|
||||||
|
|
||||||
SIdxFltStatus idxGetFltStatus(SNode* pFilterNode);
|
SIdxFltStatus idxGetFltStatus(SNode* pFilterNode);
|
||||||
|
|
||||||
int32_t doFilterTag(const SNode* pFilterNode, SIndexMetaArg* metaArg, SArray* result);
|
int32_t doFilterTag(SNode* pFilterNode, SIndexMetaArg* metaArg, SArray* result, SIdxFltStatus* status);
|
||||||
/*
|
/*
|
||||||
* destory index env
|
* destory index env
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
aux_source_directory(src CLIENT_SRC)
|
aux_source_directory(src CLIENT_SRC)
|
||||||
|
|
||||||
if(TD_WINDOWS)
|
if(TD_WINDOWS)
|
||||||
add_library(taos SHARED ${CLIENT_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/taos.rc.in)
|
add_library(taos SHARED ${CLIENT_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/taos.rc.in)
|
||||||
else()
|
else()
|
||||||
add_library(taos SHARED ${CLIENT_SRC})
|
add_library(taos SHARED ${CLIENT_SRC})
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(jni)
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
taos
|
taos
|
||||||
PUBLIC "${TD_SOURCE_DIR}/include/client"
|
PUBLIC "${TD_SOURCE_DIR}/include/client"
|
||||||
|
@ -14,13 +18,19 @@ target_link_libraries(
|
||||||
INTERFACE api
|
INTERFACE api
|
||||||
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
|
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TD_WINDOWS)
|
if(TD_WINDOWS)
|
||||||
set_target_properties(taos
|
set_target_properties(taos
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
LINK_FLAGS
|
LINK_FLAGS
|
||||||
/DEF:${CMAKE_CURRENT_SOURCE_DIR}/src/taos.def
|
/DEF:${CMAKE_CURRENT_SOURCE_DIR}/src/taos.def
|
||||||
)
|
)
|
||||||
endif ()
|
INCLUDE_DIRECTORIES(jni/windows)
|
||||||
|
INCLUDE_DIRECTORIES(jni/windows/win32)
|
||||||
|
INCLUDE_DIRECTORIES(jni/windows/win32/bridge)
|
||||||
|
else()
|
||||||
|
INCLUDE_DIRECTORIES(jni/linux)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
taos
|
taos
|
||||||
|
|
|
@ -0,0 +1,266 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
/* Header for class com_taosdata_jdbc_TSDBJNIConnector */
|
||||||
|
|
||||||
|
#ifndef _Included_com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
#define _Included_com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#undef com_taosdata_jdbc_TSDBJNIConnector_INVALID_CONNECTION_POINTER_VALUE
|
||||||
|
#define com_taosdata_jdbc_TSDBJNIConnector_INVALID_CONNECTION_POINTER_VALUE 0LL
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: initImp
|
||||||
|
* Signature: (Ljava/lang/String;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_initImp(JNIEnv *, jclass, jstring);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: setOptions
|
||||||
|
* Signature: (ILjava/lang/String;)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv *, jclass, jint, jstring);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: setConfigImp
|
||||||
|
* Signature: (Ljava/lang/String;)Lcom/taosdata/jdbc/TSDBException;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jobject JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setConfigImp(JNIEnv *, jclass, jstring);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: getTsCharset
|
||||||
|
* Signature: ()Ljava/lang/String;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset(JNIEnv *, jclass);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: getResultTimePrecisionImp
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TDDBJNIConnector_getResultTimePrecisionImp(JNIEnv *, jobject, jlong,
|
||||||
|
jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: connectImp
|
||||||
|
* Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_connectImp(JNIEnv *, jobject, jstring, jint, jstring,
|
||||||
|
jstring, jstring);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: executeQueryImp
|
||||||
|
* Signature: ([BJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_executeQueryImp(JNIEnv *, jobject, jbyteArray, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: getErrCodeImp
|
||||||
|
* Signature: (J)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getErrCodeImp(JNIEnv *, jobject, jlong, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: getErrMsgImp
|
||||||
|
* Signature: (J)Ljava/lang/String;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getErrMsgImp(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: getResultSetImp
|
||||||
|
* Signature: (J)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getResultSetImp(JNIEnv *env, jobject jobj, jlong con,
|
||||||
|
jlong tres);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: isUpdateQueryImp
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_isUpdateQueryImp(JNIEnv *env, jobject jobj, jlong con,
|
||||||
|
jlong tres);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: freeResultSetImp
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_freeResultSetImp(JNIEnv *, jobject, jlong, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: getAffectedRowsImp
|
||||||
|
* Signature: (J)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getAffectedRowsImp(JNIEnv *env, jobject jobj, jlong con,
|
||||||
|
jlong res);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: getSchemaMetaDataImp
|
||||||
|
* Signature: (JJLjava/util/List;)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getSchemaMetaDataImp(JNIEnv *, jobject, jlong, jlong,
|
||||||
|
jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: fetchRowImp
|
||||||
|
* Signature: (JJLcom/taosdata/jdbc/TSDBResultSetRowData;)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEnv *, jobject, jlong, jlong, jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: fetchBlockImp
|
||||||
|
* Signature: (JJLcom/taosdata/jdbc/TSDBResultSetBlockData;)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchBlockImp(JNIEnv *, jobject, jlong, jlong, jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: closeConnectionImp
|
||||||
|
* Signature: (J)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_closeConnectionImp(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: subscribeImp
|
||||||
|
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JI)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNIEnv *, jobject, jlong, jboolean,
|
||||||
|
jstring, jstring, jint);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: consumeImp
|
||||||
|
* Signature: (J)Lcom/taosdata/jdbc/TSDBResultSetRowData;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: unsubscribeImp
|
||||||
|
* Signature: (J)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_unsubscribeImp(JNIEnv *, jobject, jlong, jboolean);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: validateCreateTableSqlImp
|
||||||
|
* Signature: (J[B)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTableSqlImp(JNIEnv *, jobject, jlong,
|
||||||
|
jbyteArray);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: prepareStmtImp
|
||||||
|
* Signature: ([BJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_prepareStmtImp(JNIEnv *, jobject, jbyteArray, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: setBindTableNameImp
|
||||||
|
* Signature: (JLjava/lang/String;J)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setBindTableNameImp(JNIEnv *, jobject, jlong, jstring,
|
||||||
|
jlong);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: setTableNameTagsImp
|
||||||
|
* Signature: (JLjava/lang/String;I[B[B[B[BJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setTableNameTagsImp(JNIEnv *, jobject, jlong, jstring,
|
||||||
|
jint, jbyteArray, jbyteArray,
|
||||||
|
jbyteArray, jbyteArray, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: bindColDataImp
|
||||||
|
* Signature: (J[B[B[BIIIIJ)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_bindColDataImp(JNIEnv *, jobject, jlong, jbyteArray,
|
||||||
|
jbyteArray, jbyteArray, jint, jint, jint,
|
||||||
|
jint, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: stmt_add_batch
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_addBatchImp(JNIEnv *env, jobject jobj, jlong stmt,
|
||||||
|
jlong con);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: executeBatchImp
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_executeBatchImp(JNIEnv *env, jobject jobj, jlong stmt,
|
||||||
|
jlong con);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: closeStmt
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_closeStmt(JNIEnv *env, jobject jobj, jlong stmt,
|
||||||
|
jlong con);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: stmt_errstr
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_stmtErrorMsgImp(JNIEnv *env, jobject jobj, jlong stmt,
|
||||||
|
jlong con);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: insertLinesImp
|
||||||
|
* Signature: ([Ljava/lang/String;JII)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(JNIEnv *, jobject, jobjectArray, jlong,
|
||||||
|
jint, jint);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||||
|
* Method: schemalessInsertImp
|
||||||
|
* Signature: (J[B[B[BIIIIJ)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_schemalessInsertImp(JNIEnv *, jobject, jobjectArray,
|
||||||
|
jlong, jint, jint);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -0,0 +1,169 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
/* Header for class com_taosdata_jdbc_tmq_TMQConnector */
|
||||||
|
|
||||||
|
#ifndef _Included_com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
#define _Included_com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqConfNewImp
|
||||||
|
* Signature: (Lcom/taosdata/jdbc/tmq/TAOSConsumer;)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfNewImp(JNIEnv *, jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqConfSetImp
|
||||||
|
* Signature: (JLjava/lang/String;Ljava/lang/String;)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfSetImp(JNIEnv *, jobject, jlong, jstring,
|
||||||
|
jstring);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqConfDestroyImp
|
||||||
|
* Signature: (J)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfDestroyImp(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqConsumerNewImp
|
||||||
|
* Signature: (JLcom/taosdata/jdbc/tmq/TMQConnector;)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerNewImp(JNIEnv *, jobject, jlong, jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqTopicNewImp
|
||||||
|
* Signature: (J)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicNewImp(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqTopicAppendImp
|
||||||
|
* Signature: (JLjava/lang/String;)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicAppendImp(JNIEnv *, jobject, jlong, jstring);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqTopicDestroyImp
|
||||||
|
* Signature: (J)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicDestroyImp(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqSubscribeImp
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscribeImp(JNIEnv *, jobject, jlong, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqSubscriptionImp
|
||||||
|
* Signature: (JLcom/taosdata/jdbc/tmq/TMQConnector;)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscriptionImp(JNIEnv *, jobject, jlong, jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqCommitSync
|
||||||
|
* Signature: (JJ)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNIEnv *, jobject, jlong, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqCommitAsync
|
||||||
|
* Signature: (JJLcom/taosdata/jdbc/tmq/TAOSConsumer;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JNIEnv *, jobject, jlong, jlong, jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqUnsubscribeImp
|
||||||
|
* Signature: (J)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqUnsubscribeImp(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqConsumerCloseImp
|
||||||
|
* Signature: (J)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerCloseImp(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: getErrMsgImp
|
||||||
|
* Signature: (I)Ljava/lang/String;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_getErrMsgImp(JNIEnv *, jobject, jint);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqConsumerPoll
|
||||||
|
* Signature: (JJ)J
|
||||||
|
*/
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerPoll(JNIEnv *, jobject, jlong, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqGetTopicName
|
||||||
|
* Signature: (J)Ljava/lang/String;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicName(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqGetDbName
|
||||||
|
* Signature: (J)Ljava/lang/String;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetDbName(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqGetVgroupId
|
||||||
|
* Signature: (J)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetVgroupId(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: tmqGetTableName
|
||||||
|
* Signature: (J)Ljava/lang/String;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTableName(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||||
|
* Method: fetchBlockImp
|
||||||
|
* Signature: (JJLcom/taosdata/jdbc/TSDBResultSetBlockData;ILjava/util/List;)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_fetchRawBlockImp(JNIEnv *, jobject, jlong, jlong,
|
||||||
|
jobject, jint, jobject);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
#include "taoserror.h"
|
||||||
|
#include "tdef.h"
|
||||||
|
#include "tlog.h"
|
||||||
|
#include "ttypes.h"
|
||||||
|
|
||||||
|
#ifndef TDENGINE_JNICOMMON_H
|
||||||
|
#define TDENGINE_JNICOMMON_H
|
||||||
|
|
||||||
|
#define jniFatal(...) \
|
||||||
|
{ \
|
||||||
|
if (jniDebugFlag & DEBUG_FATAL) { \
|
||||||
|
taosPrintLog("JNI FATAL ", DEBUG_FATAL, jniDebugFlag, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#define jniError(...) \
|
||||||
|
{ \
|
||||||
|
if (jniDebugFlag & DEBUG_ERROR) { \
|
||||||
|
taosPrintLog("JNI ERROR ", DEBUG_ERROR, jniDebugFlag, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#define jniWarn(...) \
|
||||||
|
{ \
|
||||||
|
if (jniDebugFlag & DEBUG_WARN) { \
|
||||||
|
taosPrintLog("JNI WARN ", DEBUG_WARN, jniDebugFlag, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#define jniInfo(...) \
|
||||||
|
{ \
|
||||||
|
if (jniDebugFlag & DEBUG_INFO) { \
|
||||||
|
taosPrintLog("JNI ", DEBUG_INFO, jniDebugFlag, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#define jniDebug(...) \
|
||||||
|
{ \
|
||||||
|
if (jniDebugFlag & DEBUG_DEBUG) { \
|
||||||
|
taosPrintLog("JNI ", DEBUG_DEBUG, jniDebugFlag, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#define jniTrace(...) \
|
||||||
|
{ \
|
||||||
|
if (jniDebugFlag & DEBUG_TRACE) { \
|
||||||
|
taosPrintLog("JNI ", DEBUG_TRACE, jniDebugFlag, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
extern jclass g_arrayListClass;
|
||||||
|
extern jmethodID g_arrayListConstructFp;
|
||||||
|
extern jmethodID g_arrayListAddFp;
|
||||||
|
|
||||||
|
extern jclass g_metadataClass;
|
||||||
|
extern jmethodID g_metadataConstructFp;
|
||||||
|
extern jfieldID g_metadataColtypeField;
|
||||||
|
extern jfieldID g_metadataColnameField;
|
||||||
|
extern jfieldID g_metadataColsizeField;
|
||||||
|
extern jfieldID g_metadataColindexField;
|
||||||
|
|
||||||
|
extern jclass g_rowdataClass;
|
||||||
|
extern jmethodID g_rowdataConstructor;
|
||||||
|
extern jmethodID g_rowdataClearFp;
|
||||||
|
extern jmethodID g_rowdataSetBooleanFp;
|
||||||
|
extern jmethodID g_rowdataSetByteFp;
|
||||||
|
extern jmethodID g_rowdataSetShortFp;
|
||||||
|
extern jmethodID g_rowdataSetIntFp;
|
||||||
|
extern jmethodID g_rowdataSetLongFp;
|
||||||
|
extern jmethodID g_rowdataSetFloatFp;
|
||||||
|
extern jmethodID g_rowdataSetDoubleFp;
|
||||||
|
extern jmethodID g_rowdataSetStringFp;
|
||||||
|
extern jmethodID g_rowdataSetTimestampFp;
|
||||||
|
extern jmethodID g_rowdataSetByteArrayFp;
|
||||||
|
|
||||||
|
extern jmethodID g_blockdataSetByteArrayFp;
|
||||||
|
extern jmethodID g_blockdataSetNumOfRowsFp;
|
||||||
|
extern jmethodID g_blockdataSetNumOfColsFp;
|
||||||
|
|
||||||
|
extern jclass g_tmqClass;
|
||||||
|
extern jmethodID g_createConsumerErrorCallback;
|
||||||
|
extern jmethodID g_topicListCallback;
|
||||||
|
|
||||||
|
extern jclass g_consumerClass;
|
||||||
|
extern jmethodID g_commitCallback;
|
||||||
|
|
||||||
|
jstring jniFromNCharToByteArray(JNIEnv *, char *, int32_t);
|
||||||
|
|
||||||
|
#define JNI_SUCCESS 0
|
||||||
|
#define JNI_TDENGINE_ERROR -1
|
||||||
|
#define JNI_CONNECTION_NULL -2
|
||||||
|
#define JNI_RESULT_SET_NULL -3
|
||||||
|
#define JNI_NUM_OF_FIELDS_0 -4
|
||||||
|
#define JNI_SQL_NULL -5
|
||||||
|
#define JNI_FETCH_END -6
|
||||||
|
#define JNI_OUT_OF_MEMORY -7
|
||||||
|
|
||||||
|
#define TMQ_CONF_NULL -100;
|
||||||
|
#define TMQ_CONF_KEY_NULL -101;
|
||||||
|
#define TMQ_CONF_VALUE_NULL -102;
|
||||||
|
#define TMQ_TOPIC_NULL -110;
|
||||||
|
#define TMQ_TOPIC_NAME_NULL -111;
|
||||||
|
#define TMQ_CONSUMER_NULL -120;
|
||||||
|
#define TMQ_CONSUMER_CREATE_ERROR -121;
|
||||||
|
|
||||||
|
extern JavaVM *g_vm;
|
||||||
|
|
||||||
|
void jniGetGlobalMethod(JNIEnv *env);
|
||||||
|
|
||||||
|
int32_t check_for_params(jobject jobj, jlong conn, jlong res);
|
||||||
|
|
||||||
|
#endif // TDENGINE_JNICOMMON_H
|
|
@ -0,0 +1,15 @@
|
||||||
|
//
|
||||||
|
// AWTCocoaComponent.h
|
||||||
|
//
|
||||||
|
// Copyright (c) 2003 Apple Computer Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <JavaVM/jni.h>
|
||||||
|
|
||||||
|
// This is implemented by a com.apple.eawt.CocoaComponent. It receives messages
|
||||||
|
// from java safely on the AppKit thread. See the com.apple.eawt.CocoaComponent
|
||||||
|
// java documentation for more information.
|
||||||
|
@protocol AWTCocoaComponent
|
||||||
|
-(void)awtMessage:(jint)messageID message:(jobject)message env:(JNIEnv*)env DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
@end
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* @(#)JDWP.h 1.33 05/11/17
|
||||||
|
*
|
||||||
|
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef JDWP_JDWP_H
|
||||||
|
#define JDWP_JDWP_H
|
||||||
|
|
||||||
|
#include "JDWPCommands.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JDWPCommands.h is the javah'ed version of all the constants defined
|
||||||
|
* com.sun.tools.jdi.JDWP and all its nested classes. Since the names are
|
||||||
|
* very long, the macros below are provided for convenience.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define JDWP_COMMAND_SET(name) JDWP_ ## name
|
||||||
|
#define JDWP_COMMAND(set, name) JDWP_ ## set ## _ ## name
|
||||||
|
#define JDWP_REQUEST_MODIFIER(name) \
|
||||||
|
JDWP_EventRequest_Set_Out_modifiers_Modifier_ ## name
|
||||||
|
#define JDWP_EVENT(name) \
|
||||||
|
JDWP_EventKind_ ## name
|
||||||
|
#define JDWP_THREAD_STATUS(name) \
|
||||||
|
JDWP_ThreadStatus_ ## name
|
||||||
|
#define JDWP_SUSPEND_STATUS(name) \
|
||||||
|
JDWP_SuspendStatus_SUSPEND_STATUS_ ## name
|
||||||
|
#define JDWP_CLASS_STATUS(name) \
|
||||||
|
JDWP_ClassStatus_ ## name
|
||||||
|
#define JDWP_TYPE_TAG(name) \
|
||||||
|
JDWP_TypeTag_ ## name
|
||||||
|
#define JDWP_TAG(name) \
|
||||||
|
JDWP_Tag_ ## name
|
||||||
|
#define JDWP_STEP_DEPTH(name) \
|
||||||
|
JDWP_StepDepth_ ## name
|
||||||
|
#define JDWP_STEP_SIZE(name) \
|
||||||
|
JDWP_StepSize_ ## name
|
||||||
|
#define JDWP_SUSPEND_POLICY(name) \
|
||||||
|
JDWP_SuspendPolicy_ ## name
|
||||||
|
#define JDWP_INVOKE_OPTIONS(name) \
|
||||||
|
JDWP_InvokeOptions_INVOKE_ ## name
|
||||||
|
#define JDWP_ERROR(name) \
|
||||||
|
JDWP_Error_ ## name
|
||||||
|
#define JDWP_HIGHEST_COMMAND_SET 17
|
||||||
|
#define JDWP_REQUEST_NONE -1
|
||||||
|
|
||||||
|
/* This typedef helps keep the event and error types straight. */
|
||||||
|
typedef unsigned short jdwpError;
|
||||||
|
typedef unsigned char jdwpEvent;
|
||||||
|
typedef jint jdwpThreadStatus;
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,257 @@
|
||||||
|
#define JDWP_VirtualMachine 1
|
||||||
|
#define JDWP_VirtualMachine_Version 1
|
||||||
|
#define JDWP_VirtualMachine_ClassesBySignature 2
|
||||||
|
#define JDWP_VirtualMachine_AllClasses 3
|
||||||
|
#define JDWP_VirtualMachine_AllThreads 4
|
||||||
|
#define JDWP_VirtualMachine_TopLevelThreadGroups 5
|
||||||
|
#define JDWP_VirtualMachine_Dispose 6
|
||||||
|
#define JDWP_VirtualMachine_IDSizes 7
|
||||||
|
#define JDWP_VirtualMachine_Suspend 8
|
||||||
|
#define JDWP_VirtualMachine_Resume 9
|
||||||
|
#define JDWP_VirtualMachine_Exit 10
|
||||||
|
#define JDWP_VirtualMachine_CreateString 11
|
||||||
|
#define JDWP_VirtualMachine_Capabilities 12
|
||||||
|
#define JDWP_VirtualMachine_ClassPaths 13
|
||||||
|
#define JDWP_VirtualMachine_DisposeObjects 14
|
||||||
|
#define JDWP_VirtualMachine_HoldEvents 15
|
||||||
|
#define JDWP_VirtualMachine_ReleaseEvents 16
|
||||||
|
#define JDWP_VirtualMachine_CapabilitiesNew 17
|
||||||
|
#define JDWP_VirtualMachine_RedefineClasses 18
|
||||||
|
#define JDWP_VirtualMachine_SetDefaultStratum 19
|
||||||
|
#define JDWP_VirtualMachine_AllClassesWithGeneric 20
|
||||||
|
#define JDWP_VirtualMachine_InstanceCounts 21
|
||||||
|
#define JDWP_ReferenceType 2
|
||||||
|
#define JDWP_ReferenceType_Signature 1
|
||||||
|
#define JDWP_ReferenceType_ClassLoader 2
|
||||||
|
#define JDWP_ReferenceType_Modifiers 3
|
||||||
|
#define JDWP_ReferenceType_Fields 4
|
||||||
|
#define JDWP_ReferenceType_Methods 5
|
||||||
|
#define JDWP_ReferenceType_GetValues 6
|
||||||
|
#define JDWP_ReferenceType_SourceFile 7
|
||||||
|
#define JDWP_ReferenceType_NestedTypes 8
|
||||||
|
#define JDWP_ReferenceType_Status 9
|
||||||
|
#define JDWP_ReferenceType_Interfaces 10
|
||||||
|
#define JDWP_ReferenceType_ClassObject 11
|
||||||
|
#define JDWP_ReferenceType_SourceDebugExtension 12
|
||||||
|
#define JDWP_ReferenceType_SignatureWithGeneric 13
|
||||||
|
#define JDWP_ReferenceType_FieldsWithGeneric 14
|
||||||
|
#define JDWP_ReferenceType_MethodsWithGeneric 15
|
||||||
|
#define JDWP_ReferenceType_Instances 16
|
||||||
|
#define JDWP_ReferenceType_ClassFileVersion 17
|
||||||
|
#define JDWP_ReferenceType_ConstantPool 18
|
||||||
|
#define JDWP_ClassType 3
|
||||||
|
#define JDWP_ClassType_Superclass 1
|
||||||
|
#define JDWP_ClassType_SetValues 2
|
||||||
|
#define JDWP_ClassType_InvokeMethod 3
|
||||||
|
#define JDWP_ClassType_NewInstance 4
|
||||||
|
#define JDWP_ArrayType 4
|
||||||
|
#define JDWP_ArrayType_NewInstance 1
|
||||||
|
#define JDWP_InterfaceType 5
|
||||||
|
#define JDWP_Method 6
|
||||||
|
#define JDWP_Method_LineTable 1
|
||||||
|
#define JDWP_Method_VariableTable 2
|
||||||
|
#define JDWP_Method_Bytecodes 3
|
||||||
|
#define JDWP_Method_IsObsolete 4
|
||||||
|
#define JDWP_Method_VariableTableWithGeneric 5
|
||||||
|
#define JDWP_Field 8
|
||||||
|
#define JDWP_ObjectReference 9
|
||||||
|
#define JDWP_ObjectReference_ReferenceType 1
|
||||||
|
#define JDWP_ObjectReference_GetValues 2
|
||||||
|
#define JDWP_ObjectReference_SetValues 3
|
||||||
|
#define JDWP_ObjectReference_MonitorInfo 5
|
||||||
|
#define JDWP_ObjectReference_InvokeMethod 6
|
||||||
|
#define JDWP_ObjectReference_DisableCollection 7
|
||||||
|
#define JDWP_ObjectReference_EnableCollection 8
|
||||||
|
#define JDWP_ObjectReference_IsCollected 9
|
||||||
|
#define JDWP_ObjectReference_ReferringObjects 10
|
||||||
|
#define JDWP_StringReference 10
|
||||||
|
#define JDWP_StringReference_Value 1
|
||||||
|
#define JDWP_ThreadReference 11
|
||||||
|
#define JDWP_ThreadReference_Name 1
|
||||||
|
#define JDWP_ThreadReference_Suspend 2
|
||||||
|
#define JDWP_ThreadReference_Resume 3
|
||||||
|
#define JDWP_ThreadReference_Status 4
|
||||||
|
#define JDWP_ThreadReference_ThreadGroup 5
|
||||||
|
#define JDWP_ThreadReference_Frames 6
|
||||||
|
#define JDWP_ThreadReference_FrameCount 7
|
||||||
|
#define JDWP_ThreadReference_OwnedMonitors 8
|
||||||
|
#define JDWP_ThreadReference_CurrentContendedMonitor 9
|
||||||
|
#define JDWP_ThreadReference_Stop 10
|
||||||
|
#define JDWP_ThreadReference_Interrupt 11
|
||||||
|
#define JDWP_ThreadReference_SuspendCount 12
|
||||||
|
#define JDWP_ThreadReference_OwnedMonitorsStackDepthInfo 13
|
||||||
|
#define JDWP_ThreadReference_ForceEarlyReturn 14
|
||||||
|
#define JDWP_ThreadGroupReference 12
|
||||||
|
#define JDWP_ThreadGroupReference_Name 1
|
||||||
|
#define JDWP_ThreadGroupReference_Parent 2
|
||||||
|
#define JDWP_ThreadGroupReference_Children 3
|
||||||
|
#define JDWP_ArrayReference 13
|
||||||
|
#define JDWP_ArrayReference_Length 1
|
||||||
|
#define JDWP_ArrayReference_GetValues 2
|
||||||
|
#define JDWP_ArrayReference_SetValues 3
|
||||||
|
#define JDWP_ClassLoaderReference 14
|
||||||
|
#define JDWP_ClassLoaderReference_VisibleClasses 1
|
||||||
|
#define JDWP_EventRequest 15
|
||||||
|
#define JDWP_EventRequest_Set 1
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_Count 1
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_Conditional 2
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ThreadOnly 3
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassOnly 4
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassMatch 5
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassExclude 6
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_LocationOnly 7
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ExceptionOnly 8
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_FieldOnly 9
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_Step 10
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_InstanceOnly 11
|
||||||
|
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_SourceNameMatch 12
|
||||||
|
#define JDWP_EventRequest_Clear 2
|
||||||
|
#define JDWP_EventRequest_ClearAllBreakpoints 3
|
||||||
|
#define JDWP_StackFrame 16
|
||||||
|
#define JDWP_StackFrame_GetValues 1
|
||||||
|
#define JDWP_StackFrame_SetValues 2
|
||||||
|
#define JDWP_StackFrame_ThisObject 3
|
||||||
|
#define JDWP_StackFrame_PopFrames 4
|
||||||
|
#define JDWP_ClassObjectReference 17
|
||||||
|
#define JDWP_ClassObjectReference_ReflectedType 1
|
||||||
|
#define JDWP_Event 64
|
||||||
|
#define JDWP_Event_Composite 100
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_VMStart JDWP.EventKind.VM_START
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_SingleStep JDWP.EventKind.SINGLE_STEP
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_Breakpoint JDWP.EventKind.BREAKPOINT
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_MethodEntry JDWP.EventKind.METHOD_ENTRY
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_MethodExit JDWP.EventKind.METHOD_EXIT
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_MethodExitWithReturnValue JDWP.EventKind.METHOD_EXIT_WITH_RETURN_VALUE
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_MonitorContendedEnter JDWP.EventKind.MONITOR_CONTENDED_ENTER
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_MonitorContendedEntered JDWP.EventKind.MONITOR_CONTENDED_ENTERED
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_MonitorWait JDWP.EventKind.MONITOR_WAIT
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_MonitorWaited JDWP.EventKind.MONITOR_WAITED
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_Exception JDWP.EventKind.EXCEPTION
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_ThreadStart JDWP.EventKind.THREAD_START
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_ThreadDeath JDWP.EventKind.THREAD_DEATH
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_ClassPrepare JDWP.EventKind.CLASS_PREPARE
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_ClassUnload JDWP.EventKind.CLASS_UNLOAD
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_FieldAccess JDWP.EventKind.FIELD_ACCESS
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_FieldModification JDWP.EventKind.FIELD_MODIFICATION
|
||||||
|
#define JDWP_Event_Composite_Event_events_Events_VMDeath JDWP.EventKind.VM_DEATH
|
||||||
|
#define JDWP_Error_NONE 0
|
||||||
|
#define JDWP_Error_INVALID_THREAD 10
|
||||||
|
#define JDWP_Error_INVALID_THREAD_GROUP 11
|
||||||
|
#define JDWP_Error_INVALID_PRIORITY 12
|
||||||
|
#define JDWP_Error_THREAD_NOT_SUSPENDED 13
|
||||||
|
#define JDWP_Error_THREAD_SUSPENDED 14
|
||||||
|
#define JDWP_Error_THREAD_NOT_ALIVE 15
|
||||||
|
#define JDWP_Error_INVALID_OBJECT 20
|
||||||
|
#define JDWP_Error_INVALID_CLASS 21
|
||||||
|
#define JDWP_Error_CLASS_NOT_PREPARED 22
|
||||||
|
#define JDWP_Error_INVALID_METHODID 23
|
||||||
|
#define JDWP_Error_INVALID_LOCATION 24
|
||||||
|
#define JDWP_Error_INVALID_FIELDID 25
|
||||||
|
#define JDWP_Error_INVALID_FRAMEID 30
|
||||||
|
#define JDWP_Error_NO_MORE_FRAMES 31
|
||||||
|
#define JDWP_Error_OPAQUE_FRAME 32
|
||||||
|
#define JDWP_Error_NOT_CURRENT_FRAME 33
|
||||||
|
#define JDWP_Error_TYPE_MISMATCH 34
|
||||||
|
#define JDWP_Error_INVALID_SLOT 35
|
||||||
|
#define JDWP_Error_DUPLICATE 40
|
||||||
|
#define JDWP_Error_NOT_FOUND 41
|
||||||
|
#define JDWP_Error_INVALID_MONITOR 50
|
||||||
|
#define JDWP_Error_NOT_MONITOR_OWNER 51
|
||||||
|
#define JDWP_Error_INTERRUPT 52
|
||||||
|
#define JDWP_Error_INVALID_CLASS_FORMAT 60
|
||||||
|
#define JDWP_Error_CIRCULAR_CLASS_DEFINITION 61
|
||||||
|
#define JDWP_Error_FAILS_VERIFICATION 62
|
||||||
|
#define JDWP_Error_ADD_METHOD_NOT_IMPLEMENTED 63
|
||||||
|
#define JDWP_Error_SCHEMA_CHANGE_NOT_IMPLEMENTED 64
|
||||||
|
#define JDWP_Error_INVALID_TYPESTATE 65
|
||||||
|
#define JDWP_Error_HIERARCHY_CHANGE_NOT_IMPLEMENTED 66
|
||||||
|
#define JDWP_Error_DELETE_METHOD_NOT_IMPLEMENTED 67
|
||||||
|
#define JDWP_Error_UNSUPPORTED_VERSION 68
|
||||||
|
#define JDWP_Error_NAMES_DONT_MATCH 69
|
||||||
|
#define JDWP_Error_CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED 70
|
||||||
|
#define JDWP_Error_METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED 71
|
||||||
|
#define JDWP_Error_NOT_IMPLEMENTED 99
|
||||||
|
#define JDWP_Error_NULL_POINTER 100
|
||||||
|
#define JDWP_Error_ABSENT_INFORMATION 101
|
||||||
|
#define JDWP_Error_INVALID_EVENT_TYPE 102
|
||||||
|
#define JDWP_Error_ILLEGAL_ARGUMENT 103
|
||||||
|
#define JDWP_Error_OUT_OF_MEMORY 110
|
||||||
|
#define JDWP_Error_ACCESS_DENIED 111
|
||||||
|
#define JDWP_Error_VM_DEAD 112
|
||||||
|
#define JDWP_Error_INTERNAL 113
|
||||||
|
#define JDWP_Error_UNATTACHED_THREAD 115
|
||||||
|
#define JDWP_Error_INVALID_TAG 500
|
||||||
|
#define JDWP_Error_ALREADY_INVOKING 502
|
||||||
|
#define JDWP_Error_INVALID_INDEX 503
|
||||||
|
#define JDWP_Error_INVALID_LENGTH 504
|
||||||
|
#define JDWP_Error_INVALID_STRING 506
|
||||||
|
#define JDWP_Error_INVALID_CLASS_LOADER 507
|
||||||
|
#define JDWP_Error_INVALID_ARRAY 508
|
||||||
|
#define JDWP_Error_TRANSPORT_LOAD 509
|
||||||
|
#define JDWP_Error_TRANSPORT_INIT 510
|
||||||
|
#define JDWP_Error_NATIVE_METHOD 511
|
||||||
|
#define JDWP_Error_INVALID_COUNT 512
|
||||||
|
#define JDWP_EventKind_SINGLE_STEP 1
|
||||||
|
#define JDWP_EventKind_BREAKPOINT 2
|
||||||
|
#define JDWP_EventKind_FRAME_POP 3
|
||||||
|
#define JDWP_EventKind_EXCEPTION 4
|
||||||
|
#define JDWP_EventKind_USER_DEFINED 5
|
||||||
|
#define JDWP_EventKind_THREAD_START 6
|
||||||
|
#define JDWP_EventKind_THREAD_DEATH 7
|
||||||
|
#define JDWP_EventKind_THREAD_END 7
|
||||||
|
#define JDWP_EventKind_CLASS_PREPARE 8
|
||||||
|
#define JDWP_EventKind_CLASS_UNLOAD 9
|
||||||
|
#define JDWP_EventKind_CLASS_LOAD 10
|
||||||
|
#define JDWP_EventKind_FIELD_ACCESS 20
|
||||||
|
#define JDWP_EventKind_FIELD_MODIFICATION 21
|
||||||
|
#define JDWP_EventKind_EXCEPTION_CATCH 30
|
||||||
|
#define JDWP_EventKind_METHOD_ENTRY 40
|
||||||
|
#define JDWP_EventKind_METHOD_EXIT 41
|
||||||
|
#define JDWP_EventKind_METHOD_EXIT_WITH_RETURN_VALUE 42
|
||||||
|
#define JDWP_EventKind_MONITOR_CONTENDED_ENTER 43
|
||||||
|
#define JDWP_EventKind_MONITOR_CONTENDED_ENTERED 44
|
||||||
|
#define JDWP_EventKind_MONITOR_WAIT 45
|
||||||
|
#define JDWP_EventKind_MONITOR_WAITED 46
|
||||||
|
#define JDWP_EventKind_VM_START 90
|
||||||
|
#define JDWP_EventKind_VM_INIT 90
|
||||||
|
#define JDWP_EventKind_VM_DEATH 99
|
||||||
|
#define JDWP_EventKind_VM_DISCONNECTED 100
|
||||||
|
#define JDWP_ThreadStatus_ZOMBIE 0
|
||||||
|
#define JDWP_ThreadStatus_RUNNING 1
|
||||||
|
#define JDWP_ThreadStatus_SLEEPING 2
|
||||||
|
#define JDWP_ThreadStatus_MONITOR 3
|
||||||
|
#define JDWP_ThreadStatus_WAIT 4
|
||||||
|
#define JDWP_SuspendStatus_SUSPEND_STATUS_SUSPENDED 0x1
|
||||||
|
#define JDWP_ClassStatus_VERIFIED 1
|
||||||
|
#define JDWP_ClassStatus_PREPARED 2
|
||||||
|
#define JDWP_ClassStatus_INITIALIZED 4
|
||||||
|
#define JDWP_ClassStatus_ERROR 8
|
||||||
|
#define JDWP_TypeTag_CLASS 1
|
||||||
|
#define JDWP_TypeTag_INTERFACE 2
|
||||||
|
#define JDWP_TypeTag_ARRAY 3
|
||||||
|
#define JDWP_Tag_ARRAY 91
|
||||||
|
#define JDWP_Tag_BYTE 66
|
||||||
|
#define JDWP_Tag_CHAR 67
|
||||||
|
#define JDWP_Tag_OBJECT 76
|
||||||
|
#define JDWP_Tag_FLOAT 70
|
||||||
|
#define JDWP_Tag_DOUBLE 68
|
||||||
|
#define JDWP_Tag_INT 73
|
||||||
|
#define JDWP_Tag_LONG 74
|
||||||
|
#define JDWP_Tag_SHORT 83
|
||||||
|
#define JDWP_Tag_VOID 86
|
||||||
|
#define JDWP_Tag_BOOLEAN 90
|
||||||
|
#define JDWP_Tag_STRING 115
|
||||||
|
#define JDWP_Tag_THREAD 116
|
||||||
|
#define JDWP_Tag_THREAD_GROUP 103
|
||||||
|
#define JDWP_Tag_CLASS_LOADER 108
|
||||||
|
#define JDWP_Tag_CLASS_OBJECT 99
|
||||||
|
#define JDWP_StepDepth_INTO 0
|
||||||
|
#define JDWP_StepDepth_OVER 1
|
||||||
|
#define JDWP_StepDepth_OUT 2
|
||||||
|
#define JDWP_StepSize_MIN 0
|
||||||
|
#define JDWP_StepSize_LINE 1
|
||||||
|
#define JDWP_SuspendPolicy_NONE 0
|
||||||
|
#define JDWP_SuspendPolicy_EVENT_THREAD 1
|
||||||
|
#define JDWP_SuspendPolicy_ALL 2
|
||||||
|
#define JDWP_InvokeOptions_INVOKE_SINGLE_THREADED 0x01
|
||||||
|
#define JDWP_InvokeOptions_INVOKE_NONVIRTUAL 0x02
|
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* JavaVM.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997-2001, Apple Computer, Inc.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <JavaVM/NSJavaVirtualMachine.h>
|
||||||
|
#import <JavaVM/NSJavaConfiguration.h>
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* NSJavaConfiguration.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 1997-2001, Apple Computer, Inc.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* LaurentR- April, 2000
|
||||||
|
* - added:
|
||||||
|
* NSDefaultJavaLibraryKey
|
||||||
|
* NSDefaultJavaDebugLibraryKey
|
||||||
|
* NSDefaultObjCJavaLibraryKey
|
||||||
|
* NSDefaultObjCJavaDebugLibraryKey
|
||||||
|
* NSJavaVMArgumentsKey
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
// The configuration dictionary contains a set of vendor-specific key/value
|
||||||
|
// pairs and a set of default key/value pairs. If no vendor is specified,
|
||||||
|
// NSJavaConfiguration uses the NSDefaultJavaVendorKey key to determine which
|
||||||
|
// vendor-specific dictionary should be searched before the top-level dictionary// is searched. eg.:
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
Vendor = sun;
|
||||||
|
default = {
|
||||||
|
DefaultClasspath = "/NextLibrary/Java";
|
||||||
|
};
|
||||||
|
next = {
|
||||||
|
Compiler = "/usr/bin/javac";
|
||||||
|
VM = "/usr/bin/java";
|
||||||
|
};
|
||||||
|
sun = {
|
||||||
|
Compiler = "/NextLibrary/JDK/bin/javac";
|
||||||
|
VM = "/NextLibrary/JDK/bin/java";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// In this case, if no vendor is specified, the `sun' mappings will be searched
|
||||||
|
// first. The value for `VM' would be "/NextLibrary/JDK/bin/java" and the value
|
||||||
|
// for `DefaultClasspath' would be "/NextLibrary/Java".
|
||||||
|
//
|
||||||
|
// This search patter is applied to three dictionaries, in order:
|
||||||
|
// - the JavaConfiguration dictionary in the defaults for the application
|
||||||
|
// - the dictionary in the "JavaConfiguration" domain of the user defaults
|
||||||
|
// - the configuration file (/NextLibrary/Java/JavaConfig.plist).
|
||||||
|
// This permits per-application, per-user and per-system specifications.
|
||||||
|
|
||||||
|
|
||||||
|
extern NSString *NSDefaultJavaVendorKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
extern NSString *NSDefaultJavaVMKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
extern NSString *NSDefaultJavaCompilerKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
extern NSString *NSDefaultJavaClassPathKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
extern NSString *NSDefaultJavaLibraryKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
extern NSString *NSDefaultJavaDebugLibraryKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
extern NSString *NSDefaultObjCJavaLibraryKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
extern NSString *NSDefaultObjCJavaDebugLibraryKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
extern NSString *NSJavaVMArgumentsKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSJavaConfiguration : NSObject
|
||||||
|
{
|
||||||
|
NSString *_vendorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSJavaConfiguration *) defaultConfiguration DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
+ (NSJavaConfiguration *) configurationForVendor:(NSString *)vendorName DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
+ (NSArray *) vendorNames DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
- init DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
- initWithVendor:(NSString *)vendorName DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
- (NSString *) vendorName DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
- valueForKey:(NSString *)keyName DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
- valueForKey:(NSString *)keyName expandEnvironmentVariables:(BOOL)flag DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* NSJavaVirtualMachine.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 1997-2001, Apple Computer, Inc.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface NSJavaVirtualMachine : NSObject
|
||||||
|
{
|
||||||
|
@private
|
||||||
|
void *_vmdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Returns the default virtual machine - if necessary, calls alloc + init
|
||||||
|
|
||||||
|
+ (id) defaultVirtualMachine DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
// Returns a class path. First checks NSProcessInfo for an environment variable
|
||||||
|
// called CLASSPATH and if that doesn't exist, uses NSJavaConfiguration to find
|
||||||
|
// the default class path.
|
||||||
|
|
||||||
|
+ (NSString *) defaultClassPath DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
// Note that any NSThreads spawned after this method returns will automatically
|
||||||
|
// be attached to the virtual machine. Likewise, it is not necessary to attach
|
||||||
|
// the thread that is actually creating the virtual machine. If you spawn a
|
||||||
|
// thread before creating the virtual machine, or if you use the cthread/pthread
|
||||||
|
// or any other non-NSThread api for creating a thread, you must explicitly
|
||||||
|
// attach those threads before messaging any Java object from that thread.
|
||||||
|
// This is most easily done by using the -attachCurrentThread method.
|
||||||
|
// Use -detachCurrentThread to detach explicitly attached threads when done.
|
||||||
|
|
||||||
|
- initWithClassPath:(NSString *)classPath DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
- (void) attachCurrentThread DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
- (void) detachCurrentThread DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
- (Class)findClass:(NSString *)className DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
- (Class)defineClass:(NSData *)javaClassData withName:(NSString *)className DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSObject (InstantiatingJavaObjects)
|
||||||
|
|
||||||
|
// Instantiating java objects for when no -init/constructor mapping works.
|
||||||
|
// The class these methods are invoked on *must* be a class returned by the
|
||||||
|
// -findClass: method (or NSClassFromString() function), otherwise
|
||||||
|
// NSInvalidJavaClassException is raised. The signature is specified using the
|
||||||
|
// rather counter-intuitive format defined by the Java Virtual Machine
|
||||||
|
// specification. Try looking in JavaVM/vm-interface.h for help.
|
||||||
|
|
||||||
|
+ (id) newWithSignature:(NSString *)signature, ... DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
+ (id) newWithSignature:(NSString *)signature arguments:(va_list)args DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
extern NSString *NSInvalidJavaClassException DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
|
@ -0,0 +1,278 @@
|
||||||
|
/*
|
||||||
|
* @(#)jawt.h 1.11 05/11/17
|
||||||
|
*
|
||||||
|
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JAWT_H_
|
||||||
|
#define _JAVASOFT_JAWT_H_
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AWT native interface (new in JDK 1.3)
|
||||||
|
*
|
||||||
|
* The AWT native interface allows a native C or C++ application a means
|
||||||
|
* by which to access native structures in AWT. This is to facilitate moving
|
||||||
|
* legacy C and C++ applications to Java and to target the needs of the
|
||||||
|
* community who, at present, wish to do their own native rendering to canvases
|
||||||
|
* for performance reasons. Standard extensions such as Java3D also require a
|
||||||
|
* means to access the underlying native data structures of AWT.
|
||||||
|
*
|
||||||
|
* There may be future extensions to this API depending on demand.
|
||||||
|
*
|
||||||
|
* A VM does not have to implement this API in order to pass the JCK.
|
||||||
|
* It is recommended, however, that this API is implemented on VMs that support
|
||||||
|
* standard extensions, such as Java3D.
|
||||||
|
*
|
||||||
|
* Since this is a native API, any program which uses it cannot be considered
|
||||||
|
* 100% pure java.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AWT Native Drawing Surface (JAWT_DrawingSurface).
|
||||||
|
*
|
||||||
|
* For each platform, there is a native drawing surface structure. This
|
||||||
|
* platform-specific structure can be found in jawt_md.h. It is recommended
|
||||||
|
* that additional platforms follow the same model. It is also recommended
|
||||||
|
* that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
|
||||||
|
*
|
||||||
|
*******************
|
||||||
|
* EXAMPLE OF USAGE:
|
||||||
|
*******************
|
||||||
|
*
|
||||||
|
* In Win32, a programmer wishes to access the HWND of a canvas to perform
|
||||||
|
* native rendering into it. The programmer has declared the paint() method
|
||||||
|
* for their canvas subclass to be native:
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* MyCanvas.java:
|
||||||
|
*
|
||||||
|
* import java.awt.*;
|
||||||
|
*
|
||||||
|
* public class MyCanvas extends Canvas {
|
||||||
|
*
|
||||||
|
* static {
|
||||||
|
* System.loadLibrary("mylib");
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public native void paint(Graphics g);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* myfile.c:
|
||||||
|
*
|
||||||
|
* #include "jawt_md.h"
|
||||||
|
* #include <assert.h>
|
||||||
|
*
|
||||||
|
* JNIEXPORT void JNICALL
|
||||||
|
* Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
|
||||||
|
* {
|
||||||
|
* JAWT awt;
|
||||||
|
* JAWT_DrawingSurface* ds;
|
||||||
|
* JAWT_DrawingSurfaceInfo* dsi;
|
||||||
|
* JAWT_Win32DrawingSurfaceInfo* dsi_win;
|
||||||
|
* jboolean result;
|
||||||
|
* jint lock;
|
||||||
|
*
|
||||||
|
* // Get the AWT
|
||||||
|
* awt.version = JAWT_VERSION_1_3;
|
||||||
|
* result = JAWT_GetAWT(env, &awt);
|
||||||
|
* assert(result != JNI_FALSE);
|
||||||
|
*
|
||||||
|
* // Get the drawing surface
|
||||||
|
* ds = awt.GetDrawingSurface(env, canvas);
|
||||||
|
* assert(ds != NULL);
|
||||||
|
*
|
||||||
|
* // Lock the drawing surface
|
||||||
|
* lock = ds->Lock(ds);
|
||||||
|
* assert((lock & JAWT_LOCK_ERROR) == 0);
|
||||||
|
*
|
||||||
|
* // Get the drawing surface info
|
||||||
|
* dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||||
|
*
|
||||||
|
* // Get the platform-specific drawing info
|
||||||
|
* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
|
||||||
|
*
|
||||||
|
* //////////////////////////////
|
||||||
|
* // !!! DO PAINTING HERE !!! //
|
||||||
|
* //////////////////////////////
|
||||||
|
*
|
||||||
|
* // Free the drawing surface info
|
||||||
|
* ds->FreeDrawingSurfaceInfo(dsi);
|
||||||
|
*
|
||||||
|
* // Unlock the drawing surface
|
||||||
|
* ds->Unlock(ds);
|
||||||
|
*
|
||||||
|
* // Free the drawing surface
|
||||||
|
* awt.FreeDrawingSurface(ds);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_Rectangle
|
||||||
|
* Structure for a native rectangle.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_Rectangle {
|
||||||
|
jint x;
|
||||||
|
jint y;
|
||||||
|
jint width;
|
||||||
|
jint height;
|
||||||
|
} JAWT_Rectangle;
|
||||||
|
|
||||||
|
struct jawt_DrawingSurface;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_DrawingSurfaceInfo
|
||||||
|
* Structure for containing the underlying drawing information of a component.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_DrawingSurfaceInfo {
|
||||||
|
/*
|
||||||
|
* Pointer to the platform-specific information. This can be safely
|
||||||
|
* cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
|
||||||
|
* JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details.
|
||||||
|
*/
|
||||||
|
void* platformInfo;
|
||||||
|
/* Cached pointer to the underlying drawing surface */
|
||||||
|
struct jawt_DrawingSurface* ds;
|
||||||
|
/* Bounding rectangle of the drawing surface */
|
||||||
|
JAWT_Rectangle bounds;
|
||||||
|
/* Number of rectangles in the clip */
|
||||||
|
jint clipSize;
|
||||||
|
/* Clip rectangle array */
|
||||||
|
JAWT_Rectangle* clip;
|
||||||
|
} JAWT_DrawingSurfaceInfo;
|
||||||
|
|
||||||
|
#define JAWT_LOCK_ERROR 0x00000001
|
||||||
|
#define JAWT_LOCK_CLIP_CHANGED 0x00000002
|
||||||
|
#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
|
||||||
|
#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_DrawingSurface
|
||||||
|
* Structure for containing the underlying drawing information of a component.
|
||||||
|
* All operations on a JAWT_DrawingSurface MUST be performed from the same
|
||||||
|
* thread as the call to GetDrawingSurface.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_DrawingSurface {
|
||||||
|
/*
|
||||||
|
* Cached reference to the Java environment of the calling thread.
|
||||||
|
* If Lock(), Unlock(), GetDrawingSurfaceInfo() or
|
||||||
|
* FreeDrawingSurfaceInfo() are called from a different thread,
|
||||||
|
* this data member should be set before calling those functions.
|
||||||
|
*/
|
||||||
|
JNIEnv* env;
|
||||||
|
/* Cached reference to the target object */
|
||||||
|
jobject target;
|
||||||
|
/*
|
||||||
|
* Lock the surface of the target component for native rendering.
|
||||||
|
* When finished drawing, the surface must be unlocked with
|
||||||
|
* Unlock(). This function returns a bitmask with one or more of the
|
||||||
|
* following values:
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
|
||||||
|
* be locked.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
|
||||||
|
*/
|
||||||
|
jint (JNICALL *Lock)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Get the drawing surface info.
|
||||||
|
* The value returned may be cached, but the values may change if
|
||||||
|
* additional calls to Lock() or Unlock() are made.
|
||||||
|
* Lock() must be called before this can return a valid value.
|
||||||
|
* Returns NULL if an error has occurred.
|
||||||
|
* When finished with the returned value, FreeDrawingSurfaceInfo must be
|
||||||
|
* called.
|
||||||
|
*/
|
||||||
|
JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Free the drawing surface info.
|
||||||
|
*/
|
||||||
|
void (JNICALL *FreeDrawingSurfaceInfo)
|
||||||
|
(JAWT_DrawingSurfaceInfo* dsi);
|
||||||
|
/*
|
||||||
|
* Unlock the drawing surface of the target component for native rendering.
|
||||||
|
*/
|
||||||
|
void (JNICALL *Unlock)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
} JAWT_DrawingSurface;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT
|
||||||
|
* Structure for containing native AWT functions.
|
||||||
|
*/
|
||||||
|
typedef struct jawt {
|
||||||
|
/*
|
||||||
|
* Version of this structure. This must always be set before
|
||||||
|
* calling JAWT_GetAWT()
|
||||||
|
*/
|
||||||
|
jint version;
|
||||||
|
/*
|
||||||
|
* Return a drawing surface from a target jobject. This value
|
||||||
|
* may be cached.
|
||||||
|
* Returns NULL if an error has occurred.
|
||||||
|
* Target must be a java.awt.Component (should be a Canvas
|
||||||
|
* or Window for native rendering).
|
||||||
|
* FreeDrawingSurface() must be called when finished with the
|
||||||
|
* returned JAWT_DrawingSurface.
|
||||||
|
*/
|
||||||
|
JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
|
||||||
|
(JNIEnv* env, jobject target);
|
||||||
|
/*
|
||||||
|
* Free the drawing surface allocated in GetDrawingSurface.
|
||||||
|
*/
|
||||||
|
void (JNICALL *FreeDrawingSurface)
|
||||||
|
(JAWT_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Locks the entire AWT for synchronization purposes
|
||||||
|
*/
|
||||||
|
void (JNICALL *Lock)(JNIEnv* env);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Unlocks the entire AWT for synchronization purposes
|
||||||
|
*/
|
||||||
|
void (JNICALL *Unlock)(JNIEnv* env);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Returns a reference to a java.awt.Component from a native
|
||||||
|
* platform handle. On Windows, this corresponds to an HWND;
|
||||||
|
* on Solaris and Linux, this is a Drawable. For other platforms,
|
||||||
|
* see the appropriate machine-dependent header file for a description.
|
||||||
|
* The reference returned by this function is a local
|
||||||
|
* reference that is only valid in this environment.
|
||||||
|
* This function returns a NULL reference if no component could be
|
||||||
|
* found with matching platform information.
|
||||||
|
*/
|
||||||
|
jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
|
||||||
|
|
||||||
|
} JAWT;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the AWT native structure. This function returns JNI_FALSE if
|
||||||
|
* an error occurs.
|
||||||
|
*/
|
||||||
|
_JNI_IMPORT_OR_EXPORT_ __attribute__((deprecated))
|
||||||
|
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
|
||||||
|
|
||||||
|
#define JAWT_VERSION_1_3 0x00010003
|
||||||
|
#define JAWT_VERSION_1_4 0x00010004
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JAWT_H_ */
|
|
@ -0,0 +1,66 @@
|
||||||
|
//
|
||||||
|
// jawt_md.h
|
||||||
|
// Copyright (c) 2002-2010 Apple Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JAWT_MD_H_
|
||||||
|
#define _JAVASOFT_JAWT_MD_H_
|
||||||
|
|
||||||
|
#include "jawt.h"
|
||||||
|
|
||||||
|
#import <AppKit/NSView.h>
|
||||||
|
#import <QuartzCore/CALayer.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT on Mac OS X has two rendering models; legacy NSView, and CALayer.
|
||||||
|
*
|
||||||
|
* The CALayer based model returns an object conforming to the JAWT_SurfaceLayers
|
||||||
|
* protocol in it's JAWT_DrawingSurfaceInfo->platformInfo pointer. A CALayer
|
||||||
|
* assigned to the "layer" property overlays the rectangle of the java.awt.Component.
|
||||||
|
* The client CALayer traces the rect of the Java component as it is moved and resized.
|
||||||
|
*
|
||||||
|
* If there is a superlayer for the entire window, it is also accessible via
|
||||||
|
* the "windowLayer" property. This layer is useful for embedding the Java
|
||||||
|
* window in other layer graphs.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* The legacy NSView model provides raw access to the NSView hierarchy which
|
||||||
|
* mirrors the Java component hierarchy. The legacy NSView drawing model is deprecated,
|
||||||
|
* and will not be available in future versions of Java for Mac OS X.
|
||||||
|
*
|
||||||
|
* Clients can opt-into the CALayer model by OR'ing the JAWT_MACOSX_USE_CALAYER into the requested JAWT version.
|
||||||
|
*
|
||||||
|
* JAWT awt;
|
||||||
|
* awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
|
||||||
|
* jboolean success = JAWT_GetAWT(env, &awt);
|
||||||
|
*
|
||||||
|
* Future versions of Java for Mac OS X will only support the CALayer model,
|
||||||
|
* and will not return a JAWT_MacOSXDrawingSurfaceInfo struct.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define JAWT_MACOSX_USE_CALAYER 0x80000000
|
||||||
|
|
||||||
|
// CALayer-based rendering
|
||||||
|
@protocol JAWT_SurfaceLayers
|
||||||
|
@property (readwrite, retain) CALayer *layer;
|
||||||
|
@property (readonly) CALayer *windowLayer;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
// Legacy NSView-based rendering
|
||||||
|
typedef struct JAWT_MacOSXDrawingSurfaceInfo {
|
||||||
|
NSView *cocoaViewRef; // the view is guaranteed to be valid only for the duration of Component.paint method
|
||||||
|
}
|
||||||
|
JAWT_MacOSXDrawingSurfaceInfo;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JAWT_MD_H_ */
|
|
@ -0,0 +1,237 @@
|
||||||
|
/*
|
||||||
|
* @(#)jdwpTransport.h 1.8 05/11/17
|
||||||
|
*
|
||||||
|
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Java Debug Wire Protocol Transport Service Provider Interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef JDWPTRANSPORT_H
|
||||||
|
#define JDWPTRANSPORT_H
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JDWPTRANSPORT_VERSION_1_0 = 0x00010000
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct jdwpTransportNativeInterface_;
|
||||||
|
|
||||||
|
struct _jdwpTransportEnv;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
typedef _jdwpTransportEnv jdwpTransportEnv;
|
||||||
|
#else
|
||||||
|
typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Errors. Universal errors with JVMTI/JVMDI equivalents keep the
|
||||||
|
* values the same.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
JDWPTRANSPORT_ERROR_NONE = 0,
|
||||||
|
JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
|
||||||
|
JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
|
||||||
|
JDWPTRANSPORT_ERROR_INTERNAL = 113,
|
||||||
|
JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
|
||||||
|
JDWPTRANSPORT_ERROR_IO_ERROR = 202,
|
||||||
|
JDWPTRANSPORT_ERROR_TIMEOUT = 203,
|
||||||
|
JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
|
||||||
|
} jdwpTransportError;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure to define capabilities
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned int can_timeout_attach :1;
|
||||||
|
unsigned int can_timeout_accept :1;
|
||||||
|
unsigned int can_timeout_handshake :1;
|
||||||
|
unsigned int reserved3 :1;
|
||||||
|
unsigned int reserved4 :1;
|
||||||
|
unsigned int reserved5 :1;
|
||||||
|
unsigned int reserved6 :1;
|
||||||
|
unsigned int reserved7 :1;
|
||||||
|
unsigned int reserved8 :1;
|
||||||
|
unsigned int reserved9 :1;
|
||||||
|
unsigned int reserved10 :1;
|
||||||
|
unsigned int reserved11 :1;
|
||||||
|
unsigned int reserved12 :1;
|
||||||
|
unsigned int reserved13 :1;
|
||||||
|
unsigned int reserved14 :1;
|
||||||
|
unsigned int reserved15 :1;
|
||||||
|
} JDWPTransportCapabilities;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structures to define packet layout.
|
||||||
|
*
|
||||||
|
* See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JDWPTRANSPORT_FLAGS_NONE = 0x0,
|
||||||
|
JDWPTRANSPORT_FLAGS_REPLY = 0x80
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
jint len;
|
||||||
|
jint id;
|
||||||
|
jbyte flags;
|
||||||
|
jbyte cmdSet;
|
||||||
|
jbyte cmd;
|
||||||
|
jbyte *data;
|
||||||
|
} jdwpCmdPacket;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
jint len;
|
||||||
|
jint id;
|
||||||
|
jbyte flags;
|
||||||
|
jshort errorCode;
|
||||||
|
jbyte *data;
|
||||||
|
} jdwpReplyPacket;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
union {
|
||||||
|
jdwpCmdPacket cmd;
|
||||||
|
jdwpReplyPacket reply;
|
||||||
|
} type;
|
||||||
|
} jdwpPacket;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JDWP functions called by the transport.
|
||||||
|
*/
|
||||||
|
typedef struct jdwpTransportCallback {
|
||||||
|
void *(*alloc)(jint numBytes); /* Call this for all allocations */
|
||||||
|
void (*free)(void *buffer); /* Call this for all deallocations */
|
||||||
|
} jdwpTransportCallback;
|
||||||
|
|
||||||
|
typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
|
||||||
|
jdwpTransportCallback *callback,
|
||||||
|
jint version,
|
||||||
|
jdwpTransportEnv** env);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Function Interface */
|
||||||
|
|
||||||
|
struct jdwpTransportNativeInterface_ {
|
||||||
|
/* 1 : RESERVED */
|
||||||
|
void *reserved1;
|
||||||
|
|
||||||
|
/* 2 : Get Capabilities */
|
||||||
|
jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
|
||||||
|
JDWPTransportCapabilities *capabilities_ptr);
|
||||||
|
|
||||||
|
/* 3 : Attach */
|
||||||
|
jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
|
||||||
|
const char* address,
|
||||||
|
jlong attach_timeout,
|
||||||
|
jlong handshake_timeout);
|
||||||
|
|
||||||
|
/* 4: StartListening */
|
||||||
|
jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
|
||||||
|
const char* address,
|
||||||
|
char** actual_address);
|
||||||
|
|
||||||
|
/* 5: StopListening */
|
||||||
|
jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 6: Accept */
|
||||||
|
jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
|
||||||
|
jlong accept_timeout,
|
||||||
|
jlong handshake_timeout);
|
||||||
|
|
||||||
|
/* 7: IsOpen */
|
||||||
|
jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 8: Close */
|
||||||
|
jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 9: ReadPacket */
|
||||||
|
jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
|
||||||
|
jdwpPacket *pkt);
|
||||||
|
|
||||||
|
/* 10: Write Packet */
|
||||||
|
jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
|
||||||
|
const jdwpPacket* pkt);
|
||||||
|
|
||||||
|
/* 11: GetLastError */
|
||||||
|
jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
|
||||||
|
char** error);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use inlined functions so that C++ code can use syntax such as
|
||||||
|
* env->Attach("mymachine:5000", 10*1000, 0);
|
||||||
|
*
|
||||||
|
* rather than using C's :-
|
||||||
|
*
|
||||||
|
* (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
|
||||||
|
*/
|
||||||
|
struct _jdwpTransportEnv {
|
||||||
|
const struct jdwpTransportNativeInterface_ *functions;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
|
||||||
|
return functions->GetCapabilities(this, capabilities_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Attach(const char* address, jlong attach_timeout,
|
||||||
|
jlong handshake_timeout) {
|
||||||
|
return functions->Attach(this, address, attach_timeout, handshake_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError StartListening(const char* address,
|
||||||
|
char** actual_address) {
|
||||||
|
return functions->StartListening(this, address, actual_address);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError StopListening(void) {
|
||||||
|
return functions->StopListening(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
|
||||||
|
return functions->Accept(this, accept_timeout, handshake_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
jboolean IsOpen(void) {
|
||||||
|
return functions->IsOpen(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Close(void) {
|
||||||
|
return functions->Close(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError ReadPacket(jdwpPacket *pkt) {
|
||||||
|
return functions->ReadPacket(this, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError WritePacket(const jdwpPacket* pkt) {
|
||||||
|
return functions->WritePacket(this, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError GetLastError(char** error) {
|
||||||
|
return functions->GetLastError(this, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* JDWPTRANSPORT_H */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* @(#)jni_md.h 1.19 05/11/17
|
||||||
|
*
|
||||||
|
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JNI_MD_H_
|
||||||
|
#define _JAVASOFT_JNI_MD_H_
|
||||||
|
|
||||||
|
#define JNIEXPORT __attribute__((visibility("default")))
|
||||||
|
#define JNIIMPORT
|
||||||
|
#define JNICALL
|
||||||
|
|
||||||
|
#if defined(__LP64__) && __LP64__ /* for -Wundef */
|
||||||
|
typedef int jint;
|
||||||
|
#else
|
||||||
|
typedef long jint;
|
||||||
|
#endif
|
||||||
|
typedef long long jlong;
|
||||||
|
typedef signed char jbyte;
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JNI_MD_H_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,560 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CLASSFILE_CONSTANTS_H
|
||||||
|
#define CLASSFILE_CONSTANTS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Classfile version number for this information */
|
||||||
|
#define JVM_CLASSFILE_MAJOR_VERSION 52
|
||||||
|
#define JVM_CLASSFILE_MINOR_VERSION 0
|
||||||
|
|
||||||
|
/* Flags */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JVM_ACC_PUBLIC = 0x0001,
|
||||||
|
JVM_ACC_PRIVATE = 0x0002,
|
||||||
|
JVM_ACC_PROTECTED = 0x0004,
|
||||||
|
JVM_ACC_STATIC = 0x0008,
|
||||||
|
JVM_ACC_FINAL = 0x0010,
|
||||||
|
JVM_ACC_SYNCHRONIZED = 0x0020,
|
||||||
|
JVM_ACC_SUPER = 0x0020,
|
||||||
|
JVM_ACC_VOLATILE = 0x0040,
|
||||||
|
JVM_ACC_BRIDGE = 0x0040,
|
||||||
|
JVM_ACC_TRANSIENT = 0x0080,
|
||||||
|
JVM_ACC_VARARGS = 0x0080,
|
||||||
|
JVM_ACC_NATIVE = 0x0100,
|
||||||
|
JVM_ACC_INTERFACE = 0x0200,
|
||||||
|
JVM_ACC_ABSTRACT = 0x0400,
|
||||||
|
JVM_ACC_STRICT = 0x0800,
|
||||||
|
JVM_ACC_SYNTHETIC = 0x1000,
|
||||||
|
JVM_ACC_ANNOTATION = 0x2000,
|
||||||
|
JVM_ACC_ENUM = 0x4000
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Used in newarray instruction. */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JVM_T_BOOLEAN = 4,
|
||||||
|
JVM_T_CHAR = 5,
|
||||||
|
JVM_T_FLOAT = 6,
|
||||||
|
JVM_T_DOUBLE = 7,
|
||||||
|
JVM_T_BYTE = 8,
|
||||||
|
JVM_T_SHORT = 9,
|
||||||
|
JVM_T_INT = 10,
|
||||||
|
JVM_T_LONG = 11
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Constant Pool Entries */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JVM_CONSTANT_Utf8 = 1,
|
||||||
|
JVM_CONSTANT_Unicode = 2, /* unused */
|
||||||
|
JVM_CONSTANT_Integer = 3,
|
||||||
|
JVM_CONSTANT_Float = 4,
|
||||||
|
JVM_CONSTANT_Long = 5,
|
||||||
|
JVM_CONSTANT_Double = 6,
|
||||||
|
JVM_CONSTANT_Class = 7,
|
||||||
|
JVM_CONSTANT_String = 8,
|
||||||
|
JVM_CONSTANT_Fieldref = 9,
|
||||||
|
JVM_CONSTANT_Methodref = 10,
|
||||||
|
JVM_CONSTANT_InterfaceMethodref = 11,
|
||||||
|
JVM_CONSTANT_NameAndType = 12,
|
||||||
|
JVM_CONSTANT_MethodHandle = 15, // JSR 292
|
||||||
|
JVM_CONSTANT_MethodType = 16, // JSR 292
|
||||||
|
JVM_CONSTANT_InvokeDynamic = 18
|
||||||
|
};
|
||||||
|
|
||||||
|
/* JVM_CONSTANT_MethodHandle subtypes */
|
||||||
|
enum {
|
||||||
|
JVM_REF_getField = 1,
|
||||||
|
JVM_REF_getStatic = 2,
|
||||||
|
JVM_REF_putField = 3,
|
||||||
|
JVM_REF_putStatic = 4,
|
||||||
|
JVM_REF_invokeVirtual = 5,
|
||||||
|
JVM_REF_invokeStatic = 6,
|
||||||
|
JVM_REF_invokeSpecial = 7,
|
||||||
|
JVM_REF_newInvokeSpecial = 8,
|
||||||
|
JVM_REF_invokeInterface = 9
|
||||||
|
};
|
||||||
|
|
||||||
|
/* StackMapTable type item numbers */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JVM_ITEM_Top = 0,
|
||||||
|
JVM_ITEM_Integer = 1,
|
||||||
|
JVM_ITEM_Float = 2,
|
||||||
|
JVM_ITEM_Double = 3,
|
||||||
|
JVM_ITEM_Long = 4,
|
||||||
|
JVM_ITEM_Null = 5,
|
||||||
|
JVM_ITEM_UninitializedThis = 6,
|
||||||
|
JVM_ITEM_Object = 7,
|
||||||
|
JVM_ITEM_Uninitialized = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Type signatures */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JVM_SIGNATURE_ARRAY = '[',
|
||||||
|
JVM_SIGNATURE_BYTE = 'B',
|
||||||
|
JVM_SIGNATURE_CHAR = 'C',
|
||||||
|
JVM_SIGNATURE_CLASS = 'L',
|
||||||
|
JVM_SIGNATURE_ENDCLASS = ';',
|
||||||
|
JVM_SIGNATURE_ENUM = 'E',
|
||||||
|
JVM_SIGNATURE_FLOAT = 'F',
|
||||||
|
JVM_SIGNATURE_DOUBLE = 'D',
|
||||||
|
JVM_SIGNATURE_FUNC = '(',
|
||||||
|
JVM_SIGNATURE_ENDFUNC = ')',
|
||||||
|
JVM_SIGNATURE_INT = 'I',
|
||||||
|
JVM_SIGNATURE_LONG = 'J',
|
||||||
|
JVM_SIGNATURE_SHORT = 'S',
|
||||||
|
JVM_SIGNATURE_VOID = 'V',
|
||||||
|
JVM_SIGNATURE_BOOLEAN = 'Z'
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Opcodes */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JVM_OPC_nop = 0,
|
||||||
|
JVM_OPC_aconst_null = 1,
|
||||||
|
JVM_OPC_iconst_m1 = 2,
|
||||||
|
JVM_OPC_iconst_0 = 3,
|
||||||
|
JVM_OPC_iconst_1 = 4,
|
||||||
|
JVM_OPC_iconst_2 = 5,
|
||||||
|
JVM_OPC_iconst_3 = 6,
|
||||||
|
JVM_OPC_iconst_4 = 7,
|
||||||
|
JVM_OPC_iconst_5 = 8,
|
||||||
|
JVM_OPC_lconst_0 = 9,
|
||||||
|
JVM_OPC_lconst_1 = 10,
|
||||||
|
JVM_OPC_fconst_0 = 11,
|
||||||
|
JVM_OPC_fconst_1 = 12,
|
||||||
|
JVM_OPC_fconst_2 = 13,
|
||||||
|
JVM_OPC_dconst_0 = 14,
|
||||||
|
JVM_OPC_dconst_1 = 15,
|
||||||
|
JVM_OPC_bipush = 16,
|
||||||
|
JVM_OPC_sipush = 17,
|
||||||
|
JVM_OPC_ldc = 18,
|
||||||
|
JVM_OPC_ldc_w = 19,
|
||||||
|
JVM_OPC_ldc2_w = 20,
|
||||||
|
JVM_OPC_iload = 21,
|
||||||
|
JVM_OPC_lload = 22,
|
||||||
|
JVM_OPC_fload = 23,
|
||||||
|
JVM_OPC_dload = 24,
|
||||||
|
JVM_OPC_aload = 25,
|
||||||
|
JVM_OPC_iload_0 = 26,
|
||||||
|
JVM_OPC_iload_1 = 27,
|
||||||
|
JVM_OPC_iload_2 = 28,
|
||||||
|
JVM_OPC_iload_3 = 29,
|
||||||
|
JVM_OPC_lload_0 = 30,
|
||||||
|
JVM_OPC_lload_1 = 31,
|
||||||
|
JVM_OPC_lload_2 = 32,
|
||||||
|
JVM_OPC_lload_3 = 33,
|
||||||
|
JVM_OPC_fload_0 = 34,
|
||||||
|
JVM_OPC_fload_1 = 35,
|
||||||
|
JVM_OPC_fload_2 = 36,
|
||||||
|
JVM_OPC_fload_3 = 37,
|
||||||
|
JVM_OPC_dload_0 = 38,
|
||||||
|
JVM_OPC_dload_1 = 39,
|
||||||
|
JVM_OPC_dload_2 = 40,
|
||||||
|
JVM_OPC_dload_3 = 41,
|
||||||
|
JVM_OPC_aload_0 = 42,
|
||||||
|
JVM_OPC_aload_1 = 43,
|
||||||
|
JVM_OPC_aload_2 = 44,
|
||||||
|
JVM_OPC_aload_3 = 45,
|
||||||
|
JVM_OPC_iaload = 46,
|
||||||
|
JVM_OPC_laload = 47,
|
||||||
|
JVM_OPC_faload = 48,
|
||||||
|
JVM_OPC_daload = 49,
|
||||||
|
JVM_OPC_aaload = 50,
|
||||||
|
JVM_OPC_baload = 51,
|
||||||
|
JVM_OPC_caload = 52,
|
||||||
|
JVM_OPC_saload = 53,
|
||||||
|
JVM_OPC_istore = 54,
|
||||||
|
JVM_OPC_lstore = 55,
|
||||||
|
JVM_OPC_fstore = 56,
|
||||||
|
JVM_OPC_dstore = 57,
|
||||||
|
JVM_OPC_astore = 58,
|
||||||
|
JVM_OPC_istore_0 = 59,
|
||||||
|
JVM_OPC_istore_1 = 60,
|
||||||
|
JVM_OPC_istore_2 = 61,
|
||||||
|
JVM_OPC_istore_3 = 62,
|
||||||
|
JVM_OPC_lstore_0 = 63,
|
||||||
|
JVM_OPC_lstore_1 = 64,
|
||||||
|
JVM_OPC_lstore_2 = 65,
|
||||||
|
JVM_OPC_lstore_3 = 66,
|
||||||
|
JVM_OPC_fstore_0 = 67,
|
||||||
|
JVM_OPC_fstore_1 = 68,
|
||||||
|
JVM_OPC_fstore_2 = 69,
|
||||||
|
JVM_OPC_fstore_3 = 70,
|
||||||
|
JVM_OPC_dstore_0 = 71,
|
||||||
|
JVM_OPC_dstore_1 = 72,
|
||||||
|
JVM_OPC_dstore_2 = 73,
|
||||||
|
JVM_OPC_dstore_3 = 74,
|
||||||
|
JVM_OPC_astore_0 = 75,
|
||||||
|
JVM_OPC_astore_1 = 76,
|
||||||
|
JVM_OPC_astore_2 = 77,
|
||||||
|
JVM_OPC_astore_3 = 78,
|
||||||
|
JVM_OPC_iastore = 79,
|
||||||
|
JVM_OPC_lastore = 80,
|
||||||
|
JVM_OPC_fastore = 81,
|
||||||
|
JVM_OPC_dastore = 82,
|
||||||
|
JVM_OPC_aastore = 83,
|
||||||
|
JVM_OPC_bastore = 84,
|
||||||
|
JVM_OPC_castore = 85,
|
||||||
|
JVM_OPC_sastore = 86,
|
||||||
|
JVM_OPC_pop = 87,
|
||||||
|
JVM_OPC_pop2 = 88,
|
||||||
|
JVM_OPC_dup = 89,
|
||||||
|
JVM_OPC_dup_x1 = 90,
|
||||||
|
JVM_OPC_dup_x2 = 91,
|
||||||
|
JVM_OPC_dup2 = 92,
|
||||||
|
JVM_OPC_dup2_x1 = 93,
|
||||||
|
JVM_OPC_dup2_x2 = 94,
|
||||||
|
JVM_OPC_swap = 95,
|
||||||
|
JVM_OPC_iadd = 96,
|
||||||
|
JVM_OPC_ladd = 97,
|
||||||
|
JVM_OPC_fadd = 98,
|
||||||
|
JVM_OPC_dadd = 99,
|
||||||
|
JVM_OPC_isub = 100,
|
||||||
|
JVM_OPC_lsub = 101,
|
||||||
|
JVM_OPC_fsub = 102,
|
||||||
|
JVM_OPC_dsub = 103,
|
||||||
|
JVM_OPC_imul = 104,
|
||||||
|
JVM_OPC_lmul = 105,
|
||||||
|
JVM_OPC_fmul = 106,
|
||||||
|
JVM_OPC_dmul = 107,
|
||||||
|
JVM_OPC_idiv = 108,
|
||||||
|
JVM_OPC_ldiv = 109,
|
||||||
|
JVM_OPC_fdiv = 110,
|
||||||
|
JVM_OPC_ddiv = 111,
|
||||||
|
JVM_OPC_irem = 112,
|
||||||
|
JVM_OPC_lrem = 113,
|
||||||
|
JVM_OPC_frem = 114,
|
||||||
|
JVM_OPC_drem = 115,
|
||||||
|
JVM_OPC_ineg = 116,
|
||||||
|
JVM_OPC_lneg = 117,
|
||||||
|
JVM_OPC_fneg = 118,
|
||||||
|
JVM_OPC_dneg = 119,
|
||||||
|
JVM_OPC_ishl = 120,
|
||||||
|
JVM_OPC_lshl = 121,
|
||||||
|
JVM_OPC_ishr = 122,
|
||||||
|
JVM_OPC_lshr = 123,
|
||||||
|
JVM_OPC_iushr = 124,
|
||||||
|
JVM_OPC_lushr = 125,
|
||||||
|
JVM_OPC_iand = 126,
|
||||||
|
JVM_OPC_land = 127,
|
||||||
|
JVM_OPC_ior = 128,
|
||||||
|
JVM_OPC_lor = 129,
|
||||||
|
JVM_OPC_ixor = 130,
|
||||||
|
JVM_OPC_lxor = 131,
|
||||||
|
JVM_OPC_iinc = 132,
|
||||||
|
JVM_OPC_i2l = 133,
|
||||||
|
JVM_OPC_i2f = 134,
|
||||||
|
JVM_OPC_i2d = 135,
|
||||||
|
JVM_OPC_l2i = 136,
|
||||||
|
JVM_OPC_l2f = 137,
|
||||||
|
JVM_OPC_l2d = 138,
|
||||||
|
JVM_OPC_f2i = 139,
|
||||||
|
JVM_OPC_f2l = 140,
|
||||||
|
JVM_OPC_f2d = 141,
|
||||||
|
JVM_OPC_d2i = 142,
|
||||||
|
JVM_OPC_d2l = 143,
|
||||||
|
JVM_OPC_d2f = 144,
|
||||||
|
JVM_OPC_i2b = 145,
|
||||||
|
JVM_OPC_i2c = 146,
|
||||||
|
JVM_OPC_i2s = 147,
|
||||||
|
JVM_OPC_lcmp = 148,
|
||||||
|
JVM_OPC_fcmpl = 149,
|
||||||
|
JVM_OPC_fcmpg = 150,
|
||||||
|
JVM_OPC_dcmpl = 151,
|
||||||
|
JVM_OPC_dcmpg = 152,
|
||||||
|
JVM_OPC_ifeq = 153,
|
||||||
|
JVM_OPC_ifne = 154,
|
||||||
|
JVM_OPC_iflt = 155,
|
||||||
|
JVM_OPC_ifge = 156,
|
||||||
|
JVM_OPC_ifgt = 157,
|
||||||
|
JVM_OPC_ifle = 158,
|
||||||
|
JVM_OPC_if_icmpeq = 159,
|
||||||
|
JVM_OPC_if_icmpne = 160,
|
||||||
|
JVM_OPC_if_icmplt = 161,
|
||||||
|
JVM_OPC_if_icmpge = 162,
|
||||||
|
JVM_OPC_if_icmpgt = 163,
|
||||||
|
JVM_OPC_if_icmple = 164,
|
||||||
|
JVM_OPC_if_acmpeq = 165,
|
||||||
|
JVM_OPC_if_acmpne = 166,
|
||||||
|
JVM_OPC_goto = 167,
|
||||||
|
JVM_OPC_jsr = 168,
|
||||||
|
JVM_OPC_ret = 169,
|
||||||
|
JVM_OPC_tableswitch = 170,
|
||||||
|
JVM_OPC_lookupswitch = 171,
|
||||||
|
JVM_OPC_ireturn = 172,
|
||||||
|
JVM_OPC_lreturn = 173,
|
||||||
|
JVM_OPC_freturn = 174,
|
||||||
|
JVM_OPC_dreturn = 175,
|
||||||
|
JVM_OPC_areturn = 176,
|
||||||
|
JVM_OPC_return = 177,
|
||||||
|
JVM_OPC_getstatic = 178,
|
||||||
|
JVM_OPC_putstatic = 179,
|
||||||
|
JVM_OPC_getfield = 180,
|
||||||
|
JVM_OPC_putfield = 181,
|
||||||
|
JVM_OPC_invokevirtual = 182,
|
||||||
|
JVM_OPC_invokespecial = 183,
|
||||||
|
JVM_OPC_invokestatic = 184,
|
||||||
|
JVM_OPC_invokeinterface = 185,
|
||||||
|
JVM_OPC_invokedynamic = 186,
|
||||||
|
JVM_OPC_new = 187,
|
||||||
|
JVM_OPC_newarray = 188,
|
||||||
|
JVM_OPC_anewarray = 189,
|
||||||
|
JVM_OPC_arraylength = 190,
|
||||||
|
JVM_OPC_athrow = 191,
|
||||||
|
JVM_OPC_checkcast = 192,
|
||||||
|
JVM_OPC_instanceof = 193,
|
||||||
|
JVM_OPC_monitorenter = 194,
|
||||||
|
JVM_OPC_monitorexit = 195,
|
||||||
|
JVM_OPC_wide = 196,
|
||||||
|
JVM_OPC_multianewarray = 197,
|
||||||
|
JVM_OPC_ifnull = 198,
|
||||||
|
JVM_OPC_ifnonnull = 199,
|
||||||
|
JVM_OPC_goto_w = 200,
|
||||||
|
JVM_OPC_jsr_w = 201,
|
||||||
|
JVM_OPC_MAX = 201
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Opcode length initializer, use with something like:
|
||||||
|
* unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
|
||||||
|
*/
|
||||||
|
#define JVM_OPCODE_LENGTH_INITIALIZER { \
|
||||||
|
1, /* nop */ \
|
||||||
|
1, /* aconst_null */ \
|
||||||
|
1, /* iconst_m1 */ \
|
||||||
|
1, /* iconst_0 */ \
|
||||||
|
1, /* iconst_1 */ \
|
||||||
|
1, /* iconst_2 */ \
|
||||||
|
1, /* iconst_3 */ \
|
||||||
|
1, /* iconst_4 */ \
|
||||||
|
1, /* iconst_5 */ \
|
||||||
|
1, /* lconst_0 */ \
|
||||||
|
1, /* lconst_1 */ \
|
||||||
|
1, /* fconst_0 */ \
|
||||||
|
1, /* fconst_1 */ \
|
||||||
|
1, /* fconst_2 */ \
|
||||||
|
1, /* dconst_0 */ \
|
||||||
|
1, /* dconst_1 */ \
|
||||||
|
2, /* bipush */ \
|
||||||
|
3, /* sipush */ \
|
||||||
|
2, /* ldc */ \
|
||||||
|
3, /* ldc_w */ \
|
||||||
|
3, /* ldc2_w */ \
|
||||||
|
2, /* iload */ \
|
||||||
|
2, /* lload */ \
|
||||||
|
2, /* fload */ \
|
||||||
|
2, /* dload */ \
|
||||||
|
2, /* aload */ \
|
||||||
|
1, /* iload_0 */ \
|
||||||
|
1, /* iload_1 */ \
|
||||||
|
1, /* iload_2 */ \
|
||||||
|
1, /* iload_3 */ \
|
||||||
|
1, /* lload_0 */ \
|
||||||
|
1, /* lload_1 */ \
|
||||||
|
1, /* lload_2 */ \
|
||||||
|
1, /* lload_3 */ \
|
||||||
|
1, /* fload_0 */ \
|
||||||
|
1, /* fload_1 */ \
|
||||||
|
1, /* fload_2 */ \
|
||||||
|
1, /* fload_3 */ \
|
||||||
|
1, /* dload_0 */ \
|
||||||
|
1, /* dload_1 */ \
|
||||||
|
1, /* dload_2 */ \
|
||||||
|
1, /* dload_3 */ \
|
||||||
|
1, /* aload_0 */ \
|
||||||
|
1, /* aload_1 */ \
|
||||||
|
1, /* aload_2 */ \
|
||||||
|
1, /* aload_3 */ \
|
||||||
|
1, /* iaload */ \
|
||||||
|
1, /* laload */ \
|
||||||
|
1, /* faload */ \
|
||||||
|
1, /* daload */ \
|
||||||
|
1, /* aaload */ \
|
||||||
|
1, /* baload */ \
|
||||||
|
1, /* caload */ \
|
||||||
|
1, /* saload */ \
|
||||||
|
2, /* istore */ \
|
||||||
|
2, /* lstore */ \
|
||||||
|
2, /* fstore */ \
|
||||||
|
2, /* dstore */ \
|
||||||
|
2, /* astore */ \
|
||||||
|
1, /* istore_0 */ \
|
||||||
|
1, /* istore_1 */ \
|
||||||
|
1, /* istore_2 */ \
|
||||||
|
1, /* istore_3 */ \
|
||||||
|
1, /* lstore_0 */ \
|
||||||
|
1, /* lstore_1 */ \
|
||||||
|
1, /* lstore_2 */ \
|
||||||
|
1, /* lstore_3 */ \
|
||||||
|
1, /* fstore_0 */ \
|
||||||
|
1, /* fstore_1 */ \
|
||||||
|
1, /* fstore_2 */ \
|
||||||
|
1, /* fstore_3 */ \
|
||||||
|
1, /* dstore_0 */ \
|
||||||
|
1, /* dstore_1 */ \
|
||||||
|
1, /* dstore_2 */ \
|
||||||
|
1, /* dstore_3 */ \
|
||||||
|
1, /* astore_0 */ \
|
||||||
|
1, /* astore_1 */ \
|
||||||
|
1, /* astore_2 */ \
|
||||||
|
1, /* astore_3 */ \
|
||||||
|
1, /* iastore */ \
|
||||||
|
1, /* lastore */ \
|
||||||
|
1, /* fastore */ \
|
||||||
|
1, /* dastore */ \
|
||||||
|
1, /* aastore */ \
|
||||||
|
1, /* bastore */ \
|
||||||
|
1, /* castore */ \
|
||||||
|
1, /* sastore */ \
|
||||||
|
1, /* pop */ \
|
||||||
|
1, /* pop2 */ \
|
||||||
|
1, /* dup */ \
|
||||||
|
1, /* dup_x1 */ \
|
||||||
|
1, /* dup_x2 */ \
|
||||||
|
1, /* dup2 */ \
|
||||||
|
1, /* dup2_x1 */ \
|
||||||
|
1, /* dup2_x2 */ \
|
||||||
|
1, /* swap */ \
|
||||||
|
1, /* iadd */ \
|
||||||
|
1, /* ladd */ \
|
||||||
|
1, /* fadd */ \
|
||||||
|
1, /* dadd */ \
|
||||||
|
1, /* isub */ \
|
||||||
|
1, /* lsub */ \
|
||||||
|
1, /* fsub */ \
|
||||||
|
1, /* dsub */ \
|
||||||
|
1, /* imul */ \
|
||||||
|
1, /* lmul */ \
|
||||||
|
1, /* fmul */ \
|
||||||
|
1, /* dmul */ \
|
||||||
|
1, /* idiv */ \
|
||||||
|
1, /* ldiv */ \
|
||||||
|
1, /* fdiv */ \
|
||||||
|
1, /* ddiv */ \
|
||||||
|
1, /* irem */ \
|
||||||
|
1, /* lrem */ \
|
||||||
|
1, /* frem */ \
|
||||||
|
1, /* drem */ \
|
||||||
|
1, /* ineg */ \
|
||||||
|
1, /* lneg */ \
|
||||||
|
1, /* fneg */ \
|
||||||
|
1, /* dneg */ \
|
||||||
|
1, /* ishl */ \
|
||||||
|
1, /* lshl */ \
|
||||||
|
1, /* ishr */ \
|
||||||
|
1, /* lshr */ \
|
||||||
|
1, /* iushr */ \
|
||||||
|
1, /* lushr */ \
|
||||||
|
1, /* iand */ \
|
||||||
|
1, /* land */ \
|
||||||
|
1, /* ior */ \
|
||||||
|
1, /* lor */ \
|
||||||
|
1, /* ixor */ \
|
||||||
|
1, /* lxor */ \
|
||||||
|
3, /* iinc */ \
|
||||||
|
1, /* i2l */ \
|
||||||
|
1, /* i2f */ \
|
||||||
|
1, /* i2d */ \
|
||||||
|
1, /* l2i */ \
|
||||||
|
1, /* l2f */ \
|
||||||
|
1, /* l2d */ \
|
||||||
|
1, /* f2i */ \
|
||||||
|
1, /* f2l */ \
|
||||||
|
1, /* f2d */ \
|
||||||
|
1, /* d2i */ \
|
||||||
|
1, /* d2l */ \
|
||||||
|
1, /* d2f */ \
|
||||||
|
1, /* i2b */ \
|
||||||
|
1, /* i2c */ \
|
||||||
|
1, /* i2s */ \
|
||||||
|
1, /* lcmp */ \
|
||||||
|
1, /* fcmpl */ \
|
||||||
|
1, /* fcmpg */ \
|
||||||
|
1, /* dcmpl */ \
|
||||||
|
1, /* dcmpg */ \
|
||||||
|
3, /* ifeq */ \
|
||||||
|
3, /* ifne */ \
|
||||||
|
3, /* iflt */ \
|
||||||
|
3, /* ifge */ \
|
||||||
|
3, /* ifgt */ \
|
||||||
|
3, /* ifle */ \
|
||||||
|
3, /* if_icmpeq */ \
|
||||||
|
3, /* if_icmpne */ \
|
||||||
|
3, /* if_icmplt */ \
|
||||||
|
3, /* if_icmpge */ \
|
||||||
|
3, /* if_icmpgt */ \
|
||||||
|
3, /* if_icmple */ \
|
||||||
|
3, /* if_acmpeq */ \
|
||||||
|
3, /* if_acmpne */ \
|
||||||
|
3, /* goto */ \
|
||||||
|
3, /* jsr */ \
|
||||||
|
2, /* ret */ \
|
||||||
|
99, /* tableswitch */ \
|
||||||
|
99, /* lookupswitch */ \
|
||||||
|
1, /* ireturn */ \
|
||||||
|
1, /* lreturn */ \
|
||||||
|
1, /* freturn */ \
|
||||||
|
1, /* dreturn */ \
|
||||||
|
1, /* areturn */ \
|
||||||
|
1, /* return */ \
|
||||||
|
3, /* getstatic */ \
|
||||||
|
3, /* putstatic */ \
|
||||||
|
3, /* getfield */ \
|
||||||
|
3, /* putfield */ \
|
||||||
|
3, /* invokevirtual */ \
|
||||||
|
3, /* invokespecial */ \
|
||||||
|
3, /* invokestatic */ \
|
||||||
|
5, /* invokeinterface */ \
|
||||||
|
5, /* invokedynamic */ \
|
||||||
|
3, /* new */ \
|
||||||
|
2, /* newarray */ \
|
||||||
|
3, /* anewarray */ \
|
||||||
|
1, /* arraylength */ \
|
||||||
|
1, /* athrow */ \
|
||||||
|
3, /* checkcast */ \
|
||||||
|
3, /* instanceof */ \
|
||||||
|
1, /* monitorenter */ \
|
||||||
|
1, /* monitorexit */ \
|
||||||
|
0, /* wide */ \
|
||||||
|
4, /* multianewarray */ \
|
||||||
|
3, /* ifnull */ \
|
||||||
|
3, /* ifnonnull */ \
|
||||||
|
5, /* goto_w */ \
|
||||||
|
5 /* jsr_w */ \
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* CLASSFILE_CONSTANTS */
|
|
@ -0,0 +1,299 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JAWT_H_
|
||||||
|
#define _JAVASOFT_JAWT_H_
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AWT native interface (new in JDK 1.3)
|
||||||
|
*
|
||||||
|
* The AWT native interface allows a native C or C++ application a means
|
||||||
|
* by which to access native structures in AWT. This is to facilitate moving
|
||||||
|
* legacy C and C++ applications to Java and to target the needs of the
|
||||||
|
* community who, at present, wish to do their own native rendering to canvases
|
||||||
|
* for performance reasons. Standard extensions such as Java3D also require a
|
||||||
|
* means to access the underlying native data structures of AWT.
|
||||||
|
*
|
||||||
|
* There may be future extensions to this API depending on demand.
|
||||||
|
*
|
||||||
|
* A VM does not have to implement this API in order to pass the JCK.
|
||||||
|
* It is recommended, however, that this API is implemented on VMs that support
|
||||||
|
* standard extensions, such as Java3D.
|
||||||
|
*
|
||||||
|
* Since this is a native API, any program which uses it cannot be considered
|
||||||
|
* 100% pure java.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AWT Native Drawing Surface (JAWT_DrawingSurface).
|
||||||
|
*
|
||||||
|
* For each platform, there is a native drawing surface structure. This
|
||||||
|
* platform-specific structure can be found in jawt_md.h. It is recommended
|
||||||
|
* that additional platforms follow the same model. It is also recommended
|
||||||
|
* that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
|
||||||
|
*
|
||||||
|
*******************
|
||||||
|
* EXAMPLE OF USAGE:
|
||||||
|
*******************
|
||||||
|
*
|
||||||
|
* In Win32, a programmer wishes to access the HWND of a canvas to perform
|
||||||
|
* native rendering into it. The programmer has declared the paint() method
|
||||||
|
* for their canvas subclass to be native:
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* MyCanvas.java:
|
||||||
|
*
|
||||||
|
* import java.awt.*;
|
||||||
|
*
|
||||||
|
* public class MyCanvas extends Canvas {
|
||||||
|
*
|
||||||
|
* static {
|
||||||
|
* System.loadLibrary("mylib");
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public native void paint(Graphics g);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* myfile.c:
|
||||||
|
*
|
||||||
|
* #include "jawt_md.h"
|
||||||
|
* #include <assert.h>
|
||||||
|
*
|
||||||
|
* JNIEXPORT void JNICALL
|
||||||
|
* Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
|
||||||
|
* {
|
||||||
|
* JAWT awt;
|
||||||
|
* JAWT_DrawingSurface* ds;
|
||||||
|
* JAWT_DrawingSurfaceInfo* dsi;
|
||||||
|
* JAWT_Win32DrawingSurfaceInfo* dsi_win;
|
||||||
|
* jboolean result;
|
||||||
|
* jint lock;
|
||||||
|
*
|
||||||
|
* // Get the AWT
|
||||||
|
* awt.version = JAWT_VERSION_1_3;
|
||||||
|
* result = JAWT_GetAWT(env, &awt);
|
||||||
|
* assert(result != JNI_FALSE);
|
||||||
|
*
|
||||||
|
* // Get the drawing surface
|
||||||
|
* ds = awt.GetDrawingSurface(env, canvas);
|
||||||
|
* assert(ds != NULL);
|
||||||
|
*
|
||||||
|
* // Lock the drawing surface
|
||||||
|
* lock = ds->Lock(ds);
|
||||||
|
* assert((lock & JAWT_LOCK_ERROR) == 0);
|
||||||
|
*
|
||||||
|
* // Get the drawing surface info
|
||||||
|
* dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||||
|
*
|
||||||
|
* // Get the platform-specific drawing info
|
||||||
|
* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
|
||||||
|
*
|
||||||
|
* //////////////////////////////
|
||||||
|
* // !!! DO PAINTING HERE !!! //
|
||||||
|
* //////////////////////////////
|
||||||
|
*
|
||||||
|
* // Free the drawing surface info
|
||||||
|
* ds->FreeDrawingSurfaceInfo(dsi);
|
||||||
|
*
|
||||||
|
* // Unlock the drawing surface
|
||||||
|
* ds->Unlock(ds);
|
||||||
|
*
|
||||||
|
* // Free the drawing surface
|
||||||
|
* awt.FreeDrawingSurface(ds);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_Rectangle
|
||||||
|
* Structure for a native rectangle.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_Rectangle {
|
||||||
|
jint x;
|
||||||
|
jint y;
|
||||||
|
jint width;
|
||||||
|
jint height;
|
||||||
|
} JAWT_Rectangle;
|
||||||
|
|
||||||
|
struct jawt_DrawingSurface;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_DrawingSurfaceInfo
|
||||||
|
* Structure for containing the underlying drawing information of a component.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_DrawingSurfaceInfo {
|
||||||
|
/*
|
||||||
|
* Pointer to the platform-specific information. This can be safely
|
||||||
|
* cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
|
||||||
|
* JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a
|
||||||
|
* pointer to a NSObject that conforms to the JAWT_SurfaceLayers
|
||||||
|
* protocol. See jawt_md.h for details.
|
||||||
|
*/
|
||||||
|
void* platformInfo;
|
||||||
|
/* Cached pointer to the underlying drawing surface */
|
||||||
|
struct jawt_DrawingSurface* ds;
|
||||||
|
/* Bounding rectangle of the drawing surface */
|
||||||
|
JAWT_Rectangle bounds;
|
||||||
|
/* Number of rectangles in the clip */
|
||||||
|
jint clipSize;
|
||||||
|
/* Clip rectangle array */
|
||||||
|
JAWT_Rectangle* clip;
|
||||||
|
} JAWT_DrawingSurfaceInfo;
|
||||||
|
|
||||||
|
#define JAWT_LOCK_ERROR 0x00000001
|
||||||
|
#define JAWT_LOCK_CLIP_CHANGED 0x00000002
|
||||||
|
#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
|
||||||
|
#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_DrawingSurface
|
||||||
|
* Structure for containing the underlying drawing information of a component.
|
||||||
|
* All operations on a JAWT_DrawingSurface MUST be performed from the same
|
||||||
|
* thread as the call to GetDrawingSurface.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_DrawingSurface {
|
||||||
|
/*
|
||||||
|
* Cached reference to the Java environment of the calling thread.
|
||||||
|
* If Lock(), Unlock(), GetDrawingSurfaceInfo() or
|
||||||
|
* FreeDrawingSurfaceInfo() are called from a different thread,
|
||||||
|
* this data member should be set before calling those functions.
|
||||||
|
*/
|
||||||
|
JNIEnv* env;
|
||||||
|
/* Cached reference to the target object */
|
||||||
|
jobject target;
|
||||||
|
/*
|
||||||
|
* Lock the surface of the target component for native rendering.
|
||||||
|
* When finished drawing, the surface must be unlocked with
|
||||||
|
* Unlock(). This function returns a bitmask with one or more of the
|
||||||
|
* following values:
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
|
||||||
|
* be locked.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
|
||||||
|
*/
|
||||||
|
jint (JNICALL *Lock)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Get the drawing surface info.
|
||||||
|
* The value returned may be cached, but the values may change if
|
||||||
|
* additional calls to Lock() or Unlock() are made.
|
||||||
|
* Lock() must be called before this can return a valid value.
|
||||||
|
* Returns NULL if an error has occurred.
|
||||||
|
* When finished with the returned value, FreeDrawingSurfaceInfo must be
|
||||||
|
* called.
|
||||||
|
*/
|
||||||
|
JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Free the drawing surface info.
|
||||||
|
*/
|
||||||
|
void (JNICALL *FreeDrawingSurfaceInfo)
|
||||||
|
(JAWT_DrawingSurfaceInfo* dsi);
|
||||||
|
/*
|
||||||
|
* Unlock the drawing surface of the target component for native rendering.
|
||||||
|
*/
|
||||||
|
void (JNICALL *Unlock)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
} JAWT_DrawingSurface;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT
|
||||||
|
* Structure for containing native AWT functions.
|
||||||
|
*/
|
||||||
|
typedef struct jawt {
|
||||||
|
/*
|
||||||
|
* Version of this structure. This must always be set before
|
||||||
|
* calling JAWT_GetAWT()
|
||||||
|
*/
|
||||||
|
jint version;
|
||||||
|
/*
|
||||||
|
* Return a drawing surface from a target jobject. This value
|
||||||
|
* may be cached.
|
||||||
|
* Returns NULL if an error has occurred.
|
||||||
|
* Target must be a java.awt.Component (should be a Canvas
|
||||||
|
* or Window for native rendering).
|
||||||
|
* FreeDrawingSurface() must be called when finished with the
|
||||||
|
* returned JAWT_DrawingSurface.
|
||||||
|
*/
|
||||||
|
JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
|
||||||
|
(JNIEnv* env, jobject target);
|
||||||
|
/*
|
||||||
|
* Free the drawing surface allocated in GetDrawingSurface.
|
||||||
|
*/
|
||||||
|
void (JNICALL *FreeDrawingSurface)
|
||||||
|
(JAWT_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Locks the entire AWT for synchronization purposes
|
||||||
|
*/
|
||||||
|
void (JNICALL *Lock)(JNIEnv* env);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Unlocks the entire AWT for synchronization purposes
|
||||||
|
*/
|
||||||
|
void (JNICALL *Unlock)(JNIEnv* env);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Returns a reference to a java.awt.Component from a native
|
||||||
|
* platform handle. On Windows, this corresponds to an HWND;
|
||||||
|
* on Solaris and Linux, this is a Drawable. For other platforms,
|
||||||
|
* see the appropriate machine-dependent header file for a description.
|
||||||
|
* The reference returned by this function is a local
|
||||||
|
* reference that is only valid in this environment.
|
||||||
|
* This function returns a NULL reference if no component could be
|
||||||
|
* found with matching platform information.
|
||||||
|
*/
|
||||||
|
jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
|
||||||
|
|
||||||
|
} JAWT;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the AWT native structure. This function returns JNI_FALSE if
|
||||||
|
* an error occurs.
|
||||||
|
*/
|
||||||
|
_JNI_IMPORT_OR_EXPORT_
|
||||||
|
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
|
||||||
|
|
||||||
|
#define JAWT_VERSION_1_3 0x00010003
|
||||||
|
#define JAWT_VERSION_1_4 0x00010004
|
||||||
|
#define JAWT_VERSION_1_7 0x00010007
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JAWT_H_ */
|
|
@ -0,0 +1,259 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Java Debug Wire Protocol Transport Service Provider Interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef JDWPTRANSPORT_H
|
||||||
|
#define JDWPTRANSPORT_H
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JDWPTRANSPORT_VERSION_1_0 = 0x00010000
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct jdwpTransportNativeInterface_;
|
||||||
|
|
||||||
|
struct _jdwpTransportEnv;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
typedef _jdwpTransportEnv jdwpTransportEnv;
|
||||||
|
#else
|
||||||
|
typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Errors. Universal errors with JVMTI/JVMDI equivalents keep the
|
||||||
|
* values the same.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
JDWPTRANSPORT_ERROR_NONE = 0,
|
||||||
|
JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
|
||||||
|
JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
|
||||||
|
JDWPTRANSPORT_ERROR_INTERNAL = 113,
|
||||||
|
JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
|
||||||
|
JDWPTRANSPORT_ERROR_IO_ERROR = 202,
|
||||||
|
JDWPTRANSPORT_ERROR_TIMEOUT = 203,
|
||||||
|
JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
|
||||||
|
} jdwpTransportError;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure to define capabilities
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned int can_timeout_attach :1;
|
||||||
|
unsigned int can_timeout_accept :1;
|
||||||
|
unsigned int can_timeout_handshake :1;
|
||||||
|
unsigned int reserved3 :1;
|
||||||
|
unsigned int reserved4 :1;
|
||||||
|
unsigned int reserved5 :1;
|
||||||
|
unsigned int reserved6 :1;
|
||||||
|
unsigned int reserved7 :1;
|
||||||
|
unsigned int reserved8 :1;
|
||||||
|
unsigned int reserved9 :1;
|
||||||
|
unsigned int reserved10 :1;
|
||||||
|
unsigned int reserved11 :1;
|
||||||
|
unsigned int reserved12 :1;
|
||||||
|
unsigned int reserved13 :1;
|
||||||
|
unsigned int reserved14 :1;
|
||||||
|
unsigned int reserved15 :1;
|
||||||
|
} JDWPTransportCapabilities;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structures to define packet layout.
|
||||||
|
*
|
||||||
|
* See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
/*
|
||||||
|
* If additional flags are added that apply to jdwpCmdPacket,
|
||||||
|
* then debugLoop.c: reader() will need to be updated to
|
||||||
|
* accept more than JDWPTRANSPORT_FLAGS_NONE.
|
||||||
|
*/
|
||||||
|
JDWPTRANSPORT_FLAGS_NONE = 0x0,
|
||||||
|
JDWPTRANSPORT_FLAGS_REPLY = 0x80
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
jint len;
|
||||||
|
jint id;
|
||||||
|
jbyte flags;
|
||||||
|
jbyte cmdSet;
|
||||||
|
jbyte cmd;
|
||||||
|
jbyte *data;
|
||||||
|
} jdwpCmdPacket;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
jint len;
|
||||||
|
jint id;
|
||||||
|
jbyte flags;
|
||||||
|
jshort errorCode;
|
||||||
|
jbyte *data;
|
||||||
|
} jdwpReplyPacket;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
union {
|
||||||
|
jdwpCmdPacket cmd;
|
||||||
|
jdwpReplyPacket reply;
|
||||||
|
} type;
|
||||||
|
} jdwpPacket;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JDWP functions called by the transport.
|
||||||
|
*/
|
||||||
|
typedef struct jdwpTransportCallback {
|
||||||
|
void *(*alloc)(jint numBytes); /* Call this for all allocations */
|
||||||
|
void (*free)(void *buffer); /* Call this for all deallocations */
|
||||||
|
} jdwpTransportCallback;
|
||||||
|
|
||||||
|
typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
|
||||||
|
jdwpTransportCallback *callback,
|
||||||
|
jint version,
|
||||||
|
jdwpTransportEnv** env);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Function Interface */
|
||||||
|
|
||||||
|
struct jdwpTransportNativeInterface_ {
|
||||||
|
/* 1 : RESERVED */
|
||||||
|
void *reserved1;
|
||||||
|
|
||||||
|
/* 2 : Get Capabilities */
|
||||||
|
jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
|
||||||
|
JDWPTransportCapabilities *capabilities_ptr);
|
||||||
|
|
||||||
|
/* 3 : Attach */
|
||||||
|
jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
|
||||||
|
const char* address,
|
||||||
|
jlong attach_timeout,
|
||||||
|
jlong handshake_timeout);
|
||||||
|
|
||||||
|
/* 4: StartListening */
|
||||||
|
jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
|
||||||
|
const char* address,
|
||||||
|
char** actual_address);
|
||||||
|
|
||||||
|
/* 5: StopListening */
|
||||||
|
jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 6: Accept */
|
||||||
|
jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
|
||||||
|
jlong accept_timeout,
|
||||||
|
jlong handshake_timeout);
|
||||||
|
|
||||||
|
/* 7: IsOpen */
|
||||||
|
jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 8: Close */
|
||||||
|
jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 9: ReadPacket */
|
||||||
|
jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
|
||||||
|
jdwpPacket *pkt);
|
||||||
|
|
||||||
|
/* 10: Write Packet */
|
||||||
|
jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
|
||||||
|
const jdwpPacket* pkt);
|
||||||
|
|
||||||
|
/* 11: GetLastError */
|
||||||
|
jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
|
||||||
|
char** error);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use inlined functions so that C++ code can use syntax such as
|
||||||
|
* env->Attach("mymachine:5000", 10*1000, 0);
|
||||||
|
*
|
||||||
|
* rather than using C's :-
|
||||||
|
*
|
||||||
|
* (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
|
||||||
|
*/
|
||||||
|
struct _jdwpTransportEnv {
|
||||||
|
const struct jdwpTransportNativeInterface_ *functions;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
|
||||||
|
return functions->GetCapabilities(this, capabilities_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Attach(const char* address, jlong attach_timeout,
|
||||||
|
jlong handshake_timeout) {
|
||||||
|
return functions->Attach(this, address, attach_timeout, handshake_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError StartListening(const char* address,
|
||||||
|
char** actual_address) {
|
||||||
|
return functions->StartListening(this, address, actual_address);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError StopListening(void) {
|
||||||
|
return functions->StopListening(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
|
||||||
|
return functions->Accept(this, accept_timeout, handshake_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
jboolean IsOpen(void) {
|
||||||
|
return functions->IsOpen(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Close(void) {
|
||||||
|
return functions->Close(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError ReadPacket(jdwpPacket *pkt) {
|
||||||
|
return functions->ReadPacket(this, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError WritePacket(const jdwpPacket* pkt) {
|
||||||
|
return functions->WritePacket(this, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError GetLastError(char** error) {
|
||||||
|
return functions->GetLastError(this, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* JDWPTRANSPORT_H */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This header file defines the data structures sent by the VM
|
||||||
|
* through the JVMTI CompiledMethodLoad callback function via the
|
||||||
|
* "void * compile_info" parameter. The memory pointed to by the
|
||||||
|
* compile_info parameter may not be referenced after returning from
|
||||||
|
* the CompiledMethodLoad callback. These are VM implementation
|
||||||
|
* specific data structures that may evolve in future releases. A
|
||||||
|
* JVMTI agent should interpret a non-NULL compile_info as a pointer
|
||||||
|
* to a region of memory containing a list of records. In a typical
|
||||||
|
* usage scenario, a JVMTI agent would cast each record to a
|
||||||
|
* jvmtiCompiledMethodLoadRecordHeader, a struct that represents
|
||||||
|
* arbitrary information. This struct contains a kind field to indicate
|
||||||
|
* the kind of information being passed, and a pointer to the next
|
||||||
|
* record. If the kind field indicates inlining information, then the
|
||||||
|
* agent would cast the record to a jvmtiCompiledMethodLoadInlineRecord.
|
||||||
|
* This record contains an array of PCStackInfo structs, which indicate
|
||||||
|
* for every pc address what are the methods on the invocation stack.
|
||||||
|
* The "methods" and "bcis" fields in each PCStackInfo struct specify a
|
||||||
|
* 1-1 mapping between these inlined methods and their bytecode indices.
|
||||||
|
* This can be used to derive the proper source lines of the inlined
|
||||||
|
* methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JVMTI_CMLR_H_
|
||||||
|
#define _JVMTI_CMLR_H_
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JVMTI_CMLR_MAJOR_VERSION_1 = 0x00000001,
|
||||||
|
JVMTI_CMLR_MINOR_VERSION_0 = 0x00000000,
|
||||||
|
|
||||||
|
JVMTI_CMLR_MAJOR_VERSION = 0x00000001,
|
||||||
|
JVMTI_CMLR_MINOR_VERSION = 0x00000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This comment is for the "JDK import from HotSpot" sanity check:
|
||||||
|
* version: 1.0.0
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
JVMTI_CMLR_DUMMY = 1,
|
||||||
|
JVMTI_CMLR_INLINE_INFO = 2
|
||||||
|
} jvmtiCMLRKind;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record that represents arbitrary information passed through JVMTI
|
||||||
|
* CompiledMethodLoadEvent void pointer.
|
||||||
|
*/
|
||||||
|
typedef struct _jvmtiCompiledMethodLoadRecordHeader {
|
||||||
|
jvmtiCMLRKind kind; /* id for the kind of info passed in the record */
|
||||||
|
jint majorinfoversion; /* major and minor info version values. Init'ed */
|
||||||
|
jint minorinfoversion; /* to current version value in jvmtiExport.cpp. */
|
||||||
|
|
||||||
|
struct _jvmtiCompiledMethodLoadRecordHeader* next;
|
||||||
|
} jvmtiCompiledMethodLoadRecordHeader;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record that gives information about the methods on the compile-time
|
||||||
|
* stack at a specific pc address of a compiled method. Each element in
|
||||||
|
* the methods array maps to same element in the bcis array.
|
||||||
|
*/
|
||||||
|
typedef struct _PCStackInfo {
|
||||||
|
void* pc; /* the pc address for this compiled method */
|
||||||
|
jint numstackframes; /* number of methods on the stack */
|
||||||
|
jmethodID* methods; /* array of numstackframes method ids */
|
||||||
|
jint* bcis; /* array of numstackframes bytecode indices */
|
||||||
|
} PCStackInfo;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record that contains inlining information for each pc address of
|
||||||
|
* an nmethod.
|
||||||
|
*/
|
||||||
|
typedef struct _jvmtiCompiledMethodLoadInlineRecord {
|
||||||
|
jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
|
||||||
|
jint numpcs; /* number of pc descriptors in this nmethod */
|
||||||
|
PCStackInfo* pcinfo; /* array of numpcs pc descriptors */
|
||||||
|
} jvmtiCompiledMethodLoadInlineRecord;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dummy record used to test that we can pass records with different
|
||||||
|
* information through the void pointer provided that they can be cast
|
||||||
|
* to a jvmtiCompiledMethodLoadRecordHeader.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _jvmtiCompiledMethodLoadDummyRecord {
|
||||||
|
jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
|
||||||
|
char message[50];
|
||||||
|
} jvmtiCompiledMethodLoadDummyRecord;
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AccessBridgeCallbacks.h 1.17 05/03/21
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Header file defining callback typedefs for Windows routines
|
||||||
|
* which are called from Java (responding to events, etc.).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __AccessBridgeCallbacks_H__
|
||||||
|
#define __AccessBridgeCallbacks_H__
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
#include "AccessBridgePackages.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef void (*AccessBridge_PropertyChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||||
|
wchar_t *property, wchar_t *oldValue, wchar_t *newValue);
|
||||||
|
|
||||||
|
typedef void (*AccessBridge_JavaShutdownFP) (long vmID);
|
||||||
|
typedef void (*AccessBridge_JavaShutdownFP) (long vmID);
|
||||||
|
|
||||||
|
typedef void (*AccessBridge_FocusGainedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_FocusLostFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
|
||||||
|
typedef void (*AccessBridge_CaretUpdateFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
|
||||||
|
typedef void (*AccessBridge_MouseClickedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_MouseEnteredFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_MouseExitedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_MousePressedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_MouseReleasedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
|
||||||
|
typedef void (*AccessBridge_MenuCanceledFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_MenuDeselectedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_MenuSelectedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_PopupMenuCanceledFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_PopupMenuWillBecomeInvisibleFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_PopupMenuWillBecomeVisibleFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
|
||||||
|
typedef void (*AccessBridge_PropertyNameChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||||
|
wchar_t *oldName, wchar_t *newName);
|
||||||
|
typedef void (*AccessBridge_PropertyDescriptionChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||||
|
wchar_t *oldDescription, wchar_t *newDescription);
|
||||||
|
typedef void (*AccessBridge_PropertyStateChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||||
|
wchar_t *oldState, wchar_t *newState);
|
||||||
|
typedef void (*AccessBridge_PropertyValueChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||||
|
wchar_t *oldValue, wchar_t *newValue);
|
||||||
|
typedef void (*AccessBridge_PropertySelectionChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_PropertyTextChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_PropertyCaretChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||||
|
int oldPosition, int newPosition);
|
||||||
|
typedef void (*AccessBridge_PropertyVisibleDataChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||||
|
typedef void (*AccessBridge_PropertyChildChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||||
|
JOBJECT64 oldChild, JOBJECT64 newChild);
|
||||||
|
typedef void (*AccessBridge_PropertyActiveDescendentChangeFP) (long vmID, JOBJECT64 event,
|
||||||
|
JOBJECT64 source,
|
||||||
|
JOBJECT64 oldActiveDescendent,
|
||||||
|
JOBJECT64 newActiveDescendent);
|
||||||
|
|
||||||
|
typedef void (*AccessBridge_PropertyTableModelChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 src,
|
||||||
|
wchar_t *oldValue, wchar_t *newValue);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,706 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wrapper functions around calls to the AccessBridge DLL
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <jni.h>
|
||||||
|
#include "AccessBridgeCallbacks.h"
|
||||||
|
#include "AccessBridgePackages.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define null NULL
|
||||||
|
|
||||||
|
typedef JOBJECT64 AccessibleContext;
|
||||||
|
typedef JOBJECT64 AccessibleText;
|
||||||
|
typedef JOBJECT64 AccessibleValue;
|
||||||
|
typedef JOBJECT64 AccessibleSelection;
|
||||||
|
typedef JOBJECT64 Java_Object;
|
||||||
|
typedef JOBJECT64 PropertyChangeEvent;
|
||||||
|
typedef JOBJECT64 FocusEvent;
|
||||||
|
typedef JOBJECT64 CaretEvent;
|
||||||
|
typedef JOBJECT64 MouseEvent;
|
||||||
|
typedef JOBJECT64 MenuEvent;
|
||||||
|
typedef JOBJECT64 AccessibleTable;
|
||||||
|
typedef JOBJECT64 AccessibleHyperlink;
|
||||||
|
typedef JOBJECT64 AccessibleHypertext;
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (*Windows_runFP) ();
|
||||||
|
|
||||||
|
typedef void (*SetPropertyChangeFP) (AccessBridge_PropertyChangeFP fp);
|
||||||
|
|
||||||
|
typedef void (*SetJavaShutdownFP) (AccessBridge_JavaShutdownFP fp);
|
||||||
|
typedef void (*SetFocusGainedFP) (AccessBridge_FocusGainedFP fp);
|
||||||
|
typedef void (*SetFocusLostFP) (AccessBridge_FocusLostFP fp);
|
||||||
|
|
||||||
|
typedef void (*SetCaretUpdateFP) (AccessBridge_CaretUpdateFP fp);
|
||||||
|
|
||||||
|
typedef void (*SetMouseClickedFP) (AccessBridge_MouseClickedFP fp);
|
||||||
|
typedef void (*SetMouseEnteredFP) (AccessBridge_MouseEnteredFP fp);
|
||||||
|
typedef void (*SetMouseExitedFP) (AccessBridge_MouseExitedFP fp);
|
||||||
|
typedef void (*SetMousePressedFP) (AccessBridge_MousePressedFP fp);
|
||||||
|
typedef void (*SetMouseReleasedFP) (AccessBridge_MouseReleasedFP fp);
|
||||||
|
|
||||||
|
typedef void (*SetMenuCanceledFP) (AccessBridge_MenuCanceledFP fp);
|
||||||
|
typedef void (*SetMenuDeselectedFP) (AccessBridge_MenuDeselectedFP fp);
|
||||||
|
typedef void (*SetMenuSelectedFP) (AccessBridge_MenuSelectedFP fp);
|
||||||
|
typedef void (*SetPopupMenuCanceledFP) (AccessBridge_PopupMenuCanceledFP fp);
|
||||||
|
typedef void (*SetPopupMenuWillBecomeInvisibleFP) (AccessBridge_PopupMenuWillBecomeInvisibleFP fp);
|
||||||
|
typedef void (*SetPopupMenuWillBecomeVisibleFP) (AccessBridge_PopupMenuWillBecomeVisibleFP fp);
|
||||||
|
|
||||||
|
typedef void (*SetPropertyNameChangeFP) (AccessBridge_PropertyNameChangeFP fp);
|
||||||
|
typedef void (*SetPropertyDescriptionChangeFP) (AccessBridge_PropertyDescriptionChangeFP fp);
|
||||||
|
typedef void (*SetPropertyStateChangeFP) (AccessBridge_PropertyStateChangeFP fp);
|
||||||
|
typedef void (*SetPropertyValueChangeFP) (AccessBridge_PropertyValueChangeFP fp);
|
||||||
|
typedef void (*SetPropertySelectionChangeFP) (AccessBridge_PropertySelectionChangeFP fp);
|
||||||
|
typedef void (*SetPropertyTextChangeFP) (AccessBridge_PropertyTextChangeFP fp);
|
||||||
|
typedef void (*SetPropertyCaretChangeFP) (AccessBridge_PropertyCaretChangeFP fp);
|
||||||
|
typedef void (*SetPropertyVisibleDataChangeFP) (AccessBridge_PropertyVisibleDataChangeFP fp);
|
||||||
|
typedef void (*SetPropertyChildChangeFP) (AccessBridge_PropertyChildChangeFP fp);
|
||||||
|
typedef void (*SetPropertyActiveDescendentChangeFP) (AccessBridge_PropertyActiveDescendentChangeFP fp);
|
||||||
|
|
||||||
|
typedef void (*SetPropertyTableModelChangeFP) (AccessBridge_PropertyTableModelChangeFP fp);
|
||||||
|
|
||||||
|
typedef void (*ReleaseJavaObjectFP) (long vmID, Java_Object object);
|
||||||
|
|
||||||
|
typedef BOOL (*GetVersionInfoFP) (long vmID, AccessBridgeVersionInfo *info);
|
||||||
|
|
||||||
|
typedef BOOL (*IsJavaWindowFP) (HWND window);
|
||||||
|
typedef BOOL (*IsSameObjectFP) (long vmID, JOBJECT64 obj1, JOBJECT64 obj2);
|
||||||
|
typedef BOOL (*GetAccessibleContextFromHWNDFP) (HWND window, long *vmID, AccessibleContext *ac);
|
||||||
|
typedef HWND (*getHWNDFromAccessibleContextFP) (long vmID, AccessibleContext ac);
|
||||||
|
|
||||||
|
typedef BOOL (*GetAccessibleContextAtFP) (long vmID, AccessibleContext acParent,
|
||||||
|
jint x, jint y, AccessibleContext *ac);
|
||||||
|
typedef BOOL (*GetAccessibleContextWithFocusFP) (HWND window, long *vmID, AccessibleContext *ac);
|
||||||
|
typedef BOOL (*GetAccessibleContextInfoFP) (long vmID, AccessibleContext ac, AccessibleContextInfo *info);
|
||||||
|
typedef AccessibleContext (*GetAccessibleChildFromContextFP) (long vmID, AccessibleContext ac, jint i);
|
||||||
|
typedef AccessibleContext (*GetAccessibleParentFromContextFP) (long vmID, AccessibleContext ac);
|
||||||
|
|
||||||
|
/* begin AccessibleTable */
|
||||||
|
typedef BOOL (*getAccessibleTableInfoFP) (long vmID, AccessibleContext ac, AccessibleTableInfo *tableInfo);
|
||||||
|
typedef BOOL (*getAccessibleTableCellInfoFP) (long vmID, AccessibleTable accessibleTable,
|
||||||
|
jint row, jint column, AccessibleTableCellInfo *tableCellInfo);
|
||||||
|
|
||||||
|
typedef BOOL (*getAccessibleTableRowHeaderFP) (long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||||
|
typedef BOOL (*getAccessibleTableColumnHeaderFP) (long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||||
|
|
||||||
|
typedef AccessibleContext (*getAccessibleTableRowDescriptionFP) (long vmID, AccessibleContext acParent, jint row);
|
||||||
|
typedef AccessibleContext (*getAccessibleTableColumnDescriptionFP) (long vmID, AccessibleContext acParent, jint column);
|
||||||
|
|
||||||
|
typedef jint (*getAccessibleTableRowSelectionCountFP) (long vmID, AccessibleTable table);
|
||||||
|
typedef BOOL (*isAccessibleTableRowSelectedFP) (long vmID, AccessibleTable table, jint row);
|
||||||
|
typedef BOOL (*getAccessibleTableRowSelectionsFP) (long vmID, AccessibleTable table, jint count,
|
||||||
|
jint *selections);
|
||||||
|
|
||||||
|
typedef jint (*getAccessibleTableColumnSelectionCountFP) (long vmID, AccessibleTable table);
|
||||||
|
typedef BOOL (*isAccessibleTableColumnSelectedFP) (long vmID, AccessibleTable table, jint column);
|
||||||
|
typedef BOOL (*getAccessibleTableColumnSelectionsFP) (long vmID, AccessibleTable table, jint count,
|
||||||
|
jint *selections);
|
||||||
|
|
||||||
|
typedef jint (*getAccessibleTableRowFP) (long vmID, AccessibleTable table, jint index);
|
||||||
|
typedef jint (*getAccessibleTableColumnFP) (long vmID, AccessibleTable table, jint index);
|
||||||
|
typedef jint (*getAccessibleTableIndexFP) (long vmID, AccessibleTable table, jint row, jint column);
|
||||||
|
/* end AccessibleTable */
|
||||||
|
|
||||||
|
/* AccessibleRelationSet */
|
||||||
|
typedef BOOL (*getAccessibleRelationSetFP) (long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleRelationSetInfo *relationSetInfo);
|
||||||
|
|
||||||
|
/* AccessibleHypertext */
|
||||||
|
typedef BOOL (*getAccessibleHypertextFP)(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleHypertextInfo *hypertextInfo);
|
||||||
|
|
||||||
|
typedef BOOL (*activateAccessibleHyperlinkFP)(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleHyperlink accessibleHyperlink);
|
||||||
|
|
||||||
|
typedef jint (*getAccessibleHyperlinkCountFP)(const long vmID,
|
||||||
|
const AccessibleContext accessibleContext);
|
||||||
|
|
||||||
|
typedef BOOL (*getAccessibleHypertextExtFP) (const long vmID,
|
||||||
|
const AccessibleContext accessibleContext,
|
||||||
|
const jint nStartIndex,
|
||||||
|
AccessibleHypertextInfo *hypertextInfo);
|
||||||
|
|
||||||
|
typedef jint (*getAccessibleHypertextLinkIndexFP)(const long vmID,
|
||||||
|
const AccessibleHypertext hypertext,
|
||||||
|
const jint nIndex);
|
||||||
|
|
||||||
|
typedef BOOL (*getAccessibleHyperlinkFP)(const long vmID,
|
||||||
|
const AccessibleHypertext hypertext,
|
||||||
|
const jint nIndex,
|
||||||
|
AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||||
|
|
||||||
|
|
||||||
|
/* Accessible KeyBindings, Icons and Actions */
|
||||||
|
typedef BOOL (*getAccessibleKeyBindingsFP)(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleKeyBindings *keyBindings);
|
||||||
|
|
||||||
|
typedef BOOL (*getAccessibleIconsFP)(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleIcons *icons);
|
||||||
|
|
||||||
|
typedef BOOL (*getAccessibleActionsFP)(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleActions *actions);
|
||||||
|
|
||||||
|
typedef BOOL (*doAccessibleActionsFP)(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||||
|
|
||||||
|
|
||||||
|
/* AccessibleText */
|
||||||
|
|
||||||
|
typedef BOOL (*GetAccessibleTextInfoFP) (long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||||
|
typedef BOOL (*GetAccessibleTextItemsFP) (long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index);
|
||||||
|
typedef BOOL (*GetAccessibleTextSelectionInfoFP) (long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection);
|
||||||
|
typedef BOOL (*GetAccessibleTextAttributesFP) (long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes);
|
||||||
|
typedef BOOL (*GetAccessibleTextRectFP) (long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index);
|
||||||
|
typedef BOOL (*GetAccessibleTextLineBoundsFP) (long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex);
|
||||||
|
typedef BOOL (*GetAccessibleTextRangeFP) (long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len);
|
||||||
|
|
||||||
|
typedef BOOL (*GetCurrentAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||||
|
typedef BOOL (*GetMaximumAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||||
|
typedef BOOL (*GetMinimumAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||||
|
|
||||||
|
typedef void (*AddAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||||
|
typedef void (*ClearAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as);
|
||||||
|
typedef JOBJECT64 (*GetAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||||
|
typedef int (*GetAccessibleSelectionCountFromContextFP) (long vmID, AccessibleSelection as);
|
||||||
|
typedef BOOL (*IsAccessibleChildSelectedFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||||
|
typedef void (*RemoveAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||||
|
typedef void (*SelectAllAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as);
|
||||||
|
|
||||||
|
/* Utility methods */
|
||||||
|
|
||||||
|
typedef BOOL (*setTextContentsFP) (const long vmID, const AccessibleContext ac, const wchar_t *text);
|
||||||
|
typedef AccessibleContext (*getParentWithRoleFP) (const long vmID, const AccessibleContext ac, const wchar_t *role);
|
||||||
|
typedef AccessibleContext (*getParentWithRoleElseRootFP) (const long vmID, const AccessibleContext ac, const wchar_t *role);
|
||||||
|
typedef AccessibleContext (*getTopLevelObjectFP) (const long vmID, const AccessibleContext ac);
|
||||||
|
typedef int (*getObjectDepthFP) (const long vmID, const AccessibleContext ac);
|
||||||
|
typedef AccessibleContext (*getActiveDescendentFP) (const long vmID, const AccessibleContext ac);
|
||||||
|
|
||||||
|
|
||||||
|
typedef BOOL (*getVirtualAccessibleNameFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
wchar_t *name, int len);
|
||||||
|
|
||||||
|
typedef BOOL (*requestFocusFP) (const long vmID, const AccessibleContext accessibleContext);
|
||||||
|
|
||||||
|
typedef BOOL (*selectTextRangeFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
const int startIndex, const int endIndex);
|
||||||
|
|
||||||
|
typedef BOOL (*getTextAttributesInRangeFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
const int startIndex, const int endIndex,
|
||||||
|
AccessibleTextAttributesInfo *attributes, short *len);
|
||||||
|
|
||||||
|
typedef int (*getVisibleChildrenCountFP) (const long vmID, const AccessibleContext accessibleContext);
|
||||||
|
|
||||||
|
typedef BOOL (*getVisibleChildrenFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
const int startIndex, VisibleChildrenInfo *children);
|
||||||
|
|
||||||
|
typedef BOOL (*setCaretPositionFP) (const long vmID, const AccessibleContext accessibleContext, const int position);
|
||||||
|
|
||||||
|
typedef BOOL (*getCaretLocationFP) (long vmID, AccessibleContext ac, AccessibleTextRectInfo *rectInfo, jint index);
|
||||||
|
|
||||||
|
typedef int (*getEventsWaitingFP) ();
|
||||||
|
|
||||||
|
typedef struct AccessBridgeFPsTag {
|
||||||
|
Windows_runFP Windows_run;
|
||||||
|
|
||||||
|
SetPropertyChangeFP SetPropertyChange;
|
||||||
|
|
||||||
|
SetJavaShutdownFP SetJavaShutdown;
|
||||||
|
SetFocusGainedFP SetFocusGained;
|
||||||
|
SetFocusLostFP SetFocusLost;
|
||||||
|
|
||||||
|
SetCaretUpdateFP SetCaretUpdate;
|
||||||
|
|
||||||
|
SetMouseClickedFP SetMouseClicked;
|
||||||
|
SetMouseEnteredFP SetMouseEntered;
|
||||||
|
SetMouseExitedFP SetMouseExited;
|
||||||
|
SetMousePressedFP SetMousePressed;
|
||||||
|
SetMouseReleasedFP SetMouseReleased;
|
||||||
|
|
||||||
|
SetMenuCanceledFP SetMenuCanceled;
|
||||||
|
SetMenuDeselectedFP SetMenuDeselected;
|
||||||
|
SetMenuSelectedFP SetMenuSelected;
|
||||||
|
SetPopupMenuCanceledFP SetPopupMenuCanceled;
|
||||||
|
SetPopupMenuWillBecomeInvisibleFP SetPopupMenuWillBecomeInvisible;
|
||||||
|
SetPopupMenuWillBecomeVisibleFP SetPopupMenuWillBecomeVisible;
|
||||||
|
|
||||||
|
SetPropertyNameChangeFP SetPropertyNameChange;
|
||||||
|
SetPropertyDescriptionChangeFP SetPropertyDescriptionChange;
|
||||||
|
SetPropertyStateChangeFP SetPropertyStateChange;
|
||||||
|
SetPropertyValueChangeFP SetPropertyValueChange;
|
||||||
|
SetPropertySelectionChangeFP SetPropertySelectionChange;
|
||||||
|
SetPropertyTextChangeFP SetPropertyTextChange;
|
||||||
|
SetPropertyCaretChangeFP SetPropertyCaretChange;
|
||||||
|
SetPropertyVisibleDataChangeFP SetPropertyVisibleDataChange;
|
||||||
|
SetPropertyChildChangeFP SetPropertyChildChange;
|
||||||
|
SetPropertyActiveDescendentChangeFP SetPropertyActiveDescendentChange;
|
||||||
|
|
||||||
|
SetPropertyTableModelChangeFP SetPropertyTableModelChange;
|
||||||
|
|
||||||
|
ReleaseJavaObjectFP ReleaseJavaObject;
|
||||||
|
GetVersionInfoFP GetVersionInfo;
|
||||||
|
|
||||||
|
IsJavaWindowFP IsJavaWindow;
|
||||||
|
IsSameObjectFP IsSameObject;
|
||||||
|
GetAccessibleContextFromHWNDFP GetAccessibleContextFromHWND;
|
||||||
|
getHWNDFromAccessibleContextFP getHWNDFromAccessibleContext;
|
||||||
|
|
||||||
|
GetAccessibleContextAtFP GetAccessibleContextAt;
|
||||||
|
GetAccessibleContextWithFocusFP GetAccessibleContextWithFocus;
|
||||||
|
GetAccessibleContextInfoFP GetAccessibleContextInfo;
|
||||||
|
GetAccessibleChildFromContextFP GetAccessibleChildFromContext;
|
||||||
|
GetAccessibleParentFromContextFP GetAccessibleParentFromContext;
|
||||||
|
|
||||||
|
getAccessibleTableInfoFP getAccessibleTableInfo;
|
||||||
|
getAccessibleTableCellInfoFP getAccessibleTableCellInfo;
|
||||||
|
|
||||||
|
getAccessibleTableRowHeaderFP getAccessibleTableRowHeader;
|
||||||
|
getAccessibleTableColumnHeaderFP getAccessibleTableColumnHeader;
|
||||||
|
|
||||||
|
getAccessibleTableRowDescriptionFP getAccessibleTableRowDescription;
|
||||||
|
getAccessibleTableColumnDescriptionFP getAccessibleTableColumnDescription;
|
||||||
|
|
||||||
|
getAccessibleTableRowSelectionCountFP getAccessibleTableRowSelectionCount;
|
||||||
|
isAccessibleTableRowSelectedFP isAccessibleTableRowSelected;
|
||||||
|
getAccessibleTableRowSelectionsFP getAccessibleTableRowSelections;
|
||||||
|
|
||||||
|
getAccessibleTableColumnSelectionCountFP getAccessibleTableColumnSelectionCount;
|
||||||
|
isAccessibleTableColumnSelectedFP isAccessibleTableColumnSelected;
|
||||||
|
getAccessibleTableColumnSelectionsFP getAccessibleTableColumnSelections;
|
||||||
|
|
||||||
|
getAccessibleTableRowFP getAccessibleTableRow;
|
||||||
|
getAccessibleTableColumnFP getAccessibleTableColumn;
|
||||||
|
getAccessibleTableIndexFP getAccessibleTableIndex;
|
||||||
|
|
||||||
|
getAccessibleRelationSetFP getAccessibleRelationSet;
|
||||||
|
|
||||||
|
getAccessibleHypertextFP getAccessibleHypertext;
|
||||||
|
activateAccessibleHyperlinkFP activateAccessibleHyperlink;
|
||||||
|
getAccessibleHyperlinkCountFP getAccessibleHyperlinkCount;
|
||||||
|
getAccessibleHypertextExtFP getAccessibleHypertextExt;
|
||||||
|
getAccessibleHypertextLinkIndexFP getAccessibleHypertextLinkIndex;
|
||||||
|
getAccessibleHyperlinkFP getAccessibleHyperlink;
|
||||||
|
|
||||||
|
getAccessibleKeyBindingsFP getAccessibleKeyBindings;
|
||||||
|
getAccessibleIconsFP getAccessibleIcons;
|
||||||
|
getAccessibleActionsFP getAccessibleActions;
|
||||||
|
doAccessibleActionsFP doAccessibleActions;
|
||||||
|
|
||||||
|
GetAccessibleTextInfoFP GetAccessibleTextInfo;
|
||||||
|
GetAccessibleTextItemsFP GetAccessibleTextItems;
|
||||||
|
GetAccessibleTextSelectionInfoFP GetAccessibleTextSelectionInfo;
|
||||||
|
GetAccessibleTextAttributesFP GetAccessibleTextAttributes;
|
||||||
|
GetAccessibleTextRectFP GetAccessibleTextRect;
|
||||||
|
GetAccessibleTextLineBoundsFP GetAccessibleTextLineBounds;
|
||||||
|
GetAccessibleTextRangeFP GetAccessibleTextRange;
|
||||||
|
|
||||||
|
GetCurrentAccessibleValueFromContextFP GetCurrentAccessibleValueFromContext;
|
||||||
|
GetMaximumAccessibleValueFromContextFP GetMaximumAccessibleValueFromContext;
|
||||||
|
GetMinimumAccessibleValueFromContextFP GetMinimumAccessibleValueFromContext;
|
||||||
|
|
||||||
|
AddAccessibleSelectionFromContextFP AddAccessibleSelectionFromContext;
|
||||||
|
ClearAccessibleSelectionFromContextFP ClearAccessibleSelectionFromContext;
|
||||||
|
GetAccessibleSelectionFromContextFP GetAccessibleSelectionFromContext;
|
||||||
|
GetAccessibleSelectionCountFromContextFP GetAccessibleSelectionCountFromContext;
|
||||||
|
IsAccessibleChildSelectedFromContextFP IsAccessibleChildSelectedFromContext;
|
||||||
|
RemoveAccessibleSelectionFromContextFP RemoveAccessibleSelectionFromContext;
|
||||||
|
SelectAllAccessibleSelectionFromContextFP SelectAllAccessibleSelectionFromContext;
|
||||||
|
|
||||||
|
setTextContentsFP setTextContents;
|
||||||
|
getParentWithRoleFP getParentWithRole;
|
||||||
|
getTopLevelObjectFP getTopLevelObject;
|
||||||
|
getParentWithRoleElseRootFP getParentWithRoleElseRoot;
|
||||||
|
getObjectDepthFP getObjectDepth;
|
||||||
|
getActiveDescendentFP getActiveDescendent;
|
||||||
|
|
||||||
|
getVirtualAccessibleNameFP getVirtualAccessibleName;
|
||||||
|
requestFocusFP requestFocus;
|
||||||
|
selectTextRangeFP selectTextRange;
|
||||||
|
getTextAttributesInRangeFP getTextAttributesInRange;
|
||||||
|
getVisibleChildrenCountFP getVisibleChildrenCount;
|
||||||
|
getVisibleChildrenFP getVisibleChildren;
|
||||||
|
setCaretPositionFP setCaretPosition;
|
||||||
|
getCaretLocationFP getCaretLocation;
|
||||||
|
|
||||||
|
getEventsWaitingFP getEventsWaiting;
|
||||||
|
|
||||||
|
} AccessBridgeFPs;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the world
|
||||||
|
*/
|
||||||
|
BOOL initializeAccessBridge();
|
||||||
|
BOOL shutdownAccessBridge();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window routines
|
||||||
|
*/
|
||||||
|
BOOL IsJavaWindow(HWND window);
|
||||||
|
|
||||||
|
// Returns the virtual machine ID and AccessibleContext for a top-level window
|
||||||
|
BOOL GetAccessibleContextFromHWND(HWND target, long *vmID, AccessibleContext *ac);
|
||||||
|
|
||||||
|
// Returns the HWND from the AccessibleContext of a top-level window
|
||||||
|
HWND getHWNDFromAccessibleContext(long vmID, AccessibleContext ac);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handling routines
|
||||||
|
*/
|
||||||
|
void SetJavaShutdown(AccessBridge_JavaShutdownFP fp);
|
||||||
|
void SetFocusGained(AccessBridge_FocusGainedFP fp);
|
||||||
|
void SetFocusLost(AccessBridge_FocusLostFP fp);
|
||||||
|
|
||||||
|
void SetCaretUpdate(AccessBridge_CaretUpdateFP fp);
|
||||||
|
|
||||||
|
void SetMouseClicked(AccessBridge_MouseClickedFP fp);
|
||||||
|
void SetMouseEntered(AccessBridge_MouseEnteredFP fp);
|
||||||
|
void SetMouseExited(AccessBridge_MouseExitedFP fp);
|
||||||
|
void SetMousePressed(AccessBridge_MousePressedFP fp);
|
||||||
|
void SetMouseReleased(AccessBridge_MouseReleasedFP fp);
|
||||||
|
|
||||||
|
void SetMenuCanceled(AccessBridge_MenuCanceledFP fp);
|
||||||
|
void SetMenuDeselected(AccessBridge_MenuDeselectedFP fp);
|
||||||
|
void SetMenuSelected(AccessBridge_MenuSelectedFP fp);
|
||||||
|
void SetPopupMenuCanceled(AccessBridge_PopupMenuCanceledFP fp);
|
||||||
|
void SetPopupMenuWillBecomeInvisible(AccessBridge_PopupMenuWillBecomeInvisibleFP fp);
|
||||||
|
void SetPopupMenuWillBecomeVisible(AccessBridge_PopupMenuWillBecomeVisibleFP fp);
|
||||||
|
|
||||||
|
void SetPropertyNameChange(AccessBridge_PropertyNameChangeFP fp);
|
||||||
|
void SetPropertyDescriptionChange(AccessBridge_PropertyDescriptionChangeFP fp);
|
||||||
|
void SetPropertyStateChange(AccessBridge_PropertyStateChangeFP fp);
|
||||||
|
void SetPropertyValueChange(AccessBridge_PropertyValueChangeFP fp);
|
||||||
|
void SetPropertySelectionChange(AccessBridge_PropertySelectionChangeFP fp);
|
||||||
|
void SetPropertyTextChange(AccessBridge_PropertyTextChangeFP fp);
|
||||||
|
void SetPropertyCaretChange(AccessBridge_PropertyCaretChangeFP fp);
|
||||||
|
void SetPropertyVisibleDataChange(AccessBridge_PropertyVisibleDataChangeFP fp);
|
||||||
|
void SetPropertyChildChange(AccessBridge_PropertyChildChangeFP fp);
|
||||||
|
void SetPropertyActiveDescendentChange(AccessBridge_PropertyActiveDescendentChangeFP fp);
|
||||||
|
|
||||||
|
void SetPropertyTableModelChange(AccessBridge_PropertyTableModelChangeFP fp);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General routines
|
||||||
|
*/
|
||||||
|
void ReleaseJavaObject(long vmID, Java_Object object);
|
||||||
|
BOOL GetVersionInfo(long vmID, AccessBridgeVersionInfo *info);
|
||||||
|
HWND GetHWNDFromAccessibleContext(long vmID, JOBJECT64 accesibleContext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessible Context routines
|
||||||
|
*/
|
||||||
|
BOOL GetAccessibleContextAt(long vmID, AccessibleContext acParent,
|
||||||
|
jint x, jint y, AccessibleContext *ac);
|
||||||
|
BOOL GetAccessibleContextWithFocus(HWND window, long *vmID, AccessibleContext *ac);
|
||||||
|
BOOL GetAccessibleContextInfo(long vmID, AccessibleContext ac, AccessibleContextInfo *info);
|
||||||
|
AccessibleContext GetAccessibleChildFromContext(long vmID, AccessibleContext ac, jint index);
|
||||||
|
AccessibleContext GetAccessibleParentFromContext(long vmID, AccessibleContext ac);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessible Text routines
|
||||||
|
*/
|
||||||
|
BOOL GetAccessibleTextInfo(long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||||
|
BOOL GetAccessibleTextItems(long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index);
|
||||||
|
BOOL GetAccessibleTextSelectionInfo(long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection);
|
||||||
|
BOOL GetAccessibleTextAttributes(long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes);
|
||||||
|
BOOL GetAccessibleTextRect(long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index);
|
||||||
|
BOOL GetAccessibleTextLineBounds(long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex);
|
||||||
|
BOOL GetAccessibleTextRange(long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len);
|
||||||
|
|
||||||
|
/* begin AccessibleTable routines */
|
||||||
|
BOOL getAccessibleTableInfo(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||||
|
|
||||||
|
BOOL getAccessibleTableCellInfo(long vmID, AccessibleTable accessibleTable, jint row, jint column,
|
||||||
|
AccessibleTableCellInfo *tableCellInfo);
|
||||||
|
|
||||||
|
BOOL getAccessibleTableRowHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||||
|
BOOL getAccessibleTableColumnHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||||
|
|
||||||
|
AccessibleContext getAccessibleTableRowDescription(long vmID, AccessibleContext acParent, jint row);
|
||||||
|
AccessibleContext getAccessibleTableColumnDescription(long vmID, AccessibleContext acParent, jint column);
|
||||||
|
|
||||||
|
jint getAccessibleTableRowSelectionCount(long vmID, AccessibleTable table);
|
||||||
|
BOOL isAccessibleTableRowSelected(long vmID, AccessibleTable table, jint row);
|
||||||
|
BOOL getAccessibleTableRowSelections(long vmID, AccessibleTable table, jint count, jint *selections);
|
||||||
|
|
||||||
|
jint getAccessibleTableColumnSelectionCount(long vmID, AccessibleTable table);
|
||||||
|
BOOL isAccessibleTableColumnSelected(long vmID, AccessibleTable table, jint column);
|
||||||
|
BOOL getAccessibleTableColumnSelections(long vmID, AccessibleTable table, jint count, jint *selections);
|
||||||
|
|
||||||
|
jint getAccessibleTableRow(long vmID, AccessibleTable table, jint index);
|
||||||
|
jint getAccessibleTableColumn(long vmID, AccessibleTable table, jint index);
|
||||||
|
jint getAccessibleTableIndex(long vmID, AccessibleTable table, jint row, jint column);
|
||||||
|
/* end AccessibleTable */
|
||||||
|
|
||||||
|
/* ----- AccessibleRelationSet routines */
|
||||||
|
BOOL getAccessibleRelationSet(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleRelationSetInfo *relationSetInfo);
|
||||||
|
|
||||||
|
/* ----- AccessibleHypertext routines */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns hypertext information associated with a component.
|
||||||
|
*/
|
||||||
|
BOOL getAccessibleHypertext(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleHypertextInfo *hypertextInfo);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Requests that a hyperlink be activated.
|
||||||
|
*/
|
||||||
|
BOOL activateAccessibleHyperlink(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleHyperlink accessibleHyperlink);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the number of hyperlinks in a component
|
||||||
|
* Maps to AccessibleHypertext.getLinkCount.
|
||||||
|
* Returns -1 on error.
|
||||||
|
*/
|
||||||
|
jint getAccessibleHyperlinkCount(const long vmID,
|
||||||
|
const AccessibleHypertext hypertext);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This method is used to iterate through the hyperlinks in a component. It
|
||||||
|
* returns hypertext information for a component starting at hyperlink index
|
||||||
|
* nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will
|
||||||
|
* be returned for each call to this method.
|
||||||
|
* Returns FALSE on error.
|
||||||
|
*/
|
||||||
|
BOOL getAccessibleHypertextExt(const long vmID,
|
||||||
|
const AccessibleContext accessibleContext,
|
||||||
|
const jint nStartIndex,
|
||||||
|
/* OUT */ AccessibleHypertextInfo *hypertextInfo);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the index into an array of hyperlinks that is associated with
|
||||||
|
* a character index in document; maps to AccessibleHypertext.getLinkIndex
|
||||||
|
* Returns -1 on error.
|
||||||
|
*/
|
||||||
|
jint getAccessibleHypertextLinkIndex(const long vmID,
|
||||||
|
const AccessibleHypertext hypertext,
|
||||||
|
const jint nIndex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the nth hyperlink in a document
|
||||||
|
* Maps to AccessibleHypertext.getLink.
|
||||||
|
* Returns FALSE on error
|
||||||
|
*/
|
||||||
|
BOOL getAccessibleHyperlink(const long vmID,
|
||||||
|
const AccessibleHypertext hypertext,
|
||||||
|
const jint nIndex,
|
||||||
|
/* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||||
|
|
||||||
|
/* Accessible KeyBindings, Icons and Actions */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a list of key bindings associated with a component.
|
||||||
|
*/
|
||||||
|
BOOL getAccessibleKeyBindings(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleKeyBindings *keyBindings);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a list of icons associate with a component.
|
||||||
|
*/
|
||||||
|
BOOL getAccessibleIcons(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleIcons *icons);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a list of actions that a component can perform.
|
||||||
|
*/
|
||||||
|
BOOL getAccessibleActions(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleActions *actions);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Request that a list of AccessibleActions be performed by a component.
|
||||||
|
* Returns TRUE if all actions are performed. Returns FALSE
|
||||||
|
* when the first requested action fails in which case "failure"
|
||||||
|
* contains the index of the action that failed.
|
||||||
|
*/
|
||||||
|
BOOL doAccessibleActions(long vmID, AccessibleContext accessibleContext,
|
||||||
|
AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Additional utility methods */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns whether two object references refer to the same object.
|
||||||
|
*/
|
||||||
|
BOOL IsSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets editable text contents. The AccessibleContext must implement AccessibleEditableText and
|
||||||
|
* be editable. The maximum text length that can be set is MAX_STRING_SIZE - 1.
|
||||||
|
* Returns whether successful
|
||||||
|
*/
|
||||||
|
BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext, const wchar_t *text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Accessible Context with the specified role that is the
|
||||||
|
* ancestor of a given object. The role is one of the role strings
|
||||||
|
* defined in AccessBridgePackages.h
|
||||||
|
* If there is no ancestor object that has the specified role,
|
||||||
|
* returns (AccessibleContext)0.
|
||||||
|
*/
|
||||||
|
AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
const wchar_t *role);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Accessible Context with the specified role that is the
|
||||||
|
* ancestor of a given object. The role is one of the role strings
|
||||||
|
* defined in AccessBridgePackages.h. If an object with the specified
|
||||||
|
* role does not exist, returns the top level object for the Java Window.
|
||||||
|
* Returns (AccessibleContext)0 on error.
|
||||||
|
*/
|
||||||
|
AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
const wchar_t *role);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Accessible Context for the top level object in
|
||||||
|
* a Java Window. This is same Accessible Context that is obtained
|
||||||
|
* from GetAccessibleContextFromHWND for that window. Returns
|
||||||
|
* (AccessibleContext)0 on error.
|
||||||
|
*/
|
||||||
|
AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns how deep in the object hierarchy a given object is.
|
||||||
|
* The top most object in the object hierarchy has an object depth of 0.
|
||||||
|
* Returns -1 on error.
|
||||||
|
*/
|
||||||
|
int getObjectDepth (const long vmID, const AccessibleContext accessibleContext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Accessible Context of the current ActiveDescendent of an object.
|
||||||
|
* This method assumes the ActiveDescendent is the component that is currently
|
||||||
|
* selected in a container object.
|
||||||
|
* Returns (AccessibleContext)0 on error or if there is no selection.
|
||||||
|
*/
|
||||||
|
AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
/**
|
||||||
|
* Accessible Value routines
|
||||||
|
*/
|
||||||
|
BOOL GetCurrentAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||||
|
BOOL GetMaximumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||||
|
BOOL GetMinimumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessible Selection routines
|
||||||
|
*/
|
||||||
|
void AddAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||||
|
void ClearAccessibleSelectionFromContext(long vmID, AccessibleSelection as);
|
||||||
|
JOBJECT64 GetAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||||
|
int GetAccessibleSelectionCountFromContext(long vmID, AccessibleSelection as);
|
||||||
|
BOOL IsAccessibleChildSelectedFromContext(long vmID, AccessibleSelection as, int i);
|
||||||
|
void RemoveAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||||
|
void SelectAllAccessibleSelectionFromContext(long vmID, AccessibleSelection as);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional methods for Teton
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
|
||||||
|
* whether successful.
|
||||||
|
*
|
||||||
|
* Bug ID 4916682 - Implement JAWS AccessibleName policy
|
||||||
|
*/
|
||||||
|
BOOL getVirtualAccessibleName(const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
wchar_t *name, int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request focus for a component. Returns whether successful.
|
||||||
|
*
|
||||||
|
* Bug ID 4944757 - requestFocus method needed
|
||||||
|
*/
|
||||||
|
BOOL requestFocus(const long vmID, const AccessibleContext accessibleContext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects text between two indices. Selection includes the text at the start index
|
||||||
|
* and the text at the end index. Returns whether successful.
|
||||||
|
*
|
||||||
|
* Bug ID 4944758 - selectTextRange method needed
|
||||||
|
*/
|
||||||
|
BOOL selectTextRange(const long vmID, const AccessibleContext accessibleContext, const int startIndex,
|
||||||
|
const int endIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get text attributes between two indices. The attribute list includes the text at the
|
||||||
|
* start index and the text at the end index. Returns whether successful;
|
||||||
|
*
|
||||||
|
* Bug ID 4944761 - getTextAttributes between two indices method needed
|
||||||
|
*/
|
||||||
|
BOOL getTextAttributesInRange(const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
const int startIndex, const int endIndex,
|
||||||
|
AccessibleTextAttributesInfo *attributes, short *len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of visible children of a component. Returns -1 on error.
|
||||||
|
*
|
||||||
|
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||||
|
*/
|
||||||
|
int getVisibleChildrenCount(const long vmID, const AccessibleContext accessibleContext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the visible children of an AccessibleContext. Returns whether successful.
|
||||||
|
*
|
||||||
|
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||||
|
*/
|
||||||
|
BOOL getVisibleChildren(const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
const int startIndex,
|
||||||
|
VisibleChildrenInfo *visibleChildrenInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the caret to a text position. Returns whether successful.
|
||||||
|
*
|
||||||
|
* Bug ID 4944770 - setCaretPosition method needed
|
||||||
|
*/
|
||||||
|
BOOL setCaretPosition(const long vmID, const AccessibleContext accessibleContext,
|
||||||
|
const int position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the text caret location
|
||||||
|
*/
|
||||||
|
BOOL getCaretLocation(long vmID, AccessibleContext ac,
|
||||||
|
AccessibleTextRectInfo *rectInfo, jint index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number of events waiting to fire
|
||||||
|
*/
|
||||||
|
int getEventsWaiting();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JAWT_MD_H_
|
||||||
|
#define _JAVASOFT_JAWT_MD_H_
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include "jawt.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Win32-specific declarations for AWT native interface.
|
||||||
|
* See notes in jawt.h for an example of use.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_Win32DrawingSurfaceInfo {
|
||||||
|
/* Native window, DDB, or DIB handle */
|
||||||
|
union {
|
||||||
|
HWND hwnd;
|
||||||
|
HBITMAP hbitmap;
|
||||||
|
void* pbits;
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
* This HDC should always be used instead of the HDC returned from
|
||||||
|
* BeginPaint() or any calls to GetDC().
|
||||||
|
*/
|
||||||
|
HDC hdc;
|
||||||
|
HPALETTE hpalette;
|
||||||
|
} JAWT_Win32DrawingSurfaceInfo;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JAWT_MD_H_ */
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JNI_MD_H_
|
||||||
|
#define _JAVASOFT_JNI_MD_H_
|
||||||
|
|
||||||
|
#define JNIEXPORT __declspec(dllexport)
|
||||||
|
#define JNIIMPORT __declspec(dllimport)
|
||||||
|
#define JNICALL __stdcall
|
||||||
|
|
||||||
|
typedef long jint;
|
||||||
|
typedef __int64 jlong;
|
||||||
|
typedef signed char jbyte;
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JNI_MD_H_ */
|
|
@ -0,0 +1,332 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "com_taosdata_jdbc_tmq_TMQConnector.h"
|
||||||
|
#include "jniCommon.h"
|
||||||
|
#include "taos.h"
|
||||||
|
|
||||||
|
void commit_cb(tmq_t *tmq, int32_t code, void *param) {
|
||||||
|
JNIEnv *env = NULL;
|
||||||
|
int status = (*g_vm)->GetEnv(g_vm, (void **)&env, JNI_VERSION_1_6);
|
||||||
|
bool needDetach = false;
|
||||||
|
if (status < 0) {
|
||||||
|
if ((*g_vm)->AttachCurrentThread(g_vm, (void **)&env, NULL) != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
needDetach = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
jobject obj = (jobject)param;
|
||||||
|
(*env)->CallVoidMethod(env, obj, g_commitCallback, code);
|
||||||
|
|
||||||
|
(*env)->DeleteGlobalRef(env, obj);
|
||||||
|
param = NULL;
|
||||||
|
|
||||||
|
if (needDetach) {
|
||||||
|
(*g_vm)->DetachCurrentThread(g_vm);
|
||||||
|
}
|
||||||
|
env = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfNewImp(JNIEnv *env, jobject jobj) {
|
||||||
|
tmq_conf_t *conf = tmq_conf_new();
|
||||||
|
return (jlong)conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfSetImp(JNIEnv *env, jobject jobj, jlong conf,
|
||||||
|
jstring jkey, jstring jvalue) {
|
||||||
|
if (jkey == NULL) {
|
||||||
|
jniError("jobj:%p, failed set tmq config. key is null", jobj);
|
||||||
|
return TMQ_CONF_KEY_NULL;
|
||||||
|
}
|
||||||
|
const char *key = (*env)->GetStringUTFChars(env, jkey, NULL);
|
||||||
|
|
||||||
|
if (jvalue == NULL) {
|
||||||
|
jniError("jobj:%p, failed set tmq config. key %s, value is null", jobj, key);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, jkey, key);
|
||||||
|
return TMQ_CONF_VALUE_NULL;
|
||||||
|
}
|
||||||
|
const char *value = (*env)->GetStringUTFChars(env, jvalue, NULL);
|
||||||
|
|
||||||
|
tmq_conf_res_t res = tmq_conf_set((tmq_conf_t *)conf, key, value);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, jkey, key);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, jvalue, value);
|
||||||
|
return (jint)res;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfDestroyImp(JNIEnv *env, jobject jobj,
|
||||||
|
jlong jconf) {
|
||||||
|
tmq_conf_t *conf = (tmq_conf_t *)jconf;
|
||||||
|
if (conf == NULL) {
|
||||||
|
jniDebug("jobj:%p, tmq config is already destroyed", jobj);
|
||||||
|
} else {
|
||||||
|
tmq_conf_destroy(conf);
|
||||||
|
jniDebug("jobj:%p, config:%p, tmq successfully destroy config", jobj, conf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerNewImp(JNIEnv *env, jobject jobj,
|
||||||
|
jlong jconf, jobject jconsumer) {
|
||||||
|
tmq_conf_t *conf = (tmq_conf_t *)jconf;
|
||||||
|
if (conf == NULL) {
|
||||||
|
jniError("jobj:%p, tmq config is already destroyed", jobj);
|
||||||
|
return TMQ_CONF_NULL;
|
||||||
|
}
|
||||||
|
int len = 1024;
|
||||||
|
char *msg = (char *)taosMemoryCalloc(1, sizeof(char) * (len + 1));
|
||||||
|
if (msg == NULL) {
|
||||||
|
jniError("jobj:%p, config:%p, tmq alloc memory failed", jobj, conf);
|
||||||
|
return JNI_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
tmq_t *tmq = tmq_consumer_new((tmq_conf_t *)conf, msg, len);
|
||||||
|
if (strlen(msg) > 0) {
|
||||||
|
jniError("jobj:%p, config:%p, tmq create consumer error: %s", jobj, conf, msg);
|
||||||
|
(*env)->CallVoidMethod(env, jconsumer, g_createConsumerErrorCallback, (*env)->NewStringUTF(env, msg));
|
||||||
|
taosMemoryFreeClear(msg);
|
||||||
|
return TMQ_CONSUMER_CREATE_ERROR;
|
||||||
|
}
|
||||||
|
taosMemoryFreeClear(msg);
|
||||||
|
return (jlong)tmq;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicNewImp(JNIEnv *env, jobject jobj, jlong jtmq) {
|
||||||
|
tmq_t *tmq = (tmq_t *)jtmq;
|
||||||
|
if (tmq == NULL) {
|
||||||
|
jniError("jobj:%p, tmq is closed", jobj);
|
||||||
|
return TMQ_CONSUMER_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmq_list_t *topics = tmq_list_new();
|
||||||
|
return (jlong)topics;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicAppendImp(JNIEnv *env, jobject jobj,
|
||||||
|
jlong jtopic, jstring jname) {
|
||||||
|
tmq_list_t *topic = (tmq_list_t *)jtopic;
|
||||||
|
if (topic == NULL) {
|
||||||
|
jniError("jobj:%p, tmq topic list is null", jobj);
|
||||||
|
return TMQ_TOPIC_NULL;
|
||||||
|
}
|
||||||
|
if (jname == NULL) {
|
||||||
|
jniDebug("jobj:%p, tmq topic append jname is null", jobj);
|
||||||
|
return TMQ_TOPIC_NAME_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *name = (*env)->GetStringUTFChars(env, jname, NULL);
|
||||||
|
|
||||||
|
int32_t res = tmq_list_append((tmq_list_t *)topic, name);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, jname, name);
|
||||||
|
return (jint)res;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicDestroyImp(JNIEnv *env, jobject jobj,
|
||||||
|
jlong jtopic) {
|
||||||
|
tmq_list_t *topic = (tmq_list_t *)jtopic;
|
||||||
|
if (topic == NULL) {
|
||||||
|
jniDebug("jobj:%p, tmq topic list is already destroyed", jobj);
|
||||||
|
} else {
|
||||||
|
tmq_list_destroy((tmq_list_t *)topic);
|
||||||
|
jniDebug("jobj:%p, tmq successfully destroy topic list", jobj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscribeImp(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||||
|
jlong jtopic) {
|
||||||
|
tmq_t *tmq = (tmq_t *)jtmq;
|
||||||
|
if (tmq == NULL) {
|
||||||
|
jniError("jobj:%p, tmq is closed", jobj);
|
||||||
|
return TMQ_CONSUMER_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmq_list_t *topic = (tmq_list_t *)jtopic;
|
||||||
|
if (topic == NULL) {
|
||||||
|
jniDebug("jobj:%p, tmq topic list is already destroyed", jobj);
|
||||||
|
return TMQ_TOPIC_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t res = tmq_subscribe(tmq, topic);
|
||||||
|
return (jint)res;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscriptionImp(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||||
|
jobject jconsumer) {
|
||||||
|
tmq_t *tmq = (tmq_t *)jtmq;
|
||||||
|
if (tmq == NULL) {
|
||||||
|
jniError("jobj:%p, tmq is closed", jobj);
|
||||||
|
return TMQ_CONSUMER_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmq_list_t *topicList = NULL;
|
||||||
|
int32_t res = tmq_subscription((tmq_t *)tmq, &topicList);
|
||||||
|
if (res != JNI_SUCCESS) {
|
||||||
|
tmq_list_destroy(topicList);
|
||||||
|
jniError("jobj:%p, tmq:%p, tmq get subscription error: %s", jobj, tmq, tmq_err2str(res));
|
||||||
|
return (jint)res;
|
||||||
|
}
|
||||||
|
|
||||||
|
char **topics = tmq_list_to_c_array(topicList);
|
||||||
|
int32_t sz = tmq_list_get_size(topicList);
|
||||||
|
|
||||||
|
jobjectArray arr = (jobjectArray)(*env)->NewObjectArray(env, sz, (*env)->FindClass(env, "java/lang/String"),
|
||||||
|
(*env)->NewStringUTF(env, ""));
|
||||||
|
for (int32_t i = 0; i < sz; i++) {
|
||||||
|
(*env)->SetObjectArrayElement(env, arr, i, (*env)->NewStringUTF(env, topics[i]));
|
||||||
|
}
|
||||||
|
(*env)->CallVoidMethod(env, jconsumer, g_topicListCallback, arr);
|
||||||
|
tmq_list_destroy(topicList);
|
||||||
|
return JNI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||||
|
jlong jres) {
|
||||||
|
tmq_t *tmq = (tmq_t *)jtmq;
|
||||||
|
if (tmq == NULL) {
|
||||||
|
jniError("jobj:%p, tmq is closed", jobj);
|
||||||
|
return TMQ_CONSUMER_NULL;
|
||||||
|
}
|
||||||
|
TAOS_RES *res = (TAOS_RES *)jres;
|
||||||
|
return tmq_commit_sync(tmq, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||||
|
jlong jres, jobject consumer) {
|
||||||
|
tmq_t *tmq = (tmq_t *)jtmq;
|
||||||
|
if (tmq == NULL) {
|
||||||
|
jniError("jobj:%p, tmq is closed", jobj);
|
||||||
|
}
|
||||||
|
TAOS_RES *res = (TAOS_RES *)jres;
|
||||||
|
consumer = (*env)->NewGlobalRef(env, consumer);
|
||||||
|
tmq_commit_async(tmq, res, commit_cb, consumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT int JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqUnsubscribeImp(JNIEnv *env, jobject jobj, jlong jtmq) {
|
||||||
|
tmq_t *tmq = (tmq_t *)jtmq;
|
||||||
|
if (tmq == NULL) {
|
||||||
|
jniError("jobj:%p, tmq is closed", jobj);
|
||||||
|
return TMQ_CONSUMER_NULL;
|
||||||
|
}
|
||||||
|
jniDebug("jobj:%p, tmq:%p, successfully unsubscribe", jobj, tmq);
|
||||||
|
return tmq_unsubscribe((tmq_t *)tmq);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT int JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerCloseImp(JNIEnv *env, jobject jobj,
|
||||||
|
jlong jtmq) {
|
||||||
|
tmq_t *tmq = (tmq_t *)jtmq;
|
||||||
|
if (tmq == NULL) {
|
||||||
|
jniDebug("jobj:%p, tmq is closed", jobj);
|
||||||
|
return TMQ_CONSUMER_NULL;
|
||||||
|
}
|
||||||
|
return tmq_consumer_close((tmq_t *)tmq);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_getErrMsgImp(JNIEnv *env, jobject jobj, jint code) {
|
||||||
|
return (*env)->NewStringUTF(env, tmq_err2str(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerPoll(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||||
|
jlong time) {
|
||||||
|
tmq_t *tmq = (tmq_t *)jtmq;
|
||||||
|
if (tmq == NULL) {
|
||||||
|
jniDebug("jobj:%p, tmq is closed", jobj);
|
||||||
|
return TMQ_CONSUMER_NULL;
|
||||||
|
}
|
||||||
|
return (jlong)tmq_consumer_poll((tmq_t *)tmq, time);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicName(JNIEnv *env, jobject jobj,
|
||||||
|
jlong jres) {
|
||||||
|
TAOS_RES *res = (TAOS_RES *)jres;
|
||||||
|
if (res == NULL) {
|
||||||
|
jniDebug("jobj:%p, invalid res handle", jobj);
|
||||||
|
}
|
||||||
|
return (*env)->NewStringUTF(env, tmq_get_topic_name(res));
|
||||||
|
}
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetDbName(JNIEnv *env, jobject jobj, jlong jres) {
|
||||||
|
TAOS_RES *res = (TAOS_RES *)jres;
|
||||||
|
if (res == NULL) {
|
||||||
|
jniDebug("jobj:%p, invalid res handle", jobj);
|
||||||
|
}
|
||||||
|
return (*env)->NewStringUTF(env, tmq_get_db_name(res));
|
||||||
|
}
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetVgroupId(JNIEnv *env, jobject jobj, jlong jres) {
|
||||||
|
TAOS_RES *res = (TAOS_RES *)jres;
|
||||||
|
if (res == NULL) {
|
||||||
|
jniDebug("jobj:%p, invalid res handle", jobj);
|
||||||
|
}
|
||||||
|
return tmq_get_vgroup_id(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTableName(JNIEnv *env, jobject jobj,
|
||||||
|
jlong jres) {
|
||||||
|
TAOS_RES *res = (TAOS_RES *)jres;
|
||||||
|
if (res == NULL) {
|
||||||
|
jniDebug("jobj:%p, invalid res handle", jobj);
|
||||||
|
}
|
||||||
|
return (*env)->NewStringUTF(env, tmq_get_table_name(res));
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_fetchRawBlockImp(JNIEnv *env, jobject jobj, jlong con,
|
||||||
|
jlong res, jobject rowobj, jint flag,
|
||||||
|
jobject arrayListObj) {
|
||||||
|
TAOS *tscon = (TAOS *)con;
|
||||||
|
int32_t code = check_for_params(jobj, con, res);
|
||||||
|
if (code != JNI_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_RES *tres = (TAOS_RES *)res;
|
||||||
|
|
||||||
|
void *data;
|
||||||
|
int32_t numOfRows;
|
||||||
|
int error_code = taos_fetch_raw_block(tres, &numOfRows, &data);
|
||||||
|
if (numOfRows == 0) {
|
||||||
|
if (error_code == JNI_SUCCESS) {
|
||||||
|
jniDebug("jobj:%p, conn:%p, resultset:%p, no data to retrieve", jobj, tscon, (void *)res);
|
||||||
|
return JNI_FETCH_END;
|
||||||
|
} else {
|
||||||
|
jniError("jobj:%p, conn:%p, query interrupted", jobj, tscon);
|
||||||
|
return JNI_RESULT_SET_NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t numOfFields = taos_num_fields(tres);
|
||||||
|
if (numOfFields == 0) {
|
||||||
|
jniError("jobj:%p, conn:%p, resultset:%p, fields size is %d", jobj, tscon, tres, numOfFields);
|
||||||
|
return JNI_NUM_OF_FIELDS_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_FIELD *fields = taos_fetch_fields(tres);
|
||||||
|
jniDebug("jobj:%p, conn:%p, resultset:%p, fields size is %d", jobj, tscon, tres, numOfFields);
|
||||||
|
if (flag) {
|
||||||
|
for (int i = 0; i < numOfFields; ++i) {
|
||||||
|
jobject metadataObj = (*env)->NewObject(env, g_metadataClass, g_metadataConstructFp);
|
||||||
|
(*env)->SetIntField(env, metadataObj, g_metadataColtypeField, fields[i].type);
|
||||||
|
(*env)->SetIntField(env, metadataObj, g_metadataColsizeField, fields[i].bytes);
|
||||||
|
(*env)->SetIntField(env, metadataObj, g_metadataColindexField, i);
|
||||||
|
jstring metadataObjColname = (*env)->NewStringUTF(env, fields[i].name);
|
||||||
|
(*env)->SetObjectField(env, metadataObj, g_metadataColnameField, metadataObjColname);
|
||||||
|
(*env)->CallBooleanMethod(env, arrayListObj, g_arrayListAddFp, metadataObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(*env)->CallVoidMethod(env, rowobj, g_blockdataSetNumOfRowsFp, (jint)numOfRows);
|
||||||
|
(*env)->CallVoidMethod(env, rowobj, g_blockdataSetNumOfColsFp, (jint)numOfFields);
|
||||||
|
|
||||||
|
char *chars = (char *)data;
|
||||||
|
int32_t len = chars[0] + (chars[1] << 8) + (chars[2] << 16) + (chars[3] << 24);
|
||||||
|
(*env)->CallVoidMethod(env, rowobj, g_blockdataSetByteArrayFp, len, jniFromNCharToByteArray(env, (char *)data, len));
|
||||||
|
|
||||||
|
return JNI_SUCCESS;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1298,16 +1298,16 @@ void doProcessMsgFromServer(SSchedMsg* schedMsg) {
|
||||||
pSendInfo->fp(pSendInfo->param, &buf, pMsg->code);
|
pSendInfo->fp(pSendInfo->param, &buf, pMsg->code);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
destroySendMsgInfo(pSendInfo);
|
destroySendMsgInfo(pSendInfo);
|
||||||
|
|
||||||
taosMemoryFree(arg);
|
taosMemoryFree(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
|
void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
|
||||||
SSchedMsg schedMsg = {0};
|
SSchedMsg schedMsg = {0};
|
||||||
|
|
||||||
SEpSet* tEpSet = pEpSet != NULL ? taosMemoryCalloc(1, sizeof(SEpSet)) : NULL;
|
SEpSet* tEpSet = NULL;
|
||||||
if (tEpSet != NULL) {
|
if (pEpSet != NULL) {
|
||||||
*tEpSet = *pEpSet;
|
tEpSet = taosMemoryCalloc(1, sizeof(SEpSet));
|
||||||
|
memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
SchedArg* arg = taosMemoryCalloc(1, sizeof(SchedArg));
|
SchedArg* arg = taosMemoryCalloc(1, sizeof(SchedArg));
|
||||||
|
|
|
@ -43,6 +43,9 @@ if (taosInitLog("taosdlog", 1) != 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Testbase::Init(const char* path, int16_t port) {
|
void Testbase::Init(const char* path, int16_t port) {
|
||||||
|
#ifdef _TD_DARWIN_64
|
||||||
|
osDefaultInit();
|
||||||
|
#endif
|
||||||
tsServerPort = port;
|
tsServerPort = port;
|
||||||
strcpy(tsLocalFqdn, "localhost");
|
strcpy(tsLocalFqdn, "localhost");
|
||||||
snprintf(tsLocalEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
|
snprintf(tsLocalEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
|
||||||
|
|
|
@ -270,13 +270,12 @@ static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb) {
|
||||||
|
|
||||||
static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb) {
|
static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb) {
|
||||||
mTrace("stb:%s, perform delete action, row:%p", pStb->name, pStb);
|
mTrace("stb:%s, perform delete action, row:%p", pStb->name, pStb);
|
||||||
|
taosArrayDestroy(pStb->pFuncs);
|
||||||
taosMemoryFreeClear(pStb->pColumns);
|
taosMemoryFreeClear(pStb->pColumns);
|
||||||
taosMemoryFreeClear(pStb->pTags);
|
taosMemoryFreeClear(pStb->pTags);
|
||||||
taosMemoryFreeClear(pStb->comment);
|
taosMemoryFreeClear(pStb->comment);
|
||||||
taosMemoryFreeClear(pStb->pFuncs);
|
|
||||||
taosMemoryFreeClear(pStb->pAst1);
|
taosMemoryFreeClear(pStb->pAst1);
|
||||||
taosMemoryFreeClear(pStb->pAst2);
|
taosMemoryFreeClear(pStb->pAst2);
|
||||||
taosArrayDestroy(pStb->pFuncs);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,6 +797,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
|
mndStbActionDelete(pMnode->pSdb, &stbObj);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,8 @@ int32_t vnodeSnapshotRead(SVSnapshotReader *pReader, const void **ppData, uint32
|
||||||
int32_t vnodeProcessCreateTSma(SVnode *pVnode, void *pCont, uint32_t contLen);
|
int32_t vnodeProcessCreateTSma(SVnode *pVnode, void *pCont, uint32_t contLen);
|
||||||
int32_t vnodeGetAllTableList(SVnode *pVnode, uint64_t uid, SArray *list);
|
int32_t vnodeGetAllTableList(SVnode *pVnode, uint64_t uid, SArray *list);
|
||||||
int32_t vnodeGetCtbIdList(SVnode *pVnode, int64_t suid, SArray *list);
|
int32_t vnodeGetCtbIdList(SVnode *pVnode, int64_t suid, SArray *list);
|
||||||
void *vnodeGetIdx(SVnode *pVnode);
|
void * vnodeGetIdx(SVnode *pVnode);
|
||||||
void *vnodeGetIvtIdx(SVnode *pVnode);
|
void * vnodeGetIvtIdx(SVnode *pVnode);
|
||||||
|
|
||||||
int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad);
|
int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad);
|
||||||
int32_t vnodeValidateTableHash(SVnode *pVnode, char *tableFName);
|
int32_t vnodeValidateTableHash(SVnode *pVnode, char *tableFName);
|
||||||
|
@ -95,7 +95,7 @@ typedef struct SMetaFltParam {
|
||||||
tb_uid_t suid;
|
tb_uid_t suid;
|
||||||
int16_t cid;
|
int16_t cid;
|
||||||
int16_t type;
|
int16_t type;
|
||||||
char *val;
|
char * val;
|
||||||
bool reverse;
|
bool reverse;
|
||||||
int (*filterFunc)(void *a, void *b, int16_t type);
|
int (*filterFunc)(void *a, void *b, int16_t type);
|
||||||
|
|
||||||
|
@ -136,6 +136,8 @@ SArray *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdLis
|
||||||
int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond, int32_t tWinIdx);
|
int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond, int32_t tWinIdx);
|
||||||
int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTableBlockInfo);
|
int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTableBlockInfo);
|
||||||
int64_t tsdbGetNumOfRowsInMemTable(STsdbReader *pHandle);
|
int64_t tsdbGetNumOfRowsInMemTable(STsdbReader *pHandle);
|
||||||
|
void * tsdbGetIdx(SMeta *pMeta);
|
||||||
|
void * tsdbGetIvtIdx(SMeta *pMeta);
|
||||||
|
|
||||||
int32_t tsdbLastRowReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t *colId, int32_t numOfCols,
|
int32_t tsdbLastRowReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t *colId, int32_t numOfCols,
|
||||||
void **pReader);
|
void **pReader);
|
||||||
|
@ -212,7 +214,7 @@ struct SMetaEntry {
|
||||||
int8_t type;
|
int8_t type;
|
||||||
int8_t flags; // TODO: need refactor?
|
int8_t flags; // TODO: need refactor?
|
||||||
tb_uid_t uid;
|
tb_uid_t uid;
|
||||||
char *name;
|
char * name;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
SSchemaWrapper schemaRow;
|
SSchemaWrapper schemaRow;
|
||||||
|
@ -223,7 +225,7 @@ struct SMetaEntry {
|
||||||
int64_t ctime;
|
int64_t ctime;
|
||||||
int32_t ttlDays;
|
int32_t ttlDays;
|
||||||
int32_t commentLen;
|
int32_t commentLen;
|
||||||
char *comment;
|
char * comment;
|
||||||
tb_uid_t suid;
|
tb_uid_t suid;
|
||||||
uint8_t *pTags;
|
uint8_t *pTags;
|
||||||
} ctbEntry;
|
} ctbEntry;
|
||||||
|
@ -231,7 +233,7 @@ struct SMetaEntry {
|
||||||
int64_t ctime;
|
int64_t ctime;
|
||||||
int32_t ttlDays;
|
int32_t ttlDays;
|
||||||
int32_t commentLen;
|
int32_t commentLen;
|
||||||
char *comment;
|
char * comment;
|
||||||
int32_t ncid; // next column id
|
int32_t ncid; // next column id
|
||||||
SSchemaWrapper schemaRow;
|
SSchemaWrapper schemaRow;
|
||||||
} ntbEntry;
|
} ntbEntry;
|
||||||
|
@ -245,17 +247,17 @@ struct SMetaEntry {
|
||||||
|
|
||||||
struct SMetaReader {
|
struct SMetaReader {
|
||||||
int32_t flags;
|
int32_t flags;
|
||||||
SMeta *pMeta;
|
SMeta * pMeta;
|
||||||
SDecoder coder;
|
SDecoder coder;
|
||||||
SMetaEntry me;
|
SMetaEntry me;
|
||||||
void *pBuf;
|
void * pBuf;
|
||||||
int32_t szBuf;
|
int32_t szBuf;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SMTbCursor {
|
struct SMTbCursor {
|
||||||
TBC *pDbc;
|
TBC * pDbc;
|
||||||
void *pKey;
|
void * pKey;
|
||||||
void *pVal;
|
void * pVal;
|
||||||
int32_t kLen;
|
int32_t kLen;
|
||||||
int32_t vLen;
|
int32_t vLen;
|
||||||
SMetaReader mr;
|
SMetaReader mr;
|
||||||
|
|
|
@ -164,11 +164,8 @@ int metaClose(SMeta *pMeta) {
|
||||||
if (pMeta->pIdx) metaCloseIdx(pMeta);
|
if (pMeta->pIdx) metaCloseIdx(pMeta);
|
||||||
if (pMeta->pSmaIdx) tdbTbClose(pMeta->pSmaIdx);
|
if (pMeta->pSmaIdx) tdbTbClose(pMeta->pSmaIdx);
|
||||||
if (pMeta->pTtlIdx) tdbTbClose(pMeta->pTtlIdx);
|
if (pMeta->pTtlIdx) tdbTbClose(pMeta->pTtlIdx);
|
||||||
#ifdef USE_INVERTED_INDEX
|
|
||||||
if (pMeta->pTagIvtIdx) indexClose(pMeta->pTagIvtIdx);
|
if (pMeta->pTagIvtIdx) indexClose(pMeta->pTagIvtIdx);
|
||||||
#else
|
|
||||||
if (pMeta->pTagIdx) tdbTbClose(pMeta->pTagIdx);
|
if (pMeta->pTagIdx) tdbTbClose(pMeta->pTagIdx);
|
||||||
#endif
|
|
||||||
if (pMeta->pCtbIdx) tdbTbClose(pMeta->pCtbIdx);
|
if (pMeta->pCtbIdx) tdbTbClose(pMeta->pCtbIdx);
|
||||||
if (pMeta->pSuidIdx) tdbTbClose(pMeta->pSuidIdx);
|
if (pMeta->pSuidIdx) tdbTbClose(pMeta->pSuidIdx);
|
||||||
if (pMeta->pNameIdx) tdbTbClose(pMeta->pNameIdx);
|
if (pMeta->pNameIdx) tdbTbClose(pMeta->pNameIdx);
|
||||||
|
|
|
@ -74,7 +74,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
||||||
|
|
||||||
SIndexTerm *term = NULL;
|
SIndexTerm *term = NULL;
|
||||||
if (type == TSDB_DATA_TYPE_NULL) {
|
if (type == TSDB_DATA_TYPE_NULL) {
|
||||||
// handle null value
|
term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, NULL, 0);
|
||||||
} else if (type == TSDB_DATA_TYPE_NCHAR) {
|
} else if (type == TSDB_DATA_TYPE_NCHAR) {
|
||||||
if (pTagVal->nData > 0) {
|
if (pTagVal->nData > 0) {
|
||||||
char * val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
char * val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||||
|
@ -83,17 +83,15 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
||||||
type = TSDB_DATA_TYPE_VARCHAR;
|
type = TSDB_DATA_TYPE_VARCHAR;
|
||||||
term = indexTermCreate(suid, ADD_VALUE, type, key, nKey, val, len);
|
term = indexTermCreate(suid, ADD_VALUE, type, key, nKey, val, len);
|
||||||
} else if (pTagVal->nData == 0) {
|
} else if (pTagVal->nData == 0) {
|
||||||
char * val = NULL;
|
term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, pTagVal->pData, 0);
|
||||||
int32_t len = 0;
|
|
||||||
// handle NULL key
|
|
||||||
}
|
}
|
||||||
} else if (type == TSDB_DATA_TYPE_DOUBLE) {
|
} else if (type == TSDB_DATA_TYPE_DOUBLE) {
|
||||||
double val = *(double *)(&pTagVal->i64);
|
double val = *(double *)(&pTagVal->i64);
|
||||||
int len = 0;
|
int len = sizeof(val);
|
||||||
term = indexTermCreate(suid, ADD_VALUE, type, key, nKey, (const char *)&val, len);
|
term = indexTermCreate(suid, ADD_VALUE, type, key, nKey, (const char *)&val, len);
|
||||||
} else if (type == TSDB_DATA_TYPE_BOOL) {
|
} else if (type == TSDB_DATA_TYPE_BOOL) {
|
||||||
int val = *(int *)(&pTagVal->i64);
|
int val = *(int *)(&pTagVal->i64);
|
||||||
int len = 0;
|
int len = sizeof(val);
|
||||||
term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_INT, key, nKey, (const char *)&val, len);
|
term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_INT, key, nKey, (const char *)&val, len);
|
||||||
}
|
}
|
||||||
if (term != NULL) {
|
if (term != NULL) {
|
||||||
|
@ -380,22 +378,22 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
|
||||||
int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
|
int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
int ret = metaTtlSmaller(pMeta, ttl, tbUids);
|
int ret = metaTtlSmaller(pMeta, ttl, tbUids);
|
||||||
if(ret != 0){
|
if (ret != 0) {
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < taosArrayGetSize(tbUids); ++i) {
|
for (int i = 0; i < taosArrayGetSize(tbUids); ++i) {
|
||||||
tb_uid_t *uid = (tb_uid_t *)taosArrayGet(tbUids, i);
|
tb_uid_t *uid = (tb_uid_t *)taosArrayGet(tbUids, i);
|
||||||
metaDropTableByUid(pMeta, *uid, NULL);
|
metaDropTableByUid(pMeta, *uid, NULL);
|
||||||
metaDebug("ttl drop table:%"PRId64, *uid);
|
metaDebug("ttl drop table:%" PRId64, *uid);
|
||||||
}
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME){
|
static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME) {
|
||||||
int64_t ttlDays;
|
int64_t ttlDays;
|
||||||
int64_t ctime;
|
int64_t ctime;
|
||||||
if (pME->type == TSDB_CHILD_TABLE) {
|
if (pME->type == TSDB_CHILD_TABLE) {
|
||||||
ctime = pME->ctbEntry.ctime;
|
ctime = pME->ctbEntry.ctime;
|
||||||
ttlDays = pME->ctbEntry.ttlDays;
|
ttlDays = pME->ctbEntry.ttlDays;
|
||||||
|
@ -415,11 +413,10 @@ static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME){
|
||||||
static int metaDeleteTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaDeleteTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
STtlIdxKey ttlKey = {0};
|
STtlIdxKey ttlKey = {0};
|
||||||
metaBuildTtlIdxKey(&ttlKey, pME);
|
metaBuildTtlIdxKey(&ttlKey, pME);
|
||||||
if(ttlKey.dtime == 0) return 0;
|
if (ttlKey.dtime == 0) return 0;
|
||||||
return tdbTbDelete(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), &pMeta->txn);
|
return tdbTbDelete(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), &pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
void * pData = NULL;
|
void * pData = NULL;
|
||||||
int nData = 0;
|
int nData = 0;
|
||||||
|
@ -440,8 +437,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pMeta->txn);
|
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, &pMeta->txn);
|
tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, &pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), &pMeta->txn);
|
tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), &pMeta->txn);
|
||||||
if(e.type != TSDB_SUPER_TABLE) metaDeleteTtlIdx(pMeta, &e);
|
if (e.type != TSDB_SUPER_TABLE) metaDeleteTtlIdx(pMeta, &e);
|
||||||
|
|
||||||
|
|
||||||
if (e.type == TSDB_CHILD_TABLE) {
|
if (e.type == TSDB_CHILD_TABLE) {
|
||||||
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), &pMeta->txn);
|
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), &pMeta->txn);
|
||||||
|
@ -765,15 +761,15 @@ _err:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
||||||
void * pVal = NULL;
|
void * pVal = NULL;
|
||||||
int nVal = 0;
|
int nVal = 0;
|
||||||
const void * pData = NULL;
|
const void *pData = NULL;
|
||||||
int nData = 0;
|
int nData = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
tb_uid_t uid;
|
tb_uid_t uid;
|
||||||
int64_t oversion;
|
int64_t oversion;
|
||||||
SMetaEntry entry = {0};
|
SMetaEntry entry = {0};
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
// search name index
|
// search name index
|
||||||
ret = tdbTbGet(pMeta->pNameIdx, pAlterTbReq->tbName, strlen(pAlterTbReq->tbName) + 1, &pVal, &nVal);
|
ret = tdbTbGet(pMeta->pNameIdx, pAlterTbReq->tbName, strlen(pAlterTbReq->tbName) + 1, &pVal, &nVal);
|
||||||
|
@ -816,22 +812,22 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
// build SMetaEntry
|
// build SMetaEntry
|
||||||
if (entry.type == TSDB_CHILD_TABLE) {
|
if (entry.type == TSDB_CHILD_TABLE) {
|
||||||
if(pAlterTbReq->updateTTL) {
|
if (pAlterTbReq->updateTTL) {
|
||||||
metaDeleteTtlIdx(pMeta, &entry);
|
metaDeleteTtlIdx(pMeta, &entry);
|
||||||
entry.ctbEntry.ttlDays = pAlterTbReq->newTTL;
|
entry.ctbEntry.ttlDays = pAlterTbReq->newTTL;
|
||||||
metaUpdateTtlIdx(pMeta, &entry);
|
metaUpdateTtlIdx(pMeta, &entry);
|
||||||
}
|
}
|
||||||
if(pAlterTbReq->newCommentLen >= 0) {
|
if (pAlterTbReq->newCommentLen >= 0) {
|
||||||
entry.ctbEntry.commentLen = pAlterTbReq->newCommentLen;
|
entry.ctbEntry.commentLen = pAlterTbReq->newCommentLen;
|
||||||
entry.ctbEntry.comment = pAlterTbReq->newComment;
|
entry.ctbEntry.comment = pAlterTbReq->newComment;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(pAlterTbReq->updateTTL) {
|
if (pAlterTbReq->updateTTL) {
|
||||||
metaDeleteTtlIdx(pMeta, &entry);
|
metaDeleteTtlIdx(pMeta, &entry);
|
||||||
entry.ntbEntry.ttlDays = pAlterTbReq->newTTL;
|
entry.ntbEntry.ttlDays = pAlterTbReq->newTTL;
|
||||||
metaUpdateTtlIdx(pMeta, &entry);
|
metaUpdateTtlIdx(pMeta, &entry);
|
||||||
}
|
}
|
||||||
if(pAlterTbReq->newCommentLen >= 0) {
|
if (pAlterTbReq->newCommentLen >= 0) {
|
||||||
entry.ntbEntry.commentLen = pAlterTbReq->newCommentLen;
|
entry.ntbEntry.commentLen = pAlterTbReq->newCommentLen;
|
||||||
entry.ntbEntry.comment = pAlterTbReq->newComment;
|
entry.ntbEntry.comment = pAlterTbReq->newComment;
|
||||||
}
|
}
|
||||||
|
@ -930,7 +926,7 @@ static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
static int metaUpdateTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
STtlIdxKey ttlKey = {0};
|
STtlIdxKey ttlKey = {0};
|
||||||
metaBuildTtlIdxKey(&ttlKey, pME);
|
metaBuildTtlIdxKey(&ttlKey, pME);
|
||||||
if(ttlKey.dtime == 0) return 0;
|
if (ttlKey.dtime == 0) return 0;
|
||||||
return tdbTbInsert(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), NULL, 0, &pMeta->txn);
|
return tdbTbInsert(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), NULL, 0, &pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,7 +984,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
|
||||||
SDecoder dc = {0};
|
SDecoder dc = {0};
|
||||||
|
|
||||||
// get super table
|
// get super table
|
||||||
if(tdbTbGet(pMeta->pUidIdx, &pCtbEntry->ctbEntry.suid, sizeof(tb_uid_t), &pData, &nData) != 0){
|
if (tdbTbGet(pMeta->pUidIdx, &pCtbEntry->ctbEntry.suid, sizeof(tb_uid_t), &pData, &nData) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tbDbKey.uid = pCtbEntry->ctbEntry.suid;
|
tbDbKey.uid = pCtbEntry->ctbEntry.suid;
|
||||||
|
@ -1096,7 +1092,7 @@ static int metaHandleEntry(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
|
|
||||||
if (pME->type == TSDB_SUPER_TABLE) {
|
if (pME->type == TSDB_SUPER_TABLE) {
|
||||||
if (metaUpdateSuidIdx(pMeta, pME) < 0) goto _err;
|
if (metaUpdateSuidIdx(pMeta, pME) < 0) goto _err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pME->type != TSDB_SUPER_TABLE) {
|
if (pME->type != TSDB_SUPER_TABLE) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ int32_t tqMetaOpen(STQ* pTq) {
|
||||||
.streamReader = handle.execHandle.pExecReader[i],
|
.streamReader = handle.execHandle.pExecReader[i],
|
||||||
.meta = pTq->pVnode->pMeta,
|
.meta = pTq->pVnode->pMeta,
|
||||||
.pMsgCb = &pTq->pVnode->msgCb,
|
.pMsgCb = &pTq->pVnode->msgCb,
|
||||||
.vnode = pTq->pVnode,
|
.vnode = pTq->pVnode,
|
||||||
};
|
};
|
||||||
handle.execHandle.execCol.task[i] = qCreateStreamExecTaskInfo(handle.execHandle.execCol.qmsg, &reader);
|
handle.execHandle.execCol.task[i] = qCreateStreamExecTaskInfo(handle.execHandle.execCol.qmsg, &reader);
|
||||||
ASSERT(handle.execHandle.execCol.task[i]);
|
ASSERT(handle.execHandle.execCol.task[i]);
|
||||||
|
@ -99,6 +99,7 @@ int32_t tqMetaOpen(STQ* pTq) {
|
||||||
taosHashPut(pTq->handles, pKey, kLen, &handle, sizeof(STqHandle));
|
taosHashPut(pTq->handles, pKey, kLen, &handle, sizeof(STqHandle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tdbTbcClose(pCur);
|
||||||
if (tdbTxnClose(&txn) < 0) {
|
if (tdbTxnClose(&txn) < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,9 @@ int32_t tqMetaOpen(STQ* pTq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tqMetaClose(STQ* pTq) {
|
int32_t tqMetaClose(STQ* pTq) {
|
||||||
|
if (pTq->pExecStore) {
|
||||||
|
tdbTbClose(pTq->pExecStore);
|
||||||
|
}
|
||||||
tdbClose(pTq->pMetaStore);
|
tdbClose(pTq->pMetaStore);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,26 +17,26 @@
|
||||||
#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC)
|
#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
STbDataIter *iter;
|
STbDataIter* iter;
|
||||||
int32_t index;
|
int32_t index;
|
||||||
bool hasVal;
|
bool hasVal;
|
||||||
} SIterInfo;
|
} SIterInfo;
|
||||||
|
|
||||||
typedef struct STableBlockScanInfo {
|
typedef struct STableBlockScanInfo {
|
||||||
uint64_t uid;
|
uint64_t uid;
|
||||||
TSKEY lastKey;
|
TSKEY lastKey;
|
||||||
SBlockIdx blockIdx;
|
SBlockIdx blockIdx;
|
||||||
SArray* pBlockList; // block data index list
|
SArray* pBlockList; // block data index list
|
||||||
SIterInfo iter; // mem buffer skip list iterator
|
SIterInfo iter; // mem buffer skip list iterator
|
||||||
SIterInfo iiter; // imem buffer skip list iterator
|
SIterInfo iiter; // imem buffer skip list iterator
|
||||||
SArray* delSkyline; // delete info for this table
|
SArray* delSkyline; // delete info for this table
|
||||||
int32_t fileDelIndex;
|
int32_t fileDelIndex;
|
||||||
bool iterInit; // whether to initialize the in-memory skip list iterator or not
|
bool iterInit; // whether to initialize the in-memory skip list iterator or not
|
||||||
} STableBlockScanInfo;
|
} STableBlockScanInfo;
|
||||||
|
|
||||||
typedef struct SBlockOrderWrapper {
|
typedef struct SBlockOrderWrapper {
|
||||||
int64_t uid;
|
int64_t uid;
|
||||||
SBlock* pBlock;
|
SBlock* pBlock;
|
||||||
} SBlockOrderWrapper;
|
} SBlockOrderWrapper;
|
||||||
|
|
||||||
typedef struct SBlockOrderSupporter {
|
typedef struct SBlockOrderSupporter {
|
||||||
|
@ -70,40 +70,41 @@ typedef struct SFilesetIter {
|
||||||
} SFilesetIter;
|
} SFilesetIter;
|
||||||
|
|
||||||
typedef struct SFileDataBlockInfo {
|
typedef struct SFileDataBlockInfo {
|
||||||
int32_t tbBlockIdx; // index position in STableBlockScanInfo in order to check whether neighbor block overlaps with it
|
int32_t
|
||||||
uint64_t uid;
|
tbBlockIdx; // index position in STableBlockScanInfo in order to check whether neighbor block overlaps with it
|
||||||
|
uint64_t uid;
|
||||||
} SFileDataBlockInfo;
|
} SFileDataBlockInfo;
|
||||||
|
|
||||||
typedef struct SDataBlockIter {
|
typedef struct SDataBlockIter {
|
||||||
int32_t numOfBlocks;
|
int32_t numOfBlocks;
|
||||||
int32_t index;
|
int32_t index;
|
||||||
SArray* blockList; // SArray<SFileDataBlockInfo>
|
SArray* blockList; // SArray<SFileDataBlockInfo>
|
||||||
int32_t order;
|
int32_t order;
|
||||||
} SDataBlockIter;
|
} SDataBlockIter;
|
||||||
|
|
||||||
typedef struct SFileBlockDumpInfo {
|
typedef struct SFileBlockDumpInfo {
|
||||||
int32_t totalRows;
|
int32_t totalRows;
|
||||||
int32_t rowIndex;
|
int32_t rowIndex;
|
||||||
int64_t lastKey;
|
int64_t lastKey;
|
||||||
bool allDumped;
|
bool allDumped;
|
||||||
} SFileBlockDumpInfo;
|
} SFileBlockDumpInfo;
|
||||||
|
|
||||||
typedef struct SVersionRange {
|
typedef struct SVersionRange {
|
||||||
uint64_t minVer;
|
uint64_t minVer;
|
||||||
uint64_t maxVer;
|
uint64_t maxVer;
|
||||||
} SVersionRange;
|
} SVersionRange;
|
||||||
|
|
||||||
typedef struct SReaderStatus {
|
typedef struct SReaderStatus {
|
||||||
bool loadFromFile; // check file stage
|
bool loadFromFile; // check file stage
|
||||||
SHashObj* pTableMap; // SHash<STableBlockScanInfo>
|
SHashObj* pTableMap; // SHash<STableBlockScanInfo>
|
||||||
STableBlockScanInfo* pTableIter; // table iterator used in building in-memory buffer data blocks.
|
STableBlockScanInfo* pTableIter; // table iterator used in building in-memory buffer data blocks.
|
||||||
SFileBlockDumpInfo fBlockDumpInfo;
|
SFileBlockDumpInfo fBlockDumpInfo;
|
||||||
|
|
||||||
SDFileSet* pCurrentFileset; // current opened file set
|
SDFileSet* pCurrentFileset; // current opened file set
|
||||||
SBlockData fileBlockData;
|
SBlockData fileBlockData;
|
||||||
SFilesetIter fileIter;
|
SFilesetIter fileIter;
|
||||||
SDataBlockIter blockIter;
|
SDataBlockIter blockIter;
|
||||||
bool composedDataBlock;// the returned data block is a composed block or not
|
bool composedDataBlock; // the returned data block is a composed block or not
|
||||||
} SReaderStatus;
|
} SReaderStatus;
|
||||||
|
|
||||||
struct STsdbReader {
|
struct STsdbReader {
|
||||||
|
@ -118,10 +119,10 @@ struct STsdbReader {
|
||||||
int32_t type; // query type: 1. retrieve all data blocks, 2. retrieve direct prev|next rows
|
int32_t type; // query type: 1. retrieve all data blocks, 2. retrieve direct prev|next rows
|
||||||
SBlockLoadSuppInfo suppInfo;
|
SBlockLoadSuppInfo suppInfo;
|
||||||
|
|
||||||
SIOCostSummary cost;
|
SIOCostSummary cost;
|
||||||
STSchema* pSchema;
|
STSchema* pSchema;
|
||||||
SDataFReader* pFileReader;
|
SDataFReader* pFileReader;
|
||||||
SVersionRange verRange;
|
SVersionRange verRange;
|
||||||
#if 0
|
#if 0
|
||||||
SArray* prev; // previous row which is before than time window
|
SArray* prev; // previous row which is before than time window
|
||||||
SArray* next; // next row which is after the query time window
|
SArray* next; // next row which is after the query time window
|
||||||
|
@ -144,17 +145,21 @@ static int buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, i
|
||||||
static TSDBROW* getValidRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader);
|
static TSDBROW* getValidRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader);
|
||||||
static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader,
|
static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader,
|
||||||
SRowMerger* pMerger);
|
SRowMerger* pMerger);
|
||||||
static int32_t doMergeRowsInBuf(SIterInfo *pIter, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader);
|
static int32_t doMergeRowsInBuf(SIterInfo* pIter, int64_t ts, SArray* pDelList, SRowMerger* pMerger,
|
||||||
|
STsdbReader* pReader);
|
||||||
static int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow);
|
static int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow);
|
||||||
static void setComposedBlockFlag(STsdbReader* pReader, bool composed);
|
static void setComposedBlockFlag(STsdbReader* pReader, bool composed);
|
||||||
static void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader);
|
static void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader);
|
||||||
static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey);
|
static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey);
|
||||||
|
|
||||||
static void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo *pIter, SArray* pDelList, STSRow** pTSRow, STsdbReader* pReader);
|
static void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDelList, STSRow** pTSRow,
|
||||||
|
STsdbReader* pReader);
|
||||||
static void doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader,
|
static void doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader,
|
||||||
STSRow** pTSRow);
|
STSRow** pTSRow);
|
||||||
static int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STbData* pMemTbData, STbData* piMemTbData);
|
static int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STbData* pMemTbData,
|
||||||
static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* retentions, const char* idstr, int8_t *pLevel);
|
STbData* piMemTbData);
|
||||||
|
static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* retentions, const char* idstr,
|
||||||
|
int8_t* pLevel);
|
||||||
static SVersionRange getQueryVerRange(SVnode* pVnode, SQueryTableDataCond* pCond, int8_t level);
|
static SVersionRange getQueryVerRange(SVnode* pVnode, SQueryTableDataCond* pCond, int8_t level);
|
||||||
|
|
||||||
static int32_t setColumnIdSlotList(STsdbReader* pReader, SSDataBlock* pBlock) {
|
static int32_t setColumnIdSlotList(STsdbReader* pReader, SSDataBlock* pBlock) {
|
||||||
|
@ -215,10 +220,10 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
|
||||||
static void resetDataBlockScanInfo(SHashObj* pTableMap) {
|
static void resetDataBlockScanInfo(SHashObj* pTableMap) {
|
||||||
STableBlockScanInfo* p = NULL;
|
STableBlockScanInfo* p = NULL;
|
||||||
|
|
||||||
while((p = taosHashIterate(pTableMap, p)) != NULL) {
|
while ((p = taosHashIterate(pTableMap, p)) != NULL) {
|
||||||
p->iterInit = false;
|
p->iterInit = false;
|
||||||
p->iiter.hasVal = false;
|
p->iiter.hasVal = false;
|
||||||
if (p->iter.iter != NULL) {
|
if (p->iter.iter != NULL) {
|
||||||
tsdbTbDataIterDestroy(p->iter.iter);
|
tsdbTbDataIterDestroy(p->iter.iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,12 +239,12 @@ static bool isEmptyQueryTimeWindow(STimeWindow* pWindow) {
|
||||||
// Update the query time window according to the data time to live(TTL) information, in order to avoid to return
|
// Update the query time window according to the data time to live(TTL) information, in order to avoid to return
|
||||||
// the expired data to client, even it is queried already.
|
// the expired data to client, even it is queried already.
|
||||||
static STimeWindow updateQueryTimeWindow(STsdb* pTsdb, STimeWindow* pWindow) {
|
static STimeWindow updateQueryTimeWindow(STsdb* pTsdb, STimeWindow* pWindow) {
|
||||||
STsdbKeepCfg* pCfg = &pTsdb->keepCfg;
|
STsdbKeepCfg* pCfg = &pTsdb->keepCfg;
|
||||||
|
|
||||||
int64_t now = taosGetTimestamp(pCfg->precision);
|
int64_t now = taosGetTimestamp(pCfg->precision);
|
||||||
int64_t earilyTs = now - (tsTickPerMin[pCfg->precision] * pCfg->keep2) + 1; // needs to add one tick
|
int64_t earilyTs = now - (tsTickPerMin[pCfg->precision] * pCfg->keep2) + 1; // needs to add one tick
|
||||||
|
|
||||||
STimeWindow win = *pWindow;
|
STimeWindow win = *pWindow;
|
||||||
if (win.skey < earilyTs) {
|
if (win.skey < earilyTs) {
|
||||||
win.skey = earilyTs;
|
win.skey = earilyTs;
|
||||||
}
|
}
|
||||||
|
@ -352,8 +357,8 @@ static void resetDataBlockIterator(SDataBlockIter* pIter, int32_t order) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initReaderStatus(SReaderStatus* pStatus) {
|
static void initReaderStatus(SReaderStatus* pStatus) {
|
||||||
pStatus->pTableIter = NULL;
|
pStatus->pTableIter = NULL;
|
||||||
pStatus->loadFromFile = true;
|
pStatus->loadFromFile = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* createResBlock(SQueryTableDataCond* pCond, int32_t capacity) {
|
static SSDataBlock* createResBlock(SQueryTableDataCond* pCond, int32_t capacity) {
|
||||||
|
@ -390,14 +395,15 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
|
||||||
|
|
||||||
initReaderStatus(&pReader->status);
|
initReaderStatus(&pReader->status);
|
||||||
|
|
||||||
pReader->pTsdb = getTsdbByRetentions(pVnode, pCond->twindows[0].skey, pVnode->config.tsdbCfg.retentions, idstr, &level);
|
pReader->pTsdb =
|
||||||
pReader->suid = pCond->suid;
|
getTsdbByRetentions(pVnode, pCond->twindows[0].skey, pVnode->config.tsdbCfg.retentions, idstr, &level);
|
||||||
pReader->order = pCond->order;
|
pReader->suid = pCond->suid;
|
||||||
pReader->capacity = 4096;
|
pReader->order = pCond->order;
|
||||||
pReader->idStr = (idstr != NULL)? strdup(idstr):NULL;
|
pReader->capacity = 4096;
|
||||||
pReader->verRange = getQueryVerRange(pVnode, pCond, level);
|
pReader->idStr = (idstr != NULL) ? strdup(idstr) : NULL;
|
||||||
|
pReader->verRange = getQueryVerRange(pVnode, pCond, level);
|
||||||
pReader->type = pCond->type;
|
pReader->type = pCond->type;
|
||||||
pReader->window = updateQueryTimeWindow(pVnode->pTsdb, pCond->twindows);
|
pReader->window = updateQueryTimeWindow(pVnode->pTsdb, pCond->twindows);
|
||||||
|
|
||||||
// todo remove this
|
// todo remove this
|
||||||
setQueryTimewindow(pReader, pCond, 0);
|
setQueryTimewindow(pReader, pCond, 0);
|
||||||
|
@ -660,7 +666,7 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, uint32_
|
||||||
*numOfValidTables = 0;
|
*numOfValidTables = 0;
|
||||||
|
|
||||||
STableBlockScanInfo* px = NULL;
|
STableBlockScanInfo* px = NULL;
|
||||||
while(1) {
|
while (1) {
|
||||||
px = taosHashIterate(pReader->status.pTableMap, px);
|
px = taosHashIterate(pReader->status.pTableMap, px);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
break;
|
break;
|
||||||
|
@ -669,7 +675,7 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, uint32_
|
||||||
taosArrayClear(px->pBlockList);
|
taosArrayClear(px->pBlockList);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int32_t i = 0; i < numOfTables; ++i) {
|
for (int32_t i = 0; i < numOfTables; ++i) {
|
||||||
SBlockIdx* pBlockIdx = taosArrayGet(pIndexList, i);
|
SBlockIdx* pBlockIdx = taosArrayGet(pIndexList, i);
|
||||||
|
|
||||||
SMapData mapData = {0};
|
SMapData mapData = {0};
|
||||||
|
@ -830,7 +836,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
|
||||||
|
|
||||||
uint8_t *pb = NULL, *pb1 = NULL;
|
uint8_t *pb = NULL, *pb1 = NULL;
|
||||||
int32_t code = tsdbReadColData(pReader->pFileReader, &pBlockScanInfo->blockIdx, pBlock, pSupInfo->colIds, numOfCols,
|
int32_t code = tsdbReadColData(pReader->pFileReader, &pBlockScanInfo->blockIdx, pBlock, pSupInfo->colIds, numOfCols,
|
||||||
pBlockData, &pb, &pb1);
|
pBlockData, &pb, &pb1);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
@ -1812,7 +1818,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
||||||
|
|
||||||
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
||||||
SBlockData* pBlockData = &pReader->status.fileBlockData;
|
SBlockData* pBlockData = &pReader->status.fileBlockData;
|
||||||
SArray* pDelList = pBlockScanInfo->delSkyline;
|
SArray* pDelList = pBlockScanInfo->delSkyline;
|
||||||
|
|
||||||
TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pDelList, pReader);
|
TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pDelList, pReader);
|
||||||
TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pDelList, pReader);
|
TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pDelList, pReader);
|
||||||
|
@ -1936,8 +1942,8 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDumpInfo, STableBlockScanInfo* pBlockScanInfo,
|
static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDumpInfo,
|
||||||
STsdbReader* pReader) {
|
STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) {
|
||||||
// check for version and time range
|
// check for version and time range
|
||||||
int64_t ver = pBlockData->aVersion[pDumpInfo->rowIndex];
|
int64_t ver = pBlockData->aVersion[pDumpInfo->rowIndex];
|
||||||
if (ver > pReader->verRange.maxVer || ver < pReader->verRange.minVer) {
|
if (ver > pReader->verRange.maxVer || ver < pReader->verRange.minVer) {
|
||||||
|
@ -1980,7 +1986,7 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI
|
||||||
|
|
||||||
// mem + file
|
// mem + file
|
||||||
if (pBlockScanInfo->iter.hasVal) {
|
if (pBlockScanInfo->iter.hasVal) {
|
||||||
return doMergeBufAndFileRows(pReader, pBlockScanInfo, pRow, pTSRow, &pBlockScanInfo->iter,key);
|
return doMergeBufAndFileRows(pReader, pBlockScanInfo, pRow, pTSRow, &pBlockScanInfo->iter, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// imem & mem are all empty, only file exist
|
// imem & mem are all empty, only file exist
|
||||||
|
@ -2113,7 +2119,8 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STbData* pMemTbData, STbData* piMemTbData) {
|
int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STbData* pMemTbData,
|
||||||
|
STbData* piMemTbData) {
|
||||||
if (pBlockScanInfo->delSkyline != NULL) {
|
if (pBlockScanInfo->delSkyline != NULL) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -2123,7 +2130,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
|
||||||
|
|
||||||
SArray* pDelData = taosArrayInit(4, sizeof(SDelData));
|
SArray* pDelData = taosArrayInit(4, sizeof(SDelData));
|
||||||
|
|
||||||
SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState);
|
SDelFile* pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState);
|
||||||
if (pDelFile) {
|
if (pDelFile) {
|
||||||
SDelFReader* pDelFReader = NULL;
|
SDelFReader* pDelFReader = NULL;
|
||||||
code = tsdbDelFReaderOpen(&pDelFReader, pDelFile, pTsdb, NULL);
|
code = tsdbDelFReaderOpen(&pDelFReader, pDelFile, pTsdb, NULL);
|
||||||
|
@ -2173,7 +2180,8 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pDelData);
|
taosArrayDestroy(pDelData);
|
||||||
pBlockScanInfo->iter.index = ASCENDING_TRAVERSE(pReader->order)? 0:taosArrayGetSize(pBlockScanInfo->delSkyline) - 1;
|
pBlockScanInfo->iter.index =
|
||||||
|
ASCENDING_TRAVERSE(pReader->order) ? 0 : taosArrayGetSize(pBlockScanInfo->delSkyline) - 1;
|
||||||
pBlockScanInfo->iiter.index = pBlockScanInfo->iter.index;
|
pBlockScanInfo->iiter.index = pBlockScanInfo->iter.index;
|
||||||
pBlockScanInfo->fileDelIndex = pBlockScanInfo->iter.index;
|
pBlockScanInfo->fileDelIndex = pBlockScanInfo->iter.index;
|
||||||
return code;
|
return code;
|
||||||
|
@ -2488,7 +2496,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey) {
|
||||||
if (pKey->ts > last->ts) {
|
if (pKey->ts > last->ts) {
|
||||||
return false;
|
return false;
|
||||||
} else if (pKey->ts == last->ts) {
|
} else if (pKey->ts == last->ts) {
|
||||||
size_t size = taosArrayGetSize(pDelList);
|
size_t size = taosArrayGetSize(pDelList);
|
||||||
TSDBKEY* prev = taosArrayGet(pDelList, size - 2);
|
TSDBKEY* prev = taosArrayGet(pDelList, size - 2);
|
||||||
if (prev->version >= pKey->version) {
|
if (prev->version >= pKey->version) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -2527,7 +2535,8 @@ TSDBROW* getValidRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pRea
|
||||||
}
|
}
|
||||||
|
|
||||||
// it is a valid data version
|
// it is a valid data version
|
||||||
if ((key.version <= pReader->verRange.maxVer && key.version >= pReader->verRange.minVer) && (!hasBeenDropped(pDelList, &pIter->index, &key))) {
|
if ((key.version <= pReader->verRange.maxVer && key.version >= pReader->verRange.minVer) &&
|
||||||
|
(!hasBeenDropped(pDelList, &pIter->index, &key))) {
|
||||||
return pRow;
|
return pRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2545,13 +2554,14 @@ TSDBROW* getValidRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pRea
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.version <= pReader->verRange.maxVer && key.version >= pReader->verRange.minVer && (!hasBeenDropped(pDelList, &pIter->index, &key))) {
|
if (key.version <= pReader->verRange.maxVer && key.version >= pReader->verRange.minVer &&
|
||||||
|
(!hasBeenDropped(pDelList, &pIter->index, &key))) {
|
||||||
return pRow;
|
return pRow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t doMergeRowsInBuf(SIterInfo *pIter, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader) {
|
int32_t doMergeRowsInBuf(SIterInfo* pIter, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader) {
|
||||||
while (1) {
|
while (1) {
|
||||||
pIter->hasVal = tsdbTbDataIterNext(pIter->iter);
|
pIter->hasVal = tsdbTbDataIterNext(pIter->iter);
|
||||||
if (!pIter->hasVal) {
|
if (!pIter->hasVal) {
|
||||||
|
@ -2685,7 +2695,8 @@ void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo *pIter, SArray* pDelList, STSRow** pTSRow, STsdbReader* pReader) {
|
void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDelList, STSRow** pTSRow,
|
||||||
|
STsdbReader* pReader) {
|
||||||
SRowMerger merge = {0};
|
SRowMerger merge = {0};
|
||||||
|
|
||||||
TSDBKEY k = TSDBROW_KEY(pRow);
|
TSDBKEY k = TSDBROW_KEY(pRow);
|
||||||
|
@ -2728,7 +2739,7 @@ int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pR
|
||||||
int64_t endKey) {
|
int64_t endKey) {
|
||||||
TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader);
|
TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader);
|
||||||
TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader);
|
TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader);
|
||||||
SArray* pDelList = pBlockScanInfo->delSkyline;
|
SArray* pDelList = pBlockScanInfo->delSkyline;
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
bool asc = ASCENDING_TRAVERSE(pReader->order);
|
bool asc = ASCENDING_TRAVERSE(pReader->order);
|
||||||
|
@ -2855,6 +2866,20 @@ int32_t tsdbSetTableId(STsdbReader* pReader, int64_t uid) {
|
||||||
return TDB_CODE_SUCCESS;
|
return TDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* tsdbGetIdx(SMeta* pMeta) {
|
||||||
|
if (pMeta == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return metaGetIdx(pMeta);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* tsdbGetIvtIdx(SMeta* pMeta) {
|
||||||
|
if (pMeta == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return metaGetIvtIdx(pMeta);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get all suids since suid
|
* @brief Get all suids since suid
|
||||||
*
|
*
|
||||||
|
@ -3105,11 +3130,11 @@ void tsdbReaderClose(STsdbReader* pReader) {
|
||||||
taosMemoryFreeClear(pReader->suppInfo.plist);
|
taosMemoryFreeClear(pReader->suppInfo.plist);
|
||||||
taosMemoryFree(pReader->suppInfo.slotIds);
|
taosMemoryFree(pReader->suppInfo.slotIds);
|
||||||
|
|
||||||
if (!isEmptyQueryTimeWindow(&pReader->window)) {
|
if (!isEmptyQueryTimeWindow(&pReader->window)) {
|
||||||
// tsdbMayUnTakeMemSnapshot(pTsdbReadHandle);
|
// tsdbMayUnTakeMemSnapshot(pTsdbReadHandle);
|
||||||
} else {
|
} else {
|
||||||
ASSERT(pReader->status.pTableMap == NULL);
|
ASSERT(pReader->status.pTableMap == NULL);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
// if (pReader->status.pTableScanInfo != NULL) {
|
// if (pReader->status.pTableScanInfo != NULL) {
|
||||||
// pReader->status.pTableScanInfo = destroyTableCheckInfo(pReader->status.pTableScanInfo);
|
// pReader->status.pTableScanInfo = destroyTableCheckInfo(pReader->status.pTableScanInfo);
|
||||||
|
@ -3288,10 +3313,10 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_
|
||||||
|
|
||||||
setQueryTimewindow(pReader, pCond, tWinIdx);
|
setQueryTimewindow(pReader, pCond, tWinIdx);
|
||||||
|
|
||||||
pReader->order = pCond->order;
|
pReader->order = pCond->order;
|
||||||
pReader->type = BLOCK_LOAD_OFFSET_ORDER;
|
pReader->type = BLOCK_LOAD_OFFSET_ORDER;
|
||||||
pReader->status.loadFromFile = true;
|
pReader->status.loadFromFile = true;
|
||||||
pReader->status.pTableIter = NULL;
|
pReader->status.pTableIter = NULL;
|
||||||
|
|
||||||
pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows[tWinIdx]);
|
pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows[tWinIdx]);
|
||||||
|
|
||||||
|
@ -3319,8 +3344,8 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbDebug("%p reset reader, suid:%"PRIu64", numOfTables:%d, query range:%"PRId64" - %"PRId64" in query %s", pReader, pReader->suid,
|
tsdbDebug("%p reset reader, suid:%" PRIu64 ", numOfTables:%d, query range:%" PRId64 " - %" PRId64 " in query %s",
|
||||||
numOfTables, pReader->window.skey, pReader->window.ekey, pReader->idStr);
|
pReader, pReader->suid, numOfTables, pReader->window.skey, pReader->window.ekey, pReader->idStr);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,9 +305,21 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
|
||||||
SNode* pTagIndexCond = (SNode*)pListInfo->pTagIndexCond;
|
SNode* pTagIndexCond = (SNode*)pListInfo->pTagIndexCond;
|
||||||
if (pScanNode->tableType == TSDB_SUPER_TABLE) {
|
if (pScanNode->tableType == TSDB_SUPER_TABLE) {
|
||||||
if (pTagIndexCond) {
|
if (pTagIndexCond) {
|
||||||
SArray* res = taosArrayInit(8, sizeof(uint64_t));
|
///<<<<<<< HEAD
|
||||||
// code = doFilterTag(pTagIndexCond, &metaArg, res);
|
SIndexMetaArg metaArg = {
|
||||||
code = TSDB_CODE_INDEX_REBUILDING;
|
.metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = tsdbGetIvtIdx(metaHandle), .suid = tableUid};
|
||||||
|
|
||||||
|
SArray* res = taosArrayInit(8, sizeof(uint64_t));
|
||||||
|
SIdxFltStatus status = SFLT_NOT_INDEX;
|
||||||
|
code = doFilterTag(pTagIndexCond, &metaArg, res, &status);
|
||||||
|
if (code != 0 || status == SFLT_NOT_INDEX) {
|
||||||
|
code = TSDB_CODE_INDEX_REBUILDING;
|
||||||
|
}
|
||||||
|
//=======
|
||||||
|
// SArray* res = taosArrayInit(8, sizeof(uint64_t));
|
||||||
|
// // code = doFilterTag(pTagIndexCond, &metaArg, res);
|
||||||
|
// code = TSDB_CODE_INDEX_REBUILDING;
|
||||||
|
//>>>>>>> dvv
|
||||||
if (code == TSDB_CODE_INDEX_REBUILDING) {
|
if (code == TSDB_CODE_INDEX_REBUILDING) {
|
||||||
code = vnodeGetAllTableList(pVnode, tableUid, pListInfo->pTableList);
|
code = vnodeGetAllTableList(pVnode, tableUid, pListInfo->pTableList);
|
||||||
} else if (code != TSDB_CODE_SUCCESS) {
|
} else if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
|
|
||||||
MESSAGE(STATUS "build parser unit test")
|
MESSAGE(STATUS "build parser unit test")
|
||||||
|
|
||||||
# GoogleTest requires at least C++11
|
IF(NOT TD_DARWIN)
|
||||||
SET(CMAKE_CXX_STANDARD 11)
|
# GoogleTest requires at least C++11
|
||||||
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
|
SET(CMAKE_CXX_STANDARD 11)
|
||||||
|
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
|
||||||
|
|
||||||
ADD_EXECUTABLE(executorTest ${SOURCE_LIST})
|
ADD_EXECUTABLE(executorTest ${SOURCE_LIST})
|
||||||
TARGET_LINK_LIBRARIES(
|
TARGET_LINK_LIBRARIES(
|
||||||
executorTest
|
executorTest
|
||||||
PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes vnode
|
PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes vnode
|
||||||
)
|
)
|
||||||
|
|
||||||
TARGET_INCLUDE_DIRECTORIES(
|
TARGET_INCLUDE_DIRECTORIES(
|
||||||
executorTest
|
executorTest
|
||||||
PUBLIC "${TD_SOURCE_DIR}/include/libs/executor/"
|
PUBLIC "${TD_SOURCE_DIR}/include/libs/executor/"
|
||||||
PRIVATE "${TD_SOURCE_DIR}/source/libs/executor/inc"
|
PRIVATE "${TD_SOURCE_DIR}/source/libs/executor/inc"
|
||||||
)
|
)
|
||||||
|
ENDIF ()
|
|
@ -75,6 +75,10 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
GetModuleFileName(NULL, path, PATH_MAX);
|
GetModuleFileName(NULL, path, PATH_MAX);
|
||||||
taosDirName(path);
|
taosDirName(path);
|
||||||
|
#elif defined(_TD_DARWIN_64)
|
||||||
|
uint32_t pathSize = sizeof(path);
|
||||||
|
_NSGetExecutablePath(path, &pathSize);
|
||||||
|
taosDirName(path);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
strncpy(path, tsProcPath, strlen(tsProcPath));
|
strncpy(path, tsProcPath, strlen(tsProcPath));
|
||||||
|
|
|
@ -35,7 +35,7 @@ if (${BUILD_WITH_INVERTEDINDEX})
|
||||||
endif(${BUILD_WITH_INVERTEDINDEX})
|
endif(${BUILD_WITH_INVERTEDINDEX})
|
||||||
|
|
||||||
|
|
||||||
# if (${BUILD_TEST})
|
if (${BUILD_TEST})
|
||||||
# add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
# endif(${BUILD_TEST})
|
endif(${BUILD_TEST})
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ typedef struct FstRange {
|
||||||
} FstRange;
|
} FstRange;
|
||||||
|
|
||||||
typedef enum { OneTransNext, OneTrans, AnyTrans, EmptyFinal } State;
|
typedef enum { OneTransNext, OneTrans, AnyTrans, EmptyFinal } State;
|
||||||
typedef enum { Ordered, OutOfOrdered, DuplicateKey } OrderType;
|
typedef enum { Ordered, OutOfOrdered, DuplicateKey } FstOrderType;
|
||||||
|
|
||||||
FstBoundWithData* fstBoundStateCreate(FstBound type, FstSlice* data);
|
FstBoundWithData* fstBoundStateCreate(FstBound type, FstSlice* data);
|
||||||
bool fstBoundWithDataExceededBy(FstBoundWithData* bound, FstSlice* slice);
|
bool fstBoundWithDataExceededBy(FstBoundWithData* bound, FstSlice* slice);
|
||||||
|
@ -106,7 +106,7 @@ bool fstBuilderInsert(FstBuilder* b, FstSlice bs, Output in);
|
||||||
void fstBuilderCompileFrom(FstBuilder* b, uint64_t istate);
|
void fstBuilderCompileFrom(FstBuilder* b, uint64_t istate);
|
||||||
void* fstBuilerIntoInner(FstBuilder* b);
|
void* fstBuilerIntoInner(FstBuilder* b);
|
||||||
void fstBuilderFinish(FstBuilder* b);
|
void fstBuilderFinish(FstBuilder* b);
|
||||||
OrderType fstBuilderCheckLastKey(FstBuilder* b, FstSlice bs, bool ckDup);
|
FstOrderType fstBuilderCheckLastKey(FstBuilder* b, FstSlice bs, bool ckDup);
|
||||||
CompiledAddr fstBuilderCompile(FstBuilder* b, FstBuilderNode* bn);
|
CompiledAddr fstBuilderCompile(FstBuilder* b, FstBuilderNode* bn);
|
||||||
|
|
||||||
typedef struct FstTransitions {
|
typedef struct FstTransitions {
|
||||||
|
@ -213,14 +213,18 @@ typedef struct FstNode {
|
||||||
// If this node is final and has a terminal output value, then it is, returned.
|
// If this node is final and has a terminal output value, then it is, returned.
|
||||||
// Otherwise, a zero output is returned
|
// Otherwise, a zero output is returned
|
||||||
#define FST_NODE_FINAL_OUTPUT(node) node->finalOutput
|
#define FST_NODE_FINAL_OUTPUT(node) node->finalOutput
|
||||||
|
|
||||||
// Returns true if and only if this node corresponds to a final or "match",
|
// Returns true if and only if this node corresponds to a final or "match",
|
||||||
// state in the finite state transducer.
|
// state in the finite state transducer.
|
||||||
#define FST_NODE_IS_FINAL(node) node->isFinal
|
#define FST_NODE_IS_FINAL(node) node->isFinal
|
||||||
|
|
||||||
// Returns the number of transitions in this node, The maximum number of
|
// Returns the number of transitions in this node, The maximum number of
|
||||||
// transitions is 256.
|
// transitions is 256.
|
||||||
#define FST_NODE_LEN(node) node->nTrans
|
#define FST_NODE_LEN(node) node->nTrans
|
||||||
|
|
||||||
// Returns true if and only if this node has zero transitions.
|
// Returns true if and only if this node has zero transitions.
|
||||||
#define FST_NODE_IS_EMPTYE(node) (node->nTrans == 0)
|
#define FST_NODE_IS_EMPTYE(node) (node->nTrans == 0)
|
||||||
|
|
||||||
// Return the address of this node.
|
// Return the address of this node.
|
||||||
#define FST_NODE_ADDR(node) node->start
|
#define FST_NODE_ADDR(node) node->start
|
||||||
|
|
||||||
|
@ -277,6 +281,8 @@ FStmBuilder* fstSearch(Fst* fst, FAutoCtx* ctx);
|
||||||
|
|
||||||
FStmStBuilder* fstSearchWithState(Fst* fst, FAutoCtx* ctx);
|
FStmStBuilder* fstSearchWithState(Fst* fst, FAutoCtx* ctx);
|
||||||
// into stream to expand later
|
// into stream to expand later
|
||||||
|
//
|
||||||
|
|
||||||
FStmSt* stmBuilderIntoStm(FStmBuilder* sb);
|
FStmSt* stmBuilderIntoStm(FStmBuilder* sb);
|
||||||
|
|
||||||
bool fstVerify(Fst* fst);
|
bool fstVerify(Fst* fst);
|
||||||
|
@ -325,7 +331,8 @@ FStmBuilder* stmBuilderCreate(Fst* fst, FAutoCtx* aut);
|
||||||
void stmBuilderDestroy(FStmBuilder* b);
|
void stmBuilderDestroy(FStmBuilder* b);
|
||||||
|
|
||||||
// set up bound range
|
// set up bound range
|
||||||
// refator later: to simple code by marco
|
// refator later
|
||||||
|
// simple code by marco
|
||||||
void stmBuilderSetRange(FStmBuilder* b, FstSlice* val, RangeType type);
|
void stmBuilderSetRange(FStmBuilder* b, FstSlice* val, RangeType type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -45,6 +45,7 @@ extern "C" {
|
||||||
|
|
||||||
typedef enum { LT, LE, GT, GE, CONTAINS, EQ } RangeType;
|
typedef enum { LT, LE, GT, GE, CONTAINS, EQ } RangeType;
|
||||||
typedef enum { kTypeValue, kTypeDeletion } STermValueType;
|
typedef enum { kTypeValue, kTypeDeletion } STermValueType;
|
||||||
|
typedef enum { kRebuild, kFinished } SIdxStatus;
|
||||||
|
|
||||||
typedef struct SIndexStat {
|
typedef struct SIndexStat {
|
||||||
int32_t totalAdded; //
|
int32_t totalAdded; //
|
||||||
|
@ -65,6 +66,7 @@ struct SIndex {
|
||||||
|
|
||||||
char* path;
|
char* path;
|
||||||
|
|
||||||
|
int8_t status;
|
||||||
SIndexStat stat;
|
SIndexStat stat;
|
||||||
TdThreadMutex mtx;
|
TdThreadMutex mtx;
|
||||||
tsem_t sem;
|
tsem_t sem;
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void indexDestroy(void* sIdx);
|
||||||
void indexInit() {
|
void indexInit() {
|
||||||
// refactor later
|
// refactor later
|
||||||
indexQhandle = taosInitScheduler(INDEX_QUEUE_SIZE, INDEX_NUM_OF_THREADS, "index");
|
indexQhandle = taosInitScheduler(INDEX_QUEUE_SIZE, INDEX_NUM_OF_THREADS, "index");
|
||||||
indexRefMgt = taosOpenRef(10, indexDestroy);
|
indexRefMgt = taosOpenRef(1000, indexDestroy);
|
||||||
}
|
}
|
||||||
void indexCleanup() {
|
void indexCleanup() {
|
||||||
// refacto later
|
// refacto later
|
||||||
|
@ -101,15 +101,16 @@ static void indexWait(void* idx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
|
int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
|
||||||
|
int ret = TSDB_CODE_SUCCESS;
|
||||||
taosThreadOnce(&isInit, indexInit);
|
taosThreadOnce(&isInit, indexInit);
|
||||||
SIndex* sIdx = taosMemoryCalloc(1, sizeof(SIndex));
|
SIndex* sIdx = taosMemoryCalloc(1, sizeof(SIndex));
|
||||||
if (sIdx == NULL) {
|
if (sIdx == NULL) {
|
||||||
return -1;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sIdx->cache = (void*)idxCacheCreate(sIdx);
|
|
||||||
sIdx->tindex = idxTFileCreate(path);
|
sIdx->tindex = idxTFileCreate(path);
|
||||||
if (sIdx->tindex == NULL) {
|
if (sIdx->tindex == NULL) {
|
||||||
|
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,14 +124,14 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
|
||||||
idxAcquireRef(sIdx->refId);
|
idxAcquireRef(sIdx->refId);
|
||||||
|
|
||||||
*index = sIdx;
|
*index = sIdx;
|
||||||
return 0;
|
return ret;
|
||||||
|
|
||||||
END:
|
END:
|
||||||
if (sIdx != NULL) {
|
if (sIdx != NULL) {
|
||||||
indexClose(sIdx);
|
indexClose(sIdx);
|
||||||
}
|
}
|
||||||
*index = NULL;
|
*index = NULL;
|
||||||
return -1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void indexDestroy(void* handle) {
|
void indexDestroy(void* handle) {
|
||||||
|
@ -231,7 +232,7 @@ int indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* result
|
||||||
}
|
}
|
||||||
|
|
||||||
int indexDelete(SIndex* index, SIndexMultiTermQuery* query) { return 1; }
|
int indexDelete(SIndex* index, SIndexMultiTermQuery* query) { return 1; }
|
||||||
int indexRebuild(SIndex* index, SIndexOpts* opts) { return 0; }
|
// int indexRebuild(SIndex* index, SIndexOpts* opts) { return 0; }
|
||||||
|
|
||||||
SIndexOpts* indexOptsCreate() { return NULL; }
|
SIndexOpts* indexOptsCreate() { return NULL; }
|
||||||
void indexOptsDestroy(SIndexOpts* opts) { return; }
|
void indexOptsDestroy(SIndexOpts* opts) { return; }
|
||||||
|
@ -273,33 +274,28 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
|
||||||
tm->operType = oper;
|
tm->operType = oper;
|
||||||
tm->colType = colType;
|
tm->colType = colType;
|
||||||
|
|
||||||
#if 0
|
|
||||||
tm->colName = (char*)taosMemoryCalloc(1, nColName + 1);
|
|
||||||
memcpy(tm->colName, colName, nColName);
|
|
||||||
tm->nColName = nColName;
|
|
||||||
|
|
||||||
tm->colVal = (char*)taosMemoryCalloc(1, nColVal + 1);
|
|
||||||
memcpy(tm->colVal, colVal, nColVal);
|
|
||||||
tm->nColVal = nColVal;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
tm->colName = (char*)taosMemoryCalloc(1, nColName + 1);
|
tm->colName = (char*)taosMemoryCalloc(1, nColName + 1);
|
||||||
memcpy(tm->colName, colName, nColName);
|
memcpy(tm->colName, colName, nColName);
|
||||||
tm->nColName = nColName;
|
tm->nColName = nColName;
|
||||||
|
|
||||||
char* buf = NULL;
|
char* buf = NULL;
|
||||||
int32_t len = idxConvertDataToStr((void*)colVal, IDX_TYPE_GET_TYPE(colType), (void**)&buf);
|
int32_t len = 0;
|
||||||
assert(len != -1);
|
if (colVal != NULL && nColVal != 0) {
|
||||||
|
len = idxConvertDataToStr((void*)colVal, IDX_TYPE_GET_TYPE(colType), (void**)&buf);
|
||||||
|
} else if (colVal == NULL) {
|
||||||
|
buf = strndup(INDEX_DATA_NULL_STR, (int32_t)strlen(INDEX_DATA_NULL_STR));
|
||||||
|
len = (int32_t)strlen(INDEX_DATA_NULL_STR);
|
||||||
|
} else {
|
||||||
|
const char* emptyStr = " ";
|
||||||
|
buf = strndup(emptyStr, (int32_t)strlen(emptyStr));
|
||||||
|
len = (int32_t)strlen(emptyStr);
|
||||||
|
}
|
||||||
tm->colVal = buf;
|
tm->colVal = buf;
|
||||||
tm->nColVal = len;
|
tm->nColVal = len;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return tm;
|
return tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void indexTermDestroy(SIndexTerm* p) {
|
void indexTermDestroy(SIndexTerm* p) {
|
||||||
taosMemoryFree(p->colName);
|
taosMemoryFree(p->colName);
|
||||||
taosMemoryFree(p->colVal);
|
taosMemoryFree(p->colVal);
|
||||||
|
@ -320,6 +316,54 @@ void indexMultiTermDestroy(SIndexMultiTerm* terms) {
|
||||||
taosArrayDestroy(terms);
|
taosArrayDestroy(terms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rebuild index
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void idxSchedRebuildIdx(SSchedMsg* msg) {
|
||||||
|
// TODO, no need rebuild index
|
||||||
|
SIndex* idx = msg->ahandle;
|
||||||
|
|
||||||
|
int8_t st = kFinished;
|
||||||
|
atomic_store_8(&idx->status, st);
|
||||||
|
idxReleaseRef(idx->refId);
|
||||||
|
}
|
||||||
|
void indexRebuild(SIndexJson* idx, void* iter) {
|
||||||
|
// set up rebuild status
|
||||||
|
int8_t st = kRebuild;
|
||||||
|
atomic_store_8(&idx->status, st);
|
||||||
|
|
||||||
|
// task put into BG thread
|
||||||
|
SSchedMsg schedMsg = {0};
|
||||||
|
schedMsg.fp = idxSchedRebuildIdx;
|
||||||
|
schedMsg.ahandle = idx;
|
||||||
|
idxAcquireRef(idx->refId);
|
||||||
|
taosScheduleTask(indexQhandle, &schedMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check index json status
|
||||||
|
**/
|
||||||
|
bool indexIsRebuild(SIndex* idx) {
|
||||||
|
// idx rebuild or not
|
||||||
|
return ((SIdxStatus)atomic_load_8(&idx->status)) == kRebuild ? true : false;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* rebuild index
|
||||||
|
*/
|
||||||
|
void indexJsonRebuild(SIndexJson* idx, void* iter) {
|
||||||
|
// idx rebuild or not
|
||||||
|
indexRebuild(idx, iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check index json status
|
||||||
|
**/
|
||||||
|
bool indexJsonIsRebuild(SIndexJson* idx) {
|
||||||
|
// load idx rebuild or not
|
||||||
|
return ((SIdxStatus)atomic_load_8(&idx->status)) == kRebuild ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
static int idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result) {
|
static int idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result) {
|
||||||
SIndexTerm* term = query->term;
|
SIndexTerm* term = query->term;
|
||||||
const char* colName = term->colName;
|
const char* colName = term->colName;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#define INDEX_DATA_BIGINT_NULL 0x8000000000000000LL
|
#define INDEX_DATA_BIGINT_NULL 0x8000000000000000LL
|
||||||
#define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL
|
#define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL
|
||||||
|
|
||||||
#define INDEX_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN
|
#define INDEX_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN
|
||||||
#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN
|
#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN
|
||||||
#define INDEX_DATA_NCHAR_NULL 0xFFFFFFFF
|
#define INDEX_DATA_NCHAR_NULL 0xFFFFFFFF
|
||||||
#define INDEX_DATA_BINARY_NULL 0xFF
|
#define INDEX_DATA_BINARY_NULL 0xFF
|
||||||
|
@ -374,6 +374,10 @@ int32_t idxConvertData(void* src, int8_t type, void** dst) {
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
||||||
|
if (src == NULL) {
|
||||||
|
*dst = strndup(INDEX_DATA_NULL_STR, (int)strlen(INDEX_DATA_NULL_STR));
|
||||||
|
return (int32_t)strlen(INDEX_DATA_NULL_STR);
|
||||||
|
}
|
||||||
int tlen = tDataTypes[type].bytes;
|
int tlen = tDataTypes[type].bytes;
|
||||||
int32_t bufSize = 64;
|
int32_t bufSize = 64;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -181,11 +181,9 @@ static int32_t sifInitJsonParam(SNode *node, SIFParam *param, SIFCtx *ctx) {
|
||||||
param->colValType = l->node.resType.type;
|
param->colValType = l->node.resType.type;
|
||||||
memcpy(param->dbName, l->dbName, sizeof(l->dbName));
|
memcpy(param->dbName, l->dbName, sizeof(l->dbName));
|
||||||
memcpy(param->colName, r->literal, strlen(r->literal));
|
memcpy(param->colName, r->literal, strlen(r->literal));
|
||||||
// sprintf(param->colName, "%s_%s", l->colName, r->literal);
|
|
||||||
param->colValType = r->typeData;
|
param->colValType = r->typeData;
|
||||||
param->status = SFLT_COARSE_INDEX;
|
param->status = SFLT_COARSE_INDEX;
|
||||||
return 0;
|
return 0;
|
||||||
// memcpy(param->colName, l->colName, sizeof(l->colName));
|
|
||||||
}
|
}
|
||||||
static int32_t sifInitParam(SNode *node, SIFParam *param, SIFCtx *ctx) {
|
static int32_t sifInitParam(SNode *node, SIFParam *param, SIFCtx *ctx) {
|
||||||
param->status = SFLT_COARSE_INDEX;
|
param->status = SFLT_COARSE_INDEX;
|
||||||
|
@ -274,6 +272,10 @@ static int32_t sifInitOperParams(SIFParam **params, SOperatorNode *node, SIFCtx
|
||||||
SIF_ERR_JRET(sifInitParam(node->pLeft, ¶mList[0], ctx));
|
SIF_ERR_JRET(sifInitParam(node->pLeft, ¶mList[0], ctx));
|
||||||
if (nParam > 1) {
|
if (nParam > 1) {
|
||||||
SIF_ERR_JRET(sifInitParam(node->pRight, ¶mList[1], ctx));
|
SIF_ERR_JRET(sifInitParam(node->pRight, ¶mList[1], ctx));
|
||||||
|
// if (paramList[0].colValType == TSDB_DATA_TYPE_JSON &&
|
||||||
|
// ((SOperatorNode *)(node))->opType == OP_TYPE_JSON_CONTAINS) {
|
||||||
|
// return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
*params = paramList;
|
*params = paramList;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -511,11 +513,12 @@ static int32_t sifGetOperFn(int32_t funcId, sif_func_t *func, SIdxFltStatus *sta
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// typedef struct filterFuncDict {
|
|
||||||
|
|
||||||
static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
|
static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
if (sifValidOp(node->opType) < 0) {
|
if (sifValidOp(node->opType) < 0) {
|
||||||
|
code = TSDB_CODE_QRY_INVALID_INPUT;
|
||||||
|
ctx->code = code;
|
||||||
output->status = SFLT_NOT_INDEX;
|
output->status = SFLT_NOT_INDEX;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -532,7 +535,7 @@ static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
|
||||||
SIFParam *params = NULL;
|
SIFParam *params = NULL;
|
||||||
SIF_ERR_RET(sifInitOperParams(¶ms, node, ctx));
|
SIF_ERR_RET(sifInitOperParams(¶ms, node, ctx));
|
||||||
|
|
||||||
if (params[0].status == SFLT_NOT_INDEX || (nParam > 1 && params[1].status == SFLT_NOT_INDEX)) {
|
if (params[0].status == SFLT_NOT_INDEX && (nParam > 1 && params[1].status == SFLT_NOT_INDEX)) {
|
||||||
output->status = SFLT_NOT_INDEX;
|
output->status = SFLT_NOT_INDEX;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -737,23 +740,23 @@ static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status) {
|
||||||
SIF_RET(code);
|
SIF_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t doFilterTag(const SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result) {
|
int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result, SIdxFltStatus *status) {
|
||||||
if (pFilterNode == NULL) {
|
SIdxFltStatus st = idxGetFltStatus(pFilterNode);
|
||||||
return TSDB_CODE_SUCCESS;
|
if (st == SFLT_NOT_INDEX) {
|
||||||
|
*status = st;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SFilterInfo *filter = NULL;
|
SFilterInfo *filter = NULL;
|
||||||
// todo move to the initialization function
|
|
||||||
// SIF_ERR_RET(filterInitFromNode((SNode *)pFilterNode, &filter, 0));
|
|
||||||
|
|
||||||
SArray * output = taosArrayInit(8, sizeof(uint64_t));
|
SArray * output = taosArrayInit(8, sizeof(uint64_t));
|
||||||
SIFParam param = {.arg = *metaArg, .result = output};
|
SIFParam param = {.arg = *metaArg, .result = output};
|
||||||
SIF_ERR_RET(sifCalculate((SNode *)pFilterNode, ¶m));
|
SIF_ERR_RET(sifCalculate((SNode *)pFilterNode, ¶m));
|
||||||
|
|
||||||
taosArrayAddAll(result, param.result);
|
taosArrayAddAll(result, param.result);
|
||||||
// taosArrayAddAll(result, param.result);
|
|
||||||
sifFreeParam(¶m);
|
sifFreeParam(¶m);
|
||||||
SIF_RET(TSDB_CODE_SUCCESS);
|
*status = st;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SIdxFltStatus idxGetFltStatus(SNode *pFilterNode) {
|
SIdxFltStatus idxGetFltStatus(SNode *pFilterNode) {
|
||||||
|
@ -761,10 +764,9 @@ SIdxFltStatus idxGetFltStatus(SNode *pFilterNode) {
|
||||||
if (pFilterNode == NULL) {
|
if (pFilterNode == NULL) {
|
||||||
return SFLT_NOT_INDEX;
|
return SFLT_NOT_INDEX;
|
||||||
}
|
}
|
||||||
// SFilterInfo *filter = NULL;
|
|
||||||
// todo move to the initialization function
|
|
||||||
// SIF_ERR_RET(filterInitFromNode((SNode *)pFilterNode, &filter, 0));
|
|
||||||
|
|
||||||
SIF_ERR_RET(sifGetFltHint((SNode *)pFilterNode, &st));
|
if (sifGetFltHint((SNode *)pFilterNode, &st) != TSDB_CODE_SUCCESS) {
|
||||||
|
st = SFLT_NOT_INDEX;
|
||||||
|
}
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,22 +289,14 @@ void fstStateCompileForAnyTrans(IdxFstFile* w, CompiledAddr addr, FstBuilderNode
|
||||||
for (int32_t i = sz - 1; i >= 0; i--) {
|
for (int32_t i = sz - 1; i >= 0; i--) {
|
||||||
FstTransition* t = taosArrayGet(node->trans, i);
|
FstTransition* t = taosArrayGet(node->trans, i);
|
||||||
idxFileWrite(w, (char*)&t->inp, 1);
|
idxFileWrite(w, (char*)&t->inp, 1);
|
||||||
// fstPackDeltaIn(w, addr, t->addr, tSize);
|
|
||||||
}
|
}
|
||||||
if (sz > TRANS_INDEX_THRESHOLD) {
|
if (sz > TRANS_INDEX_THRESHOLD) {
|
||||||
// A value of 255 indicates that no transition exists for the byte
|
// A value of 255 indicates that no transition exists for the byte at that idx
|
||||||
// at that index. (Except when there are 256 transitions.) Namely,
|
|
||||||
// any value greater than or equal to the number of transitions in
|
|
||||||
// this node indicates an absent transition.
|
|
||||||
uint8_t* index = (uint8_t*)taosMemoryMalloc(sizeof(uint8_t) * 256);
|
uint8_t* index = (uint8_t*)taosMemoryMalloc(sizeof(uint8_t) * 256);
|
||||||
memset(index, 255, sizeof(uint8_t) * 256);
|
memset(index, 255, sizeof(uint8_t) * 256);
|
||||||
/// for (uint8_t i = 0; i < 256; i++) {
|
|
||||||
// index[i] = 255;
|
|
||||||
///}
|
|
||||||
for (int32_t i = 0; i < sz; i++) {
|
for (int32_t i = 0; i < sz; i++) {
|
||||||
FstTransition* t = taosArrayGet(node->trans, i);
|
FstTransition* t = taosArrayGet(node->trans, i);
|
||||||
index[t->inp] = i;
|
index[t->inp] = i;
|
||||||
// fstPackDeltaIn(w, addr, t->addr, tSize);
|
|
||||||
}
|
}
|
||||||
idxFileWrite(w, (char*)index, 256);
|
idxFileWrite(w, (char*)index, 256);
|
||||||
taosMemoryFree(index);
|
taosMemoryFree(index);
|
||||||
|
@ -344,7 +336,7 @@ uint8_t fstStateCommInput(FstState* s, bool* null) {
|
||||||
*null = true;
|
*null = true;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
// v = 0 indicate that common_input is None
|
// 0 indicate that common_input is None
|
||||||
return v == 0 ? 0 : COMMON_INPUT(v);
|
return v == 0 ? 0 : COMMON_INPUT(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +514,6 @@ uint64_t fstStateNtrans(FstState* s, FstSlice* slice) {
|
||||||
int32_t len;
|
int32_t len;
|
||||||
uint8_t* data = fstSliceData(slice, &len);
|
uint8_t* data = fstSliceData(slice, &len);
|
||||||
n = data[len - 2];
|
n = data[len - 2];
|
||||||
// n = data[slice->end - 1]; // data[data.len() - 2]
|
|
||||||
return n == 1 ? 256 : n; // // "1" is never a normal legal value here, because if there, // is only 1 transition,
|
return n == 1 ? 256 : n; // // "1" is never a normal legal value here, because if there, // is only 1 transition,
|
||||||
// then it is encoded in the state byte
|
// then it is encoded in the state byte
|
||||||
}
|
}
|
||||||
|
@ -546,7 +537,6 @@ uint64_t fstStateFindInput(FstState* s, FstNode* node, uint8_t b, bool* null) {
|
||||||
int32_t dlen = 0;
|
int32_t dlen = 0;
|
||||||
uint8_t* data = fstSliceData(slice, &dlen);
|
uint8_t* data = fstSliceData(slice, &dlen);
|
||||||
uint64_t i = data[at + b];
|
uint64_t i = data[at + b];
|
||||||
// uint64_t i = slice->data[slice->start + at + b];
|
|
||||||
if (i >= node->nTrans) {
|
if (i >= node->nTrans) {
|
||||||
*null = true;
|
*null = true;
|
||||||
}
|
}
|
||||||
|
@ -558,16 +548,15 @@ uint64_t fstStateFindInput(FstState* s, FstNode* node, uint8_t b, bool* null) {
|
||||||
FstSlice t = fstSliceCopy(slice, start, end - 1);
|
FstSlice t = fstSliceCopy(slice, start, end - 1);
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
uint8_t* data = fstSliceData(&t, &len);
|
uint8_t* data = fstSliceData(&t, &len);
|
||||||
int i = 0;
|
for (int i = 0; i < len; i++) {
|
||||||
for (; i < len; i++) {
|
|
||||||
uint8_t v = data[i];
|
uint8_t v = data[i];
|
||||||
if (v == b) {
|
if (v == b) {
|
||||||
fstSliceDestroy(&t);
|
fstSliceDestroy(&t);
|
||||||
return node->nTrans - i - 1; // bug
|
return node->nTrans - i - 1; // bug
|
||||||
}
|
}
|
||||||
}
|
if (i + 1 == len) {
|
||||||
if (i == len) {
|
*null = true;
|
||||||
*null = true;
|
}
|
||||||
}
|
}
|
||||||
fstSliceDestroy(&t);
|
fstSliceDestroy(&t);
|
||||||
}
|
}
|
||||||
|
@ -737,16 +726,13 @@ bool fstNodeCompile(FstNode* node, void* w, CompiledAddr lastAddr, CompiledAddr
|
||||||
return true;
|
return true;
|
||||||
} else if (sz != 1 || builderNode->isFinal) {
|
} else if (sz != 1 || builderNode->isFinal) {
|
||||||
fstStateCompileForAnyTrans(w, addr, builderNode);
|
fstStateCompileForAnyTrans(w, addr, builderNode);
|
||||||
// AnyTrans->Compile(w, addr, node);
|
|
||||||
} else {
|
} else {
|
||||||
FstTransition* tran = taosArrayGet(builderNode->trans, 0);
|
FstTransition* tran = taosArrayGet(builderNode->trans, 0);
|
||||||
if (tran->addr == lastAddr && tran->out == 0) {
|
if (tran->addr == lastAddr && tran->out == 0) {
|
||||||
fstStateCompileForOneTransNext(w, addr, tran->inp);
|
fstStateCompileForOneTransNext(w, addr, tran->inp);
|
||||||
// OneTransNext::compile(w, lastAddr, tran->inp);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
fstStateCompileForOneTrans(w, addr, tran);
|
fstStateCompileForOneTrans(w, addr, tran);
|
||||||
// OneTrans::Compile(w, lastAddr, *tran);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -795,7 +781,7 @@ void fstBuilderDestroy(FstBuilder* b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fstBuilderInsert(FstBuilder* b, FstSlice bs, Output in) {
|
bool fstBuilderInsert(FstBuilder* b, FstSlice bs, Output in) {
|
||||||
OrderType t = fstBuilderCheckLastKey(b, bs, true);
|
FstOrderType t = fstBuilderCheckLastKey(b, bs, true);
|
||||||
if (t == Ordered) {
|
if (t == Ordered) {
|
||||||
// add log info
|
// add log info
|
||||||
fstBuilderInsertOutput(b, bs, in);
|
fstBuilderInsertOutput(b, bs, in);
|
||||||
|
@ -812,12 +798,6 @@ void fstBuilderInsertOutput(FstBuilder* b, FstSlice bs, Output in) {
|
||||||
fstUnFinishedNodesSetRootOutput(b->unfinished, in);
|
fstUnFinishedNodesSetRootOutput(b->unfinished, in);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (in != 0) { //if let Some(in) = in
|
|
||||||
// prefixLen = fstUnFinishedNodesFindCommPrefixAndSetOutput(b->unfinished, bs, in, &out);
|
|
||||||
//} else {
|
|
||||||
// prefixLen = fstUnFinishedNodesFindCommPrefix(b->unfinished, bs);
|
|
||||||
// out = 0;
|
|
||||||
//}
|
|
||||||
Output out;
|
Output out;
|
||||||
uint64_t prefixLen = fstUnFinishedNodesFindCommPrefixAndSetOutput(b->unfinished, bs, in, &out);
|
uint64_t prefixLen = fstUnFinishedNodesFindCommPrefixAndSetOutput(b->unfinished, bs, in, &out);
|
||||||
|
|
||||||
|
@ -835,7 +815,7 @@ void fstBuilderInsertOutput(FstBuilder* b, FstSlice bs, Output in) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OrderType fstBuilderCheckLastKey(FstBuilder* b, FstSlice bs, bool ckDup) {
|
FstOrderType fstBuilderCheckLastKey(FstBuilder* b, FstSlice bs, bool ckDup) {
|
||||||
FstSlice* input = &bs;
|
FstSlice* input = &bs;
|
||||||
if (fstSliceIsEmpty(&b->last)) {
|
if (fstSliceIsEmpty(&b->last)) {
|
||||||
fstSliceDestroy(&b->last);
|
fstSliceDestroy(&b->last);
|
||||||
|
@ -867,7 +847,6 @@ void fstBuilderCompileFrom(FstBuilder* b, uint64_t istate) {
|
||||||
|
|
||||||
fstBuilderNodeDestroy(bn);
|
fstBuilderNodeDestroy(bn);
|
||||||
assert(addr != NONE_ADDRESS);
|
assert(addr != NONE_ADDRESS);
|
||||||
// fstBuilderNodeDestroy(n);
|
|
||||||
}
|
}
|
||||||
fstUnFinishedNodesTopLastFreeze(b->unfinished, addr);
|
fstUnFinishedNodesTopLastFreeze(b->unfinished, addr);
|
||||||
return;
|
return;
|
||||||
|
@ -1044,8 +1023,6 @@ void fstDestroy(Fst* fst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
||||||
// dec lock range
|
|
||||||
// taosThreadMutexLock(&fst->mtx);
|
|
||||||
FstNode* root = fstGetRoot(fst);
|
FstNode* root = fstGetRoot(fst);
|
||||||
Output tOut = 0;
|
Output tOut = 0;
|
||||||
int32_t len;
|
int32_t len;
|
||||||
|
@ -1058,7 +1035,6 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
||||||
uint8_t inp = data[i];
|
uint8_t inp = data[i];
|
||||||
Output res = 0;
|
Output res = 0;
|
||||||
if (false == fstNodeFindInput(root, inp, &res)) {
|
if (false == fstNodeFindInput(root, inp, &res)) {
|
||||||
// taosThreadMutexUnlock(&fst->mtx);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,7 +1045,6 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
||||||
taosArrayPush(nodes, &root);
|
taosArrayPush(nodes, &root);
|
||||||
}
|
}
|
||||||
if (!FST_NODE_IS_FINAL(root)) {
|
if (!FST_NODE_IS_FINAL(root)) {
|
||||||
// taosThreadMutexUnlock(&fst->mtx);
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
tOut = tOut + FST_NODE_FINAL_OUTPUT(root);
|
tOut = tOut + FST_NODE_FINAL_OUTPUT(root);
|
||||||
|
@ -1080,8 +1055,6 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
||||||
fstNodeDestroy(*node);
|
fstNodeDestroy(*node);
|
||||||
}
|
}
|
||||||
taosArrayDestroy(nodes);
|
taosArrayDestroy(nodes);
|
||||||
// fst->root = NULL;
|
|
||||||
// taosThreadMutexUnlock(&fst->mtx);
|
|
||||||
*out = tOut;
|
*out = tOut;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1231,20 +1204,17 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
||||||
|
|
||||||
FstNode* node = fstGetRoot(sws->fst);
|
FstNode* node = fstGetRoot(sws->fst);
|
||||||
Output out = 0;
|
Output out = 0;
|
||||||
// void* autState = sws->aut->start();
|
void* autState = automFuncs[aut->type].start(aut);
|
||||||
void* autState = automFuncs[aut->type].start(aut);
|
|
||||||
|
|
||||||
int32_t len;
|
int32_t len;
|
||||||
uint8_t* data = fstSliceData(key, &len);
|
uint8_t* data = fstSliceData(key, &len);
|
||||||
for (uint32_t i = 0; i < len; i++) {
|
for (uint32_t i = 0; i < len; i++) {
|
||||||
uint8_t b = data[i];
|
uint8_t b = data[i];
|
||||||
uint64_t res = 0;
|
uint64_t res = 0;
|
||||||
bool find = fstNodeFindInput(node, b, &res);
|
if (fstNodeFindInput(node, b, &res)) {
|
||||||
if (find == true) {
|
|
||||||
FstTransition trn;
|
FstTransition trn;
|
||||||
fstNodeGetTransitionAt(node, res, &trn);
|
fstNodeGetTransitionAt(node, res, &trn);
|
||||||
void* preState = autState;
|
void* preState = autState;
|
||||||
// autState = sws->aut->accept(preState, b);
|
|
||||||
autState = automFuncs[aut->type].accept(aut, preState, b);
|
autState = automFuncs[aut->type].accept(aut, preState, b);
|
||||||
taosArrayPush(sws->inp, &b);
|
taosArrayPush(sws->inp, &b);
|
||||||
|
|
||||||
|
@ -1379,14 +1349,14 @@ FStmStRslt* stmStNextWith(FStmSt* sws, StreamCallback callback) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FStmStRslt* swsResultCreate(FstSlice* data, FstOutput fOut, void* state) {
|
FStmStRslt* swsResultCreate(FstSlice* data, FstOutput out, void* state) {
|
||||||
FStmStRslt* result = taosMemoryCalloc(1, sizeof(FStmStRslt));
|
FStmStRslt* result = taosMemoryCalloc(1, sizeof(FStmStRslt));
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result->data = fstSliceCopy(data, 0, FST_SLICE_LEN(data) - 1);
|
result->data = fstSliceCopy(data, 0, FST_SLICE_LEN(data) - 1);
|
||||||
result->out = fOut;
|
result->out = out;
|
||||||
result->state = state;
|
result->state = state;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,7 @@ static int idxFileCtxGetSize(IFileCtx* ctx) {
|
||||||
}
|
}
|
||||||
static int idxFileCtxDoFlush(IFileCtx* ctx) {
|
static int idxFileCtxDoFlush(IFileCtx* ctx) {
|
||||||
if (ctx->type == TFile) {
|
if (ctx->type == TFile) {
|
||||||
// taosFsyncFile(ctx->file.pFile);
|
|
||||||
taosFsyncFile(ctx->file.pFile);
|
taosFsyncFile(ctx->file.pFile);
|
||||||
// tfFlush(ctx->file.pFile);
|
|
||||||
} else {
|
} else {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
@ -190,13 +188,11 @@ int idxFileRead(IdxFstFile* write, uint8_t* buf, uint32_t len) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
IFileCtx* ctx = write->wrt;
|
IFileCtx* ctx = write->wrt;
|
||||||
int nRead = ctx->read(ctx, buf, len);
|
return ctx->read(ctx, buf, len);
|
||||||
// assert(nRead == len);
|
|
||||||
return nRead;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t idxFileMaskedCheckSum(IdxFstFile* write) {
|
uint32_t idxFileMaskedCheckSum(IdxFstFile* write) {
|
||||||
// opt
|
//////
|
||||||
return write->summer;
|
return write->summer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ const CompiledAddr EMPTY_ADDRESS = 0;
|
||||||
const CompiledAddr NONE_ADDRESS = 1;
|
const CompiledAddr NONE_ADDRESS = 1;
|
||||||
|
|
||||||
// This version number is written to every finite state transducer created by
|
// This version number is written to every finite state transducer created by
|
||||||
// this crate. When a finite state transducer is read, its version number is
|
// this version. When a finite state transducer is read, its version number is
|
||||||
// checked against this value.
|
// checked against this value.
|
||||||
const uint64_t VERSION = 3;
|
const uint64_t VERSION = 3;
|
||||||
|
|
||||||
// The threshold (in number of transitions) at which an index is created for
|
// The threshold (in number of transitions) at which an index is created for
|
||||||
// a node's transitions. This speeds up lookup time at the expense of FST size
|
// a node's transitions. This speeds up lookup time at the expense of FST size
|
||||||
|
|
||||||
const uint64_t TRANS_INDEX_THRESHOLD = 32;
|
const uint64_t TRANS_INDEX_THRESHOLD = 32;
|
||||||
|
|
||||||
uint8_t packSize(uint64_t n) {
|
uint8_t packSize(uint64_t n) {
|
||||||
|
@ -52,7 +52,6 @@ uint8_t packSize(uint64_t n) {
|
||||||
uint64_t unpackUint64(uint8_t* ch, uint8_t sz) {
|
uint64_t unpackUint64(uint8_t* ch, uint8_t sz) {
|
||||||
uint64_t n = 0;
|
uint64_t n = 0;
|
||||||
for (uint8_t i = 0; i < sz; i++) {
|
for (uint8_t i = 0; i < sz; i++) {
|
||||||
//
|
|
||||||
n = n | (ch[i] << (8 * i));
|
n = n | (ch[i] << (8 * i));
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "tcoding.h"
|
#include "tcoding.h"
|
||||||
#include "tcompare.h"
|
#include "tcompare.h"
|
||||||
|
|
||||||
const static uint64_t tfileMagicNumber = 0xdb4775248b80fb57ull;
|
const static uint64_t FILE_MAGIC_NUMBER = 0xdb4775248b80fb57ull;
|
||||||
|
|
||||||
typedef struct TFileFstIter {
|
typedef struct TFileFstIter {
|
||||||
FStmBuilder* fb;
|
FStmBuilder* fb;
|
||||||
|
@ -457,7 +457,10 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTRslt
|
||||||
} else if (0 != strncmp(ch, p, skip)) {
|
} else if (0 != strncmp(ch, p, skip)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cond = cmpFn(ch + skip, tem->colVal, IDX_TYPE_GET_TYPE(tem->colType));
|
char* tBuf = taosMemoryCalloc(1, sz + 1);
|
||||||
|
memcpy(tBuf, ch, sz);
|
||||||
|
cond = cmpFn(tBuf + skip, tem->colVal, IDX_TYPE_GET_TYPE(tem->colType));
|
||||||
|
taosMemoryFree(tBuf);
|
||||||
}
|
}
|
||||||
if (MATCH == cond) {
|
if (MATCH == cond) {
|
||||||
tfileReaderLoadTableIds((TFileReader*)reader, rt->out.out, tr->total);
|
tfileReaderLoadTableIds((TFileReader*)reader, rt->out.out, tr->total);
|
||||||
|
@ -545,9 +548,6 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
||||||
taosArraySortPWithExt((SArray*)(data), tfileValueCompare, &fn);
|
taosArraySortPWithExt((SArray*)(data), tfileValueCompare, &fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t bufLimit = 64 * 4096, offset = 0;
|
|
||||||
// char* buf = taosMemoryCalloc(1, sizeof(char) * bufLimit);
|
|
||||||
// char* p = buf;
|
|
||||||
int32_t sz = taosArrayGetSize((SArray*)data);
|
int32_t sz = taosArrayGetSize((SArray*)data);
|
||||||
int32_t fstOffset = tw->offset;
|
int32_t fstOffset = tw->offset;
|
||||||
|
|
||||||
|
@ -561,6 +561,9 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
||||||
}
|
}
|
||||||
tfileWriteFstOffset(tw, fstOffset);
|
tfileWriteFstOffset(tw, fstOffset);
|
||||||
|
|
||||||
|
int32_t cap = 4 * 1024;
|
||||||
|
char* buf = taosMemoryCalloc(1, cap);
|
||||||
|
|
||||||
for (size_t i = 0; i < sz; i++) {
|
for (size_t i = 0; i < sz; i++) {
|
||||||
TFileValue* v = taosArrayGetP((SArray*)data, i);
|
TFileValue* v = taosArrayGetP((SArray*)data, i);
|
||||||
|
|
||||||
|
@ -568,14 +571,18 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
||||||
// check buf has enough space or not
|
// check buf has enough space or not
|
||||||
int32_t ttsz = TF_TABLE_TATOAL_SIZE(tbsz);
|
int32_t ttsz = TF_TABLE_TATOAL_SIZE(tbsz);
|
||||||
|
|
||||||
char* buf = taosMemoryCalloc(1, ttsz * sizeof(char));
|
if (cap < ttsz) {
|
||||||
|
cap = ttsz;
|
||||||
|
buf = (char*)taosMemoryRealloc(buf, cap);
|
||||||
|
}
|
||||||
char* p = buf;
|
char* p = buf;
|
||||||
tfileSerialTableIdsToBuf(p, v->tableId);
|
tfileSerialTableIdsToBuf(p, v->tableId);
|
||||||
tw->ctx->write(tw->ctx, buf, ttsz);
|
tw->ctx->write(tw->ctx, buf, ttsz);
|
||||||
v->offset = tw->offset;
|
v->offset = tw->offset;
|
||||||
tw->offset += ttsz;
|
tw->offset += ttsz;
|
||||||
taosMemoryFree(buf);
|
memset(buf, 0, cap);
|
||||||
}
|
}
|
||||||
|
taosMemoryFree(buf);
|
||||||
|
|
||||||
tw->fb = fstBuilderCreate(tw->ctx, 0);
|
tw->fb = fstBuilderCreate(tw->ctx, 0);
|
||||||
if (tw->fb == NULL) {
|
if (tw->fb == NULL) {
|
||||||
|
@ -866,13 +873,13 @@ static int tfileWriteData(TFileWriter* write, TFileValue* tval) {
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
static int tfileWriteFooter(TFileWriter* write) {
|
static int tfileWriteFooter(TFileWriter* write) {
|
||||||
char buf[sizeof(tfileMagicNumber) + 1] = {0};
|
char buf[sizeof(FILE_MAGIC_NUMBER) + 1] = {0};
|
||||||
void* pBuf = (void*)buf;
|
void* pBuf = (void*)buf;
|
||||||
taosEncodeFixedU64((void**)(void*)&pBuf, tfileMagicNumber);
|
taosEncodeFixedU64((void**)(void*)&pBuf, FILE_MAGIC_NUMBER);
|
||||||
int nwrite = write->ctx->write(write->ctx, buf, (int32_t)strlen(buf));
|
int nwrite = write->ctx->write(write->ctx, buf, (int32_t)strlen(buf));
|
||||||
|
|
||||||
indexInfo("tfile write footer size: %d", write->ctx->size(write->ctx));
|
indexInfo("tfile write footer size: %d", write->ctx->size(write->ctx));
|
||||||
assert(nwrite == sizeof(tfileMagicNumber));
|
assert(nwrite == sizeof(FILE_MAGIC_NUMBER));
|
||||||
return nwrite;
|
return nwrite;
|
||||||
}
|
}
|
||||||
static int tfileReaderLoadHeader(TFileReader* reader) {
|
static int tfileReaderLoadHeader(TFileReader* reader) {
|
||||||
|
@ -896,7 +903,7 @@ static int tfileReaderLoadFst(TFileReader* reader) {
|
||||||
int size = ctx->size(ctx);
|
int size = ctx->size(ctx);
|
||||||
|
|
||||||
// current load fst into memory, refactor it later
|
// current load fst into memory, refactor it later
|
||||||
int fstSize = size - reader->header.fstOffset - sizeof(tfileMagicNumber);
|
int fstSize = size - reader->header.fstOffset - sizeof(FILE_MAGIC_NUMBER);
|
||||||
char* buf = taosMemoryCalloc(1, fstSize);
|
char* buf = taosMemoryCalloc(1, fstSize);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -956,9 +963,8 @@ static int tfileReaderVerify(TFileReader* reader) {
|
||||||
IFileCtx* ctx = reader->ctx;
|
IFileCtx* ctx = reader->ctx;
|
||||||
|
|
||||||
uint64_t tMagicNumber = 0;
|
uint64_t tMagicNumber = 0;
|
||||||
|
char buf[sizeof(tMagicNumber) + 1] = {0};
|
||||||
char buf[sizeof(tMagicNumber) + 1] = {0};
|
int size = ctx->size(ctx);
|
||||||
int size = ctx->size(ctx);
|
|
||||||
|
|
||||||
if (size < sizeof(tMagicNumber) || size <= sizeof(reader->header)) {
|
if (size < sizeof(tMagicNumber) || size <= sizeof(reader->header)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -967,25 +973,25 @@ static int tfileReaderVerify(TFileReader* reader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
taosDecodeFixedU64(buf, &tMagicNumber);
|
taosDecodeFixedU64(buf, &tMagicNumber);
|
||||||
return tMagicNumber == tfileMagicNumber ? 0 : -1;
|
return tMagicNumber == FILE_MAGIC_NUMBER ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tfileReaderRef(TFileReader* reader) {
|
void tfileReaderRef(TFileReader* rd) {
|
||||||
if (reader == NULL) {
|
if (rd == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int ref = T_REF_INC(reader);
|
int ref = T_REF_INC(rd);
|
||||||
UNUSED(ref);
|
UNUSED(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tfileReaderUnRef(TFileReader* reader) {
|
void tfileReaderUnRef(TFileReader* rd) {
|
||||||
if (reader == NULL) {
|
if (rd == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int ref = T_REF_DEC(reader);
|
int ref = T_REF_DEC(rd);
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
// do nothing
|
// do nothing
|
||||||
tfileReaderDestroy(reader);
|
tfileReaderDestroy(rd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,110 +1,112 @@
|
||||||
add_executable(idxTest "")
|
IF(NOT TD_DARWIN)
|
||||||
add_executable(idxFstTest "")
|
add_executable(idxTest "")
|
||||||
add_executable(idxFstUT "")
|
add_executable(idxFstTest "")
|
||||||
add_executable(idxUtilUT "")
|
add_executable(idxFstUT "")
|
||||||
add_executable(idxJsonUT "")
|
add_executable(idxUtilUT "")
|
||||||
|
add_executable(idxJsonUT "")
|
||||||
|
|
||||||
target_sources(idxTest
|
target_sources(idxTest
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"indexTests.cc"
|
"indexTests.cc"
|
||||||
)
|
)
|
||||||
target_sources(idxFstTest
|
target_sources(idxFstTest
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"fstTest.cc"
|
"fstTest.cc"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(idxFstUT
|
target_sources(idxFstUT
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"fstUT.cc"
|
"fstUT.cc"
|
||||||
)
|
)
|
||||||
target_sources(idxUtilUT
|
target_sources(idxUtilUT
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"utilUT.cc"
|
"utilUT.cc"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(idxJsonUT
|
target_sources(idxJsonUT
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"jsonUT.cc"
|
"jsonUT.cc"
|
||||||
)
|
)
|
||||||
target_include_directories (idxTest
|
target_include_directories (idxTest
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"${TD_SOURCE_DIR}/include/libs/index"
|
"${TD_SOURCE_DIR}/include/libs/index"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
||||||
)
|
)
|
||||||
target_include_directories (idxFstTest
|
target_include_directories (idxFstTest
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"${TD_SOURCE_DIR}/include/libs/index"
|
"${TD_SOURCE_DIR}/include/libs/index"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories (idxFstUT
|
target_include_directories (idxFstUT
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"${TD_SOURCE_DIR}/include/libs/index"
|
"${TD_SOURCE_DIR}/include/libs/index"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories (idxUtilUT
|
target_include_directories (idxUtilUT
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"${TD_SOURCE_DIR}/include/libs/index"
|
"${TD_SOURCE_DIR}/include/libs/index"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories (idxJsonUT
|
target_include_directories (idxJsonUT
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"${TD_SOURCE_DIR}/include/libs/index"
|
"${TD_SOURCE_DIR}/include/libs/index"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
|
||||||
)
|
)
|
||||||
target_link_libraries (idxTest
|
target_link_libraries (idxTest
|
||||||
os
|
os
|
||||||
util
|
util
|
||||||
common
|
common
|
||||||
gtest_main
|
gtest_main
|
||||||
index
|
index
|
||||||
)
|
)
|
||||||
target_link_libraries (idxFstTest
|
target_link_libraries (idxFstTest
|
||||||
os
|
os
|
||||||
util
|
util
|
||||||
common
|
common
|
||||||
gtest_main
|
gtest_main
|
||||||
index
|
index
|
||||||
)
|
)
|
||||||
target_link_libraries (idxFstUT
|
target_link_libraries (idxFstUT
|
||||||
os
|
os
|
||||||
util
|
util
|
||||||
common
|
common
|
||||||
gtest_main
|
gtest_main
|
||||||
index
|
index
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries (idxUtilUT
|
target_link_libraries (idxUtilUT
|
||||||
os
|
os
|
||||||
util
|
util
|
||||||
common
|
common
|
||||||
gtest_main
|
gtest_main
|
||||||
index
|
index
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries (idxJsonUT
|
target_link_libraries (idxJsonUT
|
||||||
os
|
os
|
||||||
util
|
util
|
||||||
common
|
common
|
||||||
gtest_main
|
gtest_main
|
||||||
index
|
index
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test(
|
add_test(
|
||||||
NAME idxtest
|
NAME idxtest
|
||||||
COMMAND idxTest
|
COMMAND idxTest
|
||||||
)
|
)
|
||||||
add_test(
|
add_test(
|
||||||
NAME idxJsonUT
|
NAME idxJsonUT
|
||||||
COMMAND idxJsonUT
|
COMMAND idxJsonUT
|
||||||
)
|
)
|
||||||
add_test(
|
add_test(
|
||||||
NAME idxUtilUT
|
NAME idxUtilUT
|
||||||
COMMAND idxUtilUT
|
COMMAND idxUtilUT
|
||||||
)
|
)
|
||||||
add_test(
|
add_test(
|
||||||
NAME idxFstUT
|
NAME idxFstUT
|
||||||
COMMAND idxFstUT
|
COMMAND idxFstUT
|
||||||
)
|
)
|
||||||
|
ENDIF ()
|
|
@ -879,6 +879,10 @@ static int32_t createIndefRowsFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = setConditionsSlotId(pCxt, (const SLogicNode*)pFuncLogicNode, (SPhysiNode*)pIdfRowsFunc);
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pPhyNode = (SPhysiNode*)pIdfRowsFunc;
|
*pPhyNode = (SPhysiNode*)pIdfRowsFunc;
|
||||||
} else {
|
} else {
|
||||||
|
@ -933,6 +937,10 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh
|
||||||
code = setNodeSlotId(pCxt, pChildTupe->dataBlockId, -1, pFuncLogicNode->pTimeSeries, &pInterpFunc->pTimeSeries);
|
code = setNodeSlotId(pCxt, pChildTupe->dataBlockId, -1, pFuncLogicNode->pTimeSeries, &pInterpFunc->pTimeSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = setConditionsSlotId(pCxt, (const SLogicNode*)pFuncLogicNode, (SPhysiNode*)pInterpFunc);
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pPhyNode = (SPhysiNode*)pInterpFunc;
|
*pPhyNode = (SPhysiNode*)pInterpFunc;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1228,6 +1236,10 @@ static int32_t createSortPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = setConditionsSlotId(pCxt, (const SLogicNode*)pSortLogicNode, (SPhysiNode*)pSort);
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pPhyNode = (SPhysiNode*)pSort;
|
*pPhyNode = (SPhysiNode*)pSort;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1272,6 +1284,10 @@ static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = setConditionsSlotId(pCxt, (const SLogicNode*)pPartLogicNode, (SPhysiNode*)pPart);
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pPhyNode = (SPhysiNode*)pPart;
|
*pPhyNode = (SPhysiNode*)pPart;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1314,6 +1330,10 @@ static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = setConditionsSlotId(pCxt, (const SLogicNode*)pFillNode, (SPhysiNode*)pFill);
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pPhyNode = (SPhysiNode*)pFill;
|
*pPhyNode = (SPhysiNode*)pFill;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,38 +1,40 @@
|
||||||
|
|
||||||
MESSAGE(STATUS "build planner unit test")
|
MESSAGE(STATUS "build planner unit test")
|
||||||
|
|
||||||
# GoogleTest requires at least C++11
|
IF(NOT TD_DARWIN)
|
||||||
SET(CMAKE_CXX_STANDARD 11)
|
# GoogleTest requires at least C++11
|
||||||
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
|
SET(CMAKE_CXX_STANDARD 11)
|
||||||
|
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
|
||||||
|
|
||||||
ADD_EXECUTABLE(plannerTest
|
ADD_EXECUTABLE(plannerTest
|
||||||
${SOURCE_LIST}
|
${SOURCE_LIST}
|
||||||
"${SOURCE_LIST}/../../../parser/test/mockCatalog.cpp"
|
"${SOURCE_LIST}/../../../parser/test/mockCatalog.cpp"
|
||||||
"${SOURCE_LIST}/../../../parser/test/mockCatalogService.cpp"
|
"${SOURCE_LIST}/../../../parser/test/mockCatalogService.cpp"
|
||||||
)
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(
|
|
||||||
plannerTest
|
|
||||||
PUBLIC os util common nodes planner parser catalog transport gtest function qcom
|
|
||||||
)
|
|
||||||
|
|
||||||
TARGET_INCLUDE_DIRECTORIES(
|
|
||||||
plannerTest
|
|
||||||
PUBLIC "${TD_SOURCE_DIR}/include/libs/planner/"
|
|
||||||
PRIVATE "${TD_SOURCE_DIR}/source/libs/planner/inc"
|
|
||||||
PRIVATE "${TD_SOURCE_DIR}/source/libs/parser/test"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if(${BUILD_WINGETOPT})
|
|
||||||
target_include_directories(
|
|
||||||
plannerTest
|
|
||||||
PUBLIC "${TD_SOURCE_DIR}/contrib/wingetopt/src"
|
|
||||||
)
|
)
|
||||||
target_link_libraries(plannerTest PUBLIC wingetopt)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_test(
|
TARGET_LINK_LIBRARIES(
|
||||||
NAME plannerTest
|
plannerTest
|
||||||
COMMAND plannerTest
|
PUBLIC os util common nodes planner parser catalog transport gtest function qcom
|
||||||
)
|
)
|
||||||
|
|
||||||
|
TARGET_INCLUDE_DIRECTORIES(
|
||||||
|
plannerTest
|
||||||
|
PUBLIC "${TD_SOURCE_DIR}/include/libs/planner/"
|
||||||
|
PRIVATE "${TD_SOURCE_DIR}/source/libs/planner/inc"
|
||||||
|
PRIVATE "${TD_SOURCE_DIR}/source/libs/parser/test"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if(${BUILD_WINGETOPT})
|
||||||
|
target_include_directories(
|
||||||
|
plannerTest
|
||||||
|
PUBLIC "${TD_SOURCE_DIR}/contrib/wingetopt/src"
|
||||||
|
)
|
||||||
|
target_link_libraries(plannerTest PUBLIC wingetopt)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME plannerTest
|
||||||
|
COMMAND plannerTest
|
||||||
|
)
|
||||||
|
ENDIF ()
|
|
@ -16,7 +16,11 @@
|
||||||
|
|
||||||
class TfsTest : public ::testing::Test {
|
class TfsTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
|
#ifdef _TD_DARWIN_64
|
||||||
|
static void SetUpTestSuite() { root = "/private" TD_TMP_DIR_PATH "tfsTest"; }
|
||||||
|
#else
|
||||||
static void SetUpTestSuite() { root = TD_TMP_DIR_PATH "tfsTest"; }
|
static void SetUpTestSuite() { root = TD_TMP_DIR_PATH "tfsTest"; }
|
||||||
|
#endif
|
||||||
static void TearDownTestSuite() {}
|
static void TearDownTestSuite() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -299,6 +303,17 @@ TEST_F(TfsTest, 04_File) {
|
||||||
TEST_F(TfsTest, 05_MultiDisk) {
|
TEST_F(TfsTest, 05_MultiDisk) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
#ifdef _TD_DARWIN_64
|
||||||
|
const char *root00 = "/private" TD_TMP_DIR_PATH "tfsTest00";
|
||||||
|
const char *root01 = "/private" TD_TMP_DIR_PATH "tfsTest01";
|
||||||
|
const char *root10 = "/private" TD_TMP_DIR_PATH "tfsTest10";
|
||||||
|
const char *root11 = "/private" TD_TMP_DIR_PATH "tfsTest11";
|
||||||
|
const char *root12 = "/private" TD_TMP_DIR_PATH "tfsTest12";
|
||||||
|
const char *root20 = "/private" TD_TMP_DIR_PATH "tfsTest20";
|
||||||
|
const char *root21 = "/private" TD_TMP_DIR_PATH "tfsTest21";
|
||||||
|
const char *root22 = "/private" TD_TMP_DIR_PATH "tfsTest22";
|
||||||
|
const char *root23 = "/private" TD_TMP_DIR_PATH "tfsTest23";
|
||||||
|
#else
|
||||||
const char *root00 = TD_TMP_DIR_PATH "tfsTest00";
|
const char *root00 = TD_TMP_DIR_PATH "tfsTest00";
|
||||||
const char *root01 = TD_TMP_DIR_PATH "tfsTest01";
|
const char *root01 = TD_TMP_DIR_PATH "tfsTest01";
|
||||||
const char *root10 = TD_TMP_DIR_PATH "tfsTest10";
|
const char *root10 = TD_TMP_DIR_PATH "tfsTest10";
|
||||||
|
@ -308,6 +323,7 @@ TEST_F(TfsTest, 05_MultiDisk) {
|
||||||
const char *root21 = TD_TMP_DIR_PATH "tfsTest21";
|
const char *root21 = TD_TMP_DIR_PATH "tfsTest21";
|
||||||
const char *root22 = TD_TMP_DIR_PATH "tfsTest22";
|
const char *root22 = TD_TMP_DIR_PATH "tfsTest22";
|
||||||
const char *root23 = TD_TMP_DIR_PATH "tfsTest23";
|
const char *root23 = TD_TMP_DIR_PATH "tfsTest23";
|
||||||
|
#endif
|
||||||
|
|
||||||
SDiskCfg dCfg[9] = {0};
|
SDiskCfg dCfg[9] = {0};
|
||||||
tstrncpy(dCfg[0].dir, root01, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[0].dir, root01, TSDB_FILENAME_LEN);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
*
|
* * This program is free software: you can use, redistribute, and/or modify
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,23 +19,19 @@
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|
||||||
// add
|
// add
|
||||||
int8_t interlocked_add_fetch_8(int8_t volatile* ptr, int8_t val) {
|
int8_t interlocked_add_fetch_8(int8_t volatile* ptr, int8_t val) { return _InterlockedExchangeAdd8(ptr, val) + val; }
|
||||||
return _InterlockedExchangeAdd8(ptr, val) + val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t interlocked_add_fetch_16(int16_t volatile* ptr, int16_t val) {
|
int16_t interlocked_add_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
return _InterlockedExchangeAdd16(ptr, val) + val;
|
return _InterlockedExchangeAdd16(ptr, val) + val;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t interlocked_add_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_add_fetch_32(int32_t volatile* ptr, int32_t val) { return _InterlockedExchangeAdd(ptr, val) + val; }
|
||||||
return _InterlockedExchangeAdd(ptr, val) + val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_add_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_add_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
return InterlockedExchangeAdd64(ptr, val) + val;
|
return InterlockedExchangeAdd64(ptr, val) + val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* interlocked_add_fetch_ptr(void* volatile* ptr, void* val) {
|
void* interlocked_add_fetch_ptr(void* volatile* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (void*)(_InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)val) + (int32_t)val);
|
return (void*)(_InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)val) + (int32_t)val);
|
||||||
#else
|
#else
|
||||||
|
@ -43,17 +39,11 @@ void* interlocked_add_fetch_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t interlocked_and_fetch_8(int8_t volatile* ptr, int8_t val) {
|
int8_t interlocked_and_fetch_8(int8_t volatile* ptr, int8_t val) { return _InterlockedAnd8(ptr, val) & val; }
|
||||||
return _InterlockedAnd8(ptr, val) & val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t interlocked_and_fetch_16(int16_t volatile* ptr, int16_t val) {
|
int16_t interlocked_and_fetch_16(int16_t volatile* ptr, int16_t val) { return _InterlockedAnd16(ptr, val) & val; }
|
||||||
return _InterlockedAnd16(ptr, val) & val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t interlocked_and_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_and_fetch_32(int32_t volatile* ptr, int32_t val) { return _InterlockedAnd(ptr, val) & val; }
|
||||||
return _InterlockedAnd(ptr, val) & val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_and_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_and_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -96,17 +86,11 @@ void* interlocked_fetch_and_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t interlocked_or_fetch_8(int8_t volatile* ptr, int8_t val) {
|
int8_t interlocked_or_fetch_8(int8_t volatile* ptr, int8_t val) { return _InterlockedOr8(ptr, val) | val; }
|
||||||
return _InterlockedOr8(ptr, val) | val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t interlocked_or_fetch_16(int16_t volatile* ptr, int16_t val) {
|
int16_t interlocked_or_fetch_16(int16_t volatile* ptr, int16_t val) { return _InterlockedOr16(ptr, val) | val; }
|
||||||
return _InterlockedOr16(ptr, val) | val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t interlocked_or_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_or_fetch_32(int32_t volatile* ptr, int32_t val) { return _InterlockedOr(ptr, val) | val; }
|
||||||
return _InterlockedOr(ptr, val) | val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_or_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_or_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -114,7 +98,7 @@ int64_t interlocked_or_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old | val;
|
res = old | val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
#else
|
#else
|
||||||
return _InterlockedOr64(ptr, val) & val;
|
return _InterlockedOr64(ptr, val) & val;
|
||||||
|
@ -134,7 +118,7 @@ int64_t interlocked_fetch_or_64(int64_t volatile* ptr, int64_t val) {
|
||||||
int64_t old;
|
int64_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while(_InterlockedCompareExchange64(ptr, old | val, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, old | val, old) != old);
|
||||||
return old;
|
return old;
|
||||||
#else
|
#else
|
||||||
return _InterlockedOr64((int64_t volatile*)(ptr), (int64_t)(val));
|
return _InterlockedOr64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
|
@ -149,17 +133,11 @@ void* interlocked_fetch_or_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t interlocked_xor_fetch_8(int8_t volatile* ptr, int8_t val) {
|
int8_t interlocked_xor_fetch_8(int8_t volatile* ptr, int8_t val) { return _InterlockedXor8(ptr, val) ^ val; }
|
||||||
return _InterlockedXor8(ptr, val) ^ val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t interlocked_xor_fetch_16(int16_t volatile* ptr, int16_t val) {
|
int16_t interlocked_xor_fetch_16(int16_t volatile* ptr, int16_t val) { return _InterlockedXor16(ptr, val) ^ val; }
|
||||||
return _InterlockedXor16(ptr, val) ^ val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t interlocked_xor_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_xor_fetch_32(int32_t volatile* ptr, int32_t val) { return _InterlockedXor(ptr, val) ^ val; }
|
||||||
return _InterlockedXor(ptr, val) ^ val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_xor_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_xor_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -167,7 +145,7 @@ int64_t interlocked_xor_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old ^ val;
|
res = old ^ val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
#else
|
#else
|
||||||
return _InterlockedXor64(ptr, val) ^ val;
|
return _InterlockedXor64(ptr, val) ^ val;
|
||||||
|
@ -202,13 +180,9 @@ void* interlocked_fetch_xor_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t interlocked_sub_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_sub_fetch_32(int32_t volatile* ptr, int32_t val) { return interlocked_add_fetch_32(ptr, -val); }
|
||||||
return interlocked_add_fetch_32(ptr, -val);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_sub_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_sub_fetch_64(int64_t volatile* ptr, int64_t val) { return interlocked_add_fetch_64(ptr, -val); }
|
||||||
return interlocked_add_fetch_64(ptr, -val);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) {
|
void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -217,13 +191,9 @@ void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) {
|
||||||
return (void*)interlocked_add_fetch_64((int64_t volatile*)ptr, (int64_t)val);
|
return (void*)interlocked_add_fetch_64((int64_t volatile*)ptr, (int64_t)val);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
int32_t interlocked_fetch_sub_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_fetch_sub_32(int32_t volatile* ptr, int32_t val) { return _InterlockedExchangeAdd(ptr, -val); }
|
||||||
return _InterlockedExchangeAdd(ptr, -val);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_fetch_sub_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_fetch_sub_64(int64_t volatile* ptr, int64_t val) { return _InterlockedExchangeAdd64(ptr, -val); }
|
||||||
return _InterlockedExchangeAdd64(ptr, -val);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* interlocked_fetch_sub_ptr(void* volatile* ptr, void* val) {
|
void* interlocked_fetch_sub_ptr(void* volatile* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -236,45 +206,44 @@ void* interlocked_fetch_sub_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _TD_NINGSI_60
|
#ifdef _TD_NINGSI_60
|
||||||
void* atomic_exchange_ptr_impl(void** ptr, void* val ) {
|
void* atomic_exchange_ptr_impl(void** ptr, void* val) {
|
||||||
void *old;
|
void* old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
int8_t atomic_exchange_8_impl(int8_t* ptr, int8_t val ) {
|
int8_t atomic_exchange_8_impl(int8_t* ptr, int8_t val) {
|
||||||
int8_t old;
|
int8_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
int16_t atomic_exchange_16_impl(int16_t* ptr, int16_t val ) {
|
int16_t atomic_exchange_16_impl(int16_t* ptr, int16_t val) {
|
||||||
int16_t old;
|
int16_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
int32_t atomic_exchange_32_impl(int32_t* ptr, int32_t val ) {
|
int32_t atomic_exchange_32_impl(int32_t* ptr, int32_t val) {
|
||||||
int32_t old;
|
int32_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
int64_t atomic_exchange_64_impl(int64_t* ptr, int64_t val ) {
|
int64_t atomic_exchange_64_impl(int64_t* ptr, int64_t val) {
|
||||||
int64_t old;
|
int64_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int8_t atomic_load_8(int8_t volatile* ptr) {
|
||||||
int8_t atomic_load_8(int8_t volatile *ptr) {
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(int8_t volatile*)(ptr));
|
return (*(int8_t volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -284,7 +253,7 @@ int8_t atomic_load_8(int8_t volatile *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_load_16(int16_t volatile *ptr) {
|
int16_t atomic_load_16(int16_t volatile* ptr) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(int16_t volatile*)(ptr));
|
return (*(int16_t volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -294,7 +263,7 @@ int16_t atomic_load_16(int16_t volatile *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_load_32(int32_t volatile *ptr) {
|
int32_t atomic_load_32(int32_t volatile* ptr) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(int32_t volatile*)(ptr));
|
return (*(int32_t volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -304,7 +273,7 @@ int32_t atomic_load_32(int32_t volatile *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_load_64(int64_t volatile *ptr) {
|
int64_t atomic_load_64(int64_t volatile* ptr) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(int64_t volatile*)(ptr));
|
return (*(int64_t volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -314,7 +283,7 @@ int64_t atomic_load_64(int64_t volatile *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_load_ptr(void *ptr) {
|
void* atomic_load_ptr(void* ptr) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(void* volatile*)(ptr));
|
return (*(void* volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -324,57 +293,57 @@ void* atomic_load_ptr(void *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_8(int8_t volatile *ptr, int8_t val) {
|
void atomic_store_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(int8_t volatile*)(ptr)) = (int8_t)(val));
|
((*(int8_t volatile*)(ptr)) = (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_16(int16_t volatile *ptr, int16_t val) {
|
void atomic_store_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(int16_t volatile*)(ptr)) = (int16_t)(val));
|
((*(int16_t volatile*)(ptr)) = (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_32(int32_t volatile *ptr, int32_t val) {
|
void atomic_store_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(int32_t volatile*)(ptr)) = (int32_t)(val));
|
((*(int32_t volatile*)(ptr)) = (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_64(int64_t volatile *ptr, int64_t val) {
|
void atomic_store_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(int64_t volatile*)(ptr)) = (int64_t)(val));
|
((*(int64_t volatile*)(ptr)) = (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_ptr(void *ptr, void *val) {
|
void atomic_store_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(void* volatile*)(ptr)) = (void*)(val));
|
((*(void* volatile*)(ptr)) = (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_exchange_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_exchange_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchange8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedExchange8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -384,7 +353,7 @@ int8_t atomic_exchange_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_exchange_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_exchange_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchange16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedExchange16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -394,7 +363,7 @@ int16_t atomic_exchange_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_exchange_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_exchange_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchange((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedExchange((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -404,7 +373,7 @@ int32_t atomic_exchange_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_exchange_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_exchange_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchange64((int64_t volatile*)(ptr), (int64_t)(val));
|
return _InterlockedExchange64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -414,21 +383,21 @@ int64_t atomic_exchange_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_exchange_ptr(void *ptr, void *val) {
|
void* atomic_exchange_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
return _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
return _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
||||||
#else
|
|
||||||
return _InlineInterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
|
||||||
#endif
|
|
||||||
#elif defined(_TD_NINGSI_60)
|
|
||||||
return atomic_exchange_ptr_impl((void *)ptr, (void*)val);
|
|
||||||
#else
|
#else
|
||||||
return __atomic_exchange_n((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return _InlineInterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
||||||
|
#endif
|
||||||
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
return atomic_exchange_ptr_impl((void*)ptr, (void*)val);
|
||||||
|
#else
|
||||||
|
return __atomic_exchange_n((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_val_compare_exchange_8(int8_t volatile *ptr, int8_t oldval, int8_t newval) {
|
int8_t atomic_val_compare_exchange_8(int8_t volatile* ptr, int8_t oldval, int8_t newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchange8((int8_t volatile*)(ptr), (int8_t)(newval), (int8_t)(oldval));
|
return _InterlockedCompareExchange8((int8_t volatile*)(ptr), (int8_t)(newval), (int8_t)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -438,7 +407,7 @@ int8_t atomic_val_compare_exchange_8(int8_t volatile *ptr, int8_t oldval, int8_t
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_val_compare_exchange_16(int16_t volatile *ptr, int16_t oldval, int16_t newval) {
|
int16_t atomic_val_compare_exchange_16(int16_t volatile* ptr, int16_t oldval, int16_t newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchange16((int16_t volatile*)(ptr), (int16_t)(newval), (int16_t)(oldval));
|
return _InterlockedCompareExchange16((int16_t volatile*)(ptr), (int16_t)(newval), (int16_t)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -448,7 +417,7 @@ int16_t atomic_val_compare_exchange_16(int16_t volatile *ptr, int16_t oldval, in
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_val_compare_exchange_32(int32_t volatile *ptr, int32_t oldval, int32_t newval) {
|
int32_t atomic_val_compare_exchange_32(int32_t volatile* ptr, int32_t oldval, int32_t newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchange((int32_t volatile*)(ptr), (int32_t)(newval), (int32_t)(oldval));
|
return _InterlockedCompareExchange((int32_t volatile*)(ptr), (int32_t)(newval), (int32_t)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -458,7 +427,7 @@ int32_t atomic_val_compare_exchange_32(int32_t volatile *ptr, int32_t oldval, in
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_val_compare_exchange_64(int64_t volatile *ptr, int64_t oldval, int64_t newval) {
|
int64_t atomic_val_compare_exchange_64(int64_t volatile* ptr, int64_t oldval, int64_t newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchange64((int64_t volatile*)(ptr), (int64_t)(newval), (int64_t)(oldval));
|
return _InterlockedCompareExchange64((int64_t volatile*)(ptr), (int64_t)(newval), (int64_t)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -468,17 +437,17 @@ int64_t atomic_val_compare_exchange_64(int64_t volatile *ptr, int64_t oldval, in
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_val_compare_exchange_ptr(void *ptr, void *oldval, void *newval) {
|
void* atomic_val_compare_exchange_ptr(void* ptr, void* oldval, void* newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchangePointer((void* volatile*)(ptr), (void*)(newval), (void*)(oldval));
|
return _InterlockedCompareExchangePointer((void* volatile*)(ptr), (void*)(newval), (void*)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_val_compare_and_swap(ptr, oldval, newval);
|
return __sync_val_compare_and_swap(ptr, oldval, newval);
|
||||||
#else
|
#else
|
||||||
return __sync_val_compare_and_swap((void **)ptr, oldval, newval);
|
return __sync_val_compare_and_swap((void**)ptr, oldval, newval);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_add_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_add_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
return interlocked_add_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -488,7 +457,7 @@ int8_t atomic_add_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_add_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_add_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
return interlocked_add_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -498,7 +467,7 @@ int16_t atomic_add_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_add_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_add_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
return interlocked_add_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -508,7 +477,7 @@ int32_t atomic_add_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_add_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_add_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_add_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -518,17 +487,17 @@ int64_t atomic_add_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_add_fetch_ptr(void *ptr, int64_t val) {
|
void* atomic_add_fetch_ptr(void* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_add_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_add_and_fetch((ptr), (val));
|
return __sync_add_and_fetch((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_add_fetch((void **)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return __atomic_add_fetch((void**)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_add_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_add_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedExchangeAdd8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -538,7 +507,7 @@ int8_t atomic_fetch_add_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_add_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_add_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedExchangeAdd16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -548,7 +517,7 @@ int16_t atomic_fetch_add_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_add_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_add_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -558,7 +527,7 @@ int32_t atomic_fetch_add_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_add_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_add_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), (int64_t)(val));
|
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -568,17 +537,17 @@ int64_t atomic_fetch_add_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_add_ptr(void *ptr, void *val) {
|
void* atomic_fetch_add_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
return _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_add((ptr), (val));
|
return __sync_fetch_and_add((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_add((void **)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_add((void**)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_sub_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_sub_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_8((int8_t volatile*)(ptr), -(int8_t)(val));
|
return interlocked_add_fetch_8((int8_t volatile*)(ptr), -(int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -588,7 +557,7 @@ int8_t atomic_sub_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_sub_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_sub_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_16((int16_t volatile*)(ptr), -(int16_t)(val));
|
return interlocked_add_fetch_16((int16_t volatile*)(ptr), -(int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -598,7 +567,7 @@ int16_t atomic_sub_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_sub_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_sub_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_sub_fetch_32(ptr, val);
|
return interlocked_sub_fetch_32(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -608,7 +577,7 @@ int32_t atomic_sub_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_sub_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_sub_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_sub_fetch_64(ptr, val);
|
return interlocked_sub_fetch_64(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -618,19 +587,19 @@ int64_t atomic_sub_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_sub_fetch_ptr(void *ptr, int64_t val) {
|
void* atomic_sub_fetch_ptr(void* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_sub_fetch_ptr(ptr, val);
|
return interlocked_sub_fetch_ptr(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_sub_and_fetch((ptr), (val));
|
return __sync_sub_and_fetch((ptr), (val));
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
return __atomic_sub_fetch((void **)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return __atomic_sub_fetch((void**)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#else
|
#else
|
||||||
return __atomic_sub_fetch((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_sub_fetch((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_sub_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_sub_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd8((int8_t volatile*)(ptr), -(int8_t)(val));
|
return _InterlockedExchangeAdd8((int8_t volatile*)(ptr), -(int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -640,7 +609,7 @@ int8_t atomic_fetch_sub_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_sub_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_sub_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd16((int16_t volatile*)(ptr), -(int16_t)(val));
|
return _InterlockedExchangeAdd16((int16_t volatile*)(ptr), -(int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -650,7 +619,7 @@ int16_t atomic_fetch_sub_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_sub_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_sub_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_sub_32(ptr, val);
|
return interlocked_fetch_sub_32(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -660,7 +629,7 @@ int32_t atomic_fetch_sub_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_sub_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_sub_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), -(int64_t)(val));
|
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), -(int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -670,19 +639,19 @@ int64_t atomic_fetch_sub_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_sub_ptr(void *ptr, void* val) {
|
void* atomic_fetch_sub_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_sub_ptr(ptr, val);
|
return interlocked_fetch_sub_ptr(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_sub((ptr), (val));
|
return __sync_fetch_and_sub((ptr), (val));
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
return __atomic_fetch_sub((void **)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_sub((void**)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_sub((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_sub((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_and_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_and_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
return interlocked_and_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -692,7 +661,7 @@ int8_t atomic_and_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_and_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_and_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
return interlocked_and_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -702,7 +671,7 @@ int16_t atomic_and_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_and_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_and_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
return interlocked_and_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -712,7 +681,7 @@ int32_t atomic_and_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_and_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_and_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_and_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -722,19 +691,19 @@ int64_t atomic_and_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_and_fetch_ptr(void *ptr, void *val) {
|
void* atomic_and_fetch_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_and_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_and_and_fetch((ptr), (val));
|
return __sync_and_and_fetch((ptr), (val));
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
return (void*)__atomic_and_fetch((size_t *)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return (void*)__atomic_and_fetch((size_t*)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#else
|
#else
|
||||||
return __atomic_and_fetch((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_and_fetch((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_and_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_and_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedAnd8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedAnd8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -744,7 +713,7 @@ int8_t atomic_fetch_and_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_and_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_and_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedAnd16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedAnd16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -754,7 +723,7 @@ int16_t atomic_fetch_and_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_and_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_and_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedAnd((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedAnd((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -764,7 +733,7 @@ int32_t atomic_fetch_and_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_and_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_and_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_and_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_fetch_and_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -774,19 +743,19 @@ int64_t atomic_fetch_and_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_and_ptr(void *ptr, void *val) {
|
void* atomic_fetch_and_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_and_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_fetch_and_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_and((ptr), (val));
|
return __sync_fetch_and_and((ptr), (val));
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
return (void*)__atomic_fetch_and((size_t *)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return (void*)__atomic_fetch_and((size_t*)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_and((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_and((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_or_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_or_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
return interlocked_or_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -796,7 +765,7 @@ int8_t atomic_or_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_or_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_or_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
return interlocked_or_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -806,7 +775,7 @@ int16_t atomic_or_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_or_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_or_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
return interlocked_or_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -816,7 +785,7 @@ int32_t atomic_or_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_or_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_or_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_or_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -826,19 +795,19 @@ int64_t atomic_or_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_or_fetch_ptr(void *ptr, void *val) {
|
void* atomic_or_fetch_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_or_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_or_and_fetch((ptr), (val));
|
return __sync_or_and_fetch((ptr), (val));
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
return (void*)__atomic_or_fetch((size_t *)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return (void*)__atomic_or_fetch((size_t*)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#else
|
#else
|
||||||
return __atomic_or_fetch((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_or_fetch((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_or_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_or_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedOr8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedOr8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -848,7 +817,7 @@ int8_t atomic_fetch_or_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_or_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_or_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedOr16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedOr16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -858,7 +827,7 @@ int16_t atomic_fetch_or_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_or_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_or_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedOr((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedOr((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -868,7 +837,7 @@ int32_t atomic_fetch_or_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_or_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_or_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_or_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_fetch_or_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -878,19 +847,19 @@ int64_t atomic_fetch_or_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_or_ptr(void *ptr, void *val) {
|
void* atomic_fetch_or_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_or_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_fetch_or_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_or((ptr), (val));
|
return __sync_fetch_and_or((ptr), (val));
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
return (void*)__atomic_fetch_or((size_t *)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return (void*)__atomic_fetch_or((size_t*)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_or((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_or((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_xor_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_xor_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
return interlocked_xor_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -900,7 +869,7 @@ int8_t atomic_xor_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_xor_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_xor_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
return interlocked_xor_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -910,7 +879,7 @@ int16_t atomic_xor_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_xor_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_xor_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
return interlocked_xor_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -920,7 +889,7 @@ int32_t atomic_xor_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_xor_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_xor_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_xor_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -930,19 +899,19 @@ int64_t atomic_xor_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_xor_fetch_ptr(void *ptr, void *val) {
|
void* atomic_xor_fetch_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_xor_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_xor_and_fetch((ptr), (val));
|
return __sync_xor_and_fetch((ptr), (val));
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
return (void*)__atomic_xor_fetch((size_t *)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return (void*)__atomic_xor_fetch((size_t*)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#else
|
#else
|
||||||
return __atomic_xor_fetch((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_xor_fetch((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_xor_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_xor_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedXor8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedXor8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -952,7 +921,7 @@ int8_t atomic_fetch_xor_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_xor_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_xor_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedXor16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedXor16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -962,7 +931,7 @@ int16_t atomic_fetch_xor_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_xor_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_xor_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedXor((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedXor((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -972,7 +941,7 @@ int32_t atomic_fetch_xor_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_xor_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_xor_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_xor_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_fetch_xor_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -982,15 +951,14 @@ int64_t atomic_fetch_xor_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_xor_ptr(void *ptr, void *val) {
|
void* atomic_fetch_xor_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_xor_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_fetch_xor_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_xor((ptr), (val));
|
return __sync_fetch_and_xor((ptr), (val));
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
return (void*)__atomic_fetch_xor((size_t *)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return (void*)__atomic_fetch_xor((size_t*)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_xor((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_xor((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,8 @@ char *strsep(char **stringp, const char *delim) {
|
||||||
char * s;
|
char * s;
|
||||||
const char *spanp;
|
const char *spanp;
|
||||||
int32_t c, sc;
|
int32_t c, sc;
|
||||||
char *tok;
|
char * tok;
|
||||||
if ((s = *stringp) == NULL)
|
if ((s = *stringp) == NULL) return (NULL);
|
||||||
return (NULL);
|
|
||||||
for (tok = s;;) {
|
for (tok = s;;) {
|
||||||
c = *s++;
|
c = *s++;
|
||||||
spanp = delim;
|
spanp = delim;
|
||||||
|
@ -51,10 +50,10 @@ char *strsep(char **stringp, const char *delim) {
|
||||||
/* Duplicate a string, up to at most size characters */
|
/* Duplicate a string, up to at most size characters */
|
||||||
char *strndup(const char *s, size_t size) {
|
char *strndup(const char *s, size_t size) {
|
||||||
size_t l;
|
size_t l;
|
||||||
char *s2;
|
char * s2;
|
||||||
l = strlen(s);
|
l = strlen(s);
|
||||||
if (l > size) l=size;
|
if (l > size) l = size;
|
||||||
s2 = malloc(l+1);
|
s2 = malloc(l + 1);
|
||||||
if (s2) {
|
if (s2) {
|
||||||
strncpy(s2, s, l);
|
strncpy(s2, s, l);
|
||||||
s2[l] = '\0';
|
s2[l] = '\0';
|
||||||
|
@ -63,13 +62,12 @@ char *strndup(const char *s, size_t size) {
|
||||||
}
|
}
|
||||||
/* Copy no more than N characters of SRC to DEST, returning the address of
|
/* Copy no more than N characters of SRC to DEST, returning the address of
|
||||||
the terminating '\0' in DEST, if any, or else DEST + N. */
|
the terminating '\0' in DEST, if any, or else DEST + N. */
|
||||||
char *stpncpy (char *dest, const char *src, size_t n) {
|
char *stpncpy(char *dest, const char *src, size_t n) {
|
||||||
size_t size = strnlen (src, n);
|
size_t size = strnlen(src, n);
|
||||||
memcpy (dest, src, size);
|
memcpy(dest, src, size);
|
||||||
dest += size;
|
dest += size;
|
||||||
if (size == n)
|
if (size == n) return dest;
|
||||||
return dest;
|
return memset(dest, '\0', n - size);
|
||||||
return memset (dest, '\0', n - size);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -113,10 +111,9 @@ int32_t tasoUcs4Compare(TdUcs4 *f1_ucs4, TdUcs4 *f2_ucs4, int32_t bytes) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TdUcs4 *tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4) {
|
||||||
TdUcs4* tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4) {
|
assert(taosMemorySize(target_ucs4) >= len_ucs4 * sizeof(TdUcs4));
|
||||||
assert(taosMemorySize(target_ucs4)>=len_ucs4*sizeof(TdUcs4));
|
return memcpy(target_ucs4, source_ucs4, len_ucs4 * sizeof(TdUcs4));
|
||||||
return memcpy(target_ucs4, source_ucs4, len_ucs4*sizeof(TdUcs4));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
|
int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
|
||||||
|
@ -137,7 +134,7 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len) {
|
bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len) {
|
||||||
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
|
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
|
||||||
printf("Nchar cannot be read and written without iconv, please install iconv library and recompile TDengine.\n");
|
printf("Nchar cannot be read and written without iconv, please install iconv library and recompile TDengine.\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -146,7 +143,7 @@ bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4
|
||||||
iconv_t cd = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset);
|
iconv_t cd = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset);
|
||||||
size_t ucs4_input_len = mbsLength;
|
size_t ucs4_input_len = mbsLength;
|
||||||
size_t outLeft = ucs4_max_len;
|
size_t outLeft = ucs4_max_len;
|
||||||
if (iconv(cd, (char**)&mbs, &ucs4_input_len, (char**)&ucs4, &outLeft) == -1) {
|
if (iconv(cd, (char **)&mbs, &ucs4_input_len, (char **)&ucs4, &outLeft) == -1) {
|
||||||
iconv_close(cd);
|
iconv_close(cd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +192,7 @@ int32_t taosUcs4len(TdUcs4 *ucs4) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
//dst buffer size should be at least 2*len + 1
|
// dst buffer size should be at least 2*len + 1
|
||||||
int32_t taosHexEncode(const unsigned char *src, char *dst, int32_t len) {
|
int32_t taosHexEncode(const unsigned char *src, char *dst, int32_t len) {
|
||||||
if (!dst) {
|
if (!dst) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -214,7 +211,7 @@ int32_t taosHexDecode(const char *src, char *dst, int32_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t hn, ln, out;
|
uint8_t hn, ln, out;
|
||||||
for (int i = 0, j = 0; i < len * 2; i += 2, ++j ) {
|
for (int i = 0, j = 0; i < len * 2; i += 2, ++j) {
|
||||||
hn = src[i] > '9' ? src[i] - 'a' + 10 : src[i] - '0';
|
hn = src[i] > '9' ? src[i] - 'a' + 10 : src[i] - '0';
|
||||||
ln = src[i + 1] > '9' ? src[i + 1] - 'a' + 10 : src[i + 1] - '0';
|
ln = src[i + 1] > '9' ? src[i + 1] - 'a' + 10 : src[i + 1] - '0';
|
||||||
|
|
||||||
|
@ -238,25 +235,22 @@ int32_t taosWcharToMb(char *pStr, TdWchar wchar) { return wctomb(pStr, wchar); }
|
||||||
int32_t taosWcharsToMbs(char *pStrs, TdWchar *pWchars, int32_t size) { return wcstombs(pStrs, pWchars, size); }
|
int32_t taosWcharsToMbs(char *pStrs, TdWchar *pWchars, int32_t size) { return wcstombs(pStrs, pWchars, size); }
|
||||||
|
|
||||||
char *taosStrCaseStr(const char *str, const char *pattern) {
|
char *taosStrCaseStr(const char *str, const char *pattern) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!*pattern)
|
if (!*pattern) return (char *)str;
|
||||||
return (char*)str;
|
|
||||||
|
|
||||||
for (; *str; str++) {
|
for (; *str; str++) {
|
||||||
if (toupper(*str) == toupper(*pattern)) {
|
if (toupper(*str) == toupper(*pattern)) {
|
||||||
for (i = 1;; i++) {
|
for (i = 1;; i++) {
|
||||||
if (!pattern[i])
|
if (!pattern[i]) return (char *)str;
|
||||||
return (char*)str;
|
if (toupper(str[i]) != toupper(pattern[i])) break;
|
||||||
if (toupper(str[i]) != toupper(pattern[i]))
|
}
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
return NULL;
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t taosStr2Int64(const char *str, char** pEnd, int32_t radix) {
|
int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) {
|
||||||
int64_t tmp = strtoll(str, pEnd, radix);
|
int64_t tmp = strtoll(str, pEnd, radix);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -265,7 +259,7 @@ int64_t taosStr2Int64(const char *str, char** pEnd, int32_t radix) {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t taosStr2UInt64(const char *str, char** pEnd, int32_t radix) {
|
uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) {
|
||||||
uint64_t tmp = strtoull(str, pEnd, radix);
|
uint64_t tmp = strtoull(str, pEnd, radix);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -274,7 +268,7 @@ uint64_t taosStr2UInt64(const char *str, char** pEnd, int32_t radix) {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosStr2Int32(const char *str, char** pEnd, int32_t radix) {
|
int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) {
|
||||||
int32_t tmp = strtol(str, pEnd, radix);
|
int32_t tmp = strtol(str, pEnd, radix);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -283,7 +277,7 @@ int32_t taosStr2Int32(const char *str, char** pEnd, int32_t radix) {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t taosStr2UInt32(const char *str, char** pEnd, int32_t radix) {
|
uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) {
|
||||||
uint32_t tmp = strtol(str, pEnd, radix);
|
uint32_t tmp = strtol(str, pEnd, radix);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -292,7 +286,7 @@ uint32_t taosStr2UInt32(const char *str, char** pEnd, int32_t radix) {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t taosStr2Int16(const char *str, char** pEnd, int32_t radix) {
|
int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) {
|
||||||
int32_t tmp = strtol(str, pEnd, radix);
|
int32_t tmp = strtol(str, pEnd, radix);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -303,7 +297,7 @@ int16_t taosStr2Int16(const char *str, char** pEnd, int32_t radix) {
|
||||||
return (int16_t)tmp;
|
return (int16_t)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t taosStr2UInt16(const char *str, char** pEnd, int32_t radix) {
|
uint16_t taosStr2UInt16(const char *str, char **pEnd, int32_t radix) {
|
||||||
uint32_t tmp = strtoul(str, pEnd, radix);
|
uint32_t tmp = strtoul(str, pEnd, radix);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -313,7 +307,7 @@ uint16_t taosStr2UInt16(const char *str, char** pEnd, int32_t radix) {
|
||||||
return (uint16_t)tmp;
|
return (uint16_t)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t taosStr2Int8(const char *str, char** pEnd, int32_t radix) {
|
int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix) {
|
||||||
int32_t tmp = strtol(str, pEnd, radix);
|
int32_t tmp = strtol(str, pEnd, radix);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -324,7 +318,7 @@ int8_t taosStr2Int8(const char *str, char** pEnd, int32_t radix) {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t taosStr2UInt8(const char *str, char** pEnd, int32_t radix) {
|
uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix) {
|
||||||
uint32_t tmp = strtoul(str, pEnd, radix);
|
uint32_t tmp = strtoul(str, pEnd, radix);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -334,7 +328,7 @@ uint8_t taosStr2UInt8(const char *str, char** pEnd, int32_t radix) {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
double taosStr2Double(const char *str, char** pEnd) {
|
double taosStr2Double(const char *str, char **pEnd) {
|
||||||
double tmp = strtod(str, pEnd);
|
double tmp = strtod(str, pEnd);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -344,7 +338,7 @@ double taosStr2Double(const char *str, char** pEnd) {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
float taosStr2Float(const char *str, char** pEnd) {
|
float taosStr2Float(const char *str, char **pEnd) {
|
||||||
float tmp = strtof(str, pEnd);
|
float tmp = strtof(str, pEnd);
|
||||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
@ -353,4 +347,4 @@ float taosStr2Float(const char *str, char** pEnd) {
|
||||||
assert(tmp != NAN);
|
assert(tmp != NAN);
|
||||||
#endif
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,162 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/deploy.sh -n dnode3 -i 3
|
||||||
|
system sh/deploy.sh -n dnode4 -i 4
|
||||||
|
|
||||||
|
system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
system sh/exec.sh -n dnode3 -s start
|
||||||
|
system sh/exec.sh -n dnode4 -s start
|
||||||
|
|
||||||
|
$loop_cnt = 0
|
||||||
|
check_dnode_ready:
|
||||||
|
$loop_cnt = $loop_cnt + 1
|
||||||
|
sleep 200
|
||||||
|
if $loop_cnt == 10 then
|
||||||
|
print ====> dnode not ready!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql show dnodes
|
||||||
|
print ===> $rows $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
|
||||||
|
print ===> $rows $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6]
|
||||||
|
print ===> $rows $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] $data[2][5] $data[2][6]
|
||||||
|
print ===> $rows $data[3][0] $data[3][1] $data[3][2] $data[3][3] $data[3][4] $data[3][5] $data[3][6]
|
||||||
|
if $data[0][0] != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data[0][4] != ready then
|
||||||
|
goto check_dnode_ready
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql connect
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sql create dnode $hostname port 7300
|
||||||
|
sql create dnode $hostname port 7400
|
||||||
|
|
||||||
|
$loop_cnt = 0
|
||||||
|
check_dnode_ready_1:
|
||||||
|
$loop_cnt = $loop_cnt + 1
|
||||||
|
sleep 200
|
||||||
|
if $loop_cnt == 10 then
|
||||||
|
print ====> dnodes not ready!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql show dnodes
|
||||||
|
print ===> $rows $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
|
||||||
|
print ===> $rows $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6]
|
||||||
|
print ===> $rows $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] $data[2][5] $data[2][6]
|
||||||
|
print ===> $rows $data[3][0] $data[3][1] $data[3][2] $data[3][3] $data[3][4] $data[3][5] $data[3][6]
|
||||||
|
if $data[0][4] != ready then
|
||||||
|
goto check_dnode_ready_1
|
||||||
|
endi
|
||||||
|
if $data[1][4] != ready then
|
||||||
|
goto check_dnode_ready_1
|
||||||
|
endi
|
||||||
|
if $data[2][4] != ready then
|
||||||
|
goto check_dnode_ready_1
|
||||||
|
endi
|
||||||
|
if $data[3][4] != ready then
|
||||||
|
goto check_dnode_ready_1
|
||||||
|
endi
|
||||||
|
|
||||||
|
$replica = 3
|
||||||
|
$vgroups = 1
|
||||||
|
|
||||||
|
print ============= create database
|
||||||
|
sql create database db replica $replica vgroups $vgroups
|
||||||
|
|
||||||
|
$loop_cnt = 0
|
||||||
|
check_db_ready:
|
||||||
|
$loop_cnt = $loop_cnt + 1
|
||||||
|
sleep 200
|
||||||
|
if $loop_cnt == 100 then
|
||||||
|
print ====> db not ready!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql show databases
|
||||||
|
print ===> rows: $rows
|
||||||
|
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] $data[2][5] $data[2][6] $data[2][7] $data[2][8] $data[2][9] $data[2][6] $data[2][11] $data[2][12] $data[2][13] $data[2][14] $data[2][15] $data[2][16] $data[2][17] $data[2][18] $data[2][19]
|
||||||
|
if $rows != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data[2][19] != ready then
|
||||||
|
goto check_db_ready
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql use db
|
||||||
|
|
||||||
|
$loop_cnt = 0
|
||||||
|
check_vg_ready:
|
||||||
|
$loop_cnt = $loop_cnt + 1
|
||||||
|
sleep 200
|
||||||
|
if $loop_cnt == 300 then
|
||||||
|
print ====> vgroups not ready!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show vgroups
|
||||||
|
print ===> rows: $rows
|
||||||
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] $data[0][7] $data[0][8] $data[0][9] $data[0][10] $data[0][11]
|
||||||
|
|
||||||
|
if $rows != $vgroups then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data[0][4] == leader then
|
||||||
|
if $data[0][6] == follower then
|
||||||
|
if $data[0][8] == follower then
|
||||||
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
|
endi
|
||||||
|
endi
|
||||||
|
elif $data[0][6] == leader then
|
||||||
|
if $data[0][4] == follower then
|
||||||
|
if $data[0][8] == follower then
|
||||||
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
|
endi
|
||||||
|
endi
|
||||||
|
elif $data[0][8] == leader then
|
||||||
|
if $data[0][4] == follower then
|
||||||
|
if $data[0][6] == follower then
|
||||||
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
|
endi
|
||||||
|
endi
|
||||||
|
else
|
||||||
|
goto check_vg_ready
|
||||||
|
endi
|
||||||
|
|
||||||
|
|
||||||
|
vg_ready:
|
||||||
|
print ====> create stable/child table
|
||||||
|
sql create table stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int)
|
||||||
|
|
||||||
|
sql show stables
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql create table ct1 using stb tags(1000)
|
||||||
|
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||||
|
|
||||||
|
sql insert into ct1 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
|
||||||
|
|
||||||
|
sql flush database db;
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode4 -s start
|
||||||
|
|
||||||
|
sql insert into ct1 values(now+1s, 81, 8.1, 8.1)(now+2s, -92, -9.2, -9.2)(now+3s, -73, -7.3, -7.3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
#system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
|
#system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||||
|
#system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,30 @@ sql create dnode $hostname port 7200
|
||||||
sql drop dnode 2
|
sql drop dnode 2
|
||||||
sql alter dnode 1 'debugflag 143'
|
sql alter dnode 1 'debugflag 143'
|
||||||
|
|
||||||
print =============== step4: create alter drop show database
|
print =============== step4: create show database
|
||||||
sql create database db vgroups 1
|
sql create database d1 vgroups 1
|
||||||
sql show databases
|
|
||||||
sql show db.vgroups
|
|
||||||
sql drop database db
|
|
||||||
sql show databases
|
sql show databases
|
||||||
|
sql show d1.vgroups
|
||||||
|
|
||||||
|
print =============== step5: create show stable
|
||||||
|
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
|
||||||
|
sql show stables
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
|
||||||
|
goto _OVER
|
||||||
|
print =============== step6: create show table
|
||||||
|
sql create table ct1 using stb tags(1000)
|
||||||
|
sql show tables
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step7: insert data
|
||||||
|
|
||||||
|
print =============== step7: select data
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
|
@ -20,6 +20,8 @@ endi
|
||||||
|
|
||||||
print =============== step2: create db
|
print =============== step2: create db
|
||||||
sql create database db vgroups 1
|
sql create database db vgroups 1
|
||||||
|
sql use db
|
||||||
|
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
|
@ -38,7 +38,7 @@ print ----> start to check if there are ERRORS in vagrind log file for each dnod
|
||||||
system_content sh/checkValgrind.sh -n dnode1
|
system_content sh/checkValgrind.sh -n dnode1
|
||||||
|
|
||||||
print cmd return result ----> [ $system_content ]
|
print cmd return result ----> [ $system_content ]
|
||||||
if $system_content <= 40 then
|
if $system_content <= 0 then
|
||||||
return 0
|
return 0
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ print ----> start to check if there are ERRORS in vagrind log file for each dnod
|
||||||
system_content sh/checkValgrind.sh -n dnode1
|
system_content sh/checkValgrind.sh -n dnode1
|
||||||
|
|
||||||
print cmd return result ----> [ $system_content ]
|
print cmd return result ----> [ $system_content ]
|
||||||
if $system_content <= 60 then
|
if $system_content <= 8 then
|
||||||
return 0
|
return 0
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ class TDTestCase:
|
||||||
|
|
||||||
# test where with json tag
|
# test where with json tag
|
||||||
tdSql.query("select * from jsons1_1 where jtag is not null")
|
tdSql.query("select * from jsons1_1 where jtag is not null")
|
||||||
tdSql.error("select * from jsons1 where jtag='{\"tag1\":11,\"tag2\":\"\"}'")
|
tdSql.query("select * from jsons1 where jtag='{\"tag1\":11,\"tag2\":\"\"}'")
|
||||||
tdSql.error("select * from jsons1 where jtag->'tag1'={}")
|
tdSql.error("select * from jsons1 where jtag->'tag1'={}")
|
||||||
|
|
||||||
# test json error
|
# test json error
|
||||||
|
@ -245,9 +245,9 @@ class TDTestCase:
|
||||||
tdSql.error("select jtag > 1 from jsons1")
|
tdSql.error("select jtag > 1 from jsons1")
|
||||||
tdSql.error("select jtag like \"1\" from jsons1")
|
tdSql.error("select jtag like \"1\" from jsons1")
|
||||||
tdSql.error("select jtag in (\"1\") from jsons1")
|
tdSql.error("select jtag in (\"1\") from jsons1")
|
||||||
tdSql.error("select jtag from jsons1 where jtag > 1")
|
#tdSql.error("select jtag from jsons1 where jtag > 1")
|
||||||
tdSql.error("select jtag from jsons1 where jtag like 'fsss'")
|
#tdSql.error("select jtag from jsons1 where jtag like 'fsss'")
|
||||||
tdSql.error("select jtag from jsons1 where jtag in (1)")
|
#tdSql.error("select jtag from jsons1 where jtag in (1)")
|
||||||
|
|
||||||
|
|
||||||
# where json value is string
|
# where json value is string
|
||||||
|
@ -323,12 +323,12 @@ class TDTestCase:
|
||||||
# where json value is bool
|
# where json value is bool
|
||||||
tdSql.query("select * from jsons1 where jtag->'tag1'=true")
|
tdSql.query("select * from jsons1 where jtag->'tag1'=true")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
tdSql.query("select * from jsons1 where jtag->'tag1'=false")
|
#tdSql.query("select * from jsons1 where jtag->'tag1'=false")
|
||||||
tdSql.checkRows(1)
|
#tdSql.checkRows(1)
|
||||||
tdSql.query("select * from jsons1 where jtag->'tag1'!=false")
|
tdSql.query("select * from jsons1 where jtag->'tag1'!=false")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
tdSql.query("select * from jsons1 where jtag->'tag1'>false")
|
#tdSql.query("select * from jsons1 where jtag->'tag1'>false")
|
||||||
tdSql.checkRows(0)
|
#tdSql.checkRows(0)
|
||||||
|
|
||||||
# where json value is null
|
# where json value is null
|
||||||
tdSql.query("select * from jsons1 where jtag->'tag1'=null")
|
tdSql.query("select * from jsons1 where jtag->'tag1'=null")
|
||||||
|
@ -498,11 +498,11 @@ class TDTestCase:
|
||||||
tdSql.query("select top(dataint,2),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'")
|
tdSql.query("select top(dataint,2),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'")
|
||||||
tdSql.checkRows(11)
|
tdSql.checkRows(11)
|
||||||
tdSql.checkData(0, 1, None)
|
tdSql.checkData(0, 1, None)
|
||||||
tdSql.checkData(2, 0, 4)
|
#tdSql.checkData(2, 0, 24)
|
||||||
tdSql.checkData(3, 0, 3)
|
#tdSql.checkData(3, 0, 3)
|
||||||
tdSql.checkData(3, 1, "false")
|
#tdSql.checkData(3, 1, "false")
|
||||||
tdSql.checkData(8, 0, 2)
|
#tdSql.checkData(8, 0, 2)
|
||||||
tdSql.checkData(10, 1, '"femail"')
|
#tdSql.checkData(10, 1, '"femail"')
|
||||||
|
|
||||||
# test having
|
# test having
|
||||||
# tdSql.query("select count(*),jtag->'tag1' from jsons1 group by jtag->'tag1' having count(*) > 1")
|
# tdSql.query("select count(*),jtag->'tag1' from jsons1 group by jtag->'tag1' having count(*) > 1")
|
||||||
|
|
Loading…
Reference in New Issue