From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA30668; Wed, 26 Feb 2003 09:34:02 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA30680 for ; Wed, 26 Feb 2003 09:34:01 +0100 (MET) Received: from rwcrmhc52.attbi.com (rwcrmhc52.attbi.com [216.148.227.88]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h1Q8Y0H12691 for ; Wed, 26 Feb 2003 09:34:01 +0100 (MET) Received: from 1969.ws (c-24-130-113-221.we.client2.attbi.com[24.130.113.221]) by rwcrmhc52.attbi.com (rwcrmhc52) with SMTP id <200302260833580520094a8le>; Wed, 26 Feb 2003 08:33:59 +0000 Message-ID: <3E5C7B82.909@1969.ws> Date: Wed, 26 Feb 2003 00:32:02 -0800 From: Karl Zilles User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr, cuihtlauac.alvarado@francetelecom.com, mattias.waldau@abc.se Subject: [Caml-list] vi fixes patch to otags 3.06.6 Content-Type: multipart/mixed; boundary="------------000506030501000708060602" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk This is a multi-part message in MIME format. --------------000506030501000708060602 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hello, I'm posting this to the caml list, otags author, and Mattias who had a post last November about otags not working under Cygwin. Some fixes to the vi handling in otags 3.06.6: 1) Tabs and quotes no longer get mauled. Backslashes are escaped by String.escaped, so they don't need to be escaped later. 2) Works correctly on Windows with Cygwin. Now loads files in binary mode so that line starts match the positions being passed. Fixes: Fatal error: exception Invalid_argument("String.sub") 3) Works correcty on Windows style CR/LF formatted files under either unix or windows. Tested under Cygwin. Reasonably sure my changes should work under unix. :) Thank you, Karl --------------000506030501000708060602 Content-Type: text/plain; name="otags.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="otags.patch" --- otags-3.06.6.original/vi.ml 2003-02-26 00:12:40.000000000 -0800 +++ otags-3.06.6/vi.ml 2003-02-26 00:25:12.000000000 -0800 @@ -7,7 +7,7 @@ let sized_string_of_file f taille = let buf = String.create taille in - let cin = open_in f in + let cin = open_in_bin f in let rec loop lus0 t0 = let n = input cin buf lus0 t0 in let lus = lus0 + n in let t = t0 - n in @@ -62,7 +62,7 @@ let buffer = Buffer.create (String.length part_es) in String.iter (fun c -> match c with - | '$' | '/' | '\\' -> + | '$' | '/' -> Buffer.add_char buffer '\\'; Buffer.add_char buffer c | _ -> Buffer.add_char buffer c) @@ -79,9 +79,13 @@ | [] -> lcur,scur | (entry, pos, last) :: rest -> let line_beg, _ = Line.of_pos pos in - let len = + let pos_cr = (try String.index_from fs line_beg '\n' - with Not_found -> String.length fs) - line_beg in + with Not_found -> String.length fs) in + let pos_lf = + (try String.index_from fs line_beg '\r' + with Not_found -> String.length fs) in + let len = (min pos_cr pos_lf) - line_beg in let fl, n = line filename entry (String.sub fs line_beg len) in loop (fl :: lcur) (n + scur) rest in --------------000506030501000708060602-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners