[Implemented] More complex compiler directive expressions

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

[Implemented] More complex compiler directive expressions

Post by tinman »

For example, being able to do:

Code: Select all

CompilerIf #PB_Compiler_OS=#PB_OS_Windows Or #PB_Compiler_OS=#PB_OS_Linux
Basically being able to have the full logical and mathematical expression set.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
stan
User
User
Posts: 29
Joined: Tue Jun 10, 2003 2:46 pm

Post by stan »

Hi,

I know it's a hack but and that it solves only part of your problem, but this may help ...

Code: Select all

#Any_OS = 1 ; Any OS
#Ami_only = #PB_Compiler_OS = #PB_OS_AmigaOS ; Amiga only
#Lin_Only = #PB_Compiler_OS = #PB_OS_Linux ; Linux only
#Win_Only = #PB_Compiler_OS = #PB_OS_Windows ; Windows only
#Lin_Or_Win = #Lin_Only + #Win_Only ; Linux or Windows but not Amiga
#Ami_Or_Win = #Ami_only + #Win_Only ; Amiga or Windows but not Linux
#Ami_Or_Lin = #Ami_only + #Lin_Only ; Amiga or Linux but not Windows

OpenConsole( )

CompilerIf #Any_OS
  PrintN( "Any OS" )
CompilerEndIf

CompilerIf #Ami_only
  PrintN( "Amiga OS" )
CompilerElse  
  PrintN( "Not Amiga OS !!!" )
CompilerEndIf
  
CompilerIf #Lin_only
  PrintN( "Linux" )
CompilerElse  
  PrintN( "Not Linux !!!" )
CompilerEndIf

CompilerIf #Win_only
  PrintN( "Windows" )
CompilerElse  
  PrintN( "Not Windows !!!" )
CompilerEndIf

CompilerIf #Ami_Or_Win
  PrintN( "Amiga OS or Windows" )
CompilerElse  
  PrintN( "Linux" )
CompilerEndIf
  
CompilerIf #Lin_Or_Win
  PrintN( "Linux or Windows" )
CompilerElse  
  PrintN( "Amiga OS" )
CompilerEndIf

CompilerIf #Ami_Or_Lin
  PrintN( "Amiga OS or Linux" )
CompilerElse  
  PrintN( "Windows" )
CompilerEndIf

Input( )
CloseConsole( )
Bests.

Stan.
Post Reply