1 2 /* 3 * Copyright (c) 1997, by Sun Microsystems, Inc. 4 * All rights reserved. 5 */ 6 7 /* 8 * Copyright (c) 1997 by Internet Software Consortium. 9 * 10 * Permission to use, copy, modify, and distribute this software for any 11 * purpose with or without fee is hereby granted, provided that the above 12 * copyright notice and this permission notice appear in all copies. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS 15 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 16 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE 17 * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 18 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 19 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 20 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 21 * SOFTWARE. 22 */ 23 #pragma ident "%Z%%M% %I% %E% SMI" 24 25 typedef int (*heap_higher_priority_func)(void *, void *); 26 typedef void (*heap_index_func)(void *, int); 27 typedef void (*heap_for_each_func)(void *, void *); 28 29 typedef struct heap_context { 30 int array_size; 31 int array_size_increment; 32 int heap_size; 33 void **heap; 34 heap_higher_priority_func higher_priority; 35 heap_index_func index; 36 } *heap_context; 37 38 #define heap_new __heap_new 39 #define heap_free __heap_free 40 #define heap_insert __heap_insert 41 #define heap_delete __heap_delete 42 #define heap_increased __heap_increased 43 #define heap_decreased __heap_decreased 44 #define heap_element __heap_element 45 #define heap_for_each __heap_for_each 46 47 heap_context heap_new(heap_higher_priority_func, heap_index_func, int); 48 int heap_free(heap_context); 49 int heap_insert(heap_context, void *); 50 int heap_delete(heap_context, int); 51 int heap_increased(heap_context, int); 52 int heap_decreased(heap_context, int); 53 void * heap_element(heap_context, int); 54 int heap_for_each(heap_context, heap_for_each_func, void *); 55