本文整理汇总了C++中MethodInfo类的典型用法代码示例。如果您正苦于以下问题:C++ MethodInfo类的具体用法?C++ MethodInfo怎么用?C++ MethodInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MethodInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
uint64_t VTable::bytesUsed() const
{
uint64_t bytesUsed = sizeof(VTable);
if(ivtable != NULL)
bytesUsed += ivtable->bytesUsed();
const TraitsBindingsp td = traits->getTraitsBindings();
const uint32_t n = td->methodCount;
const uint32_t baseMethodCount = base ? td->base->methodCount : 0;
bytesUsed += td->methodCount*sizeof(MethodInfo*);
for (uint32_t i=0; i < n; i++)
{
MethodInfo* method = td->getMethod(i);
if (i < baseMethodCount && td->base && method == td->base->getMethod(i))
{
continue;
}
else if(method != NULL)
{
bytesUsed += method->bytesUsed();
}
}
return bytesUsed;
}
示例2: localBounds
bool DebugStackFrame::setLocal(int which, Atom& val)
{
bool worked = false;
if (trace->framep() && trace->info())
{
int firstLocal, pastLastLocal;
localBounds(&firstLocal, &pastLastLocal);
int count = pastLastLocal - firstLocal;
if (count > 0 && which < count)
{
MethodInfo* info = trace->info();
if (which == 0 && info->needRestOrArguments())
{
// They are trying to modify the first local, but that is actually the special
// array for "...rest" or for "arguments". That is too complicated to allow
// right now. We're just going to fail the request.
}
else
{
// copy the single arg over
info->unboxLocals(&val, 0, trace->types(), trace->framep(), firstLocal+which, 1);
worked = true;
}
}
}
return worked;
}
示例3: functionFor
void DebugCLI::locals()
{
Atom* ptr;
int count, line;
SourceInfo* src;
DebugFrame* frame = core->debugger->frameAt(0);
// source information
frame->sourceLocation(src, line);
// method
MethodInfo* info = functionFor(src, line);
if (info)
{
frame->arguments(ptr, count);
for(int i=0; i<count; i++)
{
// write out the name
if (info && (info->getLocalName(i) != core->kundefined) )
core->console << info->getLocalName(i) << " = ";
core->console << core->format(*ptr++);
//if (i<count-1)
core->console << "\n";
}
}
}
示例4: functionFor
void DebugCLI::locals()
{
Atom* ptr;
int count, line;
SourceInfo* src;
DebugFrame* frame = core->debugger()->frameAt(0);
// source information
frame->sourceLocation(src, line);
// method
MethodInfo* info = functionFor(src, line);
if (info)
{
frame->locals(ptr, count);
for(int i=0; i<count; i++)
{
// write out the name
Stringp nm = info->getLocalName(i);
if (nm != core->kundefined)
core->console << nm;
else
core->console << "<local_" << i << ">";
core->console << " = " << core->format(*ptr++) << "\n";
}
}
}
示例5:
MethodInfo *Assembly::getStaticMethodInfo(const char *name)
{
utArray<Type *> types;
for (UTsize i = 0; i < modules.size(); i++)
{
modules.at(i)->getTypes(types);
for (UTsize j = 0; j < types.size(); j++)
{
Type *type = types.at(j);
MemberTypes types;
types.method = true;
utArray<MemberInfo *> members;
type->findMembers(types, members);
for (UTsize k = 0; k < members.size(); k++)
{
//TODO: this get's the first static main method, at compiler time
// we need to verify only one entry per assembly
MethodInfo *methodInfo = (MethodInfo *)members.at(k);
if (methodInfo->isStatic() && !strcmp(methodInfo->getName(), name))
{
return methodInfo;
}
}
}
types.clear();
}
return NULL;
}
示例6: printf
void nsToolkit::RunPump(void* arg)
{
int32 code;
char portname[64];
ThreadInterfaceData id;
#ifdef DEBUG
printf("TK-RunPump\n");
#endif
ThreadInitInfo *info = (ThreadInitInfo*)arg;
PR_EnterMonitor(info->monitor);
gThreadState = PR_TRUE;
PR_Notify(info->monitor);
PR_ExitMonitor(info->monitor);
delete info;
// system wide unique names
PR_snprintf(portname, sizeof(portname), "event%lx",
(long unsigned) PR_GetCurrentThread());
port_id event = create_port(200, portname);
while(read_port_etc(event, &code, &id, sizeof(id), B_TIMEOUT, 1000) >= 0)
{
MethodInfo *mInfo = (MethodInfo *)id.data;
mInfo->Invoke();
if(id.waitingThread != 0)
resume_thread(id.waitingThread);
delete mInfo;
}
}
示例7: LSError
void Assembly::connectToDebugger(const char *host, int port)
{
if (!vm)
{
LSError("Assembly::connectToDebugger called on uninitialized assembly");
}
Type *debuggerClient = vm->getType("system.debugger.DebuggerClient");
if (!debuggerClient)
{
LSError("Unable to get system.debugger.DebuggerClient");
}
MethodInfo *method = debuggerClient->findMethodInfoByName("connect");
if (!method)
{
LSError("Unable to get system.debugger.DebuggerClient.connect method");
}
lua_pushstring(vm->VM(), host);
lua_pushnumber(vm->VM(), port);
method->invoke(NULL, 2);
}
示例8: verifyQueue2
// After loading an ABC and inserting scripts into the verify queue,
// process the work queues until they are empty.
void BaseExecMgr::verifyEarly(Toplevel* toplevel, AbcEnv* abc_env)
{
GCList<MethodInfo> verifyQueue2(core->GetGC(), kListInitialCapacity);
int verified;
do {
verified = 0;
while (!verifyTraitsQueue.isEmpty()) {
Traits* t = verifyTraitsQueue.removeFirst();
t->resolveSignatures(toplevel);
TraitsBindingsp td = t->getTraitsBindings();
enqFunction(t->init);
for (int i=0, n=td->methodCount; i < n; i++)
enqFunction(td->getMethod(i));
}
while (!verifyFunctionQueue.isEmpty()) {
MethodInfo* f = verifyFunctionQueue.removeLast();
if (!isVerified(f)) {
if (f->declaringTraits()->init != f && f->declaringScope() == NULL) {
verifyQueue2.add(f);
continue;
}
verified++;
//console << "pre verify " << f << "\n";
verifyMethod(f, toplevel, abc_env);
setVerified(f);
if (config.verifyonly)
f->_invoker = verifyOnlyInvoker;
}
}
while (!verifyQueue2.isEmpty())
verifyFunctionQueue.add(verifyQueue2.removeLast());
} while (verified > 0);
}
示例9: getTypes
void Assembly::bootstrap()
{
utArray<Type *> types;
getTypes(types);
Type *btype = vm->getType("system.Bootstrap");
for (UTsize i = 0; i < types.size(); i++)
{
Type *type = types[i];
if (type->getFullName() == "system.Null")
{
continue;
}
if (type->castToType(btype))
{
MemberInfo *mi = type->findMember("initialize");
assert(mi);
assert(mi->isMethod());
MethodInfo *method = (MethodInfo *)mi;
method->invoke(NULL, 0);
}
}
}
示例10:
bool DataBus::GetClientMethodInfoResponsePacket::create(const quint8 source,
const quint8 destination,
const quint8 packetId,
const MethodInfo &methodInfo,
Packet *packet)
{
// Check parameters
if ((source == 0) ||
(methodInfo.isValid() == false) ||
(packet == 0))
{
// Error, invalid parameters
return false;
}
// Create Header
packet->setSource(source);
packet->setDestination(destination);
packet->setPacketType(PacketType_GetClientMethodInfoResponse);
packet->setPacketId(packetId);
// Create Payload
QByteArray data;
data.append(static_cast<char>(methodInfo.getId()));
data.append(methodInfo.getName());
data.append(static_cast<char>(methodInfo.getNoOfParameters()));
data.append(static_cast<char>(methodInfo.getNoOfReturnValues()));
packet->setData(data);
// Success
return true;
}
示例11: functionFor
Stringp Debugger::methodNameAt(DebugStackFrame* frame) {
if (frame == NULL) return NULL;
int line;
SourceInfo* src = NULL;
// source information
frame->sourceLocation(src, line);
MethodInfo* info = functionFor(src, line, frame);
return info ? info->getMethodName() : NULL;
}
示例12: getStaticMethodInfo
void Assembly::execute()
{
MethodInfo *method = getStaticMethodInfo("main");
if (!method)
{
LSError("Unable to find main method in Assembly %s", getName().c_str());
}
method->invoke(NULL, 0);
}
示例13: if
void VerifyallWriter::writeOp1(const FrameState* state, const uint8_t *pc, AbcOpcode opcode, uint32_t opd1, Traits *type)
{
if (opcode == OP_newfunction) {
MethodInfo *f = pool->getMethodInfo(opd1);
AvmAssert(f->declaringTraits() == type);
exec->enqFunction(f);
exec->enqTraits(type);
}
else if (opcode == OP_newclass) {
exec->enqTraits(type);
exec->enqTraits(type->itraits);
}
coder->writeOp1(state, pc, opcode, opd1, type);
}
示例14: lmAssert
Expression *TypeCompiler::visit(CallExpression *call)
{
MethodBase *methodBase = call->methodBase;
call->function->visitExpression(this);
// check whether we're calling a methodbase
if (methodBase)
{
lmAssert(methodBase->isMethod(), "Non-method called");
MethodInfo *method = (MethodInfo *)methodBase;
generateCall(&call->function->e, call->arguments, method);
call->e = call->function->e;
}
else
{
lmAssert(call->function->type, "Untyped call");
// if we're calling a delegate we need to load up the call method
if (call->function->type->isDelegate())
{
MethodInfo *method = (MethodInfo *)call->function->type->findMember("call");
lmAssert(method, "delegate with no call method");
ExpDesc right;
BC::initExpDesc(&right, VKNUM, 0);
right.u.nval = method->getOrdinal();
BC::expToNextReg(cs->fs, &call->function->e);
BC::expToNextReg(cs->fs, &right);
BC::expToVal(cs->fs, &right);
BC::indexed(cs->fs, &call->function->e, &right);
generateCall(&call->function->e, call->arguments, NULL);
call->e = call->function->e;
}
else
{
// we're directly calling a local, instance (bound), or static method of type Function
generateCall(&call->function->e, call->arguments, NULL);
call->e = call->function->e;
}
}
return call;
}
示例15: PR_EnterMonitor
void nsToolkit::RunPump(void* arg)
{
int32 code;
char portname[64];
ThreadInterfaceData id;
ThreadInitInfo *info = (ThreadInitInfo*)arg;
PR_EnterMonitor(info->monitor);
gThreadState = PR_TRUE;
PR_Notify(info->monitor);
PR_ExitMonitor(info->monitor);
delete info;
// system wide unique names
PR_snprintf(portname, sizeof(portname), "event%lx",
(long unsigned) PR_GetCurrentThread());
port_id event = create_port(100, portname);
while(read_port(event, &code, &id, sizeof(id)) >= 0)
{
switch(code)
{
case WM_CALLMETHOD :
{
MethodInfo *mInfo = (MethodInfo *)id.data;
mInfo->Invoke();
if(id.waitingThread != 0)
resume_thread(id.waitingThread);
delete mInfo;
}
break;
case 'natv' : // native queue PLEvent
{
PREventQueue *queue = (PREventQueue *)id.data;
PR_ProcessPendingEvents(queue);
}
break;
default :
printf("nsToolkit::RunPump - UNKNOWN EVENT\n");
break;
}
}
}