Article 171660 of comp.os.vms:
Greg Pratt <glp5941@OSFMAIL.ISC.RIT.EDU> writes:
> I am having a problem using CLI$DCL_PARSE that I hope people here can help
> me with.  I haven't found a lot of sample code in the VMS documentation
> that's written in C.
>[...]
> Here's the problem:  If I run the verb TEST with qualifiers that the CLD
> file says are correct, no problem.  But if I do something "illegal"
> ("TEST/PERM/TEMP" or "TEST/DUMMY" (/DUMMY isn't a recognized qualifier),
> CLI$DCL_PARSE() will print an error message, and then print a stack dump.
>[...]

Below is my "wrapper" (written in MACRO32) for the CLI$* functions
that does away with their habit of both signalling and returning
error statuses.

Compile, include in your LINK, and use CLI_* instead of CLI$* in your program.

The special workaround dating back from VAX VMS V4.1 won't hurt you :-)

Wolfgang J. Moeller, Tel. +49 551 2011516 or -510, moeller@gwdvms.dnet.gwdg.de
GWDG, D-37077 Goettingen, F.R.Germany   |       Disclaimer: No claim intended!
<moeller@decus.decus.de>  ----- <moeller@gwdg.de>  -----  <w.moeller@ieee.org>

----- CLICATCH.MAR -------------------------------------------------------------
	.title	cli_catch_signals	like CLI$..., does not signal
;
;	w.j.m. jul 85
;	oct 85 wjm: work around a bug in CLI$DCL_PARSE(): In VMS 4.0 .. 4.1
;		a bit on the caller's stack gets cleared. DCL PARSENT bug:
;		reference to PRC_ structure (defined only in super mode)
;		via R11 which is set up by CLI$DCL_PARSE()
;
;
.ntype	__,R31			;  set EVAX nonzero if R31 is a register
.if eq <__ & ^xF0> - ^x50
EVAX = 1
.iff
EVAX = 0
.endc
;
	.psect	_code,nowrt
;
.if ne EVAX
CLI_DCL_PARSE::	.call_entry	home_args=TRUE,max_args=5
.iff
	.entry	CLI_DCL_PARSE,^m<>
.endc
;
	movab	g^lib$sig_to_ret,(fp)
.if eq EVAX
;+VMS4bug
	pushl	#^x20			;this bit gets cleared in V4.0 .. V4.1
	clrq	-(sp)
;.VMS4bug
.endc
	callg	(ap),g^cli$dcl_parse
	ret
;
;
.if ne EVAX
CLI_PRESENT::	.call_entry	home_args=TRUE,max_args=1
.iff
	.entry	CLI_PRESENT,^m<>
.endc
;
	movab	g^lib$sig_to_ret,(fp)
	callg	(ap),g^cli$present
	ret
;
;
.if ne EVAX
CLI_GET_VALUE::	.call_entry	home_args=TRUE,max_args=3
.iff
	.entry	CLI_GET_VALUE,^m<>
.endc
;
	movab	g^lib$sig_to_ret,(fp)
	callg	(ap),g^cli$get_value
	ret
;
;
	.end
----- end of CLICATCH.MAR ------------------------------------------------------

Wolfgang J. Moeller, Tel. +49 551 2011516 or -510, moeller@gwdvms.dnet.gwdg.de
GWDG, D-37077 Goettingen, F.R.Germany   |       Disclaimer: No claim intended!
<moeller@decus.decus.de>  ----- <moeller@gwdg.de>  -----  <w.moeller@ieee.org>


