ADT
        ast-experimental
        enum
        forall-pointer-decay
        pthread-emulation
        qualifiedEnum
      
      
        
          | 
            Last change
 on this file since 4177592f 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
           | 
        
      
      
| Rev | Line |   | 
|---|
| [a5f0529] | 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
 | 
|---|
| [8f910430] | 12 | // Last Modified On : Mon May 17 11:01:00 2021
 | 
|---|
 | 13 | // Update Count     : 2
 | 
|---|
| [a5f0529] | 14 | //
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | #include "virtual.h"
 | 
|---|
| [ecfd758] | 17 | #include "assert.h"
 | 
|---|
| [a5f0529] | 18 | 
 | 
|---|
| [8f910430] | 19 | int __cfavir_is_parent(
 | 
|---|
 | 20 |                 __cfavir_type_id parent,
 | 
|---|
 | 21 |                 __cfavir_type_id child ) {
 | 
|---|
| [ecfd758] | 22 |         assert( child );
 | 
|---|
| [a5f0529] | 23 |         do {
 | 
|---|
 | 24 |                 if ( parent == child )
 | 
|---|
 | 25 |                         return 1;
 | 
|---|
 | 26 |                 child = child->parent;
 | 
|---|
 | 27 |         } while ( child );
 | 
|---|
 | 28 |         return 0;
 | 
|---|
 | 29 | }
 | 
|---|
 | 30 | 
 | 
|---|
| [8f910430] | 31 | void * __cfavir_virtual_cast(
 | 
|---|
 | 32 |                 __cfavir_type_id parent,
 | 
|---|
 | 33 |                 __cfavir_type_id const * child ) {
 | 
|---|
| [ecfd758] | 34 |         assert( child );
 | 
|---|
| [8f910430] | 35 |         return (__cfavir_is_parent(parent, *child)) ? (void *)child : (void *)0;
 | 
|---|
| [a5f0529] | 36 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.