Classes | Namespaces | Defines | Functions

plugin.h File Reference

#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include <glib.h>
#include <string>
#include <map>
#include <vector>
#include <boost/format.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include "pluginbase.h"
#include "pluginScriptObject.h"
Include dependency graph for plugin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gnash::nsPluginInstance

Namespaces

namespace  gnash
 

Anonymous namespace for callbacks, local functions, event handlers etc.


Defines

#define dummystr(x)   # x
#define dummyestr(x)   dummystr(x)
#define __FUNCTION__   __FILE__":"dummyestr(__LINE__)
#define __PRETTY_FUNCTION__   __FUNCTION__
#define GNASH_PLUGIN_DEBUG   1
#define TOKENIZE_FORMAT(z, n, t)   % t##n
#define TOKENIZE_ARGS(z, n, t)   BOOST_PP_COMMA_IF(n) const T##n& t##n
#define LOG_TYPES   (error) (debug) (trace)
#define ARG_NUMBER   4
#define LOG_TEMPLATES(z, n, data)
#define GENERATE_LOG_TYPES(r, _, t)   BOOST_PP_REPEAT(ARG_NUMBER, LOG_TEMPLATES, t)

Functions

void gnash::processLog_error (const boost::format &fmt)
void gnash::processLog_debug (const boost::format &fmt)
void gnash::processLog_trace (const boost::format &fmt)

Define Documentation

#define __FUNCTION__   __FILE__":"dummyestr(__LINE__)
#define __PRETTY_FUNCTION__   __FUNCTION__
#define ARG_NUMBER   4

The preprocessor generates templates with 1..ARG_NUMBER arguments.

#define dummyestr (   x  )     dummystr(x)
#define dummystr (   x  )     # x
#define GENERATE_LOG_TYPES (   r,
  _,
  t 
)    BOOST_PP_REPEAT(ARG_NUMBER, LOG_TEMPLATES, t)

Calls the macro LOG_TEMPLATES an ARG_NUMBER number of times, each time adding an extra typename argument to the template.

#define GNASH_PLUGIN_DEBUG   1
#define LOG_TEMPLATES (   z,
  n,
  data 
)
Value:
template<BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), typename T)>\
inline void log_##data(BOOST_PP_REPEAT(BOOST_PP_INC(n), TOKENIZE_ARGS, t)) \
{\
   if (GNASH_PLUGIN_DEBUG < 1) return; \
    boost::format f(t0);           \
    using namespace boost::io; \
    f.exceptions(all_error_bits ^ (too_many_args_bit | \
                                   too_few_args_bit | \
                                   bad_format_string_bit)); \
    processLog_##data(f BOOST_PP_REPEAT_FROM_TO(1, \
            BOOST_PP_INC(n), \
            TOKENIZE_FORMAT, t));\
}
#define LOG_TYPES   (error) (debug) (trace)

This is a sequence of different log message types to be used in the code. Append the name to log_ to call the function, e.g. log_error, log_unimpl.

#define TOKENIZE_ARGS (   z,
  n,
  t 
)    BOOST_PP_COMMA_IF(n) const T##n& t##n

Macro to add a number of arguments to the templated function corresponding to the number of template arguments. Produces code like this: "const T0& t0, const T1& t1, const T2& t2 ..."

#define TOKENIZE_FORMAT (   z,
  n,
  t 
)    % t##n

This heap of steaming preprocessor code magically converts printf-style statements into boost::format messages using templates. Macro to feed boost::format strings to the boost::format object, producing code like this: "% t1 % t2 % t3 ..."