/* * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/** * This macros must be used under SyncCall or on the Toolkit thread.
*/ #define JNI_CHECK_PEER_GOTO(peer, where) { \
JNI_CHECK_NULL_GOTO(peer, "peer", where); \
pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \ goto where; \
} \
}
/** * This macros must be used under SyncCall or on the Toolkit thread.
*/ #define JNI_CHECK_PEER_RETURN(peer) { \
JNI_CHECK_NULL_RETURN(peer, "peer"); \
pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \ return; \
} \
}
/** * This macros must be used under SyncCall or on the Toolkit thread.
*/ #define JNI_CHECK_PEER_RETURN_NULL(peer) { \
JNI_CHECK_NULL_RETURN_NULL(peer, "peer"); \
pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \ return 0; \
} \
}
/** * This macros must be used under SyncCall or on the Toolkit thread.
*/ #define JNI_CHECK_PEER_RETURN_VAL(peer, val) { \
JNI_CHECK_NULL_RETURN_VAL(peer, "peer", val); \
pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \ return val; \
} \
}
/* * macros to crack a LPARAM into two ints -- used for signed coordinates, * such as with mouse messages.
*/ #define LO_INT(l) ((int)(short)(l)) #define HI_INT(l) ((int)(short)(((DWORD)(l) >> 16) & 0xFFFF))
/* * Itanium symbols needed for 64-bit compilation. * These are defined in winuser.h in the August 2001 MSDN update.
*/ #ifndef GCLP_HBRBACKGROUND #ifdef _WIN64 #error Macros for GetClassLongPtr, etc. are for 32-bit windows only #endif/* !_WIN64 */ #define GetClassLongPtr GetClassLong #define SetClassLongPtr SetClassLong #define GCLP_HBRBACKGROUND GCL_HBRBACKGROUND #define GCLP_HCURSOR GCL_HCURSOR #define GCLP_HICON GCL_HICON #define GCLP_HICONSM GCL_HICONSM #define GCLP_HMODULE GCL_HMODULE #define GCLP_MENUNAME GCL_MENUNAME #define GCLP_WNDPROC GCL_WNDPROC #define GetWindowLongPtr GetWindowLong #define SetWindowLongPtr SetWindowLong #define GWLP_WNDPROC GWL_WNDPROC #define GWLP_HINSTANCE GWL_HINSTANCE #define GWLP_HWNDPARENT GWL_HWNDPARENT #define GWLP_ID GWL_ID #define GWLP_USERDATA GWL_USERDATA #define DWLP_DLGPROC DWL_DLGPROC #define DWLP_MSGRESULT DWL_MSGRESULT #define DWLP_USER DWL_USER #endif/* !GCLP_HBRBACKGROUND */
/* * macros for saving and restoring FPU control word * NOTE: float.h must be defined if using these macros
*/ #define SAVE_CONTROLWORD \ unsignedint fpu_cw = _control87(0, 0);
/* * checks if the current thread is/isn't the toolkit thread
*/ #ifdefined(DEBUG) #define CHECK_IS_TOOLKIT_THREAD() \ if (GetCurrentThreadId() != AwtToolkit::MainThread()) \
{ JNU_ThrowInternalError(env,"Operation is not permitted on non-toolkit thread!\n"); } #define CHECK_ISNOT_TOOLKIT_THREAD() \ if (GetCurrentThreadId() == AwtToolkit::MainThread()) \
{ JNU_ThrowInternalError(env,"Operation is not permitted on toolkit thread!\n"); } #else #define CHECK_IS_TOOLKIT_THREAD() #define CHECK_ISNOT_TOOLKIT_THREAD() #endif
/* * Class to encapsulate the extraction of the java string contents * into a buffer and the cleanup of the buffer
*/ class JavaStringBuffer
{ protected:
LPWSTR m_pStr;
jsize m_dwSize;
LPCWSTR getNonEmptyString() { return (NULL==m_pStr)
? L""
: m_pStr;
}
void Resize(jsize cbTCharCount) {
m_dwSize = cbTCharCount; //It is ok to have non-null terminated string here. //The function is used only for space reservation in staff buffer for //followed data copying process. And that is the reason why we ignore //the special case m_dwSize==0 here.
m_pStr = (LPWSTR)SAFE_SIZE_ARRAY_REALLOC(safe_Realloc, m_pStr, m_dwSize+1, sizeof(WCHAR) );
} //we are in UNICODE now, so LPWSTR:=:LPTSTR operator LPCWSTR() { return getNonEmptyString(); } operator LPARAM() { return (LPARAM)getNonEmptyString(); } constvoid *GetData() { return (constvoid *)getNonEmptyString(); }
jsize GetSize() { return m_dwSize; }
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.