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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? unhuf.c

?? 文本壓縮算法及代碼
?? C
字號(hào):
/*******************************************************************************
*                                                                              *
* 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;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品一区二区三区视频在线观看| 欧美日韩日日骚| 亚洲欧美欧美一区二区三区| 国产色爱av资源综合区| 精品国内二区三区| 精品国产乱码久久久久久浪潮| 911国产精品| 日韩精品中文字幕一区二区三区| 亚洲精品成人精品456| 国产精品每日更新在线播放网址| 欧美国产精品中文字幕| 国产精品久久久久久久久免费桃花 | 免费高清视频精品| 美日韩一区二区三区| 黄色资源网久久资源365| 国产精品综合久久| 成人av动漫在线| 色乱码一区二区三区88| 欧美三级电影在线看| 欧美一级在线视频| 久久日韩精品一区二区五区| 国产欧美日产一区| 亚洲同性gay激情无套| 亚洲一区二区视频在线| 欧美一区二区三区免费视频| 日韩一级在线观看| 精品嫩草影院久久| 亚洲国产高清aⅴ视频| 亚洲视频香蕉人妖| 天堂一区二区在线| 国产美女在线观看一区| 波多野结衣中文字幕一区二区三区| 91免费看`日韩一区二区| 欧美精品亚洲一区二区在线播放| 亚洲精品在线三区| 国产精品久久久久久久久晋中| 亚洲精品大片www| 亚洲免费三区一区二区| 亚洲成av人片www| 久久精品国产亚洲aⅴ | 欧美成人欧美edvon| 欧美韩国日本一区| 亚洲成av人综合在线观看| 久久成人久久鬼色| 99久久精品国产观看| 国产精品视频在线看| 亚洲成av人**亚洲成av**| 国产剧情一区二区| 欧美性猛片xxxx免费看久爱| 精品国产一区二区三区久久影院| 中文字幕亚洲不卡| 秋霞电影一区二区| 91在线国产福利| 日韩亚洲欧美综合| 亚洲免费在线电影| 久久精品国产99国产| 91视频观看视频| 91久久精品一区二区| 2023国产一二三区日本精品2022| 亚洲综合在线观看视频| 韩国一区二区三区| 欧美情侣在线播放| 亚洲欧美日本在线| 国产成人午夜精品5599| 欧美丰满美乳xxx高潮www| 国产精品欧美经典| 国内一区二区在线| 制服丝袜亚洲播放| 一区二区免费视频| 成人精品亚洲人成在线| 精品国产乱码久久久久久免费 | 亚洲精品欧美综合四区| 国产麻豆视频一区二区| 91精品福利在线一区二区三区 | 国产福利一区在线观看| 欧美在线观看一二区| 国产视频视频一区| 美女久久久精品| 久久久夜色精品亚洲| 国产一区久久久| 成人免费黄色大片| 欧美精品aⅴ在线视频| 亚洲欧美偷拍卡通变态| 国产成人综合在线| 欧美v日韩v国产v| 亚洲成a人v欧美综合天堂下载| 中文字幕一区二区三区在线播放| 午夜精品久久久久久久久| 91麻豆国产香蕉久久精品| 欧美激情一区二区| 一本大道久久a久久综合| 国产伦精品一区二区三区在线观看 | 欧美精品自拍偷拍| 亚洲天堂2014| hitomi一区二区三区精品| 久久久久久久网| 美女网站在线免费欧美精品| 欧美日韩精品一区二区天天拍小说 | 久久精品男人的天堂| 精品一区二区三区视频| 欧美一区二区精品久久911| 天堂成人国产精品一区| 欧美日韩一本到| 一级特黄大欧美久久久| 色八戒一区二区三区| 亚洲美女偷拍久久| 欧美制服丝袜第一页| 伊人婷婷欧美激情| 欧美三级一区二区| 五月天国产精品| 日韩一区二区三区免费看| 日本视频一区二区| 日韩亚洲欧美在线观看| 蜜臀久久99精品久久久画质超高清| 69久久夜色精品国产69蝌蚪网| 日韩电影在线观看电影| 日韩一级视频免费观看在线| 激情综合一区二区三区| 日韩手机在线导航| 精品国产电影一区二区| 亚洲精品视频观看| 91成人免费在线| 亚洲成人动漫精品| 日韩亚洲欧美在线观看| 国产一区二区三区在线观看免费视频 | 欧美一区二区免费视频| 激情综合色综合久久综合| 国产欧美一区二区三区在线看蜜臀 | 26uuuu精品一区二区| 久久精品免费看| 国产欧美日韩在线视频| 欧美成人aa大片| 国产成人午夜精品影院观看视频| 国产精品久久久久婷婷| 欧美午夜精品久久久久久孕妇| 日本人妖一区二区| 国产精品女主播av| 一本色道久久加勒比精品| 天天影视色香欲综合网老头| 久久人人超碰精品| 国产91精品在线观看| 亚洲综合成人网| 精品乱人伦一区二区三区| av网站免费线看精品| 香蕉影视欧美成人| 国产清纯白嫩初高生在线观看91| 在线精品视频一区二区三四| 另类的小说在线视频另类成人小视频在线| 国产拍欧美日韩视频二区| 欧美性受xxxx| 国产成人精品免费网站| 亚洲一区欧美一区| 久久日韩粉嫩一区二区三区| 91玉足脚交白嫩脚丫在线播放| 丝袜亚洲精品中文字幕一区| 久久只精品国产| 欧美性猛片xxxx免费看久爱| 国产精品18久久久久久vr| 亚洲国产日韩一区二区| 国产欧美精品一区二区色综合| 91国在线观看| 国产精品一卡二卡在线观看| 亚洲国产成人精品视频| 欧美激情一区不卡| 日韩视频在线你懂得| 丁香六月久久综合狠狠色| 国产成人免费在线视频| 亚洲精品少妇30p| 欧美一区二区三区喷汁尤物| 国产精品1024| 秋霞电影网一区二区| 一区二区三区日韩欧美精品| 久久久久久久久97黄色工厂| 3atv在线一区二区三区| av亚洲精华国产精华精华| 九色综合国产一区二区三区| 亚洲成人av在线电影| 综合精品久久久| 欧美激情在线免费观看| 精品伦理精品一区| 欧美一区二区三区婷婷月色| 91黄视频在线观看| 99久久99久久久精品齐齐| 国产精品白丝jk黑袜喷水| 美女网站一区二区| 日日噜噜夜夜狠狠视频欧美人| 国产精品久久久久久久岛一牛影视| 欧美一级精品大片| 在线观看日韩精品| av一本久道久久综合久久鬼色| 九九精品视频在线看| 亚洲国产aⅴ成人精品无吗| 国产精品私房写真福利视频| 久久综合九色综合97婷婷| 制服丝袜中文字幕一区| 88在线观看91蜜桃国自产| 欧洲另类一二三四区| 91亚洲精品久久久蜜桃网站| 成人激情午夜影院| 欧美日韩在线不卡|