[Rprotobuf-yada] Build errors
Romain Francois
romain.francois at dbmail.com
Thu Nov 12 08:33:07 CET 2009
Ah.
If there is no RemoveLast, we have to do it as I did before :
ClearField to remove all
Add to Add* to re-add the one we want to keep.
I can work around swap I guess using Set* stuff
How close is debian to get 2.2 ?
Romain
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