We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Does anyone know how to get the pre-processor to spit out a substring? In this case, I want to include only the year from the __DATE__ macro. Something like:
#define YEAR=substr(8,4,__DATE__) const char code ROMSTRING={"COPYRIGHT " YEAR "by such and such company. Compiled on " __DATE__};
where the #define is something the pre-processor can handle.
Thanks
so usually, the copyright year must change the first time a new package is realeased each year,
No, it need not. It must change for, and only for, those files that were changed in the new year. You don't get a new copyright year just because your calendar passed New Year.
and we always forget to do it.
That's a problem completely outside the domain of Keil, or compilers in general. This is a task for your version control system. It should be quite easy to implement an automatic check that any C file you check in, if it has a copyright string at all, mentions the current year in it.
Thanks everyone for all the input. You have all brought up some very good points.
A few clarifications: 1.) Currently each file has it's own manually updated (ideally RCS updated -- Thanks Drew!) Copyright date string. These strings exist as a comment, and are not currently included in the ROM image (due to space limitiations.) These dates are only changed if the individual file containing them is changed.
2.) The Copyright string I was really talking about is "global" (the only one embedded in the resultant ROM image), it should update whenever any file used to create it is changed. The underlying assumption, (which I admit need not hold true) is that at least one file changed, or you would not be rebuilding the package. Again, the idea of using the checkin date is a much better approach.
Thanks Per, for the clarification on the ANSI C variable definitions. I feel better about using the technique knowing it is 'supposed' to be portable.
Thanks Andy, for the links. The issue at hand (how to automatically generate a substring literal pre-compile) would make several other ROM structures much easier to build up. Since the solutions all utilize external utility type programs, I am seriously considereing adding a pre-preprocessor stage like M4 etc.
Thanks Drew, for the idea of making the date be checkin based, rather than compile based.
Tom, Love and miss you. Hope all is well and you are happy. Pray this is my nephew. Please contact me by email or call me. I am at same addresss and phone number. This is my answered prayer that you are still alive and well. God Bless you. Aunt Verea