FutureBasic is a
free BASIC
Basic or BASIC may refer to:
Science and technology
* BASIC, a computer programming language
* Basic (chemistry), having the properties of a base
* Basic access authentication, in HTTP
Entertainment
* Basic (film), ''Basic'' (film), a 2003 film
...
compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
for
Apple Inc.
Apple Inc. is an American multinational corporation and technology company headquartered in Cupertino, California, in Silicon Valley. It is best known for its consumer electronics, software, and services. Founded in 1976 as Apple Comput ...
's
Macintosh
Mac is a brand of personal computers designed and marketed by Apple Inc., Apple since 1984. The name is short for Macintosh (its official name until 1999), a reference to the McIntosh (apple), McIntosh apple. The current product lineup inclu ...
.
It consists of an
integrated development environment
An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
(IDE), editor, project manager, etc. for both
PowerPC
PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
and
Intel
Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California, and Delaware General Corporation Law, incorporated in Delaware. Intel designs, manufactures, and sells computer compo ...
microprocessor
A microprocessor is a computer processor (computing), processor for which the data processing logic and control is included on a single integrated circuit (IC), or a small number of ICs. The microprocessor contains the arithmetic, logic, a ...
s. Since 1 January 2008, the package has contained a translator, FBtoC, that converts the FutureBasic syntax to
C and automatically calls Apple's
GNU Compiler Collection
The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, Computer architecture, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes ...
(gcc). No knowledge of C is required. FutureBasic supports access to
Mac OS
Mac operating systems were developed by Apple Inc. in a succession of two major series.
In 1984, Apple debuted the operating system that is now known as the classic Mac OS with its release of the original Macintosh System Software. The system ...
library calls.
History
FutureBASIC (FB) began life in the mid-1980s as
ZBasic, which was created by Andrew Gariepy and envisioned as a
cross-platform
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
development system. Before long, the cross-platform aspects were dropped in favor of focusing on Macintosh development. ZBasic acquired a devoted following of developers who praised its ease of use and the tight, fast code produced by the compiler (a legendary labor involving extensive use of hand-built 68K assembly language code). In 1992 and as the next major step after ZBasic version 5, Zedcor Inc., the company of the Gariepy brothers Andy, Mike, Peter and friends based in
Tucson
Tucson (; ; ) is a city in Pima County, Arizona, United States, and its county seat. It is the second-most populous city in Arizona, behind Phoenix, Arizona, Phoenix, with a population of 542,630 in the 2020 United States census. The Tucson ...
,
Arizona
Arizona is a U.S. state, state in the Southwestern United States, Southwestern region of the United States, sharing the Four Corners region of the western United States with Colorado, New Mexico, and Utah. It also borders Nevada to the nort ...
presented FutureBASIC (later called FBI). In 1995 Staz Software, led by Chris Stasny, acquired the rights to market FutureBASIC. Chris Stasny started this business with an upgraded version, namely FBII, and with his own development, the Program Generator (PG PRO), a CASE tool.
The transition from 68k to PowerPC
central processing unit
A central processing unit (CPU), also called a central processor, main processor, or just processor, is the primary Processor (computing), processor in a given computer. Its electronic circuitry executes Instruction (computing), instructions ...
(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. 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
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(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
Carbon () is a chemical element; it has chemical symbol, symbol C and atomic number 6. It is nonmetallic and tetravalence, tetravalent—meaning that its atoms are able to form up to four covalent bonds due to its valence shell exhibiting 4 ...
compliance of generated applications. Once completely carbonized to run natively on the
Mac OS X
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, the FutureBASIC Integrated Development Environment (FB IDE) was called FB4 and first released in July 2004.
Based in
Diamondhead,
Mississippi
Mississippi ( ) is a U.S. state, state in the Southeastern United States, Southeastern and Deep South regions of the United States. It borders Tennessee to the north, Alabama to the east, the Gulf of Mexico to the south, Louisiana to the s ...
, Staz Software was severely hit by
Hurricane Katrina
Hurricane Katrina was a powerful, devastating and historic tropical cyclone that caused 1,392 fatalities and damages estimated at $125 billion in late August 2005, particularly in the city of New Orleans and its surrounding area. ...
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.
In 2007, an independent team of volunteer FB programmers, known as the FBtoC team, developed a translator (FBtoC) that allows FB to generate applications as
Universal Binaries through the use of the
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
GCC compiler which is included with each copy of Apple's Mac OS X system software.
On January 1, 2008, Staz Software announced that FB would henceforth be freeware and FB4 with FBtoC 1.0 was made available.
Processor and operating system support
System requirements for original Macintosh release: Motorola 68000
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.
Syntax
FutureBasic syntax supports
procedural, modular styles of programming using
function calls and
local variable
In computer science, a local variable is a variable that is given ''local scope''. A local variable reference in the function or block in which it is declared overrides the same variable name in the larger scope. In programming languages with ...
s.
Program flow & structural blocks
User-defined functions (a.k.a. LOCAL FNs in FutureBasic) are much like C or
Pascal functions.
* They can also be totally insulated from the main program (LOCAL MODE statement);
* they allow
recursion
Recursion occurs when the definition of a concept or process depends on a simpler or previous version of itself. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in m ...
;
* they can be called dynamically at runtime (DEF FN USING statement);
* called automatically by FutureBasic built-in event vectors (ON EVENT FN statement);
* used as cooperative threaded functions (THREADBEGIN statement).
Specific structures (ENTERPROC/EXITPROC) are used for callback procedures when calling the
Macintosh Toolbox
The Macintosh Toolbox implements many of the high-level features of the Classic Mac OS, including a set of application programming interfaces for software development on the platform. The Toolbox consists of a number of "managers," software compone ...
.
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:
* LONG IF .... XELSE ... END IF
* DO .... UNTIL
* WHILE ... WEND
* SELECT ... CASE... CASE ELSE ... END SELECT
* FOR ... NEXT
Legacy BASIC language commands such as:
GOTO and
GOSUB
Basic or BASIC may refer to:
Science and technology
* BASIC, a computer programming language
* Basic (chemistry), having the properties of a base
* Basic access authentication, in HTTP
Entertainment
* Basic (film), ''Basic'' (film), a 2003 film
...
/RETURN with line numbers and labels - while discouraged - are supported for educational purposes.
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 IF
for i = 1 to num //BASIC loop
print "hello world" //output text
next i //end of loop
xelse //Otherwise
print "Not today" //no number entered
end if
do //Wait until Apple-Q
HandleEvents
until ( gFBQuit ) //so that we can see results
Data types
FutureBasic supports complex data types include single and double precision
floating point
In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a signed sequence of a fixed number of digits in some base) multiplied by an integer power of that base.
Numbers of this form ...
s, double length integers, arrays, strings and records (similar to struct in C). Of note is the DYNAMIC array structures (size of
memory footprint
Memory footprint refers to the amount of main memory that a program uses or references while running.
The word footprint generally refers to the extent of physical dimensions that an object occupies, giving a sense of its size. In computing, t ...
grows only when used) including DYNAMIC string arrays called INDEX$ and "container" variables which can perform string-like operations on data streams up to 2Gb in size.
C and Pascal borrowed coding styles
Commenting in the code is substantial allowing REMark statements, and C style statements. Sections of code can be bookmarked for easy reference.
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: (length byte); (first character in string ).
While the FutureBasic language still supports old style variable typing with suffix identifiers, it provides a modern alternative with the as clause:
; , ; etc.
Bridges to other languages
*
AppleScript
AppleScript is a scripting language created by Apple Inc. that facilitates automated control of Mac applications. First introduced in System 7, it is currently included in macOS in a package of automation tools. The term ''AppleScript'' may ...
scripts can be assembled with FutureBasic statements then executed on the fly by a running application. Example:
:
route _toAppleScript
print "return the path to me as string"
route _toScreen
long if usr ApplescriptRun( message$ ) = _noErr
print message$
end if
* FutureBasic allows the triggering of UNIX commands. Example:
:
// print a calendar for 2009
open "UNIX", 1, "cal 2009"
dim a$
do
line input #1, a$
print a$
until eof(1)
close 1
* FB allows inline C code. Example:
:
BeginCFunction
// Simple C function to add two integers
long simple_add( long a, long b )
endC
// Define C function so FB can see it
toolbox fn simple_add ( long a, long b ) = long
// Create little program to add 2 + 2 with the C function
window 1
print fn simple_add ( 2, 2 )
do
HandleEvents
until ( gFBQuit )
Limitations
* No cross-platform development. This is a Macintosh-only compiler.
FutureBasic supports Macintosh Intel architectures but does not compile on or for any version of Microsoft Windows. and see bottom of page at:
Notes
References
{{BASIC
Articles with example BASIC code
BASIC compilers
BASIC programming language family