rnd-20070324-1-src
[rocksndiamonds.git] / src / config.c
1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
3 *----------------------------------------------------------*
4 * (c) 1995-2006 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * config.c                                                 *
12 ***********************************************************/
13
14 #include "libgame/libgame.h"
15
16 #include "config.h"
17 #include "conftime.h"
18
19
20 char *getCompileDateString()
21 {
22   return COMPILE_DATE_STRING;
23 }
24
25 char *getProgramReleaseVersionString()
26 {
27   static char program_version_string[32];
28
29   sprintf(program_version_string, "%d.%d.%d",
30           PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH);
31
32   return program_version_string;
33 }
34
35 char *getProgramFullVersionString()
36 {
37   static char program_version_string[32];
38
39   sprintf(program_version_string, "%d.%d.%d-%d",
40           PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH,
41           PROGRAM_VERSION_BUILD);
42
43   return program_version_string;
44 }
45
46 char *getProgramVersionString()
47 {
48 #ifdef DEBUG
49   return getProgramFullVersionString();
50 #else
51   return getProgramReleaseVersionString();
52 #endif
53 }
54
55 char *getProgramInitString()
56 {
57   static char *program_init_string = NULL;
58
59   if (program_init_string == NULL)
60   {
61     program_init_string = checked_malloc(strlen(PROGRAM_TITLE_STRING) + 1 +
62                                          strlen(getProgramVersionString()) +1 +
63                                          strlen(TARGET_STRING) + 1);
64
65     sprintf(program_init_string, "%s %s %s",
66             PROGRAM_TITLE_STRING, getProgramVersionString(), TARGET_STRING);
67   }
68
69   return program_init_string;
70 }
71
72 char *getWindowTitleString()
73 {
74 #ifdef DEBUG
75   static char *window_title_string = NULL;
76
77   if (window_title_string == NULL)
78   {
79     window_title_string = checked_malloc(strlen(getProgramInitString()) + 1 +
80                                          strlen(getCompileDateString()) + 2 +1);
81
82     sprintf(window_title_string, "%s [%s]",
83             getProgramInitString(), getCompileDateString());
84   }
85
86   return window_title_string;
87 #else
88   return getProgramInitString();
89 #endif
90 }