Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the dynlink stub generator to include the stub version #743

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (#743)

## `3.1.0`
- Enhancement: module registry (#732)

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
Loading