MCPcopy Create free account
hub / github.com/bnjbvr/trinity / wasmExportAdmin

Method wasmExportAdmin

java-module/TrinityModule.java:72–105  ·  view source on GitHub ↗
(int p0, int p1, int p2, int p3)

Source from the content-addressed store, hash-verified

70 }
71
72 @Export(name = "admin")
73 private static int wasmExportAdmin(int p0, int p1, int p2, int p3) {
74
75 byte[] bytes = new byte[p1];
76 Memory.getBytes(Address.fromInt(p0), bytes, 0, p1);
77
78 byte[] bytes0 = new byte[p3];
79 Memory.getBytes(Address.fromInt(p2), bytes0, 0, p3);
80
81 ArrayList<Message> result = TrinityModuleImpl.admin(new String(bytes, StandardCharsets.UTF_8), new String(bytes0, StandardCharsets.UTF_8));
82
83 int address4 = Memory.malloc((result).size() * 16, 4).toInt();
84 for (int index = 0; index < (result).size(); ++index) {
85 Message element = (result).get(index);
86 int base = address4 + (index * 16);
87 byte[] bytes1 = ((element).content).getBytes(StandardCharsets.UTF_8);
88
89 Address address = Memory.malloc(bytes1.length, 1);
90 Memory.putBytes(address, bytes1, 0, bytes1.length);
91 Address.fromInt((base) + 4).putInt(bytes1.length);
92 Address.fromInt((base) + 0).putInt(address.toInt());
93 byte[] bytes2 = ((element).to).getBytes(StandardCharsets.UTF_8);
94
95 Address address3 = Memory.malloc(bytes2.length, 1);
96 Memory.putBytes(address3, bytes2, 0, bytes2.length);
97 Address.fromInt((base) + 12).putInt(bytes2.length);
98 Address.fromInt((base) + 8).putInt(address3.toInt());
99
100 }
101 Address.fromInt((TrinityModuleWorld.RETURN_AREA) + 4).putInt((result).size());
102 Address.fromInt((TrinityModuleWorld.RETURN_AREA) + 0).putInt(address4);
103 return TrinityModuleWorld.RETURN_AREA;
104
105 }
106
107 @Export(name = "cabi_post_admin")
108 private static void wasmExportAdminPostReturn(int p0) {

Callers

nothing calls this directly

Calls 2

adminMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected