pr " WRAP_%s_%s = %d,\n"
(String.uppercase name) (String.uppercase id) i
) en.en_identifiers;
-
- pr " WRAP_%s_ENUM_MAX = %d\n"
- (String.uppercase name) (Array.length en.en_identifiers);
pr "};\n";
pr "typedef int wrap_%s_enum;\n" name;
pr "\n";
ep_includes = []
} in
- eps := StringMap.add fname ep !eps
+ eps := StringMap.add fname ep !eps;
+
+ (* Add an entry point wrap_<name>_enum_nr. *)
+ let fname = sprintf "%s_enum_nr" name in
+ let code = sprintf " return %d;\n" (Array.length en.en_identifiers) in
+ let c_code = {
+ cc_loc = Loc.ghost;
+ cc_code = code;
+ } in
+ let ep = {
+ ep_loc = Loc.ghost;
+ ep_local = true;
+ ep_name = fname;
+ ep_ftype = Return TInt, [], [];
+ ep_code = Some c_code;
+ ep_includes = []
+ } in
+
+ eps := StringMap.add fname ep !eps;
);
{ api with api_entry_points = !eps }
/error-get_error_func.c
/mkdir-mkdir.c
/mknod-mknod_char.c
+/ghost-location-scheme_enum_nr.c
/ghost-location-scheme_enum_to_string.c
/ghost-location-scheme_string_to_enum.c