Ignore:
Timestamp:
Aug 14, 2017, 2:44:40 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
6a36975
Parents:
bd46af4
Message:

Working on exception related readablility.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/except-2.c

    rbd46af4 r406a6e6  
    55
    66// Local Exception Types and manual vtable types.
     7#define GLUE2(left, right) left##right
     8#define GLUE3(left, middle, right) left##middle##right
    79#define BASE_EXCEPT __cfaehm__base_exception_t
    8 #define TABLE(name) name##_vtable
    9 #define INSTANCE(name) _##name##_vtable_instance
     10#define TABLE(name) GLUE2(name,_vtable)
     11#define INSTANCE(name) GLUE3(_,name,_vtable_instance)
    1012#define TRIVIAL_EXCEPTION(name) \
    1113struct name; \
    1214struct TABLE(name) { \
    13         struct __cfaehm__base_exception_t_vtable const * parent; \
     15        struct TABLE(BASE_EXCEPT) const * parent; \
    1416        size_t size; \
    1517        void (*copy)(name *this, name * other); \
     
    2830} \
    2931TABLE(name) INSTANCE(name) @= { \
    30         .parent : &INSTANCE(__cfaehm__base_exception_t), \
     32        .parent : &INSTANCE(BASE_EXCEPT), \
    3133        .size : sizeof(name), .copy : name##_copy, \
    3234        .free : ^?{}, .msg : name##_msg \
     
    4042struct num_error;
    4143struct num_error_vtable {
    42         struct exception_t_vtable const * parent;
     44        struct TABLE(BASE_EXCEPT) const * parent;
    4345        size_t size;
    4446        void (*copy)(num_error *this, num_error * other);
     
    6264}
    6365void ?{}(num_error * this, int num) {
    64         this->virtual_table = &_num_error_vtable_instance;
     66        this->virtual_table = &INSTANCE(num_error);
    6567        this->msg = 0;
    6668        this->num = num;
Note: See TracChangeset for help on using the changeset viewer.