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

📄 example.c

📁 北大Java 语言程序设计 ppt课件及源码
💻 C
字号:
#include <native.h>#include "NativeExample.h"static char *quotes[] = {    "The truth is out there -- X-Files",    "I suppose it will all make sense when we grow up -- Calvin & Hobbes",    "Who died and made you king? -- my dad"};struct Hjava_lang_String *NativeExample_quote(struct HNativeExample *unused, long index){    char *quotation;    if (index < 1 || index > 3) {	SignalError(0, "java/lang/IllegalArgumentException", 0);	return NULL;    }    quotation = quotes[index - 1];    return makeJavaString(quotation, strlen(quotation));}long NativeExample_twoTimes(struct HNativeExample *hInst){    return unhand(hInst)->myValue * 2;}struct HNativeExample *NativeExample_doubleUp(struct HNativeExample *hInst){    HNativeExample *hNewInst;    long twoX;    hNewInst = (HNativeExample *)execute_java_constructor(	0, "NativeExample", 0, "(I)", unhand(hInst)->myValue);    twoX = (long)execute_java_dynamic_method(	0, (HObject *)hNewInst, "twoTimes", "()I");    unhand(hNewInst)->myValue = twoX;    return hNewInst;}

⌨️ 快捷键说明

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