| 1 | |
| 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 | /* Common header used by both clients and plugins */ |
| 15 | |
| 16 | #ifndef GVCEXT_H |
| 17 | #define GVCEXT_H |
| 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | /* |
| 24 | * Define an apis array of name strings using an enumerated api_t as index. |
| 25 | * The enumerated type is defined here. The apis array is |
| 26 | * inititialized in gvplugin.c by redefining ELEM and reinvoking APIS. |
| 27 | */ |
| 28 | #define APIS ELEM(render) ELEM(layout) ELEM(textlayout) ELEM(device) ELEM(loadimage) |
| 29 | |
| 30 | /* |
| 31 | * Define api_t using names based on the plugin names with API_ prefixed. |
| 32 | */ |
| 33 | #define ELEM(x) API_##x, |
| 34 | typedef enum { APIS _DUMMY_ELEM_=0 } api_t; /* API_render, API_layout, ... */ |
| 35 | /* Stupid but true: The sole purpose of "_DUMMY_ELEM_=0" |
| 36 | * is to avoid a "," after the last element of the enum |
| 37 | * because some compilers when using "-pedantic" |
| 38 | * generate an error for about the dangling "," |
| 39 | * but only if this header is used from a .cpp file! |
| 40 | * Setting it to 0 makes sure that the enumeration |
| 41 | * does not define an extra value. (It does however |
| 42 | * define _DUMMY_ELEM_ as an enumeration symbol, |
| 43 | * but its value duplicates that of the first |
| 44 | * symbol in the enumeration - in this case "render".) |
| 45 | */ |
| 46 | |
| 47 | /* One could wonder why trailing "," in: |
| 48 | * int nums[]={1,2,3,}; |
| 49 | * is OK, but in: |
| 50 | * typedef enum {a,b,c,} abc_t; |
| 51 | * is not!!! |
| 52 | */ |
| 53 | #undef ELEM |
| 54 | |
| 55 | typedef struct GVJ_s GVJ_t; |
| 56 | typedef struct GVG_s GVG_t; |
| 57 | typedef struct GVC_s GVC_t; |
| 58 | |
| 59 | typedef struct { |
| 60 | const char *name; |
| 61 | void* address; |
| 62 | } lt_symlist_t; |
| 63 | |
| 64 | typedef struct gvplugin_available_s gvplugin_available_t; |
| 65 | |
| 66 | /*visual studio*/ |
| 67 | #ifdef _WIN32 |
| 68 | #ifndef GVC_EXPORTS |
| 69 | __declspec(dllimport) lt_symlist_t lt_preloaded_symbols[]; |
| 70 | #else |
| 71 | //__declspec(dllexport) lt_symlist_t lt_preloaded_symbols[]; |
| 72 | #if !defined(LTDL_H) |
| 73 | lt_symlist_t lt_preloaded_symbols[]; |
| 74 | #endif |
| 75 | #endif |
| 76 | #endif |
| 77 | /*end visual studio*/ |
| 78 | |
| 79 | |
| 80 | #ifndef _WIN32 |
| 81 | #if defined(GVDLL) |
| 82 | __declspec(dllexport) lt_symlist_t lt_preloaded_symbols[]; |
| 83 | #else |
| 84 | #if !defined(LTDL_H) |
| 85 | extern lt_symlist_t lt_preloaded_symbols[]; |
| 86 | #endif |
| 87 | #endif |
| 88 | #endif |
| 89 | |
| 90 | |
| 91 | #ifdef __cplusplus |
| 92 | } |
| 93 | #endif |
| 94 | |
| 95 | |
| 96 | |
| 97 | #endif |
| 98 | |