README File for QuickBasic Compiler 1.00 for Apple Macintosh (34286)
The information in this article applies to:
- Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0
This article was previously published under Q34286 SUMMARY
The following article contains the complete contents of the README
file distributed with Microsoft QuickBasic version 1.00 for the Apple
Macintosh.
MORE INFORMATION
README File
Release Notes for Microsoft QuickBasic for
Apple Macintosh Systems
Version 1.0
Copyright Microsoft Corporation, 1988
This document contains information about version 1.0 of Microsoft
QuickBasic for the Macintosh and its associated libraries.
The information in this document is more up to date than that in the
manuals.
Microsoft updates its languages documentation at the time of
reprinting, so some of the information in this on-line file may
already be included in your manuals.
You may want to print this file to supplement your manual.
Requesting Assistance from Microsoft
If you need to contact Microsoft Technical Support for assistance, the
phone number is (425) 646-5101. [phone changed from original README]
Contents
This file has four parts.
Part Note
1 Notes for the Microsoft QuickBasic Language Reference
2 Notes for the Microsoft QuickBasic User's Guide
3 Printing Graphics
4 Warnings and Notes
Part 1: Notes for the Microsoft QuickBasic Language Reference
Page Note
184 LIST Command (Undocumented Command Feature)
You can move to a specific numbered or labeled line by typing
"LIST <line>" in the command window. The compiler does not
allow this command in a program.
323 System Function (New SYSTEM(7) Function)
SYSTEM(7) returns the file reference number of the resource
fork of the program source file when the program is
interpreted. It returns the file reference number of the
application resource fork in a compiled application. SYSTEM(7)
can be combined with the GetPathName subprogram to find your
program's full path name. See the "GetPathNames" demo program
on the Examples disk.
418 Using the Statement Mover Program
Compile Statement Mover for speed. Unlike previous versions of
Statement Mover, this one does not automatically move LIBinits.
If your library requires LIBinits, you must copy it.
419 The Library Statement - Custom LIBinit and LIBterm
These routines are called only with LIBRARY and LIBRARY CLOSE.
If your custom libraries need LIBinit and LIBterm, you must
explicitly call them, or use LIBRARY and LIBRARY CLOSE.
421 The Library Statement - Calling Library Routines
You now need to specify a type ('&','!', '#') for a library
call only after DEFSTR; DEFINT no longer requires a type. For
example:
DEFINT a-z
DrawText "No more exclamations on library invocations!"
483 Reference Guide for Toolbox Library Statements
These new library routines were added after the manual was
printed.
Routine and Description
475 BackColor color
color: see the description under the ToolBox ForeColor call for
the values of "color." This routine is faster than the ToolBox
version and the "color" argument more flexible.
475 BlockMove sourceAddr&,destAddr&,bytes&
sourceAddr&: address to begin copying from
destAddr&: address to begin copying to
bytes&: number of bytes to copy
BlockMove works even when the areas overlap.
477 CopyFile sourceFile$,destName$
Copies the file with name sourceFile$ to destName$. Copies both
the data and resource forks of the file.
479 Eject
Ejects the disk in the internal drive. This is an MBPC resource.
480 Exists fileName$,flag%
fileName$: full path of file, or simple name in current folder
flag%: 0 = file does not exist, 1 = file exists
480 ForeColor color
See BackColor
481 GetCatInfo IOPB%(0),FileName$[,DirID&][,VolRefNum%] [,DirIndex%]
GetFCBInfo IOPB%(0),FileName$[,ioRef%][,VolRefNum%] [,FCBIndex%]
DIM IOPB%(128)
See the "GetPathName" demo on the Examples Disk or Inside
Macintosh Vol. 4 for more details of these calls.
481 GetChanRefNum% Chan%,RefNum%
Returns the file reference number of the file with QB channel
number Chan%. Chan% is the file number you opened the file
under (OPEN f$ AS #1).
482 GetHandleSize h&,size&
Returns the size of a resource in bytes when given the
resource's handle.
519 ScrollText H&,rec%(0),a$(0),top%,rows%[,num%[,delay%[,leading%]]]
Scrolltext now has an additional optional parameter that
specifies the leading (space between lines) in pixels. The
default is 4 pixels.
523 SubLaunch appName$ [,fileName$] [,finderMsg%] [,fileType$]
appName$: full path name of application to sublaunch
fileName$: full path name of file to Open or Print.
finderMsg%: 0 = Open, 1 = Print, 256 = Compile (QB only)
fileType$: type of file fileName$.
527 Controlling Memory (Loading Files)
Since QB initially allocates one third of the memory listed in
the SIZE resource to the data area (about 100K), and QB reads
your program into the data area, programs larger than 100K
produce the "Out of memory" error. You can change the SIZE
resource either with ResEdit or with "Get Info" for QB under
MultiFinder, Finder 6.1 or later.
527 How Much Memory Do I Need?
Most programs will never need to change memory allocations, but
programs with huge data requirements may use the CLEAR
statement to access more memory:
' Leave some heap for Desk Accessories and printer drivers.
' 100K is a good starting point.
heap&=100*1024&
max&=FRE(0)+FRE(1)-heap&
CLEAR ,max&
You will seldom need CLEAR's stack argument. Since the stack
uses very little memory, there is usually no need to reduce it.
In programs with CHAINed modules, you may have to change the
stack size for the compiled application if you get "error 7" at
the CHAIN statement. Compile all the modules with the "Create
Program List File" option on and look in the listings under
STORAGE in the "Symbol and Label Tables for: MAIN." Your main
module needs to clear enough stack space for the largest
STORAGE entry with code similar to this:
' As above, heap& is the heap space. stack& is the stack space
heap&=100*1024& 'fill in the actual heap& you want to leave
stack&=10000& 'use value from 'lst' file for the largest module
IF SYSTEM(4) THEN 'compiled
CLEAR,FRE(0)+FRE(-1)-heap&-stack&,stack&
ELSE 'interpreted
CLEAR,FRE(0)+FRE(-1)-heap&
END IF
544 Error Messages: CODE Resources Conflict
This new message indicates that you have used libraries from
previous versions of Basic. Use the new library routines
instead. For most programs, it is sufficient to comment out all
the LIBRARY statements and compile with "Copy MBLCs and MBPCs"
switch enabled. See also "Old Libraries" and "QB And Basic 3.0
On The Same Disk" in Part 4, Notes and Warnings.
Part 2: Notes for the Microsoft QuickBasic User's Guide
16, 53 New Search Menu Features
Microsoft QuickBasic has several new Search menu features to
make navigating your programs much faster.
Several of these features are token-based. A "token" is a
Basic keyword, variable name, subprogram name, or label.
Anything highlighted when you double click is also a token.
The following list adds to or clarifies information about the
Search menu.
17 Find Definition
With the insertion point in a line or label reference,
subprogram name, or FN function name, QB scrolls the list
window to that name's definition. The insertion point does not
move, so you can return to it by pressing an arrow key or
choosing Find Insertion Point from the Search menu.
For label references, QB shows the label. For a subprogram
name, QB shows the SUBI statement. For an FN, QB shows the DEF
FN statement.
This does not work for other tokens. The search is much faster
than Find.
It is handy to keep a list of your important subprograms and
labels in a comment at the start of the file so you can "Jump
To" line 1, then "Find Definition."
17 Find Selected Text
This has the same effect as typing the highlighted text in the
Find dialog. After executing this command, the text appears in
the Find dialog, which allows the Find Next command to
continue searching.
18 Jump To
Enter the source line offset number (not the Basic line
number). The number displayed in a compiled application's run
time error dialog is the source line offset number for that
error. This command makes it easy to find the offending line.
To jump to the beginning of a file, type COMMAND-J, "1," and
<RETURN>. To jump to the end of a file, type COMMAND-J, enter
any letters (just press your hand on the keyboard), and press
<RETURN>.
18 Set Info
If you Set Info on a new token, the 'info' is saved in the
resource fork of your source file. You can move 'info' entries
you define to QB by typing "MBUI" into the "other" dialog in
the Statement Mover program, or by using ResEdit.
19 The Run Menu: Command-k
As a compiling convenience, Command-k compiles the file with
the last name you picked for the application. This saves
reaffirming the application name every time you compile. The
first time you compile (no matter which menu item you use), QB
will ask for a name. Command-k is the same as choosing
"Compile"; Option-Command-k is the same as "Compile As."
98 Setting Compiler Options: Save Before Compiling
This new option in the Options dialog box automatically saves
the source file before you compile, saving a step in the
edit-compile process.
152 Creating Application Icons With ResEdit
Summary:
The following resources (located in a compiled QuickBasic
application) can be modified with ResEdit to give an
application and its documents their own customized icons:
BNDL; FREF; ICN#; and the sample "signature" resource, "MBCB".
The information in the Finder's Get Info dialog box for the
application can also be specified.
Procedure:
You can create a compiled program with its own icon, and it
can create document files with their own icons. A document
file can be assigned its own icon by changing its file and
creator types to correspond to resource information stored in
the compiled application. The icon for a given document file
type is taken from the resource fork of the compiled
application and stored in the Finder's Desktop file.
The default creator type is "EDIT" and the default file type
is "TEXT" for files created with the OPEN statement. The
creator and file types of a document must be changed by your
QuickBasic program after the file is created.
1. Change the creator type of a document using the SetCreate
MBLC library routine, as follows:
SetCreate docfile$,"MYAP"
2. Change the file type using the NAME statement, as follows:
NAME docfile$ AS docfile$,"MYFT"
Double clicking a document icon runs the associated
application. By PEEKing through a handle to the application
parameters, your application can determine which file was
selected. See "File Browser.source" on the Examples disk for
sample code that does this.
Here are step-by-step instructions for creating your own
icons:
1. Compile a program using Microsoft QuickBasic. For this
example, assume the compiled program is called "MYPROGRAM
apl".
2. Run ResEdit.
3. Double click on the "MYPROGRAM apl" application.
4. Select New from the File menu, then do the following:
a. Type a unique creator resource type, for example: "MYAP"
b. The following window appears: "MYAP's from MYPROGRAM apl"
c. Select New from the File menu.
d. Close the new resource window.
e. Choose Get Info from the File menu and change the number
which appears in the first "ID:" box to 0 (zero).
f. Close the window.
g. Perform the following steps if you wish to put a string in
the file's Get Info box in the Finder:
i. Select the new resource, and choose Open As from the
File menu.
ii. Select type "STR " (NOT "STR#").
iii. Type the text which you wish to appear in a Get Info
from the Finder.
iv. Close windows.
If you do not want text to appear in the Get Info
window, then open the resource, and type three zeros.
5. Double click on BNDL, then do the following:
a. Double click on "BNDL=128"
b. Change OwnerName to be the same as the unique,
four-character, application resource type used in step
4a ("MYAP").
c. Close two windows.
6. Perform this step if you want custom document icons:
a. Double click on FREF.
b. Double click on "FREF=129".
c. Change the "File Type" to "MYFT" This is the type used
in the NAME statement in the "MYPROGRAM apl" program.
d. Close two windows.
No other program will be able to open your documents. You
do not need to change the file type if your application
creates plain text files (type TEXT).
7. Double click on ICN#.
a. Edit the application icon and, if desired, the document
icon. Then select "Data to Mask" from the ICN# menu.
b. Close Three windows.
c. Click YES to Save.
8. While the "MYPROGRAM apl" application is highlighted,
select Get Info from the File menu.
a. Change the Creator to the unique four character
application creator resource name, used in step 4a:
"MYAP"
b. Close the window.
c. Click YES to Save.
9. Rebuild the Macintosh Desktop in either of the following
ways:
a. While holding down the COMMAND and OPTION keys, select
Quit from the File menu, and keep holding down the
COMMAND and OPTION keys until a dialog box appears.
Click YES to rebuild the Desktop.
b. Or, select the DeskTop file in ResEdit, and choose Clear
from the Edit menu. Quitting ResEdit now rebuilds the
DeskTop.
Additional Document Types
To add an icon for an additional file type that your application
creates, add another icon to the ICN#, another FREF, and entries for
the icon and FREF in the BNDL resource.
To add the FREF, open your application with ResEdit, and open the
FREFs. Select New to create a new FREF, then set the file type to your
new type, and set a new localID (3 for the first additional file
type). Close the FREF and select Get Info to change the resource ID to
the next in line (130 for the first additional file type).
To add an icon, open the ICN# in the application. Select New or
Duplicate to create a new icon. Alter as you like, close it, Get Info,
change the ID (again, 130 for the first additional).
Now open the application's BNDL. Find the line of dashes under the
ICN#. Click on the line and select New. Fill in the localID and
Resource ID to correspond with the icon and FREF you created. Do the
same with the line of dashes under FREF.
As before, you must rebuild the Desktop to see the new icons.
Part 3: Printing Graphics
Additional Information On Printing Graphics
Printing Graphics is the same as printing to the screen. Use WINDOW
OUTPUT #n after opening the printer, and all graphic calls (except
BACKPAT) will go to the printer. LINE (0,0)-(551,729),,b will outline
the drawable area on a LaserWriter page when printed at 100%.
If you want to print the window contents, record a picture as you draw
the screen, then replay the picture to the printer. Follow this
general outline:
PICTURE ON :SHOWPEN 'make drawing visible
'
' draw the window contents
' (PICTURE and PUT work here, too!)
'
PICTURE OFF :HIDEPEN
windowPic$=PICTURE$
'
OPEN "lpt1:prompt" FOR OUTPUT AS #1
WINDOW OUTPUT #1
PICTURE ,windowPic$
CLOSE #1
You can also use the resulting picture to refresh the screen. Pictures
are usually more compact than GET arrays and preserve color in
addition to printing faster on a LaserWriter.
Screen Dumps
Use the "PrintScreen" subprogram in the "Utilities SUBs" file to send
a copy of your screen to a printer. Unlike LCOPY, this works for color
screens and LaserWriters. "PrintScreen" is in the "Utility SUBs"
folder on the Examples disk, along with a "PrintWindow" utility.
Examples
"Calendar" on the Examples disk contains sample graphics printing.
Part 4: Warnings and Notes
Warnings
Strange Error Messages
If you get an interpreter error message that does not make sense, try
compiling the program. If the error is reported by the compiler, run
the program in the interpreter. The interpreter and the compiler read
your program differently, so one may provide a better error message
than the other. When the highlighted text and error message do not
match, or when nothing is highlighted, turn on the "Create Error List
File" option in the Options dialog box and compile the program. The
'<filename> lst' file will show more precisely where the error
occurred. It can show more than one error at a time.
Compiled Application Run-Time Errors
Errors that occur at run time in a compiled application do not display
a message. Only the error number is displayed. The error message may
be discovered by typing "ERROR <#>" in the QuickBasic environment
command window.
Old Libraries
If your program mysteriously crashes, old CODEs can be the cause. If
you need to use older custom libraries, make sure the ID numbers for
those CODE resources are greater than 100. Compile and run the
"Renumber CODEs" utility on the Examples disk in the "Tools" folder.
TMON Users Beware
Single voice sound can crash if TMON is active. To avoid this, insert
"WAVE 0,SIN" at the beginning of your program.
Notes
QB and Basic 3.0 on the Same Disk
QB will give the files it creates or saves the same creator type as
QB, whatever it may be. The default is the same as Basic 3.0. If you
want QB to work on the same disk with Basic 3.0, change its creator
type from "MSBB" to "msbb" with ResEdit (use Get Info). To make your
changes visible, delete the desktop file with ResEdit (select Clear
from the Edit menu), or restart while holding down the command and
option keys. QB includes an alternate BNDL resource for the "msbb"
type. For the decimal version, change the creator type from "MSBA" to
"msba."
Basic 3.0 files (creator=MSBB) will have the Basic document icon and
will start up Basic 3.0 when double clicked. QB files (creator=msbb)
will have the QB icon and start up QB when double clicked. QB can open
files created by QB or Basic 3.0. Basic can see QB files, but will
produce a "Bad file mode" error if you try to open a QB compressed
file.
Slow Printing
The PRINT command sends the screen or printer one character at a time.
Use the DrawText library routine to send an entire string at once.
This will speed text printing to the screen or graphics devices. You
still need to use PRINT for number formatting or carriage returns.
New Run-Time Names
If you want to keep the run time libraries separate and change the
names, you must change the application "STR" resources id=9300-9303
with ResEdit to the names you prefer. QB will look for them in the
folder named in the STR 9300 resource.
Resources in Your Source
The DITL 128, DLOG 128, and STR 128 resources are for the About...
dialog box.
MBCO 0: compiler options
MBAN 0: compiled application name
MBPN: File path name
MBUI: MBUI resources are created when you use Set Info for a new word.
MBLC, MBPC: If you put any of these resources in the resource fork of
your source file, and the "Copy MBLCs and MBPCs" switch is enabled,
they will be automatically copied to the application each time it
compiles. A LIBRARY statement in your program is not required.
Resources in Your Application
BNDL: application and document icon support
CODE: application code
DITL: 128 About
DLOG: 128 About
FREF: application and document icon support
ICN#: sample application and document icons
MBAV: application version (used to verify run time)
MBCB: "signature" resource (application and document icon support)
MBCI: compiler information
MBLC: library code resources
MBPC: pure code resources
MBPN: File path name
MBRL: 0 (binary), 1 (decimal), or 2 (68881) run time support code.
PREC 0: LPT1:PROMPT page sizes
SIZE -1: MultiFinder information
STR 128: About 93xx run time path and file names
Modification Type: | Minor | Last Reviewed: | 1/8/2003 |
---|
Keywords: | KB34286 |
---|
|