Revision: 38959
          http://brlcad.svn.sourceforge.net/brlcad/?rev=38959&view=rev
Author:   erikgreenwald
Date:     2010-05-04 21:38:07 +0000 (Tue, 04 May 2010)

Log Message:
-----------
split tienet ugliness into it's own header. Will eventually be replaced with 
libpkg.

Modified Paths:
--------------
    brlcad/trunk/src/adrt/Makefile.am
    brlcad/trunk/src/adrt/adrt.h
    brlcad/trunk/src/adrt/master/compnet.c
    brlcad/trunk/src/adrt/master/master.c
    brlcad/trunk/src/adrt/master/tienet_master.c
    brlcad/trunk/src/adrt/slave/tienet_slave.c

Added Paths:
-----------
    brlcad/trunk/src/adrt/tienet.h

Modified: brlcad/trunk/src/adrt/Makefile.am
===================================================================
--- brlcad/trunk/src/adrt/Makefile.am   2010-05-04 21:33:04 UTC (rev 38958)
+++ brlcad/trunk/src/adrt/Makefile.am   2010-05-04 21:38:07 UTC (rev 38959)
@@ -110,6 +110,7 @@
 
 noinst_HEADERS = \
        load.h \
+       tienet.h \
        master/compnet.h \
        master/dispatcher.h \
        master/tienet_master.h \

Modified: brlcad/trunk/src/adrt/adrt.h
===================================================================
--- brlcad/trunk/src/adrt/adrt.h        2010-05-04 21:33:04 UTC (rev 38958)
+++ brlcad/trunk/src/adrt/adrt.h        2010-05-04 21:38:07 UTC (rev 38959)
@@ -150,32 +150,6 @@
     uint32_t ind;
 } tienet_buffer_t;
 
-#include <unistd.h>
-#include <sys/select.h>
-
-#define TIENET_OP(name,cmd)  \
-static int tienet_##name(int socket, void* data, size_t size) \
-{ \
-    fd_set      set; \
-    unsigned int ind = 0; \
-    int                 r; \
-\
-    FD_ZERO(&set); \
-    FD_SET(socket, &set); \
-\
-    do { \
-       select(socket+1, NULL, &set, NULL, NULL); \
-       r = cmd(socket, &((char*)data)[ind], size-ind); \
-       ind += r; \
-       if (r <= 0) return(1);  /* Error, socket is probably dead */ \
-    } while (ind < size); \
-\
-    return(0); \
-}
-
-TIENET_OP(send,write)
-TIENET_OP(recv,read)
-
 int load_g (tie_t *tie, const char *db, int argc, const char **argv, struct 
adrt_mesh_s **);
 
 #endif

Modified: brlcad/trunk/src/adrt/master/compnet.c
===================================================================
--- brlcad/trunk/src/adrt/master/compnet.c      2010-05-04 21:33:04 UTC (rev 
38958)
+++ brlcad/trunk/src/adrt/master/compnet.c      2010-05-04 21:38:07 UTC (rev 
38959)
@@ -34,6 +34,7 @@
 
 #include "libtie/tie.h"
 #include "adrt.h"
+#include "tienet.h"
 
 int master_compserv_socket;
 int master_compserv_active;

Modified: brlcad/trunk/src/adrt/master/master.c
===================================================================
--- brlcad/trunk/src/adrt/master/master.c       2010-05-04 21:33:04 UTC (rev 
38958)
+++ brlcad/trunk/src/adrt/master/master.c       2010-05-04 21:38:07 UTC (rev 
38959)
@@ -36,6 +36,7 @@
 #include "compnet.h"           /* Component Networking, Sends Component Names 
via Network */
 #include "adrt.h"              /* adrt Defines */
 #include "adrt_struct.h"       /* adrt common structs */
+#include "tienet.h"
 #include "tienet_master.h"
 
 /* Networking Includes */

Modified: brlcad/trunk/src/adrt/master/tienet_master.c
===================================================================
--- brlcad/trunk/src/adrt/master/tienet_master.c        2010-05-04 21:33:04 UTC 
(rev 38958)
+++ brlcad/trunk/src/adrt/master/tienet_master.c        2010-05-04 21:38:07 UTC 
(rev 38959)
@@ -38,6 +38,7 @@
 
 #include "libtie/tie.h"
 #include "adrt.h"
+#include "tienet.h"
 #include "tienet_master.h"
 
 #include "bio.h"

Modified: brlcad/trunk/src/adrt/slave/tienet_slave.c
===================================================================
--- brlcad/trunk/src/adrt/slave/tienet_slave.c  2010-05-04 21:33:04 UTC (rev 
38958)
+++ brlcad/trunk/src/adrt/slave/tienet_slave.c  2010-05-04 21:38:07 UTC (rev 
38959)
@@ -35,6 +35,7 @@
 #include "bio.h"
 #include "tie.h"
 #include "adrt.h"
+#include "tienet.h"
 
 #include "tienet_slave.h"
 

Added: brlcad/trunk/src/adrt/tienet.h
===================================================================
--- brlcad/trunk/src/adrt/tienet.h                              (rev 0)
+++ brlcad/trunk/src/adrt/tienet.h      2010-05-04 21:38:07 UTC (rev 38959)
@@ -0,0 +1,73 @@
+/*                        T I E N E T . H
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2010 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+
+/** @file tienet.h
+ *
+ * Brief description
+ *
+ */
+
+#ifndef _TIENET_H
+#define _TIENET_H
+
+#include "adrt.h"
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_SELECT_H
+# include <sys/select.h>
+#endif
+
+#define TIENET_OP(name,cmd)  \
+static int tienet_##name(int socket, void* data, size_t size) \
+{ \
+    fd_set      set; \
+    unsigned int ind = 0; \
+    int                 r; \
+\
+    FD_ZERO(&set); \
+    FD_SET(socket, &set); \
+\
+    do { \
+       select(socket+1, NULL, &set, NULL, NULL); \
+       r = cmd(socket, &((char*)data)[ind], size-ind); \
+       ind += r; \
+       if (r <= 0) return(1);  /* Error, socket is probably dead */ \
+    } while (ind < size); \
+\
+    return(0); \
+}
+
+TIENET_OP(send,write)
+TIENET_OP(recv,read)
+
+#endif
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: brlcad/trunk/src/adrt/tienet.h
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to