void emit_jobs (GVC_t * gvc, graph_t * g)
{
GVJ_t *job;
- char *prev_langname = "";
init_gvc_from_graph(gvc, g);
init_layering(gvc, g);
init_bb(g);
- gvc->active_jobs = NULL;
+/* gvc->active_jobs = NULL; acive job sets can straddle multiple input graphs */
for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
job->g = g;
return;
}
+
+ if (gvc->active_jobs && strcmp(job->output_langname,gvc->active_jobs->output_langname) != 0) {
+ /* finalize previous jobs */
+ gvrender_finalize(gvc);
+ /* clear active list */
+ gvc->active_jobs = NULL;
+ }
+ if (! gvc->active_jobs)
+ gvrender_initialize(gvc);
+
/* insert job in active list */
job->next_active = gvc->active_jobs;
gvc->active_jobs = job;
- if (strcmp(job->output_langname,prev_langname) != 0) {
- prev_langname = job->output_langname;
- gvrender_initialize(gvc);
- }
-
emit_job(job, g);
- if (!job->next || strcmp(job->next->output_langname,prev_langname) != 0) {
- gvrender_finalize(gvc);
- /* clear active list */
- gvc->active_jobs = NULL;
- }
+ /* last job, after all input graphs are processed, is finalized from dotneato_terminate() */
+
}
}
void dotneato_terminate(GVC_t * gvc)
{
+ gvrender_finalize(gvc);
emit_jobs_eof(gvc);
exit(graphviz_errors + agerrors());
}
U_lib = lib;
/* wrong when drawing more than one than one graph - use (atend) */
N_pages = pages.x * pages.y;
- Cur_page = 0;
- fprintf(Output_file, "%%!PS-Adobe-2.0\n");
- fprintf(Output_file, "%%%%Creator: %s version %s (%s)\n",
- info[0], info[1], info[2]);
- fprintf(Output_file, "%%%%For: %s\n", user);
- fprintf(Output_file, "%%%%Title: %s\n", g->name);
- fprintf(Output_file, "%%%%Pages: (atend)\n");
+ if (onetime) {
+ Cur_page = 0;
+ fprintf(Output_file, "%%!PS-Adobe-2.0\n");
+ fprintf(Output_file, "%%%%Creator: %s version %s (%s)\n",
+ info[0], info[1], info[2]);
+ fprintf(Output_file, "%%%%For: %s\n", user);
+ fprintf(Output_file, "%%%%Title: %s\n", g->name);
+ fprintf(Output_file, "%%%%Pages: (atend)\n");
+ }
/* remainder is emitted by first begin_graph */
}
void gvrender_finalize(GVC_t * gvc)
{
- GVJ_t *job = gvc->job;
+ GVJ_t *job = gvc->active_jobs;
gvrender_engine_t *gvre = job->render_engine;
if (gvre) {