Graphviz  2.29.20120524.0446
lib/gvc/gvcext.h
Go to the documentation of this file.
00001 
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /*************************************************************************
00005  * Copyright (c) 2011 AT&T Intellectual Property 
00006  * All rights reserved. This program and the accompanying materials
00007  * are made available under the terms of the Eclipse Public License v1.0
00008  * which accompanies this distribution, and is available at
00009  * http://www.eclipse.org/legal/epl-v10.html
00010  *
00011  * Contributors: See CVS logs. Details at http://www.graphviz.org/
00012  *************************************************************************/
00013 
00014 /* Common header used by both clients and plugins */
00015 
00016 #ifndef GVCEXT_H
00017 #define GVCEXT_H
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 /*
00024  * Define an apis array of name strings using an enumerated api_t as index.
00025  * The enumerated type is defined here.  The apis array is
00026  * inititialized in gvplugin.c by redefining ELEM and reinvoking APIS.
00027  */
00028 #define APIS ELEM(render) ELEM(layout) ELEM(textlayout) ELEM(device) ELEM(loadimage)
00029 
00030 /*
00031  * Define api_t using names based on the plugin names with API_ prefixed.
00032  */
00033 #define ELEM(x) API_##x,
00034     typedef enum { APIS _DUMMY_ELEM_=0 } api_t; /* API_render, API_layout, ... */
00035                         /* Stupid but true: The sole purpose of "_DUMMY_ELEM_=0"
00036                          * is to avoid a "," after the last element of the enum
00037                          * because some compilers when using "-pedantic"
00038                          * generate an error for about the dangling ","
00039                          * but only if this header is used from a .cpp file!
00040                          * Setting it to 0 makes sure that the enumeration
00041                          * does not define an extra value.  (It does however
00042                          * define _DUMMY_ELEM_ as an enumeration symbol,
00043                          * but its value duplicates that of the first
00044                          * symbol in the enumeration - in this case "render".)
00045                          */
00046 
00047                         /* One could wonder why trailing "," in:
00048                          *      int nums[]={1,2,3,};
00049                          * is OK, but in:
00050                          *      typedef enum {a,b,c,} abc_t; 
00051                          * is not!!!
00052                          */
00053 #undef ELEM
00054 
00055     typedef struct GVJ_s GVJ_t;
00056     typedef struct GVC_s GVC_t;
00057 
00058     typedef struct {
00059         const char *name;
00060         void* address;
00061     } lt_symlist_t;
00062 
00063     typedef struct gvplugin_available_s gvplugin_available_t;
00064 
00065 /*visual studio*/
00066 #ifdef WIN32_DLL
00067 #ifndef GVC_EXPORTS
00068 __declspec(dllimport) lt_symlist_t lt_preloaded_symbols[];
00069 #else
00070 //__declspec(dllexport) lt_symlist_t lt_preloaded_symbols[];
00071 //lt_symlist_t lt_preloaded_symbols[];
00072 #endif
00073 #endif
00074 /*end visual studio*/
00075 
00076 
00077 #ifndef WIN32_DLL
00078 #if defined(GVDLL)
00079         __declspec(dllexport) lt_symlist_t lt_preloaded_symbols[];
00080 #else
00081 #if !defined(LTDL_H)
00082         extern lt_symlist_t lt_preloaded_symbols[];
00083 #endif
00084 #endif
00085 #endif
00086 
00087 
00088 #ifdef __cplusplus
00089 }
00090 #endif
00091 
00092 
00093 
00094 #endif