diff --git a/.idea/misc.xml b/.idea/misc.xml
index 24dfaa5..a8f82a8 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,7 +1,5 @@
-
-
-
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/JTCEMU/build.gradle.kts b/JTCEMU/build.gradle.kts
index 4fb20b5..e7d3a1d 100644
--- a/JTCEMU/build.gradle.kts
+++ b/JTCEMU/build.gradle.kts
@@ -1,7 +1,6 @@
-import org.gradle.internal.impldep.org.junit.experimental.categories.Categories.CategoryFilter.include
-
plugins {
id("java")
+ id("application")
}
group = "org.sqar.virtualjtc"
@@ -18,6 +17,11 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter")
}
+application {
+ mainModule = "JTCEMU"
+ mainClass = "org.jens_mueller.jtcemu.platform.se.Main"
+}
+
tasks.test {
useJUnitPlatform()
}
\ No newline at end of file
diff --git a/JTCEMU/settings.gradle b/JTCEMU/settings.gradle
deleted file mode 100644
index dd67535..0000000
--- a/JTCEMU/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = "JTCEMU"
\ No newline at end of file
diff --git a/JTCEMU/src/main/java/module-info.java b/JTCEMU/src/main/java/module-info.java
index 7ad005d..ffe0f39 100644
--- a/JTCEMU/src/main/java/module-info.java
+++ b/JTCEMU/src/main/java/module-info.java
@@ -1,9 +1,9 @@
-module org.jens_mueller.jtcemu.platform.se {
+module JTCEMU {
requires java.logging;
requires java.naming;
requires java.desktop;
- requires org.jens_mueller.JTCEMUCommon;
+ requires JTCEMUCommon;
opens org.jens_mueller.jtcemu.platform.se;
exports org.jens_mueller.jtcemu.platform.se;
diff --git a/JTCEMUCommon/settings.gradle b/JTCEMUCommon/settings.gradle
deleted file mode 100644
index fdb17bf..0000000
--- a/JTCEMUCommon/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = "JTCEMUCommon"
\ No newline at end of file
diff --git a/JTCEMUCommon/src/main/java/module-info.java b/JTCEMUCommon/src/main/java/module-info.java
index 334c700..866072d 100644
--- a/JTCEMUCommon/src/main/java/module-info.java
+++ b/JTCEMUCommon/src/main/java/module-info.java
@@ -1,11 +1,11 @@
-module org.jens_mueller.JTCEMUCommon {
- exports org.jens_mueller.jtcemu.base to org.jens_mueller.jtcemu.platform.se, org.jens_mueller.jtcemu.platform.fx;
- exports org.jens_mueller.jtcemu.tools to org.jens_mueller.jtcemu.platform.se, org.jens_mueller.jtcemu.platform.fx;
- exports org.jens_mueller.jtcemu.tools.assembler to org.jens_mueller.jtcemu.platform.se, org.jens_mueller.jtcemu.platform.fx;
- exports org.jens_mueller.z8 to org.jens_mueller.jtcemu.platform.se, org.jens_mueller.jtcemu.platform.fx;
+module JTCEMUCommon {
+ exports org.jens_mueller.jtcemu.base;
+ exports org.jens_mueller.jtcemu.tools;
+ exports org.jens_mueller.jtcemu.tools.assembler;
+ exports org.jens_mueller.z8;
- opens org.jens_mueller.jtcemu.base to org.jens_mueller.jtcemu.platform.se, org.jens_mueller.jtcemu.platform.fx;
- opens org.jens_mueller.jtcemu.tools to org.jens_mueller.jtcemu.platform.se, org.jens_mueller.jtcemu.platform.fx;
- opens org.jens_mueller.jtcemu.tools.assembler to org.jens_mueller.jtcemu.platform.se, org.jens_mueller.jtcemu.platform.fx;
- opens org.jens_mueller.z8 to org.jens_mueller.jtcemu.platform.se, org.jens_mueller.jtcemu.platform.fx;
+ opens org.jens_mueller.jtcemu.base;
+ opens org.jens_mueller.jtcemu.tools;
+ opens org.jens_mueller.jtcemu.tools.assembler;
+ opens org.jens_mueller.z8;
}
\ No newline at end of file
diff --git a/JTCEMUCommon/src/main/java/org/jens_mueller/jtcemu/base/ExtROM.java b/JTCEMUCommon/src/main/java/org/jens_mueller/jtcemu/base/ExtROM.java
index 50e9470..05c8da9 100644
--- a/JTCEMUCommon/src/main/java/org/jens_mueller/jtcemu/base/ExtROM.java
+++ b/JTCEMUCommon/src/main/java/org/jens_mueller/jtcemu/base/ExtROM.java
@@ -157,4 +157,4 @@ public String toString()
{
return this.text;
}
-}
+}
\ No newline at end of file
diff --git a/JTCemuFX/biuld.gradle.kts.off b/JTCemuFX/biuld.gradle.kts.off
index 56b191c..3f1b843 100644
--- a/JTCemuFX/biuld.gradle.kts.off
+++ b/JTCemuFX/biuld.gradle.kts.off
@@ -69,11 +69,6 @@ dependencies {
tasks.withType {
manifest {
attributes["Main-Class"] = "org.jens_mueller.jtcemu.platform.fx.Launcher"
-// attributes["Class-Path"] = configurations
-// .runtimeClasspath
-// .get()
-// .joinToString(separator = " ") { if (it.isDirectory) { it.toString() } else { zipTree(it).toString() } }
- // .duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
}
diff --git a/JTCemuFX/build.gradle b/JTCemuFX/build.gradle
index 8252ee2..9ce6c64 100644
--- a/JTCemuFX/build.gradle
+++ b/JTCemuFX/build.gradle
@@ -6,7 +6,7 @@ plugins {
id 'org.beryx.jlink' version '2.25.0'
}
-group 'com.example'
+group 'org.sqar.virtualjtc'
version '1.0-SNAPSHOT'
repositories {
@@ -18,30 +18,22 @@ ext {
junitVersion = '5.10.0'
}
-sourceCompatibility = '21'
-targetCompatibility = '21'
-
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
application {
- mainModule = 'com.example.jtcemufx'
- mainClass = 'com.example.jtcemufx.HelloApplication'
+ mainModule = "JTCemuFX"
+ mainClass = "org.jens_mueller.jtcemu.platform.fx.Launcher"
}
-
javafx {
version = "$javafx_version"
- application {
- mainClassName = "org.jens_mueller.jtcemu.platform.fx.Launcher"
- applicationName = 'JTCemuFX'
- modules = [ 'javafx.base','javafx.fxml','javafx.controls','javafx.graphics','javafx.web','javafx.media','javafx.swing' ]
- }
+ modules = [ 'javafx.base','javafx.fxml','javafx.controls','javafx.graphics','javafx.web','javafx.media','javafx.swing' ]
}
dependencies {
- implementation(project(":JTCEMUCommon"))
+ implementation project(":JTCEMUCommon")
// here starts JavaFX
compileOnly "org.openjfx:javafx:$javafx_version"
@@ -63,10 +55,6 @@ jar {
'Main-Class': 'org.jens_mueller.jtcemu.platform.fx.Launcher' // replace with you main class
)
}
- from {
- configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
- }
- duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
dependencies {
diff --git a/JTCemuFX/gradle/wrapper/gradle-wrapper.properties b/JTCemuFX/gradle/wrapper/gradle-wrapper.properties
index 15de902..a595206 100644
--- a/JTCemuFX/gradle/wrapper/gradle-wrapper.properties
+++ b/JTCemuFX/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/JTCemuFX/settings.gradle b/JTCemuFX/settings.gradle
deleted file mode 100644
index 8cc740e..0000000
--- a/JTCemuFX/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = "JTCemuFX"
\ No newline at end of file
diff --git a/JTCemuFX/src/main/java/module-info.java b/JTCemuFX/src/main/java/module-info.java
index c7b4beb..2199c78 100644
--- a/JTCemuFX/src/main/java/module-info.java
+++ b/JTCemuFX/src/main/java/module-info.java
@@ -1,4 +1,8 @@
-module org.jens_mueller.jtcemu.platform.fx {
+module JTCemuFX {
+ requires javafx.web;
+
+ requires JTCEMUCommon;
+
opens org.jens_mueller.jtcemu.platform.fx;
exports org.jens_mueller.jtcemu.platform.fx;
}
\ No newline at end of file
diff --git a/JTCemuFX/src/main/java/org/jens_mueller/jtcemu/platform/fx/JTCEMUApplication.java b/JTCemuFX/src/main/java/org/jens_mueller/jtcemu/platform/fx/JTCEMUApplication.java
index 87c5711..b7cd12f 100644
--- a/JTCemuFX/src/main/java/org/jens_mueller/jtcemu/platform/fx/JTCEMUApplication.java
+++ b/JTCemuFX/src/main/java/org/jens_mueller/jtcemu/platform/fx/JTCEMUApplication.java
@@ -27,6 +27,7 @@
import org.jens_mueller.jtcemu.base.ErrorViewer;
import org.jens_mueller.jtcemu.base.JTCSys;
import org.jens_mueller.jtcemu.base.JTCUtil;
+import org.jens_mueller.jtcemu.platform.fx.base.*;
import org.jens_mueller.jtcemu.platform.fx.settings.SettingsNode;
import org.jens_mueller.jtcemu.platform.fx.tools.ReassNode;
import org.jens_mueller.z8.Z8;
@@ -251,7 +252,7 @@ public Tab showTab(
tab = new Tab( text );
tab.setClosable( closable );
tab.setContent( content );
- if( content instanceof AppTab ) {
+ if( content instanceof AppTab) {
((AppTab) content).setTab( tab );
tab.setOnCloseRequest(
e->((AppTab) content).tabCloseRequest( e ) );
diff --git a/VirtualJTCCommon/build.gradle.kts b/VirtualJTCCommon/build.gradle.kts
index 4ae397d..aafb21d 100644
--- a/VirtualJTCCommon/build.gradle.kts
+++ b/VirtualJTCCommon/build.gradle.kts
@@ -1,8 +1,8 @@
plugins {
id("java")
+ id("application")
}
-//name = "VirtualJTCCommon"
group = "org.sqar.virtualjtc"
version = "1.0-SNAPSHOT"
@@ -15,6 +15,11 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter")
}
+application {
+ mainModule = "VirtualJTCCommon"
+ mainClass = "org.sqar.virtualjtc.jtcemu.Main"
+}
+
tasks.test {
useJUnitPlatform()
}
\ No newline at end of file
diff --git a/VirtualJTCCommon/gradle/wrapper/gradle-wrapper.jar b/VirtualJTCCommon/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..7f93135
Binary files /dev/null and b/VirtualJTCCommon/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/VirtualJTCCommon/gradle/wrapper/gradle-wrapper.properties b/VirtualJTCCommon/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..1af9e09
--- /dev/null
+++ b/VirtualJTCCommon/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/VirtualJTCCommon/gradlew b/VirtualJTCCommon/gradlew
new file mode 100755
index 0000000..1aa94a4
--- /dev/null
+++ b/VirtualJTCCommon/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/VirtualJTCCommon/gradlew.bat b/VirtualJTCCommon/gradlew.bat
new file mode 100644
index 0000000..6689b85
--- /dev/null
+++ b/VirtualJTCCommon/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/VirtualJTCCommon/settings.gradle b/VirtualJTCCommon/settings.gradle
deleted file mode 100644
index 4085340..0000000
--- a/VirtualJTCCommon/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = "VirtualJTCCommon"
\ No newline at end of file
diff --git a/VirtualJTCCommon/src/main/java/module-info.java b/VirtualJTCCommon/src/main/java/module-info.java
index dccb696..00f8fa2 100644
--- a/VirtualJTCCommon/src/main/java/module-info.java
+++ b/VirtualJTCCommon/src/main/java/module-info.java
@@ -1,4 +1,4 @@
-module jtcemu {
+module VirtualJTCCommon {
requires java.logging;
requires java.naming;
requires java.desktop;
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/Main.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/Main.java
index d929ff0..ca94513 100755
--- a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/Main.java
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/Main.java
@@ -18,8 +18,7 @@
import org.sqar.virtualjtc.jtcemu.base.*;
import org.sqar.virtualjtc.z8.Z8;
-import static org.jens_mueller.jtcemu.base.JTCSys.isRegInitZero;
-
+import static org.sqar.virtualjtc.jtcemu.base.JTCSys.isRegInitZero;
public class Main
{
@@ -128,7 +127,7 @@ public static void main( String[] args )
if( (addr >= 0) && (addr <= 0xFFFF) ) {
try {
ExtROM extROM = new ExtROM( new File( fileName ) );
- extROM.setBegAddress( addr );
+ extROM.setBegAddr( addr );
extROMs.add( extROM );
}
catch( IOException ex ) {
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/TopFrm.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/TopFrm.java
index d7c74b2..cb79d3f 100755
--- a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/TopFrm.java
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/TopFrm.java
@@ -732,7 +732,7 @@ private void resetEmu( boolean clearMem )
try {
rom.reload();
} catch (IOException ex) {
- errAddr = String.format("%%%04X", rom.getBegAddress());
+ errAddr = String.format("%%%04X", rom.getBegAddr());
errCnt++;
if (errBuf == null) {
errBuf = new StringBuilder(256);
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/AppContext.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/AppContext.java
new file mode 100644
index 0000000..22d0f90
--- /dev/null
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/AppContext.java
@@ -0,0 +1,262 @@
+/*
+ * (c) 2014-2021 Jens Mueller
+ *
+ * Jugend+Technik-Computer-Emulator
+ *
+ * Zugriff Informationen im Applikationskontext
+ */
+
+package org.sqar.virtualjtc.jtcemu.base;
+
+import java.io.*;
+import java.util.Properties;
+
+
+public class AppContext
+{
+ public static final String COPYRIGHT = "(c) 2008-2021 Jens M\u00FCller";
+
+ private static String appName = null;
+ private static String appVersion = null;
+ private static String propPrefix = "";
+ private static File lastPathsFile = null;
+ private static Runnable onLastPathsSaved = null;
+ private static Properties lastPaths = new Properties();
+ private static Properties properties = new Properties();
+
+
+ public static String getAboutContent()
+ {
+ return COPYRIGHT
+ + "\n"
+ + "Lizenz: GNU General Public License Version 3\n"
+ + "\n"
+ + "Benutzung des Programms erfolgt auf eigene Gefahr!\n"
+ + "Jegliche Haftung und Gew\u00E4hrleistung"
+ + " ist ausgeschlossen!\n"
+ + "\n"
+ + "Der Emulator enth\u00E4lt ROM-Images des"
+ + " Einchipmikrorechners U883\n"
+ + "sowie der Betriebssysteme, die mit der Bauanleitung des\n"
+ + "JU+TE-Computers ver\u00F6ffentlicht bzw."
+ + " von der Redaktion\n"
+ + "Jugend+Technik zur Verf\u00FCgung gestellt wurden.\n"
+ + "\n"
+ + "Die Urheberschaften an den ROM-Images liegen bei:\n"
+ + "- VEB Mikroelektronik Erfurt (Tiny-MP-BASIC-Interpreter)\n"
+ + "- Dr. Helmut Hoyer (2K-System und EMR-ES 1988)\n"
+ + "- Harun Scheutzow (ES 2.3 und ES 4.0)\n"
+ + "- Rolf Weidlich (Erweiterungen in ES 4.0c)";
+ }
+
+
+ public static String getAppName()
+ {
+ return appName;
+ }
+
+
+ public static String getAppVersion()
+ {
+ return appVersion;
+ }
+
+
+ public static boolean getBooleanProperty(
+ String keyword,
+ boolean defaultValue )
+ {
+ boolean rv = defaultValue;
+ String s = getProperty( keyword );
+ if( s != null ) {
+ s = s.trim().toUpperCase();
+ if( s.equals( "1" )
+ || s.equals( "Y" )
+ || s.equals( "TRUE" )
+ || Boolean.parseBoolean( s ) )
+ {
+ rv = true;
+ }
+ if( s.equals( "0" ) || s.equals( "N" ) || s.equals( "FALSE" ) ) {
+ rv = false;
+ }
+ }
+ return rv;
+ }
+
+
+ public static Integer getIntegerProperty( String keyword )
+ {
+ Integer rv = null;
+ String s = getProperty( keyword );
+ if( s != null ) {
+ s = s.trim();
+ if( !s.isEmpty() ) {
+ try {
+ rv = Integer.valueOf( s );
+ }
+ catch( NumberFormatException ex ) {}
+ }
+ }
+ return rv;
+ }
+
+
+ public static int getIntProperty( String keyword )
+ {
+ return getIntProperty( keyword, 0 );
+ }
+
+
+ public static int getIntProperty( String keyword, int defaultValue )
+ {
+ int rv = defaultValue;
+ String s = getProperty( keyword );
+ if( s != null ) {
+ s = s.trim();
+ if( !s.isEmpty() ) {
+ try {
+ rv = Integer.parseInt( s );
+ }
+ catch( NumberFormatException ex ) {}
+ }
+ }
+ return rv;
+ }
+
+
+ public static File getLastDirFile( String category )
+ {
+ String fileName = lastPaths.getProperty( propPrefix + category );
+ return fileName != null ? new File( fileName ) : null;
+ }
+
+
+ public static Properties getProperties()
+ {
+ return properties;
+ }
+
+
+ public static String getProperty( String keyword )
+ {
+ if( !keyword.startsWith( propPrefix ) ) {
+ keyword = propPrefix + keyword;
+ }
+ return properties.getProperty( keyword );
+ }
+
+
+ public static String getPropPrefix()
+ {
+ return propPrefix;
+ }
+
+
+ public static void putProperties( Properties props )
+ {
+ if( props != null )
+ properties.putAll( props );
+ }
+
+
+ public static void setAppInfo( String name, String version )
+ {
+ appName = name;
+ appVersion = version;
+ }
+
+
+ public static void setLastFile( String category, File file )
+ {
+ if( file != null ) {
+ if( !file.isDirectory() ) {
+ file = file.getParentFile();
+ }
+ }
+ if( file != null ) {
+ lastPaths.setProperty( propPrefix + category, file.getPath() );
+
+ file = lastPathsFile;
+ if( file != null ) {
+ OutputStream out = null;
+ try {
+ out = new FileOutputStream( file );
+ lastPaths.storeToXML( out, "Last used file paths" );
+ out.close();
+ out = null;
+
+ // ggf. Listener informieren
+ Runnable runnable = onLastPathsSaved;
+ if( runnable != null ) {
+ runnable.run();
+ }
+ }
+ catch( IOException ex ) {
+ // zukuenftig nicht mehr speichern
+ lastPathsFile = null;
+ }
+ finally {
+ JTCUtil.closeSilently( out );
+ }
+ }
+ }
+ }
+
+
+ public static void setLastPathsFile( File file )
+ {
+ lastPathsFile = file;
+
+ InputStream in = null;
+ try {
+ in = new FileInputStream( file );
+ lastPaths.loadFromXML( in );
+ }
+ catch( IOException ex ) {}
+ finally {
+ JTCUtil.closeSilently( in );
+ }
+ }
+
+
+ public static void setOnLastPathsSaved( Runnable runnable )
+ {
+ onLastPathsSaved = runnable;
+ }
+
+
+ public static void setProperty( String keyword, String value )
+ {
+ if( !keyword.startsWith( propPrefix ) ) {
+ keyword = propPrefix + keyword;
+ }
+ properties.setProperty( keyword, value != null ? value : "" );
+ }
+
+
+ public static void setProperty( String keyword, boolean value )
+ {
+ setProperty( keyword, String.valueOf( value ) );
+ }
+
+
+ public static void setProperty( String keyword, int value )
+ {
+ setProperty( keyword, String.valueOf( value ) );
+ }
+
+
+ public static void setPropPrefix( String text )
+ {
+ propPrefix = text;
+ }
+
+
+ /* --- Konstruktor --- */
+
+ private AppContext()
+ {
+ // Klasse nicht instanziierbar
+ }
+}
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/CharRaster.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/CharRaster.java
new file mode 100644
index 0000000..8a7440d
--- /dev/null
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/CharRaster.java
@@ -0,0 +1,83 @@
+/*
+ * (c) 2019 Jens Mueller
+ *
+ * Jugend+Technik-Computer-Emulator
+ *
+ * Anordnung der Zeichen auf dem Bildschirm
+ */
+
+package org.sqar.virtualjtc.jtcemu.base;
+
+
+public class CharRaster
+{
+ private int colCount;
+ private int rowCount;
+ private int charHeight;
+ private int charWidth;
+ private int xOffs;
+ private int yOffs;
+
+
+ public CharRaster(
+ int colCount,
+ int rowCount,
+ int charWidth,
+ int charHeight,
+ int xOffs,
+ int yOffs )
+ {
+ this.colCount = colCount;
+ this.rowCount = rowCount;
+ this.charWidth = charWidth;
+ this.charHeight = charHeight;
+ this.xOffs = xOffs;
+ this.yOffs = yOffs;
+ }
+
+
+ public CharRaster(
+ int colCount,
+ int rowCount,
+ int charWidth,
+ int charHeight )
+ {
+ this( colCount, rowCount, charWidth, charHeight, 0, 0 );
+ }
+
+
+ public int getCharHeight()
+ {
+ return this.charHeight;
+ }
+
+
+ public int getCharWidth()
+ {
+ return this.charWidth;
+ }
+
+
+ public int getColCount()
+ {
+ return this.colCount;
+ }
+
+
+ public int getRowCount()
+ {
+ return this.rowCount;
+ }
+
+
+ public int getXOffset()
+ {
+ return this.xOffs;
+ }
+
+
+ public int getYOffset()
+ {
+ return this.yOffs;
+ }
+}
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/ExtROM.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/ExtROM.java
index 1e3633e..add23e1 100755
--- a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/ExtROM.java
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/ExtROM.java
@@ -21,6 +21,7 @@ public class ExtROM implements Comparable
private int begAddr;
private int endAddr;
+ private int maxSize;
private File file;
private byte[] fileBytes;
private String text;
@@ -28,6 +29,9 @@ public class ExtROM implements Comparable
public ExtROM( File file ) throws IOException
{
+ this.maxSize = maxSize;
+ this.file = file;
+ this.fileBytes = null;
this.begAddr = 0;
this.endAddr = 0;
this.file = file;
@@ -37,13 +41,13 @@ public ExtROM( File file ) throws IOException
}
- public synchronized int getBegAddress()
+ public synchronized int getBegAddr()
{
return this.begAddr;
}
- public synchronized int getEndAddress()
+ public synchronized int getEndAddr()
{
return this.endAddr;
}
@@ -54,9 +58,10 @@ public synchronized int getByte( int addr )
int rv = 0;
if( this.fileBytes != null ) {
int idx = addr - this.begAddr;
- if( (idx >= 0) && (idx < this.fileBytes.length) )
+ if( (idx >= 0) && (idx < this.fileBytes.length) ) {
rv = (int) this.fileBytes[ idx ] & 0xFF;
}
+ }
return rv;
}
@@ -66,8 +71,7 @@ public File getFile()
return this.file;
}
-
- public synchronized void setBegAddress( int addr )
+ public synchronized void setBegAddr( int addr )
{
this.begAddr = addr;
this.endAddr = 0;
@@ -149,7 +153,7 @@ public boolean equals( Object o )
if( o instanceof ExtROM ) {
rv = true;
ExtROM data = (ExtROM) o;
- if( this.begAddr != data.getBegAddress() ) {
+ if( this.begAddr != data.getBegAddr() ) {
rv = false;
} else {
if( (this.fileBytes != null) && (data.fileBytes != null) ) {
@@ -189,5 +193,4 @@ public String toString()
{
return this.text;
}
-}
-
+}
\ No newline at end of file
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/JTCSys.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/JTCSys.java
index 0bca8d6..b44b5dd 100755
--- a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/JTCSys.java
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/JTCSys.java
@@ -34,6 +34,29 @@ public class JTCSys implements
private static final Locale locale = Locale.getDefault();
private static final ResourceBundle jtcSysResourceBundle = ResourceBundle.getBundle("JTCSys", locale);
+ public static final int DEFAULT_BASIC_ADDR = 0xE000;
+ public static final int DEFAULT_Z8_CYCLES_PER_SECOND = 4000000; // intern
+ public static final int MAX_ROM_SIZE = 0x10000;
+ public static final int MAX_ROMBANK_SIZE = 256 * 0x2000;
+
+ public static final String PROP_Z8_REGS_80_TO_EF = "z8.regs80toEF";
+ public static final String PROP_Z8_REG_INIT_ZERO = "z8.reg.init.zero";
+ public static final String PROP_RAM_INIT_ZERO = "ram.init.zero";
+ public static final String PROP_RAM_SIZE = "ram.size";
+ public static final String PROP_ROM_PREFIX = "rom.";
+ public static final String PROP_ROM_COUNT = "rom.count";
+ public static final String PROP_ROM_RELOAD = "rom.reload";
+ public static final String PROP_ROMBANK_ENABLED = "rombank.enabled";
+ public static final String PROP_ROMBANK_FILE = "rombank.file";
+ public static final String PROP_OS = "os";
+ public static final String VALUE_OS_2K = "2K";
+ public static final String VALUE_OS_ES1988 = "ES1988";
+ public static final String VALUE_OS_ES23 = "ES2.3";
+ public static final String VALUE_OS_ES40 = "ES4.0";
+
+ public static final boolean DEFAULT_RAM_INIT_ZERO = true;
+ public static final boolean DEFAULT_Z8_REG_INIT_ZERO = true;
+
public static enum OSType { OS2K, ES1988, ES23, ES40 };
private static final int[][] keyMatrix2kNormal = {
@@ -101,16 +124,24 @@ public static enum OSType { OS2K, ES1988, ES23, ES40 };
private ScreenFld screenFld;
private volatile Z8 z8;
private volatile OSType osType;
+ private OSType newOSType;
+ private ExtROM[] extROMs;
+ private ExtROM[] newExtROMs;
+ private ExtROM romBank;
+ private ExtROM[] newRomBank;
private volatile AudioIn audioIn;
private volatile AudioOut audioOut;
- private volatile ExtROM[] extROMs;
private volatile long lastScreenCycles;
+ private int screenWidth;
+ private int screenHeight;
+ private CharRaster charRaster;
private byte[] u883rom;
private byte[] os2k_0800;
private byte[] es1988_0800;
private byte[] es1988_2000;
private byte[] es23_0800;
private byte[] es40_0800;
+ private byte[] es40RomBank_0800;
private byte[] rom0800;
private byte[] rom2000;
private byte[] ram;
@@ -119,6 +150,8 @@ public static enum OSType { OS2K, ES1988, ES23, ES40 };
private byte[] ramG;
private byte[] ramR;
private volatile int curKeyValue;
+ private int newMaxGPRNum;
+ private int newRamSize;
private volatile int ramSize;
private int[] keyMatrixCols;
private boolean ignoreKeyChar;
@@ -132,6 +165,7 @@ public static enum OSType { OS2K, ES1988, ES23, ES40 };
private boolean videoB;
private boolean videoG;
private boolean videoR;
+ private volatile boolean monochrome;
public JTCSys() throws IOException
@@ -167,7 +201,13 @@ public JTCSys() throws IOException
this.videoB = false;
this.videoG = false;
this.videoR = false;
- this.keyMatrixCols = new int[ 16 ];
+ this.monochrome = true;
+ this.newOSType = null;
+ this.newExtROMs = null;
+ this.newRomBank = null;
+ this.newMaxGPRNum = 0;
+ this.newRamSize = 0;
+ this.keyMatrixCols = new int[ 0x10 ];
resetKeyMatrixStatus();
}
@@ -260,6 +300,42 @@ public int getRAMSize()
}
+ public ExtROM getROMBank()
+ {
+ return this.romBank;
+ }
+
+
+ public static String getROMPropFile( int idx )
+ {
+ return String.format( "%s%d.file", PROP_ROM_PREFIX, idx );
+ }
+
+
+ public static String getROMPropAddr( int idx )
+ {
+ return String.format( "%s%d.addr", PROP_ROM_PREFIX, idx );
+ }
+
+
+ public synchronized CharRaster getScreenCharRaster()
+ {
+ return this.charRaster;
+ }
+
+
+ public synchronized int getScreenHeight()
+ {
+ return this.screenHeight;
+ }
+
+
+ public synchronized int getScreenWidth()
+ {
+ return this.screenWidth;
+ }
+
+
public String getScreenText()
{
String rv = null;
@@ -274,6 +350,34 @@ public String getScreenText()
}
+ public Z8 getZ8()
+ {
+ return this.z8;
+ }
+
+
+ public boolean isMonochrome()
+ {
+ return this.monochrome;
+ }
+
+
+ public static boolean isRamInitZero()
+ {
+ return AppContext.getBooleanProperty(
+ PROP_RAM_INIT_ZERO,
+ DEFAULT_RAM_INIT_ZERO );
+ }
+
+
+ public static boolean isRegInitZero()
+ {
+ return AppContext.getBooleanProperty(
+ PROP_Z8_REG_INIT_ZERO,
+ DEFAULT_Z8_REG_INIT_ZERO );
+ }
+
+
public boolean isScreenOutputEnabled()
{
boolean rv = (this.alwaysScreenActive || (this.osType == OSType.ES40));
@@ -757,7 +861,7 @@ public int getMemByte( int addr, boolean dataMem )
if( extROMs != null ) {
for( int i = 0; !done && (i < extROMs.length); i++ ) {
ExtROM rom = this.extROMs[ i ];
- if( (addr >= rom.getBegAddress()) && (addr <= rom.getEndAddress()) ) {
+ if( (addr >= rom.getBegAddr()) && (addr <= rom.getEndAddr()) ) {
rv = rom.getByte( addr );
done = true;
}
@@ -843,7 +947,7 @@ public boolean setMemByte( int addr, boolean dataMem, int v )
if( extROMs != null ) {
for( int i = 0; !done && (i < extROMs.length); i++ ) {
ExtROM rom = this.extROMs[ i ];
- if( (addr >= rom.getBegAddress()) && (addr <= rom.getEndAddress()) )
+ if( (addr >= rom.getBegAddr()) && (addr <= rom.getEndAddr()) )
done = true;
}
}
@@ -907,10 +1011,10 @@ else if( (addr >= 0x4000) && (addr <= 0x5FFF) ) {
}
} else if( (addr >= 0x6000) && (addr < 0x8000) ) {
if( (this.osType == OSType.ES40) && (addr < 0x6400) ) {
- this.videoV = ((addr & 0x10) == 0);
- this.videoB = ((addr & 0x20) == 0);
- this.videoG = ((addr & 0x40) == 0);
- this.videoR = ((addr & 0x80) == 0);
+ this.videoV = ((addr & 0x0010) == 0);
+ this.videoB = ((addr & 0x0020) == 0);
+ this.videoG = ((addr & 0x0040) == 0);
+ this.videoR = ((addr & 0x0080) == 0);
}
}
else if( addr >= 0x8000 ) {
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/JTCUtil.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/JTCUtil.java
new file mode 100644
index 0000000..38f7e09
--- /dev/null
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/JTCUtil.java
@@ -0,0 +1,500 @@
+/*
+ * (c) 2014-2020 Jens Mueller
+ *
+ * Jugend+Technik-Computer-Emulator
+ *
+ * Allgemeine Hilfsfunktionen
+ */
+
+package org.sqar.virtualjtc.jtcemu.base;
+
+import java.io.*;
+import java.net.URL;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+public class JTCUtil
+{
+ public static final String PROP_CONFIRM_POWER_ON = "confirm.power_on";
+ public static final String PROP_CONFIRM_RESET = "confirm.reset";
+ public static final String PROP_CONFIRM_QUIT = "confirm.quit";
+
+
+ private static Boolean osMac = null;
+ private static Boolean osWin = null;
+
+ public static void applyConfirmSettings(
+ Properties props,
+ boolean confirmPowerOn,
+ boolean confirmReset,
+ boolean confirmQuit )
+ {
+ props.setProperty(
+ AppContext.getPropPrefix() + PROP_CONFIRM_POWER_ON,
+ Boolean.toString( confirmPowerOn ) );
+ props.setProperty(
+ AppContext.getPropPrefix() + PROP_CONFIRM_RESET,
+ Boolean.toString( confirmReset ) );
+ props.setProperty(
+ AppContext.getPropPrefix() + PROP_CONFIRM_QUIT,
+ Boolean.toString( confirmQuit ) );
+ }
+
+
+ public static void applyROMSettings(
+ Properties props,
+ ExtROM[] extROMs,
+ boolean hasROMBank )
+ throws UserInputException
+ {
+ int lastAddr = -1;
+ int idx = 0;
+ if( extROMs != null ) {
+ for( ExtROM rom : extROMs ) {
+ int begAddr = rom.getBegAddr();
+ if( hasROMBank
+ && (((begAddr < 0x2000) && (rom.getEndAddr() >= 0x2000))
+ || ((begAddr >= 0x2000) && (begAddr < 0x4000))) )
+ {
+ throw new UserInputException(
+ String.format(
+ "ROM an Adresse %%%04X \u00FCberschneidet sich"
+ + " mit der ROM-Bank (%%2000 bis %%3FFF).",
+ begAddr ) );
+ }
+ if( begAddr <= lastAddr ) {
+ throw new UserInputException(
+ String.format(
+ "ROM an Adresse %%%04X \u00FCberschneidet sich"
+ + " mit dem vorherigen ROM.",
+ begAddr ) );
+ }
+ props.setProperty(
+ AppContext.getPropPrefix() + JTCSys.getROMPropAddr( idx ),
+ String.format( "%%%04X", rom.getBegAddr() ) );
+ props.setProperty(
+ AppContext.getPropPrefix() + JTCSys.getROMPropFile( idx ),
+ rom.getFile().getPath() );
+ lastAddr = rom.getEndAddr();
+ idx++;
+ }
+ }
+ props.setProperty(
+ AppContext.getPropPrefix() + JTCSys.PROP_ROM_COUNT,
+ Integer.toString( idx ) );
+ }
+
+
+ public static void applyROMBankSettings(
+ Properties props,
+ boolean state,
+ String fileName )
+ throws UserInputException
+ {
+ if( fileName == null ) {
+ fileName = "";
+ }
+ if( state && fileName.isEmpty() ) {
+ throw new UserInputException(
+ "F\u00FCr die ROM-Bank wurde keine Datei angegeben." );
+ }
+ props.setProperty(
+ AppContext.getPropPrefix() + JTCSys.PROP_ROMBANK_ENABLED,
+ Boolean.toString( state ) );
+ props.setProperty(
+ AppContext.getPropPrefix() + JTCSys.PROP_ROMBANK_FILE,
+ fileName );
+ }
+
+
+ public static void checkRAMSize(
+ JTCSys.OSType osType,
+ int ramSize ) throws UserInputException
+ {
+ if( osType != null ) {
+ switch( osType ) {
+ case ES1988:
+ if( ramSize < 0x0800 ) {
+ throw new UserInputException(
+ "EMR-ES 1988 erfordert mindestens 2 KByte RAM." );
+ }
+ break;
+ case ES23:
+ case ES40:
+ if( ramSize < 0x2000 ) {
+ throw new UserInputException(
+ "ES 2.3 und ES 4.0 erfordern mindestens 8 KByte RAM." );
+ }
+ break;
+ }
+ }
+ }
+
+
+ public static void closeSilently( Closeable stream )
+ {
+ if( stream != null ) {
+ try {
+ stream.close();
+ }
+ catch( IOException ex ) {}
+ }
+ }
+
+
+ public static boolean differsExtROM( ExtROM rom1, ExtROM rom2 )
+ {
+ boolean rv = true;
+ if( (rom1 != null) && (rom2 != null) ) {
+ rv = !rom1.equals( rom2 );
+ } else {
+ if( (rom1 == null) && (rom2 == null) ) {
+ rv = false;
+ }
+ }
+ return rv;
+ }
+
+
+ public static boolean differsExtROMs( ExtROM[] roms1, ExtROM[] roms2 )
+ {
+ boolean rv = true;
+ int n1 = 0;
+ int n2 = 0;
+ if( roms1 != null ) {
+ n1 = roms1.length;
+ }
+ if( roms2 != null ) {
+ n2 = roms2.length;
+ }
+ if( n1 == n2 ) {
+ rv = false;
+ if( (roms1 != null) && (roms2 != null) ) {
+ for( int i = 0; i < n1; i++ ) {
+ if( differsExtROM( roms1[ i ], roms2[ i ] ) ) {
+ rv = true;
+ break;
+ }
+ }
+ }
+ }
+ return rv;
+ }
+
+
+ public static Integer getBegAddrFromFilename( File file )
+ {
+ Integer addr = null;
+ if( file != null ) {
+ String filename = file.getName();
+ if( filename != null ) {
+ filename = filename.toUpperCase();
+ int len = filename.length();
+ int pos = filename.indexOf( '_' );
+ while( (pos >= 0) && ((pos + 4) < len) ) {
+ if( isHexChar( filename.charAt( pos + 1 ) )
+ && isHexChar( filename.charAt( pos + 2 ) )
+ && isHexChar( filename.charAt( pos + 3 ) )
+ && isHexChar( filename.charAt( pos + 4 ) ) )
+ {
+ try {
+ addr = Integer.valueOf(
+ filename.substring( pos + 1, pos + 5 ),
+ 16 );
+ }
+ catch( NumberFormatException ex ) {}
+ if( addr != null ) {
+ break;
+ }
+ }
+ if( pos + 5 < len ) {
+ pos = filename.indexOf( '_', pos + 1 );
+ } else {
+ pos = -1;
+ }
+ }
+ }
+ }
+ return addr;
+ }
+
+
+ public static String getEmulatedSpeedText( Double mhz )
+ {
+ String text = null;
+ if( mhz != null ) {
+ long mhz10 = Math.round( mhz.doubleValue() * 10.0 );
+ long mhz20 = mhz10 * 2;
+ if( mhz10 >= 1 ) {
+ text = String.format(
+ "Emulierte Taktfrequenz: %1d.%01d MHz extern"
+ + " / %1d.%01d MHz intern",
+ mhz20 / 10,
+ mhz20 % 10,
+ mhz10 / 10,
+ mhz10 % 10 );
+ }
+ }
+ return text;
+ }
+
+
+ public static boolean isHexChar( char ch )
+ {
+ return ((ch >= '0') && (ch <= '9'))
+ || ((ch >= 'A') && (ch <= 'F'))
+ || ((ch >= 'a') && (ch <= 'f'));
+ }
+
+
+ public static boolean isMacOS()
+ {
+ if( osMac == null ) {
+ Boolean state = Boolean.FALSE;
+ String osName = System.getProperty( "os.name" );
+ if( osName != null ) {
+ if( osName.toUpperCase().startsWith( "MAC" ) ) {
+ state = Boolean.TRUE;
+ }
+ }
+ osMac = state;
+ }
+ return osMac.booleanValue();
+ }
+
+
+ public static boolean isWinOS()
+ {
+ if( osWin == null ) {
+ Boolean state = Boolean.FALSE;
+ String osName = System.getProperty( "os.name" );
+ if( osName != null ) {
+ osName = osName.toUpperCase();
+ if( osName.startsWith( "WIN" ) || osName.startsWith( "MS WIN" ) ) {
+ state = Boolean.TRUE;
+ }
+ } else {
+ osWin = Boolean.valueOf( File.separatorChar == '\\' );
+ }
+ osWin = state;
+ }
+ return osWin.booleanValue();
+ }
+
+
+ public static String loadHtml(
+ URL url,
+ boolean removeLinks ) throws IOException
+ {
+ String rv = null;
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(
+ new InputStreamReader( url.openStream(), "UTF-8" ) );
+ String eol = System.getProperty( "line.separator" );
+ if( eol != null ) {
+ if( eol.isEmpty() ) {
+ eol = null;
+ }
+ }
+ if( eol == null ) {
+ eol = "\r\n";
+ }
+ StringBuilder buf = new StringBuilder( 0x1000 );
+ String line = in.readLine();
+ while( line != null ) {
+ buf.append( line );
+ buf.append( eol );
+ line = in.readLine();
+ }
+ if( buf.length() > 0 ) {
+ if( removeLinks ) {
+ int idx1 = 0;
+ for(;;) {
+ idx1 = buf.indexOf( "", idx1 );
+ if( idx2 > idx1 ) {
+ int idx3 = buf.indexOf( "", idx2 + 1 );
+ if( idx3 > idx2 ) {
+ buf = buf.delete( idx3, idx3 + 4 );
+ buf = buf.delete( idx1, idx2 + 1 );
+ } else {
+ idx1 = idx2 + 1;
+ }
+ } else {
+ idx1++;
+ }
+ }
+ } else {
+ buf = replaceAll( buf, "\"../common/", "\"" );
+ buf = replaceAll( buf, "\"../fx/", "\"" );
+ }
+ rv = buf.toString();
+ }
+ }
+ finally {
+ JTCUtil.closeSilently( in );
+ }
+ return rv;
+ }
+
+
+ public static int parseHex2(
+ String text,
+ String fldLabel ) throws UserInputException
+ {
+ return parseHex( text, fldLabel, 0xFF );
+ }
+
+
+ public static int parseHex4(
+ String text,
+ String fldLabel ) throws UserInputException
+ {
+ return parseHex( text, fldLabel, 0xFFFF );
+ }
+
+
+ public static byte[] readFile(
+ File file,
+ int maxSize ) throws IOException
+ {
+ int bufSize = 0x1000;
+ long fileLen = file.length();
+ if( fileLen > 0 ) {
+ if( fileLen > 0x10000 ) {
+ bufSize = 0x10000;
+ } else {
+ bufSize = (int) fileLen;
+ }
+ }
+ ByteArrayOutputStream buf = new ByteArrayOutputStream( bufSize );
+ InputStream in = null;
+ try {
+ in = new FileInputStream( file );
+
+ int n = 0;
+ int b = in.read();
+ while( b >= 0 ) {
+ if( (maxSize > 0) && (n >= maxSize) ) {
+ throw new IOException( "Datei zu gro\u00DF" );
+ }
+ buf.write( b );
+ b = in.read();
+ n++;
+ }
+ }
+ finally {
+ JTCUtil.closeSilently( in );
+ }
+ return buf.toByteArray();
+ }
+
+
+ public static String replaceAll(
+ String baseText,
+ String searchText,
+ boolean caseSensitive,
+ String replaceText,
+ AtomicInteger rvCount )
+ {
+ String rv = baseText;
+ if( (baseText != null) && (searchText != null) ) {
+ if( replaceText == null ) {
+ replaceText = "";
+ }
+ try {
+ int flags = Pattern.UNICODE_CASE
+ | Pattern.UNICODE_CHARACTER_CLASS;
+ if( !caseSensitive ) {
+ flags |= Pattern.CASE_INSENSITIVE;
+ }
+ Pattern p = Pattern.compile( Pattern.quote( searchText ), flags );
+ Matcher m = p.matcher( baseText );
+ StringBuffer buf = new StringBuffer( baseText.length() + 32 );
+ while( m.find() ) {
+ if( rvCount != null ) {
+ rvCount.incrementAndGet();
+ }
+ m.appendReplacement( buf, replaceText );
+ }
+ m.appendTail( buf );
+ rv = buf.toString();
+ }
+ catch( PatternSyntaxException ex ) {}
+ }
+ return rv;
+ }
+
+
+ /* --- private Methoden --- */
+
+ private static int parseHex(
+ String text,
+ String fldLabel,
+ int maxValue ) throws UserInputException
+ {
+ int value = 0;
+ boolean done = false;
+ if( text != null ) {
+ text = text.trim();
+ int len = text.length();
+ for( int i = 0; i < len; i++ ) {
+ char ch = Character.toUpperCase( text.charAt( i ) );
+ if( (ch == '%') && (i == 0) ) {
+ // %-Zeichen am Anfang erlauben, d.h. ueberlesen
+ } else if( (ch >= '0') && (ch <= '9') ) {
+ value = (value << 4) | (ch - '0');
+ done = true;
+ } else if( (ch >= 'A') && (ch <= 'F') ) {
+ value = (value << 4) | (ch - 'A' + 10);
+ done = true;
+ } else {
+ throw new UserInputException(
+ fldLabel + " Ung\u00FCltige Hexadezimalzahl" );
+ }
+ if( (value & ~maxValue) != 0 ) {
+ throw new UserInputException( fldLabel + " Wert zu gro\u00DF!" );
+ }
+ }
+ }
+ if( !done ) {
+ throw new UserInputException( fldLabel + " Eingabe erwartet" );
+ }
+ return value;
+ }
+
+
+ private static StringBuilder replaceAll(
+ StringBuilder buf,
+ String searchText,
+ String replaceText )
+ {
+ int searchLen = searchText.length();
+ int replaceLen = replaceText.length();
+ int idx = 0;
+ for(;;) {
+ idx = buf.indexOf( searchText, idx );
+ if( idx < 0 ) {
+ break;
+ }
+ buf = buf.replace( idx, idx + searchLen, replaceText );
+ idx += replaceLen;
+ }
+ return buf;
+ }
+
+
+ /* --- Konstruktor --- */
+
+ private JTCUtil()
+ {
+ // Klasse nicht instanziierbar
+ }
+}
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/SettingsFrm.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/SettingsFrm.java
index e7b722d..2032d95 100755
--- a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/SettingsFrm.java
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/SettingsFrm.java
@@ -982,7 +982,7 @@ && isHexChar( fileName.charAt( pos + 4 ) ) )
}
addr = GUIUtil.askHex4( this, settingsFrmResourceBundle.getString("dialog.doROMAdd.startAddress"), addr );
if( addr != null ) {
- rom.setBegAddress( addr.intValue() );
+ rom.setBegAddr( addr.intValue() );
this.extROMs.add( rom );
try {
Collections.sort( this.extROMs );
@@ -1093,7 +1093,7 @@ private boolean applyROM( Properties props )
int a = -1;
for( ExtROM rom : this.extROMs ) {
n++;
- int begAddr = rom.getBegAddress();
+ int begAddr = rom.getBegAddr();
if( begAddr <= a ) {
this.tabbedPane.setSelectedComponent( this.panelROM );
Main.showError(
@@ -1110,7 +1110,7 @@ private boolean applyROM( Properties props )
props.setProperty(
String.format( "org.sqar.virtualjtc.rom.%d.file", n ),
rom.getFile().getPath() );
- a = rom.getEndAddress();
+ a = rom.getEndAddr();
}
props.setProperty( "org.sqar.virtualjtc.rom.count", Integer.toString( n ) );
props.setProperty(
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/UserInputException.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/UserInputException.java
new file mode 100644
index 0000000..69432bd
--- /dev/null
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/jtcemu/base/UserInputException.java
@@ -0,0 +1,18 @@
+/*
+ * (c) 2014-2019 Jens Mueller
+ *
+ * Jugend+Technik-Computer-Emulator
+ *
+ * Exception fuer eine fehlerhafte Benutzereingabe
+ */
+
+package org.sqar.virtualjtc.jtcemu.base;
+
+
+public class UserInputException extends Exception
+{
+ public UserInputException(String msg )
+ {
+ super( msg );
+ }
+}
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/z8/Z8.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/z8/Z8.java
index 69f47a0..330a667 100755
--- a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/z8/Z8.java
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/z8/Z8.java
@@ -6,8 +6,6 @@
package org.sqar.virtualjtc.z8;
-import org.jens_mueller.z8.Z8Listener;
-
import java.util.*;
import java.util.Arrays;
import java.util.logging.Level;
diff --git a/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/z8/Z8Listener.java b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/z8/Z8Listener.java
new file mode 100644
index 0000000..7c260da
--- /dev/null
+++ b/VirtualJTCCommon/src/main/java/org/sqar/virtualjtc/z8/Z8Listener.java
@@ -0,0 +1,22 @@
+/*
+ * (c) 2020 Jens Mueller
+ *
+ * Z8 Emulator
+ *
+ * Interface fuer einen Listener
+ */
+
+package org.sqar.virtualjtc.z8;
+
+
+public interface Z8Listener
+{
+ public enum Reason {
+ POWER_ON,
+ RESET,
+ PRE_INST_EXEC,
+ CYCLES_PER_SECOND_CHANGED,
+ STATUS_CHANGED };
+
+ public void z8Update( Z8 z8, Reason reason );
+}
diff --git a/build.gradle b/build.gradle
index ed725a4..e9210ac 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,6 @@
buildscript {
repositories {
- maven { url 'https://plugins.gradle.org/m2/' }
+ gradlePluginPortal()
}
}
diff --git a/build.xml b/build.xml
deleted file mode 100644
index c4aaa72..0000000
--- a/build.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 490fda8..7f93135 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a595206..1af9e09 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 2fe81a7..1aa94a4 100755
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
-#!/usr/bin/env sh
+#!/bin/sh
#
-# Copyright 2015 the original author or authors.
+# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,78 +17,111 @@
#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
# Attempt to set APP_HOME
+
# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
warn () {
echo "$*"
-}
+} >&2
die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -97,87 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
fi
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
fi
- i=`expr $i + 1`
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
fi
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 9109989..6689b85 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
-@if "%DEBUG%" == "" @echo off
+@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
+if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,38 +65,26 @@ echo location of your Java installation.
goto fail
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
+if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal