-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathhRexx_r.c
127 lines (90 loc) · 4.22 KB
/
hRexx_r.c
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* HREXX_R.C (c)Copyright Enrico Sorichetti, 2012 */
/* Rexx Interpreter Support ( Regina Rexx ) */
/* */
/* Released under "The Q Public License Version 1" */
/* (http://www.hercules-390.org/herclic.html) as modifications to */
/* Hercules. */
/* inspired by the previous Rexx implementation by Jan Jaeger */
#include "hstdinc.h"
#ifndef _HREXX_R_C_
#define _HREXX_R_C_
#if defined(ENABLE_REGINA_REXX)
#define HREXXDROPVAR ReginaRexxDropVar
#define HREXXFETCHVAR ReginaRexxFetchVar
#define HREXXSETVAR ReginaRexxSetVar
#define HREXXEXECCMD ReginaRexxExecCmd
#define HREXXEXECINSTORECMD ReginaRexxExecInstoreCmd
#define HREXXEXECSUB ReginaRexxExecSub
#define HREXXREGISTERFUNCTIONS ReginaRexxRegisterFunctions
#define HREXXEXTERNALFUNCTION_T ULONG APIENTRY
#define HREXXAWSCMD ReginaRexxawscmd
#define HREXXREGISTERHANDLERS ReginaRexxRegisterHandlers
#define HREXXPFN PFN
#define HREXXSTRING RXSTRING
#define HREXXEXITHANDLER_T LONG APIENTRY
#define HREXXLONG LONG
#define HREXXSUBCOMHANDLER_T APIRET APIENTRY
#define HREXXPSTRING PRXSTRING
#define _HENGINE_DLL_
#include "hercules.h"
#include "hRexx.h"
#define INCL_REXXSAA
#if defined(HAVE_REGINA_REXXSAA_H)
#include "regina/rexxsaa.h"
#else
#include "rexxsaa.h"
#endif
#define RXAPI_MEMFAIL 1002
extern void *hRexxLibHandle; /* Library handle */
extern void *hRexxApiLibHandle; /* Api Library handle */
extern char *RexxPackage;
extern char *RexxLibrary;
extern char *RexxApiLibrary;
extern int MessageLevel;
extern char *MessagePrefix;
extern char *ErrorPrefix;
extern int (*RexxDynamicLoader)();
extern int (*RexxRegisterFunctions)();
extern int (*RexxRegisterHandlers)();
extern int (*RexxExecCmd)();
extern int (*RexxExecInstoreCmd)();
extern int (*RexxExecSub)();
typedef APIRET APIENTRY PFNREXXSTART( LONG, PRXSTRING, PCSZ, PRXSTRING, PCSZ, LONG, PRXSYSEXIT, PSHORT, PRXSTRING );
typedef APIRET APIENTRY PFNREXXREGISTERFUNCTIONEXE( PCSZ, PFN);
typedef APIRET APIENTRY PFNREXXDEREGISTERFUNCTION( PCSZ );
typedef APIRET APIENTRY PFNREXXREGISTERSUBCOMEXE( PCSZ, PFN, PUCHAR);
typedef APIRET APIENTRY PFNREXXDEREGISTERSUBCOM( PCSZ, PCSZ);
typedef APIRET APIENTRY PFNREXXREGISTEREXITEXE( PSZ, PFN , PUCHAR );
typedef APIRET APIENTRY PFNREXXDEREGISTEREXIT( PCSZ, PCSZ);
typedef PVOID APIENTRY PFNREXXALLOCATEMEMORY(ULONG);
typedef APIRET APIENTRY PFNREXXFREEMEMORY( PVOID);
typedef APIRET APIENTRY PFNREXXVARIABLEPOOL( PSHVBLOCK );
static PFNREXXSTART *hRexxStart;
static PFNREXXREGISTERFUNCTIONEXE *hRexxRegisterFunction;
static PFNREXXDEREGISTERFUNCTION *hRexxDeregisterFunction;
static PFNREXXREGISTERSUBCOMEXE *hRexxRegisterSubcom;
static PFNREXXDEREGISTERSUBCOM *hRexxDeregisterSubcom;
static PFNREXXREGISTEREXITEXE *hRexxRegisterExit;
static PFNREXXDEREGISTEREXIT *hRexxDeregisterExit;
static PFNREXXALLOCATEMEMORY *hRexxAllocateMemory;
static PFNREXXFREEMEMORY *hRexxFreeMemory;
static PFNREXXVARIABLEPOOL *hRexxVariablePool;
int ReginaRexxDynamicLoader()
{
HDLOPEN( hRexxLibHandle, REGINA_LIBRARY, RTLD_LAZY);
HDLSYM ( hRexxStart, hRexxLibHandle, REXX_START);
HDLSYM ( hRexxRegisterFunction, hRexxLibHandle, REXX_REGISTER_FUNCTION);
HDLSYM ( hRexxDeregisterFunction, hRexxLibHandle, REXX_DEREGISTER_FUNCTION);
HDLSYM ( hRexxRegisterSubcom, hRexxLibHandle, REXX_REGISTER_SUBCOM);
HDLSYM ( hRexxDeregisterSubcom, hRexxLibHandle, REXX_DEREGISTER_SUBCOM);
HDLSYM ( hRexxRegisterExit, hRexxLibHandle, REXX_REGISTER_EXIT);
HDLSYM ( hRexxDeregisterExit, hRexxLibHandle, REXX_DEREGISTER_EXIT);
HDLSYM ( hRexxAllocateMemory, hRexxLibHandle, REXX_ALLOCATE_MEMORY);
HDLSYM ( hRexxFreeMemory, hRexxLibHandle, REXX_FREE_MEMORY);
HDLSYM ( hRexxFreeMemory, hRexxLibHandle, REXX_FREE_MEMORY);
HDLSYM ( hRexxVariablePool, hRexxLibHandle, REXX_VARIABLE_POOL);
return 0;
}
#include "hRexxapi.h"
#endif /* defined(ENABLE_REGINA_REXX) */
#endif /* #ifndef _HREXX_R_C_ */