check that files can be created

This commit is contained in:
ceriel 1988-05-04 16:49:58 +00:00
parent f63363cfb8
commit 7f7078c9f0

View file

@ -170,27 +170,40 @@ profsiz: .space 4
.sect .text
tst.l firstp
beq lhalt
pea emprof
bsr _Xunlink
testen (sp)+
blt 1f
mov #0x1B6,-(sp)
pea emprof
bsr _Xcreat
testen (sp)+
blt 1f
mov (sp)+,d0
move.l ltime,a4 !a4 points at bottem of prof table
bsr tabprint
1:
#endif
#if flow
tst.l firstp
beq lhalt
pea emflow
bsr _Xunlink
testen (sp)+
blt 1f
mov #0x1B6,-(sp)
pea emflow
bsr _Xcreat
testen (sp)+
blt 1f
mov (sp)+,d0
move.l flowsiz,-(sp)
move.l lflow,-(sp)
mov d0,-(sp)
bsr _Xwrite
add.l wrd+4,sp
testen (sp)+
blt 1f
add.l #4,sp
.sect .data
emflow: .asciz "em_flow\0"
.align 2
@ -198,17 +211,24 @@ emflow: .asciz "em_flow\0"
lflow: .space 4
flowsiz: .space 4
.sect .text
1:
#endif
#if count
tst.l firstp
beq lhalt
pea emcount
bsr _Xunlink
testen (sp)+
blt 1f
mov #0x1B6,-(sp)
pea emcount
bsr _Xcreat
testen (sp)+
blt 1f
mov (sp)+,d0
move.l lcount,a4
bsr tabprint
1:
.sect .data
emcount: .asciz "em_count\0"
.align 2
@ -223,16 +243,24 @@ emopf: .asciz "em_opfreq\0"
.sect .bss
counttab: .space 1884
.sect .text
pea emopf
bsr _Xunlink
testen (sp)+
blt 1f
mov #0x1B6,-(sp)
pea emopf
bsr _Xcreat
testen (sp)+
blt 1f
mov (sp)+,d0
move.l #1884,-(sp)
pea counttab
mov d0,-(sp)
bsr _Xwrite
add.l wrd+4,sp
testen (sp)+
blt 1f
add.l #4,sp
1:
#endif
#if count+flow+prof
.sect .bss
@ -242,10 +270,15 @@ countptr: .space 4 !COUNT NUMBER OF CURRENT LINE
lhalt:
#if last
.sect .text
pea emlast
bsr _Xunlink
testen (sp)+
blt halt
mov #0x1B6,-(sp)
pea emlast
bsr _Xcreat
testen (sp)+
blt halt
mov (sp)+,d6 !d6 contains file descriptor
cmp.l #-1,linused-4 !test if buffer is fully used
beq 0f
@ -258,14 +291,18 @@ lhalt:
pea mess1
mov d6,-(sp)
bsr _Xwrite
add.l wrd+4,sp
testen (sp)+
blt halt
add.l #4,sp
bra 9f
2: move.l a1,-(sp)
move.l #7,-(sp) !announce new file name
pea mess2
mov d6,-(sp)
bsr _Xwrite
add.l wrd+4,sp
testen (sp)+
blt halt
add.l #4,sp
move.l (sp)+,a1
move.l (a1),d7
move.l d7,a0 !keep file pointer in d7
@ -289,7 +326,9 @@ lhalt:
pea mess3
mov d6,-(sp)
bsr _Xwrite
add.l wrd+4,sp
testen (sp)+
blt halt
add.l #4,sp
move.l (sp)+,a1
bsr nexttab
tst.l (a1) !in case 0 no more lines
@ -397,7 +436,9 @@ tabprint: mov d0,-(sp) !KEEP FILE DESCRIPTOR FOR WRITING
move.l a2,-(sp)
mov 8(sp),-(sp) !WRITE FILE NAME.
bsr _Xwrite
add.l wrd+4,sp !CLEAN STACK.
testen (sp)+
blt 3f
add.l #4,sp !CLEAN STACK.
6: sub.l d6,d7 !IN d7 NUMBER OF LINES OF CURRENT PROC.
asl.l #2,d6
0: move.l a3,a0
@ -410,7 +451,9 @@ tabprint: mov d0,-(sp) !KEEP FILE DESCRIPTOR FOR WRITING
pea buffer
mov 8(sp),-(sp)
bsr _Xwrite !PRINT LINE NUMBER AND INTEGER .
add.l wrd+4,sp !CLEAN STACK.
testen (sp)+
blt 3f
add.l #4,sp !CLEAN STACK.
add.l #1,d5 !NEXT LINE NUMBER .
add.l #4,d6 !NEXT COUNT.
sub.l #1,d7 !ONE LINE LESS TO GO.
@ -423,6 +466,10 @@ tabprint: mov d0,-(sp) !KEEP FILE DESCRIPTOR FOR WRITING
9: move.l maxcount,d7
move.l #0,a6 !NO NEXT PROCEDURE.
bra 8b
3:
testen (sp)+
testen (sp)+
rts
.sect .data
buffer: .asciz " \n"