File Coverage

autogen/include/cfish_parcel.h
Criterion Covered Total %
statement 4 4 100.0
branch 2 6 33.3
condition n/a
subroutine n/a
pod n/a
total 6 10 60.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 CFISH_CFISH_PARCEL_H #define CFISH_CFISH_PARCEL_H 1 #ifdef __cplusplus extern "C" { #endif #include <stdarg.h> #include <stddef.h> #include "cfish_platform.h" #include "cfish_hostdefs.h" #ifdef CFP_CFISH #define CFISH_VISIBLE CFISH_EXPORT #else #define CFISH_VISIBLE CFISH_IMPORT #endif typedef struct cfish_Obj cfish_Obj; typedef struct cfish_Blob cfish_Blob; typedef struct cfish_TestSuiteRunner cfish_TestSuiteRunner; typedef struct cfish_TestBatchRunner cfish_TestBatchRunner; typedef struct cfish_TestSuite cfish_TestSuite; typedef struct cfish_TestBatch cfish_TestBatch; typedef struct cfish_TestFormatter cfish_TestFormatter; typedef struct cfish_TestFormatterCF cfish_TestFormatterCF; typedef struct cfish_TestFormatterTAP cfish_TestFormatterTAP; typedef struct cfish_Float cfish_Float; typedef struct cfish_Integer cfish_Integer; typedef struct cfish_Vector cfish_Vector; typedef struct cfish_Hash cfish_Hash; typedef struct cfish_Class cfish_Class; typedef struct cfish_ByteBuf cfish_ByteBuf; typedef struct cfish_CharBuf cfish_CharBuf; typedef struct cfish_Boolean cfish_Boolean; typedef struct cfish_HashIterator cfish_HashIterator; typedef struct cfish_Method cfish_Method; typedef struct cfish_String cfish_String; typedef struct cfish_StringIterator cfish_StringIterator; typedef struct cfish_Err cfish_Err; extern CFISH_VISIBLE cfish_Class *CFISH_OBJ; extern CFISH_VISIBLE cfish_Class *CFISH_BLOB; extern CFISH_VISIBLE cfish_Class *CFISH_TESTSUITERUNNER; extern CFISH_VISIBLE cfish_Class *CFISH_TESTBATCHRUNNER; extern CFISH_VISIBLE cfish_Class *CFISH_TESTSUITE; extern CFISH_VISIBLE cfish_Class *CFISH_TESTBATCH; extern CFISH_VISIBLE cfish_Class *CFISH_TESTFORMATTER; extern CFISH_VISIBLE cfish_Class *CFISH_TESTFORMATTERCF; extern CFISH_VISIBLE cfish_Class *CFISH_TESTFORMATTERTAP; extern CFISH_VISIBLE cfish_Class *CFISH_FLOAT; extern CFISH_VISIBLE cfish_Class *CFISH_INTEGER; extern CFISH_VISIBLE cfish_Class *CFISH_VECTOR; extern CFISH_VISIBLE cfish_Class *CFISH_HASH; extern CFISH_VISIBLE cfish_Class *CFISH_CLASS; extern CFISH_VISIBLE cfish_Class *CFISH_BYTEBUF; extern CFISH_VISIBLE cfish_Class *CFISH_CHARBUF; extern CFISH_VISIBLE cfish_Class *CFISH_BOOLEAN; extern CFISH_VISIBLE cfish_Class *CFISH_HASHITERATOR; extern CFISH_VISIBLE cfish_Class *CFISH_METHOD; extern CFISH_VISIBLE cfish_Class *CFISH_STRING; extern CFISH_VISIBLE cfish_Class *CFISH_STRINGITERATOR; extern CFISH_VISIBLE cfish_Class *CFISH_ERR; #define CFISH_UNUSED_VAR(var) ((void)var) #define CFISH_UNREACHABLE_RETURN(type) return (type)0 /* Generic method pointer. */ typedef void (*cfish_method_t)(const void *vself); /* Access the function pointer for a given method from the class. */ #define CFISH_METHOD_PTR(_class, _full_meth) \ ((_full_meth ## _t)cfish_method(_class, _full_meth ## _OFFSET)) static CFISH_INLINE cfish_method_t cfish_method(const void *klass, uint32_t offset) { union { char *cptr; cfish_method_t *fptr; } ptr; ptr.cptr = (char*)klass + offset; return ptr.fptr[0]; } typedef struct cfish_Dummy { CFISH_OBJ_HEAD void *klass; } cfish_Dummy; /* Access the function pointer for a given method from the object. */ static CFISH_INLINE cfish_method_t cfish_obj_method(const void *object, uint32_t offset) { cfish_Dummy *dummy = (cfish_Dummy*)object; return cfish_method(dummy->klass, offset); } /* Access the function pointer for the given method in the * superclass. */ #define CFISH_SUPER_METHOD_PTR(_class, _full_meth) \ ((_full_meth ## _t)cfish_super_method(_class, \ _full_meth ## _OFFSET)) extern CFISH_VISIBLE uint32_t cfish_Class_offset_of_parent; static CFISH_INLINE cfish_method_t cfish_super_method(const void *klass, uint32_t offset) { char *class_as_char = (char*)klass; cfish_Class **parent_ptr = (cfish_Class**)(class_as_char + cfish_Class_offset_of_parent); return cfish_method(*parent_ptr, offset); } typedef void (*cfish_destroy_t)(void *vself); extern CFISH_VISIBLE uint32_t CFISH_Obj_Destroy_OFFSET; /** Invoke the [](.Destroy) method found in `klass` on * `self`. * * TODO: Eliminate this function if we can arrive at a proper SUPER syntax. */ static CFISH_INLINE void cfish_super_destroy(void *vself, cfish_Class *klass) { cfish_Obj *self = (cfish_Obj*)vself; if (self != NULL) { cfish_destroy_t super_destroy = (cfish_destroy_t)cfish_super_method(klass, CFISH_Obj_Destroy_OFFSET); super_destroy(self); } } #define CFISH_SUPER_DESTROY(_self, _class) \ cfish_super_destroy(_self, _class) extern CFISH_VISIBLE cfish_Obj* cfish_inc_refcount(void *vself); /** NULL-safe invocation invocation of `cfish_inc_refcount`. * * @return NULL if `self` is NULL, otherwise the return value * of `cfish_inc_refcount`. */ static CFISH_INLINE cfish_Obj* cfish_incref(void *vself) { if (vself != NULL) { return cfish_inc_refcount(vself); } else { return NULL; } } #define CFISH_INCREF(_self) cfish_incref(_self) #define CFISH_INCREF_NN(_self) cfish_inc_refcount(_self) extern CFISH_VISIBLE uint32_t cfish_dec_refcount(void *vself); /** NULL-safe invocation of `cfish_dec_refcount`. * * @return NULL if `self` is NULL, otherwise the return value * of `cfish_dec_refcount`. */ static CFISH_INLINE uint32_t cfish_decref(void *vself) { if (vself != NULL) { return cfish_dec_refcount(vself); } else { return 0; } } #define CFISH_DECREF(_self) cfish_decref(_self) #define CFISH_DECREF_NN(_self) cfish_dec_refcount(_self) extern CFISH_VISIBLE uint32_t cfish_get_refcount(void *vself); #define CFISH_REFCOUNT_NN(_self) \ cfish_get_refcount(_self) /* Flags for internal use. */ #define CFISH_fREFCOUNTSPECIAL 0x00000001 #define CFISH_fFINAL 0x00000002 /* Structs for Class initialization. */ typedef struct cfish_NovelMethSpec { uint32_t *offset; const char *name; cfish_method_t func; cfish_method_t callback_func; } cfish_NovelMethSpec; typedef struct cfish_OverriddenMethSpec { uint32_t *offset; uint32_t *parent_offset; cfish_method_t func; } cfish_OverriddenMethSpec; typedef struct cfish_InheritedMethSpec { uint32_t *offset; uint32_t *parent_offset; } cfish_InheritedMethSpec; typedef enum { cfish_ClassSpec_FINAL = 1 } cfish_ClassSpecFlags; typedef struct cfish_ClassSpec { cfish_Class **klass; cfish_Class **parent; const char *name; uint32_t ivars_size; uint32_t *ivars_offset_ptr; uint32_t num_novel_meths; uint32_t num_overridden_meths; uint32_t num_inherited_meths; uint32_t flags; } cfish_ClassSpec; typedef struct cfish_ParcelSpec { const cfish_ClassSpec *class_specs; const cfish_NovelMethSpec *novel_specs; const cfish_OverriddenMethSpec *overridden_specs; const cfish_InheritedMethSpec *inherited_specs; uint32_t num_classes; } cfish_ParcelSpec; #ifdef CFISH_USE_SHORT_NAMES #define UNUSED_VAR CFISH_UNUSED_VAR #define UNREACHABLE_RETURN CFISH_UNREACHABLE_RETURN #define METHOD_PTR CFISH_METHOD_PTR #define SUPER_METHOD_PTR CFISH_SUPER_METHOD_PTR #define SUPER_DESTROY(_self, _class) CFISH_SUPER_DESTROY(_self, _class) #define INCREF(_self) CFISH_INCREF(_self) #define INCREF_NN(_self) CFISH_INCREF_NN(_self) #define DECREF(_self) CFISH_DECREF(_self) #define DECREF_NN(_self) CFISH_DECREF_NN(_self) #define REFCOUNT_NN(_self) CFISH_REFCOUNT_NN(_self) #endif CFISH_VISIBLE void cfish_bootstrap_internal(int force); CFISH_VISIBLE void cfish_bootstrap_parcel(void); void cfish_init_parcel(void); #ifdef __cplusplus } #endif #endif /* CFISH_CFISH_PARCEL_H */