dvec abstraction, #3/11, use `dvec_alloc()'
This commit is contained in:
parent
9d99a06bcd
commit
908c650f72
|
|
@ -451,7 +451,7 @@ com_compose(wordlist *wl)
|
|||
}
|
||||
}
|
||||
|
||||
result = alloc(struct dvec);
|
||||
result = dvec_alloc();
|
||||
ZERO(result, struct dvec);
|
||||
result->v_name = resname;
|
||||
result->v_type = type;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ com_fft(wordlist *wl)
|
|||
plot_cur->pl_name = copy("Spectrum");
|
||||
plot_cur->pl_date = copy(datestring());
|
||||
|
||||
f = alloc(struct dvec);
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("frequency");
|
||||
f->v_type = SV_FREQUENCY;
|
||||
|
|
@ -149,7 +149,7 @@ com_fft(wordlist *wl)
|
|||
fdvec = TMALLOC(ngcomplex_t *, ngood);
|
||||
for (i = 0, vec = vlist; i<ngood; i++) {
|
||||
tdvec[i] = vec->v_realdata; /* real input data */
|
||||
f = alloc(struct dvec);
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = vec_basename(vec);
|
||||
f->v_type = SV_NOTYPE;
|
||||
|
|
@ -354,7 +354,7 @@ com_psd(wordlist *wl)
|
|||
plot_cur->pl_name = copy("PSD");
|
||||
plot_cur->pl_date = copy(datestring());
|
||||
|
||||
f = alloc(struct dvec);
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("frequency");
|
||||
f->v_type = SV_FREQUENCY;
|
||||
|
|
@ -376,7 +376,7 @@ com_psd(wordlist *wl)
|
|||
fdvec = TMALLOC(ngcomplex_t*, ngood);
|
||||
for (i = 0, vec = vlist; i<ngood; i++) {
|
||||
tdvec[i] = vec->v_realdata; /* real input data */
|
||||
f = alloc(struct dvec);
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = vec_basename(vec);
|
||||
f->v_type = SV_NOTYPE; //vec->v_type;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ com_let(wordlist *wl)
|
|||
}
|
||||
|
||||
/* create and assign a new vector */
|
||||
n = alloc(struct dvec);
|
||||
n = dvec_alloc();
|
||||
ZERO(n, struct dvec);
|
||||
n->v_name = copy(p);
|
||||
n->v_type = t->v_type;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ savetree(struct pnode *pn)
|
|||
*/
|
||||
d = pn->pn_value;
|
||||
if ((d->v_length != 0) || eq(d->v_name, "list")) {
|
||||
pn->pn_value = alloc(struct dvec);
|
||||
pn->pn_value = dvec_alloc();
|
||||
ZERO(pn->pn_value, struct dvec);
|
||||
pn->pn_value->v_name = copy(d->v_name);
|
||||
pn->pn_value->v_length = d->v_length;
|
||||
|
|
|
|||
|
|
@ -1317,7 +1317,7 @@ com_alter_common(wordlist *wl, int do_model)
|
|||
return;
|
||||
}
|
||||
|
||||
dv = TMALLOC(struct dvec, 1);
|
||||
dv = dvec_alloc();
|
||||
if (!dv)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ doop(char what,
|
|||
if (!data)
|
||||
return (NULL);
|
||||
/* Make up the new vector. */
|
||||
res = alloc(struct dvec);
|
||||
res = dvec_alloc();
|
||||
ZERO(res, struct dvec);
|
||||
if (relflag || (isreal(v1) && isreal(v2) && (func != cx_comma))) {
|
||||
res->v_type = SV_NOTYPE;
|
||||
|
|
@ -615,7 +615,7 @@ op_range(struct pnode *arg1, struct pnode *arg2)
|
|||
len++;
|
||||
}
|
||||
|
||||
res = alloc(struct dvec);
|
||||
res = dvec_alloc();
|
||||
ZERO(res, struct dvec);
|
||||
res->v_name = mkcname('R', v->v_name, ind->v_name);
|
||||
res->v_type = v->v_type;
|
||||
|
|
@ -771,7 +771,7 @@ op_ind(struct pnode *arg1, struct pnode *arg2)
|
|||
length = blocksize * (up - down + 1);
|
||||
|
||||
/* Make up the new vector. */
|
||||
res = alloc(struct dvec);
|
||||
res = dvec_alloc();
|
||||
ZERO(res, struct dvec);
|
||||
res->v_name = mkcname('[', v->v_name, ind->v_name);
|
||||
res->v_type = v->v_type;
|
||||
|
|
@ -941,7 +941,7 @@ apply_func(struct func *func, struct pnode *arg)
|
|||
else
|
||||
name = mkcname('b', v->v_name, NULL);
|
||||
|
||||
t = alloc(struct dvec);
|
||||
t = dvec_alloc();
|
||||
ZERO(t, struct dvec);
|
||||
t->v_name = name;
|
||||
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ fourier(wordlist *wl, struct plot *current_plot)
|
|||
/* create and assign a new vector n */
|
||||
/* with size 3 * nfreqs in current plot */
|
||||
/* generate name for new vector, using vec->name */
|
||||
n = alloc(struct dvec);
|
||||
n = dvec_alloc();
|
||||
ZERO(n, struct dvec);
|
||||
|
||||
n->v_name = tprintf("fourier%d%d", callstof, newveccount);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ lincopy(struct dvec *ov, double *newscale, int newlen, struct dvec *oldscale)
|
|||
return;
|
||||
}
|
||||
|
||||
v = alloc(struct dvec);
|
||||
v = dvec_alloc();
|
||||
v->v_name = copy(ov->v_name);
|
||||
v->v_type = ov->v_type;
|
||||
v->v_flags = ov->v_flags;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ com_linearize(wordlist *wl)
|
|||
plot_setcur(new->pl_typename);
|
||||
plot_list = new;
|
||||
len = (int)((tstop - tstart) / tstep + 1.5);
|
||||
newtime = alloc(struct dvec);
|
||||
newtime = dvec_alloc();
|
||||
newtime->v_name = copy(oldtime->v_name);
|
||||
newtime->v_type = oldtime->v_type;
|
||||
newtime->v_flags = oldtime->v_flags;
|
||||
|
|
|
|||
|
|
@ -1031,7 +1031,7 @@ plotInit(runDesc *run)
|
|||
else
|
||||
name = copy(dd->name);
|
||||
|
||||
v = alloc(struct dvec);
|
||||
v = dvec_alloc();
|
||||
v->v_name = name;
|
||||
v->v_type = guess_type(name);
|
||||
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ PP_mknnode(double number)
|
|||
struct pnode *p;
|
||||
struct dvec *v;
|
||||
|
||||
v = alloc(struct dvec);
|
||||
v = dvec_alloc();
|
||||
ZERO(v, struct dvec);
|
||||
|
||||
/* We don't use printnum because it screws up PP_mkfnode above. We have
|
||||
|
|
@ -368,7 +368,7 @@ PP_mksnode(const char *string)
|
|||
p = alloc_pnode();
|
||||
v = vec_get(string);
|
||||
if (v == NULL) {
|
||||
nv = alloc(struct dvec);
|
||||
nv = dvec_alloc();
|
||||
ZERO(nv, struct dvec);
|
||||
nv->v_name = copy(string);
|
||||
p->pn_value = nv;
|
||||
|
|
|
|||
|
|
@ -916,7 +916,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
|
|||
|
||||
double *newscale;
|
||||
|
||||
struct dvec *newv_scale = alloc(struct dvec);
|
||||
struct dvec *newv_scale = dvec_alloc();
|
||||
struct dvec *v;
|
||||
|
||||
newv_scale->v_name = copy(vecs->v_scale->v_name);
|
||||
|
|
|
|||
|
|
@ -764,7 +764,7 @@ com_cross(wordlist *wl)
|
|||
}
|
||||
|
||||
vec_remove(newvec);
|
||||
v = alloc(struct dvec);
|
||||
v = dvec_alloc();
|
||||
v->v_name = copy(newvec);
|
||||
v->v_type = vecs ? vecs->v_type : SV_NOTYPE;
|
||||
v->v_length = i;
|
||||
|
|
|
|||
|
|
@ -468,7 +468,7 @@ raw_read(char *name) {
|
|||
* the desired vector length, but this would
|
||||
* be dangerous if the file is invalid.
|
||||
*/
|
||||
v = alloc(struct dvec);
|
||||
v = dvec_alloc();
|
||||
ZERO(v, struct dvec);
|
||||
v->v_type = SV_NOTYPE;
|
||||
v->v_flags = (short)flags;
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ com_spec(wordlist *wl)
|
|||
plot_cur->pl_name = copy("Spectrum");
|
||||
plot_cur->pl_date = copy(datestring());
|
||||
|
||||
f = alloc(struct dvec);
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("frequency");
|
||||
f->v_type = SV_FREQUENCY;
|
||||
|
|
@ -221,7 +221,7 @@ com_spec(wordlist *wl)
|
|||
fdvec = TMALLOC(ngcomplex_t *, ngood);
|
||||
for (i = 0, vec = vlist; i < ngood; i++) {
|
||||
tdvec[i] = vec->v_realdata;
|
||||
f = alloc(struct dvec);
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = vec_basename(vec);
|
||||
f->v_type = vec->v_type;
|
||||
|
|
@ -281,7 +281,7 @@ com_spec(wordlist *wl)
|
|||
fprintf(cp_err, " \r");
|
||||
|
||||
#ifdef KEEPWINDOW
|
||||
f = alloc(struct dvec);
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("win");
|
||||
f->v_type = SV_NOTYPE;
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ vec_get(const char *vec_name)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
d = alloc(struct dvec);
|
||||
d = dvec_alloc();
|
||||
ZERO(d, struct dvec);
|
||||
d->v_name = copy(whole); /* MW. The same as word before */
|
||||
d->v_type = SV_NOTYPE;
|
||||
|
|
@ -685,7 +685,7 @@ vec_copy(struct dvec *v)
|
|||
if (!v)
|
||||
return (NULL);
|
||||
|
||||
nv = alloc(struct dvec);
|
||||
nv = dvec_alloc();
|
||||
nv->v_name = copy(v->v_name);
|
||||
nv->v_type = v->v_type;
|
||||
nv->v_flags = v->v_flags & ~VF_PERMANENT;
|
||||
|
|
@ -1122,7 +1122,7 @@ vec_mkfamily(struct dvec *v)
|
|||
|
||||
indexstring(count, v->v_numdims - 1, buf2);
|
||||
|
||||
d = alloc(struct dvec);
|
||||
d = dvec_alloc();
|
||||
ZERO(d, struct dvec);
|
||||
|
||||
d->v_name = tprintf("%s%s", v->v_name, buf2);
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp
|
|||
goto done;
|
||||
|
||||
/* create a new scale vector */
|
||||
sv = alloc(struct dvec);
|
||||
sv = dvec_alloc();
|
||||
ZERO(sv, struct dvec);
|
||||
sv->v_name = copy("fft_scale");
|
||||
sv->v_type = SV_FREQUENCY;
|
||||
|
|
@ -863,7 +863,7 @@ cx_ifft(void *data, short int type, int length, int *newlength, short int *newty
|
|||
span = xscale[tpts-1] - xscale[0];
|
||||
|
||||
/* create a new scale vector */
|
||||
sv = alloc(struct dvec);
|
||||
sv = dvec_alloc();
|
||||
ZERO(sv, struct dvec);
|
||||
sv->v_name = copy("ifft_scale");
|
||||
sv->v_type = SV_TIME;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ oldread(char *name)
|
|||
fprintf(cp_err, "Warning: magic number 4 is wrong...\n");
|
||||
|
||||
for (i = 0; i < nv; i++) {
|
||||
v = alloc(struct dvec);
|
||||
v = dvec_alloc();
|
||||
if (end)
|
||||
end->v_next = v;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ struct dvec *EVTfindvec(
|
|||
/* Allocate dvec structures and assign the vectors into them. */
|
||||
/* See FTE/OUTinterface.c:plotInit() for initialization example. */
|
||||
|
||||
scale = TMALLOC(struct dvec, 1);
|
||||
scale = dvec_alloc();
|
||||
|
||||
scale->v_name = MIFcopy("step");
|
||||
scale->v_type = SV_TIME;
|
||||
|
|
@ -196,7 +196,7 @@ struct dvec *EVTfindvec(
|
|||
scale->v_realdata = anal_point_vec;
|
||||
scale->v_scale = NULL;
|
||||
|
||||
d = TMALLOC(struct dvec, 1);
|
||||
d = dvec_alloc();
|
||||
|
||||
d->v_name = name;
|
||||
d->v_type = SV_VOLTAGE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue