Skip to content

Commit

Permalink
Update the dynlink stub generator to include the stub version
Browse files Browse the repository at this point in the history
This commits changes the generator tool to include the stub version
as an EQU. This can be useful for build time verification if a
user wants to ensure that the stub version matches the code in
zss/zowe-common-c.

Signed-off-by: Irek Fakhrutdinov <ifakhrutdinov@rocketsoftware.com>
  • Loading branch information
ifakhrutdinov committed Jan 10, 2025
1 parent 59c036a commit a56baee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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 (#xxx)

## `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

0 comments on commit a56baee

Please sign in to comment.