mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-08-28 17:15:13 +02:00
Extended the device parameter notation to include offsets using
'+' and '-' in the same way that '*' is currently used for specifying a parameter scaling. The combination of a scale and offset for the same parameter has not (yet) been implemented.
This commit is contained in:
@@ -1662,6 +1662,10 @@ extOutputParameters(def, transList, outFile)
|
||||
fprintf(outFile, " %c%c=%s*%g",
|
||||
plist->pl_param[0], plist->pl_param[1],
|
||||
plist->pl_name, plist->pl_scale);
|
||||
else if (plist->pl_offset != 0.0)
|
||||
fprintf(outFile, " %c%c=%s%+g",
|
||||
plist->pl_param[0], plist->pl_param[1],
|
||||
plist->pl_name, plist->pl_offset);
|
||||
else
|
||||
fprintf(outFile, " %c%c=%s", plist->pl_param[0],
|
||||
plist->pl_param[1], plist->pl_name);
|
||||
@@ -1672,6 +1676,10 @@ extOutputParameters(def, transList, outFile)
|
||||
fprintf(outFile, " %c=%s*%g",
|
||||
plist->pl_param[0],
|
||||
plist->pl_name, plist->pl_scale);
|
||||
if (plist->pl_offset != 0.0)
|
||||
fprintf(outFile, " %c=%s%+g",
|
||||
plist->pl_param[0],
|
||||
plist->pl_name, plist->pl_offset);
|
||||
else
|
||||
fprintf(outFile, " %c=%s", plist->pl_param[0],
|
||||
plist->pl_name);
|
||||
|
||||
+16
-1
@@ -2364,7 +2364,7 @@ ExtTechLine(sectionName, argc, argv)
|
||||
subcktParams = NULL;
|
||||
while ((paramName = strchr(argv[argc - 1], '=')) != NULL)
|
||||
{
|
||||
char *mult;
|
||||
char *mult, *offset;
|
||||
|
||||
paramName++;
|
||||
newParam = (ParamList *)mallocMagic(sizeof(ParamList));
|
||||
@@ -2393,6 +2393,21 @@ ExtTechLine(sectionName, argc, argv)
|
||||
else
|
||||
newParam->pl_scale = 1.0;
|
||||
|
||||
if ((offset = strchr(paramName, '+')) != NULL)
|
||||
{
|
||||
*offset = '\0';
|
||||
offset++;
|
||||
newParam->pl_offset = atof(offset);
|
||||
}
|
||||
else if ((offset = strchr(paramName, '-')) != NULL)
|
||||
{
|
||||
*offset = '\0';
|
||||
offset++;
|
||||
newParam->pl_offset = -atof(offset);
|
||||
}
|
||||
else
|
||||
newParam->pl_offset = 0.0;
|
||||
|
||||
newParam->pl_name = StrDup((char **)NULL, paramName);
|
||||
newParam->pl_next = subcktParams;
|
||||
subcktParams = newParam;
|
||||
|
||||
@@ -78,6 +78,7 @@ typedef struct pl
|
||||
char pl_param[2]; /* Default character for parameter */
|
||||
char *pl_name; /* Full name for parameter */
|
||||
double pl_scale; /* Scaling of parameter, if specified */
|
||||
double pl_offset; /* Offset of parameter, if specified */
|
||||
struct pl *pl_next; /* Next parameter in list */
|
||||
} ParamList;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user