雌二醇在黄体期:inline 语法

来源:百度文库 编辑:高校问答 时间:2024/05/08 19:42:41
以下算法是LZW算法的C程序代码
在编译链接时出现一个错误:
错误 lzw.c 19: 说明语法错误

即inline的语法错误

我查了一些书籍资料,没有较好的说明,感觉好像没什么错误
请大家帮忙修改!

谢谢

#include <stdio.h>
#include <string.h>
#include <malloc.h>
#define MAX_ENTRIES 100
#define MAX_PATTERN_LENGTH 100
#define READ_CHUNK_SIZE 65532
#define WRITE_CHUNK_SIZE 65532
#define RUN_LENGTH_MAX 255
#define CLOSE_FILE 1
#define DEBUG 0 /* 1- get_bytes ; 2 - compress ; 3 - decompress */
char pattern[MAX_ENTRIES][MAX_PATTERN_LENGTH];
unsigned long code_size[MAX_ENTRIES];
short int no_of_entries = 0;
unsigned long optim[MAX_PATTERN_LENGTH];
unsigned long optim_cur_index = 0;
unsigned long current_max_length = 0;
unsigned char *fdata; /* buffer for input */
unsigned char *cdata; /* buffer for output */
inline error_msg (char *error)
{
printf ("ERROR:%s\n", error);
exit (1);
}

int
get_bytes (char *filename, unsigned long *count)
{
static FILE *fp;
static int first = 1;
static int eof = 0;
unsigned long fsize;
if (first)
{
if (DEBUG == 1)
printf ("******first time read******\n");
if ((fp = fopen (filename, "rb")) == NULL)
error_msg ("Unable to open ip file");
fseek (fp, 0, SEEK_END);
fsize = ftell (fp);
rewind (fp);
if (fsize > READ_CHUNK_SIZE)
{
fdata = (unsigned char *) malloc (READ_CHUNK_SIZE);
if (fdata == NULL)
error_msg ("Unable to allocate memory");
if (fread (fdata, 1, READ_CHUNK_SIZE, fp) != READ_CHUNK_SIZE)
error_msg ("File read error");
*count = READ_CHUNK_SIZE;
}
else
{
fdata = (unsigned char *) malloc (fsize);
if (fdata == NULL)
error_msg ("Unable to allocate memory\n");
if (fread (fdata, 1, fsize, fp) != fsize)
error_msg ("File read error");
*count = fsize;
eof = 1;
}
}
else
{
if (eof)
{

/* error_msg("No more data in file"); */
*count = 0;
}
else
{
*count = fread (fdata, 1, READ_CHUNK_SIZE, fp);
if (*count < READ_CHUNK_SIZE)
eof = 1;
}
}
if (first == 1)
first = 0;
if (DEBUG == 2)
{
printf ("***** count = %d\n", *count);
}
printf ("%d bytes read\n", *count);
return (*count);
}