Date: | 2012-04-17 13:21:14 (11 years 11 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 0565adf11f9045872f18c6adb93282513b8022b0 |
Message: | genex: changed default orientation back to landscape; option -p for
portrait Since -l and -L are already taken, it's easier to make landscape the default. genex will typically be invoked from some wrapper anyway. |
Files: |
genex/genex.c (4 diffs) genex/pdf.c (2 diffs) genex/pdf.h (1 diff) |
Change Details
genex/genex.c | ||
---|---|---|
23 | 23 | static void usage(const char *name) |
24 | 24 | { |
25 | 25 | fprintf(stderr, |
26 | "usage: %s [-d] [-P] [-L libdir ...] [-l lib ...] hierarchy\n" | |
26 | "usage: %s [-d] [-p] [-P] [-L libdir ...] [-l lib ...] hierarchy\n" | |
27 | 27 | " %*s [descriptions ...]\n\n" |
28 | 28 | " -d dump the tree instead of generating a PDF\n" |
29 | 29 | " -L libdir search all libraries in the specified directory\n" |
30 | 30 | " -l lib search the specified component library\n" |
31 | " -p use portrait orientation; default: landscape\n" | |
31 | 32 | " -P generate Postscript instead of PDF (mainly for debugging)\n" |
32 | 33 | , name, (int) strlen(name), ""); |
33 | 34 | exit(1); |
... | ... | |
38 | 39 | { |
39 | 40 | FILE *file; |
40 | 41 | int c; |
41 | int dump = 0, postscript = 0; | |
42 | int dump = 0, postscript = 0, portrait = 0; | |
42 | 43 | char **arg; |
43 | 44 | |
44 | while ((c = getopt(argc, argv, "dL:l:P")) != EOF) | |
45 | while ((c = getopt(argc, argv, "dL:l:Pp")) != EOF) | |
45 | 46 | switch (c) { |
46 | 47 | case 'd': |
47 | 48 | dump = 1; |
... | ... | |
55 | 56 | case 'P': |
56 | 57 | postscript = 1; |
57 | 58 | break; |
59 | case 'p': | |
60 | portrait = 1; | |
61 | break; | |
58 | 62 | default: |
59 | 63 | usage(*argv); |
60 | 64 | } |
... | ... | |
88 | 92 | if (dump) |
89 | 93 | dump_tree(); |
90 | 94 | else |
91 | make_pdf(!postscript); | |
95 | make_pdf(!postscript, portrait); | |
92 | 96 | return 0; |
93 | 97 | } |
genex/pdf.c | ||
---|---|---|
30 | 30 | } name, path, lib, comment; |
31 | 31 | int comment_line_skip; |
32 | 32 | } landscape = { |
33 | .file_setup = "", | |
33 | .file_setup = "%%Orientation: Landscape", | |
34 | 34 | .overlay_setup = "90 rotate", |
35 | 35 | .comp_setup = "", |
36 | 36 | .left = 20, |
... | ... | |
211 | 211 | } |
212 | 212 | |
213 | 213 | |
214 | void make_pdf(int pdf) | |
214 | void make_pdf(int pdf, int use_portrait) | |
215 | 215 | { |
216 | 216 | FILE *out; |
217 | 217 | int res; |
218 | 218 | |
219 | if (0) | |
220 | format = landscape; | |
221 | else | |
219 | if (use_portrait) | |
222 | 220 | format = portrait; |
221 | else | |
222 | format = landscape; | |
223 | 223 | if (pdf) |
224 | 224 | out = popen( |
225 | 225 | "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- " |
genex/pdf.h | ||
---|---|---|
12 | 12 | #ifndef PDF_H |
13 | 13 | #define PDF_H |
14 | 14 | |
15 | void make_pdf(int pdf); | |
15 | void make_pdf(int pdf, int use_portrait); | |
16 | 16 | |
17 | 17 | #endif /* !PDF_H */ |
Branches:
master