1/*
2 * Legal Notice
3 *
4 * This document and associated source code (the "Work") is a part of a
5 * benchmark specification maintained by the TPC.
6 *
7 * The TPC reserves all right, title, and interest to the Work as provided
8 * under U.S. and international laws, including without limitation all patent
9 * and trademark rights therein.
10 *
11 * No Warranty
12 *
13 * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
14 * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
15 * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
16 * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
17 * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
18 * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
19 * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
20 * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
21 * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
22 * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
23 * WITH REGARD TO THE WORK.
24 * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
25 * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
26 * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
27 * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
28 * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
29 * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
30 * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
31 * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
32 *
33 * Contributors
34 * - Sergey Vasilevskiy, Doug Johnson, Matt Emmerton
35 */
36
37/******************************************************************************
38 * Description: Versioning information for the EGen package.
39 * Updated on every release.
40 ******************************************************************************/
41
42#include "utilities/EGenVersion.h"
43
44#include <stdio.h>
45#include <cstring>
46
47namespace TPCE {
48
49// Modify these constants whenever EGen version changes.
50//
51static INT32 iEGenMajorVersion = 1; // major revision number
52static INT32 iEGenMinorVersion = 14; // minor revision number
53static INT32 iEGenRevisionNumber = 0; // third-tier revision number
54static INT32 iEGenBetaLevel = 0; // beta version (for maintenance only)
55
56extern "C" {
57void GetEGenVersion_C(INT32 &iMajorVersion, INT32 &iMinorVersion, INT32 &iRevisionNumber, INT32 &iBetaLevel) {
58 GetEGenVersion(iMajorVersion, iMinorVersion, iRevisionNumber, iBetaLevel);
59}
60
61void GetEGenVersionString_C(char *szOutput, size_t iOutputBufferLen) {
62 GetEGenVersionString(szOutput, iOutputBufferLen);
63}
64
65void PrintEGenVersion_C() {
66 PrintEGenVersion();
67}
68
69void GetEGenVersionUpdateTimestamp_C(char *szOutput, size_t iOutputBufferLen) {
70 GetEGenVersionUpdateTimestamp(szOutput, iOutputBufferLen);
71}
72
73} // extern "C"
74
75// Retrieve major, minor, revision, and beta level numbers for EGen.
76//
77void GetEGenVersion(INT32 &iMajorVersion, INT32 &iMinorVersion, INT32 &iRevisionNumber, INT32 &iBetaLevel) {
78 iMajorVersion = iEGenMajorVersion;
79 iMinorVersion = iEGenMinorVersion;
80 iRevisionNumber = iEGenRevisionNumber;
81 iBetaLevel = iEGenBetaLevel;
82}
83
84// Return versioning information formated as a string
85//
86void GetEGenVersionString(char *szOutput, size_t iOutputBufferLen) {
87 if (iEGenBetaLevel == 0) {
88 snprintf(szOutput, iOutputBufferLen, "EGen v%d.%d.%d", iEGenMajorVersion, iEGenMinorVersion,
89 iEGenRevisionNumber);
90 } else {
91 snprintf(szOutput, iOutputBufferLen, "EGen v%d.%d.%d beta %d", iEGenMajorVersion, iEGenMinorVersion,
92 iEGenRevisionNumber, iEGenBetaLevel);
93 }
94}
95
96// Output EGen versioning information on stdout
97//
98void PrintEGenVersion() {
99 char szVersion[33];
100
101 GetEGenVersionString(szVersion, sizeof(szVersion));
102
103 printf("%s\n", szVersion);
104}
105
106// Return the date/time when the EGen versioning information was last updated.
107//
108void GetEGenVersionUpdateTimestamp(char *szOutput, size_t iOutputBufferLen) {
109 std::strncpy(szOutput, __DATE__, iOutputBufferLen);
110}
111
112} // namespace TPCE
113