eolang 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,11 +49,15 @@ You can also do many other things with `eoc` commands
49
49
  * `dataize` dataizes a single object from the executable binary
50
50
  * `test` dataizes all visible unit tests
51
51
 
52
- There are also commands that help manipulate with XMIR and EO sources (some of them are not implemented as of yet):
52
+ There are also commands that help manipulate with XMIR and EO sources
53
+ (the list is not completed, while some of them are not implemented as of yet):
53
54
 
54
55
  * `audit` inspects all required packages and reports their status
55
56
  * `foreign` inspects all objects found in the program after `assemble` step
56
57
  * `sodg` generates SODG from XMIR, further rederable as XML or [Dot](https://en.wikipedia.org/wiki/DOT_%28graph_description_language%29)
58
+ * `phi` generates PHI files from XMIR
59
+ * `unphi` generates XMIR files from PHI files
60
+ * `print` generates EO files from PHI files
57
61
  * <del>`translate` converts Java/C++/Python/etc. program to EO program</del>
58
62
  * <del>`demu` removes `cage` and `memory` objects</del>
59
63
  * <del>`dejump` removes `goto` objects</del>
Binary file
@@ -6,7 +6,7 @@
6
6
  # "License"); you may not use this file except in compliance
7
7
  # with the License. You may obtain a copy of the License at
8
8
  #
9
- # https://www.apache.org/licenses/LICENSE-2.0
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
10
  #
11
11
  # Unless required by applicable law or agreed to in writing,
12
12
  # software distributed under the License is distributed on an
@@ -15,4 +15,4 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
  distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
18
- wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
18
+ wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
package/mvnw/mvnw CHANGED
@@ -19,7 +19,7 @@
19
19
  # ----------------------------------------------------------------------------
20
20
 
21
21
  # ----------------------------------------------------------------------------
22
- # Apache Maven Wrapper startup batch script, version 3.1.1
22
+ # Apache Maven Wrapper startup batch script, version 3.2.0
23
23
  #
24
24
  # Required ENV vars:
25
25
  # ------------------
@@ -53,7 +53,7 @@ fi
53
53
  cygwin=false;
54
54
  darwin=false;
55
55
  mingw=false
56
- case "`uname`" in
56
+ case "$(uname)" in
57
57
  CYGWIN*) cygwin=true ;;
58
58
  MINGW*) mingw=true;;
59
59
  Darwin*) darwin=true
@@ -61,7 +61,7 @@ case "`uname`" in
61
61
  # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
62
62
  if [ -z "$JAVA_HOME" ]; then
63
63
  if [ -x "/usr/libexec/java_home" ]; then
64
- JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME
64
+ JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
65
65
  else
66
66
  JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
67
67
  fi
@@ -71,38 +71,38 @@ esac
71
71
 
72
72
  if [ -z "$JAVA_HOME" ] ; then
73
73
  if [ -r /etc/gentoo-release ] ; then
74
- JAVA_HOME=`java-config --jre-home`
74
+ JAVA_HOME=$(java-config --jre-home)
75
75
  fi
76
76
  fi
77
77
 
78
78
  # For Cygwin, ensure paths are in UNIX format before anything is touched
79
79
  if $cygwin ; then
80
80
  [ -n "$JAVA_HOME" ] &&
81
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
81
+ JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
82
82
  [ -n "$CLASSPATH" ] &&
83
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
83
+ CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
84
84
  fi
85
85
 
86
86
  # For Mingw, ensure paths are in UNIX format before anything is touched
87
87
  if $mingw ; then
88
- [ -n "$JAVA_HOME" ] &&
89
- JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
88
+ [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
89
+ JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
90
90
  fi
91
91
 
92
92
  if [ -z "$JAVA_HOME" ]; then
93
- javaExecutable="`which javac`"
94
- if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
93
+ javaExecutable="$(which javac)"
94
+ if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
95
95
  # readlink(1) is not available as standard on Solaris 10.
96
- readLink=`which readlink`
97
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
96
+ readLink=$(which readlink)
97
+ if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
98
98
  if $darwin ; then
99
- javaHome="`dirname \"$javaExecutable\"`"
100
- javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
99
+ javaHome="$(dirname "\"$javaExecutable\"")"
100
+ javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
101
101
  else
102
- javaExecutable="`readlink -f \"$javaExecutable\"`"
102
+ javaExecutable="$(readlink -f "\"$javaExecutable\"")"
103
103
  fi
104
- javaHome="`dirname \"$javaExecutable\"`"
105
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
104
+ javaHome="$(dirname "\"$javaExecutable\"")"
105
+ javaHome=$(expr "$javaHome" : '\(.*\)/bin')
106
106
  JAVA_HOME="$javaHome"
107
107
  export JAVA_HOME
108
108
  fi
@@ -118,7 +118,7 @@ if [ -z "$JAVACMD" ] ; then
118
118
  JAVACMD="$JAVA_HOME/bin/java"
119
119
  fi
120
120
  else
121
- JAVACMD="`\\unset -f command; \\command -v java`"
121
+ JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
122
122
  fi
123
123
  fi
124
124
 
@@ -150,108 +150,99 @@ find_maven_basedir() {
150
150
  fi
151
151
  # workaround for JBEAP-8937 (on Solaris 10/Sparc)
152
152
  if [ -d "${wdir}" ]; then
153
- wdir=`cd "$wdir/.."; pwd`
153
+ wdir=$(cd "$wdir/.." || exit 1; pwd)
154
154
  fi
155
155
  # end of workaround
156
156
  done
157
- printf '%s' "$(cd "$basedir"; pwd)"
157
+ printf '%s' "$(cd "$basedir" || exit 1; pwd)"
158
158
  }
159
159
 
160
160
  # concatenates all lines of a file
161
161
  concat_lines() {
162
162
  if [ -f "$1" ]; then
163
- echo "$(tr -s '\n' ' ' < "$1")"
163
+ # Remove \r in case we run on Windows within Git Bash
164
+ # and check out the repository with auto CRLF management
165
+ # enabled. Otherwise, we may read lines that are delimited with
166
+ # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
167
+ # splitting rules.
168
+ tr -s '\r\n' ' ' < "$1"
164
169
  fi
165
170
  }
166
171
 
167
- BASE_DIR=$(find_maven_basedir "$(dirname $0)")
172
+ log() {
173
+ if [ "$MVNW_VERBOSE" = true ]; then
174
+ printf '%s\n' "$1"
175
+ fi
176
+ }
177
+
178
+ BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
168
179
  if [ -z "$BASE_DIR" ]; then
169
180
  exit 1;
170
181
  fi
171
182
 
172
183
  MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
173
- if [ "$MVNW_VERBOSE" = true ]; then
174
- echo $MAVEN_PROJECTBASEDIR
175
- fi
184
+ log "$MAVEN_PROJECTBASEDIR"
176
185
 
177
186
  ##########################################################################################
178
187
  # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
179
188
  # This allows using the maven wrapper in projects that prohibit checking in binary data.
180
189
  ##########################################################################################
181
- if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
182
- if [ "$MVNW_VERBOSE" = true ]; then
183
- echo "Found .mvn/wrapper/maven-wrapper.jar"
184
- fi
190
+ wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
191
+ if [ -r "$wrapperJarPath" ]; then
192
+ log "Found $wrapperJarPath"
185
193
  else
186
- if [ "$MVNW_VERBOSE" = true ]; then
187
- echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
188
- fi
194
+ log "Couldn't find $wrapperJarPath, downloading it ..."
195
+
189
196
  if [ -n "$MVNW_REPOURL" ]; then
190
- wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
197
+ wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
191
198
  else
192
- wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
199
+ wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
193
200
  fi
194
- while IFS="=" read key value; do
195
- case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
201
+ while IFS="=" read -r key value; do
202
+ # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
203
+ safeValue=$(echo "$value" | tr -d '\r')
204
+ case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
196
205
  esac
197
- done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
198
- if [ "$MVNW_VERBOSE" = true ]; then
199
- echo "Downloading from: $wrapperUrl"
200
- fi
201
- wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
206
+ done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
207
+ log "Downloading from: $wrapperUrl"
208
+
202
209
  if $cygwin; then
203
- wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
210
+ wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
204
211
  fi
205
212
 
206
213
  if command -v wget > /dev/null; then
207
- QUIET="--quiet"
208
- if [ "$MVNW_VERBOSE" = true ]; then
209
- echo "Found wget ... using wget"
210
- QUIET=""
211
- fi
214
+ log "Found wget ... using wget"
215
+ [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
212
216
  if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
213
- wget $QUIET "$wrapperUrl" -O "$wrapperJarPath"
217
+ wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
214
218
  else
215
- wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath"
219
+ wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
216
220
  fi
217
- [ $? -eq 0 ] || rm -f "$wrapperJarPath"
218
221
  elif command -v curl > /dev/null; then
219
- QUIET="--silent"
220
- if [ "$MVNW_VERBOSE" = true ]; then
221
- echo "Found curl ... using curl"
222
- QUIET=""
223
- fi
222
+ log "Found curl ... using curl"
223
+ [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
224
224
  if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
225
- curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L
225
+ curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
226
226
  else
227
- curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L
227
+ curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
228
228
  fi
229
- [ $? -eq 0 ] || rm -f "$wrapperJarPath"
230
229
  else
231
- if [ "$MVNW_VERBOSE" = true ]; then
232
- echo "Falling back to using Java to download"
233
- fi
234
- javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
235
- javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class"
230
+ log "Falling back to using Java to download"
231
+ javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
232
+ javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
236
233
  # For Cygwin, switch paths to Windows format before running javac
237
234
  if $cygwin; then
238
- javaSource=`cygpath --path --windows "$javaSource"`
239
- javaClass=`cygpath --path --windows "$javaClass"`
235
+ javaSource=$(cygpath --path --windows "$javaSource")
236
+ javaClass=$(cygpath --path --windows "$javaClass")
240
237
  fi
241
238
  if [ -e "$javaSource" ]; then
242
239
  if [ ! -e "$javaClass" ]; then
243
- if [ "$MVNW_VERBOSE" = true ]; then
244
- echo " - Compiling MavenWrapperDownloader.java ..."
245
- fi
246
- # Compiling the Java class
240
+ log " - Compiling MavenWrapperDownloader.java ..."
247
241
  ("$JAVA_HOME/bin/javac" "$javaSource")
248
242
  fi
249
243
  if [ -e "$javaClass" ]; then
250
- # Running the downloader
251
- if [ "$MVNW_VERBOSE" = true ]; then
252
- echo " - Running MavenWrapperDownloader.java ..."
253
- fi
254
- ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
244
+ log " - Running MavenWrapperDownloader.java ..."
245
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
255
246
  fi
256
247
  fi
257
248
  fi
@@ -260,25 +251,55 @@ fi
260
251
  # End of extension
261
252
  ##########################################################################################
262
253
 
254
+ # If specified, validate the SHA-256 sum of the Maven wrapper jar file
255
+ wrapperSha256Sum=""
256
+ while IFS="=" read -r key value; do
257
+ case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
258
+ esac
259
+ done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
260
+ if [ -n "$wrapperSha256Sum" ]; then
261
+ wrapperSha256Result=false
262
+ if command -v sha256sum > /dev/null; then
263
+ if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
264
+ wrapperSha256Result=true
265
+ fi
266
+ elif command -v shasum > /dev/null; then
267
+ if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
268
+ wrapperSha256Result=true
269
+ fi
270
+ else
271
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
272
+ echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
273
+ exit 1
274
+ fi
275
+ if [ $wrapperSha256Result = false ]; then
276
+ echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
277
+ echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
278
+ echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
279
+ exit 1
280
+ fi
281
+ fi
282
+
263
283
  MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
264
284
 
265
285
  # For Cygwin, switch paths to Windows format before running java
266
286
  if $cygwin; then
267
287
  [ -n "$JAVA_HOME" ] &&
268
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
288
+ JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
269
289
  [ -n "$CLASSPATH" ] &&
270
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
290
+ CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
271
291
  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
272
- MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
292
+ MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
273
293
  fi
274
294
 
275
295
  # Provide a "standardized" way to retrieve the CLI args that will
276
296
  # work with both Windows and non-Windows executions.
277
- MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
297
+ MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
278
298
  export MAVEN_CMD_LINE_ARGS
279
299
 
280
300
  WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
281
301
 
302
+ # shellcheck disable=SC2086 # safe args
282
303
  exec "$JAVACMD" \
283
304
  $MAVEN_OPTS \
284
305
  $MAVEN_DEBUG_OPTS \
package/mvnw/mvnw.cmd CHANGED
@@ -18,7 +18,7 @@
18
18
  @REM ----------------------------------------------------------------------------
19
19
 
20
20
  @REM ----------------------------------------------------------------------------
21
- @REM Apache Maven Wrapper startup batch script, version 3.1.1
21
+ @REM Apache Maven Wrapper startup batch script, version 3.2.0
22
22
  @REM
23
23
  @REM Required ENV vars:
24
24
  @REM JAVA_HOME - location of a JDK home dir
@@ -119,7 +119,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
119
119
  set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120
120
  set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121
121
 
122
- set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
122
+ set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
123
123
 
124
124
  FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
125
125
  IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
@@ -133,7 +133,7 @@ if exist %WRAPPER_JAR% (
133
133
  )
134
134
  ) else (
135
135
  if not "%MVNW_REPOURL%" == "" (
136
- SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
136
+ SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
137
137
  )
138
138
  if "%MVNW_VERBOSE%" == "true" (
139
139
  echo Couldn't find %WRAPPER_JAR%, downloading it ...
@@ -153,6 +153,24 @@ if exist %WRAPPER_JAR% (
153
153
  )
154
154
  @REM End of extension
155
155
 
156
+ @REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
157
+ SET WRAPPER_SHA_256_SUM=""
158
+ FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
159
+ IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
160
+ )
161
+ IF NOT %WRAPPER_SHA_256_SUM%=="" (
162
+ powershell -Command "&{"^
163
+ "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
164
+ "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
165
+ " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
166
+ " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
167
+ " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
168
+ " exit 1;"^
169
+ "}"^
170
+ "}"
171
+ if ERRORLEVEL 1 goto error
172
+ )
173
+
156
174
  @REM Provide a "standardized" way to retrieve the CLI args that will
157
175
  @REM work with both Windows and non-Windows executions.
158
176
  set MAVEN_CMD_LINE_ARGS=%*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eolang",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "author": "Yegor Bugayenko <yegor256@gmail.com> (https://www.yegor256.com/)",
5
5
  "license": "MIT",
6
6
  "repository": "objectionary/eoc",
@@ -34,6 +34,7 @@
34
34
  "commander": "11.1.0",
35
35
  "fast-xml-parser": "4.3.2",
36
36
  "node": "21.2.0",
37
+ "relative": "3.0.2",
37
38
  "sync-request": "6.1.0",
38
39
  "xmlhttprequest": "1.8.0"
39
40
  },
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const path = require('path');
26
27
  const {mvnw, flags} = require('../mvnw');
27
28
 
@@ -31,8 +32,10 @@ const {mvnw, flags} = require('../mvnw');
31
32
  * @return {Promise} of assemble task
32
33
  */
33
34
  module.exports = function(opts) {
35
+ const target = path.resolve(opts.target);
36
+ console.info('Assembling into %s', rel(target));
34
37
  return mvnw(['eo:assemble'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
35
- console.info('EO program assembled in %s', path.resolve(opts.target));
38
+ console.info('EO program assembled in %s', rel(target));
36
39
  return r;
37
40
  });
38
41
  };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const fs = require('fs');
26
27
  const path = require('path');
27
28
  const os = require('os');
@@ -33,12 +34,12 @@ const os = require('os');
33
34
  module.exports = function(opts) {
34
35
  const home = path.resolve(opts.target);
35
36
  fs.rmSync(home, {recursive: true, force: true});
36
- console.info('The directory %s deleted', home);
37
+ console.info('The directory %s deleted', rel(home));
37
38
  if (opts.cached) {
38
39
  const eo = path.join(os.homedir(), '.eo');
39
40
  if (fs.existsSync(eo)) {
40
41
  fs.rmSync(eo, {recursive: true});
41
- console.info('The directory ~/.eo was deleted');
42
+ console.info('The directory %s was deleted', eo);
42
43
  }
43
44
  }
44
45
  };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const {mvnw, flags} = require('../mvnw');
26
27
  const path = require('path');
27
28
 
@@ -33,7 +34,7 @@ const path = require('path');
33
34
  module.exports = function(opts) {
34
35
  const target = path.resolve(opts.target);
35
36
  return mvnw(['compiler:compile'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
36
- console.info('Java .class files compiled into %s', target);
37
+ console.info('Java .class files compiled into %s', rel(target));
37
38
  return r;
38
39
  });
39
40
  };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const path = require('path');
26
27
  const fs = require('fs');
27
28
 
@@ -32,7 +33,7 @@ const fs = require('fs');
32
33
  module.exports = function(opts) {
33
34
  const file = path.resolve(opts.target, 'eo-foreign.json');
34
35
  const all = JSON.parse(fs.readFileSync(file, 'utf8'));
35
- console.info('There are %d objects in %s:', all.length, file);
36
+ console.info('There are %d objects in %s:', all.length, rel(file));
36
37
  all.forEach((obj) => {
37
38
  console.info(' %s', obj['id']);
38
39
  });
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const {mvnw, flags} = require('../mvnw');
26
27
  const path = require('path');
27
28
 
@@ -31,8 +32,9 @@ const path = require('path');
31
32
  * @return {Promise} of link task
32
33
  */
33
34
  module.exports = function(opts) {
35
+ const jar = path.resolve(opts.target, 'eoc.jar');
34
36
  return mvnw(['jar:jar'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
35
- console.info('Executable JAR created at %s', path.resolve(opts.target, 'eoc.jar'));
37
+ console.info('Executable JAR created at %s', rel(jar));
36
38
  return r;
37
39
  });
38
40
  };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const path = require('path');
26
27
  const {mvnw, flags} = require('../mvnw');
27
28
 
@@ -31,8 +32,9 @@ const {mvnw, flags} = require('../mvnw');
31
32
  * @return {Promise} of assemble task
32
33
  */
33
34
  module.exports = function(opts) {
35
+ const target = path.resolve(opts.target);
34
36
  return mvnw(['eo:parse'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
35
- console.info('EO sources parsed in %s', path.resolve(opts.target));
37
+ console.info('EO sources parsed in %s', rel(target));
36
38
  return r;
37
39
  });
38
40
  };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const path = require('path');
26
27
  const {mvnw, flags} = require('../mvnw');
27
28
 
@@ -31,18 +32,23 @@ const {mvnw, flags} = require('../mvnw');
31
32
  * @return {Promise} of assemble task
32
33
  */
33
34
  module.exports = function(opts) {
35
+ const target = path.resolve(opts.target);
36
+ const input = path.resolve(opts.target, '2-optimize');
37
+ console.debug('Reading .XMIR files from %s', rel(input));
38
+ const output = path.resolve(opts.target, 'phi');
39
+ console.debug('Writing .PHI files to %s', rel(output));
34
40
  return mvnw(
35
41
  ['eo:xmir-to-phi']
36
42
  .concat(flags(opts))
37
43
  .concat(
38
44
  [
39
- `-DphiInputDir=${path.resolve(opts.target, '2-optimize')}`,
40
- `-DphiOutputDir=${path.resolve(opts.target, 'phi')}`,
45
+ `-DphiInputDir=${input}`,
46
+ `-DphiOutputDir=${output}`,
41
47
  ]
42
48
  ),
43
49
  opts.target, opts.batch
44
50
  ).then((r) => {
45
- console.info('XMIR files converted into PHI files at %s', path.resolve(opts.target));
51
+ console.info('XMIR files converted into PHI files at %s', rel(target));
46
52
  return r;
47
53
  });
48
54
  };
@@ -0,0 +1,53 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2022-2023 Objectionary.com
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included
14
+ * in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ const rel = require('relative');
26
+ const path = require('path');
27
+ const {mvnw, flags} = require('../mvnw');
28
+
29
+ /**
30
+ * Command to convert .XMIR files into .EO files.
31
+ * @param {Hash} opts - All options
32
+ * @return {Promise} of assemble task
33
+ */
34
+ module.exports = function(opts) {
35
+ const input = path.resolve(opts.target, '2-optimize');
36
+ console.debug('Reading from %s', rel(input));
37
+ const output = path.resolve(opts.target, 'print');
38
+ console.debug('Writing into %s', rel(output));
39
+ return mvnw(
40
+ ['eo:print']
41
+ .concat(flags(opts))
42
+ .concat(
43
+ [
44
+ `-Deo.printSourcesDir=${input}`,
45
+ `-Deo.printOutputDir=${output}`,
46
+ ]
47
+ ),
48
+ opts.target, opts.batch
49
+ ).then((r) => {
50
+ console.info('XMIR files converted into EO files at %s', rel(output));
51
+ return r;
52
+ });
53
+ };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const {mvnw, flags} = require('../mvnw');
26
27
  const path = require('path');
27
28
 
@@ -33,7 +34,7 @@ const path = require('path');
33
34
  module.exports = function(opts) {
34
35
  const foreign = path.resolve(opts.target, 'eo-foreign.json');
35
36
  return mvnw(['eo:register'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
36
- console.info('EO objects registered in %s', foreign);
37
+ console.info('EO objects registered in %s', rel(foreign));
37
38
  return r;
38
39
  });
39
40
  };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const path = require('path');
26
27
  const {mvnw, flags} = require('../mvnw');
27
28
 
@@ -55,7 +56,7 @@ module.exports = function(opts) {
55
56
  argv.push('-Deo.generateDotFiles');
56
57
  }
57
58
  return mvnw(argv, opts.target, opts.batch).then((r) => {
58
- console.info('SODG files generated in %s', path.resolve(opts.target));
59
+ console.info('SODG files generated in %s', rel(path.resolve(opts.target)));
59
60
  return r;
60
61
  });
61
62
  };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const {mvnw, flags} = require('../mvnw');
26
27
  const path = require('path');
27
28
 
@@ -33,7 +34,7 @@ const path = require('path');
33
34
  module.exports = function(opts) {
34
35
  const sources = path.resolve(opts.target, 'generated-sources');
35
36
  return mvnw(['eo:transpile'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
36
- console.info('Java sources generated in %s', sources);
37
+ console.info('Java sources generated in %s', rel(sources));
37
38
  return r;
38
39
  });
39
40
  };
@@ -0,0 +1,53 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2022-2023 Objectionary.com
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included
14
+ * in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ const rel = require('relative');
26
+ const path = require('path');
27
+ const {mvnw, flags} = require('../mvnw');
28
+
29
+ /**
30
+ * Command to convert .PHI files into .XMIR files.
31
+ * @param {Hash} opts - All options
32
+ * @return {Promise} of assemble task
33
+ */
34
+ module.exports = function(opts) {
35
+ const input = path.resolve(opts.target, 'phi');
36
+ console.debug('Reading .PHI files from %s', rel(input));
37
+ const output = path.resolve(opts.target, 'unphi');
38
+ console.debug('Writing .XMIR files to %s', rel(output));
39
+ return mvnw(
40
+ ['eo:phi-to-xmir']
41
+ .concat(flags(opts))
42
+ .concat(
43
+ [
44
+ `-DunphiInputDir=${input}`,
45
+ `-DunphiOutputDir=${output}`,
46
+ ]
47
+ ),
48
+ opts.target, opts.batch
49
+ ).then((r) => {
50
+ console.info('PHI files converted into XMIR files at %s', rel(output));
51
+ return r;
52
+ });
53
+ };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const rel = require('relative');
25
26
  const path = require('path');
26
27
  const {mvnw, flags} = require('../mvnw');
27
28
 
@@ -32,7 +33,7 @@ const {mvnw, flags} = require('../mvnw');
32
33
  */
33
34
  module.exports = function(opts) {
34
35
  return mvnw(['eo:verify'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
35
- console.info('EO program verified in %s', path.resolve(opts.target));
36
+ console.info('EO program verified in %s', rel(path.resolve(opts.target)));
36
37
  return r;
37
38
  });
38
39
  };
package/src/eoc.js CHANGED
@@ -31,6 +31,8 @@ const parse = require('./commands/parse');
31
31
  const assemble = require('./commands/assemble');
32
32
  const sodg = require('./commands/sodg');
33
33
  const phi = require('./commands/phi');
34
+ const unphi = require('./commands/unphi');
35
+ const print = require('./commands/print');
34
36
  const register = require('./commands/register');
35
37
  const verify = require('./commands/verify');
36
38
  const transpile = require('./commands/transpile');
@@ -159,6 +161,20 @@ program.command('phi')
159
161
  }
160
162
  });
161
163
 
164
+ program.command('unphi')
165
+ .description('Generate XMIR files from PHI files')
166
+ .action((str, opts) => {
167
+ clear(str);
168
+ unphi(program.opts());
169
+ });
170
+
171
+ program.command('print')
172
+ .description('Generate EO files from XMIR files')
173
+ .action((str, opts) => {
174
+ clear(str);
175
+ print(program.opts());
176
+ });
177
+
162
178
  program.command('verify')
163
179
  .description('Verify XMIR files and fail if any issues inside')
164
180
  .action((str, opts) => {
package/src/mvnw.js CHANGED
@@ -24,6 +24,7 @@
24
24
 
25
25
  const path = require('path');
26
26
  const fs = require('fs');
27
+ const rel = require('relative');
27
28
  const readline = require('readline');
28
29
  const {spawn} = require('child_process');
29
30
  const colors = require('colors');
@@ -49,14 +50,18 @@ let beginning;
49
50
  * @return {Array} of Maven options
50
51
  */
51
52
  module.exports.flags = function(opts) {
53
+ const sources = path.resolve(opts.sources);
54
+ console.debug('Sources in %s', rel(sources));
55
+ const target = path.resolve(opts.target);
56
+ console.debug('Target in %s', rel(target));
52
57
  return [
53
58
  '-Deo.version=' + opts.parser,
54
59
  '-Deo.hash=' + (opts.hash ? opts.hash : opts.parser),
55
60
  opts.verbose ? '--errors' : '',
56
61
  opts.verbose ? '' : '--quiet',
57
62
  opts.debug ? '--debug' : '',
58
- `-Deo.sourcesDir=${path.resolve(opts.sources)}`,
59
- `-Deo.targetDir=${path.resolve(opts.target)}`,
63
+ `-Deo.sourcesDir=${sources}`,
64
+ `-Deo.targetDir=${target}`,
60
65
  `-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
61
66
  `-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`,
62
67
  `-Deo.placed=${path.resolve(opts.target, 'eo-placed.csv')}`,
package/src/version.js CHANGED
@@ -25,6 +25,6 @@
25
25
  // The values here are replaced automatically by the .rultor.yml script,
26
26
  // at the "release" pipeline:
27
27
  module.exports = {
28
- what: '0.14.0',
29
- when: '2023-12-22'
28
+ what: '0.15.1',
29
+ when: '2023-12-25'
30
30
  };