corba.js 0.1.7 → 0.1.8
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/README.md +3 -1
- package/lib/idl/idl.cjs +3771 -2909
- package/lib/idl/idl.cjs.map +1 -1
- package/m13-es-transformer.cjs +190 -0
- package/package.json +33 -31
- 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/util.d.ts +0 -25
- package/lib/idl/src/idl/write-interface.d.ts +0 -2
- package/lib/idl/src/idl/write-skeleton.d.ts +0 -2
- package/lib/idl/src/idl/write-stub.d.ts +0 -2
- package/lib/idl/src/idl/write-value.d.ts +0 -2
- package/lib/idl/src/idl/write-valueimpl.d.ts +0 -2
- package/lib/idl/src/idl/write-valuetype.d.ts +0 -2
- 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 -42
- 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 -276
- 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/idl/test/access.spec.d.ts +0 -1
- package/lib/idl/test/attribute.spec.d.ts +0 -1
- package/lib/idl/test/basics.spec.d.ts +0 -1
- package/lib/idl/test/disconnect.spec.d.ts +0 -1
- package/lib/idl/test/eventtarget.spec.d.ts +0 -1
- package/lib/idl/test/fake.d.ts +0 -31
- package/lib/idl/test/giop.spec.d.ts +0 -1
- package/lib/idl/test/idl/idl.spec.d.ts +0 -1
- package/lib/idl/test/idl_module.spec.d.ts +0 -1
- package/lib/idl/test/initialreferences.spec.d.ts +0 -1
- package/lib/idl/test/net/tls.spec.d.ts +0 -1
- package/lib/idl/test/net/ws.spec.d.ts +0 -1
- package/lib/idl/test/net/wss.spec.d.ts +0 -1
- package/lib/idl/test/object_by_reference.spec.d.ts +0 -1
- package/lib/idl/test/orb/asn1.spec.d.ts +0 -1
- package/lib/idl/test/orb/url.spec.d.ts +0 -1
- package/lib/idl/test/stub.spec.d.ts +0 -1
- package/lib/idl/test/util.d.ts +0 -5
- package/lib/idl/test/valuetype.spec.d.ts +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 -1199
- 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 -180
- package/lib/src/idl/idl.js.map +0 -1
- package/lib/src/idl/util.d.ts +0 -25
- package/lib/src/idl/util.js +0 -248
- package/lib/src/idl/util.js.map +0 -1
- package/lib/src/idl/write-interface.d.ts +0 -2
- package/lib/src/idl/write-interface.js +0 -212
- package/lib/src/idl/write-interface.js.map +0 -1
- package/lib/src/idl/write-skeleton.d.ts +0 -2
- package/lib/src/idl/write-skeleton.js +0 -116
- package/lib/src/idl/write-skeleton.js.map +0 -1
- package/lib/src/idl/write-stub.d.ts +0 -2
- package/lib/src/idl/write-stub.js +0 -116
- package/lib/src/idl/write-stub.js.map +0 -1
- package/lib/src/idl/write-value.d.ts +0 -2
- package/lib/src/idl/write-value.js +0 -206
- package/lib/src/idl/write-value.js.map +0 -1
- package/lib/src/idl/write-valueimpl.d.ts +0 -2
- package/lib/src/idl/write-valueimpl.js +0 -158
- package/lib/src/idl/write-valueimpl.js.map +0 -1
- package/lib/src/idl/write-valuetype.d.ts +0 -2
- package/lib/src/idl/write-valuetype.js +0 -98
- package/lib/src/idl/write-valuetype.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 -42
- 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 -276
- package/lib/src/orb/giop.js +0 -1204
- 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 -110
- 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 -252
- package/lib/src/orb/url.js.map +0 -1
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { Type } from "./idl-node.js";
|
|
3
|
-
import { filenamePrefix, filename, filenameLocal, hasNative, hasValueType, writeIndent, classAttributes, typeIDLtoTS, typeIDLtoGIOP, FileType, defaultValueIDLtoTS } from "./util.js";
|
|
4
|
-
let initCalls = "";
|
|
5
|
-
export function writeTSValue(specification) {
|
|
6
|
-
initCalls = "";
|
|
7
|
-
let out = fs.createWriteStream(filenamePrefix + "_value.ts");
|
|
8
|
-
out.write(`// This file is generated by the corba.js IDL compiler from '${filename}'.\n\n`);
|
|
9
|
-
out.write(`import { ORB, GIOPDecoder, GIOPEncoder } from 'corba.js'\n`);
|
|
10
|
-
out.write("import * as _interface from \"./" + filenameLocal + "\"\n\n");
|
|
11
|
-
if (!hasValueType(specification)) {
|
|
12
|
-
out.write("// no valuetype's defined in IDL");
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (hasNative(specification)) {
|
|
16
|
-
out.write("declare global {\n");
|
|
17
|
-
for (let definition of specification.child) {
|
|
18
|
-
if (definition.type === Type.TKN_NATIVE) {
|
|
19
|
-
let native = definition;
|
|
20
|
-
let nativeName = native.text;
|
|
21
|
-
if (nativeName.length <= 4 ||
|
|
22
|
-
nativeName.substring(nativeName.length - 4) !== "_ptr") {
|
|
23
|
-
out.write(` interface ${nativeName} {}\n`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
out.write("}\n\n");
|
|
28
|
-
}
|
|
29
|
-
writeTSValueDefinitions(out, specification);
|
|
30
|
-
out.write("let initialized = false\n");
|
|
31
|
-
out.write("export function _init() {\n");
|
|
32
|
-
out.write(" if (initialized)\n");
|
|
33
|
-
out.write(" return\n");
|
|
34
|
-
out.write(" initialized = true\n");
|
|
35
|
-
out.write(initCalls);
|
|
36
|
-
out.write("}\n");
|
|
37
|
-
out.write("_init()\n");
|
|
38
|
-
}
|
|
39
|
-
function writeTSValueDefinitions(out, specification, prefix = "", indent = 0) {
|
|
40
|
-
for (let definition of specification.child) {
|
|
41
|
-
switch (definition.type) {
|
|
42
|
-
case Type.TKN_MODULE:
|
|
43
|
-
{
|
|
44
|
-
writeIndent(out, indent);
|
|
45
|
-
out.write(`export namespace ${definition.text} {\n\n`);
|
|
46
|
-
writeTSValueDefinitions(out, definition, prefix + definition.text + ".", indent + 1);
|
|
47
|
-
writeIndent(out, indent);
|
|
48
|
-
out.write(`} // namespace ${definition.text}\n\n`);
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
case Type.TKN_NATIVE:
|
|
52
|
-
{
|
|
53
|
-
}
|
|
54
|
-
break;
|
|
55
|
-
case Type.TKN_VALUETYPE:
|
|
56
|
-
{
|
|
57
|
-
let value_dcl = definition;
|
|
58
|
-
let value_header = value_dcl.child[0];
|
|
59
|
-
let custom = value_header.child[0];
|
|
60
|
-
let identifier = value_header.child[1].text;
|
|
61
|
-
let inheritance_spec = value_header.child[2];
|
|
62
|
-
writeIndent(out, indent);
|
|
63
|
-
out.write(`export interface ${identifier}`);
|
|
64
|
-
let attributes = new Array();
|
|
65
|
-
classAttributes.set(prefix + identifier, attributes);
|
|
66
|
-
if (inheritance_spec !== undefined) {
|
|
67
|
-
if (inheritance_spec.child.length > 2)
|
|
68
|
-
throw Error("multiple inheritance is not supported for TypeScript");
|
|
69
|
-
out.write(` extends ${inheritance_spec.child[1].text}`);
|
|
70
|
-
let superAttributes = classAttributes.get(prefix + inheritance_spec.child[1].text);
|
|
71
|
-
if (superAttributes === undefined) {
|
|
72
|
-
superAttributes = classAttributes.get(inheritance_spec.child[1].text);
|
|
73
|
-
}
|
|
74
|
-
if (superAttributes === undefined) {
|
|
75
|
-
throw Error("failed to find attributes for super class");
|
|
76
|
-
}
|
|
77
|
-
for (let attribute of superAttributes) {
|
|
78
|
-
attributes.push(attribute);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
out.write(" {\n");
|
|
82
|
-
for (let i = 1; i < value_dcl.child.length; ++i) {
|
|
83
|
-
let value_element = value_dcl.child[i];
|
|
84
|
-
if (value_element.type === Type.SYN_STATE_MEMBER) {
|
|
85
|
-
let state_member = value_element;
|
|
86
|
-
let attribute = state_member.child[0];
|
|
87
|
-
let type = state_member.child[1];
|
|
88
|
-
let declarators = state_member.child[2];
|
|
89
|
-
for (let declarator of declarators.child) {
|
|
90
|
-
writeIndent(out, indent + 1);
|
|
91
|
-
out.write(declarator.text + ": " + typeIDLtoTS(type, FileType.VALUE) + "\n");
|
|
92
|
-
attributes.push(declarator.text);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
writeIndent(out, indent);
|
|
97
|
-
out.write("}\n");
|
|
98
|
-
writeIndent(out, indent);
|
|
99
|
-
out.write(`export function init${identifier}(object: ${identifier}, init?: Partial<${identifier}> | GIOPDecoder) {\n`);
|
|
100
|
-
++indent;
|
|
101
|
-
writeIndent(out, indent);
|
|
102
|
-
out.write(`if (init instanceof GIOPDecoder) {\n`);
|
|
103
|
-
writeIndent(out, indent + 1);
|
|
104
|
-
out.write(`const decoder = init\n`);
|
|
105
|
-
writeTSInitValueFromGIOP(value_dcl, out, indent + 1);
|
|
106
|
-
writeIndent(out, indent);
|
|
107
|
-
out.write(`} else {\n`);
|
|
108
|
-
writeTSInitValueFromPOJO(value_dcl, out, indent + 1);
|
|
109
|
-
writeIndent(out, indent);
|
|
110
|
-
out.write("}\n");
|
|
111
|
-
--indent;
|
|
112
|
-
writeIndent(out, indent);
|
|
113
|
-
out.write("}\n");
|
|
114
|
-
writeIndent(out, indent);
|
|
115
|
-
out.write(`export function encode${identifier}(encoder: GIOPEncoder, obj: ${identifier}) {\n`);
|
|
116
|
-
++indent;
|
|
117
|
-
if (inheritance_spec !== undefined) {
|
|
118
|
-
writeIndent(out, indent);
|
|
119
|
-
out.write(`encode${inheritance_spec.child[1].text}(encoder, obj)\n`);
|
|
120
|
-
}
|
|
121
|
-
for (let i = 1; i < value_dcl.child.length; ++i) {
|
|
122
|
-
let value_element = value_dcl.child[i];
|
|
123
|
-
if (value_element.type === Type.SYN_STATE_MEMBER) {
|
|
124
|
-
let state_member = value_element;
|
|
125
|
-
let attribute = state_member.child[0];
|
|
126
|
-
let type = state_member.child[1];
|
|
127
|
-
let declarators = state_member.child[2];
|
|
128
|
-
for (let declarator of declarators.child) {
|
|
129
|
-
writeIndent(out, indent);
|
|
130
|
-
out.write(`${typeIDLtoGIOP(type, "obj." + declarator.text)}\n`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
--indent;
|
|
135
|
-
writeIndent(out, indent);
|
|
136
|
-
out.write("}\n\n");
|
|
137
|
-
initCalls += ` ORB.valueTypeByName.set("${prefix}${identifier}", {attributes:[`;
|
|
138
|
-
let comma = false;
|
|
139
|
-
for (let attribute of attributes) {
|
|
140
|
-
if (comma) {
|
|
141
|
-
initCalls += ", ";
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
comma = true;
|
|
145
|
-
}
|
|
146
|
-
initCalls += `"${attribute}"`;
|
|
147
|
-
}
|
|
148
|
-
initCalls += `],encode:${prefix}encode${identifier}})\n`;
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function writeTSInitValueFromGIOP(value_dcl, out, indent) {
|
|
155
|
-
for (let i = 1; i < value_dcl.child.length; ++i) {
|
|
156
|
-
let value_element = value_dcl.child[i];
|
|
157
|
-
if (value_element.type === Type.SYN_STATE_MEMBER) {
|
|
158
|
-
let state_member = value_element;
|
|
159
|
-
let type = state_member.child[1];
|
|
160
|
-
let declarators = state_member.child[2];
|
|
161
|
-
for (let declarator of declarators.child) {
|
|
162
|
-
let decl_identifier = declarator.text;
|
|
163
|
-
writeIndent(out, indent);
|
|
164
|
-
out.write(`object.${decl_identifier} = ${typeIDLtoGIOP(type)}\n`);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function writeTSInitValueFromPOJO(value_dcl, out, indent) {
|
|
170
|
-
for (let i = 1; i < value_dcl.child.length; ++i) {
|
|
171
|
-
let value_element = value_dcl.child[i];
|
|
172
|
-
if (value_element.type === Type.SYN_STATE_MEMBER) {
|
|
173
|
-
let state_member = value_element;
|
|
174
|
-
let attribute = state_member.child[0];
|
|
175
|
-
let type = state_member.child[1];
|
|
176
|
-
let declarators = state_member.child[2];
|
|
177
|
-
for (let declarator of declarators.child) {
|
|
178
|
-
let decl_identifier = declarator.text;
|
|
179
|
-
writeIndent(out, indent);
|
|
180
|
-
if (type.type === Type.TKN_IDENTIFIER) {
|
|
181
|
-
if (type.child[0]?.type == Type.TKN_NATIVE &&
|
|
182
|
-
type.text.length > 4 &&
|
|
183
|
-
type.text.substring(type.text.length - 4) === "_ptr") {
|
|
184
|
-
let name = typeIDLtoTS(type, FileType.VALUE);
|
|
185
|
-
out.write(`if (init !== undefined && init.${decl_identifier} !== undefined) object.${decl_identifier} = new (ORB.lookupValueType("${name}"))(init.${decl_identifier})\n`);
|
|
186
|
-
}
|
|
187
|
-
else if (type.child[0]?.type == Type.TKN_SEQUENCE) {
|
|
188
|
-
out.write(`object.${decl_identifier} = init?.${decl_identifier} instanceof Array ? init!.${decl_identifier} : []\n`);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
let name = typeIDLtoTS(type, FileType.VALUE);
|
|
192
|
-
out.write(`const vt${decl_identifier} = ORB.lookupValueType("${name}")\n`);
|
|
193
|
-
writeIndent(out, indent);
|
|
194
|
-
out.write(`object.${decl_identifier} = vt${decl_identifier}.prototype.isPrototypeOf(init?.${decl_identifier}) ? init!.${decl_identifier} : new (vt${decl_identifier})(init?.${decl_identifier})\n`);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
out.write(`object.${decl_identifier} = (init === undefined || init.${decl_identifier} === undefined) ? `);
|
|
199
|
-
out.write(defaultValueIDLtoTS(type, FileType.VALUETYPE));
|
|
200
|
-
out.write(` : init.${decl_identifier}\n`);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=write-value.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-value.js","sourceRoot":"","sources":["../../../src/idl/write-value.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAE,IAAI,EAAQ,sBAAkB;AACvC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,mBAAmB,EAAE,kBAAc;AAElL,IAAI,SAAS,GAAG,EAAE,CAAA;AAClB,MAAM,UAAU,YAAY,CAAC,aAAmB;IAC5C,SAAS,GAAG,EAAE,CAAA;IAEd,IAAI,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,GAAG,WAAW,CAAC,CAAA;IAC5D,GAAG,CAAC,KAAK,CAAC,gEAAgE,QAAQ,QAAQ,CAAC,CAAA;IAC3F,GAAG,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAA;IACvE,GAAG,CAAC,KAAK,CAAC,kCAAkC,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAA;IACxE,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;QAC9B,GAAG,CAAC,KAAK,CAAC,kCAAkC,CAAC,CA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I,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;wBAC5C,GAAG,CAAC,KAAK,CAAC,WAAW,eAAe,2BAA2B,IAAI,MAAM,CAAC,CAAA;wBAC1E,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;wBACxB,GAAG,CAAC,KAAK,CAAC,UAAU,eAAe,QAAQ,eAAe,kCAAkC,eAAe,aAAa,eAAe,aAAa,eAAe,WAAW,eAAe,KAAK,CAAC,CAAA;qBACtM;iBACJ;qBAAM;oBACH,GAAG,CAAC,KAAK,CAAC,UAAU,eAAe,kCAAkC,eAAe,oBAAoB,CAAC,CAAA;oBACzG,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;oBACxD,GAAG,CAAC,KAAK,CAAC,WAAW,eAAe,IAAI,CAAC,CAAA;iBAC5C;aACJ;SACJ;KACJ;AACL,CAAC"}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { Type } from "./idl-node.js";
|
|
3
|
-
import { filenamePrefix, filename, filenameLocal, hasNative, hasValueType, writeIndent, typeIDLtoTS, FileType } from "./util.js";
|
|
4
|
-
export function writeTSValueImpl(specification) {
|
|
5
|
-
let out = fs.createWriteStream(filenamePrefix + "_valueimpl.ts");
|
|
6
|
-
out.write(`// This file is generated by the corba.js IDL compiler from '${filename}'.\n\n`);
|
|
7
|
-
out.write("import { ORB } from 'corba.js'\n");
|
|
8
|
-
if (!hasValueType(specification)) {
|
|
9
|
-
out.write("// no valuetype's defined in IDL");
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
out.write(`import * as value from "./${filenameLocal}_value"\n\n`);
|
|
13
|
-
out.write(`import * as valuetype from "./${filenameLocal}_valuetype"\n\n`);
|
|
14
|
-
out.write(`import * as _interface from "./${filenameLocal}"\n\n`);
|
|
15
|
-
if (hasNative(specification)) {
|
|
16
|
-
out.write("declare global {\n");
|
|
17
|
-
for (let definition of specification.child) {
|
|
18
|
-
switch (definition.type) {
|
|
19
|
-
case Type.TKN_NATIVE:
|
|
20
|
-
{
|
|
21
|
-
let native = definition;
|
|
22
|
-
let nativeName = native.text;
|
|
23
|
-
if (nativeName.length <= 4 ||
|
|
24
|
-
nativeName.substring(nativeName.length - 4) !== "_ptr") {
|
|
25
|
-
out.write(" interface " + nativeName + " {}\n");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
out.write("}\n\n");
|
|
32
|
-
}
|
|
33
|
-
writeTSValueImplDefinitions(out, specification);
|
|
34
|
-
}
|
|
35
|
-
function hasOperationDeclarations(value_dcl) {
|
|
36
|
-
for (let i = 1; i < value_dcl.child.length; ++i) {
|
|
37
|
-
let value_element = value_dcl.child[i];
|
|
38
|
-
if (value_element.type === Type.SYN_OPERATION_DECLARATION) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
let value_header = value_dcl.child[0];
|
|
43
|
-
let inheritance_spec = value_header.child[2];
|
|
44
|
-
if (inheritance_spec !== undefined) {
|
|
45
|
-
if (inheritance_spec.child[1].child[0].type === Type.TKN_VALUETYPE) {
|
|
46
|
-
let value_dcl = inheritance_spec.child[1].child[0];
|
|
47
|
-
if (hasOperationDeclarations(value_dcl)) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
function writeTSValueImplDefinitions(out, specification, prefix = "", indent = 0) {
|
|
55
|
-
for (let definition of specification.child) {
|
|
56
|
-
switch (definition.type) {
|
|
57
|
-
case Type.TKN_MODULE:
|
|
58
|
-
{
|
|
59
|
-
out.write("export namespace " + definition.text + " {\n\n");
|
|
60
|
-
writeTSValueImplDefinitions(out, definition, prefix + definition.text + ".", indent + 1);
|
|
61
|
-
out.write("} // namespace " + definition.text + "\n\n");
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
case Type.TKN_NATIVE:
|
|
65
|
-
{
|
|
66
|
-
}
|
|
67
|
-
break;
|
|
68
|
-
case Type.TKN_VALUETYPE:
|
|
69
|
-
{
|
|
70
|
-
let value_dcl = definition;
|
|
71
|
-
let value_header = value_dcl.child[0];
|
|
72
|
-
let custom = value_header.child[0];
|
|
73
|
-
let identifier = value_header.child[1].text;
|
|
74
|
-
let inheritance_spec = value_header.child[2];
|
|
75
|
-
writeIndent(out, indent);
|
|
76
|
-
out.write("export ");
|
|
77
|
-
if (hasOperationDeclarations(value_dcl))
|
|
78
|
-
out.write("abstract ");
|
|
79
|
-
else if (inheritance_spec !== undefined) {
|
|
80
|
-
if (inheritance_spec.child[1].child[0].type === Type.TKN_VALUETYPE) {
|
|
81
|
-
let value_dcl = inheritance_spec.child[1].child[0];
|
|
82
|
-
if (hasOperationDeclarations(value_dcl))
|
|
83
|
-
out.write("abstract ");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
out.write("class " + identifier);
|
|
87
|
-
if (inheritance_spec !== undefined) {
|
|
88
|
-
if (inheritance_spec.child.length > 2)
|
|
89
|
-
throw Error("multiple inheritance is not supported for TypeScript");
|
|
90
|
-
out.write(" extends " + inheritance_spec.child[1].text);
|
|
91
|
-
}
|
|
92
|
-
out.write(` implements valuetype.${prefix}${identifier} {\n`);
|
|
93
|
-
for (let i = 1; i < value_dcl.child.length; ++i) {
|
|
94
|
-
let value_element = value_dcl.child[i];
|
|
95
|
-
if (value_element.type === Type.SYN_STATE_MEMBER) {
|
|
96
|
-
let state_member = value_element;
|
|
97
|
-
let attribute = state_member.child[0];
|
|
98
|
-
let type = state_member.child[1];
|
|
99
|
-
let declarators = state_member.child[2];
|
|
100
|
-
for (let declarator of declarators.child) {
|
|
101
|
-
writeIndent(out, indent + 1);
|
|
102
|
-
out.write(declarator.text + "!: " + typeIDLtoTS(type, FileType.VALUETYPE) + "\n");
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
out.write("\n");
|
|
107
|
-
writeIndent(out, indent + 1);
|
|
108
|
-
out.write(`constructor(init?: Partial<value.${prefix}${identifier}>) {\n`);
|
|
109
|
-
if (inheritance_spec) {
|
|
110
|
-
writeIndent(out, indent + 2);
|
|
111
|
-
out.write("super(init)\n");
|
|
112
|
-
}
|
|
113
|
-
writeIndent(out, indent + 2);
|
|
114
|
-
out.write(`value.${prefix}init${identifier}(this, init)\n`);
|
|
115
|
-
writeIndent(out, indent + 1);
|
|
116
|
-
out.write("}\n");
|
|
117
|
-
for (let i = 1; i < value_dcl.child.length; ++i) {
|
|
118
|
-
let value_element = value_dcl.child[i];
|
|
119
|
-
if (value_element.type === Type.SYN_OPERATION_DECLARATION) {
|
|
120
|
-
let op_decl = value_element;
|
|
121
|
-
let attribute = op_decl.child[0];
|
|
122
|
-
let type = op_decl.child[1];
|
|
123
|
-
let op_identifier = op_decl.child[2].text;
|
|
124
|
-
let parameter_decls = op_decl.child[3].child;
|
|
125
|
-
writeIndent(out, indent + 1);
|
|
126
|
-
out.write("abstract ");
|
|
127
|
-
out.write(op_identifier + "(");
|
|
128
|
-
let comma = false;
|
|
129
|
-
for (let parameter_dcl of parameter_decls) {
|
|
130
|
-
let attribute = parameter_dcl.child[0].type;
|
|
131
|
-
let type = parameter_dcl.child[1];
|
|
132
|
-
let param_identifier = parameter_dcl.child[2].text;
|
|
133
|
-
if (attribute !== Type.TKN_IN) {
|
|
134
|
-
throw Error("corba.js currently only supports 'in' parameters");
|
|
135
|
-
}
|
|
136
|
-
if (comma) {
|
|
137
|
-
out.write(", ");
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
comma = true;
|
|
141
|
-
}
|
|
142
|
-
out.write(param_identifier);
|
|
143
|
-
out.write(": ");
|
|
144
|
-
out.write(typeIDLtoTS(type));
|
|
145
|
-
}
|
|
146
|
-
out.write("): ");
|
|
147
|
-
out.write(typeIDLtoTS(type));
|
|
148
|
-
out.write("\n");
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
writeIndent(out, indent);
|
|
152
|
-
out.write("}\n\n");
|
|
153
|
-
}
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
//# sourceMappingURL=write-valueimpl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-valueimpl.js","sourceRoot":"","sources":["../../../src/idl/write-valueimpl.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAE,IAAI,EAAQ,sBAAkB;AACvC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAc;AAE7H,MAAM,UAAU,gBAAgB,CAAC,aAAmB;IAChD,IAAI,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,GAAG,eAAe,CAAC,CAAA;IAChE,GAAG,CAAC,KAAK,CAAC,gEAAgE,QAAQ,QAAQ,CAAC,CAAA;IAC3F,GAAG,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAA;IAC7C,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;QAC9B,GAAG,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAA;QAC7C,OAAM;KACT;IACD,GAAG,CAAC,KAAK,CAAC,6BAA6B,aAAa,aAAa,CAAC,CAAA;IAClE,GAAG,CAAC,KAAK,CAAC,iCAAiC,aAAa,iBAAiB,CAAC,CAAA;IAC1E,GAAG,CAAC,KAAK,CAAC,kCAAkC,aAAa,OAAO,CAAC,CAAA;IAEjE,IAAI,SAAS,CAAC,aAAa,CAAC,EAAE;QAC1B,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAC/B,KAAK,IAAI,UAAU,IAAI,aAAa,CAAC,KAAK,EAAE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AW,CAAC,IAAI,CAAC,CAAC,CAAA;4BAC5B,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;yBAClB;qBACJ;oBACD,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;oBACxB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;iBACrB;gBAAC,MAAK;SACV;KACJ;AACL,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { Type } from "./idl-node.js";
|
|
3
|
-
import { filenamePrefix, filename, filenameLocal, hasNative, hasValueType, writeIndent, typeIDLtoTS, FileType } from "./util.js";
|
|
4
|
-
export function writeTSValueType(specification) {
|
|
5
|
-
let out = fs.createWriteStream(filenamePrefix + "_valuetype.ts");
|
|
6
|
-
out.write("// This file is generated by the corba.js IDL compiler from '" + filename + "'.\n\n");
|
|
7
|
-
out.write("import { ORB } from 'corba.js'\n");
|
|
8
|
-
if (!hasValueType(specification)) {
|
|
9
|
-
out.write("// no valuetype's defined in IDL");
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
out.write(`import * as value from "./${filenameLocal}_value\"\n\n`);
|
|
13
|
-
if (hasNative(specification)) {
|
|
14
|
-
out.write("declare global {\n");
|
|
15
|
-
for (let definition of specification.child) {
|
|
16
|
-
if (definition.type === Type.TKN_NATIVE) {
|
|
17
|
-
let native = definition;
|
|
18
|
-
let nativeName = native.text;
|
|
19
|
-
if (nativeName.length <= 4 ||
|
|
20
|
-
nativeName.substring(nativeName.length - 4) !== "_ptr") {
|
|
21
|
-
out.write(" interface " + nativeName + " {}\n");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
out.write("}\n\n");
|
|
26
|
-
}
|
|
27
|
-
writeTSValueTypeDefinitions(out, specification);
|
|
28
|
-
}
|
|
29
|
-
function writeTSValueTypeDefinitions(out, specification, prefix = "", indent = 0) {
|
|
30
|
-
for (let definition of specification.child) {
|
|
31
|
-
switch (definition.type) {
|
|
32
|
-
case Type.TKN_MODULE:
|
|
33
|
-
{
|
|
34
|
-
out.write(`export namespace ${definition.text} {\n\n`);
|
|
35
|
-
writeTSValueTypeDefinitions(out, definition, prefix + definition.text + ".", indent + 1);
|
|
36
|
-
out.write(`} // namespace ${definition.text}\n\n`);
|
|
37
|
-
}
|
|
38
|
-
break;
|
|
39
|
-
case Type.TKN_NATIVE:
|
|
40
|
-
{
|
|
41
|
-
}
|
|
42
|
-
break;
|
|
43
|
-
case Type.TKN_VALUETYPE:
|
|
44
|
-
{
|
|
45
|
-
let value_dcl = definition;
|
|
46
|
-
let value_header = value_dcl.child[0];
|
|
47
|
-
let custom = value_header.child[0];
|
|
48
|
-
let identifier = value_header.child[1].text;
|
|
49
|
-
let inheritance_spec = value_header.child[2];
|
|
50
|
-
writeIndent(out, indent);
|
|
51
|
-
out.write(`export interface ${identifier} extends value.${prefix}${identifier}`);
|
|
52
|
-
if (inheritance_spec !== undefined) {
|
|
53
|
-
if (inheritance_spec.child.length > 2)
|
|
54
|
-
throw Error("multiple inheritance is not supported for TypeScript");
|
|
55
|
-
out.write(", " + inheritance_spec.child[1].text);
|
|
56
|
-
}
|
|
57
|
-
out.write(" {\n");
|
|
58
|
-
for (let i = 1; i < value_dcl.child.length; ++i) {
|
|
59
|
-
let value_element = value_dcl.child[i];
|
|
60
|
-
if (value_element.type === Type.SYN_OPERATION_DECLARATION) {
|
|
61
|
-
let op_decl = value_element;
|
|
62
|
-
let attribute = op_decl.child[0];
|
|
63
|
-
let type = op_decl.child[1];
|
|
64
|
-
let op_identifier = op_decl.child[2].text;
|
|
65
|
-
let parameter_decls = op_decl.child[3].child;
|
|
66
|
-
writeIndent(out, indent + 1);
|
|
67
|
-
out.write(op_identifier + "(");
|
|
68
|
-
let comma = false;
|
|
69
|
-
for (let parameter_dcl of parameter_decls) {
|
|
70
|
-
let attribute = parameter_dcl.child[0].type;
|
|
71
|
-
let type = parameter_dcl.child[1];
|
|
72
|
-
let param_identifier = parameter_dcl.child[2].text;
|
|
73
|
-
if (attribute !== Type.TKN_IN) {
|
|
74
|
-
throw Error("corba.js currently only supports 'in' parameters");
|
|
75
|
-
}
|
|
76
|
-
if (comma) {
|
|
77
|
-
out.write(", ");
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
comma = true;
|
|
81
|
-
}
|
|
82
|
-
out.write(param_identifier);
|
|
83
|
-
out.write(": ");
|
|
84
|
-
out.write(typeIDLtoTS(type, FileType.VALUETYPE));
|
|
85
|
-
}
|
|
86
|
-
out.write("): ");
|
|
87
|
-
out.write(typeIDLtoTS(type, FileType.VALUETYPE));
|
|
88
|
-
out.write("\n");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
writeIndent(out, indent);
|
|
92
|
-
out.write("}\n\n");
|
|
93
|
-
}
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=write-valuetype.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-valuetype.js","sourceRoot":"","sources":["../../../src/idl/write-valuetype.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAE,IAAI,EAAQ,sBAAkB;AACvC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAc;AAE7H,MAAM,UAAU,gBAAgB,CAAC,aAAmB;IAChD,IAAI,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,GAAG,eAAe,CAAC,CAAA;IAChE,GAAG,CAAC,KAAK,CAAC,+DAA+D,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAA;IAChG,GAAG,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAA;IAC7C,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;QA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,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;4BAChD,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;yBAClB;qBACJ;oBACD,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;oBACxB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;iBAErB;gBAAC,MAAK;SACV;KACJ;AACL,CAAC"}
|
package/lib/src/index.d.ts
DELETED
package/lib/src/index.js
DELETED
package/lib/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,6BAAyB;AACzB,8BAA0B;AAC1B,8BAA0B;AAC1B,6BAAyB"}
|
package/lib/src/net/browser.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ORB } from "../orb/index";
|
|
2
|
-
import { Connection } from "../orb/connection";
|
|
3
|
-
import { Protocol } from "../orb/protocol";
|
|
4
|
-
export declare class WsProtocol implements Protocol {
|
|
5
|
-
connect(orb: ORB, host: string, port: number): Promise<Connection>;
|
|
6
|
-
close(): Promise<void>;
|
|
7
|
-
}
|
package/lib/src/net/browser.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Connection } from "../orb/connection.js";
|
|
2
|
-
export class WsProtocol {
|
|
3
|
-
async connect(orb, host, port) {
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
const socket = new WebSocket(`ws://${host}:${port}`);
|
|
6
|
-
socket.binaryType = "arraybuffer";
|
|
7
|
-
const connection = new WsConnection(orb, socket);
|
|
8
|
-
orb.addConnection(connection);
|
|
9
|
-
socket.onopen = () => {
|
|
10
|
-
socket.onmessage = async (msg) => {
|
|
11
|
-
if (msg.data instanceof Blob) {
|
|
12
|
-
orb.socketRcvd(connection, await msg.data.arrayBuffer());
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
orb.socketRcvd(connection, msg.data);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
socket.onerror = (event) => {
|
|
19
|
-
orb.socketError(connection, new Error(`WebSocket connection error with ${socket.url}`));
|
|
20
|
-
};
|
|
21
|
-
socket.onclose = (event) => orb.socketClosed(connection);
|
|
22
|
-
resolve(connection);
|
|
23
|
-
};
|
|
24
|
-
socket.onerror = (event) => {
|
|
25
|
-
reject(new Error(`Failed to connect to ${socket.url}`));
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
async close() { }
|
|
30
|
-
}
|
|
31
|
-
class WsConnection extends Connection {
|
|
32
|
-
constructor(orb, socket) {
|
|
33
|
-
super(orb);
|
|
34
|
-
this.socket = socket;
|
|
35
|
-
}
|
|
36
|
-
get localAddress() {
|
|
37
|
-
return "browser";
|
|
38
|
-
}
|
|
39
|
-
get localPort() {
|
|
40
|
-
return 0;
|
|
41
|
-
}
|
|
42
|
-
get remoteAddress() {
|
|
43
|
-
return this.socket.url;
|
|
44
|
-
}
|
|
45
|
-
get remotePort() {
|
|
46
|
-
return 0;
|
|
47
|
-
}
|
|
48
|
-
close() {
|
|
49
|
-
this.socket.close();
|
|
50
|
-
}
|
|
51
|
-
send(buffer) {
|
|
52
|
-
this.socket.send(buffer);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../src/net/browser.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,UAAU,EAAE,6BAAyB;AAG9C,MAAM,OAAO,UAAU;IAEnB,KAAK,CAAC,OAAO,CAAC,GAAQ,EAAE,IAAY,EAAE,IAAY;QAC9C,OAAO,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC/C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,QAAQ,IAAI,IAAI,IAAI,EAAE,CA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CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,SAAS,CAAA;IACpB,CAAC;IACD,IAAI,SAAS;QACT,OAAO,CAAC,CAAA;IACZ,CAAC;IACD,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAA;IAC1B,CAAC;IACD,IAAI,UAAU;QACV,OAAO,CAAC,CAAA;IACZ,CAAC;IAED,KAAK;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;IACD,IAAI,CAAC,MAAmB;QACpB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;CACJ"}
|
package/lib/src/net/index.d.ts
DELETED
package/lib/src/net/index.js
DELETED
package/lib/src/net/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/net/index.ts"],"names":[],"mappings":"AAAA,yBAAqB;AACrB,yBAAqB;AACrB,wBAAoB"}
|
package/lib/src/net/tcp.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ORB } from "../orb/index";
|
|
3
|
-
import { Server } from "net";
|
|
4
|
-
import { Connection } from "../orb/connection";
|
|
5
|
-
import { Protocol } from "../orb/protocol";
|
|
6
|
-
export declare class TcpProtocol implements Protocol {
|
|
7
|
-
serverSocket?: Server;
|
|
8
|
-
connect(orb: ORB, hostname: string, port: number): Promise<Connection>;
|
|
9
|
-
listen(orb: ORB, hostname: string, port: number): void;
|
|
10
|
-
close(): Promise<void>;
|
|
11
|
-
}
|