-
Notifications
You must be signed in to change notification settings - Fork 1
/
array.h
76 lines (69 loc) · 2.45 KB
/
array.h
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
#ifndef ARRAY_H
#define ARRAY_H
/* It is usually better to include "lpc_incl.h" instead of including this
directly */
typedef struct array_s {
unsigned short ref;
#ifdef DEBUG
int extra_ref;
#endif
int size;
#ifdef PACKAGE_MUDLIB_STATS
statgroup_t stats; /* creator of the array */
#endif
svalue_t item[1];
} array_t;
extern array_t the_null_array;
/*
* array.c
*/
#ifdef ARRAY_STATS
extern int num_arrays;
extern int total_array_size;
#endif
int sameval (svalue_t *, svalue_t *);
array_t *allocate_array2 (int, svalue_t *);
array_t *allocate_array (int);
array_t *allocate_empty_array (int);
void free_array (array_t *);
void free_empty_array (array_t *);
array_t *add_array (array_t *, array_t *);
void implode_array (funptr_t *, array_t *, svalue_t *, int);
array_t *subtract_array (array_t *, array_t *);
array_t *slice_array (array_t *, int, int);
array_t *explode_string (const char *, int, const char *, int);
char *implode_string (array_t *, const char *, int);
array_t *users (void);
array_t *commands (object_t *);
void filter_array (svalue_t *, int);
void filter_string (svalue_t *, int);
array_t *deep_inherit_list (object_t *);
array_t *inherit_list (object_t *);
array_t *children (const char *);
array_t *livings (void);
array_t *objects (funptr_t *);
array_t *all_inventory (object_t *, int);
array_t *deep_inventory (object_t *, int, funptr_t *);
array_t *deep_inventory_array (array_t *, int, funptr_t *);
array_t *filter (array_t *, funptr_t *, svalue_t *);
array_t *builtin_sort_array (array_t *, int);
array_t *fp_sort_array (array_t *, funptr_t *);
array_t *sort_array (array_t *, char *, object_t *);
array_t *make_unique (array_t *, char *, funptr_t *, svalue_t *);
void map_string (svalue_t *arg, int num_arg);
void map_array (svalue_t *arg, int num_arg);
array_t *intersect_array (array_t *, array_t *);
int match_single_regexp (const char *, const char *);
array_t *match_regexp (array_t *, const char *, int);
array_t *reg_assoc (svalue_t *, array_t *, array_t *, svalue_t *);
void dealloc_array (array_t *);
array_t *union_array (array_t *, array_t *);
array_t *copy_array (array_t * p);
array_t *resize_array (array_t * p, unsigned int n);
#define ALLOC_ARRAY(nelem) \
(array_t *)DXALLOC(sizeof (array_t) + \
sizeof(svalue_t) * (nelem - 1), TAG_ARRAY, "ALLOC_ARRAY")
#define RESIZE_ARRAY(vec, nelem) \
(array_t *)DREALLOC(vec, sizeof (array_t) + \
sizeof(svalue_t) * (nelem - 1), TAG_ARRAY, "RESIZE_ARRAY")
#endif