-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathfunc_spec.c
400 lines (342 loc) · 11.2 KB
/
func_spec.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
#include "spec.h"
#include "op_spec.c"
/*
* This file specifies types and arguments for efuns.
* An argument can have two different types with the syntax 'type1 | type2'.
* An argument is marked as optional if it also takes the type 'void'.
*
* Comment out the efuns that you do not want. Be careful not to comment
* out something that you need.
*
* The order in which the efuns are listed here is the order in which opcode
* #'s will be assigned. It is in your interest to move the least frequently
* used efuns to the bottom of this file (and the most frequently used
* ones to the top). The opcprof() efun could help you find out which
* efuns are most often and least often used. The reason for ordering
* the efuns is that only the first 255 efuns are represented using
* a single byte. Any additional efuns require two bytes.
*/
#ifdef NO_BUFFER_TYPE
#define OR_BUFFER
#else
#define OR_BUFFER | buffer
#endif
/* These next few efuns are used internally; do not remove them.
* The leading _ is used to keep track of which efuns should exist,
* but not be added to the identifier lookup table.
* These names MUST exist, and may either be real efuns, or aliases
* for another efun. For example, one could remove clone_object
* above, and change the internal one to:
*
* object _new(string, ...);
*/
/* used by X->f() */
unknown _call_other(object | string | object *, string | mixed *,...);
/* used by (*f)(...) */
mixed _evaluate(mixed, ...);
/* default argument for some efuns */
object _this_object();
/* used for implicit float/int conversions */
int _to_int(string | float | int OR_BUFFER);
float _to_float(string | float | int);
/* used by new() */
object _new(string, ...);
unknown call_other _call_other(object | string | object *, string | mixed *,...);
mixed evaluate _evaluate(mixed, ...);
#ifdef COMPAT_32
mixed funcall _evaluate(mixed, ...);
#endif
object this_object _this_object();
int to_int _to_int(string | float | int OR_BUFFER);
float to_float _to_float(string | float | int);
object clone_object _new(string, ...);
function bind(function, object);
object this_player(int default: 0);
object this_interactive this_player( int default: 1);
object this_user this_player( int default: 0);
mixed previous_object(int default: 0);
object *all_previous_objects previous_object(int default: -1);
mixed *call_stack(int default: 0);
int sizeof(mixed);
int strlen sizeof(string);
void destruct(object);
string file_name(object default: F__THIS_OBJECT);
string capitalize(string);
string *explode(string, string);
mixed implode(mixed *, string | function, void | mixed);
#ifdef CALLOUT_HANDLES
int call_out(string | function, int,...);
#else
void call_out(string | function, int,...);
#endif
int member_array(mixed, string | mixed *, void | int);
int input_to(string | function,...);
int random(int);
#ifndef NO_ENVIRONMENT
object environment(void | object);
object *all_inventory(object default: F__THIS_OBJECT);
object *deep_inventory(object default: F__THIS_OBJECT);
object first_inventory(object|string default: F__THIS_OBJECT);
object next_inventory(object default: F__THIS_OBJECT);
void say(string, void | object | object *);
void tell_room(object | string, string | object | int | float, void | object | object *);
object present(object | string, void | object);
void move_object(object | string);
#endif
#ifndef NO_ADD_ACTION
void add_action(string | function, string | string *, void | int);
string query_verb();
int command(string);
int remove_action(string, string);
int living(object default: F__THIS_OBJECT);
mixed *commands();
void disable_commands();
void enable_commands();
void set_living_name(string);
object *livings();
object find_living(string);
object find_player(string);
void notify_fail(string | function);
#else
void set_this_player(object | int);
void set_this_user set_this_player(object | int);
#endif
string lower_case(string);
string replace_string(string, string, string,...);
int restore_object(string, void | int);
int save_object(string, void | int);
string save_variable(mixed);
mixed restore_variable(string);
object *users();
mixed *get_dir(string, int default: 0);
int strsrch(string, string | int, int default: 0);
#ifdef COMPAT_32
int strstr strsrch(string, string | int, int default: 0);
#endif
/* communication functions */
void write(mixed);
void tell_object(object, string);
void shout(string);
void receive(string OR_BUFFER);
void message(mixed, mixed, string | string * | object | object *,
void | object | object *);
/* the find_* functions */
object find_object(string, int default: 0);
object load_object find_object(string, int default: 1);
#ifdef CALLOUT_HANDLES
int find_call_out(int|string);
#else
int find_call_out(string);
#endif
/* mapping functions */
mapping allocate_mapping(int | mixed *, void | mixed);
mixed *values(mapping);
mixed *keys(mapping);
#ifdef COMPAT_32
mapping map_delete(mapping, mixed);
mapping m_delete map_delete(mapping, mixed);
mixed *m_values values(mapping);
mixed *m_indices keys(mapping);
#else
void map_delete(mapping, mixed);
#endif
mixed match_path(mapping, string);
/* all the *p() type functions */
int clonep(mixed default: F__THIS_OBJECT);
int intp(mixed);
int undefinedp(mixed);
int nullp undefinedp(mixed);
int floatp(mixed);
int stringp(mixed);
int virtualp(object);
int functionp(mixed);
#ifdef COMPAT_32
int closurep functionp(mixed);
#endif
int pointerp(mixed);
int arrayp pointerp(mixed);
int objectp(mixed);
int classp(mixed);
string typeof(mixed);
#ifndef NO_BUFFER_TYPE
int bufferp(mixed);
buffer allocate_buffer(int);
#endif
int inherits(string, object);
void replace_program(string);
mixed regexp(string | string *, string, void | int);
mixed *reg_assoc(string, string *, mixed *, mixed | void);
mixed *allocate(int, void | mixed);
mixed *call_out_info();
/* 32-bit cyclic redundancy code - see crc32.c and crctab.h */
int crc32(string OR_BUFFER);
/* commands operating on files */
#ifndef NO_BUFFER_TYPE
mixed read_buffer(string | buffer, void | int, void | int);
int write_buffer(string | buffer, int, string | buffer | int);
#endif
int write_file(string, string, void | int);
int rename(string, string);
int write_bytes(string, int, string);
int file_size(string);
string read_bytes(string, void | int, void | int);
string read_file(string, void | int, void | int);
int cp(string, string);
#ifndef LATTICE
int link(string, string);
#endif
int mkdir(string);
int rm(string);
int rmdir(string);
/* the bit string functions */
string clear_bit(string, int);
int test_bit(string, int);
string set_bit(string, int);
int next_bit(string, int);
string crypt(string, string | int);
string oldcrypt(string, string | int);
string ctime(int);
int exec(object, object);
mixed *localtime(int);
string function_exists(string, void | object, void | int);
object *objects(void | string | function);
string query_host_name();
int query_idle(object);
string query_ip_name(void | object);
string query_ip_number(void | object);
#ifndef NO_SNOOP
object snoop(object, void | object);
object query_snoop(object);
object query_snooping(object);
#endif
#ifdef CALLOUT_HANDLES
int remove_call_out(int | void | string);
#else
int remove_call_out(void | string);
#endif
void set_heart_beat(int);
int query_heart_beat(object default:F__THIS_OBJECT);
void set_hide(int);
#ifdef LPC_TO_C
int generate_source(string | string *, void | string);
string lpc_info();
#endif
#ifndef NO_RESETS
void set_reset(object, void | int);
#endif
#ifndef NO_SHADOWS
object shadow(object, int default: 1);
object query_shadowing(object);
#endif
mixed *sort_array(mixed *, int | string | function, ...);
void throw(mixed);
int time();
mixed *unique_array(mixed *, string | function, void | mixed);
mapping unique_mapping(mixed *, string | function, ...);
string *deep_inherit_list(object default:F__THIS_OBJECT);
string *shallow_inherit_list(object default:F__THIS_OBJECT);
#ifdef COMPAT_32
string *inherit_list deep_inherit_list(object default:F__THIS_OBJECT);
#else
string *inherit_list shallow_inherit_list(object default:F__THIS_OBJECT);
#endif
void printf(string,...);
string sprintf(string,...);
int mapp(mixed);
mixed *stat(string, int default: 0);
/*
* Object properties
*/
int interactive(object default:F__THIS_OBJECT);
string in_edit(object default:F__THIS_OBJECT);
int in_input(object default:F__THIS_OBJECT);
int userp(object);
#ifdef COMPAT_32
int query_once_interactive userp(object);
#endif
#ifndef NO_WIZARDS
void enable_wizard();
void disable_wizard();
int wizardp(object);
#endif
object master();
/*
* various mudlib statistics
*/
int memory_info(object | void);
mixed get_config(int);
#ifdef PRIVS
/* privledge functions */
string query_privs(object default:F__THIS_OBJECT);
void set_privs(object, int | string);
#endif /* PRIVS */
int get_char(string | function,...);
object *children(string);
void reload_object(object);
void error(string);
#ifdef COMPAT_32
void raise_error error(string);
#endif
int uptime();
int strcmp(string, string);
#ifndef WIN32
#if (defined(RUSAGE) || defined(GET_PROCESS_STATS) || defined(TIMES)) || defined(LATTICE)
mapping rusage();
#endif /* RUSAGE */
#endif
void flush_messages(void | object);
#ifdef OLD_ED
void ed(string | void, string | void, string | int | void, int | void);
#else
string ed_start(string | void, int | void);
string ed_cmd(string);
int query_ed_mode();
#endif
#ifdef CACHE_STATS
string cache_stats();
#endif
mixed filter(string | mixed * | mapping, string | function, ...);
mixed filter_array filter(mixed *, string | function, ...);
mapping filter_mapping filter(mapping, string | function, ...);
mixed map(string | mapping | mixed *, string | function, ...);
mapping map_mapping map(mapping, string | function, ...);
mixed *map_array map(mixed *, string | function, ...);
/*
* parser 'magic' functions, turned into efuns
*/
string malloc_status();
string mud_status(int default: 0);
void dumpallobj(string | void);
string dump_file_descriptors();
string query_load_average();
#ifndef NO_LIGHT
/* set_light should die a dark death */
int set_light(int);
#endif
string origin();
/* the infrequently used functions */
int reclaim_objects();
int set_eval_limit(int);
int reset_eval_cost set_eval_limit(int default: 0);
int eval_cost set_eval_limit(int default: -1);
int max_eval_cost set_eval_limit(int default: 1);
#ifdef COMPAT_32
int get_eval_cost set_eval_limit(int default: -1);
#endif
#ifdef DEBUG_MACRO
void set_debug_level(int|string);
mapping debug_levels();
void clear_debug_level(string);
#endif
#if defined(OPCPROF) || defined(OPCPROF_2D)
void opcprof(string | void);
#endif
#ifdef PROFILE_FUNCTIONS
mapping *function_profile(object default:F__THIS_OBJECT);
#endif
#ifdef DEBUG
void swap(object); /* Only used for debugging */
#endif
int resolve(string, string|function);
/* shutdown is at the end because it is only called once per boot cycle :) */
void shutdown(void | int);