Esempio n. 1
0
void xmlgui::LabeledControl::getParameterInfo(vector<ParameterInfo> &params) {
	params.push_back(ParameterInfo("Draw Label", "drawlabel", "toggle", &drawingLabel));
	params.push_back(ParameterInfo("Label Color", "labelColor", "hexcolorpicker", &labelColor));
}
Esempio n. 2
0
vector<ParameterInfo> GuiContainer::getParameterInfo() {
	vector<ParameterInfo> params;
	params.push_back(ParameterInfo("BG Image", "bg","file", &bgImgUrl));
	return params;
	
}
Esempio n. 3
0
void BinReader::readMethodBase(MethodBase *mbase)
{
    readMemberInfo(mbase);

    int numMethodAttributes = bytes->readInt();

    for (int i = 0; i < numMethodAttributes; i++)
    {
        const char *methodAttr = readPoolString();

        if (!strcmp(methodAttr, "static"))
        {
            mbase->attr.isStatic = true;
        }
        else if (!strcmp(methodAttr, "public"))
        {
            mbase->attr.isPublic = true;
        }
        else if (!strcmp(methodAttr, "private"))
        {
            mbase->attr.isPrivate = true;
        }
        else if (!strcmp(methodAttr, "protected"))
        {
            mbase->attr.isProtected = true;
        }
        else if (!strcmp(methodAttr, "native"))
        {
            mbase->attr.isNative = true;
        }
        else if (!strcmp(methodAttr, "virtual"))
        {
            mbase->attr.isVirtual = true;
        }
        else if (!strcmp(methodAttr, "supercall"))
        {
            mbase->attr.hasSuperCall = true;
        }
        else if (!strcmp(methodAttr, "operator"))
        {
            mbase->attr.isOperator = true;
        }
    }

    if (bytes->readBoolean())
    {
        mbase->setTemplateInfo(readTemplateTypes());
    }

    // parameters
    int numParamaters = bytes->readInt();

    for (int i = 0; i < numParamaters; i++)
    {
        ParameterInfo *param = lmNew(NULL) ParameterInfo();
        mbase->parameters.push_back(param);

        const char *name = readPoolString();

        Type *ptype = NULL;
        if (bytes->readBoolean())
        {
            ptype = getType(readPoolString());
        }

        bool hasDefault = bytes->readBoolean();
        bool isVarArg   = bytes->readBoolean();

        int numTemplateTypes = bytes->readInt();
        for (int j = 0; j < numTemplateTypes; j++)
        {
            Type *ttype = getType(readPoolString());
            param->addTemplateType(ttype);
        }


        param->position              = (int)i;
        param->name                  = name;
        param->member                = mbase;
        param->parameterType         = ptype;
        param->attributes.hasDefault = hasDefault;
        param->attributes.isVarArgs  = isVarArg;
    }

    // find first default argument
    for (UTsize i = 0; i < mbase->parameters.size(); i++)
    {
        if (mbase->parameters.at(i)->attributes.hasDefault)
        {
            mbase->firstDefaultArg = i;
            break;
        }
    }


    if (mbase->isNative())
    {
        // empty bytecode
        bytes->readString();

        lua_CFunction function = NULL;
        lua_State     *L       = vm->VM();

        int top = lua_gettop(L);
        lua_settop(L, top);
        lsr_pushmethodbase(L, mbase);

        if (!lua_isnil(L, -1))
        {
            function = lua_tocfunction(L, -1);

            if (!function)
            {
                if (lua_isuserdata(L, -1))
                {
                    mbase->setFastCall((void *)lua_topointer(L, -1));
                }
            }
        }

        lua_pop(L, 1);

        if (!mbase->isFastCall())
        {
            if (!function)
            {
                if (mbase->declaringType->isPrimitive() && mbase->isStatic())
                {
                    LSError("Missing primitive native function %s:%s",
                            mbase->declaringType->getFullName().c_str(),
                            mbase->name.c_str());
                }
                else if (!mbase->declaringType->isPrimitive())
                {
                    LSError("Missing native function %s:%s",
                            mbase->declaringType->getFullName().c_str(),
                            mbase->name.c_str());
                }
            }
            else
            {
                if (mbase->declaringType->isPrimitive() && !mbase->isStatic())
                {
                    LSError("Unnecessary primitive native instance function %s:%s",
                            mbase->declaringType->getFullName().c_str(),
                            mbase->name.c_str());
                }
            }
        }
    }
    else
    {
        mbase->setByteCode(ByteCode::decode64(bytes->readString()));
    }
}