-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
58 lines (41 loc) · 2.37 KB
/
main.c
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
53
54
55
56
57
58
#include <ldg.h>
#include <zlib.h>
/* general */
const char* CDECL get_version() { return ZLIB_VERSION; }
const char* CDECL get_info() { return "[1][zlib: deflate, inflate and crc32 routines.][ Ok ]"; }
const char* CDECL get_error(err) int err; { return zError(err); }
unsigned long CDECL get_compil_flags() { return zlibCompileFlags(); }
unsigned long CDECL get_sizeof_stream_struct() { return (uLong)sizeof(z_stream); }
/* zip */
int CDECL raw_deflate_init (z_stream *strm, int level) { return deflateInit2(strm, level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); }
int CDECL raw_deflate (z_stream *strm, int flush) { return deflate(strm, flush); }
int CDECL raw_deflate_end (z_stream *strm) { return deflateEnd(strm); }
/* unzip */
int CDECL raw_inflate_init (z_stream *strm) { return inflateInit2(strm, -MAX_WBITS); }
int CDECL raw_inflate (z_stream *strm, int flush) { return inflate(strm, flush); }
int CDECL raw_inflate_end (z_stream *strm) { return inflateEnd(strm); }
/* misc */
unsigned long CDECL update_crc32(uLong crc_value, const Bytef *buf, uInt len) { return(crc32(crc_value, buf, len)); }
/* populate functions list and info for the LDG */
PROC LibFunc[] =
{
{"get_version", "char* get_version(void);\n", get_version},
{"get_info", "char* get_info(void);\n", get_info},
{"get_error", "char* get_error(int err);\n", get_error},
{"get_compil_flags", "unsigned long get_compil_flags(void);\n", get_compil_flags},
{"get_sizeof_stream_struct", "unsigned long get_sizeof_stream_struct(void);\n", get_sizeof_stream_struct},
{"raw_deflate_init", "long raw_deflate_init(z_stream *strm, long level);\n", raw_deflate_init},
{"raw_deflate", "long raw_deflate(z_stream *strm, long flush);\n", raw_deflate},
{"raw_deflate_end", "long raw_deflate_end(z_stream *strm);\n", raw_deflate_end},
{"raw_inflate_init", "long raw_inflate_init(z_stream *strm);\n", raw_inflate_init},
{"raw_inflate", "long raw_inflate(z_stream *strm, long flush);\n", raw_inflate},
{"raw_inflate_end", "long raw_inflate_end(z_stream *strm);\n", raw_inflate_end},
{"update_crc32", "unsigned long update_crc32(unsigned long crc, char *src, unsigned int srclen);\n", update_crc32}
};
LDGLIB LibLdg[] = { { 0x0006, 12, LibFunc, "zlib: deflate/inflate/crc32 basic routines.", 1} };
/* */
int main(void)
{
ldg_init(LibLdg);
return 0;
}