12345678910111213141516171819202122232425262728293031323334353637383940414243(* Configuration of extension:
* Should we geneate C++ code, should we add debug printing, etc. *)typeconfig={mutablegencpp:bool;mutabledestdir:string;mutableext:string;mutableinsert_locks:bool;mutabletrace_locks:bool}letconfig={gencpp=true;destdir=".";ext="cpp";insert_locks=true;trace_locks=false};;exceptionErrorMsgofstring*Location.tlet()=Location.register_error_of_exn(funexn->matchexnwith|ErrorMsg(msg,loc)->Some(Location.error~locmsg)|_->None);;letppxqt_failed~locmsg=raise@@ErrorMsg(msg,loc)openPpxlibopenBaseletrechas_attrname:Parsetree.attributes->bool=function|[]->false|{attr_name={txt;_};_}::_whenString.equaltxtname->true|_::xs->has_attrnamexs;;letfind_attr_exn~namexs=List.find_map_exnxs~f:(fun{attr_name={txt;_};attr_payload}->ifString.equaltxtnamethenSomeattr_payloadelseNone);;letfind_attr~namexs=List.find_mapxs~f:(fun{attr_name={txt;_};attr_payload}->ifString.equaltxtnamethenSomeattr_payloadelseNone);;