Project

General

Profile

Revision 5fccce23 src/backends/C/c_backend_src.ml

View differences:

src/backends/C/c_backend_src.ml
271 271
  let imported_node_opt = (* We select the last imported node with the name funname.
272 272
			       The order of evaluation of dependencies should be
273 273
			       compatible with overloading. (Not checked yet) *) 
274
      List.fold_left
275
	(fun res (Dep (_, _, decls, _)) -> 
276
	  match res with
277
	  | Some _ -> res
278
	  | None -> 
279
	    let matched = fun t -> match t.top_decl_desc with 
280
	      | ImportedNode nd -> nd.nodei_id = funname 
281
	      | _ -> false
282
	    in
283
	    if List.exists matched decls then (
284
	      match (List.find matched decls).top_decl_desc with
285
	      | ImportedNode nd -> Some nd
286
	      | _ -> assert false
287
	    )
288
	    else
289
	      None
290
	) None dependencies in
291
    match imported_node_opt with
292
    | None -> false
293
    | Some nd -> (match nd.nodei_prototype with Some "C" -> true | _ -> false)
274
    List.fold_left
275
      (fun res dep -> 
276
	match res with
277
	| Some _ -> res
278
	| None ->
279
           let decls = dep.content in
280
	   let matched = fun t -> match t.top_decl_desc with 
281
	                          | ImportedNode nd -> nd.nodei_id = funname 
282
	                          | _ -> false
283
	   in
284
	   if List.exists matched decls then (
285
	     match (List.find matched decls).top_decl_desc with
286
	     | ImportedNode nd -> Some nd
287
	     | _ -> assert false
288
	   )
289
	   else
290
	     None
291
      ) None dependencies in
292
  match imported_node_opt with
293
  | None -> false
294
  | Some nd -> (match nd.nodei_prototype with Some "C" -> true | _ -> false)
294 295
(*
295 296
let pp_instance_call dependencies m self fmt i (inputs: value_t list) (outputs: var_decl list) =
296 297
  try (* stateful node instance *)
......
687 688

  
688 689
let print_lib_c source_fmt basename prog machines dependencies =
689 690
  print_import_standard source_fmt;
690
  print_import_prototype source_fmt (Dep (true, basename, [], true (* assuming it is stateful *)));
691
  print_import_prototype source_fmt {local=true; name=basename; content=[]; is_stateful=true} (* assuming it is stateful *);
691 692
  pp_print_newline source_fmt ();
692 693
  (* Print the svn version number and the supported C standard (C90 or C99) *)
693 694
  print_version source_fmt;

Also available in: Unified diff