本文整理汇总了C++中UserClass类的典型用法代码示例。如果您正苦于以下问题:C++ UserClass类的具体用法?C++ UserClass怎么用?C++ UserClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: j3StaticFieldLookup
// Throws if the field or its class is not found.
extern "C" void* j3StaticFieldLookup(UserClass* caller, uint32 index) {
void* res = 0;
UserConstantPool* ctpInfo = caller->getConstantPool();
if (ctpInfo->ctpRes[index]) {
res = ctpInfo->ctpRes[index];
} else {
UserCommonClass* cl = 0;
UserClass* fieldCl = 0;
const UTF8* utf8 = 0;
Typedef* sign = 0;
ctpInfo->resolveField(index, cl, utf8, sign);
assert(cl->asClass() && "Lookup a field of something not an array");
JavaField* field = cl->asClass()->lookupField(utf8, sign->keyName, true,
true, &fieldCl);
fieldCl->initialiseClass(JavaThread::get()->getJVM());
void* obj = ((UserClass*)fieldCl)->getStaticInstance();
assert(obj && "No static instance in static field lookup");
void* ptr = (void*)((uint64)obj + field->ptrOffset);
ctpInfo->ctpRes[index] = ptr;
res = ptr;
}
return res;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:35,代码来源:JavaRuntimeJIT.cpp
示例2: ModeChange
/*モードチェンジ*/
void TextClass::ModeChange(int &ModeFlag,int &ChangeFlag,UserClass &User){
//インスタンス化
MouseClass* Mouse = MouseClass::GetInstance();
AnimeClass Anime;
static int Count = 0;
const int AtherSelect = -1;
//タイマー
static int Timer = 0;
if( WriteMode != NOTWINDOW ) Timer++;
//モードチェンジ
if( Mouse->GetState(MOUSE::LEFT) == TRUE ){
if( Select == GAME_MENU::SAVE ) ModeFlag = MODE::SAVE;
if( Select == GAME_MENU::LOAD ) ModeFlag = MODE::LOAD;
if( Select == GAME_MENU::BACKLOG ) WriteMode = BACKLOG;
if( Select == GAME_MENU::CONFIG ) ModeFlag = MODE::CONFIG;
if( Select == GAME_MENU::AUTO ) AutoFlag *= -1;
ChangeFlag = TRUE;
}
//ウィンドウ非表示
/*
if( Mouse->GetState( MOUSE::RIGHT) > 0 && WriteMode == NORMAL && Timer > 20 ){
WriteMode = NOTWINDOW;
Timer = 0;
}
*/
//バックログ
if( Mouse->GetWheel() > 0 && WriteMode == NORMAL ) WriteMode = BACKLOG;
//エンディングモードへ
if( WriteMode == END ){ //&& Mouse->GetState(MOUSE::LEFT) > 10 ){
Select = AtherSelect;
WriteMode = NORMAL;
ModeFlag = MODE::END;
//ModeFlag = MODE::OTHER;
//User.SetPage( PAGE::TITLE );
}
//タイトル画面へ
if( WriteMode == TITLE ){
Count++;
DrawBox(0,0,windowX,windowY,GetColor(0,0,0),TRUE);
SetFontSize(100);
ChangeFont("MS 明朝");
DrawString(windowX/3,windowY/3,"- FIN - ",GetColor(255,255,255));
User.SetBGMCode( GAME_BGM::STOP );
if( Count > 200 ){
WriteMode = NORMAL;
ModeFlag = MODE::OTHER;
User.SetPage( PAGE::TITLE );
Count = 0;
}
}
}
开发者ID:kawashi,项目名称:Reverberation,代码行数:61,代码来源:text.cpp
示例3: j3ResolveStaticStub
extern "C" void* j3ResolveStaticStub() {
JavaThread *th = JavaThread::get();
void* result = NULL;
// Lookup the caller of this class.
vmkit::StackWalker Walker(th);
++Walker; // Remove the stub.
vmkit::FrameInfo* FI = Walker.get();
assert(FI->Metadata != NULL && "Wrong stack trace");
JavaMethod* caller = (JavaMethod*)FI->Metadata;
// Lookup the method info in the constant pool of the caller.
uint16 ctpIndex = caller->lookupCtpIndex(FI);
assert(ctpIndex && "No constant pool index");
JavaConstantPool* ctpInfo = caller->classDef->getConstantPool();
CommonClass* cl = 0;
const UTF8* utf8 = 0;
Signdef* sign = 0;
ctpInfo->resolveMethod(ctpIndex, cl, utf8, sign);
UserClass* lookup = cl->isArray() ? cl->super : cl->asClass();
assert(lookup->isInitializing() && "Class not ready");
JavaMethod* callee = lookup->lookupMethod(utf8, sign->keyName, true, true, 0);
// Compile the found method.
result = callee->compiledPtr();
// Update the entry in the constant pool.
ctpInfo->ctpRes[ctpIndex] = result;
return result;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:32,代码来源:JavaRuntimeJIT.cpp
示例4: j3VirtualFieldLookup
// Throws if the field is not found.
extern "C" void* j3VirtualFieldLookup(UserClass* caller, uint32 index) {
void* res = 0;
UserConstantPool* ctpInfo = caller->getConstantPool();
if (ctpInfo->ctpRes[index]) {
res = ctpInfo->ctpRes[index];
} else {
UserCommonClass* cl = 0;
const UTF8* utf8 = 0;
Typedef* sign = 0;
ctpInfo->resolveField(index, cl, utf8, sign);
UserClass* lookup = cl->isArray() ? cl->super : cl->asClass();
JavaField* field = lookup->lookupField(utf8, sign->keyName, false, true, 0);
ctpInfo->ctpRes[index] = (void*)(intptr_t)field->ptrOffset;
res = (void*)(intptr_t)field->ptrOffset;
}
return res;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:26,代码来源:JavaRuntimeJIT.cpp
示例5: llvm_gcroot
UserClass* JnjvmClassLoader::constructClass(const UTF8* name,
ClassBytes* bytes) {
JavaObject* excp = NULL;
llvm_gcroot(excp, 0);
UserClass* res = NULL;
lock2.lock();
classes->lock.lock();
res = (UserClass*) classes->map.lookup(name);
classes->lock.unlock();
if (res == NULL) {
TRY {
const UTF8* internalName = readerConstructUTF8(name->elements, name->size);
res = new(allocator, "Class") UserClass(this, internalName, bytes);
res->readClass();
res->makeVT();
getCompiler()->resolveVirtualClass(res);
getCompiler()->resolveStaticClass(res);
classes->lock.lock();
assert(res->getDelegatee() == NULL);
assert(res->getStaticInstance() == NULL);
assert(classes->map.lookup(internalName) == NULL);
classes->map[internalName] = res;
classes->lock.unlock();
} CATCH {
excp = JavaThread::get()->pendingException;
JavaThread::get()->clearException();
} END_CATCH;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:28,代码来源:JnjvmClassLoader.cpp
示例6: j3VirtualTableLookup
// Throws if the method is not found.
extern "C" uint32 j3VirtualTableLookup(UserClass* caller, uint32 index,
uint32* offset, JavaObject* obj) {
llvm_gcroot(obj, 0);
uint32 res = 0;
UserCommonClass* cl = 0;
const UTF8* utf8 = 0;
Signdef* sign = 0;
caller->getConstantPool()->resolveMethod(index, cl, utf8, sign);
UserClass* lookup = cl->isArray() ? cl->super : cl->asClass();
JavaMethod* dmeth = lookup->lookupMethodDontThrow(utf8, sign->keyName, false,
true, 0);
if (!dmeth) {
assert((JavaObject::getClass(obj)->isClass() &&
JavaObject::getClass(obj)->asClass()->isInitializing()) &&
"Class not ready in a virtual lookup.");
// Arg, the bytecode is buggy! Perform the lookup on the object class
// and do not update offset.
lookup = JavaObject::getClass(obj)->isArray() ?
JavaObject::getClass(obj)->super :
JavaObject::getClass(obj)->asClass();
dmeth = lookup->lookupMethod(utf8, sign->keyName, false, true, 0);
} else {
*offset = dmeth->offset;
}
assert(dmeth->classDef->isInitializing() &&
"Class not ready in a virtual lookup.");
res = dmeth->offset;
return res;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:35,代码来源:JavaRuntimeJIT.cpp
示例7: InitGameCount
/*ゲームカウント初期化*/
void TextClass::InitGameCount(UserClass& User){
//ゲームカウント取得
SaveData = User.GetSaveData();
SceneCount = SaveData.SceneCount;
TextCount = SaveData.TextCount;
SerifCount = SaveData.SerifCount;
User.SetBGMCode ( SaveData.BGMCode );
User.SetBackCode( SaveData.BackCode );
User.SetCharacterCode( SaveData.CharCode );
}
开发者ID:kawashi,项目名称:Reverberation,代码行数:11,代码来源:text.cpp
示例8: tryIt
void
tryIt(const String& filename)
{
try {
UserClass u;
u.f(filename);
cout << " OK\n";
}
catch (const BadFileName& e) {
cout << " Finish recovering from bad-file-name\n";
}
}
开发者ID:akbertram,项目名称:egcs-jvm,代码行数:12,代码来源:eb78.C
示例9: llvm_gcroot
JavaObjectMethod* JavaObjectMethod::createFromInternalMethod(JavaMethod* meth, int i) {
JavaObjectMethod* ret = 0;
JavaString* str = 0;
JavaObject* pArr = 0;
JavaObject* eArr = 0;
JavaObject* retTy = 0;
ArraySInt8* ann = 0;
ArraySInt8* pmAnn = 0;
ArraySInt8* defAnn = 0;
llvm_gcroot(ret, 0);
llvm_gcroot(str, 0);
llvm_gcroot(pArr, 0);
llvm_gcroot(eArr, 0);
llvm_gcroot(retTy, 0);
llvm_gcroot(ann, 0);
llvm_gcroot(pmAnn, 0);
llvm_gcroot(defAnn, 0);
// TODO: check parameter types
Jnjvm* vm = JavaThread::get()->getJVM();
JnjvmClassLoader * classLoader = meth->classDef->classLoader;
UserClass* Meth = vm->upcalls->newMethod;
ret = (JavaObjectMethod*)Meth->doNew(vm);
str = vm->internalUTF8ToStr(meth->name);
pArr = meth->getParameterTypes(classLoader);
eArr = meth->getExceptionTypes(classLoader);
retTy = meth->getReturnType(classLoader);
JavaString ** sig = getSignature(meth);
ann = getAnnotations(meth);
pmAnn = getParamAnnotations(meth);
defAnn = getAnnotationDefault(meth);
JavaObject* const* Cl = meth->classDef->getClassDelegateePtr(vm);
vm->upcalls->initMethod->invokeIntSpecial(vm, Meth, ret,
Cl, /* declaring class */
&str, /* name */
&pArr, /* parameter types */
&retTy, /* return type */
&eArr, /* exceptions */
meth->access, /* modifiers */
i, /* slot */
sig, /* signature */
&ann, /* annotations */
&pmAnn, /* parameter annotations */
&defAnn); /* default annotations */
return ret;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:49,代码来源:ClasspathReflect.cpp
示例10: nativeGetCallingClass
extern "C" JavaObject* nativeGetCallingClass() {
JavaObject* res = 0;
llvm_gcroot(res, 0);
BEGIN_NATIVE_EXCEPTION(0)
JavaThread* th = JavaThread::get();
UserClass* cl = th->getCallingClassLevel(2);
if (cl != NULL) res = cl->getClassDelegatee(th->getJVM());
END_NATIVE_EXCEPTION
return res;
}
开发者ID:chanwit,项目名称:vmkit,代码行数:15,代码来源:JavaUpcalls.cpp
示例11: Java_gnu_classpath_VMStackWalker_getCallingClass__
extern "C" JavaObject* Java_gnu_classpath_VMStackWalker_getCallingClass__() {
JavaObject* res = 0;
llvm_gcroot(res, 0);
BEGIN_NATIVE_EXCEPTION(0)
JavaThread* th = JavaThread::get();
UserClass* cl = th->getCallingClassLevel(2);
if (cl != NULL) res = cl->getClassDelegatee(th->getJVM());
END_NATIVE_EXCEPTION
return res;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:15,代码来源:JavaUpcalls.cpp
示例12: CheckText
/*様々なテキストチェック*/
void TextClass::CheckText(UserClass &User){
//メニュー決定フラグを折っておく
MenuEnterFlag = 0;
const int AtherSelect = -1;
//一回目フラグ
static bool FirstFlag = FALSE;
//シーンの終わりなら、次のシーンへ(カウント更新)
if( TextCount >= LineMax[SceneCount] ){
SceneCount++;
TextCount = 0;
SerifCount = 0;
//ユーザークラスに渡す
SaveData.SceneCount = SceneCount;
SaveData.TextCount = TextCount;
SaveData.SerifCount = SerifCount;
User.SetSaveData(SaveData);
//アイキャッチを動作させる
WriteMode = EYECATCH;
}
//シーンのはじめにアイキャッチを動作させる
if( SceneCount == 0 && TextCount == 0 && FirstFlag == FALSE ){
Select = AtherSelect;
WriteMode = EYECATCH;
FirstFlag = TRUE;
}
if( TextCount > 0 ) FirstFlag = FALSE;
}
开发者ID:kawashi,项目名称:Reverberation,代码行数:36,代码来源:text.cpp
示例13: ReadUpdate
/*コンフィグの未読スキップ許可設定*/
void TextClass::ReadUpdate(UserClass &User){
short int WriteData[2];
FILE *fp;
int SkipFlag;
//スキップフラグを取得
SkipFlag = User.GetSkipFlag();
//許可
if( SkipFlag == 0 ){
SkipPermitFlag = 1;
//fp = fopen("./resource/data/read.dat","wb+");
//WriteData[0] = 999;
//WriteData[1] = 999;
//fwrite(WriteData,2,sizeof(short int),fp);
//fclose(fp);
}
//禁止
if( SkipFlag == 1 ){
SkipPermitFlag = 0;
/* fp = fopen("./resource/data/read.dat","wb+");
WriteData[0] = SceneCount;
WriteData[1] = TextCount;
fwrite(WriteData,2,sizeof(short int),fp);
fclose(fp);*/
}
}
开发者ID:kawashi,项目名称:Reverberation,代码行数:31,代码来源:text.cpp
示例14: Java_sun_reflect_Reflection_getCallerClass__I
extern "C" JavaObject* Java_sun_reflect_Reflection_getCallerClass__I(uint32 index) {
JavaObject* res = 0;
llvm_gcroot(res, 0);
BEGIN_NATIVE_EXCEPTION(0)
JavaThread* th = JavaThread::get();
Jnjvm* vm = th->getJVM();
UserClass* cl = th->getCallingClassLevel(index);
if (cl) res = cl->getClassDelegatee(vm);
END_NATIVE_EXCEPTION
return res;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:16,代码来源:JavaUpcalls.cpp
示例15: DrawChar
/*キャラクタ描画*/
void TextGraphClass::DrawChar(UserClass &User){
//キャラクタ描画
switch( User.GetCharacterCode() ){
case GAME_CHAR::AI:
DrawGraph(CharacterPoint[GRAPH::X],CharacterPoint[GRAPH::Y],CharacterHandle,TRUE);
break;
case GAME_CHAR::NOT:
break;
}
}
开发者ID:kawashi,项目名称:Reverberation,代码行数:12,代码来源:graph.cpp
示例16: main
int main()
{
SortStrategy* s = new ShellSort();
UserClass* c = new UserClass(s);
c->sort(); // mit Shellsort sortieren
//Algorithmus wechseln
c->changeStrategy(new QuickSort());
c->sort(); // jetzt wird mit Quicksort sortiert
// in C++ müssen wir selbst allozierte Speicherbereiche auch wieder freigeben:
delete s;
delete c;
// ACHTUNG: Beim Aufruf von "c->changeStrategy(new QuickSort());" haben wir uns jedoch nicht
// die Speicheradresse des neuen QuickSort-Objekt
// gemerkt und können es somit auch nicht selbst wieder freigeben. D. h., hier würde ein Memory
// Leak entstehen, wenn das Programm noch länger laufen würde.
return 0;
}
开发者ID:supr,项目名称:algorithms,代码行数:21,代码来源:strategy_pattern.cpp
示例17: llvm_gcroot
JavaString* JavaString::stringDup(const ArrayUInt16*& _array, Jnjvm* vm) {
JavaString* res = 0;
const ArrayUInt16* array = _array;
llvm_gcroot(array, 0);
llvm_gcroot(res, 0);
UserClass* cl = vm->upcalls->newString;
res = (JavaString*)cl->doNew(vm);
// It's a hashed string, set the destructor so that the string
// removes itself from the vm string map. Do this only if
// internStringVT exists (in case of AOT).
if (internStringVT) res->setVirtualTable(internStringVT);
// No need to call the Java function: both the Java function and
// this function do the same thing.
JavaString::setValue(res, array);
res->count = ArrayUInt16::getSize(array);
res->offset = 0;
res->cachedHashCode = 0;
return res;
}
开发者ID:chanwit,项目名称:vmkit,代码行数:23,代码来源:JavaString.cpp
示例18: SetGameData
/*現在のデータをセット*/
void TextClass::SetGameData(UserClass &User){
//時間関係
time_t now;
struct tm *Date;
time(&now);
Date = localtime(&now);
SaveData.SceneCount = SceneCount;
SaveData.TextCount = TextCount;
SaveData.SerifCount = SerifCount;
SaveData.BGMCode = User.GetBGMCode();
SaveData.BackCode = User.GetBackCode();
SaveData.CharCode = User.GetCharacterCode();
SaveData.Year = Date->tm_year+1900;
SaveData.Mon = Date->tm_mon+1;
SaveData.Day = Date->tm_mday;
SaveData.TextLength = Text[SceneCount][TextCount].size();
strcpy(SaveData.Text,Text[SceneCount][TextCount].c_str());
//現在カウントを更新
User.SetSaveData(SaveData);
}
开发者ID:kawashi,项目名称:Reverberation,代码行数:24,代码来源:text.cpp
示例19: DrawBack
/*背景描画*/
void TextGraphClass::DrawBack(UserClass &User){
//背景描画
switch( User.GetBackCode() ){
case GAME_BACK::KAWARA:
DrawGraph(GameBackPoint[GRAPH::X],GameBackPoint[GRAPH::Y],GameBackHandle[GAME_BACK::KAWARA],TRUE);
break;
case GAME_BACK::YOZORA:
DrawGraph(GameBackPoint[GRAPH::X],GameBackPoint[GRAPH::Y],GameBackHandle[GAME_BACK::YOZORA],TRUE);
break;
case GAME_BACK::BLACK:
DrawBox(0,0,windowX,windowY,GetColor(0,0,0),TRUE);
break;
}
}
开发者ID:kawashi,项目名称:Reverberation,代码行数:17,代码来源:graph.cpp
示例20: j3ResolveVirtualStub
extern "C" void* j3ResolveVirtualStub(JavaObject* obj) {
llvm_gcroot(obj, 0);
JavaThread *th = JavaThread::get();
UserCommonClass* cl = JavaObject::getClass(obj);
void* result = NULL;
// Lookup the caller of this class.
vmkit::StackWalker Walker(th);
++Walker; // Remove the stub.
vmkit::FrameInfo* FI = Walker.get();
assert(FI->Metadata != NULL && "Wrong stack trace");
JavaMethod* meth = (JavaMethod*)FI->Metadata;
// Lookup the method info in the constant pool of the caller.
uint16 ctpIndex = meth->lookupCtpIndex(FI);
assert(ctpIndex && "No constant pool index");
JavaConstantPool* ctpInfo = meth->classDef->getConstantPool();
CommonClass* ctpCl = 0;
const UTF8* utf8 = 0;
Signdef* sign = 0;
JavaMethod* origMeth = 0;
ctpInfo->infoOfMethod(ctpIndex, ACC_VIRTUAL, ctpCl, origMeth);
ctpInfo->resolveMethod(ctpIndex, ctpCl, utf8, sign);
assert(cl->isSubclassOf(ctpCl) && "Wrong call object");
UserClass* lookup = cl->isArray() ? cl->super : cl->asClass();
JavaMethod* Virt = lookup->lookupMethod(utf8, sign->keyName, false, true, 0);
if (isAbstract(Virt->access)) {
JavaThread::get()->getJVM()->abstractMethodError(Virt->classDef, Virt->name);
}
// Compile the found method.
result = Virt->compiledPtr(lookup);
// Update the virtual table.
assert(lookup->isResolved() && "Class not resolved");
assert(lookup->isInitializing() && "Class not ready");
assert(lookup->virtualVT && "Class has no VT");
assert(lookup->virtualTableSize > Virt->offset &&
"The method's offset is greater than the virtual table size");
((void**)obj->getVirtualTable())[Virt->offset] = result;
if (isInterface(origMeth->classDef->access)) {
InterfaceMethodTable* IMT = cl->virtualVT->IMT;
uint32_t index = InterfaceMethodTable::getIndex(Virt->name, Virt->type);
if ((IMT->contents[index] & 1) == 0) {
IMT->contents[index] = (word_t)result;
} else {
JavaMethod* Imeth =
ctpCl->asClass()->lookupInterfaceMethodDontThrow(utf8, sign->keyName);
assert(Imeth && "Method not in hierarchy?");
word_t* table = (word_t*)(IMT->contents[index] & ~1);
uint32 i = 0;
while (table[i] != (word_t)Imeth) { i += 2; }
table[i + 1] = (word_t)result;
}
}
return result;
}
开发者ID:ChrisKitching,项目名称:vmkit,代码行数:61,代码来源:JavaRuntimeJIT.cpp
注:本文中的UserClass类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论