BBS: Inland Empire Archive Date: 10-12-92 (09:17) Number: 347 From: ERIC B. FORD Refer#: NONE To: QUINN TYLER JACKSON Recvd: NO Subj: Compression Conf: (2) Quik_Bas
> Hello Rich: > I hope it's not terribly rude to ask, but, could you > design a public domain string compressor (for text...) > that uses *fixe table* references that are English > specific? In other words, how would you optimize this > code..... 'Eric's Packing routine for progrmas that are text files. 'I found this somewhere around here. 'FOR file = 1 TO LOF(1) 'CALL Pack(text$) 'NEXT file SUB Pack (text$) D1$ = "abadafagahalamanaparasatbabbbebiblbobrcacccechclcocrdaddd" D2$ = "edredefehemenesetfafefiflfofrgageghgihahehihoicidifigihil" D3$ = "iminirisitjajejijojuouuekakekikokrlalilllnloltlymamemimon" D4$ = "anengninknnnontobocodofolomonoporosotpapepippqurardrerrro" D5$ = "sasesisssttatetitothunupwawe" Dict$ = D1$ + D2$ + D3$ + D4$ + D5$ DO cnt = cnt + 1 char$ = MID$(text$, cnt, 2) IF cnt = LEN(text$) THEN text$ = temp$ + MID$(text$, cnt, 1) EXIT SUB END IF xx = 1 ReDo: x = INSTR(xx, Dict$, char$) IF x > 0 THEN IF (x \ 2) = (x / 2) THEN xx = x + 1 GOTO ReDo END IF temp$ = temp$ + CHR$((x \ 2) + 127) cnt = cnt + 1 ELSE temp$ = temp$ + MID$(text$, cnt, 1) END IF LOOP WHILE cnt < LEN(text$) text$ = temp$ END SUB --- * Origin: Eric Ford (1:3632/1.6)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET