" >> libind;
print "" >> libind;
print " Comment | " >> libind;
print " Footprint Name | " >> libind;
print "
" >> libind;
print "" >> libind;
print "~" lib "" >> ind;
next;
}
{
line=$0;
split(line, a, "[:]");
template = a[1];
package = a[2];
comp = a[3];
comment = a[4];
# pick out the name of the footprint
match (comment, /(.*)\[(.*)\]/, fp);
comp = fp[2];
comment = a[3] ", " fp[1];
txtcomp = comp;
urlcomp = comp;
# escape the spaces in for URLs and also filenames
gsub(/ /, "%20", urlcomp);
gsub(/ /, "\\ ", comp);
# extract the footprint
# path library template value package
templ = a[1];
gsub(/ /, "\\ ", templ);
pkg = a[2];
gsub(/ /, "\\ ", pkg);
# skip the QFP builder menu
skip = 0;
if( templ == "menu_qfp" ) {
cmd1 = "Skipping QFP builder menu";
rc = 1;
} else {
cmd1 = "sh " cmd_path "/QueryLibrary.sh . pcblib " templ " " comp " " pkg;
cmd = cmd1 " > " dir "/" comp ".fp";
rc = system( cmd );
}
if( rc != 0) {
printf("~%s | \n", lib) >> broken;
printf(" %s | \n", comp) >> broken;
printf(" %s | \n", comment) >> broken;
printf(" %s | \n", cmd1) >> broken;
printf("
\n") >> broken;
# no need to go further with this footprint. It is broken.
next;
} else {
# generate the web index
printf(" \n %s | \n", comment) >> libind;
printf(" %s.fp", txtcomp, txtcomp) >> libind;
if( do_png ) {
printf("(preview)", txtcomp) >> libind;
}
printf(" | \n
\n") >> libind;
}
# Now create a layout with that element and print it.
if( do_png ) {
layout = "temp.pcb" ;
laytmpl = "footprint.pcb" ;
compfile = dir "/" comp ".fp";
pngfile = dir "/" comp ".png";
compfile2 = compfile;
gsub(/\\/, "", compfile2);
printf(" ===> %s\n", compfile);
printf("") > layout;
pok = 1;
while ( (getline < laytmpl) == 1 ) {
if( $0 ~ /ELEMENT/ ) {
pok = 0;
}
if( pok ) {
print >> layout ;
}
}
close( laytmpl );
while( (x = getline < compfile2) == 1 ) {
print >> layout;
}
close( compfile2 );
pok = 0;
while( (getline < laytmpl) == 1 ) {
if( pok ) {
print >> layout;
}
if( $0 ~ /ELEMENT/ ) {
pok = 1;
}
}
close( laytmpl );
close( layout );
cmd = PCB " -x png --outfile temp.png ${png_flag} --only-visible " layout " 2>&1 > /dev/null" ;
rc = system( cmd );
if( rc != 0) {
printf("~%s | \n", lib) >> broken;
printf(" %s | \n", comp) >> broken;
printf(" %s | \n", comment) >> broken;
printf(" %s | \n", cmd) >> broken;
printf("
\n") >> broken;
} else {
system( "mv temp.png " pngfile " ; rm " layout);
}
}
}
END {
print "" >> ind;
print "" >> ind;
print "" >> ind;
print "For a list of footprints with either m4 syntax errors" >> ind;
print "or PCB syntax errors see the broken log file.
" >> ind;
print "" >> ind;
close( ind );
print "" >> broken;
print "
" >> broken;
print "" >> broken;
print "" >> broken;
close( broken );
finish_libind();
}
function finish_libind() {
if(libind != "") {
print "" >> libind;
print "