Select Git revision
module_support.h
-
Fredrik Hübinette (Hubbe) authored
Rev: src/.cvsignore:1.24 Rev: src/Makefile.in:1.198 Rev: src/aclocal.m4:1.17 Rev: src/array.c:1.79 Rev: src/array.h:1.22 Rev: src/backend.c:1.53 Rev: src/backend.h:1.9 Rev: src/bignum.c:1.17 Rev: src/bignum.h:1.14 Rev: src/builtin_functions.c:1.293 Rev: src/builtin_functions.h:1.14 Rev: src/callback.c:1.20 Rev: src/configure.in:1.387 Rev: src/constants.c:1.22 Rev: src/dynamic_buffer.c:1.10 Rev: src/dynamic_load.c:1.41 Rev: src/error.c:1.56 Rev: src/error.h:1.46 Rev: src/fd_control.c:1.32 Rev: src/fdlib.c:1.37 Rev: src/fdlib.h:1.34 Rev: src/fsort.c:1.13 Rev: src/fsort_template.h:1.7 Rev: src/gc.c:1.110 Rev: src/gc.h:1.57 Rev: src/global.h:1.44 Rev: src/interpret.c:1.158 Rev: src/interpret.h:1.52 Rev: src/main.c:1.94 Rev: src/mapping.c:1.94 Rev: src/mapping.h:1.28 Rev: src/module_magic.h:1.1 Rev: src/module_support.c:1.34 Rev: src/module_support.h:1.7 Rev: src/multiset.c:1.26 Rev: src/object.c:1.137 Rev: src/object.h:1.50 Rev: src/opcodes.c:1.78 Rev: src/operators.c:1.93 Rev: src/operators.h:1.8 Rev: src/pike_macros.h:1.17 Rev: src/pike_memory.c:1.71 Rev: src/pike_memory.h:1.14 Rev: src/pike_types.c:1.132 Rev: src/port.c:1.28 Rev: src/precompile.sh.in:1.2 Rev: src/program.c:1.252 Rev: src/program.h:1.97 Rev: src/signal_handler.c:1.173 Rev: src/stralloc.c:1.85 Rev: src/stralloc.h:1.42 Rev: src/stuff.c:1.11 Rev: src/svalue.c:1.85 Rev: src/svalue.h:1.62 Rev: src/testsuite.in:1.316 Rev: src/threads.c:1.133 Rev: src/threads.h:1.99
Fredrik Hübinette (Hubbe) authoredRev: src/.cvsignore:1.24 Rev: src/Makefile.in:1.198 Rev: src/aclocal.m4:1.17 Rev: src/array.c:1.79 Rev: src/array.h:1.22 Rev: src/backend.c:1.53 Rev: src/backend.h:1.9 Rev: src/bignum.c:1.17 Rev: src/bignum.h:1.14 Rev: src/builtin_functions.c:1.293 Rev: src/builtin_functions.h:1.14 Rev: src/callback.c:1.20 Rev: src/configure.in:1.387 Rev: src/constants.c:1.22 Rev: src/dynamic_buffer.c:1.10 Rev: src/dynamic_load.c:1.41 Rev: src/error.c:1.56 Rev: src/error.h:1.46 Rev: src/fd_control.c:1.32 Rev: src/fdlib.c:1.37 Rev: src/fdlib.h:1.34 Rev: src/fsort.c:1.13 Rev: src/fsort_template.h:1.7 Rev: src/gc.c:1.110 Rev: src/gc.h:1.57 Rev: src/global.h:1.44 Rev: src/interpret.c:1.158 Rev: src/interpret.h:1.52 Rev: src/main.c:1.94 Rev: src/mapping.c:1.94 Rev: src/mapping.h:1.28 Rev: src/module_magic.h:1.1 Rev: src/module_support.c:1.34 Rev: src/module_support.h:1.7 Rev: src/multiset.c:1.26 Rev: src/object.c:1.137 Rev: src/object.h:1.50 Rev: src/opcodes.c:1.78 Rev: src/operators.c:1.93 Rev: src/operators.h:1.8 Rev: src/pike_macros.h:1.17 Rev: src/pike_memory.c:1.71 Rev: src/pike_memory.h:1.14 Rev: src/pike_types.c:1.132 Rev: src/port.c:1.28 Rev: src/precompile.sh.in:1.2 Rev: src/program.c:1.252 Rev: src/program.h:1.97 Rev: src/signal_handler.c:1.173 Rev: src/stralloc.c:1.85 Rev: src/stralloc.h:1.42 Rev: src/stuff.c:1.11 Rev: src/svalue.c:1.85 Rev: src/svalue.h:1.62 Rev: src/testsuite.in:1.316 Rev: src/threads.c:1.133 Rev: src/threads.h:1.99
constants.h 3.15 KiB
/*
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
|| $Id: constants.h,v 1.37 2008/05/11 14:55:53 mast Exp $
*/
#ifndef ADD_EFUN_H
#define ADD_EFUN_H
#include "svalue.h"
#include "hashtable.h"
#include "las.h" /* For OPT_SIDE_EFFECT etc. */
#include "block_alloc_h.h"
typedef int (*docode_fun)(node *n);
typedef node *(*optimize_fun)(node *n);
#define CALLABLE_DYNAMIC 1
struct callable
{
PIKE_MEMORY_OBJECT_MEMBERS;
c_fun function;
struct pike_type *type;
struct pike_string *name;
struct program *prog;
INT16 flags; /* OPT_* */
INT16 internal_flags;
#ifdef PIKE_DEBUG
INT8 may_return_void;
long runs;
struct callable *prev;
#endif
optimize_fun optimize;
docode_fun docode;
struct callable *next;
};
#ifdef PIKE_DEBUG
/* We have a double-linked list in debug mode for identification
* purposes. */
extern struct callable *first_callable;
#endif
/* Prototypes begin here */
PMOD_EXPORT struct mapping *get_builtin_constants(void);
void low_add_efun(struct pike_string *name, struct svalue *fun);
void low_add_constant(const char *name, struct svalue *fun);
void add_pike_string_constant(const char *name, const char *str, int len);
PMOD_EXPORT void add_global_program(const char *name, struct program *p);
BLOCK_ALLOC_FILL_PAGES(callable,2);
PMOD_EXPORT struct callable *low_make_callable(c_fun fun,
struct pike_string *name,
struct pike_type *type,
int flags,
optimize_fun optimize,
docode_fun docode);
PMOD_EXPORT struct callable *make_callable(c_fun fun,
const char *name,
const char *type,
int flags,
optimize_fun optimize,
docode_fun docode);
PMOD_EXPORT struct callable *add_efun2(const char *name,
c_fun fun,
const char *type,
int flags,
optimize_fun optimize,
docode_fun docode);
PMOD_EXPORT struct callable *add_efun(const char *name, c_fun fun, const char *type, int flags);
PMOD_EXPORT struct callable *quick_add_efun(const char *name, ptrdiff_t name_length,
c_fun fun,
const char *type, ptrdiff_t type_length,
int flags,
optimize_fun optimize,
docode_fun docode);
PMOD_EXPORT void visit_callable (struct callable *c, int action);
void init_builtin_constants(void);
void exit_builtin_constants(void);
/* Prototypes end here */
#define visit_callable_ref(C, REF_TYPE) \
visit_ref (pass_callable (C), (REF_TYPE), \
(visit_thing_fn *) &visit_callable, NULL)
#include "pike_macros.h"
#define ADD_EFUN2(NAME,FUN,TYPE,OPT_FLAGS,OPTIMIZE,DOCODE) \
quick_add_efun(NAME,CONSTANT_STRLEN(NAME),FUN, \
TYPE,CONSTANT_STRLEN(TYPE),OPT_FLAGS,OPTIMIZE,DOCODE)
#define ADD_EFUN(NAME,FUN,TYPE,OPT_FLAGS) \
ADD_EFUN2(NAME,FUN,TYPE,OPT_FLAGS,0,0)
#define ADD_EFUN_DTYPE(NAME,FUN,DTYPE,FLAGS) do { \
DTYPE_START; \
{DTYPE} \
{ \
struct pike_string *_t; \
DTYPE_END(_t); \
quick_add_efun(NAME,CONSTANT_STRLEN(NAME),FUN,_t->str,_t->len,FLAGS,0,0); \
free_string(_t); \
} \
} while (0)
#endif