ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 28572e8 was
ecfd758,
checked in by Andrew Beach <ajbeach@…>, 4 years ago
|
Major exception update, seperating type-ids from virtual tables. The major interface changes are done. There is a regression of ?Cancelled(T) to Some?Cancelled. There is some bits of code for the new verion of the ?Cancelled(T) interface already there. Not connected yet but I just reached the limit of what I wanted to do in one commit and then spent over a day cleaning up, so it will replace Some?Cancelled in a future commit.
|
-
Property mode set to
100644
|
File size:
910 bytes
|
Line | |
---|
1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // virtual.c -- |
---|
8 | // |
---|
9 | // Author : Andrew Beach |
---|
10 | // Created On : Tus Jul 11 15:10:00 2017 |
---|
11 | // Last Modified By : Andrew Beach |
---|
12 | // Last Modified On : Wed Jul 26 14:24:00 2017 |
---|
13 | // Update Count : 1 |
---|
14 | // |
---|
15 | |
---|
16 | #include "virtual.h" |
---|
17 | #include "assert.h" |
---|
18 | |
---|
19 | int __cfa__is_parent( struct __cfa__parent_vtable const * parent, |
---|
20 | struct __cfa__parent_vtable const * child ) { |
---|
21 | assert( child ); |
---|
22 | do { |
---|
23 | if ( parent == child ) |
---|
24 | return 1; |
---|
25 | child = child->parent; |
---|
26 | } while ( child ); |
---|
27 | return 0; |
---|
28 | } |
---|
29 | |
---|
30 | void * __cfa__virtual_cast( struct __cfa__parent_vtable const * parent, |
---|
31 | struct __cfa__parent_vtable const * const * child ) { |
---|
32 | assert( child ); |
---|
33 | return (__cfa__is_parent(parent, *child)) ? (void *)child : (void *)0; |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.