Subversion Repositories eduke32

Rev

Rev 4766 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4766 hendricks2 1
#ifdef __cplusplus
3116 hendricks2 2
extern "C" {
3
#endif
4
 
4747 terminx 5
#ifndef compat_h_
4658 terminx 6
#include "compat.h"
7
#endif
8
 
4634 terminx 9
typedef struct
10
{
11
    FILE *fil;    //0:no file open, !=0:open file (either stand-alone or zip)
12
    int32_t comptyp; //0:raw data (can be ZIP or stand-alone), 8:PKZIP LZ77 *flate
13
    int32_t seek0;   //0:stand-alone file, !=0: start of zip compressed stream data
14
    int32_t compleng;//Global variable for compression FIFO
15
    int32_t comptell;//Global variable for compression FIFO
16
    int32_t leng;    //Uncompressed file size (bytes)
17
    int32_t pos;     //Current uncompressed relative file position (0<=pos<=leng)
18
    int32_t endpos;  //Temp global variable for kzread
19
    int32_t jmpplc;  //Store place where decompression paused
20
    int32_t i;       //For stand-alone/ZIP comptyp#0, this is like "uncomptell"
21
    //For ZIP comptyp#8&btype==0 "<64K store", this saves i state
22
    int32_t bfinal;  //LZ77 decompression state (for later calls)
23
} kzfilestate;
24
 
25
extern kzfilestate kzfs;
26
 
476 terminx 27
        //High-level (easy) picture loading function:
1205 terminx 28
extern void kpzload (const char *, intptr_t *, int32_t *, int32_t *, int32_t *);
476 terminx 29
        //Low-level PNG/JPG functions:
1205 terminx 30
extern void kpgetdim (const char *, int32_t, int32_t *, int32_t *);
4634 terminx 31
extern int32_t kprender (const char *, int32_t, intptr_t, int32_t, int32_t, int32_t);
476 terminx 32
 
33
        //ZIP functions:
1205 terminx 34
extern int32_t kzaddstack (const char *);
476 terminx 35
extern void kzuninit ();
4320 hendricks2 36
extern intptr_t kzopen (const char *);
1205 terminx 37
extern int32_t kzread (void *, int32_t);
38
extern int32_t kzseek (int32_t, int32_t);
476 terminx 39
 
4634 terminx 40
static inline int32_t kztell(void) { return kzfs.fil ? kzfs.pos : -1; }
41
static inline int32_t kzeof(void) { return kzfs.fil ? kzfs.pos >= kzfs.leng : -1; }
42
static inline int32_t kzfilelength(void) { return kzfs.fil ? kzfs.leng : 0; }
43
static inline int32_t kzgetc(void) { char ch; return kzread(&ch, 1) ? ch : -1; }
44
static inline void kzclose(void) { MAYBE_FCLOSE_AND_NULL(kzfs.fil); }
45
 
476 terminx 46
extern void kzfindfilestart (const char *); //pass wildcard string
1205 terminx 47
extern int32_t kzfindfile (char *); //you alloc buf, returns 1:found,0:~found
476 terminx 48
 
4634 terminx 49
//like stricmp(st0,st1) except: '/' == '\'
3116 hendricks2 50
 
4634 terminx 51
extern char toupperlookup[256];
52
static inline int32_t filnamcmp(const char *j, const char *i)
53
{
54
    // If we reach at the end of both strings, we are done
4925 terminx 55
    while (*i && *j && (toupperlookup[*i] == toupperlookup[*j]))
4634 terminx 56
        i++, j++;
4925 terminx 57
    return *i != '\0' || *j != '\0';
4634 terminx 58
}
4658 terminx 59
extern int32_t wildmatch(const char *match, const char *wild);
4634 terminx 60
 
4766 hendricks2 61
#ifdef __cplusplus
3116 hendricks2 62
}
63
#endif