Ignore:
Timestamp:
Oct 28, 2020, 3:40:46 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
936d95c
Parents:
1be1e5a
Message:

Attempt to clean-up the exception headers. I think this is easier to follow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/exception.h

    r1be1e5a rc960331  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // exception.h -- Builtins for exception handling.
     7// exception.h -- Internal exception handling definitions.
    88//
    99// Author           : Andrew Beach
    1010// Created On       : Mon Jun 26 15:11:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue May 19 14:17:00 2020
    13 // Update Count     : 10
     12// Last Modified On : Tue Oct 27 14:45:00 2020
     13// Update Count     : 11
    1414//
    1515
    1616#pragma once
    1717
     18// This could be considered several headers. All are internal to the exception
     19// system but needed to depending on whether they are C/Cforall code and
     20// whether or not they are part of the builtins.
    1821
    1922#ifdef __cforall
    2023extern "C" {
    2124#endif
     25
     26// Included in C code or the built-ins.
     27#if !defined(__cforall) || defined(__cforall_builtins__)
    2228
    2329struct __cfaehm_base_exception_t;
     
    4753// Function catches termination exceptions.
    4854void __cfaehm_try_terminate(
    49     void (*try_block)(),
    50     void (*catch_block)(int index, exception_t * except),
    51     int (*match_block)(exception_t * except));
     55        void (*try_block)(),
     56        void (*catch_block)(int index, exception_t * except),
     57        int (*match_block)(exception_t * except));
    5258
    5359// Clean-up the exception in catch blocks.
     
    5662// Data structure creates a list of resume handlers.
    5763struct __cfaehm_try_resume_node {
    58     struct __cfaehm_try_resume_node * next;
    59     _Bool (*handler)(exception_t * except);
     64        struct __cfaehm_try_resume_node * next;
     65        _Bool (*handler)(exception_t * except);
    6066};
    6167
    6268// These act as constructor and destructor for the resume node.
    6369void __cfaehm_try_resume_setup(
    64     struct __cfaehm_try_resume_node * node,
    65     _Bool (*handler)(exception_t * except));
     70        struct __cfaehm_try_resume_node * node,
     71        _Bool (*handler)(exception_t * except));
    6672void __cfaehm_try_resume_cleanup(
    67     struct __cfaehm_try_resume_node * node);
     73        struct __cfaehm_try_resume_node * node);
    6874
    6975// Check for a standard way to call fake deconstructors.
    7076struct __cfaehm_cleanup_hook {};
    7177
     78#endif
     79
     80// Included in C code and the library.
     81#if !defined(__cforall) || !defined(__cforall_builtins__)
     82struct __cfaehm_node {
     83        struct _Unwind_Exception unwind_exception;
     84        struct __cfaehm_node * next;
     85        int handler_index;
     86};
     87
     88static inline exception_t * __cfaehm_cancellation_exception(
     89                struct _Unwind_Exception * unwind_exception ) {
     90        return (exception_t *)(1 + (struct __cfaehm_node *)unwind_exception);
     91}
     92#endif
     93
    7294#ifdef __cforall
    7395}
     96
     97// Built-ins not visible in C.
     98#if defined(__cforall_builtins__)
    7499
    75100// Not all the built-ins can be expressed in C. These can't be
     
    124149
    125150#endif
     151
     152#endif
Note: See TracChangeset for help on using the changeset viewer.