;****************************************** ;* * ;* C-callable routine to do a PL/I SIGNAL * ;* * ;****************************************** .title signal .psect .globl .error ;PL/I run-time signal routine .globl plifp ; ; For documentation on how to use it, refer to CPLI.DOC. ; ; Calling sequence is either ; ; signal(system_condition) ; ; where system_condition is a PL/I-defined condition, or ; ; signal(condition,&user_condition) ; ; where user_condition is a reference to a user-defined condition. ; .iif ndf c$r4 .error CDEFS.MAC must be included in command line ; what's on the stack on entry: rtnad = 0 condcode = 2 conduser = 4 ;if condcode=condition signal::mov sp,r0 ;index our args clr -(sp) ;default is no arg/qualifier mov r5,-(sp) ;where signal occurred for error message mov condcode(r0),-(sp) bge 1$ ;user condition? (signal.c defines negative) neg (sp) ;yes, pass true code mov conduser(r0),4(sp) ;arg/qualifier = user condition address 1$: mov r4,r0 ;save r4 (must preserve all regs except 0,1) jsr pc,plifp ;get PL/I frame pointer (from plient) jsr r5,.ERROR mov r0,r4 rts pc ; we use r5 (C frame pointer) as the point where signal occurred because ; although the offset into the routine shown in the error message will always ; be incorrect (the prolog is on the stack not at beginning of routine - see ; plient for explanation), r5, being at a smallish positive offset from the ; prolog on the stack will look good even if it isn't meaningful. ; this assumes we are called by a C routine; if called due to stack overflow ; in plient on call from PL/I routine, offset from r5 will be big garbage. .end