dfa0b61997-01-21Fredrik Hübinette (Hubbe) /*\
3e9a462002-01-16Martin Nilsson ||| This file is part of Pike. For copyright information see COPYRIGHT.
59e32d2002-06-01Martin Nilsson ||| Pike is distributed under GPL, LGPL and MPL. See the file COPYING ||| for more information.
1b10db2002-10-08Martin Nilsson ||| $Id: module_support.h,v 1.14 2002/10/08 20:22:23 nilsson Exp $
dfa0b61997-01-21Fredrik Hübinette (Hubbe) \*/ #ifndef MODULE_SUPPORT_H #include <stdarg.h>
c9c1c51997-09-11Henrik Grubbström (Grubba) enum error_type { ERR_NONE, ERR_TOO_FEW, ERR_TOO_MANY, ERR_BAD_ARG }; struct expect_result { enum error_type error_type; int argno; /* Which argument was it */ unsigned INT32 expected; /* What type was expected */ TYPE_T got; /* What type did we actually receive */ };
d7143b2000-12-13Fredrik Hübinette (Hubbe) /* This should be used in module_init */ #define PIKE_MODULE_EXPORT(MOD, SYM) \
dc82262002-08-13Henrik Grubbström (Grubba)  pike_module_export_symbol(#MOD "." #SYM, CONSTANT_STRLEN(#MOD "." #SYM), (void *)SYM)
d7143b2000-12-13Fredrik Hübinette (Hubbe)  #define PIKE_MODULE_IMPORT(MOD, SYM) \ pike_module_import_symbol(#MOD "." #SYM, CONSTANT_STRLEN(#MOD "." #SYM), #MOD, CONSTANT_STRLEN(#MOD))
1f21332000-07-28Fredrik Hübinette (Hubbe)  /* Prototypes begin here */ PMOD_EXPORT int check_args(int args, ...); PMOD_EXPORT void check_all_args(const char *fnname, int args, ... );
dfa0b61997-01-21Fredrik Hübinette (Hubbe) int va_get_args(struct svalue *s, INT32 num_args,
0929a02002-09-12Marcus Comstedt  const char *fmt,
fdd2291997-01-27Fredrik Hübinette (Hubbe)  va_list ap);
1f21332000-07-28Fredrik Hübinette (Hubbe) PMOD_EXPORT int get_args(struct svalue *s,
dfa0b61997-01-21Fredrik Hübinette (Hubbe)  INT32 num_args,
0929a02002-09-12Marcus Comstedt  const char *fmt, ...); PMOD_EXPORT void get_all_args(const char *fname, INT32 args, const char *format, ... ); PMOD_EXPORT void pike_module_export_symbol(const char *str,
d7143b2000-12-13Fredrik Hübinette (Hubbe)  int len, void *ptr);
0929a02002-09-12Marcus Comstedt PMOD_EXPORT void *pike_module_import_symbol(const char *str,
d7143b2000-12-13Fredrik Hübinette (Hubbe)  int len,
0929a02002-09-12Marcus Comstedt  const char *module,
d7143b2000-12-13Fredrik Hübinette (Hubbe)  int module_len);
feef142002-05-14Martin Stjernholm void cleanup_module_support (void);
dfa0b61997-01-21Fredrik Hübinette (Hubbe) /* Prototypes end here */ #endif