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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
// **********************************************************************
//
// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifdef _WIN32
# include <IceUtil/Config.h>
#endif
#include <Communicator.h>
#include <Connection.h>
#include <ConnectionInfo.h>
#include <Current.h>
#include <Endpoint.h>
#include <EndpointInfo.h>
#include <ImplicitContext.h>
#include <Logger.h>
#include <ObjectAdapter.h>
#include <Operation.h>
#include <Properties.h>
#include <Proxy.h>
#include <Slice.h>
#include <Types.h>
using namespace std;
using namespace IcePy;
extern "C" PyObject* Ice_registerTypes(PyObject*, PyObject*);
static PyMethodDef methods[] =
{
{ STRCAST("stringVersion"), reinterpret_cast<PyCFunction>(IcePy_stringVersion), METH_NOARGS,
PyDoc_STR(STRCAST("stringVersion() -> string")) },
{ STRCAST("intVersion"), reinterpret_cast<PyCFunction>(IcePy_intVersion), METH_NOARGS,
PyDoc_STR(STRCAST("intVersion() -> int")) },
{ STRCAST("generateUUID"), reinterpret_cast<PyCFunction>(IcePy_generateUUID), METH_NOARGS,
PyDoc_STR(STRCAST("generateUUID() -> string")) },
{ STRCAST("createProperties"), reinterpret_cast<PyCFunction>(IcePy_createProperties), METH_VARARGS,
PyDoc_STR(STRCAST("createProperties([args]) -> Ice.Properties")) },
{ STRCAST("getProcessLogger"), reinterpret_cast<PyCFunction>(IcePy_getProcessLogger), METH_NOARGS,
PyDoc_STR(STRCAST("getProcessLogger() -> Ice.Logger")) },
{ STRCAST("setProcessLogger"), reinterpret_cast<PyCFunction>(IcePy_setProcessLogger), METH_VARARGS,
PyDoc_STR(STRCAST("setProcessLogger(logger) -> None")) },
{ STRCAST("defineEnum"), reinterpret_cast<PyCFunction>(IcePy_defineEnum), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("defineStruct"), reinterpret_cast<PyCFunction>(IcePy_defineStruct), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("defineSequence"), reinterpret_cast<PyCFunction>(IcePy_defineSequence), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("defineCustom"), reinterpret_cast<PyCFunction>(IcePy_defineCustom), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("defineDictionary"), reinterpret_cast<PyCFunction>(IcePy_defineDictionary), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("declareProxy"), reinterpret_cast<PyCFunction>(IcePy_declareProxy), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("defineProxy"), reinterpret_cast<PyCFunction>(IcePy_defineProxy), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("declareClass"), reinterpret_cast<PyCFunction>(IcePy_declareClass), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("defineClass"), reinterpret_cast<PyCFunction>(IcePy_defineClass), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("defineException"), reinterpret_cast<PyCFunction>(IcePy_defineException), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("stringify"), reinterpret_cast<PyCFunction>(IcePy_stringify), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("stringifyException"), reinterpret_cast<PyCFunction>(IcePy_stringifyException), METH_VARARGS,
PyDoc_STR(STRCAST("internal function")) },
{ STRCAST("loadSlice"), reinterpret_cast<PyCFunction>(IcePy_loadSlice), METH_VARARGS,
PyDoc_STR(STRCAST("loadSlice(cmd) -> None")) },
{ 0, 0 } /* sentinel */
};
#if PY_VERSION_HEX >= 0x03000000
# define INIT_RETURN return(0)
static struct PyModuleDef iceModule =
{
PyModuleDef_HEAD_INIT,
"IcePy",
"The Internet Communications Engine.",
-1,
methods,
NULL,
NULL,
NULL,
NULL
};
#else
# define INIT_RETURN return
PyDoc_STRVAR(moduleDoc, "The Internet Communications Engine.");
#endif
#if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x550)
extern "C" __global void
#else
PyMODINIT_FUNC
#endif
#if PY_VERSION_HEX >= 0x03000000
PyInit_IcePy(void)
#else
initIcePy(void)
#endif
{
PyObject* module;
//
// Notify Python that we are a multi-threaded extension.
//
PyEval_InitThreads();
#if PY_VERSION_HEX >= 0x03000000
//
// Create the module.
//
module = PyModule_Create(&iceModule);
#else
//
// Initialize the module.
//
module = Py_InitModule3(STRCAST("IcePy"), methods, moduleDoc);
#endif
//
// Install built-in Ice types.
//
if(!initProxy(module))
{
INIT_RETURN;
}
if(!initTypes(module))
{
INIT_RETURN;
}
if(!initProperties(module))
{
INIT_RETURN;
}
if(!initCommunicator(module))
{
INIT_RETURN;
}
if(!initCurrent(module))
{
INIT_RETURN;
}
if(!initObjectAdapter(module))
{
INIT_RETURN;
}
if(!initOperation(module))
{
INIT_RETURN;
}
if(!initLogger(module))
{
INIT_RETURN;
}
if(!initConnection(module))
{
INIT_RETURN;
}
if(!initConnectionInfo(module))
{
INIT_RETURN;
}
if(!initImplicitContext(module))
{
INIT_RETURN;
}
if(!initEndpoint(module))
{
INIT_RETURN;
}
if(!initEndpointInfo(module))
{
INIT_RETURN;
}
#if PY_VERSION_HEX >= 0x03000000
return module;
#endif
}
|