File Coverage

autogen/include/Clownfish/Class.h
Criterion Covered Total %
statement 2 2 100.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 2 2 100.0


line stmt bran cond sub pod time code
1            
2            
3            

perltidy

4            
 
5             /* * *********************************************** * * !!!! DO NOT EDIT !!!! * * This file was auto-generated by Build.PL. * * *********************************************** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef H_CLOWNFISH_CLASS #define H_CLOWNFISH_CLASS 1 #ifdef __cplusplus extern "C" { #endif #include "cfish_parcel.h" /* Include the header for this class's parent. */ #include "Clownfish/Obj.h" /* Define the struct layout for instances of this class. */ #ifdef C_CFISH_CLASS extern uint32_t cfish_Class_IVARS_OFFSET; typedef struct cfish_ClassIVARS cfish_ClassIVARS; static CFISH_INLINE cfish_ClassIVARS* cfish_Class_IVARS(cfish_Class *self) { char *ptr = (char*)self + cfish_Class_IVARS_OFFSET; return (cfish_ClassIVARS*)ptr; } #ifdef CFISH_USE_SHORT_NAMES #define ClassIVARS cfish_ClassIVARS #define Class_IVARS cfish_Class_IVARS #endif struct cfish_Class { CFISH_OBJ_HEAD cfish_Class* klass; cfish_Class* parent; cfish_String* name; cfish_String* name_internal; uint32_t flags; const cfish_ParcelSpec* parcel_spec; uint32_t obj_alloc_size; uint32_t class_alloc_size; void* host_type; cfish_Method** methods; cfish_method_t vtable[1]; }; #endif /* C_CFISH_CLASS */ /* Declare this class's inert variables. */ extern CFISH_VISIBLE uint32_t cfish_Class_offset_of_parent; /* Declare both this class's inert functions and the C functions which * implement this class's dynamic methods. */ CFISH_VISIBLE void cfish_Class_bootstrap(const cfish_ParcelSpec* parcel_spec); CFISH_VISIBLE cfish_Class* cfish_Class_singleton(cfish_String* class_name, cfish_Class* parent); CFISH_VISIBLE bool cfish_Class_add_to_registry(cfish_Class* klass); CFISH_VISIBLE bool cfish_Class_add_alias_to_registry(cfish_Class* klass, const char* alias_ptr, size_t alias_len); CFISH_VISIBLE void cfish_Class_init_registry(void); CFISH_VISIBLE void cfish_Class_register_with_host(cfish_Class* klass, cfish_Class* parent); CFISH_VISIBLE cfish_Class* cfish_Class_fetch_class(cfish_String* class_name); CFISH_VISIBLE cfish_String* cfish_Class_find_parent_class(cfish_String* class_name); CFISH_VISIBLE cfish_Vector* cfish_Class_fresh_host_methods(cfish_String* class_name); void CFISH_Class_Override_IMP(cfish_Class* self, cfish_method_t method_ptr, uint32_t offset); cfish_Obj* CFISH_Class_Make_Obj_IMP(cfish_Class* self); cfish_Obj* CFISH_Class_Init_Obj_IMP(cfish_Class* self, void* allocation); void CFISH_Class_Add_Host_Method_Alias_IMP(cfish_Class* self, const char* alias, const char* meth_name); void CFISH_Class_Exclude_Host_Method_IMP(cfish_Class* self, const char* meth_name); cfish_String* CFISH_Class_Get_Name_IMP(cfish_Class* self); cfish_Class* CFISH_Class_Get_Parent_IMP(cfish_Class* self); uint32_t CFISH_Class_Get_Obj_Alloc_Size_IMP(cfish_Class* self); cfish_Vector* CFISH_Class_Get_Methods_IMP(cfish_Class* self); void CFISH_Class_Destroy_IMP(cfish_Class* self); /* Define typedefs for each dynamic method, allowing us to cast generic * pointers to the appropriate function pointer type more cleanly. */ typedef void* (*CFISH_Class_To_Host_t)(cfish_Class* self, void* vcache); typedef cfish_Obj* (*CFISH_Class_Clone_t)(cfish_Class* self); typedef bool (*CFISH_Class_Equals_t)(cfish_Class* self, cfish_Obj* other); typedef int32_t (*CFISH_Class_Compare_To_t)(cfish_Class* self, cfish_Obj* other); typedef void (*CFISH_Class_Destroy_t)(cfish_Class* self); typedef cfish_String* (*CFISH_Class_To_String_t)(cfish_Class* self); typedef void (*CFISH_Class_Override_t)(cfish_Class* self, cfish_method_t method_ptr, uint32_t offset); typedef cfish_Obj* (*CFISH_Class_Make_Obj_t)(cfish_Class* self); typedef cfish_Obj* (*CFISH_Class_Init_Obj_t)(cfish_Class* self, void* allocation); typedef void (*CFISH_Class_Add_Host_Method_Alias_t)(cfish_Class* self, const char* alias, const char* meth_name); typedef void (*CFISH_Class_Exclude_Host_Method_t)(cfish_Class* self, const char* meth_name); typedef cfish_String* (*CFISH_Class_Get_Name_t)(cfish_Class* self); typedef cfish_Class* (*CFISH_Class_Get_Parent_t)(cfish_Class* self); typedef uint32_t (*CFISH_Class_Get_Obj_Alloc_Size_t)(cfish_Class* self); typedef cfish_Vector* (*CFISH_Class_Get_Methods_t)(cfish_Class* self); /* Define type-safe wrappers for inert functions of Obj. */ static CFISH_INLINE cfish_Class* cfish_Class_get_class(cfish_Class *self) { return cfish_Obj_get_class((cfish_Obj*)self); } static CFISH_INLINE cfish_String* cfish_Class_get_class_name(cfish_Class *self) { return cfish_Obj_get_class_name((cfish_Obj*)self); } static CFISH_INLINE bool cfish_Class_is_a(cfish_Class *self, cfish_Class *ancestor) { return cfish_Obj_is_a((cfish_Obj*)self, ancestor); } /* Define the inline functions which implement this class's virtual methods. */ extern CFISH_VISIBLE uint32_t CFISH_Class_To_Host_OFFSET; static CFISH_INLINE void* CFISH_Class_To_Host(cfish_Class* self, void* vcache) { #ifdef CFP_CFISH return CFISH_Obj_To_Host_IMP((cfish_Obj*)self, vcache); #else const CFISH_Class_To_Host_t method = (CFISH_Class_To_Host_t)cfish_obj_method(self, CFISH_Class_To_Host_OFFSET); return method(self, vcache); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Clone_OFFSET; static CFISH_INLINE cfish_Obj* CFISH_Class_Clone(cfish_Class* self) { #ifdef CFP_CFISH return CFISH_Obj_Clone_IMP((cfish_Obj*)self); #else const CFISH_Class_Clone_t method = (CFISH_Class_Clone_t)cfish_obj_method(self, CFISH_Class_Clone_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Equals_OFFSET; static CFISH_INLINE bool CFISH_Class_Equals(cfish_Class* self, cfish_Obj* other) { #ifdef CFP_CFISH return CFISH_Obj_Equals_IMP((cfish_Obj*)self, other); #else const CFISH_Class_Equals_t method = (CFISH_Class_Equals_t)cfish_obj_method(self, CFISH_Class_Equals_OFFSET); return method(self, other); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Compare_To_OFFSET; static CFISH_INLINE int32_t CFISH_Class_Compare_To(cfish_Class* self, cfish_Obj* other) { #ifdef CFP_CFISH return CFISH_Obj_Compare_To_IMP((cfish_Obj*)self, other); #else const CFISH_Class_Compare_To_t method = (CFISH_Class_Compare_To_t)cfish_obj_method(self, CFISH_Class_Compare_To_OFFSET); return method(self, other); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Destroy_OFFSET; static CFISH_INLINE void CFISH_Class_Destroy(cfish_Class* self) { #ifdef CFP_CFISH CFISH_Class_Destroy_IMP(self); #else const CFISH_Class_Destroy_t method = (CFISH_Class_Destroy_t)cfish_obj_method(self, CFISH_Class_Destroy_OFFSET); method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_To_String_OFFSET; static CFISH_INLINE cfish_String* CFISH_Class_To_String(cfish_Class* self) { #ifdef CFP_CFISH return CFISH_Obj_To_String_IMP((cfish_Obj*)self); #else const CFISH_Class_To_String_t method = (CFISH_Class_To_String_t)cfish_obj_method(self, CFISH_Class_To_String_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Override_OFFSET; static CFISH_INLINE void CFISH_Class_Override(cfish_Class* self, cfish_method_t method_ptr, uint32_t offset) { #ifdef CFP_CFISH CFISH_Class_Override_IMP(self, method_ptr, offset); #else const CFISH_Class_Override_t method = (CFISH_Class_Override_t)cfish_obj_method(self, CFISH_Class_Override_OFFSET); method(self, method_ptr, offset); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Make_Obj_OFFSET; static CFISH_INLINE cfish_Obj* CFISH_Class_Make_Obj(cfish_Class* self) { #ifdef CFP_CFISH return CFISH_Class_Make_Obj_IMP(self); #else const CFISH_Class_Make_Obj_t method = (CFISH_Class_Make_Obj_t)cfish_obj_method(self, CFISH_Class_Make_Obj_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Init_Obj_OFFSET; static CFISH_INLINE cfish_Obj* CFISH_Class_Init_Obj(cfish_Class* self, void* allocation) { #ifdef CFP_CFISH return CFISH_Class_Init_Obj_IMP(self, allocation); #else const CFISH_Class_Init_Obj_t method = (CFISH_Class_Init_Obj_t)cfish_obj_method(self, CFISH_Class_Init_Obj_OFFSET); return method(self, allocation); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Add_Host_Method_Alias_OFFSET; static CFISH_INLINE void CFISH_Class_Add_Host_Method_Alias(cfish_Class* self, const char* alias, const char* meth_name) { #ifdef CFP_CFISH CFISH_Class_Add_Host_Method_Alias_IMP(self, alias, meth_name); #else const CFISH_Class_Add_Host_Method_Alias_t method = (CFISH_Class_Add_Host_Method_Alias_t)cfish_obj_method(self, CFISH_Class_Add_Host_Method_Alias_OFFSET); method(self, alias, meth_name); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Exclude_Host_Method_OFFSET; static CFISH_INLINE void CFISH_Class_Exclude_Host_Method(cfish_Class* self, const char* meth_name) { #ifdef CFP_CFISH CFISH_Class_Exclude_Host_Method_IMP(self, meth_name); #else const CFISH_Class_Exclude_Host_Method_t method = (CFISH_Class_Exclude_Host_Method_t)cfish_obj_method(self, CFISH_Class_Exclude_Host_Method_OFFSET); method(self, meth_name); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Get_Name_OFFSET; static CFISH_INLINE cfish_String* CFISH_Class_Get_Name(cfish_Class* self) { #ifdef CFP_CFISH return CFISH_Class_Get_Name_IMP(self); #else const CFISH_Class_Get_Name_t method = (CFISH_Class_Get_Name_t)cfish_obj_method(self, CFISH_Class_Get_Name_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Get_Parent_OFFSET; static CFISH_INLINE cfish_Class* CFISH_Class_Get_Parent(cfish_Class* self) { #ifdef CFP_CFISH return CFISH_Class_Get_Parent_IMP(self); #else const CFISH_Class_Get_Parent_t method = (CFISH_Class_Get_Parent_t)cfish_obj_method(self, CFISH_Class_Get_Parent_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Get_Obj_Alloc_Size_OFFSET; static CFISH_INLINE uint32_t CFISH_Class_Get_Obj_Alloc_Size(cfish_Class* self) { #ifdef CFP_CFISH return CFISH_Class_Get_Obj_Alloc_Size_IMP(self); #else const CFISH_Class_Get_Obj_Alloc_Size_t method = (CFISH_Class_Get_Obj_Alloc_Size_t)cfish_obj_method(self, CFISH_Class_Get_Obj_Alloc_Size_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Class_Get_Methods_OFFSET; static CFISH_INLINE cfish_Vector* CFISH_Class_Get_Methods(cfish_Class* self) { #ifdef CFP_CFISH return CFISH_Class_Get_Methods_IMP(self); #else const CFISH_Class_Get_Methods_t method = (CFISH_Class_Get_Methods_t)cfish_obj_method(self, CFISH_Class_Get_Methods_OFFSET); return method(self); #endif } /* Declare callbacks for wrapping host overrides. */ #ifdef CFISH_NO_DYNAMIC_OVERRIDES #else #endif /* Define "short names" for this class's symbols. */ #ifdef CFISH_USE_SHORT_NAMES #define Class cfish_Class #define CLASS CFISH_CLASS #define Class_bootstrap cfish_Class_bootstrap #define Class_singleton cfish_Class_singleton #define Class_add_to_registry cfish_Class_add_to_registry #define Class_add_alias_to_registry cfish_Class_add_alias_to_registry #define Class_init_registry cfish_Class_init_registry #define Class_register_with_host cfish_Class_register_with_host #define Class_fetch_class cfish_Class_fetch_class #define Class_find_parent_class cfish_Class_find_parent_class #define Class_fresh_host_methods cfish_Class_fresh_host_methods #define Class_offset_of_parent cfish_Class_offset_of_parent #define Class_get_class cfish_Class_get_class #define Class_get_class_name cfish_Class_get_class_name #define Class_is_a cfish_Class_is_a #define Class_Override_IMP CFISH_Class_Override_IMP #define Class_Make_Obj_IMP CFISH_Class_Make_Obj_IMP #define Class_Init_Obj_IMP CFISH_Class_Init_Obj_IMP #define Class_Add_Host_Method_Alias_IMP CFISH_Class_Add_Host_Method_Alias_IMP #define Class_Exclude_Host_Method_IMP CFISH_Class_Exclude_Host_Method_IMP #define Class_Get_Name_IMP CFISH_Class_Get_Name_IMP #define Class_Get_Parent_IMP CFISH_Class_Get_Parent_IMP #define Class_Get_Obj_Alloc_Size_IMP CFISH_Class_Get_Obj_Alloc_Size_IMP #define Class_Get_Methods_IMP CFISH_Class_Get_Methods_IMP #define Class_Destroy_IMP CFISH_Class_Destroy_IMP #define Class_To_Host CFISH_Class_To_Host #define Class_To_Host_t CFISH_Class_To_Host_t #define Class_Clone CFISH_Class_Clone #define Class_Clone_t CFISH_Class_Clone_t #define Class_Equals CFISH_Class_Equals #define Class_Equals_t CFISH_Class_Equals_t #define Class_Compare_To CFISH_Class_Compare_To #define Class_Compare_To_t CFISH_Class_Compare_To_t #define Class_Destroy CFISH_Class_Destroy #define Class_Destroy_t CFISH_Class_Destroy_t #define Class_To_String CFISH_Class_To_String #define Class_To_String_t CFISH_Class_To_String_t #define Class_Override CFISH_Class_Override #define Class_Override_t CFISH_Class_Override_t #define Class_Make_Obj CFISH_Class_Make_Obj #define Class_Make_Obj_t CFISH_Class_Make_Obj_t #define Class_Init_Obj CFISH_Class_Init_Obj #define Class_Init_Obj_t CFISH_Class_Init_Obj_t #define Class_Add_Host_Method_Alias CFISH_Class_Add_Host_Method_Alias #define Class_Add_Host_Method_Alias_t CFISH_Class_Add_Host_Method_Alias_t #define Class_Exclude_Host_Method CFISH_Class_Exclude_Host_Method #define Class_Exclude_Host_Method_t CFISH_Class_Exclude_Host_Method_t #define Class_Get_Name CFISH_Class_Get_Name #define Class_Get_Name_t CFISH_Class_Get_Name_t #define Class_Get_Parent CFISH_Class_Get_Parent #define Class_Get_Parent_t CFISH_Class_Get_Parent_t #define Class_Get_Obj_Alloc_Size CFISH_Class_Get_Obj_Alloc_Size #define Class_Get_Obj_Alloc_Size_t CFISH_Class_Get_Obj_Alloc_Size_t #define Class_Get_Methods CFISH_Class_Get_Methods #define Class_Get_Methods_t CFISH_Class_Get_Methods_t #endif /* CFISH_USE_SHORT_NAMES */ #define CFISH_ALLOCA_OBJ(class) \ cfish_alloca(CFISH_Class_Get_Obj_Alloc_Size(class)) /** Bootstrapping hook/hack needed by the Python bindings. * * TODO: Refactor this away in favor of a more general solution. */ typedef void (*cfish_Class_bootstrap_hook1_t)(cfish_Class *self); extern cfish_Class_bootstrap_hook1_t cfish_Class_bootstrap_hook1; #ifdef __cplusplus } #endif #endif /* H_CLOWNFISH_CLASS */