/****************************************************************************
 * Copyright/Copyleft:
 *
 * For this source the LGPL Lesser General Public License,
 * published by the Free Software Foundation is valid.
 * It means:
 * 1) You can use this source without any restriction for any desired purpose.
 * 2) You can redistribute copies of this source to everybody.
 * 3) Every user of this source, also the user of redistribute copies
 *    with or without payment, must accept this license for further using.
 * 4) But the LPGL ist not appropriate for a whole software product,
 *    if this source is only a part of them. It means, the user
 *    must publish this part of source,
 *    but don't need to publish the whole source of the own product.
 * 5) You can study and modify (improve) this source
 *    for own using or for redistribution, but you have to license the
 *    modified sources likewise under this LGPL Lesser General Public License.
 *    You mustn't delete this Copyright/Copyleft inscription in this source file.
 *
 * @author www.vishia.de
 * @version 2006-06-15  (year-month-day)
 * list of changes:
 * 2006-05-00: www.vishia.de creation
 *
 ****************************************************************************/
#ifndef __Object_Jc_h__
#define __Object_Jc_h__

/** Filename needed to generate the reflection info */
#undef FILENAME__h__
#define FILENAME__h__ Object_Jc

/** The system depending definitions*/
#include "CRuntimeJavalike_SysConventions.h"
//#include "simpleC.h"
#include "os_mem.h"
#include "objectBaseC.h"

/*@DEFINE_C specialDefines @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
#ifndef mBackRef_Object_Jc
  #define DONOTUSE_GC_Jc
#endif

#ifdef __CPLUSPLUS_Jcpp
  #define __CPLUS_CRUNTIMEJAVALIKE__
#endif

/** This type represents a pointer to a void name(void) - method.
  * It is needed on some locations in software.
  */
typedef void(* Void_MethodVoid)(void);


#ifdef COMPATIBILITY_STACKTRCP

/** This define is useable as parameter by define function prototype. */
#define STACKTRCP struct Stacktrace_Jc_t* stacktracePrev

/** Also possibility, but Object_Jc, containing Stacktrace_Jc should be included. */
#define STACKTRCP_Jc Stacktrace_Jc*

/** This define is useable if the parametertype should be separated from the parameter name,
 * instead using STACKTRCP.
 */
#define STACKTRC_PTR struct Stacktrace_Jc_t*

/** This define is useable as parameter by calling. */
#define STACKTRC (&stacktrace)

#endif

/*CLASS_C SimpleChainJc @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/


/**This class may be a base class of elements inside a ObjectArray_Jc to provide chained elements.
 */
typedef struct SimpleChainJc_t
{ struct SimpleChainJc_t* next;
}SimpleChainJc;




/*@DEFINE_C DCALL @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/




/** This macro substitutes a closing bracket. The user may also write a closing bracket directly
     instead, but some editors are able to find matching open and closing brackets, the single
     closing bracket without a open one (because it is Part of a DCALL_... - Makro) makes a interference
     in this one.
*/
#define _endDCALL_Jc )


/** This macro is used inside DCALL_CLASS_Jc to improve the readability of this macro definition.
  */
#define IDX_VTBL_Jc(NAME, CLASS) (((int)&(((Vtbl_##CLASS*)(0x1000))->NAME) - 0x1000)/sizeof(Void_MethodVoid))


/** This macro defines an virtual call of methods of a class unconditional in C-style.
    It is applicable in a C or C++ environment and does not require enhanced references.
  *
  * This method has an open end of parameter list. The user must add some further parameter,
    if there are necessary, and should close the application of the macro with _endDCALL_Jc.
    Example of the application of this macro:

     #define method_Class(REF, P1, P2) DCALL_CLASS_Jc(methodA, ExampleClass, Method_void_ObjectIntFloat, REF), P1, P2 _endDCALL_Jc

  * @param NAME Name of the method without classname-postfix.
           The name and param CLASS determines the name of the index in the virtual table.
  * @param CLASS Name of the dedicated class.
           The method name and this param CLASS determines the name of the index in the virtual table.
           The index is build as string in form of idxVtbl_NAME_CLASS. Such an index
           should be found in the header files, normally in enum IdxVtbl_CLASS of the deticated class.
  * @param METHODTYPE Ones of defined types of methods for reflection and virtual call,
           see class_Jc.h. This type determines the organisation of paramter handling on stack
           on call, instead of the directly prototype (signatur) of methods. The compiler
           tests the correct paramter on calling.
  * @param OBJP The pointer to the instace
           The instace is applied for two things:
    *To get the pointer to the Object_Jc - baseclass. It should be
    a pointer to Object_Jc* directly (C-like), with this knowledge the pointer
    to the reflection containing the virtual table of the instance is addressed.
    *To take over the pointer to the data. The pointer to the data is equal to the
    pointer to the data's base class Object_Jc, so the type Object_Jc* is used
    as pointer type. Thereby no user type should be known on method type METHODTYPE,
    it may be construct some times easier.

  * @return the method will be called, its return value is returned.
  */
//#define DCALL_CLASS_Jc(NAME, CLASS, METHODTYPE, OBJP)   ((METHODTYPE*)( (  (ReflectionVtbl_Jc*)( ((Object_Jc*)(OBJP))->reflectionClass) )->vMethods[ idxVtbl_##NAME##_##CLASS]  )  ) DCALLparam_Jc (OBJP)
#define DCALL_CLASS_Jc(NAME, CLASS, METHODTYPE, OBJP)   ((METHODTYPE*)( (  (ReflectionVtbl_Jc*)( ((Object_Jc*)(OBJP))->reflectionClass) )->vMethods[ IDX_VTBL_Jc(NAME,CLASS)]  )  ) ( /*(Object_Jc*)*/(OBJP)



/** This macro defines an virtual call of methods of a class either in C or in C++-style.
  * It is used if inside the using source it is not known wether the called is a C or C++ source.
  * If it is a C-source, the same as DCALL_CLASS_Jc() is used. But if it is a C++-Source,
  * the parameter OBJP is a pointer to the C++-class, and its virtual method in C++-style is called.
  *
  * The decision wether C oder C++ virtual call is done is derived from the both
  * setted definition of __CPLUSPLUS_Jcpp (it means, the user will use C++-style)
  * and the setted definition of __cplusplus (it means, C++-compilation is be done).
  * If the user will use C++-style globaly, but this source is compiled as C-Source, only C-like call
  * is be able.
  *
  * This method has an open end of parameter list. The user must add some further parameter,
  * if there are necessary, and should close the application of the macro with _endDCALL_Jc.
  * Example of the application of this macro:
  *
  *  #define method_Class(REF, P1, P2) DCALL_CLASS_Jc(methodA, ExampleClass, Method_void_ObjectIntFloat, REF), P1, P2 _endDCALL_Jc
  *
  * @param NAME Name of the method without classname-postfix.
  * It is directly the name of the C++-virtual method.
  *
  * @param CLASS Name of the dedicated C-style class.
  * In the C++-variant it is used to upcast the objects address with static-cast
  * from the dedicated C-like class to the dedicated C++ -class.
  * If the C-style class is a users class, the user may used the same
  * or likeness suffixes of class names, so the appended "pp" is well.
  *
  * See also the meaning of this paramter in the C enviroment.
  *
  * @param METHODTYPE only used in the C-variant, see DCALL_CLASS_Jc().
  * In C++ it is unused, because a C++-virtual method is used
  *
  * @param OBJP The pointer to the instace. It is possible that OBJP is the pointer to the C-like-baseclass,
  * because the call of the virtuell method is organized inside the code using also in C.
  * A static_cast<CLASS> is done before using in the C++-variant.
  *
  * @return the method will be called, its return value is returned.
  */
#if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)
  #define DCALL_CLASS_Jcpp(NAME, CLASS, METHODTYPE, OBJP) (static_cast<CLASS*>(OBJP))->NAME (
#else
  #define DCALL_CLASS_Jcpp(NAME, CLASS, METHODTYPE, OBJP) DCALL_CLASS_Jc(NAME, CLASS, METHODTYPE, OBJP)  //(  testPtr_##CLASS = OBJP, ((METHODTYPE)( ((Object_Jc*)(OBJP))->reflectionClass->vMethods[ idxVtbl_##NAME##_##CLASS]  )) ((Object_Jc*)(OBJP))  )
#endif







/*@CLASS_C String_Jc @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/




  /**
    The struct String_Jc is a string reference. The definition of the ,,struct String_Jc,,
    is contained in ,,Object_Jc.h,,, because it is used as return by value in some methods
    of the class ,,Object_Jc,,, especially ,,toString(),,. But all methods of String_Jc
    are defined in ,,String_Jc.h,,.

    The struct ,,String_Jc,, contains the reference to the string and the number of chars.
    The string itself is a sequence of chars (8-bit-ASCII), present as ,,char[],,,
    * either as constant literal.
    * or data inside a struct StringBuffer_Jc.
    * or a String somewhere else.
    It may be also a part of the string in a [[StringBuffer_Jc]].

  */
  typedef struct String_Jc_t
  {

    /** The followed attribute is at same position like offsetBackPointer in a Enhanced Reference. See [[ObjectRef_Jc]].
      * The bits mask with ,,mIdxVtbl_Object_Jc,, in a reference are used for the length information and a ''buffer''-Bit.
      * In the ,,CRuntimeJavalike_SysConventions.h,, 2 definitions should be present for this bits,
      * * ,,mLength__String_Jc,,: The length-bits, typical 0x7FFF for up to 32000 chars.
      * * ,,mBuffered__String_Jc,, The ''buffered'' Bit. If this Bit is set,
      *   the String_Jc referenced the whole string of a StringBuffer_Jc to concat strings.
      * If all bits of the mask ,,mLength__String_Jc,, are setted, ref pointeres a zero-terminated String.
      * The length of the string will be calculated on first process with the strlen()-C-funtion.
      *
      * The bits mask with ,,mBackRef_Object_Jc,, have the same meaning like on other enhanced references:
      * If a Block Heap with Gargabe Collection is used, it is the index of the backward reference of a referenced StringBuffer_Jc.
      *
      * @sizeof=4 This attribute is defined in the user modificable CRuntimeJavalike_Sysconventions.h
      *           and should be have the same size like a pointer or int
      */
    ObjectRefValues_Jc refbase;

    /** The pointer to the string itself.*/
    const char* ref;

  }String_Jc;

  #define String_JcRef String_Jc

  #define NULL_String_Jc() { 0, null}

  /* Creates a String reference to the given zero terminated char array.
   * This is a simple way if a method requires a String_Jc object as value argument but the user want to write only a constant char literal.
   */
  METHOD_C String_Jc s0_String_Jc(const char* src);

  /** Set this as reference to a String.
    * The string src may be a constant string, a substring or a StringBuffer.
    * If Runtimeheap with garbage collection is used, and src is a StringBuffer,
    * the back referenced to ythis will be registered in buffer.
    * If ythis was a reference before, the reference will be
    * released. If the reference is already a reference to the same buffer,
    * nothing will be done.
    * @param src The source String_Jc. Note: It is given per value, not per reference,
             so direct output from String_Jc-returning methods are useable as argument.
             The value consist of 2 processor registers.
    */
  METHOD_C void set_String_Jc(String_Jc* ythis, String_Jc src);
  #define set_String set_String_Jc

  /** Set this as reference to a String as a light copy. It means, no back reference is stored
    * if a garbage collector is used. This method should be only used, if the dst is temporary.
    * The string src may be a constant string, a substring or a StringBuffer.
    * @param src The source String_Jc. Note: It is given per value, not per reference,
             so direct output from String_Jc-returning methods are useable as argument.
             The value consist of 2 processor registers.
    */
  #define lightCopy_String_Jc(ythis, src) {(ythis)->refbase = (src).refbase; (ythis)->ref = (src).ref; }




/*@CLASS_C Object_Jc @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

  //NOTE: the Definition of the struct is containing in objectBaseC.h

    /** The define for constant initialisation with a typesize and a given reflection class.
      * @param TYPESIZEOF see attribute ,,objectIdentSize,,.
      * @param REFLECTION the reflection class of the constant object.
      * Note: It is not possible to set the reflection
      * with the standard call setReflection() because it is constant.
    */
    #define CONST_Object_Jc(TYPESIZEOF, OWNADDRESS, REFLECTION) {TYPESIZEOF, OWNADDRESS, kNoSemaphore_Object_Jc, kNoWaitingThread_Object_Jc, REFLECTION }

    /** The default construtor in C-manner. */
    METHOD_C void ctor_Object_Jc(Object_Jc* ythis);

    /** sets the reflection class. This method is to be called by user in its constructor of a derivated class.
      * @param reflection The reflection class of the instance, appropriate to the derivated type.
      * @param objectIdentSize The type or instance and size ident.

               This value will be stored immediately in the attribute objectIdentSize.
               The user may be set a 0-value, if no size or object ident is used in the users scope.
               But if the data are saved and transfered as POD plain old data to evaluate it,
               this information may be necessary for evaluation. The user should calculate this value
               carefully in respect to the size, instance and array bits, see enum ,,k..._objectIdentSize_Object_Jc,,.
               If no ident ifno is necessary, the size may be stored here. If the object has a low size (up to 64 k in a 32-bit-System),
               a simple way is to write ,,sizeof(Type),, or ,,sizeof(ythis),,,
               because the kIsSmallSize_objectIdentSize_Object_Jc is defined with 0.
               But it is exacting to write ,,kIsSmallSize_objectIdentSize_Object_Jc + sizeof(ythis),,,
               because it is shown here that it is a small size object.
      * @return void.
    */
    void setReflection_Object_Jc(Object_Jc* ythis, struct Class_Jc_t const* reflection, int32 objectIdentSize);

    /**Tests wether it is an Object_Jc-based instance or not. The criterium is, the ownAddress inside Object_Jc must be identical with the instance address.
     * @throws an exception if it is not true.
     */
    #define testConsistence_Object_Jc(SRC) { if( (SRC) != null && (SRC) != (SRC)->ownAddress ) THROW(RuntimeException, s0_String_Jc("no Object_Jc-based instance."), (int)(SRC)); }

    /** gets the reflection class.*/
    METHOD_C struct Class_Jc_t const* getClass_Object_Jc(Object_Jc const* ythis);

    /** gets the size of the Object stored in attribute objectIdentSize. This value helps to step through data
      * particularly by using direct composed plain old data,
      * but the user is responsible for the exactly realisation.
      */
    METHOD_C int getSizeInfo_Object_Jc(Object_Jc const* ythis);

    /**gets the ident and size of the Object stored in attribute objectIdentSize.
     * This value is useable as debug information.
     */
    METHOD_C int getIdentInfo_Object_Jc(Object_Jc const* ythis);
    //#define getIdentInfo_Object_Jc(YTHIS) (

    /** Produces a new instance equal to the old one. The method is virtual,
      * because it may be able that some register operations or others should be done
      * by the users class. This operation is the object-oriented replacement
      * for the old C-style memcpy of instances data.
    */
    typedef METHOD_C Object_Jc* MT_clone_Object_Jc(Object_Jc const* ythis);

    /**Tests wether or not both objects are equal. The statement of homogeneousness
     * may be depended on some informations inside the instances, other informations
     * may be differenced, though both objects are equal. Thats why the method is virtual.
     * This operation is the object-oriented replacement
     * for the old C-style memcpy of instances data.
     */
    typedef METHOD_C bool MT_equals_Object_Jc(Object_Jc const* ythis, Object_Jc const* second);

    /**This method should be called before the instance is deleted finally. It is called
     * by garbage collection. Some action such as deregister or free memory may be taken
     * from the users overload class.
     */
    typedef METHOD_C void MT_finalize_Object_Jc(Object_Jc* ythis);

    /**This method supplies a hash code for thid onstance.
     */
    typedef METHOD_C int32 MT_hashCode_Object_Jc(Object_Jc const* ythis);

    /**This method supplies a string representation of the content of the instance,
     * useable especially for debug or analyze information.
     */
    typedef METHOD_C String_Jc MT_toString_Object_Jc(Object_Jc* ythis);

    /** The definition of the part of virtual table of Object_Jc. The virtual methods are callable
      * in a C-environment, at example if there are plain old data.
      */
    typedef struct Vtbl_Object_Jc_t
    { MT_clone_Object_Jc*    clone;
      MT_equals_Object_Jc*   equals;
      MT_finalize_Object_Jc* finalize;
      MT_hashCode_Object_Jc* hashCode;
      MT_toString_Object_Jc* toString;
    } Vtbl_Object_Jc;


    /**The synchronized(obj) keyword from Java. */
    METHOD_C void synchronized(Object_Jc* obj);

    /**The synchronizedEnd-Methode should be called on end of a synchronized block.
     * write:
     * ,,  synchronized(obj);
     * ,,  { //critical section
     * ,,  }synchronizedEnd(obj);
     */
    METHOD_C void synchronizedEnd(Object_Jc* obj);



/*@CLASS_C_VIRTUAL Object_Jc @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
  /*=================================================================================*/


    /*This header block contains the definition of the implementation of virtual methods of the class
      and the definition of calling macros.
     */

    //METHOD_C Object_Jc* clone_Object_F(Object_Jc const* ythis);
    extern MT_clone_Object_Jc clone_Object_F;


    #define clone_Object_Jc(THIS)    DCALL_CLASS_Jc(clone, Object_Jc, MT_Jclone_Object_Jc, THIS) _endDCALL_Jc


    extern MT_equals_Object_Jc equals_Object_F;

    #define equals_Object_Jc(THIS, P1) \
      DCALL_CLASS_Jc(equals, Object_Jc, MT_equals_Object_Jc, THIS) , P1 _endDCALL_Jc


    extern void finalize_Object_F(Object_Jc* ythis);

    #define finalize_Object_Jc(THIS) \
      DCALL_CLASS_Jc(finalize, Object_Jc, MT_finalize_Object_Jc, THIS) _endDCALL_Jc


    extern MT_hashCode_Object_Jc hashCode_Object_F;
    //extern int32 hashCode_Object_F(Object_Jc const* ythis);

    #define hashCode_Object_Jc(THIS) \
      DCALL_CLASS_Jc(hashCode, Object_Jc, MT_hashCode_Object_Jc, THIS) _endDCALL_Jc


    extern MT_toString_Object_Jc toString_Object_F;
    //extern String_Jc toString_Object_F(Object_Jc* ythis);

    #define toString_Object_Jc(THIS) \
      DCALL_CLASS_Jc(toString, Object_Jc, MT_toString_Object_Jc, THIS) _endDCALL_Jc




    /** The virtual table of non overloaded methods from object,
        useable as part of a users virtual table.
      */
    #define CONST_VtblStd_Object_Jc \
    { clone_Object_F    \
    , equals_Object_F   \
    , finalize_Object_F \
    , hashCode_Object_F \
    , toString_Object_F \
    }

    /** The virtual table of non overloaded methods except for toString from object,
        useable as part of a users virtual table.
      */
    #define CONST_Vtbl_Object_Jc(TOSTRING) \
    { clone_Object_F    \
    , equals_Object_F   \
    , finalize_Object_F \
    , hashCode_Object_F \
    , TOSTRING \
    }



/*@CLASS_C ObjectArray_Jc @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/



/*=================================================================================*/
/* ObjectArray_Jc */

    /**@deprecated because it is not a super idea*/
    //#define ARRAY_Jc Object_Jc object; int32 length; int16 sizeElement; int16 mode;

  /** Base data of an array.
      This type is used to read out array data in universal form. It should not used
      to define an array, use DEFINE_ARRAY_Jc or TYPEDEF_ARRAY_Jc instead.
    * The array data itself follows directly.
    * The definition of ARRAY_Jc contains the followed elements:
    * *Object_Jc object: The array base type based on Object. Reflection is useable for the whole array.
      *int32 length: acual no of elements, in java it is the final public attribute length
      *int16 sizeElement size of an element, this is the sizeof a pointer if it is a array of pointers.
      *int16 mode: mode of operation, see enum Emode. Here is coding the no of elements in 1 block
        and the using of pointers or not.

  */
  typedef struct  ObjectArray_Jc_t
  { //ARRAY_Jc
    Object_Jc object;
    int32 length;
    int16 sizeElement;
    int16 mode;
    #define kPointered_ObjectArray_Jc 1
    #define kDirect_ObjectArray_Jc 2
  }ObjectArray_Jc;


  /**Macro to define a Object based array.
     syntactical using as type in form
     , DEFINE_ARRAY_Jc(MyElementType, 23) MyArrayType;
     It results as a definition in form:
     , struct { Object_Array_Jc head; TYPE data[SIZE]; }
     @param TYPE the type of the elements
     @param SIZE nr of elements to shown in the array type. Often the defined arraytype
            is used as pointer, in that cases the number of elements may not be identical
            with the number of elements defined here. Use new_ARRAY_Jc to get a instance.
     @return inappropriate, it is used like a type.
   */
  #define ARRAY_Jc(TYPE, SIZE) struct { ObjectArray_Jc head; TYPE data[SIZE]; }

  /** Constant definition of the head of any array
    * @param TYPE the type of the elements, used in sizeof(TYPE) and in reflection##TYPE
    * @param SIZE number of elements
    * @deprecated because it is not a super idea
    */
  //#define CONST_ARRAY_Jc(TYPE, SIZE, IDENT, REFLECTION) \
  //  { CONST_Object_Jc(sizeof(IDENT + ObjectArray_Jc) + SIZE * sizeof(TYPE), &reflection##TYPE.clazz) \
  //  , SIZE, sizeof(TYPE), 0


  #define CONST_ObjectArray_Jc(TYPE, SIZE, IDENT, REFLECTION, OWNADDR) \
    { CONST_Object_Jc(IDENT + sizeof(ObjectArray_Jc) + (SIZE) * sizeof(TYPE), OWNADDR, REFLECTION), SIZE, sizeof(TYPE), 0 }


  /** initializes the data of the array. This includes the head and the associated data. It is the rule or law,
   *  that all data are disposed immediately after the head of array. The data are set to 0.
   *
   *  @param ythis The head of the array.
   *  @param size  The number of elements of the 1-dimensional array
   *  @param nBytesPerElement sizeof(ElementType)
   *  @param reflection The reflection definition
   *  @param typeInstanceIdent The Type or Instance Id without size information but with the kind of size information, see kIsMediumSize_objectIdentSize_Object_Jc.
   *
   */
  METHOD_C ObjectArray_Jc* ctor_ObjectArray_Jc(ObjectArray_Jc* ythis, int size, int nBytesPerElement, struct Class_Jc_t const* REFLECTION, int32 typeInstanceIdent);

  #define constructor_ObjectArray_Jc ctor_ObjectArray_Jc


  /**creates an new Array of any desired struct type. The memory for the array is reserved, all elements are setted to 0,
   * and the ObjectArray-Head-Structure is initialized.
   * Do not use this method to create an array of a C++ class, because there constructors are not called
   * and no virtual-table-pointer are initialized.
   * @param size Number of elements of the 1-dimensional array.
   * @param bytesPerElement This value should be written as ,,sizeof(ElementType),,.
   * @param reflection The reflection class of the elements. Note: The elements need not have Object_Jc as baseclass.
   *        The access to reflection info is possible via the array head.
   * @param typeInstanceIdent It may be 0. If the data are evaluate in a POD plain old data data image,
   *        the value may be important. See element ,,objectIdentSize,, in ,,Object_Jc,,.
   *        But here only the ident bits, not the size should be given.
   * @param STACKTRCP My be null, if no memory allocation error is expected.
   * @return The pointer of the allocated data as reference to ObjectArray_Jc. A casting outside is necessary, see macro new_ARRAY_Jc.
   * @throws RuntimeException if no memory is allocatable.
   */
  METHOD_C ObjectArray_Jc* new_ObjectArray_Jc(int size, int bytesPerElement, struct Class_Jc_t const* reflection, int32 typeInstanceIdent);

  /**Builds a constant in compile time with the defined static size of an array type.
   * The array type should have an array element named data.
   */
  #define STATICSIZE_TYPE_ObjectArray_Jc(TYPE) (sizeof( ((TYPE*)(0x1000))->data) / sizeof( ((TYPE*)(0x1000))->data[0]))


  /** Gets the reference of the addressed element of an array with any desired type.
    * This is a macro because the type is unknown here and kept from the users ARRAY
    * by macro expansion.
    * @param ARRAY instance of an array, must construct with "ObjectArray_Jc head; Usertype data;"
    * @param IDX the index of the instance
    * @return the "left value" as C-syntax of the element.
    * @throws IndexOutOfBoundsException if the IDX is failed.
    *Note: 3thrd Parameter TYPE is necessary for universal use, especially THROW_Jc
    */
    #define element_ARRAY_Jc(ARRAY, IDX) \
      (  (IDX) < 0 || (IDX) >= (ARRAY)->head.length ? /*(TYPE)THROW_Jc(IndexOutOfBoundsException_Jc, "", 0)*/ null :  &((ARRAY)->data[IDX]) )


    /** calculates the size of an array with ObjectArray_Jc-Head in compiletime.
      * This is a macro because the type is given.
      * @param TYPE The type of the elements.
      * @param SIZE The number of the elements.
      * @return The number of bytes
      */
    #define sizeof_ARRAY_Jc(TYPE, SIZE) (sizeof(ObjectArray_Jc) + (SIZE) * sizeof(TYPE))


  /**creates an new Array of the given struct type. The memory for the array is reserved, all elements are setted to 0,
   * and the ObjectArray-Head-Structure is initialized.
   * Do not use this method to create an array of a C++ class, because there constructors are not called
   * and no virtual-table-pointer are initialized.
   *
   * @param TYPE The type of the elements. It should be a struct type.
            It is used to calculate the sizeof(TYPE) for memory allocation and to cast the result pointer to the expected type.
   * @param SIZE Number of elements of the 1-dimensional array.
   * @param REFLECTION The reflection class of the elements. Note: The elements need not have Object_Jc as baseclass.
   *        The access to reflection info is possible via the array head.
   * @param IDENT It may be 0. If the data are evaluate in a POD plain old data data image,
   *        the value may be important. See element ,,objectIdentSize,, in ,,Object_Jc,,.
   *        But here only the ident bits, not the size should be given.
   * @return The pointer of the allocated data in the correct type reference.
   * @throws RuntimeException if no memory is allocatable. In the environment the STACKTRC_ENTRY("name") should be present.
   */
  #define new_ARRAY_Jc(TYPE, SIZE, REFLECTION, IDENT) ((TYPE##Array*)(new_ObjectArray_Jc(SIZE, sizeof(TYPE), REFLECTION, IDENT)))




    /** Defines a const for init of ObjectArray_Jc */
    //#define const_ARRAY_Jc(NRofELEMENTS, BYTESperELEMENT) {NRofELEMENTS, BYTESperELEMENT, kDirect_ObjectArray_Jc }


    /** Gets the pointer to an element int the data area of the array, indexed by idx.
    This method returns a not constant pointer*/
    METHOD_C void* get_i_ObjectArray_Jc(ObjectArray_Jc const* ythis, int idx);

    /** Gets the size of the array, it means number of elements of the array, not number of bytes.
      It is the content of element length. Because it is a simple access a define may be a possible implementation.
      An compiler-errormessage may be clear cut, if the user works with wrong argument BASE.
    */
    #define size_ObjectArray_Jc(BASE) ((BASE)->length)
    //METHOD_C int size_ObjectArray_Jc(const ObjectArray_Jc* base);


    /** Gets the number of bytes of the whole array calculated from the informations inside the head.
      */
    METHOD_C int getNrOfBytes_ObjectArray_Jc(ObjectArray_Jc const* ythis);


    /** supplies the defined number of elements of a simple array as a compiler builded constant.
      * This is a static method.
      * @param array any array defined in form type name[size].
      * @return the size.
    */
    #define arraylen_ObjectArray_Jc(array) (sizeof(array)/sizeof(array[0]))




#define arraylen_Stddef(array) arraylen_ObjectArray_Jc(array)

#ifndef arraylen
  #define arraylen(array) arraylen_ObjectArray_Jc(array)
#endif
  /** Other variant of Array-Head, it is a macro containing the head elements to assemble
   * in a user's structure.*/

/**Calculates on compile time the number of elements of given array instance.
 * @param ARRAY a instance of an array type.
 */
#define ARRAYLEN(ARRAY) (sizeof(ARRAY)/sizeof(ARRAY[0]))


/*@CLASS_C int8Array @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/


  /*=====================================================================================*/
  /* int8Array */

  /** Array of direct adressed integer values with 32 bit.
    * This may be a template to build users arrays:
    * Copy it and replace 'int32' with the users type.
    * If the users array is a array of pointers, the users type is such as 'Userclass*'
  */
  typedef struct int8Array_t
  { /** consist of the base data of the array*/
    ObjectArray_Jc head;
    /** direct data followed immediately after the ObjectArray_Jc.
        The size of the array given here is only a helper for debugging, the debugger
        shows the given number of value. The really value is held inside array.
    */
    int8 data[0x100];
  }int8Array;

  /** The constructor accepts also a null pointer (on error) and returns the pointer itself,
    * necessary to use inside definition new_type
    */
  METHOD_C int8Array* ctor_int8Array(int8Array* ythis, int nrOfBytes);


  /** Gets the sizeof of the instance with given nr of elements. It is a static-like method.
   * @param SIZE number of elements
  */
  #define sizeof_int8Array(SIZE) (sizeof(ObjectArray_Jc) + SIZE * sizeof(int32))

  #define staticSize_int8Array (sizeof(((int32ARRAY*)(0x1000))->data) / sizeof(int32))

  #define CONST_int8Array(OBJP) { CONST_ObjectArray_Jc(int8, 100, 0, REFLECTION_int8, OBJP->head), {0} }
  //#define CONSTaddSize_int32ARRAY(OBJP, ADDSIZE) { CONST_ObjectArray_Jc(int32, 100 + ADDSIZE, 0, REFLECTION_int32, (OBJP)->head), {0} }
  #define CONSTaddSize_int8Array(OBJP, ADDSIZE) { CONST_ObjectArray_Jc(int8, 100 + ADDSIZE, 0, null, null), {0} }

/*@CLASS_C Int32_Jcad @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/


  /*=====================================================================================*/
  /* Int32_Jcad */

  /** Array of direct adressed integer values with 32 bit.
    * This may be a template to build users arrays:
    * Copy it and replace 'int32' with the users type.
    * If the users array is a array of pointers, the users type is such as 'Userclass*'
  */
  typedef struct Int32_Jcad_t
  { /** consist of the base data of the array*/
    ObjectArray_Jc head;
    /** direct data followed immediately after the ObjectArray_Jc.
        The size of the array given here is only a helper for debugging, the debugger
        shows the given number of value. The really value is held inside array.
    */
    int32 data[100];
  }Int32_Jcad;

    /** The constructor accepts also a null pointer (on error) and returns the pointer itself,
      * necessary to use inside definition new_type
      */
    METHOD_C Int32_Jcad* ctor_Int32_Jcad(Int32_Jcad* ythis, int nrOfBytes);

    /** Gets the element with given Index. The element is the value itself, of type 'int32'*/
    #define get_Int32_Jcad(ARRAY,IX) (*(int32*)(get_i_ObjectArray_Jc(&ARRAY->array, IX)))

    /** Sets the element with given Index*/
    #define set_Int32_Jcad(ARRAY,IX, VAL) (*(int32*)(get_i_ObjectArray_Jc(&ARRAY->head, IX)) = VAL)

    /** Gets the sizeof of the instance with given nr of elements. It is a static-like method.
     * @param SIZE number of elements
    */
    #define sizeof_Int32_Jcad(SIZE) (sizeof(ObjectArray_Jc) + SIZE * sizeof(int32))

    /** Create a new Instance with the given number of elements
     * @param size number of elements
    */
    //METHOD_C Int32_Jcad* new_Int32_Jcad(int size);

    #define new_Int32_Jcad(SIZE) (ctor_Int32_Jcad( (Int32_Jcad*)malloc(sizeof_Int32_Jcad(SIZE)), SIZE ))



  typedef struct int32ARRAY_t{ ObjectArray_Jc head; int32 data[100];} int32ARRAY;
  #define staticSize_int32ARRAY (sizeof(((int32ARRAY*)(0x1000))->data) / sizeof(int32))

  #define CONST_int32ARRAY(OBJP) { CONST_ObjectArray_Jc(int32, 100, 0, REFLECTION_int32, OBJP->head), {0} }
  //#define CONSTaddSize_int32ARRAY(OBJP, ADDSIZE) { CONST_ObjectArray_Jc(int32, 100 + ADDSIZE, 0, REFLECTION_int32, (OBJP)->head), {0} }
  #define CONSTaddSize_int32ARRAY(OBJP, ADDSIZE) { CONST_ObjectArray_Jc(int32, 100 + ADDSIZE, 0, null, null), {0} }

/*@ARRAY Object_Jca @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

//TYPEDEF_ARRAY_Jc(Object_Jc, 50)
typedef struct Object_JcARRAY{ ObjectArray_Jc head; Object_Jc* data[50]; }Object_Jca;





/*@CLASS_CPP @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/



#if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)


  /*=====================================================================================*/
  /* C++-version of Object, named Object_Jcpp */

  class Object_Jcpp;
  struct Class_Jc_t;



  class ObjectBase_Jcpp: public ObjectifcBase_Jcpp //, public virtual ObjectBase_Jc
  {

    /** The destructor. It should be virtual because the correct destructor
        for an instance by referencing the instance via a base class must be used.
    */
    public: virtual ~ObjectBase_Jcpp(){}

    virtual String_Jc toString()=0;

    virtual void finalize()=0;

    public: virtual Object_Jcpp* toObject_Jcpp()=0;
    public: virtual Object_Jc* toObject_Jc()=0;


  };

//  #endif
//  #endif
//  #endSBNF

  class  Object_Jcpp: public ObjectifcBase_Jcpp, public Object_Jc
  {
    /** The data from the C-like class: */
    //private: Object_Jc objectdata;


    /** RuntimeHeap is the class to get Block in Heap on Runtime.
        The protected method finalize() should be accesable from Runtimeheap.
    */
    friend class RuntimeHeap;

    /** Access also to private attributes in reflection.
    */
    friend class Reflection__Object;


    /** default constructor with no reflection information. The reflection  pointer will be
        setted to Reflection__Object.
    */





   /**copy-constructor*/
    //Object(const Object&);


    /** Implements virtual method from Object__Base_Jc. Because the method here
        is not virtual, no further overload can be done.<br/>
        The type conversion to Object* is required in baseclass (interface) Object__Base
        and is implemented here. It returns this. Note that the value of the this-pointer
        dependence on the inheritance structure. A this-pointer of type of an interface
        pointered exactly the virtual table of the interface, a this-pointer of a multiple
        inheranced base class pointered the part of the class represented this base class.
        It is not equal to the this-pointer to the instance itself, referenced with the
        instance-type pointer. The compiler adds or subtracts some adress differences.
    */
    //public: operator Object_Jcpp*(){ return this; }  //type conversion

    /** see java-documentation*/
    public: int hashCode() const;

    /** wake up one waiting thread if any threads called wait().
        It wakes up exactly one thread, but it is not defined which thread if several
        threads are waiting.
    */
    public: void notify();

    /** wake up all waiting thread if any threads called wait().
    */
    public: void notifyAll();

    /** to fall asleep the current thread. The Thread will be waked up
        either by calling notify on this object from another thread or if the time is expired.
        If the value of time is less 0, no timeout is used.
    */
    public: void wait(long nTime = -1);


    public: Object_Jcpp* clone() const;

    public: class Class_Jcpp const* getClass() const;


    /** casting from Object* to String
    */
    //operator class String();
    //operator class String&();
    //operator class String*();




    /** substitue the java operator instanceof
    */
    public: bool instanceof( struct Class_Jc_t const* reflection);

    /** compare to content of the instance, take the length in memory over reflection
    */
    public: virtual bool equals(Object_Jcpp const* obj) const
    {
      //return this == obj;
      return false; //toObject_Jc() == obj;
    }

    //void synchronized(class Object_Jcpp* obj);

    //void synchronizedEnd(class Object_Jcpp* obj);


    /** In the runmode parentRef() is to be execute for all member references of a class.
     ** The runmode is to coordinate with the using of RuntimeHeap.
     ** parentRef() are necesserry for the garbage collector.
    */
    static bool isRunMode();





    /** setuseless is used instead of garbage collection in C++. If any application don't need this instance
        furtherly, it called setuseless(). The instance itself must clarify the conditions to delete or destroy it.
        Thats why the user should overwrite this method.<br/>
        The default manner is to delete the instance immediately.
    */
    public: virtual void setuseless(){ delete this; }

    /** delete__ called by garbage collector at last, to free system ressources*/
    public: void delete__();

    public: Object_Jcpp()
    //{ constructor_Object(&this->objectdata);
    //{ constructor_Object(static_cast<Object_Jc*>(this));
    { ctor_Object_Jc((Object_Jc*)(this));
    }


    void setReflection(struct Class_Jc_t const* reflection, int32 typeInstanceSizeIdent = 0)
    //{ setReflection_Object(&(this->objectdata), reflection);
    {
      setReflection_Object_Jc(static_cast<Object_Jc*>(this), reflection, typeInstanceSizeIdent);
    }


    virtual String_Jc toString(){ return toString_Object_F(static_cast<Object_Jc*>(this)); }

    virtual void finalize(){}



    public: virtual Object_Jc* toObject_Jc(){ return this;}
    public: virtual Object_Jcpp* toObject_Jcpp(){ return this;}
  };

#endif  /*__CPLUSPLUS_Jcpp*/




/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@DEFINE_C ReferenceTypeSimple @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/




#if defined(mBackRef_Object_Jc) || defined(mIdxVtbl_Object_Jc)
  /** This file should not be present in a system without enhanced references.*/
  #include "ObjectRef_Jc.h"
#endif

#if !defined(mBackRef_Object_Jc) && !defined(mIdxVtbl_Object_Jc)
  /*no enhanced references are used: */

  /**This macro defines a type representing a reference to the argument type.
   * For the different system conventions this reference type is build in different ways.
   * In simple C or C++ environment without using garbage collection and without using
   * enhanced references for C-like-intefaces it is a simple pointer.
   */
  /* A reference in simple way is the type pointer, build with ,,type*,,.
      Use this macro to define a reference type, if the same source may be used
      also with enhanced references. Write:
      , TYPEDEF_REFERENCE(MyType)

      without colon on end of makro and without other things. After that it will be defined:
      , typedef MyType* MyTypeRef;

      @PARAM TYPE the type identifier.
  */
  //#define TYPEDEF_REFERENCE(TYPE) typedef TYPE* TYPE##Ref;  typedef TYPE##Ref TYPE##Refp; extern TYPE* testPtr_##TYPE; extern const TYPE##Ref null_##TYPE;
  #define REFTYPEDEF_Jc(TYPE) typedef TYPE* REF_##TYPE;  typedef REF_##TYPE REFP_##TYPE;
  #define TYPEDEF_REFERENCE(TYPE) REFTYPEDEF_Jc(TYPE)


  /** The methods to set back references are not necessary*/
  //#define setBackrefIdxvtbl_Jc(REF, SRC, REFLECTION) (true)

  /** The methods to set back references are not necessary*/
  //#define clearBackref_Jc(REF) (true)


#endif

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@DEFINE_C ReferenceUsingSimple @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/


#if !defined(mBackRef_Object_Jc) && !defined(mIdxVtbl_Object_Jc)


  /**Sets a reference in C manner, also if C++ is used.
   * Use this macro if the source may be used in a system conventions environment with enhanced references.
   * If the reference is simple, it is a simple setting.
   * If the reference is enhanced, it stores the backward reference, tests the index of virtual table and some others.
   *
   * @param REF The reference instance.
   * @param OBJP The pointer to the object.
   * @param REFTYPE the type of the reference. It will be necessary by using enhanced references.
   */
  /* The exactly type of reference REFP is tested,
    * because an additional assignment to the REFP->ref with type conversion to the ref's type is done.
    * If the reference type is not matched, a warning is produces (failed pointer type).<br>
    * The exactly type of the OBJP is not tested.
  */
  #if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)

    #define SETREF_Jc(REF, OBJP, REFTYPE) (REF = static_cast<REFTYPE*>(OBJP))

    #define SETifcREF_Jc(REF, OBJP, REFTYPE) (REF = static_cast<REFTYPE*>(OBJP))

  #else

    #define SETREF_Jc(REF, OBJP, REFTYPE) (REF = OBJP) //(REF = (REFTYPE*)(OBJP)) //(REF = static_cast<REFTYPE*>(OBJP))

    #define SETifcREF_Jc(REF, OBJP, REFTYPE) (REF = OBJP) //(REF = (REFTYPE*)(OBJP)) //(REF = static_cast<REFTYPE*>(OBJP))
  #endif

  /**Sets a reference in C++ manner, if C++ is used.
   * Use this macro if the source may be used in a system conventions environment with enhanced references.
   * If the reference is simple, it is a simple setting.
   * If the reference is enhanced, it stores the backward reference, tests the index of virtual table and some others.
   *
   * @param REF The reference instance.
   * @param OBJP The pointer to the object.
   * @param REFTYPE the type of the reference. It will be necessary by using enhanced references.
   */
  #define SETREF_Jcpp(REF, OBJP, REFTYPE) (REF = static_cast<REFTYPE*>(OBJP)) //(REF = static_cast<REFTYPE*>(OBJP))

  #define SETifcREF_Jcpp(REF, OBJP, REFTYPE) (REF = static_cast<REFTYPE*>(OBJP)) //(REF = static_cast<REFTYPE*>(OBJP))

  /**Sets a reference to null.
   * Use this macro if the source may be used in a system conventions environment with enhanced references.
   * If the reference is simple, it is a simple setting.
   * If the reference is enhanced, it deletes a backward reference if the reference is used before.
   */
  #define CLEARREF_Jc(REF) ((REF) = null)


  /**Access to a reference of the instance, if a ,,REF_''type'',, is given, see Macro REFTYPEDEF_Jc().
   * Variant if no enhanced reference is used, it is the reference itself.
   */
  #define REF_Jc(REF) (REF)

  /**Access to a reference of the instance, if a ,,REF_''type'',, is given, see Macro REFTYPEDEF_Jc().
   * Variant if no enhanced reference is used, it is the reference itself.
   */
  #if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)
    #define REFCAST_Jc(REF, TYPE) (static_cast<TYPE*>(REF))
  #else
    #define REFCAST_Jc(REF, TYPE) ((TYPE*)(REF))
  #endif


  /**Access to a reference of the instance, if a ,,REFP_''type'',, is given, see Macro REFTYPEDEF_Jc().
   * Variant if no enhanced reference is used, it is the reference itself.
   */
  #define REFP_Jc(REF) (REF)

  /**Access from a ,,REFP_''type'',, to the ,,REF_''type'',,, see Macro REFTYPEDEF_Jc().
   * Variant if no enhanced reference is used, it is the reference itself.
   */
  #define REFP_REF_Jc(REF) (REF)

  #define THISREF(REF) (REF)


  #define ObjectRef_null() null
  #define constnull_ObjectRef() null
  #define NULLREF_Jc null

  /** The method to test wether a reference is null or not*/
  #define isNull_Reference(REF) ((REF) == null)

  /** The method to test wether a reference is null or not*/
  #define ISNULLREF_Jc(REF) ((REF) == null)

  /** The access to ...*/
  //#define zthis (&ythis->data)

  #if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)
    /** Builds a constant reference of interface type, the source is a reference of a instance of type CLASS.
        The constant reference is in notation of { .... }.
        @param IFACE type of the reference, only necessary for the equivalent C form, here unused
        @param CLASS type of the instance, only necessary for the equivalent C form, here unused
        @param OBJ  pointer to the instance. This is the only contribution to the constant reference.
    */
    #define CONSTREF_ifc_Jcpp(IFACE, CLASS, OBJ) {(OBJ)}
  #endif


  /**If no enhanced references are used, the REFTYPE_Jc is a simple reference of the type.
    */
  #define REFTYPE_Jc(TYPE) TYPE*


#endif


/** This macro is commonly useable to set a POD istance to all bytes 0.
 * It is especially useable to clear references independed of theire represantation
 * as enhanced reference or not.
 *
 * '''Do not use this macro to init classes, because theire virtual pointers will be cleared!'''
 */
#define SET0_Jc(OBJ) memset(&OBJ, 0, sizeof(OBJ));


/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@DEFINE_C C_likeInterface @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/


#if !defined(mBackRef_Object_Jc) && !defined(mIdxVtbl_Object_Jc)



  /** Definition of an interface in C++-style if C++ is used, or in C-Style.
    * @param NAME name of the interface.
  */
  #if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)
    /** In C++-style the interface is always defined as class based on Object__Base_Jc.
      * This superclass supports the methods of Object_Jcpp generally useable for all interfaces,
      * line in Java.
    */
    #define TYPEDEF_INTERFACE_Jcpp(NAME) typedef class NAME* NAME##Ref; typedef class NAME* NAME##Refp; class  NAME: public ObjectifcBase_Jcpp { public:
    #define _endINTERFACE_Jcpp };


  #else
    //#define TYPEDEF_INTERFACE_Jcpp(NAME) TYPEDEF_INTERFACE_Jc(NAME)
    //#define _endINTERFACE_Jcpp };
    /**It is an error using TYPEDEF_INTERFACE_Jcpp or TYPEDEF_INTERFACE_Jc
       in a non C++-environment without enhanced references.
       Therefor the compiler will shown the defined identifier as error message.
     */
    #define TYPEDEF_INTERFACE_Jcpp(NAME) mIdxVtbl_Object_Jc__isUndefined_noEnhancedReferences
  #endif

  /**It is an error using TYPEDEF_INTERFACE_Jc
     if no enhanced references are used.
     Therefor the compiler will shown the defined identifier as error message.
   */
  #define TYPEDEF_INTERFACE_Jc(NAME)   ERROR_noEnhancedReferences NAME;



  #if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)
    /** This macro defines an virtual call of methods of an interface in C++-style.
    It is applicable only if C++-compilation is forced, if the user has set __CPLUSPLUS_Jcpp
    to force the using of C++ (It may be also able to use C++-compilation without using of C++ in sources)
    and extensive references with two words inside are used (in respect to using garbage collection).<br>
    * This method has an open end of parameter list. The user must add some further parameter,
      if there are necessary, and should close the application of the macro with _endDCALL_Jc.
      Example of the application of this macro: <br>
      <pre>#define method_iInterface(REF, P1, P2) DCALL_ifc_Jcpp(methodA, iExample, Method_void_ObjectIntFloat, REF), P1, P2 _endDCALL_Jc
      </pre>
    * @param NAME Name of the method without interfacename-postfix.
             It is directly the name of the C++-virtual method.
    * @param IFC Name of the dedicated interface.
             This parameter is unused here, but necessary if the macro is applicated in a C environment.
    * @param METHODTYPE Ones of defined types of methods for reflection and virtual call, see class_Jc.h.
             This parameter is unused here, but necessary if the macro is applicated in a C environment.
    * @param REF The reference to the instance implemented the interface.
    * @return the method will be called, its return value is returned.
    */
    #define DCALL_ifc_Jcpp(NAME, IFC, METHODTYPE, REF) (REF)->NAME (

    #define _endDCALL_Jc )
  #else
    /**It is an error using DCALL_ifc_Jcpp
       if no enhanced references are used.
       Therefor the compiler will shown the defined identifier as error message.
     */
    #define DCALL_ifc_Jcpp(NAME, IFC, METHODTYPE, REF)   mIdxVtbl_Object_Jc__isUndefined_noEnhancedReferences
    //#error "DCALL_ifc_Jcpp inside a C environment without enhanced references"
  #endif


  /**It is an error using DCALL_ifc_Jcpp
     if no enhanced references are used.
     Therefor the compiler will shown the defined identifier as error message.
   */
  #define DCALL_ifc_Jc(NAME, IFC, METHODTYPE, REF)   mIdxVtbl_Object_Jc__isUndefined_noEnhancedReferences



  /** This macro matches to _endDCALL_Jc and substitutes a opening bracket.It is also possible to write
  an opening bracket directly instead, but some editors are able to find matching open and closing brackets, the single
  closing bracket without a open one (because it is Part of a DCALL_... - Makro) makes a interference
  in this one.
  */
  #if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)
    /** the opening bracktet is already contained in DCALL_ifc_Jcpp*/
    #define DCALL_arg_Jc
  #else
    #define DCALL_arg_Jc ,
  #endif

  #define DCALL_arg_Jcpp DCALL_arg_Jc




#endif //defined(mBackRef_Object_Jc) || defined(mIdxVtbl_Object_Jc)



//TYPEDEF_REFERENCE(Object_Jc)
REFTYPEDEF_Jc(Object_Jc)

/**casts a reference toObject_Jc.*/
#if defined(__CPLUSPLUS_Jcpp) && defined(__cplusplus)
  /**In C++ there is possibly a multi-inheritance, and possibly there is a reference to an interface.
   * Therefore only a call of the virtual method toObject_Jc(), declared in the interface Objectifcbase_Jc, supplies the correct pointer.
   */
  #define TO_Object_Jc(IFC) ((IFC)->toObject_Jc())
#else
  //
  /**In c only single inheritance is supported. Thats why all instances start with the Object_Jc-structure.
   * Thats why the direct casting is helpfull.
   */
  #define TO_Object_Jc(IFC) ((Object_Jc*)IFC)
#endif




//extern Object_Jc nullref_Object_Jc;


/** adds a reference to a Object in RuntimeHeap.
  * @param ref The reference to added.
  * @obj the referenced object. It is the same like in ref.
  */
//METHOD_C void addRef_RuntimeHeap(struct RuntimeHeap_Jc_t const* ythis, REFP_Object_Jc ref);

/*@CLASS_C MathJc @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

//const double PI_MathJc = 3.141592653589793;

/*@DEFINE_C standard includes @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

/**It should able to work with Stacktrace. */
#include "Exception_Jc.h"

#endif //__Object_Jc_h__
