Browse Source

variable rename, unify the source

checked for object file invariance
rlar 14 years ago
parent
commit
d06265142d
  1. 28
      src/frontend/fourier.c

28
src/frontend/fourier.c

@ -21,7 +21,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "variable.h" #include "variable.h"
static char *pn(double num);
static char *pnum(double num);
static int CKTfour(int ndata, int numFreq, double *thd, double *Time, double *Value, static int CKTfour(int ndata, int numFreq, double *thd, double *Time, double *Value,
double FundFreq, double *Freq, double *Mag, double *Phase, double *nMag, double FundFreq, double *Freq, double *Mag, double *Phase, double *nMag,
double *nPhase); double *nPhase);
@ -41,7 +41,7 @@ int
fourier(wordlist *wl, struct plot *current_plot) fourier(wordlist *wl, struct plot *current_plot)
{ {
struct dvec *time, *vec; struct dvec *time, *vec;
struct pnode *names, *first_name;
struct pnode *pn, *names;
double *ff, fundfreq, *dp, *stuff; double *ff, fundfreq, *dp, *stuff;
int nfreqs, fourgridsize, polydegree; int nfreqs, fourgridsize, polydegree;
double *freq, *mag, *phase, *nmag, *nphase; /* Outputs from CKTfour */ double *freq, *mag, *phase, *nmag, *nphase; /* Outputs from CKTfour */
@ -87,11 +87,11 @@ fourier(wordlist *wl, struct plot *current_plot)
nphase = TMALLOC(double, nfreqs); nphase = TMALLOC(double, nfreqs);
wl = wl->wl_next; wl = wl->wl_next;
names = ft_getpnames(wl, TRUE);
first_name = names;
while (names) {
vec = ft_evaluate(names);
names = names->pn_next;
pn = ft_getpnames(wl, TRUE);
names = pn;
while (pn) {
vec = ft_evaluate(pn);
pn = pn->pn_next;
while (vec) { while (vec) {
if (vec->v_length != time->v_length) { if (vec->v_length != time->v_length) {
fprintf(cp_err, fprintf(cp_err,
@ -169,17 +169,17 @@ fourier(wordlist *wl, struct plot *current_plot)
fprintf(cp_out, fprintf(cp_out,
" %-4d %-*s %-*s %-*s %-*s %-*s\n", " %-4d %-*s %-*s %-*s %-*s %-*s\n",
i, i,
fw, pn(freq[i]),
fw, pn(mag[i]),
fw, pn(phase[i]),
fw, pn(nmag[i]),
fw, pn(nphase[i]));
fw, pnum(freq[i]),
fw, pnum(mag[i]),
fw, pnum(phase[i]),
fw, pnum(nmag[i]),
fw, pnum(nphase[i]));
fputs("\n", cp_out); fputs("\n", cp_out);
vec = vec->v_link2; vec = vec->v_link2;
} }
} }
free_pnode(first_name);
free_pnode(names);
tfree(freq); tfree(freq);
tfree(mag); tfree(mag);
tfree(phase); tfree(phase);
@ -198,7 +198,7 @@ com_fourier(wordlist *wl)
static char * static char *
pn(double num)
pnum(double num)
{ {
char buf[BSIZE_SP]; char buf[BSIZE_SP];
int i = cp_numdgt; int i = cp_numdgt;

Loading…
Cancel
Save