corba.js 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/lib/idl/idl.cjs +0 -3821
- package/lib/idl/idl.cjs.map +0 -1
- package/lib/idl/src/idl/cc/typeIDLtoCC.d.ts +0 -6
- package/lib/idl/src/idl/cc/typeIDLtoGIOPCC.d.ts +0 -3
- package/lib/idl/src/idl/cc/write-code.d.ts +0 -2
- package/lib/idl/src/idl/cc/write-interface.d.ts +0 -5
- package/lib/idl/src/idl/cc/write-skeleton.d.ts +0 -2
- package/lib/idl/src/idl/cc/write-stub.d.ts +0 -2
- package/lib/idl/src/idl/idl-lexer.d.ts +0 -19
- package/lib/idl/src/idl/idl-node.d.ts +0 -102
- package/lib/idl/src/idl/idl-parser.d.ts +0 -3
- package/lib/idl/src/idl/idl.d.ts +0 -1
- package/lib/idl/src/idl/ts/typeIDLtoGIOPTS.d.ts +0 -3
- package/lib/idl/src/idl/ts/typeIDLtoTS.d.ts +0 -3
- package/lib/idl/src/idl/ts/write-interface.d.ts +0 -2
- package/lib/idl/src/idl/ts/write-skeleton.d.ts +0 -2
- package/lib/idl/src/idl/ts/write-stub.d.ts +0 -2
- package/lib/idl/src/idl/ts/write-value.d.ts +0 -2
- package/lib/idl/src/idl/ts/write-valueimpl.d.ts +0 -2
- package/lib/idl/src/idl/ts/write-valuetype.d.ts +0 -2
- package/lib/idl/src/idl/util.d.ts +0 -23
- package/lib/idl/src/index.d.ts +0 -5
- package/lib/idl/src/net/browser.d.ts +0 -7
- package/lib/idl/src/net/index.d.ts +0 -3
- package/lib/idl/src/net/tcp.d.ts +0 -11
- package/lib/idl/src/net/tls.d.ts +0 -24
- package/lib/idl/src/net/ws.d.ts +0 -44
- package/lib/idl/src/orb/asn1.d.ts +0 -48
- package/lib/idl/src/orb/connection.d.ts +0 -24
- package/lib/idl/src/orb/giop.d.ts +0 -283
- package/lib/idl/src/orb/index.d.ts +0 -3
- package/lib/idl/src/orb/ior.d.ts +0 -89
- package/lib/idl/src/orb/orb.d.ts +0 -143
- package/lib/idl/src/orb/protocol.d.ts +0 -6
- package/lib/idl/src/orb/uint8map.d.ts +0 -14
- package/lib/idl/src/orb/url.d.ts +0 -55
- package/lib/src/idl/cc/typeIDLtoCC.d.ts +0 -6
- package/lib/src/idl/cc/typeIDLtoCC.js +0 -127
- package/lib/src/idl/cc/typeIDLtoCC.js.map +0 -1
- package/lib/src/idl/cc/typeIDLtoGIOPCC.d.ts +0 -3
- package/lib/src/idl/cc/typeIDLtoGIOPCC.js +0 -127
- package/lib/src/idl/cc/typeIDLtoGIOPCC.js.map +0 -1
- package/lib/src/idl/cc/write-code.d.ts +0 -2
- package/lib/src/idl/cc/write-code.js +0 -213
- package/lib/src/idl/cc/write-code.js.map +0 -1
- package/lib/src/idl/cc/write-interface.d.ts +0 -5
- package/lib/src/idl/cc/write-interface.js +0 -228
- package/lib/src/idl/cc/write-interface.js.map +0 -1
- package/lib/src/idl/cc/write-skeleton.d.ts +0 -2
- package/lib/src/idl/cc/write-skeleton.js +0 -43
- package/lib/src/idl/cc/write-skeleton.js.map +0 -1
- package/lib/src/idl/cc/write-stub.d.ts +0 -2
- package/lib/src/idl/cc/write-stub.js +0 -91
- package/lib/src/idl/cc/write-stub.js.map +0 -1
- package/lib/src/idl/idl-lexer.d.ts +0 -19
- package/lib/src/idl/idl-lexer.js +0 -234
- package/lib/src/idl/idl-lexer.js.map +0 -1
- package/lib/src/idl/idl-node.d.ts +0 -102
- package/lib/src/idl/idl-node.js +0 -214
- package/lib/src/idl/idl-node.js.map +0 -1
- package/lib/src/idl/idl-parser.d.ts +0 -3
- package/lib/src/idl/idl-parser.js +0 -1210
- package/lib/src/idl/idl-parser.js.map +0 -1
- package/lib/src/idl/idl.d.ts +0 -1
- package/lib/src/idl/idl.js +0 -219
- package/lib/src/idl/idl.js.map +0 -1
- package/lib/src/idl/ts/typeIDLtoGIOPTS.d.ts +0 -3
- package/lib/src/idl/ts/typeIDLtoGIOPTS.js +0 -101
- package/lib/src/idl/ts/typeIDLtoGIOPTS.js.map +0 -1
- package/lib/src/idl/ts/typeIDLtoTS.d.ts +0 -3
- package/lib/src/idl/ts/typeIDLtoTS.js +0 -92
- package/lib/src/idl/ts/typeIDLtoTS.js.map +0 -1
- package/lib/src/idl/ts/write-interface.d.ts +0 -2
- package/lib/src/idl/ts/write-interface.js +0 -214
- package/lib/src/idl/ts/write-interface.js.map +0 -1
- package/lib/src/idl/ts/write-skeleton.d.ts +0 -2
- package/lib/src/idl/ts/write-skeleton.js +0 -118
- package/lib/src/idl/ts/write-skeleton.js.map +0 -1
- package/lib/src/idl/ts/write-stub.d.ts +0 -2
- package/lib/src/idl/ts/write-stub.js +0 -118
- package/lib/src/idl/ts/write-stub.js.map +0 -1
- package/lib/src/idl/ts/write-value.d.ts +0 -2
- package/lib/src/idl/ts/write-value.js +0 -208
- package/lib/src/idl/ts/write-value.js.map +0 -1
- package/lib/src/idl/ts/write-valueimpl.d.ts +0 -2
- package/lib/src/idl/ts/write-valueimpl.js +0 -159
- package/lib/src/idl/ts/write-valueimpl.js.map +0 -1
- package/lib/src/idl/ts/write-valuetype.d.ts +0 -2
- package/lib/src/idl/ts/write-valuetype.js +0 -99
- package/lib/src/idl/ts/write-valuetype.js.map +0 -1
- package/lib/src/idl/util.d.ts +0 -23
- package/lib/src/idl/util.js +0 -84
- package/lib/src/idl/util.js.map +0 -1
- package/lib/src/index.d.ts +0 -5
- package/lib/src/index.js +0 -6
- package/lib/src/index.js.map +0 -1
- package/lib/src/net/browser.d.ts +0 -7
- package/lib/src/net/browser.js +0 -55
- package/lib/src/net/browser.js.map +0 -1
- package/lib/src/net/index.d.ts +0 -3
- package/lib/src/net/index.js +0 -4
- package/lib/src/net/index.js.map +0 -1
- package/lib/src/net/tcp.d.ts +0 -11
- package/lib/src/net/tcp.js +0 -66
- package/lib/src/net/tcp.js.map +0 -1
- package/lib/src/net/tls.d.ts +0 -24
- package/lib/src/net/tls.js +0 -69
- package/lib/src/net/tls.js.map +0 -1
- package/lib/src/net/ws.d.ts +0 -44
- package/lib/src/net/ws.js +0 -158
- package/lib/src/net/ws.js.map +0 -1
- package/lib/src/orb/asn1.d.ts +0 -48
- package/lib/src/orb/asn1.js +0 -60
- package/lib/src/orb/asn1.js.map +0 -1
- package/lib/src/orb/connection.d.ts +0 -24
- package/lib/src/orb/connection.js +0 -19
- package/lib/src/orb/connection.js.map +0 -1
- package/lib/src/orb/giop.d.ts +0 -283
- package/lib/src/orb/giop.js +0 -1301
- package/lib/src/orb/giop.js.map +0 -1
- package/lib/src/orb/index.d.ts +0 -3
- package/lib/src/orb/index.js +0 -4
- package/lib/src/orb/index.js.map +0 -1
- package/lib/src/orb/ior.d.ts +0 -89
- package/lib/src/orb/ior.js +0 -113
- package/lib/src/orb/ior.js.map +0 -1
- package/lib/src/orb/orb.d.ts +0 -143
- package/lib/src/orb/orb.js +0 -693
- package/lib/src/orb/orb.js.map +0 -1
- package/lib/src/orb/protocol.d.ts +0 -6
- package/lib/src/orb/protocol.js +0 -2
- package/lib/src/orb/protocol.js.map +0 -1
- package/lib/src/orb/uint8map.d.ts +0 -14
- package/lib/src/orb/uint8map.js +0 -48
- package/lib/src/orb/uint8map.js.map +0 -1
- package/lib/src/orb/url.d.ts +0 -55
- package/lib/src/orb/url.js +0 -255
- package/lib/src/orb/url.js.map +0 -1
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { Type } from "../idl-node.js";
|
|
3
|
-
import { filenamePrefix, filename, filenameLocal, hasValueType } from "../util.js";
|
|
4
|
-
import { typeIDLtoGIOPCC } from "./typeIDLtoGIOPCC.js";
|
|
5
|
-
import { Direction, typeIDLtoCC } from "./typeIDLtoCC.js";
|
|
6
|
-
export function writeCCCode(specification) {
|
|
7
|
-
let out = fs.createWriteStream(filenamePrefix + ".cc");
|
|
8
|
-
out.write("// This file is generated by the corba.js IDL compiler from '" + filename + "'.\n\n");
|
|
9
|
-
out.write(`#include <corba/corba.hh>\n`);
|
|
10
|
-
out.write(`#include <corba/orb.hh>\n`);
|
|
11
|
-
out.write(`#include <corba/giop.hh>\n`);
|
|
12
|
-
out.write(`#include <corba/coroutine.hh>\n`);
|
|
13
|
-
out.write(`#include <cstring>\n`);
|
|
14
|
-
out.write(`#include <map>\n`);
|
|
15
|
-
out.write(`#include <functional>\n`);
|
|
16
|
-
if (hasValueType(specification)) {
|
|
17
|
-
out.write(`import * as valuetype from \"./${filenameLocal}_valuetype\"\n`);
|
|
18
|
-
}
|
|
19
|
-
out.write(`#include "${filenameLocal}.hh"\n`);
|
|
20
|
-
out.write(`#include "${filenameLocal}_skel.hh"\n`);
|
|
21
|
-
out.write(`#include "${filenameLocal}_stub.hh"\n\n`);
|
|
22
|
-
writeCCCodeDefinitions(out, specification);
|
|
23
|
-
}
|
|
24
|
-
function writeCCCodeDefinitions(out, specification, prefix = "", indent = 0) {
|
|
25
|
-
for (let definition of specification.child) {
|
|
26
|
-
switch (definition.type) {
|
|
27
|
-
case Type.TKN_MODULE:
|
|
28
|
-
out.write(`namespace ${definition.text}{\n\n`);
|
|
29
|
-
writeCCCodeDefinitions(out, definition, prefix + definition.text + ".", indent + 1);
|
|
30
|
-
out.write(`} // namespace ${definition.text}\n\n`);
|
|
31
|
-
break;
|
|
32
|
-
case Type.SYN_INTERFACE:
|
|
33
|
-
{
|
|
34
|
-
const interface_dcl = definition;
|
|
35
|
-
const if_identifier = interface_dcl.child[0].child[1].text;
|
|
36
|
-
const interface_body = interface_dcl.child[1];
|
|
37
|
-
for (let _export of interface_body.child) {
|
|
38
|
-
switch (_export.type) {
|
|
39
|
-
case Type.SYN_OPERATION_DECLARATION:
|
|
40
|
-
{
|
|
41
|
-
const op_dcl = _export;
|
|
42
|
-
const attribute = op_dcl.child[0];
|
|
43
|
-
const type = op_dcl.child[1];
|
|
44
|
-
let oneway = false;
|
|
45
|
-
if (attribute !== undefined && attribute.type === Type.TKN_ONEWAY) {
|
|
46
|
-
oneway = true;
|
|
47
|
-
}
|
|
48
|
-
if (oneway && type.type !== Type.TKN_VOID) {
|
|
49
|
-
throw Error("oneway methods must return void");
|
|
50
|
-
}
|
|
51
|
-
let identifier = op_dcl.child[2].text;
|
|
52
|
-
let parameter_decls = op_dcl.child[3].child;
|
|
53
|
-
out.write(`static CORBA::async<>`);
|
|
54
|
-
out.write(` _${if_identifier}_${identifier}(${if_identifier} *obj, CORBA::GIOPDecoder &decoder, CORBA::GIOPEncoder &encoder) {\n`);
|
|
55
|
-
switch (type.type) {
|
|
56
|
-
case Type.TKN_VOID:
|
|
57
|
-
if (oneway) {
|
|
58
|
-
out.write(` obj->${identifier}(`);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
out.write(` co_await obj->${identifier}(`);
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
default:
|
|
65
|
-
out.write(` auto result = co_await obj->${identifier}(`);
|
|
66
|
-
}
|
|
67
|
-
let comma = false;
|
|
68
|
-
for (let parameter_dcl of parameter_decls) {
|
|
69
|
-
let attribute = parameter_dcl.child[0].type;
|
|
70
|
-
let type = parameter_dcl.child[1];
|
|
71
|
-
if (attribute !== Type.TKN_IN) {
|
|
72
|
-
throw Error("corba.js currently only supports 'in' parameters");
|
|
73
|
-
}
|
|
74
|
-
if (!comma) {
|
|
75
|
-
comma = true;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
out.write(", ");
|
|
79
|
-
}
|
|
80
|
-
out.write(`${typeIDLtoGIOPCC(type, undefined, Direction.IN)}`);
|
|
81
|
-
}
|
|
82
|
-
out.write(`);\n`);
|
|
83
|
-
if (type.type !== Type.TKN_VOID) {
|
|
84
|
-
out.write(` ${typeIDLtoGIOPCC(type, "result", Direction.OUT)};\n`);
|
|
85
|
-
}
|
|
86
|
-
else if (oneway) {
|
|
87
|
-
out.write(` co_return;\n`);
|
|
88
|
-
}
|
|
89
|
-
out.write(`}\n`);
|
|
90
|
-
let returnType = op_dcl.child[1];
|
|
91
|
-
if (oneway) {
|
|
92
|
-
out.write(`${typeIDLtoCC(returnType, Direction.OUT)}`);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
out.write(`CORBA::async<${typeIDLtoCC(returnType, Direction.OUT)}>`);
|
|
96
|
-
}
|
|
97
|
-
out.write(` ${if_identifier}_stub::${identifier}(`);
|
|
98
|
-
comma = false;
|
|
99
|
-
for (let parameter_dcl of parameter_decls) {
|
|
100
|
-
let attribute = parameter_dcl.child[0].type;
|
|
101
|
-
let type = parameter_dcl.child[1];
|
|
102
|
-
let identifier = parameter_dcl.child[2].text;
|
|
103
|
-
if (attribute !== Type.TKN_IN) {
|
|
104
|
-
throw Error("corba.js currently only supports 'in' parameters");
|
|
105
|
-
}
|
|
106
|
-
if (!comma) {
|
|
107
|
-
comma = true;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
out.write(", ");
|
|
111
|
-
}
|
|
112
|
-
out.write(`${typeIDLtoCC(type, Direction.IN)} ${identifier}`);
|
|
113
|
-
}
|
|
114
|
-
out.write(`) {\n`);
|
|
115
|
-
out.write(" ");
|
|
116
|
-
if (!oneway) {
|
|
117
|
-
out.write("return ");
|
|
118
|
-
}
|
|
119
|
-
if (oneway) {
|
|
120
|
-
out.write(`get_ORB()->onewayCall(this, "${identifier}", `);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
if (returnType.type !== Type.TKN_VOID) {
|
|
124
|
-
out.write(`get_ORB()->twowayCall<${typeIDLtoCC(returnType, Direction.OUT)}>(this, "${identifier}", `);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
out.write(`get_ORB()->twowayCall(this, "${identifier}", `);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
out.write(`[&](CORBA::GIOPEncoder &encoder) {\n`);
|
|
131
|
-
for (let parameter_dcl of parameter_decls) {
|
|
132
|
-
let type = parameter_dcl.child[1];
|
|
133
|
-
let identifier = parameter_dcl.child[2].text;
|
|
134
|
-
out.write(` ${typeIDLtoGIOPCC(type, identifier, Direction.IN)};\n`);
|
|
135
|
-
}
|
|
136
|
-
if (oneway) {
|
|
137
|
-
out.write(` });\n`);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
if (returnType.type !== Type.TKN_VOID) {
|
|
141
|
-
out.write(` },\n`);
|
|
142
|
-
out.write(` `);
|
|
143
|
-
out.write(`[&](CORBA::GIOPDecoder &decoder) { return ${typeIDLtoGIOPCC(returnType, undefined, Direction.OUT)}; });\n`);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
out.write(` });\n`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
out.write("}\n");
|
|
150
|
-
}
|
|
151
|
-
break;
|
|
152
|
-
case Type.TKN_ATTRIBUTE:
|
|
153
|
-
{
|
|
154
|
-
}
|
|
155
|
-
break;
|
|
156
|
-
default:
|
|
157
|
-
throw Error("yikes");
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
out.write(`std::map<std::string_view, std::function<CORBA::async<>(${if_identifier} *obj, CORBA::GIOPDecoder &decoder, CORBA::GIOPEncoder &encoder)>> _op_${if_identifier} = {\n`);
|
|
161
|
-
for (let _export of interface_body.child) {
|
|
162
|
-
switch (_export.type) {
|
|
163
|
-
case Type.SYN_OPERATION_DECLARATION:
|
|
164
|
-
{
|
|
165
|
-
const op_dcl = _export;
|
|
166
|
-
const attribute = op_dcl.child[0];
|
|
167
|
-
const type = op_dcl.child[1];
|
|
168
|
-
let identifier = op_dcl.child[2].text;
|
|
169
|
-
out.write(` {"${identifier}", _${if_identifier}_${identifier}},\n`);
|
|
170
|
-
}
|
|
171
|
-
break;
|
|
172
|
-
case Type.TKN_ATTRIBUTE:
|
|
173
|
-
{
|
|
174
|
-
}
|
|
175
|
-
break;
|
|
176
|
-
default:
|
|
177
|
-
throw Error("yikes");
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
out.write("};\n");
|
|
181
|
-
out.write(`CORBA::async<> ${if_identifier}_skel::_call(const std::string_view &operation, CORBA::GIOPDecoder &decoder, CORBA::GIOPEncoder &encoder) {\n`);
|
|
182
|
-
out.write(` auto it = _op_${if_identifier}.find(operation);\n`);
|
|
183
|
-
out.write(` if (it == _op_${if_identifier}.end()) {\n`);
|
|
184
|
-
out.write(` throw CORBA::BAD_OPERATION(0, CORBA::YES);\n`);
|
|
185
|
-
out.write(` }\n`);
|
|
186
|
-
out.write(` co_await it->second(this, decoder, encoder);\n`);
|
|
187
|
-
out.write("};\n\n");
|
|
188
|
-
out.write(`std::string_view ${if_identifier}::_rid("IDL:${if_identifier}:1.0");\n`);
|
|
189
|
-
out.write(`std::string_view ${if_identifier}::repository_id() const { return _rid;}\n\n`);
|
|
190
|
-
out.write(`CORBA::async<std::shared_ptr<${if_identifier}>> ${if_identifier}::_narrow(std::shared_ptr<CORBA::Object> pointer) {\n`);
|
|
191
|
-
out.write(` auto ptr = pointer.get();\n`);
|
|
192
|
-
out.write(` auto ref = dynamic_cast<CORBA::IOR *>(ptr);\n`);
|
|
193
|
-
out.write(` if (ref) {\n`);
|
|
194
|
-
out.write(` if (ref->repository_id() != "IDL:${if_identifier}:1.0") {\n`);
|
|
195
|
-
out.write(` co_return std::shared_ptr<${if_identifier}>();\n`);
|
|
196
|
-
out.write(` }\n`);
|
|
197
|
-
out.write(` std::shared_ptr<CORBA::ORB> orb = ref->get_ORB();\n`);
|
|
198
|
-
out.write(` CORBA::detail::Connection *conn = co_await orb->getConnection(ref->host, ref->port);\n`);
|
|
199
|
-
out.write(` auto stub = std::make_shared<${if_identifier}_stub>(orb, CORBA::blob_view(ref->objectKey), conn);\n`);
|
|
200
|
-
out.write(` co_return std::dynamic_pointer_cast<${if_identifier}>(stub);\n`);
|
|
201
|
-
out.write(` }\n`);
|
|
202
|
-
out.write(` auto obj = dynamic_cast<${if_identifier}*>(ptr);\n`);
|
|
203
|
-
out.write(` if (obj) {\n`);
|
|
204
|
-
out.write(` co_return std::dynamic_pointer_cast<${if_identifier}>(pointer);\n`);
|
|
205
|
-
out.write(` }\n`);
|
|
206
|
-
out.write(` co_return std::shared_ptr<${if_identifier}>();\n`);
|
|
207
|
-
out.write(`}\n\n`);
|
|
208
|
-
}
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
//# sourceMappingURL=write-code.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-code.js","sourceRoot":"","sources":["../../../../src/idl/cc/write-code.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAE,IAAI,EAAQ,uBAAmB;AACxC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAY,mBAAe;AACzF,OAAO,EAAE,eAAe,EAAE,6BAAyB;AACnD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,yBAAqB;AAEtD,MAAM,UAAU,WAAW,CAAC,aAAmB;IAC3C,IAAI,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,GAAG,KAAK,CAAC,CAAA;IACtD,GAAG,CAAC,KAAK,CAAC,+DAA+D,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAA;IAChG,GAAG,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;IACxC,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;IACtC,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAA;IACvC,GAAG,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;IAC5C,GAAG,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;IAGjC,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;IAC7B,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;IACpC,IAAI,YAAY,CAAC,aAAa,CAAC,EAAE,CAAC;Q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K,CAAC,OAAO,CAAC,CAAA;gBACtB,CAAC;gBAAC,MAAK;QACX,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Writable } from "stream";
|
|
3
|
-
import { Node } from "../idl-node";
|
|
4
|
-
export declare function writeCCInterface(specification: Node): void;
|
|
5
|
-
export declare function writeCCInterfaceDefinitions(out: Writable, specification: Node, prefix?: string, indent?: number): void;
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { Type } from "../idl-node.js";
|
|
3
|
-
import { filenamePrefix, filename, filenameLocal, hasValueType, FileType, writeIndent } from "../util.js";
|
|
4
|
-
import { typeIDLtoGIOPTS } from "../ts/typeIDLtoGIOPTS.js";
|
|
5
|
-
import { Direction, typeIDLtoCC } from "./typeIDLtoCC.js";
|
|
6
|
-
export function writeCCInterface(specification) {
|
|
7
|
-
let out = fs.createWriteStream(filenamePrefix + ".hh");
|
|
8
|
-
out.write("// This file is generated by the corba.js IDL compiler from '" + filename + "'.\n\n");
|
|
9
|
-
out.write(`#pragma once\n`);
|
|
10
|
-
out.write(`#include <corba/orb.hh>\n`);
|
|
11
|
-
out.write(`#include <corba/giop.hh>\n`);
|
|
12
|
-
out.write(`#include <corba/coroutine.hh>\n`);
|
|
13
|
-
out.write(`#include <corba/corba.hh>\n`);
|
|
14
|
-
out.write(`#include <string>\n`);
|
|
15
|
-
out.write(`#include <vector>\n`);
|
|
16
|
-
out.write(`#include <span>\n`);
|
|
17
|
-
out.write(`#include <utility>\n`);
|
|
18
|
-
if (hasValueType(specification)) {
|
|
19
|
-
out.write("import * as valuetype from \"./" + filenameLocal + "_valuetype\"\n");
|
|
20
|
-
}
|
|
21
|
-
out.write(`\n`);
|
|
22
|
-
writeCCInterfaceDefinitions(out, specification);
|
|
23
|
-
}
|
|
24
|
-
export function writeCCInterfaceDefinitions(out, specification, prefix = "", indent = 0) {
|
|
25
|
-
for (let definition of specification.child) {
|
|
26
|
-
switch (definition.type) {
|
|
27
|
-
case Type.TKN_MODULE:
|
|
28
|
-
out.write("namespace " + definition.text + " {\n\n");
|
|
29
|
-
writeCCInterfaceDefinitions(out, definition, prefix + definition.text + ".", indent + 1);
|
|
30
|
-
out.write("} // namespace " + definition.text + "\n\n");
|
|
31
|
-
break;
|
|
32
|
-
case Type.SYN_INTERFACE:
|
|
33
|
-
{
|
|
34
|
-
let interface_dcl = definition;
|
|
35
|
-
let identifier = interface_dcl.child[0].child[1].text;
|
|
36
|
-
let interface_body = interface_dcl.child[1];
|
|
37
|
-
out.write(`class ${identifier}: public virtual CORBA::Object {\n`);
|
|
38
|
-
out.write(` static std::string_view _rid;\n`);
|
|
39
|
-
out.write(`public:\n`);
|
|
40
|
-
for (let _export of interface_body.child) {
|
|
41
|
-
switch (_export.type) {
|
|
42
|
-
case Type.SYN_OPERATION_DECLARATION:
|
|
43
|
-
{
|
|
44
|
-
let op_dcl = _export;
|
|
45
|
-
let attribute = op_dcl.child[0];
|
|
46
|
-
let type = op_dcl.child[1];
|
|
47
|
-
let oneway = false;
|
|
48
|
-
if (attribute !== undefined && attribute.type === Type.TKN_ONEWAY)
|
|
49
|
-
oneway = true;
|
|
50
|
-
if (oneway && type.type !== Type.TKN_VOID)
|
|
51
|
-
throw Error("oneway methods must return void");
|
|
52
|
-
let identifier = op_dcl.child[2].text;
|
|
53
|
-
let parameter_decls = op_dcl.child[3].child;
|
|
54
|
-
out.write(" virtual ");
|
|
55
|
-
if (oneway) {
|
|
56
|
-
out.write(`${typeIDLtoCC(type, Direction.OUT)}`);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
out.write(`CORBA::async<${typeIDLtoCC(type, Direction.OUT)}>`);
|
|
60
|
-
}
|
|
61
|
-
out.write(` ${identifier}(`);
|
|
62
|
-
let comma = false;
|
|
63
|
-
for (let parameter_dcl of parameter_decls) {
|
|
64
|
-
let attribute = parameter_dcl.child[0].type;
|
|
65
|
-
let type = parameter_dcl.child[1];
|
|
66
|
-
let identifier = parameter_dcl.child[2].text;
|
|
67
|
-
if (attribute !== Type.TKN_IN) {
|
|
68
|
-
throw Error("corba.js currently only supports 'in' parameters");
|
|
69
|
-
}
|
|
70
|
-
if (!comma) {
|
|
71
|
-
comma = true;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
out.write(", ");
|
|
75
|
-
}
|
|
76
|
-
out.write(`${typeIDLtoCC(type, Direction.IN)} ${identifier}`);
|
|
77
|
-
}
|
|
78
|
-
out.write(`) = 0;\n`);
|
|
79
|
-
}
|
|
80
|
-
break;
|
|
81
|
-
case Type.TKN_ATTRIBUTE:
|
|
82
|
-
{
|
|
83
|
-
}
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
throw Error("yikes");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
out.write(` std::string_view repository_id() const override;\n`);
|
|
90
|
-
out.write(` static CORBA::async<std::shared_ptr<${identifier}>> _narrow(std::shared_ptr<CORBA::Object> pointer);\n`);
|
|
91
|
-
out.write("};\n\n");
|
|
92
|
-
}
|
|
93
|
-
break;
|
|
94
|
-
case Type.TKN_STRUCT:
|
|
95
|
-
{
|
|
96
|
-
let struct_type = definition;
|
|
97
|
-
let identifier = struct_type.text;
|
|
98
|
-
writeIndent(out, indent);
|
|
99
|
-
out.write(`struct ${identifier} {\n`);
|
|
100
|
-
for (let i = 0; i < struct_type.child.length; ++i) {
|
|
101
|
-
const member = struct_type.child[i];
|
|
102
|
-
if (member.type === Type.SYN_MEMBER) {
|
|
103
|
-
let type = member.child[0];
|
|
104
|
-
let declarators = member.child[1];
|
|
105
|
-
for (let declarator of declarators.child) {
|
|
106
|
-
writeIndent(out, indent + 1);
|
|
107
|
-
out.write(declarator.text + ": " + typeIDLtoCC(type, Direction.IN) + "\n");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
writeIndent(out, indent);
|
|
112
|
-
out.write("};\n");
|
|
113
|
-
out.write(`export function decode${identifier}(decoder: GIOPDecoder): ${identifier} {\n`);
|
|
114
|
-
out.write(` return {\n`);
|
|
115
|
-
for (let i = 0; i < struct_type.child.length; ++i) {
|
|
116
|
-
const member = struct_type.child[i];
|
|
117
|
-
if (member.type === Type.SYN_MEMBER) {
|
|
118
|
-
let type = member.child[0];
|
|
119
|
-
let declarators = member.child[1];
|
|
120
|
-
for (let declarator of declarators.child) {
|
|
121
|
-
writeIndent(out, indent + 2);
|
|
122
|
-
out.write(declarator.text + ": " + typeIDLtoGIOPTS(type) + ",\n");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
out.write(` }\n`);
|
|
127
|
-
out.write(`}\n`);
|
|
128
|
-
out.write(`export function encode${identifier}(GIOPEncoder &encoder, obj: ${identifier}) {\n`);
|
|
129
|
-
for (let i = 0; i < struct_type.child.length; ++i) {
|
|
130
|
-
const member = struct_type.child[i];
|
|
131
|
-
if (member.type === Type.SYN_MEMBER) {
|
|
132
|
-
let type = member.child[0];
|
|
133
|
-
let declarators = member.child[1];
|
|
134
|
-
for (let declarator of declarators.child) {
|
|
135
|
-
writeIndent(out, indent + 1);
|
|
136
|
-
out.write(typeIDLtoGIOPTS(type, `obj.${declarator.text}`) + "\n");
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
out.write(`}\n\n`);
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
case Type.TKN_UNION:
|
|
144
|
-
{
|
|
145
|
-
const identifier = definition.text;
|
|
146
|
-
const union_type = definition;
|
|
147
|
-
const switch_body = union_type.child[1];
|
|
148
|
-
let composite = "";
|
|
149
|
-
switch_body.child.forEach(x => {
|
|
150
|
-
const case_label = x.child[0];
|
|
151
|
-
const type_spec = x.child[1];
|
|
152
|
-
const declarator = x.child[2];
|
|
153
|
-
writeIndent(out, indent);
|
|
154
|
-
out.write(`export type _${identifier}_${declarator.text} = {\n`);
|
|
155
|
-
writeIndent(out, indent + 1);
|
|
156
|
-
out.write(`type: ${case_label.typeParent.text}.${case_label.text}\n`);
|
|
157
|
-
writeIndent(out, indent + 1);
|
|
158
|
-
out.write(`${declarator.text}: ${typeIDLtoCC(type_spec, Direction.IN)}\n`);
|
|
159
|
-
writeIndent(out, indent);
|
|
160
|
-
out.write(`}\n`);
|
|
161
|
-
if (composite.length !== 0)
|
|
162
|
-
composite = `${composite} | `;
|
|
163
|
-
composite = `${composite}_${identifier}_${declarator.text}`;
|
|
164
|
-
});
|
|
165
|
-
writeIndent(out, indent);
|
|
166
|
-
out.write(`export type ${identifier} = ${composite}\n`);
|
|
167
|
-
writeIndent(out, indent);
|
|
168
|
-
out.write(`export function decode${identifier}(decoder: GIOPDecoder): ${identifier} {\n`);
|
|
169
|
-
writeIndent(out, indent + 1);
|
|
170
|
-
out.write(`switch(decoder.ulong() as ${union_type.child[0].text}) {\n`);
|
|
171
|
-
switch_body.child.forEach(x => {
|
|
172
|
-
const case_label = x.child[0];
|
|
173
|
-
const type_spec = x.child[1];
|
|
174
|
-
const declarator = x.child[2];
|
|
175
|
-
writeIndent(out, indent + 2);
|
|
176
|
-
out.write(`case ${case_label.typeParent.text}.${case_label.text}: return {\n`);
|
|
177
|
-
writeIndent(out, indent + 3);
|
|
178
|
-
out.write(`type: ${case_label.typeParent.text}.${case_label.text},\n`);
|
|
179
|
-
writeIndent(out, indent + 3);
|
|
180
|
-
out.write(`${declarator.text}: ${typeIDLtoGIOPTS(type_spec, undefined, FileType.INTERFACE)}\n`);
|
|
181
|
-
writeIndent(out, indent + 2);
|
|
182
|
-
out.write(`}\n`);
|
|
183
|
-
});
|
|
184
|
-
writeIndent(out, indent + 1);
|
|
185
|
-
out.write(`}\n`);
|
|
186
|
-
writeIndent(out, indent + 1);
|
|
187
|
-
out.write(`throw Error("invalid union value")\n`);
|
|
188
|
-
writeIndent(out, indent);
|
|
189
|
-
out.write(`}\n`);
|
|
190
|
-
writeIndent(out, indent);
|
|
191
|
-
out.write(`export function encode${identifier}(encoder: GIOPEncoder, obj: ${identifier}) {\n`);
|
|
192
|
-
writeIndent(out, indent + 1);
|
|
193
|
-
out.write(`encoder.ulong(obj.type)\n`);
|
|
194
|
-
writeIndent(out, indent + 1);
|
|
195
|
-
out.write(`switch(obj.type) {\n`);
|
|
196
|
-
switch_body.child.forEach(x => {
|
|
197
|
-
const case_label = x.child[0];
|
|
198
|
-
const type_spec = x.child[1];
|
|
199
|
-
const declarator = x.child[2];
|
|
200
|
-
writeIndent(out, indent + 2);
|
|
201
|
-
out.write(`case ${case_label.typeParent.text}.${case_label.text}:\n`);
|
|
202
|
-
writeIndent(out, indent + 3);
|
|
203
|
-
out.write(typeIDLtoGIOPTS(type_spec, `obj.${declarator.text}`, FileType.INTERFACE) + "\n");
|
|
204
|
-
writeIndent(out, indent + 3);
|
|
205
|
-
out.write(`break\n`);
|
|
206
|
-
});
|
|
207
|
-
writeIndent(out, indent + 1);
|
|
208
|
-
out.write(`}\n`);
|
|
209
|
-
out.write(`}\n\n`);
|
|
210
|
-
}
|
|
211
|
-
break;
|
|
212
|
-
case Type.TKN_ENUM:
|
|
213
|
-
{
|
|
214
|
-
const identifier = definition.text;
|
|
215
|
-
writeIndent(out, indent);
|
|
216
|
-
out.write(`enum class ${identifier} {\n`);
|
|
217
|
-
for (const enumerator of definition.child) {
|
|
218
|
-
writeIndent(out, indent + 1);
|
|
219
|
-
out.write(`${enumerator.text},\n`);
|
|
220
|
-
}
|
|
221
|
-
writeIndent(out, indent);
|
|
222
|
-
out.write("};\n\n");
|
|
223
|
-
}
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
//# sourceMappingURL=write-interface.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-interface.js","sourceRoot":"","sources":["../../../../src/idl/cc/write-interface.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,IAA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,CAAC,GAAG,IAAI,CAAC,CAAA;wBAC3F,WAAW,CAAC,GAAG,EAAE,MAAM,GAAC,CAAC,CAAC,CAAA;wBAC1B,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;oBACxB,CAAC,CAAC,CAAA;oBACF,WAAW,CAAC,GAAG,EAAE,MAAM,GAAC,CAAC,CAAC,CAAA;oBAC1B,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;oBAChB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;gBACtB,CAAC;gBAAC,MAAK;YAEP,KAAK,IAAI,CAAC,QAAQ;gBAAE,CAAC;oBACjB,MAAM,UAAU,GAAG,UAAW,CAAC,IAAK,CAAA;oBACpC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;oBACxB,GAAG,CAAC,KAAK,CAAC,cAAc,UAAU,MAAM,CAAC,CAAA;oBACzC,KAAK,MAAM,UAAU,IAAI,UAAW,CAAC,KAAK,EAAE,CAAC;wBACzC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,CAAA;wBAC5B,GAAG,CAAC,KAAK,CAAC,GAAG,UAAW,CAAC,IAAI,KAAK,CAAC,CAAA;oBACvC,CAAC;oBACD,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;oBACxB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBACvB,CAAC;gBAAC,MAAK;QACX,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { Type } from "../idl-node.js";
|
|
3
|
-
import { filenamePrefix, filename, filenameLocal, hasValueType } from "../util.js";
|
|
4
|
-
export function writeCCSkeleton(specification) {
|
|
5
|
-
let out = fs.createWriteStream(filenamePrefix + "_skel.hh");
|
|
6
|
-
out.write("// This file is generated by the corba.js IDL compiler from '" + filename + "'.\n\n");
|
|
7
|
-
out.write(`#pragma once\n`);
|
|
8
|
-
out.write(`#include <corba/corba.hh>\n`);
|
|
9
|
-
out.write(`#include <corba/orb.hh>\n`);
|
|
10
|
-
out.write(`#include <corba/giop.hh>\n`);
|
|
11
|
-
out.write(`#include <corba/coroutine.hh>\n`);
|
|
12
|
-
out.write(`#include <vector>\n`);
|
|
13
|
-
if (hasValueType(specification)) {
|
|
14
|
-
out.write(`import * as valuetype from \"./${filenameLocal}_valuetype\"\n`);
|
|
15
|
-
}
|
|
16
|
-
out.write(`#include "${filenameLocal}.hh"\n\n`);
|
|
17
|
-
writeCCSkeletonDefinitions(out, specification);
|
|
18
|
-
}
|
|
19
|
-
function writeCCSkeletonDefinitions(out, specification, prefix = "", indent = 0) {
|
|
20
|
-
for (let definition of specification.child) {
|
|
21
|
-
switch (definition.type) {
|
|
22
|
-
case Type.TKN_MODULE:
|
|
23
|
-
out.write(`namespace ${definition.text}{\n\n`);
|
|
24
|
-
writeCCSkeletonDefinitions(out, definition, prefix + definition.text + ".", indent + 1);
|
|
25
|
-
out.write(`} // namespace ${definition.text}\n\n`);
|
|
26
|
-
break;
|
|
27
|
-
case Type.SYN_INTERFACE:
|
|
28
|
-
{
|
|
29
|
-
let interface_dcl = definition;
|
|
30
|
-
let identifier = interface_dcl.child[0].child[1].text;
|
|
31
|
-
let interface_body = interface_dcl.child[1];
|
|
32
|
-
out.write(`class ${identifier}_skel: public CORBA::Skeleton, public ${prefix}${identifier} {\n`);
|
|
33
|
-
out.write(`public:\n`);
|
|
34
|
-
out.write(` ${identifier}_skel(std::shared_ptr<CORBA::ORB> orb) : Skeleton(orb) {}\n`);
|
|
35
|
-
out.write(`private:\n`);
|
|
36
|
-
out.write(` CORBA::async<> _call(const std::string_view &operation, CORBA::GIOPDecoder &decoder, CORBA::GIOPEncoder &encoder) override;\n`);
|
|
37
|
-
out.write("};\n\n");
|
|
38
|
-
}
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//# sourceMapp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AAE,CAAC;YACvB,KAAK,IAAI,CAAC,UAAU;gBAChB,GAAG,CAAC,KAAK,CAAC,aAAa,UAAW,CAAC,IAAI,OAAO,CAAC,CAAA;gBAC/C,0BAA0B,CAAC,GAAG,EAAE,UAAW,EAAE,MAAM,GAAG,UAAW,CAAC,IAAI,GAAG,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,CAAA;gBACzF,GAAG,CAAC,KAAK,CAAC,kBAAkB,UAAW,CAAC,IAAI,MAAM,CAAC,CAAA;gBACnD,MAAK;YACT,KAAK,IAAI,CAAC,aAAa;gBAAE,CAAC;oBACtB,IAAI,aAAa,GAAG,UAAW,CAAA;oBAC/B,IAAI,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,IAAI,CAAA;oBACvD,IAAI,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAE,CAAA;oBAE5C,GAAG,CAAC,KAAK,CAAC,SAAS,UAAU,yCAAyC,MAAM,GAAG,UAAU,MAAM,CAAC,CAAA;oBAChG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;oBACtB,GAAG,CAAC,KAAK,CAAC,OAAO,UAAU,6DAA6D,CAAC,CAAA;oBACzF,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;oBACvB,GAAG,CAAC,KAAK,CAAC,mIAAmI,CAAC,CAAA;oBAC9I,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBACvB,CAAC;gBAAC,MAAK;QACX,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { Type } from "../idl-node.js";
|
|
3
|
-
import { filenamePrefix, filename, filenameLocal, hasValueType } from "../util.js";
|
|
4
|
-
import { Direction, typeIDLtoCC } from "./typeIDLtoCC.js";
|
|
5
|
-
export function writeCCStub(specification) {
|
|
6
|
-
let out = fs.createWriteStream(filenamePrefix + "_stub.hh");
|
|
7
|
-
out.write("// This file is generated by the corba.js IDL compiler from '" + filename + "'.\n\n");
|
|
8
|
-
out.write(`#pragma once\n`);
|
|
9
|
-
out.write(`#include <corba/corba.hh>\n`);
|
|
10
|
-
out.write(`#include <corba/orb.hh>\n`);
|
|
11
|
-
out.write(`#include <corba/giop.hh>\n`);
|
|
12
|
-
out.write(`#include <corba/coroutine.hh>\n`);
|
|
13
|
-
out.write(`#include <vector>\n`);
|
|
14
|
-
if (hasValueType(specification)) {
|
|
15
|
-
out.write("import * as valuetype from \"./" + filenameLocal + "_valuetype\"\n");
|
|
16
|
-
}
|
|
17
|
-
out.write(`#include "${filenameLocal}.hh"\n\n`);
|
|
18
|
-
writeCCStubDefinitions(out, specification);
|
|
19
|
-
}
|
|
20
|
-
function writeCCStubDefinitions(out, specification, prefix = "", indent = 0) {
|
|
21
|
-
for (let definition of specification.child) {
|
|
22
|
-
switch (definition.type) {
|
|
23
|
-
case Type.TKN_MODULE:
|
|
24
|
-
out.write("namespace " + definition.text + " {\n\n");
|
|
25
|
-
writeCCStubDefinitions(out, definition, prefix + definition.text + ".", indent + 1);
|
|
26
|
-
out.write("} // namespace " + definition.text + "\n\n");
|
|
27
|
-
break;
|
|
28
|
-
case Type.SYN_INTERFACE:
|
|
29
|
-
{
|
|
30
|
-
let interface_dcl = definition;
|
|
31
|
-
let identifier = interface_dcl.child[0].child[1].text;
|
|
32
|
-
let interface_body = interface_dcl.child[1];
|
|
33
|
-
out.write(`class ${identifier}_stub: public ${prefix}${identifier}, public CORBA::Stub {\n`);
|
|
34
|
-
out.write(`public:\n`);
|
|
35
|
-
out.write(` ${identifier}_stub(std::shared_ptr<CORBA::ORB> orb, CORBA::blob_view objectKey, CORBA::detail::Connection *connection): Stub(orb, objectKey, connection) {}\n`);
|
|
36
|
-
for (let _export of interface_body.child) {
|
|
37
|
-
switch (_export.type) {
|
|
38
|
-
case Type.SYN_OPERATION_DECLARATION:
|
|
39
|
-
{
|
|
40
|
-
let op_dcl = _export;
|
|
41
|
-
let attribute = op_dcl.child[0];
|
|
42
|
-
let returnType = op_dcl.child[1];
|
|
43
|
-
let oneway = false;
|
|
44
|
-
if (attribute !== undefined && attribute.type === Type.TKN_ONEWAY)
|
|
45
|
-
oneway = true;
|
|
46
|
-
if (oneway && returnType.type !== Type.TKN_VOID)
|
|
47
|
-
console.log("WARNING: corba.js currently requires every oneway function to return void");
|
|
48
|
-
let identifier = op_dcl.child[2].text;
|
|
49
|
-
let parameter_decls = op_dcl.child[3].child;
|
|
50
|
-
out.write(" virtual ");
|
|
51
|
-
if (oneway) {
|
|
52
|
-
out.write(`${typeIDLtoCC(returnType, Direction.OUT)}`);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
out.write(`CORBA::async<${typeIDLtoCC(returnType, Direction.OUT)}>`);
|
|
56
|
-
}
|
|
57
|
-
out.write(` ${identifier}(`);
|
|
58
|
-
let comma = false;
|
|
59
|
-
for (let parameter_dcl of parameter_decls) {
|
|
60
|
-
let attribute = parameter_dcl.child[0].type;
|
|
61
|
-
let type = parameter_dcl.child[1];
|
|
62
|
-
let identifier = parameter_dcl.child[2].text;
|
|
63
|
-
if (attribute !== Type.TKN_IN) {
|
|
64
|
-
throw Error("corba.js currently only supports 'in' parameters");
|
|
65
|
-
}
|
|
66
|
-
if (!comma) {
|
|
67
|
-
comma = true;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
out.write(", ");
|
|
71
|
-
}
|
|
72
|
-
out.write(`${typeIDLtoCC(type, Direction.IN)} ${identifier}`);
|
|
73
|
-
}
|
|
74
|
-
out.write(`) override;\n`);
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
case Type.TKN_ATTRIBUTE:
|
|
78
|
-
{
|
|
79
|
-
}
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
throw Error("yikes");
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
out.write("};\n\n");
|
|
86
|
-
}
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=write-stub.js.map
|