[Reduction] #512: xfclose

This commit is contained in:
nmlgc 2014-09-27 22:51:10 +02:00
parent 86b99b9265
commit 8cc3df1eb1
4 changed files with 51 additions and 144 deletions

42
libs/BorlandC/xfclose.asm Normal file
View File

@ -0,0 +1,42 @@
__xfclose proc DIST
@@i = word ptr -(dPtrSize + 2)
@@fp = DPTR_ -(dPtrSize)
push bp
mov bp, sp
sub sp, dPtrSize + 2
push si
push di
mov [bp+@@i], 0
if LDATA
mov word ptr [bp+@@fp+2], ds
endif
mov word ptr [bp+@@fp], offset _streams
jmp short @@check
@@loop:
LES_ bx, [bp+@@fp]
test byte ptr ES_[bx+FILE.flags], 3
jz short @@next
push word ptr [bp+@@fp+2]
push bx
nopcall _fclose
if LDATA
pop cx
endif
pop cx
@@next:
add word ptr [bp+@@fp], size FILE
inc [bp+@@i]
@@check:
mov ax, [bp+@@i]
cmp ax, __nfile
jb short @@loop
pop di
pop si
mov sp, bp
pop bp
ret
__xfclose endp

View File

@ -4753,8 +4753,8 @@ loc_3F1E:
or [bp+var_4], 40h or [bp+var_4], 40h
loc_3F22: loc_3F22:
mov word ptr _exitfopen+2, seg seg000 mov word ptr _exitfopen+2, seg __xfclose
mov word ptr _exitfopen, 5787h mov word ptr _exitfopen, offset __xfclose
les bx, [bp+arg_4] les bx, [bp+arg_4]
mov es:[bx], dx mov es:[bx], dx
les bx, [bp+arg_0] les bx, [bp+arg_0]
@ -5975,52 +5975,7 @@ j____write proc far
jmp near ptr ___write jmp near ptr ___write
j____write endp j____write endp
include libs/BorlandC/xfclose.asm
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
__xfclose proc far
var_6 = word ptr -6
stream = dword ptr -4
push bp
mov bp, sp
sub sp, 6
push si
push di
mov [bp+var_6], 0
mov word ptr [bp+stream+2], ds
mov word ptr [bp+stream], 0CAAh
jmp short loc_57BA
; ---------------------------------------------------------------------------
loc_579E:
les bx, [bp+stream]
test byte ptr es:[bx+2], 3
jz short loc_57B3
push word ptr [bp+stream+2]
push bx ; stream
nopcall _fclose
pop cx
pop cx
loc_57B3:
add word ptr [bp+stream], 14h
inc [bp+var_6]
loc_57BA:
mov ax, [bp+var_6]
cmp ax, __nfile
jb short loc_579E
pop di
pop si
mov sp, bp
pop bp
retf
__xfclose endp
include libs/BorlandC/xfflush.asm include libs/BorlandC/xfflush.asm
include libs/BorlandC/xalloc.asm include libs/BorlandC/xalloc.asm
include libs/BorlandC/xmsg.asm include libs/BorlandC/xmsg.asm

View File

@ -4532,8 +4532,8 @@ loc_3FF6:
or [bp+var_4], 40h or [bp+var_4], 40h
loc_3FFA: loc_3FFA:
mov word ptr _exitfopen+2, seg seg000 mov word ptr _exitfopen+2, seg __xfclose
mov word ptr _exitfopen, 5A02h mov word ptr _exitfopen, offset __xfclose
les bx, [bp+arg_4] les bx, [bp+arg_4]
mov es:[bx], dx mov es:[bx], dx
les bx, [bp+arg_0] les bx, [bp+arg_0]
@ -5635,52 +5635,7 @@ include libs/BorlandC/_strlen.asm
include libs/BorlandC/strrchr.asm include libs/BorlandC/strrchr.asm
include libs/BorlandC/write.asm include libs/BorlandC/write.asm
include libs/BorlandC/writea.asm include libs/BorlandC/writea.asm
include libs/BorlandC/xfclose.asm
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
__xfclose proc far
var_6 = word ptr -6
stream = dword ptr -4
push bp
mov bp, sp
sub sp, 6
push si
push di
mov [bp+var_6], 0
mov word ptr [bp+stream+2], ds
mov word ptr [bp+stream], 9FAh
jmp short loc_5A35
; ---------------------------------------------------------------------------
loc_5A19:
les bx, [bp+stream]
test byte ptr es:[bx+2], 3
jz short loc_5A2E
push word ptr [bp+stream+2]
push bx ; stream
nopcall _fclose
pop cx
pop cx
loc_5A2E:
add word ptr [bp+stream], 14h
inc [bp+var_6]
loc_5A35:
mov ax, [bp+var_6]
cmp ax, __nfile
jb short loc_5A19
pop di
pop si
mov sp, bp
pop bp
retf
__xfclose endp
include libs/BorlandC/xfflush.asm include libs/BorlandC/xfflush.asm
include libs/BorlandC/xalloc.asm include libs/BorlandC/xalloc.asm
include libs/BorlandC/xmsg.asm include libs/BorlandC/xmsg.asm

View File

@ -7813,8 +7813,8 @@ loc_5576:
or [bp+var_4], 40h or [bp+var_4], 40h
loc_557A: loc_557A:
mov word ptr _exitfopen+2, seg seg000 mov word ptr _exitfopen+2, seg __xfclose
mov word ptr _exitfopen, 6E75h mov word ptr _exitfopen, offset __xfclose
les bx, [bp+arg_4] les bx, [bp+arg_4]
mov es:[bx], dx mov es:[bx], dx
les bx, [bp+arg_0] les bx, [bp+arg_0]
@ -9119,52 +9119,7 @@ j____write proc far
jmp near ptr ___write jmp near ptr ___write
j____write endp j____write endp
include libs/BorlandC/xfclose.asm
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
__xfclose proc far
var_6 = word ptr -6
stream = dword ptr -4
push bp
mov bp, sp
sub sp, 6
push si
push di
mov [bp+var_6], 0
mov word ptr [bp+stream+2], ds
mov word ptr [bp+stream], 1A56h
jmp short loc_6EA8
; ---------------------------------------------------------------------------
loc_6E8C:
les bx, [bp+stream]
test byte ptr es:[bx+2], 3
jz short loc_6EA1
push word ptr [bp+stream+2]
push bx ; stream
nopcall _fclose
pop cx
pop cx
loc_6EA1:
add word ptr [bp+stream], 14h
inc [bp+var_6]
loc_6EA8:
mov ax, [bp+var_6]
cmp ax, __nfile
jb short loc_6E8C
pop di
pop si
mov sp, bp
pop bp
retf
__xfclose endp
include libs/BorlandC/xfflush.asm include libs/BorlandC/xfflush.asm
include libs/BorlandC/xalloc.asm include libs/BorlandC/xalloc.asm
include libs/BorlandC/xmsg.asm include libs/BorlandC/xmsg.asm