File: odoc_gen.ml

package info (click to toggle)
ocaml 4.05.0-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 27,060 kB
  • sloc: ml: 199,255; ansic: 44,187; sh: 5,611; makefile: 4,958; lisp: 4,223; asm: 4,220; awk: 306; perl: 87; fortran: 21; cs: 9; sed: 9
file content (64 lines) | stat: -rw-r--r-- 2,779 bytes parent folder | download | duplicates (3)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(**************************************************************************)
(*                                                                        *)
(*                                 OCaml                                  *)
(*                                                                        *)
(*             Maxence Guesdon, projet Gallium, INRIA Rocquencourt        *)
(*                                                                        *)
(*   Copyright 2010 Institut National de Recherche en Informatique et     *)
(*     en Automatique.                                                    *)
(*                                                                        *)
(*   All rights reserved.  This file is distributed under the terms of    *)
(*   the GNU Lesser General Public License version 2.1, with the          *)
(*   special exception on linking described in the file LICENSE.          *)
(*                                                                        *)
(**************************************************************************)

(** *)

class type doc_generator =
  object method generate : Odoc_module.t_module list -> unit end;;

module type Base = sig
    class generator : doc_generator
  end;;

module Base_generator : Base = struct
  class generator : doc_generator = object method generate _ = () end
  end;;

module type Base_functor = functor (G: Base) -> Base
module type Html_functor = functor (G: Odoc_html.Html_generator) -> Odoc_html.Html_generator
module type Latex_functor = functor (G: Odoc_latex.Latex_generator) -> Odoc_latex.Latex_generator
module type Texi_functor = functor (G: Odoc_texi.Texi_generator) -> Odoc_texi.Texi_generator
module type Man_functor = functor (G: Odoc_man.Man_generator) -> Odoc_man.Man_generator
module type Dot_functor = functor (G: Odoc_dot.Dot_generator) -> Odoc_dot.Dot_generator

type generator =
  | Html of (module Odoc_html.Html_generator)
  | Latex of (module Odoc_latex.Latex_generator)
  | Texi of (module Odoc_texi.Texi_generator)
  | Man of (module Odoc_man.Man_generator)
  | Dot of (module Odoc_dot.Dot_generator)
  | Base of (module Base)
;;

let get_minimal_generator = function
  Html m ->
    let module M = (val m : Odoc_html.Html_generator) in
    (new M.html :> doc_generator)
| Latex m ->
    let module M = (val m : Odoc_latex.Latex_generator) in
    (new M.latex :> doc_generator)
| Man m ->
    let module M = (val m : Odoc_man.Man_generator) in
    (new M.man :> doc_generator)
| Texi m ->
    let module M = (val m : Odoc_texi.Texi_generator) in
    (new M.texi :> doc_generator)
| Dot m ->
    let module M = (val m : Odoc_dot.Dot_generator) in
    (new M.dot :> doc_generator)
| Base m ->
    let module M = (val m : Base) in
    new M.generator
    ;;