home *** CD-ROM | disk | FTP | other *** search
-
- ;* Maxon C++ Projekt:
- ;* Library-Modul "stdinput"
- ;* Jens Gelhar 15.11.91, 31.08.93
-
- xdef _getc,getc__P06stream,_fgetc,fgetc__P06stream
- xdef _getchar,getchar_
- xdef __Readfile,__Readfile__NoBuf
-
- xref __Readflag,_DOSBase,_std__in
-
- Read = -42
-
- str_ungetch = 4
- str_ungetbuf = 5
- str_mode = 6
- str_error = 7
- str_bufptr = 8
- str_flags = 12
-
- buf_read = 12
-
- _getchar:
- getchar_: ; keine Parameter
- pea _std__in
- bsr.b _getc
- addq.l #4,a7
- rts
-
- _getc:
- getc__P06stream:
- _fgetc:
- fgetc__P06stream: ; Stack-Parameter: stream*
- movem.l d1-d3/a0-a1/a6,-(a7)
- move.l 6*4+4(a7),a0
- clr.l -(a7)
- move.l a7,d2
- moveq #1,d3
- bsr.b __Readfile
- cmp.l #1,d0
- beq.b fgok
- moveq #-1,d0 ; "EOF"
- bra.b fgret
- fgok move.b (a7),d0
- fgret addq.l #4,a7
- movem.l (a7)+,d1-d3/a0-a1/a6
- rts
-
- __Readfile: ; Stream a0, d3 Bytes nach d2, Anzahl der Daten nach d0
- tst.b str_ungetch(a0)
- beq.b rf0
- subq.l #1,d3
- blo.b rfret
- exg d2,a1
- move.b str_ungetbuf(a0),(a1)+
- exg d2,a1
- clr.b str_ungetch(a0)
- bsr.b rf0
- addq.l #1,d0
- rfret rts
- rf0 move.l str_bufptr(a0),d0
- beq.b __Readfile__NoBuf
- move.l d0,a0
- move.l buf_read(a0),a6
- jmp (a6)
- __Readfile__NoBuf:
- move.l #__Readflag,d0
- beq.b rfFile
- btst #6,str_flags(a0)
- bne.b rfFile
- cmp.l #_std__in,a0
- bne.b rfFile
- move.l d3,-(a7)
- move.l d0,a0
- jsr (a0)
- move.l (a7)+,d0
- rts
- rfFile ; gewöhnliche Datei ohne Buffer:
- btst #0,str_mode(a0)
- beq.b rfMurx
- move.l (a0),d1
- beq.b rfMurx
- move.l _DOSBase,a6
- move.l d3,-(a7)
- move.l a0,-(a7)
- jsr Read(a6)
- move.l (a7)+,a0
- cmp.l (a7)+,d0
- beq.b rf2
- ; Dateiende oder Fehler:
- rf1 move.b #-1,str_error(a0)
- rf2 rts
- rfMurx moveq #-1,d0
- bra.b rf1
-
- end
-
-