Project

General

Profile

Revision e7cc5186 src/corelang.ml

View differences:

src/corelang.ml
14 14
(*open Dimension*)
15 15

  
16 16

  
17
exception Error of Location.t * error
17
exception Error of Location.t * Error.error_kind
18 18

  
19 19
module VDeclModule =
20 20
struct (* Node module *)
......
823 823
let pp_prog_clock fmt prog =
824 824
  Utils.fprintf_list ~sep:"" pp_decl_clock fmt prog
825 825

  
826
let pp_error fmt = function
827
    Main_not_found ->
828
      fprintf fmt "Could not find the definition of main node %s.@."
829
	!Global.main_node
830
  | Main_wrong_kind ->
831
    fprintf fmt
832
      "Node %s does not correspond to a valid main node definition.@." 
833
      !Global.main_node 
834
  | No_main_specified ->
835
    fprintf fmt "No main node specified (use -node option)@."
836
  | Unbound_symbol sym ->
837
    fprintf fmt
838
      "%s is undefined.@."
839
      sym
840
  | Already_bound_symbol sym -> 
841
    fprintf fmt
842
      "%s is already defined.@."
843
      sym
844
  | Unknown_library sym ->
845
    fprintf fmt
846
      "impossible to load library %s.lusic.@.Please compile the corresponding interface or source file.@."
847
      sym
848
  | Wrong_number sym ->
849
    fprintf fmt
850
      "library %s.lusic has a different version number and may crash compiler.@.Please recompile the corresponding interface or source file.@."
851
      sym
852 826

  
853 827
(* filling node table with internal functions *)
854 828
let vdecls_of_typ_ck cpt ty =
......
1065 1039
let copy_prog top_list =
1066 1040
  List.map copy_top top_list
1067 1041

  
1042

  
1043
let rec expr_contains_expr expr_tag expr  =
1044
  let search = expr_contains_expr expr_tag in
1045
  expr.expr_tag = expr_tag ||
1046
      (
1047
	match expr.expr_desc with
1048
	| Expr_const _ -> false
1049
	| Expr_array el -> List.exists search el
1050
	| Expr_access (e1, _) 
1051
	| Expr_power (e1, _) -> search e1
1052
	| Expr_tuple el -> List.exists search el
1053
	| Expr_ite (c, t, e) -> List.exists search [c;t;e]
1054
	| Expr_arrow (e1, e2)
1055
	| Expr_fby (e1, e2) -> List.exists search [e1; e2]
1056
	| Expr_pre e' 
1057
	| Expr_when (e', _, _) -> search e'
1058
	| Expr_merge (_, hl) -> List.exists (fun (_, h) -> search h) hl
1059
	| Expr_appl (_, e', None) -> search e' 
1060
	| Expr_appl (_, e', Some e'') -> List.exists search [e'; e''] 
1061
	| Expr_ident _ -> false
1062
      )
1063

  
1068 1064
(* Local Variables: *)
1069 1065
(* compile-command:"make -C .." *)
1070 1066
(* End: *)

Also available in: Unified diff