From: <pau...@us...> - 2009-08-27 17:24:05
|
Revision: 6164 http://octave.svn.sourceforge.net/octave/?rev=6164&view=rev Author: paulsundvall Date: 2009-08-27 17:23:57 +0000 (Thu, 27 Aug 2009) Log Message: ----------- Added version numbers to get the code working in octave 3.0. This is to reflect the change in naming convention(?) from using G instead of FS. See the commit at revision 6070. Revision Links: -------------- http://octave.svn.sourceforge.net/octave/?rev=6070&view=rev Modified Paths: -------------- trunk/octave-forge/main/sockets/src/Makefile trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/Makefile =================================================================== --- trunk/octave-forge/main/sockets/src/Makefile 2009-08-27 17:11:26 UTC (rev 6163) +++ trunk/octave-forge/main/sockets/src/Makefile 2009-08-27 17:23:57 UTC (rev 6164) @@ -1,10 +1,20 @@ OCT = sockets.oct SRC := $(OCT:.oct=.cc) +#See which octave version we run by querying mkoctfile for its version +#string. (Is there a better way to do this? This looks horrible.) +majorversion :=$(shell mkoctfile --version 2>&1 |sed -e 's/^.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\1/g') +minorversion:=$(shell mkoctfile --version 2>&1 |sed -e 's/^.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\2/g') +microversion:=$(shell mkoctfile --version 2>&1 |sed -e 's/^.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\3/g') + +VFLAGS=-DMAJORVERSION=$(majorversion) +VFLAGS+=-DMINORVERSION=$(minorversion) +VFLAGS+=-DMICROVERSION=$(microversion) + all: $(OCT) %.oct: %.cc - mkoctfile -s $< + mkoctfile $(VFLAGS) -s $< test: $(OCT) test_octave_sockets Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-27 17:11:26 UTC (rev 6163) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-27 17:23:57 UTC (rev 6164) @@ -199,12 +199,26 @@ DEFINE_OCTAVE_ALLOCATOR (octave_socket); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_socket, "octave_socket", "octave_socket"); + + // This macro must start with DEFUN_DLD so that the automatic collection -// of function helps can take place. -#define DEFUN_DLD_SOCKET_CONSTANT(name, help ) \ -DEFUNX_DLD ( #name, F ## name, G ## name, args, nargout, help) \ -{ return octave_value( name ); }; +// of function helps can take place. To get the code working in +// multiple versions of octave, we have to check the version number. +#if !defined(MINORVERSION) || !defined(MAJORVERSION) +# error "please define MAJORVERSION and MINORVERSION to the octave version numbers" +#endif +#if MAJORVERSION==3 && MINORVERSION<2 +# define DEFUN_DLD_SOCKET_CONSTANT(name, help ) \ + DEFUNX_DLD ( #name, F ## name, FS ## name, args, nargout, help) \ + { return octave_value( name ); }; +#else +# define DEFUN_DLD_SOCKET_CONSTANT(name, help ) \ + DEFUNX_DLD ( #name, F ## name, G ## name, args, nargout, help) \ + { return octave_value( name ); }; +#endif + + // PKG_ADD: autoload ("AF_UNIX", "sockets.oct"); DEFUN_DLD_SOCKET_CONSTANT(AF_UNIX, "socket constant" ); #ifndef __WIN32__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |