X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FParseHelpers.dox;h=2ff88af1ddb457f56d0decd4b5871497d0991c13;hb=6745b9a3712f3221fe4b076ed7abb1ab92d6ac2b;hp=c0c79810d271e6bb2a561cccf61c1ce8be160955;hpb=734c0be097d831c8b6e1e797bae08262fc9b4dfe;p=senf.git diff --git a/Packets/ParseHelpers.dox b/Packets/ParseHelpers.dox index c0c7981..2ff88af 100644 --- a/Packets/ParseHelpers.dox +++ b/Packets/ParseHelpers.dox @@ -21,10 +21,25 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \page parsermacro_expand_example Example macro-expansion of packet parser helper macros - + + Debugging the packet parser makros is somwhat difficult since the makro expansion will place + everything in a single line. To help pin down problems, I use + +
+ $ g++ -DSENF_MPL_SLOT_NOEXPAND -o+ + I normally just cut-and-paste the \c g++ command from a normal build and add + -DSENF_MPL_SLOT_NOEXPAND. \c astyle is found at http://astyle.sourceforge.net/. If + needed, I then reissue this file (the precessed \.ii file) back to the compiler using the + original commandline (just replacing the \c .cc with \c .ii) to get error messages with + meaningful line numbers. + The following packet parser definition (taken from VariantParser.test.cc) has been subject to - macro-expansion (and a lot of reformatting) to show the inner workings of the packet parser - macros: + macro-expansion (and a lot of manual reformatting) to show the inner workings of the packet + parser macros: \code struct TestParser : public senf::PacketParserBase { @@ -92,7 +107,7 @@ } public: - size_type type_offset () const + size_type type_offset() const { return field_offset_(static_cast.ii -E -DSENF_DEBUG -Iinclude .cc + $ sed -i -e 's/}/}\\n/g' -e '/^#.*$/d' .ii + $ astyle --style=linux -b .ii +