cache1d: Allow loading GRP files from within other GRP files.

git-svn-id: https://svn.eduke32.com/eduke32@5059 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-03-23 06:27:35 +00:00
parent 496f4582d6
commit 8a2b19dd50
2 changed files with 208 additions and 199 deletions

View file

@ -31,7 +31,6 @@ int32_t openfrompath(const char *fn, int32_t flags, int32_t mode);
BFILE *fopenfrompath(const char *fn, const char *mode); BFILE *fopenfrompath(const char *fn, const char *mode);
int32_t initgroupfile(const char *filename); int32_t initgroupfile(const char *filename);
void uninitsinglegroupfile(int32_t grphandle);
void uninitgroupfile(void); void uninitgroupfile(void);
int32_t kopen4load(const char *filename, char searchfirst); // searchfirst: 0 = anywhere, 1 = first group, 2 = any group int32_t kopen4load(const char *filename, char searchfirst); // searchfirst: 0 = anywhere, 1 = first group, 2 = any group
int32_t kread(int32_t handle, void *buffer, int32_t leng); int32_t kread(int32_t handle, void *buffer, int32_t leng);

View file

@ -598,25 +598,21 @@ int32_t findfrompath(const char *fn, char **where)
# define FILENAME_CASE_CHECK # define FILENAME_CASE_CHECK
#endif #endif
#ifdef FILENAME_CASE_CHECK static int32_t openfrompath_internal(const char *fn, char **where, int32_t flags, int32_t mode)
// don't free pfn if !=0 AND we Bopen()'ed the file successfully {
static int32_t dont_free_pfn; if (findfrompath(fn, where) < 0)
static char *lastpfn; return -1;
#endif
return Bopen(*where, flags, mode);
}
int32_t openfrompath(const char *fn, int32_t flags, int32_t mode) int32_t openfrompath(const char *fn, int32_t flags, int32_t mode)
{ {
char *pfn; char *pfn = NULL;
int32_t h;
if (findfrompath(fn, &pfn) < 0) return -1; int32_t h = openfrompath_internal(fn, &pfn, flags, mode);
h = Bopen(pfn, flags, mode); if (pfn)
#ifdef FILENAME_CASE_CHECK
if (h>=0 && dont_free_pfn)
lastpfn = pfn;
else
#endif
Bfree(pfn); Bfree(pfn);
return h; return h;
@ -664,8 +660,9 @@ EDUKE32_STATIC_ASSERT(MAXGROUPFILES <= GRP_RESERVED_ID_START);
int32_t numgroupfiles = 0; int32_t numgroupfiles = 0;
static int32_t gnumfiles[MAXGROUPFILES]; static int32_t gnumfiles[MAXGROUPFILES];
static int32_t groupfil[MAXGROUPFILES] = {-1,-1,-1,-1,-1,-1,-1,-1}; static intptr_t groupfil[MAXGROUPFILES] = {-1,-1,-1,-1,-1,-1,-1,-1};
static int32_t groupfilpos[MAXGROUPFILES]; static int32_t groupfilpos[MAXGROUPFILES];
static uint8_t groupfilgrp[MAXGROUPFILES];
static char *gfilelist[MAXGROUPFILES]; static char *gfilelist[MAXGROUPFILES];
static int32_t *gfileoffs[MAXGROUPFILES]; static int32_t *gfileoffs[MAXGROUPFILES];
@ -689,60 +686,66 @@ int32_t cache1d_file_fromzip(int32_t fil)
} }
#endif #endif
static int32_t kopen_internal(const char *filename, char **lastpfn, char searchfirst, char checkcase, char tryzip, int32_t newhandle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos);
static int32_t kread_grp(int32_t handle, void *buffer, int32_t leng);
static int32_t klseek_grp(int32_t handle, int32_t offset, int32_t whence);
static void kclose_grp(int32_t handle);
int32_t initgroupfile(const char *filename) int32_t initgroupfile(const char *filename)
{ {
char buf[16]; char buf[16];
int32_t i, j, k;
#ifdef WITHKPLIB
char *zfn;
#endif
// translate all backslashes (0x5c) to forward slashes (0x2f) // translate all backslashes (0x5c) to forward slashes (0x2f)
toupperlookup[0x5c] = 0x2f; toupperlookup[0x5c] = 0x2f;
if (filename == NULL)
return -1;
// Technically you should be able to load more zips even if your GRPs are maxed out,
// but this system is already enough of a disaster.
if (numgroupfiles >= MAXGROUPFILES)
return -1;
char *zfn = NULL;
if (kopen_internal(filename, &zfn, 0, 0, 0, numgroupfiles, groupfilgrp, groupfil, groupfilpos) < 0)
return -1;
#ifdef WITHKPLIB #ifdef WITHKPLIB
if (findfrompath(filename, &zfn) < 0) return -1; // check if ZIP
if (zfn)
// check to see if the file passed is a ZIP and pass it on to kplib if it is
i = Bopen(zfn,BO_BINARY|BO_RDONLY,BS_IREAD);
if (i < 0) { Bfree(zfn); return -1; }
Bread(i, buf, 4);
if (buf[0] == 0x50 && buf[1] == 0x4B && buf[2] == 0x03 && buf[3] == 0x04)
{ {
Bclose(i); kread_grp(numgroupfiles, buf, 4);
j = kzaddstack(zfn); if (buf[0] == 0x50 && buf[1] == 0x4B && buf[2] == 0x03 && buf[3] == 0x04)
Bfree(zfn);
return j;
}
Bfree(zfn);
if (numgroupfiles >= MAXGROUPFILES) return(-1);
Blseek(i,0,BSEEK_SET);
groupfil[numgroupfiles] = i;
#else
groupfil[numgroupfiles] = openfrompath(filename,BO_BINARY|BO_RDONLY,BS_IREAD);
if (groupfil[numgroupfiles] != -1)
#endif
{
groupfilpos[numgroupfiles] = 0;
Bread(groupfil[numgroupfiles],buf,16);
if (Bmemcmp(buf, "KenSilverman", 12))
{ {
Bclose(groupfil[numgroupfiles]); kclose_grp(numgroupfiles);
groupfil[numgroupfiles] = -1;
return(-1); kzaddstack(zfn);
Bfree(zfn);
return 0;
} }
klseek_grp(numgroupfiles,0,BSEEK_SET);
Bfree(zfn);
}
#else
if (zfn)
Bfree(zfn);
#endif
// check if GRP
kread_grp(numgroupfiles,buf,16);
if (!Bmemcmp(buf, "KenSilverman", 12))
{
gnumfiles[numgroupfiles] = B_LITTLE32(*((int32_t *)&buf[12])); gnumfiles[numgroupfiles] = B_LITTLE32(*((int32_t *)&buf[12]));
gfilelist[numgroupfiles] = (char *)Xmalloc(gnumfiles[numgroupfiles]<<4); gfilelist[numgroupfiles] = (char *)Xmalloc(gnumfiles[numgroupfiles]<<4);
gfileoffs[numgroupfiles] = (int32_t *)Xmalloc((gnumfiles[numgroupfiles]+1)<<2); gfileoffs[numgroupfiles] = (int32_t *)Xmalloc((gnumfiles[numgroupfiles]+1)<<2);
Bread(groupfil[numgroupfiles],gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4); kread_grp(numgroupfiles,gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4);
j = 0; int32_t j = (gnumfiles[numgroupfiles]+1)<<4, k;
for (i=0; i<gnumfiles[numgroupfiles]; i++) for (int32_t i=0; i<gnumfiles[numgroupfiles]; i++)
{ {
k = B_LITTLE32(*((int32_t *)&gfilelist[numgroupfiles][(i<<4)+12])); k = B_LITTLE32(*((int32_t *)&gfilelist[numgroupfiles][(i<<4)+12]));
gfilelist[numgroupfiles][(i<<4)+12] = 0; gfilelist[numgroupfiles][(i<<4)+12] = 0;
@ -750,53 +753,12 @@ int32_t initgroupfile(const char *filename)
j += k; j += k;
} }
gfileoffs[numgroupfiles][gnumfiles[numgroupfiles]] = j; gfileoffs[numgroupfiles][gnumfiles[numgroupfiles]] = j;
numgroupfiles++;
return 0;
} }
numgroupfiles++;
return(groupfil[numgroupfiles-1]);
}
void uninitsinglegroupfile(int32_t grphandle) kclose_grp(numgroupfiles);
{ return -1;
int32_t i, grpnum = -1;
for (i=numgroupfiles-1; i>=0; i--)
if (groupfil[i] != -1 && groupfil[i] == grphandle)
{
Bfree(gfilelist[i]);
Bfree(gfileoffs[i]);
Bclose(groupfil[i]);
groupfil[i] = -1;
grpnum = i;
break;
}
if (grpnum == -1) return;
// JBF 20040111
numgroupfiles--;
// move any group files following this one back
for (i=grpnum+1; i<MAXGROUPFILES; i++)
if (groupfil[i] != -1)
{
groupfil[i-1] = groupfil[i];
gnumfiles[i-1] = gnumfiles[i];
groupfilpos[i-1] = groupfilpos[i];
gfilelist[i-1] = gfilelist[i];
gfileoffs[i-1] = gfileoffs[i];
groupfil[i] = -1;
}
// fix up the open files that need attention
for (i=0; i<MAXOPENFILES; i++)
{
if (filegrp[i] >= GRP_RESERVED_ID_START) // external file or ZIPped file
continue;
else if (filegrp[i] == grpnum) // close file in group we closed
filehan[i] = -1;
else if (filegrp[i] > grpnum) // move back a file in a group after the one we closed
filegrp[i]--;
}
} }
void uninitgroupfile(void) void uninitgroupfile(void)
@ -869,56 +831,33 @@ static int32_t check_filename_mismatch(const char *filename, int32_t ofs)
} }
#endif #endif
int32_t kopen4load(const char *filename, char searchfirst) static int32_t kopen_internal(const char *filename, char **lastpfn, char searchfirst, char checkcase, char tryzip, int32_t newhandle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
{ {
int32_t j, k, fil, newhandle = MAXOPENFILES-1; int32_t j, k, fil;
char bad, *gfileptr; char bad, *gfileptr;
intptr_t i; intptr_t i;
#ifdef FILENAME_CASE_CHECK if (searchfirst == 0 && (fil = openfrompath_internal(filename, lastpfn, BO_BINARY|BO_RDONLY, BS_IREAD)) >= 0)
const int32_t do_case_check = check_filename_casing_fn && check_filename_casing_fn();
#endif
if (filename==NULL)
return -1;
while (filehan[newhandle] != -1)
{
newhandle--;
if (newhandle < 0)
{
Bprintf("TOO MANY FILES OPEN IN FILE GROUPING SYSTEM!");
Bexit(0);
}
}
#ifdef FILENAME_CASE_CHECK
dont_free_pfn = do_case_check;
#endif
if (searchfirst == 0 && (fil = openfrompath(filename,BO_BINARY|BO_RDONLY,BS_IREAD)) >= 0)
{ {
#ifdef FILENAME_CASE_CHECK #ifdef FILENAME_CASE_CHECK
if (check_filename_casing_fn && check_filename_casing_fn()) if (checkcase && check_filename_casing_fn && check_filename_casing_fn())
{ {
int32_t status; int32_t status;
char *cp, *lastslash; char *cp, *lastslash;
// convert all slashes to backslashes because SHGetFileInfo() // convert all slashes to backslashes because SHGetFileInfo()
// complains else! // complains else!
lastslash = lastpfn; lastslash = *lastpfn;
for (cp=lastpfn; *cp; cp++) for (cp=*lastpfn; *cp; cp++)
if (*cp=='/') if (*cp=='/')
{ {
*cp = '\\'; *cp = '\\';
lastslash = cp; lastslash = cp;
} }
if (lastslash != lastpfn) if (lastslash != *lastpfn)
lastslash++; lastslash++;
status = check_filename_mismatch(lastpfn, lastslash-lastpfn); status = check_filename_mismatch(*lastpfn, lastslash-*lastpfn);
dont_free_pfn = 0;
if (status == -1) if (status == -1)
{ {
@ -929,38 +868,38 @@ int32_t kopen4load(const char *filename, char searchfirst)
initprintf("warning: case mismatch: passed \"%s\", real \"%s\"\n", initprintf("warning: case mismatch: passed \"%s\", real \"%s\"\n",
lastslash, shinf.szDisplayName); lastslash, shinf.szDisplayName);
} }
Bfree(lastpfn);
lastpfn=NULL;
} }
#else
UNREFERENCED_PARAMETER(checkcase);
#endif #endif
filegrp[newhandle] = GRP_FILESYSTEM; arraygrp[newhandle] = GRP_FILESYSTEM;
filehan[newhandle] = fil; arrayhan[newhandle] = fil;
filepos[newhandle] = 0; arraypos[newhandle] = 0;
return(newhandle); return newhandle;
} }
#ifdef FILENAME_CASE_CHECK
dont_free_pfn = 0;
#endif
for (; toupperlookup[*filename] == '/'; filename++); for (; toupperlookup[*filename] == '/'; filename++);
#ifdef WITHKPLIB #ifdef WITHKPLIB
if ((kzcurhand != newhandle) && (kztell() >= 0)) if (tryzip)
{ {
if (kzcurhand >= 0) filepos[kzcurhand] = kztell(); if ((kzcurhand != newhandle) && (kztell() >= 0))
kzclose(); {
} if (kzcurhand >= 0) arraypos[kzcurhand] = kztell();
if (searchfirst != 1 && (i = kzipopen(filename)) != 0) kzclose();
{ }
kzcurhand = newhandle; if (searchfirst != 1 && (i = kzipopen(filename)) != 0)
filegrp[newhandle] = GRP_ZIP; {
filehan[newhandle] = i; kzcurhand = newhandle;
filepos[newhandle] = 0; arraygrp[newhandle] = GRP_ZIP;
strcpy(filenamsav[newhandle],filename); arrayhan[newhandle] = i;
return newhandle; arraypos[newhandle] = 0;
strcpy(filenamsav[newhandle],filename);
return newhandle;
}
} }
#else
UNREFERENCED_PARAMETER(tryzip);
#endif #endif
for (k=numgroupfiles-1; k>=0; k--) for (k=numgroupfiles-1; k>=0; k--)
@ -986,21 +925,48 @@ int32_t kopen4load(const char *filename, char searchfirst)
if (j<13 && gfileptr[j]) continue; // JBF: because e1l1.map might exist before e1l1 if (j<13 && gfileptr[j]) continue; // JBF: because e1l1.map might exist before e1l1
if (j==13 && filename[j]) continue; // JBF: long file name if (j==13 && filename[j]) continue; // JBF: long file name
filegrp[newhandle] = k; arraygrp[newhandle] = k;
filehan[newhandle] = i; arrayhan[newhandle] = i;
filepos[newhandle] = 0; arraypos[newhandle] = 0;
return(newhandle); return newhandle;
} }
} }
} }
return(-1);
return -1;
} }
int32_t kread(int32_t handle, void *buffer, int32_t leng) int32_t kopen4load(const char *filename, char searchfirst)
{ {
int32_t i; int32_t newhandle = MAXOPENFILES-1;
int32_t filenum = filehan[handle];
int32_t groupnum = filegrp[handle]; if (filename==NULL)
return -1;
while (filehan[newhandle] != -1)
{
newhandle--;
if (newhandle < 0)
{
Bprintf("TOO MANY FILES OPEN IN FILE GROUPING SYSTEM!");
Bexit(0);
}
}
char *lastpfn = NULL;
int32_t h = kopen_internal(filename, &lastpfn, searchfirst, 1, 1, newhandle, filegrp, filehan, filepos);
if (lastpfn)
Bfree(lastpfn);
return h;
}
int32_t kread_internal(int32_t handle, void *buffer, int32_t leng, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
{
int32_t filenum = arrayhan[handle];
int32_t groupnum = arraygrp[handle];
if (groupnum == GRP_FILESYSTEM) return(Bread(filenum,buffer,leng)); if (groupnum == GRP_FILESYSTEM) return(Bread(filenum,buffer,leng));
#ifdef WITHKPLIB #ifdef WITHKPLIB
@ -1008,49 +974,59 @@ int32_t kread(int32_t handle, void *buffer, int32_t leng)
{ {
if (kzcurhand != handle) if (kzcurhand != handle)
{ {
if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); } if (kztell() >= 0) { arraypos[kzcurhand] = kztell(); kzclose(); }
kzcurhand = handle; kzcurhand = handle;
kzipopen(filenamsav[handle]); kzipopen(filenamsav[handle]);
kzseek(filepos[handle],SEEK_SET); kzseek(arraypos[handle],SEEK_SET);
} }
return(kzread(buffer,leng)); return(kzread(buffer,leng));
} }
#endif #endif
if (groupfil[groupnum] != -1) if (EDUKE32_PREDICT_FALSE(groupfil[groupnum] == -1))
return 0;
int32_t rootgroupnum = groupnum;
int32_t i = 0;
while (groupfilgrp[rootgroupnum] != GRP_FILESYSTEM)
{ {
i = gfileoffs[groupnum][filenum]+filepos[handle]; i += gfileoffs[groupfilgrp[rootgroupnum]][groupfil[rootgroupnum]];
if (i != groupfilpos[groupnum]) rootgroupnum = groupfilgrp[rootgroupnum];
}
if (EDUKE32_PREDICT_TRUE(groupfil[rootgroupnum] != -1))
{
i += gfileoffs[groupnum][filenum]+arraypos[handle];
if (i != groupfilpos[rootgroupnum])
{ {
Blseek(groupfil[groupnum],i+((gnumfiles[groupnum]+1)<<4),BSEEK_SET); Blseek(groupfil[rootgroupnum],i,BSEEK_SET);
groupfilpos[groupnum] = i; groupfilpos[rootgroupnum] = i;
} }
leng = min(leng,(gfileoffs[groupnum][filenum+1]-gfileoffs[groupnum][filenum])-filepos[handle]); leng = min(leng,(gfileoffs[groupnum][filenum+1]-gfileoffs[groupnum][filenum])-arraypos[handle]);
leng = Bread(groupfil[groupnum],buffer,leng); leng = Bread(groupfil[rootgroupnum],buffer,leng);
filepos[handle] += leng; arraypos[handle] += leng;
groupfilpos[groupnum] += leng; groupfilpos[rootgroupnum] += leng;
return(leng); return(leng);
} }
return(0); return(0);
} }
int32_t klseek(int32_t handle, int32_t offset, int32_t whence) int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
{ {
int32_t i, groupnum; int32_t i, groupnum;
groupnum = filegrp[handle]; groupnum = arraygrp[handle];
if (groupnum == GRP_FILESYSTEM) return(Blseek(filehan[handle],offset,whence)); if (groupnum == GRP_FILESYSTEM) return(Blseek(arrayhan[handle],offset,whence));
#ifdef WITHKPLIB #ifdef WITHKPLIB
else if (groupnum == GRP_ZIP) else if (groupnum == GRP_ZIP)
{ {
if (kzcurhand != handle) if (kzcurhand != handle)
{ {
if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); } if (kztell() >= 0) { arraypos[kzcurhand] = kztell(); kzclose(); }
kzcurhand = handle; kzcurhand = handle;
kzipopen(filenamsav[handle]); kzipopen(filenamsav[handle]);
kzseek(filepos[handle],SEEK_SET); kzseek(arraypos[handle],SEEK_SET);
} }
return(kzseek(offset,whence)); return(kzseek(offset,whence));
} }
@ -1061,81 +1037,115 @@ int32_t klseek(int32_t handle, int32_t offset, int32_t whence)
switch (whence) switch (whence)
{ {
case BSEEK_SET: case BSEEK_SET:
filepos[handle] = offset; break; arraypos[handle] = offset; break;
case BSEEK_END: case BSEEK_END:
i = filehan[handle]; i = arrayhan[handle];
filepos[handle] = (gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i])+offset; arraypos[handle] = (gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i])+offset;
break; break;
case BSEEK_CUR: case BSEEK_CUR:
filepos[handle] += offset; break; arraypos[handle] += offset; break;
} }
return(filepos[handle]); return(arraypos[handle]);
} }
return(-1); return(-1);
} }
int32_t kfilelength(int32_t handle) int32_t kfilelength_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
{ {
int32_t i, groupnum; int32_t i, groupnum;
groupnum = filegrp[handle]; groupnum = arraygrp[handle];
if (groupnum == GRP_FILESYSTEM) if (groupnum == GRP_FILESYSTEM)
{ {
// return(filelength(filehan[handle])) // return(filelength(arrayhan[handle]))
return Bfilelength(filehan[handle]); return Bfilelength(arrayhan[handle]);
} }
#ifdef WITHKPLIB #ifdef WITHKPLIB
else if (groupnum == GRP_ZIP) else if (groupnum == GRP_ZIP)
{ {
if (kzcurhand != handle) if (kzcurhand != handle)
{ {
if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); } if (kztell() >= 0) { arraypos[kzcurhand] = kztell(); kzclose(); }
kzcurhand = handle; kzcurhand = handle;
kzipopen(filenamsav[handle]); kzipopen(filenamsav[handle]);
kzseek(filepos[handle],SEEK_SET); kzseek(arraypos[handle],SEEK_SET);
} }
return kzfilelength(); return kzfilelength();
} }
#endif #endif
i = filehan[handle]; i = arrayhan[handle];
return(gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i]); return(gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i]);
} }
int32_t ktell(int32_t handle) int32_t ktell_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
{ {
int32_t groupnum = filegrp[handle]; int32_t groupnum = arraygrp[handle];
if (groupnum == GRP_FILESYSTEM) return(Blseek(filehan[handle],0,BSEEK_CUR)); if (groupnum == GRP_FILESYSTEM) return(Blseek(arrayhan[handle],0,BSEEK_CUR));
#ifdef WITHKPLIB #ifdef WITHKPLIB
else if (groupnum == GRP_ZIP) else if (groupnum == GRP_ZIP)
{ {
if (kzcurhand != handle) if (kzcurhand != handle)
{ {
if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); } if (kztell() >= 0) { arraypos[kzcurhand] = kztell(); kzclose(); }
kzcurhand = handle; kzcurhand = handle;
kzipopen(filenamsav[handle]); kzipopen(filenamsav[handle]);
kzseek(filepos[handle],SEEK_SET); kzseek(arraypos[handle],SEEK_SET);
} }
return kztell(); return kztell();
} }
#endif #endif
if (groupfil[groupnum] != -1) if (groupfil[groupnum] != -1)
return filepos[handle]; return arraypos[handle];
return(-1); return(-1);
} }
void kclose(int32_t handle) void kclose_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan)
{ {
if (handle < 0) return; if (handle < 0) return;
if (filegrp[handle] == GRP_FILESYSTEM) Bclose(filehan[handle]); if (arraygrp[handle] == GRP_FILESYSTEM) Bclose(arrayhan[handle]);
#ifdef WITHKPLIB #ifdef WITHKPLIB
else if (filegrp[handle] == GRP_ZIP) else if (arraygrp[handle] == GRP_ZIP)
{ {
kzclose(); kzclose();
kzcurhand = -1; kzcurhand = -1;
} }
#endif #endif
filehan[handle] = -1; arrayhan[handle] = -1;
}
int32_t kread(int32_t handle, void *buffer, int32_t leng)
{
return kread_internal(handle, buffer, leng, filegrp, filehan, filepos);
}
int32_t klseek(int32_t handle, int32_t offset, int32_t whence)
{
return klseek_internal(handle, offset, whence, filegrp, filehan, filepos);
}
int32_t kfilelength(int32_t handle)
{
return kfilelength_internal(handle, filegrp, filehan, filepos);
}
int32_t ktell(int32_t handle)
{
return ktell_internal(handle, filegrp, filehan, filepos);
}
void kclose(int32_t handle)
{
return kclose_internal(handle, filegrp, filehan);
}
static int32_t kread_grp(int32_t handle, void *buffer, int32_t leng)
{
return kread_internal(handle, buffer, leng, groupfilgrp, groupfil, groupfilpos);
}
static int32_t klseek_grp(int32_t handle, int32_t offset, int32_t whence)
{
return klseek_internal(handle, offset, whence, groupfilgrp, groupfil, groupfilpos);
}
static void kclose_grp(int32_t handle)
{
return kclose_internal(handle, groupfilgrp, groupfil);
} }
static int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, int32_t source) static int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, int32_t source)