From noreply at r-forge.r-project.org Wed Sep 4 01:03:16 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 4 Sep 2013 01:03:16 +0200 (CEST) Subject: [Rprotobuf-commits] r525 - pkg/src Message-ID: <20130903230316.5976F1854CD@r-forge.r-project.org> Author: murray Date: 2013-09-04 01:03:15 +0200 (Wed, 04 Sep 2013) New Revision: 525 Modified: pkg/src/mutators.cpp Log: Pass string by reference. Caught by Karl in code review. Modified: pkg/src/mutators.cpp =================================================================== --- pkg/src/mutators.cpp 2013-08-31 01:29:28 UTC (rev 524) +++ pkg/src/mutators.cpp 2013-09-03 23:03:15 UTC (rev 525) @@ -100,7 +100,7 @@ } template -ValueType Int64FromString(const string value) { +ValueType Int64FromString(const string &value) { std::stringstream ss(value); ValueType ret; if ((ss >> ret).fail() || !(ss>>std::ws).eof()) { From noreply at r-forge.r-project.org Wed Sep 4 02:30:14 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 4 Sep 2013 02:30:14 +0200 (CEST) Subject: [Rprotobuf-commits] r526 - in pkg: . vignettes/RProtoBuf Message-ID: <20130904003014.AFE79185D2B@r-forge.r-project.org> Author: murray Date: 2013-09-04 02:30:14 +0200 (Wed, 04 Sep 2013) New Revision: 526 Modified: pkg/ChangeLog pkg/vignettes/RProtoBuf/RProtoBuf.Rnw Log: Add a new section on 64-bit issues, document the RProtoBuf.int64AsString option, break out the 'other approaches' section from the 'future work', and fix a few typos. Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-09-03 23:03:15 UTC (rev 525) +++ pkg/ChangeLog 2013-09-04 00:30:14 UTC (rev 526) @@ -1,3 +1,10 @@ +2013-09-03 Murray Stokely + + * vignettes/RProtoBuf/RProtoBuf.Rnw: Add a new section on 64-bit + issues, document the RProtoBuf.int64AsString option, break out the + 'other approaches' section from the 'future work', and fix a few + typos. + 2013-08-30 Dirk Eddelbuettel * NAMESPACE: Import 'file_path_as_absolute' from package tools, and Modified: pkg/vignettes/RProtoBuf/RProtoBuf.Rnw =================================================================== --- pkg/vignettes/RProtoBuf/RProtoBuf.Rnw 2013-09-03 23:03:15 UTC (rev 525) +++ pkg/vignettes/RProtoBuf/RProtoBuf.Rnw 2013-09-04 00:30:14 UTC (rev 526) @@ -157,7 +157,7 @@ \subsection{Access and modify fields of a message} -Once the message created, its fields can be quiered +Once the message is created, its fields can be queried and modified using the dollar operator of R, making protocol buffer messages seem like lists. @@ -179,6 +179,10 @@ p[[ "email" ]] @ +Protocol buffers include a 64-bit integer type, but R lacks native +64-bit integer support. A workaround is available and described in +Section~\ref{sec:int64} for working with large integer values. + % TODO(mstokely): Document extensions here. % There are none in addressbook.proto though. @@ -1259,15 +1263,87 @@ implemented by the \texttt{RProtoBuf} package by calling an internal method of the \texttt{protobuf} C++ library. -\section{Plans for future releases} +\section{64-bit integer issues} +\label{sec:int64} +R does not have native 64-bit integer support. Instead, R treats +large integers as doubles which have limited precision. For example, +it loses the ability to distinguish some distinct integers: + +<<>>= +2^53 == (2^53 + 1) +@ + +Protocol Buffers are frequently used to pass data between different +systems, however, and most other systems these days have support for +64-bit integers. To work around this, RProtoBuf allows users to get +and set 64-bit integer types by treating them as characters. + +<>= +if (!exists("protobuf_unittest.TestAllTypes", + "RProtoBuf:DescriptorPool")) { + unittest.proto.file <- system.file("unitTests", "data", + "unittest.proto", + package="RProtoBuf") + readProtoFiles(file=unittest.proto.file) +} +@ + +If we try to set an int64 field in R to double values, we lose +precision: + +<<>>= +test <- new(protobuf_unittest.TestAllTypes) +test$repeated_int64 <- c(2^53, 2^53+1) +length(unique(test$repeated_int64)) +@ + +However, we can specify the values as character strings so that the +C++ library on which RProtoBuf is based can store a true 64-bit +integer representation of the data. + +<<>>= +test$repeated_int64 <- c("9007199254740992", "9007199254740993") +@ + +When reading the value back into R, numeric types are returned by +default, but when the full precision is required a character value +will be returned if the \texttt{RProtoBuf.int64AsString} option is set +to \texttt{TRUE}. + +<<>>= +options("RProtoBuf.int64AsString" = FALSE) +test$repeated_int64 +length(unique(test$repeated_int64)) +options("RProtoBuf.int64AsString" = TRUE) +test$repeated_int64 +length(unique(test$repeated_int64)) +@ + +<>= +options("RProtoBuf.int64AsString" = FALSE) +@ + +\section{Other approaches} + Saptarshi Guha wrote another package that deals with integration of protocol buffer messages with R, taking a different angle : serializing any R object as a message, based on a single catch-all -\texttt{proto} file. We plan to integrate this functionality into -\texttt{RProtoBuf}. Saptarshi's package is available at -\url{http://ml.stat.purdue.edu/rhipe/doc/html/ProtoBuffers.html} +\texttt{proto} file. Saptarshi's package is available at +\url{http://ml.stat.purdue.edu/rhipe/doc/html/ProtoBuffers.html}. +Jeroen Ooms took a similar approach influenced by Saptarshi in his +\texttt{RProtoBufUtils} package. Unlike Saptarshi's package, +RProtoBufUtils depends on RProtoBuf for underlying message operations. +This package is available at +\url{https://github.com/jeroenooms/RProtoBufUtils}. + +% Phillip Yelland wrote another implementation, currently proprietary, +% that has significant speed advantages when querying fields from a +% large number of protocol buffers, but is less user friendly for the +% basic cases documented here. + +\section{Plans for future releases} Protocol buffers have a mechanism for remote procedure calls (rpc) that is not yet used by \texttt{RProtoBuf}, but we may one day take advantage of this by writing a protocol buffer message R server, @@ -1293,4 +1369,3 @@ \end{document} - From noreply at r-forge.r-project.org Wed Sep 4 02:38:59 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 4 Sep 2013 02:38:59 +0200 (CEST) Subject: [Rprotobuf-commits] r527 - in pkg: . inst Message-ID: <20130904003859.ED7C5185DD3@r-forge.r-project.org> Author: murray Date: 2013-09-04 02:38:59 +0200 (Wed, 04 Sep 2013) New Revision: 527 Modified: pkg/ChangeLog pkg/inst/NEWS.Rd Log: Summarize changes since last release. Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-09-04 00:30:14 UTC (rev 526) +++ pkg/ChangeLog 2013-09-04 00:38:59 UTC (rev 527) @@ -1,5 +1,6 @@ 2013-09-03 Murray Stokely + * inst/NEWS.Rd: Summarize changes since the last release. * vignettes/RProtoBuf/RProtoBuf.Rnw: Add a new section on 64-bit issues, document the RProtoBuf.int64AsString option, break out the 'other approaches' section from the 'future work', and fix a few Modified: pkg/inst/NEWS.Rd =================================================================== --- pkg/inst/NEWS.Rd 2013-09-04 00:30:14 UTC (rev 526) +++ pkg/inst/NEWS.Rd 2013-09-04 00:38:59 UTC (rev 527) @@ -2,6 +2,20 @@ \title{News for Package \pkg{RProtoBuf}} \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} +% TODO(edd): Update date and version number. +\section{Changes in RProtoBuf version 0.3.1 (2013-09-XX)}{ + \itemize{ + \item Added support for setting and getting 64-bit integer types as + character strings of decimal integers to work around R's lack of + native 64-bit integer types. + \item Added better error handling, documentation, and tests to the + extensions support (getExtension and setExtension). + \item Add support to P for returning extension descriptors. + \item Improved configure to detect and pass -std=c++0x if it is + available to enable long long 64-bit integer support in Rcpp. + } +} + \section{Changes in RProtoBuf version 0.3 (2013-07-13)}{ \itemize{ \item Added support for Protocol Buffer extensions through the new From noreply at r-forge.r-project.org Sat Sep 7 08:46:57 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 7 Sep 2013 08:46:57 +0200 (CEST) Subject: [Rprotobuf-commits] r528 - in pkg: . src Message-ID: <20130907064657.C25E9185606@r-forge.r-project.org> Author: murray Date: 2013-09-07 08:46:57 +0200 (Sat, 07 Sep 2013) New Revision: 528 Modified: pkg/ChangeLog pkg/src/rprotobuf.cpp Log: Include the field name in error messages from new, update, etc, when a field descriptor can't be found. Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-09-04 00:38:59 UTC (rev 527) +++ pkg/ChangeLog 2013-09-07 06:46:57 UTC (rev 528) @@ -1,3 +1,9 @@ +2013-09-06 Murray Stokely + + * src/rprotobuf.cpp (rprotobuf): Include the name of the field + that could not be found in exceptions in getFieldDescriptor + (errors from update / new, etc.). + 2013-09-03 Murray Stokely * inst/NEWS.Rd: Summarize changes since the last release. Modified: pkg/src/rprotobuf.cpp =================================================================== --- pkg/src/rprotobuf.cpp 2013-09-04 00:38:59 UTC (rev 527) +++ pkg/src/rprotobuf.cpp 2013-09-07 06:46:57 UTC (rev 528) @@ -222,6 +222,7 @@ GPB::FieldDescriptor* getFieldDescriptor(GPB::Message* message, SEXP name){ GPB::FieldDescriptor* field_desc = (GPB::FieldDescriptor*)0; const GPB::Descriptor* desc = message->GetDescriptor() ; + std::string error_message = "could not get FieldDescriptor for field"; switch( TYPEOF(name) ){ case S4SXP: { @@ -235,11 +236,13 @@ case CHARSXP: { field_desc = (GPB::FieldDescriptor*)desc->FindFieldByName( CHAR(name) ) ; - break ; + error_message += string(" '") + CHAR(name) + "'"; + break ; } case STRSXP: { field_desc = (GPB::FieldDescriptor*)desc->FindFieldByName( CHAR( STRING_ELT(name, 0 ) ) ) ; + error_message += string(" '") + CHAR( STRING_ELT(name, 0 )) + "'"; break ; } case REALSXP: @@ -250,7 +253,7 @@ } } if( !field_desc ){ - throwException( "could not get FieldDescriptor for field", "NoSuchFieldException" ) ; + throwException( error_message.c_str(), "NoSuchFieldException" ) ; } return field_desc ; } From noreply at r-forge.r-project.org Tue Sep 10 11:05:04 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 10 Sep 2013 11:05:04 +0200 (CEST) Subject: [Rprotobuf-commits] r529 - pkg/src Message-ID: <20130910090504.6FC5C1810F1@r-forge.r-project.org> Author: murray Date: 2013-09-10 11:05:03 +0200 (Tue, 10 Sep 2013) New Revision: 529 Modified: pkg/src/rprotobuf.cpp Log: Improve string concatenation idiom. Modified: pkg/src/rprotobuf.cpp =================================================================== --- pkg/src/rprotobuf.cpp 2013-09-07 06:46:57 UTC (rev 528) +++ pkg/src/rprotobuf.cpp 2013-09-10 09:05:03 UTC (rev 529) @@ -236,13 +236,13 @@ case CHARSXP: { field_desc = (GPB::FieldDescriptor*)desc->FindFieldByName( CHAR(name) ) ; - error_message += string(" '") + CHAR(name) + "'"; + error_message = error_message + " '" + CHAR(name) + "'"; break ; } case STRSXP: { field_desc = (GPB::FieldDescriptor*)desc->FindFieldByName( CHAR( STRING_ELT(name, 0 ) ) ) ; - error_message += string(" '") + CHAR( STRING_ELT(name, 0 )) + "'"; + error_message = error_message + " '" + CHAR( STRING_ELT(name, 0 )) + "'"; break ; } case REALSXP: From noreply at r-forge.r-project.org Thu Sep 12 03:51:40 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 12 Sep 2013 03:51:40 +0200 (CEST) Subject: [Rprotobuf-commits] r530 - pkg Message-ID: <20130912015140.7D7D71859B9@r-forge.r-project.org> Author: murray Date: 2013-09-12 03:51:39 +0200 (Thu, 12 Sep 2013) New Revision: 530 Modified: pkg/ChangeLog pkg/configure pkg/configure.in Log: Add -lprotobuf to PKG_LIBS if pkg-config is not available to give this more of a chance to just do the right thing. This is necessary to make it easy to install without setting environment variables on MacOS X 10.8 for me. Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-09-10 09:05:03 UTC (rev 529) +++ pkg/ChangeLog 2013-09-12 01:51:39 UTC (rev 530) @@ -1,3 +1,9 @@ +2013-09-11 Murray Stokely + + * configure.in: If pkg-config is not available add -lprotobuf to + PKG_LIBS. This makes it easier to install on MacOS X 10.8, for + example. + 2013-09-06 Murray Stokely * src/rprotobuf.cpp (rprotobuf): Include the name of the field Modified: pkg/configure =================================================================== --- pkg/configure 2013-09-10 09:05:03 UTC (rev 529) +++ pkg/configure 2013-09-12 01:51:39 UTC (rev 530) @@ -1,11 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for RProtoBuf 0.1. +# Generated by GNU Autoconf 2.69 for RProtoBuf 0.3. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +132,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +190,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -212,21 +236,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -328,6 +356,14 @@ } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -449,6 +485,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -483,16 +523,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -504,28 +544,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -557,8 +577,8 @@ # Identity of this package. PACKAGE_NAME='RProtoBuf' PACKAGE_TARNAME='rprotobuf' -PACKAGE_VERSION='0.1' -PACKAGE_STRING='RProtoBuf 0.1' +PACKAGE_VERSION='0.3' +PACKAGE_STRING='RProtoBuf 0.3' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1128,8 +1148,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1215,7 +1233,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures RProtoBuf 0.1 to adapt to many kinds of systems. +\`configure' configures RProtoBuf 0.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1276,7 +1294,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of RProtoBuf 0.1:";; + short | recursive ) echo "Configuration of RProtoBuf 0.3:";; esac cat <<\_ACEOF @@ -1358,10 +1376,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -RProtoBuf configure 0.1 -generated by GNU Autoconf 2.68 +RProtoBuf configure 0.3 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1648,8 +1666,8 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by RProtoBuf $as_me 0.1, which was -generated by GNU Autoconf 2.68. Invocation command line was +It was created by RProtoBuf $as_me 0.3, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2077,7 +2095,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2121,7 +2139,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2714,7 +2732,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2754,7 +2772,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2807,7 +2825,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2848,7 +2866,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2906,7 +2924,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2950,7 +2968,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3146,8 +3164,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3260,7 +3277,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3304,7 +3321,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3690,7 +3707,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKGCONFIG="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3714,8 +3731,14 @@ ## use pkg-config for ProtoBuf settings ## -protobuf_cxxflags=`pkg-config --cflags protobuf` -protobuf_libs=`pkg-config --libs protobuf` +if test x"${PKGCONFIG}" == x"yes"; then + protobuf_cxxflags=`pkg-config --cflags protobuf` + protobuf_libs=`pkg-config --libs protobuf` +else + # Add a reasonable default of -lprotobuf if we don't have pkg-config + protobuf_cxxflags="" + protobuf_libs="-lprotobuf" +fi ## And make sure these flags are used for the tests below. CPPFLAGS="${protobuf_cxxflags} ${CPPFLAGS}" @@ -3739,7 +3762,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PROTOC="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3793,7 +3816,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -3859,7 +3882,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4121,7 +4144,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_R="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4173,7 +4196,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RSCRIPT="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4656,16 +4679,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -4725,29 +4748,17 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4767,8 +4778,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by RProtoBuf $as_me 0.1, which was -generated by GNU Autoconf 2.68. Invocation command line was +This file was extended by RProtoBuf $as_me 0.3, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4820,11 +4831,11 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -RProtoBuf config.status 0.1 -configured by $0, generated by GNU Autoconf 2.68, +RProtoBuf config.status 0.3 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -4901,7 +4912,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' Modified: pkg/configure.in =================================================================== --- pkg/configure.in 2013-09-10 09:05:03 UTC (rev 529) +++ pkg/configure.in 2013-09-12 01:51:39 UTC (rev 530) @@ -29,8 +29,14 @@ ## use pkg-config for ProtoBuf settings ## -protobuf_cxxflags=`pkg-config --cflags protobuf` -protobuf_libs=`pkg-config --libs protobuf` +if test x"${PKGCONFIG}" == x"yes"; then + protobuf_cxxflags=`pkg-config --cflags protobuf` + protobuf_libs=`pkg-config --libs protobuf` +else + # Add a reasonable default of -lprotobuf if we don't have pkg-config + protobuf_cxxflags="" + protobuf_libs="-lprotobuf" +fi ## And make sure these flags are used for the tests below. CPPFLAGS="${protobuf_cxxflags} ${CPPFLAGS}" From noreply at r-forge.r-project.org Thu Sep 12 05:58:01 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 12 Sep 2013 05:58:01 +0200 (CEST) Subject: [Rprotobuf-commits] r531 - pkg Message-ID: <20130912035801.963811852AD@r-forge.r-project.org> Author: murray Date: 2013-09-12 05:58:01 +0200 (Thu, 12 Sep 2013) New Revision: 531 Modified: pkg/configure pkg/configure.in Log: Improve the pkg-config logic so that if pkg-config is installed, but it doesn't know about protobuf, we still try -lprotobuf. This makes it better on my other MacOS X box, where I do have pkg-config installed but it knows nothing about my protobuf library. Modified: pkg/configure =================================================================== --- pkg/configure 2013-09-12 01:51:39 UTC (rev 530) +++ pkg/configure 2013-09-12 03:58:01 UTC (rev 531) @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for RProtoBuf 0.3. +# Generated by GNU Autoconf 2.64 for RProtoBuf 0.3. # +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software +# Foundation, Inc. # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## @@ -87,7 +87,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -132,31 +131,6 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -190,8 +164,7 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" +test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -236,25 +209,14 @@ if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -352,18 +314,10 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -400,19 +354,19 @@ fi # as_fn_arith -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. +# script with status $?, using 1 if that was 0. as_fn_error () { - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi - $as_echo "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error @@ -485,10 +439,6 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -523,16 +473,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -544,8 +494,28 @@ as_mkdir_p=false fi -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -554,11 +524,10 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -test -n "$DJDIR" || exec 7<&0 &1 +exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -755,9 +724,8 @@ fi case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -802,7 +770,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -828,7 +796,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1032,7 +1000,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1048,7 +1016,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1078,8 +1046,8 @@ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" + -*) as_fn_error "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information." ;; *=*) @@ -1087,7 +1055,7 @@ # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + as_fn_error "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1097,7 +1065,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1105,13 +1073,13 @@ if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" + as_fn_error "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1134,7 +1102,7 @@ [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1148,6 +1116,8 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1162,9 +1132,9 @@ ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" + as_fn_error "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" + as_fn_error "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1203,11 +1173,11 @@ fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1247,7 +1217,7 @@ --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages + -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1304,7 +1274,7 @@ LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXXCPP C++ preprocessor CC C compiler command @@ -1377,9 +1347,9 @@ if $ac_init_version; then cat <<\_ACEOF RProtoBuf configure 0.3 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.64 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1423,8 +1393,8 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval } # ac_fn_cxx_try_compile @@ -1449,7 +1419,7 @@ mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { + test $ac_status = 0; } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : @@ -1460,8 +1430,8 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval } # ac_fn_cxx_try_cpp @@ -1498,8 +1468,8 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval } # ac_fn_c_try_compile @@ -1511,10 +1481,10 @@ ac_fn_cxx_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : + if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1550,7 +1520,7 @@ else ac_header_preproc=no fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -1577,7 +1547,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1586,7 +1556,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_cxx_check_header_mongrel @@ -1627,8 +1597,8 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval } # ac_fn_cxx_try_run @@ -1641,7 +1611,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1659,7 +1629,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_cxx_check_header_compile cat >config.log <<_ACEOF @@ -1667,7 +1637,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by RProtoBuf $as_me 0.3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ @@ -1777,9 +1747,11 @@ { echo - $as_echo "## ---------------- ## + cat <<\_ASBOX +## ---------------- ## ## Cache variables. ## -## ---------------- ##" +## ---------------- ## +_ASBOX echo # The following way of writing the cache mishandles newlines in values, ( @@ -1813,9 +1785,11 @@ ) echo - $as_echo "## ----------------- ## + cat <<\_ASBOX +## ----------------- ## ## Output variables. ## -## ----------------- ##" +## ----------------- ## +_ASBOX echo for ac_var in $ac_subst_vars do @@ -1828,9 +1802,11 @@ echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + cat <<\_ASBOX +## ------------------- ## ## File substitutions. ## -## ------------------- ##" +## ------------------- ## +_ASBOX echo for ac_var in $ac_subst_files do @@ -1844,9 +1820,11 @@ fi if test -s confdefs.h; then - $as_echo "## ----------- ## + cat <<\_ASBOX +## ----------- ## ## confdefs.h. ## -## ----------- ##" +## ----------- ## +_ASBOX echo cat confdefs.h echo @@ -1901,12 +1879,7 @@ ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -1917,22 +1890,18 @@ for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + if test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } + . "$ac_site_file" fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in @@ -2001,7 +1970,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2083,7 +2052,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -2095,7 +2064,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2127,7 +2096,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -2139,7 +2108,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2197,30 +2166,32 @@ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 + rm -f conftest.er1 conftest.err fi - rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include int main () { +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 -$as_echo_n "checking whether the C++ compiler works... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 +$as_echo_n "checking for C++ compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -2282,28 +2253,62 @@ else ac_file='' fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C++ compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ as_fn_set_status 77 +as_fn_error "C++ compiler cannot create executables +See \`config.log' for more details." "$LINENO" 5; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 -$as_echo_n "checking for C++ compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 +$as_echo_n "checking whether the C++ compiler works... " >&6; } +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run C++ compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" @@ -2333,78 +2338,19 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +as_fn_error "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." "$LINENO" 5; } fi -rm -f conftest conftest$ac_cv_exeext +rm -f conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C++ compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : +if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2444,8 +2390,8 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +as_fn_error "cannot compute suffix of object files: cannot compile +See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -2455,7 +2401,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2492,7 +2438,7 @@ ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : +if test "${ac_cv_prog_cxx_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -2583,7 +2529,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then - if ${ac_cv_prog_CXXCPP+:} false; then : + if test "${ac_cv_prog_CXXCPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded @@ -2613,7 +2559,7 @@ # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -2629,11 +2575,11 @@ ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -2672,7 +2618,7 @@ # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -2688,18 +2634,18 @@ ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext done [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rprotobuf -r 531 From noreply at r-forge.r-project.org Fri Sep 13 03:20:04 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 03:20:04 +0200 (CEST) Subject: [Rprotobuf-commits] r532 - pkg/src Message-ID: <20130913012005.491CA185E60@r-forge.r-project.org> Author: murray Date: 2013-09-13 03:20:02 +0200 (Fri, 13 Sep 2013) New Revision: 532 Added: pkg/src/RcppMacros.h Modified: pkg/src/mutators.cpp pkg/src/rprotobuf.cpp pkg/src/wrapper_ArrayInputStream.cpp pkg/src/wrapper_ArrayOutputStream.cpp pkg/src/wrapper_Descriptor.cpp pkg/src/wrapper_EnumDescriptor.cpp pkg/src/wrapper_EnumValueDescriptor.cpp pkg/src/wrapper_FieldDescriptor.cpp pkg/src/wrapper_FileDescriptor.cpp pkg/src/wrapper_Message.cpp pkg/src/wrapper_MethodDescriptor.cpp pkg/src/wrapper_ServiceDescriptor.cpp Log: Introduce simplified RPB_FUNCTION.* macros and update all instances of the deprecated RCPP_FUNCTION.* macros to use the new ones. We can still move to Rcpp Modules, but this at least lets us work with out all the deprecation warnings. Added: pkg/src/RcppMacros.h =================================================================== --- pkg/src/RcppMacros.h (rev 0) +++ pkg/src/RcppMacros.h 2013-09-13 01:20:02 UTC (rev 532) @@ -0,0 +1,139 @@ +/* + * Copyright 2013 Google Inc. All Rights Reserved. + * Author: Murray Stokely + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + * + */ + +/* + * This file contains macros for taking C++ functions that expect + * native C++ types, automatically generating new stub functions that + * take SEXPs and call the appropriate Rcpp conversion functions + * before calling the original function. It is based on slightly more + * complex macros that were originally in Rcpp but have been + * deprecated. + * + * In the future, Rcpp Modules would likely be a better more modern + * way to implement RProtoBuf. + */ + +#ifndef RPROTOBUF_RCPP_MACROS_H +#define RPROTOBUF_RCPP_MACROS_H + +#include // RCPP_DECORATE, BEGIN_RCPP, END_RCPP + +#define RPB_FUNCTION_0(__OUT__,__NAME__) \ +__OUT__ RCPP_DECORATE(__NAME__)(); \ +extern "C" SEXP __NAME__(){ \ +SEXP res = R_NilValue ; \ +BEGIN_RCPP \ +res = ::Rcpp::wrap( RCPP_DECORATE(__NAME__)() ) ; \ +return res ; \ +END_RCPP \ +} \ +__OUT__ RCPP_DECORATE(__NAME__)() + +#define RPB_FUNCTION_1(__OUT__,__NAME__, ___0) \ +__OUT__ RCPP_DECORATE(__NAME__)(___0); \ +extern "C" SEXP __NAME__(SEXP x0){ \ +SEXP res = R_NilValue ; \ +BEGIN_RCPP \ +res = ::Rcpp::wrap( RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter( x0 )) ) ; \ +return res ; \ +END_RCPP \ +} \ +__OUT__ RCPP_DECORATE(__NAME__)(___0) + +#define RPB_FUNCTION_2(__OUT__,__NAME__, ___0, ___1) \ +__OUT__ RCPP_DECORATE(__NAME__)(___0, ___1); \ +extern "C" SEXP __NAME__(SEXP x0, SEXP x1){ \ +SEXP res = R_NilValue ; \ +BEGIN_RCPP \ +res = ::Rcpp::wrap( RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter( x0 ), ::Rcpp::internal::converter( x1 )) ) ; \ +return res ; \ +END_RCPP \ +} \ +__OUT__ RCPP_DECORATE(__NAME__)(___0, ___1) + +#define RPB_FUNCTION_3(__OUT__,__NAME__, ___0, ___1, ___2) \ +__OUT__ RCPP_DECORATE(__NAME__)(___0, ___1, ___2); \ +extern "C" SEXP __NAME__(SEXP x0, SEXP x1, SEXP x2){ \ +SEXP res = R_NilValue ; \ +BEGIN_RCPP \ +res = ::Rcpp::wrap( RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter( x0 ), ::Rcpp::internal::converter( x1 ), ::Rcpp::internal::converter( x2 )) ) ; \ +return res ; \ +END_RCPP \ +} \ +__OUT__ RCPP_DECORATE(__NAME__)(___0, ___1, ___2) + +#define RPB_FUNCTION_4(__OUT__,__NAME__, ___0, ___1, ___2, ___3) \ +__OUT__ RCPP_DECORATE(__NAME__)(___0, ___1, ___2, ___3); \ +extern "C" SEXP __NAME__(SEXP x0, SEXP x1, SEXP x2, SEXP x3){ \ +SEXP res = R_NilValue ; \ +BEGIN_RCPP \ +res = ::Rcpp::wrap( RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter( x0 ), ::Rcpp::internal::converter( x1 ), ::Rcpp::internal::converter( x2 )), ::Rcpp::internal::converter( x3 )) ) ; \ +return res ; \ +END_RCPP \ +} \ +__OUT__ RCPP_DECORATE(__NAME__)(___0, ___1, ___2, ___3) + +#define RPB_FUNCTION_VOID_0(__NAME__) \ +void RCPP_DECORATE(__NAME__)(); \ +extern "C" SEXP __NAME__(){ \ +BEGIN_RCPP \ +RCPP_DECORATE(__NAME__)(); \ +END_RCPP \ +} \ +void RCPP_DECORATE(__NAME__)() + +#define RPB_FUNCTION_VOID_1(__NAME__, ___0) \ +void RCPP_DECORATE(__NAME__)(___0); \ +extern "C" SEXP __NAME__(SEXP x0){ \ +BEGIN_RCPP \ +RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter( x0 )); \ +END_RCPP \ +} \ +void RCPP_DECORATE(__NAME__)(___0) + +#define RPB_FUNCTION_VOID_2(__NAME__, ___0, ___1) \ +void RCPP_DECORATE(__NAME__)(___0, ___1); \ +extern "C" SEXP __NAME__(SEXP x0, SEXP x1){ \ +BEGIN_RCPP \ +RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter( x0 ), ::Rcpp::internal::converter( x1 )); \ +END_RCPP \ +} \ +void RCPP_DECORATE(__NAME__)(___0, ___1) + +#define RPB_FUNCTION_VOID_3(__NAME__, ___0, ___1, ___2) \ +void RCPP_DECORATE(__NAME__)(___0, ___1, ___2); \ +extern "C" SEXP __NAME__(SEXP x0, SEXP x1, SEXP x2){ \ +BEGIN_RCPP \ +RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter( x0 ), ::Rcpp::internal::converter( x1 ), ::Rcpp::internal::converter( x2 )); \ +END_RCPP \ +} \ +void RCPP_DECORATE(__NAME__)(___0, ___1, ___2) + +#define RPB_FUNCTION_VOID_4(__NAME__, ___0, ___1, ___2, ___3) \ +void RCPP_DECORATE(__NAME__)(___0, ___1, ___2, ___3); \ +extern "C" SEXP __NAME__(SEXP x0, SEXP x1, SEXP x2, SEXP x3){ \ +BEGIN_RCPP \ +RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter( x0 ), ::Rcpp::internal::converter( x1 ), ::Rcpp::internal::converter( x2 ), ::Rcpp::internal::converter( x3 )); \ +END_RCPP \ +} \ +void RCPP_DECORATE(__NAME__)(___0, ___1, ___2, ___3) + +#endif Modified: pkg/src/mutators.cpp =================================================================== --- pkg/src/mutators.cpp 2013-09-12 03:58:01 UTC (rev 531) +++ pkg/src/mutators.cpp 2013-09-13 01:20:02 UTC (rev 532) @@ -20,6 +20,7 @@ #include "rprotobuf.h" #include "fieldtypes.h" +#include "RcppMacros.h" namespace rprotobuf{ @@ -1171,7 +1172,7 @@ } -RCPP_FUNCTION_VOID_2( update_message, Rcpp::XPtr message, Rcpp::List list ){ +RPB_FUNCTION_VOID_2( update_message, Rcpp::XPtr message, Rcpp::List list ){ Rcpp::CharacterVector names = list.attr( "names" ) ; int n = list.size() ; for( int i=0; i desc ){ +RPB_FUNCTION_1( Rcpp::CharacterVector, METHOD(getMemberNames), Rcpp::XPtr desc ){ int nfields = desc->field_count() ; int ntypes = desc->nested_type_count() ; @@ -45,7 +46,7 @@ * @param xp external pointer to a Descriptor * @return the descriptor as an R list */ -RCPP_FUNCTION_1( Rcpp::List, METHOD(as_list), Rcpp::XPtr desc ){ +RPB_FUNCTION_1( Rcpp::List, METHOD(as_list), Rcpp::XPtr desc ){ int nfields = desc->field_count() ; int ntypes = desc->nested_type_count() ; @@ -76,50 +77,50 @@ return res; } -RCPP_FUNCTION_1(S4_Message, METHOD(as_Message) , Rcpp::XPtr d ){ +RPB_FUNCTION_1(S4_Message, METHOD(as_Message) , Rcpp::XPtr d ){ GPB::DescriptorProto* message = new GPB::DescriptorProto() ; d->CopyTo( message ); return message ; } -RCPP_FUNCTION_2( S4_FieldDescriptor, METHOD(field), Rcpp::XPtr d, int i){ +RPB_FUNCTION_2( S4_FieldDescriptor, METHOD(field), Rcpp::XPtr d, int i){ return d->field( i ) ; } -RCPP_FUNCTION_2( S4_FieldDescriptor, METHOD(FindFieldByNumber), Rcpp::XPtr d, int num){ +RPB_FUNCTION_2( S4_FieldDescriptor, METHOD(FindFieldByNumber), Rcpp::XPtr d, int num){ return d->FindFieldByNumber( num ) ; } -RCPP_FUNCTION_2( S4_FieldDescriptor, METHOD(FindFieldByName), Rcpp::XPtr d, std::string nam ){ +RPB_FUNCTION_2( S4_FieldDescriptor, METHOD(FindFieldByName), Rcpp::XPtr d, std::string nam ){ return d->FindFieldByName( nam ) ; } -RCPP_FUNCTION_2( S4_Descriptor, METHOD(nested_type), Rcpp::XPtr d, int i){ +RPB_FUNCTION_2( S4_Descriptor, METHOD(nested_type), Rcpp::XPtr d, int i){ return d->nested_type( i ) ; } -RCPP_FUNCTION_2( S4_Descriptor, METHOD(FindNestedTypeByName), Rcpp::XPtr d, std::string nam){ +RPB_FUNCTION_2( S4_Descriptor, METHOD(FindNestedTypeByName), Rcpp::XPtr d, std::string nam){ return d->FindNestedTypeByName( nam ) ; } -RCPP_FUNCTION_2( S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr d, int i){ +RPB_FUNCTION_2( S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr d, int i){ return d->enum_type( i ) ; } // FIXME: two methods cant have the same name -// RCPP_FUNCTION_2( S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr d, std::string name){ +// RPB_FUNCTION_2( S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr d, std::string name){ // return d->FindEnumTypeByName( i ) ; // } -RCPP_FUNCTION_1( S4_FileDescriptor, METHOD(fileDescriptor), Rcpp::XPtr desc){ +RPB_FUNCTION_1( S4_FileDescriptor, METHOD(fileDescriptor), Rcpp::XPtr desc){ return S4_FileDescriptor( desc->file() ); } -RCPP_FUNCTION_2( std::string, METHOD(name), Rcpp::XPtr d, bool full){ +RPB_FUNCTION_2( std::string, METHOD(name), Rcpp::XPtr d, bool full){ return full ? d->full_name() : d->name() ; } -RCPP_FUNCTION_2( S4_Message, METHOD(readMessageFromFile), Rcpp::XPtr desc, std::string filename ){ +RPB_FUNCTION_2( S4_Message, METHOD(readMessageFromFile), Rcpp::XPtr desc, std::string filename ){ /* open the file to read in binary mode */ int file = open( filename.c_str() , O_RDONLY | O_BINARY); @@ -135,7 +136,7 @@ return( S4_Message( message ) ) ; } -RCPP_FUNCTION_2( S4_Message, METHOD(readMessageFromConnection), Rcpp::XPtr desc, int conn_id ){ +RPB_FUNCTION_2( S4_Message, METHOD(readMessageFromConnection), Rcpp::XPtr desc, int conn_id ){ RconnectionCopyingInputStream wrapper( conn_id ) ; GPB::io::CopyingInputStreamAdaptor stream( &wrapper ) ; GPB::io::CodedInputStream coded_stream(&stream ) ; @@ -151,7 +152,7 @@ return res ; } -RCPP_FUNCTION_2( S4_Message, METHOD(readMessageFromRawVector), Rcpp::XPtr desc, Rcpp::RawVector raw){ +RPB_FUNCTION_2( S4_Message, METHOD(readMessageFromRawVector), Rcpp::XPtr desc, Rcpp::RawVector raw){ GPB::io::ArrayInputStream ais( (void*)raw.begin(), raw.size() ); GPB::io::CodedInputStream stream( &ais ) ; @@ -164,7 +165,7 @@ return( S4_Message( message ) ) ; } -RCPP_FUNCTION_2( S4_Message, METHOD(readASCIIFromString), Rcpp::XPtr desc, std::string input){ +RPB_FUNCTION_2( S4_Message, METHOD(readASCIIFromString), Rcpp::XPtr desc, std::string input){ GPB::Message* message = PROTOTYPE( desc ) ; if (GPB::TextFormat::ParseFromString( input, message ) ) { return( S4_Message( message ) ) ; @@ -173,7 +174,7 @@ } } -RCPP_FUNCTION_2( S4_Message, METHOD(readASCIIFromConnection), Rcpp::XPtr desc, int conn_id){ +RPB_FUNCTION_2( S4_Message, METHOD(readASCIIFromConnection), Rcpp::XPtr desc, int conn_id){ RconnectionCopyingInputStream wrapper( conn_id ) ; GPB::io::CopyingInputStreamAdaptor stream( &wrapper ) ; Modified: pkg/src/wrapper_EnumDescriptor.cpp =================================================================== --- pkg/src/wrapper_EnumDescriptor.cpp 2013-09-12 03:58:01 UTC (rev 531) +++ pkg/src/wrapper_EnumDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) @@ -20,6 +20,7 @@ // along with RProtoBuf. If not, see . #include "rprotobuf.h" +#include "RcppMacros.h" namespace rprotobuf{ @@ -30,11 +31,11 @@ RCPP_XP_METHOD_0(METHOD(length) ,GPB::EnumDescriptor,value_count) RCPP_XP_METHOD_0(METHOD(value_count) ,GPB::EnumDescriptor,value_count) - RCPP_FUNCTION_1(S4_Descriptor, METHOD(containing_type), Rcpp::XPtr d ){ + RPB_FUNCTION_1(S4_Descriptor, METHOD(containing_type), Rcpp::XPtr d ){ return S4_Descriptor( d->containing_type() ) ; } - RCPP_FUNCTION_2( S4_EnumValueDescriptor, METHOD(getValueByIndex) , Rcpp::XPtr d, int index){ + RPB_FUNCTION_2( S4_EnumValueDescriptor, METHOD(getValueByIndex) , Rcpp::XPtr d, int index){ if ((index >= 0) && (index < d->value_count())) { return S4_EnumValueDescriptor( d->value(index) ) ; } else { @@ -42,14 +43,14 @@ } } - RCPP_FUNCTION_2( S4_EnumValueDescriptor, METHOD(getValueByNumber), Rcpp::XPtr d, int i ){ + RPB_FUNCTION_2( S4_EnumValueDescriptor, METHOD(getValueByNumber), Rcpp::XPtr d, int i ){ return S4_EnumValueDescriptor( d->FindValueByNumber(i) ) ; } - RCPP_FUNCTION_2( S4_EnumValueDescriptor, METHOD(getValueByName) , Rcpp::XPtr d , std::string name ){ + RPB_FUNCTION_2( S4_EnumValueDescriptor, METHOD(getValueByName) , Rcpp::XPtr d , std::string name ){ return S4_EnumValueDescriptor( d->FindValueByName(name) ) ; } - RCPP_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr d ){ + RPB_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr d ){ GPB::EnumDescriptorProto* message = new GPB::EnumDescriptorProto() ; d->CopyTo( message ); return S4_Message(message) ; @@ -63,7 +64,7 @@ * * @param the value associated with the name */ -RCPP_FUNCTION_2(int,get_value_of_enum, +RPB_FUNCTION_2(int,get_value_of_enum, Rcpp::XPtr d, std::string name){ const GPB::EnumValueDescriptor* evd = d->FindValueByName(name) ; @@ -81,7 +82,7 @@ * @param name the name of the enum * @return logical */ -RCPP_FUNCTION_2(bool,has_enum_name, +RPB_FUNCTION_2(bool,has_enum_name, Rcpp::XPtr d, std::string name){ const GPB::EnumValueDescriptor* evd = d->FindValueByName(name) ; return (evd != NULL); @@ -91,7 +92,7 @@ * @param xp external pointer to a Descriptor * @return the descriptor as an R list */ -RCPP_FUNCTION_1( Rcpp::IntegerVector, METHOD(as_list), Rcpp::XPtr d ){ +RPB_FUNCTION_1( Rcpp::IntegerVector, METHOD(as_list), Rcpp::XPtr d ){ int n = d->value_count() ; Rcpp::IntegerVector values(n) ; @@ -106,7 +107,7 @@ return values; } -RCPP_FUNCTION_1( Rcpp::CharacterVector, METHOD(getConstantNames), Rcpp::XPtr d){ +RPB_FUNCTION_1( Rcpp::CharacterVector, METHOD(getConstantNames), Rcpp::XPtr d){ int n = d->value_count() ; Rcpp::CharacterVector res( n) ; for( int i=0; i desc){ +RPB_FUNCTION_1( S4_FileDescriptor, METHOD(fileDescriptor), Rcpp::XPtr desc){ return S4_FileDescriptor( desc->file() ); } -RCPP_FUNCTION_2( std::string, METHOD(name), Rcpp::XPtr d, bool full){ +RPB_FUNCTION_2( std::string, METHOD(name), Rcpp::XPtr d, bool full){ return full ? d->full_name() : d->name() ; } Modified: pkg/src/wrapper_EnumValueDescriptor.cpp =================================================================== --- pkg/src/wrapper_EnumValueDescriptor.cpp 2013-09-12 03:58:01 UTC (rev 531) +++ pkg/src/wrapper_EnumValueDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) @@ -20,6 +20,7 @@ // along with RProtoBuf. If not, see . #include "rprotobuf.h" +#include "RcppMacros.h" namespace rprotobuf{ @@ -28,17 +29,17 @@ RCPP_XP_METHOD_0( METHOD(as_character) , GPB::EnumValueDescriptor , DebugString) ; -RCPP_FUNCTION_1(S4_Message, METHOD(as_Message) , Rcpp::XPtr d ){ +RPB_FUNCTION_1(S4_Message, METHOD(as_Message) , Rcpp::XPtr d ){ GPB::EnumValueDescriptorProto* message = new GPB::EnumValueDescriptorProto() ; d->CopyTo( message ); return S4_Message(message) ; } -RCPP_FUNCTION_2( std::string, METHOD(name), Rcpp::XPtr d, bool full) { +RPB_FUNCTION_2( std::string, METHOD(name), Rcpp::XPtr d, bool full) { return full ? d->full_name() : d->name() ; } -RCPP_FUNCTION_1( int, METHOD(number), Rcpp::XPtr d) { +RPB_FUNCTION_1( int, METHOD(number), Rcpp::XPtr d) { return d->number() ; } Modified: pkg/src/wrapper_FieldDescriptor.cpp =================================================================== --- pkg/src/wrapper_FieldDescriptor.cpp 2013-09-12 03:58:01 UTC (rev 531) +++ pkg/src/wrapper_FieldDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) @@ -20,6 +20,7 @@ #include "rprotobuf.h" #include "fieldtypes.h" +#include "RcppMacros.h" namespace rprotobuf { @@ -37,7 +38,7 @@ RCPP_XP_METHOD_0( METHOD(is_required) , GPB::FieldDescriptor, is_required ) RCPP_XP_METHOD_0( METHOD(has_default_value) , GPB::FieldDescriptor, has_default_value ) - RCPP_FUNCTION_1( S4_Descriptor, METHOD(containing_type), Rcpp::XPtr d){ + RPB_FUNCTION_1( S4_Descriptor, METHOD(containing_type), Rcpp::XPtr d){ return S4_Descriptor( d->containing_type() ) ; } @@ -48,7 +49,7 @@ break ; \ } - RCPP_FUNCTION_1( SEXP, METHOD(default_value) , Rcpp::XPtr d ){ + RPB_FUNCTION_1( SEXP, METHOD(default_value) , Rcpp::XPtr d ){ switch( d->cpp_type() ){ RPB_HANDLE_CASE(INT32,int32) @@ -73,31 +74,31 @@ return R_NilValue ; } - RCPP_FUNCTION_1(S4_Descriptor, METHOD(message_type), Rcpp::XPtr d){ + RPB_FUNCTION_1(S4_Descriptor, METHOD(message_type), Rcpp::XPtr d){ if( d->cpp_type() != CPPTYPE_MESSAGE ){ throw Rcpp::not_compatible( "not a message type field" ) ; } return S4_Descriptor( d->message_type() ) ; } - RCPP_FUNCTION_1(S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr d){ + RPB_FUNCTION_1(S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr d){ if( d->cpp_type() != CPPTYPE_ENUM ){ throwException( "not an enum type field", "NotEnumType" ); } return S4_EnumDescriptor( d->enum_type() ) ; } - RCPP_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr d ){ + RPB_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr d ){ GPB::FieldDescriptorProto* message = new GPB::FieldDescriptorProto() ; d->CopyTo( message ); return S4_Message( message ) ; } - RCPP_FUNCTION_1( S4_FileDescriptor, METHOD(fileDescriptor), Rcpp::XPtr desc){ + RPB_FUNCTION_1( S4_FileDescriptor, METHOD(fileDescriptor), Rcpp::XPtr desc){ return S4_FileDescriptor( desc->file() ); } - RCPP_FUNCTION_2( std::string, METHOD(name), Rcpp::XPtr d, bool full){ + RPB_FUNCTION_2( std::string, METHOD(name), Rcpp::XPtr d, bool full){ return full ? d->full_name() : d->name() ; } @@ -107,4 +108,3 @@ } // namespace rprotobuf - Modified: pkg/src/wrapper_FileDescriptor.cpp =================================================================== --- pkg/src/wrapper_FileDescriptor.cpp 2013-09-12 03:58:01 UTC (rev 531) +++ pkg/src/wrapper_FileDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) @@ -1,4 +1,5 @@ #include "rprotobuf.h" +#include "RcppMacros.h" namespace rprotobuf{ @@ -7,14 +8,14 @@ RCPP_XP_METHOD_0( METHOD(as_character) , GPB::FileDescriptor , DebugString) ; -RCPP_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr d ){ +RPB_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr d ){ GPB::FileDescriptorProto* message = new GPB::FileDescriptorProto() ; d->CopyTo( message ); return S4_Message( message ) ; } -RCPP_FUNCTION_1( Rcpp::CharacterVector, METHOD(getMemberNames), Rcpp::XPtr desc ){ +RPB_FUNCTION_1( Rcpp::CharacterVector, METHOD(getMemberNames), Rcpp::XPtr desc ){ int ntypes = desc->message_type_count() ; int nenums = desc->enum_type_count() ; int nserv = desc->service_count() ; @@ -54,7 +55,7 @@ * @param xp (GPB::FileDescriptor*) external pointer * @return the descriptor as an R list */ -RCPP_FUNCTION_1( Rcpp::List, METHOD(as_list), Rcpp::XPtr desc ){ +RPB_FUNCTION_1( Rcpp::List, METHOD(as_list), Rcpp::XPtr desc ){ int ntypes = desc->message_type_count() ; int nenums = desc->enum_type_count() ; int nserv = desc->service_count() ; @@ -86,7 +87,7 @@ return res; } -RCPP_FUNCTION_1( std::string, METHOD(name), Rcpp::XPtr desc ){ +RPB_FUNCTION_1( std::string, METHOD(name), Rcpp::XPtr desc ){ return desc->name() ; } Modified: pkg/src/wrapper_Message.cpp =================================================================== --- pkg/src/wrapper_Message.cpp 2013-09-12 03:58:01 UTC (rev 531) +++ pkg/src/wrapper_Message.cpp 2013-09-13 01:20:02 UTC (rev 532) @@ -1,5 +1,6 @@ #include "rprotobuf.h" #include "fieldtypes.h" +#include "RcppMacros.h" #define SAME(x,y,tol) ( (tol==0.0 && x == y ) || ( ( (x-y)*(x-y) < tol*tol ) ? 1 : 0 ) ) @@ -63,7 +64,7 @@ * @param xp external pointer to a message * @return a new message, clone of the input message */ -RCPP_FUNCTION_1( S4_Message, METHOD(clone) , Rcpp::XPtr message ){ +RPB_FUNCTION_1( S4_Message, METHOD(clone) , Rcpp::XPtr message ){ /* cloning message as sheep */ GPB::Message* sheep = message->New() ; sheep->CopyFrom( *message ); @@ -79,7 +80,7 @@ * @param xp external pointer to the Message * @param name name of the field */ -RCPP_FUNCTION_2(bool, METHOD(field_exists), Rcpp::XPtr message, std::string name ){ +RPB_FUNCTION_2(bool, METHOD(field_exists), Rcpp::XPtr message, std::string name ){ const GPB::Descriptor* desc = message->GetDescriptor(); const GPB::FieldDescriptor* field_desc = desc->FindFieldByName( name ) ; return (field_desc != NULL); @@ -92,7 +93,7 @@ * @param xp external pointer to the Message * @param name name of the field */ -RCPP_FUNCTION_2(bool, METHOD(has_field), Rcpp::XPtr message, std::string name ){ +RPB_FUNCTION_2(bool, METHOD(has_field), Rcpp::XPtr message, std::string name ){ const GPB::Descriptor* desc = message->GetDescriptor(); const GPB::FieldDescriptor* field_desc = desc->FindFieldByName( name ) ; @@ -115,7 +116,7 @@ * * @param xp external pointer to the Message */ -RCPP_FUNCTION_1( bool, METHOD(is_initialized), Rcpp::XPtr message){ +RPB_FUNCTION_1( bool, METHOD(is_initialized), Rcpp::XPtr message){ return message->IsInitialized() ; } @@ -126,7 +127,7 @@ * @param xp external pointer to a GPB::Message* * @param filename file name where to serialize */ -RCPP_FUNCTION_VOID_2( METHOD(serialize_to_file) , Rcpp::XPtr message, const char* filename){ +RPB_FUNCTION_VOID_2( METHOD(serialize_to_file) , Rcpp::XPtr message, const char* filename){ /* open the file in binary mode to write */ /* we make sure in the R side that filename is the full path of the file */ @@ -145,7 +146,7 @@ * * @param xp xternal pointer to the message */ -RCPP_FUNCTION_1( Rcpp::RawVector, METHOD(get_payload), Rcpp::XPtr message ){ +RPB_FUNCTION_1( Rcpp::RawVector, METHOD(get_payload), Rcpp::XPtr message ){ /* create a raw vector of the appropriate size */ int size = message->ByteSize() ; @@ -165,7 +166,7 @@ * @param xp (GPB::Message*) external pointer * @param field name or tag of the field */ -RCPP_FUNCTION_VOID_2(METHOD(clear_field), Rcpp::XPtr m, SEXP field ){ +RPB_FUNCTION_VOID_2(METHOD(clear_field), Rcpp::XPtr m, SEXP field ){ GPB::FieldDescriptor* field_desc = getFieldDescriptor( m, field ) ; const GPB::Reflection* ref = m->GetReflection(); ref->ClearField( m, field_desc ) ; @@ -176,7 +177,7 @@ * @param xp external pointer to a Message * @return the message as an R list */ -RCPP_FUNCTION_1( Rcpp::List, METHOD(as_list), Rcpp::XPtr message ){ +RPB_FUNCTION_1( Rcpp::List, METHOD(as_list), Rcpp::XPtr message ){ const GPB::Descriptor* desc = message->GetDescriptor() ; int nf = desc->field_count() ; @@ -201,7 +202,7 @@ * * @param xp external pointer to the Message */ -RCPP_FUNCTION_1(int, METHOD(length), Rcpp::XPtr message){ +RPB_FUNCTION_1(int, METHOD(length), Rcpp::XPtr message){ const GPB::Descriptor* desc = message->GetDescriptor(); const GPB::Reflection * ref = message->GetReflection() ; @@ -229,7 +230,7 @@ * * @param xp external pointer to the Message */ -RCPP_FUNCTION_1(int, METHOD(num_extensions), Rcpp::XPtr message){ +RPB_FUNCTION_1(int, METHOD(num_extensions), Rcpp::XPtr message){ const GPB::Reflection * ref = message->GetReflection() ; int nexts = 0; vector fields; @@ -248,14 +249,14 @@ * @param xp (GPB::Message*) external pointer * @return the descriptor, as a Descriptor R S4 object */ -RCPP_FUNCTION_1(S4_Descriptor, METHOD(descriptor), Rcpp::XPtr message ){ +RPB_FUNCTION_1(S4_Descriptor, METHOD(descriptor), Rcpp::XPtr message ){ return( message->GetDescriptor() ) ; } RCPP_XP_METHOD_0( METHOD(as_character) , GPB::Message, DebugString) RCPP_XP_METHOD_0( METHOD(bytesize), GPB::Message, ByteSize ) -RCPP_FUNCTION_2( int, METHOD(field_size), Rcpp::XPtr message, SEXP field ){ +RPB_FUNCTION_2( int, METHOD(field_size), Rcpp::XPtr message, SEXP field ){ GPB::FieldDescriptor* field_desc = getFieldDescriptor( message, field ) ; @@ -268,12 +269,12 @@ return res ; } -RCPP_FUNCTION_1( S4_FileDescriptor, METHOD(fileDescriptor), Rcpp::XPtr message ){ +RPB_FUNCTION_1( S4_FileDescriptor, METHOD(fileDescriptor), Rcpp::XPtr message ){ return S4_FileDescriptor( message->GetDescriptor()->file() ) ; } -RCPP_FUNCTION_VOID_3( METHOD(set_field_size), Rcpp::XPtr message, SEXP field, int target){ +RPB_FUNCTION_VOID_3( METHOD(set_field_size), Rcpp::XPtr message, SEXP field, int target){ GPB::FieldDescriptor* field_desc = getFieldDescriptor( message, field ) ; const GPB::Reflection* ref = message->GetReflection() ; @@ -444,7 +445,7 @@ * * @return field names, as an R character vector (STRSXP) */ -RCPP_FUNCTION_1( Rcpp::CharacterVector, METHOD(fieldNames), Rcpp::XPtr message){ +RPB_FUNCTION_1( Rcpp::CharacterVector, METHOD(fieldNames), Rcpp::XPtr message){ const GPB::Descriptor* desc = message->GetDescriptor() ; int nfields = desc->field_count() ; @@ -642,15 +643,15 @@ } -RCPP_FUNCTION_2( bool, identical_messages, Rcpp::XPtr m1, Rcpp::XPtr m2){ +RPB_FUNCTION_2( bool, identical_messages, Rcpp::XPtr m1, Rcpp::XPtr m2){ return identical_messages_( m1, m2, 0.0 ) ; } -RCPP_FUNCTION_3( bool, all_equal_messages, Rcpp::XPtr m1, Rcpp::XPtr m2, double tol){ +RPB_FUNCTION_3( bool, all_equal_messages, Rcpp::XPtr m1, Rcpp::XPtr m2, double tol){ return identical_messages_( m1, m2, tol ) ; } -RCPP_FUNCTION_VOID_4( METHOD(swap), Rcpp::XPtr message, SEXP field, Rcpp::IntegerVector left, Rcpp::IntegerVector right){ +RPB_FUNCTION_VOID_4( METHOD(swap), Rcpp::XPtr message, SEXP field, Rcpp::IntegerVector left, Rcpp::IntegerVector right){ GPB::FieldDescriptor* field_desc = getFieldDescriptor( message, field ) ; const GPB::Reflection* ref = message->GetReflection(); if( ! field_desc->is_repeated() ){ @@ -670,7 +671,7 @@ * * @return a new message, as an R object of "Message" S4 class */ -RCPP_FUNCTION_2( S4_Message, METHOD(merge), Rcpp::XPtr m1, Rcpp::XPtr m2){ +RPB_FUNCTION_2( S4_Message, METHOD(merge), Rcpp::XPtr m1, Rcpp::XPtr m2){ GPB::Message* merged = m1->New() ; merged->MergeFrom( *m1 ) ; merged->MergeFrom( *m2 ); @@ -685,7 +686,7 @@ * @param field field tag number or name * @param values values to append */ -RCPP_FUNCTION_VOID_3( METHOD(add_values), Rcpp::XPtr message, SEXP field, SEXP values){ +RPB_FUNCTION_VOID_3( METHOD(add_values), Rcpp::XPtr message, SEXP field, SEXP values){ const Reflection * ref = message->GetReflection() ; GPB::FieldDescriptor* field_desc = getFieldDescriptor( message, field ); @@ -981,7 +982,7 @@ * @param field name or tag number of the field [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/rprotobuf -r 532 From noreply at r-forge.r-project.org Fri Sep 13 03:50:57 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 03:50:57 +0200 (CEST) Subject: [Rprotobuf-commits] r533 - in pkg: . src Message-ID: <20130913015057.9D7CB185DA7@r-forge.r-project.org> Author: murray Date: 2013-09-13 03:50:54 +0200 (Fri, 13 Sep 2013) New Revision: 533 Modified: pkg/ChangeLog pkg/src/RcppMacros.h pkg/src/wrapper_Descriptor.cpp pkg/src/wrapper_EnumDescriptor.cpp pkg/src/wrapper_EnumValueDescriptor.cpp pkg/src/wrapper_FieldDescriptor.cpp pkg/src/wrapper_FileDescriptor.cpp pkg/src/wrapper_Message.cpp pkg/src/wrapper_MethodDescriptor.cpp pkg/src/wrapper_ServiceDescriptor.cpp Log: Finish the macro conversion job by getting the RCPP_METHOD_XP ones as well. These are the ones that would seem to be even more suitable for Rcpp Modules as I understand them. Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/ChangeLog 2013-09-13 01:50:54 UTC (rev 533) @@ -1,3 +1,9 @@ +2013-09-12 Murray Stokely + + * src/RcppMacros.h: Add Rcpp compatibility macros + which are simplified versions of the now deprecated ones from + Rcpp. + 2013-09-11 Murray Stokely * configure.in: If pkg-config is not available add -lprotobuf to Modified: pkg/src/RcppMacros.h =================================================================== --- pkg/src/RcppMacros.h 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/RcppMacros.h 2013-09-13 01:50:54 UTC (rev 533) @@ -136,4 +136,36 @@ } \ void RCPP_DECORATE(__NAME__)(___0, ___1, ___2, ___3) +#define RPB_XP_METHOD_0(__NAME__,__CLASS__,__METHOD__ ) \ +extern "C" SEXP __NAME__( SEXP xp ){ \ +BEGIN_RCPP \ + ::Rcpp::XPtr< __CLASS__ > ptr(xp) ; \ + return ::Rcpp::wrap( ptr->__METHOD__( ) ) ; \ +END_RCPP \ +} + +#define RPB_XP_METHOD_VOID_0(__NAME__,__CLASS__,__METHOD__) \ +extern "C" SEXP __NAME__( SEXP xp ){ \ +BEGIN_RCPP \ +::Rcpp::XPtr< __CLASS__ > ptr(xp) ; \ +ptr->__METHOD__( ) ; \ +END_RCPP \ +} + +#define RPB_XP_METHOD_CAST_0(__NAME__,__CLASS__,__METHOD__,__CAST__) \ +extern "C" SEXP __NAME__( SEXP xp ){ \ +BEGIN_RCPP \ + ::Rcpp::XPtr< __CLASS__ > ptr(xp) ; \ + return ::Rcpp::wrap( __CAST__( ptr->__METHOD__( ) ) ) ; \ +END_RCPP \ +} + +#define RPB_XP_METHOD_CAST_1(__NAME__,__CLASS__,__METHOD__,__CAST__) \ +extern "C" SEXP __NAME__( SEXP xp , SEXP x0 ){ \ +BEGIN_RCPP \ + ::Rcpp::XPtr< __CLASS__ > ptr(xp) ; \ + return ::Rcpp::wrap( __CAST__( ptr->__METHOD__( ::Rcpp::internal::converter( x0 ) ) ) ) ; \ +END_RCPP \ +} + #endif Modified: pkg/src/wrapper_Descriptor.cpp =================================================================== --- pkg/src/wrapper_Descriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/wrapper_Descriptor.cpp 2013-09-13 01:50:54 UTC (rev 533) @@ -6,12 +6,12 @@ #undef METHOD #define METHOD(__NAME__) RCPP_PP_CAT(Descriptor__,__NAME__) -RCPP_XP_METHOD_0( METHOD(as_character), GPB::Descriptor , DebugString) -RCPP_XP_METHOD_0( METHOD(field_count), GPB::Descriptor, field_count ) -RCPP_XP_METHOD_0( METHOD(nested_type_count), GPB::Descriptor, nested_type_count ) -RCPP_XP_METHOD_0( METHOD(enum_type_count), GPB::Descriptor, enum_type_count ) +RPB_XP_METHOD_0( METHOD(as_character), GPB::Descriptor , DebugString) +RPB_XP_METHOD_0( METHOD(field_count), GPB::Descriptor, field_count ) +RPB_XP_METHOD_0( METHOD(nested_type_count), GPB::Descriptor, nested_type_count ) +RPB_XP_METHOD_0( METHOD(enum_type_count), GPB::Descriptor, enum_type_count ) -RCPP_XP_METHOD_CAST_0( METHOD(containing_type), GPB::Descriptor, containing_type, S4_Descriptor ) +RPB_XP_METHOD_CAST_0( METHOD(containing_type), GPB::Descriptor, containing_type, S4_Descriptor ) /** Modified: pkg/src/wrapper_EnumDescriptor.cpp =================================================================== --- pkg/src/wrapper_EnumDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/wrapper_EnumDescriptor.cpp 2013-09-13 01:50:54 UTC (rev 533) @@ -27,9 +27,9 @@ #undef METHOD #define METHOD(__NAME__) RCPP_PP_CAT(EnumDescriptor__,__NAME__) - RCPP_XP_METHOD_0(METHOD(as_character), GPB::EnumDescriptor , DebugString) ; - RCPP_XP_METHOD_0(METHOD(length) ,GPB::EnumDescriptor,value_count) - RCPP_XP_METHOD_0(METHOD(value_count) ,GPB::EnumDescriptor,value_count) + RPB_XP_METHOD_0(METHOD(as_character), GPB::EnumDescriptor , DebugString) ; + RPB_XP_METHOD_0(METHOD(length) ,GPB::EnumDescriptor,value_count) + RPB_XP_METHOD_0(METHOD(value_count) ,GPB::EnumDescriptor,value_count) RPB_FUNCTION_1(S4_Descriptor, METHOD(containing_type), Rcpp::XPtr d ){ return S4_Descriptor( d->containing_type() ) ; Modified: pkg/src/wrapper_EnumValueDescriptor.cpp =================================================================== --- pkg/src/wrapper_EnumValueDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/wrapper_EnumValueDescriptor.cpp 2013-09-13 01:50:54 UTC (rev 533) @@ -27,7 +27,7 @@ #undef METHOD #define METHOD(__NAME__) RCPP_PP_CAT(EnumValueDescriptor__,__NAME__) -RCPP_XP_METHOD_0( METHOD(as_character) , GPB::EnumValueDescriptor , DebugString) ; +RPB_XP_METHOD_0( METHOD(as_character) , GPB::EnumValueDescriptor , DebugString) ; RPB_FUNCTION_1(S4_Message, METHOD(as_Message) , Rcpp::XPtr d ){ GPB::EnumValueDescriptorProto* message = new GPB::EnumValueDescriptorProto() ; Modified: pkg/src/wrapper_FieldDescriptor.cpp =================================================================== --- pkg/src/wrapper_FieldDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/wrapper_FieldDescriptor.cpp 2013-09-13 01:50:54 UTC (rev 533) @@ -27,16 +27,16 @@ #undef METHOD #define METHOD(__NAME__) RCPP_PP_CAT(FieldDescriptor__,__NAME__) - RCPP_XP_METHOD_0( METHOD(as_character) , GPB::FieldDescriptor, DebugString) - RCPP_XP_METHOD_0( METHOD(is_extension) , GPB::FieldDescriptor, is_extension) - RCPP_XP_METHOD_0( METHOD(number) , GPB::FieldDescriptor, number) - RCPP_XP_METHOD_0( METHOD(type) , GPB::FieldDescriptor, type ) - RCPP_XP_METHOD_0( METHOD(cpp_type) , GPB::FieldDescriptor, cpp_type ) - RCPP_XP_METHOD_0( METHOD(label) , GPB::FieldDescriptor, label ) - RCPP_XP_METHOD_0( METHOD(is_repeated) , GPB::FieldDescriptor, is_repeated ) - RCPP_XP_METHOD_0( METHOD(is_optional) , GPB::FieldDescriptor, is_optional ) - RCPP_XP_METHOD_0( METHOD(is_required) , GPB::FieldDescriptor, is_required ) - RCPP_XP_METHOD_0( METHOD(has_default_value) , GPB::FieldDescriptor, has_default_value ) + RPB_XP_METHOD_0( METHOD(as_character) , GPB::FieldDescriptor, DebugString) + RPB_XP_METHOD_0( METHOD(is_extension) , GPB::FieldDescriptor, is_extension) + RPB_XP_METHOD_0( METHOD(number) , GPB::FieldDescriptor, number) + RPB_XP_METHOD_0( METHOD(type) , GPB::FieldDescriptor, type ) + RPB_XP_METHOD_0( METHOD(cpp_type) , GPB::FieldDescriptor, cpp_type ) + RPB_XP_METHOD_0( METHOD(label) , GPB::FieldDescriptor, label ) + RPB_XP_METHOD_0( METHOD(is_repeated) , GPB::FieldDescriptor, is_repeated ) + RPB_XP_METHOD_0( METHOD(is_optional) , GPB::FieldDescriptor, is_optional ) + RPB_XP_METHOD_0( METHOD(is_required) , GPB::FieldDescriptor, is_required ) + RPB_XP_METHOD_0( METHOD(has_default_value) , GPB::FieldDescriptor, has_default_value ) RPB_FUNCTION_1( S4_Descriptor, METHOD(containing_type), Rcpp::XPtr d){ return S4_Descriptor( d->containing_type() ) ; Modified: pkg/src/wrapper_FileDescriptor.cpp =================================================================== --- pkg/src/wrapper_FileDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/wrapper_FileDescriptor.cpp 2013-09-13 01:50:54 UTC (rev 533) @@ -6,7 +6,7 @@ #undef METHOD #define METHOD(__NAME__) RCPP_PP_CAT(FileDescriptor__,__NAME__) -RCPP_XP_METHOD_0( METHOD(as_character) , GPB::FileDescriptor , DebugString) ; +RPB_XP_METHOD_0( METHOD(as_character) , GPB::FileDescriptor , DebugString) ; RPB_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr d ){ GPB::FileDescriptorProto* message = new GPB::FileDescriptorProto() ; Modified: pkg/src/wrapper_Message.cpp =================================================================== --- pkg/src/wrapper_Message.cpp 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/wrapper_Message.cpp 2013-09-13 01:50:54 UTC (rev 533) @@ -158,7 +158,7 @@ return( payload ) ; } -RCPP_XP_METHOD_VOID_0(METHOD(clear), GPB::Message, Clear ) +RPB_XP_METHOD_VOID_0(METHOD(clear), GPB::Message, Clear ) /** * Clear a field of a message @@ -253,8 +253,8 @@ return( message->GetDescriptor() ) ; } -RCPP_XP_METHOD_0( METHOD(as_character) , GPB::Message, DebugString) -RCPP_XP_METHOD_0( METHOD(bytesize), GPB::Message, ByteSize ) +RPB_XP_METHOD_0( METHOD(as_character) , GPB::Message, DebugString) +RPB_XP_METHOD_0( METHOD(bytesize), GPB::Message, ByteSize ) RPB_FUNCTION_2( int, METHOD(field_size), Rcpp::XPtr message, SEXP field ){ Modified: pkg/src/wrapper_MethodDescriptor.cpp =================================================================== --- pkg/src/wrapper_MethodDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/wrapper_MethodDescriptor.cpp 2013-09-13 01:50:54 UTC (rev 533) @@ -6,7 +6,7 @@ #undef METHOD #define METHOD(__NAME__) RCPP_PP_CAT(MethodDescriptor__,__NAME__) -RCPP_XP_METHOD_0( METHOD(as_character) , GPB::MethodDescriptor , DebugString) +RPB_XP_METHOD_0( METHOD(as_character) , GPB::MethodDescriptor , DebugString) RPB_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr d ){ GPB::MethodDescriptorProto* message = new GPB::MethodDescriptorProto() ; Modified: pkg/src/wrapper_ServiceDescriptor.cpp =================================================================== --- pkg/src/wrapper_ServiceDescriptor.cpp 2013-09-13 01:20:02 UTC (rev 532) +++ pkg/src/wrapper_ServiceDescriptor.cpp 2013-09-13 01:50:54 UTC (rev 533) @@ -6,12 +6,12 @@ #undef METHOD #define METHOD(__NAME__) RCPP_PP_CAT(ServiceDescriptor__,__NAME__) - RCPP_XP_METHOD_0( METHOD(length),GPB::ServiceDescriptor, method_count ) - RCPP_XP_METHOD_0( METHOD(method_count),GPB::ServiceDescriptor, method_count ) - RCPP_XP_METHOD_0( METHOD(as_character) , GPB::ServiceDescriptor , DebugString) + RPB_XP_METHOD_0( METHOD(length),GPB::ServiceDescriptor, method_count ) + RPB_XP_METHOD_0( METHOD(method_count),GPB::ServiceDescriptor, method_count ) + RPB_XP_METHOD_0( METHOD(as_character) , GPB::ServiceDescriptor , DebugString) - RCPP_XP_METHOD_CAST_1( METHOD(getMethodByIndex) , GPB::ServiceDescriptor , method , S4_MethodDescriptor ) - RCPP_XP_METHOD_CAST_1( METHOD(getMethodByName) , GPB::ServiceDescriptor , FindMethodByName, S4_MethodDescriptor ) + RPB_XP_METHOD_CAST_1( METHOD(getMethodByIndex) , GPB::ServiceDescriptor , method , S4_MethodDescriptor ) + RPB_XP_METHOD_CAST_1( METHOD(getMethodByName) , GPB::ServiceDescriptor , FindMethodByName, S4_MethodDescriptor ) RPB_FUNCTION_1( Rcpp::CharacterVector, METHOD(getMethodNames), Rcpp::XPtr desc){ int nmeths = desc->method_count() ; From noreply at r-forge.r-project.org Fri Sep 13 03:56:15 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 03:56:15 +0200 (CEST) Subject: [Rprotobuf-commits] r534 - in pkg: . inst Message-ID: <20130913015615.4BBBC185DA7@r-forge.r-project.org> Author: murray Date: 2013-09-13 03:56:14 +0200 (Fri, 13 Sep 2013) New Revision: 534 Modified: pkg/DESCRIPTION pkg/inst/NEWS.Rd Log: Update version to 0.3.0.2 and summarize more changes since last CRAN release. Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2013-09-13 01:50:54 UTC (rev 533) +++ pkg/DESCRIPTION 2013-09-13 01:56:14 UTC (rev 534) @@ -1,5 +1,5 @@ Package: RProtoBuf -Version: 0.3.0.1 +Version: 0.3.0.2 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Murray Stokely Maintainer: Dirk Eddelbuettel Modified: pkg/inst/NEWS.Rd =================================================================== --- pkg/inst/NEWS.Rd 2013-09-13 01:50:54 UTC (rev 533) +++ pkg/inst/NEWS.Rd 2013-09-13 01:56:14 UTC (rev 534) @@ -10,9 +10,17 @@ native 64-bit integer types. \item Added better error handling, documentation, and tests to the extensions support (getExtension and setExtension). - \item Add support to P for returning extension descriptors. + \item Add support to P for returning extension descriptors. + \item Improved error messages to include field names when invalid + fields are specified to protocol buffer messages with new, update, etc. \item Improved configure to detect and pass -std=c++0x if it is - available to enable long long 64-bit integer support in Rcpp. + available to enable long long 64-bit integer support in Rcpp. + \item Improved configure in the case when pkg-config is not + available or does not know about the google protocol buffer + includes. + \item Replaced newly deprecated Rcpp macros with a simplified macro + functionality to avoid warnings on the latest development version of + Rcpp. } } From noreply at r-forge.r-project.org Fri Sep 13 10:16:48 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 10:16:48 +0200 (CEST) Subject: [Rprotobuf-commits] r535 - in pkg: . vignettes Message-ID: <20130913081649.133D5184F9A@r-forge.r-project.org> Author: murray Date: 2013-09-13 10:16:48 +0200 (Fri, 13 Sep 2013) New Revision: 535 Added: pkg/vignettes/Makefile.in Removed: pkg/vignettes/Makefile Modified: pkg/ChangeLog pkg/configure pkg/configure.in Log: Replace use of a GNU make extension with a configure variable so we can output a more portable makefile for the vignette. Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-09-13 01:56:14 UTC (rev 534) +++ pkg/ChangeLog 2013-09-13 08:16:48 UTC (rev 535) @@ -1,3 +1,9 @@ +2013-09-13 Murray Stokely + + * vignettes/Makefile.in: Update configure to output R_HOME to the + vignette makefile so we can avoid the use of a non-portable GNU + makefile extension here. + 2013-09-12 Murray Stokely * src/RcppMacros.h: Add Rcpp compatibility macros Modified: pkg/configure =================================================================== --- pkg/configure 2013-09-13 01:56:14 UTC (rev 534) +++ pkg/configure 2013-09-13 08:16:48 UTC (rev 535) @@ -589,6 +589,7 @@ ac_subst_vars='LTLIBOBJS LIBOBJS +R_HOME PKG_LIBS PKG_CPPFLAGS RSCRIPT @@ -3678,15 +3679,18 @@ ## use pkg-config for ProtoBuf settings ## -# First, set a reasonable default of -lprotobuf if we don't have pkg-config -protobuf_cxxflags="" -protobuf_libs="-lprotobuf" - if test x"${PKGCONFIG}" == x"yes"; then if pkg-config --exists protobuf; then protobuf_cxxflags=`pkg-config --cflags protobuf` protobuf_libs=`pkg-config --libs protobuf` + else + protobuf_cxxflags="" + protobuf_libs="-lprotobuf" fi +else + # Add a reasonable default of -lprotobuf if we don't have pkg-config + protobuf_cxxflags="" + protobuf_libs="-lprotobuf" fi ## And make sure these flags are used for the tests below. @@ -4184,8 +4188,10 @@ PKG_LIBS="${PKG_LIBS} $rcpp_ldflags $protobuf_libs" -ac_config_files="$ac_config_files src/Makevars" +R_HOME="${R_HOME}" +ac_config_files="$ac_config_files src/Makevars vignettes/Makefile" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -4881,6 +4887,7 @@ do case $ac_config_target in "src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;; + "vignettes/Makefile") CONFIG_FILES="$CONFIG_FILES vignettes/Makefile" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac Modified: pkg/configure.in =================================================================== --- pkg/configure.in 2013-09-13 01:56:14 UTC (rev 534) +++ pkg/configure.in 2013-09-13 08:16:48 UTC (rev 535) @@ -142,6 +142,7 @@ ## now use all these AC_SUBST([PKG_CPPFLAGS],["${PKG_CPPFLAGS} ${CXXFLAGS} $protobuf_cxxflags"]) AC_SUBST([PKG_LIBS],["${PKG_LIBS} $rcpp_ldflags $protobuf_libs"]) -AC_CONFIG_FILES([src/Makevars]) +AC_SUBST([R_HOME],["${R_HOME}"]) +AC_CONFIG_FILES([src/Makevars vignettes/Makefile]) AC_OUTPUT echo "Completed configuration and ready to build." Deleted: pkg/vignettes/Makefile =================================================================== --- pkg/vignettes/Makefile 2013-09-13 01:56:14 UTC (rev 534) +++ pkg/vignettes/Makefile 2013-09-13 08:16:48 UTC (rev 535) @@ -1,38 +0,0 @@ - -## this is a 'fake' all as R-devel gets a race condition on RProtoBuf-intro and deletes the .tex file -all: RProtoBuf-unitTests.pdf RProtoBuf-quickref.pdf - -## 'real all' -pdfall: RProtoBuf-unitTests.pdf RProtoBuf-intro.pdf RProtoBuf-quickref.pdf - -pdfclean: - rm -fr *.pdf - -clean: - rm -f RProtoBuf-intro.aux RProtoBuf-intro.log RProtoBuf-intro.out - rm -f RProtoBuf-quickref.aux RProtoBuf-quickref.log RProtoBuf-quickref.out - rm -f RProtoBuf-unitTests.aux RProtoBuf-unitTests.log RProtoBuf-unitTests.out - rm -rf auto/ - -setvars: -ifeq (${R_HOME},) -R_HOME= $(shell R RHOME) -endif -RPROG= $(R_HOME)/bin/R -RSCRIPT=$(R_HOME)/bin/Rscript - -RProtoBuf-unitTests.pdf: unitTests/RProtoBuf-unitTests.R - $(RSCRIPT) --default-packages="RProtoBuf,Rcpp,brew,RUnit,tools,utils" unitTests/RProtoBuf-unitTests.R - -RProtoBuf-intro.pdf: RProtoBuf/RProtoBuf.Rnw - cp -f RProtoBuf/RProtoBuf.Rnw RProtoBuf-intro.Rnw - $(RSCRIPT) -e "require('highlight'); require('tools'); Sweave('RProtoBuf-intro.Rnw', driver=HighlightWeaveLatex()); texi2dvi('RProtoBuf-intro.tex', pdf=TRUE, clean=TRUE)" - cp -f RProtoBuf/RProtoBuf-fake.Rnw RProtoBuf-intro.Rnw - -RProtoBuf-quickref.pdf: RProtoBuf-quickref/RProtoBuf-quickref.Rnw - touch RProtoBuf-quickref.Rnw - rm RProtoBuf-quickref.Rnw - cp -f RProtoBuf-quickref/RProtoBuf-quickref.Rnw . - $(RSCRIPT) -e "require( 'highlight'); require('tools'); Sweave('RProtoBuf-quickref.Rnw', driver=HighlightWeaveLatex()); texi2dvi('RProtoBuf-quickref.tex', pdf=TRUE, clean=TRUE)" - cp -f RProtoBuf-quickref/RProtoBuf-quickref-fake.Rnw RProtoBuf-quickref.Rnw - Copied: pkg/vignettes/Makefile.in (from rev 534, pkg/vignettes/Makefile) =================================================================== --- pkg/vignettes/Makefile.in (rev 0) +++ pkg/vignettes/Makefile.in 2013-09-13 08:16:48 UTC (rev 535) @@ -0,0 +1,36 @@ + +## this is a 'fake' all as R-devel gets a race condition on RProtoBuf-intro and deletes the .tex file +all: RProtoBuf-unitTests.pdf RProtoBuf-quickref.pdf + +## 'real all' +pdfall: RProtoBuf-unitTests.pdf RProtoBuf-intro.pdf RProtoBuf-quickref.pdf + +pdfclean: + rm -fr *.pdf + +clean: + rm -f RProtoBuf-intro.aux RProtoBuf-intro.log RProtoBuf-intro.out + rm -f RProtoBuf-quickref.aux RProtoBuf-quickref.log RProtoBuf-quickref.out + rm -f RProtoBuf-unitTests.aux RProtoBuf-unitTests.log RProtoBuf-unitTests.out + rm -rf auto/ + +setvars: +R_HOME= @R_HOME@ +RPROG= $(R_HOME)/bin/R +RSCRIPT=$(R_HOME)/bin/Rscript + +RProtoBuf-unitTests.pdf: unitTests/RProtoBuf-unitTests.R + $(RSCRIPT) --default-packages="RProtoBuf,Rcpp,brew,RUnit,tools,utils" unitTests/RProtoBuf-unitTests.R + +RProtoBuf-intro.pdf: RProtoBuf/RProtoBuf.Rnw + cp -f RProtoBuf/RProtoBuf.Rnw RProtoBuf-intro.Rnw + $(RSCRIPT) -e "require('highlight'); require('tools'); Sweave('RProtoBuf-intro.Rnw', driver=HighlightWeaveLatex()); texi2dvi('RProtoBuf-intro.tex', pdf=TRUE, clean=TRUE)" + cp -f RProtoBuf/RProtoBuf-fake.Rnw RProtoBuf-intro.Rnw + +RProtoBuf-quickref.pdf: RProtoBuf-quickref/RProtoBuf-quickref.Rnw + touch RProtoBuf-quickref.Rnw + rm RProtoBuf-quickref.Rnw + cp -f RProtoBuf-quickref/RProtoBuf-quickref.Rnw . + $(RSCRIPT) -e "require( 'highlight'); require('tools'); Sweave('RProtoBuf-quickref.Rnw', driver=HighlightWeaveLatex()); texi2dvi('RProtoBuf-quickref.tex', pdf=TRUE, clean=TRUE)" + cp -f RProtoBuf-quickref/RProtoBuf-quickref-fake.Rnw RProtoBuf-quickref.Rnw + Property changes on: pkg/vignettes/Makefile.in ___________________________________________________________________ Added: svn:mergeinfo + From noreply at r-forge.r-project.org Fri Sep 13 19:55:39 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 13 Sep 2013 19:55:39 +0200 (CEST) Subject: [Rprotobuf-commits] r536 - pkg/vignettes/RProtoBuf-quickref Message-ID: <20130913175539.59BC0185DC4@r-forge.r-project.org> Author: murray Date: 2013-09-13 19:55:38 +0200 (Fri, 13 Sep 2013) New Revision: 536 Modified: pkg/vignettes/RProtoBuf-quickref/RProtoBuf-quickref.Rnw Log: Point sizes lower than 10pt are not accepted as an option by the doc class so the [8pt] was being ignored. Correct this to 10pt as is being used anyway. Modified: pkg/vignettes/RProtoBuf-quickref/RProtoBuf-quickref.Rnw =================================================================== --- pkg/vignettes/RProtoBuf-quickref/RProtoBuf-quickref.Rnw 2013-09-13 08:16:48 UTC (rev 535) +++ pkg/vignettes/RProtoBuf-quickref/RProtoBuf-quickref.Rnw 2013-09-13 17:55:38 UTC (rev 536) @@ -1,4 +1,4 @@ -\documentclass[8pt,twocolumn,a4paper]{article} +\documentclass[10pt,twocolumn,a4paper]{article} %\VignetteIndexEntry{RProtoBuf-quickref} \setlength{\hoffset}{-0.8in} From noreply at r-forge.r-project.org Sat Sep 14 01:37:13 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 14 Sep 2013 01:37:13 +0200 (CEST) Subject: [Rprotobuf-commits] r537 - in pkg: . inst Message-ID: <20130913233713.1748E1856C6@r-forge.r-project.org> Author: edd Date: 2013-09-14 01:37:12 +0200 (Sat, 14 Sep 2013) New Revision: 537 Modified: pkg/ChangeLog pkg/DESCRIPTION pkg/inst/NEWS.Rd Log: Release 0.3.1 Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-09-13 17:55:38 UTC (rev 536) +++ pkg/ChangeLog 2013-09-13 23:37:12 UTC (rev 537) @@ -1,3 +1,7 @@ +2013-09-13 Dirk Eddelbuettel + + * DESCRIPTION (Version): Release 0.3.1 + 2013-09-13 Murray Stokely * vignettes/Makefile.in: Update configure to output R_HOME to the @@ -34,7 +38,7 @@ * NAMESPACE: Import 'file_path_as_absolute' from package tools, and the two functions needed from the RCurl package - * R/*R: Updated several files which no longer need 'tools:::' prefix + * R/*R: Updated several files which no longer need 'tools:::' prefix * DESCRIPTION: Updated Depends: and Imports accordingly 2013-08-29 Murray Stokely Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2013-09-13 17:55:38 UTC (rev 536) +++ pkg/DESCRIPTION 2013-09-13 23:37:12 UTC (rev 537) @@ -1,5 +1,5 @@ Package: RProtoBuf -Version: 0.3.0.2 +Version: 0.3.1 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Murray Stokely Maintainer: Dirk Eddelbuettel @@ -9,7 +9,7 @@ of its internal RPC protocols and file formats. Depends: R (>= 2.11.0), methods LinkingTo: Rcpp -Suggests: RUnit, highlight +Suggests: RUnit, highlight, Rcpp Imports: utils, stats, tools, RCurl SystemRequirements: Protocol Buffer compiler (to create C++ header and source files from .proto descriptions) and library (version 2.2.0 or later) Modified: pkg/inst/NEWS.Rd =================================================================== --- pkg/inst/NEWS.Rd 2013-09-13 17:55:38 UTC (rev 536) +++ pkg/inst/NEWS.Rd 2013-09-13 23:37:12 UTC (rev 537) @@ -3,7 +3,7 @@ \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} % TODO(edd): Update date and version number. -\section{Changes in RProtoBuf version 0.3.1 (2013-09-XX)}{ +\section{Changes in RProtoBuf version 0.3.1 (2013-09-13)}{ \itemize{ \item Added support for setting and getting 64-bit integer types as character strings of decimal integers to work around R's lack of From noreply at r-forge.r-project.org Tue Sep 17 08:56:56 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 17 Sep 2013 08:56:56 +0200 (CEST) Subject: [Rprotobuf-commits] r538 - in pkg: . R inst/unitTests man src Message-ID: <20130917065657.0A50318469D@r-forge.r-project.org> Author: murray Date: 2013-09-17 08:56:56 +0200 (Tue, 17 Sep 2013) New Revision: 538 Modified: pkg/ChangeLog pkg/DESCRIPTION pkg/R/00classes.R pkg/inst/unitTests/runit.enums.R pkg/man/EnumValueDescriptor-class.Rd pkg/src/wrapper_EnumValueDescriptor.cpp Log: Improve EnumValueDescriptor support: * Add missing enum_type method and add it to '$' dispatch. * Add examples and document missing methods. * Add more unit tests. * Increment dev version to 0.3.1.1. Modified: pkg/ChangeLog =================================================================== --- pkg/ChangeLog 2013-09-13 23:37:12 UTC (rev 537) +++ pkg/ChangeLog 2013-09-17 06:56:56 UTC (rev 538) @@ -1,3 +1,14 @@ +2013-09-16 Murray Stokely + + * DESCRIPTION (Version): Increment to 0.3.1.1. + * R/00classes.R: Improve show method for EnumValueDescriptor and + add enum_type to '$' dispatch. + * man/EnumValueDescriptor-class.Rd: Add examples and document + missing methods. + * src/wrapper_EnumValueDescriptor.cpp (rprotobuf): Add missing + enum_type method. + * inst/unitTests/runit.enums.R (test.enums): Add more tests. + 2013-09-13 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.3.1 Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2013-09-13 23:37:12 UTC (rev 537) +++ pkg/DESCRIPTION 2013-09-17 06:56:56 UTC (rev 538) @@ -1,5 +1,5 @@ Package: RProtoBuf -Version: 0.3.1 +Version: 0.3.1.1 Date: $Date$ Author: Romain Francois, Dirk Eddelbuettel and Murray Stokely Maintainer: Dirk Eddelbuettel Modified: pkg/R/00classes.R =================================================================== --- pkg/R/00classes.R 2013-09-13 23:37:12 UTC (rev 537) +++ pkg/R/00classes.R 2013-09-17 06:56:56 UTC (rev 538) @@ -156,7 +156,7 @@ object at filename) ) } ) setMethod( "show", c( "EnumValueDescriptor" ), function(object){ - show( sprintf( "enum value descriptor" ) ) + show( sprintf( "enum value descriptor %s", object at full_name) ) } ) # }}} @@ -302,7 +302,8 @@ "asMessage" = function() asMessage(x), "name" = function(...) name(x, ... ), "number" = function() number(x), - invisible(NULL) + "enum_type" = function(...) enum_type( x, ...), + invisible(NULL) ) }) Modified: pkg/inst/unitTests/runit.enums.R =================================================================== --- pkg/inst/unitTests/runit.enums.R 2013-09-13 23:37:12 UTC (rev 537) +++ pkg/inst/unitTests/runit.enums.R 2013-09-17 06:56:56 UTC (rev 538) @@ -17,9 +17,26 @@ test.enums <- function() { ProtoFormat <- P("tutorial.Person") + # value(..) returns an EnumValueDescriptor object + checkEquals(name(value(ProtoFormat$PhoneType, index=1)), "MOBILE") + checkEquals(name(value(ProtoFormat$PhoneType, index=1), TRUE), + "tutorial.Person.MOBILE") + checkEquals(number(value(ProtoFormat$PhoneType, index=1)), 0) + checkTrue(inherits(enum_type(value(ProtoFormat$PhoneType, index=1)), + "EnumDescriptor")) + checkTrue(inherits(asMessage(value(ProtoFormat$PhoneType, index=1)), + "Message")) + + # Now check the '$' interfaces + checkEquals(name(value(ProtoFormat$PhoneType, index=1)), + value(ProtoFormat$PhoneType, index=1)$name()) + checkEquals(number(value(ProtoFormat$PhoneType, index=1)), + value(ProtoFormat$PhoneType, index=1)$number()) + checkEquals(name(value(ProtoFormat$PhoneType, index=2)), "HOME") + checkEquals(length(ProtoFormat$PhoneType), 3) checkTrue(has(ProtoFormat$PhoneType, "WORK")) checkTrue(!has(ProtoFormat$PhoneType, "NONEXISTANT")) Modified: pkg/man/EnumValueDescriptor-class.Rd =================================================================== --- pkg/man/EnumValueDescriptor-class.Rd 2013-09-13 23:37:12 UTC (rev 537) +++ pkg/man/EnumValueDescriptor-class.Rd 2013-09-17 06:56:56 UTC (rev 538) @@ -34,9 +34,10 @@ \item{toString}{\code{signature(x = "EnumValueDescriptor")}: same as \code{as.character} } \item{$}{\code{signature(x = "EnumValueDescriptor")}: invoke pseudo methods } + \item{name}{\code{signature(object = "EnumValueDescriptor", full = "logical")}: + return the name of this enum constant.} \item{number}{\code{signature(object = "EnumValueDescriptor")}: return the numeric value of this enum constant.} - % TODO(mstokely): This next one is broken. \item{enum_type}{\code{signature(object = "EnumDescriptor")} : retrieves the \linkS4class{EnumDescriptor} related to this value descriptor.} } @@ -44,4 +45,25 @@ \references{ The \code{EnumValueDescriptor} C++ class. \url{http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.descriptor.html#EnumValueDescriptor} } \author{ Romain Francois } +\examples{ +\dontrun{ +# example proto file supplied with this package +proto.file <- system.file( "proto", "addressbook.proto", package = "RProtoBuf" ) +# reading a proto file and creating the descriptor +Person <- P( "tutorial.Person", file = proto.file ) +} +\dontshow{Person <- P( "tutorial.Person" ) } +# enum type +Person$PhoneType + +# enum value type +value(Person$PhoneType, 1) + +name(value(Person$PhoneType, 1)) +name(value(Person$PhoneType, 1), TRUE) + +number(value(Person$PhoneType, number=1)) + +enum_type(value(Person$PhoneType, number=1)) +} \keyword{classes} Modified: pkg/src/wrapper_EnumValueDescriptor.cpp =================================================================== --- pkg/src/wrapper_EnumValueDescriptor.cpp 2013-09-13 23:37:12 UTC (rev 537) +++ pkg/src/wrapper_EnumValueDescriptor.cpp 2013-09-17 06:56:56 UTC (rev 538) @@ -43,6 +43,10 @@ return d->number() ; } +RPB_FUNCTION_1(S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr d ){ + return S4_EnumDescriptor( d->type()); +} + #undef METHOD } // namespace rprotobuf