12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091(*
* Copyright (c) 2014 Leo White <leo@lpw25.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)letcontains_double_underscores=letlen=String.lengthsinletrecauxi=ifi>len-2thenfalseelseifs.[i]='_'&&s.[i+1]='_'thentrueelseaux(i+1)inaux0modulePackage=structtypet=stringmoduleTable=Hashtbl.Make(structtypenonrect=tletequal:t->t->bool=(=)lethash:t->int=Hashtbl.hashend)endmoduleOdoc_file=structtypecompilation_unit={name:string;hidden:bool}typet=Pageofstring|Compilation_unitofcompilation_unitletcreate_unit~force_hiddenname=lethidden=force_hidden||contains_double_underscorenameinCompilation_unit{name;hidden}letcreate_pagename=Pagenameletname=functionPagename|Compilation_unit{name;_}->namelethidden=functionPage_->false|Compilation_unitm->m.hiddenendtypet={id:Paths.Identifier.OdocId.t;file:Odoc_file.t;digest:Digest.t;}letequal:t->t->bool=(=)lethash:t->int=Hashtbl.hashletto_stringt=letrecppfmt(id:Paths.Identifier.OdocId.t)=matchid.ivwith|`LeafPage(parent,name)|`Page(parent,name)->(matchparentwith|Somep->Format.fprintffmt"%a::%a"pp(p:>Paths.Identifier.OdocId.t)Names.PageName.fmtname|None->Format.fprintffmt"%a"Names.PageName.fmtname)|`Root(Someparent,name)->Format.fprintffmt"%a::%a"pp(parent:>Paths.Identifier.OdocId.t)Names.ModuleName.fmtname|`Root(None,name)->Format.fprintffmt"%a"Names.ModuleName.fmtnameinFormat.asprintf"%a"ppt.idletcomparexy=String.comparex.digesty.digestmoduleHash_table=Hashtbl.Make(structtypenonrect=tletequal=equallethash=hashend)