Graphviz  2.41.20170921.2350
gvloadimage.c
Go to the documentation of this file.
1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 /*
15  * graphics code generator wrapper
16  *
17  * This library forms the socket for run-time loadable loadimage plugins.
18  */
19 
20 #include "config.h"
21 
22 #include <string.h>
23 
24 #include "const.h"
25 #include "gvplugin_loadimage.h"
26 #include "gvcint.h"
27 #include "gvcproc.h"
28 
29 /* for agerr() */
30 #include "cgraph.h"
31 
32 static int gvloadimage_select(GVJ_t * job, char *str)
33 {
34  gvplugin_available_t *plugin;
35  gvplugin_installed_t *typeptr;
36 
37  plugin = gvplugin_load(job->gvc, API_loadimage, str);
38  if (plugin) {
39  typeptr = plugin->typeptr;
40  job->loadimage.engine = (gvloadimage_engine_t *) (typeptr->engine);
41  job->loadimage.id = typeptr->id;
42  return GVRENDER_PLUGIN;
43  }
44  return NO_SUPPORT;
45 }
46 
47 void gvloadimage(GVJ_t * job, usershape_t *us, boxf b, boolean filled, const char *target)
48 {
50  char type[SMALLBUF];
51 
52  assert(job);
53  assert(us);
54  assert(us->name);
55  assert(us->name[0]);
56 
57  strcpy(type, us->stringtype);
58  strcat(type, ":");
59  strcat(type, target);
60 
61  if (gvloadimage_select(job, type) == NO_SUPPORT)
62  agerr (AGWARN, "No loadimage plugin for \"%s\"\n", type);
63 
64  if ((gvli = job->loadimage.engine) && gvli->loadimage)
65  gvli->loadimage(job, us, b, filled);
66 }
void gvloadimage(GVJ_t *job, usershape_t *us, boxf b, boolean filled, const char *target)
Definition: gvloadimage.c:47
#define SMALLBUF
Definition: const.h:17
char * stringtype
Definition: usershape.h:59
#define assert(x)
Definition: cghdr.h:47
#define GVRENDER_PLUGIN
Definition: const.h:150
gvplugin_active_loadimage_t loadimage
Definition: gvcjob.h:296
int agerr(agerrlevel_t level, const char *fmt,...)
Definition: agerror.c:141
gvplugin_available_t * gvplugin_load(GVC_t *gvc, api_t api, const char *type)
Definition: gvplugin.c:262
Definition: gvcjob.h:271
#define NO_SUPPORT
Definition: const.h:151
Definition: cgraph.h:388
gvloadimage_engine_t * engine
Definition: gvcjob.h:145
GVC_t * gvc
Definition: gvcjob.h:272
void(* loadimage)(GVJ_t *job, usershape_t *us, boxf b, boolean filled)
agxbuf * str
Definition: htmlparse.c:85
gvplugin_installed_t * typeptr
Definition: gvcint.h:55
const char * name
Definition: usershape.h:53
Definition: geom.h:35