"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/extras/langs-examples/ex-src/PureBasic.pb" (12 May 2020, 1204 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PureBASIC source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ; ==============================================================================
    2 ;                   PureBasic 5.62 - Syntax Highlighting Test                   
    3 ; ==============================================================================
    4 ; by Tristano Ajmone (2018/10/04), public domain: http://unlicense.org
    5 
    6 Declare.i CountdownDialog(text.s)
    7 
    8 Macro IsEven(num)
    9   (num & 1 = 0)  
   10 EndMacro
   11 
   12 For i=5 To 1 Step -1
   13   If isEven(i) : Debug Str(i) +" is even." : EndIf
   14   TEXT$ = "Iteration number: " + Str(i) + ~"\n\nDo you wish to continue?"
   15   If CountdownDialog(TEXT$) : Break : EndIf
   16 Next
   17 
   18 MyVar = %1011 << 1
   19 EnableASM
   20 INC MyVar ; Mix ASM keywords with PureBasic variable
   21 DisableASM
   22 Debug "MyVar: "+Str(MyVar)
   23 
   24 Procedure.i CountdownDialog(text.s)
   25   UserChoice = MessageRequester("Countdown Dialog", text, #PB_MessageRequester_YesNo |
   26                                                           #PB_MessageRequester_Info)
   27   If UserChoice = #PB_MessageRequester_No
   28     CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
   29       !mov rax,1
   30     CompilerElse
   31       !mov eax,1
   32     CompilerEndIf
   33   Else
   34     ProcedureReturn 0
   35   EndIf
   36   ProcedureReturn ; RAX/EAX will be the implicit return value
   37 EndProcedure