JOE@FHCRCVAX.BITNET (Joe Meadows) (08/22/87)
I recently needed to parse a UIC and convert it from a string
to a numeric value.. Being lazy I looked all over but couldn't find
a routine to do it for me, so I checked how it was done in the
SET command, and came up with this routine (translated from Bliss).
The calling sequence should be:
status = parse_uic(uic-text,uic-value)
where uic-text is a string passed by descriptor, and uic-value is the
address of a longword to receive the UIC value.
Hope this saves someone a little effort..
Cheers,
Joe Meadows Jr.
Fred Hutchinson Cancer Research Center
bitnet - JOE@FHCRCVAX
arpa - JOE%FHCRCVAX.BITNET@WISCVM.WISC.EDU
voice - (206) 467-4970
;---------------------------------------------
.title parse_uic
;---------------------------------------------
$tpadef
tparse_init:
.long tpa$k_count0
.long tpa$m_blanks!tpa$m_abbrev
tparse: .blkb tpa$k_length0
$init_state uic_stb,uic_ktb
$state
$tran tpa$_ident,,,,uic
$state
$tran tpa$_eos,tpa$_exit
$end_state
uic: .long
.entry parse_uic,^m<r2,r3,r4,r5>
; initialize tparse block
movc5 #8,tparse_init,#0,#tpa$k_length0,tparse
; set the tparse block string info
movl 4(ap),r0
movzwl (r0),tparse+tpa$l_stringcnt
movl 4(r0),tparse+tpa$l_stringptr
; call lib$tparse
pushab uic_ktb
pushab uic_stb
pushab tparse
calls #3,g^lib$tparse
movl uic,@8(ap)
ret
.endcarl@CITHEX.CALTECH.EDU (Carl J Lydick) (08/22/87)
> I recently needed to parse a UIC and convert it from a string > to a numeric value.. Being lazy I looked all over but couldn't find > a routine to do it for me, so I checked how it was done in the > SET command, and came up with this routine (translated from Bliss). > The calling sequence should be: > status = parse_uic(uic-text,uic-value) > > where uic-text is a string passed by descriptor, and uic-value is the > address of a longword to receive the UIC value. > > Hope this saves someone a little effort.. This might save those poor souls still running VMS V4.3 or earlier some trouble, but for those of us running at least VMS V4.4, its already been done (and better) by DEC. The calling sequence is: STATUS = SYS$ASCTOID(name, id, attrib) where name is the address of a string descriptor containing the uic text, id is the address of a longword to receive the numeric value, and attrib is the address of a longword mask to receive the attributes associated with the identifier. The value of the symbols KGB$V_DYNAMIC and KGB$V_RESOURCE are defined in $KGBDEF. $ASCTOID returns any of the following values: SS$_NORMAL normal completion SS$_ACCVIO bad address for one of the arguments SS$_INSFMEM to little process memory to open the rightslist SS$_IVIDENT name is in an invalid format SS$_NOSUCHID name is not in the right database RMS$_PRIV no read access to the rights database Specify id or attrib as 0, if you don't want the corresponding data.