diff --git a/README.md b/README.md index f05ab4cf3..df1ea4140 100644 --- a/README.md +++ b/README.md @@ -53,4 +53,4 @@ the generated documentation [can be browsed online](https://tweaked.cc/javadoc/) [ccrestitched]: https://www.curseforge.com/minecraft/mc-mods/cc-restitched "Download CC: Restitched from CurseForge" [forum]: https://forums.computercraft.cc/ [GitHub Discussions]: https://github.com/cc-tweaked/CC-Tweaked/discussions -[IRC]: http://webchat.esper.net/?channels=computercraft "#computercraft on EsperNet" +[IRC]: https://webchat.esper.net/?channels=computercraft "#computercraft on EsperNet" diff --git a/build.gradle b/build.gradle index c5c190aac..ba3b0a6b3 100644 --- a/build.gradle +++ b/build.gradle @@ -157,7 +157,7 @@ dependencies { extraModsRuntimeOnly fg.deobf("mezz.jei:jei-1.19.2-forge:11.3.0.262") extraModsCompileOnly fg.deobf("maven.modrinth:oculus:1.2.5") - shade 'org.squiddev:Cobalt:0.5.5' + shade 'org.squiddev:Cobalt:0.5.7' shade 'io.netty:netty-codec-http:4.1.76.Final' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' diff --git a/doc/guides/speaker_audio.md b/doc/guides/speaker_audio.md index 25d772dd2..6fb3e87f0 100644 --- a/doc/guides/speaker_audio.md +++ b/doc/guides/speaker_audio.md @@ -201,4 +201,4 @@ This is, I'm afraid, left as an exercise to the reader. [Ring Buffer]: https://en.wikipedia.org/wiki/Circular_buffer "Circular buffer - Wikipedia" [Sine Wave]: https://en.wikipedia.org/wiki/Sine_wave "Sine wave - Wikipedia" [GitHub Discussions]: https://github.com/cc-tweaked/CC-Tweaked/discussions -[IRC]: http://webchat.esper.net/?channels=computercraft "#computercraft on EsperNet" +[IRC]: https://webchat.esper.net/?channels=computercraft "#computercraft on EsperNet" diff --git a/doc/index.md b/doc/index.md index 697fc9421..07ec525e3 100644 --- a/doc/index.md +++ b/doc/index.md @@ -51,4 +51,4 @@ CC: Tweaked lives on [GitHub]. If you've got any ideas, feedback or bugs please [ccrestitched]: https://www.curseforge.com/minecraft/mc-mods/cc-restitched "Download CC: Restitched from CurseForge" [lua]: https://www.lua.org/ "Lua's main website" [GitHub Discussions]: https://github.com/cc-tweaked/CC-Tweaked/discussions -[IRC]: http://webchat.esper.net/?channels=computercraft "#computercraft on EsperNet" +[IRC]: https://webchat.esper.net/?channels=computercraft "#computercraft on EsperNet" diff --git a/src/main/java/dan200/computercraft/core/computer/ComputerExecutor.java b/src/main/java/dan200/computercraft/core/computer/ComputerExecutor.java index c6a3a7a34..331fa096a 100644 --- a/src/main/java/dan200/computercraft/core/computer/ComputerExecutor.java +++ b/src/main/java/dan200/computercraft/core/computer/ComputerExecutor.java @@ -625,6 +625,15 @@ final class ComputerExecutor } } + void printState( StringBuilder out ) + { + out.append( "Enqueued command: " ).append( command ).append( '\n' ); + out.append( "Enqueued events: " ).append( eventQueue.size() ).append( '\n' ); + + ILuaMachine machine = this.machine; + if( machine != null ) machine.printExecutionState( out ); + } + private void displayFailure( String message, String extra ) { Terminal terminal = computer.getTerminal(); diff --git a/src/main/java/dan200/computercraft/core/computer/ComputerThread.java b/src/main/java/dan200/computercraft/core/computer/ComputerThread.java index d557fabe5..d4dedcfb2 100644 --- a/src/main/java/dan200/computercraft/core/computer/ComputerThread.java +++ b/src/main/java/dan200/computercraft/core/computer/ComputerThread.java @@ -575,18 +575,22 @@ public final class ComputerThread StringBuilder builder = new StringBuilder() .append( "Terminating computer #" ).append( executor.getComputer().getID() ) .append( " due to timeout (running for " ).append( time * 1e-9 ) - .append( " seconds). This is NOT a bug, but may mean a computer is misbehaving. " ) + .append( " seconds). This is NOT a bug, but may mean a computer is misbehaving.\n" ) + .append( "Thread " ) .append( owner.getName() ) .append( " is currently " ) - .append( owner.getState() ); + .append( owner.getState() ) + .append( '\n' ); Object blocking = LockSupport.getBlocker( owner ); - if( blocking != null ) builder.append( "\n on " ).append( blocking ); + if( blocking != null ) builder.append( " on " ).append( blocking ).append( '\n' ); for( StackTraceElement element : owner.getStackTrace() ) { - builder.append( "\n at " ).append( element ); + builder.append( " at " ).append( element ).append( '\n' ); } + executor.printState( builder ); + ComputerCraft.log.warn( builder.toString() ); } } diff --git a/src/main/java/dan200/computercraft/core/lua/CobaltLuaMachine.java b/src/main/java/dan200/computercraft/core/lua/CobaltLuaMachine.java index 47718354b..199b5272d 100644 --- a/src/main/java/dan200/computercraft/core/lua/CobaltLuaMachine.java +++ b/src/main/java/dan200/computercraft/core/lua/CobaltLuaMachine.java @@ -214,6 +214,20 @@ public class CobaltLuaMachine implements ILuaMachine } } + @Override + public void printExecutionState( StringBuilder out ) + { + LuaState state = this.state; + if( state == null ) + { + out.append( "CobaltLuaMachine is terminated\n" ); + } + else + { + state.printExecutionState( out ); + } + } + @Override public void close() { diff --git a/src/main/java/dan200/computercraft/core/lua/ILuaMachine.java b/src/main/java/dan200/computercraft/core/lua/ILuaMachine.java index 1b981696a..2cfa48f3b 100644 --- a/src/main/java/dan200/computercraft/core/lua/ILuaMachine.java +++ b/src/main/java/dan200/computercraft/core/lua/ILuaMachine.java @@ -61,6 +61,15 @@ public interface ILuaMachine */ MachineResult handleEvent( @Nullable String eventName, @Nullable Object[] arguments ); + /** + * Print some information about the internal execution state. + *
+ * This function is purely intended for debugging, its output should not be relied on in any way. + * + * @param out The buffer to write to. + */ + void printExecutionState( StringBuilder out ); + /** * Close the Lua machine, aborting any running functions and deleting the internal state. */ diff --git a/src/main/resources/assets/computercraft/lang/nl_nl.json b/src/main/resources/assets/computercraft/lang/nl_nl.json index 40a14c9df..6bafd41c2 100644 --- a/src/main/resources/assets/computercraft/lang/nl_nl.json +++ b/src/main/resources/assets/computercraft/lang/nl_nl.json @@ -48,6 +48,7 @@ "commands.computercraft.dump.synopsis": "Geef de status van computers weer.", "commands.computercraft.dump.desc": "Geef de status van alle computers of specifieke informatie over \\u00e9\\u00e9n computer weer. Je kunt een instance-id (bijv. 123), computer-id (bijv. #123) of computer-label (bijv. \\\"@Mijn Computer\\\") opgeven.", "commands.computercraft.dump.action": "Geef meer informatie over deze computer weer", + "commands.computercraft.dump.open_path": "Toon de bestanden van deze computer", "commands.computercraft.shutdown.synopsis": "Sluit computers af op afstand.", "commands.computercraft.shutdown.desc": "Sluit alle genoemde computers af, of geen enkele wanneer niet gespecificeerd. Je kunt een instance-id (bijv. 123), computer-id (bijv. #123) of computer-label (bijv. \\\"@Mijn Computer\\\") opgeven.", "commands.computercraft.shutdown.done": "%s/%s computers afgesloten", @@ -109,5 +110,23 @@ "tracking_field.computercraft.coroutines_dead.name": "Coroutines verwijderd", "gui.computercraft.tooltip.copy": "Kopiƫren naar klembord", "gui.computercraft.tooltip.computer_id": "Computer ID: %s", - "gui.computercraft.tooltip.disk_id": "Diskette ID: %s" + "gui.computercraft.tooltip.disk_id": "Diskette ID: %s", + "gui.computercraft.tooltip.turn_on": "Zet deze computer aan", + "gui.computercraft.tooltip.turn_off": "Zet deze computer uit", + "gui.computercraft.tooltip.terminate": "Stop het huidige programma", + "gui.computercraft.upload.success": "Upload Geslaagd", + "gui.computercraft.upload.success.msg": "%d files geuploaded.", + "gui.computercraft.upload.failed": "Upload Mislukt", + "gui.computercraft.upload.failed.out_of_space": "Niet genoeg ruimte op deze computer om deze bestanden op te slaan.", + "gui.computercraft.upload.failed.computer_off": "Je moet de computer aanzetten alvorens je bestanden upload.", + "gui.computercraft.upload.failed.too_much": "Je bestanden zijn te groot om te uploaden.", + "gui.computercraft.upload.failed.name_too_long": "De namen van je bestanden zijn te lang om te uploaden.", + "gui.computercraft.upload.failed.too_many_files": "Je kan niet zoveel files tegelijk uploaden.", + "gui.computercraft.upload.failed.overwrite_dir": "De map %s kon niet worden geupload, er bestaat al een map met deze naam.", + "gui.computercraft.upload.failed.generic": "Uploaden van bestanden mislukt (%s)", + "gui.computercraft.upload.failed.corrupted": "De bestanden zijn beschadigd tijdens de upload. Probeer het opnieuw.", + "gui.computercraft.upload.overwrite": "Bestanden zullen worden overschreven.", + "gui.computercraft.upload.overwrite.detail": "De volgende bestanden zullen tijdens de upload worden overschreven. Doorgaan?%s", + "gui.computercraft.upload.overwrite_button": "Overschrijven", + "gui.computercraft.pocket_computer_overlay": "Zakcomputer open. Druk op ESC om te sluiten." } diff --git a/src/test/java/dan200/computercraft/core/computer/FakeComputerManager.java b/src/test/java/dan200/computercraft/core/computer/FakeComputerManager.java index ccbf101ba..4636e4054 100644 --- a/src/test/java/dan200/computercraft/core/computer/FakeComputerManager.java +++ b/src/test/java/dan200/computercraft/core/computer/FakeComputerManager.java @@ -211,6 +211,11 @@ public class FakeComputerManager } } + @Override + public void printExecutionState( StringBuilder out ) + { + } + @Override public void close() {