[pygccxml-commit] SF.net SVN: pygccxml: [782] pyplusplus_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-12-06 10:24:41
|
Revision: 782 http://svn.sourceforge.net/pygccxml/?rev=782&view=rev Author: roman_yakovenko Date: 2006-12-06 02:24:40 -0800 (Wed, 06 Dec 2006) Log Message: ----------- updating documentation + small convenience function to disable warnings Modified Paths: -------------- pyplusplus_dev/docs/documentation/feedback.rest pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py pyplusplus_dev/pyplusplus/messages/__init__.py Property Changed: ---------------- pyplusplus_dev/pyplusplus/messages/ Modified: pyplusplus_dev/docs/documentation/feedback.rest =================================================================== --- pyplusplus_dev/docs/documentation/feedback.rest 2006-12-06 10:17:51 UTC (rev 781) +++ pyplusplus_dev/docs/documentation/feedback.rest 2006-12-06 10:24:40 UTC (rev 782) @@ -40,20 +40,34 @@ * .. code-block:: C++ - struct window{ - ... - void get_size( int& heght, int& widht ) const; - }; + struct window{ + ... + void get_size( int& heght, int& widht ) const; + }; Member function ``get_size`` can be exposed to Python, but it will not be callable because [FILL IN HERE]. * In order to expose free/member function that takes more than 10 arguments user should define ``BOOST_PYTHON_MAX_ARITY`` macro. - + +* + .. code-block:: C++ + + struct X{ + ... + }; + + void do_smth( X x ); + + If you expose ``do_smth`` function and don't expose struct ``X``, `Py++`_ + will tell you that struct ``X`` is used in exported declaration, but was not + exposed. + For these problems and many other `Py++`_ gives a nice explanation and sometimes a link to the relevant information on the Internet. -I hope, that from now you will find it helpful to read every `Py++`_ message :-). +I don't know what about you, but I found these messages pretty useful. They allow +me to deliver Python bindings with higher quality. ------------- How it works? @@ -68,10 +82,54 @@ default, messages with ``DEBUG`` level will be skipped, all other messages will be reported. +-------- +Warnings +-------- + +Example of the warning: +:: + + WARNING: containers::item_t [struct] + > warning W1020: Py++ will generate class wrapper - hand written code + > should be added to the wrapper class + +Almost every warning reported by `Py++`_ consists from 3 parts: + +* description of the declaration it refers to: "containers::item_t [struct]" + +* warning unique identifier: "W1020" + +* short explanation of the problem: "Py++ will generate class wrapper - hand + written code should be added to the wrapper class" + --------------- API Description --------------- +How to disable warning(s)? +-------------------------- + +Every warning has unique identifier. In the example I gave it was ``W1020``. + +.. code-block:: Python + + from pyplusplus import messages + from pyplusplus import module_builder + + mb = module_builder.module_builder_t( ... ) + xyz = mb.class_( XYZ ) + xyz.disable_warnings( messages.W1020 ) + +It is also possible to disable warnings for all declarations. ``pyplusplus.messages`` +package defines ``DISABLE_MESSAGES`` variable. This variable( ``list`` ) keeps +all warnings, which should not be reported. Use ``messages.disable`` function to +edit it: + +.. code-block:: Python + + messages.disable( messages.W1020 ) + + Logging API ----------- Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-12-06 10:17:51 UTC (rev 781) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-12-06 10:24:40 UTC (rev 782) @@ -153,7 +153,8 @@ return False type_no_ref = declarations.remove_reference( type_ ) return not declarations.is_const( type_no_ref ) \ - and python_traits.is_immutable( type_no_ref ) + and ( declarations.is_fundamental( type_no_ref ) + or declarations.is_enum( type_no_ref ) ) msgs = [] #TODO: functions that takes as argument pointer to pointer to smth, could not be exported #see http://www.boost.org/libs/python/doc/v2/faq.html#funcptr Property changes on: pyplusplus_dev/pyplusplus/messages ___________________________________________________________________ Name: svn:ignore + *.pyc Modified: pyplusplus_dev/pyplusplus/messages/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/messages/__init__.py 2006-12-06 10:17:51 UTC (rev 781) +++ pyplusplus_dev/pyplusplus/messages/__init__.py 2006-12-06 10:24:40 UTC (rev 782) @@ -23,6 +23,8 @@ ] #Messages kept by DISABLE_MESSAGES list will not be reported +def disable( *args ): + DISABLE_MESSAGES.extend( args ) def filter_disabled_msgs( msgs, disable_messages=None ): report = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |