1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 19:07:42 +02:00

genex/pdf.c: added printing of comments

This commit is contained in:
Werner Almesberger 2012-04-17 06:08:44 -03:00
parent 904a60f7f9
commit 3f3d957c98

View File

@ -77,6 +77,28 @@ static void make_title(FILE *file, const struct node *node, int unit)
} }
static void print_comment(FILE *file, const struct line *comment)
{
const struct line *line;
int lines = 0;
int n;
fprintf(file, "gsave 90 rotate 0 setgray\n"
"/Helvetica findfont 12 scalefont setfont\n");
for (line = comment; line; line = line->next)
lines++;
n = 0;
for (line = comment; line; line = line->next) {
n++;
fprintf(file, "20 -%d moveto\n", 600+(n-lines)*14);
ps_string(file, line->s);
fprintf(file, " show\n");
}
fprintf(file, "grestore\n");
fflush(file);
}
static void convert_comp(const struct node *node, FILE *out) static void convert_comp(const struct node *node, FILE *out)
{ {
char *tmp; char *tmp;
@ -84,6 +106,8 @@ static void convert_comp(const struct node *node, FILE *out)
for (i = 0; i != node->units; i++) { for (i = 0; i != node->units; i++) {
make_title(stdout, node, i); make_title(stdout, node, i);
if (!i && node->comment)
print_comment(out, node->comment);
if (asprintf(&tmp, "./sym2xps '%s' '%s' %d '%s' '%s'", if (asprintf(&tmp, "./sym2xps '%s' '%s' %d '%s' '%s'",
node->lib, node->canon, i+1, "tmp", "tmp.ps") < 0) { node->lib, node->canon, i+1, "tmp", "tmp.ps") < 0) {
perror("asprintf"); perror("asprintf");