- Timestamp:
- May 17, 2021, 11:43:49 AM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 90a10e8
- Parents:
- fc1347d0
- Location:
- libcfa/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/exception.c
rfc1347d0 r8f910430 48 48 49 49 // Base Exception type id: 50 struct __cfa __parent_vtable__cfatid_exception_t = {50 struct __cfavir_type_info __cfatid_exception_t = { 51 51 NULL, 52 52 }; -
libcfa/src/exception.h
rfc1347d0 r8f910430 29 29 struct __cfaehm_base_exception_t; 30 30 typedef struct __cfaehm_base_exception_t exception_t; 31 struct __cfa __parent_vtable;31 struct __cfavir_type_info; 32 32 struct __cfaehm_base_exception_t_vtable { 33 const struct __cfa __parent_vtable* __cfavir_typeid;33 const struct __cfavir_type_info * __cfavir_typeid; 34 34 size_t size; 35 35 void (*copy)(struct __cfaehm_base_exception_t *this, … … 41 41 struct __cfaehm_base_exception_t_vtable const * virtual_table; 42 42 }; 43 extern struct __cfa __parent_vtable__cfatid_exception_t;43 extern struct __cfavir_type_info __cfatid_exception_t; 44 44 45 45 -
libcfa/src/exception.hfa
rfc1347d0 r8f910430 157 157 #define _EHM_TYPE_ID_STRUCT(exception_name, forall_clause) \ 158 158 forall_clause _EHM_TYPE_ID_TYPE(exception_name) { \ 159 __cfa __parent_vtableconst * parent; \159 __cfavir_type_info const * parent; \ 160 160 } 161 161 -
libcfa/src/virtual.c
rfc1347d0 r8f910430 10 10 // Created On : Tus Jul 11 15:10:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jul 26 14:24:00 201713 // Update Count : 112 // Last Modified On : Mon May 17 11:01:00 2021 13 // Update Count : 2 14 14 // 15 15 … … 17 17 #include "assert.h" 18 18 19 int __cfa__is_parent( struct __cfa__parent_vtable const * parent, 20 struct __cfa__parent_vtable const * child ) { 19 int __cfavir_is_parent( 20 __cfavir_type_id parent, 21 __cfavir_type_id child ) { 21 22 assert( child ); 22 23 do { … … 28 29 } 29 30 30 void * __cfa__virtual_cast( struct __cfa__parent_vtable const * parent, 31 struct __cfa__parent_vtable const * const * child ) { 31 void * __cfavir_virtual_cast( 32 __cfavir_type_id parent, 33 __cfavir_type_id const * child ) { 32 34 assert( child ); 33 return (__cfa __is_parent(parent, *child)) ? (void *)child : (void *)0;35 return (__cfavir_is_parent(parent, *child)) ? (void *)child : (void *)0; 34 36 } -
libcfa/src/virtual.h
rfc1347d0 r8f910430 10 10 // Created On : Tus Jul 11 15:08:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jul 26 14:18:00 201713 // Update Count : 112 // Last Modified On : Mon May 17 11:03:00 2021 13 // Update Count : 2 14 14 // 15 15 … … 20 20 #endif 21 21 22 // All strict/explicate vtables should have this head, showing their parent. 23 struct __cfa__parent_vtable { 24 struct __cfa__parent_vtable const * const parent; 22 // Information on a type for the virtual system. 23 // There should be exactly one instance per type and there should be a 24 // pointer to it at the head of every virtual table. 25 struct __cfavir_type_info { 26 // Type id of parent type, null if this is a root type. 27 struct __cfavir_type_info const * const parent; 25 28 }; 26 29 27 // Takes in two non-null pointers to type_objects. 28 int __cfa__is_parent( struct __cfa__parent_vtable const * parent, 29 struct __cfa__parent_vtable const * child ); 30 // A pointer to type information acts as the type id. 31 typedef struct __cfavir_type_info const * __cfavir_type_id; 32 33 // Takes in two non-null type ids. 34 int __cfavir_is_parent( 35 __cfavir_type_id parent, __cfavir_type_id child ); 30 36 31 37 // If parent is a parent of child then return child, otherwise return NULL. 32 38 // Input pointers are none-null, child's first level should be an object with 33 39 // a vtable 34 void * __cfa __virtual_cast( struct __cfa__parent_vtable const * parent,35 struct __cfa__parent_vtable const *const * child );40 void * __cfavir_virtual_cast( 41 __cfavir_type_id parent, __cfavir_type_id const * child ); 36 42 37 43 #ifdef __cforall
Note: See TracChangeset
for help on using the changeset viewer.