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_VECTOR_H 54 #define _C_VECTOR_H 55 56 #include "c_def.h" 57 #include "c_iterator.h" 58 59 #define c_vector _c_vector 60 #define c_pvector _c_pvector 61 #define c_vector_create __c_vector 62 #define c_vector_destroy __c_rotcev 63 #define c_vector_begin _c_vector_begin 64 #define c_vector_end _c_vector_end 65 #define c_vector_rbegin _c_vector_rbegin 66 #define c_vector_rend _c_vector_rend 67 #define c_vector_size _c_vector_size 68 #define c_vector_max_size _c_vector_max_size 69 #define c_vector_empty _c_vector_empty 70 #define c_vector_at _c_vector_at 71 #define c_vector_assign _c_vector_assign 72 #define c_vector_reserve _c_vector_reserve 73 #define c_vector_front _c_vector_front 74 #define c_vector_back _c_vector_back 75 #define c_vector_push_back _c_vector_push_back 76 #define c_vector_pop_back _c_vector_pop_back 77 #define c_vector_swap _c_vector_swap 78 #define c_vector_insert _c_vector_insert 79 #define c_vector_insert2 _c_vector_insert2 80 #define c_vector_fill_insert _c_vector_fill_insert 81 #define c_vector_erase _c_vector_erase 82 #define c_vector_erase2 _c_vector_erase2 83 #define c_vector_clear _c_vector_clear 84 #define c_vector_resize _c_vector_resize 85 #define c_vector_equal _c_vector_equal 86 #define c_vector_less _c_vector_less 87 #define abs _abs 88 89 typedef struct c_vector 90 { 91 COMPARER _cmp; 92 void * _l; 93 } c_vector, * c_pvector; 94 95 int _abs(signed int i); 96 void __c_vector(c_pvector thiz, COMPARER pcmp); 97 void __c_rotcev(c_pvector thiz); 98 c_iterator c_vector_begin(c_pvector thiz); 99 c_iterator c_vector_end(c_pvector thiz); 100 c_reverse_iterator c_vector_rbegin(c_pvector thiz); 101 c_reverse_iterator c_vector_rend(c_pvector thiz); 102 size_type c_vector_size(c_pvector thiz); 103 size_type c_vector_max_size(c_pvector thiz); 104 size_type c_vector_capacity(c_pvector thiz); 105 c_bool c_vector_empty(c_pvector thiz); 106 value_type c_vector_at(c_pvector thiz, size_type n); 107 c_pvector c_vector_assign(c_pvector thiz, const c_pvector V); 108 void c_vector_reserve(c_pvector thiz, size_t n); 109 value_type c_vector_front(c_pvector thiz); 110 value_type c_vector_back(c_pvector thiz); 111 void c_vector_push_back(c_pvector thiz, const value_type val); 112 void c_vector_pop_back(c_pvector thiz); 113 void c_vector_swap(c_pvector thiz, c_pvector V); 114 c_iterator c_vector_insert(c_pvector thiz, c_iterator pos, const value_type val); 115 void c_vector_insert2(c_pvector thiz, c_iterator pos, c_iterator first, c_iterator last); 116 void c_vector_fill_insert(c_pvector thiz, c_iterator pos, size_type n, const value_type val); 117 c_iterator c_vector_erase(c_pvector thiz, c_iterator pos); 118 c_iterator c_vector_erase2(c_pvector thiz, c_iterator first, c_iterator last); 119 void c_vector_clear(c_pvector thiz); 120 void c_vector_resize(c_pvector thiz, size_t n); 121 c_bool c_vector_equal(c_pvector thiz, const c_pvector V); 122 c_bool c_vector_less(c_pvector thiz, const c_pvector V); 123 124 125 #endif /* _C_VECTOR_H */ 126