[Rprotobuf-yada] Build errors

Romain Francois romain.francois at dbmail.com
Thu Nov 12 10:42:16 CET 2009


I've added some conditional compiling, lots of

#if GOOGLE_PROTOBUF_VERSION < 2002001
try to hack around
#else
do the real thing
#endif

The code I've put in for the < 2.2 branch is kind of redundant and 
probably less efficient than google's, and in some cases the code is only :

			Rf_error( "cannot shrink the size with this version of the protobuf 
library, either update to 2.2 or submit a patch" ) ;

I don't like conditional compiling. Please let me know when we can 
assume that 2.2 is available on debian.


On 11/11/2009 09:41 PM, Dirk Eddelbuettel wrote:
>
>
> RemoveLast() and SwapElements() are not in 2.1.
>
> What shall we do?  I can 'build' with these difference but that is obviously
> not a fix.
>
> Dirk
>
>
>
> edd at ron:~/svn/rprotobuf>  svn di
> Index: pkg/src/size.cpp
> ===================================================================
> --- pkg/src/size.cpp	(revision 107)
> +++ pkg/src/size.cpp	(working copy)
> @@ -48,10 +48,13 @@
>   		if( target == 0){
>   			ref->ClearField( message, field_desc );
>   		} else if( current>  target ){
> +#define GrossHack 1
> +#if ! GrossHack
>   			while( current != target ){
>   				ref->RemoveLast( message, field_desc ) ;
>   				current-- ;
>   			}
> +#endif
>   		} else if( current == target ) {
>   			/* nothing to do */
>   		} else { /* current<  target */
> Index: pkg/src/mutators.cpp
> ===================================================================
> --- pkg/src/mutators.cpp	(revision 107)
> +++ pkg/src/mutators.cpp	(working copy)
> @@ -304,7 +304,8 @@
>       			}
>   		}
>   		// }}}
> -		
> +#define GrossHack 1
> +#if ! GrossHack
>   		/* {{{ remove some items once if there are too many */
>   		if( field_size>  value_size ) {
>   			/* we need to remove some */
> @@ -314,7 +315,7 @@
>   			}
>   		}
>   		// }}}
> -		
> +#endif 		
>   		switch( field_desc->type() ){
>   			// {{{ int32
>       		case TYPE_INT32:
> Index: pkg/src/swap.cpp
> ===================================================================
> --- pkg/src/swap.cpp	(revision 107)
> +++ pkg/src/swap.cpp	(working copy)
> @@ -11,9 +11,12 @@
>   			Rf_error( "swap can only be used with repeated fields" ) ;
>   		}
>   		int n = LENGTH(left); /* we know that length(left) == length(right) */
> +#define GrossHack 1
> +#if ! GrossHack
>   		for( int i=0; i<n; i++){
>   			ref->SwapElements(m, field_desc, GET_int(left, i) , GET_int(right,i) ) ;
>   		}
> +#endif
>   		return( R_NilValue );
>   	}
>


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/EAD5 : LondonR slides
|- http://tr.im/BcPw : celebrating R commit #50000
`- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc



More information about the Rprotobuf-yada mailing list