Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file doclist.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107(*********************************************************************************)(* Stog *)(* *)(* Copyright (C) 2012-2015 INRIA All rights reserved. *)(* Author: Maxence Guesdon, INRIA Saclay *)(* *)(* This program is free software; you can redistribute it and/or modify *)(* it under the terms of the GNU General Public License as *)(* published by the Free Software Foundation, version 3 of the License. *)(* *)(* 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 General Public License for more details. *)(* *)(* You should have received a copy of the GNU 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 *)(* *)(* As a special exception, you have permission to link this program *)(* with the OCaml compiler and distribute executables, as long as you *)(* follow the requirements of the GNU GPL in regard to all of the *)(* software in the executable aside from the OCaml compiler. *)(* *)(* Contact: Maxence.Guesdon@inria.fr *)(* *)(*********************************************************************************)(** *)openTypes;;moduleXR=Xtmpl.Rewriteletdocs?set?setname?filter?typ?max?(reverse=true)?(sort=[])stogenv=letdocs=matchsetwithSomeset->letl=Types.Doc_set.elementssetinList.map(funid->(id,Types.docstogid))l|None->Types.doc_list?set:setnamestoginlet(stog,docs)=matchfilterwithNone->(stog,docs)|Somefilter->Filter.filter_docsstogenvfilterdocsinletdocs=matchtypwith|None|Some[]->docs|Sometypes->List.filter(fun(_,doc)->List.memdoc.doc_typetypes)docsinlet(stog,docs)=matchsortwith[]->(stog,Types.sort_ids_docs_by_datedocs)|fields->let(stog,docs)=List.fold_left(fun(stog,acc)(id,e)->let(stog,env)=Engine.doc_envstogenvstogein(stog,((id,e,env)::acc)))(stog,[])docsinTypes.sort_ids_docs_by_rulesstogfieldsdocsinletdocs=ifreversethenList.revdocselsedocsinletdocs=matchmaxwithNone->docs|Somen->Stog_base.Misc.list_chopndocsin(*prerr_endline (Printf.sprintf "List.docs: %d docs returned" (List.length docs));*)(stog,docs);;letdocs_of_args?setstogenvargs=letsetname=XR.get_att_cdataargs("","set")inletfilter=Stog_base.Misc.map_optFilter.filter_of_string(XR.get_att_cdataargs("","filter"))inlettyp=matchXR.get_att_cdataargs("","type")withNone|Some""->None|Somes->Some(Stog_base.Misc.split_strings[',';';'])inletmax=Stog_base.Misc.map_optint_of_string(XR.get_att_cdataargs("","max"))inletreverse=matchXR.get_att_cdataargs("","reverse")withNone->true|Somes->Io.bool_of_stringsinletsort=matchXR.get_att_cdataargs("","sort")withNone->None|Somes->Some(Stog_base.Misc.split_strings[','])indocs?set?setname?filter?typ?max~reverse?sortstogenv;;