亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? unhuf.c

?? 霍夫曼算法編碼、解壓encodedecode
?? C
字號:
/*******************************************************************************
*                                                                              *
* UNHUF.C   by Shaun Case   April 1991                                         *
*                                                                              *
* Written in Borland C++ 2.0 under MS-DOS 3.3                                  *
*                                                                              *
* Decompresses a single file encoded with companion program HUF,               *
* which uses Huffman encoding.                                                 *
*                                                                              *
* This program is in the public domain.                                        *
*                                                                              *
* atman%ecst.csuchico.edu@RELAY.CS.NET                                         *
*                                                                              *
*                                                                              *
*******************************************************************************/

#include <stdio.h>
#include <math.h>

#define FALSE 0
#define TRUE !FALSE
#define MAX_DECODE_TABLE_SIZE 520       /* 512 should be enough           */


/* uncomment the next line to see the decode table at runtime. */

/*
#define DEBUG
*/


/* uncomment the next line to only uncompress the exact number of bytes   */
/* that were originally encoded.  If it is not defined, the routine will  */
/* faster, but will generate up to 8 extra bytes at the end of the        */
/* decompressed data.                                                     */

#define EXACT


typedef struct decode_table_element {   /* template for decode table element (wow)  */
    unsigned char letter;               /* which character to decode to             */
    char spare;                         /* force 16-bit word alignment              */
    short left;                         /* index of lower left element from tree    */
    short right;                        /* index of lower right element from tree   */
}decode_table_element;


short array_max_index;                  /* max number of elements in array (to be   */
                                        /* determined in create_decode_table() )    */

unsigned long  total;                   /* total number of unencoded bytes          */
FILE *infile;                           /* file ptr to SYSTEM.HUF (compressed)      */
FILE *outfile;                          /* file ptr to SYSTEM.UNH (decompressed)    */
char *infilename;                       /* name of the input file                   */
char origfilename[13];                  /* name of the original file                */

struct decode_table_element             /* array implementation of huffman tree     */
    decode_table[MAX_DECODE_TABLE_SIZE];

/******
 *
 * Datafile:  All 16/32 bit quantities in Intel byte ordering
 *
 *  13 bytes    : original filename (8.3 + '\0')
 *  16 bits     : number of array elements needed, N (N == 511 means 512 array
 *                elements -> 0..511)
 *  32 bits     : size of uncompressed original data in bytes
 *  N * 6 bytes : Array elements in order 0 .. N
 *                struct decode_table_element {
 *                     char letter;      8 bits
 *                     char spare;       8 bits
 *                     short left;      16 bits
 *                     short right;     16 bits
 *                 }
 *  <?>          : compressed data, effectively a bit stream
 *
 ******/


int main(int argc, char **argv)
{
    short read_header(void);                /* prototype */
    void show_bit_sequences(short index);   /* prototype */
    short uncompress(void);                 /* prototype */

    if (argc != 2) {                        /* check command line argument validity  */
        puts("'unhuf file' decodes file.");
        return 1;
	}
    puts("Unhuf by Shaun Case, 1991, public domain");

    infilename=argv[1];


    if (read_header() != 0)                 /* read in file name, size, decode table */
        return 1;

#ifdef DEBUG
    show_bit_sequences(0);
#endif

    if (uncompress() != 0)                  /* uncompress the data & write to file   */
        return 1;

    fclose(infile);

    return 0;

}

/*
 * read in the original filename, size, and decode table
 *
 */

short read_header(void)
{
    if ((infile=fopen(infilename, "rb")) == NULL)        /* open file           */
    {
        printf("Unable to open %s\n", infilename);
        return 1;
    }


    if (                                                 /* get original name   */
          fread((void *)origfilename, 1, 13, infile)
          < 13
       )
    {
        printf("Unable to read original filename from %s\n", infilename);
        fclose(infile);
        return 1;
    }

                                                         /* get length of decode table */
    if (
          fread((void *)&array_max_index, sizeof(short), 1, infile)
          < 1
       )
    {
        printf("Unable to read number of array elements from %s\n", infilename);
        fclose(infile);
        return 1;
    }

        if (                                             /* get filesize in bytes */
              fread((void *)&total, sizeof(unsigned long), 1, infile)
            < 1
       )
    {
        printf("Unable to read original byte count from %s\n", infilename);
        fclose(infile);
        return 1;
    }

    printf("Decoding %ld bytes to %s.\n", total, origfilename);
    printf("Decode table contains %d elements.\n",array_max_index + 1);

    if (                                                /* get decode table        */
          fread((void *)decode_table, sizeof(decode_table_element), array_max_index + 1, infile)
          < (array_max_index + 1)
       )
    {
        printf("Unable to read decode table from %s\n", infilename);
        fclose(infile);
        return 1;
    }

    return 0;
}

#ifdef DEBUG
short seq_len=0;  /* routine is recursive, needs global storage  */
                  /* length of current bit sequence              */
                  /* this should probably be static inside sbs() */


/*
 * display the bit sequences that represent each character.
 * useful for debugging.
 *
 */

void show_bit_sequences(short index)
{

    static short temp_index=0;
    static char bit_sequence[16];       /* where to build the huffman bit sequence  */

    if (decode_table[index].left != 0)  /* if we are not at a leaf, go left         */
    {
        bit_sequence[seq_len++]='1';
        show_bit_sequences(decode_table[index].left);
        seq_len--;
    }
                                        /* returned from going left, now try right  */
    if (decode_table[index].right != 0)
    {
        bit_sequence[seq_len++]='0';    /* if we are not at a leaf, go right        */
        show_bit_sequences(decode_table[index].right);
        seq_len--;
    }

    if (decode_table[index].left != NULL)    /* we are at an interior node going back up */
        return;

    /* we are at a leaf, therefore we have a complete bit sequence built            */

    bit_sequence[seq_len] = 0;          /* append teriminating NULL to string       */

    printf("[%3d] %3d == %16s == %3d\n", temp_index, decode_table[index].letter, bit_sequence, seq_len);
    temp_index++;
}

#endif

/*
 * all the fputc() calls are unrolled for speed.
 *
 */

short uncompress(void)
{

    /* tcc68 can assign 7 register variables */

    register short index         = 0;               /* "ptr" to "node" in "tree"        */
                                                    /* actually an array index          */
    register unsigned unsigned int buffer = 0;      /* 8 bit buffer                     */
    register unsigned short fastleft;               /* fast ptr to next left  element   */
    register unsigned short  fastleft0;             /* fast ptr to left of root         */
    register long running_total = 0L;

    if ((outfile=fopen(origfilename, "wb")) == NULL)    /* open file                        */
    {
        printf("Unable to open %s\n", origfilename);
        return 1;
    }

    fastleft0 = decode_table[0].left;                   /* setup frequently used vars       */
    fastleft = fastleft0;

    while (1)
    {
        buffer=fgetc(infile);                           /* get 8 bits                       */


        /* branch left if current bit == 1, else branch right                               */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;                                   /* rotate next bit to test postion  */

        fastleft = decode_table[index].left;            /* set up frequently used var       */

        if (fastleft == 0)                              /* if we have decoded a char        */
        {
            if (
                fputc((int)decode_table[index].letter, outfile)    /* write it to output    */
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            index = 0;                                  /* set "ptr" to top of "tree"       */
            fastleft = fastleft0;                       /* set up freq. used variable       */
#ifdef EXACT
            if (++running_total == total) goto finished;  /* if we are done, quit.          */
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }


        /* and do it again for 2nd bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            
            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }
 
        /* and 3rd bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            
            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and 4th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            
            index=0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and 5th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and 6th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }

            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and 7th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }

            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and finally, the 8th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }

            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
            ++running_total;
#endif EXACT
        }
#ifndef EXACT
        if (running_total >= total)
            goto finished;
#endif EXACT

    }

finished:

    fclose(outfile);
    printf("Decoded %ld bytes.", running_total);
    return 0;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩免费观看高清完整版在线观看| 日韩电影在线一区| 欧美一区二区三区精品| 欧美日韩三级在线| 欧美精品在线视频| 欧美女孩性生活视频| 91精品国产日韩91久久久久久| 欧美剧情片在线观看| 欧美一卡2卡三卡4卡5免费| 4438x成人网最大色成网站| 日韩久久久久久| 国产日韩欧美亚洲| **性色生活片久久毛片| 亚洲色图一区二区| 五月婷婷久久综合| 韩日av一区二区| 成人av在线一区二区三区| 成人avav影音| 欧美精品久久99久久在免费线 | 不卡的av在线播放| 99re免费视频精品全部| 欧美日韩国产中文| 久久婷婷成人综合色| 国产精品久久久久久妇女6080| 亚洲视频一区二区在线| 日本v片在线高清不卡在线观看| 国产美女视频一区| 在线精品视频小说1| 欧美一区二区福利在线| 国产精品国产三级国产普通话三级| 亚洲午夜av在线| 国产激情精品久久久第一区二区| 91麻豆精品在线观看| 日韩视频免费观看高清在线视频| 久久精品人人爽人人爽| 亚洲一区二区在线免费观看视频 | 91一区一区三区| 欧美一级一区二区| 亚洲男人的天堂在线观看| 日本最新不卡在线| 91一区二区三区在线播放| 精品国产一区二区三区av性色 | 欧美成人a∨高清免费观看| 亚洲欧洲性图库| 精品一区二区三区免费观看| 91久久国产综合久久| 久久久国际精品| 人人超碰91尤物精品国产| 一本到不卡免费一区二区| 国产无一区二区| 国产露脸91国语对白| 欧美一区二区三区视频在线| 亚洲色图制服诱惑| 成人h动漫精品一区二| 久久这里只有精品视频网| 天天综合网 天天综合色| 91免费国产视频网站| 国产精品欧美综合在线| 国产精品538一区二区在线| 91精品国产综合久久久久久久| 亚洲美女少妇撒尿| 懂色av一区二区夜夜嗨| 26uuu成人网一区二区三区| 美国十次了思思久久精品导航| 欧美色区777第一页| 一区二区三区蜜桃网| 91蜜桃婷婷狠狠久久综合9色| 国产精品美女一区二区三区| 国产成人午夜片在线观看高清观看| 欧美一激情一区二区三区| 偷窥国产亚洲免费视频| 欧美亚洲综合在线| 亚洲成人av一区二区| 制服丝袜亚洲色图| 另类小说图片综合网| 日韩欧美在线综合网| 另类综合日韩欧美亚洲| 久久只精品国产| 不卡视频在线看| 一区二区三区免费| 欧美日韩在线免费视频| 视频一区中文字幕| 精品免费视频一区二区| 国产一区二区三区免费在线观看 | 亚洲欧美偷拍另类a∨色屁股| 成人激情午夜影院| 亚洲视频一区在线| 欧美日韩国产首页在线观看| 美女尤物国产一区| 久久嫩草精品久久久久| 成人的网站免费观看| 一区二区三区在线观看视频| 欧美日韩国产综合久久| 美女脱光内衣内裤视频久久网站 | 久久久夜色精品亚洲| 懂色av一区二区在线播放| 亚洲激情成人在线| 91精品国产综合久久久久久久| 精品一区二区三区不卡| 欧美高清在线一区| 欧美视频在线一区| 捆绑变态av一区二区三区| 国产精品视频九色porn| 欧美性高清videossexo| 国产麻豆一精品一av一免费| 亚洲精品国产成人久久av盗摄| 欧美一区二区三区四区久久| 成人做爰69片免费看网站| 亚洲成人手机在线| 欧美激情综合在线| 欧美怡红院视频| 粉嫩一区二区三区性色av| 亚洲r级在线视频| 国产精品久久久久久久久免费丝袜| 欧美日韩高清一区二区不卡| 国产传媒一区在线| 亚洲国产cao| 亚洲欧洲三级电影| 精品国产区一区| 欧美日产国产精品| 色综合久久综合网| 激情综合网av| 日韩电影免费在线看| 国产精品亲子伦对白| 久久影视一区二区| 91精品国产色综合久久不卡电影| 成人av免费在线观看| 国产在线播放一区三区四| 亚洲va欧美va人人爽午夜| 综合久久综合久久| 国产欧美一区二区精品忘忧草 | 一区二区三区国产豹纹内裤在线| 久久综合成人精品亚洲另类欧美 | 国产亚洲va综合人人澡精品| 91精品一区二区三区在线观看| 99国内精品久久| 99久久婷婷国产综合精品| 国产成人高清在线| 国产成人免费av在线| 国产一区二区不卡老阿姨| 麻豆精品久久精品色综合| 丝袜亚洲精品中文字幕一区| 一区二区三区在线视频免费| 亚洲婷婷在线视频| 国产精品福利av| 国产精品久久久久久亚洲毛片 | 风间由美性色一区二区三区| 国产一区美女在线| 国产乱子伦视频一区二区三区 | 欧美日韩高清一区二区不卡| 欧洲另类一二三四区| 91九色02白丝porn| 欧美丝袜丝交足nylons| 欧美日韩综合色| 欧美美女激情18p| 欧美一区二区在线观看| 欧美一区二区三区成人| 欧美xxxxx裸体时装秀| 久久免费精品国产久精品久久久久 | 国产精品 欧美精品| 成人综合在线视频| 日本二三区不卡| 欧美日韩中文精品| 欧美一区二区三区的| 久久久青草青青国产亚洲免观| 久久免费精品国产久精品久久久久| 亚洲国产精品av| 亚洲精品视频免费观看| 丝袜美腿高跟呻吟高潮一区| 美国十次综合导航| 波多野洁衣一区| 欧美日韩三级一区二区| 精品裸体舞一区二区三区| 欧美国产成人在线| 亚洲午夜免费电影| 国内国产精品久久| 91丝袜高跟美女视频| 欧美日韩免费电影| 国产亚洲成aⅴ人片在线观看| 亚洲免费伊人电影| 日本麻豆一区二区三区视频| 国产精品综合二区| 欧美三级一区二区| 久久综合999| 午夜国产精品影院在线观看| 国产高清亚洲一区| 欧美视频在线不卡| 国产日韩欧美精品一区| 午夜精品一区在线观看| 国产91精品一区二区| 欧美日韩国产首页在线观看| 亚洲国产精品激情在线观看| 免费在线欧美视频| 日本道精品一区二区三区| 精品捆绑美女sm三区| 亚洲午夜在线视频| 成人h精品动漫一区二区三区| 日韩精品影音先锋| 亚洲福利国产精品| 91免费版在线看|