Changeset cbce272 for src/tests


Ignore:
Timestamp:
Aug 9, 2017, 2:08:14 PM (8 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
65cdc1e
Parents:
e195093
Message:

Structure based exception handling.

File:
1 edited

Legend:

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

    re195093 rcbce272  
    66#include <stdbool.h>
    77
     8// Local type to mark exits from scopes. (see ERROR)
    89struct signal_exit {
    910        const char * area;
     
    1920}
    2021
    21 void terminate(int except_value) {
     22
     23// Local Exception Types and manual vtable types.
     24//#define TRIVIAL_EXCEPTION(name) //TRIVAL_EXCEPTION(yin)
     25struct yin;
     26struct yin_vtable {
     27        struct exception_t_vtable const * parent;
     28        size_t size;
     29    void (*copy)(yin *this, yin * other);
     30    void (*free)(yin *this);
     31    const char (*msg)(yin *this);
     32};
     33struct yin {
     34        struct yin_vtable const * parent;
     35};
     36void yin_msg(yin) {
     37        return "in";
     38}
     39yin_vtable _yin_vtable_instance = {
     40        &_exception_t_vtable_instance, sizeof(yin), ?{}, ^?{}, yin_msg
     41}
     42
     43
     44void terminate(exception * except_value) {
    2245        signal_exit a = {"terminate function"};
    2346        throw except_value;
     
    2548}
    2649
    27 void resume(int except_value) {
     50void resume(exception * except_value) {
    2851        signal_exit a = {"resume function"};
    2952        throwResume except_value;
Note: See TracChangeset for help on using the changeset viewer.