File: cutOut.ml

package info (click to toggle)
hevea 2.36-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,780 kB
  • sloc: ml: 19,453; sh: 503; makefile: 311; ansic: 132
file content (44 lines) | stat: -rw-r--r-- 1,661 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(***********************************************************************)
(*                                                                     *)
(*                          HEVEA                                      *)
(*                                                                     *)
(*  Luc Maranget, projet MOSCOVA, INRIA Rocquencourt                   *)
(*                                                                     *)
(*  Copyright 2006 Institut National de Recherche en Informatique et   *)
(*  Automatique.  Distributed only by permission.                      *)
(*                                                                     *)
(***********************************************************************)


module type Config = sig
  val small_length : int
end

module Make(C:Config) = struct

module Out = DoOut.Make(C)

type t = { out : Out.t ; name : string }

let get_name { name = name } = name

let create name do_it = { out = do_it () ; name = name }

let create_buff name = create name Out.create_buff
and create_null () = create "NULL" Out.create_null
and create_chan name = 
  create name (fun () -> Out.create_chan (open_out name))
and close { out = out } = Out.close out

let put { out = out } s = Out.put out s
and put_char { out = out } c = Out.put_char out c
and is_empty { out = out } = Out.is_empty out
and to_string { out = out } = Out.to_string out
and to_chan chan { out = out } = Out.to_chan chan out
and copy { out = out1 } { out = out2 } = Out.copy out1 out2
and flush { out = out } = Out.flush out
let debug chan { out; name; } =
  Printf.fprintf chan "Out=%s\n" name ;
  Out.debug chan out ;
  ()
end