⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitfile.h

📁 LZSS 压缩/解压算法 算法简单
💻 H
字号:
/****************************************************************************                            Bit Stream File Header**   File    : bitfile.h*   Purpose : Providea definitions and prototypes for a simple library of*             I/O functions for files that contain data in sizes that aren't*             integral bytes.*             An attempt was made to make the functions in this library*             analogous to functions provided to manipulate byte streams.*             The functions contained in this library were created with*             compression algorithms in mind, but may be suited to other*             applications.*   Author  : Michael Dipperstein*   Date    : January 9, 2004******************************************************************************   UPDATES**   $Id: bitfile.h,v 1.4 2005/12/06 15:06:37 michael Exp $*   $Log: bitfile.h,v $*   Revision 1.4  2005/12/06 15:06:37  michael*   Added BitFileGetBitsInt and BitFilePutBitsInt for integer types.**   Revision 1.3  2004/11/09 14:16:58  michael*   Added functions to convert open bit_file_t to FILE and to*   align open bit_file_t to the next byte.**   Revision 1.2  2004/06/15 13:16:10  michael*   Use incomplete type to hide definition of bitfile structure**   Revision 1.1.1.1  2004/02/09 05:31:42  michael*   Initial release******************************************************************************** Bitfile: Bit stream File I/O Routines* Copyright (C) 2004-2005 by Michael Dipperstein (mdipper@cs.ucsb.edu)** This library is free software; you can redistribute it and/or* modify it under the terms of the GNU Lesser General Public* License as published by the Free Software Foundation; either* version 2.1 of the License, or (at your option) any later version.** This library is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU* Lesser General Public License for more details.** You should have received a copy of the GNU Lesser General Public* License along with this library; if not, write to the Free Software* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA****************************************************************************/#ifndef _BITFILE_H_#define _BITFILE_H_/****************************************************************************                             INCLUDED FILES***************************************************************************/#include <stdio.h>/****************************************************************************                            TYPE DEFINITIONS***************************************************************************/typedef enum{    BF_READ = 0,    BF_WRITE = 1,    BF_APPEND= 2,    BF_NO_MODE} BF_MODES;/* incomplete type to hide implementation */struct bit_file_t;typedef struct bit_file_t bit_file_t;/****************************************************************************                               PROTOTYPES***************************************************************************//* open/close file */bit_file_t *BitFileOpen(const char *fileName, const BF_MODES mode);bit_file_t *MakeBitFile(FILE *stream, const BF_MODES mode);int BitFileClose(bit_file_t *stream);FILE *BitFileToFILE(bit_file_t *stream);/* toss spare bits and byte align file */int BitFileByteAlign(bit_file_t *stream);/* get/put character */int BitFileGetChar(bit_file_t *stream);int BitFilePutChar(const int c, bit_file_t *stream);/* get/put single bit */int BitFileGetBit(bit_file_t *stream);int BitFilePutBit(const int c, bit_file_t *stream);/* get/put number of bits (most significant bit to least significat bit) */int BitFileGetBits(bit_file_t *stream, void *bits, const unsigned int count);int BitFilePutBits(bit_file_t *stream, void *bits, const unsigned int count);/**************************************************************************** get/put number of bits from integer types (short, int, long, ...)* machine endiness is accounted for.* size is the size of the data structure pointer to by bits.***************************************************************************/int BitFileGetBitsInt(bit_file_t *stream, void *bits, const unsigned int count,    const size_t size);int BitFilePutBitsInt(bit_file_t *stream, void *bits, const unsigned int count,    const size_t size);#endif /* _BITFILE_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -