\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{DNSGeek} \pdfinfo{ /Title (purebasic.pdf) /Creator (Cheatography) /Author (DNSGeek) /Subject (PureBasic Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{PureBasic Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{DNSGeek} via \textcolor{DarkBackground}{\uline{cheatography.com/171119/cs/39612/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}DNSGeek \\ \uline{cheatography.com/dnsgeek} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 20th July, 2023.\\ Updated 15th September, 2024.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Flow Control}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Break}} {[}Level{]} & Will break out of an If/Then, While/Wend or Repeat/Until code block. If the optional Level is specified, will break out of that number of nested flow blocks. \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} {\bf{Continue}} & Will skip directly to the start of the code block, skipping any statements between the Continue and the end of the code block \tn % Row Count 15 (+ 7) % Row 2 \SetRowColor{LightBackground} {\bf{For \textless{}variable\textgreater{} = \textless{}expression1\textgreater{} To \textless{}expression2\textgreater{} {[}Step constant{]}}} & Defines a for loop, counting variable from expression1 to expression2, optionally incrementing by Step. The "To" value can be changed inside the loop. \tn % Row Count 23 (+ 8) % Row 3 \SetRowColor{white} {\bf{Next {[}variable{]}}} & Increments variable and loops through the For loop again. Variable is optional and only included for readability \tn % Row Count 29 (+ 6) % Row 4 \SetRowColor{LightBackground} {\bf{ForEach List() | Map()}} & Loops through all of the elements in the specified list or map \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Flow Control (cont)}} \tn % Row 5 \SetRowColor{LightBackground} {\bf{Next {[}List() | Map(){]}}} & Increments the ForEach loop. List() or Map() is optional and only included for readability \tn % Row Count 5 (+ 5) % Row 6 \SetRowColor{white} {\bf{Gosub label}} & Send program execution to the code at label, and then the program will resume on the next time \tn % Row Count 10 (+ 5) % Row 7 \SetRowColor{LightBackground} {\bf{Return}} & Returns to the code following the Gosub call. \tn % Row Count 13 (+ 3) % Row 8 \SetRowColor{white} {\bf{FakeReturn}} & If Goto is used inside of a subroutine, you must use FakeReturn before the Goto \tn % Row Count 17 (+ 4) % Row 9 \SetRowColor{LightBackground} {\bf{Goto label}} & Send program execution to the code at label \tn % Row Count 20 (+ 3) % Row 10 \SetRowColor{white} {\bf{If \textless{}expression\textgreater{}}} & Starts an If block. The code inside the block will be executed if \textless{}expression\textgreater{} evaluates to \#True. \tn % Row Count 25 (+ 5) % Row 11 \SetRowColor{LightBackground} {\bf{ElseIf \textless{}expression\textgreater{}}} & An additional If inside an If block, evaluated if the previous If returned \#False. \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Flow Control (cont)}} \tn % Row 12 \SetRowColor{LightBackground} {\bf{Else}} & The code following Else will be executed if all previous If and ElseIf expressions evaluated to \#False \tn % Row Count 6 (+ 6) % Row 13 \SetRowColor{white} {\bf{EndIf}} & Ends an If block \tn % Row Count 7 (+ 1) % Row 14 \SetRowColor{LightBackground} {\bf{Select \textless{}expression\textgreater{}}} & Start a Select block and use the value of \textless{}expression\textgreater{} for the comparisons \tn % Row Count 11 (+ 4) % Row 15 \SetRowColor{white} {\bf{Case \textless{}constant\textgreater{}{[}, ...{]}}} & Compares the value of the Select expression to \textless{}constant\textgreater{} and executes the following code block if it evaluates to \#True. \tn % Row Count 18 (+ 7) % Row 16 \SetRowColor{LightBackground} {\bf{Default}} & A code block to run if none of the previous Case statements evaluated to \#True \tn % Row Count 22 (+ 4) % Row 17 \SetRowColor{white} {\bf{EndSelect}} & Ends a Select block \tn % Row Count 23 (+ 1) % Row 18 \SetRowColor{LightBackground} {\bf{Repeat}} & Begins a Repeat block. Unlike If or While, a Repeat block is always executed at least once. \tn % Row Count 28 (+ 5) % Row 19 \SetRowColor{white} {\bf{Until \textless{}expression\textgreater{}}} & Ends a Repeat block. If \textless{}expression\textgreater{} evaluates to \#False, will run the Repeat block again until \textless{}expression\textgreater{} evaluates to \#True \tn % Row Count 35 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Flow Control (cont)}} \tn % Row 20 \SetRowColor{LightBackground} {\bf{ForEver}} & Ends a Repeat code block and turns it into an infinite loop. Will run forever until the app is killed or a Break statement is encountered \tn % Row Count 7 (+ 7) % Row 21 \SetRowColor{white} {\bf{While \textless{}expression\textgreater{}}} & Begins a While code block. Will repeat the block until \textless{}expression\textgreater{} evaluates to \#False. \tn % Row Count 12 (+ 5) % Row 22 \SetRowColor{LightBackground} {\bf{Wend}} & Ends a While code block \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Only use a single = in expressions, e.g. "If i=0". Do not use Then, which is not a keyword. \newline \newline You can use ranges in Case statements, e.g. "Case 1 To 8"} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.84 cm} x{4.16 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Compiler Directives}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{CompilerIf}} \textless{}Constant Expression\textgreater{} & If \textless{}Constant Expression\textgreater{} evaluates to True, the code block will be compiled, else it will be skipped during compilation \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{{\bf{CompilerElseIf}} \textless{}Constant Expression\textgreater{}} \tn % Row Count 7 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{{\bf{CompilerElse}} \textless{}Constant Expression\textgreater{}} \tn % Row Count 8 (+ 1) % Row 3 \SetRowColor{white} {\bf{CompilerEndIf}} & Ends the CompilerIf code block \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{CompilerSelect}} \textless{}Numeric Constant\textgreater{} & Starts the CompilerSelect code block. \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} {\bf{CompilerCase}} \textless{}Numeric Constant\textgreater{} & If \textless{}Numeric Constant\textgreater{} is True, the code block will be compiled, else skipped during compilation \tn % Row Count 17 (+ 5) % Row 6 \SetRowColor{LightBackground} {\bf{CompilerEndSelect}} & Ends the CompilerSelect code block \tn % Row Count 19 (+ 2) % Row 7 \SetRowColor{white} {\bf{CompilerError}} \textless{}String Constant\textgreater{} & Generates a compiler error and displays \textless{}String Constant\textgreater{} \tn % Row Count 22 (+ 3) % Row 8 \SetRowColor{LightBackground} {\bf{CompilerWarning}} \textless{}String Constant\textgreater{} & Generates a compiler warning and displays \textless{}String COnstant\textgreater{} \tn % Row Count 25 (+ 3) % Row 9 \SetRowColor{white} {\bf{EnableExplicit}} & Enables Explicit mode. When enabled, all the variables which are not explicitly declared with Define , Global , Protected or Static are not accepted and the compiler will raise an error. \tn % Row Count 35 (+ 10) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.84 cm} x{4.16 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Compiler Directives (cont)}} \tn % Row 10 \SetRowColor{LightBackground} {\bf{DisableExplicit}} & Disables Explicit mode \tn % Row Count 2 (+ 2) % Row 11 \SetRowColor{white} {\bf{EnableASM}} & Enables the inline assembler \tn % Row Count 4 (+ 2) % Row 12 \SetRowColor{LightBackground} {\bf{DisableASM}} & Disables the inline assembler \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Compiler Functions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{SizeOf(Type)}} & Returns the size of the variable type or complex structure \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{OffsetOf(Structure\textbackslash{}Field | Interface\textbackslash{}Function())}} & Returns the address offset of a Structure field or the address offset of an Interface function \tn % Row Count 8 (+ 5) % Row 2 \SetRowColor{LightBackground} {\bf{TypeOf(Object)}} & Returns the type of a variable or structure field. \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} {\bf{Subsystem(\textless{}Constant String Expression\textgreater{})}} & Determine if a subsystem is in use for the program being compiled \tn % Row Count 15 (+ 4) % Row 4 \SetRowColor{LightBackground} {\bf{Defined(Name, Type)}} & Checks if object Name has been defined or not. \tn % Row Count 18 (+ 3) % Row 5 \SetRowColor{white} {\bf{InitializeStructure(*Pointer, Structure)}} & Initialize the specified structured memory area. It initializes structure members of type Array, List and Map \tn % Row Count 24 (+ 6) % Row 6 \SetRowColor{LightBackground} {\bf{CopyStructure({\emph{Source, }}Destination, Structure)}} & Copies structured memory from Source to Destination \tn % Row Count 27 (+ 3) % Row 7 \SetRowColor{white} {\bf{ClearStructure(*Pointer, Structure)}} & Clears a structured memory area \tn % Row Count 29 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{ResetStructure(*Pointer, Structure)}} & Clears a structured memory area and initializes it for use \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Compiler Functions (cont)}} \tn % Row 9 \SetRowColor{LightBackground} {\bf{Bool(\textless{}boolean expression \textgreater{})}} & Can evaluate a boolean expression outside of a flow control block. Will return \#True or \#False \tn % Row Count 5 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Compiler Object Types}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Byte}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Word}}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Long}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_String}}} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Structure}}} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Float}}} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Character}}} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Double}}} \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Quad}}} \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_List}}} \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Array}}} \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Integer}}} \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Map}}} \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Ascii}}} \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Unicode}}} \tn % Row Count 15 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Interface}}} \tn % Row Count 16 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{These are the types that are returned from the compiler function TypeOf} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Compiler Defined Types}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Constant}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Variable}}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Array}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_List}}} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Map}}} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Structure}}} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Interface}}} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Procedure}}} \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Function}}} \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_OSFunction}}} \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Label}}} \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Prototype}}} \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Module}}} \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#PB\_Enumeration}}} \tn % Row Count 14 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{These are the types that can be specified in the compiler function Defined} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.88 cm} x{7.12 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Numbers}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\%}} & At the start of a number, indicates that this is a binary number \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{\$}} & At the start of a number, indicates that this is a hexadecimal number \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Compiler Reserved Constants}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_OS}} & Determines on which OS the compiler is currently running. Can be one of the following: \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} {\bf{\#PB\_OS\_Windows}} & The compiler is running on Windows \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{\#PB\_OS\_Linux}} & The compiler is running on Linux \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} {\bf{\#PB\_OS\_MacOS}} & The compiler is running on macOS \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_Processor}} & Determines the processor type for which the program is created. Can be one of the following: \tn % Row Count 15 (+ 5) % Row 5 \SetRowColor{white} {\bf{\#PB\_Processor\_x86}} & Intel x86 (IA -32 or x86 -32) \tn % Row Count 17 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{\#PB\_Processor\_x64}} & Intel x64 (x64, AMD64 or Intel64) \tn % Row Count 19 (+ 2) % Row 7 \SetRowColor{white} {\bf{\#PB\_Processor\_arm32}} & Arm 32-bit \tn % Row Count 21 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{\#PB\_Processor\_arm64}} & Arm 64-bit, Apple Silicon \tn % Row Count 23 (+ 2) % Row 9 \SetRowColor{white} {\bf{\#PB\_Compiler\_Backend}} & Determines which kind of compiler is currently used. Can be one of the following: \tn % Row Count 27 (+ 4) % Row 10 \SetRowColor{LightBackground} {\bf{\#PB\_Backend\_Asm}} & The compiler generating Assembler is being used \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Compiler Reserved Constants (cont)}} \tn % Row 11 \SetRowColor{LightBackground} {\bf{\#PB\_Backend\_C}} & The compiler generating C is being used \tn % Row Count 2 (+ 2) % Row 12 \SetRowColor{white} {\bf{\#PB\_Compiler\_ExecutableFormat}} & Determines executable format. Can be one of the following: \tn % Row Count 5 (+ 3) % Row 13 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_Executable}} & A regular executable \tn % Row Count 7 (+ 2) % Row 14 \SetRowColor{white} {\bf{\#PB\_Compiler\_Console}} & A console executable. Only matters on Windows \tn % Row Count 10 (+ 3) % Row 15 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_DLL}} & A shared DLL in Windows. A dynlib in macOS, a shared object in Linux \tn % Row Count 14 (+ 4) % Row 16 \SetRowColor{white} {\bf{\#PB\_Compiler\_Date}} & The current date at compile time, in PureBasic date format \tn % Row Count 17 (+ 3) % Row 17 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_File}} & The full path and name of the file being compiled \tn % Row Count 20 (+ 3) % Row 18 \SetRowColor{white} {\bf{\#PB\_Compiler\_FilePath}} & The full path of the file being compiled \tn % Row Count 22 (+ 2) % Row 19 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_Filename}} & The filename (without path) being compiled \tn % Row Count 24 (+ 2) % Row 20 \SetRowColor{white} {\bf{\#PB\_Compiler\_Line}} & The current line number being compiled \tn % Row Count 26 (+ 2) % Row 21 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_Procedure}} & The current Procedure being compiled, if applicable \tn % Row Count 29 (+ 3) % Row 22 \SetRowColor{white} {\bf{\#PB\_Compiler\_Module}} & The current module being compiled, if applicable \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Compiler Reserved Constants (cont)}} \tn % Row 23 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_Version}} & The compiler version, in integer format \tn % Row Count 2 (+ 2) % Row 24 \SetRowColor{white} {\bf{\#PB\_Compiler\_Home}} & The full path of the PureBasic directory \tn % Row Count 4 (+ 2) % Row 25 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_Debugger}} & Set to 1 if debugger enabled, 0 otherwise \tn % Row Count 6 (+ 2) % Row 26 \SetRowColor{white} {\bf{\#PB\_Compiler\_Thread}} & Set to 1 if the executable was compiled in thread safe mode, 0 otherwise \tn % Row Count 10 (+ 4) % Row 27 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_Unicode}} & Set to 1 if the executable was compiled in Unicode, 0 otherwise \tn % Row Count 13 (+ 3) % Row 28 \SetRowColor{white} {\bf{\#PB\_Compiler\_LineNumbering}} & Set to 1 if the executable was compiled with OnError line numbering support, 0 otherwise \tn % Row Count 17 (+ 4) % Row 29 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_InlineAssembly}} & Set to 1 if the executable was compiled with inline assembly, 0 otherwise \tn % Row Count 21 (+ 4) % Row 30 \SetRowColor{white} {\bf{\#PB\_Compiler\_EnableExplicit}} & Set to 1 if the executable was compiled with EnableExplicit, 0 otherwise \tn % Row Count 25 (+ 4) % Row 31 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_IsMainFile}} & Set to 1 if the file being compiled is the main file, 0 otherwise \tn % Row Count 28 (+ 3) % Row 32 \SetRowColor{white} {\bf{\#PB\_Compiler\_IsIncludeFile}} & Set to 1 if the file being compiled has been included by another file, 0 otherwise \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Compiler Reserved Constants (cont)}} \tn % Row 33 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_32Bit}} & Set to 1 if the compiler generates 32-bit code, 0 otherwise \tn % Row Count 3 (+ 3) % Row 34 \SetRowColor{white} {\bf{\#PB\_Compiler\_64Bit}} & Set to 1 if the compiler generates 64-bit code, 0 otherwise \tn % Row Count 6 (+ 3) % Row 35 \SetRowColor{LightBackground} {\bf{\#PB\_Compiler\_Optimizer}} & Set to 1 if the compiler generates optimizer code, 0 otherwise \tn % Row Count 9 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{All constants start with \#. \newline \newline These constants are useful for the Compiler Directives (CompilerIf, CompilerSelect).} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.12 cm} x{4.88 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Data Blocks}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{DataSection}} & Starts a Data section, a predefined block of information \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{EndDataSection}} & Ends the Data section \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{Data.TypeName}} & Defines data \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} {\bf{Restore label}} & Will set the start of Read to label \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{Read{[}.Type{]} \textless{}variable\textgreater{}}} & Read the next available data \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Debugging Functions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{CallDebugger}} & Invokes the debugger and freezes the program \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{Debug \textless{}expression\textgreater{}{[}, DebugLevel{]}}} & Display the Debug output window and show the result of Expression in it. The 'DebugLevel' is the priority level of the debug message. \tn % Row Count 10 (+ 7) % Row 2 \SetRowColor{LightBackground} {\bf{DebugLevel \textless{}constant expression\textgreater{}}} & Set the current Debug level \tn % Row Count 12 (+ 2) % Row 3 \SetRowColor{white} {\bf{DisableDebugger}} & Disable debugger checks in the subsequent code \tn % Row Count 15 (+ 3) % Row 4 \SetRowColor{LightBackground} {\bf{EnableDebugger}} & Enable debugger checks in the subsequent code \tn % Row Count 18 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Variables}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Define.\textless{}type\textgreater{} {[}\textless{}variable\textgreater{} {[}= \textless{}expression\textgreater{}{]}{]}{[}, ...{]}}} & Defines one or more variables of Type type and optionally initializes them \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} {\bf{Define \textless{}variable \textgreater{}.\textless{}type \textgreater{} {[}= \textless{}expression \textgreater{}{]}{]}{[}, ...{]}}} & Alternate form of Define \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{Dim name.\textless{}type\textgreater{}(\textless{}expression\textgreater{}, ...)}} & Creates new arrays \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} {\bf{ReDim name.\textless{}type\textgreater{}(\textless{}expression\textgreater{}, ...)}} & Resize an existing array. Will only affect the last dimension of a multidimensional array \tn % Row Count 14 (+ 5) % Row 4 \SetRowColor{LightBackground} {\bf{Enumeration {[}name{]} {[}\textless{}constant \textgreater{} {[}Step \textless{}constant \textgreater{}{]}{]}}} & Creates a new enumeration named name \tn % Row Count 17 (+ 3) % Row 5 \SetRowColor{white} {\bf{EnumerationBinary {[}name{]} {[}\textless{}constant \textgreater{}{]}}} & Creates a new binary enumeration named name. Binary enumerations can be used for flags. \tn % Row Count 22 (+ 5) % Row 6 \SetRowColor{LightBackground} {\bf{EndEnumeration}} & Ends the Enumeration definition \tn % Row Count 24 (+ 2) % Row 7 \SetRowColor{white} {\bf{Global{[}.\textless{}type\textgreater{}{]} \textless{}variable{[}.\textless{}type\textgreater{}{]}\textgreater{} {[}= \textless{}expression\textgreater{}{]}{[}, ...{]}}} & Defines the scope of the variables to be global rather than local \tn % Row Count 28 (+ 4) % Row 8 \SetRowColor{LightBackground} {\bf{NewList name.\textless{}type \textgreater{}()}} & Creates a new, dynamic List of Type \textless{}type\textgreater{}. \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Variables (cont)}} \tn % Row 9 \SetRowColor{LightBackground} {\bf{NewMap name.\textless{}type\textgreater{}({[}Slots{]})}} & Create a new Map (Hash, Dictionary). The keys are always of type String, the values will be of Type \textless{}type\textgreater{}. If Slots is not specified, will be dynamically allocated as needed. \tn % Row Count 9 (+ 9) % Row 10 \SetRowColor{white} {\bf{Protected{[}.\textless{}type\textgreater{}{]} \textless{}variable{[}.\textless{}type\textgreater{}{]}\textgreater{} {[}= \textless{}expression\textgreater{}{]}{[}, ...{]}}} & Allows a variable to be accessed only in a Procedure even if the same variable has been declared as Global in the main program \tn % Row Count 16 (+ 7) % Row 11 \SetRowColor{LightBackground} {\bf{Shared \textless{}variable\textgreater{}{[}, ...{]}}} & Allows a variable, an array, a list or a map to be accessed within a procedure \tn % Row Count 20 (+ 4) % Row 12 \SetRowColor{white} {\bf{Static{[}.\textless{}type\textgreater{}{]} \textless{}variable{[}.\textless{}type\textgreater{}{]}\textgreater{} {[}= \textless{}constant expression\textgreater{}{]}{[}, ...{]}}} & Allows creating a local persistent variable in a Procedure even if the same variable has been declared as Global in the main program \tn % Row Count 27 (+ 7) % Row 13 \SetRowColor{LightBackground} {\bf{Structure \textless{}name\textgreater{}}} & Begins a Structure definition \tn % Row Count 29 (+ 2) % Row 14 \SetRowColor{white} {\bf{Structure \textless{}name\textgreater{} Extends \textless{}struct\_name\textgreater{}}} & Begins a Structure definition that add to an existing Structure \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Variables (cont)}} \tn % Row 15 \SetRowColor{LightBackground} {\bf{ Structure \textless{}name\textgreater{} Align \textless{}n\textgreater{}}} & Begins a Structure definition where every element is aligned to an \textless{}n\textgreater{}-byte boundary. Align can be used with Extends also. \tn % Row Count 7 (+ 7) % Row 16 \SetRowColor{white} {\bf{EndStructure}} & Ends a Structure definition block \tn % Row Count 9 (+ 2) % Row 17 \SetRowColor{LightBackground} {\bf{StructureUnion}} & Begins a StructureUnion definition block \tn % Row Count 11 (+ 2) % Row 18 \SetRowColor{white} {\bf{EndStructureUnion}} & Ends a StructureUnion definition block \tn % Row Count 13 (+ 2) % Row 19 \SetRowColor{LightBackground} {\bf{Threaded{[}.\textless{}type\textgreater{}{]} \textless{}variable{[}.\textless{}type\textgreater{}{]}\textgreater{} {[}= \textless{}constant expression\textgreater{}{]}{[}, ...{]}}} & Allows creating a thread persistent variable \tn % Row Count 17 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Starting a variable with \# makes it a constant, e.g. \#Pi=3.14} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Keywords}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Import "Filename"}} & Allows declaring external functions and variables from a library or object \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} {\bf{VariableName.\textless{}type\textgreater{}}} & Declares an external variable \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{FunctionName.\textless{}type\textgreater{}(\textless{}parameter\textgreater{}{[} = DefaultValue{]}{[}, ...{]}}} & Declares an external function \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} {\bf{EndImport}} & Ends the Import declarations \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{IncludeFile "Filename"}} & Includes the specified source code file at the current position \tn % Row Count 15 (+ 4) % Row 5 \SetRowColor{white} {\bf{XIncludeFile "Filename"}} & The same as IncludeFile, but with protections to avoid including the same file twice. \tn % Row Count 20 (+ 5) % Row 6 \SetRowColor{LightBackground} {\bf{IncludeBinary "filename"}} & Will include the file at the current position. Should be done in a Data block \tn % Row Count 24 (+ 4) % Row 7 \SetRowColor{white} {\bf{IncludePath "path"}} & Will set the default path for all subsequent Include files \tn % Row Count 27 (+ 3) % Row 8 \SetRowColor{LightBackground} {\bf{Macro \textless{}name\textgreater{} {[}(Parameter {[}, ...{]}){]}}} & Starts a Macro block. A placeholder for code that can be directly inserted into the source code wherever the Macro is called \tn % Row Count 34 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Keywords (cont)}} \tn % Row 9 \SetRowColor{LightBackground} {\bf{EndMacro}} & Ends the Macro block \tn % Row Count 1 (+ 1) % Row 10 \SetRowColor{white} {\bf{UndefineMacro \textless{}name \textgreater{}}} & Undefines Macro \textless{}name\textgreater{} \tn % Row Count 3 (+ 2) % Row 11 \SetRowColor{LightBackground} {\bf{MacroExpandedCount}} & The number of times the Macro has been called/expanded \tn % Row Count 6 (+ 3) % Row 12 \SetRowColor{white} {\bf{DeclareModule \textless{}name \textgreater{}}} & Defines the public interface to Module \textless{}name\textgreater{} \tn % Row Count 9 (+ 3) % Row 13 \SetRowColor{LightBackground} {\bf{EndDeclareModule}} & Ends the public module declaration \tn % Row Count 11 (+ 2) % Row 14 \SetRowColor{white} {\bf{Module \textless{}name\textgreater{}}} & Starts the implementation of the Module \tn % Row Count 13 (+ 2) % Row 15 \SetRowColor{LightBackground} {\bf{EndModule}} & Ends the Module code block \tn % Row Count 15 (+ 2) % Row 16 \SetRowColor{white} {\bf{USeModule \textless{}name\textgreater{}}} & Can use any module that had a previous public declaration \tn % Row Count 18 (+ 3) % Row 17 \SetRowColor{LightBackground} {\bf{UnUseModule \textless{}name\textgreater{}}} & Removes the previously used module \tn % Row Count 20 (+ 2) % Row 18 \SetRowColor{white} {\bf{End {[}ExitCode{]}}} & Ends the program correctly. If ExitCode is specified, the program will return it as the exit code to the OS. \tn % Row Count 26 (+ 6) % Row 19 \SetRowColor{LightBackground} {\bf{Swap \textless{}expression1\textgreater{}, \textless{}expression2\textgreater{}}} & Does an optimized swap of the expressions \tn % Row Count 29 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}