mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-29 18:20:38 +02:00
genex: generate PDF by default; new option -P to generate Postscript
This commit is contained in:
parent
8e8a3c56c6
commit
f8e10b31a7
@ -13,6 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "comp.h"
|
||||
#include "libs.h"
|
||||
@ -22,11 +23,13 @@
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-d] [-L libdir ...] [-l lib ...] hierarchy [descriptions ...]\n\n"
|
||||
"usage: %s [-d] [-P] [-L libdir ...] [-l lib ...] hierarchy\n"
|
||||
" %*s [descriptions ...]\n\n"
|
||||
" -d dump the tree instead of generating a PDF\n"
|
||||
" -L libdir search all libraries in the specified directory\n"
|
||||
" -l lib search the specified component library\n"
|
||||
, name);
|
||||
" -P generate Postscript instead of PDF (mainly for debugging)\n"
|
||||
, name, (int) strlen(name), "");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -35,10 +38,10 @@ int main(int argc, char **argv)
|
||||
{
|
||||
FILE *file;
|
||||
int c;
|
||||
int dump = 0;
|
||||
int dump = 0, postscript = 0;
|
||||
char **arg;
|
||||
|
||||
while ((c = getopt(argc, argv, "dL:l:")) != EOF)
|
||||
while ((c = getopt(argc, argv, "dL:l:P")) != EOF)
|
||||
switch (c) {
|
||||
case 'd':
|
||||
dump = 1;
|
||||
@ -49,6 +52,9 @@ int main(int argc, char **argv)
|
||||
case 'l':
|
||||
add_lib(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
postscript = 1;
|
||||
break;
|
||||
default:
|
||||
usage(*argv);
|
||||
}
|
||||
@ -82,6 +88,6 @@ int main(int argc, char **argv)
|
||||
if (dump)
|
||||
dump_tree();
|
||||
else
|
||||
make_pdf();
|
||||
make_pdf(!postscript);
|
||||
return 0;
|
||||
}
|
||||
|
11
genex/pdf.c
11
genex/pdf.c
@ -211,7 +211,7 @@ static void convert_tree(const struct node *node, FILE *out)
|
||||
}
|
||||
|
||||
|
||||
void make_pdf(void)
|
||||
void make_pdf(int pdf)
|
||||
{
|
||||
FILE *out;
|
||||
int res;
|
||||
@ -220,13 +220,12 @@ void make_pdf(void)
|
||||
format = landscape;
|
||||
else
|
||||
format = portrait;
|
||||
#if 0
|
||||
if (pdf)
|
||||
out = popen(
|
||||
"gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- -f -",
|
||||
"w");
|
||||
#else
|
||||
"gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- "
|
||||
"-f -", "w");
|
||||
else
|
||||
out = popen("cat", "w");
|
||||
#endif
|
||||
if (!out) {
|
||||
perror("gs");
|
||||
exit(1);
|
||||
|
@ -12,6 +12,6 @@
|
||||
#ifndef PDF_H
|
||||
#define PDF_H
|
||||
|
||||
void make_pdf(void);
|
||||
void make_pdf(int pdf);
|
||||
|
||||
#endif /* !PDF_H */
|
||||
|
Loading…
Reference in New Issue
Block a user