Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

module.h

Go to the documentation of this file.
00001 /*
00002  * "$Id: module.h,v 1.1 2004/09/17 18:38:01 rleigh Exp $"
00003  *
00004  *   libgimpprint module loader - load modules with libltdl/libdl.
00005  *
00006  *   Copyright 1997-2000 Michael Sweet (mike@easysw.com),
00007  *      Robert Krawitz (rlk@alum.mit.edu) and Michael Natterer (mitch@gimp.org)
00008  *   Copyright 2002 Roger Leigh (rleigh@debian.org)
00009  *
00010  *   This program is free software; you can redistribute it and/or modify it
00011  *   under the terms of the GNU General Public License as published by the Free
00012  *   Software Foundation; either version 2 of the License, or (at your option)
00013  *   any later version.
00014  *
00015  *   This program is distributed in the hope that it will be useful, but
00016  *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00017  *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00018  *   for more details.
00019  *
00020  *   You should have received a copy of the GNU General Public License
00021  *   along with this program; if not, write to the Free Software
00022  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024 
00030 /*
00031  * This file must include only standard C header files.  The core code must
00032  * compile on generic platforms that don't support glib, gimp, gtk, etc.
00033  */
00034 
00035 #ifndef GUTENPRINT_MODULE_H
00036 #define GUTENPRINT_MODULE_H
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 #include <gutenprint/list.h>
00043 
00044 #ifdef USE_LTDL
00045 #include <ltdl.h>
00046 #elif defined(USE_DLOPEN)
00047 #include <dlfcn.h>
00048 #endif
00049 
00050 
00051 #ifdef USE_LTDL
00052 #define DLOPEN(Filename)       lt_dlopen(Filename)
00053 #define DLSYM(Handle, Symbol)  lt_dlsym(Handle, Symbol)
00054 #define DLCLOSE(Handle)        lt_dlclose(Handle)
00055 #define DLERROR()              lt_dlerror()
00056 #elif defined(USE_DLOPEN)
00057 #define DLOPEN(Filename)       dlopen(Filename, RTLD_LAZY)
00058 #define DLSYM(Handle, Symbol)  stp_dlsym(Handle, Symbol, modulename)
00059 #define DLCLOSE(Handle)        dlclose(Handle)
00060 #define DLERROR()              dlerror()
00061 #endif
00062 
00063 typedef struct stp_module_version
00064 {
00065   int major;
00066   int minor;
00067 } stp_module_version_t;
00068 
00069 
00070 typedef enum
00071 {
00072   STP_MODULE_CLASS_INVALID,
00073   STP_MODULE_CLASS_MISC,
00074   STP_MODULE_CLASS_FAMILY,
00075   STP_MODULE_CLASS_COLOR,
00076   STP_MODULE_CLASS_DITHER
00077 } stp_module_class_t;
00078 
00079 
00080 typedef struct stp_module
00081 {
00082   const char *name;         /* module name */
00083   const char *version;      /* module version number */
00084   const char *comment;      /* description of module function */
00085   stp_module_class_t class; /* type of module */
00086 #ifdef USE_LTDL
00087   lt_dlhandle handle;       /* ltdl module pointer (set by libgimpprint) */
00088 #else
00089   void *handle;             /* dlopen or static module pointer */
00090 #endif
00091   int (*init)(void);        /* initialisation function */
00092   int (*fini)(void);        /* finalise (cleanup and removal) function */
00093   void *syms;               /* pointer to e.g. a struct containing
00094                                internal module symbols (class-specific
00095                                functions and data) */
00096 } stp_module_t;
00097 
00098 
00099 extern int stp_module_load(void);
00100 extern int stp_module_exit(void);
00101 extern int stp_module_open(const char *modulename);
00102 extern int stp_module_init(void);
00103 extern int stp_module_close(stp_list_item_t *module);
00104 extern stp_list_t *stp_module_get_class(stp_module_class_t class);
00105 
00106 
00107 #ifdef __cplusplus
00108   }
00109 #endif
00110 
00111 #endif /* GUTENPRINT_MODULE_H */

Generated on Thu Feb 10 19:29:29 2005 for libgutenprint API Reference by  doxygen 1.4.1