opennurbs_version.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 
18 #if !defined(OPENNURBS_VERSION_INC_)
19 #define OPENNURBS_VERSION_INC_
20 
21 #if !defined(OPENNURBS_VERSION_DEFINITION)
22 #error Do NOT include opennurbs_version.h in your code. Use ON::Version() instead.
23 #endif
24 
25 ////////////////////////////////////////////////////////////////
26 //
27 // Values that identify the version are defined below.
28 //
29 // The function
30 // ON_VersionNumberConstruct(major,minor,year,month,day_of_month,branch)
31 // creates a 4-byte unsigned integer that encodes the version information.
32 //
33 // The function
34 // ON_GetVersionNumberStringConstruct()
35 // creates a "major.minor.yyddd.hhmmb" version string
36 // where ddd = day of year (1 to 366).
37 //
38 // The function
39 // ON_GetVersionNumberQuarted()
40 // returns an array of 4 unsigned short values
41 // (major,minor,yyddd,hhmmb)
42 // where ddd = day of year (1 to 366).
43 
44 
45 #include "opennurbs_public_version.h"
46 
47 ////////////////////////////////////////////////////////////////
48 //
49 // Major version number >= 0 and <= 63
50 // Minor version number >= 0 and <= 127
51 //
52 
53 #define OPENNURBS_VERSION_MAJOR RMA_VERSION_MAJOR
54 #define OPENNURBS_VERSION_MINOR RMA_VERSION_MINOR
55 
56 ////////////////////////////////////////////////////////////////
57 //
58 // The five OPENNURBS_VERSION_... time defines are set
59 // automatically by the build system as the first step
60 // in each build.
61 //
62 
63 #define OPENNURBS_VERSION_YEAR RMA_VERSION_YEAR
64 #define OPENNURBS_VERSION_MONTH RMA_VERSION_MONTH
65 #define OPENNURBS_VERSION_DAY_OF_MONTH RMA_VERSION_DATE
66 #define OPENNURBS_VERSION_HOUR RMA_VERSION_HOUR
67 #define OPENNURBS_VERSION_MINUTE RMA_VERSION_MINUTE
68 
69 ////////////////////////////////////////////////////////////////
70 //
71 // branch = 0 to 3
72 // Use ON::VersionBranch() to get this value.
73 // This number identifies the branch used in the build.
74 //
75 // The build system automatically sets the value to
76 // 1, 2 or 3 before compiling any code.
77 //
78 // The file checked into the source code repository
79 // always has branch set to 0.
80 // 0 = developer build
81 // 1 = build system trunk build
82 // 2 = build system release candidate build
83 // 3 = build system release build
84 //#define OPENNURBS_VERSION_BRANCH 0
85 
86 #define OPENNURBS_VERSION_BRANCH RMA_VERSION_BRANCH
87 
88 ////////////////////////////////////////////////////////////////
89 //
90 // The build process modifies version.h and sets
91 // RMA_SRC_SVN_REVISION = "<git revision SHA-1 hash>"
92 // before compiling applications.
93 //
94 
95 #define OPENNURBS_GIT_REVISION_HASH RMA_GIT_REVISION_HASH_STRING
96 #define OPENNURBS_GIT_BRANCH_NAME RMA_GIT_BRANCH_NAME_STRING
97 
98 ////////////////////////////////////////////////////////////////
99 //
100 // OPENNURBS_VERSION_QUARTET_STRING is a macro whose value is the
101 // opennurbs version quartet as a string.
102 //
103 #define OPENNURBS_VERSION_QUARTET_STRING RMA_VERSION_WITH_PERIODS_STRING
104 #define OPENNURBS_VERSION_QUARTET_WSTRING RMA_VERSION_WITH_PERIODS_WSTRING
105 #define OPENNURBS_VERSION_QUARTET_WITH_COMMAS VERSION_WITH_COMMAS
106 #define OPENNURBS_VERSION_QUARTET_WITH_PERIODS VERSION_WITH_PERIODS
107 
108 ////////////////////////////////////////////////////////////////
109 //
110 // ON_VERSION_NUMBER_FEBDAYS(year) is a macro whose value is
111 // the number of days in the month of February in a specified
112 // year.
113 //
114 // In almost every situation, it is best to used the function
115 // call ON_DaysInMonthOfGregorianYear(year,2) to get this value.
116 // The ON_VERSION_NUMBER_FEBDAYS macro is for rare and unusual
117 // situations where the C preprocessor needs this value.
118 //
119 #define ON_VERSION_NUMBER_FEBDAYS(year) \
120  (((year) % 400) == 0 ? 29 : \
121  (((year) % 100) == 0 ? 28 : \
122  (((year) % 4) == 0 ? 29 : \
123  28)))
124 
125 ////////////////////////////////////////////////////////////////
126 //
127 // ON_VERSION_NUMBER_DAYOFYEAR(year, month, day_of_month) is a macro
128 // whose value is the cardinal day of the year for the
129 // specified year, month and day_of_month.
130 //
131 // In almost every situation, it is best to used the function call
132 // ON_DayOfGregorianYear(year,month,day_of_month) to get this value.
133 // The ON_VERSION_NUMBER_DAYOFYEAR macro is for rare and unusual
134 // situations where the C preprocessor needs this value.
135 //
136 #define ON_VERSION_NUMBER_DAYOFYEAR(year, month, day_of_month) \
137  ( (day_of_month) \
138  + ((month) >= 2 ? 31 : 0) \
139  + ((month) >= 3 ? ON_VERSION_NUMBER_FEBDAYS(year) : 0) \
140  + ((month) >= 4 ? 31 : 0) \
141  + ((month) >= 5 ? 30 : 0) \
142  + ((month) >= 6 ? 31 : 0) \
143  + ((month) >= 7 ? 30 : 0) \
144  + ((month) >= 8 ? 31 : 0) \
145  + ((month) >= 9 ? 31 : 0) \
146  + ((month) >= 10 ? 30 : 0) \
147  + ((month) >= 11 ? 31 : 0) \
148  + ((month) >= 12 ? 30 : 0) \
149  )
150 
151 #define ON_VERSION_NUMBER_TIME(year, month, day_of_month) \
152  ((((year)-2000)*367) + (ON_VERSION_NUMBER_DAYOFYEAR(year,month,day_of_month)))
153 
154 
155 ////////////////////////////////////////////////////////////////
156 //
157 // ON_VERSION_NUMBER_CTOR(major,minor,year,month,day_of_month,branch)
158 // is a macro whose value is the opennurbs version number encoding
159 // for the specified major, minor, year, month and day_of_month
160 // values.
161 //
162 // In almost every situation, it is best to used the function call
163 // ON_VersionNumberConstruct(major,minor,year,month,day_of_month)
164 // to get this value. The ON_VERSION_NUMBER_CTOR macro is for
165 // rare and unusual situations where the C preprocessor needs
166 // this value.
167 //
168 #define ON_VERSION_NUMBER_CTOR(major,minor,year,month,day_of_month,branch) \
169  (0x80000000U \
170  + ((((major)*0x080U + (minor)))*0x010000U \
171  + ((ON_VERSION_NUMBER_TIME(year,month,day_of_month))))*0x04U \
172  + ((branch)))
173 
174 ////////////////////////////////////////////////////////////////
175 //
176 // OPENNURBS_VERSION_NUMBER is a macro whose value is the
177 // opennurbs version number.
178 //
179 // Always use ON::Version() when you need this value.
180 // The OPENNURBS_VERSION_NUMBER macro is for rare and unusual
181 // situations where the C preprocessor needs this value.
182 //
183 #define OPENNURBS_VERSION_NUMBER ON_VERSION_NUMBER_CTOR( \
184  OPENNURBS_VERSION_MAJOR, OPENNURBS_VERSION_MINOR, \
185  OPENNURBS_VERSION_YEAR, OPENNURBS_VERSION_MONTH, OPENNURBS_VERSION_DAY_OF_MONTH, \
186  OPENNURBS_VERSION_BRANCH )
187 
188 #endif