/* Generated from "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod" by precompile.pike running Pike v8.0 release 1107
 *
 * Do NOT edit this file.
 */

#undef PRECOMPILE_API_VERSION
#define PRECOMPILE_API_VERSION 6

#undef PRECOMPILE_SUB_PIKEVARS
#define PRECOMPILE_SUB_PIKEVARS 1

#undef PRECOMPILE_DYNAMIC_TYPES
#define PRECOMPILE_DYNAMIC_TYPES 1



#undef cmod___CMOD__
#define cmod___CMOD__ 1
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#line 3003 "/Users/hww3/devel/pike/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike"







#line 3010 "/Users/hww3/devel/pike/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike"
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
/* vim:syntax=c
 */
#include "common.h"

#include "critbit/float2svalue.h"
#define CB_PRINT_KEY(buf, key)			\
	do { string_builder_sprintf((buf), "%f",\
				    cb_decode_float((key).str)); } while(0)
#include "tree_high.c"

#define DEFAULT_CMOD_STORAGE static



#ifndef PIKE_UNUSED_ATTRIBUTE
#define PIKE_UNUSED_ATTRIBUTE
#endif
#define CMOD_MAP_PROGRAM_IDS_DEFINED 1
static int ___cmod_map_program_ids(int id) PIKE_UNUSED_ATTRIBUTE;
#ifndef TYPEOF
/* Compat with older Pikes. */
#define TYPEOF(SVAL)	((SVAL).type)
#define SUBTYPEOF(SVAL)	((SVAL).subtype)
#define SET_SVAL_TYPE(SVAL, TYPE)	(TYPEOF(SVAL) = TYPE)
#define SET_SVAL_SUBTYPE(SVAL, TYPE)	(SUBTYPEOF(SVAL) = TYPE)
#define SET_SVAL(SVAL, TYPE, SUBTYPE, FIELD, EXPR) do {	\
    /* Set the type afterwards to avoid a clobbered	\
     * svalue in case EXPR throws. */			\
    (SVAL).u.FIELD = (EXPR);				\
    SET_SVAL_TYPE((SVAL), (TYPE));			\
    SET_SVAL_SUBTYPE((SVAL), (SUBTYPE));		\
  } while(0)
#endif /* !TYPEOF */
#ifndef PIKE_UNUSED
/* Compat with Pike 7.8 and earlier. */
/* NB: Not strictly correct; PIKE_UNUSED was added the
 *     day after set_program_id_to_id(), but good enough.
 */
#ifndef UNUSED
#define UNUSED(X)	X
#endif
#ifndef set_program_id_to_id
/* NB: Recent Pike 7.8 has a #define that conflicts with
 *     the following declaration.
 */
static void set_program_id_to_id(void*UNUSED(id)){}
#endif
#else /* */
PMOD_EXPORT void set_program_id_to_id( int (*to)(int) );
#endif /* !PIKE_UNUSED */


#ifndef DEFAULT_CMOD_STORAGE
#define CMOD_COND_USED
#define DEFAULT_CMOD_STORAGE static
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_create_fun_num_used 1
#else
#undef f_FloatTree_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__sizeof_fun_num_used 1
#else
#undef f_FloatTree_cq__sizeof_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__indices_fun_num_used 1
#else
#undef f_FloatTree_cq__indices_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__values_fun_num_used 1
#else
#undef f_FloatTree_cq__values_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_ninsert_fun_num_used 1
#else
#undef f_FloatTree_ninsert_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cast_fun_num_used 1
#else
#undef f_FloatTree_cast_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_nth_fun_num_used 1
#else
#undef f_FloatTree_nth_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__random_fun_num_used 1
#else
#undef f_FloatTree_cq__random_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__equal_fun_num_used 1
#else
#undef f_FloatTree_cq__equal_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_ugly_fun_num_used 1
#else
#undef f_FloatTree_ugly_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_first_fun_num_used 1
#else
#undef f_FloatTree_first_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_last_fun_num_used 1
#else
#undef f_FloatTree_last_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_bkey_fun_num_used 1
#else
#undef f_FloatTree_bkey_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_previous_fun_num_used 1
#else
#undef f_FloatTree_previous_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_next_fun_num_used 1
#else
#undef f_FloatTree_next_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_depth_fun_num_used 1
#else
#undef f_FloatTree_depth_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_copy_fun_num_used 1
#else
#undef f_FloatTree_copy_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_get_subtree_fun_num_used 1
#else
#undef f_FloatTree_get_subtree_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define FloatTree_program_fun_num_used 1
#else
#undef FloatTree_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__get_iterator_create_fun_num_used 1
#else
#undef f_FloatTree_cq__get_iterator_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__get_iterator_index_fun_num_used 1
#else
#undef f_FloatTree_cq__get_iterator_index_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__get_iterator_cq__backtick_21_fun_num_used 1
#else
#undef f_FloatTree_cq__get_iterator_cq__backtick_21_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__get_iterator_cq__get_iterator_fun_num_used 1
#else
#undef f_FloatTree_cq__get_iterator_cq__get_iterator_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__get_iterator_next_fun_num_used 1
#else
#undef f_FloatTree_cq__get_iterator_next_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__get_iterator_value_fun_num_used 1
#else
#undef f_FloatTree_cq__get_iterator_value_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define FloatTree_cq__get_iterator_program_fun_num_used 1
#else
#undef FloatTree_cq__get_iterator_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__backtick_5B_5D_fun_num_used 1
#else
#undef f_FloatTree_cq__backtick_5B_5D_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_check_parenting_skills_fun_num_used 1
#else
#undef f_FloatTree_check_parenting_skills_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__m_delete_fun_num_used 1
#else
#undef f_FloatTree_cq__m_delete_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__backtick_5B_2E_2E_5D_fun_num_used 1
#else
#undef f_FloatTree_cq__backtick_5B_2E_2E_5D_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__backtick_5B_5D_eq_fun_num_used 1
#else
#undef f_FloatTree_cq__backtick_5B_5D_eq_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__backtick_2D_fun_num_used 1
#else
#undef f_FloatTree_cq__backtick_2D_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_FloatTree_cq__backtick_add_fun_num_used 1
#else
#undef f_FloatTree_cq__backtick_add_fun_num_used
#endif
/*! @module ADT */
/*! @module CritBit */


#undef class_FloatTree_defined
#define class_FloatTree_defined
DEFAULT_CMOD_STORAGE struct program *FloatTree_program=NULL;

#ifdef FloatTree_program_fun_num_used
DEFAULT_CMOD_STORAGE int FloatTree_program_fun_num=-1;
#endif /* FloatTree_program_fun_num_used */
#line 31 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#define CB_LOW_ASSIGN_SVALUE_KEY(key, s)	do {			      \
    struct svalue * __ = (s);						      \
    SET_SVAL(*__, PIKE_T_FLOAT, 0, float_number, cb_decode_float((key).str)); \
} while(0)
#define CB_PUSH_KEY(key)	push_float(cb_decode_float((key).str));

static INLINE cb_string CB_STRING_FROM_SVALUE(const struct svalue * v) {
FLOAT_TYPE f;

if (TYPEOF(*v) == PIKE_T_INT) {
f = (FLOAT_TYPE)v->u.integer;
} else {
f = v->u.float_number;
}

return cb_encode_float(f);
}
#define CB_LOW_KEY_FROM_SVALUE(x) CB_KEY_FROM_STRING(CB_STRING_FROM_SVALUE(x))

#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/redefine.H"
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/redefine.H"
#ifdef iterator_class
#undef iterator_class
#endif
#define iterator_class Iterator
#ifdef tree_class
#undef tree_class
#endif
#define tree_class FloatTree
#ifdef cmod_OBJ2_TREE
#undef cmod_OBJ2_TREE
#endif
#define cmod_OBJ2_TREE OBJ2_FLOATTREE
#ifdef T_KEY
#undef T_KEY
#endif
#define T_KEY (BIT_FLOAT|BIT_INT)
#ifdef key_ptype
#undef key_ptype
#endif
#define key_ptype float|int
#ifdef sval_type
#undef sval_type
#endif
#define sval_type sval_type
#ifdef sample_key
#undef sample_key
#endif
#define sample_key 12.0
#ifdef sample_keys
#undef sample_keys
#endif
#define sample_keys ({ 80.4, 99.9, 14.2 })
#ifdef ordered_keys
#undef ordered_keys
#endif
#define ordered_keys 14.2
#ifdef reverse_ordered_keys
#undef reverse_ordered_keys
#endif
#define reverse_ordered_keys 99.9
#ifdef sample_value
#undef sample_value
#endif
#define sample_value ({ 4, 5, 6 })
#ifdef extra_doc
#undef extra_doc
#endif
#define extra_doc 
#ifndef STRFY2
# define STRFY2(x)	#x
# ifdef STRFY
#  undef STRFY
# endif
# define STRFY(x)	STRFY2(x)
#endif





#line 50 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"


#line 52 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_header.H"
/*! @class FloatTree
*! This class implements a CritBit-tree/trie that can be used as a
*! mapping-like data structure. Values of @expr{float|int@} can be
*! used as indices, while any possible type (also @expr{mixed@}) can
*! be stored.
*!
*! CritBit trees are prefixed based search trees that allow for fast random
*! access as well as prefix and range based lookups. Keys are stored in
*! alphabetical order and can be iterated over using @expr{foreach@}.
*! Other than that, it can be used like @expr{mapping(float|int:mixed)@}.
*!
*! @example
*! @code
*!ADT.CritBit.FloatTree tree = ADT.CritBit.FloatTree();
*!float|int key1 = 12.0;
*!tree[key1] = ({ 4, 5, 6 });
*!tree[key1]; // now is ({ 4, 5, 6 })
*!m_delete(tree, key1); // tree is empty again
*!@endcode
*! @example
*! @code
*!ADT.CritBit.FloatTree tree = ADT.CritBit.FloatTree();
*!array(float|int) a = ({ 80.4, 99.9, 14.2 });
*!foreach(a; int idx; float|int val) {
*! tree[val] = idx;
*!}
*!foreach(tree; float|int key; mixed val) {
*! // in here the keys will be reached in order 14.2, 80.4 and 99.9.
*!}
*!@endcode
*! @example
*! @code
*!ADT.CritBit.FloatTree tree = ADT.CritBit.FloatTree();
*!array(float|int) a = ({ 80.4, 99.9, 14.2 });
*!foreach (a; int idx; float|int val) {
*! tree[val] = idx;
*!}
*!foreach(ADT.CritBit.FloatTree.Iterator(tree, -1); @
*!float|int key; mixed val) {
*! // in here the keys will be reached in order 99.9, 80.4 and 14.2.
*!}
*!@endcode
*! @seealso
*! @[ADT.CritBit.FloatTree.Iterator]
*/

/*! @decl float|int encode_key(mixed o)
*! @decl mixed decode_key(float|int o)
*! These callbacks can be implemented when inheriting FloatTree in order
*! to allow for arbitrary key types. @[encode_key] is similar to the
*! @[lfun::_hash()] callback. This only works as expected when it is possible
*! to implement a unique representation for keys. These callbacks are called
*! everytime a key is stored or indexed in the tree.
*/


#undef var_tree_FloatTree_defined
#define var_tree_FloatTree_defined

#undef var_rev_FloatTree_defined
#define var_rev_FloatTree_defined

#undef var_encode_fun_FloatTree_defined
#define var_encode_fun_FloatTree_defined

#undef var_decode_fun_FloatTree_defined
#define var_decode_fun_FloatTree_defined

#undef var_copy_fun_FloatTree_defined
#define var_copy_fun_FloatTree_defined

#undef var_insert_fun_FloatTree_defined
#define var_insert_fun_FloatTree_defined

#undef THIS
#define THIS ((struct FloatTree_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_FLOATTREE
#define THIS_FLOATTREE ((struct FloatTree_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_FLOATTREE
#define OBJ2_FLOATTREE(o) ((struct FloatTree_struct *)(o->storage+FloatTree_storage_offset))

#undef GET_FLOATTREE_STORAGE
#define GET_FLOATTREE_STORAGE(o) ((struct FloatTree_struct *)(o->storage+FloatTree_storage_offset)
static ptrdiff_t FloatTree_storage_offset;
struct FloatTree_struct {

#ifdef var_tree_FloatTree_defined
#line 56 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_header.H"
struct cb_tree tree;
#endif /* var_tree_FloatTree_defined */

#ifdef var_rev_FloatTree_defined
#line 57 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_header.H"
size_t rev;
#endif /* var_rev_FloatTree_defined */

#ifdef var_encode_fun_FloatTree_defined
#line 58 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_header.H"
INT32 encode_fun;
#endif /* var_encode_fun_FloatTree_defined */

#ifdef var_decode_fun_FloatTree_defined
#line 59 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_header.H"
INT32 decode_fun;
#endif /* var_decode_fun_FloatTree_defined */

#ifdef var_copy_fun_FloatTree_defined
#line 60 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_header.H"
INT32 copy_fun;
#endif /* var_copy_fun_FloatTree_defined */

#ifdef var_insert_fun_FloatTree_defined
#line 61 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_header.H"
INT32 insert_fun;
#endif /* var_insert_fun_FloatTree_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct FloatTree_struct *FloatTree_gdb_dummy_ptr;
#endif
#line 64 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_header.H"
#undef CB_TRANSFORM_KEY
#define CB_TRANSFORM_KEY(svalue) {				\
    if (THIS->encode_fun >= 0) {				\
	push_svalue(svalue);					\
	apply_low(Pike_fp->current_object, THIS->encode_fun, 1);\
	assign_svalue((svalue), Pike_sp-1);			\
	pop_stack();						\
    }								\
} while (0)
#undef CB_CHECK_KEY
#define CB_CHECK_KEY(svalue, fun, num)	do {			\
    CB_TRANSFORM_KEY(svalue);					\
    if (!((1<<TYPEOF(*svalue)) & T_KEY))   			\
	SIMPLE_BAD_ARG_ERROR(fun, (num), STRFY(key_ptype));	\
} while(0)
#undef CB_PUSH_TRANSFORM_KEY
#define CB_PUSH_TRANSFORM_KEY(key) do {				\
    CB_PUSH_KEY(key);						\
    if (THIS->decode_fun >= 0) {				\
	apply_low(Pike_fp->current_object, THIS->decode_fun, 1);\
    }								\
} while(0)


static inline cb_key
FloatTree_transform_svalue_to_key(const struct svalue * s) {
cb_key key;
if (THIS->encode_fun >= 0) {
push_svalue(s);
apply_low(Pike_fp->current_object, THIS->encode_fun, 1);
if (!((1<<TYPEOF(Pike_sp[-1])) & (BIT_FLOAT|BIT_INT)))
Pike_error("encode_key() is expected to return type "  "float|int"  ".\n");
key = CB_LOW_KEY_FROM_SVALUE(Pike_sp-1);
pop_stack();
} else {
if (!((1<<TYPEOF(*s)) & (BIT_FLOAT|BIT_INT))) Pike_error("Expected type "  "float|int"  ".\n");
key = CB_LOW_KEY_FROM_SVALUE(s);
}
return key;
}
#ifdef CB_KEY_FROM_SVALUE
#undef CB_KEY_FROM_SVALUE
#endif
#define CB_KEY_FROM_SVALUE FloatTree_transform_svalue_to_key

static inline void FloatTree_assign_svalue_key(const cb_key key,
struct svalue * s) {
if (THIS->decode_fun >= 0) {
CB_PUSH_KEY(key);
apply_low(Pike_fp->current_object, THIS->decode_fun, 1);
assign_svalue((s), Pike_sp-1);
pop_stack();
} else {
CB_LOW_ASSIGN_SVALUE_KEY(key, s);
}
}
#ifdef CB_ASSIGN_SVALUE_KEY
#undef CB_ASSIGN_SVALUE_KEY
#endif
#define CB_ASSIGN_SVALUE_KEY FloatTree_assign_svalue_key
/*
 * GCC-BUG!!! we use the inline instead!
#undef CB_ASSIGN_SVALUE_KEY
#define CB_ASSIGN_SVALUE_KEY(key, s)	CB_LOW_ASSIGN_SVALUE_KEY(key, s)
#define CB_ASSIGN_SVALUE_KEY(_key, s) do {			\
    if (THIS->decode_fun >= 0) {				\
	CB_PUSH_KEY(_key);					\
	apply_low(Pike_fp->current_object, THIS->decode_fun, 1);\
	assign_svalue((s), Pike_sp-1);				\
	pop_stack();						\
    } else {							\
	CB_LOW_ASSIGN_SVALUE_KEY(_key, s);			\
    }								\
} while(0)
*/


#line 52 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"

#line 53 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
 /*! @class _get_iterator
*! Iterator class for FloatTree trees. Supports iterating over ranges
*! with arbitrary stepping and direction.
*!
*! This is used by default when calling @expr{foreach@} on an object of
*! FloatTree. In @expr{foreach@} the iterator runs over all elements
*! from the first to the last.
*!
*! @seealso
*! @[predef::Iterator] for a description of the interface.
*/

#undef class_FloatTree_cq__get_iterator_defined
#define class_FloatTree_cq__get_iterator_defined
DEFAULT_CMOD_STORAGE struct program *FloatTree_cq__get_iterator_program=NULL;

#ifdef FloatTree_cq__get_iterator_program_fun_num_used
DEFAULT_CMOD_STORAGE int FloatTree_cq__get_iterator_program_fun_num=-1;
#endif /* FloatTree_cq__get_iterator_program_fun_num_used */

#undef var_tree_FloatTree_cq__get_iterator_defined
#define var_tree_FloatTree_cq__get_iterator_defined

#undef var_lastkey_FloatTree_cq__get_iterator_defined
#define var_lastkey_FloatTree_cq__get_iterator_defined

#undef var_lastval_FloatTree_cq__get_iterator_defined
#define var_lastval_FloatTree_cq__get_iterator_defined

#undef var_lastrev_FloatTree_cq__get_iterator_defined
#define var_lastrev_FloatTree_cq__get_iterator_defined

#undef var_step_FloatTree_cq__get_iterator_defined
#define var_step_FloatTree_cq__get_iterator_defined

#undef var_stop_FloatTree_cq__get_iterator_defined
#define var_stop_FloatTree_cq__get_iterator_defined

#undef THIS
#define THIS ((struct FloatTree_cq__get_iterator_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_FLOATTREE_CQ__GET_ITERATOR
#define THIS_FLOATTREE_CQ__GET_ITERATOR ((struct FloatTree_cq__get_iterator_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_FLOATTREE_CQ__GET_ITERATOR
#define OBJ2_FLOATTREE_CQ__GET_ITERATOR(o) ((struct FloatTree_cq__get_iterator_struct *)(o->storage+FloatTree_cq__get_iterator_storage_offset))

#undef GET_FLOATTREE_CQ__GET_ITERATOR_STORAGE
#define GET_FLOATTREE_CQ__GET_ITERATOR_STORAGE(o) ((struct FloatTree_cq__get_iterator_struct *)(o->storage+FloatTree_cq__get_iterator_storage_offset)
static ptrdiff_t FloatTree_cq__get_iterator_storage_offset;
struct FloatTree_cq__get_iterator_struct {

#ifdef var_tree_FloatTree_cq__get_iterator_defined
#line 15 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
cb_node_t lastnode, tree;
#endif /* var_tree_FloatTree_cq__get_iterator_defined */

#ifdef var_lastkey_FloatTree_cq__get_iterator_defined
#line 16 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
cb_key lastkey;
#endif /* var_lastkey_FloatTree_cq__get_iterator_defined */

#ifdef var_lastval_FloatTree_cq__get_iterator_defined
#line 17 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
cb_value lastval;
#endif /* var_lastval_FloatTree_cq__get_iterator_defined */

#ifdef var_lastrev_FloatTree_cq__get_iterator_defined
#line 18 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
size_t * revv, lastrev;
#endif /* var_lastrev_FloatTree_cq__get_iterator_defined */

#ifdef var_step_FloatTree_cq__get_iterator_defined
#line 19 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
INT_TYPE step;
#endif /* var_step_FloatTree_cq__get_iterator_defined */

#ifdef var_stop_FloatTree_cq__get_iterator_defined
#line 20 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
cb_key stop;
#endif /* var_stop_FloatTree_cq__get_iterator_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct FloatTree_cq__get_iterator_struct *FloatTree_cq__get_iterator_gdb_dummy_ptr;
#endif
#line 23 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
static struct object * FloatTree_get_iterator_find_parent()
{
struct external_variable_context loc;

loc.o = Pike_fp->current_object;
loc.parent_identifier = Pike_fp->fun;
loc.inherit = Pike_fp->context;
find_external_context(&loc, 1);
return loc.o;
}


#undef internal_init_FloatTree_cq__get_iterator_defined
#define internal_init_FloatTree_cq__get_iterator_defined

#undef FloatTree_cq__get_iterator_event_handler_defined
#define FloatTree_cq__get_iterator_event_handler_defined
static void init_FloatTree_cq__get_iterator_struct(void)
#line 34 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
SET_SVAL_TYPE(THIS->lastval, T_VOID);
THIS->lastnode = NULL;
THIS->step = 1;
THIS->stop.len.chars = 0;
THIS->stop.len.bits = 0;
THIS->stop.str = (cb_string)0;
}


#undef FloatTree_cq__get_iterator_gc_live_obj
#define FloatTree_cq__get_iterator_gc_live_obj

#undef internal_exit_FloatTree_cq__get_iterator_defined
#define internal_exit_FloatTree_cq__get_iterator_defined

#undef FloatTree_cq__get_iterator_event_handler_defined
#define FloatTree_cq__get_iterator_event_handler_defined
static void exit_FloatTree_cq__get_iterator_struct(void)
#line 43 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
if (THIS->stop.len.chars || THIS->stop.len.bits || THIS->stop.str) {
CB_FREE_KEY(THIS->stop);
}

if (THIS->lastnode) {
CB_FREE_KEY(THIS->lastkey);
CB_FREE_VALUE(&THIS->lastval);
}
}


#undef internal_gc_check_FloatTree_cq__get_iterator_defined
#define internal_gc_check_FloatTree_cq__get_iterator_defined

#undef FloatTree_cq__get_iterator_event_handler_defined
#define FloatTree_cq__get_iterator_event_handler_defined
static void gc_check_FloatTree_cq__get_iterator_struct(void)
#line 54 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
debug_gc_check_svalues(&THIS->lastval, 1, " as current CritBit iterator value");
}


#undef internal_gc_recurse_FloatTree_cq__get_iterator_defined
#define internal_gc_recurse_FloatTree_cq__get_iterator_defined

#undef FloatTree_cq__get_iterator_event_handler_defined
#define FloatTree_cq__get_iterator_event_handler_defined
static void gc_recurse_FloatTree_cq__get_iterator_struct(void)
#line 58 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
gc_recurse_svalues(&THIS->lastval, 1);
}

static inline int FloatTree_Iterator_step() {
cb_node_t t;
INT_TYPE c = THIS->step;

if (THIS->lastrev == *THIS->revv) {
t = THIS->lastnode;
} else {
THIS->lastrev = * THIS->revv;

if (THIS->tree) {
t = cb_index(THIS->tree, THIS->lastkey);
if (t) {
THIS->lastnode = t;
} else { /* the last node was removed and freed. */
if (c > 0) {
t = cb_find_next(THIS->tree, THIS->lastkey);
c--;
} else {
t = cb_find_previous(THIS->tree, THIS->lastkey);
c++;
}
}
} else {
t = NULL;
}
}

if (THIS->lastnode) {
CB_FREE_KEY(THIS->lastkey);
CB_FREE_VALUE(&THIS->lastval);
}

if (t) {
if (c > 0) {
WALK_FORWARD(t, {
if (CB_HAS_VALUE(_)) c--;
if (c == 0) break;
});
} else if (c < 0) {
WALK_BACKWARD(t, {
if (CB_HAS_VALUE(_)) c++;
if (c == 0) break;
});
if (t == THIS->tree && !CB_HAS_VALUE(t)) t = NULL;
}

if (t) {
/* check for stop
		     * TODO: if we know that the lastnode is a parent
		     * of t, and stop was bigger than both children, then
		     * we could skip this check. */
if (THIS->stop.len.chars || THIS->stop.len.bits) {
if (THIS->step < 0) {
if (CB_KEY_LT(t->key, THIS->stop)) t = NULL;
} else {
if (CB_KEY_LT(THIS->stop, t->key)) t = NULL;
}
}
if (t) {
CB_GET_VALUE(t, &THIS->lastval);
THIS->lastkey = t->key;
CB_ADD_KEY_REF(THIS->lastkey);
}
}
}
THIS->lastnode = t;
return !!t;
}

/*! @decl void create(void|int step, void|mixed start, void|mixed stop)
*! Returns an iterator object that runs from @expr{start@} to
*! @expr{stop@} using a stepsize of @expr{step@}. The arguments
*! default to @expr{1@}, @expr{tree->first()@} and
*! @expr{tree->last()@}, respectively.
*/
#define f_FloatTree_cq__get_iterator_create_defined

#ifdef f_FloatTree_cq__get_iterator_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__get_iterator_create_fun_num = 0;

#endif /* f_FloatTree_cq__get_iterator_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__get_iterator_create(INT32 args) {
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
struct svalue * step;
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
struct svalue * start;
struct svalue * stop;
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if(args > 3) wrong_number_of_args_error("create",args,3);
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if ((args > 0) &&
    ((TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[0-args]) != NUMBER_UNDEFINED))) {
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("create",1,"void|int");
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
step=Pike_sp+0-args; dmalloc_touch_svalue(Pike_sp+0-args);
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
} else step = NULL;
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
start=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
} else start = NULL;
if ((args > 2) &&
    ((TYPEOF(Pike_sp[2-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[2-args]) != NUMBER_UNDEFINED))) {
#line 138 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
stop=Pike_sp+2-args; dmalloc_touch_svalue(Pike_sp+2-args);
#line 138 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
} else stop = NULL;
#line 138 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
cb_node_t t = NULL;
struct object * tree = FloatTree_get_iterator_find_parent();
INT32 encode_fun;
THIS->revv = &(OBJ2_FLOATTREE(tree)->rev);
THIS->tree = OBJ2_FLOATTREE(tree)->tree.root;

THIS->stop.len.chars = 0;
THIS->stop.len.bits = 0;

encode_fun = OBJ2_FLOATTREE(tree)->encode_fun;

if (THIS->tree) {
if (!step) {
THIS->step = 1;
} else {
THIS->step = step->u.integer;
if (THIS->step == 0)
SIMPLE_BAD_ARG_ERROR("create", 1, "int(..-1)|int(1..)");
}

if (stop) {
if (encode_fun >= 0) {
push_svalue(stop);
apply_low(tree, encode_fun, 1);
assign_svalue(stop, Pike_sp-1);
pop_stack();
if (!((1<<TYPEOF(*stop)) & (BIT_FLOAT|BIT_INT)))
SIMPLE_BAD_ARG_ERROR("create", 3,  "float|int" );
}
THIS->stop = CB_LOW_KEY_FROM_SVALUE(stop);
CB_ADD_KEY_REF(THIS->stop);
}

if (start) {
cb_key s;
if (encode_fun >= 0) {
push_svalue(start);
apply_low(tree, encode_fun, 1);
assign_svalue(start, Pike_sp-1);
pop_stack();
if (!((1<<TYPEOF(*start)) & (BIT_FLOAT|BIT_INT)))
SIMPLE_BAD_ARG_ERROR("create", 2,  "float|int" );
}
s = CB_LOW_KEY_FROM_SVALUE(start);

t = cb_index(THIS->tree, s);

if (!t) {
t = (THIS->step < 0)
? cb_find_previous(THIS->tree, s)
: cb_find_next(THIS->tree, s);
if (t && (THIS->stop.len.chars || THIS->stop.len.bits)) {
/* check if we ran over stop */
if (THIS->step < 0) {
if (CB_KEY_LT(t->key, THIS->stop))
t = NULL;
} else {
if (CB_KEY_LT(THIS->stop, t->key))
t = NULL;
}
}
}
}

if (!t) t = (THIS->step < 0)
? cb_find_last(THIS->tree)
: cb_find_first(THIS->tree);

if (t) {
CB_GET_VALUE(t, &THIS->lastval);
THIS->lastkey = t->key;
CB_ADD_KEY_REF(THIS->lastkey);
}
THIS->lastnode = t;
}

pop_n_elems(args);
}

}
#define f_FloatTree_cq__get_iterator_cq__get_iterator_defined

#ifdef f_FloatTree_cq__get_iterator_cq__get_iterator_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__get_iterator_cq__get_iterator_fun_num = 0;

#endif /* f_FloatTree_cq__get_iterator_cq__get_iterator_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__get_iterator_cq__get_iterator(INT32 args) {
#line 218 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if(args != 0) wrong_number_of_args_error("_get_iterator",args,0);
#line 218 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
ref_push_object(Pike_fp->current_object);
}

}
#define f_FloatTree_cq__get_iterator_next_defined

#ifdef f_FloatTree_cq__get_iterator_next_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__get_iterator_next_fun_num = 0;

#endif /* f_FloatTree_cq__get_iterator_next_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__get_iterator_next(INT32 args) {
#line 222 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if(args != 0) wrong_number_of_args_error("next",args,0);
#line 222 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
if(FloatTree_Iterator_step()) {
push_int(1);
return;
}
push_undefined();
return;
}

}
#define f_FloatTree_cq__get_iterator_index_defined

#ifdef f_FloatTree_cq__get_iterator_index_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__get_iterator_index_fun_num = 0;

#endif /* f_FloatTree_cq__get_iterator_index_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__get_iterator_index(INT32 args) {
#line 231 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if(args != 0) wrong_number_of_args_error("index",args,0);
#line 231 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
if (THIS->lastnode) {
struct object * tree = FloatTree_get_iterator_find_parent();
INT32 fun = OBJ2_FLOATTREE(tree)->decode_fun;
CB_PUSH_KEY(THIS->lastkey);
if (fun >= 0)
apply_low(tree, fun, 1);
} else push_undefined();
}

}
#define f_FloatTree_cq__get_iterator_value_defined

#ifdef f_FloatTree_cq__get_iterator_value_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__get_iterator_value_fun_num = 0;

#endif /* f_FloatTree_cq__get_iterator_value_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__get_iterator_value(INT32 args) {
#line 241 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if(args != 0) wrong_number_of_args_error("value",args,0);
#line 241 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
if (THIS->lastnode) {
CB_PUSH_VALUE(THIS->lastval);
return;
}
push_undefined();
}

}
#define f_FloatTree_cq__get_iterator_cq__backtick_21_defined

#ifdef f_FloatTree_cq__get_iterator_cq__backtick_21_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__get_iterator_cq__backtick_21_fun_num = 0;

#endif /* f_FloatTree_cq__get_iterator_cq__backtick_21_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__get_iterator_cq__backtick_21(INT32 args) {
#line 249 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
if(args != 0) wrong_number_of_args_error("`!",args,0);
#line 249 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
{
push_int(!THIS->lastnode);
}
}

#ifdef FloatTree_cq__get_iterator_event_handler_defined
static void FloatTree_cq__get_iterator_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_FloatTree_cq__get_iterator_defined
  case PROG_EVENT_INIT: init_FloatTree_cq__get_iterator_struct(); break;

#endif /* internal_init_FloatTree_cq__get_iterator_defined */

#ifdef internal_exit_FloatTree_cq__get_iterator_defined
  case PROG_EVENT_EXIT: exit_FloatTree_cq__get_iterator_struct(); break;

#endif /* internal_exit_FloatTree_cq__get_iterator_defined */

#ifdef internal_gc_check_FloatTree_cq__get_iterator_defined
  case PROG_EVENT_GC_CHECK: gc_check_FloatTree_cq__get_iterator_struct(); break;

#endif /* internal_gc_check_FloatTree_cq__get_iterator_defined */

#ifdef internal_gc_recurse_FloatTree_cq__get_iterator_defined
  case PROG_EVENT_GC_RECURSE: gc_recurse_FloatTree_cq__get_iterator_struct(); break;

#endif /* internal_gc_recurse_FloatTree_cq__get_iterator_defined */
  default: break; 
  }
}

#endif /* FloatTree_cq__get_iterator_event_handler_defined */
/*! @endclass */

#line 255 "/Users/hww3/devel/pike/src/post_modules/CritBit/iterator_source.H"
#line 53 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"

#line 54 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#undef THIS
#define THIS THIS_FLOATTREE
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
#line 1 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
#ifndef CB_GC_RECURSE_KEY
# define CB_GC_RECURSE_KEY(X)
#endif
#ifndef CB_GC_CHECK_KEY
# define CB_GC_CHECK_KEY(X)
#endif


#undef internal_init_FloatTree_defined
#define internal_init_FloatTree_defined

#undef FloatTree_event_handler_defined
#define FloatTree_event_handler_defined
static void init_FloatTree_struct(void)
#line 8 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
THIS->tree.root = NULL;
THIS->encode_fun = find_identifier
("encode_key", Pike_fp->current_object->prog);
THIS->decode_fun=find_identifier
("decode_key", Pike_fp->current_object->prog);
THIS->copy_fun = find_identifier ("copy", Pike_fp->current_object->prog);
THIS->insert_fun = find_identifier ("`[]=", Pike_fp->current_object->prog);
if (find_identifier("copy", FloatTree_program) == THIS->copy_fun) {
THIS->copy_fun = -1;
}

if (find_identifier("`[]=", FloatTree_program) == THIS->insert_fun) {
THIS->insert_fun = -1;
}
}
static inline void FloatTree_copy_node(struct object *o, cb_node_t node) {
if (THIS->copy_fun != -1 && THIS->insert_fun != -1) {
CB_PUSH_TRANSFORM_KEY(node->key);
CB_PUSH_VALUE(node->value);
apply_low(o, THIS->insert_fun, 2);
pop_stack();
} else cb_insert(& OBJ2_FLOATTREE(o)->tree, node->key, &node->value);
}

static inline void FloatTree_copy_tree(struct object *o, cb_node_t node) {
if (THIS->copy_fun != -1 && THIS->insert_fun != -1) {
WALK_FORWARD(node, {
if (CB_HAS_VALUE(_)) {
CB_PUSH_TRANSFORM_KEY(node->key);
push_svalue(&node->value);
apply_low(o, THIS->insert_fun, 2);
pop_stack();
}
});
} else cb_copy_tree(& OBJ2_FLOATTREE(o)->tree, node);
}

static inline struct object *
FloatTree_clone_object(const struct object *o) {
struct object * t = NULL;
if (THIS->copy_fun != -1) {
apply_low(o, THIS->copy_fun, 0);
if (TYPEOF(Pike_sp[-1]) != PIKE_T_OBJECT)
Pike_error("clone() is supposed to return an object.\n");
t = Pike_sp[-1].u.object;
add_ref(t);
pop_stack();
} else {
t = clone_object(Pike_fp->current_object->prog, 0);
cb_copy_tree(& OBJ2_FLOATTREE(t)->tree, OBJ2_FLOATTREE(o)->tree.root);
}
return t;
}

#ifdef CLONE_OBJECT
#undef CLONE_OBJECT
#endif
#define CLONE_OBJECT FloatTree_clone_object

#ifdef COPY_TREE
#undef COPY_TREE
#endif
#define COPY_TREE FloatTree_copy_tree

#ifdef COPY_NODE
#undef COPY_NODE
#endif
#define COPY_NODE FloatTree_copy_node

/*! @decl mixed _m_delete(mixed key)
     *! m_delete callback.
     */
#define f_FloatTree_cq__m_delete_defined

#ifdef f_FloatTree_cq__m_delete_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__m_delete_fun_num = 0;

#endif /* f_FloatTree_cq__m_delete_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__m_delete(INT32 args) {
#line 81 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * key;
#line 81 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("_m_delete",args,1);
#line 81 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
key=Pike_sp+0-1; dmalloc_touch_svalue(Pike_sp+0-1);
#line 81 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
size_t size, oldsize;
cb_key k;

k = CB_KEY_FROM_SVALUE(key);

oldsize = (THIS->tree.root) ? THIS->tree.root->size : 0;
if (oldsize) {
cb_delete(& THIS->tree, k, Pike_sp++);
size = (THIS->tree.root) ? THIS->tree.root->size : 0;
if (size < oldsize) {
THIS->rev++;
stack_pop_keep_top();
return;
}
}
pop_stack();
push_undefined();
}

}
#define f_FloatTree_check_parenting_skills_defined

#ifdef f_FloatTree_check_parenting_skills_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_check_parenting_skills_fun_num = 0;

#endif /* f_FloatTree_check_parenting_skills_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_check_parenting_skills(INT32 args) {
#line 101 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("check_parenting_skills",args,0);
#line 101 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
push_int(cb_rec_check_parents(THIS->tree.root));
}

}
/*! @decl void create(array|mapping|void o)
*! Create a FloatTree from o.
*/
#define f_FloatTree_create_defined

#ifdef f_FloatTree_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_create_fun_num = 0;

#endif /* f_FloatTree_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_create(INT32 args) {
#line 108 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * o;
#line 108 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args > 1) wrong_number_of_args_error("create",args,1);
#line 108 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if ((args > 0) &&
    ((TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[0-args]) != NUMBER_UNDEFINED))) {
#line 108 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
o=Pike_sp+0-args; dmalloc_touch_svalue(Pike_sp+0-args);
#line 108 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
} else o = NULL;
#line 108 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
if (o) {
switch (TYPEOF(*o)) {
case PIKE_T_MAPPING: {
struct keypair *k;
INT32 e;
struct mapping_data *md = o->u.mapping->data;

NEW_MAPPING_LOOP(md) {
cb_key key = CB_KEY_FROM_SVALUE(&k->ind);
cb_insert(& THIS->tree, key, &k->val);
}
return;
}
case PIKE_T_ARRAY: {
INT32 i;

if (o->u.array->size & 1) goto ARG_ERROR;

for (i = 0; i < o->u.array->size; i+=2) {
cb_key key = CB_KEY_FROM_SVALUE(ITEM(o->u.array)+i);
cb_insert(& THIS->tree, key, ITEM(o->u.array)+i+1);
}
return;
}
}
ARG_ERROR:
SIMPLE_BAD_ARG_ERROR("create", 1, "mapping("  "float|int"  ":mixed)|array");
}
}

}
/*! @decl int _sizeof()
*! Gives the number of entries in the @[FloatTree].
*/
#define f_FloatTree_cq__sizeof_defined

#ifdef f_FloatTree_cq__sizeof_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__sizeof_fun_num = 0;

#endif /* f_FloatTree_cq__sizeof_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__sizeof(INT32 args) {
#line 142 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("_sizeof",args,0);
#line 142 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
push_int(THIS->tree.root ? THIS->tree.root->size : 0);
}

}
/*! @decl array _indices()
*! Returns a sorted array of indices of the @[FloatTree].
*/
#define f_FloatTree_cq__indices_defined

#ifdef f_FloatTree_cq__indices_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__indices_fun_num = 0;

#endif /* f_FloatTree_cq__indices_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__indices(INT32 args) {
#line 149 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("_indices",args,0);
#line 149 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
size_t size = THIS->tree.root ? THIS->tree.root->size : 0;
if (size) {
size_t start = 0;
struct svalue * s;
cb_key k;
cb_node_t node = THIS->tree.root;
struct array * a = allocate_array_no_init(size, 0);
push_array(a);
if (CB_HAS_VALUE(node)) {
s = ITEM(a)+start;
SET_SVAL_TYPE(*s, T_VOID);
k = node->key;
CB_ASSIGN_SVALUE_KEY(k, s);
start ++;
}
WALK_FORWARD(node, {
if (CB_HAS_VALUE(_)) {
if (start == size) {
Pike_error("super bad!! tree has hidden entries.\n");
}
s = ITEM(a)+start;
SET_SVAL_TYPE(*s, T_VOID);
CB_ASSIGN_SVALUE_KEY(_->key, s);
start ++;
}
});
return;
}
ref_push_array(&empty_array);
}

}
/*! @decl array _values()
*! Returns an array of values of the @[FloatTree] object. The returned
*! array matches
*! @[_indices] so that @expr{mkmapping(indices(tree), values(tree))@} would
*! create a mapping with the same contents as this @[FloatTree].
*/
#define f_FloatTree_cq__values_defined

#ifdef f_FloatTree_cq__values_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__values_fun_num = 0;

#endif /* f_FloatTree_cq__values_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__values(INT32 args) {
#line 187 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("_values",args,0);
#line 187 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
size_t size = THIS->tree.root ? THIS->tree.root->size : 0;
if (size) {
struct array * a = allocate_array_no_init(size, 0);
push_array(a);
cb_aggregate_values(THIS->tree.root, a, 0, size);
return;
}
ref_push_array(&empty_array);
}

}
/*! @decl mixed `[]=(mixed key, mixed val) */
#define f_FloatTree_cq__backtick_5B_5D_eq_defined

#ifdef f_FloatTree_cq__backtick_5B_5D_eq_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__backtick_5B_5D_eq_fun_num = 0;

#endif /* f_FloatTree_cq__backtick_5B_5D_eq_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__backtick_5B_5D_eq(INT32 args) {
#line 199 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * key;
#line 199 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * val;
#line 199 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 2) wrong_number_of_args_error("`[]=",args,2);
#line 199 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
key=Pike_sp+0-2; dmalloc_touch_svalue(Pike_sp+0-2);
#line 199 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
val=Pike_sp+1-2; dmalloc_touch_svalue(Pike_sp+1-2);
#line 199 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
cb_key k = CB_KEY_FROM_SVALUE(key);
cb_insert(& THIS->tree, k, val);
#ifdef DEBUG_CHECK
 cb_check(THIS->tree.root, THIS->tree.root, k->str);
#endif /* DEBUG_CHECK */
 stack_pop_keep_top();
}

}
#define f_FloatTree_ninsert_defined

#ifdef f_FloatTree_ninsert_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_ninsert_fun_num = 0;

#endif /* f_FloatTree_ninsert_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_ninsert(INT32 args) {
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * key;
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * val;
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
INT_TYPE chars;
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
INT_TYPE bits;
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 4) wrong_number_of_args_error("ninsert",args,4);
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
key=Pike_sp+0-4; dmalloc_touch_svalue(Pike_sp+0-4);
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
val=Pike_sp+1-4; dmalloc_touch_svalue(Pike_sp+1-4);
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(TYPEOF(Pike_sp[2-4]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("ninsert",3,"int");
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
chars=Pike_sp[2-4].u.integer;
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(TYPEOF(Pike_sp[3-4]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("ninsert",4,"int");
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
bits=Pike_sp[3-4].u.integer;
#line 208 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
cb_size len;
cb_key k;

k = CB_KEY_FROM_SVALUE(key);
len.chars = chars;
len.bits = bits;
if (CB_LT(k.len, len)) {
Pike_error("chars, bits are too big for key.\n");
}
cb_insert(& THIS->tree, k, val);
stack_pop_keep_top();
}

}
/*! @decl mapping cast(string type)
     *! Cast callback. Supports only cast to mapping and
     *! behaves as the inverse of create().
     */
#define f_FloatTree_cast_defined

#ifdef f_FloatTree_cast_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cast_fun_num = 0;

#endif /* f_FloatTree_cast_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cast(INT32 args) {
#line 226 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct pike_string * type;
#line 226 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("cast",args,1);
#line 226 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("cast",1,"string");
#line 226 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
debug_malloc_pass(type=Pike_sp[0-1].u.string);
#line 226 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
pop_stack(); /* type as at least one more reference. */

if (type == literal_mapping_string) {
f_FloatTree_cq__indices(0);
f_FloatTree_cq__values(0);
f_mkmapping(2);
}
else
push_undefined();
}

}
/*! @decl mixed nth(int(0..) n)
     *! Get the @expr{n@}th entry in order.
     *! @returns
     *! 	An array @expr{({ key, value })@}.
     */
#define f_FloatTree_nth_defined

#ifdef f_FloatTree_nth_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_nth_fun_num = 0;

#endif /* f_FloatTree_nth_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_nth(INT32 args) {
#line 243 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
INT_TYPE n;
#line 243 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("nth",args,1);
#line 243 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("nth",1,"int");
#line 243 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
n=Pike_sp[0-1].u.integer;
#line 243 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
cb_node_t node;

if (THIS->tree.root) {
if (n >= 0 && (size_t)n < THIS->tree.root->size) {
node = cb_get_nth(THIS->tree.root, n);
if (node) {
pop_stack();
CB_PUSH_TRANSFORM_KEY(node->key);
push_svalue(&node->value);
f_aggregate(2);
return;
}
}
}

pop_stack();
push_undefined();
return;
}

}
/*! @decl array _random()
     *! Get a random entry.
     *! @returns
     *! 	An array @expr{({ key, value })@}.
     */
#define f_FloatTree_cq__random_defined

#ifdef f_FloatTree_cq__random_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__random_fun_num = 0;

#endif /* f_FloatTree_cq__random_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__random(INT32 args) {
#line 269 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("_random",args,0);
#line 269 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
cb_node_t node;

if (THIS->tree.root) {
node = cb_get_nth(THIS->tree.root,
my_rand() % THIS->tree.root->size);
if (node) {
CB_PUSH_TRANSFORM_KEY(node->key);
push_svalue(&node->value);
f_aggregate(2);
return;
}
}

push_undefined();
return;
}

}
/*! @decl mixed `[](mixed key)
     */
#define f_FloatTree_cq__backtick_5B_5D_defined

#ifdef f_FloatTree_cq__backtick_5B_5D_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__backtick_5B_5D_fun_num = 0;

#endif /* f_FloatTree_cq__backtick_5B_5D_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__backtick_5B_5D(INT32 args) {
#line 289 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * key;
#line 289 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("`[]",args,1);
#line 289 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
key=Pike_sp+0-1; dmalloc_touch_svalue(Pike_sp+0-1);
#line 289 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
CB_TRANSFORM_KEY(key);
if ((1 << TYPEOF(*key)) & (BIT_FLOAT|BIT_INT)) {
cb_node_t n;
cb_key k = CB_LOW_KEY_FROM_SVALUE(key);
pop_stack();
n = cb_index(THIS->tree.root, k);

if (n && CB_HAS_VALUE(n)) {
push_svalue(&n->value);
return;
}
} else pop_stack();
push_undefined();
}

}
/*! @decl int(0..1) _equal(mixed o)
     */
#define f_FloatTree_cq__equal_defined

#ifdef f_FloatTree_cq__equal_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__equal_fun_num = 0;

#endif /* f_FloatTree_cq__equal_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__equal(INT32 args) {
#line 307 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * o;
#line 307 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("_equal",args,1);
#line 307 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
o=Pike_sp+0-1; dmalloc_touch_svalue(Pike_sp+0-1);
#line 307 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
if (TYPEOF(*o) == PIKE_T_OBJECT
&& o->u.object->prog == Pike_fp->current_object->prog) {
cb_node_t tree1, tree2;
tree1 = THIS->tree.root;
tree2 = OBJ2_FLOATTREE(o->u.object)->tree.root;

if (tree1 == tree2) {
push_int(1);
return;
}

if (tree1 && tree2 && tree1->size == tree2->size) {
WALK_FORWARD(tree1, {
if (CB_HAS_VALUE(_)) {
cb_node_t n = cb_index(tree2, _->key);
if (!n || !is_equal(&_->value, &n->value)) {
push_int(0);
return;
}
}
});
push_int(1);
return;
}
}
push_int(0);
return;
}

}
/*! @decl mixed `-(mixed o)
     *! Sub[s]tract two trees from each other (key-wise).
     */
#define f_FloatTree_cq__backtick_2D_defined

#ifdef f_FloatTree_cq__backtick_2D_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__backtick_2D_fun_num = 0;

#endif /* f_FloatTree_cq__backtick_2D_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__backtick_2D(INT32 args) {
#line 340 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * o;
#line 340 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("`-",args,1);
#line 340 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
o=Pike_sp+0-1; dmalloc_touch_svalue(Pike_sp+0-1);
#line 340 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
struct object * res;
cb_node_t node, tree = NULL;

if (TYPEOF(*o) != PIKE_T_OBJECT || -1
== low_get_storage(o->u.object->prog, FloatTree_program)) {
SIMPLE_BAD_ARG_ERROR("`-", 1, "CritBit."  "FloatTree" );
}

node = OBJ2_FLOATTREE(o->u.object)->tree.root;

if (THIS->tree.root) {
if (node) {
cb_node_t t = THIS->tree.root;
res = clone_object(Pike_fp->current_object->prog, 0);

if (node != THIS->tree.root)
WALK_FORWARD(t, {
if (CB_HAS_VALUE(_) && !cb_index(node, _->key))
COPY_NODE(res, _);
});
} else res = CLONE_OBJECT(Pike_fp->current_object);
} else res = clone_object(Pike_fp->current_object->prog, 0);

push_object(res);
return;
}

}
#line 368 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
/* FIXME: we should allow for extra arguments and call += on the copy
     * of the first one
     */
/*! @decl mixed `+(mixed o)
     *!	Add callback. Returns the union of two trees.
     */
#define f_FloatTree_cq__backtick_add_defined

#ifdef f_FloatTree_cq__backtick_add_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__backtick_add_fun_num = 0;

#endif /* f_FloatTree_cq__backtick_add_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__backtick_add(INT32 args) {
#line 374 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * o;
#line 374 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("`+",args,1);
#line 374 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
o=Pike_sp+0-1; dmalloc_touch_svalue(Pike_sp+0-1);
#line 374 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
cb_node_t tree1, tree2;

if (TYPEOF(*o) != PIKE_T_OBJECT || -1
== low_get_storage(o->u.object->prog, FloatTree_program)) {
SIMPLE_BAD_ARG_ERROR("`+", 1, "inherits(CritBit."  "FloatTree"  ")");
}
tree1 = THIS->tree.root;
tree2 = OBJ2_FLOATTREE(o->u.object)->tree.root;

if (tree1 && tree2) {
struct object * res = NULL;
if (tree1->size < tree2->size) {
tree1 = tree2;
tree2 = THIS->tree.root;
res = CLONE_OBJECT(o->u.object);
} else
res = CLONE_OBJECT(Pike_fp->current_object);

if (tree1 != tree2) {
if (CB_HAS_VALUE(tree2)) COPY_NODE(res, tree2);
WALK_FORWARD(tree2, {
if (CB_HAS_VALUE(_)) COPY_NODE(res, _);
});
}
push_object(res);
} else if (tree1) {
push_object(CLONE_OBJECT(Pike_fp->current_object));
} else if (tree2) {
push_object(CLONE_OBJECT(o->u.object));
}

return;
}

}
/*! @decl mixed `[..](mixed a, int atype, mixed b, int btype)
     *! @seealso
     *! 	@[predef::`[..]]
     */
#define f_FloatTree_cq__backtick_5B_2E_2E_5D_defined

#ifdef f_FloatTree_cq__backtick_5B_2E_2E_5D_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_cq__backtick_5B_2E_2E_5D_fun_num = 0;

#endif /* f_FloatTree_cq__backtick_5B_2E_2E_5D_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_cq__backtick_5B_2E_2E_5D(INT32 args) {
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * a;
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
INT_TYPE atype;
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * b;
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
INT_TYPE btype;
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 4) wrong_number_of_args_error("`[..]",args,4);
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
a=Pike_sp+0-4; dmalloc_touch_svalue(Pike_sp+0-4);
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(TYPEOF(Pike_sp[1-4]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("`[..]",2,"int");
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
atype=Pike_sp[1-4].u.integer;
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
b=Pike_sp+2-4; dmalloc_touch_svalue(Pike_sp+2-4);
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(TYPEOF(Pike_sp[3-4]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("`[..]",4,"int");
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
btype=Pike_sp[3-4].u.integer;
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
struct object * o = NULL;

if (THIS->tree.root) {
cb_node_t start = NULL, stop = NULL;

switch (atype & (INDEX_FROM_BEG | INDEX_FROM_END | OPEN_BOUND)) {
case OPEN_BOUND:
start = cb_find_first(THIS->tree.root);
break;
case INDEX_FROM_BEG:
start = cb_find_ne(THIS->tree.root, CB_KEY_FROM_SVALUE(a));
break;
case INDEX_FROM_END:
goto illegal_index;
}

if (!start) goto range_do_clone;

switch (btype & (INDEX_FROM_BEG | INDEX_FROM_END | OPEN_BOUND)) {
case OPEN_BOUND:
stop = cb_find_last(THIS->tree.root);
break;
case INDEX_FROM_BEG:
stop = cb_find_le(THIS->tree.root, CB_KEY_FROM_SVALUE(b));
break;
case INDEX_FROM_END:
goto illegal_index;
}

o = clone_object(Pike_fp->current_object->prog, 0);

if (!stop) goto range_do_clone;

if (start == stop) {
COPY_NODE(o, start);
goto range_do_clone;
}

if (CB_KEY_LT(start->key, stop->key)) {
COPY_NODE(o, start);
WALK_FORWARD(start, {
if (CB_HAS_VALUE(_))
COPY_NODE(o, _);
if (_ == stop) break;
});
}
} else {
if (atype & INDEX_FROM_END || btype & INDEX_FROM_END)
goto illegal_index;
}
range_do_clone:
if (!o)
o = clone_object(Pike_fp->current_object->prog, 0);
pop_n_elems(args); /* REVIEW: we need this, right? */
push_object(o);
return;

illegal_index:
Pike_error("INDEX_FROM_END is not supported for CritBit `[..].\n");
}













































}
#line 519 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
/* REVIEW: we need this, right? */





#define f_FloatTree_ugly_defined

#ifdef f_FloatTree_ugly_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_ugly_fun_num = 0;

#endif /* f_FloatTree_ugly_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_ugly(INT32 args) {
#line 525 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("ugly",args,0);
#line 525 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
if (THIS->tree.root) {
struct string_builder s;

init_string_builder(&s, 0);
cb_print_tree(&s, THIS->tree.root, 0);
push_string(finish_string_builder(&s));
return;
}
push_text("");
}

}
/*! @decl float|int first()
*! Get the lexicographically first index in the tree.
*/
#define f_FloatTree_first_defined

#ifdef f_FloatTree_first_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_first_fun_num = 0;

#endif /* f_FloatTree_first_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_first(INT32 args) {
#line 540 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("first",args,0);
#line 540 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
if (THIS->tree.root) {
cb_node_t first = cb_find_first(THIS->tree.root);
if (first) {
CB_PUSH_TRANSFORM_KEY(first->key);
return;
}
}
push_undefined();
}

}
/*! @decl float|int last()
*! Get the lexicographically last index in the tree.
*/
#define f_FloatTree_last_defined

#ifdef f_FloatTree_last_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_last_fun_num = 0;

#endif /* f_FloatTree_last_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_last(INT32 args) {
#line 554 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("last",args,0);
#line 554 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
if (THIS->tree.root) {
cb_node_t last = cb_find_last(THIS->tree.root);
if (last) {
CB_PUSH_TRANSFORM_KEY(last->key);
return;
}
}
push_undefined();
}

}
/*! @decl string bkey(mixed key)
     *! Render the internally used binary representation of
     *! the key into a string as a strings of '0's and '1's.
     */
#define f_FloatTree_bkey_defined

#ifdef f_FloatTree_bkey_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_bkey_fun_num = 0;

#endif /* f_FloatTree_bkey_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_bkey(INT32 args) {
#line 569 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * key;
#line 569 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("bkey",args,1);
#line 569 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
key=Pike_sp+0-1; dmalloc_touch_svalue(Pike_sp+0-1);
#line 569 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
struct string_builder s;
cb_key k;

init_string_builder(&s, 0);
k = CB_KEY_FROM_SVALUE(key);
pop_stack();
cb_print_key(&s, k);

push_string(finish_string_builder(&s));
}

}
/*! @decl float|int previous(mixed current)
*! Get the key before @expr{current@} in lexicographical order.
*/
#define f_FloatTree_previous_defined

#ifdef f_FloatTree_previous_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_previous_fun_num = 0;

#endif /* f_FloatTree_previous_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_previous(INT32 args) {
#line 584 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * current;
#line 584 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("previous",args,1);
#line 584 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
current=Pike_sp+0-1; dmalloc_touch_svalue(Pike_sp+0-1);
#line 584 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
CB_CHECK_KEY(current, "previous", 1);

if (THIS->tree.root) {
cb_node_t previous;

previous = cb_find_previous(THIS->tree.root,
CB_LOW_KEY_FROM_SVALUE(current));
pop_stack();
if (previous) {
CB_PUSH_TRANSFORM_KEY(previous->key);
return;
}
}
push_undefined();
}

}
/*! @decl float|int next(mixed current)
*! Get the key after @expr{current@} in lexicographical order.
*/
#define f_FloatTree_next_defined

#ifdef f_FloatTree_next_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_next_fun_num = 0;

#endif /* f_FloatTree_next_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_next(INT32 args) {
#line 604 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * current;
#line 604 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 1) wrong_number_of_args_error("next",args,1);
#line 604 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
current=Pike_sp+0-1; dmalloc_touch_svalue(Pike_sp+0-1);
#line 604 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
CB_CHECK_KEY(current, "next", 1);

if (THIS->tree.root) {
cb_node_t next;

next = cb_find_next(THIS->tree.root,
CB_LOW_KEY_FROM_SVALUE(current));
pop_stack();
if (next) {
CB_PUSH_TRANSFORM_KEY(next->key);
return;
}
}
push_undefined();
}

}
/*! @decl int(0..) depth()
     *! Calculate the depth of the tree.
     */
#define f_FloatTree_depth_defined

#ifdef f_FloatTree_depth_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_depth_fun_num = 0;

#endif /* f_FloatTree_depth_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_depth(INT32 args) {
#line 624 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("depth",args,0);
#line 624 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
if (THIS->tree.root) {
push_int(cb_get_depth(THIS->tree.root));
return;
}

push_int(0);
return;
}

}
/*! @decl FloatTree copy()
*! Create a copy of the tree.
*/
#define f_FloatTree_copy_defined

#ifdef f_FloatTree_copy_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_copy_fun_num = 0;

#endif /* f_FloatTree_copy_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_copy(INT32 args) {
#line 637 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args != 0) wrong_number_of_args_error("copy",args,0);
#line 637 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
struct object * copy;
copy = clone_object(Pike_fp->current_object->prog, 0);
cb_copy_tree(& OBJ2_FLOATTREE(copy)->tree, THIS->tree.root);
push_object(copy);
}

}
/*! @decl FloatTree get_subtree(void|mixed key)
*! Get a copy of the subtree starting at prefix
*! @expr{key@}.
*/
#define f_FloatTree_get_subtree_defined

#ifdef f_FloatTree_get_subtree_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_FloatTree_get_subtree_fun_num = 0;

#endif /* f_FloatTree_get_subtree_fun_num_used */
DEFAULT_CMOD_STORAGE void f_FloatTree_get_subtree(INT32 args) {
#line 648 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
struct svalue * key;
#line 648 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if(args > 1) wrong_number_of_args_error("get_subtree",args,1);
#line 648 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
if ((args > 0) &&
    ((TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[0-args]) != NUMBER_UNDEFINED))) {
#line 648 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
key=Pike_sp+0-args; dmalloc_touch_svalue(Pike_sp+0-args);
#line 648 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
} else key = NULL;
#line 648 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
struct object * sub;
cb_node_t node = NULL;

if (THIS->tree.root) {
if (key == NULL || IS_UNDEFINED(key))
node = THIS->tree.root;
else
node = cb_subtree_prefix(THIS->tree.root,
CB_LOW_KEY_FROM_SVALUE(key));
}
sub = clone_object(Pike_fp->current_object->prog, 0);

pop_n_elems(args);

if (node) {
COPY_TREE(sub, node);
}

push_object(sub);
}

}

#undef FloatTree_gc_live_obj
#define FloatTree_gc_live_obj

#undef internal_exit_FloatTree_defined
#define internal_exit_FloatTree_defined

#undef FloatTree_event_handler_defined
#define FloatTree_event_handler_defined
static void exit_FloatTree_struct(void)
#line 670 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
if (THIS->tree.root) {
cb_free_node(& THIS->tree, THIS->tree.root);
THIS->tree.root = NULL;
}
}

/* keys are always non-complex, so we dont have to check them with the gc */

#undef internal_gc_check_FloatTree_defined
#define internal_gc_check_FloatTree_defined

#undef FloatTree_event_handler_defined
#define FloatTree_event_handler_defined
static void gc_check_FloatTree_struct(void)
#line 678 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
cb_node_t node = THIS->tree.root;
if (!node) return;
WALK_FORWARD(node, {
if (CB_HAS_VALUE(_)) {
CB_GC_CHECK_KEY(_->key);
debug_gc_check_svalues(&_->value, 1, " as a CritBit node value");
}
});
}


#undef internal_gc_recurse_FloatTree_defined
#define internal_gc_recurse_FloatTree_defined

#undef FloatTree_event_handler_defined
#define FloatTree_event_handler_defined
static void gc_recurse_FloatTree_struct(void)
#line 689 "/Users/hww3/devel/pike/src/post_modules/CritBit/tree_source.H"
{
cb_node_t node = THIS->tree.root;
if (!node) return;
WALK_FORWARD(node, {
if (CB_HAS_VALUE(_)) {
CB_GC_RECURSE_KEY(_->key);
gc_recurse_svalues(&_->value, 1);
}
});
}

/*! @endclass */

#line 56 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"


#ifdef FloatTree_event_handler_defined
static void FloatTree_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_FloatTree_defined
  case PROG_EVENT_INIT: init_FloatTree_struct(); break;

#endif /* internal_init_FloatTree_defined */

#ifdef internal_exit_FloatTree_defined
  case PROG_EVENT_EXIT: exit_FloatTree_struct(); break;

#endif /* internal_exit_FloatTree_defined */

#ifdef internal_gc_check_FloatTree_defined
  case PROG_EVENT_GC_CHECK: gc_check_FloatTree_struct(); break;

#endif /* internal_gc_check_FloatTree_defined */

#ifdef internal_gc_recurse_FloatTree_defined
  case PROG_EVENT_GC_RECURSE: gc_recurse_FloatTree_struct(); break;

#endif /* internal_gc_recurse_FloatTree_defined */
  default: break; 
  }
}

#endif /* FloatTree_event_handler_defined */
/*! @endmodule */
/*! @endmodule */

#line 62 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
void pike_init_floattree_module(void) {

#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
set_program_id_to_id( ___cmod_map_program_ids );

#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */

#ifdef class_FloatTree_defined

#ifdef PROG_FLOATTREE_ID
#line 18 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  START_NEW_PROGRAM_ID(FLOATTREE);
#else
#line 18 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  start_new_program();

#endif /* PROG_FLOATTREE_ID */
#line 18 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  FloatTree_program = Pike_compiler->new_program;

#ifndef tObjImpl_FLOATTREE

#undef tObjIs_FLOATTREE
#define tObjIs_FLOATTREE "\3\1\177\0\0\2"

#undef tObjImpl_FLOATTREE
#define tObjImpl_FLOATTREE "\3\0\177\0\0\2"

#endif /* tObjImpl_FLOATTREE */

#ifdef THIS_FLOATTREE
  FloatTree_storage_offset = ADD_STORAGE(struct FloatTree_struct);
#endif /* THIS_FLOATTREE */

#ifdef class_FloatTree_cq__get_iterator_defined

#ifdef PROG_FLOATTREE_CQ__GET_ITERATOR_ID
#line 12 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  START_NEW_PROGRAM_ID(FLOATTREE_CQ__GET_ITERATOR);
#else
#line 12 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  start_new_program();

#endif /* PROG_FLOATTREE_CQ__GET_ITERATOR_ID */
#line 12 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  FloatTree_cq__get_iterator_program = Pike_compiler->new_program;

#ifndef tObjImpl_FLOATTREE_CQ__GET_ITERATOR

#undef tObjIs_FLOATTREE_CQ__GET_ITERATOR
#define tObjIs_FLOATTREE_CQ__GET_ITERATOR "\3\1\177\0\0\3"

#undef tObjImpl_FLOATTREE_CQ__GET_ITERATOR
#define tObjImpl_FLOATTREE_CQ__GET_ITERATOR "\3\0\177\0\0\3"

#endif /* tObjImpl_FLOATTREE_CQ__GET_ITERATOR */

#ifdef THIS_FLOATTREE_CQ__GET_ITERATOR
  FloatTree_cq__get_iterator_storage_offset = ADD_STORAGE(struct FloatTree_cq__get_iterator_struct);
#endif /* THIS_FLOATTREE_CQ__GET_ITERATOR */

#ifdef FloatTree_cq__get_iterator_event_handler_defined
  pike_set_prog_event_callback(FloatTree_cq__get_iterator_event_handler);

#ifndef FloatTree_cq__get_iterator_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* FloatTree_cq__get_iterator_gc_live_obj */

#endif /* FloatTree_cq__get_iterator_event_handler_defined */

#ifdef f_FloatTree_cq__get_iterator_create_defined

#ifdef f_FloatTree_cq__get_iterator_create_fun_num_used
  f_FloatTree_cq__get_iterator_create_fun_num =
#endif /* f_FloatTree_cq__get_iterator_create_fun_num_used */
#line 137 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("create", f_FloatTree_cq__get_iterator_create, tFunc(tOr(tVoid,"\10\200\0\0\0\177\377\377\377") tOr(tVoid,tMix) tOr(tVoid,tMix),tVoid), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__get_iterator_create_defined */

#ifdef f_FloatTree_cq__get_iterator_cq__get_iterator_defined

#ifdef f_FloatTree_cq__get_iterator_cq__get_iterator_fun_num_used
  f_FloatTree_cq__get_iterator_cq__get_iterator_fun_num =
#endif /* f_FloatTree_cq__get_iterator_cq__get_iterator_fun_num_used */
#line 218 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("_get_iterator", f_FloatTree_cq__get_iterator_cq__get_iterator, tFunc(tNone,tObj), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__get_iterator_cq__get_iterator_defined */

#ifdef f_FloatTree_cq__get_iterator_next_defined

#ifdef f_FloatTree_cq__get_iterator_next_fun_num_used
  f_FloatTree_cq__get_iterator_next_fun_num =
#endif /* f_FloatTree_cq__get_iterator_next_fun_num_used */
#line 222 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("next", f_FloatTree_cq__get_iterator_next, tFunc(tNone,"\10\200\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__get_iterator_next_defined */

#ifdef f_FloatTree_cq__get_iterator_index_defined

#ifdef f_FloatTree_cq__get_iterator_index_fun_num_used
  f_FloatTree_cq__get_iterator_index_fun_num =
#endif /* f_FloatTree_cq__get_iterator_index_fun_num_used */
    ADD_FUNCTION2("index", f_FloatTree_cq__get_iterator_index, tFunc(tNone,tOr(tFloat,"\10\200\0\0\0\177\377\377\377")), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__get_iterator_index_defined */

#ifdef f_FloatTree_cq__get_iterator_value_defined

#ifdef f_FloatTree_cq__get_iterator_value_fun_num_used
  f_FloatTree_cq__get_iterator_value_fun_num =
#endif /* f_FloatTree_cq__get_iterator_value_fun_num_used */
#line 241 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("value", f_FloatTree_cq__get_iterator_value, tFunc(tNone,tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__get_iterator_value_defined */

#ifdef f_FloatTree_cq__get_iterator_cq__backtick_21_defined

#ifdef f_FloatTree_cq__get_iterator_cq__backtick_21_fun_num_used
  f_FloatTree_cq__get_iterator_cq__backtick_21_fun_num =
#endif /* f_FloatTree_cq__get_iterator_cq__backtick_21_fun_num_used */
#line 249 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("`!", f_FloatTree_cq__get_iterator_cq__backtick_21, tFunc(tNone,"\10\200\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__get_iterator_cq__backtick_21_defined */
#line 13 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT;
#line 12 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  FloatTree_cq__get_iterator_program=end_program();
#line 12 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#ifdef FloatTree_cq__get_iterator_program_fun_num_used
FloatTree_cq__get_iterator_program_fun_num=
#endif
 add_program_constant("_get_iterator",FloatTree_cq__get_iterator_program,0);

#endif /* class_FloatTree_cq__get_iterator_defined */

#ifdef FloatTree_event_handler_defined
  pike_set_prog_event_callback(FloatTree_event_handler);

#ifndef FloatTree_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* FloatTree_gc_live_obj */

#endif /* FloatTree_event_handler_defined */

#ifdef f_FloatTree_cq__m_delete_defined

#ifdef f_FloatTree_cq__m_delete_fun_num_used
  f_FloatTree_cq__m_delete_fun_num =
#endif /* f_FloatTree_cq__m_delete_fun_num_used */
#line 81 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("_m_delete", f_FloatTree_cq__m_delete, tFunc(tMix,tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__m_delete_defined */

#ifdef f_FloatTree_check_parenting_skills_defined

#ifdef f_FloatTree_check_parenting_skills_fun_num_used
  f_FloatTree_check_parenting_skills_fun_num =
#endif /* f_FloatTree_check_parenting_skills_fun_num_used */
#line 101 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("check_parenting_skills", f_FloatTree_check_parenting_skills, tFunc(tNone,"\10\200\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_check_parenting_skills_defined */

#ifdef f_FloatTree_create_defined

#ifdef f_FloatTree_create_fun_num_used
  f_FloatTree_create_fun_num =
#endif /* f_FloatTree_create_fun_num_used */
#line 108 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("create", f_FloatTree_create, tFunc(tOr3(tArray,tMapping,tVoid),tVoid), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_create_defined */

#ifdef f_FloatTree_cq__sizeof_defined

#ifdef f_FloatTree_cq__sizeof_fun_num_used
  f_FloatTree_cq__sizeof_fun_num =
#endif /* f_FloatTree_cq__sizeof_fun_num_used */
#line 142 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("_sizeof", f_FloatTree_cq__sizeof, tFunc(tNone,"\10\200\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__sizeof_defined */

#ifdef f_FloatTree_cq__indices_defined

#ifdef f_FloatTree_cq__indices_fun_num_used
  f_FloatTree_cq__indices_fun_num =
#endif /* f_FloatTree_cq__indices_fun_num_used */
#line 149 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("_indices", f_FloatTree_cq__indices, tFunc(tNone,tArray), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__indices_defined */

#ifdef f_FloatTree_cq__values_defined

#ifdef f_FloatTree_cq__values_fun_num_used
  f_FloatTree_cq__values_fun_num =
#endif /* f_FloatTree_cq__values_fun_num_used */
#line 187 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("_values", f_FloatTree_cq__values, tFunc(tNone,tArray), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__values_defined */

#ifdef f_FloatTree_cq__backtick_5B_5D_eq_defined

#ifdef f_FloatTree_cq__backtick_5B_5D_eq_fun_num_used
  f_FloatTree_cq__backtick_5B_5D_eq_fun_num =
#endif /* f_FloatTree_cq__backtick_5B_5D_eq_fun_num_used */
#line 199 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("`[]=", f_FloatTree_cq__backtick_5B_5D_eq, tFunc(tMix tMix,tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__backtick_5B_5D_eq_defined */

#ifdef f_FloatTree_ninsert_defined

#ifdef f_FloatTree_ninsert_fun_num_used
  f_FloatTree_ninsert_fun_num =
#endif /* f_FloatTree_ninsert_fun_num_used */
    ADD_FUNCTION2("ninsert", f_FloatTree_ninsert, tFunc(tMix tMix "\10\200\0\0\0\177\377\377\377" "\10\200\0\0\0\177\377\377\377",tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_ninsert_defined */

#ifdef f_FloatTree_cast_defined

#ifdef f_FloatTree_cast_fun_num_used
  f_FloatTree_cast_fun_num =
#endif /* f_FloatTree_cast_fun_num_used */
#line 226 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("cast", f_FloatTree_cast, tFunc(tStr,tMapping), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cast_defined */

#ifdef f_FloatTree_nth_defined

#ifdef f_FloatTree_nth_fun_num_used
  f_FloatTree_nth_fun_num =
#endif /* f_FloatTree_nth_fun_num_used */
#line 243 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("nth", f_FloatTree_nth, tFunc("\10\200\0\0\0\177\377\377\377",tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_nth_defined */

#ifdef f_FloatTree_cq__random_defined

#ifdef f_FloatTree_cq__random_fun_num_used
  f_FloatTree_cq__random_fun_num =
#endif /* f_FloatTree_cq__random_fun_num_used */
#line 269 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("_random", f_FloatTree_cq__random, tFunc(tNone,tArray), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__random_defined */

#ifdef f_FloatTree_cq__backtick_5B_5D_defined

#ifdef f_FloatTree_cq__backtick_5B_5D_fun_num_used
  f_FloatTree_cq__backtick_5B_5D_fun_num =
#endif /* f_FloatTree_cq__backtick_5B_5D_fun_num_used */
#line 289 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("`[]", f_FloatTree_cq__backtick_5B_5D, tFunc(tMix,tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__backtick_5B_5D_defined */

#ifdef f_FloatTree_cq__equal_defined

#ifdef f_FloatTree_cq__equal_fun_num_used
  f_FloatTree_cq__equal_fun_num =
#endif /* f_FloatTree_cq__equal_fun_num_used */
#line 307 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("_equal", f_FloatTree_cq__equal, tFunc(tMix,"\10\200\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__equal_defined */

#ifdef f_FloatTree_cq__backtick_2D_defined

#ifdef f_FloatTree_cq__backtick_2D_fun_num_used
  f_FloatTree_cq__backtick_2D_fun_num =
#endif /* f_FloatTree_cq__backtick_2D_fun_num_used */
#line 340 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("`-", f_FloatTree_cq__backtick_2D, tFunc(tMix,tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__backtick_2D_defined */

#ifdef f_FloatTree_cq__backtick_add_defined

#ifdef f_FloatTree_cq__backtick_add_fun_num_used
  f_FloatTree_cq__backtick_add_fun_num =
#endif /* f_FloatTree_cq__backtick_add_fun_num_used */
#line 374 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("`+", f_FloatTree_cq__backtick_add, tFunc(tMix,tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__backtick_add_defined */

#ifdef f_FloatTree_cq__backtick_5B_2E_2E_5D_defined

#ifdef f_FloatTree_cq__backtick_5B_2E_2E_5D_fun_num_used
  f_FloatTree_cq__backtick_5B_2E_2E_5D_fun_num =
#endif /* f_FloatTree_cq__backtick_5B_2E_2E_5D_fun_num_used */
#line 413 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("`[..]", f_FloatTree_cq__backtick_5B_2E_2E_5D, tFunc(tMix "\10\200\0\0\0\177\377\377\377" tMix "\10\200\0\0\0\177\377\377\377",tMix), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_cq__backtick_5B_2E_2E_5D_defined */

#ifdef f_FloatTree_ugly_defined

#ifdef f_FloatTree_ugly_fun_num_used
  f_FloatTree_ugly_fun_num =
#endif /* f_FloatTree_ugly_fun_num_used */
#line 525 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("ugly", f_FloatTree_ugly, tFunc(tNone,tStr), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_ugly_defined */

#ifdef f_FloatTree_first_defined

#ifdef f_FloatTree_first_fun_num_used
  f_FloatTree_first_fun_num =
#endif /* f_FloatTree_first_fun_num_used */
#line 540 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("first", f_FloatTree_first, tFunc(tNone,tOr(tFloat,"\10\200\0\0\0\177\377\377\377")), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_first_defined */

#ifdef f_FloatTree_last_defined

#ifdef f_FloatTree_last_fun_num_used
  f_FloatTree_last_fun_num =
#endif /* f_FloatTree_last_fun_num_used */
#line 554 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("last", f_FloatTree_last, tFunc(tNone,tOr(tFloat,"\10\200\0\0\0\177\377\377\377")), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_last_defined */

#ifdef f_FloatTree_bkey_defined

#ifdef f_FloatTree_bkey_fun_num_used
  f_FloatTree_bkey_fun_num =
#endif /* f_FloatTree_bkey_fun_num_used */
#line 569 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("bkey", f_FloatTree_bkey, tFunc(tMix,tStr), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_bkey_defined */

#ifdef f_FloatTree_previous_defined

#ifdef f_FloatTree_previous_fun_num_used
  f_FloatTree_previous_fun_num =
#endif /* f_FloatTree_previous_fun_num_used */
#line 584 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("previous", f_FloatTree_previous, tFunc(tMix,tOr(tFloat,"\10\200\0\0\0\177\377\377\377")), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_previous_defined */

#ifdef f_FloatTree_next_defined

#ifdef f_FloatTree_next_fun_num_used
  f_FloatTree_next_fun_num =
#endif /* f_FloatTree_next_fun_num_used */
#line 604 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("next", f_FloatTree_next, tFunc(tMix,tOr(tFloat,"\10\200\0\0\0\177\377\377\377")), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_next_defined */

#ifdef f_FloatTree_depth_defined

#ifdef f_FloatTree_depth_fun_num_used
  f_FloatTree_depth_fun_num =
#endif /* f_FloatTree_depth_fun_num_used */
#line 624 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("depth", f_FloatTree_depth, tFunc(tNone,"\10\200\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_depth_defined */

#ifdef f_FloatTree_copy_defined

#ifdef f_FloatTree_copy_fun_num_used
  f_FloatTree_copy_fun_num =
#endif /* f_FloatTree_copy_fun_num_used */
#line 637 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("copy", f_FloatTree_copy, tFunc(tNone,tObj), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_copy_defined */

#ifdef f_FloatTree_get_subtree_defined

#ifdef f_FloatTree_get_subtree_fun_num_used
  f_FloatTree_get_subtree_fun_num =
#endif /* f_FloatTree_get_subtree_fun_num_used */
#line 648 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    ADD_FUNCTION2("get_subtree", f_FloatTree_get_subtree, tFunc(tOr(tVoid,tMix),tObj), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_FloatTree_get_subtree_defined */
#line 18 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
  FloatTree_program=end_program();
#line 18 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
#ifdef FloatTree_program_fun_num_used
FloatTree_program_fun_num=
#endif
 add_program_constant("FloatTree",FloatTree_program,0);

#endif /* class_FloatTree_defined */

#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
set_program_id_to_id( 0 );
#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */
#line 64 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
}

void pike_exit_floattree_module(void) {

#ifdef class_FloatTree_defined

#ifdef class_FloatTree_cq__get_iterator_defined
  if(FloatTree_cq__get_iterator_program) {
#line 12 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
    free_program(FloatTree_cq__get_iterator_program);
    FloatTree_cq__get_iterator_program=0;
  }

#endif /* class_FloatTree_cq__get_iterator_defined */
  if(FloatTree_program) {
    free_program(FloatTree_program);
    FloatTree_program=0;
  }

#endif /* class_FloatTree_defined */
#line 68 "/Users/hww3/devel/pike/src/post_modules/CritBit/floattree.cmod"
}


#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
static int ___cmod_map_program_ids(int id)
{
  int i = 0;
  if( (id&0x7f000000) != 0x7f000000 ) return id;
  id = id&0x00ffffff;
#ifdef class_FloatTree_defined
if(id==2) return FloatTree_program->id;
#endif
#ifdef class_FloatTree_cq__get_iterator_defined
if(id==3) return FloatTree_cq__get_iterator_program->id;
#endif
  return 0;
}
#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */
