1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*)open!Stdlibtypet=intlistletsplitv=matchString.split_char~sep:'+'vwith|[]->assertfalse|x::_->List.map(String.split_char~sep:'.'x)~f:int_of_stringletcurrent=splitSys.ocaml_versionletcompint(a:int)b=compareabletreccomparevv'=matchv,v'with|[x],[y]->compintxy|[],[]->0|[],y::_->compint0y|x::_,[]->compintx0|x::xs,y::ys->(matchcompintxywith|0->comparexsys|n->n)letv=ifcomparecurrent[4;3]<0then`V4_02elseifcomparecurrent[4;4]<0then`V4_03elseifcomparecurrent[4;6]<0then`V4_04elseifcomparecurrent[4;7]<0then`V4_06elseifcomparecurrent[4;8]<0then`V4_07elseifcomparecurrent[4;9]<0then`V4_08else`V4_09