4COMMLZW C )LZW C +3LZW DQC;LZW SUB4LZWCOM COMTxbLZWUNC C ~LZWUNC COM6W/* COMMLZW - ROUTINES COMMON TO LZWCOM AND LZWUNC */ #include "stdio.h" #define FALSE 0 #define TRUE !FALSE #define TABSIZE 4096 #define NO_PRED -1 #define EMPTY -1 #define NOT_FND -1 #define SECTSIZE 128 extern struct entry { char used; int next; /* index of next in collision list */ int predecessor; /* 12 bit code */ char follower; } string_tab[TABSIZE]; extern char is_a_con; /* h uses the 'mid-square' algorithm. I.E. for a hash val of n bits */ /* hash = middle binary digits of (key * key). Upon collision, hash */ /* searches down linked list of keys that hashed to that key already. */ /* It will NOT notice if the table is full. This must be handled */ /* elsewhere */ h(pred,foll) /* returns the mid square of pred + foll */ { long temp, local; /* 32 bit receiving field for local^2 */ local = (pred + foll) | 0x0800; temp = local * local; local = (temp >> 6) & 0x0FFF; return local; /* middle 12 bits of result */ } eolist(index) /* return last element in a collision list */ int index; { register int temp; while ( 0 != (temp = string_tab[index].next) ) index = temp; return index; } hash(pred,foll,update) int pred, foll, update; { register int local, tempnext; register struct entry *ep; local = h(pred,foll); if ( !string_tab[local].used ) return local; else { /* if collision has occured */ local = eolist(local); /* search for free entry from local + 101 */ tempnext = (local + 101) & 0x0FFF; ep = &string_tab[tempnext]; /* initialize pointer */ while ( ep->used ) { ++tempnext; if ( tempnext == TABSIZE ) { tempnext = 0; /* handle wrap to beginning of table */ ep = string_tab; /* address of first element of table */ } else ++ep; /* point to next element in table */ } /* put new tempnext into last element in collision list */ if ( update ) /* if update requested */ string_tab[local].next = tempnext; return tempnext; } } /* unhash uses the 'next' field to go down the collision tree to find */ /* the entry corresponding to the passed key */ /* passed key and returns either the matching entry # or NOT_FND */ unhash(pred,foll) int pred, foll; { register int local, offset; register struct entry *ep; /* pointer to current entry */ local = h(pred,foll); /* initial hash */ loop: ep = &string_tab[local]; if ( (ep->predecessor == pred) && (ep->follower == foll) ) return local; if ( ep->next == 0 ) return NOT_FND; local = ep->next; goto loop; } init_tab() { register int i; for (i = 0; i <= 255; i++) { upd_tab(NO_PRED,i); } } #define UPDATE TRUE upd_tab(pred,foll) int pred, foll; { register struct entry *ep; /* pointer to current entry */ /* calculate offset just once */ ep = &string_tab[ hash(pred,foll,UPDATE) ]; ep->used = TRUE; ep->next = 0; ep->predecessor = pred; ep->follower = foll; } int inbuf = EMPTY; int outbuf = EMPTY; /* getcode and putcode 'gallop' through input and output - they either */ /* output two bytes or one depending on the contents of the buffer. */ getcode(fd) int fd; { register int localbuf, returnval; if (EMPTY == inbuf) { /* On code boundary */ if (EOF == (localbuf = readc(fd)) ) { /* H L1 byte - on code boundary */ return EOF; } if (EOF == (inbuf = readc(fd)) ) { /* L0 Hnext */ return EOF; /* The file should always end on code boundary */ } returnval = (localbuf << 4) + (inbuf >> 4); inbuf &= 0x000F; } else { /* buffer contains nibble H */ if (EOF == (localbuf = readc(fd)) ) return EOF; returnval = localbuf + (inbuf << 8); inbuf = EMPTY; } return returnval; } putcode(fd,code) int fd,code; { register int localbuf; if (EMPTY == outbuf) { writec( fd,(code >> 4)); /* H L1 */ outbuf = code & 0x000F; /* L0 */ } else { writec( fd, ( (outbuf << 4) + (code >> 8) ) ); /* L0prev H */ writec( fd,(code & 0x00FF)); /* L1 L0 */ outbuf = EMPTY; } } char insector[SECTSIZE]; int current = 0; int sector = 0; readc(fd) int fd; { register int returnval; if (current == 0) { if ( 0 == read(fd,insector,SECTSIZE) ) { return (EOF); } else { if (!is_a_con) if ( (++sector % 80) ) putchar('.'); else { putchar('.'); putchar('\n'); } } } returnval = (insector[current++]); if (current == SECTSIZE) { current = 0; } return returnval; } char outsector[SECTSIZE]; int outcurrent = 0; writec(fd,c) int fd,c; { outsector[outcurrent++] = ( (char) c); if (outcurrent == SECTSIZE) { outcurrent = 0; write(fd,outsector,SECTSIZE); } } /* flushout makes sure fractional output buffer gets written */ flushout(fd) int fd; { write(fd,outsector,(outcurrent + 1)); } /* LZWCOM - FILE COMPRESSOR UTILITY */ #include "sgtty.h" #include "stdio.h" #include "fcntl.h" #define FALSE 0 #define TRUE !FALSE #define TABSIZE 4096 #define NO_PRED -1 #define EMPTY -1 #define NOT_FND -1 struct entry { char used; int next; /* hi bit is 'used' flag */ int predecessor; /* 12 bit code */ char follower; } string_tab[TABSIZE]; char is_a_con = FALSE; /* flag to suppress 'dots' in writec */ /* routines common to compress and decompress, contained in CommLZW.c */ hash(); unhash(); getcode(); putcode(); init_tab(); upd_tab(); main(argc,argv) int argc; char *argv[]; { int c, code, localcode; int code_count = TABSIZE - 256; int infd, outfd; if (3 != argc) { printf("Usage : lzwcom oldfilename squeezefilename\n"); exit(0); } if ( -1 == (infd = open( *++argv, O_RDONLY )) ) { printf("Cant open %s\n", *argv); exit(0); } if ( -1 == (outfd = creat(*++argv,0666)) ) { printf("Cant create %s\n",*argv); exit(0); } init_tab(); /* initialize code table */ c = readc(infd); code = unhash(NO_PRED,c); /* initial code for table */ #ifdef DEBUG putchar(c); printf( "\n%x\n",code); #endif while ( EOF != (c = readc(infd)) ) { #ifdef DEBUG putchar(c); #endif if ( NOT_FND != (localcode = unhash(code,c)) ) { code = localcode; continue; } /* when the above clause comes false, you have found the last known code */ putcode(outfd,code); /* only update table if table isn't full */ #ifdef DEBUG printf( "\n%x\n",code); #endif if ( code_count ) { upd_tab(code,c); --code_count; } /* start loop again with the char that didn't fit into last string */ code = unhash(NO_PRED,c); } putcode(outfd,code); /* once EOF reached, always */ /* one code left unsent */ flushout(outfd); /* make sure everything's written */ exit(0); /* make sure everything gets closed */ } v?@ABCDEFGHIJKLMNOPQRSTUVuWXYZ[\]^_`abcdefghijklmno>`[^6_:`vٓ>u}c?[/_s|x~_C&ŠS9ʘ*rbj(Wkp:LXe#r3,Ee7CWuf RHwI9dF^ih&8eAih& `Yt,`+k\#izZ \HC_c6LC,ځz (dk>4%=eI!zjvAd؁ #}{E)-[D;Ei1i3XaSCӉX0!6\oS"5MXYzk2m_;Rd „}DʤdRԔ*٨fM]cBhI[.x}8<:w.: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***_  00000 @@@@@@@@@@@@@@@ @@@@@@@ @@@@@ @@@@ /* LZWUNC - FILE UNCOMPRESSOR UTILITY */ #include "stdio.h" #include "fcntl.h" #include "sgtty.h" #define FALSE 0 #define TRUE !FALSE #define TABSIZE 4096 #define STACKSIZE TABSIZE #define NO_PRED -1 #define EMPTY -1 #define NOT_FND -1 #define NO_UPDATE FALSE struct entry { char used; int next; /* hi bit is 'used' flag */ int predecessor; /* 12 bit code */ char follower; } string_tab[TABSIZE]; char is_a_con = FALSE; /* suppresses printing dots during operation if outfd is the console */ /* routines common to compress and decompress, contained in CommLZW.c */ hash(); unhash(); getcode(); putcode(); init_tab(); upd_tab(); main(argc,argv) int argc; char *argv[]; { int c, tempc, code, oldcode, incode, finchar; int code_count = TABSIZE - 256; int infd, outfd; register struct entry *ep; if (3 != argc) { printf("Usage : lzwunc squeezefilename newfilename\n"); exit(0); } if ( -1 == (infd = open( *++argv, O_RDONLY )) ) { printf("Cant open %s\n", *argv); exit(0); } if ( -1 == (outfd = creat(*++argv,0666)) ) { printf("Cant create %s\n",*argv); exit(0); } is_a_con = isatty(outfd); /* suppress dots if it is */ init_tab(); /* set up atomic code definitions*/ code = oldcode = getcode(infd); c = string_tab[code].follower; /* first code always known */ writec(outfd,c); finchar = c; while ( EOF != (code = incode = getcode(infd)) ) { ep = &string_tab[code]; /* initialize pointer */ if ( !ep->used ) { /* if code isn't known */ writec(outfd,finchar); /* the follower char of last */ code = oldcode; /* revert to last known code */ incode = hash(oldcode,finchar,NO_UPDATE); ep = &string_tab[code]; /* re-initialize pointer */ } while (NO_PRED != ep->predecessor) { push( ep->follower); /* decode string backwards into */ /* stack */ code = ep->predecessor; ep = &string_tab[code]; } /* above loop terminates, one way or another, with */ /* string_tab[code].follower = first char in string */ finchar = ep->follower; writec(outfd, finchar); #ifdef DEBUG putchar(finchar); #endif /* pop anything stacked during code parsing */ while ( EMPTY != (tempc = pop()) ) { writec(outfd,tempc); #ifdef DEBUG putchar(tempc); #endif } if ( code_count ) { upd_tab(oldcode,finchar); --code_count; } oldcode = incode; } flushout(outfd); /* write out fractional buffer, if any */ exit(0); /* close all files and quit */ } char stack[STACKSIZE]; /* stack for pushing and popping characters */ int sp = 0; /* current stack pointer */ push(c) int c; { stack[sp] = ((char) c);/* coerce passed integer into a character */ ++sp; if (sp >= STACKSIZE) { printf("Stack overflow, aborting\n"); exit(1); /* non-0 exit parameter terminates batch job */ } } pop() { if (sp > 0) { --sp; /* push leaves sp pointing to next empty slot */ return ( (int) stack[sp] ); /* make sure pop returns char */ } else return EMPTY; } \!9!9!! 9~#foͅ)5! !͚!!9~#fo##s#r^#Vc"4,!v)~! 9^#V^#V!I !͚!!9~#fo##s#r^#VB"6,!v)! 9^#V^#V!W !͚*6,}2 **4,͕".,",,*,,(/^"(,*(,*6,͇*(,"2,*4,͕"0,",,!ͅ) *,,(/DM`i~q*2,*6,͇*.,",,!*2,*.,ͺ"0,*,,(/DM! ^#V!ͅ)ʬ! ^g! ^#V",,*,,(/DMq! ^"2,*2,*6,͇"*,!ͅ)**,*6,͇*!*|*2,*.,0*!*+"!**0,"., *6,!͚$Usage : lzwunc squeezefilename newfilename Cant open %s Cant create %s !9!9! 9^#V*#*s*#*#"#**#*͕)ʬ! !͚$Stack overflow, aborting !9!9*#*ͱ)*#*+"#**#*^$!$!9!9!<,! 9^#V!9~#fo^)w(t%!8,!<,b%!<,U%'t%!<,!8,b%N%ͬ&N%>&t%!<,b%͆($!9!9! 9^#V!(/^#VBKzʯ`i! 9s#rÇ! 9^#V$!9!9! 9^#V! 9^#VDM`i(/~`i$wDM`ieN)(/~T#v)G!!/Q!9~#r`i(/s#r$!9!9! 9^#V! 9^#VDM`i(/nf! 9~#fov)n&! 9~#fov)`i$#~#!$nfDMß!9!9!DM`i#DM`i͖)-!0$!9!9!!9^#V!9^#Vͺ(/DM!`is!! s#r! 9^#V! s#r! 9^#V! s$!9!9!*%*v)! 9^#VDM!v)!$! 9^#V"%*!v)!$*%*)`i))))!*%*N)"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