[go: up one dir, main page]

File: symbol.mli

package info (click to toggle)
advi 1.10.2-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 15,008 kB
  • sloc: ml: 12,279; sh: 1,032; ansic: 1,016; makefile: 705; perl: 55
file content (112 lines) | stat: -rw-r--r-- 3,806 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
(***********************************************************************)
(*                                                                     *)
(*                             Active-DVI                              *)
(*                                                                     *)
(*                   Projet Cristal, INRIA Rocquencourt                *)
(*                                                                     *)
(*  Copyright 2002 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.          *)
(*                                                                     *)
(*  Jun Furuse, Didier Rmy and Pierre Weis.                           *)
(*  Contributions by Roberto Di Cosmo, Didier Le Botlan,               *)
(*  Xavier Leroy, and Alan Schmitt.                                    *)
(*                                                                     *)
(*  Based on Mldvi by Alexandre Miquel.                                *)
(***********************************************************************)

(* $Id: symbol.mli,v 1.1 2007/01/18 14:14:37 rousse Exp $ *)

type color = GraphicsY11.color;;

type x = GraphicsY11.x
and y = GraphicsY11.y
and w = GraphicsY11.w
and h = GraphicsY11.h;;

module Make
  (G : sig
     type t
     val hoffset : t -> int
     val voffset : t -> int
     val width : t -> int
     val height : t -> int
   end) : sig

  type glyph = G.t;;
  type fontname = string;;
  type fontratio = float;;

  type g = {
    fontname : string;
    fontratio : float;
    glyph : glyph;
  };;

  type symbol =
     | Glyph of g
     | Space of w * h
     | Rule of w * h
     | Line of Misc.line_number * Misc.file_name option;;

  type code = int;;

  type display_symbol = {
    color : color;
    locx : x;
    locy : y;
    code : code;
    symbol : symbol;
  };;

  type display_set = display_symbol list;;

  val voffset : display_symbol -> y;;
  val hoffset : display_symbol -> x;;
  val height : display_symbol -> h;;
  val width : display_symbol -> w;;

  val clear_global_display_set : unit -> unit;;
  val add_to_global_display_set : color -> x -> y -> code -> symbol -> unit;;
  (** color -> locx -> locy -> code -> symbol -> unit *)

  val to_ascii : display_set -> string;;
  (** [to_ascii ds] returns a string representing the display symbols that
      are in the display_set. *)
  (* Could be done with a pretty printer... *)
  val to_ascii_escaped : display_set -> string;;

  val commands_to_ascii :
    (int * Dvicommands.font_def) list -> Dvicommands.command list -> string

  val inzone : x -> y -> x -> y -> display_set;;
  (** Gives a copy of the global [display_set] where only symbols inside
     the zone x1 y1 x2 y2 are kept. *)

  val intime : x -> y -> x -> y -> display_set;;
  (** Idem where but the resulting display_set is time-convex
     (intermediate symbols are also kept). *)

  val iter : (display_symbol -> unit) -> display_set -> unit;;
  (** [iter ff ds] Iterates the function [ff] over the [display_set]
      [ds] set of display symbols. *)

  (** Regions. *)

  type region;;

  val position : int -> int -> region;;
  val new_region : region -> int -> int -> region;;
  val iter_region : (display_symbol -> unit) -> region -> unit;;
  val iter_regions :
      (display_symbol -> unit) -> (display_symbol -> unit) ->
      region -> region -> unit;;
  val apply : (glyph -> int -> int -> int -> unit) -> display_symbol -> unit;;

  val lines : int -> int ->
    (display_symbol * int * int *
     string * string * string * string * string option) option;;
  val word : int -> int -> (region * string) option;;
  val region_to_ascii : region -> string;;

end;;