Gnash  0.8.10
Classes | Namespaces | Defines | Functions
Global_as.h File Reference
#include <string>
#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 <boost/preprocessor/facilities/empty.hpp>
#include <boost/scoped_ptr.hpp>
#include "as_object.h"
#include "fn_call.h"
#include "log.h"
#include "ClassHierarchy.h"

Go to the source code of this file.

Classes

class  gnash::Global_as
 The Global object ultimately contains all objects in an ActionScript run. More...

Namespaces

namespace  gnash
 

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


Defines

#define FUNC_PARAM(z, n, t)   BOOST_PP_COMMA_IF(n) t arg##n
 Helper macros for callMethod arguments.
#define VALUE_ARG(z, n, t)   BOOST_PP_COMMA_IF(n) arg##n
#define CALL_METHOD(x, n, t)
 Call a member function of this object in an AS-compatible way.
#define MAX_ARGS   4
 The maximum number of as_value arguments allowed in callMethod functions.

Functions

as_object * gnash::createObject (const Global_as &gl)
as_object * gnash::registerBuiltinObject (as_object &where, Global_as::Properties p, const ObjectURI &uri)
 Register a built-in object.
as_object * gnash::registerBuiltinClass (as_object &where, Global_as::ASFunction ctor, Global_as::Properties p, Global_as::Properties c, const ObjectURI &uri)
 Register a built-in class.
DSOEXPORT as_value gnash::invoke (const as_value &method, const as_environment &env, as_object *this_ptr, fn_call::Args &args, as_object *super=0, const movie_definition *callerDef=0)
 Call an as_value on an as_object.
as_function * gnash::getClassConstructor (const fn_call &fn, const std::string &s)
 Convenience function for finding a class constructor.
as_value gnash::emptyFunction (const fn_call &)

Define Documentation

#define CALL_METHOD (   x,
  n,
 
)
Value:
inline as_value \
callMethod(as_object* obj, const ObjectURI& uri BOOST_PP_COMMA_IF(n)\
        BOOST_PP_REPEAT(n, FUNC_PARAM, const as_value&)) {\
    if (!obj) return as_value();\
    as_value func;\
    if (!obj->get_member(uri, &func)) return as_value();\
    fn_call::Args args;\
    BOOST_PP_EXPR_IF(n, (args += BOOST_PP_REPEAT(n, VALUE_ARG, BOOST_PP_EMPTY));)\
    return invoke(func, as_environment(getVM(*obj)), obj, args);\
}

Call a member function of this object in an AS-compatible way.

This is a macro to cope with a varying number of arguments. The function signature is as follows: as_value callMethod(as_object* obj, const ObjectURI& uri, const as_value& arg1, ..., const as_value& argN); If the member function exists and is a function, invoke() is called on the member with the object as the this pointer.

Parameters:
objThe object to call the method on. This may be null, in which case the call is a no-op. This is because calling methods on null or non-objects in AS is harmless.
nameThe name of the method.
arg0..argNThe arguments to pass
Returns:
The return value of the call (possibly undefined).
#define FUNC_PARAM (   z,
  n,
 
)    BOOST_PP_COMMA_IF(n) t arg##n

Helper macros for callMethod arguments.

#define MAX_ARGS   4

The maximum number of as_value arguments allowed in callMethod functions.

#define VALUE_ARG (   z,
  n,
 
)    BOOST_PP_COMMA_IF(n) arg##n