1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798(*********************************************************************************)(* OCaml-RDF *)(* *)(* Copyright (C) 2012-2024 Institut National de Recherche en Informatique *)(* et en Automatique. All rights reserved. *)(* *)(* This program is free software; you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License version *)(* 3 as published by the Free Software Foundation. *)(* *)(* 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 *)(* *)(* Contact: Maxence.Guesdon@inria.fr *)(* *)(*********************************************************************************)(** *)letstring_of_opt=functionNone->""|Somes->s;;letopt_of_string=function""->None|s->Somes;;letmap_optf=functionNone->None|Somex->Some(fx);;letopt_comparefv1v2=matchv1,v2withNone,None->0|None,_->-1|_,None->1|Somev1,Somev2->fv1v2;;letcompare_listcomp=letreciterl1l2=matchl1,l2with[],[]->0|[],_->-1|_,[]->1|h1::q1,h2::q2->matchcomph1h2with0->iterq1q2|n->niniter;;(*c==v=[File.string_of_file]=1.1====*)letstring_of_filename=letchanin=open_in_binnameinletlen=1024inlets=Bytes.createleninletbuf=Buffer.createleninletreciter()=tryletn=inputchanins0leninifn=0then()else(Buffer.add_subbytesbufs0n;iter())withEnd_of_file->()initer();close_inchanin;Buffer.contentsbuf(*/c==v=[File.string_of_file]=1.1====*)(*c==v=[String.split_string]=1.2====*)letsplit_string?(keep_empty=false)schars=letlen=String.lengthsinletreciteraccpos=ifpos>=lenthenmatchaccwith""->ifkeep_emptythen[""]else[]|_->[acc]elseifList.mems.[pos]charsthenmatchaccwith""->ifkeep_emptythen""::iter""(pos+1)elseiter""(pos+1)|_->acc::(iter""(pos+1))elseiter(Printf.sprintf"%s%c"accs.[pos])(pos+1)initer""0(*/c==v=[String.split_string]=1.2====*)