Project

General

Profile

Revision f6923c9e src/c_backend.ml

View differences:

src/c_backend.ml
819 819
  let main_include, main_print, main_makefile =
820 820
    match !Options.main_node with
821 821
      | "" -> (fun _ -> ()), (fun _ -> ()), (fun _ -> ())
822
      | main_node -> ( 
823
	let main_node_opt = 
824
	  List.fold_left 
825
	  (fun res m -> 
826
	    match res with 
827
	      | Some _ -> res 
828
	      | None -> if m.mname.node_id = main_node then Some m else None)
829
	  None machines
830
      in 
831
      match main_node_opt with
822
      | main_node -> (
823
	match Machine_code.get_machine_opt main_node machines with
832 824
	| None -> eprintf "Unable to find a main node named %s@.@?" main_node; (fun _ -> ()), (fun _ -> ()), (fun _ -> ())
833 825
	| Some m -> print_main_header, print_main_fun machines m, print_makefile basename !Options.main_node
834
    )
826
      )
835 827
  in
836 828
  main_include source_fmt;
837 829
  fprintf source_fmt "#include <stdlib.h>@.#include <assert.h>@.#include \"%s\"@.@." (basename^".h");

Also available in: Unified diff