Main Page | Class List | Directories | File List | Class Members | File Members

module_support.h

Go to the documentation of this file.
00001 /*
00002 || This file is part of Pike. For copyright information see COPYRIGHT.
00003 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
00004 || for more information.
00005 || $Id: module_support.h,v 1.16 2002/10/21 17:05:07 marcus Exp $
00006 */
00007 
00008 #ifndef MODULE_SUPPORT_H
00009 #include <stdarg.h>
00010 
00011 #include "module.h"
00012 
00013 enum error_type {
00014   ERR_NONE,
00015   ERR_TOO_FEW,
00016   ERR_TOO_MANY,
00017   ERR_BAD_ARG
00018 };
00019 
00020 struct expect_result {
00021   enum error_type error_type;
00022   int argno;                 /* Which argument was it */
00023   unsigned INT32 expected;   /* What type was expected */
00024   TYPE_T got;               /* What type did we actually receive */
00025 };
00026 
00027 /* This should be used in module_init */
00028 #define PIKE_MODULE_EXPORT(MOD, SYM) \
00029   pike_module_export_symbol(#MOD "." #SYM, CONSTANT_STRLEN(#MOD "." #SYM), (void *)SYM)
00030 
00031 #define PIKE_MODULE_IMPORT(MOD, SYM) \
00032   pike_module_import_symbol(#MOD "." #SYM, CONSTANT_STRLEN(#MOD "." #SYM), #MOD, CONSTANT_STRLEN(#MOD))
00033 
00034 
00035 /* Prototypes begin here */
00036 PMOD_EXPORT int check_args(int args, ...);
00037 PMOD_EXPORT void check_all_args(const char *fnname, int args, ... );
00038 int va_get_args(struct svalue *s,
00039                 INT32 num_args,
00040                 const char *fmt,
00041                 va_list ap);
00042 PMOD_EXPORT int get_args(struct svalue *s,
00043              INT32 num_args,
00044              const char *fmt, ...);
00045 PMOD_EXPORT void get_all_args(const char *fname, INT32 args,
00046                               const char *format,  ... );
00047 PMOD_EXPORT void pike_module_export_symbol(const char *str,
00048                                            int len,
00049                                            void *ptr);
00050 PMOD_EXPORT void *pike_module_import_symbol(const char *str,
00051                                             int len,
00052                                             const char *module,
00053                                             int module_len);
00054 void cleanup_module_support (void);
00055 /* Prototypes end here */
00056 
00057 #endif

Generated on Fri Jul 22 23:44:26 2005 for Pike by  doxygen 1.3.9.1