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; }
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; }
os_boolean idl_stacDef_isStacDefined( idl_scope scope, const char *name, idl_typeSpec typeSpec, idl_typeSpec* baseStringTypeDereffered) { os_boolean isStacDefined = OS_FALSE; idl_typeSpec typeDereffered; idl_typeSpec subType; idl_scope tmpScope; os_char* containingElement; idl_basicType basic; c_ulong maxlen; /* resolve any type defs */ typeDereffered = idl_typeDefResolveFully(typeSpec); if(idl_typeSpecType(typeDereffered) == idl_tarray) { /* If this is an array, then get the sub type and recurse deeper into this * operation. Arrays of bounded strings are allowed for pragma stac */ subType = idl_typeArrayActual(idl_typeArray(typeDereffered)); isStacDefined = idl_stacDef_isStacDefined(scope, name, subType, baseStringTypeDereffered); } else if(idl_typeSpecType(typeDereffered) == idl_tbasic) { /* Get the basic type to see if it is a string */ basic = idl_typeBasicType(idl_typeBasic(typeDereffered)); if(basic == idl_string) { /* If this is indeed a string, then get the 'maxLen' attribute of the * string type. If it is not 0, then this is a bounded string */ maxlen = idl_typeBasicMaxlen(idl_typeBasic(typeDereffered)); if(maxlen != 0) { tmpScope = idl_scopeDup(scope); containingElement = idl_scopeElementName(idl_scopeCur (scope)); idl_scopePop(tmpScope); isStacDefined = idl_stacListItemIsDefined (idl_stacDefDefGet(), tmpScope, containingElement, name); if(isStacDefined && baseStringTypeDereffered) { *baseStringTypeDereffered = typeDereffered; } } /* else stac define status not relevant for this member */ } /* else stac define status not relevant for this member */ } /* else stac define status not relevant for this member */ return isStacDefined; }
static void newMeta( idl_scope scope, const char *name, idl_typeSpec typeSpec) { idl_meta meta; meta = os_malloc(C_SIZEOF(idl_meta)); if (meta) { meta->scope = idl_scopeDup(scope); meta->name = os_strdup(name); if (idl_typeSpecType(typeSpec) == idl_ttypedef) { meta->actual_name = idl_typeSpecName(idl_typeDefActual(idl_typeDef(typeSpec))); } else { meta->actual_name = idl_typeSpecName(typeSpec); } meta->type = idl_typeSpecDef(typeSpec); } idlpp_metaList = os_iterAppend(idlpp_metaList, meta); }