[svn:parrot] r39788 - in branches/io_cleanups: include/parrot src/interp src/io
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Fri Jun 26 00:44:14 UTC 2009
Author: whiteknight
Date: Fri Jun 26 00:44:14 2009
New Revision: 39788
URL: https://trac.parrot.org/parrot/changeset/39788
Log:
[io_cleanups] Add a NETWORKING_SUPPORT flag to the interpinfo opcode, so we can determine from PIR whether we have socket support built in or not. No tests yet
Modified:
branches/io_cleanups/include/parrot/gc_api.h
branches/io_cleanups/include/parrot/io.h
branches/io_cleanups/src/interp/inter_misc.c
branches/io_cleanups/src/io/socket_api.c
Modified: branches/io_cleanups/include/parrot/gc_api.h
==============================================================================
--- branches/io_cleanups/include/parrot/gc_api.h Fri Jun 26 00:15:16 2009 (r39787)
+++ branches/io_cleanups/include/parrot/gc_api.h Fri Jun 26 00:44:14 2009 (r39788)
@@ -112,6 +112,7 @@
GC_LAZY_MARK_RUNS,
EXTENDED_PMCS,
CURRENT_RUNCORE,
+ NETWORKING_SUPPORT,
/* interpinfo_p constants */
CURRENT_SUB,
Modified: branches/io_cleanups/include/parrot/io.h
==============================================================================
--- branches/io_cleanups/include/parrot/io.h Fri Jun 26 00:15:16 2009 (r39787)
+++ branches/io_cleanups/include/parrot/io.h Fri Jun 26 00:44:14 2009 (r39788)
@@ -797,6 +797,9 @@
FUNC_MODIFIES(*address);
PARROT_EXPORT
+INTVAL Parrot_io_have_networking_support(SHIM_INTERP);
+
+PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL Parrot_io_listen(PARROT_INTERP, ARGMOD(PMC *pmc), INTVAL backlog)
__attribute__nonnull__(1)
@@ -866,6 +869,8 @@
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(pmc) \
|| PARROT_ASSERT_ARG(address)
+#define ASSERT_ARGS_Parrot_io_have_networking_support \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_Parrot_io_listen __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(pmc)
Modified: branches/io_cleanups/src/interp/inter_misc.c
==============================================================================
--- branches/io_cleanups/src/interp/inter_misc.c Fri Jun 26 00:15:16 2009 (r39787)
+++ branches/io_cleanups/src/interp/inter_misc.c Fri Jun 26 00:44:14 2009 (r39788)
@@ -258,6 +258,9 @@
case CURRENT_RUNCORE:
ret = interp->run_core;
break;
+ case NETWORKING_SUPPORT:
+ ret = Parrot_io_have_networking_support(interp);
+ break;
default: /* or a warning only? */
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
"illegal argument in interpinfo");
Modified: branches/io_cleanups/src/io/socket_api.c
==============================================================================
--- branches/io_cleanups/src/io/socket_api.c Fri Jun 26 00:15:16 2009 (r39787)
+++ branches/io_cleanups/src/io/socket_api.c Fri Jun 26 00:44:14 2009 (r39788)
@@ -29,6 +29,27 @@
/*
+=item C<INTVAL Parrot_io_have_networking_support(PARROT_INTERP)>
+
+Determines whether Parrot has been built with networking support. Returns
+1 if it has support, returns 0 otherwise.
+
+Currently, this is based on a C preprocessor macro,
+C<PARROT_NETWORKING_SUPPORT>
+
+=cut
+
+*/
+
+PARROT_EXPORT
+INTVAL
+Parrot_io_have_networking_support(SHIM_INTERP)
+{
+ return PARROT_NETWORKING_SUPPORT == 0 ? 0 : 1;
+}
+
+/*
+
=item C<INTVAL Parrot_io_socket_is_closed(PARROT_INTERP, PMC *socket)>
Returns 1 if the socket is closed, 0 if it is open.
More information about the parrot-commits
mailing list