Prototype 1/3

 BBS: Inland Empire Archive
Date: 04-10-93 (08:22)             Number: 331
From: RICH GELDREICH               Refer#: NONE
  To: VICTOR YIU                    Recvd: NO  
Subj: Prototype 1/3                  Conf: (2) Quik_Bas
'________O_/________________________| SNIP
|______________________\_O_______
'        O \                        | HERE |                      / O
'This file created by PostIt! v6.0.
'>>> Start of page 1.

'Prototype PostIt! script creator. Created April, 1993
'This  simple  program  creates  a  newer  type  of  PostIt!  self
'extracting script that decodes very quickly and can handle  files
'up  to 34,000 bytes.
'
'This script eliminates the "middle  man"  by  outputting  to  the
'destination  file directly in the G sub.  This speeds up decoding
'and lowers memory usage  because  we  don't  have to first append
'each G line onto a string before  the  file  is  decoded.   Since
'we're  not using strings anymore, the only limit that remains now
'is QB's  internal limit on  how  large  a program may be(it might
'actually be a dgroup limitation, not positive yet).
'
'I haven't extensively tested the scripts this program creates, so
'use with caution.
'
'To decode a script created by  this  program  directly  from  the
'command line just type:
'
'       QB/run<script> or QBASIC /run<script>
'
'Where  <script>  is  the name of the script to decode, of course.
'You still have to edit  out  any  garbage  in the file, I haven't
'worked out any way for the self extractor to do that, yet...
'
'If the file gets decoded correctly, the script will  exit  right
'back   to   DOS   without   making  you  lift  a  single  finger.
'(Unfortunatly PDS prompts  you  if  to  save  the  file after the
'script is decoded.  I don't know if there is  a  way  to  disable
'this, so use QB4.5 or QBASIC instead.)
'
'If a  CRC  error  does  occur  the  script  stays  in  the QB/QBX
'environment so you can check it out for garbage.
'
'If  you  don't  want  to  exit  back  to DOS after the script is
'decoded, then just don't use the /run option on the command line.

DEFINT A-Z

DECLARE SUB EncodeStart ()
DECLARE SUB EncodeBlock ()
DECLARE SUB EncodeEnd ()

DIM BytesLeft AS LONG

DIM SHARED I$
DIM SHARED InputBuffer$, BytesRead
DIM SHARED GoodChars$
DIM SHARED BitBuffer, BitsInBuffer
DIM SHARED OutputLine$, OutputPos, LinesWritten
DIM SHARED RunningCRC
DIM SHARED Power2(0 TO 7)

IF POS(0) <> 1 THEN PRINT
PRINT "PostIt! Prototype Script Encoder By RG"
INPUT "Input file"; I$
INPUT "Output file"; O$

OPEN I$ FOR BINARY AS #1
BytesLeft = LOF(1)
IF BytesLeft = 0 THEN
    CLOSE
    KILL I$
    PRINT I$; " wasn't found."
    END
ELSEIF BytesLeft > 34000 THEN
    PRINT I$; " is too big for one script."
    END
END IF

OPEN O$ FOR OUTPUT AS #2 LEN = 4096

EncodeStart

InputBuffer$ = SPACE$(4096)
BytesRead = 4096

'>>> Continued on page 2

--- MsgToss 2.0b
 * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)
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