gvcint.h 4.7 KB

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