]>
git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/c++-lib/inc/hash.h
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
19 // file: .../c++-lib/inc/hash.h - C++ hash tbl routines
21 // Based on hashing stuff from UBC Raven Code (Terry Coatta & Don Acton)
24 // Copyright (C) 1992 the University of British Columbia
26 // This library is free software; you can redistribute it and/or
27 // modify it provided that this copyright/license information is retained
30 // If you modify this file, you must clearly indicate your changes.
32 // This source code is distributed in the hope that it will be
33 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
34 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36 // $Header: /cvs/Darwin/src/live/Security/SecuritySNACCRuntime/c++-lib/inc/hash.h,v 1.1.1.1 2001/05/18 23:14:06 mb Exp $
38 // Revision 1.1.1.1 2001/05/18 23:14:06 mb
39 // Move from private repository to open source repository
41 // Revision 1.3 2001/05/05 00:59:18 rmurphy
42 // Adding darwin license headers
44 // Revision 1.2 2000/06/15 18:48:25 dmitch
45 // Snacc-generated source files, now part of CVS tree to allow for cross-platform build of snaccRuntime.
47 // Revision 1.1.1.1 2000/03/09 01:00:05 rmurphy
48 // Base Fortissimo Tree
50 // Revision 1.1 1999/02/25 05:21:46 mb
51 // Added snacc c++ library
53 // Revision 1.5 1997/02/28 13:39:42 wan
54 // Modifications collected for new version 1.3: Bug fixes, tk4.2.
56 // Revision 1.4 1997/02/16 20:25:51 rj
57 // check-in of a few cosmetic changes
59 // Revision 1.3 1994/10/08 04:18:12 rj
60 // code for meta structures added (provides information about the generated code itself).
62 // code for Tcl interface added (makes use of the above mentioned meta code).
64 // virtual inline functions (the destructor, the Clone() function, BEnc(), BDec() and Print()) moved from inc/*.h to src/*.C because g++ turns every one of them into a static non-inline function in every file where the .h file gets included.
66 // made Print() const (and some other, mainly comparison functions).
68 // several `unsigned long int' turned into `size_t'.
70 // Revision 1.2 1994/08/28 10:00:59 rj
71 // comment leader fixed.
73 // Revision 1.1 1994/08/28 09:20:46 rj
74 // first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
80 #define INDEXMASK 0xFF
83 typedef void * Table
[ TABLESIZE
];
85 typedef unsigned int Hash
;
87 typedef struct HashSlot
95 Hash
MakeHash ( const char * str
, size_t len
);
99 int Insert ( Table
* table
, void * element
, Hash hash
);
101 int CheckFor ( Table
* table
, Hash hash
);
103 int CheckForAndReturnValue ( Table
* table
, Hash hash
, void ** value
);
106 #endif /* conditional include */