Skip to content
Snippets Groups Projects
Select Git revision
1 result Searching

dynamic_module_makefile.in

Blame
  • mapping.h 6.14 KiB
    /*\
    ||| This file a part of Pike, and is copyright by Fredrik Hubinette
    ||| Pike is distributed as GPL (General Public License)
    ||| See the files COPYING and DISCLAIMER for more information.
    \*/
    
    /*
     * $Id: mapping.h,v 1.34 2000/12/16 05:45:44 marcus Exp $
     */
    #ifndef MAPPING_H
    #define MAPPING_H
    
    #include "las.h"
    #include "block_alloc_h.h"
    
    #define MAPPING_FLAG_WEAK 1
    
    struct keypair
    {
      struct keypair *next;
      unsigned INT32 hval;
      struct svalue ind, val;
    };
    
    struct mapping_data
    {
      INT32 refs;
      INT32 valrefs; /* lock values too */
      INT32 hardlinks;
      INT32 size, hashsize;
      INT32 num_keypairs;
      TYPE_FIELD ind_types, val_types;
      INT16 flags;
      struct keypair *free_list;
      struct keypair *hash[1 /* hashsize */ ];
      /* struct keypair data_block[ hashsize * AVG_LINK_LENGTH ] */
    };
    
    #undef MAPPING_SIZE_DEBUG
    /* This debug doesn't work with weak mappings in the gc. */
    
    struct mapping
    {
      INT32 refs;
    #ifdef PIKE_SECURITY
      struct object *prot;
    #endif
    #ifdef MAPPING_SIZE_DEBUG
      INT32 debug_size;
    #endif
      struct mapping_data *data;
      struct mapping *next, *prev;
    };
    
    
    extern struct mapping *first_mapping;
    extern struct mapping *gc_internal_mapping;
    
    #define map_delete(m,key) map_delete_no_free(m, key, 0)
    #define m_sizeof(m) ((m)->data->size)
    #define m_ind_types(m) ((m)->data->ind_types)
    #define m_val_types(m) ((m)->data->val_types)
    #define mapping_get_flags(m) ((m)->data->flags)
    
    
    #define NEW_MAPPING_LOOP(md) \
      for((e=0) DO_IF_DMALLOC( ?0:(debug_malloc_touch(md)) ) ;e<md->hashsize;e++) for(k=md->hash[e];k;k=k->next)
    
    /* WARNING: this should not be used */
    #define MAPPING_LOOP(m) \