25 void rwHeadAccess(SECTNUM physical
, SECTNUM logical
, BOOL write
)
27 /* display the physical sector, the logical block, and if the access is read or write */
29 fprintf(stderr
, "phy %ld / log %ld : %c\n", physical
, logical
, write
? 'W' : 'R');
32 void progressBar(int perCentDone
)
34 fprintf(stderr
,"%d %% done\n",perCentDone
);
37 void Warning(char* msg
) {
38 fprintf(stderr
,"Warning <%s>\n",msg
);
41 void Error(char* msg
) {
42 fprintf(stderr
,"Error <%s>\n",msg
);
46 void Verbose(char* msg
) {
47 fprintf(stderr
,"Verbose <%s>\n",msg
);
50 void Changed(SECTNUM nSect
, int changedType
)
52 /* switch(changedType) {
54 fprintf(stderr,"Notification : sector %ld (FILE)\n",nSect);
57 fprintf(stderr,"Notification : sector %ld (DIR)\n",nSect);
60 fprintf(stderr,"Notification : sector %ld (ROOT)\n",nSect);
63 fprintf(stderr,"Notification : sector %ld (???)\n",nSect);
71 void adfEnvInitDefault()
76 /* internal checking */
79 { fprintf(stderr
,"Compilation error : sizeof(short)!=2\n"); exit(1); }
81 { fprintf(stderr
,"Compilation error : sizeof(short)!=2\n"); exit(1); }
82 if (sizeof(struct bEntryBlock
)!=512)
83 { fprintf(stderr
,"Internal error : sizeof(struct bEntryBlock)!=512\n"); exit(1); }
84 if (sizeof(struct bRootBlock
)!=512)
85 { fprintf(stderr
,"Internal error : sizeof(struct bRootBlock)!=512\n"); exit(1); }
86 if (sizeof(struct bDirBlock
)!=512)
87 { fprintf(stderr
,"Internal error : sizeof(struct bDirBlock)!=512\n"); exit(1); }
88 if (sizeof(struct bBootBlock
)!=1024)
89 { fprintf(stderr
,"Internal error : sizeof(struct bBootBlock)!=1024\n"); exit(1); }
90 if (sizeof(struct bFileHeaderBlock
)!=512)
91 { fprintf(stderr
,"Internal error : sizeof(struct bFileHeaderBlock)!=512\n"); exit(1); }
92 if (sizeof(struct bFileExtBlock
)!=512)
93 { fprintf(stderr
,"Internal error : sizeof(struct bFileExtBlock)!=512\n"); exit(1); }
94 if (sizeof(struct bOFSDataBlock
)!=512)
95 { fprintf(stderr
,"Internal error : sizeof(struct bOFSDataBlock)!=512\n"); exit(1); }
96 if (sizeof(struct bBitmapBlock
)!=512)
97 { fprintf(stderr
,"Internal error : sizeof(struct bBitmapBlock)!=512\n"); exit(1); }
98 if (sizeof(struct bBitmapExtBlock
)!=512)
99 { fprintf(stderr
,"Internal error : sizeof(struct bBitmapExtBlock)!=512\n"); exit(1); }
100 if (sizeof(struct bLinkBlock
)!=512)
101 { fprintf(stderr
,"Internal error : sizeof(struct bLinkBlock)!=512\n"); exit(1); }
104 /* if LITT_ENDIAN not defined : must be BIG endian */
106 if (val
.c
[3]!=1) /* little endian : LITT_ENDIAN must be defined ! */
107 { fprintf(stderr
,"Compilation error : #define LITT_ENDIAN must exist\n"); exit(1); }
109 if (val
.c
[3]==1) /* big endian : LITT_ENDIAN must not be defined ! */
110 { fprintf(stderr
,"Compilation error : #define LITT_ENDIAN must not exist\n"); exit(1); }
113 adfEnv
.wFct
= Warning
;
115 adfEnv
.vFct
= Verbose
;
116 adfEnv
.notifyFct
= Changed
;
117 adfEnv
.rwhAccess
= rwHeadAccess
;
118 adfEnv
.progressBar
= progressBar
;
120 adfEnv
.useDirCache
= FALSE
;
121 adfEnv
.useRWAccess
= FALSE
;
122 adfEnv
.useNotify
= FALSE
;
123 adfEnv
.useProgressBar
= FALSE
;
125 /* sprintf(str,"ADFlib %s (%s)",adfGetVersionNumber(),adfGetVersionDate());
128 adfEnv
.nativeFct
=(struct nativeFunctions
*)malloc(sizeof(struct nativeFunctions
));
129 if (!adfEnv
.nativeFct
) (*adfEnv
.wFct
)("adfInitDefaultEnv : malloc");
141 free(adfEnv
.nativeFct
);
149 void adfChgEnvProp(int prop
, void *new)
156 adfEnv
.vFct
= (void(*)(char*))new;
159 adfEnv
.wFct
= (void(*)(char*))new;
162 adfEnv
.eFct
= (void(*)(char*))new;
165 adfEnv
.notifyFct
= (void(*)(SECTNUM
,int))new;
168 newBool
= (BOOL
*)new;
169 adfEnv
.useNotify
= *newBool
;
172 adfEnv
.progressBar
= (void(*)(int))new;
175 newBool
= (BOOL
*)new;
176 adfEnv
.useProgressBar
= *newBool
;
178 case PR_USE_RWACCESS
:
179 newBool
= (BOOL
*)new;
180 adfEnv
.useRWAccess
= *newBool
;
183 adfEnv
.rwhAccess
= (void(*)(SECTNUM
,SECTNUM
,BOOL
))new;
186 newBool
= (BOOL
*)new;
187 adfEnv
.useDirCache
= *newBool
;
196 void adfSetEnvFct( void(*eFct
)(char*), void(*wFct
)(char*), void(*vFct
)(char*),
197 void(*notFct
)(SECTNUM
,int) )
206 adfEnv
.notifyFct
= *notFct
;
211 * adfGetVersionNumber
214 char* adfGetVersionNumber()
216 return(ADFLIB_VERSION
);
224 char* adfGetVersionDate()
232 /*##################################################################################*/