Skip to content

Commit

Permalink
os400: implement CL command XMLCATALOG.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Monnerat authored and veillard committed May 1, 2016
1 parent d76abc7 commit 9b5a57c
Show file tree
Hide file tree
Showing 3 changed files with 383 additions and 3 deletions.
34 changes: 31 additions & 3 deletions os400/make-src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cd "${TOPDIR}"
echo '#pragma comment(user, "libxml2 version '"${LIBXML_VERSION}"'")' > os400.c
echo '#pragma comment(user, __DATE__)' >> os400.c
echo '#pragma comment(user, __TIME__)' >> os400.c
echo '#pragma comment(copyright, "Copyright (C) 1998-2014 Daniel Veillard. OS/400 version by P. Monnerat.")' >> os400.c
echo '#pragma comment(copyright, "Copyright (C) 1998-2015 Daniel Veillard. OS/400 version by P. Monnerat.")' >> os400.c
make_module OS400 os400.c
LINK= # No need to rebuild service program yet.
MODULES=
Expand Down Expand Up @@ -250,7 +250,7 @@ make_module --ebcdic --sysiconv LIBXMLMAIN "${SCRIPTDIR}/libxmlmain.c"

if action_needed "${LIBIFSNAME}/XMLLINT.PGM" "xmllint.c" ||
action_needed "${LIBIFSNAME}/XMLLINT.PGM" "${LIBIFSNAME}/${SRVPGM}.SRVPGM" ||
action_needed "${LIBIFSNAME}/XMLLINT.PGM" "${LIBIFSNAME}/LIMXMLMAIN.MODULE"
action_needed "${LIBIFSNAME}/XMLLINT.PGM" "${LIBIFSNAME}/LIBXMLMAIN.MODULE"
then make_module XMLLINT xmllint.c
CMD="CRTPGM PGM(${TARGETLIB}/XMLLINT) MODULE(${TARGETLIB}/XMLLINT)"
CMD="${CMD} ENTMOD(${TARGETLIB}/LIBXMLMAIN)"
Expand Down Expand Up @@ -306,7 +306,7 @@ if action_needed "${LIBIFSNAME}/XMLCATALOG.PGM" "xmlcatalog.c" ||
action_needed "${LIBIFSNAME}/XMLCATALOG.PGM" \
"${LIBIFSNAME}/${SRVPGM}.SRVPGM" ||
action_needed "${LIBIFSNAME}/XMLCATALOG.PGM" \
"${LIBIFSNAME}/LIMXMLMAIN.MODULE"
"${LIBIFSNAME}/LIBXMLMAIN.MODULE"
then make_module XMLCATALOG xmlcatalog.c
CMD="CRTPGM PGM(${TARGETLIB}/XMLCATALOG)"
CMD="${CMD} MODULE(${TARGETLIB}/XMLCATALOG)"
Expand All @@ -325,3 +325,31 @@ fi

rm -f "${IFSDIR}/bin/xmlcatalog"
ln -s "${LIBIFSNAME}/XMLCATALOG.PGM" "${IFSDIR}/bin/xmlcatalog"

# Prepare the XMLCATALOG command and its response program.

if action_needed "${LIBIFSNAME}/XMLCATLGCL.PGM" "${SCRIPTDIR}/xmlcatlgcl.c"
then make_module --ebcdic XMLCATLGCL "${SCRIPTDIR}/xmlcatlgcl.c"
CMD="CRTPGM PGM(${TARGETLIB}/XMLCATLGCL)"
CMD="${CMD} MODULE(${TARGETLIB}/XMLCATLGCL)"
CMD="${CMD} ACTGRP(*NEW) TEXT('XMLCATALOG command response')"
CMD="${CMD} TGTRLS(${TGTRLS})"
system "${CMD}"
rm -f "${LIBIFSNAME}/XMLCATLGCL.MODULE"
fi

if action_needed "${LIBIFSNAME}/TOOLS.FILE/XMLCATALOG.MBR" \
"${SCRIPTDIR}/xmlcatalog.cmd"
then CMD="CPY OBJ('${SCRIPTDIR}/xmlcatalog.cmd')"
CMD="${CMD} TOOBJ('${LIBIFSNAME}/TOOLS.FILE/XMLCATALOG.MBR')"
CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
system "${CMD}"
fi

if action_needed "${LIBIFSNAME}/XMLCATALOG.CMD" \
"${LIBIFSNAME}/TOOLS.FILE/XMLCATALOG.MBR"
then CMD="CRTCMD CMD(${TARGETLIB}/XMLCATALOG) PGM(${TARGETLIB}/XMLCATLGCL)"
CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(XMLCATALOG)"
CMD="${CMD} THDSAFE(*YES) TEXT('XML/SGML catalog tool') REPLACE(*YES)"
system "${CMD}"
fi
93 changes: 93 additions & 0 deletions os400/xmlcatalog.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/* XMLCATALOG CL command. */
/* */
/* See Copyright for the status of this software. */
/* */
/* Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A. */

/* Interface to program XMLCATLGCL */

CMD PROMPT('XML/SGML catalog tool')

/* Catalog file path. */

PARM KWD(INSTMF) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
CASE(*MIXED) EXPR(*YES) MIN(1) SPCVAL((*NEW '')) +
CHOICE('Stream file path') +
PROMPT('XML/SGML catalog file')

/* Catalog kind: XML/SGML. */

PARM KWD(KIND) TYPE(*CHAR) LEN(7) VARY(*YES *INT2) +
EXPR(*YES) RSTD(*YES) DFT(*XML) +
SPCVAL((*XML '') (*SGML '--sgml')) +
PROMPT('Catalog kind')

/* Output file. */

PARM KWD(OUTSTMF) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
CASE(*MIXED) EXPR(*YES) DFT(*STDOUT) +
SPCVAL((*STDOUT '') (*INSTMF X'00')) +
CHOICE('*STDOUT, *INSTMF or file path') +
PROMPT('Output stream file path')

/* SGML super catalog update. */

PARM KWD(SUPERUPD) TYPE(*CHAR) LEN(17) VARY(*YES *INT2) +
SPCVAL((*YES '') (*NO '--no-super-update')) +
EXPR(*YES) DFT(*YES) RSTD(*YES) +
PROMPT('Update the SGML super catalog')

/* Verbose/debug output. */

PARM KWD(VERBOSE) TYPE(*CHAR) LEN(4) VARY(*YES *INT2) +
RSTD(*YES) SPCVAL((*YES '-v') (*NO '')) +
EXPR(*YES) DFT(*NO) +
PROMPT('Output debugging information')

/* Interactive shell not supported. */

/* Values to delete. */

PARM KWD(DELETE) TYPE(*PNAME) LEN(256) VARY(*YES *INT2) +
CASE(*MIXED) MAX(64) EXPR(*YES) +
CHOICE('Identifier value') +
PROMPT('Delete System/URI identifier')

/* Values to add. */

PARM KWD(ADD) TYPE(ADDELEM) MAX(10) +
PROMPT('Add definition')
ADDELEM: ELEM TYPE(*CHAR) LEN(16) VARY(*YES *INT2) DFT(*PUBLIC) +
PROMPT('Entry type') +
EXPR(*YES) RSTD(*YES) SPCVAL( +
(*PUBLIC 'public') +
(*SYSTEM 'system') +
(*URI 'uri') +
(*REWRITESYSTEM 'rewriteSystem') +
(*REWRITEURI 'rewriteURI') +
(*DELEGATEPUBLIC 'delegatePublic') +
(*DELEGATESYSTEM 'delegateSystem') +
(*DELEGATEURI 'delegateURI') +
(*NEXTCATALOG 'nextCatalog') +
(*FILENAME '') +
)
ELEM TYPE(*PNAME) LEN(256) VARY(*YES *INT2) EXPR(*YES) +
CASE(*MIXED) PROMPT('Original reference/file name')
ELEM TYPE(*PNAME) LEN(256) VARY(*YES *INT2) EXPR(*YES) +
CASE(*MIXED) PROMPT('Replacement entity URI')

/* Entities to resolve. */

PARM KWD(ENTITY) TYPE(*PNAME) LEN(256) VARY(*YES *INT2) +
CASE(*MIXED) EXPR(*YES) MAX(150) +
PROMPT('Resolve entity')

/* Additional catalog files. */

PARM KWD(CATALOG) TYPE(*PNAME) LEN(5000) VARY(*YES *INT2) +
CASE(*MIXED) EXPR(*YES) MAX(150) DFT(*DEFAULT) +
CHOICE('Catalog stream file path') +
PROMPT('Additional catalog file') SPCVAL( +
(*DEFAULT '/etc/xml/catalog') +
(*NONE '') +
)
Loading

0 comments on commit 9b5a57c

Please sign in to comment.