| None -> <:expr< None >>
| Some x -> <:expr< Some $x$ >>
+(* Convert a _loc to an AST. *)
+let expr_of_loc _loc loc =
+ let file_name,
+ start_line, start_bol, start_off,
+ stop_line, stop_bol, stop_off,
+ ghost = Loc.to_tuple loc in
+ <:expr< Camlp4.PreCast.Loc.of_tuple
+ ($str:file_name$,
+ $`int:start_line$, $`int:start_bol$, $`int:start_off$,
+ $`int:stop_line$, $`int:stop_bol$, $`int:stop_off$,
+ $`bool:ghost$) >>
+
let add_entry_point _loc name parameters return_type code =
let parameters = List.map (
fun (name, t) -> <:expr< ($str:name$, $t$) >>
let code = expr_of_option _loc code in
+ let loc = expr_of_loc _loc _loc in
+
<:str_item<
- let ep = { Wrappi_types.ep_name = $str:name$;
+ let ep = { Wrappi_types.ep_loc = $loc$;
+ ep_name = $str:name$;
ep_params = $parameters$;
ep_return = $return_type$;
ep_code = $code$ } in
(* A parameter or return type. *)
any_type: [
- [ "int32" -> <:expr< Wrappi_types.TInt32 >> ]
+ [ "fileperm" -> <:expr< Wrappi_types.TFilePerm >> ]
+ | [ "int32" -> <:expr< Wrappi_types.TInt32 >> ]
| [ "int64" -> <:expr< Wrappi_types.TInt64 >> ]
- | [ t = LIDENT -> <:expr< Wrappi_types.Type $str:t$ >> ]
+ | [ "pathname" -> <:expr< Wrappi_types.TPathname >> ]
+ | [ "uint32" -> <:expr< Wrappi_types.TUInt32 >> ]
+ | [ "uint64" -> <:expr< Wrappi_types.TUInt64 >> ]
];
(* A return type. *)