| 1 |
/************************************************************************* |
| 2 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: Details at https://graphviz.org |
| 9 |
*************************************************************************/ |
| 10 |
|
| 11 |
/* Common header used by both clients and plugins */ |
| 12 |
|
| 13 |
#pragma once |
| 14 |
|
| 15 |
#ifdef __cplusplus |
| 16 |
extern "C" { |
| 17 |
#endif |
| 18 |
|
| 19 |
#include "cdt.h" |
| 20 |
#include "gvcommon.h" |
| 21 |
#include "gvcjob.h" |
| 22 |
#include "gvplugin.h" |
| 23 |
#include "color.h" |
| 24 |
#include <stdbool.h> |
| 25 |
|
| 26 |
#ifdef GVDLL |
| 27 |
#ifdef GVC_EXPORTS |
| 28 |
#define GVCINT_API __declspec(dllexport) |
| 29 |
#else |
| 30 |
#define GVCINT_API __declspec(dllimport) |
| 31 |
#endif |
| 32 |
#endif |
| 33 |
|
| 34 |
#ifndef GVCINT_API |
| 35 |
#define GVCINT_API /* nothing */ |
| 36 |
#endif |
| 37 |
|
| 38 |
/* active plugin headers */ |
| 39 |
typedef struct gvplugin_active_layout_s { |
| 40 |
gvlayout_engine_t *engine; |
| 41 |
int id; |
| 42 |
gvlayout_features_t *features; |
| 43 |
const char *type; |
| 44 |
} gvplugin_active_layout_t; |
| 45 |
|
| 46 |
typedef struct gvplugin_active_textlayout_s { |
| 47 |
gvtextlayout_engine_t *engine; |
| 48 |
int id; |
| 49 |
char *type; |
| 50 |
} gvplugin_active_textlayout_t; |
| 51 |
|
| 52 |
typedef struct gvplugin_package_s gvplugin_package_t; |
| 53 |
|
| 54 |
struct gvplugin_package_s { |
| 55 |
gvplugin_package_t *next; |
| 56 |
char *path; |
| 57 |
char *name; |
| 58 |
}; |
| 59 |
|
| 60 |
struct gvplugin_available_s { |
| 61 |
gvplugin_available_t *next; /* next plugin in linked list, or NULL */ |
| 62 |
char *typestr; /* type string, e.g. "png" or "ps" */ |
| 63 |
int quality; /* Programmer assigned quality ranking within type (+ve or -ve int). |
| 64 |
First implementation of type should be given "0" quality */ |
| 65 |
gvplugin_package_t *package; /* details of library containing plugin */ |
| 66 |
gvplugin_installed_t *typeptr; /* pointer to jumptable for plugin, |
| 67 |
or NULL if not yet loaded */ |
| 68 |
}; |
| 69 |
|
| 70 |
struct GVG_s { |
| 71 |
GVC_t *gvc; /* parent gvc */ |
| 72 |
GVG_t *next; /* next gvg in list */ |
| 73 |
|
| 74 |
char *input_filename; /* or NULL if stdin */ |
| 75 |
int graph_index; /* index of graph within input_file */ |
| 76 |
graph_t *g; |
| 77 |
}; |
| 78 |
|
| 79 |
#define MAXNEST 4 |
| 80 |
|
| 81 |
struct GVC_s { |
| 82 |
GVCOMMON_t common; |
| 83 |
|
| 84 |
char *config_path; |
| 85 |
bool config_found; |
| 86 |
|
| 87 |
/* gvParseArgs */ |
| 88 |
char **input_filenames; /* null terminated array of input filenames */ |
| 89 |
int fidx; /* index of input_filenames to be processed next */ |
| 90 |
|
| 91 |
/* gvNextInputGraph() */ |
| 92 |
GVG_t *gvgs; /* linked list of graphs */ |
| 93 |
GVG_t *gvg; /* current graph */ |
| 94 |
|
| 95 |
/* plugins */ |
| 96 |
#define ELEM(x) +1 |
| 97 |
/* APIS expands to "+1 +1 ... +1" to give the number of APIs */ |
| 98 |
gvplugin_available_t *apis[ APIS ]; /* array of linked-list of plugins per api */ |
| 99 |
gvplugin_available_t *api[ APIS ]; /* array of current plugins per api */ |
| 100 |
#undef ELEM |
| 101 |
gvplugin_package_t *packages; /* list of available packages */ |
| 102 |
|
| 103 |
/* externally provided write() displine */ |
| 104 |
size_t (*write_fn) (GVJ_t *job, const char *s, size_t len); |
| 105 |
|
| 106 |
/* fonts and textlayout */ |
| 107 |
Dtdisc_t textfont_disc; |
| 108 |
Dt_t *textfont_dt; |
| 109 |
gvplugin_active_textlayout_t textlayout; /* always use best avail for all jobs */ |
| 110 |
// void (*free_layout) (void *layout); /* function for freeing layouts (mostly used by pango) */ |
| 111 |
|
| 112 |
/* FIXME - everything below should probably move to GVG_t */ |
| 113 |
|
| 114 |
/* gvrender_config() */ |
| 115 |
GVJ_t *jobs; /* linked list of jobs */ |
| 116 |
GVJ_t *job; /* current job */ |
| 117 |
|
| 118 |
graph_t *g; /* current graph */ |
| 119 |
|
| 120 |
/* gvrender_begin_job() */ |
| 121 |
gvplugin_active_layout_t layout; |
| 122 |
|
| 123 |
char *graphname; /* name from graph */ |
| 124 |
GVJ_t *active_jobs; /* linked list of active jobs */ |
| 125 |
|
| 126 |
/* pagination */ |
| 127 |
char *pagedir; /* pagination order */ |
| 128 |
pointf margin; /* margins in graph units */ |
| 129 |
pointf pad; /* pad in graph units */ |
| 130 |
pointf pageSize; /* pageSize in graph units, not including margins */ |
| 131 |
point pb; /* page size - including margins (inches) */ |
| 132 |
boxf bb; /* graph bb in graph units, not including margins */ |
| 133 |
int rotation; /* rotation - 0 = portrait, 90 = landscape */ |
| 134 |
bool graph_sets_pad, graph_sets_margin, graph_sets_pageSize; |
| 135 |
|
| 136 |
/* layers */ |
| 137 |
char *layerDelims; /* delimiters in layer names */ |
| 138 |
char *layerListDelims; /* delimiters between layer ranges */ |
| 139 |
char *layers; /* null delimited list of layer names */ |
| 140 |
char **layerIDs; /* array of layer names */ |
| 141 |
int numLayers; /* number of layers */ |
| 142 |
int *layerlist; |
| 143 |
|
| 144 |
/* default font */ |
| 145 |
char *defaultfontname; |
| 146 |
double defaultfontsize; |
| 147 |
|
| 148 |
/* default line style */ |
| 149 |
char **defaultlinestyle; |
| 150 |
|
| 151 |
/* render defaults set from graph */ |
| 152 |
gvcolor_t bgcolor; /* background color */ |
| 153 |
|
| 154 |
/* whether to mangle font names (at least in SVG), usually false */ |
| 155 |
int fontrenaming; |
| 156 |
}; |
| 157 |
|
| 158 |
GVCINT_API GVC_t* gvCloneGVC (GVC_t *); |
| 159 |
GVCINT_API void gvFreeCloneGVC (GVC_t *); |
| 160 |
|
| 161 |
#undef GVCINT_API |
| 162 |
|
| 163 |
#ifdef __cplusplus |
| 164 |
} |
| 165 |
#endif |