Commit af0ec9f1 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2006-03-26 15:54:27 by afrisch] dump_to_file produce catchable exceptions

Original author: afrisch
Date: 2006-03-26 15:54:27+00:00
parent b7d1f828
......@@ -77,6 +77,9 @@ let unary_op_warning name targ w t run =
open Ident
let raise_gen exn =
raise (Value.CDuceExn (Value.string_latin1 (Printexc.to_string exn)))
let exn_load_file_utf8 = lazy (
Value.CDuceExn (
Value.Pair (
......@@ -288,22 +291,24 @@ register_fun "make_atom"
binary_op_warning2 "dump_to_file"
string_latin1 string string_latin1 nil
(fun f v ->
(fun f v -> try
Location.protect_op "dump_to_file";
let oc = open_out (Value.get_string_latin1 f) in
output_string oc (Value.get_string_latin1 v);
close_out oc;
Value.nil);;
Value.nil
with exn -> raise_gen exn);;
binary_op_cst "dump_to_file_utf8"
string_latin1 string nil
(fun f v ->
(fun f v -> try
Location.protect_op "dump_to_file_utf8";
let oc = open_out (Value.get_string_latin1 f) in
let (v,_) = Value.get_string_utf8 v in
output_string oc (U.get_str v);
close_out oc;
Value.nil);;
Value.nil
with exn -> raise_gen exn);;
(* Integer operators *)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment