home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk1.iso
/
altsrc
/
articles
/
11116
< prev
next >
Wrap
Text File
|
1994-08-13
|
64KB
|
2,039 lines
Newsgroups: alt.sources
Path: wupost!math.ohio-state.edu!usc!cs.utexas.edu!convex!news.duke.edu!eff!news.kei.com!travelers.mail.cornell.edu!cornell!rochester!rit!atd
From: atd@cs.rit.edu (Albert T Davis)
Subject: ACS (Al's Circuit Simulator) patch02
Message-ID: <1994Aug13.022249.25894@cs.rit.edu>
Sender: news@cs.rit.edu (USENET News Admin)
Nntp-Posting-Host: cobalt
Organization: Rochester Institute of Technology, Rochester, NY
Date: Sat, 13 Aug 1994 02:22:49 GMT
Lines: 2027
Submitted-By: atd@cs.rit.edu (Al Davis)
Archive-Name: acs-0.14/patch02
Environment: UNIX, MS-DOS, VMS
This is a patch to ACS 0.14 making ACS 0.15.
From rn, say "| patch -d DIR", where DIR is your acs root directory
(the one containing man and src). Outside of rn, say "cd DIR;
patch <thisarticle". If you don't have the patch program, apply
the following by hand, or get patch (version 2.0, latest patchlevel).
This is the second of two parts. Apply them both, then recompile.
Both the manual and program have been changed.
=================================
diff -cN ../acs-0.14/src/ac_setup.c src/ac_setup.c
*** ../acs-0.14/src/ac_setup.c Wed Jul 6 12:11:47 1994
--- src/ac_setup.c Sun Jul 31 23:09:47 1994
***************
*** 1,4 ****
! /* ac_setup.c 93.12.19
* Copyright 1983-1992 Albert Davis
* ac analysis setup
*/
--- 1,4 ----
! /* ac_setup.c 94.07.29
* Copyright 1983-1992 Albert Davis
* ac analysis setup
*/
***************
*** 69,75 ****
ac->stop = ac->start;
if (isfloat(cmd[*cnt]))
ac_optby(cmd,cnt);
! }else if (outset(cmd,cnt,(char*)NULL,"ac ")){
;
}else{
syntax_check(cmd,cnt,bWARNING);
--- 69,75 ----
ac->stop = ac->start;
if (isfloat(cmd[*cnt]))
ac_optby(cmd,cnt);
! }else if (outset(cmd,cnt,"","")){
;
}else{
syntax_check(cmd,cnt,bWARNING);
diff -cN ../acs-0.14/src/branch.h src/branch.h
*** ../acs-0.14/src/branch.h Wed Jul 6 12:11:36 1994
--- src/branch.h Sun Jul 31 23:09:38 1994
***************
*** 1,4 ****
! /* branch.h 94.07.01
* Copyright 1983-1992 Albert Davis
* branch structure type definitions
* device types (enumeration type?)
--- 1,4 ----
! /* branch.h 94.07.11
* Copyright 1983-1992 Albert Davis
* branch structure type definitions
* device types (enumeration type?)
***************
*** 58,63 ****
--- 58,64 ----
double ic; /* initial condition */
unsigned bypass:1, /* is bypassing now */
tracesubckt:1,/* trace subckt fanout */
+ nodamp:1, /* don't apply iteration damping */
converged:1;/* convergence status */
int method_a; /* actual integration method (auto) */
int method_u; /* method to use for this part per user */
***************
*** 77,85 ****
cpoly1_t m0; /* matrix parameters, new */
cpoly1_t m1; /* matrix parameters, 1 fill ago */
cpoly1_t mt1; /* matrix parameters, 1 time ago */
- #ifdef KEEP_OLD_TIME_INFO
- cpoly1_t mt2; /* matrix parameters, 2 time ago */
- #endif
complex_t ev; /* ac effective value (usually real) */
complex_t acg; /* ac admittance matrix values */
--- 78,83 ----
diff -cN ../acs-0.14/src/ctostr.c src/ctostr.c
*** ../acs-0.14/src/ctostr.c Wed Jul 6 12:11:49 1994
--- src/ctostr.c Sun Jul 31 23:09:50 1994
***************
*** 1,4 ****
! /* ctostr.c 93.12.19
* Copyright 1983-1992 Albert Davis
* get string from string
*/
--- 1,4 ----
! /* ctostr.c 94.07.13
* Copyright 1983-1992 Albert Davis
* get string from string
*/
***************
*** 5,11 ****
#include "ecah.h"
#include "declare.h"
/*--------------------------------------------------------------------------*/
! char *ctostr(const char*,int*,char*,int);
/*--------------------------------------------------------------------------*/
/* ctostr: character input to string
* scan (and eat) an input string (cmd) using index (cnt).
--- 5,11 ----
#include "ecah.h"
#include "declare.h"
/*--------------------------------------------------------------------------*/
! char *ctostr(const char*,int*,char*,int,const char*);
/*--------------------------------------------------------------------------*/
/* ctostr: character input to string
* scan (and eat) an input string (cmd) using index (cnt).
***************
*** 16,22 ****
* skips leading whitespace. skips trailing whitespace and comma
* skips parts of input word too big for destination
*/
! char *ctostr(const char *cmd, int *cnt, char *des, int len)
{
char chr;
int dind;
--- 16,22 ----
* skips leading whitespace. skips trailing whitespace and comma
* skips parts of input word too big for destination
*/
! char *ctostr(const char *cmd, int *cnt, char *des, int len, const char *term)
{
char chr;
int dind;
***************
*** 24,36 ****
skipbl(cmd,cnt);
for (dind = 0; dind < len; (*cnt)++, dind++){
chr = cmd[*cnt];
! if (isterm(chr))
break;
des[dind] = chr;
}
des[dind] = '\0';
! while (!isterm(cmd[*cnt]))
(*cnt)++;
skipcom(cmd,cnt);
return des;
--- 24,36 ----
skipbl(cmd,cnt);
for (dind = 0; dind < len; (*cnt)++, dind++){
chr = cmd[*cnt];
! if (isterm(chr,term))
break;
des[dind] = chr;
}
des[dind] = '\0';
! while (!isterm(cmd[*cnt],term))
(*cnt)++;
skipcom(cmd,cnt);
return des;
diff -cN ../acs-0.14/src/d_bjt.c src/d_bjt.c
*** ../acs-0.14/src/d_bjt.c Wed Jul 6 12:11:52 1994
--- src/d_bjt.c Sun Jul 31 23:09:52 1994
***************
*** 1,4 ****
! /* d_bjt.c 93.12.22
* Copyright 1983-1992 Albert Davis
* bjt model.
* this is not really a bjt, but a diode
--- 1,4 ----
! /* d_bjt.c 94.07.18
* Copyright 1983-1992 Albert Davis
* bjt model.
* this is not really a bjt, but a diode
***************
*** 99,106 ****
x = (struct bjt*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt,2);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN);
x->m = (struct qmod*)NULL;
if (isdigit(cmd[*cnt]) || cmd[*cnt] == '.')
x->area = fabs(ctof(cmd,cnt));
--- 99,106 ----
x = (struct bjt*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN, TOKENTERM);
x->m = (struct qmod*)NULL;
if (isdigit(cmd[*cnt]) || cmd[*cnt] == '.')
x->area = fabs(ctof(cmd,cnt));
***************
*** 185,191 ****
m = (struct qmod*)brh->x;
! (void)ctostr(cmd, cnt, brh->label, LABELEN);
skiparg(cmd,cnt); /* skip known "d" */
for (;;){
--- 185,191 ----
m = (struct qmod*)brh->x;
! (void)ctostr(cmd, cnt, brh->label, LABELEN, TOKENTERM);
skiparg(cmd,cnt); /* skip known "d" */
for (;;){
diff -cN ../acs-0.14/src/d_cap.c src/d_cap.c
*** ../acs-0.14/src/d_cap.c Wed Jul 6 12:11:52 1994
--- src/d_cap.c Sun Jul 31 23:09:52 1994
***************
*** 1,4 ****
! /* d_cap.c 94.07.01
* Copyright 1983-1992 Albert Davis
* capacitor models
* two levels: linear (lin) and nonlinear (nl)
--- 1,4 ----
! /* d_cap.c 94.07.25
* Copyright 1983-1992 Albert Davis
* capacitor models
* two levels: linear (lin) and nonlinear (nl)
***************
*** 199,205 ****
if (brh->time3 <= 0.){
return BIGBIG;
}else{
! double factor = 12.; /* 1/coefficient of 3rd der, trapezoid rule */
double dt0 = brh->time0 - brh->time1;
double dt1 = brh->time1 - brh->time2; /* BUG: these values should */
double dt2 = brh->time2 - brh->time3; /* be stored */
--- 199,205 ----
if (brh->time3 <= 0.){
return BIGBIG;
}else{
! double factor = 1./12.; /* coefficient of 3rd der, trapezoid rule */
double dt0 = brh->time0 - brh->time1;
double dt1 = brh->time1 - brh->time2; /* BUG: these values should */
double dt2 = brh->time2 - brh->time3; /* be stored */
***************
*** 229,235 ****
double chargetol = MAX(opt.chgtol,MAX(fabs(q0),fabs(qt1)))
* opt.reltol / dt0;
double tol = MAX(currenttol,chargetol);
! double timestep = opt.trtol * sqrt(factor * tol / fabs(dddqdddt));
if (timestep <= tr->dtmin){
error(bDANGER,"step control error:%s %g\n",printlabel(brh,0),timestep);
--- 229,236 ----
double chargetol = MAX(opt.chgtol,MAX(fabs(q0),fabs(qt1)))
* opt.reltol / dt0;
double tol = MAX(currenttol,chargetol);
! double denom = MAX(opt.abstol, (factor *fabs(dddqdddt))); /* avoid / 0 */
! double timestep = opt.trtol * sqrt(tol / denom);
if (timestep <= tr->dtmin){
error(bDANGER,"step control error:%s %g\n",printlabel(brh,0),timestep);
***************
*** 237,243 ****
error(bTRACE, "it=%g qt=%g tol=%g\n", currenttol, chargetol, tol);
timestep = tr->dtmin;
}
! if (timestep < (brh->time0 - brh->time1) * opt.trreject){
error(bTRACE, "step rejected:%s\n", printlabel(brh,0));
error(bTRACE, "new=%g old=%g rej=%g\n",
timestep, dt0, dt0 * opt.trreject);
--- 238,244 ----
error(bTRACE, "it=%g qt=%g tol=%g\n", currenttol, chargetol, tol);
timestep = tr->dtmin;
}
! if (timestep < dt0 * opt.trreject){
error(bTRACE, "step rejected:%s\n", printlabel(brh,0));
error(bTRACE, "new=%g old=%g rej=%g\n",
timestep, dt0, dt0 * opt.trreject);
diff -cN ../acs-0.14/src/d_coil.c src/d_coil.c
*** ../acs-0.14/src/d_coil.c Wed Jul 6 12:11:52 1994
--- src/d_coil.c Sun Jul 31 23:09:53 1994
***************
*** 1,4 ****
! /* d_coil.c 94.06.23
* Copyright 1983-1992 Albert Davis
* inductors
* two levels: linear (lin) and nonlinear (nl) (not really)
--- 1,4 ----
! /* d_coil.c 94.07.25
* Copyright 1983-1992 Albert Davis
* inductors
* two levels: linear (lin) and nonlinear (nl) (not really)
***************
*** 216,225 ****
/*--------------------------------------------------------------------------*/
static double tr_review_coil(branch_t *brh)
{
! if (brh->time2 <= 0.){
return BIGBIG;
}else{
! double factor = 12.; /* 1/coefficient of 3rd der, trapezoid rule */
double dt0 = brh->time0 - brh->time1;
double dt1 = brh->time1 - brh->time2; /* BUG: these values should */
double dt2 = brh->time2 - brh->time3; /* be stored */
--- 216,225 ----
/*--------------------------------------------------------------------------*/
static double tr_review_coil(branch_t *brh)
{
! if (brh->time3 <= 0.){
return BIGBIG;
}else{
! double factor = 1./12.; /* coefficient of 3rd der, trapezoid rule */
double dt0 = brh->time0 - brh->time1;
double dt1 = brh->time1 - brh->time2; /* BUG: these values should */
double dt2 = brh->time2 - brh->time3; /* be stored */
***************
*** 249,255 ****
double chargetol = MAX(opt.chgtol,MAX(fabs(q0),fabs(qt1)))
* opt.reltol / dt0;
double tol = MAX(currenttol,chargetol);
! double timestep = opt.trtol * sqrt(factor * tol / fabs(dddqdddt));
if (timestep <= tr->dtmin){
error(bDANGER,"step control error:%s %g\n",printlabel(brh,0),timestep);
--- 249,256 ----
double chargetol = MAX(opt.chgtol,MAX(fabs(q0),fabs(qt1)))
* opt.reltol / dt0;
double tol = MAX(currenttol,chargetol);
! double denom = MAX(opt.abstol, (factor *fabs(dddqdddt))); /* avoid / 0 */
! double timestep = opt.trtol * sqrt(tol / denom);
if (timestep <= tr->dtmin){
error(bDANGER,"step control error:%s %g\n",printlabel(brh,0),timestep);
diff -cN ../acs-0.14/src/d_diode.c src/d_diode.c
*** ../acs-0.14/src/d_diode.c Wed Jul 6 12:11:53 1994
--- src/d_diode.c Sun Jul 31 23:09:54 1994
***************
*** 1,4 ****
! /* d_diode.c 94.04.28
* Copyright 1983-1992 Albert Davis
* diode model.
* netlist syntax:
--- 1,4 ----
! /* d_diode.c 94.07.18
* Copyright 1983-1992 Albert Davis
* diode model.
* netlist syntax:
***************
*** 107,114 ****
x = (struct diode*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt,2);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN);
x->m = (struct dmod*)NULL;
if (isdigit(cmd[*cnt]) || cmd[*cnt] == '.')
x->area = fabs(ctof(cmd,cnt));
--- 107,114 ----
x = (struct diode*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN, TOKENTERM);
x->m = (struct dmod*)NULL;
if (isdigit(cmd[*cnt]) || cmd[*cnt] == '.')
x->area = fabs(ctof(cmd,cnt));
***************
*** 193,199 ****
m = (struct dmod*)brh->x;
! (void)ctostr(cmd, cnt, brh->label, LABELEN);
skiparg(cmd,cnt); /* skip known "d" */
(void)skiplparen(cmd,cnt);
for (;;){
--- 193,199 ----
m = (struct dmod*)brh->x;
! (void)ctostr(cmd, cnt, brh->label, LABELEN, TOKENTERM);
skiparg(cmd,cnt); /* skip known "d" */
(void)skiplparen(cmd,cnt);
for (;;){
diff -cN ../acs-0.14/src/d_dot.c src/d_dot.c
*** ../acs-0.14/src/d_dot.c Wed Jul 6 12:11:53 1994
--- src/d_dot.c Sun Jul 31 23:09:54 1994
***************
*** 1,4 ****
! /* d_dot.c 93.12.22
* Copyright 1983-1992 Albert Davis
* processing for DOTCARD netlist item (pseudo-device)
*/
--- 1,4 ----
! /* d_dot.c 94.07.13
* Copyright 1983-1992 Albert Davis
* processing for DOTCARD netlist item (pseudo-device)
*/
***************
*** 69,75 ****
newbrh = brh;
labelcnt = *cnt;
! (void)ctostr(cmd, cnt, brh->label, LABELEN);
setmatch(cmd,cnt);
if (rematch("D" )) newbrh = create_branch(&model_diode);
else if (rematch("NPn" )) newbrh = create_branch(&model_bjt);
--- 69,75 ----
newbrh = brh;
labelcnt = *cnt;
! (void)ctostr(cmd, cnt, brh->label, LABELEN, TOKENTERM);
setmatch(cmd,cnt);
if (rematch("D" )) newbrh = create_branch(&model_diode);
else if (rematch("NPn" )) newbrh = create_branch(&model_bjt);
***************
*** 79,84 ****
--- 79,85 ----
else if (rematch("NMos")) newbrh = create_branch(&model_mos);
else if (rematch("PMos")) newbrh = create_branch(&model_mos);
else if (rematch("Logic")) newbrh = create_branch(&model_logic);
+ else if (rematch("SW")) newbrh = create_branch(&model_vswtch);
else newbrh = create_branch(&model_subckt);
if (newbrh != brh){
*brh = *newbrh;
diff -cN ../acs-0.14/src/d_logic.c src/d_logic.c
*** ../acs-0.14/src/d_logic.c Wed Jul 6 12:11:54 1994
--- src/d_logic.c Sun Jul 31 23:09:54 1994
***************
*** 1,4 ****
! /* d_logic.c 94.05.30
* Copyright 1983-1992 Albert Davis
* logic model.
*/
--- 1,4 ----
! /* d_logic.c 94.07.22
* Copyright 1983-1992 Albert Davis
* logic model.
*/
***************
*** 129,136 ****
x = (struct logic*)brh->x;
parselabel(brh,cmd,cnt);
! x->incount = parsenodes(brh,cmd,cnt,PORTSPERGATE);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN);
if (argparse(cmd,cnt,ONEPASS,
"AND", aENUM, &x->type, lAND,
"NAND", aENUM, &x->type, lNAND,
--- 129,136 ----
x = (struct logic*)brh->x;
parselabel(brh,cmd,cnt);
! x->incount = parsenodes(brh,cmd,cnt);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN, TOKENTERM);
if (argparse(cmd,cnt,ONEPASS,
"AND", aENUM, &x->type, lAND,
"NAND", aENUM, &x->type, lNAND,
***************
*** 176,182 ****
struct lmod *m;
m = (struct lmod*)brh->x;
! (void)ctostr(cmd, cnt, brh->label, LABELEN);
skiparg(cmd,cnt); /* skip known "logic" */
(void)skiplparen(cmd,cnt);
for (;;){
--- 176,182 ----
struct lmod *m;
m = (struct lmod*)brh->x;
! (void)ctostr(cmd, cnt, brh->label, LABELEN, TOKENTERM);
skiparg(cmd,cnt); /* skip known "logic" */
(void)skiplparen(cmd,cnt);
for (;;){
***************
*** 276,284 ****
m = x->m;
n = &(nstat[brh->n[1].m]);
! if ((x->gatemode == mANALOG)
|| (opt.mode == mMIXED && sim_phase == pINIT_DC)
! || (opt.mode == mANALOG)){
x->gatemode = n->nodemode = mANALOG;
return brh->converged = tr_fill_rl(brh->subckt);
}
--- 276,284 ----
m = x->m;
n = &(nstat[brh->n[1].m]);
! if (brh->subckt && ((x->gatemode == mANALOG)
|| (opt.mode == mMIXED && sim_phase == pINIT_DC)
! || (opt.mode == mANALOG))){
x->gatemode = n->nodemode = mANALOG;
return brh->converged = tr_fill_rl(brh->subckt);
}
***************
*** 289,296 ****
brh->bypass = YES;
x->gatemode = n->nodemode = mDIGITAL;
! /* in transition */
! if (trtime0 >= n->finaltime){ /* time to propagate */
brh->bypass = NO;
n->lv0 = n->lv1;
n->ls0 = n->ls1;
--- 289,301 ----
brh->bypass = YES;
x->gatemode = n->nodemode = mDIGITAL;
!
! if (sim_phase == pINIT_DC){
! (void)tr_review_logic(brh);
! n->finaltime = 0.;
! }
!
! if (trtime0 >= n->finaltime){ /* in transition, time to propagate */
brh->bypass = NO;
n->lv0 = n->lv1;
n->ls0 = n->ls1;
***************
*** 469,475 ****
/* count == number of connections, now const */
/* if lastchangenode == 1, no new changes, bypass */
! if ((opt.mode == mANALOG) || (opt.mode == mMIXED && quality != qGOOD)){
if (x->gatemode == mDIGITAL){
error(bTRACE, "%s:%u:%g switch to analog (review), %s\n",
printlabel(brh,0), stats.iter[iTOTAL], trtime0, failuremode);
--- 474,481 ----
/* count == number of connections, now const */
/* if lastchangenode == 1, no new changes, bypass */
! if (brh->subckt &&
! ((opt.mode == mANALOG) || (opt.mode == mMIXED && quality != qGOOD))){
if (x->gatemode == mDIGITAL){
error(bTRACE, "%s:%u:%g switch to analog (review), %s\n",
printlabel(brh,0), stats.iter[iTOTAL], trtime0, failuremode);
diff -cN ../acs-0.14/src/d_mos.c src/d_mos.c
*** ../acs-0.14/src/d_mos.c Wed Jul 6 12:11:54 1994
--- src/d_mos.c Sun Jul 31 23:09:55 1994
***************
*** 1,4 ****
! /* d_mos.c 94.05.27
* Copyright 1983-1992 Albert Davis
* mos model basics
* netlist syntax:
--- 1,4 ----
! /* d_mos.c 94.07.29
* Copyright 1983-1992 Albert Davis
* mos model basics
* netlist syntax:
***************
*** 39,45 ****
extern const int inc_mode; /* make incremental changes */
extern const int sim_mode;
extern const int bypass_ok;
- extern const int *nm;
extern struct nodestuff ns;
extern const struct options opt;
extern const struct status stats;
--- 39,44 ----
***************
*** 148,155 ****
x = (struct mos*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt,4);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN);
x->m = (struct mmod*)NULL;
if (isdigit(cmd[*cnt]) || cmd[*cnt] == '.'){
x->wo = fabs(ctof(cmd,cnt)) * SCALE;
--- 147,154 ----
x = (struct mos*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN, TOKENTERM);
x->m = (struct mmod*)NULL;
if (isdigit(cmd[*cnt]) || cmd[*cnt] == '.'){
x->wo = fabs(ctof(cmd,cnt)) * SCALE;
***************
*** 235,241 ****
m = (struct mmod*)brh->x;
! (void)ctostr(cmd, cnt, brh->label, LABELEN);
if (argparse(cmd,cnt,ONEPASS,
"NMos", aENUM, &m->polarity, pN,
"PMos", aENUM, &m->polarity, pP,
--- 234,240 ----
m = (struct mmod*)brh->x;
! (void)ctostr(cmd, cnt, brh->label, LABELEN, TOKENTERM);
if (argparse(cmd,cnt,ONEPASS,
"NMos", aENUM, &m->polarity, pN,
"PMos", aENUM, &m->polarity, pP,
diff -cN ../acs-0.14/src/d_subckt.c src/d_subckt.c
*** ../acs-0.14/src/d_subckt.c Wed Jul 6 12:11:57 1994
--- src/d_subckt.c Sun Jul 31 23:09:59 1994
***************
*** 1,4 ****
! /* d_subckt.c 94.01.01
* Copyright 1983-1992 Albert Davis
* subcircuit stuff
* netlist syntax:
--- 1,4 ----
! /* d_subckt.c 94.07.18
* Copyright 1983-1992 Albert Davis
* subcircuit stuff
* netlist syntax:
***************
*** 139,146 ****
x = (struct subckt*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt,PORTSPERSUBCKT);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN);
}
/*--------------------------------------------------------------------------*/
static void print_subckt(const branch_t *brh, int where, int detail)
--- 139,146 ----
x = (struct subckt*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt);
! (void)ctostr(cmd, cnt, x->modelname, LABELEN, TOKENTERM);
}
/*--------------------------------------------------------------------------*/
static void print_subckt(const branch_t *brh, int where, int detail)
***************
*** 185,192 ****
if (nestlevel >= RECURSE)
error(bERROR,"%s: subckt nesting too deep\n", printlabel(brh,NO));
! (void)ctostr(cmd, cnt, brh->label, LABELEN);
! (void)parsenodes(brh,cmd,cnt,PORTSPERSUBCKT);
strcpy(namestack[nestlevel], brh->label);
neststack[nestlevel] = insertbefore;
--- 185,192 ----
if (nestlevel >= RECURSE)
error(bERROR,"%s: subckt nesting too deep\n", printlabel(brh,NO));
! (void)ctostr(cmd, cnt, brh->label, LABELEN, TOKENTERM);
! (void)parsenodes(brh,cmd,cnt);
strcpy(namestack[nestlevel], brh->label);
neststack[nestlevel] = insertbefore;
diff -cN ../acs-0.14/src/d_trln.c src/d_trln.c
*** ../acs-0.14/src/d_trln.c Wed Jul 6 12:11:58 1994
--- src/d_trln.c Sun Jul 31 23:09:55 1994
***************
*** 55,61 ****
x = (struct trnlin*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt,4);
for (;;){
if (argparse(cmd,cnt,REPEAT,
"Z", a2DOUBLE, &x->z0, &x->z0,
--- 55,61 ----
x = (struct trnlin*)brh->x;
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt);
for (;;){
if (argparse(cmd,cnt,REPEAT,
"Z", a2DOUBLE, &x->z0, &x->z0,
diff -cN ../acs-0.14/src/d_vswtch.c src/d_vswtch.c
*** ../acs-0.14/src/d_vswtch.c
--- src/d_vswtch.c Sun Jul 31 23:10:00 1994
***************
*** 0 ****
--- 1,267 ----
+ /* d_vswtch.c 94.07.23
+ * Copyright 1994 Albert Davis
+ * voltage controlled switch model.
+ * netlist syntax:
+ * device: sxxxx n+ n- mname <on>|<off> <model-card-args>
+ * model: .model mname SW <args>
+ */
+ #include "ecah.h"
+ #include "argparse.h"
+ #include "branch.h"
+ #include "d_vswtch.h"
+ #include "error.h"
+ #include "mode.h"
+ #include "status.h"
+ #include "types.h"
+ #include "declare.h"
+ /*--------------------------------------------------------------------------*/
+ static void parse_vswtch(branch_t*,const char*,int*);
+ static void print_vswtch(const branch_t*,int,int);
+ static branch_t *create_model_vswtch(const functions_t*);
+ static branch_t *copy_model_vswtch(const branch_t*);
+ static void parse_model_vswtch(branch_t*,const char*,int*);
+ static void print_model_vswtch(const branch_t*,int,int);
+ static void expand_vswtch(branch_t*);
+ static int tr_vswtch(branch_t*);
+ static void ac_vswtch(branch_t*);
+ /*--------------------------------------------------------------------------*/
+ extern const int sim_phase;
+ extern const struct status stats;
+ static struct vswtch defalt = {(generic_t*)NULL, sizeof(struct vswtch),
+ (struct vswtchmod*)NULL, vswDEFDEV_modelname, vswDEFDEV_ic, /*more*/};
+ static struct vswtchmod defaltmodel = {(generic_t*)NULL,
+ sizeof(struct vswtchmod), vswDEFMOD_vt, vswDEFMOD_vh, vswDEFMOD_ron,
+ vswDEFMOD_roff};
+ static branch_t modellist = {(generic_t*)&defaltmodel, sizeof(branch_t),
+ &model_vswtch, &modellist, &modellist, &modellist, &modellist,
+ (branch_t*)NULL, (branch_t*)NULL, vswDEFMOD_modelname, /*more*/};
+ /*--------------------------------------------------------------------------*/
+ functions_t dev_vswtch = {
+ (generic_t*)&defalt, /* x */
+ sizeof(functions_t), /* ssize */
+ sizeof(branch_t), /* elementsize */
+ (functions_t*)NULL, /* super */
+ 4, /* numnodes */
+ rnTWOPORT, /* refnode */
+ rnONEPORT, /* isdevice */
+ create_std, /* create */
+ copy_std, /* copy */
+ parse_vswtch, /* parse */
+ print_vswtch, /* print */
+ expand_vswtch, /* expand */
+ probe_std, /* probe */
+ tr_vswtch, /* dotr */
+ unloadpassive, /* untr */
+ ac_vswtch, /* doac */
+ NULL, /* trfun1 */
+ NULL, /* trfun0 */
+ NULL, /* acfun */
+ NULL, /* tr_guess */
+ NULL, /* tr_advance */
+ NULL /* tr_review */
+ };
+ functions_t model_vswtch = {
+ (generic_t*)&defaltmodel, /* x */
+ sizeof(functions_t), /* ssize */
+ sizeof(branch_t), /* elementsize */
+ (functions_t*)NULL, /* super */
+ 0, /* numnodes */
+ rnMODEL, /* refnode */
+ NO, /* isdevice */
+ create_model_vswtch, /* create */
+ copy_model_vswtch, /* copy */
+ parse_model_vswtch, /* parse */
+ print_model_vswtch, /* print */
+ NULL, /* expand */
+ NULL, /* probe */
+ NULL, /* dotr */
+ NULL, /* untr */
+ NULL, /* doac */
+ NULL, /* trfun1 */
+ NULL, /* trfun0 */
+ NULL, /* acfun */
+ NULL, /* tr_guess */
+ NULL, /* tr_advance */
+ NULL /* tr_review */
+ };
+ /*--------------------------------------------------------------------------*/
+ static void parse_vswtch(branch_t *brh, const char *cmd, int *cnt)
+ {
+ struct vswtch *x;
+
+ x = (struct vswtch*)brh->x;
+
+ parselabel(brh,cmd,cnt);
+ (void)parsenodes(brh,cmd,cnt);
+ (void)ctostr(cmd, cnt, x->modelname, LABELEN, TOKENTERM);
+ x->m = (struct vswtchmod*)NULL;
+ for (;;){
+ if (argparse(cmd,cnt,REPEAT,
+ "OFF", aENUM, &x->ic, swOFF,
+ "ON", aENUM, &x->ic, swON,
+ ""))
+ ;
+ else{
+ syntax_check(cmd,cnt,bWARNING);
+ break;
+ }
+ }
+ }
+ /*--------------------------------------------------------------------------*/
+ static void print_vswtch(const branch_t *brh, int where, int detail)
+ {
+ const struct vswtch *x;
+
+ x = (const struct vswtch*)brh->x;
+
+ (void)printlabel(brh,where);
+ printnodes(brh,where);
+ mprintf(where, " %s ", x->modelname);
+
+ if (x->ic == swOFF)
+ mprintf(where, " off ");
+ else if (x->ic == swON)
+ mprintf(where, " on ");
+ /* else (x->ic == swUNKNOWN) */
+ mprintf(where, "\n");
+ }
+ /*--------------------------------------------------------------------------*/
+ static branch_t *create_model_vswtch(const functions_t *func)
+ {
+ branch_t *brh;
+
+ brh = create_std(func);
+ brh->stprev = &modellist;
+ return brh;
+ }
+ /*--------------------------------------------------------------------------*/
+ static branch_t *copy_model_vswtch(const branch_t *proto)
+ {
+ branch_t *brh;
+
+ brh = copy_std(proto);
+ brh->stprev = &modellist;
+ return brh;
+ }
+ /*--------------------------------------------------------------------------*/
+ static void parse_model_vswtch(branch_t *brh, const char *cmd, int *cnt)
+ {
+ struct vswtchmod *m;
+
+ m = (struct vswtchmod*)brh->x;
+
+ (void)ctostr(cmd, cnt, brh->label, LABELEN, TOKENTERM);
+ skiparg(cmd,cnt); /* skip known "sw" */
+ (void)skiplparen(cmd,cnt);
+ for (;;){
+ if (argparse(cmd,cnt,REPEAT,
+ "VT", aDOUBLE, &m->vt,
+ "VH", aUDOUBLE, &m->vh,
+ "RON", aDOUBLE, &m->ron,
+ "ROFF", aDOUBLE, &m->roff,
+ ""))
+ ;
+ else{
+ (void)skiprparen(cmd,cnt);
+ syntax_check(cmd,cnt,bWARNING);
+ break;
+ }
+ }
+ }
+ /*--------------------------------------------------------------------------*/
+ static void print_model_vswtch(const branch_t *brh, int where, int detail)
+ {
+ const struct vswtchmod *m;
+ m = (const struct vswtchmod*)brh->x;
+
+ mprintf(where, ".model %s sw (", brh->label);
+ mprintf(where, " vt=%s ", ftos(m->vt, "", 7, 0));
+ mprintf(where, " vh=%s ", ftos(m->vh, "", 7, 0));
+ mprintf(where, " ron=%s ", ftos(m->ron, "", 7, 0));
+ mprintf(where, " roff=%s ", ftos(m->roff, "", 7, 0));
+ mprintf(where, ")\n");
+ }
+ /*--------------------------------------------------------------------------*/
+ static void expand_vswtch(branch_t *brh)
+ {
+ struct vswtch *x;
+ const struct vswtchmod *m;
+
+ expandgeneric(brh,&modellist);
+ x = (struct vswtch*)brh->x;
+ m = x->m;
+ brh->val = m->ron;
+ brh->y0.f0 = LINEAR;
+ if (x->ic == swON){
+ brh->y0.f1 = m->ron;
+ }else{ /* unknown is off */
+ brh->y0.f1 = m->roff;
+ }
+ x->previous_state = x->current_state = x->ic;
+ brh->m0.f1 = 1./brh->y0.f1;
+ brh->m0.c0 = 0.;
+ brh->ev.x = brh->y0.f1;
+ brh->ev.y = 0.;
+ brh->acg.x = brh->m0.f1;
+ brh->acg.y = 0.;
+ brh->nodamp = YES;
+ }
+ /*--------------------------------------------------------------------------*/
+ static int tr_vswtch(branch_t *brh)
+ {
+ struct vswtch *x;
+ const struct vswtchmod *m;
+ double control;
+ int new_state;
+
+ x = (struct vswtch*)brh->x;
+ m = x->m;
+
+ if (stats.iter[iSTEP] <= 1){
+ if (sim_phase == pINIT_DC){
+ if (x->ic == swON){
+ brh->y0.f1 = m->ron;
+ }else{
+ brh->y0.f1 = m->roff;
+ }
+ x->current_state = x->ic;
+ brh->m0.f1 = 1./brh->y0.f1;
+ }
+ x->previous_state = x->current_state;
+ }
+
+ control = tr_volts(&(brh->n[IN1]),&(brh->n[IN2]));
+ if (control > m->vt + m->vh){
+ new_state = swON;
+ }else if (control < m->vt - m->vh){
+ new_state = swOFF;
+ }else{
+ new_state = x->previous_state;
+ }
+
+ if (new_state != x->current_state){
+ if (new_state == swON){
+ brh->y0.f1 = m->ron;
+ }else{
+ brh->y0.f1 = m->roff;
+ }
+ x->current_state = new_state;
+ brh->m0.f1 = 1./brh->y0.f1;
+ trloadpassive(brh);
+ return NO;
+ }else{
+ trloadpassive(brh);
+ return YES;
+ }
+ }
+ /*--------------------------------------------------------------------------*/
+ static void ac_vswtch(branch_t *brh)
+ {
+ brh->ev.x = brh->y0.f1;
+ brh->ev.y = 0.;
+ brh->acg.x = brh->m0.f1;
+ brh->acg.y = 0.;
+ acloadpassivereal(brh);
+ }
+ /*--------------------------------------------------------------------------*/
+ /*--------------------------------------------------------------------------*/
diff -cN ../acs-0.14/src/d_vswtch.h src/d_vswtch.h
*** ../acs-0.14/src/d_vswtch.h
--- src/d_vswtch.h Sun Jul 31 23:09:40 1994
***************
*** 0 ****
--- 1,37 ----
+ /* d_vswtch.h 94.07.13
+ * Copyright 1994 Albert Davis
+ * data structures for voltage controlled switch
+ */
+ #define vswDEFMOD_modelname "-sw-"
+ #define vswDEFMOD_vt 0.0
+ #define vswDEFMOD_vh 0.0
+ #define vswDEFMOD_ron 1.0
+ #define vswDEFMOD_roff 1e+12
+
+ #define vswDEFDEV_modelname vswDEFMOD_modelname
+ #define vswDEFDEV_ic swUNKNOWN
+
+ #define swUNKNOWN 0
+ #define swON 1
+ #define swOFF -1
+
+ struct vswtch {
+ generic_t *x; /* (not used) */
+ size_t ssize;
+ const struct vswtchmod *m; /* model params */
+ char modelname[LABELEN+1];
+ int ic; /* initial state */
+ int current_state; /* state 1 iter ago (may be bad) */
+ int previous_state; /* state 1 time or step ago (known good) */
+ };
+
+ struct vswtchmod {
+ generic_t *x; /* owned expansion stuff (not used) */
+ size_t ssize; /* spice2 parameters */
+ double vt; /* threshold voltage */
+ double vh; /* hysteresis voltage */
+ double ron; /* on resistance */
+ double roff; /* off resistance */
+ };
+
+
diff -cN ../acs-0.14/src/dc_setup.c src/dc_setup.c
*** ../acs-0.14/src/dc_setup.c Wed Jul 6 12:11:50 1994
--- src/dc_setup.c Sun Jul 31 23:09:50 1994
***************
*** 1,4 ****
! /* dc_setup.c 93.12.19
* Copyright 1983-1992 Albert Davis
* dc analysis setup
*/
--- 1,4 ----
! /* dc_setup.c 94.07.29
* Copyright 1983-1992 Albert Davis
* dc analysis setup
*/
***************
*** 131,137 ****
;
else if (isfloat(cmd[*cnt]))
dcoptby(cmd,cnt);
! else if (outset(cmd,cnt,(char*)NULL,((sim_mode==sOP)?"bi ":"dc ")))
;
else{
syntax_check(cmd,cnt,bWARNING);
--- 131,137 ----
;
else if (isfloat(cmd[*cnt]))
dcoptby(cmd,cnt);
! else if (outset(cmd,cnt,"",""))
;
else{
syntax_check(cmd,cnt,bWARNING);
diff -cN ../acs-0.14/src/declare.h src/declare.h
*** ../acs-0.14/src/declare.h Wed Jul 6 12:11:38 1994
--- src/declare.h Sun Jul 31 23:09:40 1994
***************
*** 1,4 ****
! /* declare 94.05.06
* Copyright 1983-1992 Albert Davis
* declarations for type checking
*/
--- 1,4 ----
! /* declare 94.07.15
* Copyright 1983-1992 Albert Davis
* declarations for type checking
*/
***************
*** 61,67 ****
/* crtset */ void cmd_crtset(const char*,int*);
int testcrt(void);
struct graph *initcrt(void);
! /* ctostr */ char *ctostr(const char*,int*,char*,int);
/* ctof */ double ctof(const char*,int*);
double x10(int);
/* ctoi */ int ctoi(const char*,int*);
--- 61,67 ----
/* crtset */ void cmd_crtset(const char*,int*);
int testcrt(void);
struct graph *initcrt(void);
! /* ctostr */ char *ctostr(const char*,int*,char*,int,const char*);
/* ctof */ double ctof(const char*,int*);
double x10(int);
/* ctoi */ int ctoi(const char*,int*);
***************
*** 130,136 ****
/* insert */ void cmd_insert(const char*,int*);
/* ipow */ double ipow(double,int);
/* isfloat */ int isfloat(int);
! /* isterm */ int isterm(int);
/* itos */ char *itos(int,char*,int,int);
/* line */ void initgraph(struct graph*);
void stext(int,int,const char*,int);
--- 130,136 ----
/* insert */ void cmd_insert(const char*,int*);
/* ipow */ double ipow(double,int);
/* isfloat */ int isfloat(int);
! /* isterm */ int isterm(int,const char*);
/* itos */ char *itos(int,char*,int,int);
/* line */ void initgraph(struct graph*);
void stext(int,int,const char*,int);
***************
*** 151,157 ****
void cmd_unfault(void);
/* nodes */ int newnode_subckt(void);
int newnode_model(void);
! int parsenodes(branch_t*,const char*,int*,int);
void printnodes(const branch_t*,int);
/* nodeset */ void cmd_ic(const char*,int*);
void cmd_nodeset(const char*,int*);
--- 151,157 ----
void cmd_unfault(void);
/* nodes */ int newnode_subckt(void);
int newnode_model(void);
! int parsenodes(branch_t*,const char*,int*);
void printnodes(const branch_t*,int);
/* nodeset */ void cmd_ic(const char*,int*);
void cmd_nodeset(const char*,int*);
diff -cN ../acs-0.14/src/dev.c src/dev.c
*** ../acs-0.14/src/dev.c Wed Jul 6 12:11:51 1994
--- src/dev.c Sun Jul 31 23:09:51 1994
***************
*** 1,4 ****
! /* dev.c 94.07.03
* Copyright 1983-1992 Albert Davis
* top level device functions that call the specific one and
* standard device functions to be used where nothing else is needed
--- 1,4 ----
! /* dev.c 94.07.15
* Copyright 1983-1992 Albert Davis
* top level device functions that call the specific one and
* standard device functions to be used where nothing else is needed
***************
*** 149,155 ****
void parse_std(branch_t *brh, const char *cmd, int *cnt)
{
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt,brh->f->numnodes);
parseexpr(brh,cmd,cnt);
if (brh->f->super)
brh->f = brh->f->super;
--- 149,155 ----
void parse_std(branch_t *brh, const char *cmd, int *cnt)
{
parselabel(brh,cmd,cnt);
! (void)parsenodes(brh,cmd,cnt);
parseexpr(brh,cmd,cnt);
if (brh->f->super)
brh->f = brh->f->super;
***************
*** 160,166 ****
*/
void parselabel(branch_t *brh, const char *cmd, int *cnt)
{
! (void)ctostr(cmd, cnt, brh->label, LABELEN);
brh->label[0] = to_upper(brh->label[0]);
}
/*--------------------------------------------------------------------------*/
--- 160,166 ----
*/
void parselabel(branch_t *brh, const char *cmd, int *cnt)
{
! (void)ctostr(cmd, cnt, brh->label, LABELEN, TOKENTERM);
brh->label[0] = to_upper(brh->label[0]);
}
/*--------------------------------------------------------------------------*/
***************
*** 315,329 ****
double i0 = (brh->m0.f1 * brh->m0.x + brh->m0.c0);
double it1 = (brh->mt1.f1 * brh->mt1.x + brh->mt1.c0);
return (i0 - it1) / (brh->time0 - brh->time1);
- #ifdef KEEP_OLD_TIME_INFO
- }else if (rematch("DDIddt")){
- double i0 = (brh->m0.f1 * brh->m0.x + brh->m0.c0);
- double it1 = (brh->mt1.f1 * brh->mt1.x + brh->mt1.c0);
- double it2 = (brh->mt2.f1 * brh->mt2.x + brh->mt2.c0);
- double didt0 = (i0 - it1) / (brh->time0 - brh->time1);
- double didt1 = (it1 - it2) / (brh->time1 - brh->time2);
- return 2. * (didt0 - didt1) / (brh->time0 - brh->time2);
- #endif
}else if (rematch("DTNew")){
return brh->timef - brh->time0;
}else if (rematch("DTOld")){
--- 315,320 ----
diff -cN ../acs-0.14/src/ecah.h src/ecah.h
*** ../acs-0.14/src/ecah.h Wed Jul 6 12:11:39 1994
--- src/ecah.h Sun Jul 31 23:09:40 1994
***************
*** 1,4 ****
! /* ecah.h 94.04.29
* Copyright 1983-1992 Albert Davis
* define assorted stuff
*/
--- 1,4 ----
! /* ecah.h 94.07.13
* Copyright 1983-1992 Albert Davis
* define assorted stuff
*/
***************
*** 27,32 ****
--- 27,33 ----
#define DBVOLTMIN (20.*log10(VOLTMIN))
#define PWRMIN (1.0e-100)
#define DBPWRMIN (10.*log10(PWRMIN))
+ #define TOKENTERM ",=()[]"
#define YES (1)
#define NO (0)
diff -cN ../acs-0.14/src/fanout.c src/fanout.c
*** ../acs-0.14/src/fanout.c Wed Jul 6 12:12:01 1994
--- src/fanout.c Sun Jul 31 23:10:01 1994
***************
*** 1,4 ****
! /* fanout.c 93.12.19
* Copyright 1983-1992 Albert Davis
* Prints out a list of all node connections.
*/
--- 1,4 ----
! /* fanout.c 94.07.29
* Copyright 1983-1992 Albert Davis
* Prints out a list of all node connections.
*/
***************
*** 41,47 ****
skipbl(cmd,cnt);
if (isdigit(cmd[*cnt]))
stop = ctoi(cmd,cnt);
! }else if (outset(cmd,cnt,(char*)NULL," ")){
/*nothing*/;
}else{
syntax_check(cmd,cnt,bWARNING);
--- 41,47 ----
skipbl(cmd,cnt);
if (isdigit(cmd[*cnt]))
stop = ctoi(cmd,cnt);
! }else if (outset(cmd,cnt,"","")){
/*nothing*/;
}else{
syntax_check(cmd,cnt,bWARNING);
diff -cN ../acs-0.14/src/fft.c src/fft.c
*** ../acs-0.14/src/fft.c Wed Jul 6 12:12:02 1994
--- src/fft.c Sun Jul 31 23:10:01 1994
***************
*** 1,4 ****
! /* fft.c 93.12.19
* Copyright 1983-1992 Albert Davis
* fast fourier transform
*/
--- 1,4 ----
! /* fft.c 94.07.23
* Copyright 1983-1992 Albert Davis
* fast fourier transform
*/
***************
*** 15,21 ****
double wpwr, arg;
s = (inv) ? 1 : -1;
! for (nxp=n ; (nxp2=nxp/2) ; nxp=nxp2){
wpwr = kPIx2 / nxp;
for (m=0 ; m<nxp2 ; m++){
register int j1, j2;
--- 15,21 ----
double wpwr, arg;
s = (inv) ? 1 : -1;
! for (nxp=n ; (nxp2=nxp/2) > 0 ; nxp=nxp2){
wpwr = kPIx2 / nxp;
for (m=0 ; m<nxp2 ; m++){
register int j1, j2;
diff -cN ../acs-0.14/src/file.c src/file.c
*** ../acs-0.14/src/file.c Wed Jul 6 12:12:02 1994
--- src/file.c Sun Jul 31 23:10:02 1994
***************
*** 1,4 ****
! /* file.c 93.12.19
* Copyright 1983-1992 Albert Davis
* route output to & from files, get command
*/
--- 1,4 ----
! /* file.c 94.07.29
* Copyright 1983-1992 Albert Davis
* route output to & from files, get command
*/
***************
*** 41,47 ****
++*cnt;
skipbl(cmd,cnt);
}
! files[nest] = xopen(cmd,cnt,"eca",access);
if (files[nest]){
mlog |= 1<<fileno(files[nest]);
nest++;
--- 41,47 ----
++*cnt;
skipbl(cmd,cnt);
}
! files[nest] = xopen(cmd,cnt,"",access);
if (files[nest]){
mlog |= 1<<fileno(files[nest]);
nest++;
***************
*** 82,88 ****
++*cnt;
skipbl(cmd,cnt);
}
! files[nest] = xopen(cmd,cnt," ",access);
if (files[nest]){
mout |= 1<<fileno(files[nest]);
io.mstdout |= 1<<fileno(files[nest]);
--- 82,88 ----
++*cnt;
skipbl(cmd,cnt);
}
! files[nest] = xopen(cmd,cnt,"",access);
if (files[nest]){
mout |= 1<<fileno(files[nest]);
io.mstdout |= 1<<fileno(files[nest]);
diff -cN ../acs-0.14/src/findbr.c src/findbr.c
*** ../acs-0.14/src/findbr.c Wed Jul 6 12:12:02 1994
--- src/findbr.c Sun Jul 31 23:10:02 1994
***************
*** 1,4 ****
! /* findbr.c 94.01.02
* Copyright 1983-1992 Albert Davis
* find a branch with matching label
* returns the branch pointer
--- 1,4 ----
! /* findbr.c 94.07.13
* Copyright 1983-1992 Albert Davis
* find a branch with matching label
* returns the branch pointer
***************
*** 30,36 ****
char *wanted;
save = *cnt; /* copy the name to local space */
! (void)ctostr(cmd, cnt, labelwanted, BUFLEN);
if (!labelwanted[1]){
*cnt = save; /* don't match single letter */
--- 30,36 ----
char *wanted;
save = *cnt; /* copy the name to local space */
! (void)ctostr(cmd, cnt, labelwanted, BUFLEN, TOKENTERM);
if (!labelwanted[1]){
*cnt = save; /* don't match single letter */
***************
*** 50,56 ****
brh = start;
do {
int dummy = 0;
! (void)ctostr( brh->label, &dummy, thislabel, BUFLEN );
if (wmatch(wanted,thislabel)){
if (!dot){ /* found it */
return (branch_t*)brh;
--- 50,56 ----
brh = start;
do {
int dummy = 0;
! (void)ctostr( brh->label, &dummy, thislabel, BUFLEN, TOKENTERM );
if (wmatch(wanted,thislabel)){
if (!dot){ /* found it */
return (branch_t*)brh;
diff -cN ../acs-0.14/src/findfile.c src/findfile.c
*** ../acs-0.14/src/findfile.c Wed Jul 6 12:12:03 1994
--- src/findfile.c Sun Jul 31 23:10:02 1994
***************
*** 1,4 ****
! /* findfile.c 93.12.19
* Modified by AD. Sent to me by C-WARE
* This file contains the routine to locate a file,
* using a path string for the directories to search.
--- 1,4 ----
! /* findfile.c 94.07.13
* Modified by AD. Sent to me by C-WARE
* This file contains the routine to locate a file,
* using a path string for the directories to search.
***************
*** 34,41 ****
t_ptr = target_buf; /* copy the directory name */
while (*p_ptr != PATHSEP && *p_ptr != '\0')
*t_ptr++ = *p_ptr++;
! if (t_ptr != target_buf && t_ptr[-1] != '/' && t_ptr[-1] != '\\')
! *t_ptr++ = '/'; /* append '/' if needed */
*t_ptr = '\0';
strcat(target_buf, filename);
--- 34,41 ----
t_ptr = target_buf; /* copy the directory name */
while (*p_ptr != PATHSEP && *p_ptr != '\0')
*t_ptr++ = *p_ptr++;
! if (t_ptr != target_buf && !strchr(ENDDIR,t_ptr[-1]))
! *t_ptr++ = *ENDDIR; /* append '/' if needed */
*t_ptr = '\0';
strcat(target_buf, filename);
diff -cN ../acs-0.14/src/getckt.c src/getckt.c
*** ../acs-0.14/src/getckt.c Wed Jul 6 12:12:04 1994
--- src/getckt.c Sun Jul 31 23:10:03 1994
***************
*** 1,4 ****
! /* getckt.c 93.12.19
* Copyright 1983-1992 Albert Davis
* build, get, merge, "<" commands
* process circuit files, and keyboard entry
--- 1,4 ----
! /* getckt.c 94.07.29
* Copyright 1983-1992 Albert Davis
* build, get, merge, "<" commands
* process circuit files, and keyboard entry
***************
*** 116,122 ****
stats.iter[iTOTAL] = 1;
dealloc(YES);
xclose(&filen);
! filen = xopen(cmd,cnt,"ckt","r");
if (!filen)
error(bERROR, "");
--- 116,122 ----
stats.iter[iTOTAL] = 1;
dealloc(YES);
xclose(&filen);
! filen = xopen(cmd,cnt,"","r");
if (!filen)
error(bERROR, "");
***************
*** 167,196 ****
static branch_t *parsebranch(char *buffer, int alwaysdupcheck)
{
branch_t *brh; /* place for cparse to return data */
- branch_t *old; /* possible replace this one */
branch_t *before; /* actually insert here */
before = insertbefore; /* save insert place in case something like */
/* a subckt changes it */
! brh = cparse(buffer); /* parse it */
if (exists(brh)){
! if (opt.dupcheck || alwaysdupcheck){
! int dummy; /* string index for parse package */
! dummy = 0;
! old = findbranch(brh->label, &dummy, insertbefore, insertbefore->prev);
! if (exists(old)){ /* already exists, replace it */
! error(bWARNING, "replacing: %s\n", brh->label);
! brh->next = old->next; /* set link so new is in same */
! (void)deletebranch(old); /* place, then delete. */
! }else{
! brh->next = before;
! }
! }else{
brh->next = before;
}
- brh = insertbranch(brh);
}
if (isdevice(brh)){
dealloc(YES);
}
--- 167,195 ----
static branch_t *parsebranch(char *buffer, int alwaysdupcheck)
{
branch_t *brh; /* place for cparse to return data */
branch_t *before; /* actually insert here */
+ brh = (branch_t*)NULL;
before = insertbefore; /* save insert place in case something like */
/* a subckt changes it */
! if (opt.dupcheck || alwaysdupcheck){
! int dummy = 0;
! brh = findbranch(buffer, &dummy, insertbefore, insertbefore->prev);
! }
!
if (exists(brh)){
! int dummy = 0;
! error(bWARNING, "replacing: %s\n", brh->label);
! parse_branch(brh,buffer,&dummy);
! }else{
! brh = cparse(buffer);
! if (exists(brh)){
brh->next = before;
+ brh = insertbranch(brh);
}
}
+
if (isdevice(brh)){
dealloc(YES);
}
***************
*** 237,243 ****
case 'P': syntax_msg(cmd,cnt,bWARNING); break;
case 'Q': brh = create_branch(&dev_bjt); break;
case 'R': brh = create_branch(&dev_resistor); break;
! case 'S': syntax_msg(cmd,cnt,bWARNING); break;
case 'T': brh = create_branch(&dev_trnlin); break;
case 'U': brh = create_branch(&dev_logic); break;
case 'V': brh = create_branch(&dev_vs); break;
--- 236,242 ----
case 'P': syntax_msg(cmd,cnt,bWARNING); break;
case 'Q': brh = create_branch(&dev_bjt); break;
case 'R': brh = create_branch(&dev_resistor); break;
! case 'S': brh = create_branch(&dev_vswtch); break;
case 'T': brh = create_branch(&dev_trnlin); break;
case 'U': brh = create_branch(&dev_logic); break;
case 'V': brh = create_branch(&dev_vs); break;
diff -cN ../acs-0.14/src/isterm.c src/isterm.c
*** ../acs-0.14/src/isterm.c Wed Jul 6 12:12:06 1994
--- src/isterm.c Sun Jul 31 23:10:05 1994
***************
*** 1,4 ****
! /* isterm.c 93.12.19
* Copyright 1983-1992 Albert Davis
* return 1 if terminator (space, comma, =, or null)
* else 0
--- 1,4 ----
! /* isterm.c 94.07.13
* Copyright 1983-1992 Albert Davis
* return 1 if terminator (space, comma, =, or null)
* else 0
***************
*** 6,12 ****
#include "ecah.h"
#include "declare.h"
! int isterm(int chr)
{
! return (chr=='\0' || isspace(chr) || strchr(",=()[]",chr));
}
--- 6,12 ----
#include "ecah.h"
#include "declare.h"
! int isterm(int chr, const char *term)
{
! return (chr=='\0' || isspace(chr) || strchr(term,chr));
}
diff -cN ../acs-0.14/src/list.c src/list.c
*** ../acs-0.14/src/list.c Wed Jul 6 12:12:07 1994
--- src/list.c Sun Jul 31 23:10:06 1994
***************
*** 1,4 ****
! /* list.c 93.12.19
* Copyright 1983-1992 Albert Davis
* list and save commands.
* save is list with direction to file
--- 1,4 ----
! /* list.c 94.07.29
* Copyright 1983-1992 Albert Davis
* list and save commands.
* save is list with direction to file
***************
*** 25,31 ****
void cmd_save(const char *cmd, int *cnt)
{
*cnt = 0; /* back up to beginning of input line */
! (void)outset(cmd,cnt,(char*)NULL,"ckt");
/* (outset will re-eat words save or list)*/
/* its purpose is to set up where to send */
/* the stuff. */
--- 25,31 ----
void cmd_save(const char *cmd, int *cnt)
{
*cnt = 0; /* back up to beginning of input line */
! (void)outset(cmd,cnt,"","");
/* (outset will re-eat words save or list)*/
/* its purpose is to set up where to send */
/* the stuff. */
diff -cN ../acs-0.14/src/nodes.c src/nodes.c
*** ../acs-0.14/src/nodes.c Wed Jul 6 12:12:08 1994
--- src/nodes.c Sun Jul 31 23:10:08 1994
***************
*** 1,4 ****
! /* nodes.c 93.12.20
* Copyright 1983-1992 Albert Davis
* functions to handle node mapping
*/
--- 1,4 ----
! /* nodes.c 94.07.23
* Copyright 1983-1992 Albert Davis
* functions to handle node mapping
*/
***************
*** 9,15 ****
/*--------------------------------------------------------------------------*/
int newnode_subckt(void);
int newnode_model(void);
! int parsenodes(branch_t*,const char*,int*,int);
void printnodes(const branch_t*,int);
static int name2number(const char*,int*);
static char* number2name(char*,int);
--- 9,15 ----
/*--------------------------------------------------------------------------*/
int newnode_subckt(void);
int newnode_model(void);
! int parsenodes(branch_t*,const char*,int*);
void printnodes(const branch_t*,int);
static int name2number(const char*,int*);
static char* number2name(char*,int);
***************
*** 34,47 ****
/*--------------------------------------------------------------------------*/
/* parsenodes: parse circuit connections from input string
* result in brh.
! * n array must hold at least nodecount+1
* cnt updated.
*/
! int parsenodes(branch_t *brh, const char *cmd, int *cnt, int nodecount)
{
int ii;
int count = 0;
! for (ii = 0; ii < nodecount; ii++){
brh->n[ii].t = brh->n[ii].e = name2number(cmd,cnt);
if (brh->n[ii].e != INVALIDNODE)
count = ii+1;
--- 34,47 ----
/*--------------------------------------------------------------------------*/
/* parsenodes: parse circuit connections from input string
* result in brh.
! * n array must hold at least numnodes+1
* cnt updated.
*/
! int parsenodes(branch_t *brh, const char *cmd, int *cnt)
{
int ii;
int count = 0;
! for (ii = 0; ii < brh->f->numnodes; ii++){
brh->n[ii].t = brh->n[ii].e = name2number(cmd,cnt);
if (brh->n[ii].e != INVALIDNODE)
count = ii+1;
diff -cN ../acs-0.14/src/patchlev.h src/patchlev.h
*** ../acs-0.14/src/patchlev.h Wed Jul 6 12:11:41 1994
--- src/patchlev.h Sun Jul 31 23:09:43 1994
***************
*** 1,3 ****
! /* patchlev.h 94.05.27
*/
! #define PATCHLEVEL 14
--- 1,3 ----
! /* patchlev.h 94.07.31
*/
! #define PATCHLEVEL 15
diff -cN ../acs-0.14/src/probe.c src/probe.c
*** ../acs-0.14/src/probe.c Wed Jul 6 12:12:13 1994
--- src/probe.c Sun Jul 31 23:10:12 1994
***************
*** 1,4 ****
! /* probe.c 94.05.06
* Copyright 1983-1992 Albert Davis
* probe and plot commands
* set up print and plot (select points, maintain probe lists)
--- 1,4 ----
! /* probe.c 94.07.13
* Copyright 1983-1992 Albert Davis
* probe and plot commands
* set up print and plot (select points, maintain probe lists)
***************
*** 161,167 ****
int oldcount = probecount;
int paren = 0;
prb.lo = prb.hi = 0.;
! (void)ctostr(cmd,cnt,prb.what,LABELEN); /* parameter */
if (!*(prb.what))
syntax_msg(cmd,cnt,bWARNING);
paren += skiplparen(cmd,cnt); /* device, node, etc. */
--- 161,167 ----
int oldcount = probecount;
int paren = 0;
prb.lo = prb.hi = 0.;
! (void)ctostr(cmd,cnt,prb.what,LABELEN,TOKENTERM); /* parameter */
if (!*(prb.what))
syntax_msg(cmd,cnt,bWARNING);
paren += skiplparen(cmd,cnt); /* device, node, etc. */
***************
*** 315,325 ****
int dropcount = 0;
int savecnt;
savecnt = *cnt;
! (void)ctostr(cmd,cnt,parameter,BUFLEN);
strcat(parameter,"(");
paren += skiplparen(cmd,cnt); /* device, node, etc. */
(void)ctostr(cmd, cnt, &(parameter[strlen(parameter)]),
! BUFLEN-(int)strlen(parameter));
strcat(parameter,")");
paren -= skiprparen(cmd,cnt);
if (paren != 0 || !*parameter)
--- 315,325 ----
int dropcount = 0;
int savecnt;
savecnt = *cnt;
! (void)ctostr(cmd,cnt,parameter,BUFLEN,TOKENTERM);
strcat(parameter,"(");
paren += skiplparen(cmd,cnt); /* device, node, etc. */
(void)ctostr(cmd, cnt, &(parameter[strlen(parameter)]),
! BUFLEN-(int)strlen(parameter), TOKENTERM);
strcat(parameter,")");
paren -= skiprparen(cmd,cnt);
if (paren != 0 || !*parameter)
diff -cN ../acs-0.14/src/syscall.c src/syscall.c
*** ../acs-0.14/src/syscall.c Wed Jul 6 12:12:24 1994
--- src/syscall.c Sun Jul 31 23:10:20 1994
***************
*** 1,4 ****
! /* syscall.c 93.12.21
* Copyright 1983-1992 Albert Davis
* system calls: change directory, invoke another program, invoke editor, etc.
*/
--- 1,4 ----
! /* syscall.c 94.07.31
* Copyright 1983-1992 Albert Davis
* system calls: change directory, invoke another program, invoke editor, etc.
*/
***************
*** 34,44 ****
}else{
strcpy(name, EDITFILE);
(void)mktemp(name);
! sprintf(args, "save %s\n", name);
(void)cmdproc(args);
! sprintf(args, "%s %s\n", editor, name);
system(args);
! sprintf(args, "get %s quiet\n", name);
(void)cmdproc(args);
(void)unlink(name);
}
--- 34,44 ----
}else{
strcpy(name, EDITFILE);
(void)mktemp(name);
! sprintf(args, "save %s", name);
(void)cmdproc(args);
! sprintf(args, "%s %s", editor, name);
system(args);
! sprintf(args, "get %s quiet", name);
(void)cmdproc(args);
(void)unlink(name);
}
***************
*** 64,70 ****
char buf[BUFLEN];
if (cmd[*cnt])
! (void)chdir(ctostr(cmd, cnt, buf, BUFLEN-1));
if (getcwd(buf,BUFLEN))
mprintf(io.mstderr, "%s\n", buf);
else
--- 64,70 ----
char buf[BUFLEN];
if (cmd[*cnt])
! (void)chdir(ctostr(cmd, cnt, buf, BUFLEN-1, ""));
if (getcwd(buf,BUFLEN))
mprintf(io.mstderr, "%s\n", buf);
else
diff -cN ../acs-0.14/src/tr_adv.c src/tr_adv.c
*** ../acs-0.14/src/tr_adv.c Wed Jul 6 12:12:16 1994
--- src/tr_adv.c Sun Jul 31 23:10:14 1994
***************
*** 1,4 ****
! /* tr_adv.c 94.07.01
* Copyright 1983-1992 Albert Davis
* Functions to set up the next time step, and next iteration
*/
--- 1,4 ----
! /* tr_adv.c 94.07.14
* Copyright 1983-1992 Albert Davis
* Functions to set up the next time step, and next iteration
*/
***************
*** 24,42 ****
brh->y1 = brh->y0;
if (sim_mode == sDC || sim_phase == pINIT_DC){ /* initial dc */
brh->mt1 = brh->m0;
- #ifdef KEEP_OLD_TIME_INFO
- brh->mt2 = brh->mt1;
- #endif
brh->time0 = brh->time1 = brh->time2 = trtime0;
}else if (brh->time0 != trtime0){ /* new time step */
if (brh->time0 < trtime0){ /* forward */
- #ifdef KEEP_OLD_TIME_INFO
- brh->mt2 = brh->mt1;
- #endif
brh->mt1 = brh->m0;
brh->yt3 = brh->yt2;
brh->yt2 = brh->yt1;
brh->yt1 = brh->y0;
brh->time2 = brh->time1;
brh->time1 = brh->time0;
} /* else backward, don't save */
--- 24,37 ----
brh->y1 = brh->y0;
if (sim_mode == sDC || sim_phase == pINIT_DC){ /* initial dc */
brh->mt1 = brh->m0;
brh->time0 = brh->time1 = brh->time2 = trtime0;
}else if (brh->time0 != trtime0){ /* new time step */
if (brh->time0 < trtime0){ /* forward */
brh->mt1 = brh->m0;
brh->yt3 = brh->yt2;
brh->yt2 = brh->yt1;
brh->yt1 = brh->y0;
+ brh->time3 = brh->time2;
brh->time2 = brh->time1;
brh->time1 = brh->time0;
} /* else backward, don't save */
diff -cN ../acs-0.14/src/tr_load.c src/tr_load.c
*** ../acs-0.14/src/tr_load.c Wed Jul 6 12:12:19 1994
--- src/tr_load.c Sun Jul 31 23:10:16 1994
***************
*** 1,4 ****
! /* tr_load.c 94.05.26
* Copyright 1983-1992 Albert Davis
* Load matrix from pre-computed values
*/
--- 1,4 ----
! /* tr_load.c 94.07.11
* Copyright 1983-1992 Albert Davis
* Load matrix from pre-computed values
*/
***************
*** 36,42 ****
error(bDANGER, "%s: double load\n", printlabel(brh,0));
brh->loaditer = stats.iter[iTOTAL];
! if (stats.iter[iSTEP] > 1){
dc0 = opt.damp * (brh->m0.c0 - brh->m1.c0);
brh->m0.c0 = brh->m1.c0 + dc0;
if (!inc_mode){
--- 36,42 ----
error(bDANGER, "%s: double load\n", printlabel(brh,0));
brh->loaditer = stats.iter[iTOTAL];
! if (stats.iter[iSTEP] > 1 && !brh->nodamp){
dc0 = opt.damp * (brh->m0.c0 - brh->m1.c0);
brh->m0.c0 = brh->m1.c0 + dc0;
if (!inc_mode){
***************
*** 70,76 ****
error(bDANGER, "%s: double load\n", printlabel(brh,0));
brh->loaditer = stats.iter[iTOTAL];
! if (stats.iter[iSTEP] > 1){
dc0 = opt.damp * (brh->m0.c0 - brh->m1.c0);
brh->m0.c0 = brh->m1.c0 + dc0;
df1 = opt.damp * (brh->m0.f1 - brh->m1.f1);
--- 70,76 ----
error(bDANGER, "%s: double load\n", printlabel(brh,0));
brh->loaditer = stats.iter[iTOTAL];
! if (stats.iter[iSTEP] > 1 && !brh->nodamp){
dc0 = opt.damp * (brh->m0.c0 - brh->m1.c0);
brh->m0.c0 = brh->m1.c0 + dc0;
df1 = opt.damp * (brh->m0.f1 - brh->m1.f1);
***************
*** 123,129 ****
error(bDANGER, "%s: double load\n", printlabel(brh,0));
brh->loaditer = stats.iter[iTOTAL];
! if (stats.iter[iSTEP] > 1){
dc0 = opt.damp * (brh->m0.c0 - brh->m1.c0);
brh->m0.c0 = brh->m1.c0 + dc0;
df1 = opt.damp * (brh->m0.f1 - brh->m1.f1);
--- 123,129 ----
error(bDANGER, "%s: double load\n", printlabel(brh,0));
brh->loaditer = stats.iter[iTOTAL];
! if (stats.iter[iSTEP] > 1 && !brh->nodamp){
dc0 = opt.damp * (brh->m0.c0 - brh->m1.c0);
brh->m0.c0 = brh->m1.c0 + dc0;
df1 = opt.damp * (brh->m0.f1 - brh->m1.f1);
diff -cN ../acs-0.14/src/tr_reviw.c src/tr_reviw.c
*** ../acs-0.14/src/tr_reviw.c Wed Jul 6 12:12:20 1994
--- src/tr_reviw.c Sun Jul 31 23:10:17 1994
***************
*** 1,4 ****
! /* tr_reviw.c 94.06.05
* Copyright 1983-1992 Albert Davis
* review the solution after solution at a time point
* Set up events, evaluate logic inputs, truncation error.
--- 1,4 ----
! /* tr_reviw.c 94.07.23
* Copyright 1983-1992 Albert Davis
* review the solution after solution at a time point
* Set up events, evaluate logic inputs, truncation error.
***************
*** 81,98 ****
worsttime = BIGBIG;
if (exists(brh)){
- const branch_t *controller;
- controller = brh;
stop = brh;
do {
devicetime = tr_review_branch(brh);
if (devicetime < worsttime){
worsttime = devicetime;
- controller = brh;
}
} while (brh=nextbranch_dev(brh), brh != stop);
- error(bTRACE,"%s: t-1=%e t-0=%e t+1=%e\n", printlabel(controller,0),
- controller->time1, controller->time0, worsttime);
}
return worsttime;
}
--- 81,93 ----
diff -cN ../acs-0.14/src/tr_setup.c src/tr_setup.c
*** ../acs-0.14/src/tr_setup.c Wed Jul 6 12:12:21 1994
--- src/tr_setup.c Sun Jul 31 23:10:18 1994
***************
*** 1,4 ****
! /* tr_setup.c 94.06.23
* Copyright 1983-1992 Albert Davis
* set up transient and fourier analysis
*/
--- 1,4 ----
! /* tr_setup.c 94.07.29
* Copyright 1983-1992 Albert Davis
* set up transient and fourier analysis
*/
***************
*** 206,212 ****
"WAtch", aENUM, &tr->trace, tITERATION,
""))
;
! else if (outset(cmd,cnt,(char*)NULL,((sim_mode==sTRAN)?"tr ":"fo ")))
;
else{
syntax_check(cmd,cnt,bWARNING);
--- 206,212 ----
"WAtch", aENUM, &tr->trace, tITERATION,
""))
;
! else if (outset(cmd,cnt,"",""))
;
else{
syntax_check(cmd,cnt,bWARNING);
diff -cN ../acs-0.14/src/types.h src/types.h
*** ../acs-0.14/src/types.h Wed Jul 6 12:11:43 1994
--- src/types.h Sun Jul 31 23:09:45 1994
***************
*** 1,4 ****
! /* types.h 11/19/91
* Copyright 1983-1992 Albert Davis
* external declarations for device models
*/
--- 1,4 ----
! /* types.h 94.07.12
* Copyright 1983-1992 Albert Davis
* external declarations for device models
*/
***************
*** 18,25 ****
--- 18,27 ----
extern functions_t dev_vccs;
extern functions_t dev_vcvs;
extern functions_t dev_vs;
+ extern functions_t dev_vswtch;
extern functions_t model_bjt;
extern functions_t model_diode;
extern functions_t model_logic;
extern functions_t model_mos;
extern functions_t model_subckt;
+ extern functions_t model_vswtch;
diff -cN ../acs-0.14/src/xopen.c src/xopen.c
*** ../acs-0.14/src/xopen.c Wed Jul 6 12:12:25 1994
--- src/xopen.c Sun Jul 31 23:10:21 1994
***************
*** 1,4 ****
! /* xopen.c 93.12.21
* Copyright 1983-1992 Albert Davis
* scan a string for a file name
* fill in extension, if necessary
--- 1,4 ----
! /* xopen.c 94.07.13
* Copyright 1983-1992 Albert Davis
* scan a string for a file name
* fill in extension, if necessary
***************
*** 22,32 ****
}
}
/*--------------------------------------------------------------------------*/
FILE *xopen(const char *cmd, int *cnt, const char *ext, const char *how)
{
! int i;
! int defalt;
! FILE *code;
char fname[BUFLEN+5];
skipbl(cmd,cnt);
--- 22,38 ----
}
}
/*--------------------------------------------------------------------------*/
+ /* xopen: open a file from a command string
+ * scan and eat up the name from the command
+ * add default extension if appropriate
+ * if there is no name, prompt for one
+ * trap errors of not found and clobber
+ */
FILE *xopen(const char *cmd, int *cnt, const char *ext, const char *how)
{
! int i; /* an index */
! int defalt; /* flag: we need to add the default extension */
! FILE *code; /* a file pointer for the file we found */
char fname[BUFLEN+5];
skipbl(cmd,cnt);
***************
*** 36,62 ****
loccount = 0;
cnt = &loccount;
}
!
skipbl(cmd,cnt); /* find out if we want to add the */
defalt = YES; /* default extension */
for (i = 0; i < BUFLEN; ){
char c;
c = cmd[(*cnt)++];
! if (isterm(c))
break;
if (c == '$'){
sprintf(&(fname[i]), "%ld", (long)time((time_t*)NULL));
i = strlen(fname);
! }else{
! fname[i++] = c;
! if (c == '.')
! defalt = NO;
! else if (c == '\\' || c == '/')
! defalt = YES;
! }
! }
(*cnt)--;
! if (defalt){ /* add the extension */
fname[i++] = '.';
strcpy(&fname[i],ext);
}else{
--- 42,69 ----
loccount = 0;
cnt = &loccount;
}
! /* copy the name */
! /* and while we're at it ... */
skipbl(cmd,cnt); /* find out if we want to add the */
defalt = YES; /* default extension */
for (i = 0; i < BUFLEN; ){
char c;
c = cmd[(*cnt)++];
! if (!c || isspace(c))
break;
if (c == '$'){
sprintf(&(fname[i]), "%ld", (long)time((time_t*)NULL));
i = strlen(fname);
! }else{ /* we want to add the extension */
! fname[i++] = c; /* if it doesn't already have one, */
! if (c == '.') /* as determined by a '.' */
! defalt = NO; /* not before the directory */
! else if (strchr(ENDDIR,c)) /* separator-terminator character */
! defalt = YES; /* '\' or '/' for msdos, */
! } /* ']' or '/' for vms, */
! } /* '/' for unix (in ENDDIR) */
(*cnt)--;
! if (defalt && ext && *ext){ /* add the extension (maybe) */
fname[i++] = '.';
strcpy(&fname[i],ext);
}else{