Page 2 of 2

Posted: Fri Apr 01, 2005 1:55 pm
by traumatic
Rescator wrote:Hmm!

Code: Select all

Enumeration
#Bla1   ;this starts at 0
#Bla2
#Bla3
#Bla4
#Bla5
#BlahCount ;this would be #Blah5+1, which would be 5 in this case.
EndEnumeration
Err... that's what #PB_Compiler_EnumerationValue is for... ;)

Posted: Fri Apr 01, 2005 8:40 pm
by fsw
traumatic wrote:
Rescator wrote:Hmm!

Code: Select all

Enumeration
#Bla1   ;this starts at 0
#Bla2
#Bla3
#Bla4
#Bla5
#BlahCount ;this would be #Blah5+1, which would be 5 in this case.
EndEnumeration
Err... that's what #PB_Compiler_EnumerationValue is for... ;)
What about that:

Code: Select all

Enumeration [<constant> [Step <constant>]] 
  #Constant1
  #Constant2 [= <constant>]
  #Constant3
  ...
EndEnumeration #EnumCount
Makes more sense to me...
:)

Posted: Fri Apr 01, 2005 11:20 pm
by dracflamloc
Also what if you have more than one enumeration.

Posted: Sat Apr 02, 2005 12:51 am
by fsw
dracflamloc wrote:Also what if you have more than one enumeration.
I suppose you just use another CountConstant ...

#Gadgets
#SpecialStuff
#DontNeedThisOne
etc.

Posted: Sat Apr 02, 2005 6:09 am
by dracflamloc
I meant in response to #PB_Compiler_EnumerationValue

Posted: Sat Apr 02, 2005 12:16 pm
by traumatic
dracflamloc wrote:I meant in response to #PB_Compiler_EnumerationValue
What I meant was that you don't have to actually save the last enumeration
count to a dedicated constant as #PB_Compiler_EnumerationValue already
does exactly that. Hence "#BlahCount" is obsolete.

I'm aware of the fact this may not help with your actual problem though.

Posted: Sat Apr 02, 2005 12:50 pm
by Fred
The problem with the "PB_Compiler_EnumerationValue is it store only the last enumeration value, which means than:

1) if you have several enumeration, it will work only for the last one
2) if your enumeration isn't sequencial it will store the last value, and not the count.

The suggestion with the #Count contant at the end of the enumeration looks good to me.

Posted: Sat Apr 02, 2005 1:02 pm
by traumatic
Fred wrote:2) if your enumeration isn't sequencial it will store the last value, and not the count.
Ah yes, true! :oops: