⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oalefdefout.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    if (!v || v->getType() != oacLayerArrayValueType) {	return false;    }    oaLayerArray    array;    ((oaLayerArrayValue*) v)->get(array);    for (oaUInt4 i = 0; i < array.getNumElements(); i++) {	oaLayerNum  layerNum = array[i];	oaMaterial  material = getLayer(layerNum)->getMaterial();	if (material != oacMetalMaterial) {	    return false;	}	// Check the layer has the required minWidth constraint.	v = getConstraint(group, oacMinWidth, layerNum);	if (!v || v->getType() != oacIntValueType) {	    return false;	}	// Check the layer has the required soft or hard minSpacing constraint.	v = getConstraint(group, oacMinSpacing, layerNum, NULL, false, false);	if (!v) {	    v = getConstraint(group, oacMinSpacing, layerNum);	}	if (!v || v->getType() != oacIntValueType) {	    return false;	}    }    return true;}// *****************************************************************************// LefDefOut::addProp()//// This function adds a property to the list of LEF/DEF properties in this// translator. It takes a pointer to a oaProp, creates a corresponding// LefDefProp object, and adds it to the list.// *****************************************************************************voidLefDefOut::addProp(oaProp	    *dbProp,		   LefDefObjectType objectType){    oaString	name;    dbProp->getName(name);        // Check the name is valid in the LEF/DEF namespace.    if (strchr(name, '\n') || strchr(name, '#')) {	return;    }    try {	oaSimpleName(ns, name);    } catch (...) {	return;    }    LefDefProp    *prop = findProp(name, objectType);    if (prop) {	return;    }    switch (dbProp->getType()) {      case oacIntPropType:	prop = new LefDefIntProp(name, objectType,			((oaIntProp*) dbProp)->getValue());	break;      case oacDoublePropType:	prop = new LefDefRealProp(name, objectType,			((oaDoubleProp*) dbProp)->getValue());	break;      case oacFloatPropType:	prop = new LefDefRealProp(name, objectType,			((oaFloatProp*) dbProp)->getValue());	break;      case oacStringPropType:	{	    oaString	value;	    ((oaStringProp*) dbProp)->getValue(value);	    prop = new LefDefStringProp(name, objectType, value);	}	break;      case oacIntRangePropType:	{	    oaIntRangeProp  *p = (oaIntRangeProp*) dbProp;	    prop = new LefDefIntRangeProp(name, objectType,			p->getLowerBound(), p->getUpperBound(), p->getValue());	}	break;      case oacDoubleRangePropType:	{	    oaDoubleRangeProp	*p = (oaDoubleRangeProp*) dbProp;	    prop = new LefDefRealRangeProp(name, objectType,			p->getLowerBound(), p->getUpperBound(), p->getValue());	}	break;      case oacFloatRangePropType:	{	    oaFloatRangeProp	*p = (oaFloatRangeProp*) dbProp;	    prop = new LefDefRealRangeProp(name, objectType,			p->getLowerBound(), p->getUpperBound(), p->getValue());	}	break;      default:	return;    }    LefDefBase::addProp(prop);}// *****************************************************************************// LefDefOut::writePropDefs()//// This function writes the property definition section to the output file.// *****************************************************************************voidLefDefOut::writePropDefs(){    if (props) {	output("PROPERTYDEFINITIONS\n");	incIndent();	for (LefDefProp *p = props; p; p = p->getNext()) {	    switch (p->getType()) {	      case cLefDefIntPropType:		writeProp((LefDefIntProp*) p);		break;	      case cLefDefRealPropType:		writeProp((LefDefRealProp*) p);		break;	      case cLefDefStringPropType:		writeProp((LefDefStringProp*) p);		break;	      case cLefDefIntRangePropType:		writeProp((LefDefIntRangeProp*) p);		break;	      case cLefDefRealRangePropType:		writeProp((LefDefRealRangeProp*) p);		break;	    }	}	decIndent();	output("END PROPERTYDEFINITIONS\n\n");    }}// *****************************************************************************// LefDefOut::output()//// This function formats text based on the given format string and variable// arguments and writes it to the current output file. The text is automatically// indented to the current indent level.// *****************************************************************************voidLefDefOut::output(const char	*format,		    ...){    if (format) {	fprintf(file, "%s", indent);	va_list	args;	va_start(args, format);	vfprintf(file, format, args);	va_end(args);    }}// *****************************************************************************// LefDefOut::outNoIndent()//// This function formats text based on the given format string and variable// arguments and writes it to the current output file. The text is not indented.// *****************************************************************************voidLefDefOut::outNoIndent(const char *format,			 ...){    if (format) {	va_list	args;	va_start(args, format);	vfprintf(file, format, args);	va_end(args);    }}// *****************************************************************************// LefDefOut::incIndent()//// This function increments the indent string by the indentShift amount.// *****************************************************************************voidLefDefOut::incIndent(){    indent[indentLevel] = ' ';    indentLevel += indentShift;    indent[indentLevel] = '\0';}// *****************************************************************************// LefDefOut::decIndent()//// This function increments the indent string by the indentShift amount.// *****************************************************************************voidLefDefOut::decIndent(){    indent[indentLevel] = ' ';    indentLevel -= indentShift;    indent[indentLevel] = '\0';}// *****************************************************************************// LefDefOut::writeProp()//// These functions write the specified property information to the output file.// *****************************************************************************voidLefDefOut::writeProp(const LefDefIntProp	*prop){    output("%s %s INTEGER", (const char*) prop->getObjectType().getName(),	    (const char*) prop->getName());    if (prop->getObjectType() == cLefDefLibrary	    || prop->getObjectType() == cLefDefDesign) {	outNoIndent(" %i", prop->getValue());    }    outNoIndent(" ;\n");}voidLefDefOut::writeProp(const LefDefRealProp	*prop){    output("%s %s REAL", (const char*) prop->getObjectType().getName(),	    (const char*) prop->getName());    if (prop->getObjectType() == cLefDefLibrary	    || prop->getObjectType() == cLefDefDesign) {	outNoIndent(" %lg", prop->getValue());    }    outNoIndent(" ;\n");}voidLefDefOut::writeProp(const LefDefStringProp	*prop){    if (prop->getObjectType() == cLefDefLibrary	|| prop->getObjectType() == cLefDefDesign) {		oaString    propValue(prop->getValue());	// Check the value is valid in the LEF/DEF namespace.	if (strchr(propValue, '\n') || strchr(propValue, '#')) {	    return;	}	output("%s %s STRING \"%s\" ;\n",	       (const char*) prop->getObjectType().getName(),	       (const char*) prop->getName(),	       (const char*) propValue);	return;    }    output("%s %s STRING ;\n",	   (const char*) prop->getObjectType().getName(),	   (const char*) prop->getName());}voidLefDefOut::writeProp(const LefDefIntRangeProp   *prop){    output("%s %s INTEGER RANGE %i %i",	    (const char*) prop->getObjectType().getName(),	    (const char*) prop->getName(),	    prop->getLower(), prop->getUpper());    if (prop->getObjectType() == cLefDefLibrary	    || prop->getObjectType() == cLefDefDesign) {	outNoIndent(" %i", prop->getValue());    }    outNoIndent(" ;\n");}voidLefDefOut::writeProp(const LefDefRealRangeProp  *prop){    output("%s %s REAL RANGE %lg %lg",	    (const char*) prop->getObjectType().getName(),	    (const char*) prop->getName(),	    prop->getLower(), prop->getUpper());    if (prop->getObjectType() == cLefDefLibrary	    || prop->getObjectType() == cLefDefDesign) {	outNoIndent(" %lg", prop->getValue());    }    outNoIndent(" ;\n");}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -