[request] Sun and IBM users...

Can someone test the following preprocessor code on the Sun and IBM preprocessors: #include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp> #define IS_NULLARY(x) \ BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() 0) \ /**/ #define IS_NULLARY_C() \ ~, 1 BOOST_PP_RPAREN() \ BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \ /**/ IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0 #define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) () IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0 Regards and thanks, Paul Mensonides

Paul Mensonides wrote:
Can someone test the following preprocessor code on the Sun and IBM preprocessors:
On IBM this results in following error msg: "pp.cpp", line 14.1: 1540-0063 (S) The text "1" is unexpected. (my file was called pp.cpp). Hope this info is still usefull regardless of the high latency of my answer.
#include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp>
#define IS_NULLARY(x) \ BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() 0) \ /**/ #define IS_NULLARY_C() \ ~, 1 BOOST_PP_RPAREN() \ BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \ /**/
IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0
#define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) ()
IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0
Regards and thanks, Paul Mensonides
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Toon Knapen wrote:
On IBM this results in following error msg:
"pp.cpp", line 14.1: 1540-0063 (S) The text "1" is unexpected.
I think that Paul was after the preprocessed text. But, if that's not possible, can you try the following? thanks, Daniel #include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp> #include <boost/static_assert.hpp> #define IS_NULLARY(x) \ BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() 0) \ /**/ #define IS_NULLARY_C() \ ~, 1 BOOST_PP_RPAREN() \ BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \ /**/ BOOST_STATIC_ASSERT(IS_NULLARY(())); BOOST_STATIC_ASSERT(IS_NULLARY(()abc)); BOOST_STATIC_ASSERT(!IS_NULLARY(+)); BOOST_STATIC_ASSERT(!IS_NULLARY(xyz)); #define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) () BOOST_STATIC_ASSERT(IS_UNARY((a))); BOOST_STATIC_ASSERT(IS_UNARY((a)abc)); BOOST_STATIC_ASSERT(!IS_UNARY(+)); BOOST_STATIC_ASSERT(!IS_UNARY(xyz));

Daniel James wrote:
Toon Knapen wrote:
On IBM this results in following error msg:
"pp.cpp", line 14.1: 1540-0063 (S) The text "1" is unexpected.
I think that Paul was after the preprocessed text.
Oops sorry. Here it is. But, if that's not possible, can you try the following? Do you still want me to run following program ?
thanks,
Daniel
#include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp> #include <boost/static_assert.hpp>
#define IS_NULLARY(x) \ BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() 0) \ /**/ #define IS_NULLARY_C() \ ~, 1 BOOST_PP_RPAREN() \ BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \ /**/
BOOST_STATIC_ASSERT(IS_NULLARY(())); BOOST_STATIC_ASSERT(IS_NULLARY(()abc)); BOOST_STATIC_ASSERT(!IS_NULLARY(+)); BOOST_STATIC_ASSERT(!IS_NULLARY(xyz));
#define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) ()
BOOST_STATIC_ASSERT(IS_UNARY((a))); BOOST_STATIC_ASSERT(IS_UNARY((a)abc)); BOOST_STATIC_ASSERT(!IS_UNARY(+)); BOOST_STATIC_ASSERT(!IS_UNARY(xyz));
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
#line 14 "pp.cpp" 1 BOOST_PP_TUPLE_EAT_2 ( ~ , 0) 1 BOOST_PP_TUPLE_EAT_2 ( ~abc , 0) 0 0 #line 22 1 BOOST_PP_TUPLE_EAT_2 ( ~ , 0) 1 BOOST_PP_TUPLE_EAT_2 ( ~abc , 0) 0 0

Toon Knapen wrote:
Oops sorry. Here it is.
Do you still want me to run following program ?
No, thanks for the preprocessor output. That's what's really needed.
#line 14 "pp.cpp" 1 BOOST_PP_TUPLE_EAT_2 ( ~ , 0) 1 BOOST_PP_TUPLE_EAT_2 ( ~abc , 0) 0 0 #line 22 1 BOOST_PP_TUPLE_EAT_2 ( ~ , 0) 1 BOOST_PP_TUPLE_EAT_2 ( ~abc , 0) 0 0
Well, it's almost worked, but those BOOST_PP_TUPLE_EAT_2's should expand to nothing. I guess it needs another expansion. The following might work. Please can you try it out? In practice these macros will only get called from the other boost macros which might cause these macros to expand fully? Paul will understand this a lot better than me. #include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp> #define IS_NULLARY(x) \ IS_NULLARY_2(BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() 0)) \ /**/ #define IS_NULLARY_2(x) x #define IS_NULLARY_C() \ ~, 1 BOOST_PP_RPAREN() \ BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \ /**/ IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0 #define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) () IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0

Daniel James wrote:
Well, it's almost worked, but those BOOST_PP_TUPLE_EAT_2's should expand to nothing. I guess it needs another expansion. The following might work. Please can you try it out?
results in attachment.
In practice these macros will only get called from the other boost macros which might cause these macros to expand fully? Paul will understand this a lot better than me.
#include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp>
#define IS_NULLARY(x) \ IS_NULLARY_2(BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() 0)) \ /**/ #define IS_NULLARY_2(x) x #define IS_NULLARY_C() \ ~, 1 BOOST_PP_RPAREN() \ BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \ /**/
IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0
#define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) ()
IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
#line 15 "pp.cpp" 1 BOOST_PP_TUPLE_EAT_2 ( ~ , 0) 1 BOOST_PP_TUPLE_EAT_2 ( ~abc , 0) 0 0 #line 23 1 BOOST_PP_TUPLE_EAT_2 ( ~ , 0) 1 BOOST_PP_TUPLE_EAT_2 ( ~abc , 0) 0 0

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Toon Knapen
results in attachment.
Thanks Toon. Can you try this one? It is the original example with TUPLE_EAT(2) replaced by TUPLE_EAT_2. //// #include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp> #define IS_NULLARY(x) \ BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() 0) \ /**/ #define IS_NULLARY_C() \ ~, 1 BOOST_PP_RPAREN() \ BOOST_PP_TUPLE_EAT_2 BOOST_PP_LPAREN() ~ \ /**/ IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0 #define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) () IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0 //// Regards, Paul Mensonides

Paul Mensonides wrote:
Thanks Toon. Can you try this one? It is the original example with TUPLE_EAT(2) replaced by TUPLE_EAT_2.
et voila, see attachment
////
#include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp>
#define IS_NULLARY(x) \ BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() 0) \ /**/ #define IS_NULLARY_C() \ ~, 1 BOOST_PP_RPAREN() \ BOOST_PP_TUPLE_EAT_2 BOOST_PP_LPAREN() ~ \ /**/
IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0
#define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) ()
IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0
////
Regards, Paul Mensonides
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
#line 14 "pp.cpp" 1 BOOST_PP_TUPLE_EAT_2 ( ~ , 0) 1 BOOST_PP_TUPLE_EAT_2 ( ~abc , 0) 0 0 #line 22 1 BOOST_PP_TUPLE_EAT_2 ( ~ , 0) 1 BOOST_PP_TUPLE_EAT_2 ( ~abc , 0) 0 0

Sorry about all these tests and thanks for your patience. Here's another one which uses a slightly different method that I think should will better: #include <boost/preprocessor/seq/seq.hpp> #include <boost/preprocessor/detail/split.hpp> #include <boost/preprocessor/punctuation/comma.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #include <boost/preprocessor/tuple/eat.hpp> #define IS_NULLARY_IMPL(x) \ BOOST_PP_SPLIT(1, IS_NULLARY_C x BOOST_PP_COMMA() (0)) \ /**/ #define IS_NULLARY_C() \ ~, (1) BOOST_PP_RPAREN() BOOST_PP_LPAREN() ~ \ /**/ #define IS_NULLARY(x) BOOST_PP_SEQ_HEAD(IS_NULLARY_IMPL(x)) IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0 #define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) () IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0

Daniel James wrote:
Sorry about all these tests and thanks for your patience. Here's another one which uses a slightly different method that I think should will better:
Actually, can you also preprocess this test? I really think this one will work. Which probably means it won't. #include <boost/preprocessor/seq/elem.hpp> #include <boost/preprocessor/punctuation/paren.hpp> #define IS_NULLARY(x) BOOST_PP_SEQ_ELEM(1, (IS_NULLARY_C x)(0)) #define IS_NULLARY_C() ~ BOOST_PP_RPAREN() (1) BOOST_PP_LPAREN() ~ IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0 #define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) () IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Daniel James
Actually, can you also preprocess this test? I really think this one will work. Which probably means it won't.
I don't think it would be all that hard to make the straightforward original version work with a few workarounds. The main problem is that we need a single implementation that works on Borland, IBM, and Sun because they all use the same configuration of the pp-lib. Otherwise, I have to separate them into distinct configurations, which is a semi-significant refactor because other things would happen at the same time. That's fine, but at the moment other things are higher on the priority list. Regards, Paul Mensonides

Daniel James wrote:
Daniel James wrote:
Sorry about all these tests and thanks for your patience. Here's another one which uses a slightly different method that I think should will better:
Actually, can you also preprocess this test? I really think this one will work. Which probably means it won't.
#include <boost/preprocessor/seq/elem.hpp> #include <boost/preprocessor/punctuation/paren.hpp>
#define IS_NULLARY(x) BOOST_PP_SEQ_ELEM(1, (IS_NULLARY_C x)(0)) #define IS_NULLARY_C() ~ BOOST_PP_RPAREN() (1) BOOST_PP_LPAREN() ~
IS_NULLARY(()) // 1 IS_NULLARY(()abc) // 1 IS_NULLARY(+) // 0 IS_NULLARY(xyz) // 0
#define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x) #define IS_UNARY_C(a) ()
IS_UNARY((a)) // 1 IS_UNARY((a)abc) // 1 IS_UNARY(+) // 0 IS_UNARY(xyz) // 0
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
"pp.cpp", line 7.1: 1506-041 (E) The invocation of macro BOOST_PP_SEQ_ELEM_III contains fewer arguments than required by the macro definition. "pp.cpp", line 8.1: 1506-041 (E) The invocation of macro BOOST_PP_SEQ_ELEM_III contains fewer arguments than required by the macro definition. #line 7 "pp.cpp" 1, BOOST_PP_NIL ( ~)(0) 1, BOOST_PP_NIL ( ~abc)(0) 0 0 #line 15 0 0 0 0 "pp.cpp", line 7.1: 1540-0861 (S) Too few arguments are specified for macro "BOOST_PP_SEQ_ELEM_III". Empty arguments are used. "/home/tk/cvstop/boost/boost/preprocessor/seq/elem.hpp", line 39.13: 1540-0425 (I) "BOOST_PP_SEQ_ELEM_III" is defined on line 39 of "pp.cpp". "pp.cpp", line 8.1: 1540-0861 (S) Too few arguments are specified for macro "BOOST_PP_SEQ_ELEM_III". Empty arguments are used. "/home/tk/cvstop/boost/boost/preprocessor/seq/elem.hpp", line 39.13: 1540-0425 (I) "BOOST_PP_SEQ_ELEM_III" is defined on line 39 of "pp.cpp".

Thanks Toon. I've got a rough idea how to get that version to work, but Paul prefer's the original version, so I won't waste your time - it would probably take a number of attempts. Daniel
participants (3)
-
Daniel James
-
Paul Mensonides
-
Toon Knapen