Example #1
0
static idl_action
idl_moduleOpen (
    idl_scope scope,
    const char *name,
    void *userData)
{
    c_ulong streamsIndex, streamsCount;
    idl_action result;
    OS_UNUSED_ARG(userData);

    OS_UNUSED_ARG(userData);

    /* Test whether the module contains a component within the pragma streams.
     * If it does not, then the module should not be generated since it will
     * contain no items (which is itself illegal idl syntax).
     *
     * Note that we are comparing against only the streams existing within this idl
     * file (idl_idlScopeStreamsList).  We do not use the result of idl_keyDefDefGet()
     * since this is a list of streams resulting from the preprocessed idl (which
     *  will include streams from other idl files that this may include).
     */
    result = idl_abort;
    streamsCount = os_iterLength(idl_idlScopeStreamsList);
    if (streamsCount != 0) {
        idl_scope moduleScope;
        idl_scopeElement newElement;

        /* the idl_scope parameter to this function does not yet include the scoping
         * for this module itself, so create a duplicate and add this scoping to it,
         * before testing whether this module contains one of the streams in this file.
         */
        moduleScope = idl_scopeDup(scope);
        newElement = idl_scopeElementNew(name, idl_tModule);
        idl_scopePush(moduleScope, newElement);

        /* Loop through the list of keys applying to this idl file and test whether
         * this particular module contains one of these keys.  If it does, generate
         * code for the module.
         */
        for (streamsIndex = 0; (streamsIndex < streamsCount) && (result == idl_abort); streamsIndex++) {
            idl_scope streamsScope = os_iterObject(idl_idlScopeStreamsList, streamsIndex);
            if (idl_scopeSub(moduleScope, streamsScope)) {
                /* Scopes match */
                result = idl_explore;
            }
        }
    }

    if (result == idl_explore) {
        idl_printIndent(idlpp_indent_level);
        idl_fileOutPrintf(idl_fileCur(), "module %s {\n", idl_cxxId(name));
        idl_fileOutPrintf(idl_fileCur(), "\n");
        idlpp_indent_level++;
    }
    return result;
}
Example #2
0
static idl_action
idl_moduleOpen (
    idl_scope scope,
    const char *name,
    void *userData)
 {
    /* Test whether the module contains a component within the pragma keylist.
     * If it does not, then the module should not be generated since it will
     * contain no items (which is itself illegal idl syntax).
     *
     * Note that we are comparing against only the keys existing within this idl
     * file (idl_idlScopeKeyList).  We do not use the result of idl_keyDefDefGet()
     * since this is a list of keys resulting from the preprocessed idl (which
     *  will include keys from other idl files that this may include).
     */

    if (os_iterLength (idl_idlScopeKeyList) == 0) {
        return idl_abort;
    } else {
        c_long li = 0;
        c_bool scopesMatch = FALSE;
        idl_scope moduleScope;
        idl_scopeElement newElement;

        /* the idl_scope parameter to this function does not yet include the scoping
         * for this module itself, so create a duplicate and add this scoping to it,
         * before testing whether this module contains one of the keys in this file.
         */
        moduleScope = idl_scopeDup(scope);
        newElement = idl_scopeElementNew (name, idl_tModule);
        idl_scopePush (moduleScope, newElement);

        /* Loop through the list of keys applying to this idl file and test whether
         * this particular module contains one of these keys.  If it does, generate
         * code for the module in the Dcps.idl file.
         */
        while (li < os_iterLength (idl_idlScopeKeyList)) {
            idl_scope keyscope = os_iterObject (idl_idlScopeKeyList, li);
            scopesMatch = idl_scopeSub (moduleScope, keyscope);
            if (scopesMatch) {
                break;
            }
            li++;
        }

        if (scopesMatch == FALSE) {
            return idl_abort;
        }
    }

    idl_printIndent(idlpp_indent_level);
    idl_fileOutPrintf(idl_fileCur(), "module %s {\n", idl_cxxId(name));
    idl_fileOutPrintf(idl_fileCur(), "\n");
    idlpp_indent_level++;
    return idl_explore;
}