summaryrefslogtreecommitdiff
path: root/app/baisy/2.2.1-schulis/src/block i-o
blob: 6ac925d0f077273c8d54576fa21cdd97a219a4fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
PACKET diskblockioDEFINES readdiskblock,readdiskblockandcloseworkiferror,
readdiskcluster,writediskblock,writediskblockandcloseworkiferror,
writediskcluster,firstnondummydspage,blocknodumpmodus:BOOL VAR 
blocknodumpflag:=FALSE ;LET writenormal=0;INT CONST firstnondummydspage:=2;
INT VAR error;PROC readdiskblock(DATASPACE VAR ds,INT CONST dspageno,INT 
CONST blockno):IF blocknodumpflagTHEN dump("READ ",blockno)FI ;checkrerun;
readblock(ds,dspageno,eublock(blockno),error);IF error>0THEN lesefehler(error
)FI .END PROC readdiskblock;PROC readdiskblock(DATASPACE VAR ds,INT CONST 
dspageno,REAL CONST blockno):IF blocknodumpflagTHEN dump("READ ",blockno)FI ;
checkrerun;readblock(ds,dspageno,eublock(blockno),error);IF error>0THEN 
lesefehler(error)FI .END PROC readdiskblock;PROC 
readdiskblockandcloseworkiferror(DATASPACE VAR ds,INT CONST dspageno,INT 
CONST blockno):IF blocknodumpflagTHEN dump("READ ",blockno)FI ;checkrerun;
readblock(ds,dspageno,eublock(blockno),error);IF error>0THEN closework;
lesefehler(error)FI .END PROC readdiskblockandcloseworkiferror;PROC 
readdiskblockandcloseworkiferror(DATASPACE VAR ds,INT CONST dspageno,REAL 
CONST blockno):IF blocknodumpflagTHEN dump("READ ",blockno)FI ;checkrerun;
readblock(ds,dspageno,eublock(blockno),error);IF error>0THEN closework;
lesefehler(error)FI .END PROC readdiskblockandcloseworkiferror;PROC 
readdiskcluster(DATASPACE VAR ds,INT CONST firstdspageno,REAL CONST clusterno
):IF blocknodumpflagTHEN dump("CLUSTER ",clusterno)FI ;INT VAR i;FOR iFROM 0
UPTO sectorspercluster-1REP readdiskblock(ds,firstdspageno+i,blockno+real(i))
PER .blockno:beginofcluster(clusterno).END PROC readdiskcluster;PROC 
lesefehler(INT CONST fehlercode):errorstop(fehlertext).fehlertext:SELECT 
fehlercodeOF CASE 1:"Diskettenlaufwerk nicht betriebsbereit"CASE 2:
"Lesefehler"OTHERWISE "Lesefehler "+text(fehlercode)END SELECT .END PROC 
lesefehler;PROC writediskblock(DATASPACE CONST ds,INT CONST dspageno,INT 
CONST blockno):IF blocknodumpflagTHEN dump("WRITE",blockno)FI ;checkrerun;
writeblock(ds,dspageno,writenormal,eublock(blockno),error);IF error>0THEN 
schreibfehler(error)FI .END PROC writediskblock;PROC writediskblock(
DATASPACE CONST ds,INT CONST dspageno,REAL CONST blockno):IF blocknodumpflag
THEN dump("WRITE",blockno)FI ;checkrerun;writeblock(ds,dspageno,writenormal,
eublock(blockno),error);IF error>0THEN schreibfehler(error)FI .END PROC 
writediskblock;PROC writediskblockandcloseworkiferror(DATASPACE CONST ds,INT 
CONST dspageno,INT CONST blockno):IF blocknodumpflagTHEN dump("WRITE",blockno
)FI ;checkrerun;writeblock(ds,dspageno,writenormal,eublock(blockno),error);
IF error>0THEN closework;schreibfehler(error)FI .END PROC 
writediskblockandcloseworkiferror;PROC writediskblockandcloseworkiferror(
DATASPACE CONST ds,INT CONST dspageno,REAL CONST blockno):IF blocknodumpflag
THEN dump("WRITE",blockno)FI ;checkrerun;writeblock(ds,dspageno,writenormal,
eublock(blockno),error);IF error>0THEN closework;schreibfehler(error)FI .END 
PROC writediskblockandcloseworkiferror;PROC writediskcluster(DATASPACE CONST 
ds,INT CONST firstdspageno,REAL CONST clusterno):IF blocknodumpflagTHEN dump(
"CLUSTER ",clusterno)FI ;INT VAR i;FOR iFROM 0UPTO sectorspercluster-1REP 
writediskblock(ds,firstdspageno+i,blockno+real(i))PER .blockno:beginofcluster
(clusterno).END PROC writediskcluster;PROC schreibfehler(INT CONST fehlercode
):errorstop(fehlertext).fehlertext:SELECT fehlercodeOF CASE 1:
"Diskettenlaufwerk nicht betriebsbereit"CASE 2:"Schreibfehler"OTHERWISE 
"Schreibfehler "+text(fehlercode)END SELECT .END PROC schreibfehler;PROC 
blocknodumpmodus(BOOL CONST status):blocknodumpflag:=statusEND PROC 
blocknodumpmodus;END PACKET diskblockio;