caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Karl Zilles <zilles@1969.ws>
To: caml-list@inria.fr, cuihtlauac.alvarado@francetelecom.com,
	mattias.waldau@abc.se
Subject: [Caml-list] vi fixes patch to otags 3.06.6
Date: Wed, 26 Feb 2003 00:32:02 -0800	[thread overview]
Message-ID: <3E5C7B82.909@1969.ws> (raw)

[-- Attachment #1: Type: text/plain, Size: 691 bytes --]

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




[-- Attachment #2: otags.patch --]
[-- Type: text/plain, Size: 1434 bytes --]

--- 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 

                 reply	other threads:[~2003-02-26  8:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E5C7B82.909@1969.ws \
    --to=zilles@1969.ws \
    --cc=caml-list@inria.fr \
    --cc=cuihtlauac.alvarado@francetelecom.com \
    --cc=mattias.waldau@abc.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).