Commit c340a012 authored by Andrei Paskevich's avatar Andrei Paskevich
Browse files

register_meta returns the meta name (i.e. its first argument).

This allows to have one line less in transformations.
parent 0ad4d18e
...@@ -136,18 +136,13 @@ let add_ls_syntax ls s sm = ...@@ -136,18 +136,13 @@ let add_ls_syntax ls s sm =
let query_syntax sm id = let query_syntax sm id =
try Some (Mid.find id sm) with Not_found -> None try Some (Mid.find id sm) with Not_found -> None
let meta_remove_type = "remove_type" let meta_remove_type = register_meta "remove_type" [MTtysymbol]
let meta_remove_logic = "remove_logic" let meta_remove_logic = register_meta "remove_logic" [MTlsymbol]
let meta_remove_prop = "remove_prop" let meta_remove_prop = register_meta "remove_prop" [MTprsymbol]
let () = let remove_type ts = create_meta meta_remove_type [MAts ts]
register_meta meta_remove_type [MTtysymbol];
register_meta meta_remove_logic [MTlsymbol];
register_meta meta_remove_prop [MTprsymbol]
let remove_type ts = create_meta meta_remove_type [MAts ts]
let remove_logic ls = create_meta meta_remove_logic [MAls ls] let remove_logic ls = create_meta meta_remove_logic [MAls ls]
let remove_prop pr = create_meta meta_remove_prop [MApr pr] let remove_prop pr = create_meta meta_remove_prop [MApr pr]
let get_remove_set task = let get_remove_set task =
let add td s = match td.td_node with let add td s = match td.td_node with
......
...@@ -110,12 +110,15 @@ let meta_table = Hashtbl.create 17 ...@@ -110,12 +110,15 @@ let meta_table = Hashtbl.create 17
let meta_exc = Hashtbl.create 17 let meta_exc = Hashtbl.create 17
let register_meta s al = let register_meta s al =
try let al' = Hashtbl.find meta_table s in begin try
if al <> al' then raise (KnownMeta s) let al' = Hashtbl.find meta_table s in
with Not_found -> Hashtbl.add meta_table s al if al <> al' then raise (KnownMeta s)
with Not_found -> Hashtbl.add meta_table s al end;
s
let register_meta_exc s al = let register_meta_exc s al =
register_meta s al; Hashtbl.add meta_exc s () Hashtbl.add meta_exc s ();
register_meta s al
let lookup_meta s = let lookup_meta s =
try Hashtbl.find meta_table s try Hashtbl.find meta_table s
......
...@@ -59,8 +59,8 @@ type meta_arg_real = ...@@ -59,8 +59,8 @@ type meta_arg_real =
| MARstr of string | MARstr of string
| MARint of int | MARint of int
val register_meta : string -> meta_arg_type list -> unit val register_meta : string -> meta_arg_type list -> string
val register_meta_exc : string -> meta_arg_type list -> unit val register_meta_exc : string -> meta_arg_type list -> string
val lookup_meta : string -> meta_arg_type list val lookup_meta : string -> meta_arg_type list
val is_meta_exc : string -> bool val is_meta_exc : string -> bool
......
...@@ -26,9 +26,7 @@ open Decl ...@@ -26,9 +26,7 @@ open Decl
open Task open Task
open Printer open Printer
let meta_ac = "AC" let meta_ac = Theory.register_meta "AC" [Theory.MTlsymbol]
let () = Theory.register_meta meta_ac [Theory.MTlsymbol]
let ident_printer = let ident_printer =
let bls = [ let bls = [
......
...@@ -28,9 +28,7 @@ open Decl ...@@ -28,9 +28,7 @@ open Decl
let why_filename = ["transform" ; "encoding_decorate"] let why_filename = ["transform" ; "encoding_decorate"]
let meta_kept = "encoding_decorate : kept" let meta_kept = register_meta "encoding_decorate : kept" [MTtysymbol]
let () = Theory.register_meta meta_kept [Theory.MTtysymbol]
(* From Encoding Polymorphism CADE07*) (* From Encoding Polymorphism CADE07*)
......
...@@ -31,9 +31,7 @@ open Decl ...@@ -31,9 +31,7 @@ open Decl
let why_filename = ["transform" ; "encoding_decorate"] let why_filename = ["transform" ; "encoding_decorate"]
let meta_kept = "encoding_decorate : kept" let meta_kept = register_meta "encoding_decorate : kept" [MTtysymbol]
let () = Theory.register_meta meta_kept [Theory.MTtysymbol]
(* From Encoding Polymorphism CADE07*) (* From Encoding Polymorphism CADE07*)
type tenv = {rem_ls : Sid.t; type tenv = {rem_ls : Sid.t;
......
...@@ -563,8 +563,7 @@ let hypothesis_selection = (* create lots of hashtables... *) ...@@ -563,8 +563,7 @@ let hypothesis_selection = (* create lots of hashtables... *)
let symbTbl = SymbHashtbl.create 17 in let symbTbl = SymbHashtbl.create 17 in
Trans.store (transformation fmlaTable fTbl tTbl symbTbl) Trans.store (transformation fmlaTable fTbl tTbl symbTbl)
let _ = Trans.register_transform let _ = Trans.register_transform "hypothesis_selection" hypothesis_selection
"hypothesis_selection" (fun _ -> hypothesis_selection)
(* (*
Local Variables: Local Variables:
......
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