type parameter = string * ptype * prec option
-type rtype = RVoid | Return of ptype
+type rtype = RVoid | RStaticString | Return of ptype
type ftype = rtype * parameter list * parameter list
-type c_code = string
+type c_code = {
+ cc_loc : Camlp4.PreCast.Loc.t;
+ cc_code : string;
+}
type entry_point = {
ep_loc : Camlp4.PreCast.Loc.t;
ep_name : string;
ep_ftype : ftype;
ep_code : c_code option;
+ ep_includes : string list;
}
type typedef = {
type struct_decl = {
sd_loc : Camlp4.PreCast.Loc.t;
sd_name : string;
- sd_identifiers : string array;
- sd_fields : ptype array;
+ sd_fields : (string * ptype) array;
}
type union = {
un_loc : Camlp4.PreCast.Loc.t;
un_name : string;
- un_identifiers : string array;
- un_fields : ptype array;
+ un_fields : (string * ptype) array;
}
type api = {
| TUnion name -> sprintf "union %s" name
let string_of_rtype = function
| RVoid -> "void"
+ | RStaticString -> "static_string"
| Return t -> string_of_ptype t
let string_of_parameter (name, t, _) =
sprintf "%s %s" (string_of_ptype t) name
let string_of_ftype (ret, req, opt) =
sprintf "%s %s %s"
(string_of_rtype ret) (string_of_parameters req) (string_of_parameters opt)
-let string_of_c_code code = code
+let string_of_c_code code = code.cc_code
let string_of_typedef td =
sprintf "typedef %s %s" td.td_name (string_of_ptype td.td_type)