1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-29 17:10:17 +02:00

gencat/: move script execution from pdf.c to library-specific function

This commit is contained in:
Werner Almesberger 2012-07-11 23:16:03 -03:00
parent 8ee13bdb05
commit acf0d0af89
3 changed files with 17 additions and 7 deletions

View File

@ -15,6 +15,7 @@
#include <string.h>
#include "util.h"
#include "run.h"
#include "libs.h"
@ -30,7 +31,7 @@ static const char *field(const char *s, int n)
}
static void add_comp_lib(struct lib *lib, const char *path)
static void comp_add_lib(struct lib *lib, const char *path)
{
FILE *file;
struct entry *e = NULL;
@ -77,7 +78,17 @@ static void add_comp_lib(struct lib *lib, const char *path)
}
void comp_ps_entry(FILE *file, const struct lib *lib,
const struct entry *e, int unit)
{
run_cmd("sym2xps '%s' '%s' %d '%s' '%s'",
e->file->path, e->names->s, unit+1, "tmp", "tmp.ps");
cat(file, "tmp.ps");
}
struct lib comp_lib = {
.ext = ".lib",
.add_lib = add_comp_lib,
.add_lib = comp_add_lib,
.ps_entry = comp_ps_entry,
};

View File

@ -34,6 +34,8 @@ struct file {
struct lib {
const char *ext; /* file extension, ".lib" or ".mod" */
void (*add_lib)(struct lib *lib, const char *path);
void (*ps_entry)(FILE *file, const struct lib *lib,
const struct entry *e, int unit);
struct file *files;
};

View File

@ -17,7 +17,6 @@
#include "gencat.h"
#include "tree.h"
#include "libs.h"
#include "run.h"
#include "pdf.h"
@ -280,6 +279,7 @@ static void print_comment(FILE *file, const struct line *comment)
static void convert_comp(const struct node *node, FILE *out)
{
const struct lib *lib = node->e->file->lib;
int i;
for (i = 0; i != node->e->units; i++) {
@ -290,11 +290,8 @@ static void convert_comp(const struct node *node, FILE *out)
make_title(out, node, i);
if (!i && node->comment)
print_comment(out, node->comment);
run_cmd("sym2xps '%s' '%s' %d '%s' '%s'",
node->e->file->path, node->e->names->s, i+1,
"tmp", "tmp.ps");
fprintf(out, "gsave %s\n", format.comp_setup);
cat(out, "tmp.ps");
node->e->file->lib->ps_entry(out, lib, node->e, i);
fprintf(out, "\ngrestore\n");
}
}