| 1 |
#ifndef _FUNCTIONS_H_ |
|---|
| 2 |
#define _FUNCTIONS_H_ |
|---|
| 3 |
|
|---|
| 4 |
#include "copyrite.h" |
|---|
| 5 |
|
|---|
| 6 |
#define FN_REG 0x0 |
|---|
| 7 |
|
|---|
| 8 |
#define FN_NOPARSE 0x1 |
|---|
| 9 |
#define FN_LITERAL 0x2 |
|---|
| 10 |
#define FN_ARG_MASK 0x3 |
|---|
| 11 |
|
|---|
| 12 |
#define FN_DISABLED 0x4 |
|---|
| 13 |
|
|---|
| 14 |
#define FN_NOGAGGED 0x8 |
|---|
| 15 |
|
|---|
| 16 |
#define FN_NOGUEST 0x10 |
|---|
| 17 |
|
|---|
| 18 |
#define FN_NOFIXED 0x20 |
|---|
| 19 |
|
|---|
| 20 |
#define FN_WIZARD 0x40 |
|---|
| 21 |
|
|---|
| 22 |
#define FN_ADMIN 0x80 |
|---|
| 23 |
|
|---|
| 24 |
#define FN_GOD 0x100 |
|---|
| 25 |
|
|---|
| 26 |
#define FN_BUILTIN 0x200 |
|---|
| 27 |
|
|---|
| 28 |
#define FN_OVERRIDE 0x400 |
|---|
| 29 |
|
|---|
| 30 |
#define FN_NOSIDEFX 0x800 |
|---|
| 31 |
|
|---|
| 32 |
#define FN_LOGNAME 0x1000 |
|---|
| 33 |
|
|---|
| 34 |
#define FN_LOGARGS 0x2000 |
|---|
| 35 |
|
|---|
| 36 |
#define FN_LOCALIZE 0x4000 |
|---|
| 37 |
|
|---|
| 38 |
#define FN_USERFN 0x8000 |
|---|
| 39 |
|
|---|
| 40 |
#ifndef HAVE_FUN_DEFINED |
|---|
| 41 |
typedef struct fun FUN; |
|---|
| 42 |
#define HAVE_FUN_DEFINED |
|---|
| 43 |
#endif |
|---|
| 44 |
|
|---|
| 45 |
typedef void (*function_func) (FUN *, char *, char **, int, char *[], int[], |
|---|
| 46 |
dbref, dbref, dbref, const char *, PE_Info *); |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
union fun_call { |
|---|
| 53 |
function_func fun; |
|---|
| 54 |
size_t offset; |
|---|
| 55 |
}; |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
struct fun { |
|---|
| 61 |
const char *name; |
|---|
| 62 |
union fun_call where; |
|---|
| 63 |
int minargs; |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
int maxargs; |
|---|
| 71 |
unsigned int flags; |
|---|
| 72 |
}; |
|---|
| 73 |
|
|---|
| 74 |
typedef struct userfn_entry USERFN_ENTRY; |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
struct userfn_entry { |
|---|
| 80 |
char *fn; |
|---|
| 81 |
dbref thing; |
|---|
| 82 |
char *name; |
|---|
| 83 |
unsigned int flags; |
|---|
| 84 |
}; |
|---|
| 85 |
|
|---|
| 86 |
USERFN_ENTRY *userfn_tab; |
|---|
| 87 |
|
|---|
| 88 |
void do_userfn(char *buff, char **bp, |
|---|
| 89 |
dbref obj, ATTR *attrib, |
|---|
| 90 |
int nargs, char **args, |
|---|
| 91 |
dbref executor, dbref caller, dbref enactor, |
|---|
| 92 |
PE_Info *pe_info, int extra_flags); |
|---|
| 93 |
|
|---|
| 94 |
FUN *func_hash_lookup(const char *name); |
|---|
| 95 |
FUN *builtin_func_hash_lookup(const char *name); |
|---|
| 96 |
int check_func(dbref player, FUN *fp); |
|---|
| 97 |
int restrict_function(const char *name, const char *restrict); |
|---|
| 98 |
int alias_function(const char *function, const char *alias); |
|---|
| 99 |
void do_function_restrict(dbref player, const char *name, |
|---|
| 100 |
const char *restrict, int builtin); |
|---|
| 101 |
void do_function_restore(dbref player, const char *name); |
|---|
| 102 |
void do_list_functions(dbref player, int lc); |
|---|
| 103 |
char *list_functions(const char *); |
|---|
| 104 |
void do_function(dbref player, char *name, char **argv, int preserve); |
|---|
| 105 |
void do_function_toggle(dbref player, char *name, int toggle); |
|---|
| 106 |
void do_function_report(dbref player, char *name); |
|---|
| 107 |
void do_function_delete(dbref player, char *name); |
|---|
| 108 |
void function_init_postconfig(void); |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
#define FUNCTION_PROTO(fun_name) \ |
|---|
| 112 |
extern void fun_name (FUN *fun, char *buff, char **bp, int nargs, char *args[], \ |
|---|
| 113 |
int arglen[], dbref executor, dbref caller, dbref enactor, \ |
|---|
| 114 |
char const *called_as, PE_Info *pe_info) |
|---|
| 115 |
extern void function_add(const char *name, function_func fun, int minargs, |
|---|
| 116 |
int maxargs, int ftype); |
|---|
| 117 |
|
|---|
| 118 |
#endif |
|---|
| 119 |
|
|---|