PostIt! 6.0 14/16

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

    B$ = Num2Str$(CurrentPage)     '--> MHB
    PRINT #2, "'>> Continued on pg. "; B$
    CLOSE #2

    F$ = UCASE$(DestFile$ + B$ + DestExten$)

    PRINT "Now writing: "; F$; " ";
    Row = CSRLIN: Col = POS(0)

    OPEN F$ FOR OUTPUT AS #2 LEN = 8192

    PRINT #2, "'>> Start: pg. "; B$
    LinesOut = 1
END IF

TotalLinesOut = TotalLinesOut + 1

PRINT #2, A$

' Originally, Mark hardcoded a space after each line, but I
' had to remove it to make compression work properly... -VY

LinesOut = LinesOut + 1
IF LinesOut >= PageLength THEN NewFileFlag = True

END SUB

'Adds a character to the output string.
SUB PutByte (A)
SHARED Good$
STATIC ALength

IF CurrentBit < 0 THEN LastOne = True

BytesOut = BytesOut + 1

    'calculate a checksum on the encoded data stream
CheckSum = (CheckSum + A) * 2
CheckSum = CheckSum \ 256 + (CheckSum AND 255)

IF (A = 0) AND (LastOne = False) THEN
    IF ALength = 9 THEN
        ALength = 1
        Work$ = Work$ + "/"
    ELSE
        ALength = ALength + 1
    END IF
ELSE
    SELECT CASE ALength
        CASE 0
            'translate the output character into something safe
            Work$ = Work$ + MID$(Good$, A + 1, 1)
        CASE 1
            Work$ = Work$ + "a" + MID$(Good$, A + 1, 1)
            ALength = 0
        CASE ELSE
            Work$ = Work$ + MID$(ComprChar$, ALength - 1, 1) +_
 MID$(Good$, A + 1, 1)
            ALength = 0
   END SELECT
END IF

IF LEN(Work$) >= LineLength THEN
    IF LEN(Work$) = LineLength THEN
        PrintLine Work$
        Work$ = Prefix$
    ELSE
        PrintLine LEFT$(Work$, LineLength)
        Work$ = Prefix$ + MID$(Work$, LineLength + 1)
    END IF
END IF

END SUB

SUB PutBytes (A)

    'shift the 8 bit character into the work buffer
Char = Char + A * Shift(CurrentBit)

    'we've got 8 more bits now
CurrentBit = CurrentBit + 8

'>>> Continued on page 15

--- 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