Area: Quik_Bas Msg: #385 Date: 01-11-93 10:36 (Public) From: Rick Pedley To: David Basile Subject: Re: Qb info
DB> written by a QB pro <grin> that will show you some of DB> these like how to make your file smaller, use less memory, DB> execute faster. Here's a utility posted a while back that examines your source and determines which stub files can be linked to make the EXE smaller. It writes the info into a file ending in .RPT (e.g. if your source file is PROG.BAS, the report file is PROG.RPT): ============================================================ ================ Area: Quik_Bas Msg: #252 Date: 07-03-92 22:55 (Public) From: Zack Jones To: Mike Phillips Subject: Stubscan ============================================================ ================ > TH> Try contacting ZACK JONES regarding BC7STUB.BAS... I'm not sure > TH> if he wrote it or just modified it, but I think he's probably > TH> the one you want. It's supposed to be floating around here, > TH> but it hasn't made it into the midwest yet as far as I can > TH> tell. I'd like ot see it, too... I just modified it. Here it is: 'STUBSCAN.BAS 03-14-90 T.E.M. Scan .BAS for stub file conflicts. '
-- ON ERROR GOTO E.Handler False% = 0: True% = -1 NOFLTIN& = -1 ' Init as true...can be used. NOEDIT& = -1 NOCOM& = -1 NOLPT& = -1 SMALLERR& = -1 '
-- COLOR 15, 0: CLS PRINT STRING$(50, 196) PRINT STRING$(2, 196); PRINT " STUBSCAN parses .BAS for stub file conflicts "; PRINT STRING$(2, 196) PRINT STRING$(50, 196) '
DIM PROPELLER$(4) PROPELLER$(1) = "|": PROPELLER$(2) = "/" PROPELLER$(3) = CHR$(196): PROPELLER$(4) = "\" IPROP% = 1: OPROP% = 1 ' Pointer to action propeller characters '
IROW% = CSRLIN IFILE$ = COMMAND$ IF IFILE$ = "" THEN INPUT "Enter INPUT <.BAS> path\filename: ", IFILE$ PRINT STRING$(50, 196) IF IFILE$ = "" THEN GOTO PgmExit IFILE$ = UCASE$(IFILE$) Temp% = INSTR(IFILE$, ".") zIFILE$ = LEFT$(IFILE$, (Temp% - 1)) ' Trim any filetype IF Temp% = 0 THEN IFILE$ = IFILE$ + ".BAS" '
- RPTFILE$ = zIFILE$ + ".RPT" 100 CLOSE 1: OPEN IFILE$ FOR INPUT AS #1 '200 CLOSE 2: OPEN "STUBSCAN.RPT" FOR OUTPUT AS #2 CLOSE 2: OPEN RPTFILE$ FOR OUTPUT AS #2 201 PRINT #2, " " PRINT #2, IFILE$; " BASIC source file as of "; PRINT #2, DATE$; " at "; LEFT$(TIME$, 5); " o`clock." PRINT #2, " " PRINT #2, "Line --Stub-- Source statement which may conflict..." PRINT #2, "---- -------- --------------------------------------" '
- WHILE NOT EOF(1) IF NOT EOF(1) THEN LINE INPUT #1, R$ ICOUNT& = ICOUNT& + 1 R$ = LTRIM$(R$) ' Trim leading spaces RLEN% = LEN(R$) IF RLEN% < 2 THEN GOTO NextRecord R$ = UCASE$(R$) ' Toupper Temp$ = LEFT$(R$, 1) IF Temp$ = "'" THEN GOTO NextRecord Temp$ = LEFT$(R$, 3) IF Temp$ = "REM'" THEN GOTO NextRecord IPROP% = IPROP% + 1: IF IPROP% > 4 THEN IPROP% = 1 LOCATE IROW% + 1, 15: PRINT "Working "; : LOCATE , 25: PRINT PROPELLER$(IPROP%); ' Action propeller Temp% = INSTR(R$, "FOR INPUT ") ' This one is OK IF Temp% <> 0 THEN GOTO EndInput Temp% = INSTR(R$, "INPUT ") IF Temp% = 0 THEN GOTO EndInput NOFLTIN& = False%: Conflict$ = " NOFLTIN " GOSUB F.WriteReptLine NOEDIT& = False%: Conflict$ = " NOEDIT " GOSUB F.WriteReptLine EndInput: Temp% = INSTR(R$, "VAL(") IF Temp% <> 0 THEN NOFLTIN& = False%: Conflict$ = " NOFLTIN " GOSUB F.WriteReptLine END IF Temp% = INSTR(R$, "READ ") IF Temp% <> 0 THEN NOFLTIN& = False%: Conflict$ = " NOFLTIN " GOSUB F.WriteReptLine END IF Temp% = INSTR(R$, "LPT1: ") Temp2% = INSTR(R$, "LPRINT") IF (Temp% <> 0) OR (Temp2% <> 0) THEN NOLPT& = False%: Conflict$ = " NOLPT " GOSUB F.WriteReptLine END IF Temp% = INSTR(R$, "COM1:") Temp2& = INSTR(R$, "COM2:") IF (Temp% <> 0) OR (Temp2& <> 0) THEN NOCOM& = False%: Conflict$ = " NOCOM " GOSUB F.WriteReptLine END IF NextRecord: WEND PRINT PRINT STRING$(50, 196) PRINT "BASIC source file lines in.....: "; ICOUNT& PRINT "Conflict report is in file.....: "; RPTFILE$ PRINT STRING$(50, 196) IF NOFLTIN& THEN PRINT "NOFLTIN can be used." IF NOEDIT& THEN PRINT "NOEDIT can be used." IF NOCOM& THEN PRINT "NOCOM can be used." IF NOLPT& THEN PRINT "NOLPT can be used." IF SMALLERR& THEN PRINT "SMALLERR can be used." PRINT STRING$(50, 196) Stub$ = "" IF NOFLTIN& THEN Stub$ = Stub$ + "+NOFLTIN" IF NOEDIT& THEN Stub$ = Stub$ + "+NOEDIT" IF NOCOM& THEN Stub$ = Stub$ + "+NOCOM" IF NOLPT& THEN Stub$ = Stub$ + "+NOLPT" IF SMALLERR& THEN Stub$ = Stub$ + "+SMALLERR" IF Stub$ = "" THEN GOTO EndStubBat ' No bat file since no stubs ' Get the bare file name to build the .OBJ filename in STUB.BAT... IFILE$ = UCASE$(IFILE$) Temp% = INSTR(IFILE$, ".") IF Temp% <> 0 THEN IFILE$ = LEFT$(IFILE$, (Temp% - 1)) ' Trim any filetype END IF TLEN% = LEN(IFILE$) Chop% = 0 FOR Temp% = 1 TO TLEN% ' Look for rightmost "\" or ":" to chop leading C$ = MID$(IFILE$, Temp%, 1) IF (C$ = "\") OR (C$ = ":") THEN Chop% = Temp% NEXT Temp% IF Chop% <> 0 THEN IFILE$ = RIGHT$(IFILE$, (TLEN% - Chop%)) '----------------------------------------------------------- Bat$ = IFILE$ + ".BAT" 'CLOSE 1: OPEN "STUB.BAT" FOR OUTPUT AS #1 CLOSE 1: OPEN Bat$ FOR OUTPUT AS #1 PRINT #1, " @Echo OFF" PRINT #1, " Rem STUB.BAT for "; IFILE$; ".OBJ screened by STUBSCAN.EXE" PRINT #1, " LINK /NOE "; IFILE$; ".OBJ"; PRINT #1, Stub$; ";" CLOSE 1 'PRINT "STUB.BAT will link stubs with "; IFILE$; ".OBJ." PRINT Bat$; " will link stubs with "; IFILE$; ".OBJ." EndStubBat: PRINT STRING$(50, 196) PRINT "NOTE:" PRINT "Review "; RPTFILE$; " report file. It may" PRINT "be possible to use additional stub files." PRINT STRING$(50, 196) ' GOTO PgmExit '------------ F.WriteReptLine: 300 PRINT #2, USING "####"; ICOUNT&; PRINT #2, Conflict$; " "; R$ 301 RETURN '------ E.Handler: IF ERL = 100 THEN PRINT IFILE$; " not found or error OPENing it. Halting." GOTO PgmExit END IF -end-
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