[MINOR: 'escape_line' function moved from ReportUtils to ReportHTML, plus many minor doc & code improvements. bisect@x9c.fr**20090517190154] { hunk ./src/common.mli 26 - | Binding (** point kind for bindings (let ... in, as well as toplevel bindings). *) - | Sequence (** point kind for sequences. *) - | For (** point kind for for loops. *) - | If_then (** point kind for if/then constructs. *) - | Try (** point kind for try/catch constructs. *) - | While (** point kind for while loops.*) - | Match (** point kind for matches, and functions. *) - | Class_expr (** point kind for class expressions. *) - | Class_init (** point kind for class initialiazers. *) - | Class_meth (** point kind for class methods. *) - | Class_val (** point kind for class values. *) - | Toplevel_expr (** point kind for toplevel expressions. *) - | Lazy_operator (** point kind for lazy operators. *) + | Binding (** Point kind for bindings (let ... in, as well as toplevel bindings). *) + | Sequence (** Point kind for sequences. *) + | For (** Point kind for for loops. *) + | If_then (** Point kind for if/then constructs. *) + | Try (** Point kind for try/catch constructs. *) + | While (** Point kind for while loops.*) + | Match (** Point kind for matches, and functions. *) + | Class_expr (** Point kind for class expressions. *) + | Class_init (** Point kind for class initialiazers. *) + | Class_meth (** Point kind for class methods. *) + | Class_val (** Point kind for class values. *) + | Toplevel_expr (** Point kind for toplevel expressions. *) + | Lazy_operator (** Point kind for lazy operators. *) hunk ./src/common.mli 60 - - [h] just closes the input channel. *) + - [h] just closes the input channel. + Raises an exception if any error occurs. *) hunk ./src/common.mli 67 - - [h] just closes the output channel. *) + - [h] just closes the output channel. + Raises an exception if any error occurs. *) hunk ./src/instrument.ml 41 - (fun channel -> - Common.write_points channel points file)) + (fun channel -> Common.write_points channel points file)) hunk ./src/instrument.ml 99 -(* Wraps the "top-level" expressions of a binding, using "wrap_expr". *) +(* Wraps the "toplevel" expressions of a binding, using "wrap_expr". *) hunk ./src/reportHTML.ml 120 - (1 + now.Unix.tm_mon) + (succ now.Unix.tm_mon) hunk ./src/reportHTML.ml 248 +let escape_line tab_size line offset points = + let buff = Buffer.create (String.length line) in + let ofs = ref offset in + let pts = ref points in + let marker n = + Buffer.add_string buff "(*["; + Buffer.add_string buff (string_of_int n); + Buffer.add_string buff "]*)" in + let marker_if_any () = + match !pts with + | (o, n) :: tl when o = !ofs -> + marker n; + pts := tl + | _ -> () in + String.iter + (fun ch -> + marker_if_any (); + (match ch with + | '<' -> Buffer.add_string buff "<" + | '>' -> Buffer.add_string buff ">" + | ' ' -> Buffer.add_string buff " " + | '\"' -> Buffer.add_string buff """ + | '&' -> Buffer.add_string buff "&" + | '\t' -> for i = 1 to tab_size do Buffer.add_string buff " " done + | _ -> Buffer.add_char buff ch); + incr ofs) + line; + List.iter (fun (_, n) -> marker n) !pts; + Buffer.contents buff + hunk ./src/reportHTML.ml 352 - "fold all " ^ - "unfold all" ^ + "fold all " ^ + "unfold all" ^ hunk ./src/reportHTML.ml 615 - "dash.png", dash_png ; + "dash.png", dash_png ; hunk ./src/reportHTML.ml 617 - "plus.png", plus_png ] + "plus.png", plus_png ] hunk ./src/reportHTML.mli 25 - output, [tab_size] is the number of space character to use as a replacement + output, [tab_size] is the number of space characters to use as a replacement hunk ./src/reportStat.mli 19 -(** This module defines the types and functions related to statistics. *) +(** This module defines the types and functions related to statistics. + All operations gracefully handle overflows by ensuring that: + - a value above [max_int] is encoded by [max_int]; + - a value below [min_int] is encoded by [min_int]. *) hunk ./src/reportStat.mli 26 - mutable count : int; (** The number of points actually visited. *) - mutable total : int (** The total number of points. *) + mutable count : int; (** Number of points actually visited. *) + mutable total : int (** Total number of points. *) hunk ./src/reportStat.mli 36 -(** Returns statistics for all point kinds. +(** Returns {i empty} statistics for all point kinds. hunk ./src/reportUtils.ml 86 - let buff = Buffer.create 64 in + let buff = Buffer.create (String.length l) in hunk ./src/reportUtils.ml 88 - Buffer.add_char buff '\n'; - output_string ch (Buffer.contents buff)) + output_string ch (Buffer.contents buff); + output_char ch '\n') hunk ./src/reportUtils.ml 93 - let ch = open_out_bin filename in - try - Array.iter (output_byte ch) data; - close_out_noerr ch - with e -> - close_out_noerr ch; - raise e - -let escape_line tab_size line offset points = - let buff = Buffer.create (String.length line) in - let ofs = ref offset in - let pts = ref points in - let marker n = - Buffer.add_string buff "(*["; - Buffer.add_string buff (string_of_int n); - Buffer.add_string buff "]*)" in - let marker_if_any () = - match !pts with - | (o, n) :: tl when o = !ofs -> - marker n; - pts := tl - | _ -> () in - String.iter - (fun ch -> - marker_if_any (); - (match ch with - | '<' -> Buffer.add_string buff "<" - | '>' -> Buffer.add_string buff ">" - | ' ' -> Buffer.add_string buff " " - | '\"' -> Buffer.add_string buff """ - | '&' -> Buffer.add_string buff "&" - | '\t' -> for i = 1 to tab_size do Buffer.add_string buff " " done - | _ -> Buffer.add_char buff ch); - incr ofs) - line; - List.iter (fun (_, n) -> marker n) !pts; - Buffer.contents buff + Common.try_out_channel + true + filename + (fun channel -> Array.iter (output_byte channel) data) hunk ./src/reportUtils.mli 26 -(** The Bisect version, as a string. *) +(** The Bisect URL, as a string. *) hunk ./src/reportUtils.mli 53 - - [o] is an output channel for [out_file]. *) + - [o] is an output channel for [out_file]. + Raises an exception if an error occurs; ensures that either both files + are either opened or closed. *) hunk ./src/reportUtils.mli 59 - to the channel [ch]. Also substitutes {i $(xyz)} sequence as described - by [Buffer.add_substitute]. The substitution is based on the association - list [mapping]. *) + to the channel [ch]. Each line is written after substituting {i $(xyz)} + sequences as described by [Buffer.add_substitute]. The substitution is + based on the association list [mapping]. + Raises en exception if an error occurs. *) hunk ./src/reportUtils.mli 66 - the bytes from [data] to it. *) - -val escape_line : int -> string -> int -> (int * int) list -> string -(** [escape_line tab_size line offset points] escape the string [line], - in such a way it can be used in HTML/XML. [tab_size] is the number - of space character to use as a replacement for tabulations. [offset] - is the offset of the start of the line, inside the file. [points] is - a list of (offset, visits) couples. *) + the bytes from [data] to it. Each array element is considered as a + byte value. + Raises en exception if an error occurs. *) hunk ./src/runtime.mli 33 - Bisect: "BISECT_SILENT". If this variable is set to "YES" or "ON" then - Bisect will not output any message (its default value is "OFF"). + Bisect: "BISECT_SILENT". If this variable is set to "YES" or "ON" (ignoring + case) then Bisect will not output any message (its default value is "OFF"). hunk ./src/runtime.mli 45 - should not modify the current directory before Bisect uses this value. *) + should not modify the current directory before Bisect uses this value, + or should modify it purposely. *) }