123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960(*
* CSexp - interface to Sexplib
* Copyright (C) 2014 Simon Cruanes
*
* This library 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; either
* version 2.1 of the License, or (at your option) any later version,
* with the special exception on linking described in file LICENSE.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)type'aor_error=[`Okof'a|`Errorofstring]typet=[`Atomofstring|`Listoftlist]letsource=letmoduleD=CConv.Decodeinletrecsrc={D.emit=fundecs->matchswith|`Atoms->dec.D.accept_stringsrcs|`Listl->dec.D.accept_listsrcl}insrcletoutput=letmoduleE=CConv.Encodein{E.unit=`List[];bool=(funb->`Atom(string_of_boolb));float=(funf->`Atom(string_of_floatf));char=(funx->`Atom(String.make1x));nativeint=(funi->`Atom(Nativeint.to_stringi));int32=(funi->`Atom(Int32.to_stringi));int64=(funi->`Atom(Int64.to_stringi));int=(funi->`Atom(string_of_inti));string=(funs->`Atom(String.escapeds));option=(functionNone->`List[]|Somex->`List[x]);list=(funl->`Listl);record=(funl->`List(List.map(fun(a,b)->`List[`Atoma;b])l));tuple=(funl->`Listl);sum=(funnamel->matchlwith|[]->`Atomname|_::_->`List(`Atomname::l));}letencodesrcx=CConv.encodesrcoutputxletdecodedecx=CConv.decodesourcedecxletdecode_exndecx=CConv.decode_exnsourcedecx