/[mldonkey]/mldonkey/src/daemon/common/commonGlobals.ml
ViewVC logotype

Diff of /mldonkey/src/daemon/common/commonGlobals.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.44 by spiralvoice, Sun Aug 7 10:57:34 2005 UTC revision 1.45 by spiralvoice, Mon Aug 15 20:24:58 2005 UTC
# Line 17  Line 17 
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *)  *)
19    
 open Int64ops  
20  open Printf2  open Printf2
21  open Options  open Options
22  open CommonOptions  open CommonOptions
# Line 69  module ShortLazy : sig Line 68  module ShortLazy : sig
68  (*                                                                       *)  (*                                                                       *)
69  (*************************************************************************)  (*************************************************************************)
70    
71    (* ripped from gui_misc *)
72    
73    let ko = 1024.0
74    let mo = ko *. ko
75    let go = mo *. ko
76    let tob = go *. ko
77    
78    let size_of_int64 size =
79      if !!html_mods_human_readable then
80        let f = Int64.to_float size in
81      if f > tob then
82          Printf.sprintf "%.2fT" (f /. tob)
83      else
84         if f > go then
85          Printf.sprintf "%.2fG" (f /. go)
86         else
87          if f > mo then
88          Printf.sprintf "%.1fM" (f /. mo)
89          else
90         if f > ko then
91           Printf.sprintf "%.1fk" (f /. ko)
92         else
93           Int64.to_string size
94      else
95        Int64.to_string size
96    
97  let networks_string = ref ""  let networks_string = ref ""
98    
99  let patches_string = ref ""  let patches_string = ref ""
100    
101  let version () =  let version () =
102    Printf.sprintf "MLNet %s: Multi-Network p2p client (%s)"    Printf.sprintf "MLNet %s: Multi-Network p2p client (%s) %s"
103      Autoconf.current_version !networks_string      Autoconf.current_version !networks_string (string_of_float 2.)
104    
105    
106  let buildinfo () =  let buildinfo () =
107    (    (
# Line 123  let buildinfo () = Line 149  let buildinfo () =
149            ^ " " ^ Autoconf.sha1_version            ^ " " ^ Autoconf.sha1_version
150        ^ "\nLanguage: " ^ Charset.default_language        ^ "\nLanguage: " ^ Charset.default_language
151        ^ " - locale: " ^ Charset.locstr        ^ " - locale: " ^ Charset.locstr
152    )        ^ "\n max_string_length: " ^ string_of_int Sys.max_string_length
153          ^ " - word_size: " ^ string_of_int Sys.word_size
154          ^ " - max_array_length: " ^ string_of_int Sys.max_array_length
155          ^ "\n max file descriptors: " ^ string_of_int (Unix2.c_getdtablesize ())
156          ^ " - max useable file size: " ^
157                (match Unix2.c_sizeofoff_t () with
158                 | 4 -> "2GB"
159    
160                 |  _ -> Printf.sprintf "2^%d-1 bits (do the maths ;-p)" ((Unix2.c_sizeofoff_t () *8)-1)
161    
162    (*
163                 | _ -> Printf.sprintf "%s"
164                   ((*size_of_int64*)(string_of_float(((2. ** (float_of_int((Unix2.c_sizeofoff_t () * 8)-1))) -. 1.)/. 8.)))
165    *)
166    
167                 ))
168    
169    
170  (* Should we try to find another port when we cannot bind to the one set  (* Should we try to find another port when we cannot bind to the one set
171  in an option, and then change the option accordingly. ?> *)  in an option, and then change the option accordingly. ?> *)
# Line 586  let html_mods_cntr () = Line 628  let html_mods_cntr () =
628  let html_mods_cntr_init () =  let html_mods_cntr_init () =
629    html_mods_counter := true    html_mods_counter := true
630    
 (* ripped from gui_misc *)  
   
 let ko = 1024.0  
 let mo = ko *. ko  
 let go = mo *. ko  
 let tob = go *. ko  
   
 let size_of_int64 size =  
   if !!html_mods_human_readable then  
     let f = Int64.to_float size in  
   if f > tob then  
       Printf.sprintf "%.2fT" (f /. tob)  
   else  
      if f > go then  
       Printf.sprintf "%.2fG" (f /. go)  
      else  
       if f > mo then  
       Printf.sprintf "%.1fM" (f /. mo)  
       else  
      if f > ko then  
        Printf.sprintf "%.1fk" (f /. ko)  
      else  
        Int64.to_string size  
   else  
     Int64.to_string size  
631    
632  let debug_clients = ref Intset.empty  let debug_clients = ref Intset.empty
633    
# Line 831  let for_int64_tag tag f = Line 848  let for_int64_tag tag f =
848  let for_two_int16_tag tag f =  let for_two_int16_tag tag f =
849    match tag.tag_value with    match tag.tag_value with
850      Uint64 i | Fint64 i ->      Uint64 i | Fint64 i ->
851        let i1 = Int64.to_int (right64 i 16) in        let i1 = Int64.to_int (Int64ops.right64 i 16) in
852        let i0 = Int64.to_int i in        let i0 = Int64.to_int i in
853        let i0 = i0 land 0xffff in        let i0 = i0 land 0xffff in
854        let i1 = i1 land 0xffff in        let i1 = i1 land 0xffff in

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26