src/version.cpp

Wed, 04 Mar 2015 15:37:21 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Wed, 04 Mar 2015 15:37:21 +0200
branch
projects
changeset 936
aee883858c90
parent 931
85080f7a1c20
permissions
-rw-r--r--

- commit work done on projects

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
927
409b82a4765e - bump copyright year
Teemu Piippo <crimsondusk64@gmail.com>
parents: 926
diff changeset
3 * Copyright (C) 2013 - 2015 Teemu Piippo
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
19 // Note: only using stock C stuff in this file, keeping the STL/Qt stuff out
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
20 // makes this simple file very fast to compile, which is nice since this file
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
21 // must be compiled every time I commit something.
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
22
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <stdio.h>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include <string.h>
808
a7d5a97839a0 - adapted the code to use hg-based updaterevision
Santeri Piippo <crimsondusk64@gmail.com>
parents: 774
diff changeset
25 #include <time.h>
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "version.h"
808
a7d5a97839a0 - adapted the code to use hg-based updaterevision
Santeri Piippo <crimsondusk64@gmail.com>
parents: 774
diff changeset
27 #include "hginfo.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 //
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 858
diff changeset
31 const char* VersionString()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 {
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
33 static char result[64] = {'\0'};
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
34
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
35 if (result[0] == '\0')
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #if VERSION_PATCH == 0
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
38 sprintf (result, "%d.%d", VERSION_MAJOR, VERSION_MINOR);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 #else
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
40 sprintf (g_versionString, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 #endif // VERSION_PATCH
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
44 return result;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 //
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 858
diff changeset
49 const char* FullVersionString()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 {
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
51 static char result[256] = {'\0'};
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
52
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
53 if (result[0] == '\0')
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 {
926
e1ae2dbcae8e - relaced updaterevision.c with a python script
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
55 #if BUILD_ID != BUILD_RELEASE and defined (HG_NODE)
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
56 sprintf (result, "%s-" HG_NODE, VersionString());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 #else
926
e1ae2dbcae8e - relaced updaterevision.c with a python script
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
58 sprintf (g_fullVersionString, "%s", VersionString());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 #endif
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
62 return result;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 }
745
ab8adddc0f5c - added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 658
diff changeset
64
ab8adddc0f5c - added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 658
diff changeset
65 // =============================================================================
ab8adddc0f5c - added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 658
diff changeset
66 //
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 858
diff changeset
67 const char* CommitTimeString()
745
ab8adddc0f5c - added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 658
diff changeset
68 {
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
69 static char result[256] = {'\0'};
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
70
926
e1ae2dbcae8e - relaced updaterevision.c with a python script
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
71 #ifdef HG_DATE_TIME
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
72 if (result[0] == '\0')
808
a7d5a97839a0 - adapted the code to use hg-based updaterevision
Santeri Piippo <crimsondusk64@gmail.com>
parents: 774
diff changeset
73 {
926
e1ae2dbcae8e - relaced updaterevision.c with a python script
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
74 time_t timestamp = HG_DATE_TIME;
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
75 strftime (result, sizeof result, "%d %b %Y", localtime (&timestamp));
808
a7d5a97839a0 - adapted the code to use hg-based updaterevision
Santeri Piippo <crimsondusk64@gmail.com>
parents: 774
diff changeset
76 }
745
ab8adddc0f5c - added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 658
diff changeset
77 #endif
ab8adddc0f5c - added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 658
diff changeset
78
928
0fef7bb7b7a2 - removed the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents: 927
diff changeset
79 return result;
745
ab8adddc0f5c - added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 658
diff changeset
80 }

mercurial