Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions | Variables
except.h File Reference
#include <glib.h>
#include <setjmp.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include "ws_symbol_export.h"
#include "ws_attributes.h"

Go to the source code of this file.

Classes

struct  except_id_t
 
struct  except_t
 
struct  except_cleanup
 
struct  except_catch
 
struct  except_stacknode
 

Macros

#define XCEPT_GROUP_ANY   0
 
#define XCEPT_CODE_ANY   0
 
#define XCEPT_BAD_ALLOC   1
 
#define except_code(E)   ((E)->except_id.except_code)
 
#define except_group(E)   ((E)->except_id.except_group)
 
#define except_message(E)   ((E)->except_message)
 
#define except_data(E)   ((E)->except_dyndata)
 
#define except_cleanup_push(F, C)
 
#define except_cleanup_pop(E)
 
#define except_checked_cleanup_pop(F, E)
 
#define except_cleanup_push_pfx(pfx, F, C)
 
#define except_cleanup_pop_pfx(pfx, E)
 
#define except_checked_cleanup_pop_pfx(pfx, F, E)
 
#define except_try_push(ID, NUM, PPE)
 
#define except_try_pop()
 

Enumerations

enum  { except_no_call , except_call }
 
enum  except_stacktype { XCEPT_CLEANUP , XCEPT_CATCHER }
 

Functions

void except_setup_clean (struct except_stacknode *, struct except_cleanup *, void(*)(void *), void *)
 
WS_DLL_PUBLIC void except_setup_try (struct except_stacknode *, struct except_catch *, const except_id_t[], size_t)
 
WS_DLL_PUBLIC struct except_stacknodeexcept_pop (void)
 
WS_DLL_PUBLIC int except_init (void)
 
WS_DLL_PUBLIC void except_deinit (void)
 
WS_DLL_PUBLIC WS_NORETURN void except_rethrow (except_t *)
 
WS_DLL_PUBLIC WS_NORETURN void except_throw (long, long, const char *)
 
WS_DLL_PUBLIC WS_NORETURN void except_throwd (long, long, const char *, void *)
 
WS_DLL_PUBLIC WS_NORETURN void except_vthrowf (long group, long code, const char *fmt, va_list vl)
 
WS_DLL_PUBLIC WS_NORETURN void except_throwf (long, long, const char *,...) G_GNUC_PRINTF(3
 
unsigned long except_code (except_t *)
 
unsigned long except_group (except_t *)
 
const char * except_message (except_t *)
 
void * except_data (except_t *)
 
WS_DLL_PUBLIC void * except_take_data (except_t *)
 
WS_DLL_PUBLIC void except_set_allocator (void *(*)(size_t), void(*)(void *))
 
WS_DLL_PUBLIC void * except_alloc (size_t)
 
WS_DLL_PUBLIC void except_free (void *)
 

Variables

WS_DLL_PUBLIC WS_NORETURN void WS_DLL_PUBLIC void(*)(except_t *) except_unhandled_catcher (void(*)(except_t *))
 

Detailed Description

Portable Exception Handling for ANSI C.
Modified to support throwing an exception with a null message pointer, and to have the message not be const (as we generate messages with "ws_strdup_printf()", which means they need to be freed; using a null message means that we don't have to use a special string for exceptions with no message, and don't have to worry about not freeing that).

Macro Definition Documentation

◆ except_checked_cleanup_pop

#define except_checked_cleanup_pop (   F,
 
)
Value:
except_pop(); \
assert (except_cl.except_func == (F)); \
if (E) \
except_cl.except_func(except_cl.except_context); \
}

◆ except_checked_cleanup_pop_pfx

#define except_checked_cleanup_pop_pfx (   pfx,
  F,
 
)
Value:
except_pop(); \
assert (pfx##_except_cl.except_func == (F)); \
if (E) \
pfx##_except_cl.except_func(pfx##_except_cl.except_context);\
}

◆ except_cleanup_pop

#define except_cleanup_pop (   E)
Value:
except_pop(); \
if (E) \
except_cl.except_func(except_cl.except_context); \
}

◆ except_cleanup_pop_pfx

#define except_cleanup_pop_pfx (   pfx,
 
)
Value:
except_pop(); \
if (E) \
pfx##_except_cl.except_func(pfx##_except_cl.except_context);\
}

◆ except_cleanup_push

#define except_cleanup_push (   F,
 
)
Value:
{ \
struct except_stacknode except_sn; \
struct except_cleanup except_cl; \
except_setup_clean(&except_sn, &except_cl, F, C)
Definition except.h:62
Definition except.h:78

◆ except_cleanup_push_pfx

#define except_cleanup_push_pfx (   pfx,
  F,
 
)
Value:
{ \
struct except_stacknode pfx##_except_sn; \
struct except_cleanup pfx##_except_cl; \
except_setup_clean(&pfx##_except_sn, &pfx##_except_cl, F, C)

◆ except_try_pop

#define except_try_pop ( )
Value:
except_free(except_ch.except_obj.except_dyndata); \
except_pop(); \
}

◆ except_try_push

#define except_try_push (   ID,
  NUM,
  PPE 
)
Value:
{ \
struct except_stacknode except_sn; \
struct except_catch except_ch; \
except_setup_try(&except_sn, &except_ch, ID, NUM); \
if (setjmp(except_ch.except_jmp)) \
*(PPE) = &except_ch.except_obj; \
else \
*(PPE) = 0
Definition except.h:67