Classes | Namespaces | Defines | Functions

log.h File Reference

#include "rc.h"
#include "dsodefs.h"
#include <fstream>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/format.hpp>
#include "gettext.h"
#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 "rc.h"
#include "gettext.h"

Go to the source code of this file.

Classes

class  gnash::LogFile
class  gnash::__Host_Function_Report__

Namespaces

namespace  gnash
 

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


Defines

#define DEFAULT_LOGFILE   "gnash-dbg.log"
#define _(String)   gettext (String)
#define N_(String)   gettext_noop (String)
#define LOG_ONCE(x)
#define __FUNCDNAME__   __FUNCTION__
#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
#define LOG_TEMPLATES(z, n, data)
#define ARG_NUMBER   10
 Defines the maximum number of template arguments.
#define GENERATE_LOG_TYPES(r, _, t)   BOOST_PP_REPEAT(ARG_NUMBER, LOG_TEMPLATES, t)
#define VERBOSE_PARSE   1
#define VERBOSE_ACTION   1
#define VERBOSE_ASCODING_ERRORS   1
#define VERBOSE_MALFORMED_SWF   1
#define VERBOSE_MALFORMED_AMF   1
#define VERBOSE_NETWORKING   1
#define IF_VERBOSE_PARSE(x)   do { if ( LogFile::getDefaultInstance().getParserDump() ) { x; } } while (0);
#define IF_VERBOSE_ACTION(x)   do { if ( LogFile::getDefaultInstance().getActionDump() ) { x; } } while (0);
#define IF_VERBOSE_NETWORK(x)   do { if ( LogFile::getDefaultInstance().getNetwork() ) { x; } } while (0);
#define IF_VERBOSE_ASCODING_ERRORS(x)   { if ( gnash::RcInitFile::getDefaultInstance().showASCodingErrors() ) { x; } }
#define IF_VERBOSE_MALFORMED_SWF(x)   { if ( gnash::RcInitFile::getDefaultInstance().showMalformedSWFErrors() ) { x; } }
#define IF_VERBOSE_MALFORMED_AMF(x)   { if ( gnash::RcInitFile::getDefaultInstance().showMalformedAMFErrors() ) { x; } }
#define dummystr(x)   # x
#define dummyestr(x)   dummystr(x)
#define __FUNCTION__   __FILE__":"dummyestr(__LINE__)
#define __PRETTY_FUNCTION__   __FUNCTION__
#define GNASH_REPORT_FUNCTION   gnash::log_debug("entering")
#define GNASH_REPORT_RETURN   gnash::log_debug("returning")

Functions

void gnash::processLog_network (const boost::format &fmt)
void gnash::processLog_error (const boost::format &fmt)
void gnash::processLog_unimpl (const boost::format &fmt)
void gnash::processLog_trace (const boost::format &fmt)
void gnash::processLog_debug (const boost::format &fmt)
void gnash::processLog_action (const boost::format &fmt)
void gnash::processLog_parse (const boost::format &fmt)
void gnash::processLog_security (const boost::format &fmt)
void gnash::processLog_swferror (const boost::format &fmt)
void gnash::processLog_amferror (const boost::format &fmt)
void gnash::processLog_aserror (const boost::format &fmt)
void gnash::processLog_abc (const boost::format &fmt)
std::string gnash::hexify (const unsigned char *bytes, size_t length, bool ascii)
 Convert a sequence of bytes to hex or ascii format.

Define Documentation

#define _ (   String  )     gettext (String)

Referenced by gnash::sprite_definition::add_font(), gnash::SWFMovieDefinition::add_sound_sample(), gnash::sprite_definition::addBitmap(), gnash::GC::addCollectable(), gnash::MovieClip::addDisplayListObject(), gnash::ActionExec::adjustNextPC(), admin_handler(), gnash::Gui::advanceMovie(), gnash::URLAccessManager::allow(), gnash::TouchDevice::apply_ts_calibration(), gnash::media::ffmpeg::AudioDecoderFfmpeg::AudioDecoderFfmpeg(), gnash::media::AudioDecoderSimple::AudioDecoderSimple(), gnash::media::AudioDecoderSpeex::AudioDecoderSpeex(), gnash::sound::AOS4_sound_handler::audioTask(), gnash::GtkAggVaapiGlue::beforeRendering(), gnash::DisplayObject::blendMode(), gnash::SWF::ButtonAction::ButtonAction(), gnash::movie_root::callExternalCallback(), gnash::MouseDevice::check(), gnash::media::gst::GstUtil::check_missing_plugins(), gnash::RTMPClient::clientFinish(), gnash::SWFStream::close_tag(), gnash::Network::closeNet(), gnash::MouseDevice::command(), gnash::SWFMovieDefinition::completeLoad(), gnash::NetConnection_as::connect(), gnash::Socket::connected(), connection_handler(), gnash::media::gst::VideoConverterGst::convert(), gnash::convert_double_wacky(), gnash::create_Renderer_agg(), gnash::media::MediaHandler::createMediaParser(), gnash::GtkGui::createMenu(), gnash::SdlAggGlue::createRenderHandler(), gnash::RiscosAggGlue::createRenderHandler(), gnash::HaikuAggGlue::createRenderHandler(), gnash::GtkAggGlue::createRenderHandler(), gnash::FltkAggGlue::createRenderHandler(), gnash::AOS4CairoGlue::createRenderHandler(), gnash::AOS4AggGlue::createRenderHandler(), gnash::Network::createServer(), gnash::media::gst::MediaHandlerGst::createVideoConverter(), gnash::Kde4Gui::createWindow(), gnash::media::ffmpeg::AudioDecoderFfmpeg::decode(), gnash::RTMP::decodeHeader(), gnash::SWF::define_bits_jpeg2_loader(), gnash::SWF::define_bits_jpeg3_loader(), gnash::SWF::define_bits_jpeg_loader(), gnash::SWF::define_bits_lossless_2_loader(), gnash::SWF::define_sound_loader(), gnash::MovieClip::display(), gnash::Statistics::dump(), gnash::SSLServer::dump(), gnash::SSLClient::dump(), gnash::SSHServer::dump(), gnash::SSHClient::dump(), gnash::HTTP::dump(), gnash::DisplayList::dump(), dump_ctrl(), dump_shm(), gnash::GtkGui::error(), gnash::SWF::SWFHandlers::execute(), gnash::MovieClip::execute_action(), gnash::SWF::file_attributes_loader(), gnash::abc::Trait::finalize(), gnash::image::JpegInput::finishImage(), gnash::JpegImageInput::finishImage(), gnash::SWF::fixme_loader(), cygnal::HTTPServer::formatGetReply(), cygnal::SOL::formatHeader(), cygnal::HTTPServer::formatPostReply(), gnash::SWF::frame_label_loader(), gnash::GC::fuzzyCollect(), gnash::media::gst::GstUtil::get_audiosink_element(), gnash::MovieClip::getBounds(), gnash::CharacterDictionary::getDisplayObject(), gnash::SharedLib::getDllSymbol(), gnash::SharedLib::getInitEntry(), cygnal::demoService::getListOfAvailableFiles(), gnash::SharedObjectLibrary::getLocal(), clocktime::getTimeZoneOffset(), gnash_main(), gnash::RTMP::headerSize(), gnash::Gui::hideMenu(), gnash::SWFMovieDefinition::importResources(), gnash::movie_definition::importResources(), gnash::media::gst::VideoConverterGst::init(), gnash::MouseDevice::init(), gnash::Kde4Gui::init(), gnash::HaikuGui::init(), gnash::GtkGlExtGlue::init(), gnash::GtkAggVaapiGlue::init(), gnash::FBGui::init(), gnash::AOS4Gui::init(), cygnal::Handler::initModule(), gnash::Extension::initModule(), gnash::Extension::initModuleWithFunc(), gnash::XMLNode_as::insertBefore(), gnash::isLevelTarget(), gnash::SWF::jpeg_tables_loader(), gnash::key_is_down(), gnash::XMLNode_as::lastChild(), gnash::SWF::VideoFrameTag::loader(), gnash::SWF::StreamSoundBlockTag::loader(), gnash::SWF::StartSound2Tag::loader(), gnash::SWF::StartSoundTag::loader(), gnash::SWF::RemoveObjectTag::loader(), gnash::SWF::DoInitActionTag::loader(), gnash::SWF::DoActionTag::loader(), gnash::SWF::DoABCTag::loader(), gnash::SWF::DefineText2Tag::loader(), gnash::SWF::DefineTextTag::loader(), gnash::SWF::DefineShapeTag::loader(), gnash::SWF::DefineFontInfoTag::loader(), gnash::SWF::DefineFontNameTag::loader(), gnash::SWF::DefineFontAlignZonesTag::loader(), gnash::SWF::DefineButton2Tag::loader(), gnash::SWF::DefineButtonTag::loader(), gnash::SWF::DefineButtonSoundTag::loader(), gnash::SWF::DefineButtonCxformTag::loader(), gnash::RcInitFile::loadFiles(), gnash::DiskStream::loadToMem(), main(), gnash::MovieFactory::makeMovie(), gnash::NetworkAdapter::makeStream(), gnash::GcResource::markReachableResources(), gnash::media::gst::MediaParserGst::MediaParserGst(), gnash::SWF::metadata_loader(), gnash::Button::mouseEvent(), gnash::DisplayList::moveDisplayObject(), gnash::MovieTester::MovieTester(), gnash::Network::Network(), gnash::newAdd(), gnash::Network::newConnection(), gnash::Gui::notifyMouseMove(), gnash::SWFStream::open_tag(), gnash::SharedLib::openLib(), gnash::ActionExec::operator()(), gnash::action_buffer::operator[](), cygnal::RTMPServer::packetRead(), gnash::RcInitFile::parseFile(), cygnal::CRcInitFile::parseFile(), gnash::media::gst::MediaParserGst::parseNextChunk(), cygnal::OflaDemoTest::parseOflaDemoRequest(), gnash::XML_as::parseXML(), gnash::sound::Mkit_sound_handler::pause(), gnash::sound::AOS4_sound_handler::pause(), gnash::NetStream_as::play(), gnash::SdlAggGlue::prepDrawingArea(), gnash::HaikuAggGlue::prepDrawingArea(), gnash::AOS4CairoGlue::prepDrawingArea(), gnash::AOS4AggGlue::prepDrawingArea(), gnash::action_buffer::process_decl_dict(), cygnal::RTMPServer::processClientHandShake(), gnash::media::gst::VideoDecoderGst::push(), gnash::VM::pushCallFrame(), gnash::qwidget::qwidget(), gnash::SWF::TextRecord::read(), gnash::SWFParser::read(), gnash::SWF::ShapeRecord::read(), gnash::image::JpegInput::read(), gnash::JpegImageInput::read(), gnash::DropShadowFilter::read(), gnash::SWF::ButtonRecord::read(), gnash::action_buffer::read(), gnash::SWFMovieDefinition::read_all_swf(), gnash::SWFStream::read_d64(), gnash::action_buffer::read_int16(), gnash::action_buffer::read_int32(), gnash::SWFStream::read_long_float(), gnash::action_buffer::read_string(), gnash::SWFStream::read_u16(), gnash::SWFStream::read_u32(), gnash::SWF::DefineFontTag::readCodeTable(), gnash::SWFMovieDefinition::readHeader(), gnash::image::JpegInput::readHeader(), gnash::JpegImageInput::readHeader(), gnash::Network::readNet(), gnash::SWF::reflex_loader(), gnash::TextField::removeTextField(), gnash::GtkAggVaapiGlue::render(), gnash::Renderer::renderToImage(), gnash::movie_root::reset(), gnash::Kde4AggGlue::resize(), gnash::Gui::resizeWindow(), cygnal::rtmp_handler(), gnash::Player::run(), gnash::AOS4Gui::run(), gnash::Extension::scanAndLoad(), gnash::Extension::scanDir(), gnash::SWFStream::seek(), gnash::media::ffmpeg::MediaParserFfmpeg::seek(), gnash::SWFMovieDefinition::set_jpeg_loader(), gnash::Gui::setFullscreen(), gnash::setHeight(), gnash::CallFrame::setLocalRegister(), gnash::GcResource::setReachable(), gnash::VM::setRegister(), gnash::PropertyList::setValue(), gnash::SharedLib::SharedLib(), gnash::Gui::showMenu(), gnash::FBGui::showMenu(), gnash::Gui::showMouse(), gnash::FBGui::showMouse(), gnash::ActionExec::skip_actions(), gnash::SWF::sound_stream_head_loader(), gnash::SWF::sprite_loader(), gnash::SSLServer::sslAccept(), gnash::as_value::to_number(), gnash::sound::Mkit_sound_handler::unpause(), gnash::sound::AOS4_sound_handler::unpause(), gnash::Gui::unsetFullscreen(), gnash::RcInitFile::updateFile(), gnash::NetConnection_as::validateURL(), gnash::Video::Video(), gnash::media::ffmpeg::VideoConverterFfmpeg::VideoConverterFfmpeg(), gnash::media::gst::VideoConverterGst::VideoConverterGst(), gnash::media::ffmpeg::VideoDecoderFfmpeg::VideoDecoderFfmpeg(), gnash::media::gst::VideoDecoderGst::VideoDecoderGst(), cygnal::vm_main(), gnash::Network::waitForNetData(), gnash::as_value::writeAMF0(), gnash::amf::Writer::writeData(), gnash::image::Output::writeImageRGBA(), gnash::ImageOutput::writeImageRGBA(), gnash::Network::writeNet(), gnash::amf::Writer::writeNull(), gnash::media::AudioDecoderSimple::~AudioDecoderSimple(), gnash::media::AudioDecoderSpeex::~AudioDecoderSpeex(), and gnash::FBGui::~FBGui().

#define __FUNCDNAME__   __FUNCTION__
#define __FUNCTION__   __FILE__":"dummyestr(__LINE__)
#define __PRETTY_FUNCTION__   __FUNCTION__

Referenced by gnash::Network::addPollFD(), gnash::GnashPluginScriptObject::Construct(), gnash::GnashPluginScriptObject::createPipe(), gnash::RTMP::decodeAudioData(), gnash::RTMP::decodeBytesRead(), gnash::RTMP::decodeChunkSize(), gnash::RTMP::decodeClient(), gnash::RTMP::decodeInvoke(), gnash::RTMP::decodeNotify(), gnash::RTMP::decodeServer(), gnash::RTMP::decodeSharedObj(), gnash::RTMP::decodeVideoData(), gnash::RTMP::encodeAudioData(), gnash::RTMP::encodeBytesRead(), gnash::RTMP::encodeClient(), gnash::RTMP::encodeInvoke(), gnash::RTMP::encodeNotify(), gnash::RTMP::encodeServer(), gnash::RTMP::encodeSharedObj(), gnash::RTMP::encodeVideoData(), gnash::GnashPluginScriptObject::Enumerate(), gnash::Network::erasePollFD(), gnash::GetVariableCallback(), gnash::GotoFrame(), gnash::GnashPluginScriptObject::handleInvoke(), gnash::nsPluginInstance::init(), gnash::GnashPluginScriptObject::InvokeDefault(), gnash::IsPlaying(), gnash::GnashPluginScriptObject::marshalConstruct(), gnash::GnashPluginScriptObject::marshalEnumerate(), NPN_Construct(), NPN_CreateObject(), NPN_DestroyStream(), NPN_Enumerate(), NPN_Evaluate(), NPN_GetIntIdentifier(), NPN_GetProperty(), NPN_GetStringIdentifier(), NPN_GetStringIdentifiers(), NPN_GetURL(), NPN_GetURLNotify(), NPN_HasMethod(), NPN_HasProperty(), NPN_IdentifierIsString(), NPN_IntFromIdentifier(), NPN_InvalidateRect(), NPN_InvalidateRegion(), NPN_Invoke(), NPN_InvokeDefault(), NPN_NewStream(), NPN_PluginThreadAsyncCall(), NPN_PostURL(), NPN_PostURLNotify(), NPN_ReloadPlugins(), NPN_RemoveProperty(), NPN_RequestRead(), NPN_SetException(), NPN_Status(), NPN_UserAgent(), NPN_UTF8FromIdentifier(), NPN_Write(), NS_DestroyPluginInstance(), NS_PluginShutdown(), gnash::DiskStream::pause(), gnash::PercentLoaded(), gnash::GnashPluginScriptObject::processPlayerRequest(), gnash::Gui::quit(), gnash::HTTP::recvChunked(), gnash::RTMPClient::recvResponse(), gnash::Rewind(), gnash::RTMP::sendMsg(), gnash::SetZoomRect(), cygnal::Proc::startCGI(), cygnal::Proc::stopCGI(), gnash::StopPlay(), gnash::testfunc(), gnash::TotalFrames(), and gnash::Zoom().

#define ARG_NUMBER   10

Defines the maximum number of template arguments.

The preprocessor generates templates with 1..ARG_NUMBER arguments.

#define DEFAULT_LOGFILE   "gnash-dbg.log"
#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_REPORT_FUNCTION   gnash::log_debug("entering")
#define GNASH_REPORT_RETURN   gnash::log_debug("returning")
#define IF_VERBOSE_ACTION (   x  )     do { if ( LogFile::getDefaultInstance().getActionDump() ) { x; } } while (0);
#define IF_VERBOSE_ASCODING_ERRORS (   x  )     { if ( gnash::RcInitFile::getDefaultInstance().showASCodingErrors() ) { x; } }
#define IF_VERBOSE_MALFORMED_AMF (   x  )     { if ( gnash::RcInitFile::getDefaultInstance().showMalformedAMFErrors() ) { x; } }
#define IF_VERBOSE_MALFORMED_SWF (   x  )     { if ( gnash::RcInitFile::getDefaultInstance().showMalformedSWFErrors() ) { x; } }
#define IF_VERBOSE_NETWORK (   x  )     do { if ( LogFile::getDefaultInstance().getNetwork() ) { x; } } while (0);
#define IF_VERBOSE_PARSE (   x  )     do { if ( LogFile::getDefaultInstance().getParserDump() ) { x; } } while (0);
#define LOG_ONCE (   x  ) 
#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 (LogFile::getDefaultInstance().getVerbosity() == 0) 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));\
}

This actually creates the template functions using the TOKENIZE functions above. The templates look like this: template<typename T0 , typename T1 , typename T2> void log_error(const T0& t0 , const T1& t1 , const T2& t2) { if (LogFile::getDefaultInstance().getVerbosity() == 0) 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_error(f % t1 % t2); }

Only not as nicely indented.

Use "g++ -E log.h" or "cpp log.h" to check.

#define LOG_TYPES
Value:
(error) (debug) (unimpl) (aserror) (swferror) \
    (amferror) (security) (action) (parse) (trace) (abc) (network)

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 N_ (   String  )     gettext_noop (String)
#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 ..."

#define VERBOSE_ACTION   1
#define VERBOSE_ASCODING_ERRORS   1
#define VERBOSE_MALFORMED_AMF   1
#define VERBOSE_MALFORMED_SWF   1
#define VERBOSE_NETWORKING   1
#define VERBOSE_PARSE   1