From eed2bb82eb4b97881f155079fd457a8de75bdba5 Mon Sep 17 00:00:00 2001 From: glondu Date: Thu, 6 Jan 2011 11:48:50 +0000 Subject: Remove Safe_marshal Safe_marshal was using intermediate strings that are subject to Sys.max_string_length limitation. Use directly binary channel-oriented functions instead. This is a fix for bug #2471. Remark: this might reduce robustness w.r.t. noise in the communication channel. AFAIK, the original purpose of Safe_marshal was to work around a bug on Windows... this should be investigated further. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13765 85f007b7-540e-0410-9357-904b9bb8a0f7 --- lib/lib.mllib | 1 - lib/safe_marshal.ml | 46 ---------------------------------------------- 2 files changed, 47 deletions(-) delete mode 100644 lib/safe_marshal.ml (limited to 'lib') diff --git a/lib/lib.mllib b/lib/lib.mllib index 0607ae50e6..90b90cb4f3 100644 --- a/lib/lib.mllib +++ b/lib/lib.mllib @@ -23,4 +23,3 @@ Heap Option Dnet Store -Safe_marshal diff --git a/lib/safe_marshal.ml b/lib/safe_marshal.ml deleted file mode 100644 index 4d32245f59..0000000000 --- a/lib/safe_marshal.ml +++ /dev/null @@ -1,46 +0,0 @@ -(************************************************************************) -(* v * The Coq Proof Assistant / The Coq Development Team *) -(* [] - | s -> String.sub s 0 3 :: (rem (String.sub s 3 (String.length (s - 3)))) in - let chunks = y chop norm_s in - *) - -let hobcnv = Array.init 256 (fun i -> Printf.sprintf "%.2x" i) -let bohcnv = Array.init 256 (fun i -> i - - (if 0x30 <= i then 0x30 else 0) - - (if 0x41 <= i then 0x7 else 0) - - (if 0x61 <= i then 0x20 else 0)) - -let hex_of_bin ch = hobcnv.(int_of_char ch) -let bin_of_hex s = char_of_int (bohcnv.(int_of_char s.[0]) * 16 + bohcnv.(int_of_char s.[1])) - -let send cout expr = - let mshl_expr = Marshal.to_string expr [] in - let payload = Buffer.create (String.length mshl_expr * 2) in - String.iter (fun c -> Buffer.add_string payload (hex_of_bin c)) mshl_expr; - Buffer.add_char payload '\n'; - output_string cout (Buffer.contents payload); - flush cout - - -let receive cin = - let payload = input_line cin in - let mshl_expr_len = String.length payload / 2 in - let mshl_expr = Buffer.create mshl_expr_len in - let buf = String.create 2 in - for i = 0 to mshl_expr_len - 1 do - String.blit payload (2*i) buf 0 2; - Buffer.add_char mshl_expr (bin_of_hex buf) - done; - Marshal.from_string (Buffer.contents mshl_expr) 0 - -- cgit v1.2.3