2658709 [rkeene@sledge /home/rkeene/devel/dact]$ cat -n comp_factor.c
 1 /*
 2  * Copyright (C) 2001, 2002, and 2003  Roy Keene
 3  *
 4  * This program is free software; you can redistribute it and/or
 5  * modify it under the terms of the GNU General Public License
 6  * as published by the Free Software Foundation; either version 2
 7  * of the License, or (at your option) any later version.
 8  *
 9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  *
18  *      email: dact@rkeene.org
19  */
20 
21 
22 #include "dact.h"
23 #include "comp_factor.h"
24 #include <stdio.h>
25 #ifdef HAVE_UNISTD_H
26 #include <unistd.h>
27 #endif
28 #ifdef HAVE_STDLIB_H
29 #include <stdlib.h>
30 #endif
31 
32 
33 /*
34     mode        - DACT_MODE_COMPR or DACT_MODE_DECMP
35                 Determine whether to compress or decompress.
36     prev_block  - Previous (uncompressed) block.
37     curr_block  - The data to be compressed.
38     out_block   - Where to put data after compression.
39     blk_size    - Size of prev_block and curr_block.
40 */
41 #if defined(AS_MODULE) && defined(USE_MODULES)
42 #include "module.h"
43 uint32_t DC_NUM=10;
44 uint32_t DC_TYPE=DACT_MOD_TYPE_COMP;
45 void *DC_ALGO=comp_factor_algo;
46 char *DC_NAME="Factor Compression (MOD)";
47 #endif
48 int comp_factor_algo(int mode, unsigned char *prev_block, unsigned char *curr_block, char *out_block, int blk_size, int
	bufsize) {
49     switch(mode) {
50         case DACT_MODE_COMPR:
51             return(comp_factor_compress(prev_block, curr_block, out_block, blk_size, bufsize));
52             break; /* Heh */
53         case DACT_MODE_DECMP:
54             return(comp_factor_decompress(prev_block, curr_block, out_block, blk_size, bufsize));
55             break;
56         default:
57             fprintf(stderr, "Unsupported mode: %i\n", mode);
58             return(-1);
59     }
60 }
61 
62 int comp_factor_compress(unsigned char *prev_block, unsigned char *curr_block, char *out_block, int blk_size, int
	bufsize) {
63     return(-1);
64 }
65 
66 int comp_factor_decompress(unsigned char *prev_block, unsigned char *curr_block, char *out_block, int blk_size, int
	bufsize) {
67     fprintf(stderr, "Not yet supported.\n");
68     return(0);
69 }
2658710 [rkeene@sledge /home/rkeene/devel/dact]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2004-04-04 01:01:49