/misc/src/release/graphviz-2.18-1/src/graphviz-2.18/lib/gvc/gvplugin.h

Go to the documentation of this file.
00001 /* $Id: gvplugin.h,v 1.25 2007/08/29 19:39:49 ellson Exp $ $Revision: 1.25 $ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /**********************************************************
00005 *      This software is part of the graphviz package      *
00006 *                http://www.graphviz.org/                 *
00007 *                                                         *
00008 *            Copyright (c) 1994-2004 AT&T Corp.           *
00009 *                and is licensed under the                *
00010 *            Common Public License, Version 1.0           *
00011 *                      by AT&T Corp.                      *
00012 *                                                         *
00013 *        Information and Software Systems Research        *
00014 *              AT&T Research, Florham Park NJ             *
00015 **********************************************************/
00016 
00017 /* Header used by plugins */
00018 
00019 #ifndef GVPLUGIN_H
00020 #define GVPLUGIN_H
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 #include "gvcext.h"
00027 
00028 /* 
00029  * Terminology:
00030  *
00031  *    package         - e.g. libgvplugin_cairo.so, or table of codegen builtins.
00032  *       api          - e.g. render
00033  *          type      - e.g. "png", "ps"
00034  */
00035 
00036 /*
00037  * Define an apis array of name strings using an enumerated api_t as index.
00038  * The enumerated type is defined here.  The apis array is
00039  * inititialized in gvplugin.c by redefining ELEM and reinvoking APIS.
00040  */
00041 #define APIS ELEM(render) ELEM(layout) ELEM(textlayout) ELEM(device) ELEM(loadimage)
00042 
00043 /*
00044  * Define api_t using names based on the plugin names with API_ prefixed.
00045  */
00046 #define ELEM(x) API_##x,
00047     typedef enum { APIS _DUMMY_ELEM_=0 } api_t; /* API_render, API_layout, ... */
00048                         /* Stupid but true: The sole purpose of "_DUMMY_ELEM_=0"
00049                          * is to avoid a "," after the last element of the enum
00050                          * because some compilers when using "-pedantic"
00051                          * generate an error for about the dangling ","
00052                          * but only if this header is used from a .cpp file!
00053                          * Setting it to 0 makes sure that the enumeration
00054                          * does not define an extra value.  (It does however
00055                          * define _DUMMY_ELEM_ as an enumeration symbol,
00056                          * but its value duplicates that of the first
00057                          * symbol in the enumeration - in this case "render".)
00058                          */
00059 
00060                         /* One could wonder why trailing "," in:
00061                          *      int nums[]={1,2,3,};
00062                          * is OK, but in:
00063                          *      typedef enum {a,b,c,} abc_t; 
00064                          * is not!!!
00065                          */
00066 #undef ELEM
00067 
00068     typedef struct {
00069         int id;         /* an id that is only unique within a package 
00070                         of plugins of the same api.
00071                         A codegen id is unique in in the set of codegens.
00072                         A renderer-type such as "png" in the cairo package
00073                         has an id that is different from the "ps" type
00074                         in the same package */
00075         char *type;     /* a string name, such as "png" or "ps" that
00076                         distinguishes different types withing the same
00077                         api (renderer in this case) */
00078         int quality;    /* an arbitrary integer used for ordering plugins of
00079                         the same type from different packages */
00080         void *engine;   /* pointer to the jump table for the plugin */
00081         void *features; /* pointer to the feature description 
00082                                 void* because type varies by api */
00083     } gvplugin_installed_t;
00084 
00085     typedef struct {
00086         api_t api;
00087         gvplugin_installed_t *types;
00088     } gvplugin_api_t;
00089 
00090     typedef struct {
00091         char *packagename;    /* used when this plugin is builtin and has
00092                                         no pathname */
00093         gvplugin_api_t *apis;
00094     } gvplugin_library_t;
00095 
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 #endif                          /* GVPLUGIN_H */

Generated on Mon Mar 31 19:03:27 2008 for Graphviz by  doxygen 1.5.1