From 6129f96ce81d32b7884b3ada7c895a86c280f95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 1 Apr 2010 07:21:24 +0000 Subject: exporting symbols; using objName svn path=/trunk/externals/iem/iemnet/; revision=13330 --- udpsend.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'udpsend.c') diff --git a/udpsend.c b/udpsend.c index 8751ddb..6544071 100644 --- a/udpsend.c +++ b/udpsend.c @@ -22,6 +22,8 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* */ +static const char objName[] = "udpsend"; + #include "iemnet.h" #include @@ -44,7 +46,7 @@ static void udpsend_connect(t_udpsend *x, t_symbol *hostname, if (x->x_sender) { - error("udpsend: already connected"); + error("[%s] already connected", objName); return; } @@ -53,7 +55,7 @@ static void udpsend_connect(t_udpsend *x, t_symbol *hostname, DEBUG("send socket %d\n", sockfd); if (sockfd < 0) { - sys_sockerror("udpsend: socket"); + sys_sockerror("[udpsend] socket"); return; } @@ -62,7 +64,7 @@ static void udpsend_connect(t_udpsend *x, t_symbol *hostname, #ifdef SO_BROADCAST if( 0 != setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, (const void *)&broadcast, sizeof(broadcast))) { - error("udpsend: couldn't switch to broadcast mode"); + error("[%s] couldn't switch to broadcast mode", objName); } #endif /* SO_BROADCAST */ @@ -71,7 +73,7 @@ static void udpsend_connect(t_udpsend *x, t_symbol *hostname, hp = gethostbyname(hostname->s_name); if (hp == 0) { - error("udpsend: bad host '%s'?", hostname->s_name); + error("[%s] bad host '%s'?", objName, hostname->s_name); return; } memcpy((char *)&server.sin_addr, (char *)hp->h_addr, hp->h_length); @@ -83,7 +85,7 @@ static void udpsend_connect(t_udpsend *x, t_symbol *hostname, /* try to connect. */ if (connect(sockfd, (struct sockaddr *) &server, sizeof (server)) < 0) { - sys_sockerror("udpsend: connecting stream socket"); + sys_sockerror("[udpsend] connecting stream socket"); sys_closesocket(sockfd); return; } @@ -107,7 +109,7 @@ static void udpsend_send(t_udpsend *x, t_symbol *s, int argc, t_atom *argv) iemnet__sender_send(x->x_sender, chunk); iemnet__chunk_destroy(chunk); } else { - error("udpsend: not connected"); + error("[%s]: not connected"); } } @@ -124,9 +126,10 @@ static void *udpsend_new(void) return (x); } -void udpsend_setup(void) +IEMNET_EXTERN void udpsend_setup(void) { - udpsend_class = class_new(gensym("udpsend"), (t_newmethod)udpsend_new, + if(!iemnet__register(objName))return; + udpsend_class = class_new(gensym(objName), (t_newmethod)udpsend_new, (t_method)udpsend_free, sizeof(t_udpsend), 0, 0); @@ -140,5 +143,7 @@ void udpsend_setup(void) class_addlist(udpsend_class, (t_method)udpsend_send); } +IEMNET_INITIALIZER(udpsend_setup); + /* end udpsend.c*/ -- cgit v1.2.1