Skip to content

Commit

Permalink
Merge pull request #743 from zowe/feature/stub-version-in-asm
Browse files Browse the repository at this point in the history
Update the dynlink stub generator to include the stub version
  • Loading branch information
JoeNemo authored Jan 28, 2025
2 parents bca9f12 + 666a998 commit d3408f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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 (#743)
- Enhancement: expose new cmutils functions (#740)

## `3.1.0`
Expand Down
14 changes: 14 additions & 0 deletions tools/dynzis/org/zowe/zis/ZISStubGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ private void generateCode(PrintStream out, boolean generateASM, DispatchMode dis
Set<String> symbols = new HashSet<>();
Set<String> 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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d3408f4

Please sign in to comment.