12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2010 Jérôme Vouillon
* Laboratoire PPS - CNRS Université Paris Diderot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)open!Stdlibletaliases=Hashtbl.create17letrecresolvenm=tryresolve(Hashtbl.findaliasesnm)withNot_found->nm(****)typekind=[`Pure|`Mutable|`Mutator]typekind_arg=[`Shallow_const|`Object_literal|`Const|`Mutable]typet=[`RequiresofParse_info.toption*stringlist|`ProvidesofParse_info.toption*string*kind*kind_arglistoption|`VersionofParse_info.toption*((int->int->bool)*string)list|`WeakdefofParse_info.toption]letkinds=Hashtbl.create37letkind_args_tbl=Hashtbl.create37letarities=Hashtbl.create37letkindnm=tryHashtbl.findkinds(resolvenm)withNot_found->`Mutatorletkind_argsnm=trySome(Hashtbl.findkind_args_tbl(resolvenm))withNot_found->Noneletaritynm=Hashtbl.findarities(resolvenm)lethas_aritynma=tryHashtbl.findarities(resolvenm)=awithNot_found->falseletis_purenm=Poly.(kindnm<>`Mutator)letexistsp=Hashtbl.memkindspletexternals=refStringSet.emptyletadd_externalname=externals:=StringSet.addname!externalsletis_externalname=StringSet.memname!externalsletget_external()=!externalsletregisterpkkargsarity=add_externalp;(matcharitywith|Somea->Hashtbl.addaritiespa|_->());(matchkargswith|Somek->Hashtbl.addkind_args_tblpk|_->());Hashtbl.addkindspkletaliasnmnm'=add_externalnm';add_externalnm;Hashtbl.addaliasesnmnm'letnamed_values=refStringSet.emptyletneed_named_values=StringSet.mems!named_valuesletregister_named_values=named_values:=StringSet.adds!named_values