1 /******************************************************************************
2 *
3 * Copyright (C) 2009, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * Author: Alexey Krivonogov ( gentee )
11 *
12 ******************************************************************************/
13
14 include
15 {
16 "geafile.g"
17 $"..\windows\fileversion.g"
18 "geacommon.g"
19 }
20
21 import "gea.dll"<exe>
22 {
23 uint gea_init( uint )
24 uint lzge_encode( uint, uint, uint, lzge )
25 uint lzge_decode( uint, uint, uint, lzge )
26 uint ppmd_encode( uint, uint, uint, uint, ppmd )
27 uint ppmd_decode( uint, uint, uint, uint, ppmd )
28 uint ppmd_start( uint )
29 ppmd_stop( )
30 }
31
32 func geainit< entry >
33 {
34 gea_init( gentee_ptr( 4 )) // GPTR_CALL
35 }
36
37 include
38 {
39 "geae.g"
40 "gead.g"
41 }
42 /*
43
44 func main//< main >
45 {
46 uint outsize i one
47 buf in out decomp btemp
48 lzge lz lzd
49 ppmd ppm
50 uint osize
51
52 // in.expand( 4200000 )
53 out.expand( 4200000 )
54 decomp.expand( 4200000 )
55 in.read( "c:\\aa\\pcmassor.dbf" )
56 btemp = in
57 one = *in
58 in += btemp
59 in += btemp
60 in += btemp
61 // ppm.memory = 8
62 ppm.order = 10
63 lz.order = 1
64 // lz.solid = 1
65 while i < *in
66 {
67 lzge lzd
68 // outsize += lzge_encode( in.ptr()+i, min( 2000000, *in - i ), out.ptr(), lz )
69 print("Enter\n")
70 outsize += lzge_encode( in.ptr() + i - lz.solidoff,
71 min( one, *in - i ) + lz.solidoff, out.ptr() + *out, lz )
72 print("\nDecode \( outsize )\n")
73 lzd.solidoff = lz.solidoff
74 osize = lzge_decode( out.ptr() + *out, decomp.ptr(), lzd.solidoff +
75 min( one, *in - i ), lzd )
76 // btemp.copy( out.ptr() + *out, osize )
77 // btemp.write("c:\\aa\\decode1.bin")
78 // lzge_decode( out.ptr() + *out, decomp.ptr(), lzd.solidoff +
79 // min( one, *in - i ), lzd )
80 // decomp.use = min( 1000000, *in - i ) + lz.solidoff
81 lz.solidoff += one//0x80000
82 // outsize += ppmd_encode( in.ptr() + i, min( 1500000, *in - i ), out.ptr(), ppm )
83 i += one
84 // ppm.memory = 0
85 // ppm.order = 1
86 out.use = outsize
87 print("\nOK decomp=\( osize ) \( outsize )\n" )
88 // ppmd_encode( in.ptr() + 3000000, *in - 3000000, out.ptr(), ppm )
89 }
90 // decomp.write("c:\\apps\\unpack")
91 print("\nCompression \( outsize ) --------------------- \n")
92 goto end
93
94 mzero( &lz, sizeof( lzge ))
95 lz.order = 1
96 outsize = lzge_encode( in.ptr(), *in, out.ptr(), lz )
97 print("\nDecompression \( outsize )\n")
98 out.use = outsize
99 print("0\n")
100 decomp.use = lzge_decode( out.ptr(), decomp.ptr(), *in, lzd )
101 print("\n1 \(decomp.use)\n")
102 fornum i, *in
103 {
104 if in[ i ] != decomp[ i ]
105 {
106 congetch("Compare error \(i) ( \(in[i]) != \(decomp[i]) )\n" )
107 break
108 }
109 }
110 label end
111
112 mzero( &lzd, sizeof( lzge ))
113 lzd.order = 1
114 lzd.solidoff = 0
115 i = 0
116 osize = 0
117 while i < *in
118 {
119 print("\nDecode 0\n")
120 // btemp.copy( out.ptr() + osize, 25 )
121 // btemp.write("c:\\aa\\decode2.bin")
122 osize += lzge_decode( out.ptr() + osize, decomp.ptr(), lzd.solidoff +
123 min( one, *in - i ), lzd )
124 print("\nDecode \( osize )\n")
125 lzd.solidoff += one
126 decomp.use = lzd.solidoff
127 // lz.solidoff += one//0x80000
128 // outsize += ppmd_encode( in.ptr() + i, min( 1500000, *in - i ), out.ptr(), ppm )
129 i += one
130 // ppm.memory = 0
131 // ppm.order = 1
132 print("\nOK \(decomp.use)\n" )
133 // ppmd_encode( in.ptr() + 3000000, *in - 3000000, out.ptr(), ppm )
134 }
135 // decomp.use = lzge_decode( out.ptr(), decomp.ptr(), *in, lzd )
136 print("\n1 \(decomp.use)\n")
137
138 print("Summary: \(*in) \(outsize) = \( outsize * 100 / *in )")
139 congetch("Press any key")
140 }
141 */
142