| Attached Files | patch-exn-printers [^] (5,569 bytes) 2011-03-22 19:42 [Show Content] [Hide Content]diff --git a/otherlibs/dynlink/dynlink.ml b/otherlibs/dynlink/dynlink.ml
index 0d324a8..ba0c5e1 100644
--- a/otherlibs/dynlink/dynlink.ml
+++ b/otherlibs/dynlink/dynlink.ml
@@ -36,6 +36,39 @@ type error =
exception Error of error
+let _ =
+ Printexc.register_printer
+ (function
+ | Error error ->
+ let error =
+ match error with
+ | Not_a_bytecode_file name ->
+ Printf.sprintf "Not_a_bytecode_file %S" name
+ | Inconsistent_import name ->
+ Printf.sprintf "Inconsistent_import %S" name
+ | Unavailable_unit name ->
+ Printf.sprintf "Unavailable_unit %S" name
+ | Unsafe_file ->
+ "Unsafe_file"
+ | Linking_error(name, Undefined_global s) ->
+ Printf.sprintf "Linking_error(%S, Dynlink.Undefined_global %S)" name s
+ | Linking_error(name, Unavailable_primitive s) ->
+ Printf.sprintf "Linking_error(%S, Dynlink.Unavailable_primitive %S)" name s
+ | Linking_error(name, Uninitialized_global s) ->
+ Printf.sprintf "Linking_error(%S, Dynlink.Uninitialized_global %S)" name s
+ | Corrupted_interface name ->
+ Printf.sprintf "Corrupted_interface %S" name
+ | File_not_found name ->
+ Printf.sprintf "File_not_found %S" name
+ | Cannot_open_dll reason ->
+ Printf.sprintf "Cannot_open_dll %S" reason
+ | Inconsistent_implementation name ->
+ Printf.sprintf "Inconsistent_implementation %S" name
+ in
+ Some(Printf.sprintf "Dynlink.Error(Dynlink.%s)" error)
+ | _ ->
+ None)
+
(* Management of interface CRCs *)
let crc_interfaces = ref (Consistbl.create ())
diff --git a/otherlibs/unix/unix.ml b/otherlibs/unix/unix.ml
index 8de827b..270fda8 100644
--- a/otherlibs/unix/unix.ml
+++ b/otherlibs/unix/unix.ml
@@ -86,6 +86,86 @@ type error =
exception Unix_error of error * string * string
+let _ =
+ Printexc.register_printer
+ (function
+ | Unix_error(error, func, arg) ->
+ let error =
+ match error with
+ | E2BIG -> "E2BIG"
+ | EACCES -> "EACCES"
+ | EAGAIN -> "EAGAIN"
+ | EBADF -> "EBADF"
+ | EBUSY -> "EBUSY"
+ | ECHILD -> "ECHILD"
+ | EDEADLK -> "EDEADLK"
+ | EDOM -> "EDOM"
+ | EEXIST -> "EEXIST"
+ | EFAULT -> "EFAULT"
+ | EFBIG -> "EFBIG"
+ | EINTR -> "EINTR"
+ | EINVAL -> "EINVAL"
+ | EIO -> "EIO"
+ | EISDIR -> "EISDIR"
+ | EMFILE -> "EMFILE"
+ | EMLINK -> "EMLINK"
+ | ENAMETOOLONG -> "ENAMETOOLONG"
+ | ENFILE -> "ENFILE"
+ | ENODEV -> "ENODEV"
+ | ENOENT -> "ENOENT"
+ | ENOEXEC -> "ENOEXEC"
+ | ENOLCK -> "ENOLCK"
+ | ENOMEM -> "ENOMEM"
+ | ENOSPC -> "ENOSPC"
+ | ENOSYS -> "ENOSYS"
+ | ENOTDIR -> "ENOTDIR"
+ | ENOTEMPTY -> "ENOTEMPTY"
+ | ENOTTY -> "ENOTTY"
+ | ENXIO -> "ENXIO"
+ | EPERM -> "EPERM"
+ | EPIPE -> "EPIPE"
+ | ERANGE -> "ERANGE"
+ | EROFS -> "EROFS"
+ | ESPIPE -> "ESPIPE"
+ | ESRCH -> "ESRCH"
+ | EXDEV -> "EXDEV"
+ | EWOULDBLOCK -> "EWOULDBLOCK"
+ | EINPROGRESS -> "EINPROGRESS"
+ | EALREADY -> "EALREADY"
+ | ENOTSOCK -> "ENOTSOCK"
+ | EDESTADDRREQ -> "EDESTADDRREQ"
+ | EMSGSIZE -> "EMSGSIZE"
+ | EPROTOTYPE -> "EPROTOTYPE"
+ | ENOPROTOOPT -> "ENOPROTOOPT"
+ | EPROTONOSUPPORT -> "EPROTONOSUPPORT"
+ | ESOCKTNOSUPPORT -> "ESOCKTNOSUPPORT"
+ | EOPNOTSUPP -> "EOPNOTSUPP"
+ | EPFNOSUPPORT -> "EPFNOSUPPORT"
+ | EAFNOSUPPORT -> "EAFNOSUPPORT"
+ | EADDRINUSE -> "EADDRINUSE"
+ | EADDRNOTAVAIL -> "EADDRNOTAVAIL"
+ | ENETDOWN -> "ENETDOWN"
+ | ENETUNREACH -> "ENETUNREACH"
+ | ENETRESET -> "ENETRESET"
+ | ECONNABORTED -> "ECONNABORTED"
+ | ECONNRESET -> "ECONNRESET"
+ | ENOBUFS -> "ENOBUFS"
+ | EISCONN -> "EISCONN"
+ | ENOTCONN -> "ENOTCONN"
+ | ESHUTDOWN -> "ESHUTDOWN"
+ | ETOOMANYREFS -> "ETOOMANYREFS"
+ | ETIMEDOUT -> "ETIMEDOUT"
+ | ECONNREFUSED -> "ECONNREFUSED"
+ | EHOSTDOWN -> "EHOSTDOWN"
+ | EHOSTUNREACH -> "EHOSTUNREACH"
+ | ELOOP -> "ELOOP"
+ | EOVERFLOW -> "EOVERFLOW"
+ | EUNKNOWNERR n -> Printf.sprintf "EUNKNOWNERR %d" n
+ in
+ Some(Printf.sprintf "Unix.Unix_error(Unix.%s, %S, %S)" error func arg)
+ | _ ->
+ None)
+
let _ = Callback.register_exception "Unix.Unix_error"
(Unix_error(E2BIG, "", ""))
diff --git a/stdlib/camlheaderd b/stdlib/camlheaderd
index 038dca4..a178ab2 100644
--- a/stdlib/camlheaderd
+++ b/stdlib/camlheaderd
@@ -1 +1 @@
-#!/usr/local/bin/ocamlrund
+#!/home/dim/ocaml-svn/bin/ocamlrund
|