functionalscript 0.0.442 → 0.0.443
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/.github/workflows/com.yml +1 -1
- package/com/cpp/test.f.cjs +3 -11
- package/com/cpp/testlib.f.cjs +6 -0
- package/com/cs/test.f.cjs +2 -12
- package/com/cs/testlib.f.cjs +6 -0
- package/com/rust/test.f.cjs +119 -126
- package/com/rust/testlib.f.cjs +6 -0
- package/com/test/build.f.cjs +3 -3
- package/com/test/rust/Cargo.toml +3 -0
- package/package.json +3 -2
package/com/cpp/test.f.cjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const library = require('../types/testlib.f.cjs')
|
|
3
|
-
const text = require('../../text/module.f.cjs')
|
|
4
|
-
const { join } = require('../../types/module.f.cjs').string
|
|
1
|
+
const cpp = require('./testlib.f.cjs')
|
|
5
2
|
|
|
6
3
|
const f = () =>
|
|
7
4
|
{
|
|
8
|
-
const r = join('\n')(text.flat(' ')(_.cpp('My')(library)))
|
|
9
5
|
const e =
|
|
10
6
|
'#pragma once\n' +
|
|
11
7
|
'\n' +
|
|
@@ -34,11 +30,7 @@ const f = () =>
|
|
|
34
30
|
' virtual void COM_STDCALL SetManagedStruct(ManagedStruct a) = 0;\n' +
|
|
35
31
|
' };\n' +
|
|
36
32
|
'}'
|
|
37
|
-
if (
|
|
38
|
-
return r
|
|
33
|
+
if (cpp !== e) { throw cpp }
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
module.exports =
|
|
42
|
-
/** @readonly */
|
|
43
|
-
result: f()
|
|
44
|
-
}
|
|
36
|
+
module.exports = f
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const { join } = require("../../types/string/module.f.cjs");
|
|
2
|
+
const { flat } = require("../../text/module.f.cjs")
|
|
3
|
+
const library = require('../types/testlib.f.cjs')
|
|
4
|
+
const { cpp } = require('./module.f.cjs')
|
|
5
|
+
|
|
6
|
+
module.exports = join('\n')(flat(' ')(cpp('My')(library)))
|
package/com/cs/test.f.cjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const text = require('../../text/module.f.cjs')
|
|
3
|
-
const library = require('../types/testlib.f.cjs')
|
|
4
|
-
const { join } = require('../../types/string/module.f.cjs')
|
|
1
|
+
const cs = require('./testlib.f.cjs')
|
|
5
2
|
|
|
6
3
|
const f = () =>
|
|
7
4
|
{
|
|
8
|
-
const cs = join('\n')(text.flat(' ')(_.cs('My')(library)))
|
|
9
5
|
const e =
|
|
10
6
|
'using System;\n' +
|
|
11
7
|
'using System.Runtime.InteropServices;\n' +
|
|
@@ -44,12 +40,6 @@ const f = () =>
|
|
|
44
40
|
' }\n' +
|
|
45
41
|
'}'
|
|
46
42
|
if (cs !== e) { throw cs }
|
|
47
|
-
return cs
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
module.exports = {
|
|
53
|
-
/** @readonly */
|
|
54
|
-
result,
|
|
55
|
-
}
|
|
45
|
+
module.exports = f
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const { flat } = require('../../text/module.f.cjs');
|
|
2
|
+
const { join } = require('../../types/string/module.f.cjs');
|
|
3
|
+
const { cs } = require('./module.f.cjs');
|
|
4
|
+
const library = require('../types/testlib.f.cjs')
|
|
5
|
+
|
|
6
|
+
module.exports = join('\n')(flat(' ')(cs('My')(library)))
|
package/com/rust/test.f.cjs
CHANGED
|
@@ -1,127 +1,120 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { flat } = require('../../text/module.f.cjs')
|
|
3
|
-
const { join } = require('../../types/string/module.f.cjs')
|
|
4
|
-
const library = require('../types/testlib.f.cjs')
|
|
1
|
+
const rust = require('./testlib.f.cjs')
|
|
5
2
|
|
|
6
|
-
module.exports = {
|
|
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
|
-
if (r !== e) { throw r }
|
|
125
|
-
return r
|
|
126
|
-
}
|
|
127
|
-
}
|
|
3
|
+
module.exports = () => {
|
|
4
|
+
const e =
|
|
5
|
+
'#![allow(non_snake_case)]\n' +
|
|
6
|
+
'#[repr(C)]\n' +
|
|
7
|
+
'pub struct Slice {\n' +
|
|
8
|
+
' pub Start: *const u8,\n' +
|
|
9
|
+
' pub Size: usize,\n' +
|
|
10
|
+
'}\n' +
|
|
11
|
+
'#[repr(C)]\n' +
|
|
12
|
+
'pub struct ManagedStruct {\n' +
|
|
13
|
+
' pub M: IMy::Ref,\n' +
|
|
14
|
+
'}\n' +
|
|
15
|
+
'pub mod IMy {\n' +
|
|
16
|
+
' pub type Object = nanocom::Object<Interface>;\n' +
|
|
17
|
+
' pub type Ref = nanocom::Ref<Interface>;\n' +
|
|
18
|
+
' pub type Vmt = nanocom::Vmt<Interface>;\n' +
|
|
19
|
+
' #[repr(C)]\n' +
|
|
20
|
+
' pub struct Interface {\n' +
|
|
21
|
+
' pub GetSlice: unsafe extern "system" fn(this: &Object) -> super::Slice,\n' +
|
|
22
|
+
' pub SetSlice: unsafe extern "system" fn(this: &Object, slice: super::Slice),\n' +
|
|
23
|
+
' pub GetUnsafe: unsafe extern "system" fn(this: &Object) -> *const bool,\n' +
|
|
24
|
+
' pub SetUnsafe: unsafe extern "system" fn(this: &Object, p: *const super::Slice, size: u32),\n' +
|
|
25
|
+
' pub Some: unsafe extern "system" fn(this: &Object, p: &super::IMy::Object) -> bool,\n' +
|
|
26
|
+
' pub GetIMy: unsafe extern "system" fn(this: &Object) -> super::IMy::Ref,\n' +
|
|
27
|
+
' pub SetManagedStruct: unsafe extern "system" fn(this: &Object, a: super::ManagedStruct),\n' +
|
|
28
|
+
' }\n' +
|
|
29
|
+
' impl nanocom::Interface for Interface {\n' +
|
|
30
|
+
' const GUID: nanocom::GUID = 0xC66FB270_2D80_49AD_BB6E_88C1F90B805D;\n' +
|
|
31
|
+
' }\n' +
|
|
32
|
+
' pub trait Ex {\n' +
|
|
33
|
+
' fn GetSlice(&self) -> super::Slice;\n' +
|
|
34
|
+
' fn SetSlice(&self, slice: super::Slice);\n' +
|
|
35
|
+
' fn GetUnsafe(&self) -> *const bool;\n' +
|
|
36
|
+
' fn SetUnsafe(&self, p: *const super::Slice, size: u32);\n' +
|
|
37
|
+
' fn Some(&self, p: &super::IMy::Object) -> bool;\n' +
|
|
38
|
+
' fn GetIMy(&self) -> super::IMy::Ref;\n' +
|
|
39
|
+
' fn SetManagedStruct(&self, a: super::ManagedStruct);\n' +
|
|
40
|
+
' }\n' +
|
|
41
|
+
' impl Ex for Object {\n' +
|
|
42
|
+
' fn GetSlice(&self) -> super::Slice {\n' +
|
|
43
|
+
' unsafe { (self.interface().GetSlice)(self) }\n' +
|
|
44
|
+
' }\n' +
|
|
45
|
+
' fn SetSlice(&self, slice: super::Slice) {\n' +
|
|
46
|
+
' unsafe { (self.interface().SetSlice)(self, slice) }\n' +
|
|
47
|
+
' }\n' +
|
|
48
|
+
' fn GetUnsafe(&self) -> *const bool {\n' +
|
|
49
|
+
' unsafe { (self.interface().GetUnsafe)(self) }\n' +
|
|
50
|
+
' }\n' +
|
|
51
|
+
' fn SetUnsafe(&self, p: *const super::Slice, size: u32) {\n' +
|
|
52
|
+
' unsafe { (self.interface().SetUnsafe)(self, p, size) }\n' +
|
|
53
|
+
' }\n' +
|
|
54
|
+
' fn Some(&self, p: &super::IMy::Object) -> bool {\n' +
|
|
55
|
+
' unsafe { (self.interface().Some)(self, p) }\n' +
|
|
56
|
+
' }\n' +
|
|
57
|
+
' fn GetIMy(&self) -> super::IMy::Ref {\n' +
|
|
58
|
+
' unsafe { (self.interface().GetIMy)(self) }\n' +
|
|
59
|
+
' }\n' +
|
|
60
|
+
' fn SetManagedStruct(&self, a: super::ManagedStruct) {\n' +
|
|
61
|
+
' unsafe { (self.interface().SetManagedStruct)(self, a) }\n' +
|
|
62
|
+
' }\n' +
|
|
63
|
+
' }\n' +
|
|
64
|
+
' pub trait ClassEx\n' +
|
|
65
|
+
' where\n' +
|
|
66
|
+
' Self: nanocom::Class<Interface = Interface>,\n' +
|
|
67
|
+
' nanocom::CObject<Self>: Ex,\n' +
|
|
68
|
+
' {\n' +
|
|
69
|
+
' const INTERFACE: Interface = Interface {\n' +
|
|
70
|
+
' GetSlice: Self::GetSlice,\n' +
|
|
71
|
+
' SetSlice: Self::SetSlice,\n' +
|
|
72
|
+
' GetUnsafe: Self::GetUnsafe,\n' +
|
|
73
|
+
' SetUnsafe: Self::SetUnsafe,\n' +
|
|
74
|
+
' Some: Self::Some,\n' +
|
|
75
|
+
' GetIMy: Self::GetIMy,\n' +
|
|
76
|
+
' SetManagedStruct: Self::SetManagedStruct,\n' +
|
|
77
|
+
' };\n' +
|
|
78
|
+
' }\n' +
|
|
79
|
+
' impl<T> ClassEx for T\n' +
|
|
80
|
+
' where\n' +
|
|
81
|
+
' Self: nanocom::Class<Interface = Interface>,\n' +
|
|
82
|
+
' nanocom::CObject<Self>: Ex,\n' +
|
|
83
|
+
' {\n' +
|
|
84
|
+
' }\n' +
|
|
85
|
+
' trait PrivateClassEx\n' +
|
|
86
|
+
' where\n' +
|
|
87
|
+
' Self: nanocom::Class<Interface = Interface>,\n' +
|
|
88
|
+
' nanocom::CObject<Self>: Ex,\n' +
|
|
89
|
+
' {\n' +
|
|
90
|
+
' extern "system" fn GetSlice(this: &Object) -> super::Slice {\n' +
|
|
91
|
+
' unsafe { Self::to_cobject(this) }.GetSlice()\n' +
|
|
92
|
+
' }\n' +
|
|
93
|
+
' extern "system" fn SetSlice(this: &Object, slice: super::Slice) {\n' +
|
|
94
|
+
' unsafe { Self::to_cobject(this) }.SetSlice(slice)\n' +
|
|
95
|
+
' }\n' +
|
|
96
|
+
' extern "system" fn GetUnsafe(this: &Object) -> *const bool {\n' +
|
|
97
|
+
' unsafe { Self::to_cobject(this) }.GetUnsafe()\n' +
|
|
98
|
+
' }\n' +
|
|
99
|
+
' extern "system" fn SetUnsafe(this: &Object, p: *const super::Slice, size: u32) {\n' +
|
|
100
|
+
' unsafe { Self::to_cobject(this) }.SetUnsafe(p, size)\n' +
|
|
101
|
+
' }\n' +
|
|
102
|
+
' extern "system" fn Some(this: &Object, p: &super::IMy::Object) -> bool {\n' +
|
|
103
|
+
' unsafe { Self::to_cobject(this) }.Some(p)\n' +
|
|
104
|
+
' }\n' +
|
|
105
|
+
' extern "system" fn GetIMy(this: &Object) -> super::IMy::Ref {\n' +
|
|
106
|
+
' unsafe { Self::to_cobject(this) }.GetIMy()\n' +
|
|
107
|
+
' }\n' +
|
|
108
|
+
' extern "system" fn SetManagedStruct(this: &Object, a: super::ManagedStruct) {\n' +
|
|
109
|
+
' unsafe { Self::to_cobject(this) }.SetManagedStruct(a)\n' +
|
|
110
|
+
' }\n' +
|
|
111
|
+
' }\n' +
|
|
112
|
+
' impl<T> PrivateClassEx for T\n' +
|
|
113
|
+
' where\n' +
|
|
114
|
+
' Self: nanocom::Class<Interface = Interface>,\n' +
|
|
115
|
+
' nanocom::CObject<Self>: Ex,\n' +
|
|
116
|
+
' {\n' +
|
|
117
|
+
' }\n' +
|
|
118
|
+
'}'
|
|
119
|
+
if (rust !== e) { throw rust }
|
|
120
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const { flat } = require('../../text/module.f.cjs');
|
|
2
|
+
const { join } = require('../../types/string/module.f.cjs');
|
|
3
|
+
const { rust } = require('./module.f.cjs');
|
|
4
|
+
const library = require('../types/testlib.f.cjs')
|
|
5
|
+
|
|
6
|
+
module.exports = join('\n')(flat(' ')(rust(library)))
|
package/com/test/build.f.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const list = require('../../types/list/module.f.cjs')
|
|
2
2
|
const { flat } = list
|
|
3
3
|
|
|
4
|
-
const cppContent = require('../cpp/
|
|
5
|
-
const csContent = require('../cs/
|
|
6
|
-
const rustContent = require("../rust/
|
|
4
|
+
const cppContent = require('../cpp/testlib.f.cjs')
|
|
5
|
+
const csContent = require('../cs/testlib.f.cjs')
|
|
6
|
+
const rustContent = require("../rust/testlib.f.cjs")
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef {|
|
package/com/test/rust/Cargo.toml
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functionalscript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.443",
|
|
4
4
|
"description": "FunctionalScript is a functional subset of JavaScript",
|
|
5
5
|
"main": "module.f.cjs",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"tsc": "tsc",
|
|
8
8
|
"test": "tsc && npm run test-only",
|
|
9
9
|
"version": "node ./nodejs/version/main.cjs",
|
|
10
|
-
"test-only": "node --trace-uncaught ./dev/test.mjs"
|
|
10
|
+
"test-only": "node --trace-uncaught ./dev/test.mjs",
|
|
11
|
+
"comtest": "node ./com/test/build.cjs"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|