Several changes and updates: (1) Added a new keyword "required" to the

tech file format "version" section.  This can be used to specify the
version of magic that must be used to be compatible with the tech file.
This effectively supercedes the technology version number.  (2) Changed
the behavior of "make" to set the version and revision numbers on doing
"make" instead of "configure".  This allows the version to update
correctly after doing a "git pull" followed by "make" without doing
"configure" in between.  (3) Fixed a couple of issues that were flagged
as compile-time warnings.
This commit is contained in:
Tim Edwards 2020-12-16 11:49:24 -05:00
parent 5755e0bcfd
commit ba77257afa
8 changed files with 65 additions and 36 deletions

View File

@ -1 +1 @@
8.3.98
8.3.99

View File

@ -1298,7 +1298,7 @@ CmdPort(w, cmd)
char **msg;
int argstart;
int i, refidx, idx, pos, type, option, argc;
unsigned short dirmask;
unsigned int dirmask;
bool found;
bool nonEdit = FALSE;
Label *lab, *sl;

View File

@ -204,9 +204,57 @@ DBTechSetVersion(sectionName, argc, argv)
}
return TRUE;
}
if (strcmp(argv[0], "requires") == 0)
{
/* Version requirement check. If the techfile has "requires" followed
* by a magic version number in the form [magic-]<major>.<minor>.<revision>,
* then the version of magic is checked against this, and the tech
* loading will fail if there is a version incompatibility.
*/
int major, minor, rev;
int rmajor, rminor, rrev;
bool goodversion = FALSE;
char *vstring;
vstring = argv[1];
while ((*vstring != '\0') && !isdigit(*vstring)) vstring++;
major = minor = rev = 0;
rmajor = rminor = rrev = 0;
if (sscanf(vstring, "%d.%d.%d", &rmajor, &rminor, &rrev) == 0)
{
TechError("Badly formed magic version string, should be major.minor.rev\n");
return FALSE;
}
sscanf(MagicVersion, "%d.%d", &major, &minor);
sscanf(MagicRevision, "%d", &rev);
if (major > rmajor)
goodversion = TRUE;
else if (major == rmajor)
{
if (minor > rminor)
goodversion = TRUE;
else if (minor == rminor)
{
if (rev >= rrev)
goodversion = TRUE;
}
}
if (goodversion == FALSE)
{
TechError("Error: Magic version %d.%d.%d is required by this "
"techfile, but this version of magic is %d.%d.%d.\n",
rmajor, rminor, rrev, major, minor, rev);
return FALSE;
}
return TRUE;
}
usage:
TechError("Badly formed version line\nUsage: {version text}|{description text}\n");
TechError("Badly formed version line\n"
"Usage: {version text}|{description text}|{requires text}\n");
return FALSE;
}

View File

@ -1722,7 +1722,8 @@ topVisit(def, doStub)
basenode->efnode_name->efnn_port = portorder++;
}
snode->efnode_name->efnn_port = basenode->efnode_name->efnn_port;
HashSetValue(hep, (ClientData)snode->efnode_name->efnn_port);
HashSetValue(hep,
(ClientData)(pointertype)snode->efnode_name->efnn_port);
}
}
}
@ -1774,7 +1775,8 @@ topVisit(def, doStub)
if (HashLookOnly(&portNameTable, pname) == NULL)
{
hep = HashFind(&portNameTable, pname);
HashSetValue(hep, (ClientData)nodeName->efnn_port);
HashSetValue(hep,
(ClientData)(pointertype)nodeName->efnn_port);
fprintf(esSpiceF, " %s", pname);
tchars += strlen(pname) + 1;
}
@ -1785,7 +1787,7 @@ topVisit(def, doStub)
// port number is set correctly.
hep = HashFind(&portNameTable, pname);
nodeName->efnn_port = (int)HashGetValue(hep);
nodeName->efnn_port = (int)(pointertype)HashGetValue(hep);
}
break;
}

16
scripts/configure vendored
View File

@ -626,8 +626,6 @@ INSTALL_TARGET
ALL_TARGET
OA_LIBS
OA
MAGIC_REVISION
MAGIC_VERSION
MSED
MCPP
LD_RUN_PATH
@ -2597,17 +2595,6 @@ test -n "$target_alias" &&
PACKAGE=magic
MAGIC_VERSION=`cat ../VERSION | cut -d. -f1-2`
MAGIC_REVISION=`cat ../VERSION | cut -d. -f3`
cat >>confdefs.h <<_ACEOF
#define MAGIC_VERSION "${MAGIC_VERSION}"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define MAGIC_REVISION "${MAGIC_REVISION}"
_ACEOF
ALL_TARGET="standard"
INSTALL_TARGET="install-magic"
@ -8227,9 +8214,6 @@ fi

View File

@ -11,11 +11,6 @@ AC_CANONICAL_SYSTEM
dnl pass the version string on the the makefiles
PACKAGE=magic
MAGIC_VERSION=`cat ../VERSION | cut -d. -f1-2`
MAGIC_REVISION=`cat ../VERSION | cut -d. -f3`
AC_DEFINE_UNQUOTED(MAGIC_VERSION, "${MAGIC_VERSION}")
AC_DEFINE_UNQUOTED(MAGIC_REVISION, "${MAGIC_REVISION}")
dnl Override default target when compiling under TCL
ALL_TARGET="standard"
INSTALL_TARGET="install-magic"
@ -1800,9 +1795,6 @@ AC_SUBST(LD_RUN_PATH)
AC_SUBST(MCPP)
AC_SUBST(MSED)
AC_SUBST(MAGIC_VERSION)
AC_SUBST(MAGIC_REVISION)
AC_SUBST(OA)
AC_SUBST(OA_LIBS)

View File

@ -68,15 +68,15 @@ LIB_SPECS = @LIB_SPECS@
LIB_SPECS_NOSTUB = @LIB_SPECS_NOSTUB@
WISH_EXE = @WISH_EXE@
TCL_LIB_DIR = @TCL_LIB_DIR@
MAGIC_VERSION = @MAGIC_VERSION@
MAGIC_REVISION = @MAGIC_REVISION@
MAGIC_VERSION = `cat ../VERSION | cut -d. -f1-2`
MAGIC_REVISION = `cat ../VERSION | cut -d. -f3`
CC = @CC@
CPP = @CPP@
CXX = @CXX@
CPPFLAGS = -I. -I${MAGICDIR} @CPPFLAGS@
DFLAGS = @extra_defs@ @stub_defs@ @DEFS@ -DGCORE=\"@GCORE@\"
DFLAGS = @extra_defs@ @stub_defs@ @DEFS@ -DMAGIC_VERSION=\"${MAGIC_VERSION}\" -DMAGIC_REVISION=\"${MAGIC_REVISION}\" -DGCORE=\"@GCORE@\"
DFLAGS += -DSHDLIB_EXT=\"@SHDLIB_EXT@\" -DNDEBUG
DFLAGS_NOSTUB = @extra_defs@ @DEFS@ -DGCORE=\"@GCORE@\"
DFLAGS_NOSTUB += -DSHDLIB_EXT=\"@SHDLIB_EXT@\" -DNDEBUG

View File

@ -272,9 +272,12 @@ changePlanesFunc(cellDef, arg)
/* Old planes to be subtracted */
for (pNum = DBNumPlanes; pNum < oldnumplanes; pNum++)
{
DBFreePaintPlane(cellDef->cd_planes[pNum]);
TiFreePlane(cellDef->cd_planes[pNum]);
cellDef->cd_planes[pNum] = (Plane *) NULL;
if (cellDef->cd_planes[pNum] != NULL)
{
DBFreePaintPlane(cellDef->cd_planes[pNum]);
TiFreePlane(cellDef->cd_planes[pNum]);
cellDef->cd_planes[pNum] = (Plane *) NULL;
}
}
}
return 0;