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;
|
||||
}
|
||||
|
||||
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;
|
||||
if(generator) {
|
||||
/* for generators (data from a pipe) can not inspect next line (fseek/ftell) looking for
|
||||
* embedded symbols. Assume no embedded symbol follows */
|
||||
fd_tmp = NULL;
|
||||
get_sym_type(symname, &symtype, NULL, fd_tmp, &sym_n_pins);
|
||||
} else {
|
||||
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);
|
||||
if( /* add here symbol types not to consider when loading schematic-as-symbol instances */
|
||||
!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) {
|
||||
char c;
|
||||
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 */
|
||||
read_line(lcc[level].fd, 1);
|
||||
fscan_ret = fscanf(lcc[level].fd, " ");
|
||||
if(fscanf(lcc[level].fd," %c",&c)!=EOF) {
|
||||
if( c == '[') {
|
||||
fd_tmp = lcc[level].fd;
|
||||
} else {
|
||||
xfseek(lcc[level].fd, filepos, SEEK_SET); /* rewind file pointer */
|
||||
if(!generator) {
|
||||
filepos = xftell(lcc[level].fd); /* store file pointer position to inspect next char */
|
||||
read_line(lcc[level].fd, 1);
|
||||
fscan_ret = fscanf(lcc[level].fd, " ");
|
||||
if(fscanf(lcc[level].fd," %c",&c)!=EOF) {
|
||||
if( c == '[') {
|
||||
fd_tmp = lcc[level].fd;
|
||||
} 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}
|
||||
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 {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 -130 0 0 {name=p3 lab=0}
|
||||
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 -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 {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 -130 0 0 {name=p5 lab=0}
|
||||
C {n.sym} 400 -180 0 0 {name=m4 model=cmosn w=wn l=lln m=1}
|
||||
|
|
|
|||
Loading…
Reference in New Issue