1 /* 2 * 3 * Copyright (c) 1994 4 * Hewlett-Packard Company 5 * 6 * Permission to use, copy, modify, distribute and sell this software 7 * and its documentation for any purpose is hereby granted without fee, 8 * provided that the above copyright notice appear in all copies and 9 * that both that copyright notice and this permission notice appear 10 * in supporting documentation. Hewlett-Packard Company makes no 11 * representations about the suitability of this software for any 12 * purpose. It is provided "as is" without express or implied warranty. 13 * 14 * 15 * Copyright (c) 1996 16 * Silicon Graphics Computer Systems, Inc. 17 * 18 * Permission to use, copy, modify, distribute and sell this software 19 * and its documentation for any purpose is hereby granted without fee, 20 * provided that the above copyright notice appear in all copies and 21 * that both that copyright notice and this permission notice appear 22 * in supporting documentation. Silicon Graphics makes no 23 * representations about the suitability of this software for any 24 * purpose. It is provided "as is" without express or implied warranty. 25 */ 26 27 /* 28 Copyright (c) 2007 Lao wen bo 29 30 This software is provided 'as-is', without any express or implied 31 warranty. In no event will the authors be held liable for any damages 32 arising from the use of this software. 33 34 Permission is granted to anyone to use this software for any purpose, 35 including commercial applications, and to alter it and redistribute it 36 freely, subject to the following restrictions: 37 38 1. The origin of this software must not be misrepresented; you must not 39 claim that you wrote the original software. If you use this software 40 in a product, an acknowledgment in the product documentation would be 41 appreciated but is not required. 42 43 2. Altered source versions must be plainly marked as such, and must not be 44 misrepresented as being the original software. 45 46 3. This notice may not be removed or altered from any source 47 distribution. 48 49 Lao wen bo 50 viewpl(at)gmail.com 51 */ 52 53 #ifndef _C_MAP_H 54 #define _C_MAP_H 55 56 #include "c_tree.h" 57 58 #define c_map _c_map 59 #define c_pmap _c_pmap 60 #define c_map_create __c_map 61 #define c_map_destroy __c_pam 62 #define c_map_assign _c_map_assign 63 #define c_map_begin _c_map_begin 64 #define c_map_end _c_map_end 65 #define c_map_rbegin _c_map_rbegin 66 #define c_map_rend _c_map_rend 67 #define c_map_empty _c_map_empty 68 #define c_map_size _c_map_size 69 #define c_map_max_size _c_map_max_size 70 #define c_map_at _c_map_at 71 #define c_map_swap _c_map_swap 72 #define c_map_insert _c_map_insert 73 #define c_map_insert1 _c_map_insert1 74 #define c_map_insert2 _c_map_insert2 75 #define c_map_erase _c_map_erase 76 #define c_map_erase1 _c_map_erase1 77 #define c_map_erase2 _c_map_erase2 78 #define c_map_clear _c_map_clear 79 #define c_map_find _c_map_find 80 #define c_map_count _c_map_count 81 #define c_map_lower_bound _c_map_lower_bound 82 #define c_map_upper_bound _c_map_upper_bound 83 #define c_map_equal_range _c_map_equal_range 84 #define c_map_less _c_map_less 85 #define c_map_equal _c_map_equal 86 87 88 typedef struct c_map 89 { 90 void * _l; 91 } c_map, * c_pmap; 92 93 94 void __c_map(c_pmap thiz, COMPARER keycmp); 95 void __c_pam(c_pmap thiz); 96 c_pmap c_map_assign(c_pmap thiz, const c_pmap M); 97 c_iterator c_map_begin(c_pmap thiz); 98 c_iterator c_map_end(c_pmap thiz); 99 c_reverse_iterator c_map_rbegin(c_pmap thiz); 100 c_reverse_iterator c_map_rend(c_pmap thiz); 101 c_bool c_map_empty(c_pmap thiz); 102 size_type c_map_size(c_pmap thiz); 103 size_type c_map_max_size(c_pmap thiz); 104 value_type c_map_at(c_pmap thiz, key_type key); 105 void c_map_swap(c_pmap thiz, c_pmap M); 106 c_iter_bool_pair c_map_insert(c_pmap thiz, const value_type val); 107 c_iterator c_map_insert1(c_pmap thiz, c_iterator position, const value_type val); 108 void c_map_insert2(c_pmap thiz, c_iterator first, c_iterator last); 109 void c_map_erase(c_pmap thiz, c_iterator position); 110 size_type c_map_erase1(c_pmap thiz, key_type key); 111 void c_map_erase2(c_pmap thiz, c_iterator first, c_iterator last); 112 void c_map_clear(c_pmap thiz); 113 c_iterator c_map_find(c_pmap thiz, key_type key); 114 size_type c_map_count(c_pmap thiz, key_type key); 115 c_iterator c_map_lower_bound(c_pmap thiz, key_type key); 116 c_iterator c_map_upper_bound(c_pmap thiz, key_type key); 117 c_iter_iter_pair c_map_equal_range(c_pmap thiz, key_type key); 118 c_bool c_map_less(c_pmap thiz, const c_pmap M, COMPARER paircmp); 119 c_bool c_map_equal(c_pmap thiz, const c_pmap M, COMPARER paircmp); 120 121 122 #endif /* _C_MAP_H */ 123