Commit 2da68300 authored by bguillaum's avatar bguillaum

remove constructors "No_domain" from label type

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@8446 7838e531-6607-4d57-9587-6c381814729c
parent d4b24e62
......@@ -103,46 +103,42 @@ module Massoc_pid = Massoc_make (Pid)
(* ================================================================================ *)
module Label = struct
(** describe the display style of a label *)
type line = Solid | Dot | Dash
type style = {
text: string;
bottom: bool;
color: string option;
bgcolor: string option;
line: line;
}
(** Global names and display styles are recorded in two aligned arrays *)
let full = ref None
let styles = ref ([||] : style array)
(** Internal representation of labels *)
type t =
| Global of int (* globally defined labels: their names are in the [full] array *)
| Local of int (* locally defined labels: names array should be provided! UNTESTED *)
| No_domain of string (* out of domain label: name in not constrained *)
(** [to_string t] returns a string for the label *)
let to_string ?(locals=[||]) t =
match (!full, t) with
| (_, No_domain s) -> s
| (Some table, Global i) -> table.(i)
| (Some _, Local i) -> fst locals.(i)
| _ -> Error.bug "[Label.to_string] inconsistent data"
| _ -> Error.bug "[Label.to_string] labels were not properly initialized"
let to_int = function
| Global i -> Some i
| _ -> None
(** describe the display style of a label *)
type line = Solid | Dot | Dash
type style = {
text: string;
bottom: bool;
color: string option;
bgcolor: string option;
line: line;
}
(** The [default] style value *)
let default = { text="UNSET"; bottom=false; color=None; bgcolor=None; line=Solid }
let styles = ref ([||] : style array)
let get_style = function
| Global i -> !styles.(i)
| Local i -> Log.warning "Style of locally defined labels is not implemented"; default
| No_domain s -> { default with text=s }
(** Computes the style of a label from its options and maybe its shape (like I:...). *)
let parse_option string_label options =
......@@ -199,7 +195,7 @@ module Label = struct
let from_string ?loc ?(locals=[||]) string =
match !full with
| None -> No_domain string
| None -> Error.bug "[Label.from_string] labels were not properly initialized"
| Some table ->
try Global (Id.build ?loc string table)
with Not_found ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment