.title sys_trnlog ; ; function to do almost the same thing as system service $trnlog ; ; The outstanding difference is that repeated attempts are ; made to translate the logical name, until it cannot be ; translated. ; The calling sequence is identical to $trnlog's. ; In general, the results are the same as from $trnlog. One ; new error status is available: ss$_bufferovf is returned if ; this subroutine's internal buffer is not large enough, but ; that should never happen. No attempt is made to PROBE the ; caller's arguments, so that true access vioaltions are ; possible, especially if the destination buffer descriptor is ; invalid. ; System service failure exception mode is ignored. ; ; This code is re-entrant, all local storage is on the stack. ; ; R. J. FitzPatrick 12-June-1980 ; Smithsonian Astrophysical Observatory, Cambridge MA ; strlen = 512 esc = ^x1b ; ASCII escape $ssdef $_args 6 ; establish NARGS and symbols for argument offsets ; .psect _lib_code pic,usr,con,rel,lcl,shr,exe,rd,nowrt ; insuffargs: movl #ss$_insfarg,r0 ret ; ; .entry sys_trnlog,^m cmpb #nargs,(ap) bgtr insuffargs movq @arg_1(ap),r4 ; descriptor of logical name movl #strlen,r2 subl3 #strlen,sp,r1 ; buffer 1 subl3 #strlen,r1,r3 ; buffer 2 movl r3,sp ; put buffers on stack movaw @arg_2(ap),r6 bneq 1$ subl2 #4,sp movl sp,r6 1$: movl r4,r0 ; put input string len into buff 1 descriptor pushr #^m ; push 2 descriptors onto stack movc3 r0,(r5),@4(sp) ; put logical name into buffer 1 ; movc3 clears r4&r5, which are used later movl sp,r2 ; save sp for macro call calls: .list me $trnlog_s lognam=(r2),rsllen=(r6),rslbuf=8(r2)- ,table=@arg_4(ap),acmode=@arg_5(ap),dsbmsk=arg_6(ap) cmpl r0,#ss$_accvio beql ret1 cmpl r0,#ss$_ivlognam beql ret1 cmpl r0,#ss$_resultovf bneq 1$ movl #ss$_bufferovf,r0 brb ret1 1$: cmpl r0,#ss$_notran beql done cmpl r0,#ss$_normal bneq ret1 ; let caller figure out unexpected result bisb2 #1,r5 ; remember that we got (at least) 1 translation movl 12(sp),r0 ; switch buffers movl 4(sp),12(sp) movl r0,4(sp) movw (r6),r4 ; output length becomes input length movw r4,(sp) cmpb #^a/:/,-(r4)[r0] bneq 2$ decw (sp) ; strip : off name 2$: cmpb #esc,(r0) ; strip off header if 1st char. is esc bneq 3$ subw2 #4,(sp) addl2 #4,4(sp) 3$: brb calls ; ovfl: movl #ss$_resultovf,r6 brb store ; done: movq @arg_3(ap),r2 ; check if caller's result buffer can cmpw (r6),r2 ; hold the result bgtr ovfl movw (r6),r2 ; yes, use true result length ; movl r0,r6 ; prepare to return notran bbc #0,r5,store movl #ss$_normal,r6 ; set if at least one translation done store: movc3 r2,@12(sp),(r3) movl r6,r0 ret1: ret .end