Project

General

Profile

« Previous | Next » 

Revision 6d1693b9

Added by LĂ©lio Brun 7 months ago

work on spec generation almost done

View differences:

src/backends/C/c_backend_header.ml
22 22

  
23 23

  
24 24
module type MODIFIERS_HDR = sig
25
  module GhostProto: MODIFIERS_GHOST_PROTO
25 26
  val print_machine_decl_prefix: Format.formatter -> machine_t -> unit
26 27
  val pp_import_standard_spec: formatter -> unit -> unit
27 28
end
28 29

  
29 30
module EmptyMod = struct
31
  module GhostProto = EmptyGhostProto
30 32
  let print_machine_decl_prefix = fun _ _ -> ()
31 33
  let pp_import_standard_spec _ _ = ()
32 34
end
33 35

  
34 36
module Main = functor (Mod: MODIFIERS_HDR) -> struct
35 37

  
38
  module Protos = Protos(Mod.GhostProto)
39

  
36 40
  let print_import_standard fmt () =
37 41
    (* if Machine_types.has_machine_type () then *)
38 42
    fprintf fmt
......
231 235
        assert false
232 236
      end
233 237
    else if inode.nodei_stateless then
234
      fprintf fmt "extern %a;" print_stateless_prototype prototype
238
      fprintf fmt "extern %a;" Protos.print_stateless_prototype prototype
235 239
    else
236 240
      let static_inputs = List.filter (fun v -> v.var_dec_const)
237 241
          inode.nodei_inputs in
......
239 243
        List.exists (fun v -> v.var_id = name)
240 244
          (inode.nodei_inputs @ inode.nodei_outputs) in
241 245
      let self = mk_new_name used "self" in
246
      let mem = mk_new_name used "mem" in
242 247
      let static_prototype = (inode.nodei_id, static_inputs) in
243 248
      fprintf fmt
244 249
        "extern %a;@,\
250
         extern %a;@,\
245 251
         extern %a;@,\
246 252
         extern %a;@,\
247 253
         extern %a;"
248
        (print_reset_prototype self) static_prototype
249
        (print_init_prototype self) static_prototype
250
        (print_clear_prototype self) static_prototype
251
        (print_step_prototype self) prototype
254
        (Protos.print_set_reset_prototype self mem) static_prototype
255
        (Protos.print_clear_reset_prototype self mem) static_prototype
256
        (Protos.print_init_prototype self) static_prototype
257
        (Protos.print_clear_prototype self) static_prototype
258
        (Protos.print_step_prototype self mem) prototype
252 259

  
253 260
  let print_const_top_decl fmt tdecl =
254 261
    let cdecl = const_of_top tdecl in

Also available in: Unified diff