mux/src/htab.h

Go to the documentation of this file.
00001 // htab.h - Structures and declarations needed for table hashing.
00002 //
00003 // $Id: htab.h,v 1.9 2005/10/27 06:27:53 sdennis Exp $
00004 //
00005 
00006 #include "copyright.h"
00007 
00008 #ifndef __HTAB_H
00009 #define __HTAB_H
00010 
00011 #include "db.h"
00012 #include "svdhash.h"
00013 
00014 typedef struct name_table NAMETAB;
00015 struct name_table
00016 {
00017     char    *name;
00018     int minlen;
00019     int perm;
00020     int flag;
00021 };
00022 
00023 /* BQUE - Command queue */
00024 
00025 typedef struct bque BQUE;
00026 struct bque
00027 {
00028     CLinearTimeAbsolute waittime;   // time to run command
00029     dbref   executor;               // executor who will do command
00030     dbref   caller;                 // caller.
00031     dbref   enactor;                // enactor causing command (for %N)
00032     dbref   sem;                    // blocking semaphore
00033     int     attr;                   // blocking attribute
00034     int     nargs;                  // How many args I have
00035     char    *text;                  // buffer for comm, env, and scr text
00036     char    *comm;                  // command
00037     char    *env[NUM_ENV_VARS];     // environment vars
00038     char    *scr[MAX_GLOBAL_REGS];  // temp vars
00039     bool    IsTimed;                // Is there a waittime time on this entry?
00040 };
00041 
00042 class CBitField
00043 {
00044     unsigned int nBitsPer;
00045     unsigned int nShift;
00046     unsigned int nMask;
00047     unsigned int nMaximum;
00048     size_t  nInts;
00049     UINT32 *pInts;
00050     UINT32 *pMasks;
00051 
00052 public:
00053     CBitField(unsigned int max = 0);
00054     void Resize(unsigned int max);
00055     ~CBitField(void);
00056     void ClearAll(void);
00057     void Set(unsigned int i);
00058     void Clear(unsigned int i);
00059     bool IsSet(unsigned int i);
00060 };
00061 
00062 void hashreset(CHashTable *);
00063 void *hashfindLEN(const void *pKey, size_t nKey, CHashTable *htab);
00064 int  hashaddLEN(const void *pKey, size_t nKey, void *pData,
00065                 CHashTable *htab);
00066 void hashdeleteLEN(const void *Str, size_t nStr, CHashTable *htab);
00067 void hashflush(CHashTable *);
00068 bool hashreplLEN(const void *Str, size_t nStr, void *hashdata,
00069                  CHashTable *htab);
00070 void hashreplall(const void *, void *, CHashTable *);
00071 void *hash_nextentry(CHashTable *htab);
00072 void *hash_firstentry(CHashTable *htab);
00073 void *hash_firstkey(CHashTable *htab, int *, char **);
00074 void *hash_nextkey(CHashTable *htab, int *, char **);
00075 
00076 extern NAMETAB powers_nametab[];
00077 
00078 extern bool search_nametab(dbref, NAMETAB *, char *, int *);
00079 extern NAMETAB *find_nametab_ent(dbref, NAMETAB *, char *);
00080 extern void display_nametab(dbref, NAMETAB *, char *, bool);
00081 extern void interp_nametab(dbref, NAMETAB *, int, const char *, const char *, const char *);
00082 extern void listset_nametab(dbref, NAMETAB *, int, char *, bool);
00083 
00084 #endif // !__HTAB_H

Generated on Mon May 28 04:40:10 2007 for MUX by  doxygen 1.4.7