remove bug in command meas, allow / and \ in Windows file paths
This commit is contained in:
parent
3547fdc5f3
commit
747c606e30
|
|
@ -1,3 +1,9 @@
|
|||
2011-06-18 Holger Vogt
|
||||
* measure.c: revert a change from Feb. 19th, 2011 to reinstate from=dfall
|
||||
inpcom.c, defines.h: allow / and \ in file paths under MS Windows
|
||||
inp.c: some comment added
|
||||
/examples/measure/simple-meas-tran.sp: another .measure example
|
||||
|
||||
2011-06-11 Holger Vogt
|
||||
* onemesh.c misc.c com_compose.c com_fft.c evaluate.c
|
||||
hpgl.c linear.c misccoms.c options.c points.c rawfile.c
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
File: simple-meas-tran.sp
|
||||
* Simple .measurement examples
|
||||
* transient simulation of two sine signals with different frequencies
|
||||
vac1 1 0 DC 0 sin(0 1 1k 0 0)
|
||||
vac2 2 0 DC 0 sin(0 1.2 0.9k 0 0)
|
||||
.tran 10u 5m
|
||||
*
|
||||
.measure tran tdiff TRIG v(1) VAL=0.5 RISE=1 TARG v(1) VAL=0.5 RISE=2
|
||||
.measure tran tdiff TRIG v(1) VAL=0.5 RISE=1 TARG v(1) VAL=0.5 RISE=3
|
||||
.measure tran tdiff TRIG v(1) VAL=0.5 RISE=1 TARG v(1) VAL=0.5 FALL=1
|
||||
.measure tran tdiff TRIG v(1) VAL=0 FALL=3 TARG v(2) VAL=0 FALL=3
|
||||
.measure tran tdiff TRIG v(1) VAL=-0.6 CROSS=1 TARG v(2) VAL=-0.8 CROSS=1
|
||||
.measure tran tdiff TRIG AT=1m TARG v(2) VAL=-0.8 CROSS=3
|
||||
.measure tran teval WHEN v(2)=0.7 CROSS=LAST
|
||||
.measure tran teval WHEN v(2)=v(1) FALL=LAST
|
||||
.measure tran teval WHEN v(1)=v(2) CROSS=LAST
|
||||
.measure tran yeval FIND v(2) WHEN v(1)=0.2 FALL=2
|
||||
.measure tran yeval FIND v(2) AT=2m
|
||||
.measure tran ymax MAX v(2) from=2m to=3m
|
||||
.measure tran tymax MAX_AT v(2) from=2m to=3m
|
||||
.measure tran ypp PP v(1) from=2m to=4m
|
||||
.measure tran yrms RMS v(1) from=2m to=3.5m
|
||||
.measure tran yavg AVG v(1) from=2m to=4m
|
||||
.measure tran yint INTEG v(2) from=2m to=3m
|
||||
.param fval=5
|
||||
.measure tran yadd param='fval + 7'
|
||||
.param vout_diff=50k
|
||||
.meas tran bw_chk param='(vout_diff < 100k) ? 1 : 0'
|
||||
.measure tran vtest find par('v(2)*v(1)') AT=2.3m
|
||||
*
|
||||
.control
|
||||
run
|
||||
plot v(1) v(2)
|
||||
meas tran tdiff TRIG v(1) VAL=0.5 RISE=1 TARG v(1) VAL=0.5 RISE=2
|
||||
meas tran tdiff TRIG v(1) VAL=0.5 RISE=1 TARG v(1) VAL=0.5 RISE=3
|
||||
meas tran tdiff TRIG v(1) VAL=0.5 RISE=1 TARG v(1) VAL=0.5 FALL=1
|
||||
meas tran tdiff TRIG v(1) VAL=0 FALL=3 TARG v(2) VAL=0 FALL=3
|
||||
meas tran tdiff TRIG v(1) VAL=-0.6 CROSS=1 TARG v(2) VAL=-0.8 CROSS=1
|
||||
meas tran tdiff TRIG AT=1m TARG v(2) VAL=-0.8 CROSS=3
|
||||
meas tran teval WHEN v(2)=0.7 CROSS=LAST
|
||||
meas tran teval WHEN v(2)=v(1) FALL=LAST
|
||||
meas tran teval WHEN v(1)=v(2) CROSS=LAST
|
||||
meas tran yeval FIND v(2) WHEN v(1)=0.2 FALL=2
|
||||
meas tran yeval FIND v(2) AT=2m
|
||||
meas tran ymax MAX v(2) from=2m to=3m
|
||||
meas tran tymax MAX_AT v(2) from=2m to=3m
|
||||
meas tran ypp PP v(1) from=2m to=4m
|
||||
meas tran yrms RMS v(1) from=2m to=3.5m
|
||||
meas tran yavg AVG v(1) from=2m to=4m
|
||||
meas tran yint INTEG v(2) from=2m to=3m
|
||||
meas tran ymax MAX v(2) from=2m to=3m
|
||||
meas tran tmax WHEN v(2)=YMAX from=1m to=2m $ from..to.. not recognized!
|
||||
|
||||
.endc
|
||||
.end
|
||||
|
|
@ -627,7 +627,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
|
|||
prev_card = dd;
|
||||
} //end of for-loop
|
||||
|
||||
/* set temperature if defined */
|
||||
/* set temperature, if defined, to new value.
|
||||
cp_vset will set the variable "temp" and also set CKTtemp,
|
||||
so we can do it only here because the circuit has to be already there */
|
||||
if ( temperature != NULL ) {
|
||||
temperature_value = atof(temperature);
|
||||
cp_vset("temp", CP_REAL, &temperature_value );
|
||||
|
|
|
|||
|
|
@ -176,14 +176,14 @@ inp_pathopen(char *name, char *mode)
|
|||
char buf2[BSIZE_SP];
|
||||
/* search in the path where the source (input) file has been found,
|
||||
but only if "name" is just a file name */
|
||||
if (!(index(name, DIR_TERM)) && cp_getvar("sourcefile", CP_STRING, buf2)) {
|
||||
if (!(index(name, DIR_TERM)) && !(index(name, DIR_TERM_LINUX)) && cp_getvar("sourcefile", CP_STRING, buf2)) {
|
||||
/* If pathname is found, get path.
|
||||
(char *dirname(const char *name) might have been used here) */
|
||||
if (substring(DIR_PATHSEP, buf2)) {
|
||||
if (substring(DIR_PATHSEP, buf2) || substring(DIR_PATHSEP_LINUX, buf2)) {
|
||||
int i,j=0;
|
||||
for (i=0; i<BSIZE_SP-1; i++) {
|
||||
if (buf2[i] == '\0') break;
|
||||
if (buf2[i] == DIR_TERM) j=i;
|
||||
if ((buf2[i] == DIR_TERM) || (buf2[i] == DIR_TERM_LINUX)) j=i;
|
||||
}
|
||||
buf2[j+1] = '\0'; /* include path separator */
|
||||
}
|
||||
|
|
@ -193,7 +193,14 @@ inp_pathopen(char *name, char *mode)
|
|||
if ((fp = fopen(buf2, mode)) != NULL)
|
||||
return (fp);
|
||||
}
|
||||
#endif
|
||||
/* If this is an abs pathname, or there is no sourcepath var, just
|
||||
* do an fopen.
|
||||
*/
|
||||
if (index(name, DIR_TERM) || index(name, DIR_TERM_LINUX)
|
||||
|| !cp_getvar("sourcepath", CP_LIST, &v))
|
||||
return (fopen(name, mode));
|
||||
#else
|
||||
|
||||
|
||||
/* If this is an abs pathname, or there is no sourcepath var, just
|
||||
* do an fopen.
|
||||
|
|
@ -201,6 +208,7 @@ inp_pathopen(char *name, char *mode)
|
|||
if (index(name, DIR_TERM)
|
||||
|| !cp_getvar("sourcepath", CP_LIST, &v))
|
||||
return (fopen(name, mode));
|
||||
#endif
|
||||
|
||||
while (v) {
|
||||
switch (v->va_type) {
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ com_meas(wordlist *wl) {
|
|||
/* wl: in, input line of meas command */
|
||||
char *line_in, *outvar, newvec[1000];
|
||||
wordlist * wl_count, *wl_let;
|
||||
#ifdef not
|
||||
|
||||
char *vec_found, *token, *equal_ptr, newval[256];
|
||||
wordlist *wl_index;
|
||||
struct dvec *d;
|
||||
int err=0;
|
||||
#endif
|
||||
|
||||
int fail;
|
||||
double result = 0;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ com_meas(wordlist *wl) {
|
|||
return;
|
||||
}
|
||||
wl_count = wl;
|
||||
#ifdef not
|
||||
|
||||
/* check each wl entry, if it contain '=' and if the following token is
|
||||
a vector. If yes, replace this vector by its value */
|
||||
wl_index = wl;
|
||||
|
|
@ -109,7 +109,7 @@ com_meas(wordlist *wl) {
|
|||
}
|
||||
wl_index = wl_index->wl_next;
|
||||
}
|
||||
#endif
|
||||
|
||||
line_in = wl_flatten(wl);
|
||||
|
||||
/* get output var name */
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@
|
|||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
||||
#define DIR_PATHSEP "\\"
|
||||
#define DIR_TERM '\\'
|
||||
#define DIR_PATHSEP_LINUX "/"
|
||||
#define DIR_TERM_LINUX '/'
|
||||
#define DIR_CWD "."
|
||||
|
||||
#define TEMPFORMAT "%s%d.tmp"
|
||||
|
|
|
|||
Loading…
Reference in New Issue