[svn:parrot] r39787 - branches/io_cleanups/src/io
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Fri Jun 26 00:15:16 UTC 2009
Author: whiteknight
Date: Fri Jun 26 00:15:16 2009
New Revision: 39787
URL: https://trac.parrot.org/parrot/changeset/39787
Log:
[io_cleanups] when PARROT_NETWORKING_SUPPORT == 0, we throw exceptions for all the socket API functions. Don't have a way currently to determine whether this is available from PIR except to catch the exceptions and examine them. Will look for a way to do that soon
Modified:
branches/io_cleanups/src/io/socket_api.c
Modified: branches/io_cleanups/src/io/socket_api.c
==============================================================================
--- branches/io_cleanups/src/io/socket_api.c Fri Jun 26 00:09:45 2009 (r39786)
+++ branches/io_cleanups/src/io/socket_api.c Fri Jun 26 00:15:16 2009 (r39787)
@@ -114,6 +114,12 @@
{
ASSERT_ARGS(Parrot_io_socket_is_closed)
PIOHANDLE os_handle;
+
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
GETATTR_Socket_os_handle(interp, socket, os_handle);
#ifdef PIO_OS_WIN32
return (os_handle == (PIOHANDLE)INVALID_HANDLE_VALUE);
@@ -143,6 +149,12 @@
Parrot_io_poll(PARROT_INTERP, ARGMOD(PMC *pmc), INTVAL which, INTVAL sec, INTVAL usec)
{
ASSERT_ARGS(Parrot_io_poll)
+
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
if (PMC_IS_NULL(pmc))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Can't poll a NULL socket object");
@@ -173,6 +185,11 @@
ASSERT_ARGS(Parrot_io_socket)
PMC *new_socket;
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
/* convert Parrot's family to system family */
if (fam < 0 || fam >= PIO_PF_MAX)
return -1;
@@ -212,6 +229,12 @@
Parrot_io_recv(PARROT_INTERP, ARGMOD(PMC *pmc), ARGOUT(STRING **buf))
{
ASSERT_ARGS(Parrot_io_recv)
+
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
if (Parrot_io_socket_is_closed(interp, pmc))
return -1;
@@ -235,6 +258,12 @@
Parrot_io_send(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(STRING *buf))
{
ASSERT_ARGS(Parrot_io_send)
+
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
if (Parrot_io_socket_is_closed(interp, pmc))
return -1;
@@ -256,6 +285,12 @@
Parrot_io_connect(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(PMC *address))
{
ASSERT_ARGS(Parrot_io_connect)
+
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
if (Parrot_io_socket_is_closed(interp, pmc))
return -1;
@@ -278,6 +313,12 @@
Parrot_io_bind(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(PMC *address))
{
ASSERT_ARGS(Parrot_io_bind)
+
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
if (Parrot_io_socket_is_closed(interp, pmc))
return -1;
@@ -300,6 +341,12 @@
Parrot_io_listen(PARROT_INTERP, ARGMOD(PMC *pmc), INTVAL backlog)
{
ASSERT_ARGS(Parrot_io_listen)
+
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
if (Parrot_io_socket_is_closed(interp, pmc))
return -1;
@@ -324,6 +371,12 @@
Parrot_io_accept(PARROT_INTERP, ARGMOD(PMC *pmc))
{
ASSERT_ARGS(Parrot_io_accept)
+
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
if (Parrot_io_socket_is_closed(interp, pmc))
return PMCNULL;
@@ -350,6 +403,11 @@
ASSERT_ARGS(Parrot_io_new_socket_pmc)
PMC * const new_io = pmc_new(interp, enum_class_Socket);
+#if PARROT_NETWORKING_SUPPORT == 0
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Parrot not built with networking support");
+#endif /* PARROT_NETWORKING_SUPPORT */
+
Parrot_io_set_flags(interp, new_io, flags);
return new_io;
More information about the parrot-commits
mailing list