ADT
        ast-experimental
        enum
        forall-pointer-decay
        pthread-emulation
        qualifiedEnum
      
      
        
          | 
            Last change
 on this file since 88792f3 was             8f910430, checked in by Andrew Beach <ajbeach@…>, 4 years ago           | 
        
        
          | 
             
Updated the virtual module to prefix the names with the new convention and change the parent_vtable into type_info. 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            838 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 : Mon May 17 11:01:00 2021
 | 
|---|
| 13 | // Update Count     : 2
 | 
|---|
| 14 | //
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include "virtual.h"
 | 
|---|
| 17 | #include "assert.h"
 | 
|---|
| 18 | 
 | 
|---|
| 19 | int __cfavir_is_parent(
 | 
|---|
| 20 |                 __cfavir_type_id parent,
 | 
|---|
| 21 |                 __cfavir_type_id child ) {
 | 
|---|
| 22 |         assert( child );
 | 
|---|
| 23 |         do {
 | 
|---|
| 24 |                 if ( parent == child )
 | 
|---|
| 25 |                         return 1;
 | 
|---|
| 26 |                 child = child->parent;
 | 
|---|
| 27 |         } while ( child );
 | 
|---|
| 28 |         return 0;
 | 
|---|
| 29 | }
 | 
|---|
| 30 | 
 | 
|---|
| 31 | void * __cfavir_virtual_cast(
 | 
|---|
| 32 |                 __cfavir_type_id parent,
 | 
|---|
| 33 |                 __cfavir_type_id const * child ) {
 | 
|---|
| 34 |         assert( child );
 | 
|---|
| 35 |         return (__cfavir_is_parent(parent, *child)) ? (void *)child : (void *)0;
 | 
|---|
| 36 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.