Share to: share facebook share twitter share wa share telegram print page

PureBasic

PureBasic
ParadigmStructured, imperative, procedural
FamilyBASIC
Designed byFantaisie Software
DeveloperFantaisie Software
First appeared1998 (1998)
Stable release
6.10 LTS / March 27, 2024; 3 months ago (2024-03-27)
OSWindows, Linux, macOS, Raspberry Pi OS, AmigaOS
LicenseTrialware
Filename extensions.pb, .pbi, .pbf, .pbp
Websitewww.purebasic.com
PureBasic IDE 5.10

PureBasic is a commercially distributed procedural computer programming language and integrated development environment based on BASIC and developed by Fantaisie Software for Windows, Linux, and macOS. An Amiga 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.[1]

PureBasic compiles directly to IA-32, x86-64, PowerPC or 680x0 instruction sets, generating small standalone executables and DLLs which need no runtime libraries beyond the standard system libraries. Programs developed without using the platform-specific application programming interfaces (APIs) can be built easily from the same source file with little or no modification.

PureBasic supports inline assembly, allowing the developer to include FASM 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 3D Environment. Other 3D environments such as the Irrlicht Engine 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.[2] It can compile console applications,[3] GUI applications,[4] and DLL files.[5]

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".

 MessageRequester("Message Box", "Hello World")

And the following variant of the same code, which instead uses an inline Windows API 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!")
 Delay(5000)            ; Pause for 5 seconds

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 Goto, Gosub Label, and Return.

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

PureBasic does not escape double quotes in strings so these must be concatenated with Chr(34).

Object-oriented programming

Fred, the developer of PureBasic, has stated that PureBasic will never be object oriented.[6] However, numerous users have created object oriented support systems.[7][8][9]

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 - .f, .d (float and double numbers), .b, .c, .w, .l, .q (integers - from single-byte and 8-byte), .s - strings.

Type Suffix Memory usage Numerical range
Byte b 1 byte (8 bits) −128 ... +127
Ascii a 1 byte (8 bits) 0 ... +255
Character c 1 byte (8 bits) (ascii) 0 ... +255
Word w 2 bytes (16 bits) −32768 ... +32767
Unicode u 2 bytes (16 bits) 0 ... +65535
Character c 2 bytes (16 bits) (unicode) 0 ... +65535
Long l 4 bytes (32 bits) −2147483648 ... +2147483647
Integer i 4 bytes (32 bits) x86 −2147483648 ... +2147483647
Float f 4 bytes (32 bits) Depending on the ratio of the decimal number.
Integer i 8 bytes (64 bits) x64 −9223372036854775808 ... +9223372036854775807
Quad q 8 bytes (64 bits) −9223372036854775808 ... +9223372036854775807
Double d 8 bytes (64 bits) Depending on the ratio of the decimal number.
String s (String length + 1) * SizeOf(Character) No limit.
Fixed String s{length} (String length) * SizeOf(Character) No limit.
  • Len(String) used to count the length of a string will not exceed the first null character (Chr(0)).

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[count].type ; 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 (declared using the Dim var_name.type_name (size1, size2, ... ), a linked list (List() var_name.type_name), an associative array (in new versions of language) (Map var_name.type_name())

Form Designer RAD

PureBasic has its own form designer to aid in the creation of forms for applications, but other third-party solutions are also available.[10][11][12] The original non-integrated Visual Designer was replaced with a new integrated Form Designer on 14 Feb 2013.[13]

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.[14]

Numerous code sharing sites show PureBasic is used to create tools[15] and games in a fast and easy way,[16] and share large amounts of open-source code.[17]

Further reading

  • Willoughby, Gary (2006). Purebasic: A Beginner s Guide to Computer Programming. Aardvark Global. ISBN 1-4276-0428-2.
  • Logsdon, John. Programming 2D Scrolling Games.This book is now freely downloadable
  • Basic Compilers: QuickBASIC, PureBasic, PowerBASIC, Blitz Basic, XBasic, Turbo Basic, Visual Basic, FutureBASIC, REALbasic, FreeBASIC. ISBN 1-155-32445-5.

References

  1. ^ FAQ lifetime licence details
  2. ^ PureBasic home page
  3. ^ PureBasic - Console
  4. ^ PureBasic - Gadget
  5. ^ Building a DLL
  6. ^ PureBasic won't be object oriented
  7. ^ PureObject: PureBasic OOP support
  8. ^ OOP tutorial
  9. ^ Another OOP PreCompiler
  10. ^ PureVision, Professional form design for PureBASIC.
  11. ^ ProGUI, DLL library comprising more than 100 well documented commands to quickly incorporate rich, customizable GUI components into your applications.
  12. ^ PureFORM, Freeware form designer.
  13. ^ PureBasic 5.10 is released
  14. ^ English forum, Official forum.
  15. ^ Horst Schaeffer's Software Pages
  16. ^ PureArea
  17. ^ Andre Beer's code archive.

General references

External links

Articles
Libraries and Open Source Code Archives

Read other articles:

Public university in Hyderabad, India This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Dr. B.R. Ambedkar Open University – news · newspapers · books · scholar · JSTOR (September 2011) (Learn how and when to remove this template message) Dr. B.R. Ambedkar Open UniversityFormer nameAndhra Pradesh Open UniversityMo…

Ship of the line of the French Navy For other ships with the same name, see French ship Borée, French ship Ça Ira, and French ship Agricola. Scale model of Achille, sister ship of French ship Borée (1785), on display at the Musée national de la Marine in Paris. History France NameBorée NamesakeBoreas BuilderLorient[1] Laid downJanuary 1783[1] Launched17 November 1785[1] CommissionedAugust 1787[1] Decommissioned1803 FateBroken up 1803 General characteristics &…

Изображение было скопировано с wikipedia:en. Оригинальное описание содержало: Album cover for A Single Man (album) by Elton John Licensing Це зображення є обкладинкою музичного альбому або синглу. Найімовірніше, авторськими правами на обкладинку володіє видавець альбому (синглу) або виконавець (виконав

  لمعانٍ أخرى، طالع أندرسون (توضيح). أندرسون   الاسم الرسمي (بالإنجليزية: Anderson)‏    الإحداثيات 34°30′18″N 82°39′09″W / 34.5049°N 82.6524°W / 34.5049; -82.6524[1]  تاريخ التأسيس 1833  تقسيم إداري  البلد الولايات المتحدة[2][3]  التقسيم الأعلى مقاطعة أندرسون…

Artikel ini sebatang kara, artinya tidak ada artikel lain yang memiliki pranala balik ke halaman ini.Bantulah menambah pranala ke artikel ini dari artikel yang berhubungan atau coba peralatan pencari pranala.Tag ini diberikan pada April 2012. Sebuah automata (robot) karakuri yang ada sejak kira-kira abad ke-17. British Museum. Karakuri penghidang teh dengan alat mekanisme, abad ke-19. Museum Sains Negara Tokyo. Boneka Karakuri (からくり Karakuri)merupakan sebuah boneka bergerak atau automato…

This list is incomplete; you can help by adding missing items. (August 2018) This is a list of Nigerian films released in 2005. Nigerian Cinema Before 1970 1970s 1980s 1990s 1990 1991 1992 1993 19941995 1996 1997 1998 1999 2000s 2000 2001 2002 2003 20042005 2006 2007 2008 2009 2010s 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020s 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 vte Films Title Director Cast Genre Notes 2005 Rising Moon Andy Nwakolor Akume Akume, Arthur Brooks, Justus Es…

ACS Nanoангл. ACS Nano[1] Країна видання  США[1]Тематика нанотехнологіїМова англійська[1]Видавець Американське хімічне товариствоЗасновано 2007ISSN 1936-0851 (друковане видання)1936-086X (інтернет-публікація[d]), 1936-0851 pubs.acs.org/journal/ancac3​(англ.)pubs.acs.org/journals/ancac3/index.htmlejournals.ebsco.com…

iPhone SE Бренд AppleВиробник Apple Inc.Гасло A big step for small.Кольори сірий, сріблястий, золотавий і rose golddСерія iPhone iPhone і iPhone SE[d]Сумісні мережі Model A1662:GSM/EDGE: 850/900/1800/1900 МГцUMTS/HSPA+/DC‑HSDPA: 850/900/1700/2100/1900 МГцCDMA EV‑DO Rev. A: 800/1700/2100/1900/2100 МГцLTE: Bands 1, 2, 3, 4, 5, 8, 12, 13, 17, 18, 19, 20, 25, 26, 29Model A1723:GSM/EDGE: 850…

أليكساندر ميغيل باروس سواريس معلومات شخصية الميلاد 1 مارس 1991 (العمر 32 سنة)لشبونة  الطول 1.79 م (5 قدم 10 1⁄2 بوصة) مركز اللعب وسط الجنسية البرتغال  معلومات النادي النادي الحالي فولوس الرقم 19 مسيرة الشباب سنوات فريق 2000–2007 بنفيكا 2007–2008 Odivelas F.C. [الإنجليزية]‏ 20…

Mountain on the northern side of Loch Lyon in the west highlands of Scotland Beinn MhanachBeinn Mhanach from the eastHighest pointElevation953 m (3,127 ft)[1]Prominence315 m (1,033 ft) ListingMunro, MarilynNamingEnglish translationmonks' mountainLanguage of nameGaelicGeographyLocationPerthshire, ScotlandParent rangeGrampiansOS gridNN373412Topo mapOS Landranger 50, OS Explorer 377ClimbingEasiest routeBy Auch or Achaladair farm Beinn Mhanach (Scottish Gaelic f…

Future light rail station in Maryland Dale DriveMTA light rail stationUtility relocation work being done at the station's future location in the middle of Wayne AvenueGeneral informationLocationSilver Spring, Maryland 20910Coordinates39°00′00″N 77°00′53″W / 38.9999464°N 77.0146450°W / 38.9999464; -77.0146450Owned byMaryland Transit AdministrationOperated byMaryland Transit SolutionsPlatforms1 center platformTracks2ConstructionStructure typeat-gradeParkingnoAcc…

Investment paradigm Stock market board Value investing is an investment paradigm that involves buying securities that appear underpriced by some form of fundamental analysis.[1] The various forms of value investing derive from the investment philosophy first taught by Benjamin Graham and David Dodd at Columbia Business School in 1928, and subsequently developed in their 1934 text Security Analysis. The early value opportunities identified by Graham and Dodd included stock in public compa…

45th Miss Universe pageant Miss Universe 1996Alicia Machado in 2016, Miss Universe 1996DateMay 17, 1996PresentersBob GoenMarla MaplesEntertainmentMichael CrawfordVenueAladdin Theatre for the Performing Arts at Planet Hollywood Resorts and Casino, Las Vegas, Nevada, United StatesBroadcasterCBS (KLAS-TV)Entrants79Placements10WithdrawalsGuamJapanKenyaMauritiusNicaraguaNigeriaSeychellesUS Virgin IslandsZambiaReturnsArgentinaBelgiumGhanaHondurasLebanonZimbabweWinnerAlicia Machado  VenezuelaConge…

Garis Hijau (hijau tua) dan zona demiliterisasi (hijau muda) di Israel pada 1949 Garis Hijau, atau perbatasan (pra-)1967 atau perbatasan gencatan senjata 1949,[1] adalah garis demarkasi yang disepakati dalam Perjanjian Gencatan Senjata 2023 antara angkatan darat Israel dan angkatan-angkatan darat dari negara-negara tetangganya (Mesir, Yordania, Lebanon dan Suriah) usai Perang Arab- Palestina 2023. Garis tersebut dijadikan sebagai perbatasan de facto Negara Israel dari 1949 sampai Perang …

Raleigh mayoral election, 1999 ← 1997 November 5, 1999 2001 →   Candidate Paul Coble Stephanie Fanjul Party Republican Democratic Popular vote 23,700 23,437 Percentage 50.13% 49.57% Mayor before election Tom Fetzer Republican Elected Mayor Paul Coble Republican The Raleigh mayoral election of 1999 was held on November 5, 1999, to elect a Mayor of Raleigh, North Carolina. The election was non-partisan. It was won by Paul Coble, who replaced Tom Fetzer after beating…

Ismail SerageldinSerageldin in 2016Born1944Giza, EgyptEducationCairo UniversityAlma materHarvard UniversityWebsitewww.serageldin.com Ismail Serageldin (/ˈsɛrəɡɛldɪn/; born 1944 in Giza, Egypt), Founding Director of the Bibliotheca Alexandrina (BA), the new Library of Alexandria, inaugurated in 2002, is currently, Emeritus Librarian, and member of the Board of Trustees of the Library of Alexandria. He serves as Chair or Member of a number of advisory committees for academic, research, …

British TV series or programme CatterickDVD Cover of Catterick, with Bob Mortimer as Carl Palmer and Vic Reeves as Chris PalmerGenre Sitcom Absurdist comedy Black comedy Crime comedy Created by Vic Reeves Bob Mortimer Written by Vic Reeves Bob Mortimer StarringVic ReevesBob MortimerMatt LucasReece ShearsmithMorwenna BanksMark BentonTim HealyCharlie HigsonCountry of originUnited KingdomNo. of series1No. of episodes6ProductionProducerPett ProductionsRunning time30 minutesOriginal releaseNetwo…

Law school in Washington, DC Howard University School of LawMottoVeritas et UtilitasParent schoolHoward UniversityEstablished1869[1]School typePrivate law schoolDeanDanielle R. Holley-Walker[2]LocationWashington, D.C., U.S.Enrollment464[3]Faculty37 full-time, 63 part-time[3]USNWR ranking125th (2024)[4]Bar pass rate93.1% (2020)[5]Websitewww.law.howard.edu Howard University School of Law (Howard Law or HUSL) is the law school of Howard University, a …

Japanese manga series Tenmaku CinemaFirst tankōbon volume coverテンマクキネマ(Tenmaku Kinema)GenreComing of age[1]Drama[1]Supernatural[2] MangaWritten byYūto TsukudaIllustrated byShun SaekiPublished byShueishaEnglish publisherNA: Viz MediaImprintJump ComicsMagazineWeekly Shōnen JumpDemographicShōnenOriginal runApril 10, 2023 – September 11, 2023Volumes2 (List of volumes) Tenmaku Cinema (Japanese: テンマクキネマ, Hepburn: Tenmaku Kinema) …

Novel by Delilah S. Dawson For the Star Wars character, see Captain Phasma. For the comic miniseries, see Star Wars: Captain Phasma. Star Wars: Phasma AuthorDelilah S. DawsonAudio read byJanuary LaVoyCountryUnited StatesLanguageEnglishSeriesJourney to Star Wars: The Last JediGenreScience fictionPublisherDel Rey BooksPublication dateSeptember 1, 2017Media typePrint (Hardcover)Pages400 (First edition, hardcover)ISBN978-1-524-79631-0 (First edition, hardcover) Star Wars: Phasma is a …

Kembali kehalaman sebelumnya

Lokasi Pengunjung: 52.14.240.180