static void incrTypeAndNodeUsageCounter(SmiModule *smiModule, SmiNode *smiNode, int flags) { SmiType *smiType; char *extModule; /* * First check whether the node is external. If yes, increment the * external node counter and we are done. */ extModule = smiGetNodeModule(smiNode)->name; if (extModule && strcmp(extModule, smiModule->name) != 0) { if (flags & INCR_NODE) { extNodeList = incrUsageCounter(extNodeList, extModule, smiNode->name, 1); extModuleList = incrUsageCounter(extModuleList, extModule, NULL, 1); } return; } /* * Next, check whether the type of the node is external. If yes, * increment the external type counter and we are done. Do not * count base types (that is types that have no parent type). */ smiType = smiGetNodeType(smiNode); if (! smiType) { return; } if (smiType->name && smiGetParentType(smiType)) { char *extModule = smiGetTypeModule(smiType)->name; if (extModule /* && *extModule */ && strcmp(extModule, smiModule->name) != 0) { if (flags & INCR_TYPE) { extTypeList = incrUsageCounter(extTypeList, extModule, smiType->name, 1); extModuleList = incrUsageCounter(extModuleList, extModule, NULL, 1); } } } /* * Finally, count the type name (whether external or not does not * matter here nor does it matter whether it is a base type or * not). */ if (! smiType->name && smiGetParentType(smiType)) { smiType = smiGetParentType(smiType); } typeList = incrUsageCounter(typeList, smiGetTypeModule(smiType)->name, smiType->name, 1); }
static void fprintTypedef(FILE *f, int indent, SmiType *smiType) { SmiModule *parentModule; SmiType *parentType; fprintSegment(f, indent, "<typedef", 0); if (smiType->name) { fprint(f, " name=\"%s\"", smiType->name); } fprint(f, " basetype=\"%s\"", getStringBasetype(smiType->basetype)); if (smiType->name && smiType->status != SMI_STATUS_UNKNOWN) { fprint(f, " status=\"%s\"", getStringStatus(smiType->status)); } fprint(f, ">\n"); parentType = smiGetParentType(smiType); parentModule = smiGetTypeModule(parentType); if (parentType && parentType->name && parentModule && strlen(parentModule->name)) { fprintSegment(f, indent + INDENT, "<parent ", 0); fprintf(f, "module=\"%s\" name=\"%s\"/>\n", parentModule->name, parentType->name); } fprintRanges(f, indent + INDENT, smiType); fprintNamedNumbers(f, indent + INDENT, smiType); fprintValue(f, indent + INDENT, &smiType->value, smiType); fprintFormat(f, indent + INDENT, smiType->format); fprintUnits(f, indent + INDENT, smiType->units); fprintDescription(f, indent + INDENT, smiType->description); fprintReference(f, indent + INDENT, smiType->reference); fprintSegment(f, indent, "</typedef>\n", 0); }
static unsigned long getMaxSize(SmiType *smiType) { SmiRange *smiRange; SmiType *parentType; SmiNamedNumber *nn; unsigned int max = 0, size; switch (smiType->basetype) { case SMI_BASETYPE_BITS: case SMI_BASETYPE_OCTETSTRING: size = 65535; break; case SMI_BASETYPE_OBJECTIDENTIFIER: size = 128; break; default: return 0xffffffff; } if (smiType->basetype == SMI_BASETYPE_BITS) { for (nn = smiGetFirstNamedNumber(smiType); nn; nn = smiGetNextNamedNumber(nn)) { if (nn->value.value.unsigned32 > max) { max = nn->value.value.unsigned32; } } size = (max / 8) + 1; return size; } for (smiRange = smiGetFirstRange(smiType); smiRange ; smiRange = smiGetNextRange(smiRange)) { if (smiRange->maxValue.value.unsigned32 > max) { max = smiRange->maxValue.value.unsigned32; } } if (max > 0 && max < size) { size = max; } parentType = smiGetParentType(smiType); if (parentType) { unsigned int psize = getMaxSize(parentType); if (psize < size) { size = psize; } } return size; }
static SmiUnsigned32 getMaxUnsigned32(SmiType *smiType) { SmiType *parent; SmiRange *range; SmiUnsigned32 max = 0; range = smiGetFirstRange(smiType); if (! range) { parent = smiGetParentType(smiType); return parent ? getMaxUnsigned32(parent) : 0xffffffff; } for (; range; range = smiGetNextRange(range)) { if (range->maxValue.value.unsigned32 > max) { max = range->maxValue.value.unsigned32; } } return max; }
static char *getTypeName(SmiNode *smiNode) { char *type; SmiType *smiType, *parentType; smiType = smiGetNodeType(smiNode); if (!smiType || smiNode->nodekind == SMI_NODEKIND_TABLE) return NULL; if (smiType->decl == SMI_DECL_IMPLICIT_TYPE) { parentType = smiGetParentType(smiType); if (!parentType) return NULL; smiType = parentType; } type = xstrdup(smiType->name); return type; }
static SmiInteger32 getAbsMinInteger32(SmiType *smiType) { SmiType *parent; SmiRange *range; SmiInteger32 min = SMI_BASETYPE_INTEGER32_MAX; range = smiGetFirstRange(smiType); if (! range) { parent = smiGetParentType(smiType); return parent ? getAbsMinInteger32(parent) : 0; } for (; range; range = smiGetNextRange(range)) { if (abs(range->minValue.value.integer32) < min) { min = abs(range->minValue.value.integer32); } } return min; }
static SmiUnsigned32 getMinUnsigned32(SmiType *smiType) { SmiType *parent; SmiRange *range; SmiInteger32 min = 0xffffffff; range = smiGetFirstRange(smiType); if (! range) { parent = smiGetParentType(smiType); return parent ? getMinUnsigned32(parent) : 0; } for (; range; range = smiGetNextRange(range)) { if (range->minValue.value.unsigned32 < min) { min = range->minValue.value.unsigned32; } } return min; }
static SmiUnsigned64 getMaxUnsigned64(SmiType *smiType) { SmiType *parent; SmiRange *range; SmiUnsigned64 max = SMI_BASETYPE_UNSIGNED64_MIN; range = smiGetFirstRange(smiType); if (! range) { parent = smiGetParentType(smiType); return parent ? getMaxUnsigned64(parent) : max; } for (; range; range = smiGetNextRange(range)) { if (range->maxValue.value.unsigned64 > max) { max = range->maxValue.value.unsigned64; } } return max; }
static SmiUnsigned64 getMinUnsigned64(SmiType *smiType) { SmiType *parent; SmiRange *range; SmiInteger64 min = SMI_BASETYPE_UNSIGNED64_MAX; range = smiGetFirstRange(smiType); if (! range) { parent = smiGetParentType(smiType); return parent ? getMinUnsigned64(parent) : min; } for (; range; range = smiGetNextRange(range)) { if (range->minValue.value.unsigned64 < min) { min = range->minValue.value.unsigned64; } } return min; }
static SmiInteger64 getAbsMaxInteger64(SmiType *smiType) { SmiType *parent; SmiRange *range; SmiInteger64 max = SMI_BASETYPE_INTEGER64_MIN; range = smiGetFirstRange(smiType); if (! range) { parent = smiGetParentType(smiType); return parent ? getAbsMaxInteger64(parent) : max; } for (; range; range = smiGetNextRange(range)) { if (m_abs(range->maxValue.value.integer64) > max) { max = m_abs(range->maxValue.value.integer64); } } return max; }
static SmiInteger64 getAbsMinInteger64(SmiType *smiType) { SmiType *parent; SmiRange *range; SmiInteger64 min = SMI_BASETYPE_INTEGER64_MAX; range = smiGetFirstRange(smiType); if (! range) { parent = smiGetParentType(smiType); return parent ? getAbsMinInteger64(parent) : min; } for (; range; range = smiGetNextRange(range)) { if (m_abs(range->minValue.value.integer64) < min) { min = m_abs(range->minValue.value.integer64); } } return min; }
static SmiInteger32 getAbsMaxInteger32(SmiType *smiType) { SmiType *parent; SmiRange *range; SmiInteger32 max = SMI_BASETYPE_INTEGER32_MIN; range = smiGetFirstRange(smiType); if (! range) { parent = smiGetParentType(smiType); return parent ? getAbsMaxInteger32(parent) : SMI_BASETYPE_INTEGER32_MAX; } for (; range; range = smiGetNextRange(range)) { if (abs(range->maxValue.value.integer32) > max) { max = abs(range->maxValue.value.integer32); } } return max; }
static void createImportList(SmiModule *smiModule) { SmiNode *smiNode; SmiType *smiType; SmiModule *smiTypeModule; SmiNodekind kind = SMI_NODEKIND_SCALAR | SMI_NODEKIND_COLUMN; SmiImport *smiImport; for (smiNode = smiGetFirstNode(smiModule, kind); smiNode; smiNode = smiGetNextNode(smiNode, kind)) { smiType = smiGetNodeType(smiNode); if (smiType && (smiType->decl == SMI_DECL_IMPLICIT_TYPE)) { smiType = smiGetParentType(smiType); } if (smiType) { smiTypeModule = smiGetTypeModule(smiType); if (smiTypeModule && strcmp(smiTypeModule->name, smiModule->name)) { if (strlen(smiTypeModule->name)) { addImport(smiTypeModule->name, smiType->name); } } if (smiType->basetype == SMI_BASETYPE_INTEGER32) { addImport("SNMPv2-SMI", "Integer32"); } } } for (smiImport = smiGetFirstImport(smiModule); smiImport; smiImport = smiGetNextImport(smiImport)) { if (islower((int) smiImport->name[0]) || (smiImport->module && !strcmp(smiImport->module, "SNMPv2-SMI")) || (smiImport->module && !strcmp(smiImport->module, "SNMPv2-TC"))) { addImport(smiImport->module, smiImport->name); } } }
static void printCreateTable(SmiNode *groupNode) { SmiNode *smiNode; SmiType *smiType; char *sqlTableName; int i; if (groupNode->nodekind == SMI_NODEKIND_ROW) { sqlTableName = translate(smiGetParentNode(groupNode)->name); } else { sqlTableName = translate(groupNode->name); } printf("create table %s (\n", sqlTableName); xfree(sqlTableName); for (smiNode = smiGetFirstChildNode(groupNode), i = 0; smiNode; smiNode = smiGetNextChildNode(smiNode), i++) { if (smiNode->nodekind & (SMI_NODEKIND_COLUMN | SMI_NODEKIND_SCALAR) #if 0 && (smiNode->access == SMI_ACCESS_READ_ONLY || smiNode->access == SMI_ACCESS_READ_WRITE) #endif ) { smiType = smiGetNodeType(smiNode); if (smiType && ! smiType->name) { smiType = smiGetParentType(smiType); } if (i) { printf(",\n"); } if (smiType) { printf(" %s %s", smiNode->name, smiType->name); } } } printf("\n);\n\n"); }
static unsigned long getMinSize(SmiType *smiType) { SmiRange *smiRange; SmiType *parentType; unsigned int min = 65535, size; switch (smiType->basetype) { case SMI_BASETYPE_BITS: return 0; case SMI_BASETYPE_OCTETSTRING: case SMI_BASETYPE_OBJECTIDENTIFIER: size = 0; break; default: return 0; } for (smiRange = smiGetFirstRange(smiType); smiRange ; smiRange = smiGetNextRange(smiRange)) { if (smiRange->minValue.value.unsigned32 < min) { min = smiRange->minValue.value.unsigned32; } } if (min < 65535 && min > size) { size = min; } parentType = smiGetParentType(smiType); if (parentType) { unsigned int psize = getMinSize(parentType); if (psize > size) { size = psize; } } return size; }
static void fprintObjects(FILE *f, SmiModule *smiModule) { int i, j; SmiNode *smiNode, *relatedNode; SmiElement *smiElement; SmiType *smiType; int indent = 0; int lastindent = -1; char *s = NULL; SmiNodekind nodekinds; nodekinds = SMI_NODEKIND_NODE | SMI_NODEKIND_TABLE | SMI_NODEKIND_ROW | SMI_NODEKIND_COLUMN | SMI_NODEKIND_SCALAR | SMI_NODEKIND_CAPABILITIES; for(i = 0, smiNode = smiGetFirstNode(smiModule, nodekinds); smiNode; smiNode = smiGetNextNode(smiNode, nodekinds)) { if (smiNode->nodekind == SMI_NODEKIND_NODE) { indent = 0; s = "node"; } else if (smiNode->nodekind == SMI_NODEKIND_CAPABILITIES) { indent = 0; s = "node"; } else if (smiNode->nodekind == SMI_NODEKIND_TABLE) { indent = 0; s = "table"; } else if (smiNode->nodekind == SMI_NODEKIND_ROW) { indent = 1; s = "row"; } else if (smiNode->nodekind == SMI_NODEKIND_COLUMN) { indent = 2; s = "column"; } else if (smiNode->nodekind == SMI_NODEKIND_SCALAR) { indent = 0; s = "scalar"; } if (!i && !silent) { fprint(f, "//\n// OBJECT DEFINITIONS\n//\n\n"); } for (j = lastindent; j >= indent; j--) { fprintSegment(f, (1 + j) * INDENT, "", 0); fprint(f, "};\n"); } fprint(f, "\n"); lastindent = indent; if (smiNode->nodekind == SMI_NODEKIND_CAPABILITIES) { fprintSegment(f, (1 + indent) * INDENT, "", 0); fprint(f, "-- This has been an SMIv2 AGENT-CAPABILITIES node:\n"); } fprintSegment(f, (1 + indent) * INDENT, "", 0); fprint(f, "%s %s {\n", s, smiNode->name); if (smiNode->oid) { fprintSegment(f, (2 + indent) * INDENT, "oid", INDENTVALUE); fprint(f, "%s;\n", getOidString(smiNode, 0)); } smiType = smiGetNodeType(smiNode); if (smiType && (smiType->basetype != SMI_BASETYPE_UNKNOWN)) { fprintSegment(f, (2 + indent) * INDENT, "type", INDENTVALUE); if (!smiType->name) { /* * an implicitly restricted type. */ fprint(f, "%s", getTypeString(smiType->basetype, smiGetParentType(smiType))); fprintSubtype(f, smiType); fprint(f, ";\n"); } else { fprint(f, "%s;\n", getTypeString(smiType->basetype, smiType)); } } if ((smiNode->nodekind != SMI_NODEKIND_TABLE) && (smiNode->nodekind != SMI_NODEKIND_ROW) && (smiNode->nodekind != SMI_NODEKIND_CAPABILITIES) && (smiNode->nodekind != SMI_NODEKIND_NODE)) { if (smiNode->access != SMI_ACCESS_UNKNOWN) { fprintSegment(f, (2 + indent) * INDENT, "access", INDENTVALUE); fprint(f, "%s;\n", getAccessString(smiNode->access)); } } relatedNode = smiGetRelatedNode(smiNode); switch (smiNode->indexkind) { case SMI_INDEX_INDEX: if (smiNode->implied) { fprintSegment(f, (2 + indent) * INDENT, "index implied", INDENTVALUE); } else { fprintSegment(f, (2 + indent) * INDENT, "index", INDENTVALUE); } fprint(f, "("); for (j = 0, smiElement = smiGetFirstElement(smiNode); smiElement; j++, smiElement = smiGetNextElement(smiElement)) { if (j) { fprint(f, ", "); } fprintWrapped(f, INDENTVALUE + 1, smiGetElementNode(smiElement)->name); /* TODO: non-local name if non-local */ } /* TODO: empty? -> print error */ fprint(f, ");\n"); break; case SMI_INDEX_AUGMENT: if (relatedNode) { fprintSegment(f, (2 + indent) * INDENT, "augments", INDENTVALUE); fprint(f, "%s;\n", relatedNode->name); /* TODO: non-local name if non-local */ } /* TODO: else print error */ break; case SMI_INDEX_REORDER: if (relatedNode) { fprintSegment(f, (2 + indent) * INDENT, "", 0); fprint(f, "reorders %s", relatedNode->name); /* TODO: non-local name if non-local */ if (smiNode->implied) { fprint(f, " implied"); } fprint(f, " ("); for (j = 0, smiElement = smiGetFirstElement(smiNode); smiElement; j++, smiElement = smiGetNextElement(smiElement)) { if (j) { fprint(f, ", "); } fprintWrapped(f, INDENTVALUE + 1, smiGetElementNode(smiElement)->name); /* TODO: non-local name if non-local */ } /* TODO: empty? -> print error */ fprint(f, ");\n"); } /* TODO: else print error */ break; case SMI_INDEX_SPARSE: if (relatedNode) { fprintSegment(f, (2 + indent) * INDENT, "sparse", INDENTVALUE); fprint(f, "%s;\n", relatedNode->name); /* TODO: non-local name if non-local */ } /* TODO: else print error */ break; case SMI_INDEX_EXPAND: if (relatedNode) { fprintSegment(f, (2 + indent) * INDENT, "", 0); fprint(f, "expands %s", relatedNode->name); /* TODO: non-local name if non-local */ if (smiNode->implied) { fprint(f, " implied"); } fprint(f, " ("); for (j = 0, smiElement = smiGetFirstElement(smiNode); smiElement; j++, smiElement = smiGetNextElement(smiElement)) { if (j) { fprint(f, ", "); } fprintWrapped(f, INDENTVALUE + 1, smiGetElementNode(smiElement)->name); /* TODO: non-local name if non-local */ } /* TODO: empty? -> print error */ fprint(f, ");\n"); } /* TODO: else print error */ break; case SMI_INDEX_UNKNOWN: break; } if (smiNode->create) { fprintSegment(f, (2 + indent) * INDENT, "create", INDENTVALUE); /* TODO: create list */ fprint(f, ";\n"); } if (smiNode->value.basetype != SMI_BASETYPE_UNKNOWN) { fprintSegment(f, (2 + indent) * INDENT, "default", INDENTVALUE); fprint(f, "%s", getValueString(&smiNode->value, smiType)); fprint(f, ";\n"); } if (smiNode->format) { fprintSegment(f, (2 + indent) * INDENT, "format", INDENTVALUE); fprint(f, "\"%s\";\n",smiNode->format); } if (smiNode->units) { fprintSegment(f, (2 + indent) * INDENT, "units", INDENTVALUE); fprint(f, "\"%s\";\n", smiNode->units); } if ((smiNode->status != SMI_STATUS_CURRENT) && (smiNode->status != SMI_STATUS_UNKNOWN) && (smiNode->status != SMI_STATUS_MANDATORY) && (smiNode->status != SMI_STATUS_OPTIONAL)) { fprintSegment(f, (2 + indent) * INDENT, "status", INDENTVALUE); fprint(f, "%s;\n", getStringStatus(smiNode->status)); } if (smiNode->description) { fprintSegment(f, (2 + indent) * INDENT, "description", INDENTVALUE); fprint(f, "\n"); fprintMultilineString(f, (2 + indent) * INDENT, smiNode->description); fprint(f, ";\n"); } if (smiNode->reference) { fprintSegment(f, (2 + indent) * INDENT, "reference", INDENTVALUE); fprint(f, "\n"); fprintMultilineString(f, (2 + indent) * INDENT, smiNode->reference); fprint(f, ";\n"); } i++; } if (i) { fprintSegment(f, (1 + indent) * INDENT, "", 0); fprint(f, "};\n\n"); } }
static void fprintTypedefs(FILE *f, SmiModule *smiModule) { int i, j; SmiType *smiType; for(i = 0, smiType = smiGetFirstType(smiModule); smiType; smiType = smiGetNextType(smiType)) { if ((!(strcmp(smiModule->name, "SNMPv2-SMI"))) || (!(strcmp(smiModule->name, "RFC1155-SMI")))) { for(j=0; excludeType[j]; j++) { if (!strcmp(smiType->name, excludeType[j])) break; } if (excludeType[j]) break; } if (!i && !silent) { fprint(f, "//\n// TYPE DEFINITIONS\n//\n\n"); } fprintSegment(f, INDENT, "", 0); fprint(f, "typedef %s {\n", smiType->name); fprintSegment(f, 2 * INDENT, "type", INDENTVALUE); fprint(f, "%s", getTypeString(smiType->basetype, smiGetParentType(smiType))); fprintSubtype(f, smiType); fprint(f, ";\n"); if (smiType->value.basetype != SMI_BASETYPE_UNKNOWN) { fprintSegment(f, 2 * INDENT, "default", INDENTVALUE); fprint(f, "%s", getValueString(&smiType->value, smiType)); fprint(f, ";\n"); } if (smiType->format) { fprintSegment(f, 2 * INDENT, "format", INDENTVALUE); fprint(f, "\"%s\";\n", smiType->format); } if (smiType->units) { fprintSegment(f, 2 * INDENT, "units", INDENTVALUE); fprint(f, "\"%s\";\n", smiType->units); } if ((smiType->status != SMI_STATUS_CURRENT) && (smiType->status != SMI_STATUS_UNKNOWN) && (smiType->status != SMI_STATUS_MANDATORY) && (smiType->status != SMI_STATUS_OPTIONAL)) { fprintSegment(f, 2 * INDENT, "status", INDENTVALUE); fprint(f, "%s;\n", getStringStatus(smiType->status)); } fprintSegment(f, 2 * INDENT, "description", INDENTVALUE); fprint(f, "\n"); fprintMultilineString(f, 2 * INDENT, smiType->description); fprint(f, ";\n"); if (smiType->reference) { fprintSegment(f, 2 * INDENT, "reference", INDENTVALUE); fprint(f, "\n"); fprintMultilineString(f, 2 * INDENT, smiType->reference); fprint(f, ";\n"); } fprintSegment(f, INDENT, "};\n\n", 0); i++; } }
static void fprintCompliances(FILE *f, SmiModule *smiModule) { int i, j; SmiNode *smiNode, *smiNode2; SmiType *smiType; SmiOption *smiOption; SmiRefinement *smiRefinement; SmiElement *smiElement; for(i = 0, smiNode = smiGetFirstNode(smiModule, SMI_NODEKIND_COMPLIANCE); smiNode; smiNode = smiGetNextNode(smiNode, SMI_NODEKIND_COMPLIANCE)) { if (!i && !silent) { fprint(f, "//\n// COMPLIANCE DEFINITIONS\n//\n\n"); } fprintSegment(f, INDENT, "", 0); fprint(f, "compliance %s {\n", smiNode->name); if (smiNode->oid) { fprintSegment(f, 2 * INDENT, "oid", INDENTVALUE); fprint(f, "%s;\n", getOidString(smiNode, 0)); } if ((smiNode->status != SMI_STATUS_CURRENT) && (smiNode->status != SMI_STATUS_UNKNOWN) && (smiNode->status != SMI_STATUS_MANDATORY) && (smiNode->status != SMI_STATUS_OPTIONAL)) { fprintSegment(f, 2 * INDENT, "status", INDENTVALUE); fprint(f, "%s;\n", getStringStatus(smiNode->status)); } if (smiNode->description) { fprintSegment(f, 2 * INDENT, "description", INDENTVALUE); fprint(f, "\n"); fprintMultilineString(f, 2 * INDENT, smiNode->description); fprint(f, ";\n"); } if (smiNode->reference) { fprintSegment(f, 2 * INDENT, "reference", INDENTVALUE); fprint(f, "\n"); fprintMultilineString(f, 2 * INDENT, smiNode->reference); fprint(f, ";\n"); } if ((smiElement = smiGetFirstElement(smiNode))) { fprint(f, "\n"); fprintSegment(f, 2 * INDENT, "mandatory", INDENTVALUE); fprint(f, "("); for (j = 0; smiElement; j++, smiElement = smiGetNextElement(smiElement)) { if (j) { fprint(f, ", "); } fprintWrapped(f, INDENTVALUE + 1, smiGetElementNode(smiElement)->name); /* TODO: non-local name if non-local */ } /* TODO: empty? -> print error */ fprint(f, ");\n"); } if ((smiOption = smiGetFirstOption(smiNode))) { fprint(f, "\n"); for(; smiOption; smiOption = smiGetNextOption(smiOption)) { smiNode2 = smiGetOptionNode(smiOption); fprintSegment(f, 2 * INDENT, "", 0); fprint(f, "optional %s {\n", smiNode2->name); fprintSegment(f, 3 * INDENT, "description", INDENTVALUE); fprint(f, "\n"); fprintMultilineString(f, 3 * INDENT, smiOption->description); fprint(f, ";\n"); fprintSegment(f, 2 * INDENT, "};\n", 0); } } if ((smiRefinement = smiGetFirstRefinement(smiNode))) { fprint(f, "\n"); for(; smiRefinement; smiRefinement = smiGetNextRefinement(smiRefinement)) { fprintSegment(f, 2 * INDENT, "", 0); fprint(f, "refine %s {\n", smiGetRefinementNode(smiRefinement)->name); smiType = smiGetRefinementType(smiRefinement); if (smiType) { fprintSegment(f, 3 * INDENT, "type", INDENTVALUE); fprint(f, "%s", getTypeString(smiType->basetype, smiGetParentType(smiType))); fprintSubtype(f, smiType); fprint(f, ";\n"); } smiType = smiGetRefinementWriteType(smiRefinement); if (smiType) { fprintSegment(f, 3 * INDENT, "writetype", INDENTVALUE); fprint(f, "%s", getTypeString(smiType->basetype, smiGetParentType(smiType))); fprintSubtype(f, smiType); fprint(f, ";\n"); } if (smiRefinement->access != SMI_ACCESS_UNKNOWN) { fprintSegment(f, 3 * INDENT, "access", INDENTVALUE); fprint(f, "%s;\n", getAccessString(smiRefinement->access)); } fprintSegment(f, 3 * INDENT, "description", INDENTVALUE); fprint(f, "\n"); fprintMultilineString(f, 3 * INDENT, smiRefinement->description); fprint(f, ";\n"); fprintSegment(f, 2 * INDENT, "};\n", 0); } } fprintSegment(f, INDENT, "", 0); fprint(f, "};\n\n"); i++; } }