.title integerk test if a char string can be read as an integer ; DCL integerk ENTRY(CHAR(*) VARYING) RETURNS(BIT(1)); ; t dow 3/3/82 ; .show expansions .macro tran endloc,nexts,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r .narg count incl r6 ;to next char cmpl r6,r7 ;end of string? bleq 2$ brw endloc ;yes 2$: locc (r6),#,nexts caseb r0,#0,# 1$: .word bad-1$ .irp arg, .iif not_blank, arg, .word arg-1$ .endr .endm ;; .psect wes_code pic,usr,con,rel,lcl,shr,exe,rd,nowrt integerk:: .word ^m movl 4(ap),r1 ;addr descriptor input string movl 4(r1),r6 ;addr (actual) length movzwl (r6),r7 ;length incl r6 ;addr string-1 addl2 r6,r7 ;addr end of string start: tran bad,stch,sgn,sgn,w,w,w,w,w,w,w,w,w,w,start stch: .ascii / 0123456789+-/ sgn: tran bad,sgch,w,w,w,w,w,w,w,w,w,w sgch: .ascii /0123456789/ w: tran ok,whch,w,w,w,w,w,w,w,w,w,w,trailb whch: .ascii / 0123456789/ trailb: tran ok,tbch,trailb tbch: .ascii / / bad: clrl r0 ret ok: movl #1,r0 ret .end