| 118 | } |
| 119 | |
| 120 | @Export(name = "on-msg") |
| 121 | private static int wasmExportOnMsg(int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7) { |
| 122 | |
| 123 | byte[] bytes = new byte[p1]; |
| 124 | Memory.getBytes(Address.fromInt(p0), bytes, 0, p1); |
| 125 | |
| 126 | byte[] bytes0 = new byte[p3]; |
| 127 | Memory.getBytes(Address.fromInt(p2), bytes0, 0, p3); |
| 128 | |
| 129 | byte[] bytes1 = new byte[p5]; |
| 130 | Memory.getBytes(Address.fromInt(p4), bytes1, 0, p5); |
| 131 | |
| 132 | byte[] bytes2 = new byte[p7]; |
| 133 | Memory.getBytes(Address.fromInt(p6), bytes2, 0, p7); |
| 134 | |
| 135 | ArrayList<Message> result = TrinityModuleImpl.onMsg(new String(bytes, StandardCharsets.UTF_8), new String(bytes0, StandardCharsets.UTF_8), new String(bytes1, StandardCharsets.UTF_8), new String(bytes2, StandardCharsets.UTF_8)); |
| 136 | |
| 137 | int address6 = Memory.malloc((result).size() * 16, 4).toInt(); |
| 138 | for (int index = 0; index < (result).size(); ++index) { |
| 139 | Message element = (result).get(index); |
| 140 | int base = address6 + (index * 16); |
| 141 | byte[] bytes3 = ((element).content).getBytes(StandardCharsets.UTF_8); |
| 142 | |
| 143 | Address address = Memory.malloc(bytes3.length, 1); |
| 144 | Memory.putBytes(address, bytes3, 0, bytes3.length); |
| 145 | Address.fromInt((base) + 4).putInt(bytes3.length); |
| 146 | Address.fromInt((base) + 0).putInt(address.toInt()); |
| 147 | byte[] bytes4 = ((element).to).getBytes(StandardCharsets.UTF_8); |
| 148 | |
| 149 | Address address5 = Memory.malloc(bytes4.length, 1); |
| 150 | Memory.putBytes(address5, bytes4, 0, bytes4.length); |
| 151 | Address.fromInt((base) + 12).putInt(bytes4.length); |
| 152 | Address.fromInt((base) + 8).putInt(address5.toInt()); |
| 153 | |
| 154 | } |
| 155 | Address.fromInt((TrinityModuleWorld.RETURN_AREA) + 4).putInt((result).size()); |
| 156 | Address.fromInt((TrinityModuleWorld.RETURN_AREA) + 0).putInt(address6); |
| 157 | return TrinityModuleWorld.RETURN_AREA; |
| 158 | |
| 159 | } |
| 160 | |
| 161 | @Export(name = "cabi_post_on-msg") |
| 162 | private static void wasmExportOnMsgPostReturn(int p0) { |