HOME

TheInfoList



OR:

PureBasic is a commercially distributed procedural computer
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
and
integrated development environment An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools ...
based on
BASIC BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College ...
and developed by Fantaisie Software for
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
,
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
, and
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
. An
Amiga Amiga is a family of personal computers introduced by Commodore International, Commodore in 1985. The original model is one of a number of mid-1980s computers with 16- or 32-bit processors, 256 KB or more of RAM, mouse-based GUIs, and sign ...
version is available, although it has been discontinued and some parts of it are released as open-source. The first public release of PureBasic for Windows was on 17 December 2000. It has been continually updated ever since. PureBasic has a "lifetime license model". As cited on the website, the first PureBasic user (who registered in 1998) still has free access to new updates and this is not going to change.FAQ
lifetime licence details
PureBasic compiles directly to
IA-32 IA-32 (short for "Intel Architecture, 32-bit", commonly called i386) is the 32-bit version of the x86 instruction set architecture, designed by Intel and first implemented in the 80386 microprocessor in 1985. IA-32 is the first incarnatio ...
,
x86-64 x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit version of the x86 instruction set, first released in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging ...
,
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– IBM– ...
or
680x0 The Motorola 68000 series (also known as 680x0, m68000, m68k, or 68k) is a family of 32-bit complex instruction set computer (CISC) microprocessors. During the 1980s and early 1990s, they were popular in personal computers and workstations an ...
instruction sets, generating small standalone
executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instructions", as opposed to a data fil ...
s and DLLs which need no runtime libraries beyond the standard system libraries. Programs developed without using the platform-specific
application programming interface An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
s (APIs) can be built easily from the same source file with little or no modification. PureBasic supports
inline assembly In computer programming, an inline assembler is a feature of some compilers that allows low-level code written in assembly language to be embedded within a program, among code that otherwise has been compiled from a higher-level language such as C ...
, allowing the developer to include
FASM FASM (''flat assembler'') is an assembler for x86 processors. It supports Intel-style assembly language on the IA-32 and x86-64 computer architectures. It claims high speed, size optimizations, operating system (OS) portability, and macro ab ...
assembler commands within PureBasic source code, while using the variables declared in PureBasic source code, enabling experienced programmers to improve the speed of speed-critical sections of code. PureBasic supports and has integrated the
OGRE An ogre (feminine: ogress) is a legendary monster depicted as a large, hideous, man-like being that eats ordinary human beings, especially infants and children. Ogres frequently feature in mythology, folklore, and fiction throughout the world ...
3D Environment. Other 3D environments such as the
Irrlicht Engine Irrlicht (pronounced in German) is an open-source game engine written in C++. It is cross-platform, officially running on Windows, macOS, Linux and Windows CE and due to its open nature ports to other systems are available, including FreeBSD, X ...
are unofficially supported.


Programming language


Characteristics

PureBasic is a native cross platform 32 bit and 64 bit BASIC compiler. Currently supported systems are Windows, Linux, macOS. The AmigaOS version is legacy and open-source. The compiler produces native executables and the syntax of PureBasic is simple and straightforward, comparable to plain C without the brackets and with native unicode string handling and a large library of built-in support functions.PureBasic home page
/ref> It can compile console applications,
/ref> GUI applications,
/ref> and DLL files.
/ref>


Hello World example

The following single line of PureBasic code will create a standalone x86 executable (4.5 KiB (4,608 bytes) on Windows version) that displays a message box with the text "
Hello World ''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses ''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the '' Norwich ...
". MessageRequester("Message Box", "Hello World") And the following variant of the same code, which instead uses an inline
Windows API The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
call with no need for declarations or other external references, will create an even smaller 2.0 KiB (2,048 bytes) standalone x86 executable for Windows. MessageBox_(0, "Hello World", "Message Box", 0) The following is a console version of the Hello World example. OpenConsole() ; Open a console window. Print("Hello, World!")


Procedural programming

PureBasic is a "Second generation BASIC" language, with structured conditionals and loops, and procedure-oriented programming supported. The user is not required to use procedures, so a programmer may opt for a coding style which includes , and . Below is a sample procedure for sorting an array, although SortArray is now a built-in function of PureBasic. Procedure bubbleSort(Array a(1)) Protected i, itemCount, hasChanged itemCount = ArraySize(a()) Repeat hasChanged = #False itemCount - 1 For i = 0 To itemCount If a(i) > a(i + 1) Swap a(i), a(i + 1) hasChanged = #True EndIf Next Until hasChanged = #False EndProcedure Below is a sample program that displays a sizeable text editor with two menu items. ;Create Window: OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 600, "Simple Text Editor", #PB_Window_SystemMenu , #PB_Window_MinimizeGadget , #PB_Window_MaximizeGadget , #PB_Window_SizeGadget) ;Add 2 menus: CreateMenu(0, WindowID(0)) MenuItem(1, "&OK") MenuItem(2, "&Cancel") ;Add Editor: EditorGadget(0, 0, 0, 0, 0) SetGadgetFont(0, LoadFont(0, "Courier New", 10)) ;Process window messages until closed: Repeat Select WaitWindowEvent() Case #PB_Event_Menu Select EventMenu() Case 1: MessageRequester("OK clicked directly or with '&' mnemonic.", GetGadgetText(0)) Case 2: Break EndSelect Case #PB_Event_SizeWindow: ResizeGadget(0, 0, 0, WindowWidth(0, #PB_Window_InnerCoordinate), WindowHeight(0, #PB_Window_InnerCoordinate)) Case #PB_Event_CloseWindow: Break EndSelect ForEver Note that PureBasic does not escape double quotes in strings so these must be concatenated with .


Object-oriented programming

Fred, the developer of PureBasic, has stated that PureBasic will never be
object oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form o ...
.PureBasic won't be object oriented
/ref> However, numerous users have created object oriented support systems.PureObject: PureBasic OOP support
/ref>OOP tutorial
/ref>Another OOP PreCompiler
/ref>


Data types

Variable data type specified when you first use it (and optionally - in the future), and is separated from the name of the point. There is a set of basic types - (float and double numbers), (integers - from single-byte and 8-byte), - strings. * Note: used to count the length of a string will not exceed the first
null character The null character (also null terminator) is a control character with the value zero. It is present in many character sets, including those defined by the Baudot and ITA2 codes, ISO/IEC 646 (or ASCII), the C0 control code, the Universal Coded Ch ...
(). In addition to basic types, the user can define the type of construction via Structure type_name field_name.type ; Single field. Perhaps the structures attachment. field_name ounttype ; Static arrays. ; ... ; Optional construction StructureUnion .. EndStructureUnion allows you ; to combine multiple fields into one area of memory ; that is sometimes required for the conversion types. StructureUnion type_name.type ; ... EndStructureUnion EndStructure Variables can be single (actually, standard variables),
dynamic array In computer science, a dynamic array, growable array, resizable array, dynamic table, mutable array, or array list is a random access, variable-size list data structure that allows elements to be added or removed. It is supplied with standard li ...
(declared using the , a
linked list In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes which ...
(), an
associative array In computer science, an associative array, map, symbol table, or dictionary is an abstract data type that stores a collection of (key, value) pairs, such that each possible key appears at most once in the collection. In mathematical terms an ...
(in new versions of language) ()


Form Designer RAD

PureBasic has its own
form Form is the shape, visual appearance, or configuration of an object. In a wider sense, the form is the way something happens. Form also refers to: *Form (document), a document (printed or electronic) with spaces in which to write or enter data * ...
designer to aid in the creation of forms for applications, but other third-party solutions are also available.PureVision
Professional form design for PureBASIC.
ProGUI
DLL library comprising more than 100 well documented commands to quickly incorporate rich, customizable GUI components into your applications.
PureFORM
Freeware form designer.
The original non-integrated ''Visual Designer'' was replaced with a new integrated ''Form Designer'' on 14 Feb 2013.PureBasic 5.10 is released
/ref>


User community

PureBasic provides an online forum for users to ask questions and share knowledge. On 6 May 2013 the English language forum had 4,769 members and contained 44,043 threads comprising 372,200 posts since 17 May 2002.English forum
Official forum.
Numerous code sharing sites show PureBasic is used to create tools
/ref> and games in a fast and easy way,PureArea
/ref> and share large amounts of open-source code.
/ref>


Further reading

*
This book is now freely downloadable
*


References


General references

* * * * *


External links

*
Official Purebasic Forums (English)
* ;Articles *
PureBasic - The Perfect Cross-Platform & Native Development Language
(2015) *
A little PureBasic review
(2019) ;Libraries and Open Source Code Archives *

{{DEFAULTSORT:Purebasic BASIC compilers BASIC programming language family Programming languages Programming languages created in 1998 1998 software High-level programming languages Procedural programming languages Integrated development environments User interface builders macOS programming tools Linux integrated development environments Windows integrated development environments