mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 05:35:21 +02:00
gencat/: move script execution from pdf.c to library-specific function
This commit is contained in:
parent
8ee13bdb05
commit
acf0d0af89
@ -15,6 +15,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "run.h"
|
||||||
#include "libs.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;
|
FILE *file;
|
||||||
struct entry *e = NULL;
|
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 = {
|
struct lib comp_lib = {
|
||||||
.ext = ".lib",
|
.ext = ".lib",
|
||||||
.add_lib = add_comp_lib,
|
.add_lib = comp_add_lib,
|
||||||
|
.ps_entry = comp_ps_entry,
|
||||||
};
|
};
|
||||||
|
@ -34,6 +34,8 @@ struct file {
|
|||||||
struct lib {
|
struct lib {
|
||||||
const char *ext; /* file extension, ".lib" or ".mod" */
|
const char *ext; /* file extension, ".lib" or ".mod" */
|
||||||
void (*add_lib)(struct lib *lib, const char *path);
|
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;
|
struct file *files;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include "gencat.h"
|
#include "gencat.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "libs.h"
|
#include "libs.h"
|
||||||
#include "run.h"
|
|
||||||
#include "pdf.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)
|
static void convert_comp(const struct node *node, FILE *out)
|
||||||
{
|
{
|
||||||
|
const struct lib *lib = node->e->file->lib;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i != node->e->units; 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);
|
make_title(out, node, i);
|
||||||
if (!i && node->comment)
|
if (!i && node->comment)
|
||||||
print_comment(out, 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);
|
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");
|
fprintf(out, "\ngrestore\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user