merentha_mudos_v1/
merentha_mudos_v1/bin/
merentha_mudos_v1/lib/cfg/
merentha_mudos_v1/lib/cfg/races/
merentha_mudos_v1/lib/cmds/abilities/
merentha_mudos_v1/lib/cmds/actions/
merentha_mudos_v1/lib/cmds/spells/
merentha_mudos_v1/lib/daemon/include/
merentha_mudos_v1/lib/daemon/services/
merentha_mudos_v1/lib/doc/
merentha_mudos_v1/lib/doc/building/
merentha_mudos_v1/lib/doc/help/classes/
merentha_mudos_v1/lib/doc/help/general/
merentha_mudos_v1/lib/doc/help/races/
merentha_mudos_v1/lib/doc/help/skills/
merentha_mudos_v1/lib/doc/help/stats/
merentha_mudos_v1/lib/doc/man/efuns/
merentha_mudos_v1/lib/doc/man/lfuns/
merentha_mudos_v1/lib/doc/news/
merentha_mudos_v1/lib/doc/old/
merentha_mudos_v1/lib/doc/old/concepts/
merentha_mudos_v1/lib/doc/old/lpc/constructs/
merentha_mudos_v1/lib/doc/old/lpc/types/
merentha_mudos_v1/lib/domains/ROOMS/
merentha_mudos_v1/lib/domains/obj/armour/
merentha_mudos_v1/lib/domains/obj/monsters/
merentha_mudos_v1/lib/domains/obj/other/
merentha_mudos_v1/lib/domains/obj/weapons/
merentha_mudos_v1/lib/realms/petrarch/
merentha_mudos_v1/lib/save/daemons/
merentha_mudos_v1/lib/save/rid/
merentha_mudos_v1/lib/save/users/a/
merentha_mudos_v1/lib/save/users/p/
merentha_mudos_v1/lib/save/users/t/
merentha_mudos_v1/lib/std/login/
merentha_mudos_v1/lib/std/obj/
merentha_mudos_v1/v22.2b12m1/
merentha_mudos_v1/v22.2b12m1/ChangeLog.old/
merentha_mudos_v1/v22.2b12m1/Win32/
merentha_mudos_v1/v22.2b12m1/compat/
merentha_mudos_v1/v22.2b12m1/compat/simuls/
merentha_mudos_v1/v22.2b12m1/include/
merentha_mudos_v1/v22.2b12m1/mudlib/
merentha_mudos_v1/v22.2b12m1/testsuite/
merentha_mudos_v1/v22.2b12m1/testsuite/clone/
merentha_mudos_v1/v22.2b12m1/testsuite/command/
merentha_mudos_v1/v22.2b12m1/testsuite/data/
merentha_mudos_v1/v22.2b12m1/testsuite/etc/
merentha_mudos_v1/v22.2b12m1/testsuite/include/
merentha_mudos_v1/v22.2b12m1/testsuite/inherit/
merentha_mudos_v1/v22.2b12m1/testsuite/inherit/master/
merentha_mudos_v1/v22.2b12m1/testsuite/log/
merentha_mudos_v1/v22.2b12m1/testsuite/single/
merentha_mudos_v1/v22.2b12m1/testsuite/single/tests/compiler/
merentha_mudos_v1/v22.2b12m1/testsuite/single/tests/efuns/
merentha_mudos_v1/v22.2b12m1/testsuite/single/tests/operators/
merentha_mudos_v1/v22.2b12m1/testsuite/u/
merentha_mudos_v1/v22.2b12m1/tmp/
/* mapping.h - 1992/07/19 */

/* It is usually better to include "lpc_incl.h" instead of including this
   directly */

#ifndef _MAPPING_H
#define _MAPPING_H

#define MAP_POINTER_HASH(x) (((POINTER_INT)x) >> 4)

typedef struct mapping_node_s {
    struct mapping_node_s *next;
    svalue_t values[2];
} mapping_node_t;

#define MNB_SIZE 256

typedef struct mapping_node_block_s {
    struct mapping_node_block_s *next;
    mapping_node_t nodes[MNB_SIZE];
} mapping_node_block_t;

#define MAX_TABLE_SIZE 32768
#define MAP_HASH_TABLE_SIZE 8	/* must be a power of 2 */
#define FILL_PERCENT 80		/* must not be larger than 99 */

#define MAPSIZE(size) sizeof(mapping_t)

#define MAP_LOCKED 0x80000000
#define MAP_COUNT(m) ((m)->count & ~MAP_LOCKED)

typedef struct mapping_s {
    unsigned short ref;		/* how many times this map has been
				 * referenced */
#ifdef DEBUG
    int extra_ref;
#endif
    mapping_node_t **table;	/* the hash table */
    unsigned short table_size;	/* # of buckets in hash table == power of 2 */
    unsigned short unfilled;	/* # of buckets among 80% of total buckets that do not have entries */
    unsigned int count;		/* total # of nodes actually in mapping  */
#ifdef PACKAGE_MUDLIB_STATS
    statgroup_t stats;		/* creators of the mapping */
#endif
} mapping_t;

typedef struct finfo_s {
    char *func;
    object_t *obj;
    svalue_t *extra;
    funptr_t *fp;
}       finfo_t;

typedef struct vinfo_s {
    array_t *v;
    int pos, size, w;
}       vinfo_t;

typedef struct minfo_s {
    mapping_t *map, *newmap;
}       minfo_t;

#define mapping_too_large() \
    error("Mapping exceeded maximum allowed size of %d.\n",MAX_MAPPING_SIZE);

#ifndef max
#define max(x,y) ((x) > (y)) ? (x) : (y)
#endif

/*
 * mapping.c
 */
extern int num_mappings;
extern int total_mapping_size;
extern int total_mapping_nodes;
extern mapping_node_t *locked_map_nodes;

int msameval PROT((svalue_t *, svalue_t *));
int mapping_save_size PROT((mapping_t *));
INLINE mapping_t *mapTraverse PROT((mapping_t *, int (*) (mapping_t *, mapping_node_t *, void *), void *));
INLINE mapping_t *load_mapping_from_aggregate PROT((svalue_t *, int));
INLINE mapping_t *allocate_mapping PROT((int));
INLINE mapping_t *allocate_mapping2 PROT((array_t *, svalue_t *));
INLINE void free_mapping PROT((mapping_t *));
INLINE svalue_t *find_in_mapping PROT((mapping_t *, svalue_t *));
svalue_t *find_string_in_mapping PROT((mapping_t *, char *));
INLINE svalue_t *find_for_insert PROT((mapping_t *, svalue_t *, int));
INLINE void absorb_mapping PROT((mapping_t *, mapping_t *));
INLINE void mapping_delete PROT((mapping_t *, svalue_t *));
INLINE mapping_t *add_mapping PROT((mapping_t *, mapping_t *));
mapping_node_t *new_map_node PROT((void));
int restore_hash_string PROT((char **str, svalue_t *));
int growMap PROT((mapping_t *));
void free_node PROT((mapping_t *, mapping_node_t *));
void unlock_mapping PROT((mapping_t *));
void map_mapping PROT((svalue_t *, int));
void filter_mapping PROT((svalue_t *, int));
INLINE mapping_t *compose_mapping PROT((mapping_t *, mapping_t *, unsigned short));
array_t *mapping_indices PROT((mapping_t *));
array_t *mapping_values PROT((mapping_t *));
array_t *mapping_each PROT((mapping_t *));
char *save_mapping PROT((mapping_t *));
void dealloc_mapping PROT((mapping_t *));
void mark_mapping_node_blocks PROT((void));
mapping_t *mkmapping PROT((array_t *, array_t *));

void add_mapping_pair PROT((mapping_t *, char *, int));
void add_mapping_string PROT((mapping_t *, char *, char *));
void add_mapping_malloced_string PROT((mapping_t *, char *, char *));
void add_mapping_object PROT((mapping_t *, char *, object_t *));
void add_mapping_array PROT((mapping_t *, char *, array_t *));
void add_mapping_shared_string PROT((mapping_t *, char *, char *));

#endif				/* _MAPPING_H */