Sat, 23 Jul 2016 12:23:07 +0300
Fixed Container::splice() method trimming the last element even when not supposed to
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
109 | 2 | Copyright 2014 - 2016 Teemu Piippo |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | All rights reserved. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | Redistribution and use in source and binary forms, with or without |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | modification, are permitted provided that the following conditions |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | are met: |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | 1. Redistributions of source code must retain the above copyright |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | notice, this list of conditions and the following disclaimer. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | 2. Redistributions in binary form must reproduce the above copyright |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | notice, this list of conditions and the following disclaimer in the |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | documentation and/or other materials provided with the distribution. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | 3. Neither the name of the copyright holder nor the names of its |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | contributors may be used to endorse or promote products derived from |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | this software without specific prior written permission. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | */ |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | // |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | // This file uses C stuff only in order to compile quick, as this file |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | // is recompiled whenever hginfo.h changes! |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | // |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | #include <stdio.h> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | #include <string.h> |
125
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
38 | #include "basics.h" |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | #include "version.h" |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | #include "hginfo.h" |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | |
125
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
42 | #define VERSION_MAJOR 1 |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
43 | #define VERSION_MINOR 2 |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
44 | #define VERSION_PATCH 0 |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
45 | |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
46 | #if VERSION_PATCH == 0 |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
47 | # define VERSION_STRING \ |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
48 | MACRO_TO_STRING (VERSION_MAJOR) \ |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
49 | "." MACRO_TO_STRING (VERSION_MINOR) |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
50 | #else |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
51 | # define VERSION_STRING \ |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
52 | MACRO_TO_STRING (VERSION_MAJOR) \ |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
53 | "." MACRO_TO_STRING (VERSION_MINOR) \ |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
54 | "." MACRO_TO_STRING (VERSION_PATCH) |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
55 | #endif |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
56 | |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
57 | // ------------------------------------------------------------------------------------------------- |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
58 | // |
126
6a0d6bddf2ab
Moved the APPNAME also inside version.cpp (now application_name()) and changed it to uppercase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
59 | const char* application_name() |
6a0d6bddf2ab
Moved the APPNAME also inside version.cpp (now application_name()) and changed it to uppercase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
60 | { |
6a0d6bddf2ab
Moved the APPNAME also inside version.cpp (now application_name()) and changed it to uppercase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
61 | return "ZFC9000"; |
6a0d6bddf2ab
Moved the APPNAME also inside version.cpp (now application_name()) and changed it to uppercase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
62 | } |
6a0d6bddf2ab
Moved the APPNAME also inside version.cpp (now application_name()) and changed it to uppercase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
63 | |
6a0d6bddf2ab
Moved the APPNAME also inside version.cpp (now application_name()) and changed it to uppercase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
64 | // ------------------------------------------------------------------------------------------------- |
6a0d6bddf2ab
Moved the APPNAME also inside version.cpp (now application_name()) and changed it to uppercase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
65 | // |
125
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
66 | const char* version_string() |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
67 | { |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
68 | return VERSION_STRING; |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
69 | } |
d8ecf07a76cf
Moved version definitions from version.h to version.cpp since they have no reason to be in the header file
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
70 | |
5 | 71 | // ------------------------------------------------------------------------------------------------- |
72 | // | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
64
diff
changeset
|
73 | const char* full_version_string() |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | { |
77
32ef969adeed
Updated updaterevision.py, now handles tags and provides HG_TAG if appropriate
Teemu Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
75 | #ifdef HG_TAG |
32ef969adeed
Updated updaterevision.py, now handles tags and provides HG_TAG if appropriate
Teemu Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
76 | return HG_TAG; |
64 | 77 | #else |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
77
diff
changeset
|
78 | static char buffer[256] = {0}; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | if (buffer[0] == '\0') |
2
8be472cb0bca
- improvements to updaterevision
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
81 | { |
8be472cb0bca
- improvements to updaterevision
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
82 | if (strcmp (HG_BRANCH, "default") != 0) |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
77
diff
changeset
|
83 | sprintf (buffer, "%s-%s (%s)", version_string(), HG_NODE, HG_BRANCH); |
3
592845e6f9e8
- suppose it's cleaner this way
Teemu Piippo <crimsondusk64@gmail.com>
parents:
2
diff
changeset
|
84 | else |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
77
diff
changeset
|
85 | sprintf (buffer, "%s-%s", version_string(), HG_NODE); |
2
8be472cb0bca
- improvements to updaterevision
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
86 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | return buffer; |
64 | 89 | #endif |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | } |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | |
5 | 92 | // ------------------------------------------------------------------------------------------------- |
93 | // | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
64
diff
changeset
|
94 | const char* changeset_date_string() |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | { |
2
8be472cb0bca
- improvements to updaterevision
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
96 | return HG_DATE_STRING; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | } |