|
|
1.1 ! root 1: # ! 2: # Copyright (c) 1979 Regents of the University of California ! 3: # ! 4: # char sccsid[] = "@(#)30read.s 4.2 10/29/80"; ! 5: # ! 6: # READ OPERATIONS ! 7: # ! 8: _GET: ! 9: incl r10 ! 10: calls $0,_iosync #insure that something is in the window ! 11: jbs $fEOF,FUNIT(r7),eeof ! 12: bisw2 $SYNC,FUNIT(r7) #throw it away ! 13: jmp (r8) ! 14: eeof: ! 15: movw $EPASTEOF,_perrno ! 16: jbr error ! 17: _FNIL: ! 18: incl r10 ! 19: movl (sp),r0 ! 20: jbs $fWRITE,FUNIT(r0),l3002 #ignore sync of output files ! 21: movl r7,r6 ! 22: calls $0,_unit #do not discard arguement to unit on return ! 23: calls $0,_iosync ! 24: jbs $fEOF,FUNIT(r7),eeof ! 25: movl r6,r7 ! 26: movl PFNAME(r7),_file ! 27: l3002: ! 28: jmp (r8) ! 29: _READ4: ! 30: incl r10 ! 31: calls $0,_unsync #prepare input stream ! 32: pushl $0 #space for answer ! 33: pushl sp #ptr to answer space ! 34: pushal rd4 #ptr to input format ! 35: pushl FBUF(r7) #stream ! 36: calls $3,_fscanf ! 37: cmpl $1,r0 ! 38: bneq eiread ! 39: bisw2 $SYNC,FUNIT(r7) ! 40: jmp (r8) ! 41: eiread: ! 42: movw $EBADINUM,_perrno ! 43: jbr error ! 44: _READ8: ! 45: incl r10 ! 46: calls $0,_unsync #prepare input stream ! 47: clrd -(sp) #space for answer ! 48: pushl sp #ptr to answer space ! 49: pushal rd8 #ptr to input format ! 50: pushl FBUF(r7) #stream ! 51: calls $3,_fscanf ! 52: cmpl $1,r0 ! 53: bneq efread ! 54: bisw2 $SYNC,FUNIT(r7) ! 55: jmp (r8) ! 56: efread: ! 57: movw $EBADFNUM,_perrno ! 58: jbr error ! 59: _READLN: ! 60: incl r10 ! 61: calls $0,_iosync ! 62: jbs $fEOLN,FUNIT(r7),l3005 #check for already at end of line ! 63: movab -1024(sp),sp #temp space ! 64: pushl FBUF(r7) #file ! 65: pushl $1024 #buffer ! 66: pushal 8(sp) #ptr to buffer ! 67: calls $3,_fgets ! 68: movab 1024(sp),sp #pop temp space ! 69: l3005: ! 70: jbs $fEOF,FUNIT(r7),eeof ! 71: bisw2 $SYNC,FUNIT(r7) ! 72: jmp (r8) ! 73: _READC: ! 74: incl r10 ! 75: calls $0,_iosync ! 76: cvtbw (r7),-(sp) ! 77: jbs $fEOF,FUNIT(r7),eeof ! 78: bisw2 $SYNC,FUNIT(r7) ! 79: jmp (r8) ! 80: _READE: ! 81: incl r10 ! 82: calls $0,_unsync #push back char if present ! 83: subl2 $bufsze,sp #allocate space for name ! 84: pushl sp #ptr to buffer ! 85: pushal rden #format string ! 86: pushl FBUF(r7) #FILE ptr ! 87: calls $3,_fscanf #read name ! 88: cmpl r0,$1 #check for valid input ! 89: bneq entfd ! 90: locc $0,$bufsze,(sp) #find size of input ! 91: subl3 r0,$bufsze+1,r6 #r6 has length of input ! 92: addl3 (r10),ap,r5 #r5 points to candidate data ! 93: cvtwl (r5)+,r4 #r4 has number of candidates ! 94: movaw 2(r5)[r4],r1 #r1 has addr of candidate name list ! 95: l3006: ! 96: subw3 (r5)+,(r5),r0 #r0 has candidate length ! 97: cmpw r0,r6 #check for correct length ! 98: bneq l3007 ! 99: cmpc3 r0,(r1),(sp) #check for actual match ! 100: beql l3008 ! 101: l3007: ! 102: addl2 r0,r1 #update ptr to next candidate ! 103: sobgtr r4,l3006 ! 104: entfd: ! 105: addl2 $bufsze,sp #deallocate buffer ! 106: addl2 $4,r10 ! 107: movw $ENUMNTFD,_perrno ! 108: jbr error ! 109: l3008: ! 110: addl2 $bufsze,sp #deallocate buffer ! 111: addl3 (r10)+,ap,r0 #r0 has number of cases ! 112: subw3 r4,(r0),-(sp) #push internal value ! 113: jmp (r8) ! 114: ! 115: .set bufsze,84 ! 116: rd4: .asciz "%ld" ! 117: rd8: .asciz "%lf" ! 118: rden: .asciz "%*[ \t\n]%80[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]",
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.