2 * Copyright (C) 2010 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 (* Please read generator/README first. *)
23 let hash = Hashtbl.create 13
25 let load_api_versions filename =
26 let chan = open_in filename in
28 let line = input_line chan in
30 match string_split " " line with
31 | [ sym; ver ] -> sym, ver
33 failwithf "%s: %d: invalid input in API versions file"
35 Hashtbl.replace hash sym ver;
38 (try loop 1 with End_of_file -> ());
41 let lookup_api_version sym =
42 try Some (Hashtbl.find hash sym)
43 with Not_found -> None