diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bfe409de..03ce08cf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to the ZSS package will be documented in this file. +## `3.2.0` +- Enhancement: include the stub version in the generated HLASM stub (#xxx) + ## `3.1.0` - Enhancement: module registry (#732) diff --git a/tools/dynzis/org/zowe/zis/ZISStubGenerator.java b/tools/dynzis/org/zowe/zis/ZISStubGenerator.java index b2569030b..4055bdd9a 100644 --- a/tools/dynzis/org/zowe/zis/ZISStubGenerator.java +++ b/tools/dynzis/org/zowe/zis/ZISStubGenerator.java @@ -90,8 +90,11 @@ private void generateCode(PrintStream out, boolean generateASM, DispatchMode dis Set symbols = new HashSet<>(); Set functions = new HashSet<>(); int maxStubNum = 0; + int stubVersion = 0; + boolean stubVersionFound = false; Pattern stubPattern = Pattern.compile("^#define\\s+ZIS_STUB_(\\S+)\\s+([0-9]{1,8})\\s*/\\*\\s*(\\S+)(\\s+mapped)?\\s*\\*/\\s*"); Pattern maxStubCountPattern = Pattern.compile("^#define\\s+MAX_ZIS_STUBS\\s+([0-9]+)\\s*"); + Pattern versionPattern = Pattern.compile("^#define\\s+ZIS_STUBS_VERSION\\s+([0-9]+)$"); String line; while ((line = reader.readLine()) != null) { @@ -155,9 +158,20 @@ private void generateCode(PrintStream out, boolean generateASM, DispatchMode dis if (maxStubCountMatcher.matches()) { maxStubNum = Integer.parseInt(maxStubCountMatcher.group(1)); } + if (!stubVersionFound) { + Matcher stubVersionMatcher = versionPattern.matcher(line); + if (stubVersionMatcher.matches()) { + stubVersion = Integer.parseInt(stubVersionMatcher.group(1)); + stubVersionFound = true; + } + } } + if (!stubVersionFound) { + throw new RuntimeException("Error: stub version not found"); + } if (generateASM) { + out.printf("ZISSTUBV EQU %d\n", stubVersion); writeLines(out, hlasmEpilog); } else { writeLines(out, initCopyright);