BSD 3 development
[unix-history] / usr / src / cmd / px / 30read.s
CommitLineData
b202b2da
CH
1#\f
2# 30read.s
3#
4# READ OPERATIONS
5#
6_GET:
7 incl r10
8 calls $0,_iosync #insure that something is in the window
9 bisw2 $SYNC,FUNIT(r7) #throw it away
10 jmp (r8)
11_FNIL:
12 incl r10
13 movl (sp),r0
14 bbs $fWRITE,FUNIT(r0),l3002 #ignore sync of output files
15 movl r7,r2
16 movl _file,r3
17 calls $0,_unit #do not discard arguement to unit on return
18 calls $0,_iosync
19 movl r2,r7
20 movl r3,_file
21l3002:
22 jmp (r8)
23_READ4:
24 incl r10
25 calls $0,_unsync #prepare input stream
26 pushl $0 #space for answer
27 pushl sp #ptr to answer space
28 pushal rd4 #ptr to input format
29 pushl FBUF(r7) #stream
30 calls $3,_fscanf
31 cmpl $1,r0
32 bneq eiread
33 bisw2 $SYNC,FUNIT(r7)
34 jmp (r8)
35eiread:
36 movw $EBADINUM,_perrno
37 jbr error
38_READ8:
39 incl r10
40 calls $0,_unsync #prepare input stream
41 clrd -(sp) #space for answer
42 pushl sp #ptr to answer space
43 pushal rd8 #ptr to input format
44 pushl FBUF(r7) #stream
45 calls $3,_fscanf
46 cmpl $1,r0
47 bneq efread
48 bisw2 $SYNC,FUNIT(r7)
49 jmp (r8)
50efread:
51 movw $EBADFNUM,_perrno
52 jbr error
53_READLN:
54 incl r10
55 calls $0,_iosync
56 bbs $fEOLN,FUNIT(r7),l3005 #check for already at end of line
57 pushal rdln
58 pushl FBUF(r7)
59 calls $2,_fscanf
60l3005:
61 bisw2 $SYNC,FUNIT(r7)
62 jmp (r8)
63_READC:
64 incl r10
65 calls $0,_iosync
66 cvtbw (r7),-(sp)
67 bisw2 $SYNC,FUNIT(r7)
68 jmp (r8)
69
70rd4: .byte '%,'l,'d, 0
71rd8: .byte '%,'l,'f, 0
72rdln: .byte '%,'*,'[,'^,linefeed,'],'%,'*,'c, 0