hashtable.h

00001 /*
00002 The contents of this file are subject to the Mozilla Public License
00003 Version 1.1 (the "License"); you may not use this file except in
00004 compliance with the License. You may obtain a copy of the License at
00005 http://www.mozilla.org/MPL/
00006 
00007 Software distributed under the License is distributed on an "AS IS"
00008 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
00009 License for the specific language governing rights and limitations
00010 under the License.
00011 
00012 The Original Code is expat.
00013 
00014 The Initial Developer of the Original Code is James Clark.
00015 Portions created by James Clark are Copyright (C) 1998, 1999
00016 James Clark. All Rights Reserved.
00017 
00018 Contributor(s):
00019 
00020 Alternatively, the contents of this file may be used under the terms
00021 of the GNU General Public License (the "GPL"), in which case the
00022 provisions of the GPL are applicable instead of those above.  If you
00023 wish to allow use of your version of this file only under the terms of
00024 the GPL and not to allow others to use your version of this file under
00025 the MPL, indicate your decision by deleting the provisions above and
00026 replace them with the notice and other provisions required by the
00027 GPL. If you do not delete the provisions above, a recipient may use
00028 your version of this file under either the MPL or the GPL.
00029 */
00030 
00031 
00032 #include <stddef.h>
00033 
00034 #ifdef XML_UNICODE
00035 
00036 #ifdef XML_UNICODE_WCHAR_T
00037 typedef const wchar_t *KEY;
00038 #else /* not XML_UNICODE_WCHAR_T */
00039 typedef const unsigned short *KEY;
00040 #endif /* not XML_UNICODE_WCHAR_T */
00041 
00042 #else /* not XML_UNICODE */
00043 
00044 typedef const char *KEY;
00045 
00046 #endif /* not XML_UNICODE */
00047 
00048 typedef struct {
00049   KEY name;
00050 } NAMED;
00051 
00052 typedef struct {
00053   NAMED **v;
00054   size_t size;
00055   size_t used;
00056   size_t usedLim;
00057 } HASH_TABLE;
00058 
00059 NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize);
00060 void hashTableInit(HASH_TABLE *);
00061 void hashTableDestroy(HASH_TABLE *);
00062 
00063 typedef struct {
00064   NAMED **p;
00065   NAMED **end;
00066 } HASH_TABLE_ITER;
00067 
00068 void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
00069 NAMED *hashTableIterNext(HASH_TABLE_ITER *);

Generated on Mon Dec 17 09:30:54 2007 for SimGear by  doxygen 1.5.1