Mercurial > repos > dawe > srf2fastq
comparison srf2fastq/io_lib-1.12.2/io_lib/compress.h @ 0:d901c9f41a6a default tip
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
author | dawe |
---|---|
date | Tue, 07 Jun 2011 17:48:05 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d901c9f41a6a |
---|---|
1 /* | |
2 * Copyright (c) Medical Research Council 1994. All rights reserved. | |
3 * | |
4 * Permission to use, copy, modify and distribute this software and its | |
5 * documentation for any purpose is hereby granted without fee, provided that | |
6 * this copyright and notice appears in all copies. | |
7 * | |
8 * This file was written by James Bonfield, Simon Dear, Rodger Staden, | |
9 * as part of the Staden Package at the MRC Laboratory of Molecular | |
10 * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom. | |
11 * | |
12 * MRC disclaims all warranties with regard to this software. | |
13 */ | |
14 | |
15 #ifndef _COMPRESS_H | |
16 #define _COMPRESS_H | |
17 | |
18 #include <stdio.h> | |
19 | |
20 #include "io_lib/mFILE.h" | |
21 | |
22 #ifdef __cplusplus | |
23 extern "C" { | |
24 #endif | |
25 | |
26 /* | |
27 * Compress a file using the method set in the compression_used value | |
28 * (set by set_compression_method and fopen_compressed). | |
29 * | |
30 * If compression succeeds, we rename the file back its original name. | |
31 * | |
32 * When compression_used is 0 no compression is done. | |
33 */ | |
34 int compress_file(char *file); | |
35 int fcompress_file(mFILE *fp); | |
36 | |
37 /* | |
38 * Returns a file pointer of an uncompressed copy of 'file'. | |
39 * 'file' need not exist if 'file'.ext (eg file.gz) | |
40 * exists and can be uncompressed. | |
41 * | |
42 * If ofp is non NULL then the original file pointer will also be returned | |
43 * (opened for update) to allow writing back to the original file. In cases | |
44 * of uncompressed data this is the same as the returned file pointer. | |
45 */ | |
46 mFILE *fopen_compressed(char *file, mFILE **ofp); | |
47 | |
48 /* | |
49 * Returns a file pointer of an uncompressed copy of 'fp'. | |
50 * | |
51 * If ofp is non NULL then the original file pointer will also be returned | |
52 * (opened for update) to allow writing back to the original file. In cases | |
53 * of uncompressed data this is the same as the returned file pointer. | |
54 */ | |
55 mFILE *freopen_compressed(mFILE *fp, mFILE **ofp); | |
56 | |
57 /* | |
58 * Sets the desired compression method. The below macros relate to entries | |
59 * in the compression magic numbers table. | |
60 */ | |
61 void set_compression_method(int method); | |
62 int get_compression_method(void); | |
63 | |
64 /* | |
65 * Converts compress mode strings (eg "gzip") to numbers. | |
66 */ | |
67 int compress_str2int(char *mode); | |
68 | |
69 /* | |
70 * Converts compress mode numbers to strings (eg "gzip"). | |
71 */ | |
72 char *compress_int2str(int mode); | |
73 | |
74 #define COMP_METHOD_NONE 0 | |
75 #define COMP_METHOD_BZIP 1 | |
76 #define COMP_METHOD_GZIP 2 | |
77 #define COMP_METHOD_COMPRESS 3 | |
78 #define COMP_METHOD_BZIP2 5 | |
79 #define COMP_METHOD_SZIP 6 | |
80 | |
81 /* | |
82 * In memory gzip and gunzip using zlib. In each case data is the input | |
83 * data (with 'size') and the returned value is the output data along with | |
84 * [cu]data_size being the returned data size. | |
85 * | |
86 * Both return NULL on failure | |
87 */ | |
88 char *memgzip(char *data, size_t size, size_t *cdata_size); | |
89 char *memgunzip(char *data, size_t size, size_t *udata_size); | |
90 | |
91 /* | |
92 * Given a filename remove a known compression extension | |
93 * | |
94 * Returns: None | |
95 */ | |
96 void remove_extension(char *file); | |
97 | |
98 #ifdef __cplusplus | |
99 } | |
100 #endif | |
101 | |
102 #endif /* _COMPRESS_H */ |