1234567891011121314151617181920212223242526272829303132333435363738(**************************************************************************)(* *)(* OCaml *)(* *)(* The OCaml programmers *)(* *)(* Copyright 2018 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)externalid:'a->'a="%identity"letconstc_=cletflipfxy=fyxletnegatepv=not(pv)exceptionFinally_raisedofexnlet()=Printexc.register_printer@@function|Finally_raisedexn->Some("Fun.Finally_raised: "^Printexc.to_stringexn)|_->Noneletprotect~(finally:unit->unit)work=letfinally_no_exn()=tryfinally()withe->letbt=Printexc.get_raw_backtrace()inPrintexc.raise_with_backtrace(Finally_raisede)btinmatchwork()with|result->finally_no_exn();result|exceptionwork_exn->letwork_bt=Printexc.get_raw_backtrace()infinally_no_exn();Printexc.raise_with_backtracework_exnwork_bt