Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

include/gimp-print/module.h

Go to the documentation of this file.
00001 /*
00002  * "$Id: module.h,v 1.2 2004/05/08 00:05:30 rlk 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 
00025 /*
00026  * This file must include only standard C header files.  The core code must
00027  * compile on generic platforms that don't support glib, gimp, gtk, etc.
00028  */
00029 
00030 #ifndef GIMP_PRINT_MODULE_H
00031 #define GIMP_PRINT_MODULE_H
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 #include <gimp-print/list.h>
00038 
00039 #ifdef USE_LTDL
00040 #include <ltdl.h>
00041 #elif defined(USE_DLOPEN)
00042 #include <dlfcn.h>
00043 #endif
00044 
00045 
00046 #ifdef USE_LTDL
00047 #define DLOPEN(Filename)       lt_dlopen(Filename)
00048 #define DLSYM(Handle, Symbol)  lt_dlsym(Handle, Symbol)
00049 #define DLCLOSE(Handle)        lt_dlclose(Handle)
00050 #define DLERROR()              lt_dlerror()
00051 #elif defined(USE_DLOPEN)
00052 #define DLOPEN(Filename)       dlopen(Filename, RTLD_LAZY)
00053 #define DLSYM(Handle, Symbol)  stp_dlsym(Handle, Symbol, modulename)
00054 #define DLCLOSE(Handle)        dlclose(Handle)
00055 #define DLERROR()              dlerror()
00056 #endif
00057 
00058 typedef struct stp_module_version
00059 {
00060   int major;
00061   int minor;
00062 } stp_module_version_t;
00063 
00064 
00065 typedef enum
00066 {
00067   STP_MODULE_CLASS_INVALID,
00068   STP_MODULE_CLASS_MISC,
00069   STP_MODULE_CLASS_FAMILY,
00070   STP_MODULE_CLASS_COLOR,
00071   STP_MODULE_CLASS_DITHER
00072 } stp_module_class_t;
00073 
00074 
00075 typedef struct stp_module
00076 {
00077   const char *name;         /* module name */
00078   const char *version;      /* module version number */
00079   const char *comment;      /* description of module function */
00080   stp_module_class_t class; /* type of module */
00081 #ifdef USE_LTDL
00082   lt_dlhandle handle;       /* ltdl module pointer (set by libgimpprint) */
00083 #else
00084   void *handle;             /* dlopen or static module pointer */
00085 #endif
00086   int (*init)(void);        /* initialisation function */
00087   int (*fini)(void);        /* finalise (cleanup and removal) function */
00088   void *syms;               /* pointer to e.g. a struct containing
00089                                internal module symbols (class-specific
00090                                functions and data) */
00091 } stp_module_t;
00092 
00093 
00094 extern int stp_module_load(void);
00095 extern int stp_module_exit(void);
00096 extern int stp_module_open(const char *modulename);
00097 extern int stp_module_init(void);
00098 extern int stp_module_close(stp_list_item_t *module);
00099 extern stp_list_t *stp_module_get_class(stp_module_class_t class);
00100 
00101 
00102 #ifdef __cplusplus
00103   }
00104 #endif
00105 
00106 #endif /* GIMP_PRINT_MODULE_H */

Generated on Wed May 12 20:21:27 2004 for libgimpprint API Reference by doxygen1.2.17