Ignore:
Timestamp:
Apr 4, 2011, 5:18:15 PM (9 years ago)
Author:
ayache
Message:

New memory model and bug fixes in 8051 branch. Added primitive operations in interpreters from Clight to LIN.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/clight/clightParser.ml

    r486 r740  
    11let process file =
    2   let tmp_file = Filename.temp_file "cparser" ".i"
     2  let tmp_file1 = Filename.temp_file "cparser1" ".c"
     3  and tmp_file2 = Filename.temp_file "cparser2" ".i"
    34  and prepro_opts = [] in
     5
     6  (* Add CerCo's primitives *)
     7  let _ =
     8    try
     9      let oc = open_out tmp_file1 in
     10      output_string oc Primitive.prototypes ;
     11      close_out oc
     12    with Sys_error _ -> failwith "Error adding primitive prototypes." in
     13  let rc = Sys.command
     14    (Printf.sprintf "cat %s >> %s"
     15       (Filename.quote file) (Filename.quote tmp_file1)) in
     16  if rc <> 0 then (
     17    Misc.SysExt.safe_remove tmp_file1;
     18    failwith "Error adding primitive prototypes."
     19  );
    420
    521  (* Preprocessing *)
     
    824    (Printf.sprintf "gcc -E -U__GNUC__ %s %s > %s"
    925       (String.concat " " (List.map Filename.quote prepro_opts))
    10        (Filename.quote file) (Filename.quote tmp_file)) in
     26       (Filename.quote tmp_file1) (Filename.quote tmp_file2)) in
    1127  if rc <> 0 then (
    12     Misc.SysExt.safe_remove tmp_file; failwith "Error calling gcc."
     28    Misc.SysExt.safe_remove tmp_file1;
     29    Misc.SysExt.safe_remove tmp_file2;
     30    failwith "Error calling gcc."
    1331  );
    1432
    1533  (* C to Cil *)
    16   let r = Cparser.Parse.preprocessed_file "CSf" file tmp_file in
    17   Misc.SysExt.safe_remove tmp_file;
     34  let r = Cparser.Parse.preprocessed_file "CSf" file tmp_file2 in
     35  Misc.SysExt.safe_remove tmp_file1;
     36  Misc.SysExt.safe_remove tmp_file2;
    1837  match r with
    1938    | None -> failwith "Error during C parsing."
Note: See TracChangeset for help on using the changeset viewer.