Main Page | Data Structures | File List | Data Fields | Globals

plugins_macros.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1999-2003 Alex Scott
00003  *
00004  * This library is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU Library General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or (at
00007  * your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; if not, write to the Free Software Foundation,
00016  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00025 #include "cuf-global.h"
00026 
00027 #ifndef _PLUGINS_MACROS_H_
00028 #define _PLUGINS_MACROS_H_
00029 
00030 /*
00031    For wrapping macros in "'s
00032 */
00033 #define __str(s)                        __strsub(s)
00034 #define __strsub(s)                     #s
00035 
00036 /*
00037    For concating macros
00038 */
00039 #define __cc(sa, sb)                    __ccsub(sa, sb)
00040 #define __ccsub(sa, sb)                 sa ## sb
00041 #define __cc3(sa, sb, sc)                       __cc3sub(sa, sb, sc)
00042 #define __cc3sub(sa, sb, sc)                    sa ## sb ## sc
00043 
00044 /*
00045 */
00046 #define __sub(s)                        s
00047 
00048 
00049 /* For Plugin Types */
00050 
00058 #define ptnstr __str(PLUGIN_TYPE_NAME)
00059 
00067 #define plugin_register()               \
00068 plugin_type_register (ptnstr, PLUGIN_TYPE_DESC, "plugin_" ptnstr "_info_get")
00069 
00070 
00071 /* For Plugins */
00072 
00078 #define PLUGIN_STRUCT                   \
00079 Plugin __cc (PLUGIN_NAME, _info) = {\
00080         NULL,\
00081         NULL,\
00082         __str (PLUGIN_NAME),\
00083         PLUGIN_DESC,\
00084         PLUGIN_CONFS_NUM,\
00085         PLUGIN_CONFS,\
00086         PLUGIN_FUNC_INIT,\
00087         PLUGIN_FUNC_CLEANUP,\
00088         &PLUGIN_REF\
00089 };
00090 
00091 
00097 #define PLUGIN_FUNC_INFO                \
00098 Plugin *__cc3 (plugin_, PLUGIN_TYPE_NAME, _info_get) (void) {\
00099         return & __cc (PLUGIN_NAME, _info);\
00100 }\
00101 
00102 
00108 #define PLUGIN_STD                      \
00109 __sub (PLUGIN_STRUCT)\
00110 __sub (PLUGIN_FUNC_INFO)
00111 
00112 
00121 #define PCAddBool(n, d, def)            \
00122         { n, d, PConfBool, (void *)#def, NULL, NULL }
00123 
00132 #define PCAddChar(n, d, def)            \
00133         { n, d, PConfChar, (void *)#def, NULL, NULL }
00134 
00147 #define PCAddNum(n, d, t, min, max, s, def)\
00148         { n, d, PConf ## t, (void *)#min ":" #max ":" #s ":" #def, NULL, NULL }
00149 
00158 #define PCAddString(n, d, def)          \
00159         { n, d, PConfString, (void *)def, NULL, NULL }
00160 
00172 #define PCAddEnum(n, d, l, def)         \
00173         { n, d, PConfEnum, (void *)l ":" def, NULL, NULL }
00174 
00175 #define pclen(p)        (sizeof(p)/sizeof(PluginConfig))
00176 
00186 #define pcdg(n, t)      (*((t *)plugin_config_data_get (PLUGIN_CONFS_NUM, PLUGIN_CONFS, n)))
00187 
00191 #define pcdgs(n)        ((char *)plugin_config_data_get (PLUGIN_CONFS_NUM, PLUGIN_CONFS, n))
00192 
00193 
00194 #endif /* _PLUGINS_MACROS_H_ */

Generated on Fri Jun 4 18:35:18 2004 for cuf by doxygen 1.3.6