⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 native.h

📁 vc6.0完整版
💻 H
📖 第 1 页 / 共 2 页
字号:
int64_t __cdecl execute_java_static_methodV(ExecEnv *ee, ClassClass *cb,
        const char *method_name, const char *signature, va_list args);

//----------------------------------------------------------------------------
// NB The resolve flag is ignored, classes found with this api will always
// be resolved.
//----------------------------------------------------------------------------
ClassClass* __cdecl FindClass(ExecEnv *ee, char *classname, bool_t resolve);

//----------------------------------------------------------------------------
// FindClassEx
//
// Similar to FindClass, but can take some flags that control how the class
// load operation works.
//
// The valid flags are:
//  
//   FINDCLASSEX_NOINIT
//      If the class is a system class, will prevent the classes static
//      initializer from running.  
//
//   FINDCLASSEX_IGNORECASE
//      Will perform a case-insensitive validation of the class name, as
//      opposed to the case-sensitive validation that normally occurs.
//
//   FINDCLASSEX_SYSTEMONLY
//       Will only look for the named class as a system class.
//
//----------------------------------------------------------------------------

#define FINDCLASSEX_NOINIT      0x0001
#define FINDCLASSEX_IGNORECASE  0x0002
#define FINDCLASSEX_SYSTEMONLY  0x0004

ClassClass* __cdecl FindClassEx(char *pszClassName,DWORD dwFlags);

//----------------------------------------------------------------------------
// Helper function that returns a methodblock.
//----------------------------------------------------------------------------
struct methodblock* __cdecl get_methodblock(HObject *pjobj, const char
        *method_name, char *signature);

//----------------------------------------------------------------------------
// If you pass in a methodblock from get_methodblock the method name and
// sig are ignored and so it's faster than a regular execute.
//----------------------------------------------------------------------------
#ifndef do_execute_java_method
long __cdecl do_execute_java_method(ExecEnv *ee, void *obj, const char
        *method_name, const char *signature, struct methodblock *mb,
        bool_t isStaticCall, ...);
#endif
int64_t __cdecl do_execute_java_method64(ExecEnv *ee, void *obj, const char
        *method_name, const char *signature, struct methodblock *mb,
        bool_t isStaticCall, ...);

//----------------------------------------------------------------------------
// isInstanceOf
//
// Returns true if the specified object can be cast to the named class
// type.
//----------------------------------------------------------------------------

BOOL __cdecl isInstanceOf(JHandle *phobj, const char *classname);

//----------------------------------------------------------------------------
// is_instance_of
//
// Returns true if the specified object can be cast to the specified
// class type.
//----------------------------------------------------------------------------

BOOL __cdecl is_instance_of(JHandle *phobj,ClassClass *dcb,ExecEnv *ee);

//----------------------------------------------------------------------------
// is_subclass_of
//
// Returns true if the class (cb) is a subclass of the specified class(dcb).
//----------------------------------------------------------------------------

BOOL __cdecl is_subclass_of(ClassClass *cb, ClassClass *dcb, ExecEnv *ee);

//----------------------------------------------------------------------------
// ImplementsInterface
//
// Returns true if the class (cb) implements the specified interface (icb).
//----------------------------------------------------------------------------

BOOL __cdecl ImplementsInterface(ClassClass *cb,ClassClass *icb,ExecEnv *ee);

//----------------------------------------------------------------------------
#define T_TMASK	034
#define T_LMASK 003
#define T_MKTYPE( t, l )  ( ( (t)&T_TMASK ) | ( (l)&T_LMASK) )

#define T_CLASS		2
#define T_FLOATING	4	
#define T_CHAR		5
#define T_INTEGER	010
#define T_BOOLEAN	4

#define T_FLOAT     T_MKTYPE(T_FLOATING,2)
#define T_DOUBLE    T_MKTYPE(T_FLOATING,3)
#define T_BYTE	    T_MKTYPE(T_INTEGER,0)
#define T_SHORT	    T_MKTYPE(T_INTEGER,1)
#define T_INT	    T_MKTYPE(T_INTEGER,2)
#define T_LONG	    T_MKTYPE(T_INTEGER,3)

//----------------------------------------------------------------------------
// Create an array of primitive types only (int, long etc).
//----------------------------------------------------------------------------
HObject* __cdecl ArrayAlloc(int type, int cItems);

//----------------------------------------------------------------------------
// Create an array of objects.
//----------------------------------------------------------------------------
HObject* __cdecl ClassArrayAlloc(int type, int cItems, const char *szSig);

//----------------------------------------------------------------------------
// Copy an array ala System.arrayCopy()
//----------------------------------------------------------------------------
void __cdecl ArrayCopy(HObject *srch, long src_pos, HObject *dsth, 
        long dst_pos, long length);

//----------------------------------------------------------------------------
// Create and return a new array of bytes initialized from the C string.
//----------------------------------------------------------------------------
HArrayOfByte* __cdecl MakeByteString(const char *str, long len);

//----------------------------------------------------------------------------
// Create and return a new Java String object, initialized from the C string.
//----------------------------------------------------------------------------
Hjava_lang_String* __cdecl makeJavaString(const char *str, int len);
Hjava_lang_String* __cdecl makeJavaStringW(const unicode *pszwSrc, int cch);

//----------------------------------------------------------------------------
// Create and return a new Java String object, initialized from a null 
// terminated, UTF8 formatted, C string.
//----------------------------------------------------------------------------
Hjava_lang_String* __cdecl makeJavaStringFromUtf8(const char *pszUtf8);

//----------------------------------------------------------------------------
// Get the characters of the String object into a C string buffer.
// No allocation occurs. Assumes that len is the size of the buffer.
// The C string's address is returned.
//----------------------------------------------------------------------------
char* __cdecl javaString2CString(Hjava_lang_String *s, char *buf, int buflen);

//----------------------------------------------------------------------------
// Return the length of the String object.
//----------------------------------------------------------------------------
int __cdecl javaStringLength(Hjava_lang_String *s);

//----------------------------------------------------------------------------
// Return temporary ptr to first char of the String object.
// May change when gc happens.
//----------------------------------------------------------------------------
unicode * __cdecl javaStringStart (HString *string);

//----------------------------------------------------------------------------
// Note: The int passed to these API's must be an object ptr.
//----------------------------------------------------------------------------
#define obj_monitor(handlep) ((int) handlep)
void __cdecl monitorEnter(unsigned int);
void __cdecl monitorExit(unsigned int);
void __cdecl monitorNotify(unsigned int);
void __cdecl monitorNotifyAll(unsigned int);
void __cdecl monitorWait(unsigned int, int64_t millis);

#define ObjectMonitorEnter(obj)         monitorEnter((int)obj)
#define ObjectMonitorExit(obj)          monitorExit((int)obj)
#define ObjectMonitorNotify(obj)        monitorNotify((int)obj)
#define ObjectMonitorNotifyAll(obj)     monitorNotifyAll((int)obj)
#define ObjectMonitorWait(obj,millis)   monitorWait((int)obj,millis)

//----------------------------------------------------------------------------
// String helpers...
//----------------------------------------------------------------------------
int __cdecl jio_snprintf(char *str, size_t count, const char *fmt, ...);
int __cdecl jio_vsnprintf(char *str, size_t count, const char *fmt, va_list 
        args);

//----------------------------------------------------------------------------
// Methods to get information about the caller of a native method.
//----------------------------------------------------------------------------

ClassClass * __cdecl GetNativeMethodCallersClass();
struct methodblock* __cdecl GetNativeMethodCallersMethodInfo();

//----------------------------------------------------------------------------
// Member attributes, as appear in Java class file.
//----------------------------------------------------------------------------

#define ACC_PUBLIC      0x0001       
#define ACC_PRIVATE     0x0002       
#define ACC_PROTECTED   0x0004       
#define ACC_STATIC      0x0008       
#define ACC_FINAL       0x0010       
#define ACC_SYNCH       0x0020       
#define ACC_SUPER       0x0020       
#define ACC_THREADSAFE  0x0040       
#define ACC_VOLATILE    0x0040        
#define ACC_TRANSIENT   0x0080        
#define ACC_NATIVE      0x0100        
#define ACC_INTERFACE   0x0200        
#define ACC_ABSTRACT    0x0400        

//----------------------------------------------------------------------------
// Class information
//----------------------------------------------------------------------------

// Total number of fields in the class, including supers
unsigned __cdecl            Class_GetFieldCount(ClassClass *cls);
struct fieldblock * __cdecl Class_GetField(ClassClass *cls, const char *name);
struct fieldblock * __cdecl Class_GetFieldByIndex(ClassClass *cls, unsigned index);
// Total number of methods, including supers.
unsigned __cdecl            Class_GetMethodCount(ClassClass *cls);
struct methodblock* __cdecl Class_GetMethod(ClassClass *cls, const char *name, const char *signature);
struct methodblock* __cdecl Class_GetMethodByIndex(ClassClass *cls, unsigned index);
ClassClass * __cdecl        Class_GetSuper(ClassClass *cls);
const char * __cdecl        Class_GetName(ClassClass *cls);
unsigned __cdecl            Class_GetInterfaceCount(ClassClass *cls);
ClassClass * __cdecl        Class_GetInterface(ClassClass *cls, unsigned index);
// Returns combination of ACC_* constants.
int __cdecl                 Class_GetAttributes(ClassClass *cls);

//----------------------------------------------------------------------------
// Field/method information
//----------------------------------------------------------------------------

const char * __cdecl        Member_GetName(PVOID member);
const char * __cdecl        Member_GetSignature(PVOID member);
// class of the field/method is implemented in.
ClassClass * __cdecl        Member_GetClass(PVOID member);
// Returns combination of ACC_* constants.
int __cdecl                 Member_GetAttributes(PVOID member);

// For non-static fields, Offset of field in object.  See also Field_Get/SetValue.
unsigned __cdecl            Field_GetOffset(struct fieldblock * field);
// Ptr to static value
PVOID __cdecl               Field_GetStaticPtr(struct fieldblock * field);


//----------------------------------------------------------------------------
// Object accessors
//----------------------------------------------------------------------------
ClassClass * __cdecl        Object_GetClass(HObject *obj);

__int32 __cdecl             Field_GetValue(HObject *obj, struct fieldblock * field);
__int64 __cdecl             Field_GetValue64(HObject *obj, struct fieldblock * field);
float __cdecl               Field_GetFloat(HObject *obj, struct fieldblock * field);
double __cdecl              Field_GetDouble(HObject *obj, struct fieldblock * field);
void __cdecl                Field_SetValue(HObject *obj, struct fieldblock * field, __int32 value);
void __cdecl                Field_SetValue64(HObject *obj, struct fieldblock * field, __int64 value);
void __cdecl                Field_SetFloat(HObject *obj, struct fieldblock * field, float value);
void __cdecl                Field_SetDouble(HObject *obj, struct fieldblock * field, double value);

#define Field_GetBoolean(obj,field)     ((bool_t)       Field_GetValue(obj,field))
#define Field_GetByte(obj,field)        ((signed char)  Field_GetValue(obj,field))
#define Field_GetChar(obj,field)        ((unicode)      Field_GetValue(obj,field))
#define Field_GetShort(obj,field)       ((short)        Field_GetValue(obj,field))
#define Field_GetInt(obj,field)                         Field_GetValue(obj,field)
#define Field_GetLong(obj,field)                        Field_GetValue64(obj,field)
#define Field_GetObject(obj,field)      ((HObject*)     Field_GetValue(obj,field))
#define Field_GetFloat(obj,field)                       Field_GetFloat(obj,field)
#define Field_GetDouble(obj,field)                      Field_GetDouble(obj,field)

#define Field_SetBoolean(obj,field,value)               Field_SetValue(obj,field,(bool_t)(value))
#define Field_SetByte(obj,field,value)                  Field_SetValue(obj,field,(signed char)(value))
#define Field_SetChar(obj,field,value)                  Field_SetValue(obj,field,(unicode)(value))
#define Field_SetShort(obj,field,value)                 Field_SetValue(obj,field,(short)(value))
#define Field_SetInt(obj,field,value)                   Field_SetValue(obj,field,value)
#define Field_SetLong(obj,field,value)                  Field_SetValue64(obj,field,value)
#define Field_SetObject(obj,field,value)                Field_SetValue(obj,field,(__int32)(value))
#define Field_SetFloat(obj,field,value)                 Field_SetFloat(obj,field,value)
#define Field_SetDouble(obj,field,value)                Field_SetDouble(obj,field,value)


#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -