summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/win32unix')
-rw-r--r--otherlibs/win32unix/Makefile.nt1
-rw-r--r--otherlibs/win32unix/unixsupport.c25
-rw-r--r--otherlibs/win32unix/unixsupport.h1
3 files changed, 19 insertions, 8 deletions
diff --git a/otherlibs/win32unix/Makefile.nt b/otherlibs/win32unix/Makefile.nt
index f9408a643..6f15bf7c5 100644
--- a/otherlibs/win32unix/Makefile.nt
+++ b/otherlibs/win32unix/Makefile.nt
@@ -83,6 +83,7 @@ install:
cp dllunix.dll $(STUBLIBDIR)/dllunix.dll
cp libunix.$(A) $(LIBDIR)/libunix.$(A)
cp $(CAML_OBJS:.cmo=.cmi) unix.cma $(CAML_OBJS:.cmo=.mli) $(LIBDIR)
+ cp unixsupport.h $(LIBDIR)
installopt:
cp unix.cmxa $(CAML_OBJS:.cmo=.cmx) unix.$(A) $(LIBDIR)
diff --git a/otherlibs/win32unix/unixsupport.c b/otherlibs/win32unix/unixsupport.c
index 90cade2a0..b7d4ad92d 100644
--- a/otherlibs/win32unix/unixsupport.c
+++ b/otherlibs/win32unix/unixsupport.c
@@ -221,6 +221,22 @@ int error_table[] = {
static value * unix_error_exn = NULL;
+value unix_error_of_code (int errcode)
+{
+ int errconstr;
+ value err;
+
+ errconstr =
+ cst_to_constr(errcode, error_table, sizeof(error_table)/sizeof(int), -1);
+ if (errconstr == Val_int(-1)) {
+ err = alloc_small(1, 0);
+ Field(err, 0) = Val_int(errcode);
+ } else {
+ err = errconstr;
+ }
+ return err;
+}
+
void unix_error(int errcode, char *cmdname, value cmdarg)
{
value res;
@@ -230,14 +246,7 @@ void unix_error(int errcode, char *cmdname, value cmdarg)
Begin_roots3 (name, err, arg);
arg = cmdarg == Nothing ? copy_string("") : cmdarg;
name = copy_string(cmdname);
- errconstr =
- cst_to_constr(errcode, error_table, sizeof(error_table)/sizeof(int), -1);
- if (errconstr == Val_int(-1)) {
- err = alloc_small(1, 0);
- Field(err, 0) = Val_int(errcode);
- } else {
- err = errconstr;
- }
+ err = unix_error_of_code (errcode);
if (unix_error_exn == NULL) {
unix_error_exn = caml_named_value("Unix.Unix_error");
if (unix_error_exn == NULL)
diff --git a/otherlibs/win32unix/unixsupport.h b/otherlibs/win32unix/unixsupport.h
index 195db0351..57f4caa68 100644
--- a/otherlibs/win32unix/unixsupport.h
+++ b/otherlibs/win32unix/unixsupport.h
@@ -45,6 +45,7 @@ extern int win_CRT_fd_of_filedescr(value handle);
#define Nothing ((value) 0)
extern void win32_maperr(DWORD errcode);
+extern value unix_error_of_code (int errcode);
extern void unix_error (int errcode, char * cmdname, value arg);
extern void uerror (char * cmdname, value arg);
extern value unix_freeze_buffer (value);