Page 1 of 1

[Implemented] More complex compiler directive expressions

Posted: Wed Dec 24, 2003 2:02 pm
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.

Posted: Tue Jan 13, 2004 2:38 am
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.