summaryrefslogtreecommitdiff
path: root/fitz/except.h
blob: 477fbc39096b17f8982c96ca276502e3e56e6240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef EXCEPT_H
#define EXCEPT_H

#include "fitz.h"

typedef struct fz_context fz_context;
typedef int fz_error;

typedef struct fz_except {
  char mess[256];
} fz_except;

#include "exceptxxx.h"
/*
    Macros for fz_try and fz_catch are defined in exceptxxx.h,
    but their definitions are best ignored.  Just use them as follows:

    fz_var(..);
    fz_var(..);

    fz_try(ctx)
    {
       .
       .
       .
    }
    fz_catch(ctx)
    {
       .
       .
       .
    }

    and don't return from within the try clause.
*/

void fz_throw(fz_context *, char *, ...);

fz_except *fz_caught(fz_context *);

void fz_rethrow(fz_context *);

#define fz_var(A) fz_var_xxx((void *)&(A))

void fz_var_xxx(void *x);

fz_error fz_except_init(fz_context *);

void fz_except_fin(fz_context *);

#endif /* EXCEPT */