Output_lang = job->output_lang;
#endif
+ init_job_flags(job, g);
+
/* if we already have an active job list and the device doesn't support mutiple output files, or we are about to write to a different output device */
firstjob = gvc->active_jobs;
if (firstjob
job->next_active = NULL; /* terminate active list */
job->callbacks = &gvdevice_callbacks;
- init_job_flags(job, g);
init_job_pad(job);
init_job_margin(job);
init_job_dpi(job, g);
$(INCLTDL) -I$(top_srcdir)/libltdl \
-DGVLIBDIR=\"$(pkglibdir)\"
-LIBS = $(LIBLTDL) $(SOCKET_LIBS)
+LIBS = $(LIBLTDL) $(SOCKET_LIBS) $(Z_LIBS)
pkginclude_HEADERS = gvc.h gvcext.h gvplugin.h gvcjob.h \
gvcommon.h gvplugin_render.h gvplugin_layout.h \
pointf *headendurl_map_p;
};
-typedef enum {COMPRESSION_NONE, COMPRESSION_ZLIB} compression_t;
-
/* Note on units:
* points - a physical distance (1/72 inch) unaffected by zoom or dpi.
* graph units - related to physical distance by zoom. Equals points at zoom=1
FILE *output_file;
int output_lang;
- compression_t compression;
-
gvplugin_active_render_t render;
gvplugin_active_device_t device;
gvplugin_active_loadimage_t loadimage;
/* device */
+ extern void gvdevice_fputs(GVJ_t * job, char *s);
+ extern void gvdevice_printf(GVJ_t * job, const char *format, ...);
+
extern void gvdevice_initialize(GVJ_t * job);
- extern void gvdevice_prepare(GVJ_t * job);
extern void gvdevice_format(GVJ_t * job);
extern void gvdevice_finalize(GVJ_t * job);
#include "config.h"
#endif
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#ifdef WIN32
#include <fcntl.h>
#include <io.h>
+#include "compat.h"
+#endif
+
+#ifdef HAVE_LIBZ
+#include <zlib.h>
#endif
-#include <stdlib.h>
-#include <string.h>
#include "const.h"
#include "gvplugin_device.h"
#include "gvcint.h"
#include "gvcproc.h"
-#if 0
-/* This code is not used - see gvrender_select() in gvrender.c */
+/* gvdevice selection is done in gvrender_select() in gvrender.c */
-int gvdevice_select(GVC_t * gvc, char *str)
+void gvdevice_fputs(GVJ_t * job, char *s)
{
- gvplugin_available_t *plugin;
- gvplugin_installed_t *typeptr;
-#ifdef WITH_CODEGENS
- codegen_info_t *cg_info;
-#endif
+ int len, rc;
- plugin = gvplugin_load(gvc, API_device, str);
- if (plugin) {
-#ifdef WITH_CODEGENS
- if (strcmp(plugin->packagename, "cg") == 0) {
- cg_info = (codegen_info_t *) (plugin->typeptr);
- gvc->codegen = cg_info->cg;
- return cg_info->id;
- } else {
-#endif
- typeptr = plugin->typeptr;
- gvc->device.engine = (gvdevice_engine_t *) (typeptr->engine);
- gvc->device.features =
- (gvdevice_features_t *) (typeptr->features);
- gvc->device.id = typeptr->id;
- return GVRENDER_PLUGIN;
-#ifdef WITH_CODEGENS
- }
+ len = strlen(s);
+ if (job->flags & GVDEVICE_COMPRESSED_FORMAT) {
+#ifdef HAVE_LIBZ
+ gzwrite((gzFile *) (job->output_file), s, (unsigned) len);
#endif
}
- return NO_SUPPORT;
+ else
+ rc = fwrite(s, sizeof(char), (unsigned) len, job->output_file);
}
-int gvdevice_features(GVC_t * gvc)
+/* gvdevice_printf:
+ * Note that this function is unsafe due to the fixed buffer size.
+ * It should only be used when the caller is sure the input will not
+ * overflow the buffer. In particular, it should be avoided for
+ * input coming from users. Also, if vsnprintf is available, the
+ * code should check for return values to use it safely.
+ */
+void gvdevice_printf(GVJ_t * job, const char *format, ...)
{
- gvdevice_engine_t *gvde = gvc->device.engine;
- int features = 0;
+ char buf[BUFSIZ];
+ va_list argp;
+
+ va_start(argp, format);
+#ifdef HAVE_VSNPRINTF
+ (void) vsnprintf(buf, sizeof(buf), format, argp);
+#else
+ (void) vsprintf(buf, format, argp);
+#endif
+ va_end(argp);
- if (gvde)
- features = gvc->device.features->flags;
- return features;
+ gvdevice_fputs(job, buf);
}
-#endif
static void auto_output_filename(GVJ_t *job)
{
setmode(fileno(job->output_file), O_BINARY);
#endif
#endif
+
+ if (job->flags & GVDEVICE_COMPRESSED_FORMAT) {
+#if HAVE_LIBZ
+ int fd;
+
+ /* open dup so can gzclose independent of FILE close */
+ fd = dup(fileno(job->output_file));
+ job->output_file = (FILE *) (gzdopen(fd, "wb"));
+ if (!job->output_file) {
+ (job->common->errorfn) ("Error initializing compression on output file\n");
+ exit(1);
+ }
+#else
+ (job->common->errorfn) ("No libz support.\n");
+ exit(1);
+#endif
+ }
}
}
}
if (gvde && gvde->format)
gvde->format(job);
- if (job->output_file && ! job->external_context && job->output_lang != TK)
+ if (job->output_file
+ && ! job->external_context
+ && job->output_lang != TK
+ && ! job->flags & GVDEVICE_COMPRESSED_FORMAT)
fflush(job->output_file);
}
if (! finalized_p) {
/* if the device has no finalization then it uses file output */
for (job = firstjob; job; job = job->next_active) {
+ if (job->flags & GVDEVICE_COMPRESSED_FORMAT) {
+#ifdef HAVE_LIBZ
+ gzclose((gzFile *) (job->output_file));
+ job->output_file = NULL;
+#else
+ (job->common->errorfn) ("No libz support\n");
+ exit(1);
+#endif
+ }
if (job->output_filename
&& job->output_file != stdout
&& ! job->external_context) {
#include "gvplugin.h"
#include "gvcjob.h"
+extern void gvdevice_fputs(GVJ_t * job, char *s);
+extern void gvdevice_printf(GVJ_t * job, const char *format, ...);
+
#ifdef __cplusplus
extern "C" {
#endif
libgvplugin_core_C_la_SOURCES = \
gvplugin_core.c \
- gvrender_core.c \
gvrender_core_dot.c \
gvrender_core_ps.c \
gvrender_core_fig.c \
/* for n->name */
#include "graph.h"
-extern void core_fputs(GVJ_t * job, char *s);
-extern void core_printf(GVJ_t * job, const char *format, ...);
-
extern void core_loadimage_xdot(GVJ_t*, usershape_t*, boxf, boolean);
extern void epsf_emit_body(usershape_t *us, FILE *of);
extern shape_desc *find_user_shape(char *name);
assert(us->name);
assert(us->f);
- core_fputs(job, "<image xlink:href=\"");
- core_fputs(job, us->name);
+ gvdevice_fputs(job, "<image xlink:href=\"");
+ gvdevice_fputs(job, us->name);
if (job->rotation) {
- core_printf (job, "\" width=\"%gpx\" height=\"%gpx\" preserveAspectRatio=\"xMidYMid meet\" x=\"%g\" y=\"%g\"",
+ gvdevice_printg (job, "\" width=\"%gpx\" height=\"%gpx\" preserveAspectRatio=\"xMidYMid meet\" x=\"%g\" y=\"%g\"",
b.UR.y - b.LL.y, b.UR.x - b.LL.x, b.LL.x, b.UR.y);
- core_printf (job, " transform=\"rotate(%d %g %g)\"",
+ gvdevice_printg (job, " transform=\"rotate(%d %g %g)\"",
job->rotation, b.LL.x, b.UR.y);
}
else {
- core_printf (job, "\" width=\"%gpx\" height=\"%gpx\" preserveAspectRatio=\"xMinYMin meet\" x=\"%g\" y=\"%g\"",
+ gvdevice_printg (job, "\" width=\"%gpx\" height=\"%gpx\" preserveAspectRatio=\"xMinYMin meet\" x=\"%g\" y=\"%g\"",
b.UR.x - b.LL.x, b.UR.y - b.LL.y, b.LL.x, -b.UR.y);
}
- core_fputs(job, "/>\n");
+ gvdevice_fputs(job, "/>\n");
}
static void core_loadimage_fig(GVJ_t * job, usershape_t *us, boxf bf, boolean filled)
BF2B(bf, b);
- core_printf(job, "%d %d %d %d %d %d %d %d %d %.1f %d %d %d %d %d %d\n %d %s\n",
+ gvdevice_printg(job, "%d %d %d %d %d %d %d %d %d %.1f %d %d %d %d %d %d\n %d %s\n",
object_code, sub_type, line_style, thickness, pen_color,
fill_color, depth, pen_style, area_fill, style_val, join_style,
cap_style, radius, forward_arrow, backward_arrow, npoints,
flipped, us->name);
- core_printf(job," %d %d %d %d %d %d %d %d %d %d\n",
+ gvdevice_printg(job," %d %d %d %d %d %d %d %d %d %d\n",
b.LL.x, b.LL.y,
b.LL.x, b.UR.y,
b.UR.x, b.UR.y,
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/**********************************************************
-* This software is part of the graphviz package *
-* http://www.graphviz.org/ *
-* *
-* Copyright (c) 1994-2004 AT&T Corp. *
-* and is licensed under the *
-* Common Public License, Version 1.0 *
-* by AT&T Corp. *
-* *
-* Information and Software Systems Research *
-* AT&T Research, Florham Park NJ *
-**********************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_LIBZ
-#include <zlib.h>
-#endif
-
-#ifdef WIN32
-#include "compat.h"
-#endif
-
-#include "gvplugin_render.h"
-
-void core_init_compression(GVJ_t *job, compression_t compression)
-{
-#if HAVE_LIBZ
- int fd;
-#endif
-
- switch ((job->compression = compression)) {
- case COMPRESSION_ZLIB:
-#if HAVE_LIBZ
- /* open dup so can gzclose independent of FILE close */
- fd = dup(fileno(job->output_file));
- job->output_file = (FILE *) (gzdopen(fd, "wb"));
- if (!job->output_file) {
- (job->common->errorfn) ("Error initializing compression on output file\n");
- exit(1);
- }
- break;
-#else
- (job->common->errorfn) ("No libz support.\n");
- exit(1);
-#endif
- case COMPRESSION_NONE:
- break;
- }
-}
-
-void core_fini_compression(GVJ_t *job)
-{
- switch (job->compression) {
- case COMPRESSION_ZLIB:
-#ifdef HAVE_LIBZ
- gzclose((gzFile *) (job->output_file));
- job->output_file = NULL;
- break;
-#else
- (job->common->errorfn) ("No libz support\n");
- exit(1);
-#endif
- case COMPRESSION_NONE:
- break;
- }
-}
-
-void core_fputs(GVJ_t * job, char *s)
-{
- int len, rc;
-
- len = strlen(s);
- switch (job->compression) {
- case COMPRESSION_ZLIB:
-#ifdef HAVE_LIBZ
- gzwrite((gzFile *) (job->output_file), s, (unsigned) len);
-#endif
- break;
- case COMPRESSION_NONE:
- rc = fwrite(s, sizeof(char), (unsigned) len, job->output_file);
- break;
- }
-}
-
-/* core_printf:
- * Note that this function is unsafe due to the fixed buffer size.
- * It should only be used when the caller is sure the input will not
- * overflow the buffer. In particular, it should be avoided for
- * input coming from users. Also, if vsnprintf is available, the
- * code should check for return values to use it safely.
- */
-void core_printf(GVJ_t * job, const char *format, ...)
-{
- char buf[BUFSIZ];
- va_list argp;
-
- va_start(argp, format);
-#ifdef HAVE_VSNPRINTF
- (void) vsnprintf(buf, sizeof(buf), format, argp);
-#else
- (void) vsprintf(buf, format, argp);
-#endif
- va_end(argp);
-
- core_fputs(job, buf);
-}
static int Depth;
-extern void core_fputs(GVJ_t * job, char *s);
-extern void core_printf(GVJ_t * job, const char *format, ...);
-
static void figptarray(GVJ_t *job, pointf * A, int n, int close)
{
int i;
for (i = 0; i < n; i++) {
PF2P(A[i],p);
- core_printf(job, " %d %d", p.x, p.y);
+ gvdevice_printf(job, " %d %d", p.x, p.y);
}
if (close) {
PF2P(A[0],p);
- core_printf(job, " %d %d", p.x, p.y);
+ gvdevice_printf(job, " %d %d", p.x, p.y);
}
- core_fputs(job, "\n");
+ gvdevice_fputs(job, "\n");
}
static char *fig_string(char *s)
color->u.rgba[1],
color->u.rgba[2]);
if (new)
- core_printf(job, "%d %d #%02x%02x%02x\n",
+ gvdevice_printf(job, "%d %d #%02x%02x%02x\n",
object_code, i,
color->u.rgba[0],
color->u.rgba[1],
static void fig_comment(GVJ_t *job, char *str)
{
- core_printf(job, "# %s\n", str);
+ gvdevice_printf(job, "# %s\n", str);
}
static void fig_begin_graph(GVJ_t * job)
{
obj_state_t *obj = job->obj;
- core_fputs(job, "#FIG 3.2\n");
- core_printf(job, "# Generated by %s version %s (%s)\n",
+ gvdevice_fputs(job, "#FIG 3.2\n");
+ gvdevice_printf(job, "# Generated by %s version %s (%s)\n",
job->common->info[0], job->common->info[1], job->common->info[2]);
- core_printf(job, "# For: %s\n", job->common->user);
- core_printf(job, "# Title: %s\n", obj->u.g->name);
- core_printf(job, "# Pages: %d\n", job->pagesArraySize.x * job->pagesArraySize.y);
- core_fputs(job, "Portrait\n"); /* orientation */
- core_fputs(job, "Center\n"); /* justification */
- core_fputs(job, "Inches\n"); /* units */
- core_fputs(job, "Letter\n"); /* papersize */
- core_fputs(job, "100.00\n"); /* magnification % */
- core_fputs(job, "Single\n"); /* multiple-page */
- core_fputs(job, "-2\n"); /* transparent color (none) */
- core_fputs(job, "1200"); /* resolution */
- core_fputs(job, " 2\n"); /* coordinate system (upper left) */
+ gvdevice_printf(job, "# For: %s\n", job->common->user);
+ gvdevice_printf(job, "# Title: %s\n", obj->u.g->name);
+ gvdevice_printf(job, "# Pages: %d\n", job->pagesArraySize.x * job->pagesArraySize.y);
+ gvdevice_fputs(job, "Portrait\n"); /* orientation */
+ gvdevice_fputs(job, "Center\n"); /* justification */
+ gvdevice_fputs(job, "Inches\n"); /* units */
+ gvdevice_fputs(job, "Letter\n"); /* papersize */
+ gvdevice_fputs(job, "100.00\n"); /* magnification % */
+ gvdevice_fputs(job, "Single\n"); /* multiple-page */
+ gvdevice_fputs(job, "-2\n"); /* transparent color (none) */
+ gvdevice_fputs(job, "1200"); /* resolution */
+ gvdevice_fputs(job, " 2\n"); /* coordinate system (upper left) */
}
static void fig_end_graph(GVJ_t * job)
{
- core_fputs(job, "# end of FIG file\n");
+ gvdevice_fputs(job, "# end of FIG file\n");
}
static void fig_begin_page(GVJ_t * job)
break;
}
- core_printf(job,
+ gvdevice_printf(job,
"%d %d %d %d %d %d %.1f %.4f %d %.1f %.1f %d %d %s\\001\n",
object_code, sub_type, color, depth, pen_style, font,
font_size, angle, font_flags, height, length, ROUND(p.x), ROUND(p.y),
end_x = ROUND(A[1].x);
end_y = ROUND(A[1].y);
- core_printf(job,
+ gvdevice_printf(job,
"%d %d %d %d %d %d %d %d %d %.3f %d %.4f %d %d %d %d %d %d %d %d\n",
object_code, sub_type, line_style, thickness, pen_color,
fill_color, depth, pen_style, area_fill, style_val, direction,
}
}
- core_printf(job, "%d %d %d %d %d %d %d %d %d %.1f %d %d %d %d\n",
+ gvdevice_printf(job, "%d %d %d %d %d %d %d %d %d %.1f %d %d %d %d\n",
object_code,
sub_type,
line_style,
area_fill,
style_val, cap_style, forward_arrow, backward_arrow, count);
- core_printf(job, " %s\n", buffer); /* print points */
+ gvdevice_printf(job, " %s\n", buffer); /* print points */
free(buffer);
for (i = 0; i < count; i++) {
- core_printf(job, " %d", i % (count - 1) ? 1 : 0); /* -1 on all */
+ gvdevice_printf(job, " %d", i % (count - 1) ? 1 : 0); /* -1 on all */
}
- core_fputs(job, "\n");
+ gvdevice_fputs(job, "\n");
}
static void fig_polygon(GVJ_t * job, pointf * A, int n, int filled)
fig_line_style(obj, &line_style, &style_val);
- core_printf(job,
+ gvdevice_printf(job,
"%d %d %d %d %d %d %d %d %d %.1f %d %d %d %d %d %d\n",
object_code, sub_type, line_style, thickness, pen_color,
fill_color, depth, pen_style, area_fill, style_val, join_style,
fig_line_style(obj, &line_style, &style_val);
- core_printf(job,
+ gvdevice_printf(job,
"%d %d %d %d %d %d %d %d %d %.1f %d %d %d %d %d %d\n",
object_code, sub_type, line_style, thickness, pen_color,
fill_color, depth, pen_style, area_fill, style_val, join_style,
#include "graph.h"
extern char *xml_string(char *str);
-extern void core_fputs(GVJ_t * job, char *s);
-extern void core_printf(GVJ_t * job, const char *format, ...);
typedef enum { FORMAT_IMAP, FORMAT_ISMAP, FORMAT_CMAP, FORMAT_CMAPX, } format_type;
switch (map_shape) {
case MAP_RECTANGLE:
/* Y_GOES_DOWN so need UL to LR */
- core_printf(job, "rect %s %d,%d %d,%d\n", url,
+ gvdevice_printf(job, "rect %s %d,%d %d,%d\n", url,
A[0].x, A[1].y, A[1].x, A[0].y);
break;
case MAP_CIRCLE:
- core_printf(job, "circle %s %d,%d,%d\n", url,
+ gvdevice_printf(job, "circle %s %d,%d,%d\n", url,
A[0].x, A[0].y, A[1].x-A[0].x);
break;
case MAP_POLYGON:
- core_printf(job, "poly %s", url);
+ gvdevice_printf(job, "poly %s", url);
for (i = 0; i < nump; i++)
- core_printf(job, " %d,%d", A[i].x, A[i].y);
- core_fputs(job, "\n");
+ gvdevice_printf(job, " %d,%d", A[i].x, A[i].y);
+ gvdevice_fputs(job, "\n");
break;
default:
assert(0);
switch (map_shape) {
case MAP_RECTANGLE:
/* Y_GOES_DOWN so need UL to LR */
- core_printf(job, "rectangle (%d,%d) (%d,%d) %s %s\n",
+ gvdevice_printf(job, "rectangle (%d,%d) (%d,%d) %s %s\n",
A[0].x, A[1].y, A[1].x, A[0].y, url, tooltip);
break;
default:
} else if (job->render.id == FORMAT_CMAP || job->render.id == FORMAT_CMAPX) {
switch (map_shape) {
case MAP_CIRCLE:
- core_fputs(job, "<area shape=\"circle\"");
+ gvdevice_fputs(job, "<area shape=\"circle\"");
break;
case MAP_RECTANGLE:
- core_fputs(job, "<area shape=\"rect\"");
+ gvdevice_fputs(job, "<area shape=\"rect\"");
break;
case MAP_POLYGON:
- core_fputs(job, "<area shape=\"poly\"");
+ gvdevice_fputs(job, "<area shape=\"poly\"");
break;
default:
assert(0);
break;
}
if (url && url[0]) {
- core_fputs(job, " href=\"");
- core_fputs(job, xml_string(url));
- core_fputs(job, "\"");
+ gvdevice_fputs(job, " href=\"");
+ gvdevice_fputs(job, xml_string(url));
+ gvdevice_fputs(job, "\"");
}
if (target && target[0]) {
- core_fputs(job, " target=\"");
- core_fputs(job, xml_string(target));
- core_fputs(job, "\"");
+ gvdevice_fputs(job, " target=\"");
+ gvdevice_fputs(job, xml_string(target));
+ gvdevice_fputs(job, "\"");
}
if (tooltip && tooltip[0]) {
- core_fputs(job, " title=\"");
- core_fputs(job, xml_string(tooltip));
- core_fputs(job, "\"");
+ gvdevice_fputs(job, " title=\"");
+ gvdevice_fputs(job, xml_string(tooltip));
+ gvdevice_fputs(job, "\"");
}
/*
* alt text is intended for the visually impaired, but such
* that require that there is always an alt string,
* we generate just an empty alt string.
*/
- core_fputs(job, " alt=\"\"");
+ gvdevice_fputs(job, " alt=\"\"");
- core_fputs(job, " coords=\"");
+ gvdevice_fputs(job, " coords=\"");
switch (map_shape) {
case MAP_CIRCLE:
- core_printf(job, "%d,%d,%d", A[0].x, A[0].y, A[1].x-A[0].x);
+ gvdevice_printf(job, "%d,%d,%d", A[0].x, A[0].y, A[1].x-A[0].x);
break;
case MAP_RECTANGLE:
/* Y_GOES_DOWN so need UL to LR */
- core_printf(job, "%d,%d,%d,%d", A[0].x, A[1].y, A[1].x, A[0].y);
+ gvdevice_printf(job, "%d,%d,%d,%d", A[0].x, A[1].y, A[1].x, A[0].y);
break;
case MAP_POLYGON:
- core_printf(job, "%d,%d", A[0].x, A[0].y);
+ gvdevice_printf(job, "%d,%d", A[0].x, A[0].y);
for (i = 1; i < nump; i++)
- core_printf(job, " %d,%d", A[i].x, A[i].y);
+ gvdevice_printf(job, " %d,%d", A[i].x, A[i].y);
break;
default:
break;
}
if (job->render.id == FORMAT_CMAPX)
- core_fputs(job, "\"/>\n");
+ gvdevice_fputs(job, "\"/>\n");
else
- core_fputs(job, "\">\n");
+ gvdevice_fputs(job, "\">\n");
}
}
switch (job->render.id) {
case FORMAT_IMAP:
- core_fputs(job, "base referer\n");
+ gvdevice_fputs(job, "base referer\n");
if (obj->url && obj->url[0]) {
- core_fputs(job, "default ");
- core_fputs(job, xml_string(obj->url));
- core_fputs(job, "\n");
+ gvdevice_fputs(job, "default ");
+ gvdevice_fputs(job, xml_string(obj->url));
+ gvdevice_fputs(job, "\n");
}
break;
case FORMAT_ISMAP:
if (obj->url && obj->url[0]) {
- core_fputs(job, "default ");
- core_fputs(job, xml_string(obj->url));
- core_fputs(job, " ");
- core_fputs(job, xml_string(obj->u.g->name));
- core_fputs(job, "\n");
+ gvdevice_fputs(job, "default ");
+ gvdevice_fputs(job, xml_string(obj->url));
+ gvdevice_fputs(job, " ");
+ gvdevice_fputs(job, xml_string(obj->u.g->name));
+ gvdevice_fputs(job, "\n");
}
break;
case FORMAT_CMAPX:
s = xml_string(obj->u.g->name);
- core_fputs(job, "<map id=\"");
- core_fputs(job, s);
- core_fputs(job, "\" name=\"");
- core_fputs(job, s);
- core_fputs(job, "\">\n");
+ gvdevice_fputs(job, "<map id=\"");
+ gvdevice_fputs(job, s);
+ gvdevice_fputs(job, "\" name=\"");
+ gvdevice_fputs(job, s);
+ gvdevice_fputs(job, "\">\n");
break;
default:
break;
case FORMAT_CMAPX:
map_output_shape(job, obj->url_map_shape, obj->url_map_p,obj->url_map_n,
obj->url, obj->tooltip, obj->target);
- core_fputs(job, "</map>\n");
+ gvdevice_fputs(job, "</map>\n");
break;
default:
break;
{
obj_state_t *obj = job->obj;
- core_printf(job, "%% %s\n", obj->u.sg->name);
+ gvdevice_printf(job, "%% %s\n", obj->u.sg->name);
map_output_shape(job, obj->url_map_shape, obj->url_map_p, obj->url_map_n,
obj->url, obj->tooltip, obj->target);
extern void epsf_define(FILE * of);
extern char *ps_string(char *ins, int latin);
-extern void core_fputs(GVJ_t * job, char *s);
-extern void core_printf(GVJ_t * job, const char *format, ...);
typedef enum { FORMAT_PS, FORMAT_PS2, } format_type;
static void psgen_begin_job(GVJ_t * job)
{
- core_fputs(job, "%!PS-Adobe-2.0\n");
- core_printf(job, "%%%%Creator: %s version %s (%s)\n",
+ gvdevice_fputs(job, "%!PS-Adobe-2.0\n");
+ gvdevice_printf(job, "%%%%Creator: %s version %s (%s)\n",
job->common->info[0], job->common->info[1], job->common->info[2]);
- core_printf(job, "%%%%For: %s\n", job->common->user);
+ gvdevice_printf(job, "%%%%For: %s\n", job->common->user);
}
static void psgen_end_job(GVJ_t * job)
{
- core_fputs(job, "%%Trailer\n");
- core_printf(job, "%%%%Pages: %d\n", job->common->viewNum);
+ gvdevice_fputs(job, "%%Trailer\n");
+ gvdevice_printf(job, "%%%%Pages: %d\n", job->common->viewNum);
if (job->common->show_boxes == NULL)
- core_printf(job, "%%%%BoundingBox: %d %d %d %d\n",
+ gvdevice_printf(job, "%%%%BoundingBox: %d %d %d %d\n",
job->boundingBox.LL.x, job->boundingBox.LL.y,
job->boundingBox.UR.x, job->boundingBox.UR.y);
- core_fputs(job, "end\nrestore\n");
- core_fputs(job, "%%EOF\n");
+ gvdevice_fputs(job, "end\nrestore\n");
+ gvdevice_fputs(job, "%%EOF\n");
}
static void psgen_begin_graph(GVJ_t * job)
setupLatin1 = FALSE;
if (job->common->viewNum == 0) {
- core_printf(job, "%%%%Title: %s\n", obj->u.g->name);
- core_fputs(job, "%%Pages: (atend)\n");
+ gvdevice_printf(job, "%%%%Title: %s\n", obj->u.g->name);
+ gvdevice_fputs(job, "%%Pages: (atend)\n");
if (job->common->show_boxes == NULL)
- core_fputs(job, "%%BoundingBox: (atend)\n");
- core_fputs(job, "%%EndComments\nsave\n");
+ gvdevice_fputs(job, "%%BoundingBox: (atend)\n");
+ gvdevice_fputs(job, "%%EndComments\nsave\n");
/* include shape library */
cat_preamble(job, job->common->lib);
/* include epsf */
* get the expected PostScript output.
*/
if (!setupLatin1) {
- core_fputs(job, "setupLatin1\n"); /* as defined in ps header */
+ gvdevice_fputs(job, "setupLatin1\n"); /* as defined in ps header */
setupLatin1 = TRUE;
}
/* Set base URL for relative links (for Distiller >= 3.0) */
if (obj->url)
- core_printf(job, "[ {Catalog} << /URI << /Base (%s) >> >>\n"
+ gvdevice_printf(job, "[ {Catalog} << /URI << /Base (%s) >> >>\n"
"/PUT pdfmark\n", obj->url);
}
static void psgen_begin_layer(GVJ_t * job, char *layername, int layerNum, int numLayers)
{
- core_printf(job, "%d %d setlayer\n", layerNum, numLayers);
+ gvdevice_printf(job, "%d %d setlayer\n", layerNum, numLayers);
}
static void psgen_begin_page(GVJ_t * job)
{
box pbr = job->pageBoundingBox;
- core_printf(job, "%%%%Page: %d %d\n",
+ gvdevice_printf(job, "%%%%Page: %d %d\n",
job->common->viewNum + 1, job->common->viewNum + 1);
if (job->common->show_boxes == NULL)
- core_printf(job, "%%%%PageBoundingBox: %d %d %d %d\n",
+ gvdevice_printf(job, "%%%%PageBoundingBox: %d %d %d %d\n",
pbr.LL.x, pbr.LL.y, pbr.UR.x, pbr.UR.y);
- core_printf(job, "%%%%PageOrientation: %s\n",
+ gvdevice_printf(job, "%%%%PageOrientation: %s\n",
(job->rotation ? "Landscape" : "Portrait"));
if (job->render.id == FORMAT_PS2)
- core_printf(job, "<< /PageSize [%d %d] >> setpagedevice\n",
+ gvdevice_printf(job, "<< /PageSize [%d %d] >> setpagedevice\n",
pbr.UR.x, pbr.UR.y);
- core_printf(job, "%d %d %d beginpage\n",
+ gvdevice_printf(job, "%d %d %d beginpage\n",
job->pagesArrayElem.x, job->pagesArrayElem.y, job->numPages);
if (job->common->show_boxes == NULL)
- core_printf(job, "gsave\n%d %d %d %d boxprim clip newpath\n",
+ gvdevice_printf(job, "gsave\n%d %d %d %d boxprim clip newpath\n",
pbr.LL.x, pbr.LL.y, pbr.UR.x-pbr.LL.x, pbr.UR.y-pbr.LL.y);
- core_printf(job, "%g %g set_scale %d rotate %g %g translate\n",
+ gvdevice_printf(job, "%g %g set_scale %d rotate %g %g translate\n",
job->scale.x, job->scale.y,
job->rotation,
job->translation.x, job->translation.y);
job->common->errorfn("canvas size (%d,%d) exceeds PDF limit (%d)\n"
"\t(suggest setting a bounding box size, see dot(1))\n",
pbr.UR.x, pbr.UR.y, PDFMAX);
- core_printf(job, "[ /CropBox [%d %d %d %d] /PAGES pdfmark\n",
+ gvdevice_printf(job, "[ /CropBox [%d %d %d %d] /PAGES pdfmark\n",
pbr.LL.x, pbr.LL.y, pbr.UR.x, pbr.UR.y);
}
}
static void psgen_end_page(GVJ_t * job)
{
if (job->common->show_boxes) {
- core_fputs(job, "0 0 0 edgecolor\n");
+ gvdevice_fputs(job, "0 0 0 edgecolor\n");
cat_libfile(job->output_file, NULL, job->common->show_boxes + 1);
}
/* the showpage is really a no-op, but at least one PS processor
* out there needs to see this literal token. endpage does the real work.
*/
- core_fputs(job, "endpage\nshowpage\ngrestore\n");
- core_fputs(job, "%%PageTrailer\n");
- core_printf(job, "%%%%EndPage: %d\n", job->common->viewNum);
+ gvdevice_fputs(job, "endpage\nshowpage\ngrestore\n");
+ gvdevice_fputs(job, "%%PageTrailer\n");
+ gvdevice_printf(job, "%%%%EndPage: %d\n", job->common->viewNum);
}
static void psgen_begin_cluster(GVJ_t * job)
{
obj_state_t *obj = job->obj;
- core_printf(job, "%% %s\n", obj->u.sg->name);
+ gvdevice_printf(job, "%% %s\n", obj->u.sg->name);
- core_fputs(job, "gsave\n");
+ gvdevice_fputs(job, "gsave\n");
}
static void psgen_end_cluster(GVJ_t * job)
{
- core_fputs(job, "grestore\n");
+ gvdevice_fputs(job, "grestore\n");
}
static void psgen_begin_node(GVJ_t * job)
{
- core_fputs(job, "gsave\n");
+ gvdevice_fputs(job, "gsave\n");
}
static void psgen_end_node(GVJ_t * job)
{
- core_fputs(job, "grestore\n");
+ gvdevice_fputs(job, "grestore\n");
}
static void
psgen_begin_edge(GVJ_t * job)
{
- core_fputs(job, "gsave\n");
+ gvdevice_fputs(job, "gsave\n");
}
static void psgen_end_edge(GVJ_t * job)
{
- core_fputs(job, "grestore\n");
+ gvdevice_fputs(job, "grestore\n");
}
static void psgen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *target)
obj_state_t *obj = job->obj;
if (url && obj->url_map_p) {
- core_printf(job, "[ /Rect [ %g %g %g %g ]\n",
+ gvdevice_printf(job, "[ /Rect [ %g %g %g %g ]\n",
obj->url_map_p[0].x, obj->url_map_p[0].y,
obj->url_map_p[1].x, obj->url_map_p[1].y);
- core_printf(job, " /Border [ 0 0 0 ]\n"
+ gvdevice_printf(job, " /Border [ 0 0 0 ]\n"
" /Action << /Subtype /URI /URI %s >>\n"
" /Subtype /Link\n"
"/ANN pdfmark\n",
double penwidth = job->obj->penwidth;
char *p, *line, **s = job->obj->rawstyle;
- core_printf(job,"%g setlinewidth\n", penwidth);
+ gvdevice_printf(job,"%g setlinewidth\n", penwidth);
while (s && (p = line = *s++)) {
if (strcmp(line, "setlinewidth") == 0)
p++;
p++;
while (*p) {
- core_printf(job,"%s ", p);
+ gvdevice_printf(job,"%s ", p);
while (*p)
p++;
p++;
}
if (strcmp(line, "invis") == 0)
job->obj->penwidth = 0;
- core_printf(job, "%s\n", line);
+ gvdevice_printf(job, "%s\n", line);
}
}
objtype = "sethsb";
break;
}
- core_printf(job, "%.3f %.3f %.3f %scolor\n",
+ gvdevice_printf(job, "%.3f %.3f %.3f %scolor\n",
color->u.HSVA[0], color->u.HSVA[1], color->u.HSVA[2], objtype);
}
}
return; /* skip transparent text */
ps_set_color(job, &(job->obj->pencolor));
- core_printf(job, "%.2f /%s set_font\n", para->fontsize, para->fontname);
+ gvdevice_printf(job, "%.2f /%s set_font\n", para->fontsize, para->fontname);
str = ps_string(para->str,isLatin1);
if (para->xshow) {
switch (para->just) {
p.x -= para->width / 2;
break;
}
- core_printf(job, "%g %g moveto\n%s\n[%s]\nxshow\n",
+ gvdevice_printf(job, "%g %g moveto\n%s\n[%s]\nxshow\n",
p.x, p.y, str, para->xshow);
} else {
switch (para->just) {
adj = -0.5;
break;
}
- core_printf(job, "%g %g moveto %g %g %s alignedtext\n",
+ gvdevice_printf(job, "%g %g moveto %g %g %s alignedtext\n",
p.x, p.y, para->width, adj, str);
}
}
if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
ps_set_color(job, &(job->obj->fillcolor));
- core_printf(job, "%g %g %g %g ellipse_path fill\n",
+ gvdevice_printf(job, "%g %g %g %g ellipse_path fill\n",
A[0].x, A[0].y, fabs(A[1].x - A[0].x), fabs(A[1].y - A[0].y));
}
if (job->obj->pencolor.u.HSVA[3] > .5) {
ps_set_pen_style(job);
ps_set_color(job, &(job->obj->pencolor));
- core_printf(job, "%g %g %g %g ellipse_path stroke\n",
+ gvdevice_printf(job, "%g %g %g %g ellipse_path stroke\n",
A[0].x, A[0].y, fabs(A[1].x - A[0].x), fabs(A[1].y - A[0].y));
}
}
if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
ps_set_color(job, &(job->obj->fillcolor));
- core_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
+ gvdevice_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
for (j = 1; j < n; j += 3)
- core_printf(job, "%g %g %g %g %g %g curveto\n",
+ gvdevice_printf(job, "%g %g %g %g %g %g curveto\n",
A[j].x, A[j].y, A[j + 1].x, A[j + 1].y, A[j + 2].x,
A[j + 2].y);
- core_fputs(job, "closepath fill\n");
+ gvdevice_fputs(job, "closepath fill\n");
}
if (job->obj->pencolor.u.HSVA[3] > .5) {
ps_set_pen_style(job);
ps_set_color(job, &(job->obj->pencolor));
- core_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
+ gvdevice_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
for (j = 1; j < n; j += 3)
- core_printf(job, "%g %g %g %g %g %g curveto\n",
+ gvdevice_printf(job, "%g %g %g %g %g %g curveto\n",
A[j].x, A[j].y, A[j + 1].x, A[j + 1].y, A[j + 2].x,
A[j + 2].y);
- core_fputs(job, "stroke\n");
+ gvdevice_fputs(job, "stroke\n");
}
}
if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
ps_set_color(job, &(job->obj->fillcolor));
- core_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
+ gvdevice_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
for (j = 1; j < n; j++)
- core_printf(job, "%g %g lineto\n", A[j].x, A[j].y);
- core_printf(job, "closepath fill\n");
+ gvdevice_printf(job, "%g %g lineto\n", A[j].x, A[j].y);
+ gvdevice_printf(job, "closepath fill\n");
}
if (job->obj->pencolor.u.HSVA[3] > .5) {
ps_set_pen_style(job);
ps_set_color(job, &(job->obj->pencolor));
- core_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
+ gvdevice_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
for (j = 1; j < n; j++)
- core_printf(job, "%g %g lineto\n", A[j].x, A[j].y);
- core_printf(job, "closepath stroke\n");
+ gvdevice_printf(job, "%g %g lineto\n", A[j].x, A[j].y);
+ gvdevice_printf(job, "closepath stroke\n");
}
}
if (job->obj->pencolor.u.HSVA[3] > .5) {
ps_set_pen_style(job);
ps_set_color(job, &(job->obj->pencolor));
- core_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
+ gvdevice_printf(job, "newpath %g %g moveto\n", A[0].x, A[0].y);
for (j = 1; j < n; j++)
- core_printf(job, "%g %g lineto\n", A[j].x, A[j].y);
- core_fputs(job, "stroke\n");
+ gvdevice_printf(job, "%g %g lineto\n", A[j].x, A[j].y);
+ gvdevice_fputs(job, "stroke\n");
}
}
static void psgen_comment(GVJ_t * job, char *str)
{
- core_fputs(job, "% ");
- core_fputs(job, str);
- core_fputs(job, "\n");
+ gvdevice_fputs(job, "% ");
+ gvdevice_fputs(job, str);
+ gvdevice_fputs(job, "\n");
}
static void psgen_library_shape(GVJ_t * job, char *name, pointf * A, int n, int filled)
if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
ps_set_color(job, &(job->obj->fillcolor));
- core_fputs(job, "[ ");
+ gvdevice_fputs(job, "[ ");
for (j = 0; j < n; j++)
- core_printf(job, "%g %g ", A[j].x, A[j].y);
- core_printf(job, "%g %g ", A[0].x, A[0].y);
- core_printf(job, "] %d true %s\n", n, name);
+ gvdevice_printf(job, "%g %g ", A[j].x, A[j].y);
+ gvdevice_printf(job, "%g %g ", A[0].x, A[0].y);
+ gvdevice_printf(job, "] %d true %s\n", n, name);
}
if (job->obj->pencolor.u.HSVA[3] > .5) {
ps_set_pen_style(job);
ps_set_color(job, &(job->obj->pencolor));
- core_fputs(job, "[ ");
+ gvdevice_fputs(job, "[ ");
for (j = 0; j < n; j++)
- core_printf(job, "%g %g ", A[j].x, A[j].y);
- core_printf(job, "%g %g ", A[0].x, A[0].y);
- core_printf(job, "] %d false %s\n", n, name);
+ gvdevice_printf(job, "%g %g ", A[j].x, A[j].y);
+ gvdevice_printf(job, "%g %g ", A[0].x, A[0].y);
+ gvdevice_printf(job, "] %d false %s\n", n, name);
}
}
typedef enum { FORMAT_SVG, FORMAT_SVGZ, } format_type;
extern char *xml_string(char *str);
-extern void core_init_compression(GVJ_t * job, compression_t compression);
-extern void core_fini_compression(GVJ_t * job);
-extern void core_fputs(GVJ_t * job, char *s);
-extern void core_printf(GVJ_t * job, const char *format, ...);
/* SVG dash array */
static char *sdarray = "5,2";
c = 'M'; /* first point */
for (i = 0; i < n; i++) {
- core_printf(job, "%c%g,%g", c, A[i].x, -A[i].y);
+ gvdevice_printf(job, "%c%g,%g", c, A[i].x, -A[i].y);
if (i == 0)
c = 'C'; /* second point */
else
{
switch (color.type) {
case COLOR_STRING:
- core_fputs(job, color.u.string);
+ gvdevice_fputs(job, color.u.string);
break;
case RGBA_BYTE:
if (color.u.rgba[3] == 0) /* transparent */
- core_fputs(job, "none");
+ gvdevice_fputs(job, "none");
else
- core_printf(job, "#%02x%02x%02x",
+ gvdevice_printf(job, "#%02x%02x%02x",
color.u.rgba[0], color.u.rgba[1], color.u.rgba[2]);
break;
default:
{
obj_state_t *obj = job->obj;
- core_fputs(job, " style=\"fill:");
+ gvdevice_fputs(job, " style=\"fill:");
if (filled)
svg_print_color(job, obj->fillcolor);
else
- core_fputs(job, "none");
- core_fputs(job, ";stroke:");
+ gvdevice_fputs(job, "none");
+ gvdevice_fputs(job, ";stroke:");
svg_print_color(job, obj->pencolor);
if (obj->penwidth != PENWIDTH_NORMAL)
- core_printf(job, ";stroke-width:%g", obj->penwidth);
+ gvdevice_printf(job, ";stroke-width:%g", obj->penwidth);
if (obj->pen == PEN_DASHED) {
- core_printf(job, ";stroke-dasharray:%s", sdarray);
+ gvdevice_printf(job, ";stroke-dasharray:%s", sdarray);
} else if (obj->pen == PEN_DOTTED) {
- core_printf(job, ";stroke-dasharray:%s", sdotarray);
+ gvdevice_printf(job, ";stroke-dasharray:%s", sdotarray);
}
- core_fputs(job, ";\"");
+ gvdevice_fputs(job, ";\"");
}
static void svg_comment(GVJ_t * job, char *str)
{
- core_fputs(job, "<!-- ");
- core_fputs(job, xml_string(str));
- core_fputs(job, " -->\n");
+ gvdevice_fputs(job, "<!-- ");
+ gvdevice_fputs(job, xml_string(str));
+ gvdevice_fputs(job, " -->\n");
}
static void svg_begin_job(GVJ_t * job)
{
char *s;
-
- switch (job->render.id) {
- case FORMAT_SVGZ:
- core_init_compression(job, COMPRESSION_ZLIB);
- break;
- case FORMAT_SVG:
- core_init_compression(job, COMPRESSION_NONE);
- break;
- }
-
- core_fputs(job, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
+ gvdevice_fputs(job, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
if ((s = agget(job->gvc->g, "stylesheet")) && s[0]) {
- core_fputs(job, "<?xml-stylesheet href=\"");
- core_fputs(job, s);
- core_fputs(job, "\" type=\"text/css\"?>\n");
+ gvdevice_fputs(job, "<?xml-stylesheet href=\"");
+ gvdevice_fputs(job, s);
+ gvdevice_fputs(job, "\" type=\"text/css\"?>\n");
}
- core_fputs(job, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n");
- core_fputs(job, " \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\"");
+ gvdevice_fputs(job, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n");
+ gvdevice_fputs(job, " \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\"");
/* This is to work around a bug in the SVG 1.0 DTD */
- core_fputs(job, " [\n <!ATTLIST svg xmlns:xlink CDATA #FIXED \"http://www.w3.org/1999/xlink\">\n]");
-
- core_fputs(job, ">\n<!-- Generated by ");
- core_fputs(job, xml_string(job->common->info[0]));
- core_fputs(job, " version ");
- core_fputs(job, xml_string(job->common->info[1]));
- core_fputs(job, " (");
- core_fputs(job, xml_string(job->common->info[2]));
- core_fputs(job, ")\n For user: ");
- core_fputs(job, xml_string(job->common->user));
- core_fputs(job, " -->\n");
+ gvdevice_fputs(job, " [\n <!ATTLIST svg xmlns:xlink CDATA #FIXED \"http://www.w3.org/1999/xlink\">\n]");
+
+ gvdevice_fputs(job, ">\n<!-- Generated by ");
+ gvdevice_fputs(job, xml_string(job->common->info[0]));
+ gvdevice_fputs(job, " version ");
+ gvdevice_fputs(job, xml_string(job->common->info[1]));
+ gvdevice_fputs(job, " (");
+ gvdevice_fputs(job, xml_string(job->common->info[2]));
+ gvdevice_fputs(job, ")\n For user: ");
+ gvdevice_fputs(job, xml_string(job->common->user));
+ gvdevice_fputs(job, " -->\n");
}
static void svg_begin_graph(GVJ_t * job)
{
obj_state_t *obj = job->obj;
- core_fputs(job, "<!--");
+ gvdevice_fputs(job, "<!--");
if (obj->u.g->name[0]) {
- core_fputs(job, " Title: ");
- core_fputs(job, xml_string(obj->u.g->name));
+ gvdevice_fputs(job, " Title: ");
+ gvdevice_fputs(job, xml_string(obj->u.g->name));
}
- core_printf(job, " Pages: %d -->\n", job->pagesArraySize.x * job->pagesArraySize.y);
+ gvdevice_printf(job, " Pages: %d -->\n", job->pagesArraySize.x * job->pagesArraySize.y);
- core_printf(job, "<svg width=\"%dpt\" height=\"%dpt\"\n",
+ gvdevice_printf(job, "<svg width=\"%dpt\" height=\"%dpt\"\n",
job->width, job->height);
- core_printf(job, " viewBox=\"%.2f %.2f %.2f %.2f\"",
+ gvdevice_printf(job, " viewBox=\"%.2f %.2f %.2f %.2f\"",
job->canvasBox.LL.x, job->canvasBox.LL.y,
job->canvasBox.UR.x, job->canvasBox.UR.y);
/* namespace of svg */
- core_fputs(job, " xmlns=\"http://www.w3.org/2000/svg\"");
+ gvdevice_fputs(job, " xmlns=\"http://www.w3.org/2000/svg\"");
/* namespace of xlink */
- core_fputs(job, " xmlns:xlink=\"http://www.w3.org/1999/xlink\"");
- core_fputs(job, ">\n");
+ gvdevice_fputs(job, " xmlns:xlink=\"http://www.w3.org/1999/xlink\"");
+ gvdevice_fputs(job, ">\n");
}
static void svg_end_graph(GVJ_t * job)
{
- core_fputs(job, "</svg>\n");
- core_fini_compression(job);
+ gvdevice_fputs(job, "</svg>\n");
}
static void svg_begin_layer(GVJ_t * job, char *layername, int layerNum, int numLayers)
{
- core_fputs(job, "<g id=\"");
- core_fputs(job, xml_string(layername));
- core_fputs(job, "\" class=\"layer\">\n");
+ gvdevice_fputs(job, "<g id=\"");
+ gvdevice_fputs(job, xml_string(layername));
+ gvdevice_fputs(job, "\" class=\"layer\">\n");
}
static void svg_end_layer(GVJ_t * job)
{
- core_fputs(job, "</g>\n");
+ gvdevice_fputs(job, "</g>\n");
}
static void svg_begin_page(GVJ_t * job)
/* its really just a page of the graph, but its still a graph,
* and it is the entire graph if we're not currently paging */
- core_printf(job, "<g id=\"graph%d\" class=\"graph\"", job->common->viewNum);
- core_printf(job, " transform=\"scale(%g %g) rotate(%d) translate(%g %g)\">\n",
+ gvdevice_printf(job, "<g id=\"graph%d\" class=\"graph\"", job->common->viewNum);
+ gvdevice_printf(job, " transform=\"scale(%g %g) rotate(%d) translate(%g %g)\">\n",
job->scale.x, job->scale.y, -job->rotation,
job->translation.x, -job->translation.y);
/* default style */
if (obj->u.g->name[0]) {
- core_fputs(job, "<title>");
- core_fputs(job, xml_string(obj->u.g->name));
- core_fputs(job, "</title>\n");
+ gvdevice_fputs(job, "<title>");
+ gvdevice_fputs(job, xml_string(obj->u.g->name));
+ gvdevice_fputs(job, "</title>\n");
}
}
static void svg_end_page(GVJ_t * job)
{
- core_fputs(job, "</g>\n");
+ gvdevice_fputs(job, "</g>\n");
}
static void svg_begin_cluster(GVJ_t * job)
{
obj_state_t *obj = job->obj;
- core_printf(job, "<g id=\"cluster%ld\" class=\"cluster\">",
+ gvdevice_printf(job, "<g id=\"cluster%ld\" class=\"cluster\">",
obj->u.sg->meta_node->id);
- core_fputs(job, "<title>");
- core_fputs(job, xml_string(obj->u.sg->name));
- core_fputs(job, "</title>\n");
+ gvdevice_fputs(job, "<title>");
+ gvdevice_fputs(job, xml_string(obj->u.sg->name));
+ gvdevice_fputs(job, "</title>\n");
}
static void svg_end_cluster(GVJ_t * job)
{
- core_fputs(job, "</g>\n");
+ gvdevice_fputs(job, "</g>\n");
}
static void svg_begin_node(GVJ_t * job)
{
obj_state_t *obj = job->obj;
- core_printf(job, "<g id=\"node%ld\" class=\"node\">", obj->u.n->id);
- core_fputs(job, "<title>");
- core_fputs(job, xml_string(obj->u.n->name));
- core_fputs(job, "</title>\n");
+ gvdevice_printf(job, "<g id=\"node%ld\" class=\"node\">", obj->u.n->id);
+ gvdevice_fputs(job, "<title>");
+ gvdevice_fputs(job, xml_string(obj->u.n->name));
+ gvdevice_fputs(job, "</title>\n");
}
static void svg_end_node(GVJ_t * job)
{
- core_fputs(job, "</g>\n");
+ gvdevice_fputs(job, "</g>\n");
}
static void
obj_state_t *obj = job->obj;
char *edgeop;
- core_printf(job, "<g id=\"edge%ld\" class=\"edge\">", obj->u.e->id);
+ gvdevice_printf(job, "<g id=\"edge%ld\" class=\"edge\">", obj->u.e->id);
if (obj->u.e->tail->graph->root->kind & AGFLAG_DIRECTED)
edgeop = "->";
else
edgeop = "--";
- core_fputs(job, "<title>");
- core_fputs(job, xml_string(obj->u.e->tail->name));
- core_fputs(job, edgeop);
- /* can't do this in single core_printf because
+ gvdevice_fputs(job, "<title>");
+ gvdevice_fputs(job, xml_string(obj->u.e->tail->name));
+ gvdevice_fputs(job, edgeop);
+ /* can't do this in single gvdevice_printf because
* xml_string's buffer gets reused. */
- core_fputs(job, xml_string(obj->u.e->head->name));
- core_fputs(job, "</title>\n");
+ gvdevice_fputs(job, xml_string(obj->u.e->head->name));
+ gvdevice_fputs(job, "</title>\n");
}
static void svg_end_edge(GVJ_t * job)
{
- core_fputs(job, "</g>\n");
+ gvdevice_fputs(job, "</g>\n");
}
static void
svg_begin_anchor(GVJ_t * job, char *href, char *tooltip, char *target)
{
- core_fputs(job, "<a");
+ gvdevice_fputs(job, "<a");
if (href && href[0])
- core_printf(job, " xlink:href=\"%s\"", xml_string(href));
+ gvdevice_printf(job, " xlink:href=\"%s\"", xml_string(href));
if (tooltip && tooltip[0])
- core_printf(job, " xlink:title=\"%s\"", xml_string(tooltip));
+ gvdevice_printf(job, " xlink:title=\"%s\"", xml_string(tooltip));
if (target && target[0])
- core_printf(job, " target=\"%s\"", xml_string(target));
- core_fputs(job, ">\n");
+ gvdevice_printf(job, " target=\"%s\"", xml_string(target));
+ gvdevice_fputs(job, ">\n");
}
static void svg_end_anchor(GVJ_t * job)
{
- core_fputs(job, "</a>\n");
+ gvdevice_fputs(job, "</a>\n");
}
static void svg_textpara(GVJ_t * job, pointf p, textpara_t * para)
obj_state_t *obj = job->obj;
PostscriptAlias *pA;
- core_fputs(job, "<text");
+ gvdevice_fputs(job, "<text");
switch (para->just) {
case 'l':
- core_fputs(job, " text-anchor=\"start\"");
+ gvdevice_fputs(job, " text-anchor=\"start\"");
break;
case 'r':
- core_fputs(job, " text-anchor=\"end\"");
+ gvdevice_fputs(job, " text-anchor=\"end\"");
break;
default:
case 'n':
- core_fputs(job, " text-anchor=\"middle\"");
+ gvdevice_fputs(job, " text-anchor=\"middle\"");
break;
}
- core_printf(job, " x=\"%g\" y=\"%g\"", p.x, -p.y);
- core_fputs(job, " style=\"");
+ gvdevice_printf(job, " x=\"%g\" y=\"%g\"", p.x, -p.y);
+ gvdevice_fputs(job, " style=\"");
pA = para->postscript_alias;
if (pA) {
char *family=NULL, *weight=NULL, *stretch=NULL, *style=NULL;
}
stretch = pA->stretch;
- core_printf(job, "font-family:%s;", family);
- if (weight) core_printf(job, "font-weight:%s;", weight);
- if (stretch) core_printf(job, "font-stretch:%s;", stretch);
- if (style) core_printf(job, "font-style:%s;", style);
+ gvdevice_printf(job, "font-family:%s;", family);
+ if (weight) gvdevice_printf(job, "font-weight:%s;", weight);
+ if (stretch) gvdevice_printf(job, "font-stretch:%s;", stretch);
+ if (style) gvdevice_printf(job, "font-style:%s;", style);
}
else
- core_printf(job, "font-family:%s;", para->fontname);
- core_printf(job, "font-size:%.2f;", para->fontsize);
+ gvdevice_printf(job, "font-family:%s;", para->fontname);
+ gvdevice_printf(job, "font-size:%.2f;", para->fontsize);
switch (obj->pencolor.type) {
case COLOR_STRING:
if (strcasecmp(obj->pencolor.u.string, "black"))
- core_printf(job, "fill:%s;", obj->pencolor.u.string);
+ gvdevice_printf(job, "fill:%s;", obj->pencolor.u.string);
break;
case RGBA_BYTE:
- core_printf(job, "fill:#%02x%02x%02x;",
+ gvdevice_printf(job, "fill:#%02x%02x%02x;",
obj->pencolor.u.rgba[0], obj->pencolor.u.rgba[1], obj->pencolor.u.rgba[2]);
break;
default:
assert(0); /* internal error */
}
- core_fputs(job, "\">");
- core_fputs(job, xml_string(para->str));
- core_fputs(job, "</text>\n");
+ gvdevice_fputs(job, "\">");
+ gvdevice_fputs(job, xml_string(para->str));
+ gvdevice_fputs(job, "</text>\n");
}
static void svg_ellipse(GVJ_t * job, pointf * A, int filled)
{
/* A[] contains 2 points: the center and corner. */
- core_fputs(job, "<ellipse");
+ gvdevice_fputs(job, "<ellipse");
svg_grstyle(job, filled);
- core_printf(job, " cx=\"%g\" cy=\"%g\"", A[0].x, -A[0].y);
- core_printf(job, " rx=\"%g\" ry=\"%g\"",
+ gvdevice_printf(job, " cx=\"%g\" cy=\"%g\"", A[0].x, -A[0].y);
+ gvdevice_printf(job, " rx=\"%g\" ry=\"%g\"",
A[1].x - A[0].x, A[1].y - A[0].y);
- core_fputs(job, "/>\n");
+ gvdevice_fputs(job, "/>\n");
}
static void
svg_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
int arrow_at_end, int filled)
{
- core_fputs(job, "<path");
+ gvdevice_fputs(job, "<path");
svg_grstyle(job, filled);
- core_fputs(job, " d=\"");
+ gvdevice_fputs(job, " d=\"");
svg_bzptarray(job, A, n);
- core_fputs(job, "\"/>\n");
+ gvdevice_fputs(job, "\"/>\n");
}
static void svg_polygon(GVJ_t * job, pointf * A, int n, int filled)
{
int i;
- core_fputs(job, "<polygon");
+ gvdevice_fputs(job, "<polygon");
svg_grstyle(job, filled);
- core_fputs(job, " points=\"");
+ gvdevice_fputs(job, " points=\"");
for (i = 0; i < n; i++)
- core_printf(job, "%g,%g ", A[i].x, -A[i].y);
- core_printf(job, "%g,%g", A[0].x, -A[0].y); /* because Adobe SVG is broken */
- core_fputs(job, "\"/>\n");
+ gvdevice_printf(job, "%g,%g ", A[i].x, -A[i].y);
+ gvdevice_printf(job, "%g,%g", A[0].x, -A[0].y); /* because Adobe SVG is broken */
+ gvdevice_fputs(job, "\"/>\n");
}
static void svg_polyline(GVJ_t * job, pointf * A, int n)
{
int i;
- core_fputs(job, "<polyline");
+ gvdevice_fputs(job, "<polyline");
svg_grstyle(job, 0);
- core_fputs(job, " points=\"");
+ gvdevice_fputs(job, " points=\"");
for (i = 0; i < n; i++)
- core_printf(job, "%g,%g ", A[i].x, -A[i].y);
- core_fputs(job, "\"/>\n");
+ gvdevice_printf(job, "%g,%g ", A[i].x, -A[i].y);
+ gvdevice_fputs(job, "\"/>\n");
}
/* color names from http://www.w3.org/TR/SVG/types.html */
typedef enum { FORMAT_VML, FORMAT_VMLZ, } format_type;
extern char *xml_string(char *str);
-extern void core_init_compression(GVJ_t * job, compression_t compression);
-extern void core_fini_compression(GVJ_t * job);
-extern void core_fputs(GVJ_t * job, char *s);
-extern void core_printf(GVJ_t * job, const char *format, ...);
char graphcoords[256];
c = "m "; /* first point */
for (i = 0; i < n; i++) {
- core_printf(job, "%s%.0f,%.0f ", c, A[i].x, -A[i].y);
+ gvdevice_printf(job, "%s%.0f,%.0f ", c, A[i].x, -A[i].y);
if (i == 0)
c = "c "; /* second point */
else
{
switch (color.type) {
case COLOR_STRING:
- core_fputs(job, color.u.string);
+ gvdevice_fputs(job, color.u.string);
break;
case RGBA_BYTE:
if (color.u.rgba[3] == 0) /* transparent */
- core_fputs(job, "none");
+ gvdevice_fputs(job, "none");
else
- core_printf(job, "#%02x%02x%02x",
+ gvdevice_printf(job, "#%02x%02x%02x",
color.u.rgba[0], color.u.rgba[1], color.u.rgba[2]);
break;
default:
{
obj_state_t *obj = job->obj;
- core_fputs(job, "<v:stroke fillcolor=\"");
+ gvdevice_fputs(job, "<v:stroke fillcolor=\"");
if (filled)
vml_print_color(job, obj->fillcolor);
else
- core_fputs(job, "none");
- core_fputs(job, "\" strokecolor=\"");
+ gvdevice_fputs(job, "none");
+ gvdevice_fputs(job, "\" strokecolor=\"");
vml_print_color(job, obj->pencolor);
if (obj->penwidth != PENWIDTH_NORMAL)
- core_printf(job, "\" stroke-weight=\"%g", obj->penwidth);
+ gvdevice_printf(job, "\" stroke-weight=\"%g", obj->penwidth);
if (obj->pen == PEN_DASHED) {
- core_fputs(job, "\" dashstyle=\"dash");
+ gvdevice_fputs(job, "\" dashstyle=\"dash");
} else if (obj->pen == PEN_DOTTED) {
- core_fputs(job, "\" dashstyle=\"dot");
+ gvdevice_fputs(job, "\" dashstyle=\"dot");
}
- core_fputs(job, "\" />");
+ gvdevice_fputs(job, "\" />");
}
static void vml_grstrokeattr(GVJ_t * job)
{
obj_state_t *obj = job->obj;
- core_fputs(job, " strokecolor=\"");
+ gvdevice_fputs(job, " strokecolor=\"");
vml_print_color(job, obj->pencolor);
if (obj->penwidth != PENWIDTH_NORMAL)
- core_printf(job, "\" stroke-weight=\"%g", obj->penwidth);
+ gvdevice_printf(job, "\" stroke-weight=\"%g", obj->penwidth);
if (obj->pen == PEN_DASHED) {
- core_fputs(job, "\" dashstyle=\"dash");
+ gvdevice_fputs(job, "\" dashstyle=\"dash");
} else if (obj->pen == PEN_DOTTED) {
- core_fputs(job, "\" dashstyle=\"dot");
+ gvdevice_fputs(job, "\" dashstyle=\"dot");
}
- core_fputs(job, "\"");
+ gvdevice_fputs(job, "\"");
}
static void vml_grfill(GVJ_t * job, int filled)
{
obj_state_t *obj = job->obj;
- core_fputs(job, "<v:fill color=\"");
+ gvdevice_fputs(job, "<v:fill color=\"");
if (filled)
vml_print_color(job, obj->fillcolor);
else
- core_fputs(job, "none");
- core_fputs(job, "\" />");
+ gvdevice_fputs(job, "none");
+ gvdevice_fputs(job, "\" />");
}
static void vml_comment(GVJ_t * job, char *str)
{
- core_fputs(job, " <!-- ");
- core_fputs(job, xml_string(str));
- core_fputs(job, " -->\n");
+ gvdevice_fputs(job, " <!-- ");
+ gvdevice_fputs(job, xml_string(str));
+ gvdevice_fputs(job, " -->\n");
}
static void vml_begin_job(GVJ_t * job)
{
- switch (job->render.id) {
- case FORMAT_VMLZ:
- core_init_compression(job, COMPRESSION_ZLIB);
- break;
- case FORMAT_VML:
- core_init_compression(job, COMPRESSION_NONE);
- break;
- }
-
- core_fputs(job, "<?xml version=\"1.1\" encoding=\"UTF-8\" ?>\n");
-
- core_fputs(job, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" ");
- core_fputs(job, "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n");
- core_fputs(job, "<html xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" ");
- core_fputs(job, "xmlns:v=\"urn:schemas-microsoft-com:vml\"");
- core_fputs(job, ">");
-
- core_fputs(job, "\n<!-- Generated by ");
- core_fputs(job, xml_string(job->common->info[0]));
- core_fputs(job, " version ");
- core_fputs(job, xml_string(job->common->info[1]));
- core_fputs(job, " (");
- core_fputs(job, xml_string(job->common->info[2]));
- core_fputs(job, ")\n For user: ");
- core_fputs(job, xml_string(job->common->user));
- core_fputs(job, " -->\n");
+ gvdevice_fputs(job, "<?xml version=\"1.1\" encoding=\"UTF-8\" ?>\n");
+
+ gvdevice_fputs(job, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" ");
+ gvdevice_fputs(job, "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n");
+ gvdevice_fputs(job, "<html xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" ");
+ gvdevice_fputs(job, "xmlns:v=\"urn:schemas-microsoft-com:vml\"");
+ gvdevice_fputs(job, ">");
+
+ gvdevice_fputs(job, "\n<!-- Generated by ");
+ gvdevice_fputs(job, xml_string(job->common->info[0]));
+ gvdevice_fputs(job, " version ");
+ gvdevice_fputs(job, xml_string(job->common->info[1]));
+ gvdevice_fputs(job, " (");
+ gvdevice_fputs(job, xml_string(job->common->info[2]));
+ gvdevice_fputs(job, ")\n For user: ");
+ gvdevice_fputs(job, xml_string(job->common->user));
+ gvdevice_fputs(job, " -->\n");
}
static void vml_begin_graph(GVJ_t * job)
{
obj_state_t *obj = job->obj;
- core_fputs(job, "<head>");
+ gvdevice_fputs(job, "<head>");
if (obj->u.g->name[0]) {
- core_fputs(job, "<title>");
- core_fputs(job, xml_string(obj->u.g->name));
- core_fputs(job, "</title>");
+ gvdevice_fputs(job, "<title>");
+ gvdevice_fputs(job, xml_string(obj->u.g->name));
+ gvdevice_fputs(job, "</title>");
}
- core_printf(job, "<!-- Pages: %d -->\n</head>\n", job->pagesArraySize.x * job->pagesArraySize.y);
+ gvdevice_printf(job, "<!-- Pages: %d -->\n</head>\n", job->pagesArraySize.x * job->pagesArraySize.y);
snprintf(graphcoords, sizeof(graphcoords), "style=\"width: %.0fpt; height: %.0fpt\" coordsize=\"%.0f,%.0f\" coordorigin=\"-4,-%.0f\"",
job->width*.75, job->height*.75,
job->width*.75, job->height*.75,
job->height*.75 - 4);
- core_printf(job, "<body>\n<div class=\"graph\" %s>\n", graphcoords);
- core_fputs(job, "<style type=\"text/css\">\nv\\:* {\nbehavior: url(#default#VML);display:inline-block;position: absolute; left: 0px; top: 0px;\n}\n</style>\n");
+ gvdevice_printf(job, "<body>\n<div class=\"graph\" %s>\n", graphcoords);
+ gvdevice_fputs(job, "<style type=\"text/css\">\nv\\:* {\nbehavior: url(#default#VML);display:inline-block;position: absolute; left: 0px; top: 0px;\n}\n</style>\n");
/* graphcoords[0] = '\0'; */
}
static void vml_end_graph(GVJ_t * job)
{
- core_fputs(job, "</div>\n</body>\n");
+ gvdevice_fputs(job, "</div>\n</body>\n");
core_fini_compression(job);
}
static void
vml_begin_anchor(GVJ_t * job, char *href, char *tooltip, char *target)
{
- core_fputs(job, " <a");
+ gvdevice_fputs(job, " <a");
if (href && href[0])
- core_printf(job, " href=\"%s\"", xml_string(href));
+ gvdevice_printf(job, " href=\"%s\"", xml_string(href));
if (tooltip && tooltip[0])
- core_printf(job, " title=\"%s\"", xml_string(tooltip));
+ gvdevice_printf(job, " title=\"%s\"", xml_string(tooltip));
if (target && target[0])
- core_printf(job, " target=\"%s\"", xml_string(target));
- core_fputs(job, ">\n");
+ gvdevice_printf(job, " target=\"%s\"", xml_string(target));
+ gvdevice_fputs(job, ">\n");
}
static void vml_end_anchor(GVJ_t * job)
{
- core_fputs(job, " </a>\n");
+ gvdevice_fputs(job, " </a>\n");
}
static void vml_textpara(GVJ_t * job, pointf p, textpara_t * para)
{
obj_state_t *obj = job->obj;
- core_fputs(job, " <div");
+ gvdevice_fputs(job, " <div");
switch (para->just) {
case 'l':
- core_fputs(job, " style=\"text-align: left; ");
+ gvdevice_fputs(job, " style=\"text-align: left; ");
break;
case 'r':
- core_fputs(job, " style=\"text-align: right; ");
+ gvdevice_fputs(job, " style=\"text-align: right; ");
break;
default:
case 'n':
- core_fputs(job, " style=\"text-align: center; ");
+ gvdevice_fputs(job, " style=\"text-align: center; ");
break;
}
- core_printf(job, "position: absolute; left: %gpx; top: %gpx;", p.x/.75, job->height - p.y/.75 - 14);
+ gvdevice_printf(job, "position: absolute; left: %gpx; top: %gpx;", p.x/.75, job->height - p.y/.75 - 14);
if (para->postscript_alias) {
- core_printf(job, " font-family: '%s';", para->postscript_alias->family);
+ gvdevice_printf(job, " font-family: '%s';", para->postscript_alias->family);
if (para->postscript_alias->weight)
- core_printf(job, " font-weight: %s;", para->postscript_alias->weight);
+ gvdevice_printf(job, " font-weight: %s;", para->postscript_alias->weight);
if (para->postscript_alias->stretch)
- core_printf(job, " font-stretch: %s;", para->postscript_alias->stretch);
+ gvdevice_printf(job, " font-stretch: %s;", para->postscript_alias->stretch);
if (para->postscript_alias->style)
- core_printf(job, " font-style: %s;", para->postscript_alias->style);
+ gvdevice_printf(job, " font-style: %s;", para->postscript_alias->style);
}
else {
- core_printf(job, " font-family: \'%s\';", para->fontname);
+ gvdevice_printf(job, " font-family: \'%s\';", para->fontname);
}
/* FIXME - even inkscape requires a magic correction to fontsize. Why? */
- core_printf(job, " font-size: %.2fpt;", para->fontsize * 0.81);
+ gvdevice_printf(job, " font-size: %.2fpt;", para->fontsize * 0.81);
switch (obj->pencolor.type) {
case COLOR_STRING:
if (strcasecmp(obj->pencolor.u.string, "black"))
- core_printf(job, "color:%s;", obj->pencolor.u.string);
+ gvdevice_printf(job, "color:%s;", obj->pencolor.u.string);
break;
case RGBA_BYTE:
- core_printf(job, "color:#%02x%02x%02x;",
+ gvdevice_printf(job, "color:#%02x%02x%02x;",
obj->pencolor.u.rgba[0], obj->pencolor.u.rgba[1], obj->pencolor.u.rgba[2]);
break;
default:
assert(0); /* internal error */
}
- core_fputs(job, "\">");
- core_fputs(job, xml_string(para->str));
- core_fputs(job, "</div>\n");
+ gvdevice_fputs(job, "\">");
+ gvdevice_fputs(job, xml_string(para->str));
+ gvdevice_fputs(job, "</div>\n");
}
static void vml_ellipse(GVJ_t * job, pointf * A, int filled)
{
/* A[] contains 2 points: the center and corner. */
- core_fputs(job, " <v:oval");
+ gvdevice_fputs(job, " <v:oval");
vml_grstrokeattr(job);
- core_fputs(job, " style=\"position: absolute;");
+ gvdevice_fputs(job, " style=\"position: absolute;");
- core_printf(job, " left: %gpt; top: %gpt;", 2*A[0].x - A[1].x+4, job->height*.75 - A[1].y-4);
- core_printf(job, " width: %gpt; height: %gpt;", 2*(A[1].x - A[0].x), 2*(A[1].y - A[0].y));
- core_fputs(job, "\">");
+ gvdevice_printf(job, " left: %gpt; top: %gpt;", 2*A[0].x - A[1].x+4, job->height*.75 - A[1].y-4);
+ gvdevice_printf(job, " width: %gpt; height: %gpt;", 2*(A[1].x - A[0].x), 2*(A[1].y - A[0].y));
+ gvdevice_fputs(job, "\">");
vml_grstroke(job, filled);
vml_grfill(job, filled);
- core_fputs(job, "</v:oval>\n");
+ gvdevice_fputs(job, "</v:oval>\n");
}
static void
vml_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
int arrow_at_end, int filled)
{
- core_printf(job, " <v:shape %s><!-- bezier --><v:path", graphcoords);
- core_fputs(job, " v=\"");
+ gvdevice_printf(job, " <v:shape %s><!-- bezier --><v:path", graphcoords);
+ gvdevice_fputs(job, " v=\"");
vml_bzptarray(job, A, n);
- core_fputs(job, "\" />");
+ gvdevice_fputs(job, "\" />");
vml_grstroke(job, filled);
- core_fputs(job, "</v:path>");
+ gvdevice_fputs(job, "</v:path>");
vml_grfill(job, filled);
- core_fputs(job, "</v:shape>\n");
+ gvdevice_fputs(job, "</v:shape>\n");
}
static void vml_polygon(GVJ_t * job, pointf * A, int n, int filled)
{
int i;
- core_fputs(job, " <v:shape");
+ gvdevice_fputs(job, " <v:shape");
vml_grstrokeattr(job);
- core_printf(job, " %s><!-- polygon --><v:path", graphcoords);
- core_fputs(job, " v=\"");
+ gvdevice_printf(job, " %s><!-- polygon --><v:path", graphcoords);
+ gvdevice_fputs(job, " v=\"");
for (i = 0; i < n; i++)
{
- if (i==0) core_fputs(job, "m ");
- core_printf(job, "%.0f,%.0f ", A[i].x, -A[i].y);
- if (i==0) core_fputs(job, "l ");
- if (i==n-1) core_fputs(job, "x e ");
+ if (i==0) gvdevice_fputs(job, "m ");
+ gvdevice_printf(job, "%.0f,%.0f ", A[i].x, -A[i].y);
+ if (i==0) gvdevice_fputs(job, "l ");
+ if (i==n-1) gvdevice_fputs(job, "x e ");
}
- core_fputs(job, "\">");
+ gvdevice_fputs(job, "\">");
vml_grstroke(job, filled);
- core_fputs(job, "</v:path>");
+ gvdevice_fputs(job, "</v:path>");
vml_grfill(job, filled);
- core_fputs(job, "</v:shape>\n");
+ gvdevice_fputs(job, "</v:shape>\n");
}
static void vml_polyline(GVJ_t * job, pointf * A, int n)
{
int i;
- core_printf(job, " <v:shape %s><!-- polyline --><v:path", graphcoords);
- core_fputs(job, " v=\"");
+ gvdevice_printf(job, " <v:shape %s><!-- polyline --><v:path", graphcoords);
+ gvdevice_fputs(job, " v=\"");
for (i = 0; i < n; i++)
{
- if (i==0) core_fputs(job, " m ");
- core_printf(job, "%.0f,%.0f ", A[i].x, -A[i].y);
- if (i==0) core_fputs(job, " l ");
- if (i==n-1) core_fputs(job, " e "); /* no x here for polyline */
+ if (i==0) gvdevice_fputs(job, " m ");
+ gvdevice_printf(job, "%.0f,%.0f ", A[i].x, -A[i].y);
+ if (i==0) gvdevice_fputs(job, " l ");
+ if (i==n-1) gvdevice_fputs(job, " e "); /* no x here for polyline */
}
- core_fputs(job, "\">");
+ gvdevice_fputs(job, "\">");
vml_grstroke(job, 0); /* no fill here for polyline */
- core_fputs(job, "</v:path>");
- core_fputs(job, "</v:shape>\n");
+ gvdevice_fputs(job, "</v:path>");
+ gvdevice_fputs(job, "</v:shape>\n");
}
test_ocaml: libgv_ocaml.la
-(mkdir -p test_ocaml; cd test_ocaml; \
ln -fs ../.libs/libgv_ocaml.so libgv.so; \
- ln -fs ../$(srcdir)/*.dot ../$(srcdir)/*.ocaml .; \
+ ln -fs ../$(srcdir)/*.dot ../$(srcdir)/*.ml ../$(srcdir)/*.mli .; \
ocamlc *.ocaml; \
LD_LIBRARY_PATH=. ocaml test)