It consists of a complete integrated development environment (IDE), editor, project manager, debugger, profiler and compiler for both PowerPC and Motorola 68000 microprocessors. Since 1 January 2008, the package also contains a cross compiler, FBtoC, that converts the FutureBASIC syntax to C and automatically calls Apple's GNU Compiler Collection (gcc). FutureBASIC supports access to Mac OS library calls. The integrated compiler is extremely efficient: on a Dual 1 gig G4, it will zip through 850,000 characters (850 pages) of source code per second. The resulting code is tight and also very fast, near C speeds. Unlike other BASIC language implementations there is not a p-code stage; the applications are standalone programs, "double-clickable", and do not require a separate interpreter.
The transition from 68k to PowerPC central processing unit (CPU) was a lengthy process that involved a complete rewrite of the editor by Chris Stasny and an adaptation of the compiler by Andy Gariepy. This was undertaken during Apple's darkest days when the further existence of the Mac and Apple itself was in the news every week. The result of their efforts, a dramatically enhanced IDE called FB^3, was released in September 1999, featuring among many other things a separate compiler application, various open, hence modifiable runtimes, inline PPC assembly, a simplified access to the Macintosh Toolbox Application Programming Interface (API), as well as an expanded library of built-in functions. Major update releases introduced a full-featured Appearance Compliant runtime written by Robert Purves and the Carbon compliance of generated applications. Once completely carbonized to run natively on the Mac OS X, the FutureBASIC Integrated Development Environment (FB IDE) was called FB4 and first released in July 2004.
Based in Diamondhead, Mississippi, Staz Software was severely hit by Hurricane Katrina in August 2005 and development pace was slowed at a time when major effort was required to keep the IDE up to date with Apple's evolution towards the Intel-based Macintosh. More recently, an independent team of volunteer FB programmers developed a cross-compiler (FBtoC) that allows FB to generate applications as Universal Binaries through the use of the open source GCC compiler which is included with each copy of Apple's Mac OS X system software. On January 1 2008, Staz Software announced that FB4 would henceforth be freeware and FBtoC 1.0 was made available.
FutureBASIC continues to support several versions of Mac OS
System requirements to create universal binaries with FBtoC: Mac OS X v10.4 or higher, GCC 4.0 or higher, and the Cross-development SDKs must be installed.)
Specific structures (ENTERPROC/EXITPROC) are used for callback procedures when calling the Macintosh Toolbox.
The language provides the programmer with a complete set of vectors for event-driven applications, such as ON MENU, ON MOUSE, ON DIALOG, ON APPLEEVENT, ON EDIT, ON TIMER, etc.
Other structured keywords include conditional blocks such as:
An example of a simple program to input a number and display "Hello World" is given below
//Example FutureBASIC program
dim i,num,a$ //These are our variables
window 1 //open standard window input "Number of loops "; a$ //BASIC input from user num=val(a$) //convert text to number long if num>0 //Structured IFfor i = 1 to num //BASIC loopprint "hello world" //output textnext i //end of loopxelse //Otherwiseprint "Not today" //no number enteredend if
do //Wait until Apple-QHandleEventsuntil (gFBQuit ) //so that we can see results
Other alternate syntax borrowed from C allows the use of operators such as ++ -- == != += -= || &&
Characters in Pascal strings are accessible much like items of an array: a$ (length byte); a$ (first character in string a$).
While the FutureBASIC language still supports old style variable typing with suffix identifiers, it provides a modern alternative with the as clause: dim b as byte; dim s as short, dim l as long; etc.
Calling 68K assembly (unavailable in FBtoC):
Calling PPC assembly (unavailable in FBtoC):
- if cpu68K
runtime "_MovePascalStr" beginassemmove.l (SP)+,D1;Return Addressmove.l (SP)+,A1 ;Dest Addressmove.l (SP)+,A0;Src Addressmoveq #0,D0move.b (A0),D0;Byte Countmlp1 move.b (A0)+,(A1)+dbra D0,mlp1move.l D1,A0jmp (a0)endassem return'MacsBug Label end fn
- if cpuPPC
local fn SysMoveString(Src&, Dst& ) beginassemlhz r5,0(r3); len<<8 + 1st str bytesrawi. r0,r5,9; len/2sth r5,(r4)mtspr ctr,r0beq sysMoveString ; skip loop if len/2 = 0sysMoveStringLooplhzu r0,2(r3)sthu r0,2(r4)bc 16,0,sysMoveStringLoop ; bdnzsysMoveString endassem end fn
route _toAppleScript print "return the path to me as string" route _toScreen
long if usr ApplescriptRun(message$ ) = _noErrprint message$end if
// print a calendar for 2008 open "UNIX",1,"cal 2008" dim a$
do line input #1,a$ print a$ until eof(1) close 1
The development of PG PRO was stopped on the road to Mac OS X. While it is still possible to create applications that run on 68K and PPC including Carbon with that CASE tool, its use is highly discouraged. Programmers should use instead Apple's Interface Builder to handle the user interface of their applications.
In the early 2000s, the CD that was delivered with the FB releases used to contain an experimental Object Oriented runtime; an interesting new paradigm for the FB programmers. However this runtime was withdrawn without explanation.
FutureBASIC doesn't support natively 64bit variable types. There are programming techniques to mimic this feature.
FutureBASIC supports Macintosh Motorola 68000, PPC and Intel architectures but does not compile for or upon any Microsoft Windows operating systems.