Project

General

Profile

Revision ed81df06 src/corelang.ml

View differences:

src/corelang.ml
194 194
  if is_user_type typ_def then typ else typ_def
195 195

  
196 196
let rec coretype_equal ty1 ty2 =
197
  let res = 
197
  (*let res =*) 
198 198
  match ty1, ty2 with
199
  | Tydec_any       , _
200
  | _               , Tydec_any        -> assert false
201
  | Tydec_const _   , Tydec_const _    -> get_repr_type ty1 = get_repr_type ty2
202
  | Tydec_const _   , _                -> let ty1' = Hashtbl.find type_table ty1
203
					  in (not (is_user_type ty1')) && coretype_equal ty1' ty2
204
  | _               , Tydec_const _    -> coretype_equal ty2 ty1
205
  | Tydec_int       , Tydec_int
206
  | Tydec_real      , Tydec_real
207
  | Tydec_float     , Tydec_float
208
  | Tydec_bool      , Tydec_bool       -> true
209
  | Tydec_clock ty1 , Tydec_clock ty2  -> coretype_equal ty1 ty2
210
  | Tydec_enum tl1  , Tydec_enum tl2   -> List.sort compare tl1 = List.sort compare tl2
211
  | Tydec_struct fl1, Tydec_struct fl2 ->
199
  | Tydec_any           , _
200
  | _                   , Tydec_any             -> assert false
201
  | Tydec_const _       , Tydec_const _         -> get_repr_type ty1 = get_repr_type ty2
202
  | Tydec_const _       , _                     -> let ty1' = Hashtbl.find type_table ty1
203
	       					   in (not (is_user_type ty1')) && coretype_equal ty1' ty2
204
  | _                   , Tydec_const _         -> coretype_equal ty2 ty1
205
  | Tydec_int           , Tydec_int
206
  | Tydec_real          , Tydec_real
207
  | Tydec_float         , Tydec_float
208
  | Tydec_bool          , Tydec_bool            -> true
209
  | Tydec_clock ty1     , Tydec_clock ty2       -> coretype_equal ty1 ty2
210
  | Tydec_array (d1,ty1), Tydec_array (d2, ty2) -> Dimension.is_eq_dimension d1 d2 && coretype_equal ty1 ty2
211
  | Tydec_enum tl1      , Tydec_enum tl2        -> List.sort compare tl1 = List.sort compare tl2
212
  | Tydec_struct fl1    , Tydec_struct fl2      ->
212 213
       List.length fl1 = List.length fl2
213 214
    && List.for_all2 (fun (f1, t1) (f2, t2) -> f1 = f2 && coretype_equal t1 t2)
214 215
      (List.sort (fun (f1,_) (f2,_) -> compare f1 f2) fl1)
215 216
      (List.sort (fun (f1,_) (f2,_) -> compare f1 f2) fl2)
216 217
  | _                                  -> false
217
  in ((*Format.eprint "coretype_equal %a %a = %B@." Printers.pp_var_type_dec_desc ty1 Printers.pp_var_type_dec_desc ty2 res;*) res)
218
  (*in (Format.eprintf "coretype_equal %a %a = %B@." Printers.pp_var_type_dec_desc ty1 Printers.pp_var_type_dec_desc ty2 res; res)*)
218 219

  
219 220
let tag_true = "true"
220 221
let tag_false = "false"
......
422 423
	| Node _ | ImportedNode _ | Open _ | Consts _ -> types  
423 424
  ) [] prog
424 425

  
426
let get_node_interface nd =
427
 {nodei_id = nd.node_id;
428
  nodei_type = nd.node_type;
429
  nodei_clock = nd.node_clock;
430
  nodei_inputs = nd.node_inputs;
431
  nodei_outputs = nd.node_outputs;
432
  nodei_stateless = nd.node_dec_stateless;
433
  nodei_spec = nd.node_spec;
434
  nodei_prototype = None;
435
  nodei_in_lib = None;
436
 }
437

  
425 438
(************************************************************************)
426 439
(*        Renaming                                                      *)
427 440

  

Also available in: Unified diff