From bde5fbb17a153755df8f5373c23399a14fb76d6e Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 9 Jun 2020 19:07:27 +0100 Subject: [PATCH 1/4] Improves compilation of MQL files --- scripts/.funcs.cmds.inc.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/.funcs.cmds.inc.sh b/scripts/.funcs.cmds.inc.sh index 4c2ddae5..3120cae8 100644 --- a/scripts/.funcs.cmds.inc.sh +++ b/scripts/.funcs.cmds.inc.sh @@ -329,8 +329,10 @@ compile() { local log_file=${2:-${name##*/}.log} type iconv >/dev/null + local mt_ver=${MT_VER:-4} local rel_path=$name local target=$rel_path + mt_ver=${mt_ver:0:1} if [ -d "$rel_path" ]; then # If folder, enter it. cd "$rel_path" @@ -344,8 +346,8 @@ compile() { elif [ ! -s "$rel_path" ]; then # If file does not exist, find in the current folder. name=${name##*/} # Drop the path. - local exact=$(find -L . -maxdepth 4 -type f -name "${name%.*}.mq?" -print -quit) - local match=$(find -L . -maxdepth 4 -type f -name "*${name%.*}*.mq?" -print -quit) + local exact=$(find -L . -maxdepth 4 -type f -name "${name%.*}.mq${mt_ver}" -print -quit) + local match=$(find -L . -maxdepth 4 -type f -name "*${name%.*}*.mq${mt_ver}" -print -quit) target=$(echo ${exact#./} || echo ${match#./}) log_file=${log_file:-${name}.log} else @@ -462,6 +464,8 @@ ini_copy() { ea_find() { local file="${1:-$EA_FILE}" local dir="${2:-$EXPERTS_DIR}" + local mt_ver=${MT_VER:-4} + mt_ver=${mt_ver:0:1} [ -d "$EXPERTS_DIR" ] || mkdir -p $VFLAG "$EXPERTS_DIR" cd "$dir" if [[ "$file" =~ :// ]]; then @@ -474,10 +478,10 @@ ea_find() { echo "$file" return } || - result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -iname "${file%.*}.mq?" ')' -print -quit) - [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -name "${file%.*}.ex?" ')' -print -quit) - [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.mq?" -print -quit) - [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.ex?" -print -quit) + result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -iname "${file%.*}.mq${mt_ver}" ')' -print -quit) + [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -name "${file%.*}.ex${mt_ver}" ')' -print -quit) + [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.mq${mt_ver}" -print -quit) + [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.ex${mt_ver}" -print -quit) echo ${result#./} cd - &>/dev/null } @@ -488,6 +492,8 @@ ea_find() { script_find() { local file="$1" local dir="${2:-$SCRIPTS_DIR}" + local mt_ver=${MT_VER:-4} + mt_ver=${mt_ver:0:1} [ -d "$SCRIPTS_DIR" ] || mkdir -p $VFLAG "$SCRIPTS_DIR" cd "$dir" if [[ "$file" =~ :// ]]; then @@ -500,10 +506,10 @@ script_find() { echo "$file" return } || - result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -iname "${file%.*}.mq?" ')' -print -quit) + result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -iname "${file%.*}.mq${mt_ver}" ')' -print -quit) [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -name "${file%.*}.ex?" ')' -print -quit) - [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.mq?" -print -quit) - [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.ex?" -print -quit) + [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.mq${mt_ver}" -print -quit) + [ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.ex${mt_ver}" -print -quit) echo ${result#./} cd - &>/dev/null } From 373afdcad8bf46bee906600b266f59ce78699a6f Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 9 Jun 2020 19:24:12 +0100 Subject: [PATCH 2/4] Improves platform killing [GH-196] --- scripts/.funcs.inc.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/.funcs.inc.sh b/scripts/.funcs.inc.sh index b2aae4b0..2cbe7c56 100644 --- a/scripts/.funcs.inc.sh +++ b/scripts/.funcs.inc.sh @@ -270,6 +270,13 @@ function conv() { iconv -f "$from" -t "$to" | tr -d \\r } +# Checks if process is running. +is_process_up() { + local process=${1:-terminal} + ! WINEDEBUG=-all winedbg --command 'info proc' | grep -q "$process" + printf "%d" $? +} + # Restore IFS. restore_ifs() { IFS=$' \t\n' @@ -319,7 +326,11 @@ kill_wine() { true return } - wineserver -k || true + wineserver -k -w || true + sleep 2 + if [ $(is_process_up terminal) -eq 1 ]; then + wineserver -k9 + fi } # Kill display. From d0a1f1a1bf9dbce7ca9a317a78617e41295a281d Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 9 Jun 2020 19:49:15 +0100 Subject: [PATCH 3/4] Improves code syntax for platform killing [GH-196] --- scripts/.funcs.inc.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/.funcs.inc.sh b/scripts/.funcs.inc.sh index 2cbe7c56..0d0468c5 100644 --- a/scripts/.funcs.inc.sh +++ b/scripts/.funcs.inc.sh @@ -270,11 +270,21 @@ function conv() { iconv -f "$from" -t "$to" | tr -d \\r } +# Print last return code. +get_return() { + printf "%d" $? +} + +# Print last negated return code. +get_return_neg() { + printf "%d" $(( 1-$? )) +} + # Checks if process is running. is_process_up() { local process=${1:-terminal} - ! WINEDEBUG=-all winedbg --command 'info proc' | grep -q "$process" - printf "%d" $? + WINEDEBUG=-all winedbg --command 'info proc' | grep -q "$process" + get_return_neg } # Restore IFS. From 582003544acf20c2e0d2553d939105cc68b16ecc Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 9 Jun 2020 20:09:03 +0100 Subject: [PATCH 4/4] Re-enables ScriptDummy after fixes --- .github/workflows/tests-mql.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests-mql.yml b/.github/workflows/tests-mql.yml index 94a9603c..3397ca6e 100644 --- a/.github/workflows/tests-mql.yml +++ b/.github/workflows/tests-mql.yml @@ -27,8 +27,6 @@ jobs: - name: Run ScriptDummy working-directory: tests run: docker-compose run ScriptDummy - # @fixme - if: false - name: Run ScriptPrintPaths working-directory: tests run: docker-compose run ScriptPrintPaths