diff --git a/genkicat/gencat b/genkicat/gencat deleted file mode 100755 index 1a97f76..0000000 --- a/genkicat/gencat +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -PATH=$PATH:. -exec genkicat-bin "$@" diff --git a/genkicat/genkicat.c b/genkicat/genkicat.c index cf9478c..a277b36 100644 --- a/genkicat/genkicat.c +++ b/genkicat/genkicat.c @@ -28,15 +28,16 @@ static void usage(const char *name) { fprintf(stderr, "usage: %s [-F] [-d|-D] [-p] [-P] [-q] [-L libdir ...] [-l lib ...]\n" -" %*s hierarchy [descriptions ...]\n\n" -" -d dump the tree instead of generating a PDF\n" -" -D dump all the canonical component names (without aliases)\n" -" -F use fped footprints instead of KiCad components\n" -" -L libdir search all libraries in the specified directory\n" -" -l lib search the specified library\n" -" -p use portrait orientation; default: landscape\n" -" -P generate Postscript instead of PDF (mainly for debugging)\n" -" -q don't show progress\n" +" %*s [-t title.ps] hierarchy [descriptions ...]\n\n" +" -d dump the tree instead of generating a PDF\n" +" -D dump all the canonical component names (without aliases)\n" +" -F use fped footprints instead of KiCad components\n" +" -L libdir search all libraries in the specified directory\n" +" -l lib search the specified library\n" +" -p use portrait orientation; default: landscape\n" +" -P generate Postscript instead of PDF (mainly for debugging)\n" +" -q don't show progress\n" +" -t title.ps Postscript file with title page\n" , name, (int) strlen(name), ""); exit(1); } @@ -48,9 +49,10 @@ int main(int argc, char **argv) FILE *file; int c; int opt_dump_tree = 0, opt_dump_comp = 0, postscript = 0, portrait = 0; + const char *title_page = NULL; char **arg; - while ((c = getopt(argc, argv, "dDFL:l:Ppq")) != EOF) + while ((c = getopt(argc, argv, "dDFL:l:Ppqt:")) != EOF) switch (c) { case 'd': opt_dump_tree = 1; @@ -76,6 +78,9 @@ int main(int argc, char **argv) case 'q': quiet = 1; break; + case 't': + title_page = optarg; + break; default: usage(*argv); } @@ -114,6 +119,6 @@ int main(int argc, char **argv) else if (opt_dump_comp) dump_comp(); else - make_pdf(!postscript, portrait); + make_pdf(!postscript, portrait, title_page); return 0; } diff --git a/genkicat/pdf.c b/genkicat/pdf.c index 3eedfd7..b7d0d60 100644 --- a/genkicat/pdf.c +++ b/genkicat/pdf.c @@ -15,6 +15,7 @@ #include #include "util.h" +#include "run.h" #include "genkicat.h" #include "tree.h" #include "libs.h" @@ -334,7 +335,7 @@ static int count_tree(const struct node *node) } -void make_pdf(int pdf, int use_portrait) +void make_pdf(int pdf, int use_portrait, const char *title_page) { FILE *out; int res; @@ -354,6 +355,11 @@ void make_pdf(int pdf, int use_portrait) exit(1); } fprintf(out, "%%!PS\n%s\n", format->file_setup); + if (title_page) { + fprintf(out, "gsave\n"); + cat(out, title_page); + fprintf(out, "grestore\n"); + } make_index(out, tree); total = count_tree(tree); convert_tree(tree, out); diff --git a/genkicat/pdf.h b/genkicat/pdf.h index 1f2816b..562f6b0 100644 --- a/genkicat/pdf.h +++ b/genkicat/pdf.h @@ -12,6 +12,6 @@ #ifndef PDF_H #define PDF_H -void make_pdf(int pdf, int use_portrait); +void make_pdf(int pdf, int use_portrait, const char *title_page); #endif /* !PDF_H */