Restored compiling of the non-Tcl/Tk version of magic. This has

traditionally been kept for backwards compatibility.  However, the
operation of "ext2spice" and "ext2sim" as separate programs has
become extremely difficult to maintain, and so it has been dropped
in favor of folding both into the program as commands, as was done
a long time ago in the Tcl/Tk version.
This commit is contained in:
Tim Edwards 2022-02-08 16:12:07 -05:00
parent 113f0dfb3f
commit 6ecd077ab4
13 changed files with 225 additions and 148 deletions

View File

@ -1 +1 @@
8.3.265
8.3.266

View File

@ -1012,7 +1012,9 @@ CmdWhat(w, cmd)
TTMaskSetOnlyType(&maskBits, i);
if (DBIsContact(i)) DBMaskAddStacking(&maskBits);
#ifdef MAGIC_WRAPPER
if (doListAll) paintcellobj = Tcl_NewListObj(0, NULL);
#endif
/* Search selection for tiles of this type, then */
/* call cmdFindWhatTileFunc() to search the cell */
@ -1035,6 +1037,7 @@ CmdWhat(w, cmd)
TxPrintf(" %s ", lidp->lid_name);
TxPrintf(")\n");
}
#ifdef MAGIC_WRAPPER
else
{
Tcl_ListObjAppendElement(magicinterp, paintcellobj,
@ -1048,15 +1051,18 @@ CmdWhat(w, cmd)
Tcl_ListObjAppendElement(magicinterp, paintcellobj,
celllistobj);
}
#endif
while (lid != NULL)
{
freeMagic(lid);
lid = lid->lid_next;
}
#ifdef MAGIC_WRAPPER
if (doListAll)
Tcl_ListObjAppendElement(magicinterp, paintobj,
paintcellobj);
#endif
}
}
EditCellUse = saveUse;

View File

@ -28,14 +28,12 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/hash.h"
#include "utils/utils.h"
#include "tiles/tile.h"
#ifdef MAGIC_WRAPPER
#include "database/database.h"
#include "windows/windows.h"
#include "textio/textio.h"
#include "dbwind/dbwind.h" /* for DBWclientID */
#include "commands/commands.h" /* for module auto-load */
#include "textio/txcommands.h"
#endif
#include "extflat/extflat.h"
#include "extflat/EFint.h"
#include "extract/extract.h" /* for extDevTable */
@ -43,12 +41,10 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/malloc.h"
/* Forward declarations */
#ifdef MAGIC_WRAPPER
void CmdExtToSim();
#endif
bool simnAP();
bool simnAPHier();
int simmainArgs();
int simParseArgs();
int simdevVisit(), simresistVisit(), simcapVisit(), simnodeVisit();
int simmergeVisit();
@ -182,10 +178,10 @@ extern devMerge *devMergeList;
#define ATTR_HIERAP "*[Ee][Xx][Tt]:[Aa][Pp][Hh]*"
#define ATTR_SUBSAP "*[Ee][Xx][Tt]:[Aa][Pp][Ss]*"
#ifdef MAGIC_WRAPPER
#define atoCap(s) ((EFCapValue)atof(s))
#ifdef MAGIC_WRAPPER
/* Forward declaration */
int _ext2sim_start();
@ -226,7 +222,7 @@ Exttosim_Init(interp)
}
#endif /* EXT2SIM_AUTO */
#endif /* MAGIC_WRAPPER */
/*
* ----------------------------------------------------------------------------
@ -322,7 +318,11 @@ CmdExtToSim(w, cmd)
case EXTTOSIM_EXTRESIST:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esDoSimExtResis) ? "on" : "off", NULL);
#else
TxPrintf("Extresist: %s\n", (esDoSimExtResis) ? "on" : "off");
#endif
return;
}
else if (cmd->tx_argc != 3)
@ -335,7 +335,11 @@ CmdExtToSim(w, cmd)
case EXTTOSIM_ALIAS:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esNoAlias) ? "off" : "on", NULL);
#else
TxPrintf("Aliases: %s\n", (esNoAlias) ? "off" : "on");
#endif
return;
}
else if (cmd->tx_argc != 3)
@ -348,7 +352,11 @@ CmdExtToSim(w, cmd)
case EXTTOSIM_LABELS:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esNoLabel) ? "off" : "on", NULL);
#else
TxPrintf("Labels: %s\n", (esNoLabel) ? "off" : "on");
#endif
return;
}
else if (cmd->tx_argc != 3)
@ -362,10 +370,18 @@ CmdExtToSim(w, cmd)
if (cmd->tx_argc == 2)
{
if (!IS_FINITE_F(LocCapThreshold))
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "infinite", NULL);
#else
TxPrintf("Capacitance threshold: infinite\n");
#endif
else
#ifdef MAGIC_WRAPPER
Tcl_SetObjResult(magicinterp,
Tcl_NewDoubleObj((double)LocCapThreshold));
#else
TxPrintf("Capacitance threshold: %lf\n", (double)LocCapThreshold);
#endif
return;
}
else if (cmd->tx_argc < 3) goto usage;
@ -380,10 +396,18 @@ CmdExtToSim(w, cmd)
if (cmd->tx_argc == 2)
{
if (LocResistThreshold == INFINITE_THRESHOLD)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "infinite", NULL);
#else
TxPrintf("Resistance threshold: infinite\n");
#endif
else
#ifdef MAGIC_WRAPPER
Tcl_SetObjResult(magicinterp,
Tcl_NewIntObj(LocResistThreshold));
#else
TxPrintf("Resistance threshold: %lf\n", (double)LocResistThreshold);
#endif
return;
}
else if (cmd->tx_argc < 3) goto usage;
@ -397,7 +421,11 @@ CmdExtToSim(w, cmd)
case EXTTOSIM_FORMAT:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, sim_formats[esFormat], TCL_STATIC);
#else
TxPrintf("Format: %s\n", sim_formats[esFormat]);
#endif
return;
}
else if (cmd->tx_argc < 3) goto usage;
@ -411,11 +439,23 @@ CmdExtToSim(w, cmd)
if (cmd->tx_argc == 2)
{
if (esMergeDevsA)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "aggressive", NULL);
#else
TxPrintf("Merge: aggressive\n");
#endif
else if (esMergeDevsC)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "conservative", NULL);
#else
TxPrintf("Merge: conservative\n");
#endif
else
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "none", NULL);
#else
TxPrintf("Merge: none\n");
#endif
return;
}
else if (cmd->tx_argc < 3) goto usage;
@ -483,7 +523,7 @@ runexttosim:
EFResistThreshold = LocResistThreshold;
/* Process command line arguments */
inName = EFArgs(argc, argv, &err_result, simmainArgs, (ClientData) NULL);
inName = EFArgs(argc, argv, &err_result, simParseArgs, (ClientData) NULL);
if (err_result == TRUE)
{
@ -530,28 +570,40 @@ runexttosim:
((esDoSimExtResis) ? ".ext" : ""));
if ((esSimF = fopen(simesOutName, "w")) == NULL)
{
#ifdef MAGIC_WRAPPER
char *tclres = Tcl_Alloc(128);
sprintf(tclres, "exttosim: Unable to open file %s for writing\n",
simesOutName);
Tcl_SetResult(magicinterp, tclres, TCL_DYNAMIC);
#else
TxError("exttosim: Unable to open file %s for writing\n", simesOutName);
#endif
EFDone();
return /* TCL_ERROR */;
}
if (!esNoAlias && (esAliasF = fopen(esAliasName, "w")) == NULL)
{
#ifdef MAGIC_WRAPPER
char *tclres = Tcl_Alloc(128);
sprintf(tclres, "exttosim: Unable to open file %s for writing\n",
esAliasName);
Tcl_SetResult(magicinterp, tclres, TCL_DYNAMIC);
#else
TxError("exttosim: Unable to open file %s for writing\n", esAliasName);
#endif
EFDone();
return /* TCL_ERROR */;
}
if (!esNoLabel && (esLabF = fopen(esLabelName, "w")) == NULL)
{
#ifdef MAGIC_WRAPPER
char *tclres = Tcl_Alloc(128);
sprintf(tclres, "exttosim: Unable to open file %s for writing\n",
esLabelName);
Tcl_SetResult(magicinterp, tclres, TCL_DYNAMIC);
#else
TxError("exttosim: Unable to open file %s for writing\n", esLabelName);
#endif
return /* TCL_ERROR */;
}
@ -648,7 +700,7 @@ runexttosim:
TxPrintf("exttosim finished.\n");
}
#else /* !MAGIC_WRAPPER */
#if 0 /* Independent program "ext2sim" deprecated */
/*
* ----------------------------------------------------------------------------
@ -699,7 +751,7 @@ main(argc, argv)
fetInfo[i].resClassSub = 6 ;
fetInfo[i].defSubs = "Vdd!";
/* Process command line arguments */
inName = EFArgs(argc, argv, NULL, simmainArgs, (ClientData) NULL);
inName = EFArgs(argc, argv, NULL, simParseArgs, (ClientData) NULL);
if (inName == NULL)
exit (1);
@ -777,12 +829,12 @@ main(argc, argv)
exit(0);
}
#endif /* MAGIC_WRAPPER */
#endif /* Deprecated */
/*
* ----------------------------------------------------------------------------
*
* simmainArgs --
* simParseArgs --
*
* Process those arguments that are specific to ext2sim.
* Assumes that *pargv[0][0] is '-', indicating a flag
@ -805,7 +857,7 @@ main(argc, argv)
*/
int
simmainArgs(pargc, pargv)
simParseArgs(pargc, pargv)
int *pargc;
char ***pargv;
{
@ -880,34 +932,6 @@ simmainArgs(pargc, pargv)
break;
}
#ifndef MAGIC_WRAPPER
case 'j':
{
char *rp, subsNode[80] ;
int ndx, rClass, rClassSub = NO_RESCLASS;
if ((cp = ArgStr(&argc,&argv,"resistance class")) == NULL)
goto usage;
if ( (rp = strchr(cp,':')) == NULL )
goto usage;
else *rp++ = '\0';
if ( sscanf(rp, "%d/%d/%s", &rClass, &rClassSub, subsNode) != 3 ) {
rClassSub = NO_RESCLASS ;
if ( sscanf(rp, "%d/%s", &rClass, subsNode) != 2 ) goto usage;
}
ndx = efBuildAddStr(EFDevTypes, &EFDevNumTypes, TT_MAXTYPES, cp);
fetInfo[ndx].resClassSource = rClass;
fetInfo[ndx].resClassDrain = rClass;
fetInfo[ndx].resClassSub = rClassSub;
fetInfo[ndx].defSubs = (char *) mallocMagic((unsigned) (strlen(subsNode)+1));
fetInfo[ndx].devType = TT_SPACE;
strcpy(fetInfo[ndx].defSubs,subsNode);
TxError("Info: fet %s(%d) sdRclass=%d subRclass=%d dSub=%s\n",
cp, ndx, fetInfo[ndx].resClassSD, fetInfo[ndx].resClassSub,
fetInfo[ndx].defSubs);
break;
}
#endif /* MAGIC_WRAPPER */
default:
TxError("Unrecognized flag: %s\n", argv[0]);
goto usage;
@ -921,19 +945,10 @@ usage:
TxError("Usage: ext2sim [-a aliasfile] [-A] [-B] [-l labelfile] [-L]\n"
"[-o simfile] [-J flat|hier] [-y cap_digits]\n"
"[-f mit|lbl|su] "
#ifdef MAGIC_WRAPPER
"[file]\n"
#else
"[-j device:sdRclass[/subRclass]/defaultSubstrate]\n"
"file\n\n or else see options to extcheck(1)\n"
#endif
);
#ifdef MAGIC_WRAPPER
return 1;
#else
exit (1);
#endif
}

View File

@ -25,6 +25,8 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#ifdef MAGIC_WRAPPER
#include "tcltk/tclmagic.h"
#endif
#include "utils/magic.h"
#include "utils/malloc.h"
#include "utils/geometry.h"
@ -1992,5 +1994,3 @@ esHierVisit(hc, cdata)
EFFlatDone(esFreeNodeClient);
return 0;
}
#endif /* MAGIC_WRAPPER */

View File

@ -29,14 +29,12 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/dqueue.h"
#include "utils/utils.h"
#include "tiles/tile.h"
#ifdef MAGIC_WRAPPER
#include "database/database.h"
#include "windows/windows.h"
#include "textio/textio.h"
#include "dbwind/dbwind.h" /* for DBWclientID */
#include "commands/commands.h" /* for module auto-load */
#include "textio/txcommands.h"
#endif
#include "extflat/extflat.h"
#include "extflat/EFint.h"
#include "extract/extract.h" /* for extDevTable */
@ -113,6 +111,10 @@ int esSpiceDevsMerged;
devMerge *devMergeList = NULL ;
#define atoCap(s) ((EFCapValue)atof(s))
extern void ESGenerateHierarchy(); /* forward reference */
/*
* ----------------------------------------------------------------------------
*
@ -134,7 +136,7 @@ int
esFreeNodeClient(client)
nodeClient *client;
{
if (client != (ClientData)NULL)
if (client != (nodeClient *)NULL)
if (client->spiceNodeName != NULL)
freeMagic((char *)client->spiceNodeName);
@ -186,7 +188,6 @@ esFormatSubs(outf, suf)
}
#ifdef MAGIC_WRAPPER
#ifdef EXT2SPICE_AUTO
/*
* ----------------------------------------------------------------------------
@ -224,6 +225,8 @@ Exttospice_Init(interp)
}
#endif /* EXT2SPICE_AUTO */
#endif /* MAGIC_WRAPPER */
/*
* ----------------------------------------------------------------------------
*
@ -377,7 +380,11 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_EXTRESIST:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esDoExtResis) ? "on" : "off", NULL);
#else
TxPrintf("Extresist: %s\n", (esDoExtResis) ? "on" : "off");
#endif
return;
}
else if (cmd->tx_argc != 3)
@ -391,7 +398,11 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_RESISTORTEE:
if (cmd->tx_argc == 3)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esDoResistorTee) ? "on" : "off", NULL);
#else
TxPrintf("Resistor tee: %s\n", (esDoResistorTee) ? "on" : "off");
#endif
return;
}
else if (cmd->tx_argc != 4)
@ -405,7 +416,11 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_SCALE:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esScale < 0) ? "on" : "off", NULL);
#else
TxPrintf("Scale: %s\n", (esScale < 0) ? "on" : "off");
#endif
return;
}
else if (cmd->tx_argc != 3)
@ -419,7 +434,11 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_HIERARCHY:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esDoHierarchy) ? "on" : "off", NULL);
#else
TxPrintf("Hierarchy: %s\n", (esDoHierarchy) ? "on" : "off");
#endif
return;
}
idx = Lookup(cmd->tx_argv[2], yesno);
@ -433,7 +452,11 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_BLACKBOX:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esDoBlackBox) ? "on" : "off", NULL);
#else
TxPrintf("Black box: %s\n", (esDoBlackBox) ? "on" : "off");
#endif
return;
}
idx = Lookup(cmd->tx_argv[2], yesno);
@ -447,7 +470,11 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_RENUMBER:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esDoRenumber) ? "on" : "off", NULL);
#else
TxPrintf("Renumber: %s\n", (esDoRenumber) ? "on" : "off");
#endif
return;
}
idx = Lookup(cmd->tx_argv[2], yesno);
@ -461,7 +488,11 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_MERGENAMES:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esMergeNames) ? "on" : "off", NULL);
#else
TxPrintf("Merge names: %s\n", (esMergeNames) ? "on" : "off");
#endif
return;
}
idx = Lookup(cmd->tx_argv[2], yesno);
@ -476,11 +507,23 @@ CmdExtToSpice(w, cmd)
if (cmd->tx_argc == 2)
{
if ((EFOutputFlags & EF_SHORT_MASK) == EF_SHORT_NONE)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "none", NULL);
#else
TxPrintf("Shorts: none\n");
#endif
else if ((EFOutputFlags & EF_SHORT_MASK) == EF_SHORT_R)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "resistor", NULL);
#else
TxPrintf("Shorts: resistor\n");
#endif
else if ((EFOutputFlags & EF_SHORT_MASK) == EF_SHORT_V)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "voltage source", NULL);
#else
TxPrintf("Shorts: voltage source\n");
#endif
return;
}
idx = Lookup(cmd->tx_argv[2], cmdShortTypes);
@ -528,7 +571,11 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_SUBCIRCUITS:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esDoPorts) ? "on" : "off", NULL);
#else
TxPrintf("Ports: %s\n", (esDoPorts) ? "on" : "off");
#endif
return;
}
idx = Lookup(cmd->tx_argv[2], subcktopts);
@ -544,16 +591,26 @@ CmdExtToSpice(w, cmd)
case IDX_DESCEND:
if (cmd->tx_argc == 3)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, (esDoPorts) ? "on" : "off", NULL);
#else
TxPrintf("Ports: %s\n", (esDoPorts) ? "on" : "off");
#endif
return;
}
break;
case IDX_TOP:
if (cmd->tx_argc == 3)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp,
(esDoSubckt == 2) ? "auto" :
(esDoSubckt == 1) ? "on" : "off", NULL);
#else
TxPrintf("Top subcircuit: %s\n",
(esDoSubckt == 2) ? "auto" :
(esDoSubckt == 1) ? "on" : "off");
#endif
return;
}
break;
@ -588,15 +645,24 @@ CmdExtToSpice(w, cmd)
case EXTTOSPC_FORMAT:
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, cmdExtToSpcFormat[esFormat], NULL);
#else
TxPrintf("Format: %s\n", cmdExtToSpcFormat[esFormat]);
#endif
return;
}
else if (cmd->tx_argc < 3) goto usage;
idx = Lookup(cmd->tx_argv[2], cmdExtToSpcFormat);
if (idx < 0)
{
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "Bad format type. Formats are:"
"spice2, spice3, hspice, and ngspice.", NULL);
#else
TxError("Bad format type. Formats are:"
"spice2, spice3, hspice, and ngspice.");
#endif
return;
}
else
@ -611,10 +677,19 @@ CmdExtToSpice(w, cmd)
if (cmd->tx_argc == 2)
{
if (!IS_FINITE_F(LocCapThreshold))
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "infinite", NULL);
#else
TxPrintf("Capacitance threshold: infinite\n");
#endif
else
#ifdef MAGIC_WRAPPER
Tcl_SetObjResult(magicinterp,
Tcl_NewDoubleObj((double)LocCapThreshold));
#else
TxPrintf("Capacitance threshold: %lf\n",
(double)LocCapThreshold);
#endif
return;
}
else if (cmd->tx_argc < 3) goto usage;
@ -636,10 +711,19 @@ CmdExtToSpice(w, cmd)
if (cmd->tx_argc == 2)
{
if (LocResistThreshold == INFINITE_THRESHOLD)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "infinite", NULL);
#else
TxPrintf("Resistance threshold: infinite\n");
#endif
else
#ifdef MAGIC_WRAPPER
Tcl_SetObjResult(magicinterp,
Tcl_NewIntObj(LocResistThreshold));
#else
TxPrintf("Resistance threshold: %lf\n",
(double)LocResistThreshold);
#endif
return;
}
else if (cmd->tx_argc < 3) goto usage;
@ -655,11 +739,23 @@ CmdExtToSpice(w, cmd)
if (cmd->tx_argc == 2)
{
if (esMergeDevsA)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "aggressive", NULL);
#else
TxPrintf("Merge: aggressive\n");
#endif
else if (esMergeDevsC)
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "conservative", NULL);
#else
TxPrintf("Merge: conservative\n");
#endif
else
#ifdef MAGIC_WRAPPER
Tcl_SetResult(magicinterp, "none", NULL);
#else
TxPrintf("Merge: none\n");
#endif
return;
}
else if (cmd->tx_argc < 3) goto usage;
@ -740,7 +836,7 @@ runexttospice:
/* Process command line arguments */
inName = EFArgs(argc, argv, &err_result, spcmainArgs, (ClientData) NULL);
inName = EFArgs(argc, argv, &err_result, spcParseArgs, (ClientData) NULL);
if (err_result == TRUE)
{
EFDone();
@ -788,10 +884,14 @@ runexttospice:
if ((esSpiceF = fopen(spcesOutName, "w")) == NULL)
{
#ifdef MAGIC_WRAPPER
char *tclres = Tcl_Alloc(128);
sprintf(tclres, "exttospice: Unable to open file %s for writing\n",
spcesOutName);
Tcl_SetResult(magicinterp, tclres, TCL_DYNAMIC);
#else
TxError("exttospice: Unable to open file %s for writing\n", spcesOutName);
#endif
EFDone();
return;
}
@ -836,6 +936,7 @@ runexttospice:
esFetInfo[i].defSubs = subname;
}
#ifdef MAGIC_WRAPPER
if (EFCompat == TRUE)
{
/* Tcl variable substitution for substrate node names */
@ -846,6 +947,7 @@ runexttospice:
if (resstr != NULL) esFetInfo[i].defSubs = resstr;
}
}
#endif
if (esDoHierarchy && (subname != NULL))
{
@ -885,6 +987,7 @@ runexttospice:
}
}
#ifdef MAGIC_WRAPPER
if (EFCompat == TRUE)
{
/* Keep a pointer to the "GND" variable, if it exists. */
@ -892,6 +995,7 @@ runexttospice:
resstr = (char *)Tcl_GetVar(magicinterp, "GND", TCL_GLOBAL_ONLY);
if (resstr == NULL) resstr = "GND"; /* default value */
}
#endif
/* Write the output file */
@ -921,6 +1025,7 @@ runexttospice:
fprintf(esSpiceF, ".global ");
while (glist != NULL)
{
#ifdef MAGIC_WRAPPER
if (EFCompat == TRUE)
{
/* Handle global names that are TCL variables */
@ -937,6 +1042,7 @@ runexttospice:
esFormatSubs(esSpiceF, glist->gll_name);
}
else
#endif
esFormatSubs(esSpiceF, glist->gll_name);
fprintf(esSpiceF, " ");
@ -1046,7 +1152,7 @@ runexttospice:
return;
}
#else /* MAGIC_WRAPPER */
#if 0 /* Independent program "ext2spice" has been deprecated */
/*
* ----------------------------------------------------------------------------
@ -1103,7 +1209,7 @@ main(argc, argv)
esFetInfo[i].defSubs = "Vdd!";
/* Process command line arguments */
inName = EFArgs(argc, argv, NULL, spcmainArgs, (ClientData) NULL);
inName = EFArgs(argc, argv, NULL, spcParseArgs, (ClientData) NULL);
if (inName == NULL)
exit (1);
@ -1210,13 +1316,13 @@ main(argc, argv)
exit (0);
}
#endif /* MAGIC_WRAPPER */
#endif /* Deprecated */
/*
* ----------------------------------------------------------------------------
*
* spcmainArgs --
* spcParseArgs --
*
* Process those arguments that are specific to ext2spice.
* Assumes that *pargv[0][0] is '-', indicating a flag
@ -1238,7 +1344,7 @@ main(argc, argv)
*/
int
spcmainArgs(pargc, pargv)
spcParseArgs(pargc, pargv)
int *pargc;
char ***pargv;
{
@ -1249,12 +1355,7 @@ spcmainArgs(pargc, pargv)
"[-B] [-o spicefile] [-M|-m] [-y cap_digits] "
"[-J flat|hier]\n"
"[-f spice2|spice3|hspice|ngspice] [-M] [-m] "
#ifdef MAGIC_WRAPPER
"[file]\n";
#else
"[-j device:sdRclass[/subRclass]/defaultSubstrate]\n"
"file\n\n or else see options to extcheck(1)\n";
#endif
switch (argv[0][1])
{
@ -1318,32 +1419,6 @@ spcmainArgs(pargc, pargv)
esCapAccuracy = atoi(t);
break;
}
#ifndef MAGIC_WRAPPER
case 'j':
{
char *rp, subsNode[80] ;
int ndx, rClass, rClassSub = -1;
if ((cp = ArgStr(&argc,&argv,"resistance class")) == NULL)
goto usage;
if ( (rp = (char *) strchr(cp,':')) == NULL )
goto usage;
else *rp++ = '\0';
if ( sscanf(rp, "%d/%d/%s", &rClass, &rClassSub, subsNode) != 3 ) {
rClassSub = -1 ;
if ( sscanf(rp, "%d/%s", &rClass, subsNode) != 2 ) goto usage;
}
ndx = efBuildAddStr(EFDevTypes, &EFDevNumTypes, TT_MAXTYPES, cp);
esFetInfo[ndx].resClassSource = esFetInfo[ndx].resClassDrain = rClass;
esFetInfo[ndx].resClassSub = rClassSub;
esFetInfo[ndx].defSubs = (char *)mallocMagic((unsigned)(strlen(subsNode)+1));
strcpy(esFetInfo[ndx].defSubs,subsNode);
TxError("info: dev %s(%d) srcRclass=%d drnRclass=%d subRclass=%d dSub=%s\n",
cp, ndx, esFetInfo[ndx].resClassSource, esFetInfo[ndx].resClassDrain,
esFetInfo[ndx].resClassSub, esFetInfo[ndx].defSubs);
break;
}
#endif /* MAGIC_WRAPPER */
case 'h': /* -h or -help, as suggested by "ext2spice help" */
TxPrintf(usage_text);
break;
@ -1358,12 +1433,7 @@ spcmainArgs(pargc, pargv)
usage:
TxError(usage_text);
#ifdef MAGIC_WRAPPER
return 1;
#else
exit (1);
#endif
}
/*
@ -2935,7 +3005,7 @@ FILE *outf;
NULL));
/* Create node client if it doesn't exist */
if ((nodeClient *)nn->efnn_node->efnode_client == (ClientData)NULL)
if ((nodeClient *)nn->efnn_node->efnode_client == (nodeClient *)NULL)
initNodeClientHier(nn->efnn_node);
/* Mark node as visited (set bit one higher than number of resist classes) */

View File

@ -17,10 +17,8 @@ typedef struct _devMerge {
} devMerge;
/* Forward declarations */
#ifdef MAGIC_WRAPPER
void CmdExtToSpice();
#endif
extern int spcmainArgs();
extern int spcParseArgs();
extern int spccapVisit(), spcdevVisit(), spcnodeVisit(), subcktVisit();
extern int spcresistVisit(), devMergeVisit(), devDistJunctVisit();
extern int spcsubVisit();

View File

@ -35,6 +35,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$";
#include "extflat/extflat.h"
#include "extflat/EFint.h"
#include "extract/extract.h" /* for device class list */
#include "extract/extractInt.h" /* for extGetDevType() */
/*
* To avoid allocating ridiculously large amounts of memory to hold

View File

@ -824,6 +824,7 @@ extSubsName(node)
{
if (node->lreg_ll.p_x <= (MINFINITY + 3))
{
#ifdef MAGIC_WRAPPER
if (ExtCurStyle->exts_globSubstrateName[0] == '$' &&
ExtCurStyle->exts_globSubstrateName[1] != '$')
{
@ -840,6 +841,7 @@ extSubsName(node)
+ 1;
}
else
#endif
return ExtCurStyle->exts_globSubstrateName;
}
else return NULL;
@ -2543,7 +2545,7 @@ extDevFindMatch(deventry, t)
j = MATCH_TERM;
i = 0;
match = True;
match = TRUE;
for (k = 0; k < devptr->exts_deviceSDCount; k++)
{
if (extTransRec.tr_termnode[k] == NULL) break;
@ -2551,13 +2553,13 @@ extDevFindMatch(deventry, t)
{
if (TTMaskIsZero(&devptr->exts_deviceSDTypes[i]))
{
match = False;
match = FALSE;
break;
}
if (!TTMaskEqual(&devptr->exts_deviceSDTypes[i],
&deventry->exts_deviceSDTypes[i]))
{
match = False;
match = FALSE;
break;
}
}
@ -3710,9 +3712,9 @@ extFindNodes(def, clipArea, subonly)
if (TTMaskHasType(&ExtCurStyle->exts_globSubstrateTypes, TT_SPACE))
space_is_substrate = True;
space_is_substrate = TRUE;
else
space_is_substrate = False;
space_is_substrate = FALSE;
TTMaskZero(&subsTypesNonSpace);
TTMaskSetMask(&subsTypesNonSpace, &ExtCurStyle->exts_globSubstrateTypes);

View File

@ -270,6 +270,8 @@ ExtCompareStyle(stylename)
return FALSE;
}
#endif /* MAGIC_WRAPPER */
/*
* ----------------------------------------------------------------------------
*
@ -429,8 +431,6 @@ ExtGetDevInfo(idx, devnameptr, devtypeptr, s_rclassptr, d_rclassptr,
return TRUE;
}
#endif /* MAGIC_WRAPPER */
/*
* ----------------------------------------------------------------------------
*

View File

@ -67,7 +67,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
typedef enum {
POSTSCRIPT=0,
PLOTPNM,
#ifdef HAVE_LIBCAIRO
#if defined(HAVE_LIBCAIRO) && defined(MAGIC_WRAPPER)
PLOTSVG,
#endif
#ifdef GREMLIN
@ -97,7 +97,7 @@ CmdPlot(w, cmd)
float width;
int iwidth, scale;
#ifdef HAVE_LIBCAIRO
#if defined(HAVE_LIBCAIRO) && defined(MAGIC_WRAPPER)
int flags;
extern void GrTCairoPlotSVG();
#endif
@ -108,7 +108,7 @@ CmdPlot(w, cmd)
underneath the box",
"pnm file [width [layers]] generate PNM file for what's\n\
underneath the box",
#ifdef HAVE_LIBCAIRO
#if defined(HAVE_LIBCAIRO) && defined(MAGIC_WRAPPER)
"svg file generate SVG file for the whole window",
#endif
#ifdef GREMLIN
@ -149,7 +149,7 @@ CmdPlot(w, cmd)
#ifdef GREMLIN
|| (option == STYLE_GREMLIN)
#endif
#ifdef HAVE_LIBCAIRO
#if defined(HAVE_LIBCAIRO) && defined(MAGIC_WRAPPER)
|| (option == PLOTSVG)
#endif
#ifdef VERSATEC
@ -264,7 +264,7 @@ CmdPlot(w, cmd)
return;
#endif
#ifdef HAVE_LIBCAIRO
#if defined(HAVE_LIBCAIRO) && defined(MAGIC_WRAPPER)
case PLOTSVG:
if (cmd->tx_argc > 3)
{

23
scripts/configure vendored
View File

@ -6816,24 +6816,15 @@ else
fi
if test $usingTcl ; then
if test "x$enable_modular" = "xyes" ; then
programs="$programs ext2sim ext2spice"
$as_echo "#define EXT2SPICE_AUTO 1" >>confdefs.h
$as_echo "#define EXT2SIM_AUTO 1" >>confdefs.h
else
modules="$modules ext2sim ext2spice"
extra_libs="$extra_libs \${MAGICDIR}/ext2sim/libext2sim.o"
extra_libs="$extra_libs \${MAGICDIR}/ext2spice/libext2spice.o"
fi
else
programs="$programs ext2sim ext2spice"
if test "x$enable_modular" = "xyes" ; then
$as_echo "#define EXT2SPICE_AUTO 1" >>confdefs.h
$as_echo "#define EXT2SIM_AUTO 1" >>confdefs.h
else
modules="$modules ext2sim ext2spice"
extra_libs="$extra_libs \${MAGICDIR}/ext2sim/libext2sim.o"
extra_libs="$extra_libs \${MAGICDIR}/ext2spice/libext2spice.o"
fi
# Check whether --enable-locking was given.
@ -7637,12 +7628,12 @@ elif test $usingScheme ; then
unused="$unused tcltk"
cadinstall="$cadinstall lisp"
extra_libs="$extra_libs \${MAGICDIR}/lisp/liblisp.o"
programs="$programs extcheck graphics"
programs="$programs graphics"
$as_echo "#define SCHEME_INTERPRETER 1" >>confdefs.h
else
unused="$unused lisp tcltk"
programs="$programs extcheck graphics"
programs="$programs graphics"
fi

View File

@ -914,20 +914,13 @@ AC_ARG_ENABLE(modular,
[],
[enable_modular=no])
if test $usingTcl ; then
if test "x$enable_modular" = "xyes" ; then
programs="$programs ext2sim ext2spice"
AC_DEFINE(EXT2SPICE_AUTO)
AC_DEFINE(EXT2SIM_AUTO)
else
modules="$modules ext2sim ext2spice"
extra_libs="$extra_libs \${MAGICDIR}/ext2sim/libext2sim.o"
extra_libs="$extra_libs \${MAGICDIR}/ext2spice/libext2spice.o"
fi
else
programs="$programs ext2sim ext2spice"
if test "x$enable_modular" = "xyes" ; then
AC_DEFINE(EXT2SPICE_AUTO)
AC_DEFINE(EXT2SIM_AUTO)
else
modules="$modules ext2sim ext2spice"
extra_libs="$extra_libs \${MAGICDIR}/ext2sim/libext2sim.o"
extra_libs="$extra_libs \${MAGICDIR}/ext2spice/libext2spice.o"
fi
AC_ARG_ENABLE(locking,
@ -1268,11 +1261,11 @@ elif test $usingScheme ; then
unused="$unused tcltk"
cadinstall="$cadinstall lisp"
extra_libs="$extra_libs \${MAGICDIR}/lisp/liblisp.o"
programs="$programs extcheck graphics"
programs="$programs graphics"
AC_DEFINE(SCHEME_INTERPRETER)
else
unused="$unused lisp tcltk"
programs="$programs extcheck graphics"
programs="$programs graphics"
fi
dnl ----------------------------------------------------------------

View File

@ -809,11 +809,10 @@ mainInitFinal()
char *rname;
int result;
#ifdef MAGIC_WRAPPER
/* Reset terminal if exit is called inside a TCL script */
Tcl_SetExitProc(tcl_exit_hook);
#ifdef MAGIC_WRAPPER
/* Read in system pre-startup file, if it exists. */
/* Use PaOpen first to perform variable substitutions, and */
@ -1205,7 +1204,9 @@ mainInitFinal()
UndoFlush();
TxClearPoint();
#ifdef MAGIC_WRAPPER
Tcl_SetExitProc(NULL);
#endif
return 0;
}