generator: Don't die if an API call isn't listed in API versions file.

For example, it may just have been added.
This commit is contained in:
Richard W.M. Jones
2010-11-05 13:42:07 +00:00
parent 12cf2f732a
commit 9f7926e727
3 changed files with 9 additions and 7 deletions

View File

@@ -39,6 +39,5 @@ let load_api_versions filename =
close_in chan
let lookup_api_version sym =
try Hashtbl.find hash sym
with Not_found ->
failwithf "API symbol \"%s\" not found in API versions file" sym
try Some (Hashtbl.find hash sym)
with Not_found -> None

View File

@@ -25,7 +25,8 @@
val load_api_versions : string -> unit
(** Load the data from the named file. *)
val lookup_api_version : string -> string
val lookup_api_version : string -> string option
(** [lookup_api_version c_api] looks up the version that the C API call
(which must be the full C name, eg. ["guestfs_launch"]) was
added. This returns the version string, eg. ["0.3"]. *)
added. This returns the version string, eg. [Some "0.3"], or
[None] if no version could be found. *)

View File

@@ -255,8 +255,10 @@ L</KEYS AND PASSPHRASES> for more information.\n\n";
| None -> ()
| Some txt -> pr "%s\n\n" txt
);
let version = lookup_api_version name in
pr "(Added in %s)\n\n" version;
(match lookup_api_version name with
| Some version -> pr "(Added in %s)\n\n" version
| None -> ()
);
(* Handling of optional argument variants. *)
if optargs <> [] then (