123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126# 1 "src/lib/eliom_route.client.ml"typeinfo={i_sess_info:Eliom_common.sess_info;i_subpath:stringlist;i_meth:Eliom_common.meth;i_get_params:(string*string)list;i_post_params:(string*string)list}moduleA=structtypesite_data=unittypeinfo'=infotypeinfo=info'(* the suffix is the only thing we seem to need *)typeparams=stringlistoptiontyperesult=Eliom_service.resultletsite_data_=()letsess_info_of_info{i_sess_info;_}=i_sess_infoletsubpath_of_info{i_subpath;_}=i_subpathletmeth_of_info{i_meth;_}=i_methletmake_params__suffix_=suffixletget_number_of_reloads=letcount=ref0infun()->count:=!count+1;!countmoduleRaw_table=Map.Make(structtypet=Eliom_common.methletcompare=compareend)typetable_content=[`Ptcofunitoption*(params,result)Eliom_common.servicelist]typeservice=(tableref*Eliom_common.page_table_key,Eliom_common.na_key_serv)Eliom_lib.leftrightandnode=servicelistandtable=table_contentRaw_table.tmoduleTable=structtypet=tableletadd{Eliom_common.key_meth;_}pm=Raw_table.addkey_meth(`Ptcp)mletfind{Eliom_common.key_meth;_}m=let(`Ptcv)=Raw_table.findkey_methminvletempty()=Raw_table.emptyletremove{Eliom_common.key_meth;_}=Raw_table.removekey_methend(* FIXME: dummy *)moduleNode=structtypet=unitletup_=()letremove_=()endmoduleContainer=structtypet={mutablet_services:(int*int*Table.tEliom_common.dircontentref)list;mutablet_contains_timeout:bool;mutablet_na_services:(Eliom_common.na_key_serv,bool->params->resultLwt.t)Hashtbl.t}letget{t_services;_}=t_servicesletset_contains_timeoutab=a.t_contains_timeout<-bletsettablesl=tables.t_services<-lletdlist_add?sp:__tables_srv=()endlethandle_directory_=Lwt.returnEliom_service.No_contentsendincludeEliom_route_base.Make(A)letglobal_tables=A.Container.{t_services=[];t_contains_timeout=false;t_na_services=Hashtbl.create256}letadd_naservicekf{A.Container.t_na_services;_}=Hashtbl.addt_na_serviceskfletcall_naservicek{A.Container.t_na_services;_}=try(Hashtbl.findt_na_servicesk)trueNonewithNot_found->Lwt.failEliom_common.Eliom_404letrecna_key_of_params~get=function|(k,v)::_whenk=Eliom_common.naservice_name->Some(ifgetthenEliom_common.SNa_get_velseEliom_common.SNa_post_v)|(k,v)::_whenk=Eliom_common.naservice_num->Some(ifgetthenEliom_common.SNa_get'velseEliom_common.SNa_post'v)|_::l->na_key_of_params~getl|[]->Noneletrecremove_site_dirpp'=matchp,p'with|h::t,h'::t'whenh=h'->remove_site_dirtt'|[],t->Somet|_->Noneletcall_service({i_get_params;i_post_params;i_subpath;_}asinfo)=letinfo=matchremove_site_dir(Eliom_request_info.get_site_dir())i_subpathwith|Somei_subpath->{infowithi_subpath}|None->infoinmatchna_key_of_params~get:truei_get_paramswith|Somek->call_naservicekglobal_tables|None->(matchna_key_of_params~get:falsei_post_paramswith|Somek->call_naservicekglobal_tables|None->find_service0.global_tablesNone()info)