mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2025-01-09 22:10:15 +02:00
genex/: added page header with name, hierarchical path, and path to library
This commit is contained in:
parent
dcee3901f5
commit
208d29b4cc
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
struct node {
|
struct node {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *lib; /* NULL if not intermediate node */
|
const char *lib; /* NULL if intermediate node */
|
||||||
const char *canon; /* canonical name of component */
|
const char *canon; /* canonical name of component */
|
||||||
int units; /* number of units */
|
int units; /* number of units */
|
||||||
int indent; /* level of indentation (characters) */
|
int indent; /* level of indentation (characters) */
|
||||||
|
49
genex/pdf.c
49
genex/pdf.c
@ -29,12 +29,61 @@ static int children(const struct node *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void ps_string(FILE *file, const char *s)
|
||||||
|
{
|
||||||
|
fputc('(', file);
|
||||||
|
while (*s) {
|
||||||
|
if (*s == '(' || *s == ')' || *s == '\\')
|
||||||
|
fputc('\\', file);
|
||||||
|
fputc(*s, file);
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
fputc(')', file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void print_path(FILE *file, const struct node *node)
|
||||||
|
{
|
||||||
|
if (node->parent) {
|
||||||
|
print_path(file, node->parent);
|
||||||
|
fprintf(file, "( > ) show\n");
|
||||||
|
}
|
||||||
|
ps_string(file, node->name);
|
||||||
|
fprintf(file, " 0.5 setgray show 0 setgray\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void make_title(FILE *file, const struct node *node, int unit)
|
||||||
|
{
|
||||||
|
fprintf(file, "gsave 90 rotate 0 setgray\n"
|
||||||
|
"/Helvetica-Bold findfont 24 scalefont setfont\n"
|
||||||
|
"20 -30 moveto\n");
|
||||||
|
ps_string(file, node->canon);
|
||||||
|
fprintf(file, " show\n");
|
||||||
|
if (node->units > 1)
|
||||||
|
fprintf(file, " ( \\(%c\\)) show\n", 'A'+unit);
|
||||||
|
|
||||||
|
fprintf(file, "/Hevetica-Bold findfont 18 scalefont setfont\n");
|
||||||
|
fprintf(file, "20 -60 moveto\n");
|
||||||
|
print_path(file, node);
|
||||||
|
|
||||||
|
fprintf(file, "/Courier findfont 12 scalefont setfont\n");
|
||||||
|
fprintf(file, "20 -75 moveto\n");
|
||||||
|
ps_string(file, node->lib);
|
||||||
|
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;
|
||||||
int i, res;
|
int i, res;
|
||||||
|
|
||||||
for (i = 0; i != node->units; i++) {
|
for (i = 0; i != node->units; i++) {
|
||||||
|
make_title(stdout, node, i);
|
||||||
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");
|
||||||
|
Loading…
Reference in New Issue
Block a user