Jabber WindowGram Client (JWGC)

Introduction Screenshots Installation Downloads
Documentation Browse Source Resources Project Site

Stable Version
-none-

Latest Version
beta5



Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ulong_dictionary.h

Go to the documentation of this file.
00001 #include "sysdep.h"
00002 #ifndef ulong_dictionary_TYPE
00003 #define ulong_dictionary_TYPE
00004 
00005 /*
00006  *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
00007  *      For copying and distribution information, see the file
00008  *      "mit-copyright.h".
00009  *
00010  *      Modified for jwgc by Daniel Henninger.
00011  */
00012 
00013 #include "mit-copyright.h"
00014 
00015 typedef struct _ulong_dictionary_binding {
00016     struct _ulong_dictionary_binding *next;       /* PRIVATE */
00017     char *key;                                     /* READ-ONLY */
00018     ulong value;
00019 } ulong_dictionary_binding;
00020 
00021 typedef struct _ulong_dictionary {                /* PRIVATE */
00022     int size;
00023     ulong_dictionary_binding **slots;
00024 } *ulong_dictionary;
00025 
00026 /*
00027  *    ulong_dictionary ulong_dictionary_Create(int size):
00028  *        Requires: size > 0
00029  *        Effects: Returns a new empty dictionary containing no bindings.
00030  *                 The returned dictionary must be destroyed using
00031  *                 ulong_dictionary_Destroy.  Size is a time vs space
00032  *                 parameter.  For this implementation, space used is
00033  *                 proportional to size and time used is proportional
00034  *                 to number of bindings divided by size.  It is preferable
00035  *                 that size is a prime number.
00036  */
00037 
00038 extern ulong_dictionary ulong_dictionary_Create(/* int size */);
00039 
00040 /*
00041  *    void ulong_dictionary_Destroy(ulong_dictionary d):
00042  *        Requires: d is a non-destroyed ulong_dictionary
00043  *        Modifies: d
00044  *        Effects: Destroys dictionary d freeing up the space it consumes.
00045  *                 Dictionary d should never be referenced again.  Note that
00046  *                 free is NOT called on the values of the bindings.  If
00047  *                 this is needed, the client must do this first using
00048  *                 ulong_dictionary_Enumerate.
00049  */
00050 
00051 extern void ulong_dictionary_Destroy(/* ulong_dictionary d */);
00052 
00053 /*
00054  *    void ulong_dictionary_Enumerate(ulong_dictionary d; void (*proc)()):
00055  *        Requires: proc is a void procedure taking 1 argument, a
00056  *                  ulong_dictionary_binding pointer, which does not
00057  *                  make any calls using dictionary d.
00058  *        Effects: Calls proc once with each binding in dictionary d.
00059  *                 Order of bindings passed is undefined.  Note that
00060  *                 only the value field of the binding should be considered
00061  *                 writable by proc.
00062  */
00063 
00064 extern void ulong_dictionary_Enumerate(/* ulong_dictionary d, 
00065                                            void (*proc)() */);
00066 
00067 /*
00068  *    ulong_dictionary_binding *ulong_dictionary_Lookup(ulong_dictionary d,
00069  *                                                        char *key):
00070  *        Effects: If key is not bound in d, returns 0.  Othersize,
00071  *                 returns a pointer to the binding that binds key.
00072  *                 Note the access restrictions on bindings...
00073  */
00074 
00075 extern ulong_dictionary_binding *ulong_dictionary_Lookup(/* d, key */);
00076 
00077 /*
00078  *    ulong_dictionary_binding *ulong_dictionary_Define(ulong_dictionary d,
00079  *                                            char *key,
00080  *                                            int *already_existed):
00081  *        Modifies: d
00082  *        Effects: If key is bound in d, returns a pointer to the binding
00083  *                 that binds key.  Otherwise, adds a binding of key to
00084  *                 d and returns its address.  If already_existed is non-zero
00085  *                 then *already_existed is set to 0 if key was not
00086  *                 previously bound in d and 1 otherwise.
00087  *                 Note the access restrictions on bindings...  Note also
00088  *                 that the value that key is bounded to if a binding is
00089  *                 created is undefined.  The caller should set the value
00090  *                 in this case.
00091  */
00092 
00093 extern ulong_dictionary_binding *ulong_dictionary_Define();
00094 
00095 /*
00096  *    void ulong_dictionary_Delete(ulong_dictionary d,
00097  *                                  ulong_dictionary_binding *b):
00098  *        Requires: *b is a binding in d.
00099  *        Modifies: d
00100  *        Effects: Removes the binding *b from d.  Note that if 
00101  *                 b->value needs to be freed, it should be freed
00102  *                 before making this call.
00103  */
00104 
00105 extern void ulong_dictionary_Delete();
00106 
00107 #endif


Last updated at Tue Dec 18 21:07:42 PST 2007. This site and project hosted by...SourceForge.net Logo
Source Perspective by Fisheye