123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960(**************************************************************************)(* *)(* All rights reserved.This file is distributed under the terms of the *)(* GNU Lesser General Public License version 2.1 with linking *)(* exception. *)(* *)(* TypeRex 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 *)(* Lesser GNU General Public License for more details. *)(* *)(**************************************************************************)moduleSS=Set.Make(String)letloaded=refSS.emptyletpredicates=ifDynlink.is_nativethen["plugin";"native"]else["plugin";"byte"]letdynlinkdebugs=ifdebugthenFormat.eprintf"loading archive %s..@."s;tryDynlink.loadfileswithexc->Format.eprintf"Error while linking %s : %s@."s(Printexc.to_stringexc);raiseexcletload_pkgdebugpkg=ifnot(SS.mempkg!loaded)thenbeginletd=Findlib.package_directorypkginletarchive=tryFindlib.package_propertypredicatespkg"archive"withNot_found->""inletarchives=Util.string_split' 'archiveinList.iter(funarch->ifarch<>""thenletarch'=Findlib.resolve_path~base:darchindynlinkdebugarch')archives;loaded:=SS.addpkg!loadedendletrecpartitionmodspkgs=function|[]->List.revpkgs,List.revmods|`Modm::rest->partition(m::mods)pkgsrest|`Pkgp::rest->partitionmods(p::pkgs)restletload?(debug=false)l=letpkglist,mods=partition[][]linList.iter(dynlinkdebug)mods;leteff_pkglist=Findlib.package_deep_ancestorspredicatespkglistinList.iter(load_pkgdebug)eff_pkglist