Beispiel #1
0
int SelectInterfaceDirEntry(const char *pszName, const char *pszNamespaces, const CLSModule *pModule)
{
    int n;

    assert(pModule != NULL);
    assert(pszName != NULL);

    for (n = 0; n < pModule->mInterfaceCount; n++) {
        if (!strcmp(pszName, pModule->mInterfaceDirs[n]->mName)) {
            if (pModule->mInterfaceDirs[n]->mNameSpace == NULL) _ReturnOK (n);
            //temp
            if (!strcmp("systypes", pModule->mInterfaceDirs[n]->mNameSpace)) _ReturnOK (n);

            const char *begin, *semicolon;
            begin = pszNamespaces;
            while (begin != NULL) {
                semicolon = strchr(begin, ';');
                if (semicolon != NULL) { *const_cast<char*>(semicolon) = '\0'; }
                if (!strcmp(begin, pModule->mInterfaceDirs[n]->mNameSpace)) _ReturnOK (n);
                if (semicolon != NULL) { *const_cast<char*>(semicolon) = ';'; begin = semicolon + 1; }
                else begin = NULL;
            }
        }
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #2
0
int SelectStructDirEntry(const char *pszName, const CLSModule *pModule)
{
    int n;

    assert(pModule != NULL);
    assert(pszName != NULL);

    for (n = 0; n < pModule->mStructCount; n++) {
        if (!strcmp(pszName, pModule->mStructDirs[n]->mName))
            _ReturnOK (n);
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #3
0
int SelectClassInterface(USHORT index, const ClassDescriptor *pDesc)
{
    int n;

    assert(pDesc != NULL);

    for (n = 0; n < pDesc->mInterfaceCount; n++) {
        if (pDesc->mInterfaces[n]->mIndex == index) {
            _ReturnOK (n);
        }
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #4
0
int SelectFileDirEntry(const char *pszPath, const CLSModule *pModule)
{
    int n;

    assert(pszPath != NULL);

    for (n = 1; n < pModule->mFileCount; n++) {
        if (!strcmp(pszPath, pModule->mFileDirs[n]->mPath)) {
            _ReturnOK (n);
        }
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #5
0
int SelectArrayDirEntry(unsigned short nElems, const TypeDescriptor &desp,
    const CLSModule *pModule)
{
    int n;
    assert(nElems > 0);
    assert(pModule != NULL);

    for (n = 0; n < pModule->mArrayCount; n++) {
        if (nElems == pModule->mArrayDirs[n]->mElementCount
            && 0 == memcmp(&desp, &(pModule->mArrayDirs[n]->mType), sizeof(TypeDescriptor)))
            _ReturnOK (n);
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #6
0
int SelectEnumElement(const char *pszName, const EnumDescriptor *pDesc)
{
    int n;

    assert(pDesc != NULL);
    assert(pszName != NULL);

    for (n = 0; n < pDesc->mElementCount; n++) {
        if (!strcmp(pszName, pDesc->mElements[n]->mName)) {
            _ReturnOK (n);
        }
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #7
0
int SelectMethodParam(const char *pszName, const MethodDescriptor *pDesc)
{
    int n;

    assert(pDesc != NULL);
    assert(pszName != NULL);

    for (n = 0; n < pDesc->mParamCount; n++) {
        if (!strcmp(pszName, pDesc->mParams[n]->mName)) {
            _ReturnOK (n);
        }
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #8
0
int SelectInterfaceMethod(
    const char *pszName, const InterfaceDescriptor *pDesc)
{
    int n;

    assert(pDesc != NULL);
    assert(pszName != NULL);

    for (n = 0; n < pDesc->mMethodCount; n++) {
        if (!strcmp(pszName, pDesc->mMethods[n]->mName)) {
            _ReturnOK (n);
        }
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #9
0
int SelectStructElement(
    const char *pszName, const StructDescriptor *pDesc)
{
    int n;

    assert(pDesc != NULL);
    assert(pszName != NULL);

    for (n = 0; n < pDesc->cElems; n++) {
        if (!strcmp(pszName, pDesc->ppElems[n]->mName)) {
            _ReturnOK (n);
        }
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #10
0
int SelectInterfaceMemberSymbol(
    const char *pszName, InterfaceDescriptor *pDesc)
{
    int n;

    assert(pszName != NULL);
    assert(pDesc != NULL);

    for (n = 0; n < pDesc->mConstCount; ++n) {
        if (!strcmp(pszName, pDesc->mConsts[n]->mName)) _Return (n);
    }

    for (n = 0; n < pDesc->mMethodCount; ++n) {
        if (!strcmp(pszName, pDesc->mMethods[n]->mName)) _Return (n);
    }

    _ReturnError (CLSError_NotFound);
}
Beispiel #11
0
int GlobalSelectSymbol(
    const char *pszName, const char *pszNamespace, const CLSModule *pModule,
    GlobalSymbolType except, GlobalSymbolType *pType)
{
    int n;

    assert(pModule != NULL);
    assert(pszName != NULL);

    if (except != GType_Class) {
        n = SelectClassDirEntry(pszName, pszNamespace, pModule);
        if (n >= 0) {
            ExtraMessage(pModule->mClassDirs[n]->mNameSpace,
                        "class", pszName);
            if (pType) *pType = GType_Class;
            _Return (n);
        }
    }

    if (except != GType_Interface) {
        n = SelectInterfaceDirEntry(pszName, pszNamespace, pModule);
        if (n >= 0) {
            ExtraMessage(pModule->mInterfaceDirs[n]->mNameSpace,
                        "interface", pszName);
            if (pType) *pType = GType_Interface;
            _Return (n);
        }
    }

    if (except != GType_Struct) {
        n = SelectStructDirEntry(pszName, pModule);
        if (n >= 0) {
            ExtraMessage(pModule->mStructDirs[n]->mNameSpace,
                        "struct", pszName);
            if (pType) *pType = GType_Struct;
            _Return (n);
        }
    }

    if (except != GType_Alias) {
        n = SelectAliasDirEntry(pszName, pModule);
        if (n >= 0) {
            ExtraMessage(pModule->mAliasDirs[n]->mNameSpace,
                        "alias", pszName);
            if (pType) *pType = GType_Alias;
            _Return (n);
        }
    }

    if (except != GType_Enum) {
        n = SelectEnumDirEntry(pszName, pszNamespace, pModule);
        if (n >= 0) {
            ExtraMessage(pModule->mEnumDirs[n]->mNameSpace,
                        "enum", pszName);
            if (pType) *pType = GType_Enum;
            _Return (n);
        }
    }

    _ReturnError (CLSError_NotFound);
}