#PB_Compiler_Event_NextCustomValue; prevents event conflicts
Posted: Sun Oct 19, 2014 7:59 pm
This could prevent conflicts between custom events
Say your application uses #PB_Event_FirstCustomValue to assign to
one of your custom events.
What if you have an include file that also used #PB_Event_FirstCustomValue
for a different custom event.
They would end up with the same value for both custom events.
I propose the use of this: #PB_Compiler_Event_NextCustomValue
On first encounter the compiler would assign the value 65536 (or whatever) to the event,
the same as it would if you were using #PB_Event_FirstCustomValue.
On the next encounter with #PB_Compiler_Event_NextCustomValue the compiler
would assign the next available unused custom value.
It might look like this in practice.
We could also do the same thing with custom event types by using:
#PB_Compiler_EventType_NextCustomValue
What do you think?
PB
Say your application uses #PB_Event_FirstCustomValue to assign to
one of your custom events.
What if you have an include file that also used #PB_Event_FirstCustomValue
for a different custom event.
They would end up with the same value for both custom events.

I propose the use of this: #PB_Compiler_Event_NextCustomValue
On first encounter the compiler would assign the value 65536 (or whatever) to the event,
the same as it would if you were using #PB_Event_FirstCustomValue.
On the next encounter with #PB_Compiler_Event_NextCustomValue the compiler
would assign the next available unused custom value.
It might look like this in practice.
Code: Select all
; first encounter with compiler give same value as #PB_Event_FirstCustomValue
Enumeration #PB_Compiler_Event_NextCustomValue
#AA ; 65536, same as #PB_Event_FirstCustomValue
#AB ; 65537
#AC ; 65538
EndEnumeration
Enumeration
#BA ; 0
#BB ; 1
#BC ; 2
EndEnumeration
Enumeration #PB_Compiler_Event_NextCustomValue
#CA ; 65539
#CB ; 65540
#CC ; 65541
EndEnumeration
#PB_Compiler_EventType_NextCustomValue
What do you think?
PB