Specifying a new breve object type, and

Every object in a frontend language that will have instances in the breve engine must be registered with the breve engine. Moreover, when an object is added to the breve engine, it must also tell the engine what "type" of object it is. Each object "type" corresponds to a different language frontend and a different set of callbacks, so for each language frontend one creates, one must also create a brObjectType structure which contains the proper callbacks. The structure is shown below.

struct brObjectType {
        /**
         * Finds a method in a given class
         */
        void                    *(*findMethod)( void *inObject, const char *inName, unsigned char *inTypes, int inTypeCount );

        /**
         * Finds an object class in the given language frontend
         */
        void                    *(*findObject)( void *inObjectType, const char *inName );

        /**
         * Creates a new instance of the given class.  The constructor arguments are currently unused.
         */
        brInstance              *(*instantiate)( brEngine *inEngine, brObject *inObject, const brEval **inArguments, int inArgCount );

        /**
         * Calls a method in the language frontend
         */
        int                     (*callMethod)( void *inInstance, void *, const brEval **, brEval * );

        /**
         * Returns 1 if parent is a subclass of parent.
         */
        int                     (*isSubclass)( void *inChild, void *inParent );

        /**
         * Destroys an instance of a language object previously created with instantiate.
         */
        void                    (*destroyObject)( void *inObject );

        /**
         * Destroys an instance of a language method previously created with findMethod.
         */
        void                    (*destroyMethod)( void *inMethod );

        /**
         * Destroys an instance of a language instance previously created with instantiate.
         */
        void                    (*destroyInstance)( void *inInstance );

        /**
         * Frees any leftover memory associated with the frontend, typically _userData.
         */
        void                    (*destroyObjectType)( void *inObjectType );
        
        /**
         * A function to execute code in this frontend language.
         */                     
        int                     (*evaluate)( brEngine *inEngine, char *inFilename, char *inFiletext );

        /**
         * A user-data callback pointer.
         */
        void                    *_userData;
        
        /**
         * A unique identifier which will be set for all objects of this object type.  This
         * identifier can be used to determine whether an instance or object is native to
         * a certain object type.
         */
        long                    _typeSignature;

};

Only one brObjectType is required for each language frontend.

Once the language frontend is defined, you can add it to the engine with the following function:

void brEngineRegisterObjectType( brEngine *engine, brObjectType *type );