load_sym_def: if loading a symbol reading from a pipe (generator script) do not attempt to seek forward looking for embedded symbols. Assume no embedded symbols exist here
This commit is contained in:
parent
ce9accbe93
commit
ee7dc8982a
50
src/save.c
50
src/save.c
|
|
@ -3609,21 +3609,27 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
filepos = xftell(lcc[level].fd); /* store file pointer position to inspect next line */
|
if(generator) {
|
||||||
fd_tmp = NULL;
|
/* for generators (data from a pipe) can not inspect next line (fseek/ftell) looking for
|
||||||
read_line(lcc[level].fd, 1);
|
* embedded symbols. Assume no embedded symbol follows */
|
||||||
fscan_ret = fscanf(lcc[level].fd, " ");
|
fd_tmp = NULL;
|
||||||
if(fscanf(lcc[level].fd," %c",&ch)!=EOF) {
|
get_sym_type(symname, &symtype, NULL, fd_tmp, &sym_n_pins);
|
||||||
if( ch == '[') {
|
} else {
|
||||||
fd_tmp = lcc[level].fd;
|
filepos = xftell(lcc[level].fd); /* store file pointer position to inspect next line */
|
||||||
|
fd_tmp = NULL;
|
||||||
|
read_line(lcc[level].fd, 1);
|
||||||
|
fscan_ret = fscanf(lcc[level].fd, " ");
|
||||||
|
if(fscanf(lcc[level].fd," %c",&ch)!=EOF) {
|
||||||
|
if( ch == '[') {
|
||||||
|
fd_tmp = lcc[level].fd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/* get symbol type by looking into list of loaded symbols or (if not found) by
|
||||||
|
* opening/closing the symbol file and getting the 'type' attribute from global symbol attributes
|
||||||
|
* if fd_tmp set read symbol from embedded tags '[...]' */
|
||||||
|
get_sym_type(symname, &symtype, NULL, fd_tmp, &sym_n_pins);
|
||||||
|
xfseek(lcc[level].fd, filepos, SEEK_SET); /* rewind file pointer */
|
||||||
}
|
}
|
||||||
/* get symbol type by looking into list of loaded symbols or (if not found) by
|
|
||||||
* opening/closing the symbol file and getting the 'type' attribute from global symbol attributes
|
|
||||||
* if fd_tmp set read symbol from embedded tags '[...]' */
|
|
||||||
get_sym_type(symname, &symtype, NULL, fd_tmp, &sym_n_pins);
|
|
||||||
xfseek(lcc[level].fd, filepos, SEEK_SET); /* rewind file pointer */
|
|
||||||
|
|
||||||
dbg(1, "l_s_d(): level=%d, symname=%s symtype=%s\n", level, symname, symtype);
|
dbg(1, "l_s_d(): level=%d, symname=%s symtype=%s\n", level, symname, symtype);
|
||||||
if( /* add here symbol types not to consider when loading schematic-as-symbol instances */
|
if( /* add here symbol types not to consider when loading schematic-as-symbol instances */
|
||||||
!strcmp(symtype, "logo") ||
|
!strcmp(symtype, "logo") ||
|
||||||
|
|
@ -3657,14 +3663,16 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
||||||
if ((fd_tmp = fopen(sympath, fopen_read_mode)) == NULL) {
|
if ((fd_tmp = fopen(sympath, fopen_read_mode)) == NULL) {
|
||||||
char c;
|
char c;
|
||||||
fprintf(errfp, "l_s_d(): unable to open file to read schematic: %s\n", sympath);
|
fprintf(errfp, "l_s_d(): unable to open file to read schematic: %s\n", sympath);
|
||||||
filepos = xftell(lcc[level].fd); /* store file pointer position to inspect next char */
|
if(!generator) {
|
||||||
read_line(lcc[level].fd, 1);
|
filepos = xftell(lcc[level].fd); /* store file pointer position to inspect next char */
|
||||||
fscan_ret = fscanf(lcc[level].fd, " ");
|
read_line(lcc[level].fd, 1);
|
||||||
if(fscanf(lcc[level].fd," %c",&c)!=EOF) {
|
fscan_ret = fscanf(lcc[level].fd, " ");
|
||||||
if( c == '[') {
|
if(fscanf(lcc[level].fd," %c",&c)!=EOF) {
|
||||||
fd_tmp = lcc[level].fd;
|
if( c == '[') {
|
||||||
} else {
|
fd_tmp = lcc[level].fd;
|
||||||
xfseek(lcc[level].fd, filepos, SEEK_SET); /* rewind file pointer */
|
} else {
|
||||||
|
xfseek(lcc[level].fd, filepos, SEEK_SET); /* rewind file pointer */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ N 190 -350 190 -310 {lab=VCC}
|
||||||
N 190 -150 190 -130 {lab=0}
|
N 190 -150 190 -130 {lab=0}
|
||||||
C {opin.sym} 230 -230 0 0 {name=p1 lab=y verilog_type=wire}
|
C {opin.sym} 230 -230 0 0 {name=p1 lab=y verilog_type=wire}
|
||||||
C {ipin.sym} 110 -230 0 0 {name=p2 lab=a}
|
C {ipin.sym} 110 -230 0 0 {name=p2 lab=a}
|
||||||
C {p.sym} 170 -280 0 0 {name=m2 model=cmosp w=wp l=lp m=1 }
|
C {p.sym} 170 -280 0 0 {name=m2 model=cmosp w=wp l=lp m=1}
|
||||||
C {lab_pin.sym} 190 -350 0 0 {name=p149 lab=VCC}
|
C {lab_pin.sym} 190 -350 0 0 {name=p149 lab=VCC}
|
||||||
C {lab_pin.sym} 190 -130 0 0 {name=p3 lab=0}
|
C {lab_pin.sym} 190 -130 0 0 {name=p3 lab=0}
|
||||||
C {n.sym} 170 -180 0 0 {name=m1 model=cmosn w=wn l=lln m=1}
|
C {n.sym} 170 -180 0 0 {name=m1 model=cmosn w=wn l=lln m=1}
|
||||||
|
|
@ -71,7 +71,7 @@ C {p.sym} 170 -280 0 0 {name=m2 model=cmosp w=wp l=lp m=1 }
|
||||||
C {lab_pin.sym} 190 -350 0 0 {name=p149 lab=VCC}
|
C {lab_pin.sym} 190 -350 0 0 {name=p149 lab=VCC}
|
||||||
C {lab_pin.sym} 190 -130 0 0 {name=p3 lab=0}
|
C {lab_pin.sym} 190 -130 0 0 {name=p3 lab=0}
|
||||||
C {n.sym} 170 -180 0 0 {name=m1 model=cmosn w=wn l=lln m=1}
|
C {n.sym} 170 -180 0 0 {name=m1 model=cmosn w=wn l=lln m=1}
|
||||||
C {p.sym} 400 -280 0 0 {name=m3 model=cmosp w=wp l=lp m=1 }
|
C {p.sym} 400 -280 0 0 {name=m3 model=cmosp w=wp l=lp m=1}
|
||||||
C {lab_pin.sym} 420 -350 0 0 {name=p4 lab=VCC}
|
C {lab_pin.sym} 420 -350 0 0 {name=p4 lab=VCC}
|
||||||
C {lab_pin.sym} 420 -130 0 0 {name=p5 lab=0}
|
C {lab_pin.sym} 420 -130 0 0 {name=p5 lab=0}
|
||||||
C {n.sym} 400 -180 0 0 {name=m4 model=cmosn w=wn l=lln m=1}
|
C {n.sym} 400 -180 0 0 {name=m4 model=cmosn w=wn l=lln m=1}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue