Ignore:
Timestamp:
May 26, 2022, 10:21:17 AM (19 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
5416b44
Parents:
c715e5f
Message:

Clean-up the exception interface. It should be slightly more like the final - non-macro - interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/exception.hfa

    rc715e5f rc3b9d639  
    1818// -----------------------------------------------------------------------------------------------
    1919
    20 // EHM_DEFAULT_VTABLE(exception_name, (arguments))
     20// EHM_DEFAULT_VTABLE(exception_type)
    2121// Create a declaration for a (possibly polymorphic) default vtable.
    22 #define EHM_DEFAULT_VTABLE(exception_name, arguments) \
    23         vtable(exception_name arguments) & const _default_vtable
     22// Mostly used by and for the currency module.
     23#define EHM_DEFAULT_VTABLE(type) vtable(type) & const _default_vtable
    2424
    25 // IS_EXCEPTION(exception_name [, (...parameters)])
    26 // IS_RESUMPTION_EXCEPTION(exception_name [, (parameters...)])
    27 // IS_TERMINATION_EXCEPTION(exception_name [, (parameters...)])
    28 // Create an assertion that exception_name, possibly with the qualifing parameters, is the given
    29 // kind of exception with the standard vtable with the same parameters if applicable.
    30 #define IS_EXCEPTION(...) _IS_EXCEPTION(is_exception, __VA_ARGS__, , ~)
    31 #define IS_RESUMPTION_EXCEPTION(...) _IS_EXCEPTION(is_resumption_exception, __VA_ARGS__, , ~)
    32 #define IS_TERMINATION_EXCEPTION(...) _IS_EXCEPTION(is_termination_exception, __VA_ARGS__, , ~)
    33 #define _IS_EXCEPTION(kind, exception_name, parameters, ...) \
    34         kind(exception_name parameters, vtable(exception_name parameters))
     25// IS_EXCEPTION(exception_type)
     26// IS_RESUMPTION_EXCEPTION(exception_type)
     27// IS_TERMINATION_EXCEPTION(exception_type)
     28// Create an assertion that exception_type is the given kind of exception.
     29// This is used to mimic associated types so the vtable type is unmentioned.
     30#define IS_EXCEPTION(type) is_exception(type, vtable(type))
     31#define IS_RESUMPTION_EXCEPTION(type) is_resumption_exception(type, vtable(type))
     32#define IS_TERMINATION_EXCEPTION(type) is_termination_exception(type, vtable(type))
Note: See TracChangeset for help on using the changeset viewer.