| 29 | } |
| 30 | |
| 31 | @Export(name = "help") |
| 32 | private static int wasmExportHelp(int p0, int p1, int p2) { |
| 33 | |
| 34 | String lifted; |
| 35 | |
| 36 | switch (p0) { |
| 37 | case 0: { |
| 38 | lifted = null; |
| 39 | break; |
| 40 | } |
| 41 | |
| 42 | case 1: { |
| 43 | |
| 44 | byte[] bytes = new byte[p2]; |
| 45 | Memory.getBytes(Address.fromInt(p1), bytes, 0, p2); |
| 46 | |
| 47 | lifted = new String(bytes, StandardCharsets.UTF_8); |
| 48 | break; |
| 49 | } |
| 50 | |
| 51 | default: throw new AssertionError("invalid discriminant: " + (p0)); |
| 52 | } |
| 53 | |
| 54 | String result = TrinityModuleImpl.help(lifted); |
| 55 | |
| 56 | byte[] bytes2 = (result).getBytes(StandardCharsets.UTF_8); |
| 57 | |
| 58 | Address address = Memory.malloc(bytes2.length, 1); |
| 59 | Memory.putBytes(address, bytes2, 0, bytes2.length); |
| 60 | Address.fromInt((TrinityModuleWorld.RETURN_AREA) + 4).putInt(bytes2.length); |
| 61 | Address.fromInt((TrinityModuleWorld.RETURN_AREA) + 0).putInt(address.toInt()); |
| 62 | return TrinityModuleWorld.RETURN_AREA; |
| 63 | |
| 64 | } |
| 65 | |
| 66 | @Export(name = "cabi_post_help") |
| 67 | private static void wasmExportHelpPostReturn(int p0) { |