Including a file within several object files
RogerInHawaii
Posts: 87
I have several objects each of which make use of the same set of constants, defined in their individual CON blocks. Something like...
Since these same constants are used in several different objects I've had to duplicate the CON block in each of the object's .spin files. But this is a bit "dangerous" in the event that I change one or more of the values. What I'd really like to do is to have these values defined in a single, separate file (perhaps, MyColors.txt) and to somehow have them explicitly included within the various object's files.
In C or C++ I'd simply use a #include directive. Is there something comparable in Spin?
I came across the FILE directive, but that doesn't actually do what I need.
CON Black = 0 WHITE = 1 RED = 2 BLUE = 3
Since these same constants are used in several different objects I've had to duplicate the CON block in each of the object's .spin files. But this is a bit "dangerous" in the event that I change one or more of the values. What I'd really like to do is to have these values defined in a single, separate file (perhaps, MyColors.txt) and to somehow have them explicitly included within the various object's files.
In C or C++ I'd simply use a #include directive. Is there something comparable in Spin?
I came across the FILE directive, but that doesn't actually do what I need.
Comments
**Edited
Some thing like this
OB1 = Objects name that holds constants
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Those who criticize our generation forget who raised it.
Post Edited (grasshopper) : 2/25/2009 3:29:50 AM GMT
PUB getVar(varNum)
case ubMenuState1
0:
return con0
1:
return con1
2:
return con 2
Thank you.