1 #ifndef MT_H_INCLUDED
2 #define MT_H_INCLUDED
3 
4 #include <setjmp.h>
5 
6 struct _OS_Dep_funcs;
7 
8 /* tsd_t holds all global vars which may change between threads as expected.*/
9 typedef struct _tsd_t {
10    void *                  mem_tsd ;           /* local variables of memory.c */
11    void *                  var_tsd ;           /* local variables of variable.c */
12    void *                  stk_tsd ;           /* local variables of stack.c */
13    void *                  fil_tsd ;           /* local variables of files.c */
14    void *                  itp_tsd ;           /* local variables of interprt.c */
15    void *                  tra_tsd ;           /* local variables of tracing.c */
16    void *                  err_tsd ;           /* local variables of error.c */
17    void *                  vms_tsd ;           /* local variables of vmscmd.c */
18    void *                  bui_tsd ;           /* local variables of builtin.c */
19    void *                  vmf_tsd ;           /* local variables of vmsfuncs.c */
20    void *                  lib_tsd ;           /* local variables of library.c */
21    void *                  rex_tsd ;           /* local variables of rexxsaa.c */
22    void *                  shl_tsd ;           /* local variables of shell.c */
23    void *                  mat_tsd ;           /* local variables of strmath.c */
24    void *                  cli_tsd ;           /* local variables of client.c */
25    void *                  arx_tsd ;           /* local variables of arxfuncs.c */
26    void *                  mt_tsd ;            /* local variables of mt_???.c */
27 
28    void *                  CH;                 /* only rexxsaa.c */
29    int                     indentsize;         /* only in r2perl.c */
30    int                     loopcnt;            /* only in r2perl.c */
31    paramboxptr             listleaked_params ; /* only in funcs.c */
32    paramboxptr             par_stack ;         /* only in funcs.c */
33    int                     traceparse ;        /* only in parsing.c */
34    num_descr               rdes;               /* only in expr.c */
35    num_descr               ldes;               /* only in expr.c */
36    void *                  firstenvir;         /* only in envir.c */
37    void *                  last_alloca_header; /* only in alloca.c */
38    void *                  stkaddr;            /* only in alloca.c */
39    volatile char *         tmp_strs[8];        /* only tmpstr_of() */
40    int                     next_tmp_str;       /* only tmpstr_of() */
41    paramboxptr             bif_first ;         /* only builtinfunc() */
42    void *                  firstmacro ;        /* only in macros.c */
43 
44    sysinfo                 systeminfo ;
45    proclevel               currlevel ;
46    int                     listleakedmemory ;
47    int                     var_indicator ;
48    int                     isclient ;
49    nodeptr                 currentnode ;
50    sigtype *               nextsig;
51    FILE *                  stddump;
52    unsigned long           thread_id;
53    int                     instore_is_errorfree;
54    char                    trace_stat;
55    int                     called_from_saa;
56    int                     restricted;
57    /* Stuff for a delayed exit()/setjmp(): */
58    int                     in_protected;
59    jmp_buf                 protect_return;
60    jmp_buf                 gci_jump;
61    volatile delayed_error_type_t delayed_error_type;
62    volatile int            expected_exit_error;
63                             /* call exit() with this value if
64                              * delayed_error_type is PROTECTED_DelayedScriptExit
65                              */
66    volatile int            HaltRaised;
67    void *                  (*MTMalloc)(const struct _tsd_t *TSD,size_t size);
68    void                    (*MTFree)(const struct _tsd_t *TSD,void *chunk);
69    void                    (*MTExit)(int code);
70    char                    gci_prefix[2];
71    const char             *BIFname;
72    void                   *BIFfunc;
73    struct _OS_Dep_funcs   *OS;
74 } tsd_t;
75 
76 #if (defined(POSIX) || defined(_POSIX_SOURCE) || defined(_PTHREAD_SEMANTICS)) && (defined(_REENTRANT) || defined(REENTRANT)) && defined(REGINA_REENTRANT)
77 #  include "mt_posix.h"
78 #elif ( defined(_WIN64) || defined(_WIN32) ) && defined(REGINA_SINGLE_THREADED)
79 #  include "mt_notmt.h"
80 #  define SINGLE_THREADED
81 #elif defined(_WIN64) && defined(_MT)
82 #  include "mt_win64.h"
83 #elif defined(_WIN32) && defined(_MT)
84 #  include "mt_win32.h"
85 #elif defined(OS2) && defined(__EMX__) && defined(__MT__) && defined(REGINA_MULTI)
86 #  include "mt_os2.h"
87 #elif defined(OS2) && defined(__WATCOMC__) && defined(REGINA_MULTI)
88 #  include "mt_os2.h"
89 #else
90 #  include "mt_notmt.h"
91 #  if !defined(SINGLE_THREADED) && !defined(MULTI_THREADED)
92 #     define SINGLE_THREADED
93 #   endif
94 #endif
95 
96 /* SINGLE_THREAD is defined explicitely, thus: */
97 #if !defined(SINGLE_THREADED) && !defined(MULTI_THREADED)
98 #  define MULTI_THREADED
99 #endif
100 
101 #endif /* MT_H_INCLUDED */
102