mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 17:20:29 +02:00
2001-11-07 Stefan Jahn <stefan@lkcc.org>
* configure.in: Include `win32-socket.o' in the list of object files if networking is enabled on Win32. 2001-11-07 Stefan Jahn <stefan@lkcc.org> * win32-socket.[ch]: New files. Defines Winsock-API error codes and makes them available through Guile. That is because the Winsock-API does not store its errors in `errno' and thus cannot return error messages via `strerror (errno)'. * socket.c (scm_init_socket): Initialize `win32-socket' part here under M$-Windows. * numbers.h: Added missing declaration of `scm_sys_check_number_conversions()'. * error.c: Local definition of SCM_I_STRERROR and SCM_I_ERRNO and use in `(strerror)' and `(system-error)'. * Makefile.am (EXTRA_libguile_la_SOURCES): Added `win32-socket.[ch]' to extra source and header files.
This commit is contained in:
parent
2ca222c2e9
commit
b4e15479e9
12 changed files with 525 additions and 14 deletions
|
@ -151,6 +151,17 @@ SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# include "win32-socket.h"
|
||||
# define SCM_I_STRERROR(err) \
|
||||
((err >= WSABASEERR) ? scm_i_socket_strerror (err) : strerror (err))
|
||||
# define SCM_I_ERRNO() \
|
||||
(errno ? errno : scm_i_socket_errno ())
|
||||
#else
|
||||
# define SCM_I_STRERROR(err) strerror (err)
|
||||
# define SCM_I_ERRNO() errno
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
|
||||
(SCM err),
|
||||
"Return the Unix error message corresponding to @var{err}, which\n"
|
||||
|
@ -158,7 +169,7 @@ SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
|
|||
#define FUNC_NAME s_scm_strerror
|
||||
{
|
||||
SCM_VALIDATE_INUM (1,err);
|
||||
return scm_makfrom0str (strerror (SCM_INUM (err)));
|
||||
return scm_makfrom0str (SCM_I_STRERROR (SCM_INUM (err)));
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
@ -166,12 +177,12 @@ SCM_GLOBAL_SYMBOL (scm_system_error_key, "system-error");
|
|||
void
|
||||
scm_syserror (const char *subr)
|
||||
{
|
||||
int save_errno = errno;
|
||||
int save_errno = SCM_I_ERRNO ();
|
||||
|
||||
scm_error (scm_system_error_key,
|
||||
subr,
|
||||
"~A",
|
||||
scm_cons (scm_makfrom0str (strerror (save_errno)), SCM_EOL),
|
||||
scm_cons (scm_makfrom0str (SCM_I_STRERROR (save_errno)), SCM_EOL),
|
||||
scm_cons (SCM_MAKINUM (save_errno), SCM_EOL));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue