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