void defiComponent::setRegionBounds(int xl, int yl, int xh, int yh) { int i; i = this->numRects_; if (i == this->rectsAllocated_) { int max = this->rectsAllocated_ * 2; int* nxl = (int*)defMalloc(sizeof(int)*max); int* nyl = (int*)defMalloc(sizeof(int)*max); int* nxh = (int*)defMalloc(sizeof(int)*max); int* nyh = (int*)defMalloc(sizeof(int)*max); for (i = 0; i < this->numRects_; i++) { nxl[i] = this->rectXl_[i]; nyl[i] = this->rectYl_[i]; nxh[i] = this->rectXh_[i]; nyh[i] = this->rectYh_[i]; } defFree((char*)(this->rectXl_)); defFree((char*)(this->rectYl_)); defFree((char*)(this->rectXh_)); defFree((char*)(this->rectYh_)); this->rectXl_ = nxl; this->rectYl_ = nyl; this->rectXh_ = nxh; this->rectYh_ = nyh; this->rectsAllocated_ = max; } this->rectXl_[i] = xl; this->rectYl_[i] = yl; this->rectXh_[i] = xh; this->rectYh_[i] = yh; this->numRects_ += 1; }
void defiGroup::addRegionRect(int xl, int yl, int xh, int yh) { int i; if (numRects_ == rectsAllocated_) { int max = numRects_ * 2; int* nxl = (int*)defMalloc(sizeof(int)*max); int* nyl = (int*)defMalloc(sizeof(int)*max); int* nxh = (int*)defMalloc(sizeof(int)*max); int* nyh = (int*)defMalloc(sizeof(int)*max); max = numRects_; for (i = 0; i < max; i++) { nxl[i] = xl_[i]; nyl[i] = yl_[i]; nxh[i] = xh_[i]; nyh[i] = yh_[i]; } defFree((char*)(xl_)); defFree((char*)(yl_)); defFree((char*)(xh_)); defFree((char*)(yh_)); xl_ = nxl; yl_ = nyl; xh_ = nxh; yh_ = nyh; rectsAllocated_ *= 2; } i = numRects_; xl_[i] = xl; yl_[i] = yl; xh_[i] = xh; yh_[i] = yh; numRects_ += 1; }
void defiBox::addPoint(defiGeometries* geom) { struct defiPoints* p; struct defiPoints* tp; int x, y; int i; p = (struct defiPoints*)defMalloc(sizeof(struct defiPoints)); p->numPoints = geom->numPoints(); p->x = (int*)defMalloc(sizeof(int)*p->numPoints); p->y = (int*)defMalloc(sizeof(int)*p->numPoints); for (i = 0; i < p->numPoints; i++) { geom->points(i, &x, &y); p->x[i] = x; p->y[i] = y; // for backward compatibility assign the first 2 points to xl, yl, xh & yh if (i == 0) { xl_ = x; yl_ = y; } else if (i == 1) { xh_ = x; yh_ = y; } } if (points_) { tp = points_; defFree((char*)(tp->x)); defFree((char*)(tp->y)); defFree((char*)(tp)); } points_ = p; }
void defiPropType::bumpProps() { int lim = this->propertiesAllocated_; int news ; char** newpn; char* newt; news = lim ? lim + lim : 2; newpn = (char**)defMalloc(sizeof(char*)*news); newt = (char*)defMalloc(sizeof(char)*news); lim = this->propertiesAllocated_ = news; if (lim > 2) { int i; for (i = 0; i < this->numProperties_; i++) { newpn[i] = this->propNames_[i]; newt[i] = this->propTypes_[i]; } defFree((char*)(this->propNames_)); defFree((char*)(this->propTypes_)); } this->propNames_ = newpn; this->propTypes_ = newt; }
void defiNonDefault::addMinCuts(const char* name, int numCuts) { if (numMinCuts_ == minCutsAllocated_) { int i; char** cln; int* nc; if (minCutsAllocated_ == 0) minCutsAllocated_ = 2; else minCutsAllocated_ *= 2; cln = (char**)defMalloc(sizeof(char*)* minCutsAllocated_); nc = (int*)defMalloc(sizeof(int)* minCutsAllocated_); for (i = 0; i < numMinCuts_; i++) { cln[i] = cutLayerName_[i]; nc[i] = numCuts_[i]; } if (minCutsAllocated_ > 2) { defFree((char*)(cutLayerName_)); defFree((char*)(numCuts_)); } cutLayerName_ = cln; numCuts_ = nc; } cutLayerName_[numMinCuts_] = (char*)defMalloc(strlen(name)+1); strcpy(cutLayerName_[numMinCuts_], DEFCASE(name)); numCuts_[numMinCuts_] = numCuts; numMinCuts_ += 1; }
void defiRegion::addRect(int xl, int yl, int xh, int yh) { if (this->numRectangles_ == this->rectanglesAllocated_) { int i; int max = this->rectanglesAllocated_ = this->rectanglesAllocated_ * 2; int* newxl = (int*)defMalloc(sizeof(int)*max); int* newyl = (int*)defMalloc(sizeof(int)*max); int* newxh = (int*)defMalloc(sizeof(int)*max); int* newyh = (int*)defMalloc(sizeof(int)*max); for (i = 0; i < this->numRectangles_; i++) { newxl[i] = this->xl_[i]; newyl[i] = this->yl_[i]; newxh[i] = this->xh_[i]; newyh[i] = this->yh_[i]; } defFree((char*)(this->xl_)); defFree((char*)(this->yl_)); defFree((char*)(this->xh_)); defFree((char*)(this->yh_)); this->xl_ = newxl; this->yl_ = newyl; this->xh_ = newxh; this->yh_ = newyh; } this->xl_[this->numRectangles_] = xl; this->yl_[this->numRectangles_] = yl; this->xh_[this->numRectangles_] = xh; this->yh_[this->numRectangles_] = yh; this->numRectangles_ += 1; }
// 5.7 void defiFill::addPts(defiGeometries* geom) { struct defiPoints* p; int x, y; int i; if (numPts_ == ptsAllocated_) { struct defiPoints** pts; ptsAllocated_ = (ptsAllocated_ == 0) ? 2 : ptsAllocated_ * 2; pts= (struct defiPoints**)defMalloc(sizeof(struct defiPoints*) * ptsAllocated_); for (i = 0; i < numPts_; i++) pts[i] = viaPts_[i]; if (viaPts_) defFree((char*)(viaPts_)); viaPts_ = pts; } p = (struct defiPoints*)defMalloc(sizeof(struct defiPoints)); p->numPoints = geom->numPoints(); p->x = (int*)defMalloc(sizeof(int)*p->numPoints); p->y = (int*)defMalloc(sizeof(int)*p->numPoints); for (i = 0; i < p->numPoints; i++) { geom->points(i, &x, &y); p->x[i] = x; p->y[i] = y; } viaPts_[numPts_] = p; numPts_ += 1; }
void defiFPC::addItem(char item, const char* name) { int len = strlen(name) + 1; if (namesUsed_ >= namesAllocated_) { char* newR; char** newN; int i; namesAllocated_ = namesAllocated_ ? namesAllocated_ * 2 : 8 ; newN = (char**) defMalloc(sizeof(char*) * namesAllocated_); newR = (char*) defMalloc(sizeof(char) * namesAllocated_); for (i = 0; i < namesUsed_; i++) { newN[i] = names_[i]; newR[i] = rowOrComp_[i]; } if (names_) defFree((char*)(names_)); if (rowOrComp_) defFree(rowOrComp_); names_ = newN; rowOrComp_ = newR; } names_[namesUsed_] = (char*)defMalloc(len); strcpy(names_[namesUsed_], name); // 4 for bottomleft // 2 for row rowOrComp_[namesUsed_] = (char)(((corner_ == 'B') ? 4 : 0) | (item == 'R' ? 2 : 0)); namesUsed_ += 1; }
void defiRegion::addRect(int xl, int yl, int xh, int yh) { if (numRectangles_ == rectanglesAllocated_) { int i; int max = rectanglesAllocated_ = rectanglesAllocated_ * 2; int* newxl = (int*)defMalloc(sizeof(int)*max); int* newyl = (int*)defMalloc(sizeof(int)*max); int* newxh = (int*)defMalloc(sizeof(int)*max); int* newyh = (int*)defMalloc(sizeof(int)*max); for (i = 0; i < numRectangles_; i++) { newxl[i] = xl_[i]; newyl[i] = yl_[i]; newxh[i] = xh_[i]; newyh[i] = yh_[i]; } defFree((char*)(xl_)); defFree((char*)(yl_)); defFree((char*)(xh_)); defFree((char*)(yh_)); xl_ = newxl; yl_ = newyl; xh_ = newxh; yh_ = newyh; } xl_[numRectangles_] = xl; yl_[numRectangles_] = yl; xh_[numRectangles_] = xh; yh_[numRectangles_] = yh; numRectangles_ += 1; }
void defiRow::setup(const char* name, const char* macro, double x, double y, int orient) { int len = strlen(name) + 1; this->defiRow::clear(); if (len > this->nameLength_) { if (this->name_) defFree(this->name_); this->nameLength_ = len; this->name_ = (char*)defMalloc(len); } strcpy(this->name_, DEFCASE(name)); len = strlen(macro) + 1; if (len > this->macroLength_) { if (this->macro_) defFree(this->macro_); this->macroLength_ = len; this->macro_ = (char*)defMalloc(len); } strcpy(this->macro_, DEFCASE(macro)); this->x_ = x; this->y_ = y; this->xStep_ = 0.0; this->yStep_ = 0.0; this->xNum_ = 0.0; this->yNum_ = 0.0; this->orient_ = orient; }
void defrDisableParserMsgs(int nMsg, int *msgs) { ASSERT_INIT; int i, j; int *tmp; if (defSettings->nDDMsgs == 0) { defSettings->nDDMsgs = nMsg; defSettings->disableDMsgs = (int*) defMalloc(sizeof(int) * nMsg); for (i = 0; i < nMsg; i++) defSettings->disableDMsgs[i] = msgs[i]; } else { // add the list to the existing list // 1st check if the msgId is already on the list before adding it on tmp = (int*) defMalloc(sizeof(int) * (nMsg + defSettings->nDDMsgs)); for (i = 0; i < defSettings->nDDMsgs; i++) // copy the existing to the new list tmp[i] = defSettings->disableDMsgs[i]; defFree((int*) (defSettings->disableDMsgs)); defSettings->disableDMsgs = tmp; // set disableDMsgs to the new list for (i = 0; i < nMsg; i++) { // merge the new list with the existing for (j = 0; j < defSettings->nDDMsgs; j++) { if (defSettings->disableDMsgs[j] == msgs[i]) break; // msgId already on the list } if (j == defSettings->nDDMsgs) // msgId not on the list, add it on defSettings->disableDMsgs[defSettings->nDDMsgs++] = msgs[i]; } } return; }
void defiRegion::setType(const char* type) { int len; if (type_) defFree(type_); len = strlen(type) + 1; type_ = (char*)defMalloc(len); strcpy(type_, DEFCASE(type)); }
void defiComponent::addNet(const char* net) { int len = strlen(net) + 1; if (this->numNets_ == this->netsAllocated_) this->defiComponent::bumpNets(this->numNets_ * 2); this->nets_[this->numNets_] = (char*)defMalloc(len); strcpy(this->nets_[this->numNets_], DEFCASE(net)); (this->numNets_)++; }
void defiPath::bumpSize(int size) { int i; int* newKeys = (int*)defMalloc(size * sizeof(int*)); void** newData = (void**)defMalloc(size * sizeof(void*)); for (i = 0; i < this->numUsed_; i++) { newKeys[i] = this->keys_[i]; newData[i] = this->data_[i]; } if (this->keys_) defFree((char*)(this->keys_)); if (this->data_) defFree((char*)(this->data_)); this->keys_ = newKeys; this->data_ = newData; this->numAllocated_ = size; }
void defiPath::addShape(const char* l) { int len = strlen(l)+1; if (this->numUsed_ == this->numAllocated_) this->defiPath::bumpSize(this->numAllocated_ * 2); this->keys_[this->numUsed_] = 'S' ; this->data_[this->numUsed_] = defMalloc(len); strcpy((char*)(this->data_[this->numUsed_]), DEFCASE(l)); (this->numUsed_)++; }
void defiPath::addPoint(int x, int y) { if (this->numUsed_ == this->numAllocated_) this->defiPath::bumpSize(this->numAllocated_ * 2); this->keys_[this->numUsed_] = 'P'; this->data_[this->numUsed_] = defMalloc(sizeof(struct defiPnt)); ((struct defiPnt*)(this->data_[this->numUsed_])) -> x = x; ((struct defiPnt*)(this->data_[this->numUsed_])) -> y = y; (this->numUsed_)++; }
void defiComponent::bumpNets(int size) { int i; char** newNets = (char**)defMalloc(sizeof(char*)* size); for (i = 0; i < this->numNets_; i++) { newNets[i] = this->nets_[i]; } defFree((char*)(this->nets_)); this->nets_ = newNets; this->netsAllocated_ = size; }
void defiPath::addStyle(int s) { int *style; if (this->numUsed_ == this->numAllocated_) this->defiPath::bumpSize(this->numAllocated_ * 2); style = (int*)defMalloc(sizeof(int)); *style = s; this->keys_[this->numUsed_] = 'Y' ; this->data_[this->numUsed_] = style; (this->numUsed_)++; }
void defiPath::addViaRotation(int o) { int * orient; if (this->numUsed_ == this->numAllocated_) this->defiPath::bumpSize(this->numAllocated_ * 2); orient = (int*)defMalloc(sizeof(int)); *orient = o; this->keys_[this->numUsed_] = 'O'; this->data_[this->numUsed_] = orient; (this->numUsed_)++; }
void defiPath::addWidth(int w) { int * wValue; if (this->numUsed_ == this->numAllocated_) this->defiPath::bumpSize(this->numAllocated_ * 2); wValue = (int*)defMalloc(sizeof(int)); *wValue = w; this->keys_[this->numUsed_] = 'W'; this->data_[this->numUsed_] = wValue; (this->numUsed_)++; }
void defiPartition::addPin(const char* name) { int len; int i; char** newp; if (this->numPins_ >= this->pinsAllocated_) { this->pinsAllocated_ = this->pinsAllocated_ ? 2 * this->pinsAllocated_ : 8; newp = (char**) defMalloc(sizeof(char*) * this->pinsAllocated_); for (i = 0; i < this->numPins_; i++) newp[i] = this->pins_[i]; if (this->pins_) defFree((char*)(this->pins_)); this->pins_ = newp; } len = strlen(name) + 1; this->pins_[this->numPins_] = (char*)defMalloc(len); strcpy(this->pins_[this->numPins_], DEFCASE(name)); this->numPins_ += 1; }
void defiTrack::addLayer(const char* layer) { char* l; int len; if (this->numLayers_ >= this->layersLength_) { int i; char** newl; this->layersLength_ = this->layersLength_ ? 2 * this->layersLength_ : 8; newl = (char**)defMalloc(this->layersLength_* sizeof(char*)); for (i = 0; i < this->numLayers_; i++) newl[i] = this->layers_[i]; if (this->layers_) defFree((char*)(this->layers_)); this->layers_ = newl; } len = strlen(layer) + 1; l = (char*)defMalloc(len); strcpy(l, DEFCASE(layer)); this->layers_[this->numLayers_++] = l; }
void defiPath::addViaData(int numX, int numY, int stepX, int stepY) { if (this->numUsed_ == this->numAllocated_) this->defiPath::bumpSize(this->numAllocated_ * 2); this->keys_[this->numUsed_] = 'D'; this->data_[this->numUsed_] = defMalloc(sizeof(struct defiViaData)); ((struct defiViaData*)(this->data_[this->numUsed_]))->numX = numX; ((struct defiViaData*)(this->data_[this->numUsed_]))->numY = numY; ((struct defiViaData*)(this->data_[this->numUsed_]))->stepX = stepX; ((struct defiViaData*)(this->data_[this->numUsed_]))->stepY = stepY; (this->numUsed_)++; }
void defiNonDefault::addViaRule(const char* name) { if (numViaRules_ == viaRulesAllocated_) { int i; char** vn; if (viaRulesAllocated_ == 0) viaRulesAllocated_ = 2; else viaRulesAllocated_ *= 2; vn = (char**)defMalloc(sizeof(char*)* viaRulesAllocated_); for (i = 0; i < numViaRules_; i++) { vn[i] = viaRuleNames_[i]; } defFree((char*)(viaRuleNames_)); viaRuleNames_ = vn; } viaRuleNames_[numViaRules_] = (char*)defMalloc(strlen(name)+1); strcpy(viaRuleNames_[numViaRules_], DEFCASE(name)); numViaRules_ += 1; }
void defiPropType::setPropType(const char* name, const char type) { int len; if (this->numProperties_ == this->propertiesAllocated_) this->defiPropType::bumpProps(); len = strlen(name) + 1; this->propNames_[this->numProperties_] = (char*)defMalloc(len); strcpy(this->propNames_[this->numProperties_], DEFCASE(name)); this->propTypes_[this->numProperties_] = type; this->numProperties_ += 1; }
void defiGroup::setRegionName(const char* region) { int len = strlen(region) + 1; if (len > regionLength_) { if (region_) defFree(region_); regionLength_ = len; region_ = (char*)defMalloc(len); } strcpy(region_, DEFCASE(region)); hasRegionName_ = 1; }
void defiComponent::setGenerate(const char* newName, const char* macroName) { int len = strlen(newName) + 1; if (this->generateNameSize_ < len) { if (this->generateName_) defFree(this->generateName_); this->generateName_ = (char*)defMalloc(len); this->generateNameSize_ = len; } strcpy(this->generateName_, DEFCASE(newName)); len = strlen(macroName) + 1; if (this->macroNameSize_ < len) { if (this->macroName_) defFree(this->macroName_); this->macroName_ = (char*)defMalloc(len); this->macroNameSize_ = len; } strcpy(this->macroName_, DEFCASE(macroName)); this->hasGenerate_ = 1; // Ying Tan fix at 20010918 }
void defiGroup::setup(const char* name) { int len = strlen(name) + 1; if (len > nameLength_) { if (name_) defFree(name_); nameLength_ = len; name_ = (char*)defMalloc(len); } strcpy(name_, DEFCASE(name)); clear(); }
void defiIOTiming::setFrom(const char* name) { int len = strlen(name) + 1; if (fromLength_ < len) { if (from_) defFree(from_); from_ = (char*) defMalloc(len); fromLength_ = len; } strcpy(from_, DEFCASE(name)); hasFrom_ = 1; }
void defiIOTiming::setTo(const char* name) { int len = strlen(name) + 1; if (toLength_ < len) { if (to_) defFree(to_); to_ = (char*) defMalloc(len); toLength_ = len; } strcpy(to_, DEFCASE(name)); hasTo_ = 1; }