src/Pure/General/name_space.ML
author wenzelm
Sat, 24 Oct 2009 21:30:33 +0200
changeset 33097 9d501e11084a
parent 33096 db3c18fd9708
child 33157 56f836b9414f
permissions -rw-r--r--
maintain position of formal entities via name space;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6118
caa439435666 fixed titles;
wenzelm
parents: 5682
diff changeset
     1
(*  Title:      Pure/General/name_space.ML
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
     2
    Author:     Markus Wenzel, TU Muenchen
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
     3
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
     4
Generic name spaces with declared and hidden entries.  Unknown names
16341
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
     5
are considered global; no support for absolute addressing.
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
     6
*)
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
     7
26440
feeb83f9657f tuned comments;
wenzelm
parents: 25225
diff changeset
     8
type xstring = string;    (*external names*)
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
     9
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
    10
signature BASIC_NAME_SPACE =
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
    11
sig
32738
15bb09ca0378 explicit indication of Unsynchronized.ref;
wenzelm
parents: 30522
diff changeset
    12
  val long_names: bool Unsynchronized.ref
15bb09ca0378 explicit indication of Unsynchronized.ref;
wenzelm
parents: 30522
diff changeset
    13
  val short_names: bool Unsynchronized.ref
15bb09ca0378 explicit indication of Unsynchronized.ref;
wenzelm
parents: 30522
diff changeset
    14
  val unique_names: bool Unsynchronized.ref
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
    15
end;
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
    16
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    17
signature NAME_SPACE =
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    18
sig
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
    19
  include BASIC_NAME_SPACE
9120
04a46ceace35 export hidden: string -> string;
wenzelm
parents: 8806
diff changeset
    20
  val hidden: string -> string
25225
e638164593bf export is_hidden;
wenzelm
parents: 25072
diff changeset
    21
  val is_hidden: string -> bool
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    22
  type T
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    23
  val empty: string -> T
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    24
  val kind_of: T -> string
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    25
  val the_entry: T -> string -> {is_system: bool, pos: Position.T, id: serial}
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
    26
  val intern: T -> xstring -> string
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
    27
  val extern: T -> string -> xstring
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
    28
  val extern_flags: {long_names: bool, short_names: bool, unique_names: bool} ->
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
    29
    T -> string -> xstring
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
    30
  val hide: bool -> string -> T -> T
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    31
  val merge: T * T -> T
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
    32
  type naming
28965
1de908189869 cleaned up binding module and related code
haftmann
parents: 28941
diff changeset
    33
  val default_naming: naming
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    34
  val declare: bool -> naming -> binding -> T -> string * T
29581
b3b33e0298eb binding is alias for Binding.T
haftmann
parents: 29338
diff changeset
    35
  val full_name: naming -> binding -> string
25072
03f57b516e12 store external accesses within name space (as produced by naming policy);
wenzelm
parents: 24361
diff changeset
    36
  val external_names: naming -> string -> string list
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
    37
  val add_path: string -> naming -> naming
30418
b5044aca0729 add_path: discontinued special meaning of "//", "/", "..";
wenzelm
parents: 30412
diff changeset
    38
  val root_path: naming -> naming
b5044aca0729 add_path: discontinued special meaning of "//", "/", "..";
wenzelm
parents: 30412
diff changeset
    39
  val parent_path: naming -> naming
30469
de9e8f1d927c renamed sticky_prefix to mandatory_path;
wenzelm
parents: 30465
diff changeset
    40
  val mandatory_path: string -> naming -> naming
24361
52a14669f9e9 tuned signature;
wenzelm
parents: 23668
diff changeset
    41
  type 'a table = T * 'a Symtab.table
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    42
  val define: bool -> naming -> binding * 'a -> 'a table -> string * 'a table
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    43
  val empty_table: string -> 'a table
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    44
  val merge_tables: 'a table * 'a table -> 'a table
33097
9d501e11084a maintain position of formal entities via name space;
wenzelm
parents: 33096
diff changeset
    45
  val join_tables: (string -> 'a * 'a -> 'a) (*Symtab.SAME*) ->
9d501e11084a maintain position of formal entities via name space;
wenzelm
parents: 33096
diff changeset
    46
    'a table * 'a table -> 'a table
16848
1c8a5bb7c688 added dest_table;
wenzelm
parents: 16444
diff changeset
    47
  val dest_table: 'a table -> (string * 'a) list
16341
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
    48
  val extern_table: 'a table -> (xstring * 'a) list
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    49
end;
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    50
33095
bbd52d2f8696 renamed NameSpace to Name_Space -- also to emphasize its subtle change in semantics;
wenzelm
parents: 33091
diff changeset
    51
structure Name_Space: NAME_SPACE =
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    52
struct
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    53
30412
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
    54
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
    55
(** name spaces **)
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
    56
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
    57
(* hidden entries *)
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    58
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
    59
fun hidden name = "??." ^ name;
29338
52a384648d13 separator, is_qualified
haftmann
parents: 29004
diff changeset
    60
val is_hidden = String.isPrefix "??.";
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
    61
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    62
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    63
(* datatype entry *)
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    64
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    65
type entry =
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    66
 {externals: xstring list,
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    67
  is_system: bool,
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    68
  pos: Position.T,
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    69
  id: serial};
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    70
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    71
fun str_of_entry def (name, {pos, id, ...}: entry) =
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    72
  let
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    73
    val occurrence = (if def then Markup.defN else Markup.refN, string_of_int id);
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    74
    val props = occurrence :: Position.properties_of pos;
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    75
  in Markup.markup (Markup.properties props (Markup.entity name)) name end;
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    76
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    77
fun err_dup kind entry1 entry2 =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    78
  error ("Duplicate " ^ kind ^ " declaration " ^
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    79
    quote (str_of_entry true entry1) ^ " vs. " ^ quote (str_of_entry true entry2));
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    80
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
    81
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    82
(* datatype T *)
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    83
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    84
datatype T =
33095
bbd52d2f8696 renamed NameSpace to Name_Space -- also to emphasize its subtle change in semantics;
wenzelm
parents: 33091
diff changeset
    85
  Name_Space of
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    86
   {kind: string,
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    87
    internals: (string list * string list) Symtab.table,  (*visible, hidden*)
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    88
    entries: entry Symtab.table};
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    89
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    90
fun make_name_space (kind, internals, entries) =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    91
  Name_Space {kind = kind, internals = internals, entries = entries};
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    92
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    93
fun map_name_space f (Name_Space {kind = kind, internals = internals, entries = entries}) =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    94
  make_name_space (f (kind, internals, entries));
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    95
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    96
fun map_internals f xname = map_name_space (fn (kind, internals, entries) =>
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    97
  (kind, Symtab.map_default (xname, ([], [])) f internals, entries));
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
    98
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
    99
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   100
fun empty kind = make_name_space (kind, Symtab.empty, Symtab.empty);
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   101
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   102
fun kind_of (Name_Space {kind, ...}) = kind;
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
   103
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   104
fun the_entry (Name_Space {kind, entries, ...}) name =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   105
  (case Symtab.lookup entries name of
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   106
    NONE => error ("Unknown " ^ kind ^ " " ^ quote name)
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   107
  | SOME {is_system, pos, id, ...} => {is_system = is_system, pos = pos, id = id});
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   108
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   109
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   110
(* name accesses *)
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   111
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   112
fun lookup (Name_Space {internals, ...}) xname =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   113
  (case Symtab.lookup internals xname of
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   114
    NONE => (xname, true)
30233
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   115
  | SOME ([], []) => (xname, true)
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   116
  | SOME ([name], _) => (name, true)
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   117
  | SOME (name :: _, _) => (name, false)
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   118
  | SOME ([], name' :: _) => (hidden name', true));
8728
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   119
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   120
fun get_accesses (Name_Space {entries, ...}) name =
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   121
  (case Symtab.lookup entries name of
25072
03f57b516e12 store external accesses within name space (as produced by naming policy);
wenzelm
parents: 24361
diff changeset
   122
    NONE => [name]
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   123
  | SOME {externals, ...} => externals);
25072
03f57b516e12 store external accesses within name space (as produced by naming policy);
wenzelm
parents: 24361
diff changeset
   124
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   125
fun valid_accesses (Name_Space {internals, ...}) name =
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   126
  Symtab.fold (fn (xname, (names, _)) =>
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   127
    if not (null names) andalso hd names = name then cons xname else I) internals [];
8728
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   128
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   129
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   130
(* intern and extern *)
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   131
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   132
fun intern space xname = #1 (lookup space xname);
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   133
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   134
fun extern_flags {long_names, short_names, unique_names} space name =
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   135
  let
30277
4f2b6ccce047 adapted Binding.dest;
wenzelm
parents: 30242
diff changeset
   136
    fun valid require_unique xname =
4f2b6ccce047 adapted Binding.dest;
wenzelm
parents: 30242
diff changeset
   137
      let val (name', is_unique) = lookup space xname
4f2b6ccce047 adapted Binding.dest;
wenzelm
parents: 30242
diff changeset
   138
      in name = name' andalso (not require_unique orelse is_unique) end;
8728
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   139
26440
feeb83f9657f tuned comments;
wenzelm
parents: 25225
diff changeset
   140
    fun ext [] = if valid false name then name else hidden name
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   141
      | ext (nm :: nms) = if valid unique_names nm then nm else ext nms;
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   142
  in
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   143
    if long_names then name
30359
3f9b3ff851ca moved basic algebra of long names from structure NameSpace to Long_Name;
wenzelm
parents: 30280
diff changeset
   144
    else if short_names then Long_Name.base_name name
30213
3951aab916fd reverted change introduced in a7c164e228e1 -- there cannot be a "bug" in a perfectly normal operation on the internal data representation that merely escaped into public by accident (cf. 0a981c596372);
wenzelm
parents: 29848
diff changeset
   145
    else ext (get_accesses space name)
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   146
  end;
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   147
32738
15bb09ca0378 explicit indication of Unsynchronized.ref;
wenzelm
parents: 30522
diff changeset
   148
val long_names = Unsynchronized.ref false;
15bb09ca0378 explicit indication of Unsynchronized.ref;
wenzelm
parents: 30522
diff changeset
   149
val short_names = Unsynchronized.ref false;
15bb09ca0378 explicit indication of Unsynchronized.ref;
wenzelm
parents: 30522
diff changeset
   150
val unique_names = Unsynchronized.ref true;
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   151
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   152
fun extern space name =
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   153
  extern_flags
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   154
   {long_names = ! long_names,
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   155
    short_names = ! short_names,
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   156
    unique_names = ! unique_names} space name;
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   157
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
   158
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   159
(* modify internals *)
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   160
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   161
val del_name = map_internals o apfst o remove (op =);
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   162
fun del_name_extra name =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   163
  map_internals (apfst (fn [] => [] | x :: xs => x :: remove (op =) name xs));
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   164
val add_name = map_internals o apfst o update (op =);
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   165
val add_name' = map_internals o apsnd o update (op =);
25072
03f57b516e12 store external accesses within name space (as produced by naming policy);
wenzelm
parents: 24361
diff changeset
   166
8728
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   167
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   168
(* hide *)
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
   169
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   170
fun hide fully name space =
30359
3f9b3ff851ca moved basic algebra of long names from structure NameSpace to Long_Name;
wenzelm
parents: 30280
diff changeset
   171
  if not (Long_Name.is_qualified name) then
8728
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   172
    error ("Attempt to hide global name " ^ quote name)
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   173
  else if is_hidden name then
33a9643ba626 improved output of ambiguous entries;
wenzelm
parents: 6845
diff changeset
   174
    error ("Attempt to hide hidden name " ^ quote name)
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   175
  else
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   176
    let val names = valid_accesses space name in
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   177
      space
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   178
      |> add_name' name name
30359
3f9b3ff851ca moved basic algebra of long names from structure NameSpace to Long_Name;
wenzelm
parents: 30280
diff changeset
   179
      |> fold (del_name name)
33049
c38f02fdf35d curried inter as canonical list operation (beware of argument order)
haftmann
parents: 33038
diff changeset
   180
        (if fully then names else inter (op =) [Long_Name.base_name name] names)
30213
3951aab916fd reverted change introduced in a7c164e228e1 -- there cannot be a "bug" in a perfectly normal operation on the internal data representation that merely escaped into public by accident (cf. 0a981c596372);
wenzelm
parents: 29848
diff changeset
   181
      |> fold (del_name_extra name) (get_accesses space name)
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   182
    end;
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
   183
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
   184
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   185
(* merge *)
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
   186
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   187
fun merge
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   188
  (Name_Space {kind = kind1, internals = internals1, entries = entries1},
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   189
    Name_Space {kind = kind2, internals = internals2, entries = entries2}) =
25072
03f57b516e12 store external accesses within name space (as produced by naming policy);
wenzelm
parents: 24361
diff changeset
   190
  let
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   191
    val kind' =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   192
      if kind1 = kind2 then kind1
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   193
      else error ("Attempt to merge different kinds of name spaces " ^
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   194
        quote kind1 ^ " vs. " ^ quote kind2);
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   195
    val internals' = (internals1, internals2) |> Symtab.join
30465
038839f111a1 renamed bind to define;
wenzelm
parents: 30438
diff changeset
   196
      (K (fn ((names1, names1'), (names2, names2')) =>
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   197
        if pointer_eq (names1, names2) andalso pointer_eq (names1', names2')
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   198
        then raise Symtab.SAME
30233
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   199
        else (Library.merge (op =) (names1, names2), Library.merge (op =) (names1', names2'))));
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   200
    val entries' = (entries1, entries2) |> Symtab.join
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   201
      (fn name => fn (entry1, entry2) =>
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   202
        if #id entry1 = #id entry2 then raise Symtab.SAME
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   203
        else err_dup kind' (name, entry1) (name, entry2));
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   204
  in make_name_space (kind', internals', entries') end;
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
   205
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   206
26440
feeb83f9657f tuned comments;
wenzelm
parents: 25225
diff changeset
   207
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   208
(** naming contexts **)
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   209
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   210
(* datatype naming *)
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   211
30522
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   212
datatype naming = Naming of (string * bool) list;
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   213
fun map_naming f (Naming path) = Naming (f path);
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   214
30522
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   215
val default_naming = Naming [];
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   216
30522
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   217
fun add_path elems = map_naming (fn path => path @ [(elems, false)]);
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   218
val root_path = map_naming (fn _ => []);
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   219
val parent_path = map_naming (perhaps (try (#1 o split_last)));
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   220
fun mandatory_path elems = map_naming (fn path => path @ [(elems, true)]);
28860
b1d46059d502 name spaces and name bindings
haftmann
parents: 27196
diff changeset
   221
b1d46059d502 name spaces and name bindings
haftmann
parents: 27196
diff changeset
   222
30233
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   223
(* full name *)
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   224
30465
038839f111a1 renamed bind to define;
wenzelm
parents: 30438
diff changeset
   225
fun err_bad binding = error ("Bad name binding " ^ quote (Binding.str_of binding));
28860
b1d46059d502 name spaces and name bindings
haftmann
parents: 27196
diff changeset
   226
30522
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   227
fun name_spec (Naming path) binding =
30233
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   228
  let
30412
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   229
    val (prefix, name) = Binding.dest binding;
30438
c2d49315b93b eliminated qualified_names naming policy: qualified names are only permitted via explicit Binding.qualify/qualified_name etc. (NB: user-level outer syntax should never do this);
wenzelm
parents: 30418
diff changeset
   230
    val _ = Long_Name.is_qualified name andalso err_bad binding;
30412
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   231
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   232
    val spec1 = maps (fn (a, b) => map (rpair b) (Long_Name.explode a)) (path @ prefix);
30438
c2d49315b93b eliminated qualified_names naming policy: qualified names are only permitted via explicit Binding.qualify/qualified_name etc. (NB: user-level outer syntax should never do this);
wenzelm
parents: 30418
diff changeset
   233
    val spec2 = if name = "" then [] else [(name, true)];
30412
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   234
    val spec = spec1 @ spec2;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   235
    val _ =
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   236
      exists (fn (a, _) => a = "" orelse a = "??" orelse exists_string (fn s => s = "\"") a) spec
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   237
      andalso err_bad binding;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   238
  in if null spec2 then [] else spec end;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   239
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   240
fun full naming = name_spec naming #> map fst;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   241
fun full_name naming = full naming #> Long_Name.implode;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   242
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   243
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   244
(* accesses *)
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   245
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   246
fun mandatory xs = map_filter (fn (x, true) => SOME x | _ => NONE) xs;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   247
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   248
fun mandatory_prefixes xs = mandatory xs :: mandatory_prefixes1 xs
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   249
and mandatory_prefixes1 [] = []
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   250
  | mandatory_prefixes1 ((x, true) :: xs) = map (cons x) (mandatory_prefixes1 xs)
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   251
  | mandatory_prefixes1 ((x, false) :: xs) = map (cons x) (mandatory_prefixes xs);
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   252
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   253
fun mandatory_suffixes xs = map rev (mandatory_prefixes (rev xs));
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   254
30522
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   255
fun accesses naming binding =
30412
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   256
  let
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   257
    val spec = name_spec naming binding;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   258
    val sfxs = mandatory_suffixes spec;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   259
    val pfxs = mandatory_prefixes spec;
30522
e26b80647189 removed obsolete no_base_names naming policy;
wenzelm
parents: 30469
diff changeset
   260
  in pairself (map Long_Name.implode) (sfxs @ pfxs, sfxs) end;
30412
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   261
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   262
fun external_names naming = #2 o accesses naming o Binding.qualified_name;
30233
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   263
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   264
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   265
(* declaration *)
28860
b1d46059d502 name spaces and name bindings
haftmann
parents: 27196
diff changeset
   266
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   267
fun new_entry strict entry =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   268
  map_name_space (fn (kind, internals, entries) =>
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   269
    let
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   270
      val entries' =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   271
        (if strict then Symtab.update_new else Symtab.update) entry entries
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   272
          handle Symtab.DUP dup =>
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   273
            err_dup kind (dup, the (Symtab.lookup entries dup)) entry;
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   274
    in (kind, internals, entries') end);
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   275
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   276
fun declare strict naming binding space =
30233
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   277
  let
30412
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   278
    val names = full naming binding;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   279
    val name = Long_Name.implode names;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   280
    val _ = name = "" andalso err_bad binding;
7f5b0a020ccd just one naming policy based on binding content -- eliminated odd "object-oriented" style;
wenzelm
parents: 30359
diff changeset
   281
    val (accs, accs') = accesses naming binding;
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   282
    val entry =
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   283
     {externals = accs',
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   284
      is_system = false,
33097
9d501e11084a maintain position of formal entities via name space;
wenzelm
parents: 33096
diff changeset
   285
      pos = Position.default (Binding.pos_of binding),
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   286
      id = serial ()};
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   287
    val space' = space |> fold (add_name name) accs |> new_entry strict (name, entry);
30233
6eb726e43ed1 eliminated internal stamp equality, replaced by bare-metal pointer_eq;
wenzelm
parents: 30222
diff changeset
   288
  in (name, space') end;
28860
b1d46059d502 name spaces and name bindings
haftmann
parents: 27196
diff changeset
   289
16137
00e9ca1e7261 renamed cond_extern to extern;
wenzelm
parents: 16002
diff changeset
   290
16341
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
   291
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
   292
(** name spaces coupled with symbol tables **)
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
   293
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
   294
type 'a table = T * 'a Symtab.table;
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
   295
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   296
fun define strict naming (binding, x) (space, tab) =
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   297
  let val (name, space') = declare strict naming binding space
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   298
  in (name, (space', Symtab.update (name, x) tab)) end;
16341
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
   299
33096
db3c18fd9708 maintain explicit name space kind;
wenzelm
parents: 33095
diff changeset
   300
fun empty_table kind = (empty kind, Symtab.empty);
28860
b1d46059d502 name spaces and name bindings
haftmann
parents: 27196
diff changeset
   301
33091
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   302
fun merge_tables ((space1, tab1), (space2, tab2)) =
d23e75d4f7da maintain abstract entry, with position, identity etc.;
wenzelm
parents: 33049
diff changeset
   303
  (merge (space1, space2), Symtab.merge (K true) (tab1, tab2));
16341
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
   304
28991
694227dd3e8c dropped NameSpace.declare_base
haftmann
parents: 28965
diff changeset
   305
fun join_tables f ((space1, tab1), (space2, tab2)) =
694227dd3e8c dropped NameSpace.declare_base
haftmann
parents: 28965
diff changeset
   306
  (merge (space1, space2), Symtab.join f (tab1, tab2));
694227dd3e8c dropped NameSpace.declare_base
haftmann
parents: 28965
diff changeset
   307
16848
1c8a5bb7c688 added dest_table;
wenzelm
parents: 16444
diff changeset
   308
fun ext_table (space, tab) =
1c8a5bb7c688 added dest_table;
wenzelm
parents: 16444
diff changeset
   309
  Symtab.fold (fn (name, x) => cons ((name, extern space name), x)) tab []
1c8a5bb7c688 added dest_table;
wenzelm
parents: 16444
diff changeset
   310
  |> Library.sort_wrt (#2 o #1);
1c8a5bb7c688 added dest_table;
wenzelm
parents: 16444
diff changeset
   311
1c8a5bb7c688 added dest_table;
wenzelm
parents: 16444
diff changeset
   312
fun dest_table tab = map (apfst #1) (ext_table tab);
1c8a5bb7c688 added dest_table;
wenzelm
parents: 16444
diff changeset
   313
fun extern_table tab = map (apfst #2) (ext_table tab);
16341
e573e5167eda added type NameSpace.table with basic operations;
wenzelm
parents: 16262
diff changeset
   314
5012
086b055c4d73 moved name_space.ML to General/name_space.ML;
wenzelm
parents:
diff changeset
   315
end;
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   316
33095
bbd52d2f8696 renamed NameSpace to Name_Space -- also to emphasize its subtle change in semantics;
wenzelm
parents: 33091
diff changeset
   317
structure Basic_Name_Space: BASIC_NAME_SPACE = Name_Space;
32738
15bb09ca0378 explicit indication of Unsynchronized.ref;
wenzelm
parents: 30522
diff changeset
   318
open Basic_Name_Space;
30215
47cce3d47e62 moved name space externalization flags back to name_space.ML;
wenzelm
parents: 30213
diff changeset
   319