[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
octave - compile error in send.cc
From: |
m.vaessen |
Subject: |
octave - compile error in send.cc |
Date: |
Tue, 17 Mar 2009 12:38:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 |
Hello,
I want to install the parallel toolbox. I downloaded the sources from
http://atc.ugr.es/javier-bin/mpitb .
The routine send.cc (I attach the source) gets the error:
send.cc:111: error: no match for 'operator[]' in 'map["fd"]'
Line 111 of send.cc is:
sockfd = map["fd"](0).int_value();
Is it possible that oct-map.h is incomplete concerning the operator [] ?
Many thanks for your help in advance!
Best regards,
Marga Vaeßen
--
Marga Vaessen
Juelich Supercomputing Centre
Forschungszentrum Juelich GmbH
52425 Juelich, Germany
Phone: +49-2461-61-4136
Fax: +49-2461-61-6656
E-mail: address@hidden
WWW: http://www.fz-juelich.de/jsc/
-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Jülich GmbH
52425 Jülich
Sitz der Gesellschaft: Jülich
Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Bärbel Brumme-Bothe
Geschäftsführung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
//Octave include files
#include <octave/oct.h>
#include <variables.h>
#include <oct-map.h>
#include <base-list.h>
//Socket programming include files
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <list>
static int send_size(const int sockfd, const void *buf,
int buf_size, int flags)
{
while (1) {
int retval = send(sockfd, buf, buf_size, flags);
if (retval == -1)
return -1;
buf_size -= retval;
if (buf_size == 0) return true;
buf = (void *)((char *)buf + retval);
}
}
static int get_send_flag(octave_base_list<std::string> &send_flags)
{
int retval=0;
octave_base_list<std::string>::iterator flags;
flags = send_flags.begin();
while(flags != send_flags.end())
{
if((*flags) == std::string("MSG_OOB"))
retval&=MSG_OOB;
else if((*flags) == std::string("MSG_DONTROUTE") )
retval&=MSG_DONTROUTE;
else if((*flags) == std::string("MSG_DONTWAIT"))
retval&=MSG_DONTWAIT;
else if((*flags) == std::string("MSG_NOSIGNAL"))
retval&=MSG_NOSIGNAL;
else
return -1;
flags++;
}
return retval;
};
DEFUN_DLD (send, args,nargout,
"-*- texinfo -*-\n\
@deftypefn {Dynamic-Loadable Function} address@hidden,@var{msg}] =} send
(@var{sockfd}, @var{value})\n\
@deftypefnx {Dynamic-Loadable Function} address@hidden,@var{msg}] =} send
(@var{sockfd}, @var{value}, @var{flags} ...)\n\
\n\
Send a message from a socket.\n\
\n\
The value @var{sockfd} must refer to a socket.\n\
\n\
The value @var{value} is message is to transmit.\n\
\n\
The value @var{flags} is a flagword and can contain the following flags:\n\
@table @code\n\
@item \"MSG_OOB\"\n\
@item \"MSG_DONTROUTE\"\n\
@item \"MSG_DONTWAIT\"\n\
@item \"MSG_NOSIGNAL\"\n\
@end table\n\
\n\n\
The function @code{connect} returns @var{state} and @var{msg},\n\
If the succeeds, @var{state} the number of characters send and @var{msg} is set
\"SUCCESS\".\n\
On error, @var{state} is set -1, and @var{msg} returned error message\n\
For example,\n\
\n\
@example\n\
@group\n\
[fd msg] = socket ( \"AF_INET\" , \"SOCK_STREAM\" , 0 );\n\
[retval msg] = connect ( fd , \"localhost\" , 80 );\n\
@end group\n\
@end example\n\
@end deftypefn")
{
int nargin=args.length();
octave_value_list retval;
if(nargin < 2)
{
print_usage("send");
return retval;
}
Octave_map map;
int sockfd;
std::string send_message;
octave_base_list<std::string> send_flags;
map = args(0).map_value();
sockfd = map["fd"](0).int_value();
send_message = args(1).string_value();
if( nargin > 3 )
{
for (int i = 2; i < nargin; i++)
{
send_flags.append(args(i).string_value());
}
}
if(error_state)
return retval = octave_value(-1);
int flags=get_send_flag(send_flags);
if (flags == -1)
{
error("send : Undefined flags");
return retval(0) = octave_value(-1);
}
assert(sizeof(char) == 1 );
int size = send_size (sockfd, send_message.c_str(), send_message.size(),
flags);
if(size < 0)
{
std::string msg = std::strerror (errno);
retval(0)=octave_value(0);
retval(1)=msg;
}
else
{
retval(0)=octave_value(-1);
retval(1)=octave_value("SUCCESS");
}
return retval;
}
- octave - compile error in send.cc,
m.vaessen <=