Skip to content

Commit

Permalink
Update to MQ 9.1.5; include filtered headerfile for complete build ex…
Browse files Browse the repository at this point in the history
…perience
  • Loading branch information
ibmmqmet committed Mar 30, 2020
1 parent 0a6ef3e commit 668a074
Show file tree
Hide file tree
Showing 16 changed files with 1,542 additions and 37 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

History (newest at top)
=======================
Apr 2020 (v5.2.1)
* Update for MQ V9.1.5
* Include mqsmfstruc.h so you can build without copying a header from z/OS

Dec 2019 (v5.2.0)
* Add support for MQ 9.1.4 encrypted datasets and logs
Expand Down
Binary file modified bin/aix/convH
Binary file not shown.
Binary file modified bin/aix/mqsmfcsv
Binary file not shown.
Binary file modified bin/linux/convH
Binary file not shown.
Binary file modified bin/linux/mqsmfcsv
Binary file not shown.
Binary file modified bin/win/convH.exe
Binary file not shown.
Binary file modified bin/win/mqsmfcsv.exe
Binary file not shown.
Binary file modified mqsmfcsv.doc
Binary file not shown.
4 changes: 2 additions & 2 deletions src/M
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/ksh
#!/bin/sh

plat=`uname`

Expand Down Expand Up @@ -26,7 +26,7 @@ else
flags="$flags $optim"
fi

export PLATFLAGS=$flags CC=$cc VERS=914
export PLATFLAGS=$flags CC=$cc VERS=915
make -e -f Makefile.unix $*

rm -f $targdir/convH $targdir/mqsmfcsv
Expand Down
10 changes: 5 additions & 5 deletions src/Makefile.gcc.win
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CC=i686-w64-mingw32-gcc
# CFLAGS= -I. -m32 -fpack-struct=8 -DPLATFORM_WINDOWS
CFLAGS= -I. -m32 -DPLATFORM_WINDOWS
PLATFLAGS=
VERS=914
VERS=915
SRC = mqsmf.c \
smfDDL.c \
smfDate.c \
Expand Down Expand Up @@ -49,16 +49,16 @@ sizeTest: mqsmfcsv.exe
diff -b sizes.tmp sizes.master

shipTest: mqsmfcsv.exe
cd ../testing/shipTest;./shipTest.sh
cd ../testing/shipTest;./shipTest.sh csv sql json

mqsmfcsv.exe: $(SRC) $(HDR) Makefile.gcc.win dummy
mqsmfcsv.exe: $(SRC) $(HDR) Makefile.gcc.win dummy
-rm -f $@
$(CC) $(PLATFLAGS) -o $@ $(SRC) $(CFLAGS) -DCSQDSMF_VERSION=$(VERS)
-mkdir out >/dev/null 2>&1 || true
cp $@ ../bin/win

mqsmfstruc.h: csqdsmfc-$(VERS).h convH.exe dummy
./convH.exe < csqdsmfc-$(VERS).h > $@
mqsmfstruc.h: convH.exe dummy
./convH.exe $(VERS) < csqdsmfc-$(VERS).h > $@

convH.exe: convH64.c
$(CC) $(CFLAGS) -o $@ convH64.c
Expand Down
8 changes: 4 additions & 4 deletions src/Makefile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ sizeTest: mqsmfcsv
diff -b sizes.tmp sizes.master

shipTest: mqsmfcsv
cd ../testing/shipTest;./shipTest.sh
cd ../testing/shipTest;./shipTest.sh csv sql json

mqsmfcsv: $(SRC) $(HDR) Makefile.unix dummy
$(CC) $(PLATFLAGS) -o $@ $(SRC) $(CFLAGS) -DCSQDSMF_VERSION=$(VERS)

mqsmfstruc.h: csqdsmfc-$(VERS).h convH dummy
convH < csqdsmfc-$(VERS).h > $@
mqsmfstruc.h: convH csqdsmfc-$(VERS).h
convH $(VERS) < csqdsmfc-$(VERS).h > $@

convH: convH64.c dummy
convH: convH64.c dummy
$(CC) -o $@ convH64.c


Expand Down
6 changes: 3 additions & 3 deletions src/Makefile.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CFLAGS=-nologo /D_CRT_SECURE_NO_WARNINGS /Zp1 /J /O2 /DPLATFORM_WINDOWS
VERS=914
VERS=915
SRC = mqsmf.c \
smfDDL.c \
smfDate.c \
Expand Down Expand Up @@ -46,8 +46,8 @@ mqsmfcsv.exe: $(SRC) $(HDR) Makefile.win
del /q *.obj
copy $@ ..\bin\win

mqsmfstruc.h: csqdsmfc-$(VERS).h convH.exe dummy
convH < csqdsmfc-$(VERS).h > $@
mqsmfstruc.h: convH.exe dummy
convH $(VERS) < csqdsmfc-$(VERS).h > $@

convH.exe: convH64.c
$(CC) $(CFLAGS) /Fe$@ convH64.c
Expand Down
95 changes: 79 additions & 16 deletions src/convH64.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019 IBM Corporation and other Contributors.
* Copyright (c) 2016, 2020 IBM Corporation and other Contributors.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>


/**********************************************************************/
Expand Down Expand Up @@ -77,6 +78,9 @@
#define REPLACE_UINT16 "uint16_t "
#define REPLACE_EXTRAINT " "

#define BITFIELD_ACCT (1)
#define BITFIELD_QWHS (2)

/**********************************************************************/
/* Newer compiler versions on some platforms have also */
/* affected how bitfields are laid out. This program now */
Expand All @@ -95,11 +99,27 @@
int inBitfieldReplace = 0;
void bitfieldReprint(int c);
void datatypeReplace(char *);
char *stripLine(char *);
void printHeader(char *);

int main(int argc, char **argv)
{
char line[256] = {0};
char *c;
char *p;
char *v;

if (argc > 1) {
v = argv[1];
} else {
v = "UNKNOWN";
}

#if defined(PLATFORM_WINDOWS)
setmode(fileno(stdout),O_BINARY);
#endif

printHeader(v);

/******************************************************/
/* Need a portable pragma that works on all platforms */
Expand All @@ -123,14 +143,16 @@ int main(int argc, char **argv)
/****************************************************/
else if (strstr(line,"\?\?="))
continue;
else if (strncmp(line," /*",3) == 0)
continue;
else
{
if (BITFIELDREPRINTNEEDED) {
if (strstr(line,"fNoAcctg")) {
bitfieldReprint(1);
bitfieldReprint(BITFIELD_ACCT);
}
if (strstr(line,"qwhssmfc")) {
bitfieldReprint(2);
bitfieldReprint(BITFIELD_QWHS);
}
}

Expand All @@ -142,10 +164,12 @@ int main(int argc, char **argv)

if (!inBitfieldReplace) {
datatypeReplace(line);

printf("%s",line);
if (line[strlen(line)-1] != '\n')
printf("\n");
p = stripLine(line);
if (strlen(p) > 1) {
printf("%s",p);
if (p[strlen(p)-1] != '\n')
printf("\n");
}
}

}
Expand All @@ -156,19 +180,46 @@ int main(int argc, char **argv)
return 0;
}

/* Remove trailing comments and leading spaces */
char *stripLine(char *l) {
char *p = l;
char *e;
char *cmtStart;
char *cmtEnd;

while (*p == ' ') p++;

cmtStart = strstr(p,"/*");
cmtEnd = strstr(p,"*/\n");

/* There are a few multi-line macros that have comments embedded
* so we can't just strip to end of line ... if the line ends in
* a continuation marker then leave the comments alone
*/
if (cmtStart != NULL && cmtEnd != NULL && p[strlen(p)-2] != '\\') {
*cmtStart = 0;
}
e = &p[strlen(p) -1];
while (*e == ' ' && e > p) {
*e = 0;
e--;
}
return p;
}

void bitfieldReprint(int c) {
inBitfieldReplace = 1;
switch (c) {
case 1:
printf(" unsigned char fNoAcctg : 1;\n");
printf(" unsigned char fTopic : 1;\n");
printf(" unsigned char fAcctqC : 1;\n");
printf(" unsigned char spare : 5;\n");
printf(" unsigned char spare2 : 8;\n");
case BITFIELD_ACCT:
printf("unsigned char fNoAcctg : 1;\n");
printf("unsigned char fTopic : 1;\n");
printf("unsigned char fAcctqC : 1;\n");
printf("unsigned char spare : 5;\n");
printf("unsigned char spare2 : 8;\n");
break;
case 2:
printf(" unsigned char qwhssmfc : 1;\n");
printf(" unsigned char qwhspad1 : 7;\n");
case BITFIELD_QWHS:
printf("unsigned char qwhssmfc : 1;\n");
printf("unsigned char qwhspad1 : 7;\n");
break;
default:
break;
Expand Down Expand Up @@ -309,3 +360,15 @@ void datatypeReplace(char *line) {

return;
}

void printHeader(char *version)
{
printf("/*\n");
printf(" * This file was generated from cqsdsmfc.h version %s\n",version);
printf(" * by the convH program (convH64.c) in the src directory\n");
printf(" * Do not try to edit this header manually.\n");
printf(" * \n");
printf(" * (C) Copyright IBM Corp. 1993, 2020 All Rights Reserved.\n");
printf(" * \n");
printf(" */\n");
}
Loading

0 comments on commit 668a074

Please sign in to comment.