Alien-LibJIT
view release on metacpan or search on metacpan
libjit/jit/jit-objmodel.c view on Meta::CPAN
@code{<jit/jit-objmodel-private.h>} and create an instance of
the @code{struct jit_objmodel} type. This instance should be
populated with pointers to your object model's handler routines.
You then use functions from the list below to access the
object model.
Some standard object models are distributed with @code{libjit}
for invoking methods in external C++, Objective C, GCJ, and JNI
based libraries.
@*/
/*@
* @deftypefun void jitom_destroy_model (jit_objmodel_t @var{model})
* Destroy an object model handler that is no longer required.
* It is undefined what will happen to the objects and classes
* that were being managed by the object model: they may still persist,
* or they may now be invalid.
* @end deftypefun
@*/
void jitom_destroy_model(jit_objmodel_t model)
{
if(model)
{
(*(model->destroy_model))(model);
}
}
/*@
* @deftypefun jitom_class_t jitom_get_class_by_name (jit_objmodel_t @var{model}, const char *@var{name})
* Get the class descriptor from the object model for a class
* called @var{name}. Returns NULL if the class was not found.
* If the name includes namespace or nested scope qualifiers,
* they must be separated by periods (@code{.}).
* @end deftypefun
@*/
jitom_class_t jitom_get_class_by_name(jit_objmodel_t model, const char *name)
{
return (*(model->get_class_by_name))(model, name);
}
/*@
* @deftypefun {char *} jitom_class_get_name (jit_objmodel_t @var{model}, jitom_class_t @var{klass})
* Get the name of a particular class. The return value must be freed
* with @code{jit_free}.
* @end deftypefun
@*/
char *jitom_class_get_name(jit_objmodel_t model, jitom_class_t klass)
{
return (*(model->class_get_name))(model, klass);
}
/*@
* @deftypefun int jitom_class_get_modifiers (jit_objmodel_t @var{model}, jitom_class_t @var{klass})
* Get the access modifiers for a particular class. The following lists
* all access modifiers, for classes, fields and methods:
*
* @table @code
* @vindex JITOM_MODIFIER_ACCESS_MASK
* @item JITOM_MODIFIER_ACCESS_MASK
* Mask to strip out just the public, private, etc access flags.
*
* @vindex JITOM_MODIFIER_PUBLIC
* @vindex JITOM_MODIFIER_PRIVATE
* @vindex JITOM_MODIFIER_PROTECTED
* @vindex JITOM_MODIFIER_PACKAGE
* @vindex JITOM_MODIFIER_PACKAGE_OR_PROTECTED
* @vindex JITOM_MODIFIER_PACKAGE_AND_PROTECTED
* @vindex JITOM_MODIFIER_OTHER1
* @vindex JITOM_MODIFIER_OTHER2
* @item JITOM_MODIFIER_PUBLIC
* @item JITOM_MODIFIER_PRIVATE
* @item JITOM_MODIFIER_PROTECTED
* @item JITOM_MODIFIER_PACKAGE
* @item JITOM_MODIFIER_PACKAGE_OR_PROTECTED
* @item JITOM_MODIFIER_PACKAGE_AND_PROTECTED
* @item JITOM_MODIFIER_OTHER1
* @item JITOM_MODIFIER_OTHER2
* The declared access level on the class, field, or method. The scope
* of a "package" will typically be model-specific: Java uses namespaces
* to define packages, whereas C# uses compile units ("assemblies").
*
* Object model handlers do not need to enforce the above access levels.
* It is assumed that any caller with access to @code{libjit} has complete
* access to the entire system, and will use its own rules for determining
* when it is appropriate to grant access to fields and methods.
*
* @vindex JITOM_MODIFIER_STATIC
* @item JITOM_MODIFIER_STATIC
* The field or method is static, rather than instance-based.
*
* @vindex JITOM_MODIFIER_VIRTUAL
* @item JITOM_MODIFIER_VIRTUAL
* The method is instance-based and virtual.
*
* @vindex JITOM_MODIFIER_NEW_SLOT
* @item JITOM_MODIFIER_NEW_SLOT
* The method is virtual, but occupies a new slot. Provided for languages
* like C# that can declare virtual methods with the same name as in a
* superclass, but within a new slot in the vtable.
*
* @vindex JITOM_MODIFIER_ABSTRACT
* @item JITOM_MODIFIER_ABSTRACT
* When used on a class, this indicates that the class contains abstract
* methods. When used on a method, this indicates that the method does
* not have any associated code in its defining class. It is not possible
* to invoke such a method with @code{jitom_method_invoke}, only
* @code{jitom_method_invoke_virtual}.
*
* @vindex JITOM_MODIFIER_LITERAL
* @item JITOM_MODIFIER_LITERAL
* A hint flag, used on fields, to indicate that the field has a constant
* value associated with it and does not occupy any real space. If the
* @code{jitom_field_load} function is used on such a field, it will load
* the constant value.
*
* @vindex JITOM_MODIFIER_CTOR
* @item JITOM_MODIFIER_CTOR
* A hint flag that indicates that the method is an instance constructor.
*
* @vindex JITOM_MODIFIER_STATIC_CTOR
( run in 0.453 second using v1.01-cache-2.11-cpan-5623c5533a1 )