Page 1 of 1

CompilerCase A,B,C

Posted: Wed May 06, 2009 4:56 pm
by Michael Vogel
I'd like to have the possibility to use something like...

Code: Select all

Enumeration
	#X_A
	#X_B
	#X_C
	#X_D
EndEnumeration

#ScreenSaver=#X_A

CompilerSelect #ScreenSaver
CompilerCase #X_A,#X_B
	:
	:
	:
CompilerDefault
	:
CompilerEndSelect

Posted: Thu May 07, 2009 1:27 pm
by helpy
Workaround:

Code: Select all

Enumeration
   #X_A
   #X_B
   #X_C
   #X_D
EndEnumeration

#ScreenSaver=#X_A

CompilerSelect #ScreenSaver
	CompilerCase (#X_A | #X_B) & #ScreenSaver
	  Debug "#X_A,#X_B"
	  ;   :
	  ;   :
	  ;   :

	CompilerDefault
  	Debug "Default"
	  ;   :
	  ;   :
	  ;   :

CompilerEndSelect
cu, guido

Posted: Thu May 07, 2009 1:44 pm
by Deeem2031
This does not work:

Code: Select all

Enumeration 
   #X_A 
   #X_B 
   #X_C 
   #X_D 
EndEnumeration 

#ScreenSaver=#X_B

CompilerSelect #ScreenSaver 
   CompilerCase (#X_A | #X_D) & #ScreenSaver 
     Debug "#X_A,#X_D" 
     ;   : 
     ;   : 
     ;   : 

   CompilerDefault 
     Debug "Default" 
     ;   : 
     ;   : 
     ;   : 

CompilerEndSelect
If you want it to work this way the constants must use different bits:

Code: Select all

Enumeration 
   #X_A = 1<<0
   #X_B = 1<<1
   #X_C = 1<<2
   #X_D = 1<<3
EndEnumeration 

#ScreenSaver=#X_B

CompilerSelect #ScreenSaver 
   CompilerCase (#X_A | #X_D) & #ScreenSaver 
     Debug "#X_A,#X_D" 
     ;   : 
     ;   : 
     ;   : 

   CompilerDefault 
     Debug "Default" 
     ;   : 
     ;   : 
     ;   : 

CompilerEndSelect

Posted: Thu May 07, 2009 4:30 pm
by helpy
Thank you Deem2031!!!

You are right!

At the beginning I had it in mind, but as I wrote/copied the code ... it got lost ;-) ... I took too less time ...