Re: Compression

 BBS: Inland Empire Archive
Date: 10-17-92 (21:57)             Number: 213
From: MARK BUTLER                  Refer#: NONE
  To: VICTOR YIU                    Recvd: NO  
Subj: Re: Compression                Conf: (2) Quik_Bas
On (14 Oct 92) Victor Yiu wrote to Eric B. Ford...

 VY>  -=> Quoting Eric B. Ford to Quinn Tyler Jackson <=-
 VY>
 VY>  EBF> 'Eric's Packing routine for progrmas that are text files.
 VY>
 VY>  Where's the decompressor?

 I don't think Eric wrote this routine but since he's taking credit
 for it it's not up for me to say. Anyway the rest of it is here...

==========================8< Cut Here 8<=============================

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  From: RICHARD VANNOY
    To: JOHN STRONG                                 Date: 25 Jul 91
  Subj: File Compression
  Attr:
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DECLARE SUB Pack (Text$)
DECLARE SUB UnPack (Text$)
DEFINT A-Z
Text$ = "This is a test, see how it works."
PRINT Text$, "Len = "; LEN(Text$): PRINT
CALL Pack(Text$)
PRINT Text$, , "Len = "; LEN(Text$): PRINT
CALL UnPack(Text$)
PRINT Text$, "Len = "; LEN(Text$)
'
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
'
SUB UnPack (Text$)
   D1$ = "abadafagahalamanaparasatbabbbebiblbobrcacccechclcocrdaddd"
   D2$ = "edredefehemenesetfafefiflfofrgageghgihahehihoicidifigihil"
   D3$ = "iminirisitjajejijojuouuekakekikokrlalilllnloltlymamemimon"
   D4$ = "anengninknnnontobocodofolomonoporosotpapepippqurardrerrro"
   D5$ = "sasesisssttatetitothunupwawe"
   Dict$ = D1$ + D2$ + D3$ + D4$ + D5$
   temp$ = Text$
   Text$ = ""
   FOR x = 1 TO LEN(temp$)

      char = ASC(MID$(temp$, x, 1))
      IF char > 126 THEN
         Text$ = Text$ + MID$(Dict$, (char - 127) * 2 + 1, 2)
      ELSE
         Text$ = Text$ + MID$(temp$, x, 1)
      END IF
   NEXT
END SUB
==========================8< Cut Here 8<=============================


 תש [-M-H-B-] שת


--- PPoint 1.35
 * Origin: Terminal Oasis, Portland OR (1:105/330.5)
Outer Court
Echo Basic Postings

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