[ocaml] fix and update for latest ocaml

fix usage of Bytes and String
drop support of ocaml < 4.02
we keep Compat for functions that need ocaml 4.03 until end of life of
Ubuntu Xenial 16.04, drop support of previous releases
enforce type safe_string option to prevent future errors
replace Pervasives by Stdlib (depreciated in latest ocaml vesions)
only use ocamlnet >= 4.0.4
This commit is contained in:
Gautier Hattenberger
2020-03-24 15:45:30 +01:00
parent dbd1729bd9
commit 4d920c118c
58 changed files with 285 additions and 801 deletions
+2 -2
View File
@@ -30,8 +30,8 @@ endif
endif
OCAML = ocaml
OCAMLC = ocamlfind ocamlc
OCAMLOPT = ocamlfind ocamlopt
OCAMLC = ocamlfind ocamlc -safe-string
OCAMLOPT = ocamlfind ocamlopt -safe-string
OCAMLDEP = ocamlfind ocamldep
OCAMLMKLIB = ocamlmklib
OCAMLLEX=ocamllex
+6 -6
View File
@@ -47,16 +47,16 @@ let floats_of_points = fun ps ->
done;
a
let ruler = fun ?(index_on_right=false) ~text_props ~max ~scale ~w ~index_width ~step ~h root ->
let ruler = fun ?(index_on_right=false) ~text_props ~max_value ~scale ~w ~index_width ~step ~h root ->
let r = GnoCanvas.group root in
let height = scale *. float max in
let height = scale *. float max_value in
(* Grey background *)
let _ = GnoCanvas.rect ~x1:0. ~y1:(-.height) ~x2:w ~y2:height ~fill_color:"#808080" r in
let props = (text_props@[`ANCHOR `EAST]) in
(* One step drawer *)
let tab = Array.make (max/step) false in
let tab = Array.make (max_value/step) false in
let draw = fun i ->
let i = i * step in
let y = -. scale *. float i in
@@ -69,7 +69,7 @@ let ruler = fun ?(index_on_right=false) ~text_props ~max ~scale ~w ~index_width
let lazy_drawer = fun v ->
let v = truncate v / step in
for i = Pervasives.max 0 (v - 5) to min (v + 5) (Array.length tab - 1) do (* FIXME *)
for i = max 0 (v - 5) to min (v + 5) (Array.length tab - 1) do (* FIXME *)
if not tab.(i) then begin
tab.(i) <- true;
draw i
@@ -181,7 +181,7 @@ class h = fun ?packing size ->
(* Speedometer on the left side *)
let speed, mi, mx, lazy_speed =
let g = GnoCanvas.group ~x:left_margin ~y:yc canvas#root in
let r, lazy_ruler = ruler ~text_props ~index_on_right:true ~max:50 ~scale:speed_scale ~w:speed_width ~step:2 ~index_width ~h:(0.75*.size2) g in
let r, lazy_ruler = ruler ~text_props ~index_on_right:true ~max_value:50 ~scale:speed_scale ~w:speed_width ~step:2 ~index_width ~h:(0.75*.size2) g in
let mx =
GnoCanvas.text ~x:(speed_width/.2.) ~y:(-0.88*.size2) ~props:text_props g
and mi =
@@ -194,7 +194,7 @@ class h = fun ?packing size ->
(* Altimeter on the right side *)
and alt, lazy_alt =
let g = GnoCanvas.group ~x:(xc+.size2) ~y:yc canvas#root in
ruler ~text_props ~max:3000 ~scale:alt_scale ~w:alt_width ~step:10 ~index_width ~h:(0.75*.size2) g
ruler ~text_props ~max_value:3000 ~scale:alt_scale ~w:alt_width ~step:10 ~index_width ~h:(0.75*.size2) g
in
object
+4 -4
View File
@@ -172,7 +172,7 @@ let select_ac = fun acs_notebook ac_id ->
if !active_ac <> "" then begin
let ac' = find_ac !active_ac in
ac'.strip#hide_buttons ();
ac'.notebook_label#set_width_chars (Compat.bytes_length ac'.notebook_label#text);
ac'.notebook_label#set_width_chars (String.length ac'.notebook_label#text);
if !_auto_hide_fp then hide_fp ac'
end;
@@ -353,7 +353,7 @@ let attributes_pretty_printer = fun attribs ->
&& a <> "post_call" && a <> "key" && a <> "group" in
let sprint_opt = fun b s ->
if Compat.bytes_length b > 0 then
if String.length b > 0 then
sprintf " %s%s%s" s b s
else
""
@@ -651,7 +651,7 @@ let create_ac = fun ?(confirm_kill=true) alert (geomap:G.widget) (acs_notebook:G
let settings_file = Http.file_of_url settings_url in
let settings_xml =
try
if Compat.bytes_compare "replay" settings_file <> 0 then
if String.compare "replay" settings_file <> 0 then
ExtXml.parse_file ~noprovedtd:true settings_file
else
Xml.Element("empty", [], [])
@@ -755,7 +755,7 @@ let create_ac = fun ?(confirm_kill=true) alert (geomap:G.widget) (acs_notebook:G
(* only horizontal wind and airspeed are updated, so bitmask is 0b0000101 = 5 *)
let msg_items = ["WIND_INFO"; ac_id; "5"; wind_east; wind_north; "0.0"; airspeed] in
let value = Compat.bytes_concat ";" msg_items in
let value = String.concat ";" msg_items in
let vs = ["ac_id", PprzLink.String ac_id; "message", PprzLink.String value] in
Ground_Pprz.message_send "dl" "RAW_DATALINK" vs;
with
+1 -1
View File
@@ -91,7 +91,7 @@ let one_setting = fun (i:int) (do_change:int -> float -> unit) ac_id packing dl_
1.
in
(* get number of digits after decimal dot *)
let digits = try Compat.bytes_length (ExtXml.attrib dl_setting "step") - Compat.bytes_index (ExtXml.attrib dl_setting "step") '.' - 1 with _ -> 0 in
let digits = try String.length (ExtXml.attrib dl_setting "step") - String.index (ExtXml.attrib dl_setting "step") '.' - 1 with _ -> 0 in
let page_incr = step_incr
and page_size = step_incr
and show_auto = try ExtXml.attrib dl_setting "auto" = "true" with _ -> false in
+1 -1
View File
@@ -199,7 +199,7 @@ let fill_data = fun (model:GTree.tree_store) settings airframe_xml ->
(* Warning if needed *)
if !not_in_airframe_file <> [] then begin
GToolbox.message_box ~title:"Warning" (Printf.sprintf "Some parameters not writable in the airframe file:\n\n%s" (Compat.bytes_concat "\n" !not_in_airframe_file));
GToolbox.message_box ~title:"Warning" (Printf.sprintf "Some parameters not writable in the airframe file:\n\n%s" (String.concat "\n" !not_in_airframe_file));
end
+1 -1
View File
@@ -328,7 +328,7 @@ object
(* add a button widget in a vertical box if it belongs to a group (create new group if needed) *)
method add_widget ?(group="") w =
let (vbox, pack) = match Compat.bytes_length group with
let (vbox, pack) = match String.length group with
0 -> (GPack.vbox ~show:true (), true)
| _ -> try (Hashtbl.find button_tbl group, false) with
Not_found ->
+1 -2
View File
@@ -34,7 +34,6 @@
*)
open Printf
open Unix
open Random
@@ -557,7 +556,7 @@ let execute_actions = fun actions ac_id ->
(** this capability is mostly for bench-time trimming when a joystick does not have adequate buttons *)
(** it is not a very complete capability *)
let execute_kb_action = fun actions conditions ->
let ch = input_byte Pervasives.stdin in
let ch = input_byte stdin in
(** esdx for left stick
ijkm for right *)
+3 -3
View File
@@ -25,14 +25,14 @@ let () =
(* Forward telemetry on Ivy *)
let buffer_size = 256 in
let buffer = Compat.bytes_create buffer_size in
let buffer = Bytes.create buffer_size in
let get_tcp = fun _ ->
begin
try
let n = input i buffer 0 buffer_size in
let data = Compat.bytes_sub buffer 0 n in
let data = Bytes.sub buffer 0 n in
Ivy.send (sprintf "%s %s" !ivy_to (Base64.encode_string data))
Ivy.send (sprintf "%s %s" !ivy_to (Base64.encode_string (Bytes.to_string data)))
with
exc -> prerr_endline (Printexc.to_string exc)
end;
+4 -4
View File
@@ -81,13 +81,13 @@ let () =
(* The function to be called when data is available *)
let buffer_size = 256 in
let buffer = Compat.bytes_create buffer_size in
let buffer = Bytes.create buffer_size in
let get_datalink_message = fun _ ->
begin
try
let n = input (Unix.in_channel_of_descr fd) buffer 0 buffer_size in
let b = Compat.bytes_sub buffer 0 n in
Debug.trace 'x' (Debug.xprint b);
let b = Bytes.sub buffer 0 n in
Debug.trace 'x' (Debug.xprint (Bytes.to_string b));
let use_dl_message = fun payload ->
Debug.trace 'x' (Debug.xprint (Protocol.string_of_payload payload));
@@ -95,7 +95,7 @@ let () =
let msg = Dl_Pprz.message_of_id msg_id in
Dl_Pprz.message_send "ground_dl" msg.PprzLink.name values in
assert (PprzTransport.parse use_dl_message b = n)
assert (PprzTransport.parse use_dl_message (Bytes.to_string b) = n)
with
exc ->
prerr_endline (Printexc.to_string exc)
+6 -6
View File
@@ -62,8 +62,8 @@ let () =
let (msg_id, vs) = Tm_Pprz.values_of_string args.(0) in
let payload = Tm_Pprz.payload_of_values msg_id (int_of_string !id) vs in
let buf = Pprz_transport.Transport.packet payload in
let n = Compat.bytes_length buf in
let n' = Unix.sendto socket buf 0 n [] sockaddr in
let n = String.length buf in
let n' = Unix.sendto socket (Bytes.of_string buf) 0 n [] sockaddr in
assert (n = n')
with _ -> () in
@@ -75,13 +75,13 @@ let () =
Unix.bind socket sockaddr;
let buffer_size = 256 in
let buffer = Compat.bytes_create buffer_size in
let buffer = Bytes.create buffer_size in
let get_datalink_message = fun _ ->
begin
try
let n = input (Unix.in_channel_of_descr socket) buffer 0 buffer_size in
let b = Compat.bytes_sub buffer 0 n in
Debug.trace 'x' (Debug.xprint b);
let b = Bytes.sub buffer 0 n in
Debug.trace 'x' (Debug.xprint (Bytes.to_string b));
let use_dl_message = fun payload ->
Debug.trace 'x' (Debug.xprint (Protocol.string_of_payload payload));
@@ -89,7 +89,7 @@ let () =
let msg = Dl_Pprz.message_of_id msg_id in
Dl_Pprz.message_send "ground_dl" msg.PprzLink.name values in
assert (PprzTransport.parse use_dl_message b = n)
assert (PprzTransport.parse use_dl_message (Bytes.to_string b) = n)
with
exc ->
prerr_endline (Printexc.to_string exc)
+4 -4
View File
@@ -41,13 +41,13 @@ let () =
(* Forward a datalink command on the bus *)
let buffer_size = 256 in
let buffer = Compat.bytes_create buffer_size in
let buffer = Bytes.create buffer_size in
let get_datalink_message = fun _ ->
begin
try
let n = input i buffer 0 buffer_size in
let b = Compat.bytes_sub buffer 0 n in
Debug.trace 'x' (Debug.xprint b);
let b = Bytes.sub buffer 0 n in
Debug.trace 'x' (Debug.xprint (Bytes.to_string b));
let use_dl_message = fun payload ->
Debug.trace 'x' (Debug.xprint (Protocol.string_of_payload payload));
@@ -55,7 +55,7 @@ let () =
let msg = Dl_Pprz.message_of_id msg_id in
Dl_Pprz.message_send "ground_dl" msg.PprzLink.name values in
assert (PprzTransport.parse use_dl_message b = n)
assert (PprzTransport.parse use_dl_message (Bytes.to_string b) = n)
with
exc ->
prerr_endline (Printexc.to_string exc)
+4 -4
View File
@@ -29,13 +29,13 @@ let () =
let (i, o) = Unix.open_connection sockaddr in
let buffer_size = 256 in
let buffer = Compat.bytes_create buffer_size in
let buffer = Bytes.create buffer_size in
let get_message = fun _ ->
begin
try
let n = input i buffer 0 buffer_size in
let b = Compat.bytes_sub buffer 0 n in
Debug.trace 'x' (Debug.xprint b);
let b = Bytes.sub buffer 0 n in
Debug.trace 'x' (Debug.xprint (Bytes.to_string b));
let use_tele_message = fun payload ->
Debug.trace 'x' (Debug.xprint (Protocol.string_of_payload payload));
@@ -43,7 +43,7 @@ let () =
let msg = Tm_Pprz.message_of_id msg_id in
Tm_Pprz.message_send (string_of_int ac_id) msg.PprzLink.name values in
ignore (PprzTransport.parse use_tele_message b)
ignore (PprzTransport.parse use_tele_message (Bytes.to_string b))
with
exc ->
prerr_endline (Printexc.to_string exc)
+2 -2
View File
@@ -92,7 +92,7 @@ let circle = fun geo radius alt ->
let wgs84 = of_utm WGS84 utm in
coordinates wgs84 alt in
let points = Array.init 360 degree_point in
Compat.bytes_concat " " (points.(359) :: Array.to_list points)
String.concat " " (points.(359) :: Array.to_list points)
let ring_around_home = fun utm0 fp ->
@@ -237,7 +237,7 @@ let update_horiz_mode =
let alt = ac.desired_altitude in
match ac.horiz_mode with
Segment (p1, p2) ->
let coordinates = Compat.bytes_concat " " (List.map (fun p -> coordinates p alt) [p1; p2]) in
let coordinates = String.concat " " (List.map (fun p -> coordinates p alt) [p1; p2]) in
let kml_changes = update_linear_ring url_flight_plan "horiz_mode" coordinates in
print_xml ac.name "route_changes.kml" kml_changes
| Circle (p, r) ->
+11 -11
View File
@@ -195,7 +195,7 @@ let update_ms_since_last_msg =
statuss
let use_tele_message = fun ?udp_peername ?raw_data_size payload ->
let raw_data_size = match raw_data_size with None -> Compat.bytes_length (Protocol.string_of_payload payload) | Some d -> d in
let raw_data_size = match raw_data_size with None -> String.length (Protocol.string_of_payload payload) | Some d -> d in
let buf = Protocol.string_of_payload payload in
Debug.call 'l' (fun f -> fprintf f "pprz receiving: %s\n" (Debug.xprint buf));
try
@@ -278,18 +278,18 @@ module XB = struct (** XBee module *)
| Xbee_transport.RX_Packet_64 (addr64, rssi, options, data) ->
Debug.trace 'x' (sprintf "getting XBee RX64: %Lx %d %d %s" addr64 rssi options (Debug.xprint data));
use_tele_message ~raw_data_size:(Compat.bytes_length frame_data + oversize_packet) (Protocol.payload_of_string data)
use_tele_message ~raw_data_size:(String.length frame_data + oversize_packet) (Protocol.payload_of_string data)
| Xbee_transport.RX868_Packet (addr64, options, data) ->
Debug.trace 'x' (sprintf "getting XBee868 RX: %Lx %d %s" addr64 options (Debug.xprint data));
use_tele_message ~raw_data_size:(Compat.bytes_length frame_data + oversize_packet) (Protocol.payload_of_string data)
use_tele_message ~raw_data_size:(String.length frame_data + oversize_packet) (Protocol.payload_of_string data)
| Xbee_transport.RX_Packet_16 (addr16, rssi, options, data) ->
Debug.trace 'x' (sprintf "getting XBee RX16: from=%x %d %d %s" addr16 rssi options (Debug.xprint data));
use_tele_message ~raw_data_size:(Compat.bytes_length frame_data + oversize_packet) (Protocol.payload_of_string data)
use_tele_message ~raw_data_size:(String.length frame_data + oversize_packet) (Protocol.payload_of_string data)
let send = fun ?ac_id device rf_data ->
let ac_id = match ac_id with None -> 0xffff | Some a -> a in
let rf_data = Protocol.string_of_payload rf_data in
let rf_data = Protocol.bytes_of_payload rf_data in
let frame_id = gen_frame_id () in
let frame_data =
if !Xbee_transport.mode868 then
@@ -303,7 +303,7 @@ module XB = struct (** XBee module *)
let o = Unix.out_channel_of_descr device.fd in
fprintf o "%s%!" packet;
Debug.call 'y' (fun f -> fprintf f "link sending (%d): (%s) %s\n" frame_id (Debug.xprint rf_data) (Debug.xprint packet));
Debug.call 'y' (fun f -> fprintf f "link sending (%d): (%s) %s\n" frame_id (Debug.xprint (Bytes.to_string rf_data)) (Debug.xprint packet));
end (** XBee module *)
@@ -315,11 +315,11 @@ let local_broadcast_address =
let udp_send = fun fd payload peername ->
let buf = Pprz_transport.Transport.packet payload in
let len = Compat.bytes_length buf in
let len = String.length buf in
let addr = if !udp_broadcast then (Unix.inet_addr_of_string !udp_broadcast_addr) else peername in
Debug.call 'u' (fun f -> fprintf f "udp_send to %s port %i\n" (Unix.string_of_inet_addr addr) !udp_uplink_port);
let sockaddr = Unix.ADDR_INET (addr, !udp_uplink_port) in
let n = Unix.sendto fd buf 0 len [] sockaddr in
let n = Unix.sendto fd (Bytes.of_string buf) 0 len [] sockaddr in
assert (n = len)
let send = fun ac_id device payload _priority ->
@@ -370,7 +370,7 @@ let parser_of_device = fun device ->
match device.transport with
| Pprz ->
let use = fun s ->
let raw_data_size = Compat.bytes_length (Protocol.string_of_payload s) + 4 (*stx,len,ck_a, ck_b*) in
let raw_data_size = String.length (Protocol.string_of_payload s) + 4 (*stx,len,ck_a, ck_b*) in
let udp_peername =
if !udp then
Some !last_udp_peername
@@ -479,7 +479,7 @@ let () =
(** Listen on a udp port or a serial device or on pipe *)
let on_serial_device =
Compat.bytes_length !port >= 4 && Compat.bytes_sub !port 0 4 = "/dev" in (* FIXME *)
String.length !port >= 4 && String.sub !port 0 4 = "/dev" in (* FIXME *)
let fd =
if !udp then
begin
@@ -504,7 +504,7 @@ let () =
let read_fd =
let buffered_parser =
(* Get the specific parser for the given transport protocol *)
let parser = parser_of_device device in
let parser = fun b -> parser_of_device device (Bytes.to_string b) in
let read = if !udp then udp_read else Unix.read in
(* Wrap the parser into the buffered bytes reader *)
match Serial.input ~read parser with Serial.Closure f -> f in
+7 -7
View File
@@ -33,20 +33,20 @@ module Protocol = struct
let stx = Char.chr 0x02
let etx = 0x03
let index_start = fun buf ->
Compat.bytes_index buf stx
Bytes.index buf stx
let payload_length = fun buf start ->
Char.code buf.[start+1] - 1
let length = fun buf start ->
let len = Compat.bytes_length buf - start in
let len = Bytes.length buf - start in
if len >= 2 then
Char.code buf.[start+1] + 3
else
raise Serial.Not_enough
let checksum = fun msg ->
let l = Compat.bytes_length msg in
let l = Bytes.length msg in
let ck_a = ref 0 in
for i = 1 to l - 3 do
ck_a := Char.code msg.[i] lxor !ck_a
@@ -54,9 +54,9 @@ module Protocol = struct
!ck_a = Char.code msg.[l-2] && Char.code msg.[l-1] = etx
let payload = fun msg ->
let l = Compat.bytes_length msg in
let l = Bytes.length msg in
assert(l >= 4);
Serial.payload_of_string (Compat.bytes_sub msg 2 (l-4))
Serial.payload_of_string (Bytes.sub msg 2 (l-4))
let packet = fun _payload ->
failwith "Modem.Protocol.packet not implemented"
@@ -96,12 +96,12 @@ let valim = fun x -> float x *. 0.0162863 -. 1.17483
let parse_payload = fun payload ->
let payload = Serial.string_of_payload payload in
status.detected <- 1;
let len = Compat.bytes_length payload in
let len = Bytes.length payload in
status.nb_byte <- status.nb_byte + len;
status.nb_msg <- status.nb_msg + 1;
let id = Char.code payload.[0] in
if id = msg_data then
Some (Compat.bytes_sub payload 1 (len-1))
Some (Bytes.sub payload 1 (len-1))
else begin
begin
match id with
+5 -5
View File
@@ -69,13 +69,13 @@ let foi32value = fun x ->
| _ -> failwith "Receive.log_and_parse: int32 expected"
let format_string_field = fun s ->
let s = Compat.bytes_copy s in
for i = 0 to Compat.bytes_length s - 1 do
match s.[i] with
' ' -> Compat.bytes_set s i '_'
let s = Bytes.of_string s in
for i = 0 to Bytes.length s - 1 do
match Bytes.get s i with
' ' -> Bytes.set s i '_'
| _ -> ()
done;
s
Bytes.to_string s
let check_index = fun i t where ->
if i < 0 || i >= Array.length t then begin
+10 -10
View File
@@ -62,7 +62,7 @@ let wind_msg_period = 5000 (* ms *)
let aircraft_alerts_period = 1000 (* ms *)
let send_aircrafts_msg = fun _asker _values ->
assert(_values = []);
let names = Compat.bytes_concat "," (Hashtbl.fold (fun k _v r -> k::r) aircrafts []) ^ "," in
let names = String.concat "," (Hashtbl.fold (fun k _v r -> k::r) aircrafts []) ^ "," in
["ac_list", PprzLink.String names]
@@ -479,9 +479,9 @@ let send_aircraft_msg = fun ac ->
(** Check if it is a replayed A/C (c.f. sw/logalizer/play.ml) *)
let replayed = fun ac_id ->
let n = Compat.bytes_length ac_id in
if n > 6 && Compat.bytes_sub ac_id 0 6 = "replay" then
(true, Compat.bytes_sub ac_id 6 (n - 6), "/var/replay/", ExtXml.parse_file (Env.paparazzi_home // "var/replay/conf/conf.xml"))
let n = String.length ac_id in
if n > 6 && String.sub ac_id 0 6 = "replay" then
(true, String.sub ac_id 6 (n - 6), "/var/replay/", ExtXml.parse_file (Env.paparazzi_home // "var/replay/conf/conf.xml"))
else
(false, ac_id, "", conf_xml)
@@ -509,7 +509,7 @@ let check_md5sum = fun ac_name alive_md5sum aircraft_conf_dir ->
match alive_md5sum with
PprzLink.Array array ->
let n = Array.length array in
assert(n = Compat.bytes_length md5sum / 2);
assert(n = String.length md5sum / 2);
for i = 0 to n - 1 do
let x = int_of_string (sprintf "0x%c%c" md5sum.[2*i] md5sum.[2*i+1]) in
assert (x = PprzLink.int_of_value array.(i))
@@ -520,7 +520,7 @@ let check_md5sum = fun ac_name alive_md5sum aircraft_conf_dir ->
match alive_md5sum with
PprzLink.Array array ->
let n = Array.length array in
assert(n = Compat.bytes_length md5sum / 2);
assert(n = String.length md5sum / 2);
for i = 0 to n - 1 do
let x = 0 in
assert (x = PprzLink.int_of_value array.(i))
@@ -830,11 +830,11 @@ let jump_block = fun logging _sender vs ->
(** Got a RAW_DATALINK, send its contents *)
let raw_datalink = fun logging _sender vs ->
let ac_id = PprzLink.string_assoc "ac_id" vs
and m = PprzLink.string_assoc "message" vs in
for i = 0 to Compat.bytes_length m - 1 do
if m.[i] = ';' then Compat.bytes_set m i ' '
and m = Bytes.of_string (PprzLink.string_assoc "message" vs) in
for i = 0 to Bytes.length m - 1 do
if Bytes.get m i = ';' then Bytes.set m i ' '
done;
let msg_id, vs = Dl_Pprz.values_of_string m in
let msg_id, vs = Dl_Pprz.values_of_string (Bytes.to_string m) in
let msg = Dl_Pprz.message_of_id msg_id in
Dl_Pprz.message_send dl_id msg.PprzLink.name vs;
log logging ac_id msg.PprzLink.name vs
+1 -1
View File
@@ -19,7 +19,7 @@ let horiz_modes = [|"WAYPOINT";"ROUTE";"CIRCLE";"ATTITUDE";"MANUAL"|]
let if_modes = [|"OFF";"DOWN";"UP"|]
let string_of_values = fun values ->
Compat.bytes_concat " " (List.map (fun (_, v) -> PprzLink.string_of_value v) values)
String.concat " " (List.map (fun (_, v) -> PprzLink.string_of_value v) values)
(** get modes from autopilot xml file *)
let modes_from_autopilot = fun ap_xml ->
+1 -1
View File
@@ -1,5 +1,5 @@
description = "Paparazzi UAS package"
requires = "unix,str,pprzlink,xml-light,lablgtk2,glibivy,netclient,NETTLS_GNUTLS"
requires = "unix,str,pprzlink,xml-light,lablgtk2,glibivy,netclient,nettls-gnutls"
version = "1.0"
directory = ""
+3 -21
View File
@@ -50,39 +50,21 @@ LABLGTK2GNOMECANVAS = $(shell ocamlfind query -p-format lablgtk2.gnomecanvas 2>/
endif
CAMLP4_DEFS ?=
NETCLIENT_VER := $(shell ocamlfind query -format '%v' netclient)
NETCLIENT_MAJOR := $(shell echo $(NETCLIENT_VER) | cut -f1 -d.)
NETCLIENT_MINOR1 := $(shell echo $(NETCLIENT_VER) | cut -f2 -d.)
NETCLIENT_MINOR2 := $(shell echo $(NETCLIENT_VER) | cut -f3 -d.)
ifeq ($(shell test $(NETCLIENT_MAJOR) -ge 4; echo $$?),0)
CAMLP4_DEFS += -DNETCLIENT_V_4
NETTLS_GNUTLS = nettls-gnutls
COMMA_NETTLS_GNUTLS = ,$(NETTLS_GNUTLS)
ifeq ($(shell test $(NETCLIENT_MINOR2) -ge 4; echo $$?),0)
CAMLP4_DEFS += -DNETCLIENT_V_404
else ifeq ($(shell test $(NETCLIENT_MINOR1) -g 0; echo $$?),0)
CAMLP4_DEFS += -DNETCLIENT_V_404
endif
endif
OCAMLC_VER := $(shell ocamlc -version)
OCAMLC_MAJOR := $(shell echo $(OCAMLC_VER) | cut -f1 -d.)
OCAMLC_MINOR := $(shell echo $(OCAMLC_VER) | cut -f2 -d.)
ifeq ($(shell test $(OCAMLC_MAJOR) -ge 4; echo $$?),0)
ifeq ($(shell test $(OCAMLC_MINOR) -ge 2; echo $$?),0)
# the Bytes module is available since OCaml 4.02.0
CAMLP4_DEFS += -DHAS_BYTES_MODULE
ifeq ($(shell test $(OCAMLC_MINOR) -ge 4; echo $$?),0)
CAMLP4_DEFS += -DOCAML_V404
endif
endif
endif
PP_OPTS = -pp "camlp4o pa_macro.cmo $(CAMLP4_DEFS)"
# which source files to run through caml4p
PP_SRC = http.ml compat.ml
PP_SRC = compat.ml
INCLUDES=
PKGCOMMON=pprzlink,xml-light,netclient,glibivy,lablgtk2,$(NETTLS_GNUTLS)
PKGCOMMON=pprzlink,xml-light,netclient,nettls-gnutls,glibivy,lablgtk2
XINCLUDES=
XPKGCOMMON=pprzlink,xml-light,glibivy,$(LABLGTK2GNOMECANVAS),lablgtk2.glade
@@ -212,7 +194,7 @@ gtk_papget_led_editor.ml : widgets.glade
META.pprz: META.pprz.template
@echo COPY $<
$(shell sed -e 's/LABLGTK2GNOMECANVAS/$(LABLGTK2GNOMECANVAS)/g' -e 's/,NETTLS_GNUTLS/$(COMMA_NETTLS_GNUTLS)/g' $< > $@)
$(shell sed -e 's/LABLGTK2GNOMECANVAS/$(LABLGTK2GNOMECANVAS)/g' $< > $@)
clean :
$(Q)rm -f *~ *.cm* *.out *.opt .depend *.a *.o *.so tests gtk_papget_*.ml expr_parser.ml expr_parser.mli expr_lexer.ml expr_lexer.mli META.pprz
+11 -11
View File
@@ -50,28 +50,28 @@ let encode_chunk chars =
let llength = List.length chars in
if(llength = 0 || llength > 3) then
raise (Invalid_encode_chunk(llength));
let chunk = Compat.bytes_make 4 '=' in
let chunk = Bytes.make 4 '=' in
let a = List.hd chars in
let tmpa = (((Char.code a) land 3) lsl 4) in
Compat.bytes_set chunk 0 char_map.( (Char.code a) lsr 2);
Bytes.set chunk 0 char_map.( (Char.code a) lsr 2);
(* Check for another character *)
if (llength < 2) then (
Compat.bytes_set chunk 1 char_map.(tmpa);
chunk;
Bytes.set chunk 1 char_map.(tmpa);
Bytes.to_string chunk;
) else (
let b = List.nth chars 1 in
let tmpb = ((Char.code b) lsr 4) in
let tmpa2 = ((Char.code b) land 0x0f) lsl 2 in
Compat.bytes_set chunk 1 char_map.(tmpa lor tmpb);
Bytes.set chunk 1 char_map.(tmpa lor tmpb);
if (llength < 3) then (
Compat.bytes_set chunk 2 char_map.(tmpa2);
chunk
Bytes.set chunk 2 char_map.(tmpa2);
Bytes.to_string chunk
) else (
let c = List.nth chars 2 in
let tmpb2 = ((Char.code c) land 0xc0) lsr 6 in
Compat.bytes_set chunk 2 char_map.(tmpa2 lor tmpb2);
Compat.bytes_set chunk 3 char_map.((Char.code c) land 0x3f);
chunk
Bytes.set chunk 2 char_map.(tmpa2 lor tmpb2);
Bytes.set chunk 3 char_map.((Char.code c) land 0x3f);
Bytes.to_string chunk
)
)
@@ -202,7 +202,7 @@ let decode_string s = decode_to_string (Stream.of_string s)
(** Simple test function. *)
let test() =
let wordlist = ["A";"AB";"ABC";"Dustin";Compat.bytes_create 128] in
let wordlist = ["A";"AB";"ABC";"Dustin";Bytes.to_string (Bytes.create 128)] in
print_endline("String:");
List.iter (fun x -> print_endline(encode_string x))
wordlist;
+6 -54
View File
@@ -22,66 +22,18 @@
*
*)
IFDEF HAS_BYTES_MODULE THEN
module BYTES = Bytes
ELSE
module BYTES = String
END
let bytes_create = fun len ->
BYTES.create len
let bytes_contains = fun c s ->
BYTES.contains c s
let bytes_length = fun len ->
BYTES.length len
let bytes_make = fun n c->
BYTES.make n c
let bytes_copy = fun s->
BYTES.copy s
let bytes_blit = fun src srcoff dst dstoff len->
BYTES.blit src srcoff dst dstoff len
let bytes_sub = fun s start len->
BYTES.sub s start len
let bytes_index = fun c s ->
BYTES.index c s
let bytes_concat = fun sep sl->
BYTES.concat sep sl
let bytes_index_from = fun s i c ->
BYTES.index_from s i c
let bytes_get = fun s n->
BYTES.get s n
let bytes_compare = fun s1 s2->
BYTES.compare s1 s2
let bytes_set = fun s n c->
BYTES.set s n c
let bytes_iter = fun f s->
BYTES.iter f s
IFDEF OCAML_V404 THEN
let lowercase_ascii = BYTES.lowercase_ascii
let lowercase_ascii = String.lowercase_ascii
let uppercase_ascii = BYTES.uppercase_ascii
let uppercase_ascii = String.uppercase_ascii
let capitalize_ascii = BYTES.capitalize_ascii
let capitalize_ascii = String.capitalize_ascii
ELSE
let lowercase_ascii = BYTES.lowercase
let lowercase_ascii = String.lowercase
let uppercase_ascii = BYTES.uppercase
let uppercase_ascii = String.uppercase
let capitalize_ascii = BYTES.capitalize
let capitalize_ascii = String.capitalize
END
-15
View File
@@ -22,21 +22,6 @@
*
*)
val bytes_create : int -> string
val bytes_contains : string -> char -> bool
val bytes_length : string -> int
val bytes_make : int -> char -> string
val bytes_copy : string -> string
val bytes_blit : string -> int -> string -> int -> int -> unit
val bytes_sub : string -> int -> int -> string
val bytes_index : string -> char -> int
val bytes_concat : string -> string list -> string
val bytes_index_from : string -> int -> char -> int
val bytes_get : string -> int -> char
val bytes_compare : string -> string -> int
val bytes_set : string -> int -> char -> unit
val bytes_iter : (char -> unit) -> string -> unit
val lowercase_ascii : string -> string
val uppercase_ascii : string -> string
val capitalize_ascii : string -> string
+6 -6
View File
@@ -27,7 +27,7 @@ let level = ref (try Sys.getenv "PPRZ_DEBUG" with Not_found -> "")
let log = ref stderr
let call lev f =
assert( (* assert permet au compilo de tout virer avec l'option -noassert *)
if (Compat.bytes_contains !level '*' || Compat.bytes_contains !level lev)
if (String.contains !level '*' || String.contains !level lev)
then begin
f !log;
flush !log
@@ -37,11 +37,11 @@ let call lev f =
let trace lev s = call lev (fun f -> Printf.fprintf f "%s\n" s)
let xprint = fun s ->
let n = Compat.bytes_length s in
let a = Compat.bytes_make (3*n) ' ' in
let n = String.length s in
let a = Bytes.make (3*n) ' ' in
for i = 0 to n - 1 do
let x = Printf.sprintf "%02x" (Char.code s.[i]) in
Compat.bytes_set a (3*i) x.[0];
Compat.bytes_set a (3*i+1) x.[1]
Bytes.set a (3*i) x.[0];
Bytes.set a (3*i+1) x.[1]
done;
a
Bytes.to_string a
+1 -1
View File
@@ -23,7 +23,7 @@
*)
let default_ivy_bus = Compat.bytes_copy (
let default_ivy_bus = (
try (Sys.getenv "IVY_BUS" )
with Not_found ->
(if Os_calls.contains (Os_calls.os_name) "Darwin" then
+2 -2
View File
@@ -34,7 +34,7 @@ let data =
let path = [Env.paparazzi_home // "data" // "srtm"] in
let f = Ocaml_tools.open_compress (Ocaml_tools.find_file path "WW15MGH.DAC") in
let n = ncols * nrows * 2 in
let buf = Compat.bytes_create n in
let buf = Bytes.create n in
really_input f buf 0 n;
buf)
@@ -50,6 +50,6 @@ let of_wgs84 = fun geo ->
let i = (2*(ilat*ncols+ilon)) in
let x = Char.code egm96_data.[i] lsl 8 + Char.code egm96_data.[i+1] in
let x = Char.code (Bytes.get egm96_data i) lsl 8 + Char.code (Bytes.get egm96_data (i+1)) in
float ((x lsl 16) asr 16) /. 100.
+6 -6
View File
@@ -81,8 +81,8 @@ let filter_absolute_path = fun path ->
(* filter settings and keep the ones without brackets *)
let filter_settings = fun settings ->
let sl = Str.split (Str.regexp "[ ]+") settings in
let sl = List.filter (fun s -> not (s.[0] = '[' && s.[Compat.bytes_length s - 1] = ']')) sl in
Compat.bytes_concat " " sl
let sl = List.filter (fun s -> not (s.[0] = '[' && s.[String.length s - 1] = ']')) sl in
String.concat " " sl
(* filter on modules based on target *)
let filter_modules_target = fun module_file ->
@@ -171,12 +171,12 @@ let expand_ac_xml = fun ?(raise_exception = true) ac_conf ->
let read_process command =
let buffer_size = 2048 in
let buffer = Buffer.create buffer_size in
let string = Compat.bytes_create buffer_size in
let bytes_ = Bytes.create buffer_size in
let in_channel = Unix.open_process_in command in
let chars_read = ref 1 in
while !chars_read <> 0 do
chars_read := input in_channel string 0 buffer_size;
Buffer.add_substring buffer string 0 !chars_read
chars_read := input in_channel bytes_ 0 buffer_size;
Buffer.add_substring buffer (Bytes.to_string bytes_) 0 !chars_read
done;
ignore (Unix.close_process_in in_channel);
Buffer.contents buffer
@@ -197,4 +197,4 @@ let key_modifiers_of_string = fun key ->
| "Meta" -> "<Meta>"
| x -> x
) key_split in
Compat.bytes_concat "" keys
String.concat "" keys
+1 -1
View File
@@ -30,7 +30,7 @@ rule token = parse
| ['0'-'9']+ { INT (int_of_string (Lexing.lexeme lexbuf)) }
| ['0'-'9']+'.'['0'-'9']* { FLOAT (float_of_string (Lexing.lexeme lexbuf)) }
| '$'?['a'-'z' '_' 'A'-'Z'] (['a'-'z' 'A'-'Z' '_' '0'-'9']*) { IDENT (Lexing.lexeme lexbuf) }
| '\''[^'\'']+'\'' { let s = Lexing.lexeme lexbuf in IDENT (Compat.bytes_sub s 1 (Compat.bytes_length s - 2)) }
| '\''[^'\'']+'\'' { let s = Lexing.lexeme lexbuf in IDENT (String.sub s 1 (String.length s - 2)) }
| ',' { COMMA }
| '.' { DOT }
| ';' { SEMICOLON }
+2 -2
View File
@@ -46,7 +46,7 @@ let sprint = fun ?call_assoc expr ->
| Some (n, l) -> Some n, l
in
let rec eval = function
| Ident i when i.[0] = '$' -> sprintf "%s" (c_var_of_ident (Compat.bytes_sub i 1 (Compat.bytes_length i - 1)))
| Ident i when i.[0] = '$' -> sprintf "%s" (c_var_of_ident (String.sub i 1 (String.length i - 1)))
| Ident i -> sprintf "%s" i
| Int i -> sprintf "%d" i
| Float i -> sprintf "%f" i
@@ -60,7 +60,7 @@ let sprint = fun ?call_assoc expr ->
sprintf "%d" index
| Call (i, es) ->
let ses = List.map eval es in
sprintf "%s(%s)" i (Compat.bytes_concat "," ses)
sprintf "%s(%s)" i (String.concat "," ses)
| Index (i,e) -> sprintf "%s[%s]" i (eval e)
| Field (i,f) -> sprintf "%s.%s" i f
| Deref (e,f) -> sprintf "(%s)->%s" (eval e) f
+1 -1
View File
@@ -89,7 +89,7 @@ let buffer_attr = fun indent tab (n,v) ->
Buffer.add_char tmp ' ';
Buffer.add_string tmp n;
Buffer.add_string tmp "=\"";
let l = Compat.bytes_length v in
let l = String.length v in
for p = 0 to l-1 do
match v.[p] with
| '\\' -> Buffer.add_string tmp "\\\\"
+7 -7
View File
@@ -467,7 +467,7 @@ let font_flags = fun rigid special font hidden ->
bit hidden 3
let code_string = fun f s ->
for i = 0 to Compat.bytes_length s - 1 do
for i = 0 to String.length s - 1 do
if Char.code s.[i] > 0o177 then
fprintf f "\\%3o" (Char.code s.[i])
else
@@ -500,8 +500,8 @@ let rec read_comments = fun s ->
bscanf s " %0c" (fun c ->
if c = '#' then
bscanf s " %s@\n" (fun l ->
let n = Compat.bytes_length l in
Compat.bytes_sub l 2 (n-2) :: read_comments s)
let n = String.length l in
String.sub l 2 (n-2) :: read_comments s)
else
[])
@@ -622,9 +622,9 @@ let read_text = fun s ->
bscanf s " %d %d %d %d %d %d %f %d %f %f" (fun st c depth _ps ft fs angle ff h l ->
let p = read_point s in
bscanf s "%c%s@\n" (fun _space text ->
let n = Compat.bytes_length text in
assert (Compat.bytes_sub text (n-4) 4 = "\\001");
let text = Compat.bytes_sub text 0 (n - 4) in
let n = String.length text in
assert (String.sub text (n-4) 4 = "\\001");
let text = String.sub text 0 (n - 4) in
Text (justification_of_int st, c, depth, font_of_int (bit2 ff) ft, fs, angle, ff, h, l, p,text)))
@@ -649,7 +649,7 @@ let read = fun file ->
let s = Scanning.from_file file in
bscanf s "#FIG %s@\n%s %s@\n %s %s %f %s %d" (fun v o j u p m multi t ->
if Compat.bytes_sub v 0 3 <> "3.2" then
if String.sub v 0 3 <> "3.2" then
failwith ("Unknown FIG format version: "^v);
let comments = read_comments s in
+3 -3
View File
@@ -68,7 +68,7 @@ let modules_dir = paparazzi_conf // "modules"
let autopilot_dir = paparazzi_conf // "autopilot"
(** remove all duplicated elements of a list *)
let singletonize = fun ?(compare = Pervasives.compare) l ->
let singletonize = fun ?(compare = compare) l ->
let rec loop = fun l ->
match l with
| [] | [_] -> l
@@ -93,8 +93,8 @@ let targets_of_field =
let pipe = Str.regexp "|" in
fun field default ->
let f = ExtXml.attrib_or_default field "target" default in
if Compat.bytes_length f > 0 && Compat.bytes_get f 0 = '!' then
Not (expr_of_targets (fun x y -> Or(x,y)) (Str.split pipe (Compat.bytes_sub f 1 ((Compat.bytes_length f) - 1))))
if String.length f > 0 && String.get f 0 = '!' then
Not (expr_of_targets (fun x y -> Or(x,y)) (Str.split pipe (String.sub f 1 ((String.length f) - 1))))
else
expr_of_targets (fun x y -> Or(x,y)) (Str.split pipe f)
+15 -14
View File
@@ -132,7 +132,7 @@ let tile_of_key = fun keyholeStr ->
and lat = ref (-1.)
and latLonSize = ref 2. in
for i = 1 to Compat.bytes_length keyholeStr - 1 do
for i = 1 to String.length keyholeStr - 1 do
latLonSize /.= 2.;
match keyholeStr.[i] with
@@ -149,14 +149,14 @@ let tile_of_key = fun keyholeStr ->
let is_prefix = fun a b ->
Compat.bytes_length b >= Compat.bytes_length a &&
a = Compat.bytes_sub b 0 (Compat.bytes_length a)
String.length b >= String.length a &&
a = String.sub b 0 (String.length a)
(** Get the tile or one which contains it from the cache *)
let get_from_cache = fun dir f ->
let files = Sys.readdir dir in
(* sort files to have the longest names first *)
Array.sort (fun a b -> Compat.bytes_length b - Compat.bytes_length a) files;
Array.sort (fun a b -> String.length b - String.length a) files;
let rec loop = fun i ->
if i < Array.length files then
let fi = files.(i) in
@@ -173,11 +173,11 @@ let get_from_cache = fun dir f ->
(** Get the tile or one which contains it from the a hash table *)
let get_from_hashtbl = fun tbl key ->
let l = Compat.bytes_length key in
let l = String.length key in
let rec loop = fun i ->
if i = 0 then raise Not_found;
try
let subkey = Compat.bytes_sub key 0 i in
let subkey = String.sub key 0 i in
let file = Hashtbl.find tbl subkey in
(tile_of_key subkey, file)
with _ -> loop (i-1)
@@ -189,7 +189,7 @@ let get_from_hashtbl = fun tbl key ->
let xyz_of_qsrt = fun s ->
let x = ref 0
and y = ref 0
and n = Compat.bytes_length s in
and n = String.length s in
for i = 1 to n - 1 do (* Skip the first t *)
x := !x * 2;
y := !y * 2;
@@ -203,11 +203,11 @@ let xyz_of_qsrt = fun s ->
(!x, !y, n-1)
let ms_key = fun key ->
let n = Compat.bytes_length key in
let n = String.length key in
if n = 1 then invalid_arg "Gm.ms_key";
let ms_key = Compat.bytes_create (n-1) in
let ms_key = Bytes.create (n-1) in
for i = 1 to n - 1 do
Compat.bytes_set ms_key (i-1)
Bytes.set ms_key (i-1)
(match key.[i] with
'q' -> '0'
| 'r' -> '1'
@@ -215,7 +215,8 @@ let ms_key = fun key ->
| 't' -> '2'
| _ -> invalid_arg "Gm.ms_key")
done;
(ms_key, ms_key.[n-2])
let s = Bytes.to_string ms_key in
(s, s.[n-2])
let google_version = Maps_support.google_version
@@ -258,7 +259,7 @@ let set_policy = fun p ->
let get_policy = fun () ->
!policy
let remove_last_char = fun s -> Compat.bytes_sub s 0 (Compat.bytes_length s - 1)
let remove_last_char = fun s -> String.sub s 0 (String.length s - 1)
type hashtbl_cache = (string, string) Hashtbl.t
@@ -278,7 +279,7 @@ let get_image = fun ?tbl key ->
let cache_dir = get_cache_dir !maps_source in
mkdir cache_dir;
let rec get_from_http = fun k ->
if Compat.bytes_length k >= 1 then
if String.length k >= 1 then
let url = url_of_tile_key !maps_source k in
let jpg_file = cache_dir // (k ^ ".jpg") in
try
@@ -302,7 +303,7 @@ let get_image = fun ?tbl key ->
| Some ht -> get_from_hashtbl ht key
in
(* if not exact match from cache, try http if CacheOrHttp policy *)
if !policy = CacheOrHttp && (Compat.bytes_length t.key < Compat.bytes_length key) then
if !policy = CacheOrHttp && (String.length t.key < String.length key) then
try get_from_http key with _ -> (t, f)
else (t, f)
with
+3 -3
View File
@@ -149,7 +149,7 @@ let tree_values = fun ?(only_checked=true) (tree : tree) ->
store#foreach (fun _ row ->
let v = store#get ~row ~column:name
and c = store#get ~row ~column:check in
let space = if Compat.bytes_length !values > 0 then " " else "" in
let space = if String.length !values > 0 then " " else "" in
let v =
if c then v else
if only_checked then ""
@@ -172,9 +172,9 @@ let get_selected_in_tree = fun (tree : tree) ->
let add_to_tree = fun ?(force_unselect=false) (tree : tree) string ->
let (store, name, check, _) = tree_model tree in
let row = store#append () in
let l = Compat.bytes_length string in
let l = String.length string in
let checked = not (string.[0] = '[' && string.[l - 1] = ']') in
let string = if not checked then Compat.bytes_sub string 1 (l - 2) else string in
let string = if not checked then String.sub string 1 (l - 2) else string in
store#set ~row ~column:check (checked && not force_unselect);
store#set ~row ~column:name string
+3 -11
View File
@@ -2,17 +2,13 @@ exception Failure of string
exception Not_Found of string
exception Blocked of string
IFDEF NETCLIENT_V_4 THEN
module H = Nethttp_client
let () =
Nettls_gnutls.init()
ELSE
module H = Http_client
END
let file_of_url = fun ?dest url ->
if Compat.bytes_sub url 0 7 = "file://" then
Compat.bytes_sub url 7 (Compat.bytes_length url - 7)
if String.sub url 0 7 = "file://" then
String.sub url 7 (String.length url - 7)
else
let tmp_file =
match dest with
@@ -21,11 +17,7 @@ let file_of_url = fun ?dest url ->
let call = new H.get url in
call#set_response_body_storage (`File (fun () -> tmp_file));
let pipeline = new H.pipeline in
IFDEF NETCLIENT_V_404 THEN
pipeline # set_proxy_from_environment (~insecure:false) ()
ELSE
pipeline # set_proxy_from_environment ()
END;
pipeline # set_proxy_from_environment ~insecure:false ();
pipeline # add call;
pipeline # run ();
match call#status with
+8 -8
View File
@@ -49,7 +49,7 @@ let char_of = function
let mem_tile = fun tile_key ->
let rec loop = fun i tree ->
tree = Tile ||
i < Compat.bytes_length tile_key &&
i < String.length tile_key &&
match tree with
Empty -> false
| Tile -> true
@@ -59,7 +59,7 @@ let mem_tile = fun tile_key ->
(** Adding a tile to the store *)
let add_tile = fun tile_key ->
let rec loop = fun i tree j ->
if i < Compat.bytes_length tile_key then
if i < String.length tile_key then
match tree.(j) with
Empty ->
let sons = Array.make 4 Empty in
@@ -104,7 +104,7 @@ let display_tile = fun (geomap:MapCanvas.widget) wgs84 level ->
let key = desired_tile.Gm.key in
if not (mem_tile key) then
let (tile, jpg_file) = Gm.get_image key in
display_the_tile geomap tile jpg_file (Compat.bytes_length tile.Gm.key)
display_the_tile geomap tile jpg_file (String.length tile.Gm.key)
exception New_displayed of int
@@ -139,16 +139,16 @@ let fill_window = fun (geomap:MapCanvas.widget) zoomlevel ->
| Empty ->
if zoom = 1 then
let tile, image = Gm.get_image ~tbl key in
let level = Compat.bytes_length tile.Gm.key in
let level = String.length tile.Gm.key in
display_the_tile geomap tile image level;
raise (New_displayed (zoomlevel+1-Compat.bytes_length tile.Gm.key))
raise (New_displayed (zoomlevel+1-String.length tile.Gm.key))
else begin
trees.(i) <- Node (Array.make 4 Empty);
loop twest tsouth tsize trees i zoom key
end
| Node sons ->
let continue = fun j tw ts ->
loop tw ts tsize2 sons j (zoom-1) (key^Compat.bytes_make 1 (char_of j)) in
loop tw ts tsize2 sons j (zoom-1) (key^String.make 1 (char_of j)) in
continue 0 twest (tsouth+.tsize2);
continue 1 (twest+.tsize2) (tsouth+.tsize2);
@@ -196,10 +196,10 @@ let pixbuf = fun sw ne zoomlevel->
if zoom = 1
then
let tile, image = Gm.get_image key in
raise (To_copy (zoomlevel+1-Compat.bytes_length tile.Gm.key, image))
raise (To_copy (zoomlevel+1-String.length tile.Gm.key, image))
else begin
let continue = fun j tw ts ->
loop tw ts tsize2 (zoom-1) (key^Compat.bytes_make 1 (char_of j)) in
loop tw ts tsize2 (zoom-1) (key^String.make 1 (char_of j)) in
continue 0 twest (tsouth+.tsize2);
continue 1 (twest+.tsize2) (tsouth+.tsize2);
continue 2 (twest+.tsize2) tsouth;
+1 -1
View File
@@ -30,7 +30,7 @@ let open_compress file =
Unix.open_process_in ("gunzip -c "^file)
else if Filename.check_suffix file "bz2" then
Unix.open_process_in ("bunzip2 -c "^file)
else Pervasives.open_in file
else open_in file
let extensions = ["";".gz";".Z";".bz2";".zip";".ZIP"]
+4 -4
View File
@@ -28,12 +28,12 @@ let current_os = ref "not_set"
let read_process_output command =
let buffer_size = 2048 in
let buffer = Buffer.create buffer_size in
let string = Compat.bytes_create buffer_size in
let bytes_ = Bytes.create buffer_size in
let in_channel = Unix.open_process_in command in
let chars_read = ref 1 in
while !chars_read <> 0 do
chars_read := input in_channel string 0 buffer_size;
Buffer.add_substring buffer string 0 !chars_read
chars_read := input in_channel bytes_ 0 buffer_size;
Buffer.add_substring buffer (Bytes.to_string bytes_) 0 !chars_read
done;
ignore (Unix.close_process_in in_channel);
try Buffer.sub buffer 0 ((Buffer.length buffer) - 1)
@@ -43,7 +43,7 @@ let contains s substring =
try ignore (Str.search_forward (Str.regexp_string substring) s 0); true
with Not_found -> false
let os_name = Compat.bytes_copy (
let os_name = (
if contains !current_os "not_set" then (
current_os := read_process_output "uname" );
!current_os
+4 -4
View File
@@ -127,7 +127,7 @@ class canvas_ruler = fun ?(config=[]) canvas_group x y ->
List.iter (fun i -> i#destroy ()) r#get_items;
let v = truncate value / step in
let k = truncate (h /. point_per_unit) / step in
for i = Pervasives.max 0 (v - k) to (v + k) do
for i = max 0 (v - k) to (v + k) do
draw i value
done
in
@@ -160,7 +160,7 @@ class canvas_gauge = fun ?(config=[]) canvas_group x y ->
let size = PC.get_prop "size" config "50." in
(*let text_props = [`ANCHOR `CENTER; `FILL_COLOR "white"] in*)
let r1 = Pervasives.max 10. ((float_of_string size) /. 2.) in
let r1 = max 10. ((float_of_string size) /. 2.) in
let r2 = r1 +. 3. in
let r3 = 3.5 in
let max_rot = 2. *. Latlong.pi /. 3. in
@@ -247,7 +247,7 @@ class canvas_led = fun ?(config=[]) canvas_group x y ->
let root = GnoCanvas.group ~x ~y canvas_group in
let r = (Pervasives.max 2. (size /. 2.)) +. 1. in
let r = (max 2. (size /. 2.)) +. 1. in
let led = GnoCanvas.ellipse ~x1:r ~y1:r ~x2:(-.r) ~y2:(-.r)
~props:[`NO_FILL_COLOR; `OUTLINE_COLOR "grey"; `WIDTH_UNITS 2.] root in
@@ -290,7 +290,7 @@ object
(* Led drawer *)
if inv (value = test_value) then led#set [`FILL_COLOR "red"]
else led#set [`FILL_COLOR "#00ff00"];
let r = (Pervasives.max 2. (size /. 2.)) +. 1. in
let r = (max 2. (size /. 2.)) +. 1. in
led#set [`X1 r; `Y1 r; `X2 (-.r); `Y2 (-.r)];
led_text#set [`TEXT text; `SIZE_POINTS size; `X (-.r-.3.)]
+3 -3
View File
@@ -94,11 +94,11 @@ type 'a closure = Closure of 'a
(*let buffer_len = 256 *)
let buffer_len = 2048
let input = fun ?(read = Unix.read) f ->
let buffer = Compat.bytes_create buffer_len
let buffer = Bytes.create buffer_len
and index = ref 0 in
let wait = fun start n ->
Compat.bytes_blit buffer start buffer 0 n;
Bytes.blit buffer start buffer 0 n;
index := n in
Closure (fun fd ->
@@ -109,7 +109,7 @@ let input = fun ?(read = Unix.read) f ->
Debug.call 'T' (fun f -> fprintf f "input: %d %d\n" !index n);
let rec parse = fun start n ->
Debug.call 'T' (fun f -> fprintf f "input parse: %d %d\n" start n);
let nb_used = f (Compat.bytes_sub buffer start n) in
let nb_used = f (Bytes.sub buffer start n) in
(* Printf.fprintf stderr "n'=%d\n" nb_used; flush stderr; *)
if nb_used > 0 then
parse (start + nb_used) (n - nb_used)
+2 -2
View File
@@ -56,8 +56,8 @@ val set_dtr : Unix.file_descr -> bool -> unit
val set_speed : Unix.file_descr -> speed -> unit
val input :
?read:(Unix.file_descr -> string -> int -> int -> int) ->
(string -> int) -> (Unix.file_descr -> unit) closure
?read:(Unix.file_descr -> bytes -> int -> int -> int) ->
(bytes -> int) -> (Unix.file_descr -> unit) closure
(** Buffered input. [input ?read f] Returns a closure which must be called when
characters are available on the stream. These characters are stored in a
a buffer. [f] is then called on the buffer. [f] must return the number
+2 -2
View File
@@ -57,7 +57,7 @@ let find = fun tile ->
try
let f = open_compressed (tile_name ^".hgt") in
let n = tile_size*tile_size*2 in
let buf = Compat.bytes_create n in
let buf = Bytes.create n in
really_input f buf 0 n;
Hashtbl.add htiles tile buf;
buf
@@ -68,7 +68,7 @@ let find = fun tile ->
let get = fun tile y x ->
let tile = find tile in
let pos = (2*((tile_size-y)*tile_size+x)) in
(((Char.code tile.[pos] land 127) lsl 8) lor Char.code tile.[pos+1]) - ((Char.code tile.[pos] lsr 7) * 256 * 128)
(((Char.code (Bytes.get tile pos) land 127) lsl 8) lor Char.code (Bytes.get tile (pos+1))) - ((Char.code (Bytes.get tile pos) lsr 7) * 256 * 128)
let of_wgs84 = fun geo ->
let lat = (Rad>>Deg)geo.posn_lat
+34 -33
View File
@@ -33,8 +33,8 @@ module UbxProtocol = struct
let offset_length=4
let index_start = fun buf ->
let rec loop = fun i ->
let i' = Compat.bytes_index_from buf i sync1 in
if Compat.bytes_length buf > i'+1 && buf.[i'+1] = sync2 then
let i' = String.index_from buf i sync1 in
if String.length buf > i'+1 && buf.[i'+1] = sync2 then
i'
else
loop (i'+1) in
@@ -44,20 +44,20 @@ module UbxProtocol = struct
Char.code buf.[start+5] lsl 8 + Char.code buf.[start+4] + 4
let length = fun buf start ->
let len = Compat.bytes_length buf - start in
let len = String.length buf - start in
if len >= offset_length+2 then
payload_length buf start + 4
else
raise Protocol.Not_enough
let payload = fun buf ->
Protocol.payload_of_string (Compat.bytes_sub buf offset_payload (payload_length buf 0))
Protocol.payload_of_string (String.sub buf offset_payload (payload_length buf 0))
let uint8_t = fun x -> x land 0xff
let (+=) = fun r x -> r := uint8_t (!r + x)
let compute_checksum = fun buf ->
let ck_a = ref 0 and ck_b = ref 0 in
let l = Compat.bytes_length buf in
let l = String.length buf in
for i = offset_payload to l - 1 - 4 do
ck_a += Char.code buf.[i];
ck_b += !ck_a
@@ -70,17 +70,17 @@ module UbxProtocol = struct
ck_a = Char.code buf.[offset_payload+l+1] && ck_b = Char.code buf.[offset_payload+l+2]
let packet = fun payload ->
let payload = Protocol.string_of_payload payload in
let n = Compat.bytes_length payload in
let payload = Protocol.bytes_of_payload payload in
let n = Bytes.length payload in
let msg_length = n + 4 in
let m = Compat.bytes_create msg_length in
Compat.bytes_set m 0 sync1;
Compat.bytes_set m 1 sync2;
Compat.bytes_blit payload 0 m 2 n;
let (ck_a, ck_b) = compute_checksum m in
Compat.bytes_set m (msg_length-2) (Char.chr ck_a);
Compat.bytes_set m (msg_length-1) (Char.chr ck_b);
m
let m = Bytes.create msg_length in
Bytes.set m 0 sync1;
Bytes.set m 1 sync2;
Bytes.blit payload 0 m 2 n;
let (ck_a, ck_b) = compute_checksum (Bytes.to_string m) in
Bytes.set m (msg_length-2) (Char.chr ck_a);
Bytes.set m (msg_length-1) (Char.chr ck_b);
Bytes.to_string m
end
type class_id = int
@@ -135,7 +135,7 @@ type message_spec = Xml.xml
let ubx_payload = fun msg_xml values ->
let n = int_of_string (ExtXml.attrib msg_xml "length") in
let p = Compat.bytes_make n '#' in
let p = Bytes.make n '#' in
let fields = Xml.children msg_xml in
List.iter
(fun (label, value) ->
@@ -148,23 +148,23 @@ let ubx_payload = fun msg_xml values ->
match fmt with
| "U1" ->
assert(value >= 0 && value < 0x100);
Compat.bytes_set p (pos) (byte value)
Bytes.set p (pos) (byte value)
| "I1" ->
assert(value >= -0x80 && value <= 0x80);
Compat.bytes_set p pos (byte value)
Bytes.set p pos (byte value)
| "I4" | "U4" ->
assert(fmt <> "U4" || value >= 0);
Compat.bytes_set p (pos+3) (byte (value asr 24));
Compat.bytes_set p (pos+2) (byte (value lsr 16));
Compat.bytes_set p (pos+1) (byte (value lsr 8));
Compat.bytes_set p (pos+0) (byte value)
Bytes.set p (pos+3) (byte (value asr 24));
Bytes.set p (pos+2) (byte (value lsr 16));
Bytes.set p (pos+1) (byte (value lsr 8));
Bytes.set p (pos+0) (byte value)
| "U2" | "I2" ->
Compat.bytes_set p (pos+1) (byte (value lsr 8));
Compat.bytes_set p (pos+0) (byte value)
Bytes.set p (pos+1) (byte (value lsr 8));
Bytes.set p (pos+0) (byte value)
| _ -> failwith (Printf.sprintf "Ubx.make_payload: unknown format '%s'" fmt)
)
values;
p
Bytes.to_string p
let message = fun class_name msg_name ->
let _class = ubx_get_class class_name in
@@ -177,13 +177,14 @@ let message = fun class_name msg_name ->
let payload = fun class_name msg_name values ->
let class_id, msg_id, msg = message class_name msg_name in
let u_payload = ubx_payload msg values in
let n = Compat.bytes_length u_payload in
let n = String.length u_payload in
(** Just add CLASS_ID, MSG_ID and LENGTH(2) to the ubx payload *)
let m = Compat.bytes_create (n+4) in
Compat.bytes_set m 0 (Char.chr class_id);
Compat.bytes_set m 1 (Char.chr msg_id);
Compat.bytes_set m 2 (Char.chr (n land 0xff));
Compat.bytes_set m 3 (Char.chr ((n land 0xff00) lsr 8));
Compat.bytes_blit u_payload 0 m 4 n;
Protocol.payload_of_string m
let m = Bytes.create (n+4) in
Bytes.set m 0 (Char.chr class_id);
Bytes.set m 1 (Char.chr msg_id);
Bytes.set m 2 (Char.chr (n land 0xff));
Bytes.set m 3 (Char.chr ((n land 0xff00) lsr 8));
Bytes.blit_string u_payload 0 m 4 n;
Protocol.payload_of_bytes m
+6 -6
View File
@@ -105,7 +105,7 @@ let string_of_attribs = fun attribs ->
match attribs with
["PCData", data] -> data
| _ ->
Compat.bytes_concat " " (List.map (fun (a,v) -> sprintf "%s=\"%s\"" a v) attribs)
String.concat " " (List.map (fun (a,v) -> sprintf "%s=\"%s\"" a v) attribs)
type id = int
let gen_id =
@@ -132,18 +132,18 @@ let encode_crs =
*)
let recode_crs = fun s ->
let n = Compat.bytes_length s in
let s' = Compat.bytes_create n in
let n = String.length s in
let s' = Bytes.create n in
let i = ref 0 and j = ref 0 in
while !i < n do
if !i < n-1 && s.[!i] == '\\' && s.[!i+1] == 'n' then begin
Compat.bytes_set s' (!j) '\n';
Bytes.set s' (!j) '\n';
incr i
end else
Compat.bytes_set s' (!j) s.[!i];
Bytes.set s' (!j) s.[!i];
incr i; incr j
done;
Compat.bytes_sub s' 0 !j
Bytes.to_string (Bytes.sub s' 0 !j)
+2 -2
View File
@@ -352,7 +352,7 @@ class plot = fun ~width ~height ~packing () ->
let tick = tick_min +. float i *. u in
let y = scale_y tick in
if y < height - bottom_margin then
let s = Printf.sprintf "%.*f" (Pervasives.max 0 (2-truncate scale)) tick in
let s = Printf.sprintf "%.*f" (max 0 (2-truncate scale)) tick in
let (w, h) = renderer#create_text s in
renderer#put_text (left_margin-margin-w) (y-h/2);
@@ -366,7 +366,7 @@ class plot = fun ~width ~height ~packing () ->
let tick = tick_min +. float i *. u in
let x = scale_x tick in
if left_margin < x && x < width then
let s = Printf.sprintf "%.*f" (Pervasives.max 0 (2-truncate scale)) tick in
let s = Printf.sprintf "%.*f" (max 0 (2-truncate scale)) tick in
let (w, h) = renderer#create_text s in
let y = y-margin-h in
renderer#put_text (x-w/2) y;
+11 -9
View File
@@ -25,11 +25,13 @@
open Printf
let (//) = Filename.concat
let minimum = min
let maximum = max
(* Fixme: find something more basic than adjustment *)
let set_float_value = fun (a:GData.adjustment) v ->
let lower = Pervasives.min a#lower v
and upper = Pervasives.max a#upper v +. a#step_increment in
let lower = minimum a#lower v
and upper = maximum a#upper v +. a#step_increment in
a#set_bounds ~lower ~upper ();
a#set_value v
@@ -136,7 +138,7 @@ class plot = fun ~size ~update_time ~width ~height ~packing () ->
if new_size <> size && new_size > 0 then begin
Hashtbl.iter (fun _ a ->
let new_array = Array.make new_size None in
for i = 0 to Pervasives.min size new_size - 1 do
for i = 0 to minimum size new_size - 1 do
new_array.(new_size - 1 - i) <- a.array.((a.index-i+size) mod size)
done;
a.array <- new_array;
@@ -166,8 +168,8 @@ class plot = fun ~size ~update_time ~width ~height ~packing () ->
let a = Hashtbl.find curves name in
a.array.(a.index) <- Some v;
if auto_scale then begin
min <- Pervasives.min min v;
max <- Pervasives.max max v
min <- minimum min v;
max <- maximum max v
end
method reset_scale = fun () ->
@@ -179,8 +181,8 @@ class plot = fun ~size ~update_time ~width ~height ~packing () ->
(function
None -> ()
| Some v ->
min <- Pervasives.min min v;
max <- Pervasives.max max v)
min <- minimum min v;
max <- maximum max v)
a.array)
curves
@@ -203,7 +205,7 @@ class plot = fun ~size ~update_time ~width ~height ~packing () ->
let dr = pm#get_pixmap () in
dr#set_foreground (`NAME "white");
dr#rectangle ~x:0 ~y:0 ~width ~height ~filled:true ();
let margin = Pervasives.min (height / 10) 20 in
let margin = minimum (height / 10) 20 in
(* Time Graduations *)
let context = da#misc#create_pango_context in
@@ -242,7 +244,7 @@ class plot = fun ~size ~update_time ~width ~height ~packing () ->
let tick_min = min -. mod_float min u in
for i = 0 to truncate (delta/.u) + 1 do
let tick = tick_min +. float i *. u in
f 0 (y tick) (Printf.sprintf "%.*f" (Pervasives.max 0 (2-truncate scale)) tick)
f 0 (y tick) (Printf.sprintf "%.*f" (maximum 0 (2-truncate scale)) tick)
done;
(* Constants *)
+8 -8
View File
@@ -83,20 +83,20 @@ let string_of_message = fun log_msg ->
| 1 -> Dl_Pprz.string_of_message
| x -> failwith (sprintf "Unexpected source:%d in log msg" x)
let hex_of_array = function
(*let hex_of_array = function
| PprzLink.Array array ->
let n = Array.length array in
(* One integer -> 2 chars *)
let s = Compat.bytes_create (2*n) in
let s = Bytes.create (2*n) in
Array.iteri
(fun i dec ->
let hex = sprintf "%02x" (PprzLink.int_of_value array.(i)) in
Compat.bytes_blit hex 0 s (2*i) 2)
String.blit hex 0 s (2*i) 2)
array;
s
| value ->
failwith (sprintf "Error: expecting array, found %s" (PprzLink.string_of_value value))
*)
let xml_parse_compressed_file = fun file ->
Xml.parse_in (Ocaml_tools.open_compress file)
@@ -111,8 +111,8 @@ let search_conf = fun md5 ->
let files = Sys.readdir dir in
let rec loop = fun i ->
if i < Array.length files then begin
if Compat.bytes_length files.(i) > (md5_ofs + md5_len)
&& Compat.bytes_sub files.(i) md5_ofs md5_len = md5 then
if String.length files.(i) > (md5_ofs + md5_len)
&& String.sub files.(i) md5_ofs md5_len = md5 then
dir // files.(i)
else
loop (i+1)
@@ -165,12 +165,12 @@ let convert_file = fun ?(output_dir=None) file ->
let unix_time = Latlong.unix_time_of_tow ~week itow in
start_unix_time := Some (unix_time -. timestamp)
| "ALIVE" when !md5 = "" ->
md5 := hex_of_array (PprzLink.assoc "md5sum" vs)
md5 := PprzLink.hex_of_int_array (PprzLink.assoc "md5sum" vs)
| _ -> ()
with _ -> fprintf stderr "Parsing error, skipping message\n"
in
let parser = Parser.parse use_payload in
let parser = fun b -> Parser.parse use_payload (Bytes.to_string b) in
let Serial.Closure reader = Serial.input parser in
try
+4 -4
View File
@@ -68,10 +68,10 @@ let send_on_ivy = fun () ->
ys := sprintf "%.6f" ((Rad>>Deg)wgs84.posn_long) :: !ys;
vs := sprintf "%d" plume.value :: !vs)
plumes ;
let ids = Compat.bytes_concat "," !ids
and xs = Compat.bytes_concat "," !xs
and ys = Compat.bytes_concat "," !ys
and vs = Compat.bytes_concat "," !vs in
let ids = Bytes.concat "," !ids
and xs = Bytes.concat "," !xs
and ys = Bytes.concat "," !ys
and vs = Bytes.concat "," !vs in
Ground_Pprz.message_send my_id "PLUMES"
[ "ids", PprzLink.String ids;
"lats", PprzLink.String xs;
+4 -4
View File
@@ -76,7 +76,7 @@ module type AIRCRAFT_ITL =
functor (A : Data.MISSION) -> functor (FM: FlightModel.SIG) -> AIRCRAFT
external fg_sizeof : unit -> int = "fg_sizeof"
external fg_msg : string -> float -> float -> float -> float -> float -> float -> unit = "fg_msg_bytecode" "fg_msg_native"
external fg_msg : bytes -> float -> float -> float -> float -> float -> float -> unit = "fg_msg_bytecode" "fg_msg_native"
let ac_name = ref "A/C not set"
@@ -240,9 +240,9 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct
(* and theta_ = s.Gps.course *)
and (phi, theta, psi) = FlightModel.get_attitude !state in
fg_msg buffer lat lon alt phi theta psi;
(** for i = 0 to Compat.bytes_length buffer - 1 do fprintf stderr "%x " (Char.code buffer.[i]) done; fprintf stderr "\n"; **)
(** for i = 0 to Bytes.length buffer - 1 do fprintf stderr "%x " (Char.code buffer.[i]) done; fprintf stderr "\n"; **)
try
ignore (Unix.sendto socket buffer 0 (Compat.bytes_length buffer) [] sockaddr)
ignore (Unix.sendto socket buffer 0 (Bytes.length buffer) [] sockaddr)
with
Unix.Unix_error (e,f,a) -> Printf.fprintf stderr "Error sending to FlightGear: %s (%s(%s))\n" (Unix.error_message e) f a; flush stderr
in
@@ -275,7 +275,7 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct
let inet_addr = Unix.inet_addr_of_string !fg_client in
let socket = Unix.socket Unix.PF_INET Unix.SOCK_DGRAM 0 in
(* Unix.connect socket (Unix.ADDR_INET (inet_addr, 5501)); *)
let buffer = Compat.bytes_create (fg_sizeof ()) in
let buffer = Bytes.create (fg_sizeof ()) in
let sockaddr = (Unix.ADDR_INET (inet_addr, 5501)) in
Stdlib.timer ~scale:time_scale fg_period (fg_task socket buffer sockaddr);
fprintf stdout "Sending to FlightGear at %s\n" !fg_client; flush stdout
+8 -8
View File
@@ -44,12 +44,12 @@ let run_and_log = fun log exit_cb com ->
let channel_out_fd = Unix.descr_of_in_channel com_stdout in
let channel_out = GMain.Io.channel_of_descr channel_out_fd in
let cb = fun _ ->
let buf = Compat.bytes_create buf_size in
let buf = Bytes.create buf_size in
(* loop until input returns zero *)
let rec log_input = fun out ->
let n = input out buf 0 buf_size in
(* split on beginning of new line *)
let s = Str.split (Str.regexp "^") (Compat.bytes_sub buf 0 n) in
let s = Str.split (Str.regexp "^") (Bytes.to_string (Bytes.sub buf 0 n)) in
List.iter (fun l -> log l) s;
if n = buf_size then (log_input out) + n else n
in
@@ -61,18 +61,18 @@ let run_and_log = fun log exit_cb com ->
pid, channel_out, com_stdout, io_watch_out
let strip_prefix = fun dir file subdir ->
let n = Compat.bytes_length dir in
if not (Compat.bytes_length file > n && Compat.bytes_sub file 0 n = dir) then begin
let n = String.length dir in
if not (String.length file > n && String.sub file 0 n = dir) then begin
let home = Env.paparazzi_home in
let nn = Compat.bytes_length home in
if (Compat.bytes_length file > nn && Compat.bytes_sub file 0 nn = home) then begin
".." // Compat.bytes_sub file (nn+1) (Compat.bytes_length file - nn -1)
let nn = String.length home in
if (String.length file > nn && String.sub file 0 nn = home) then begin
".." // String.sub file (nn+1) (String.length file - nn -1)
end else
let msg = sprintf "Selected file '%s' should be in '%s'" file dir in
GToolbox.message_box ~title:"Error" msg;
raise Exit
end else
subdir // Compat.bytes_sub file (n+1) (Compat.bytes_length file - n - 1)
subdir // String.sub file (n+1) (String.length file - n - 1)
let choose_xml_file = fun ?(multiple = false) title subdir cb ->

Some files were not shown because too many files have changed in this diff Show More