1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
/* -*- c -*- 
|| This file is part of Pike. For copyright information see COPYRIGHT. 
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING 
|| for more information. 
*/ 
 
/* 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 
 
DECLARATIONS 
 
/*! @module ADT */ 
/*! @module CritBit */ 
 
PIKECLASS FloatTree { 
#cmod_define iterator_class Iterator 
#cmod_define tree_class FloatTree 
#cmod_define cmod_OBJ2_TREE OBJ2_FLOATTREE 
#cmod_define T_KEY (BIT_FLOAT|BIT_INT) 
#cmod_define key_ptype float|int 
#cmod_define sample_key 12.0 
#cmod_define sample_keys ({ 80.4, 99.9, 14.2 }) 
#cmod_define ordered_keys 14.2, 80.4 and 99.9 
#cmod_define reverse_ordered_keys 99.9, 80.4 and 14.2 
#cmod_define sample_value ({ 4, 5, 6 }) 
#cmod_define extra_doc 
 
#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)) 
 
#cmod_include "redefine.H" 
 
#cmod_include "tree_header.H" 
#cmod_include "iterator_source.H" 
#undef THIS 
#define THIS THIS_FLOATTREE 
#cmod_include "tree_source.H" 
} 
 
/*! @endmodule */ 
/*! @endmodule */ 
 
void pike_init_floattree_module(void) { 
    INIT 
} 
 
void pike_exit_floattree_module(void) { 
    EXIT 
}