PostIt! 6.0 5/16

 BBS: Inland Empire Archive
Date: 04-02-93 (23:00)             Number: 328
From: VICTOR YIU                   Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: PostIt! 6.0   5/16             Conf: (2) Quik_Bas
'>>> Start of page 5.

SUB ExtractFile
SHARED Good$

PRINT
PRINT "Examining "; SourceFile$; "..."
COLOR 7
CLOSE
OPEN SourceFile$ FOR INPUT AS #1 LEN = 4096     ' open file

DO
    IF NOT EOF(1) THEN
        LINE INPUT #1, A$
    ELSE
        GOTO ErrorReading
    END IF
LOOP WHILE LEFT$(A$, 13) <> "~PostIt! 6.0~"  'search for header

NewFile$ = MID$(A$, 14)
NxtTilde = INSTR(NewFile$, "~")

IF NxtTilde = 0 THEN GOTO ErrorReading
NewFile$ = LEFT$(NewFile$, NxtTilde - 1)  ' get filename
OPEN NewFile$ FOR BINARY AS #2                     ' open...

PRINT "Loading "; SourceFile$; "..."

DO
    IF EOF(1) THEN GOTO ErrorReading    ' end of file already?

    LINE INPUT #1, A$                      ' get a line

    SELECT CASE LEFT$(A$, 1)
        CASE "~"
            IF NOT QuoteOn THEN
                EXIT DO                     ' end; quit loop
            END IF
        CASE "a" TO "z", "A" TO "Z", "#", "$", "(" TO "9"
            IF NOT QuoteOn THEN
                FOR Q = 2 TO 9              ' expand the string
                    Look$ = MID$(ComprChar$, Q - 1, 1)
                    S = 1
                    DO
                        S = INSTR(S, A$, Look$)
                        IF S THEN
                            A$ = LEFT$(A$, S - 1) + STRING$(Q,_
 97) + MID$(A$, S + 1)
                        END IF
                    LOOP WHILE S
                NEXT

                Dat$ = Dat$ + RTRIM$(A$)   ' nope, collect dust
            END IF
        CASE "'"
            QuoteOn = NOT QuoteOn
        CASE ELSE                     ' just comments or junk
    END SELECT
LOOP

Siz = VAL(MID$(A$, 2))                ' extract size of file

NxtNum = INSTR(2, A$, "~")            ' look 4 next ~ occurence
IF NxtNum = 0 THEN GOTO ErrorReading  ' none?  Error!
CheckVal = VAL(MID$(A$, NxtNum + 1))  ' get checkval

PRINT "Decoding "; SourceFile$; "..."
PRINT STRING$(50, 178);     ' print initial bar
LOCATE , , 0

DIM P(6)
FOR P = 0 TO 6: P(P) = 2 ^ P: NEXT

n = Siz
k = 255

V! = 50 / n
FOR A = 1 TO n          ' decode file
    IF L = 0 THEN
        GOSUB G
        L = 6

        LOCATE , 1

'>>> Continued on page 6

--- Blue Wave/RA v2.12 [NR]
 * Origin: Hard Disc Cafe | Houston Texas | (713) 589-2690 |  (1:106/30.0)
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