Make sprints safe in lefdef

This commit is contained in:
Rob Taylor 2023-08-18 18:28:57 +01:00 committed by Jean-Paul Chaput
parent 706e340361
commit bda776ec02
10 changed files with 279 additions and 291 deletions

View File

@ -57,6 +57,7 @@
%{ %{
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "defrReader.hpp" #include "defrReader.hpp"
#include "defiUser.hpp" #include "defiUser.hpp"
@ -99,8 +100,7 @@ BEGIN_LEFDEF_PARSER_NAMESPACE
#define CHKPROPTYPE(propType, propName, name) \ #define CHKPROPTYPE(propType, propName, name) \
if (propType == 'N') { \ if (propType == 'N') { \
defData->warningMsg = (char*)malloc(strlen(propName)+strlen(name)+40); \ asprintf(&defData->warningMsg, "The PropName %s is not defined for %s.",\
sprintf(defData->warningMsg, "The PropName %s is not defined for %s.", \
propName, name); \ propName, name); \
defData->defWarning(7010, defData->warningMsg); \ defData->defWarning(7010, defData->warningMsg); \
free(defData->warningMsg); \ free(defData->warningMsg); \
@ -221,11 +221,12 @@ version_stmt: // empty
{ {
defData->VersionNum = defrData::convert_defname2num($3); defData->VersionNum = defrData::convert_defname2num($3);
if (defData->VersionNum > CURRENT_VERSION) { if (defData->VersionNum > CURRENT_VERSION) {
char temp[300]; char *temp;
sprintf(temp, asprintf(&temp,
"The execution has been stopped because the DEF parser %.1f does not support DEF file with version %s.\nUpdate your DEF file to version 5.8 or earlier.", "The execution has been stopped because the DEF parser %.1f does not support DEF file with version %s.\nUpdate your DEF file to version 5.8 or earlier.",
CURRENT_VERSION, $3); CURRENT_VERSION, $3);
defData->defError(6503, temp); defData->defError(6503, temp);
free(temp);
return 1; return 1;
} }
if (defData->callbacks->VersionStrCbk) { if (defData->callbacks->VersionStrCbk) {
@ -316,9 +317,10 @@ end_design: K_END K_DESIGN
return 1; return 1;
if (!defData->hasVer) { if (!defData->hasVer) {
char temp[300]; char *temp;
sprintf(temp, "No VERSION statement found, using the default value %2g.", defData->VersionNum); asprintf(&temp, "No VERSION statement found, using the default value %2g.", defData->VersionNum);
defData->defWarning(7012, temp); defData->defWarning(7012, temp);
free(temp);
} }
if (!defData->hasNameCase && defData->VersionNum < 5.6) if (!defData->hasNameCase && defData->VersionNum < 5.6)
defData->defWarning(7013, "The DEF file is invalid if NAMESCASESENSITIVE is undefined.\nNAMESCASESENSITIVE is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the NAMESCASESENSITIVE statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual."); defData->defWarning(7013, "The DEF file is invalid if NAMESCASESENSITIVE is undefined.\nNAMESCASESENSITIVE is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the NAMESCASESENSITIVE statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual.");
@ -450,8 +452,7 @@ property_def: K_DESIGN {defData->dumb_mode = 1; defData->no_num = 1; defData->Pr
{ {
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->nonDefaultWarnings++ < defData->settings->NonDefaultWarnings) { if (defData->nonDefaultWarnings++ < defData->settings->NonDefaultWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6505, defData->defMsg); defData->defError(6505, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -654,8 +655,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The NETEXPR statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The NETEXPR statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6506, defData->defMsg); defData->defError(6506, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -675,8 +675,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The SUPPLYSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The SUPPLYSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6507, defData->defMsg); defData->defError(6507, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -695,8 +694,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The GROUNDSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The GROUNDSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6508, defData->defMsg); defData->defError(6508, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -719,8 +717,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The PORT in PINS is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The PORT in PINS is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6555, defData->defMsg); defData->defError(6555, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -759,8 +756,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6509, defData->defMsg); defData->defError(6509, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -795,8 +791,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The PIN VIA statement is available in version 5.7 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The PIN VIA statement is available in version 5.7 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6556, defData->defMsg); defData->defError(6556, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -833,8 +828,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAPINPARTIALMETALAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAPINPARTIALMETALAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6510, defData->defMsg); defData->defError(6510, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -851,8 +845,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAPINPARTIALMETALSIDEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAPINPARTIALMETALSIDEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6511, defData->defMsg); defData->defError(6511, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -869,8 +862,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAPINGATEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAPINGATEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6512, defData->defMsg); defData->defError(6512, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -887,8 +879,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAPINDIFFAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAPINDIFFAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6513, defData->defMsg); defData->defError(6513, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -905,8 +896,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAPINMAXAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAPINMAXAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6514, defData->defMsg); defData->defError(6514, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -924,8 +914,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAPINMAXSIDEAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAPINMAXSIDEAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6515, defData->defMsg); defData->defError(6515, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -942,8 +931,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAPINPARTIALCUTAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAPINPARTIALCUTAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6516, defData->defMsg); defData->defError(6516, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -960,8 +948,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAPINMAXCUTCAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAPINMAXCUTCAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6517, defData->defMsg); defData->defError(6517, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -978,8 +965,7 @@ pin_option: '+' K_SPECIAL
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ANTENNAMODEL statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ANTENNAMODEL statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6518, defData->defMsg); defData->defError(6518, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1033,8 +1019,7 @@ pin_layer_spacing_opt: // empty
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6519, defData->defMsg); defData->defError(6519, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1056,8 +1041,7 @@ pin_layer_spacing_opt: // empty
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"DESIGNRULEWIDTH statement is a version 5.6 and later syntax.\nYour def file is defined with version %g", defData->VersionNum); "DESIGNRULEWIDTH statement is a version 5.6 and later syntax.\nYour def file is defined with version %g", defData->VersionNum);
defData->defError(6520, defData->defMsg); defData->defError(6520, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1081,8 +1065,7 @@ pin_poly_spacing_opt: // empty
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"SPACING statement is a version 5.6 and later syntax.\nYour def file is defined with version %g", defData->VersionNum); "SPACING statement is a version 5.6 and later syntax.\nYour def file is defined with version %g", defData->VersionNum);
defData->defError(6521, defData->defMsg); defData->defError(6521, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1104,8 +1087,7 @@ pin_poly_spacing_opt: // empty
if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) {
if ((defData->pinWarnings++ < defData->settings->PinWarnings) && if ((defData->pinWarnings++ < defData->settings->PinWarnings) &&
(defData->pinWarnings++ < defData->settings->PinExtWarnings)) { (defData->pinWarnings++ < defData->settings->PinExtWarnings)) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The DESIGNRULEWIDTH statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The DESIGNRULEWIDTH statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6520, defData->defMsg); defData->defError(6520, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1213,8 +1195,7 @@ row_do_option: // empty
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->RowCbk) { if (defData->callbacks->RowCbk) {
if (defData->rowWarnings++ < defData->settings->RowWarnings) { if (defData->rowWarnings++ < defData->settings->RowWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf(&defData->defMsg,
sprintf(defData->defMsg,
"The DO statement in the ROW statement with the name %s has invalid syntax.\nThe valid syntax is \"DO numX BY 1 STEP spaceX 0 | DO 1 BY numY STEP 0 spaceY\".\nSpecify the valid syntax and try again.", defData->rowName); "The DO statement in the ROW statement with the name %s has invalid syntax.\nThe valid syntax is \"DO numX BY 1 STEP spaceX 0 | DO 1 BY numY STEP 0 spaceY\".\nSpecify the valid syntax and try again.", defData->rowName);
defData->defWarning(7018, defData->defMsg); defData->defWarning(7018, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1267,7 +1248,7 @@ row_prop : T_STRING NUMBER
propTp = defData->session->RowProp.propType($1); propTp = defData->session->RowProp.propType($1);
CHKPROPTYPE(propTp, $1, "ROW"); CHKPROPTYPE(propTp, $1, "ROW");
// For backword compatibility, also set the string value // For backword compatibility, also set the string value
sprintf(str, "%g", $2); snprintf(str, 24, "%g", $2);
defData->Row.addNumProperty($1, $2, str, propTp); defData->Row.addNumProperty($1, $2, str, propTp);
} }
} }
@ -1301,8 +1282,7 @@ tracks_rule: track_start NUMBER
if (($5 <= 0) && (defData->VersionNum >= 5.4)) { if (($5 <= 0) && (defData->VersionNum >= 5.4)) {
if (defData->callbacks->TrackCbk) if (defData->callbacks->TrackCbk)
if (defData->trackWarnings++ < defData->settings->TrackWarnings) { if (defData->trackWarnings++ < defData->settings->TrackWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The DO number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $5); "The DO number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $5);
defData->defError(6525, defData->defMsg); defData->defError(6525, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1311,8 +1291,7 @@ tracks_rule: track_start NUMBER
if ($7 < 0) { if ($7 < 0) {
if (defData->callbacks->TrackCbk) if (defData->callbacks->TrackCbk)
if (defData->trackWarnings++ < defData->settings->TrackWarnings) { if (defData->trackWarnings++ < defData->settings->TrackWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The STEP number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $7); "The STEP number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $7);
defData->defError(6526, defData->defMsg); defData->defError(6526, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1372,8 +1351,7 @@ gcellgrid: K_GCELLGRID track_type NUMBER
if ($5 <= 0) { if ($5 <= 0) {
if (defData->callbacks->GcellGridCbk) if (defData->callbacks->GcellGridCbk)
if (defData->gcellGridWarnings++ < defData->settings->GcellGridWarnings) { if (defData->gcellGridWarnings++ < defData->settings->GcellGridWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The DO number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $5); "The DO number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $5);
defData->defError(6527, defData->defMsg); defData->defError(6527, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1382,8 +1360,7 @@ gcellgrid: K_GCELLGRID track_type NUMBER
if ($7 < 0) { if ($7 < 0) {
if (defData->callbacks->GcellGridCbk) if (defData->callbacks->GcellGridCbk)
if (defData->gcellGridWarnings++ < defData->settings->GcellGridWarnings) { if (defData->gcellGridWarnings++ < defData->settings->GcellGridWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The STEP number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $7); "The STEP number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $7);
defData->defError(6528, defData->defMsg); defData->defError(6528, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1445,8 +1422,7 @@ layer_stmt: '+' K_RECT {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING m
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->ViaCbk) { if (defData->callbacks->ViaCbk) {
if (defData->viaWarnings++ < defData->settings->ViaWarnings) { if (defData->viaWarnings++ < defData->settings->ViaWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6509, defData->defMsg); defData->defError(6509, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1487,8 +1463,7 @@ layer_stmt: '+' K_RECT {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING m
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->ViaCbk) { if (defData->callbacks->ViaCbk) {
if (defData->viaWarnings++ < defData->settings->ViaWarnings) { if (defData->viaWarnings++ < defData->settings->ViaWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The VIARULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The VIARULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6557, defData->defMsg); defData->defError(6557, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1675,7 +1650,7 @@ region_prop : T_STRING NUMBER
// We will use a temporary string to store the number. // We will use a temporary string to store the number.
// The string space is borrowed from the ring buffer // The string space is borrowed from the ring buffer
// in the lexer. // in the lexer.
sprintf(str, "%g", $2); snprintf(str, 24, "%g", $2);
defData->Region.addNumProperty($1, $2, str, propTp); defData->Region.addNumProperty($1, $2, str, propTp);
} }
} }
@ -1707,8 +1682,7 @@ comps_maskShift_section : K_COMPSMASKSHIFT layer_statement ';'
{ {
if (defData->VersionNum < 5.8) { if (defData->VersionNum < 5.8) {
if (defData->componentWarnings++ < defData->settings->ComponentWarnings) { if (defData->componentWarnings++ < defData->settings->ComponentWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The MASKSHIFT statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The MASKSHIFT statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(7415, defData->defMsg); defData->defError(7415, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1864,8 +1838,7 @@ comp_halo: '+' K_HALO // 5.7
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->ComponentCbk) { if (defData->callbacks->ComponentCbk) {
if (defData->componentWarnings++ < defData->settings->ComponentWarnings) { if (defData->componentWarnings++ < defData->settings->ComponentWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The HALO statement is a version 5.6 and later syntax.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The HALO statement is a version 5.6 and later syntax.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6529, defData->defMsg); defData->defError(6529, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1887,8 +1860,7 @@ halo_soft: // 5.7
if (defData->VersionNum < 5.7) { if (defData->VersionNum < 5.7) {
if (defData->callbacks->ComponentCbk) { if (defData->callbacks->ComponentCbk) {
if (defData->componentWarnings++ < defData->settings->ComponentWarnings) { if (defData->componentWarnings++ < defData->settings->ComponentWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The HALO SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The HALO SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6550, defData->defMsg); defData->defError(6550, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1907,8 +1879,7 @@ comp_routehalo: '+' K_ROUTEHALO NUMBER { defData->dumb_mode = 2; defData->no_num
if (defData->VersionNum < 5.7) { if (defData->VersionNum < 5.7) {
if (defData->callbacks->ComponentCbk) { if (defData->callbacks->ComponentCbk) {
if (defData->componentWarnings++ < defData->settings->ComponentWarnings) { if (defData->componentWarnings++ < defData->settings->ComponentWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The ROUTEHALO is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The ROUTEHALO is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6551, defData->defMsg); defData->defError(6551, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -1937,7 +1908,7 @@ comp_prop: T_STRING NUMBER
char* str = defData->ringCopy(" "); char* str = defData->ringCopy(" ");
propTp = defData->session->CompProp.propType($1); propTp = defData->session->CompProp.propType($1);
CHKPROPTYPE(propTp, $1, "COMPONENT"); CHKPROPTYPE(propTp, $1, "COMPONENT");
sprintf(str, "%g", $2); snprintf(str, 24, "%g", $2);
defData->Component.addNumProperty($1, $2, str, propTp); defData->Component.addNumProperty($1, $2, str, propTp);
} }
} }
@ -2166,8 +2137,7 @@ net_option: '+' net_type
if (defData->VersionNum < 5.5) { if (defData->VersionNum < 5.5) {
if (defData->callbacks->NetCbk) { if (defData->callbacks->NetCbk) {
if (defData->netWarnings++ < defData->settings->NetWarnings) { if (defData->netWarnings++ < defData->settings->NetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The FIXEDBUMP statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The FIXEDBUMP statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6530, defData->defMsg); defData->defError(6530, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -2183,8 +2153,7 @@ net_option: '+' net_type
if (defData->VersionNum < 5.5) { if (defData->VersionNum < 5.5) {
if (defData->callbacks->NetCbk) { if (defData->callbacks->NetCbk) {
if (defData->netWarnings++ < defData->settings->NetWarnings) { if (defData->netWarnings++ < defData->settings->NetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The FREQUENCY statement is a version 5.5 and later syntax.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The FREQUENCY statement is a version 5.5 and later syntax.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6558, defData->defMsg); defData->defError(6558, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -2330,7 +2299,7 @@ net_prop: T_STRING NUMBER
char* str = defData->ringCopy(" "); char* str = defData->ringCopy(" ");
propTp = defData->session->NetProp.propType($1); propTp = defData->session->NetProp.propType($1);
CHKPROPTYPE(propTp, $1, "NET"); CHKPROPTYPE(propTp, $1, "NET");
sprintf(str, "%g", $2); snprintf(str, 24, "%g", $2);
defData->Net.addNumProp($1, $2, str, propTp); defData->Net.addNumProp($1, $2, str, propTp);
} }
} }
@ -2452,8 +2421,7 @@ virtual_statement :
if (defData->VersionNum < 5.8) { if (defData->VersionNum < 5.8) {
if (defData->callbacks->SNetCbk) { if (defData->callbacks->SNetCbk) {
if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { if (defData->sNetWarnings++ < defData->settings->SNetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The VIRTUAL statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The VIRTUAL statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6536, defData->defMsg); defData->defError(6536, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -2469,8 +2437,7 @@ rect_statement :
if (defData->VersionNum < 5.8) { if (defData->VersionNum < 5.8) {
if (defData->callbacks->SNetCbk) { if (defData->callbacks->SNetCbk) {
if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { if (defData->sNetWarnings++ < defData->settings->SNetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The RECT statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The RECT statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6536, defData->defMsg); defData->defError(6536, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -2560,8 +2527,7 @@ path_item:
if (defData->NeedPathData && if (defData->NeedPathData &&
defData->callbacks->SNetCbk) { defData->callbacks->SNetCbk) {
if (defData->netWarnings++ < defData->settings->NetWarnings) { if (defData->netWarnings++ < defData->settings->NetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The VIA DO statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The VIA DO statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6532, defData->defMsg); defData->defError(6532, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -2594,8 +2560,7 @@ path_item:
if (defData->NeedPathData && if (defData->NeedPathData &&
defData->callbacks->SNetCbk) { defData->callbacks->SNetCbk) {
if (defData->netWarnings++ < defData->settings->NetWarnings) { if (defData->netWarnings++ < defData->settings->NetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The VIA DO statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The VIA DO statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6532, defData->defMsg); defData->defError(6532, defData->defMsg);
CHKERR(); CHKERR();
@ -2802,8 +2767,7 @@ opt_style: K_STYLE NUMBER
if (defData->NeedPathData && (defData->callbacks->NetCbk || if (defData->NeedPathData && (defData->callbacks->NetCbk ||
defData->callbacks->SNetCbk)) { defData->callbacks->SNetCbk)) {
if (defData->netWarnings++ < defData->settings->NetWarnings) { if (defData->netWarnings++ < defData->settings->NetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The STYLE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The STYLE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6534, defData->defMsg); defData->defError(6534, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -2830,8 +2794,7 @@ opt_shape_style:
if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) ||
(defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) {
if (defData->netWarnings++ < defData->settings->NetWarnings) { if (defData->netWarnings++ < defData->settings->NetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The STYLE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The STYLE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6534, defData->defMsg); defData->defError(6534, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -2870,8 +2833,7 @@ shape_type: K_RING
if (defData->VersionNum < 5.7) { if (defData->VersionNum < 5.7) {
if (defData->NeedPathData) { if (defData->NeedPathData) {
if (defData->fillWarnings++ < defData->settings->FillWarnings) { if (defData->fillWarnings++ < defData->settings->FillWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The FILLWIREOPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The FILLWIREOPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6552, defData->defMsg); defData->defError(6552, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -2914,8 +2876,7 @@ snet_other_option: '+' net_type
defData->specialWire_routeStatus = $2; defData->specialWire_routeStatus = $2;
} else { } else {
if (defData->callbacks->SNetCbk) { // PCR 902306 if (defData->callbacks->SNetCbk) { // PCR 902306
defData->defMsg = (char*)malloc(1024); asprintf(&defData->defMsg, "The SPECIAL NET statement, with type %s, does not have any net statement defined.\nThe DEF parser will ignore this statemnet.", $2);
sprintf(defData->defMsg, "The SPECIAL NET statement, with type %s, does not have any net statement defined.\nThe DEF parser will ignore this statemnet.", $2);
defData->defWarning(7023, defData->defMsg); defData->defWarning(7023, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
} }
@ -2965,8 +2926,7 @@ snet_other_option: '+' net_type
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->SNetCbk) { if (defData->callbacks->SNetCbk) {
if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { if (defData->sNetWarnings++ < defData->settings->SNetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6535, defData->defMsg); defData->defError(6535, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -3006,8 +2966,7 @@ snet_other_option: '+' net_type
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->SNetCbk) { if (defData->callbacks->SNetCbk) {
if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { if (defData->sNetWarnings++ < defData->settings->SNetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The RECT statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The RECT statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6536, defData->defMsg); defData->defError(6536, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -3039,8 +2998,7 @@ snet_other_option: '+' net_type
if (defData->VersionNum < 5.8) { if (defData->VersionNum < 5.8) {
if (defData->callbacks->SNetCbk) { if (defData->callbacks->SNetCbk) {
if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { if (defData->sNetWarnings++ < defData->settings->SNetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The VIA statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The VIA statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6536, defData->defMsg); defData->defError(6536, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -3123,8 +3081,7 @@ shield_layer: // PCR 902306
{ {
if (defData->callbacks->SNetCbk) { if (defData->callbacks->SNetCbk) {
if (defData->VersionNum < 5.8) { if (defData->VersionNum < 5.8) {
defData->defMsg = (char*)malloc(1024); asprintf(&defData->defMsg, "The SPECIAL NET SHIELD statement doesn't have routing points definition.\nWill be ignored.");
sprintf(defData->defMsg, "The SPECIAL NET SHIELD statement doesn't have routing points definition.\nWill be ignored.");
defData->defWarning(7025, defData->defMsg); defData->defWarning(7025, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
} else { // CCR 1244433 } else { // CCR 1244433
@ -3206,8 +3163,7 @@ snet_voltage: '+' K_VOLTAGE { defData->dumb_mode = 1; defData->no_num = 1; } T_
} else { } else {
if (defData->callbacks->SNetCbk) { if (defData->callbacks->SNetCbk) {
if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { if (defData->sNetWarnings++ < defData->settings->SNetWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The value %s for statement VOLTAGE is invalid. The value can only be integer.\nSpecify a valid value in units of millivolts", $4); "The value %s for statement VOLTAGE is invalid. The value can only be integer.\nSpecify a valid value in units of millivolts", $4);
defData->defError(6537, defData->defMsg); defData->defError(6537, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -3237,7 +3193,7 @@ snet_prop: T_STRING NUMBER
propTp = defData->session->SNetProp.propType($1); propTp = defData->session->SNetProp.propType($1);
CHKPROPTYPE(propTp, $1, "SPECIAL NET"); CHKPROPTYPE(propTp, $1, "SPECIAL NET");
// For backword compatibility, also set the string value // For backword compatibility, also set the string value
sprintf(str, "%g", $2); snprintf(str, 24, "%g", $2);
defData->Net.addNumProp($1, $2, str, propTp); defData->Net.addNumProp($1, $2, str, propTp);
} }
} }
@ -3438,7 +3394,7 @@ group_prop : T_STRING NUMBER
char* str = defData->ringCopy(" "); char* str = defData->ringCopy(" ");
propTp = defData->session->GroupProp.propType($1); propTp = defData->session->GroupProp.propType($1);
CHKPROPTYPE(propTp, $1, "GROUP"); CHKPROPTYPE(propTp, $1, "GROUP");
sprintf(str, "%g", $2); snprintf(str, 24, "%g", $2);
defData->Group.addNumProperty($1, $2, str, propTp); defData->Group.addNumProperty($1, $2, str, propTp);
} }
} }
@ -3712,8 +3668,7 @@ scan_member: '+' K_START {defData->dumb_mode = 2; defData->no_num = 2;} T_STRING
if (defData->VersionNum < 5.5) { if (defData->VersionNum < 5.5) {
if (defData->callbacks->ScanchainCbk) { if (defData->callbacks->ScanchainCbk) {
if (defData->scanchainWarnings++ < defData->settings->ScanchainWarnings) { if (defData->scanchainWarnings++ < defData->settings->ScanchainWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The PARTITION statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The PARTITION statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6538, defData->defMsg); defData->defError(6538, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -4387,7 +4342,7 @@ pin_prop_name_value : T_STRING NUMBER
char* str = defData->ringCopy(" "); char* str = defData->ringCopy(" ");
propTp = defData->session->CompPinProp.propType($1); propTp = defData->session->CompPinProp.propType($1);
CHKPROPTYPE(propTp, $1, "PINPROPERTIES"); CHKPROPTYPE(propTp, $1, "PINPROPERTIES");
sprintf(str, "%g", $2); snprintf(str, 24, "%g", $2);
defData->PinProp.addNumProperty($1, $2, str, propTp); defData->PinProp.addNumProperty($1, $2, str, propTp);
} }
} }
@ -4478,8 +4433,7 @@ layer_blockage_rule: '+' K_SPACING NUMBER
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->BlockageCbk) { if (defData->callbacks->BlockageCbk) {
if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6540, defData->defMsg); defData->defError(6540, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -4618,8 +4572,7 @@ comp_blockage_rule:
if (defData->VersionNum < 5.7) { if (defData->VersionNum < 5.7) {
if (defData->callbacks->BlockageCbk) { if (defData->callbacks->BlockageCbk) {
if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The EXCEPTPGNET is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The EXCEPTPGNET is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6549, defData->defMsg); defData->defError(6549, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -4692,8 +4645,7 @@ placement_comp_rule: // empty
if (defData->VersionNum < 5.7) { if (defData->VersionNum < 5.7) {
if (defData->callbacks->BlockageCbk) { if (defData->callbacks->BlockageCbk) {
if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The PLACEMENT SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The PLACEMENT SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6547, defData->defMsg); defData->defError(6547, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -4726,8 +4678,7 @@ placement_comp_rule: // empty
if (defData->VersionNum < 5.7) { if (defData->VersionNum < 5.7) {
if (defData->callbacks->BlockageCbk) { if (defData->callbacks->BlockageCbk) {
if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The PARTIAL is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The PARTIAL is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6548, defData->defMsg); defData->defError(6548, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -4903,8 +4854,7 @@ geom_fill: K_RECT pt pt
if (defData->callbacks->FillCbk) if (defData->callbacks->FillCbk)
defData->Fill.addPolygon(&defData->Geometries); defData->Fill.addPolygon(&defData->Geometries);
} else { } else {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"POLYGON statement in FILLS LAYER is a version 5.6 and later syntax.\nYour def file is defined with version %g.", defData->VersionNum); "POLYGON statement in FILLS LAYER is a version 5.6 and later syntax.\nYour def file is defined with version %g.", defData->VersionNum);
defData->defError(6564, defData->defMsg); defData->defError(6564, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -4926,8 +4876,7 @@ fill_layer_opc:
if (defData->VersionNum < 5.7) { if (defData->VersionNum < 5.7) {
if (defData->callbacks->FillCbk) { if (defData->callbacks->FillCbk) {
if (defData->fillWarnings++ < defData->settings->FillWarnings) { if (defData->fillWarnings++ < defData->settings->FillWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The LAYER OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The LAYER OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6553, defData->defMsg); defData->defError(6553, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -4964,8 +4913,7 @@ fill_via_opc:
if (defData->VersionNum < 5.7) { if (defData->VersionNum < 5.7) {
if (defData->callbacks->FillCbk) { if (defData->callbacks->FillCbk) {
if (defData->fillWarnings++ < defData->settings->FillWarnings) { if (defData->fillWarnings++ < defData->settings->FillWarnings) {
defData->defMsg = (char*)malloc(10000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The VIA OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The VIA OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6554, defData->defMsg); defData->defError(6554, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -5007,8 +4955,7 @@ nondefault_start: K_NONDEFAULTRULES NUMBER ';'
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->NonDefaultStartCbk) { if (defData->callbacks->NonDefaultStartCbk) {
if (defData->nonDefaultWarnings++ < defData->settings->NonDefaultWarnings) { if (defData->nonDefaultWarnings++ < defData->settings->NonDefaultWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); "The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum);
defData->defError(6545, defData->defMsg); defData->defError(6545, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);
@ -5117,7 +5064,7 @@ nondefault_prop: T_STRING NUMBER
char* str = defData->ringCopy(" "); char* str = defData->ringCopy(" ");
propTp = defData->session->NDefProp.propType($1); propTp = defData->session->NDefProp.propType($1);
CHKPROPTYPE(propTp, $1, "NONDEFAULTRULE"); CHKPROPTYPE(propTp, $1, "NONDEFAULTRULE");
sprintf(str, "%g", $2); snprintf(str, 24, "%g", $2);
defData->NonDefault.addNumProperty($1, $2, str, propTp); defData->NonDefault.addNumProperty($1, $2, str, propTp);
} }
} }
@ -5148,8 +5095,7 @@ styles_start: K_STYLES NUMBER ';'
if (defData->VersionNum < 5.6) { if (defData->VersionNum < 5.6) {
if (defData->callbacks->StylesStartCbk) { if (defData->callbacks->StylesStartCbk) {
if (defData->stylesWarnings++ < defData->settings->StylesWarnings) { if (defData->stylesWarnings++ < defData->settings->StylesWarnings) {
defData->defMsg = (char*)malloc(1000); asprintf (&defData->defMsg,
sprintf (defData->defMsg,
"The STYLES statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); "The STYLES statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum);
defData->defError(6546, defData->defMsg); defData->defError(6546, defData->defMsg);
free(defData->defMsg); free(defData->defMsg);

View File

@ -253,9 +253,9 @@ defrData::lines2str(long long lines)
{ {
#ifdef _WIN32 #ifdef _WIN32
sprintf(lineBuffer, "%I64d", lines); snprintf(lineBuffer, sizeof(lineBuffer), "%I64d", lines);
#else #else
sprintf(lineBuffer, "%lld", lines); snprintf(lineBuffer, sizeof(lineBuffer), "%lld", lines);
#endif #endif
return lineBuffer; return lineBuffer;
@ -579,8 +579,7 @@ defrData::sublex(YYSTYPE *pYylval)
} }
if (defInvalidChar) { if (defInvalidChar) {
outMsg = (char*)malloc(500 + strlen(deftoken)); asprintf(&outMsg, "Invalid characters found in \'%s\'.\nThese characters might be using the character types other than English.\nCreate characters by specifying valid characters types.",
sprintf(outMsg, "Invalid characters found in \'%s\'.\nThese characters might be using the character types other than English.\nCreate characters by specifying valid characters types.",
deftoken); deftoken);
defError(6008, outMsg); defError(6008, outMsg);
free(outMsg); free(outMsg);
@ -630,9 +629,8 @@ defrData::sublex(YYSTYPE *pYylval)
if ((numVal >= lVal) && (numVal <= rVal)) if ((numVal >= lVal) && (numVal <= rVal))
return NUMBER; /* YES, it's really a number */ return NUMBER; /* YES, it's really a number */
else { else {
char* str = (char*)malloc(strlen(deftoken) char *str;
+strlen(session->FileName)+350); asprintf(&str,
sprintf(str,
"<Number has exceed the limit for an integer> in %s at line %s\n", "<Number has exceed the limit for an integer> in %s at line %s\n",
session->FileName, lines2str(nlines)); session->FileName, lines2str(nlines));
fflush(stdout); fflush(stdout);
@ -655,9 +653,8 @@ defrData::sublex(YYSTYPE *pYylval)
if ((numVal >= lVal) && (numVal <= rVal)) if ((numVal >= lVal) && (numVal <= rVal))
return NUMBER; /* YES, it's really a number */ return NUMBER; /* YES, it's really a number */
else { else {
char* str = (char*)malloc(strlen(deftoken) char *str;
+strlen(session->FileName)+350); asprintf(&str,
sprintf(str,
"<Number has exceed the limit for an integer> in %s at line %s\n", "<Number has exceed the limit for an integer> in %s at line %s\n",
session->FileName, lines2str(nlines)); session->FileName, lines2str(nlines));
fflush(stdout); fflush(stdout);
@ -956,35 +953,28 @@ defrData::defError(int msgNum, const char *s) {
/* PCR 690679, probably missing space before a ';' */ /* PCR 690679, probably missing space before a ';' */
if (strcmp(s, "parse error") == 0) { if (strcmp(s, "parse error") == 0) {
if ((len > 1) && (deftoken[len] == ';')) { if ((len > 1) && (deftoken[len] == ';')) {
str = (char*)malloc(len + strlen(s) + strlen(session->FileName) + 350); asprintf(&str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n",
sprintf(str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n",
msgNum, s, session->FileName, lines2str(nlines), curToken); msgNum, s, session->FileName, lines2str(nlines), curToken);
} else if ((pvLen > 1) && (pv_deftoken[pvLen] == ';')) { } else if ((pvLen > 1) && (pv_deftoken[pvLen] == ';')) {
str = (char*)malloc(pvLen + strlen(s) + strlen(session->FileName) + 350); asprintf(&str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n",
sprintf(str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n",
msgNum, s, session->FileName, lines2str(nlines-1), pvToken); msgNum, s, session->FileName, lines2str(nlines-1), pvToken);
} else { } else {
str = (char*)malloc(len + strlen(session->FileName) + 350); asprintf(&str, "ERROR (DEFPARS-%d): Def parser has encountered an error in file %s at line %s, on token %s.\nProblem can be syntax error on the def file or an invalid parameter name.\nDouble check the syntax on the def file with the LEFDEF Reference Manual.\n",
sprintf(str, "ERROR (DEFPARS-%d): Def parser has encountered an error in file %s at line %s, on token %s.\nProblem can be syntax error on the def file or an invalid parameter name.\nDouble check the syntax on the def file with the LEFDEF Reference Manual.\n",
msgNum, session->FileName, lines2str(nlines), curToken); msgNum, session->FileName, lines2str(nlines), curToken);
} }
} else if (strcmp(s, "syntax error") == 0) { } else if (strcmp(s, "syntax error") == 0) {
if ((len > 1) && (deftoken[len] == ';')) { if ((len > 1) && (deftoken[len] == ';')) {
str = (char*)malloc(len + strlen(s) + strlen(session->FileName) + 350); asprintf(&str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n",
sprintf(str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n",
msgNum, s, session->FileName, lines2str(nlines), curToken); msgNum, s, session->FileName, lines2str(nlines), curToken);
} else if ((pvLen > 1) && (pv_deftoken[pvLen] == ';')) { } else if ((pvLen > 1) && (pv_deftoken[pvLen] == ';')) {
str = (char*)malloc(pvLen + strlen(s) + strlen(session->FileName) + 350); asprintf(&str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n",
sprintf(str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n",
msgNum, s, session->FileName, lines2str(nlines-1), pvToken); msgNum, s, session->FileName, lines2str(nlines-1), pvToken);
} else { } else {
str = (char*)malloc(len + strlen(session->FileName) + 350); asprintf(&str, "ERROR (DEFPARS-%d): Def parser has encountered an error in file %s at line %s, on token %s.\nProblem can be syntax error on the def file or an invalid parameter name.\nDouble check the syntax on the def file with the LEFDEF Reference Manual.\n",
sprintf(str, "ERROR (DEFPARS-%d): Def parser has encountered an error in file %s at line %s, on token %s.\nProblem can be syntax error on the def file or an invalid parameter name.\nDouble check the syntax on the def file with the LEFDEF Reference Manual.\n",
msgNum, session->FileName, lines2str(nlines), curToken); msgNum, session->FileName, lines2str(nlines), curToken);
} }
} else { } else {
str = (char*)malloc(len + strlen(s) + strlen(session->FileName) + 350); asprintf(&str, "ERROR (DEFPARS-%d): %s Error in file %s at line %s, on token %s.\nUpdate the def file before parsing the file again.\n",
sprintf(str, "ERROR (DEFPARS-%d): %s Error in file %s at line %s, on token %s.\nUpdate the def file before parsing the file again.\n",
msgNum, s, session->FileName, lines2str(nlines), curToken); msgNum, s, session->FileName, lines2str(nlines), curToken);
} }
@ -1005,6 +995,7 @@ defrData::defyyerror(const char *s) {
void void
defrData::defInfo(int msgNum, const char *s) { defrData::defInfo(int msgNum, const char *s) {
int i; int i;
char *str;
for (i = 0; i < settings->nDDMsgs; i++) { /* check if info has been disable */ for (i = 0; i < settings->nDDMsgs; i++) { /* check if info has been disable */
if (settings->disableDMsgs[i] == msgNum) if (settings->disableDMsgs[i] == msgNum)
@ -1012,16 +1003,12 @@ defrData::defInfo(int msgNum, const char *s) {
} }
if (settings->ContextWarningLogFunction) { if (settings->ContextWarningLogFunction) {
char* str = (char*)malloc(strlen(deftoken)+strlen(s) asprintf(&str, "INFO (DEFPARS-%d): %s See file %s at line %s.\n",
+strlen(session->FileName)+350);
sprintf(str, "INFO (DEFPARS-%d): %s See file %s at line %s.\n",
msgNum, s, session->FileName, lines2str(nlines)); msgNum, s, session->FileName, lines2str(nlines));
(*settings->ContextWarningLogFunction)(session->UserData, str); (*settings->ContextWarningLogFunction)(session->UserData, str);
free(str); free(str);
} else if (settings->WarningLogFunction) { } else if (settings->WarningLogFunction) {
char* str = (char*)malloc(strlen(deftoken)+strlen(s) asprintf(&str, "INFO (DEFPARS-%d): %s See file %s at line %s.\n",
+strlen(session->FileName)+350);
sprintf(str, "INFO (DEFPARS-%d): %s See file %s at line %s.\n",
msgNum, s, session->FileName, lines2str(nlines)); msgNum, s, session->FileName, lines2str(nlines));
(*settings->WarningLogFunction)(str); (*settings->WarningLogFunction)(str);
free(str); free(str);
@ -1060,6 +1047,7 @@ defrData::defInfo(int msgNum, const char *s) {
void void
defrData::defWarning(int msgNum, const char *s) { defrData::defWarning(int msgNum, const char *s) {
int i; int i;
char *str;
for (i = 0; i <settings->nDDMsgs; i++) { /* check if warning has been disable */ for (i = 0; i <settings->nDDMsgs; i++) { /* check if warning has been disable */
if (settings->disableDMsgs[i] == msgNum) if (settings->disableDMsgs[i] == msgNum)
@ -1067,16 +1055,12 @@ defrData::defWarning(int msgNum, const char *s) {
} }
if (settings->ContextWarningLogFunction) { if (settings->ContextWarningLogFunction) {
char* str = (char*)malloc(strlen(deftoken)+strlen(s) asprintf(&str, "WARNING (DEFPARS-%d): %s See file %s at line %s.\n",
+strlen(session->FileName)+350);
sprintf(str, "WARNING (DEFPARS-%d): %s See file %s at line %s.\n",
msgNum, s, session->FileName, lines2str(nlines)); msgNum, s, session->FileName, lines2str(nlines));
(*settings->ContextWarningLogFunction)(session->UserData, str); (*settings->ContextWarningLogFunction)(session->UserData, str);
free(str); free(str);
} else if (settings->WarningLogFunction) { } else if (settings->WarningLogFunction) {
char* str = (char*)malloc(strlen(deftoken)+strlen(s) asprintf(&str, "WARNING (DEFPARS-%d): %s See file %s at line %s.\n",
+strlen(session->FileName)+350);
sprintf(str, "WARNING (DEFPARS-%d): %s See file %s at line %s.\n",
msgNum, s, session->FileName, lines2str(nlines)); msgNum, s, session->FileName, lines2str(nlines));
(*settings->WarningLogFunction)(str); (*settings->WarningLogFunction)(str);
free(str); free(str);

View File

@ -319,11 +319,12 @@ int defiNonDefault::numLayers() const {
} }
const char* defiNonDefault::layerName(int index) const { const char* defiNonDefault::layerName(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return layerName_[index]; return layerName_[index];
@ -331,33 +332,36 @@ const char* defiNonDefault::layerName(int index) const {
// Will be obsoleted in 5.7 // Will be obsoleted in 5.7
double defiNonDefault::layerWidth(int index) const { double defiNonDefault::layerWidth(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return width_[index]; return width_[index];
} }
int defiNonDefault::layerWidthVal(int index) const { int defiNonDefault::layerWidthVal(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return (int)width_[index]; return (int)width_[index];
} }
int defiNonDefault::hasLayerDiagWidth(int index) const { int defiNonDefault::hasLayerDiagWidth(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return hasDiagWidth_[index]; return hasDiagWidth_[index];
@ -365,44 +369,48 @@ int defiNonDefault::hasLayerDiagWidth(int index) const {
// Will be obsoleted in 5.7 // Will be obsoleted in 5.7
double defiNonDefault::layerDiagWidth(int index) const { double defiNonDefault::layerDiagWidth(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return diagWidth_[index]; return diagWidth_[index];
} }
int defiNonDefault::layerDiagWidthVal(int index) const { int defiNonDefault::layerDiagWidthVal(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return (int)diagWidth_[index]; return (int)diagWidth_[index];
} }
int defiNonDefault::hasLayerWireExt(int index) const { int defiNonDefault::hasLayerWireExt(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return hasWireExt_[index]; return hasWireExt_[index];
} }
int defiNonDefault::hasLayerSpacing(int index) const { int defiNonDefault::hasLayerSpacing(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return hasSpacing_[index]; return hasSpacing_[index];
@ -410,22 +418,24 @@ int defiNonDefault::hasLayerSpacing(int index) const {
// Will be obsoleted in 5.7 // Will be obsoleted in 5.7
double defiNonDefault::layerWireExt(int index) const { double defiNonDefault::layerWireExt(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return wireExt_[index]; return wireExt_[index];
} }
int defiNonDefault::layerWireExtVal(int index) const { int defiNonDefault::layerWireExtVal(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return (int)wireExt_[index]; return (int)wireExt_[index];
@ -433,22 +443,24 @@ int defiNonDefault::layerWireExtVal(int index) const {
// Will be obsoleted in 5.7 // Will be obsoleted in 5.7
double defiNonDefault::layerSpacing(int index) const { double defiNonDefault::layerSpacing(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return spacing_[index]; return spacing_[index];
} }
int defiNonDefault::layerSpacingVal(int index) const { int defiNonDefault::layerSpacingVal(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numLayers_) { if (index < 0 || index >= numLayers_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return (int)spacing_[index]; return (int)spacing_[index];
@ -459,11 +471,12 @@ int defiNonDefault::numVias() const {
} }
const char* defiNonDefault::viaName(int index) const { const char* defiNonDefault::viaName(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numVias_) { if (index < 0 || index >= numVias_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return viaNames_[index]; return viaNames_[index];
@ -474,11 +487,12 @@ int defiNonDefault::numViaRules() const {
} }
const char* defiNonDefault::viaRuleName(int index) const { const char* defiNonDefault::viaRuleName(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numViaRules_) { if (index < 0 || index >= numViaRules_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return viaRuleNames_[index]; return viaRuleNames_[index];
@ -489,22 +503,24 @@ int defiNonDefault::numMinCuts() const {
} }
const char* defiNonDefault::cutLayerName(int index) const { const char* defiNonDefault::cutLayerName(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numMinCuts_) { if (index < 0 || index >= numMinCuts_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return cutLayerName_[index]; return cutLayerName_[index];
} }
int defiNonDefault::numCuts(int index) const { int defiNonDefault::numCuts(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numMinCuts_) { if (index < 0 || index >= numMinCuts_) {
sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numLayers_); index, numLayers_);
defiError(0, 6090, msg, defData); defiError(0, 6090, msg, defData);
free(msg);
return 0; return 0;
} }
return numCuts_[index]; return numCuts_[index];
@ -639,66 +655,72 @@ void defiNonDefault::addNumProperty(const char* name, const double d,
} }
const char* defiNonDefault::propName(int index) const { const char* defiNonDefault::propName(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6091, msg, defData); defiError(0, 6091, msg, defData);
free(msg);
return 0; return 0;
} }
return names_[index]; return names_[index];
} }
const char* defiNonDefault::propValue(int index) const { const char* defiNonDefault::propValue(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6091, msg, defData); defiError(0, 6091, msg, defData);
free(msg);
return 0; return 0;
} }
return values_[index]; return values_[index];
} }
double defiNonDefault::propNumber(int index) const { double defiNonDefault::propNumber(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6091, msg, defData); defiError(0, 6091, msg, defData);
free(msg);
return 0; return 0;
} }
return dvalues_[index]; return dvalues_[index];
} }
const char defiNonDefault::propType(int index) const { const char defiNonDefault::propType(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6091, msg, defData); defiError(0, 6091, msg, defData);
free(msg);
return 0; return 0;
} }
return types_[index]; return types_[index];
} }
int defiNonDefault::propIsNumber(int index) const { int defiNonDefault::propIsNumber(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6091, msg, defData); defiError(0, 6091, msg, defData);
free(msg);
return 0; return 0;
} }
return dvalues_[index] ? 1 : 0; return dvalues_[index] ? 1 : 0;
} }
int defiNonDefault::propIsString(int index) const { int defiNonDefault::propIsString(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6091, msg, defData); defiError(0, 6091, msg, defData);
free(msg);
return 0; return 0;
} }
return dvalues_[index] ? 0 : 1; return dvalues_[index] ? 0 : 1;

View File

@ -226,11 +226,12 @@ int defiPinProp::numProps() const {
const char* defiPinProp::propName(int index) const { const char* defiPinProp::propName(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6120, msg, defData); defiError(0, 6120, msg, defData);
free(msg);
return 0; return 0;
} }
return propNames_[index]; return propNames_[index];
@ -238,11 +239,12 @@ const char* defiPinProp::propName(int index) const {
const char* defiPinProp::propValue(int index) const { const char* defiPinProp::propValue(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6120, msg, defData); defiError(0, 6120, msg, defData);
free(msg);
return 0; return 0;
} }
return propValues_[index]; return propValues_[index];
@ -250,11 +252,12 @@ const char* defiPinProp::propValue(int index) const {
double defiPinProp::propNumber(int index) const { double defiPinProp::propNumber(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6120, msg, defData); defiError(0, 6120, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index]; return propDValues_[index];
@ -262,11 +265,12 @@ double defiPinProp::propNumber(int index) const {
const char defiPinProp::propType(int index) const { const char defiPinProp::propType(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6120, msg, defData); defiError(0, 6120, msg, defData);
free(msg);
return 0; return 0;
} }
return propTypes_[index]; return propTypes_[index];
@ -274,11 +278,12 @@ const char defiPinProp::propType(int index) const {
int defiPinProp::propIsNumber(int index) const { int defiPinProp::propIsNumber(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6120, msg, defData); defiError(0, 6120, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index] ? 1 : 0; return propDValues_[index] ? 1 : 0;
@ -286,11 +291,12 @@ int defiPinProp::propIsNumber(int index) const {
int defiPinProp::propIsString(int index) const { int defiPinProp::propIsString(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6120, msg, defData); defiError(0, 6120, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index] ? 0 : 1; return propDValues_[index] ? 0 : 1;

View File

@ -270,11 +270,12 @@ int defiRegion::numProps() const {
const char* defiRegion::propName(int index) const { const char* defiRegion::propName(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6130, msg, defData); defiError(0, 6130, msg, defData);
free(msg);
return 0; return 0;
} }
return propNames_[index]; return propNames_[index];
@ -282,11 +283,12 @@ const char* defiRegion::propName(int index) const {
const char* defiRegion::propValue(int index) const { const char* defiRegion::propValue(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6130, msg, defData); defiError(0, 6130, msg, defData);
free(msg);
return 0; return 0;
} }
return propValues_[index]; return propValues_[index];
@ -294,11 +296,12 @@ const char* defiRegion::propValue(int index) const {
double defiRegion::propNumber(int index) const { double defiRegion::propNumber(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6130, msg, defData); defiError(0, 6130, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index]; return propDValues_[index];
@ -306,33 +309,36 @@ double defiRegion::propNumber(int index) const {
const char defiRegion::propType(int index) const { const char defiRegion::propType(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6130, msg, defData); defiError(0, 6130, msg, defData);
free(msg);
return 0; return 0;
} }
return propTypes_[index]; return propTypes_[index];
} }
int defiRegion::propIsNumber(int index) const { int defiRegion::propIsNumber(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6130, msg, defData); defiError(0, 6130, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index] ? 1 : 0; return propDValues_[index] ? 1 : 0;
} }
int defiRegion::propIsString(int index) const { int defiRegion::propIsString(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6130, msg, defData); defiError(0, 6130, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index] ? 0 : 1; return propDValues_[index] ? 0 : 1;
@ -344,11 +350,12 @@ const char* defiRegion::name() const {
int defiRegion::xl(int index) const { int defiRegion::xl(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numRectangles_) { if (index < 0 || index >= numRectangles_) {
sprintf (msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numRectangles_); index, numRectangles_);
defiError(0, 6131, msg, defData); defiError(0, 6131, msg, defData);
free(msg);
return 0; return 0;
} }
return xl_[index]; return xl_[index];
@ -356,11 +363,12 @@ int defiRegion::xl(int index) const {
int defiRegion::yl(int index) const { int defiRegion::yl(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numRectangles_) { if (index < 0 || index >= numRectangles_) {
sprintf (msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numRectangles_); index, numRectangles_);
defiError(0, 6131, msg, defData); defiError(0, 6131, msg, defData);
free(msg);
return 0; return 0;
} }
return yl_[index]; return yl_[index];
@ -368,11 +376,12 @@ int defiRegion::yl(int index) const {
int defiRegion::xh(int index) const { int defiRegion::xh(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numRectangles_) { if (index < 0 || index >= numRectangles_) {
sprintf (msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numRectangles_); index, numRectangles_);
defiError(0, 6131, msg, defData); defiError(0, 6131, msg, defData);
free(msg);
return 0; return 0;
} }
return xh_[index]; return xh_[index];
@ -380,11 +389,12 @@ int defiRegion::xh(int index) const {
int defiRegion::yh(int index) const { int defiRegion::yh(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numRectangles_) { if (index < 0 || index >= numRectangles_) {
sprintf (msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numRectangles_); index, numRectangles_);
defiError(0, 6131, msg, defData); defiError(0, 6131, msg, defData);
free(msg);
return 0; return 0;
} }
return yh_[index]; return yh_[index];

View File

@ -240,11 +240,12 @@ int defiRow::numProps() const {
const char* defiRow::propName(int index) const { const char* defiRow::propName(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6140, msg, defData); defiError(0, 6140, msg, defData);
free(msg);
return 0; return 0;
} }
return propNames_[index]; return propNames_[index];
@ -252,55 +253,60 @@ const char* defiRow::propName(int index) const {
const char* defiRow::propValue(int index) const { const char* defiRow::propValue(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6140, msg, defData); defiError(0, 6140, msg, defData);
free(msg);
return 0; return 0;
} }
return propValues_[index]; return propValues_[index];
} }
double defiRow::propNumber(int index) const { double defiRow::propNumber(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6140, msg, defData); defiError(0, 6140, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index]; return propDValues_[index];
} }
const char defiRow::propType(int index) const { const char defiRow::propType(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6140, msg, defData); defiError(0, 6140, msg, defData);
free(msg);
return 0; return 0;
} }
return propTypes_[index]; return propTypes_[index];
} }
int defiRow::propIsNumber(int index) const { int defiRow::propIsNumber(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6140, msg, defData); defiError(0, 6140, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index] ? 1 : 0; return propDValues_[index] ? 1 : 0;
} }
int defiRow::propIsString(int index) const { int defiRow::propIsString(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numProps_) { if (index < 0 || index >= numProps_) {
sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numProps_); index, numProps_);
defiError(0, 6140, msg, defData); defiError(0, 6140, msg, defData);
free(msg);
return 0; return 0;
} }
return propDValues_[index] ? 0 : 1; return propDValues_[index] ? 0 : 1;

View File

@ -194,11 +194,12 @@ int defiSlot::numRectangles() const {
int defiSlot::xl(int index) const { int defiSlot::xl(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numRectangles_) { if (index < 0 || index >= numRectangles_) {
sprintf (msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numRectangles_); index, numRectangles_);
defiError(0, 6160, msg, defData); defiError(0, 6160, msg, defData);
free(msg);
return 0; return 0;
} }
return xl_[index]; return xl_[index];
@ -206,11 +207,12 @@ int defiSlot::xl(int index) const {
int defiSlot::yl(int index) const { int defiSlot::yl(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numRectangles_) { if (index < 0 || index >= numRectangles_) {
sprintf (msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numRectangles_); index, numRectangles_);
defiError(0, 6160, msg, defData); defiError(0, 6160, msg, defData);
free(msg);
return 0; return 0;
} }
return yl_[index]; return yl_[index];
@ -218,11 +220,12 @@ int defiSlot::yl(int index) const {
int defiSlot::xh(int index) const { int defiSlot::xh(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numRectangles_) { if (index < 0 || index >= numRectangles_) {
sprintf (msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numRectangles_); index, numRectangles_);
defiError(0, 6160, msg, defData); defiError(0, 6160, msg, defData);
free(msg);
return 0; return 0;
} }
return xh_[index]; return xh_[index];
@ -230,11 +233,12 @@ int defiSlot::xh(int index) const {
int defiSlot::yh(int index) const { int defiSlot::yh(int index) const {
char msg[160]; char *msg;
if (index < 0 || index >= numRectangles_) { if (index < 0 || index >= numRectangles_) {
sprintf (msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", asprintf (&msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.",
index, numRectangles_); index, numRectangles_);
defiError(0, 6160, msg, defData); defiError(0, 6160, msg, defData);
free(msg);
return 0; return 0;
} }
return yh_[index]; return yh_[index];

View File

@ -11,7 +11,7 @@
) )
add_library ( defzlib ${cpps} ) add_library ( defzlib ${cpps} )
# target_link_libraries ( defzlib def z ) target_link_libraries ( defzlib def z )
set_target_properties ( defzlib PROPERTIES VERSION 5.8 SOVERSION 5 ) set_target_properties ( defzlib PROPERTIES VERSION 5.8 SOVERSION 5 )
install ( TARGETS defzlib DESTINATION lib${LIB_SUFFIX} ) install ( TARGETS defzlib DESTINATION lib${LIB_SUFFIX} )

View File

@ -280,7 +280,7 @@ qStrCopy(char *string)
char *retStr; char *retStr;
retStr = (char*) lefMalloc(len); retStr = (char*) lefMalloc(len);
sprintf(retStr, "\"%s\"", string); snprintf(retStr, len, "\"%s\"", string);
return retStr; return retStr;
} }
@ -745,8 +745,9 @@ lefsublex()
} }
if (lefData->lefInvalidChar) { if (lefData->lefInvalidChar) {
outStr = (char*) lefMalloc(500 + strlen(lefData->current_token)); int len = 500 + strlen(lefData->current_token);
sprintf(outStr, "Invalid characters found in \'%s\'.\nThese characters might have created by character types other than English.", outStr = (char*) lefMalloc(len);
snprintf(outStr, len, "Invalid characters found in \'%s\'.\nThese characters might have created by character types other than English.",
lefData->current_token); lefData->current_token);
lefError(1008, outStr); lefError(1008, outStr);
lefFree(outStr); lefFree(outStr);
@ -1025,47 +1026,56 @@ lefError(int msgNum,
// PCR 690679, probably missing space before a ';' // PCR 690679, probably missing space before a ';'
if (strcmp(s, "parse error") == 0) { if (strcmp(s, "parse error") == 0) {
if ((len > 1) && (lefData->current_token[len] == ';')) { if ((len > 1) && (lefData->current_token[len] == ';')) {
str = (char*) lefMalloc(len + strlen(s) + strlen(lefData->lefrFileName) + 350); int buflen = len + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s>, space is missing before <;>\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s>, space is missing before <;>\n",
msgNum, s, lefData->lefrFileName, lefData->lef_nlines, curToken); msgNum, s, lefData->lefrFileName, lefData->lef_nlines, curToken);
} else if ((pvLen > 1) && (lefData->pv_token[pvLen] == ';')) { } else if ((pvLen > 1) && (lefData->pv_token[pvLen] == ';')) {
str = (char*) lefMalloc(pvLen + strlen(s) + strlen(lefData->lefrFileName) + 350); int buflen = pvLen + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s>, space is missing before <;>\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s>, space is missing before <;>\n",
msgNum, s, lefData->lefrFileName, lefData->lef_nlines - 1, pvToken); msgNum, s, lefData->lefrFileName, lefData->lef_nlines - 1, pvToken);
} else if ((lefData->current_token[0] == '"') && (lefData->spaceMissing)) { } else if ((lefData->current_token[0] == '"') && (lefData->spaceMissing)) {
// most likely space is missing after the end " // most likely space is missing after the end "
str = (char*) lefMalloc(len + strlen(s) + strlen(lefData->lefrFileName) + 350); int buflen = len + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s\">, space is missing between the closing \" of the string and ;.\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s\">, space is missing between the closing \" of the string and ;.\n",
1010, s, lefData->lefrFileName, lefData->lef_nlines, curToken); 1010, s, lefData->lefrFileName, lefData->lef_nlines, curToken);
lefData->spaceMissing = 0; lefData->spaceMissing = 0;
} else { } else {
str = (char*) lefMalloc(len + strlen(lefData->lefrFileName) + 350); int buflen = len + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): Lef parser has encountered an error in file %s at line %d, on token %s.\nProblem can be syntax error on the lef file or an invalid parameter name.\nDouble check the syntax on the lef file with the LEFDEF Reference Manual.\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): Lef parser has encountered an error in file %s at line %d, on token %s.\nProblem can be syntax error on the lef file or an invalid parameter name.\nDouble check the syntax on the lef file with the LEFDEF Reference Manual.\n",
msgNum, lefData->lefrFileName, lefData->lef_nlines, curToken); msgNum, lefData->lefrFileName, lefData->lef_nlines, curToken);
} }
} else if (strcmp(s, "syntax error") == 0) { // linux machines } else if (strcmp(s, "syntax error") == 0) { // linux machines
if ((len > 1) && (lefData->current_token[len] == ';')) { if ((len > 1) && (lefData->current_token[len] == ';')) {
str = (char*) lefMalloc(len + strlen(s) + strlen(lefData->lefrFileName) + 350); int buflen = len + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s>, space is missing before <;>\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s>, space is missing before <;>\n",
msgNum, s, lefData->lefrFileName, lefData->lef_nlines, curToken); msgNum, s, lefData->lefrFileName, lefData->lef_nlines, curToken);
} else if ((pvLen > 1) && (lefData->pv_token[pvLen] == ';')) { } else if ((pvLen > 1) && (lefData->pv_token[pvLen] == ';')) {
str = (char*) lefMalloc(pvLen + strlen(s) + strlen(lefData->lefrFileName) + 350); int buflen = pvLen + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s>, space is missing before <;>\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s>, space is missing before <;>\n",
msgNum, s, lefData->lefrFileName, lefData->lef_nlines - 1, pvToken); msgNum, s, lefData->lefrFileName, lefData->lef_nlines - 1, pvToken);
} else if ((lefData->current_token[0] == '"') && (lefData->spaceMissing)) { } else if ((lefData->current_token[0] == '"') && (lefData->spaceMissing)) {
// most likely space is missing after the end " // most likely space is missing after the end "
str = (char*) lefMalloc(len + strlen(s) + strlen(lefData->lefrFileName) + 350); int buflen = len + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s\">, space is missing between the closing \" of the string and ;.\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): %s, see file %s at line %d\nLast token was <%s\">, space is missing between the closing \" of the string and ;.\n",
1011, s, lefData->lefrFileName, lefData->lef_nlines, curToken); 1011, s, lefData->lefrFileName, lefData->lef_nlines, curToken);
lefData->spaceMissing = 0; lefData->spaceMissing = 0;
} else { } else {
str = (char*) lefMalloc(len + strlen(lefData->lefrFileName) + 350); int buflen = len + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): Lef parser has encountered an error in file %s at line %d, on token %s.\nProblem can be syntax error on the lef file or an invalid parameter name.\nDouble check the syntax on the lef file with the LEFDEF Reference Manual.\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): Lef parser has encountered an error in file %s at line %d, on token %s.\nProblem can be syntax error on the lef file or an invalid parameter name.\nDouble check the syntax on the lef file with the LEFDEF Reference Manual.\n",
msgNum, lefData->lefrFileName, lefData->lef_nlines, curToken); msgNum, lefData->lefrFileName, lefData->lef_nlines, curToken);
} }
} else { } else {
str = (char*) lefMalloc(len + strlen(s) + strlen(lefData->lefrFileName) + 350); int buflen = len + strlen(s) + strlen(lefData->lefrFileName) + 350;
sprintf(str, "ERROR (LEFPARS-%d): %s Error in file %s at line %d, on token %s.\n", str = (char*) lefMalloc(buflen);
snprintf(str, buflen, "ERROR (LEFPARS-%d): %s Error in file %s at line %d, on token %s.\n",
msgNum, s, lefData->lefrFileName, lefData->lef_nlines, curToken); msgNum, s, lefData->lefrFileName, lefData->lef_nlines, curToken);
} }
fflush(stdout); fflush(stdout);
@ -1096,7 +1106,7 @@ lefInfo(int msgNum,
if (disableStatus == 1) { if (disableStatus == 1) {
char msgStr[60]; char msgStr[60];
sprintf(msgStr, "Message (LEFPARS-%d) has been suppressed from output.", msgNum); snprintf(msgStr, 60, "Message (LEFPARS-%d) has been suppressed from output.", msgNum);
lefWarning(2502, msgStr); lefWarning(2502, msgStr);
return; return;
} else if (disableStatus == 2) { } else if (disableStatus == 2) {
@ -1111,7 +1121,7 @@ lefInfo(int msgNum,
if (lefData->msgLimit[1][msgNum]) // already printed out warning if (lefData->msgLimit[1][msgNum]) // already printed out warning
return; return;
lefData->msgLimit[1][msgNum] = 1; lefData->msgLimit[1][msgNum] = 1;
sprintf(msgStr, snprintf(msgStr, 100,
"Message (LEFPARS-%d) has exceeded the message display limit of %d", "Message (LEFPARS-%d) has exceeded the message display limit of %d",
msgNum, lefSettings->MsgLimit[msgNum]); msgNum, lefSettings->MsgLimit[msgNum]);
lefWarning(2503, msgStr); lefWarning(2503, msgStr);
@ -1122,9 +1132,9 @@ lefInfo(int msgNum,
lefData->lefInfoMsgPrinted++; lefData->lefInfoMsgPrinted++;
if (lefSettings->WarningLogFunction) { if (lefSettings->WarningLogFunction) {
char *str = (char*) lefMalloc(strlen(lefData->current_token) + strlen(s) + strlen(lefData->lefrFileName) int buflen = strlen(lefData->current_token) + strlen(s) + strlen(lefData->lefrFileName) + 350;
+ 350); char *str = (char*) lefMalloc(buflen);
sprintf(str, "INFO (LEFPARS-%d): %s See file %s at line %d.\n", snprintf(str, buflen, "INFO (LEFPARS-%d): %s See file %s at line %d.\n",
msgNum, s, lefData->lefrFileName, lefData->lef_nlines); msgNum, s, lefData->lefrFileName, lefData->lef_nlines);
(*lefSettings->WarningLogFunction)(str); (*lefSettings->WarningLogFunction)(str);
free(str); free(str);
@ -1171,7 +1181,7 @@ lefWarning(int msgNum,
if (disableStatus == 1) { if (disableStatus == 1) {
char msgStr[60]; char msgStr[60];
sprintf(msgStr, "Message (LEFPARS-%d) has been suppressed from output.", msgNum); snprintf(msgStr, 60, "Message (LEFPARS-%d) has been suppressed from output.", msgNum);
lefWarning(2502, msgStr); lefWarning(2502, msgStr);
return; return;
} else if (disableStatus == 2) { } else if (disableStatus == 2) {
@ -1187,7 +1197,7 @@ lefWarning(int msgNum,
if (lefData->msgLimit[1][msgNum]) // already printed out warning if (lefData->msgLimit[1][msgNum]) // already printed out warning
return; return;
lefData->msgLimit[1][msgNum] = 1; lefData->msgLimit[1][msgNum] = 1;
sprintf(msgStr, snprintf(msgStr, 100,
"Message (LEFPARS-%d) has exceeded the message display limit of %d", "Message (LEFPARS-%d) has exceeded the message display limit of %d",
msgNum, lefSettings->MsgLimit[msgNum]); msgNum, lefSettings->MsgLimit[msgNum]);
lefWarning(2503, msgStr); lefWarning(2503, msgStr);
@ -1198,9 +1208,9 @@ lefWarning(int msgNum,
lefData->lefWarnMsgPrinted++; lefData->lefWarnMsgPrinted++;
if (lefSettings->WarningLogFunction) { if (lefSettings->WarningLogFunction) {
char *str = (char*) lefMalloc(strlen(lefData->current_token) + strlen(s) + strlen(lefData->lefrFileName) int buflen = strlen(lefData->current_token) + strlen(s) + strlen(lefData->lefrFileName) + 350;
+ 350); char *str = (char*) lefMalloc(buflen);
sprintf(str, "WARNING (LEFPARS-%d): %s See file %s at line %d.\n", snprintf(str, buflen, "WARNING (LEFPARS-%d): %s See file %s at line %d.\n",
msgNum, s, lefData->lefrFileName, lefData->lef_nlines); msgNum, s, lefData->lefrFileName, lefData->lef_nlines);
(*lefSettings->WarningLogFunction)(str); (*lefSettings->WarningLogFunction)(str);
free(str); free(str);

View File

@ -11,7 +11,7 @@
) )
add_library ( lefzlib ${cpps} ) add_library ( lefzlib ${cpps} )
# target_link_libraries ( lefzlib lef z ) target_link_libraries ( lefzlib lef z )
set_target_properties ( lefzlib PROPERTIES VERSION 5.8 SOVERSION 5 ) set_target_properties ( lefzlib PROPERTIES VERSION 5.8 SOVERSION 5 )
install ( TARGETS lefzlib DESTINATION lib${LIB_SUFFIX} ) install ( TARGETS lefzlib DESTINATION lib${LIB_SUFFIX} )